@blockcerts/blockcerts-verifier 1.54.1 → 1.55.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ie11.js CHANGED
@@ -595,7 +595,7 @@ var KD=IN.suites.LinkedDataSignature,jD=RD.constants.CONTEXT_URL,GD=HD.constants
595
595
  * Released under MIT license <https://lodash.com/license>
596
596
  * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
597
597
  * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
598
- */!function(e,t){(function(){var n,r="Expected a function",o="__lodash_hash_undefined__",a="__lodash_placeholder__",s=32,u=128,l=1/0,A=9007199254740991,c=NaN,h=4294967295,f=[["ary",u],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",p="[object Array]",g="[object Boolean]",v="[object Date]",y="[object Error]",m="[object Function]",w="[object GeneratorFunction]",b="[object Map]",I="[object Number]",B="[object Object]",E="[object Promise]",C="[object RegExp]",x="[object Set]",k="[object String]",S="[object Symbol]",Q="[object WeakMap]",_="[object ArrayBuffer]",N="[object DataView]",D="[object Float32Array]",F="[object Float64Array]",P="[object Int8Array]",U="[object Int16Array]",L="[object Int32Array]",T="[object Uint8Array]",M="[object Uint8ClampedArray]",R="[object Uint16Array]",O="[object Uint32Array]",H=/\b__p \+= '';/g,K=/\b(__p \+=) '' \+/g,j=/(__e\(.*?\)|\b__t\)) \+\n'';/g,G=/&(?:amp|lt|gt|quot|#39);/g,q=/[&<>"']/g,V=RegExp(G.source),z=RegExp(q.source),J=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,X=/<%=([\s\S]+?)%>/g,W=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z=/^\w*$/,$=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ee=/[\\^$.*+?()[\]{}|]/g,te=RegExp(ee.source),ne=/^\s+/,re=/\s/,ie=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,oe=/\{\n\/\* \[wrapped with (.+)\] \*/,ae=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ue=/[()=,{}\[\]\/\s]/,le=/\\(\\)?/g,Ae=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ce=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,fe=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,pe=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,ve=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ye=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",be="a-z\\xdf-\\xf6\\xf8-\\xff",Ie="A-Z\\xc0-\\xd6\\xd8-\\xde",Be="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+Be+"]",Ce="["+we+"]",xe="\\d+",ke="["+be+"]",Se="[^\\ud800-\\udfff"+Be+xe+"\\u2700-\\u27bf"+be+Ie+"]",Qe="\\ud83c[\\udffb-\\udfff]",_e="[^\\ud800-\\udfff]",Ne="(?:\\ud83c[\\udde6-\\uddff]){2}",De="[\\ud800-\\udbff][\\udc00-\\udfff]",Fe="["+Ie+"]",Pe="(?:"+ke+"|"+Se+")",Ue="(?:"+Fe+"|"+Se+")",Le="(?:['’](?:d|ll|m|re|s|t|ve))?",Te="(?:['’](?:D|LL|M|RE|S|T|VE))?",Me="(?:"+Ce+"|"+Qe+")?",Re="[\\ufe0e\\ufe0f]?",Oe=Re+Me+"(?:\\u200d(?:"+[_e,Ne,De].join("|")+")"+Re+Me+")*",He="(?:"+["[\\u2700-\\u27bf]",Ne,De].join("|")+")"+Oe,Ke="(?:"+[_e+Ce+"?",Ce,Ne,De,"[\\ud800-\\udfff]"].join("|")+")",je=RegExp("['’]","g"),Ge=RegExp(Ce,"g"),qe=RegExp(Qe+"(?="+Qe+")|"+Ke+Oe,"g"),Ve=RegExp([Fe+"?"+ke+"+"+Le+"(?="+[Ee,Fe,"$"].join("|")+")",Ue+"+"+Te+"(?="+[Ee,Fe+Pe,"$"].join("|")+")",Fe+"?"+Pe+"+"+Le,Fe+"+"+Te,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",xe,He].join("|"),"g"),ze=RegExp("[\\u200d\\ud800-\\udfff"+we+"\\ufe0e\\ufe0f]"),Je=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ye=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Xe=-1,We={};We[D]=We[F]=We[P]=We[U]=We[L]=We[T]=We[M]=We[R]=We[O]=!0,We[d]=We[p]=We[_]=We[g]=We[N]=We[v]=We[y]=We[m]=We[b]=We[I]=We[B]=We[C]=We[x]=We[k]=We[Q]=!1;var Ze={};Ze[d]=Ze[p]=Ze[_]=Ze[N]=Ze[g]=Ze[v]=Ze[D]=Ze[F]=Ze[P]=Ze[U]=Ze[L]=Ze[b]=Ze[I]=Ze[B]=Ze[C]=Ze[x]=Ze[k]=Ze[S]=Ze[T]=Ze[M]=Ze[R]=Ze[O]=!0,Ze[y]=Ze[m]=Ze[Q]=!1;var $e={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},et=parseFloat,tt=parseInt,nt="object"==i(Do)&&Do&&Do.Object===Object&&Do,rt="object"==("undefined"==typeof self?"undefined":i(self))&&self&&self.Object===Object&&self,it=nt||rt||Function("return this")(),ot=t&&!t.nodeType&&t,at=ot&&e&&!e.nodeType&&e,st=at&&at.exports===ot,ut=st&&nt.process,lt=function(){try{return at&&at.require&&at.require("util").types||ut&&ut.binding&&ut.binding("util")}catch(e){}}(),At=lt&&lt.isArrayBuffer,ct=lt&&lt.isDate,ht=lt&&lt.isMap,ft=lt&&lt.isRegExp,dt=lt&&lt.isSet,pt=lt&&lt.isTypedArray;function gt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function vt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i<o;){var a=e[i];t(r,a,n(a),e)}return r}function yt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function mt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function wt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function bt(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var a=e[n];t(a,n,e)&&(o[i++]=a)}return o}function It(e,t){return!(null==e||!e.length)&&Dt(e,t,0)>-1}function Bt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function Et(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function Ct(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function xt(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}function kt(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function St(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Qt=Lt("length");function _t(e,t,n){var r;return n(e,(function(e,n,i){if(t(e,n,i))return r=n,!1})),r}function Nt(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function Dt(e,t,n){return t==t?function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):Nt(e,Pt,n)}function Ft(e,t,n,r){for(var i=n-1,o=e.length;++i<o;)if(r(e[i],t))return i;return-1}function Pt(e){return e!=e}function Ut(e,t){var n=null==e?0:e.length;return n?Rt(e,t)/n:c}function Lt(e){return function(t){return null==t?n:t[e]}}function Tt(e){return function(t){return null==e?n:e[t]}}function Mt(e,t,n,r,i){return i(e,(function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)})),n}function Rt(e,t){for(var r,i=-1,o=e.length;++i<o;){var a=t(e[i]);a!==n&&(r=r===n?a:r+a)}return r}function Ot(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Ht(e){return e?e.slice(0,on(e)+1).replace(ne,""):e}function Kt(e){return function(t){return e(t)}}function jt(e,t){return Et(t,(function(t){return e[t]}))}function Gt(e,t){return e.has(t)}function qt(e,t){for(var n=-1,r=e.length;++n<r&&Dt(t,e[n],0)>-1;);return n}function Vt(e,t){for(var n=e.length;n--&&Dt(t,e[n],0)>-1;);return n}function zt(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var Jt=Tt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Yt=Tt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Xt(e){return"\\"+$e[e]}function Wt(e){return ze.test(e)}function Zt(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function $t(e,t){return function(n){return e(t(n))}}function en(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var s=e[n];s!==t&&s!==a||(e[n]=a,o[i++]=n)}return o}function tn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function nn(e){return Wt(e)?function(e){for(var t=qe.lastIndex=0;qe.test(e);)++t;return t}(e):Qt(e)}function rn(e){return Wt(e)?function(e){return e.match(qe)||[]}(e):function(e){return e.split("")}(e)}function on(e){for(var t=e.length;t--&&re.test(e.charAt(t)););return t}var an=Tt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),sn=function e(t){var re,we=(t=null==t?it:sn.defaults(it.Object(),t,sn.pick(it,Ye))).Array,be=t.Date,Ie=t.Error,Be=t.Function,Ee=t.Math,Ce=t.Object,xe=t.RegExp,ke=t.String,Se=t.TypeError,Qe=we.prototype,_e=Be.prototype,Ne=Ce.prototype,De=t["__core-js_shared__"],Fe=_e.toString,Pe=Ne.hasOwnProperty,Ue=0,Le=(re=/[^.]+$/.exec(De&&De.keys&&De.keys.IE_PROTO||""))?"Symbol(src)_1."+re:"",Te=Ne.toString,Me=Fe.call(Ce),Re=it._,Oe=xe("^"+Fe.call(Pe).replace(ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),He=st?t.Buffer:n,Ke=t.Symbol,qe=t.Uint8Array,ze=He?He.allocUnsafe:n,$e=$t(Ce.getPrototypeOf,Ce),nt=Ce.create,rt=Ne.propertyIsEnumerable,ot=Qe.splice,at=Ke?Ke.isConcatSpreadable:n,ut=Ke?Ke.iterator:n,lt=Ke?Ke.toStringTag:n,Qt=function(){try{var e=lo(Ce,"defineProperty");return e({},"",{}),e}catch(e){}}(),Tt=t.clearTimeout!==it.clearTimeout&&t.clearTimeout,un=be&&be.now!==it.Date.now&&be.now,ln=t.setTimeout!==it.setTimeout&&t.setTimeout,An=Ee.ceil,cn=Ee.floor,hn=Ce.getOwnPropertySymbols,fn=He?He.isBuffer:n,dn=t.isFinite,pn=Qe.join,gn=$t(Ce.keys,Ce),vn=Ee.max,yn=Ee.min,mn=be.now,wn=t.parseInt,bn=Ee.random,In=Qe.reverse,Bn=lo(t,"DataView"),En=lo(t,"Map"),Cn=lo(t,"Promise"),xn=lo(t,"Set"),kn=lo(t,"WeakMap"),Sn=lo(Ce,"create"),Qn=kn&&new kn,_n={},Nn=To(Bn),Dn=To(En),Fn=To(Cn),Pn=To(xn),Un=To(kn),Ln=Ke?Ke.prototype:n,Tn=Ln?Ln.valueOf:n,Mn=Ln?Ln.toString:n;function Rn(e){if(es(e)&&!ja(e)&&!(e instanceof jn)){if(e instanceof Kn)return e;if(Pe.call(e,"__wrapped__"))return Mo(e)}return new Kn(e)}var On=function(){function e(){}return function(t){if(!$a(t))return{};if(nt)return nt(t);e.prototype=t;var r=new e;return e.prototype=n,r}}();function Hn(){}function Kn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=n}function jn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Gn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function qn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Vn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function zn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Vn;++t<n;)this.add(e[t])}function Jn(e){var t=this.__data__=new qn(e);this.size=t.size}function Yn(e,t){var n=ja(e),r=!n&&Ka(e),i=!n&&!r&&za(e),o=!n&&!r&&!i&&us(e),a=n||r||i||o,s=a?Ot(e.length,ke):[],u=s.length;for(var l in e)!t&&!Pe.call(e,l)||a&&("length"==l||i&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||vo(l,u))||s.push(l);return s}function Xn(e){var t=e.length;return t?e[Vr(0,t-1)]:n}function Wn(e,t){return Po(ki(e),ar(t,0,e.length))}function Zn(e){return Po(ki(e))}function $n(e,t,r){(r!==n&&!Ra(e[t],r)||r===n&&!(t in e))&&ir(e,t,r)}function er(e,t,r){var i=e[t];Pe.call(e,t)&&Ra(i,r)&&(r!==n||t in e)||ir(e,t,r)}function tr(e,t){for(var n=e.length;n--;)if(Ra(e[n][0],t))return n;return-1}function nr(e,t,n,r){return cr(e,(function(e,i,o){t(r,e,n(e),o)})),r}function rr(e,t){return e&&Si(t,_s(t),e)}function ir(e,t,n){"__proto__"==t&&Qt?Qt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function or(e,t){for(var r=-1,i=t.length,o=we(i),a=null==e;++r<i;)o[r]=a?n:Cs(e,t[r]);return o}function ar(e,t,r){return e==e&&(r!==n&&(e=e<=r?e:r),t!==n&&(e=e>=t?e:t)),e}function sr(e,t,r,i,o,a){var s,u=1&t,l=2&t,A=4&t;if(r&&(s=o?r(e,i,o,a):r(e)),s!==n)return s;if(!$a(e))return e;var c=ja(e);if(c){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Pe.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!u)return ki(e,s)}else{var h=ho(e),f=h==m||h==w;if(za(e))return bi(e,u);if(h==B||h==d||f&&!o){if(s=l||f?{}:po(e),!u)return l?function(e,t){return Si(e,co(e),t)}(e,function(e,t){return e&&Si(t,Ns(t),e)}(s,e)):function(e,t){return Si(e,Ao(e),t)}(e,rr(s,e))}else{if(!Ze[h])return o?e:{};s=function(e,t,n){var r,i=e.constructor;switch(t){case _:return Ii(e);case g:case v:return new i(+e);case N:return function(e,t){var n=t?Ii(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case D:case F:case P:case U:case L:case T:case M:case R:case O:return Bi(e,n);case b:return new i;case I:case k:return new i(e);case C:return function(e){var t=new e.constructor(e.source,ce.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case S:return r=e,Tn?Ce(Tn.call(r)):{}}}(e,h,u)}}a||(a=new Jn);var p=a.get(e);if(p)return p;a.set(e,s),os(e)?e.forEach((function(n){s.add(sr(n,t,r,n,e,a))})):ts(e)&&e.forEach((function(n,i){s.set(i,sr(n,t,r,i,e,a))}));var y=c?n:(A?l?no:to:l?Ns:_s)(e);return yt(y||e,(function(n,i){y&&(n=e[i=n]),er(s,i,sr(n,t,r,i,e,a))})),s}function ur(e,t,r){var i=r.length;if(null==e)return!i;for(e=Ce(e);i--;){var o=r[i],a=t[o],s=e[o];if(s===n&&!(o in e)||!a(s))return!1}return!0}function lr(e,t,i){if("function"!=typeof e)throw new Se(r);return _o((function(){e.apply(n,i)}),t)}function Ar(e,t,n,r){var i=-1,o=It,a=!0,s=e.length,u=[],l=t.length;if(!s)return u;n&&(t=Et(t,Kt(n))),r?(o=Bt,a=!1):t.length>=200&&(o=Gt,a=!1,t=new zn(t));e:for(;++i<s;){var A=e[i],c=null==n?A:n(A);if(A=r||0!==A?A:0,a&&c==c){for(var h=l;h--;)if(t[h]===c)continue e;u.push(A)}else o(t,c,r)||u.push(A)}return u}Rn.templateSettings={escape:J,evaluate:Y,interpolate:X,variable:"",imports:{_:Rn}},Rn.prototype=Hn.prototype,Rn.prototype.constructor=Rn,Kn.prototype=On(Hn.prototype),Kn.prototype.constructor=Kn,jn.prototype=On(Hn.prototype),jn.prototype.constructor=jn,Gn.prototype.clear=function(){this.__data__=Sn?Sn(null):{},this.size=0},Gn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Gn.prototype.get=function(e){var t=this.__data__;if(Sn){var r=t[e];return r===o?n:r}return Pe.call(t,e)?t[e]:n},Gn.prototype.has=function(e){var t=this.__data__;return Sn?t[e]!==n:Pe.call(t,e)},Gn.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Sn&&t===n?o:t,this},qn.prototype.clear=function(){this.__data__=[],this.size=0},qn.prototype.delete=function(e){var t=this.__data__,n=tr(t,e);return!(n<0||(n==t.length-1?t.pop():ot.call(t,n,1),--this.size,0))},qn.prototype.get=function(e){var t=this.__data__,r=tr(t,e);return r<0?n:t[r][1]},qn.prototype.has=function(e){return tr(this.__data__,e)>-1},qn.prototype.set=function(e,t){var n=this.__data__,r=tr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Vn.prototype.clear=function(){this.size=0,this.__data__={hash:new Gn,map:new(En||qn),string:new Gn}},Vn.prototype.delete=function(e){var t=so(this,e).delete(e);return this.size-=t?1:0,t},Vn.prototype.get=function(e){return so(this,e).get(e)},Vn.prototype.has=function(e){return so(this,e).has(e)},Vn.prototype.set=function(e,t){var n=so(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},zn.prototype.add=zn.prototype.push=function(e){return this.__data__.set(e,o),this},zn.prototype.has=function(e){return this.__data__.has(e)},Jn.prototype.clear=function(){this.__data__=new qn,this.size=0},Jn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Jn.prototype.get=function(e){return this.__data__.get(e)},Jn.prototype.has=function(e){return this.__data__.has(e)},Jn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof qn){var r=n.__data__;if(!En||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Vn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ni(mr),hr=Ni(wr,!0);function fr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function dr(e,t,r){for(var i=-1,o=e.length;++i<o;){var a=e[i],s=t(a);if(null!=s&&(u===n?s==s&&!ss(s):r(s,u)))var u=s,l=a}return l}function pr(e,t){var n=[];return cr(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n}function gr(e,t,n,r,i){var o=-1,a=e.length;for(n||(n=go),i||(i=[]);++o<a;){var s=e[o];t>0&&n(s)?t>1?gr(s,t-1,n,r,i):Ct(i,s):r||(i[i.length]=s)}return i}var vr=Di(),yr=Di(!0);function mr(e,t){return e&&vr(e,t,_s)}function wr(e,t){return e&&yr(e,t,_s)}function br(e,t){return bt(t,(function(t){return Xa(e[t])}))}function Ir(e,t){for(var r=0,i=(t=vi(t,e)).length;null!=e&&r<i;)e=e[Lo(t[r++])];return r&&r==i?e:n}function Br(e,t,n){var r=t(e);return ja(e)?r:Ct(r,n(e))}function Er(e){return null==e?e===n?"[object Undefined]":"[object Null]":lt&&lt in Ce(e)?function(e){var t=Pe.call(e,lt),r=e[lt];try{e[lt]=n;var i=!0}catch(e){}var o=Te.call(e);return i&&(t?e[lt]=r:delete e[lt]),o}(e):function(e){return Te.call(e)}(e)}function Cr(e,t){return e>t}function xr(e,t){return null!=e&&Pe.call(e,t)}function kr(e,t){return null!=e&&t in Ce(e)}function Sr(e,t,r){for(var i=r?Bt:It,o=e[0].length,a=e.length,s=a,u=we(a),l=1/0,A=[];s--;){var c=e[s];s&&t&&(c=Et(c,Kt(t))),l=yn(c.length,l),u[s]=!r&&(t||o>=120&&c.length>=120)?new zn(s&&c):n}c=e[0];var h=-1,f=u[0];e:for(;++h<o&&A.length<l;){var d=c[h],p=t?t(d):d;if(d=r||0!==d?d:0,!(f?Gt(f,p):i(A,p,r))){for(s=a;--s;){var g=u[s];if(!(g?Gt(g,p):i(e[s],p,r)))continue e}f&&f.push(p),A.push(d)}}return A}function Qr(e,t,r){var i=null==(e=xo(e,t=vi(t,e)))?e:e[Lo(Yo(t))];return null==i?n:gt(i,e,r)}function _r(e){return es(e)&&Er(e)==d}function Nr(e,t,r,i,o){return e===t||(null==e||null==t||!es(e)&&!es(t)?e!=e&&t!=t:function(e,t,r,i,o,a){var s=ja(e),u=ja(t),l=s?p:ho(e),A=u?p:ho(t),c=(l=l==d?B:l)==B,h=(A=A==d?B:A)==B,f=l==A;if(f&&za(e)){if(!za(t))return!1;s=!0,c=!1}if(f&&!c)return a||(a=new Jn),s||us(e)?$i(e,t,r,i,o,a):function(e,t,n,r,i,o,a){switch(n){case N:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case _:return!(e.byteLength!=t.byteLength||!o(new qe(e),new qe(t)));case g:case v:case I:return Ra(+e,+t);case y:return e.name==t.name&&e.message==t.message;case C:case k:return e==t+"";case b:var s=Zt;case x:var u=1&r;if(s||(s=tn),e.size!=t.size&&!u)return!1;var l=a.get(e);if(l)return l==t;r|=2,a.set(e,t);var A=$i(s(e),s(t),r,i,o,a);return a.delete(e),A;case S:if(Tn)return Tn.call(e)==Tn.call(t)}return!1}(e,t,l,r,i,o,a);if(!(1&r)){var m=c&&Pe.call(e,"__wrapped__"),w=h&&Pe.call(t,"__wrapped__");if(m||w){var E=m?e.value():e,Q=w?t.value():t;return a||(a=new Jn),o(E,Q,r,i,a)}}return!!f&&(a||(a=new Jn),function(e,t,r,i,o,a){var s=1&r,u=to(e),l=u.length;if(l!=to(t).length&&!s)return!1;for(var A=l;A--;){var c=u[A];if(!(s?c in t:Pe.call(t,c)))return!1}var h=a.get(e),f=a.get(t);if(h&&f)return h==t&&f==e;var d=!0;a.set(e,t),a.set(t,e);for(var p=s;++A<l;){var g=e[c=u[A]],v=t[c];if(i)var y=s?i(v,g,c,t,e,a):i(g,v,c,e,t,a);if(!(y===n?g===v||o(g,v,r,i,a):y)){d=!1;break}p||(p="constructor"==c)}if(d&&!p){var m=e.constructor,w=t.constructor;m==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof m&&m instanceof m&&"function"==typeof w&&w instanceof w||(d=!1)}return a.delete(e),a.delete(t),d}(e,t,r,i,o,a))}(e,t,r,i,Nr,o))}function Dr(e,t,r,i){var o=r.length,a=o,s=!i;if(null==e)return!a;for(e=Ce(e);o--;){var u=r[o];if(s&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++o<a;){var l=(u=r[o])[0],A=e[l],c=u[1];if(s&&u[2]){if(A===n&&!(l in e))return!1}else{var h=new Jn;if(i)var f=i(A,c,l,e,t,h);if(!(f===n?Nr(c,A,3,i,h):f))return!1}}return!0}function Fr(e){return!(!$a(e)||(t=e,Le&&Le in t))&&(Xa(e)?Oe:de).test(To(e));var t}function Pr(e){return"function"==typeof e?e:null==e?nu:"object"==i(e)?ja(e)?Rr(e[0],e[1]):Mr(e):cu(e)}function Ur(e){if(!Io(e))return gn(e);var t=[];for(var n in Ce(e))Pe.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Lr(e,t){return e<t}function Tr(e,t){var n=-1,r=qa(e)?we(e.length):[];return cr(e,(function(e,i,o){r[++n]=t(e,i,o)})),r}function Mr(e){var t=uo(e);return 1==t.length&&t[0][2]?Eo(t[0][0],t[0][1]):function(n){return n===e||Dr(n,e,t)}}function Rr(e,t){return mo(e)&&Bo(t)?Eo(Lo(e),t):function(r){var i=Cs(r,e);return i===n&&i===t?xs(r,e):Nr(t,i,3)}}function Or(e,t,r,i,o){e!==t&&vr(t,(function(a,s){if(o||(o=new Jn),$a(a))!function(e,t,r,i,o,a,s){var u=So(e,r),l=So(t,r),A=s.get(l);if(A)$n(e,r,A);else{var c=a?a(u,l,r+"",e,t,s):n,h=c===n;if(h){var f=ja(l),d=!f&&za(l),p=!f&&!d&&us(l);c=l,f||d||p?ja(u)?c=u:Va(u)?c=ki(u):d?(h=!1,c=bi(l,!0)):p?(h=!1,c=Bi(l,!0)):c=[]:rs(l)||Ka(l)?(c=u,Ka(u)?c=gs(u):$a(u)&&!Xa(u)||(c=po(l))):h=!1}h&&(s.set(l,c),o(c,l,i,a,s),s.delete(l)),$n(e,r,c)}}(e,t,s,r,Or,i,o);else{var u=i?i(So(e,s),a,s+"",e,t,o):n;u===n&&(u=a),$n(e,s,u)}}),Ns)}function Hr(e,t){var r=e.length;if(r)return vo(t+=t<0?r:0,r)?e[t]:n}function Kr(e,t,n){t=t.length?Et(t,(function(e){return ja(e)?function(t){return Ir(t,1===e.length?e[0]:e)}:e})):[nu];var r=-1;t=Et(t,Kt(ao()));var i=Tr(e,(function(e,n,i){var o=Et(t,(function(t){return t(e)}));return{criteria:o,index:++r,value:e}}));return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(i,(function(e,t){return function(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,a=i.length,s=n.length;++r<a;){var u=Ei(i[r],o[r]);if(u)return r>=s?u:u*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function jr(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var a=t[r],s=Ir(e,a);n(s,a)&&Wr(o,vi(a,e),s)}return o}function Gr(e,t,n,r){var i=r?Ft:Dt,o=-1,a=t.length,s=e;for(e===t&&(t=ki(t)),n&&(s=Et(e,Kt(n)));++o<a;)for(var u=0,l=t[o],A=n?n(l):l;(u=i(s,A,u,r))>-1;)s!==e&&ot.call(s,u,1),ot.call(e,u,1);return e}function qr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?ot.call(e,i,1):li(e,i)}}return e}function Vr(e,t){return e+cn(bn()*(t-e+1))}function zr(e,t){var n="";if(!e||t<1||t>A)return n;do{t%2&&(n+=e),(t=cn(t/2))&&(e+=e)}while(t);return n}function Jr(e,t){return No(Co(e,t,nu),e+"")}function Yr(e){return Xn(Rs(e))}function Xr(e,t){var n=Rs(e);return Po(n,ar(t,0,n.length))}function Wr(e,t,r,i){if(!$a(e))return e;for(var o=-1,a=(t=vi(t,e)).length,s=a-1,u=e;null!=u&&++o<a;){var l=Lo(t[o]),A=r;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(o!=s){var c=u[l];(A=i?i(c,l,u):n)===n&&(A=$a(c)?c:vo(t[o+1])?[]:{})}er(u,l,A),u=u[l]}return e}var Zr=Qn?function(e,t){return Qn.set(e,t),e}:nu,$r=Qt?function(e,t){return Qt(e,"toString",{configurable:!0,enumerable:!1,value:$s(t),writable:!0})}:nu;function ei(e){return Po(Rs(e))}function ti(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=we(i);++r<i;)o[r]=e[r+t];return o}function ni(e,t){var n;return cr(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n}function ri(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var o=r+i>>>1,a=e[o];null!==a&&!ss(a)&&(n?a<=t:a<t)?r=o+1:i=o}return i}return ii(e,t,nu,n)}function ii(e,t,r,i){var o=0,a=null==e?0:e.length;if(0===a)return 0;for(var s=(t=r(t))!=t,u=null===t,l=ss(t),A=t===n;o<a;){var c=cn((o+a)/2),h=r(e[c]),f=h!==n,d=null===h,p=h==h,g=ss(h);if(s)var v=i||p;else v=A?p&&(i||f):u?p&&f&&(i||!d):l?p&&f&&!d&&(i||!g):!d&&!g&&(i?h<=t:h<t);v?o=c+1:a=c}return yn(a,4294967294)}function oi(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var a=e[n],s=t?t(a):a;if(!n||!Ra(s,u)){var u=s;o[i++]=0===a?0:a}}return o}function ai(e){return"number"==typeof e?e:ss(e)?c:+e}function si(e){if("string"==typeof e)return e;if(ja(e))return Et(e,si)+"";if(ss(e))return Mn?Mn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ui(e,t,n){var r=-1,i=It,o=e.length,a=!0,s=[],u=s;if(n)a=!1,i=Bt;else if(o>=200){var l=t?null:zi(e);if(l)return tn(l);a=!1,i=Gt,u=new zn}else u=t?[]:s;e:for(;++r<o;){var A=e[r],c=t?t(A):A;if(A=n||0!==A?A:0,a&&c==c){for(var h=u.length;h--;)if(u[h]===c)continue e;t&&u.push(c),s.push(A)}else i(u,c,n)||(u!==s&&u.push(c),s.push(A))}return s}function li(e,t){return null==(e=xo(e,t=vi(t,e)))||delete e[Lo(Yo(t))]}function Ai(e,t,n,r){return Wr(e,t,n(Ir(e,t)),r)}function ci(e,t,n,r){for(var i=e.length,o=r?i:-1;(r?o--:++o<i)&&t(e[o],o,e););return n?ti(e,r?0:o,r?o+1:i):ti(e,r?o+1:0,r?i:o)}function hi(e,t){var n=e;return n instanceof jn&&(n=n.value()),xt(t,(function(e,t){return t.func.apply(t.thisArg,Ct([e],t.args))}),n)}function fi(e,t,n){var r=e.length;if(r<2)return r?ui(e[0]):[];for(var i=-1,o=we(r);++i<r;)for(var a=e[i],s=-1;++s<r;)s!=i&&(o[i]=Ar(o[i]||a,e[s],t,n));return ui(gr(o,1),t,n)}function di(e,t,r){for(var i=-1,o=e.length,a=t.length,s={};++i<o;){var u=i<a?t[i]:n;r(s,e[i],u)}return s}function pi(e){return Va(e)?e:[]}function gi(e){return"function"==typeof e?e:nu}function vi(e,t){return ja(e)?e:mo(e,t)?[e]:Uo(vs(e))}var yi=Jr;function mi(e,t,r){var i=e.length;return r=r===n?i:r,!t&&r>=i?e:ti(e,t,r)}var wi=Tt||function(e){return it.clearTimeout(e)};function bi(e,t){if(t)return e.slice();var n=e.length,r=ze?ze(n):new e.constructor(n);return e.copy(r),r}function Ii(e){var t=new e.constructor(e.byteLength);return new qe(t).set(new qe(e)),t}function Bi(e,t){var n=t?Ii(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ei(e,t){if(e!==t){var r=e!==n,i=null===e,o=e==e,a=ss(e),s=t!==n,u=null===t,l=t==t,A=ss(t);if(!u&&!A&&!a&&e>t||a&&s&&l&&!u&&!A||i&&s&&l||!r&&l||!o)return 1;if(!i&&!a&&!A&&e<t||A&&r&&o&&!i&&!a||u&&r&&o||!s&&o||!l)return-1}return 0}function Ci(e,t,n,r){for(var i=-1,o=e.length,a=n.length,s=-1,u=t.length,l=vn(o-a,0),A=we(u+l),c=!r;++s<u;)A[s]=t[s];for(;++i<a;)(c||i<o)&&(A[n[i]]=e[i]);for(;l--;)A[s++]=e[i++];return A}function xi(e,t,n,r){for(var i=-1,o=e.length,a=-1,s=n.length,u=-1,l=t.length,A=vn(o-s,0),c=we(A+l),h=!r;++i<A;)c[i]=e[i];for(var f=i;++u<l;)c[f+u]=t[u];for(;++a<s;)(h||i<o)&&(c[f+n[a]]=e[i++]);return c}function ki(e,t){var n=-1,r=e.length;for(t||(t=we(r));++n<r;)t[n]=e[n];return t}function Si(e,t,r,i){var o=!r;r||(r={});for(var a=-1,s=t.length;++a<s;){var u=t[a],l=i?i(r[u],e[u],u,r,e):n;l===n&&(l=e[u]),o?ir(r,u,l):er(r,u,l)}return r}function Qi(e,t){return function(n,r){var i=ja(n)?vt:nr,o=t?t():{};return i(n,e,ao(r,2),o)}}function _i(e){return Jr((function(t,r){var i=-1,o=r.length,a=o>1?r[o-1]:n,s=o>2?r[2]:n;for(a=e.length>3&&"function"==typeof a?(o--,a):n,s&&yo(r[0],r[1],s)&&(a=o<3?n:a,o=1),t=Ce(t);++i<o;){var u=r[i];u&&e(t,u,i,a)}return t}))}function Ni(e,t){return function(n,r){if(null==n)return n;if(!qa(n))return e(n,r);for(var i=n.length,o=t?i:-1,a=Ce(n);(t?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function Di(e){return function(t,n,r){for(var i=-1,o=Ce(t),a=r(t),s=a.length;s--;){var u=a[e?s:++i];if(!1===n(o[u],u,o))break}return t}}function Fi(e){return function(t){var r=Wt(t=vs(t))?rn(t):n,i=r?r[0]:t.charAt(0),o=r?mi(r,1).join(""):t.slice(1);return i[e]()+o}}function Pi(e){return function(t){return xt(Xs(Ks(t).replace(je,"")),e,"")}}function Ui(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=On(e.prototype),r=e.apply(n,t);return $a(r)?r:n}}function Li(e){return function(t,r,i){var o=Ce(t);if(!qa(t)){var a=ao(r,3);t=_s(t),r=function(e){return a(o[e],e,o)}}var s=e(t,r,i);return s>-1?o[a?t[s]:s]:n}}function Ti(e){return eo((function(t){var i=t.length,o=i,a=Kn.prototype.thru;for(e&&t.reverse();o--;){var s=t[o];if("function"!=typeof s)throw new Se(r);if(a&&!u&&"wrapper"==io(s))var u=new Kn([],!0)}for(o=u?o:i;++o<i;){var l=io(s=t[o]),A="wrapper"==l?ro(s):n;u=A&&wo(A[0])&&424==A[1]&&!A[4].length&&1==A[9]?u[io(A[0])].apply(u,A[3]):1==s.length&&wo(s)?u[l]():u.thru(s)}return function(){var e=arguments,n=e[0];if(u&&1==e.length&&ja(n))return u.plant(n).value();for(var r=0,o=i?t[r].apply(this,e):n;++r<i;)o=t[r].call(this,o);return o}}))}function Mi(e,t,r,i,o,a,s,l,A,c){var h=t&u,f=1&t,d=2&t,p=24&t,g=512&t,v=d?n:Ui(e);return function n(){for(var u=arguments.length,y=we(u),m=u;m--;)y[m]=arguments[m];if(p)var w=oo(n),b=zt(y,w);if(i&&(y=Ci(y,i,o,p)),a&&(y=xi(y,a,s,p)),u-=b,p&&u<c){var I=en(y,w);return qi(e,t,Mi,n.placeholder,r,y,I,l,A,c-u)}var B=f?r:this,E=d?B[e]:e;return u=y.length,l?y=ko(y,l):g&&u>1&&y.reverse(),h&&A<u&&(y.length=A),this&&this!==it&&this instanceof n&&(E=v||Ui(E)),E.apply(B,y)}}function Ri(e,t){return function(n,r){return function(e,t,n,r){return mr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function Oi(e,t){return function(r,i){var o;if(r===n&&i===n)return t;if(r!==n&&(o=r),i!==n){if(o===n)return i;"string"==typeof r||"string"==typeof i?(r=si(r),i=si(i)):(r=ai(r),i=ai(i)),o=e(r,i)}return o}}function Hi(e){return eo((function(t){return t=Et(t,Kt(ao())),Jr((function(n){var r=this;return e(t,(function(e){return gt(e,r,n)}))}))}))}function Ki(e,t){var r=(t=t===n?" ":si(t)).length;if(r<2)return r?zr(t,e):t;var i=zr(t,An(e/nn(t)));return Wt(t)?mi(rn(i),0,e).join(""):i.slice(0,e)}function ji(e){return function(t,r,i){return i&&"number"!=typeof i&&yo(t,r,i)&&(r=i=n),t=hs(t),r===n?(r=t,t=0):r=hs(r),function(e,t,n,r){for(var i=-1,o=vn(An((t-e)/(n||1)),0),a=we(o);o--;)a[r?o:++i]=e,e+=n;return a}(t,r,i=i===n?t<r?1:-1:hs(i),e)}}function Gi(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=ps(t),n=ps(n)),e(t,n)}}function qi(e,t,r,i,o,a,u,l,A,c){var h=8&t;t|=h?s:64,4&(t&=~(h?64:s))||(t&=-4);var f=[e,t,o,h?a:n,h?u:n,h?n:a,h?n:u,l,A,c],d=r.apply(n,f);return wo(e)&&Qo(d,f),d.placeholder=i,Do(d,e,t)}function Vi(e){var t=Ee[e];return function(e,n){if(e=ps(e),(n=null==n?0:yn(fs(n),292))&&dn(e)){var r=(vs(e)+"e").split("e");return+((r=(vs(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var zi=xn&&1/tn(new xn([,-0]))[1]==l?function(e){return new xn(e)}:su;function Ji(e){return function(t){var n=ho(t);return n==b?Zt(t):n==x?function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}(t):function(e,t){return Et(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Yi(e,t,i,o,l,A,c,h){var f=2&t;if(!f&&"function"!=typeof e)throw new Se(r);var d=o?o.length:0;if(d||(t&=-97,o=l=n),c=c===n?c:vn(fs(c),0),h=h===n?h:fs(h),d-=l?l.length:0,64&t){var p=o,g=l;o=l=n}var v=f?n:ro(e),y=[e,t,i,o,l,p,g,A,c,h];if(v&&function(e,t){var n=e[1],r=t[1],i=n|r,o=i<131,s=r==u&&8==n||r==u&&256==n&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!o&&!s)return e;1&r&&(e[2]=t[2],i|=1&n?0:4);var l=t[3];if(l){var A=e[3];e[3]=A?Ci(A,l,t[4]):l,e[4]=A?en(e[3],a):t[4]}(l=t[5])&&(A=e[5],e[5]=A?xi(A,l,t[6]):l,e[6]=A?en(e[5],a):t[6]),(l=t[7])&&(e[7]=l),r&u&&(e[8]=null==e[8]?t[8]:yn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(y,v),e=y[0],t=y[1],i=y[2],o=y[3],l=y[4],!(h=y[9]=y[9]===n?f?0:e.length:vn(y[9]-d,0))&&24&t&&(t&=-25),t&&1!=t)m=8==t||16==t?function(e,t,r){var i=Ui(e);return function o(){for(var a=arguments.length,s=we(a),u=a,l=oo(o);u--;)s[u]=arguments[u];var A=a<3&&s[0]!==l&&s[a-1]!==l?[]:en(s,l);return(a-=A.length)<r?qi(e,t,Mi,o.placeholder,n,s,A,n,n,r-a):gt(this&&this!==it&&this instanceof o?i:e,this,s)}}(e,t,h):t!=s&&33!=t||l.length?Mi.apply(n,y):function(e,t,n,r){var i=1&t,o=Ui(e);return function t(){for(var a=-1,s=arguments.length,u=-1,l=r.length,A=we(l+s),c=this&&this!==it&&this instanceof t?o:e;++u<l;)A[u]=r[u];for(;s--;)A[u++]=arguments[++a];return gt(c,i?n:this,A)}}(e,t,i,o);else var m=function(e,t,n){var r=1&t,i=Ui(e);return function t(){return(this&&this!==it&&this instanceof t?i:e).apply(r?n:this,arguments)}}(e,t,i);return Do((v?Zr:Qo)(m,y),e,t)}function Xi(e,t,r,i){return e===n||Ra(e,Ne[r])&&!Pe.call(i,r)?t:e}function Wi(e,t,r,i,o,a){return $a(e)&&$a(t)&&(a.set(t,e),Or(e,t,n,Wi,a),a.delete(t)),e}function Zi(e){return rs(e)?n:e}function $i(e,t,r,i,o,a){var s=1&r,u=e.length,l=t.length;if(u!=l&&!(s&&l>u))return!1;var A=a.get(e),c=a.get(t);if(A&&c)return A==t&&c==e;var h=-1,f=!0,d=2&r?new zn:n;for(a.set(e,t),a.set(t,e);++h<u;){var p=e[h],g=t[h];if(i)var v=s?i(g,p,h,t,e,a):i(p,g,h,e,t,a);if(v!==n){if(v)continue;f=!1;break}if(d){if(!St(t,(function(e,t){if(!Gt(d,t)&&(p===e||o(p,e,r,i,a)))return d.push(t)}))){f=!1;break}}else if(p!==g&&!o(p,g,r,i,a)){f=!1;break}}return a.delete(e),a.delete(t),f}function eo(e){return No(Co(e,n,Go),e+"")}function to(e){return Br(e,_s,Ao)}function no(e){return Br(e,Ns,co)}var ro=Qn?function(e){return Qn.get(e)}:su;function io(e){for(var t=e.name+"",n=_n[t],r=Pe.call(_n,t)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==e)return i.name}return t}function oo(e){return(Pe.call(Rn,"placeholder")?Rn:e).placeholder}function ao(){var e=Rn.iteratee||ru;return e=e===ru?Pr:e,arguments.length?e(arguments[0],arguments[1]):e}function so(e,t){var n=e.__data__;return function(e){var t=i(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function uo(e){for(var t=_s(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Bo(i)]}return t}function lo(e,t){var r=function(e,t){return null==e?n:e[t]}(e,t);return Fr(r)?r:n}var Ao=hn?function(e){return null==e?[]:(e=Ce(e),bt(hn(e),(function(t){return rt.call(e,t)})))}:du,co=hn?function(e){for(var t=[];e;)Ct(t,Ao(e)),e=$e(e);return t}:du,ho=Er;function fo(e,t,n){for(var r=-1,i=(t=vi(t,e)).length,o=!1;++r<i;){var a=Lo(t[r]);if(!(o=null!=e&&n(e,a)))break;e=e[a]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&Za(i)&&vo(a,i)&&(ja(e)||Ka(e))}function po(e){return"function"!=typeof e.constructor||Io(e)?{}:On($e(e))}function go(e){return ja(e)||Ka(e)||!!(at&&e&&e[at])}function vo(e,t){var n=i(e);return!!(t=null==t?A:t)&&("number"==n||"symbol"!=n&&ge.test(e))&&e>-1&&e%1==0&&e<t}function yo(e,t,n){if(!$a(n))return!1;var r=i(t);return!!("number"==r?qa(n)&&vo(t,n.length):"string"==r&&t in n)&&Ra(n[t],e)}function mo(e,t){if(ja(e))return!1;var n=i(e);return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!ss(e))||Z.test(e)||!W.test(e)||null!=t&&e in Ce(t)}function wo(e){var t=io(e),n=Rn[t];if("function"!=typeof n||!(t in jn.prototype))return!1;if(e===n)return!0;var r=ro(n);return!!r&&e===r[0]}(Bn&&ho(new Bn(new ArrayBuffer(1)))!=N||En&&ho(new En)!=b||Cn&&ho(Cn.resolve())!=E||xn&&ho(new xn)!=x||kn&&ho(new kn)!=Q)&&(ho=function(e){var t=Er(e),r=t==B?e.constructor:n,i=r?To(r):"";if(i)switch(i){case Nn:return N;case Dn:return b;case Fn:return E;case Pn:return x;case Un:return Q}return t});var bo=De?Xa:pu;function Io(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ne)}function Bo(e){return e==e&&!$a(e)}function Eo(e,t){return function(r){return null!=r&&r[e]===t&&(t!==n||e in Ce(r))}}function Co(e,t,r){return t=vn(t===n?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=vn(n.length-t,0),a=we(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=we(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),gt(e,this,s)}}function xo(e,t){return t.length<2?e:Ir(e,ti(t,0,-1))}function ko(e,t){for(var r=e.length,i=yn(t.length,r),o=ki(e);i--;){var a=t[i];e[i]=vo(a,r)?o[a]:n}return e}function So(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Qo=Fo(Zr),_o=ln||function(e,t){return it.setTimeout(e,t)},No=Fo($r);function Do(e,t,n){var r=t+"";return No(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ie,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return yt(f,(function(n){var r="_."+n[0];t&n[1]&&!It(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(oe);return t?t[1].split(ae):[]}(r),n)))}function Fo(e){var t=0,r=0;return function(){var i=mn(),o=16-(i-r);if(r=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(n,arguments)}}function Po(e,t){var r=-1,i=e.length,o=i-1;for(t=t===n?i:t;++r<t;){var a=Vr(r,o),s=e[a];e[a]=e[r],e[r]=s}return e.length=t,e}var Uo=function(e){var t=Fa((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace($,(function(e,n,r,i){t.push(r?i.replace(le,"$1"):n||e)})),t}),(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}();function Lo(e){if("string"==typeof e||ss(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function To(e){if(null!=e){try{return Fe.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Mo(e){if(e instanceof jn)return e.clone();var t=new Kn(e.__wrapped__,e.__chain__);return t.__actions__=ki(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Ro=Jr((function(e,t){return Va(e)?Ar(e,gr(t,1,Va,!0)):[]})),Oo=Jr((function(e,t){var r=Yo(t);return Va(r)&&(r=n),Va(e)?Ar(e,gr(t,1,Va,!0),ao(r,2)):[]})),Ho=Jr((function(e,t){var r=Yo(t);return Va(r)&&(r=n),Va(e)?Ar(e,gr(t,1,Va,!0),n,r):[]}));function Ko(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:fs(n);return i<0&&(i=vn(r+i,0)),Nt(e,ao(t,3),i)}function jo(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var o=i-1;return r!==n&&(o=fs(r),o=r<0?vn(i+o,0):yn(o,i-1)),Nt(e,ao(t,3),o,!0)}function Go(e){return null!=e&&e.length?gr(e,1):[]}function qo(e){return e&&e.length?e[0]:n}var Vo=Jr((function(e){var t=Et(e,pi);return t.length&&t[0]===e[0]?Sr(t):[]})),zo=Jr((function(e){var t=Yo(e),r=Et(e,pi);return t===Yo(r)?t=n:r.pop(),r.length&&r[0]===e[0]?Sr(r,ao(t,2)):[]})),Jo=Jr((function(e){var t=Yo(e),r=Et(e,pi);return(t="function"==typeof t?t:n)&&r.pop(),r.length&&r[0]===e[0]?Sr(r,n,t):[]}));function Yo(e){var t=null==e?0:e.length;return t?e[t-1]:n}var Xo=Jr(Wo);function Wo(e,t){return e&&e.length&&t&&t.length?Gr(e,t):e}var Zo=eo((function(e,t){var n=null==e?0:e.length,r=or(e,t);return qr(e,Et(t,(function(e){return vo(e,n)?+e:e})).sort(Ei)),r}));function $o(e){return null==e?e:In.call(e)}var ea=Jr((function(e){return ui(gr(e,1,Va,!0))})),ta=Jr((function(e){var t=Yo(e);return Va(t)&&(t=n),ui(gr(e,1,Va,!0),ao(t,2))})),na=Jr((function(e){var t=Yo(e);return t="function"==typeof t?t:n,ui(gr(e,1,Va,!0),n,t)}));function ra(e){if(!e||!e.length)return[];var t=0;return e=bt(e,(function(e){if(Va(e))return t=vn(e.length,t),!0})),Ot(t,(function(t){return Et(e,Lt(t))}))}function ia(e,t){if(!e||!e.length)return[];var r=ra(e);return null==t?r:Et(r,(function(e){return gt(t,n,e)}))}var oa=Jr((function(e,t){return Va(e)?Ar(e,t):[]})),aa=Jr((function(e){return fi(bt(e,Va))})),sa=Jr((function(e){var t=Yo(e);return Va(t)&&(t=n),fi(bt(e,Va),ao(t,2))})),ua=Jr((function(e){var t=Yo(e);return t="function"==typeof t?t:n,fi(bt(e,Va),n,t)})),la=Jr(ra),Aa=Jr((function(e){var t=e.length,r=t>1?e[t-1]:n;return r="function"==typeof r?(e.pop(),r):n,ia(e,r)}));function ca(e){var t=Rn(e);return t.__chain__=!0,t}function ha(e,t){return t(e)}var fa=eo((function(e){var t=e.length,r=t?e[0]:0,i=this.__wrapped__,o=function(t){return or(t,e)};return!(t>1||this.__actions__.length)&&i instanceof jn&&vo(r)?((i=i.slice(r,+r+(t?1:0))).__actions__.push({func:ha,args:[o],thisArg:n}),new Kn(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(n),e}))):this.thru(o)})),da=Qi((function(e,t,n){Pe.call(e,n)?++e[n]:ir(e,n,1)})),pa=Li(Ko),ga=Li(jo);function va(e,t){return(ja(e)?yt:cr)(e,ao(t,3))}function ya(e,t){return(ja(e)?mt:hr)(e,ao(t,3))}var ma=Qi((function(e,t,n){Pe.call(e,n)?e[n].push(t):ir(e,n,[t])})),wa=Jr((function(e,t,n){var r=-1,i="function"==typeof t,o=qa(e)?we(e.length):[];return cr(e,(function(e){o[++r]=i?gt(t,e,n):Qr(e,t,n)})),o})),ba=Qi((function(e,t,n){ir(e,n,t)}));function Ia(e,t){return(ja(e)?Et:Tr)(e,ao(t,3))}var Ba=Qi((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Ea=Jr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Kr(e,gr(t,1),[])})),Ca=un||function(){return it.Date.now()};function xa(e,t,r){return t=r?n:t,t=e&&null==t?e.length:t,Yi(e,u,n,n,n,n,t)}function ka(e,t){var i;if("function"!=typeof t)throw new Se(r);return e=fs(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=n),i}}var Sa=Jr((function(e,t,n){var r=1;if(n.length){var i=en(n,oo(Sa));r|=s}return Yi(e,r,t,n,i)})),Qa=Jr((function(e,t,n){var r=3;if(n.length){var i=en(n,oo(Qa));r|=s}return Yi(t,r,e,n,i)}));function _a(e,t,i){var o,a,s,u,l,A,c=0,h=!1,f=!1,d=!0;if("function"!=typeof e)throw new Se(r);function p(t){var r=o,i=a;return o=a=n,c=t,u=e.apply(i,r)}function g(e){return c=e,l=_o(y,t),h?p(e):u}function v(e){var r=e-A;return A===n||r>=t||r<0||f&&e-c>=s}function y(){var e=Ca();if(v(e))return m(e);l=_o(y,function(e){var n=t-(e-A);return f?yn(n,s-(e-c)):n}(e))}function m(e){return l=n,d&&o?p(e):(o=a=n,u)}function w(){var e=Ca(),r=v(e);if(o=arguments,a=this,A=e,r){if(l===n)return g(A);if(f)return wi(l),l=_o(y,t),p(A)}return l===n&&(l=_o(y,t)),u}return t=ps(t)||0,$a(i)&&(h=!!i.leading,s=(f="maxWait"in i)?vn(ps(i.maxWait)||0,t):s,d="trailing"in i?!!i.trailing:d),w.cancel=function(){l!==n&&wi(l),c=0,o=A=a=l=n},w.flush=function(){return l===n?u:m(Ca())},w}var Na=Jr((function(e,t){return lr(e,1,t)})),Da=Jr((function(e,t,n){return lr(e,ps(t)||0,n)}));function Fa(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Se(r);var n=function n(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Fa.Cache||Vn),n}function Pa(e){if("function"!=typeof e)throw new Se(r);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Fa.Cache=Vn;var Ua=yi((function(e,t){var n=(t=1==t.length&&ja(t[0])?Et(t[0],Kt(ao())):Et(gr(t,1),Kt(ao()))).length;return Jr((function(r){for(var i=-1,o=yn(r.length,n);++i<o;)r[i]=t[i].call(this,r[i]);return gt(e,this,r)}))})),La=Jr((function(e,t){var r=en(t,oo(La));return Yi(e,s,n,t,r)})),Ta=Jr((function(e,t){var r=en(t,oo(Ta));return Yi(e,64,n,t,r)})),Ma=eo((function(e,t){return Yi(e,256,n,n,n,t)}));function Ra(e,t){return e===t||e!=e&&t!=t}var Oa=Gi(Cr),Ha=Gi((function(e,t){return e>=t})),Ka=_r(function(){return arguments}())?_r:function(e){return es(e)&&Pe.call(e,"callee")&&!rt.call(e,"callee")},ja=we.isArray,Ga=At?Kt(At):function(e){return es(e)&&Er(e)==_};function qa(e){return null!=e&&Za(e.length)&&!Xa(e)}function Va(e){return es(e)&&qa(e)}var za=fn||pu,Ja=ct?Kt(ct):function(e){return es(e)&&Er(e)==v};function Ya(e){if(!es(e))return!1;var t=Er(e);return t==y||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!rs(e)}function Xa(e){if(!$a(e))return!1;var t=Er(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Wa(e){return"number"==typeof e&&e==fs(e)}function Za(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=A}function $a(e){var t=i(e);return null!=e&&("object"==t||"function"==t)}function es(e){return null!=e&&"object"==i(e)}var ts=ht?Kt(ht):function(e){return es(e)&&ho(e)==b};function ns(e){return"number"==typeof e||es(e)&&Er(e)==I}function rs(e){if(!es(e)||Er(e)!=B)return!1;var t=$e(e);if(null===t)return!0;var n=Pe.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Fe.call(n)==Me}var is=ft?Kt(ft):function(e){return es(e)&&Er(e)==C},os=dt?Kt(dt):function(e){return es(e)&&ho(e)==x};function as(e){return"string"==typeof e||!ja(e)&&es(e)&&Er(e)==k}function ss(e){return"symbol"==i(e)||es(e)&&Er(e)==S}var us=pt?Kt(pt):function(e){return es(e)&&Za(e.length)&&!!We[Er(e)]},ls=Gi(Lr),As=Gi((function(e,t){return e<=t}));function cs(e){if(!e)return[];if(qa(e))return as(e)?rn(e):ki(e);if(ut&&e[ut])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[ut]());var t=ho(e);return(t==b?Zt:t==x?tn:Rs)(e)}function hs(e){return e?(e=ps(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function fs(e){var t=hs(e),n=t%1;return t==t?n?t-n:t:0}function ds(e){return e?ar(fs(e),0,h):0}function ps(e){if("number"==typeof e)return e;if(ss(e))return c;if($a(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=$a(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Ht(e);var n=fe.test(e);return n||pe.test(e)?tt(e.slice(2),n?2:8):he.test(e)?c:+e}function gs(e){return Si(e,Ns(e))}function vs(e){return null==e?"":si(e)}var ys=_i((function(e,t){if(Io(t)||qa(t))Si(t,_s(t),e);else for(var n in t)Pe.call(t,n)&&er(e,n,t[n])})),ms=_i((function(e,t){Si(t,Ns(t),e)})),ws=_i((function(e,t,n,r){Si(t,Ns(t),e,r)})),bs=_i((function(e,t,n,r){Si(t,_s(t),e,r)})),Is=eo(or),Bs=Jr((function(e,t){e=Ce(e);var r=-1,i=t.length,o=i>2?t[2]:n;for(o&&yo(t[0],t[1],o)&&(i=1);++r<i;)for(var a=t[r],s=Ns(a),u=-1,l=s.length;++u<l;){var A=s[u],c=e[A];(c===n||Ra(c,Ne[A])&&!Pe.call(e,A))&&(e[A]=a[A])}return e})),Es=Jr((function(e){return e.push(n,Wi),gt(Fs,n,e)}));function Cs(e,t,r){var i=null==e?n:Ir(e,t);return i===n?r:i}function xs(e,t){return null!=e&&fo(e,t,kr)}var ks=Ri((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),e[t]=n}),$s(nu)),Ss=Ri((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),Pe.call(e,t)?e[t].push(n):e[t]=[n]}),ao),Qs=Jr(Qr);function _s(e){return qa(e)?Yn(e):Ur(e)}function Ns(e){return qa(e)?Yn(e,!0):function(e){if(!$a(e))return function(e){var t=[];if(null!=e)for(var n in Ce(e))t.push(n);return t}(e);var t=Io(e),n=[];for(var r in e)("constructor"!=r||!t&&Pe.call(e,r))&&n.push(r);return n}(e)}var Ds=_i((function(e,t,n){Or(e,t,n)})),Fs=_i((function(e,t,n,r){Or(e,t,n,r)})),Ps=eo((function(e,t){var n={};if(null==e)return n;var r=!1;t=Et(t,(function(t){return t=vi(t,e),r||(r=t.length>1),t})),Si(e,no(e),n),r&&(n=sr(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Us=eo((function(e,t){return null==e?{}:function(e,t){return jr(e,t,(function(t,n){return xs(e,n)}))}(e,t)}));function Ls(e,t){if(null==e)return{};var n=Et(no(e),(function(e){return[e]}));return t=ao(t),jr(e,n,(function(e,n){return t(e,n[0])}))}var Ts=Ji(_s),Ms=Ji(Ns);function Rs(e){return null==e?[]:jt(e,_s(e))}var Os=Pi((function(e,t,n){return t=t.toLowerCase(),e+(n?Hs(t):t)}));function Hs(e){return Ys(vs(e).toLowerCase())}function Ks(e){return(e=vs(e))&&e.replace(ve,Jt).replace(Ge,"")}var js=Pi((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Gs=Pi((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),qs=Fi("toLowerCase"),Vs=Pi((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),zs=Pi((function(e,t,n){return e+(n?" ":"")+Ys(t)})),Js=Pi((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Ys=Fi("toUpperCase");function Xs(e,t,r){return e=vs(e),(t=r?n:t)===n?function(e){return Je.test(e)}(e)?function(e){return e.match(Ve)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Ws=Jr((function(e,t){try{return gt(e,n,t)}catch(e){return Ya(e)?e:new Ie(e)}})),Zs=eo((function(e,t){return yt(t,(function(t){t=Lo(t),ir(e,t,Sa(e[t],e))})),e}));function $s(e){return function(){return e}}var eu=Ti(),tu=Ti(!0);function nu(e){return e}function ru(e){return Pr("function"==typeof e?e:sr(e,1))}var iu=Jr((function(e,t){return function(n){return Qr(n,e,t)}})),ou=Jr((function(e,t){return function(n){return Qr(e,n,t)}}));function au(e,t,n){var r=_s(t),i=br(t,r);null!=n||$a(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=br(t,_s(t)));var o=!($a(n)&&"chain"in n&&!n.chain),a=Xa(e);return yt(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),i=n.__actions__=ki(this.__actions__);return i.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Ct([this.value()],arguments))})})),e}function su(){}var uu=Hi(Et),lu=Hi(wt),Au=Hi(St);function cu(e){return mo(e)?Lt(Lo(e)):function(e){return function(t){return Ir(t,e)}}(e)}var hu=ji(),fu=ji(!0);function du(){return[]}function pu(){return!1}var gu,vu=Oi((function(e,t){return e+t}),0),yu=Vi("ceil"),mu=Oi((function(e,t){return e/t}),1),wu=Vi("floor"),bu=Oi((function(e,t){return e*t}),1),Iu=Vi("round"),Bu=Oi((function(e,t){return e-t}),0);return Rn.after=function(e,t){if("function"!=typeof t)throw new Se(r);return e=fs(e),function(){if(--e<1)return t.apply(this,arguments)}},Rn.ary=xa,Rn.assign=ys,Rn.assignIn=ms,Rn.assignInWith=ws,Rn.assignWith=bs,Rn.at=Is,Rn.before=ka,Rn.bind=Sa,Rn.bindAll=Zs,Rn.bindKey=Qa,Rn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return ja(e)?e:[e]},Rn.chain=ca,Rn.chunk=function(e,t,r){t=(r?yo(e,t,r):t===n)?1:vn(fs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,a=0,s=we(An(i/t));o<i;)s[a++]=ti(e,o,o+=t);return s},Rn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var o=e[t];o&&(i[r++]=o)}return i},Rn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=we(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Ct(ja(n)?ki(n):[n],gr(t,1))},Rn.cond=function(e){var t=null==e?0:e.length,n=ao();return e=t?Et(e,(function(e){if("function"!=typeof e[1])throw new Se(r);return[n(e[0]),e[1]]})):[],Jr((function(n){for(var r=-1;++r<t;){var i=e[r];if(gt(i[0],this,n))return gt(i[1],this,n)}}))},Rn.conforms=function(e){return function(e){var t=_s(e);return function(n){return ur(n,e,t)}}(sr(e,1))},Rn.constant=$s,Rn.countBy=da,Rn.create=function(e,t){var n=On(e);return null==t?n:rr(n,t)},Rn.curry=function e(t,r,i){var o=Yi(t,8,n,n,n,n,n,r=i?n:r);return o.placeholder=e.placeholder,o},Rn.curryRight=function e(t,r,i){var o=Yi(t,16,n,n,n,n,n,r=i?n:r);return o.placeholder=e.placeholder,o},Rn.debounce=_a,Rn.defaults=Bs,Rn.defaultsDeep=Es,Rn.defer=Na,Rn.delay=Da,Rn.difference=Ro,Rn.differenceBy=Oo,Rn.differenceWith=Ho,Rn.drop=function(e,t,r){var i=null==e?0:e.length;return i?ti(e,(t=r||t===n?1:fs(t))<0?0:t,i):[]},Rn.dropRight=function(e,t,r){var i=null==e?0:e.length;return i?ti(e,0,(t=i-(t=r||t===n?1:fs(t)))<0?0:t):[]},Rn.dropRightWhile=function(e,t){return e&&e.length?ci(e,ao(t,3),!0,!0):[]},Rn.dropWhile=function(e,t){return e&&e.length?ci(e,ao(t,3),!0):[]},Rn.fill=function(e,t,r,i){var o=null==e?0:e.length;return o?(r&&"number"!=typeof r&&yo(e,t,r)&&(r=0,i=o),function(e,t,r,i){var o=e.length;for((r=fs(r))<0&&(r=-r>o?0:o+r),(i=i===n||i>o?o:fs(i))<0&&(i+=o),i=r>i?0:ds(i);r<i;)e[r++]=t;return e}(e,t,r,i)):[]},Rn.filter=function(e,t){return(ja(e)?bt:pr)(e,ao(t,3))},Rn.flatMap=function(e,t){return gr(Ia(e,t),1)},Rn.flatMapDeep=function(e,t){return gr(Ia(e,t),l)},Rn.flatMapDepth=function(e,t,r){return r=r===n?1:fs(r),gr(Ia(e,t),r)},Rn.flatten=Go,Rn.flattenDeep=function(e){return null!=e&&e.length?gr(e,l):[]},Rn.flattenDepth=function(e,t){return null!=e&&e.length?gr(e,t=t===n?1:fs(t)):[]},Rn.flip=function(e){return Yi(e,512)},Rn.flow=eu,Rn.flowRight=tu,Rn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r},Rn.functions=function(e){return null==e?[]:br(e,_s(e))},Rn.functionsIn=function(e){return null==e?[]:br(e,Ns(e))},Rn.groupBy=ma,Rn.initial=function(e){return null!=e&&e.length?ti(e,0,-1):[]},Rn.intersection=Vo,Rn.intersectionBy=zo,Rn.intersectionWith=Jo,Rn.invert=ks,Rn.invertBy=Ss,Rn.invokeMap=wa,Rn.iteratee=ru,Rn.keyBy=ba,Rn.keys=_s,Rn.keysIn=Ns,Rn.map=Ia,Rn.mapKeys=function(e,t){var n={};return t=ao(t,3),mr(e,(function(e,r,i){ir(n,t(e,r,i),e)})),n},Rn.mapValues=function(e,t){var n={};return t=ao(t,3),mr(e,(function(e,r,i){ir(n,r,t(e,r,i))})),n},Rn.matches=function(e){return Mr(sr(e,1))},Rn.matchesProperty=function(e,t){return Rr(e,sr(t,1))},Rn.memoize=Fa,Rn.merge=Ds,Rn.mergeWith=Fs,Rn.method=iu,Rn.methodOf=ou,Rn.mixin=au,Rn.negate=Pa,Rn.nthArg=function(e){return e=fs(e),Jr((function(t){return Hr(t,e)}))},Rn.omit=Ps,Rn.omitBy=function(e,t){return Ls(e,Pa(ao(t)))},Rn.once=function(e){return ka(2,e)},Rn.orderBy=function(e,t,r,i){return null==e?[]:(ja(t)||(t=null==t?[]:[t]),ja(r=i?n:r)||(r=null==r?[]:[r]),Kr(e,t,r))},Rn.over=uu,Rn.overArgs=Ua,Rn.overEvery=lu,Rn.overSome=Au,Rn.partial=La,Rn.partialRight=Ta,Rn.partition=Ba,Rn.pick=Us,Rn.pickBy=Ls,Rn.property=cu,Rn.propertyOf=function(e){return function(t){return null==e?n:Ir(e,t)}},Rn.pull=Xo,Rn.pullAll=Wo,Rn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Gr(e,t,ao(n,2)):e},Rn.pullAllWith=function(e,t,r){return e&&e.length&&t&&t.length?Gr(e,t,n,r):e},Rn.pullAt=Zo,Rn.range=hu,Rn.rangeRight=fu,Rn.rearg=Ma,Rn.reject=function(e,t){return(ja(e)?bt:pr)(e,Pa(ao(t,3)))},Rn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],o=e.length;for(t=ao(t,3);++r<o;){var a=e[r];t(a,r,e)&&(n.push(a),i.push(r))}return qr(e,i),n},Rn.rest=function(e,t){if("function"!=typeof e)throw new Se(r);return Jr(e,t=t===n?t:fs(t))},Rn.reverse=$o,Rn.sampleSize=function(e,t,r){return t=(r?yo(e,t,r):t===n)?1:fs(t),(ja(e)?Wn:Xr)(e,t)},Rn.set=function(e,t,n){return null==e?e:Wr(e,t,n)},Rn.setWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:Wr(e,t,r,i)},Rn.shuffle=function(e){return(ja(e)?Zn:ei)(e)},Rn.slice=function(e,t,r){var i=null==e?0:e.length;return i?(r&&"number"!=typeof r&&yo(e,t,r)?(t=0,r=i):(t=null==t?0:fs(t),r=r===n?i:fs(r)),ti(e,t,r)):[]},Rn.sortBy=Ea,Rn.sortedUniq=function(e){return e&&e.length?oi(e):[]},Rn.sortedUniqBy=function(e,t){return e&&e.length?oi(e,ao(t,2)):[]},Rn.split=function(e,t,r){return r&&"number"!=typeof r&&yo(e,t,r)&&(t=r=n),(r=r===n?h:r>>>0)?(e=vs(e))&&("string"==typeof t||null!=t&&!is(t))&&!(t=si(t))&&Wt(e)?mi(rn(e),0,r):e.split(t,r):[]},Rn.spread=function(e,t){if("function"!=typeof e)throw new Se(r);return t=null==t?0:vn(fs(t),0),Jr((function(n){var r=n[t],i=mi(n,0,t);return r&&Ct(i,r),gt(e,this,i)}))},Rn.tail=function(e){var t=null==e?0:e.length;return t?ti(e,1,t):[]},Rn.take=function(e,t,r){return e&&e.length?ti(e,0,(t=r||t===n?1:fs(t))<0?0:t):[]},Rn.takeRight=function(e,t,r){var i=null==e?0:e.length;return i?ti(e,(t=i-(t=r||t===n?1:fs(t)))<0?0:t,i):[]},Rn.takeRightWhile=function(e,t){return e&&e.length?ci(e,ao(t,3),!1,!0):[]},Rn.takeWhile=function(e,t){return e&&e.length?ci(e,ao(t,3)):[]},Rn.tap=function(e,t){return t(e),e},Rn.throttle=function(e,t,n){var i=!0,o=!0;if("function"!=typeof e)throw new Se(r);return $a(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),_a(e,t,{leading:i,maxWait:t,trailing:o})},Rn.thru=ha,Rn.toArray=cs,Rn.toPairs=Ts,Rn.toPairsIn=Ms,Rn.toPath=function(e){return ja(e)?Et(e,Lo):ss(e)?[e]:ki(Uo(vs(e)))},Rn.toPlainObject=gs,Rn.transform=function(e,t,n){var r=ja(e),i=r||za(e)||us(e);if(t=ao(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:$a(e)&&Xa(o)?On($e(e)):{}}return(i?yt:mr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Rn.unary=function(e){return xa(e,1)},Rn.union=ea,Rn.unionBy=ta,Rn.unionWith=na,Rn.uniq=function(e){return e&&e.length?ui(e):[]},Rn.uniqBy=function(e,t){return e&&e.length?ui(e,ao(t,2)):[]},Rn.uniqWith=function(e,t){return t="function"==typeof t?t:n,e&&e.length?ui(e,n,t):[]},Rn.unset=function(e,t){return null==e||li(e,t)},Rn.unzip=ra,Rn.unzipWith=ia,Rn.update=function(e,t,n){return null==e?e:Ai(e,t,gi(n))},Rn.updateWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:Ai(e,t,gi(r),i)},Rn.values=Rs,Rn.valuesIn=function(e){return null==e?[]:jt(e,Ns(e))},Rn.without=oa,Rn.words=Xs,Rn.wrap=function(e,t){return La(gi(t),e)},Rn.xor=aa,Rn.xorBy=sa,Rn.xorWith=ua,Rn.zip=la,Rn.zipObject=function(e,t){return di(e||[],t||[],er)},Rn.zipObjectDeep=function(e,t){return di(e||[],t||[],Wr)},Rn.zipWith=Aa,Rn.entries=Ts,Rn.entriesIn=Ms,Rn.extend=ms,Rn.extendWith=ws,au(Rn,Rn),Rn.add=vu,Rn.attempt=Ws,Rn.camelCase=Os,Rn.capitalize=Hs,Rn.ceil=yu,Rn.clamp=function(e,t,r){return r===n&&(r=t,t=n),r!==n&&(r=(r=ps(r))==r?r:0),t!==n&&(t=(t=ps(t))==t?t:0),ar(ps(e),t,r)},Rn.clone=function(e){return sr(e,4)},Rn.cloneDeep=function(e){return sr(e,5)},Rn.cloneDeepWith=function(e,t){return sr(e,5,t="function"==typeof t?t:n)},Rn.cloneWith=function(e,t){return sr(e,4,t="function"==typeof t?t:n)},Rn.conformsTo=function(e,t){return null==t||ur(e,t,_s(t))},Rn.deburr=Ks,Rn.defaultTo=function(e,t){return null==e||e!=e?t:e},Rn.divide=mu,Rn.endsWith=function(e,t,r){e=vs(e),t=si(t);var i=e.length,o=r=r===n?i:ar(fs(r),0,i);return(r-=t.length)>=0&&e.slice(r,o)==t},Rn.eq=Ra,Rn.escape=function(e){return(e=vs(e))&&z.test(e)?e.replace(q,Yt):e},Rn.escapeRegExp=function(e){return(e=vs(e))&&te.test(e)?e.replace(ee,"\\$&"):e},Rn.every=function(e,t,r){var i=ja(e)?wt:fr;return r&&yo(e,t,r)&&(t=n),i(e,ao(t,3))},Rn.find=pa,Rn.findIndex=Ko,Rn.findKey=function(e,t){return _t(e,ao(t,3),mr)},Rn.findLast=ga,Rn.findLastIndex=jo,Rn.findLastKey=function(e,t){return _t(e,ao(t,3),wr)},Rn.floor=wu,Rn.forEach=va,Rn.forEachRight=ya,Rn.forIn=function(e,t){return null==e?e:vr(e,ao(t,3),Ns)},Rn.forInRight=function(e,t){return null==e?e:yr(e,ao(t,3),Ns)},Rn.forOwn=function(e,t){return e&&mr(e,ao(t,3))},Rn.forOwnRight=function(e,t){return e&&wr(e,ao(t,3))},Rn.get=Cs,Rn.gt=Oa,Rn.gte=Ha,Rn.has=function(e,t){return null!=e&&fo(e,t,xr)},Rn.hasIn=xs,Rn.head=qo,Rn.identity=nu,Rn.includes=function(e,t,n,r){e=qa(e)?e:Rs(e),n=n&&!r?fs(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),as(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Dt(e,t,n)>-1},Rn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:fs(n);return i<0&&(i=vn(r+i,0)),Dt(e,t,i)},Rn.inRange=function(e,t,r){return t=hs(t),r===n?(r=t,t=0):r=hs(r),function(e,t,n){return e>=yn(t,n)&&e<vn(t,n)}(e=ps(e),t,r)},Rn.invoke=Qs,Rn.isArguments=Ka,Rn.isArray=ja,Rn.isArrayBuffer=Ga,Rn.isArrayLike=qa,Rn.isArrayLikeObject=Va,Rn.isBoolean=function(e){return!0===e||!1===e||es(e)&&Er(e)==g},Rn.isBuffer=za,Rn.isDate=Ja,Rn.isElement=function(e){return es(e)&&1===e.nodeType&&!rs(e)},Rn.isEmpty=function(e){if(null==e)return!0;if(qa(e)&&(ja(e)||"string"==typeof e||"function"==typeof e.splice||za(e)||us(e)||Ka(e)))return!e.length;var t=ho(e);if(t==b||t==x)return!e.size;if(Io(e))return!Ur(e).length;for(var n in e)if(Pe.call(e,n))return!1;return!0},Rn.isEqual=function(e,t){return Nr(e,t)},Rn.isEqualWith=function(e,t,r){var i=(r="function"==typeof r?r:n)?r(e,t):n;return i===n?Nr(e,t,n,r):!!i},Rn.isError=Ya,Rn.isFinite=function(e){return"number"==typeof e&&dn(e)},Rn.isFunction=Xa,Rn.isInteger=Wa,Rn.isLength=Za,Rn.isMap=ts,Rn.isMatch=function(e,t){return e===t||Dr(e,t,uo(t))},Rn.isMatchWith=function(e,t,r){return r="function"==typeof r?r:n,Dr(e,t,uo(t),r)},Rn.isNaN=function(e){return ns(e)&&e!=+e},Rn.isNative=function(e){if(bo(e))throw new Ie("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Fr(e)},Rn.isNil=function(e){return null==e},Rn.isNull=function(e){return null===e},Rn.isNumber=ns,Rn.isObject=$a,Rn.isObjectLike=es,Rn.isPlainObject=rs,Rn.isRegExp=is,Rn.isSafeInteger=function(e){return Wa(e)&&e>=-9007199254740991&&e<=A},Rn.isSet=os,Rn.isString=as,Rn.isSymbol=ss,Rn.isTypedArray=us,Rn.isUndefined=function(e){return e===n},Rn.isWeakMap=function(e){return es(e)&&ho(e)==Q},Rn.isWeakSet=function(e){return es(e)&&"[object WeakSet]"==Er(e)},Rn.join=function(e,t){return null==e?"":pn.call(e,t)},Rn.kebabCase=js,Rn.last=Yo,Rn.lastIndexOf=function(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var o=i;return r!==n&&(o=(o=fs(r))<0?vn(i+o,0):yn(o,i-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Nt(e,Pt,o,!0)},Rn.lowerCase=Gs,Rn.lowerFirst=qs,Rn.lt=ls,Rn.lte=As,Rn.max=function(e){return e&&e.length?dr(e,nu,Cr):n},Rn.maxBy=function(e,t){return e&&e.length?dr(e,ao(t,2),Cr):n},Rn.mean=function(e){return Ut(e,nu)},Rn.meanBy=function(e,t){return Ut(e,ao(t,2))},Rn.min=function(e){return e&&e.length?dr(e,nu,Lr):n},Rn.minBy=function(e,t){return e&&e.length?dr(e,ao(t,2),Lr):n},Rn.stubArray=du,Rn.stubFalse=pu,Rn.stubObject=function(){return{}},Rn.stubString=function(){return""},Rn.stubTrue=function(){return!0},Rn.multiply=bu,Rn.nth=function(e,t){return e&&e.length?Hr(e,fs(t)):n},Rn.noConflict=function(){return it._===this&&(it._=Re),this},Rn.noop=su,Rn.now=Ca,Rn.pad=function(e,t,n){e=vs(e);var r=(t=fs(t))?nn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Ki(cn(i),n)+e+Ki(An(i),n)},Rn.padEnd=function(e,t,n){e=vs(e);var r=(t=fs(t))?nn(e):0;return t&&r<t?e+Ki(t-r,n):e},Rn.padStart=function(e,t,n){e=vs(e);var r=(t=fs(t))?nn(e):0;return t&&r<t?Ki(t-r,n)+e:e},Rn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),wn(vs(e).replace(ne,""),t||0)},Rn.random=function(e,t,r){if(r&&"boolean"!=typeof r&&yo(e,t,r)&&(t=r=n),r===n&&("boolean"==typeof t?(r=t,t=n):"boolean"==typeof e&&(r=e,e=n)),e===n&&t===n?(e=0,t=1):(e=hs(e),t===n?(t=e,e=0):t=hs(t)),e>t){var i=e;e=t,t=i}if(r||e%1||t%1){var o=bn();return yn(e+o*(t-e+et("1e-"+((o+"").length-1))),t)}return Vr(e,t)},Rn.reduce=function(e,t,n){var r=ja(e)?xt:Mt,i=arguments.length<3;return r(e,ao(t,4),n,i,cr)},Rn.reduceRight=function(e,t,n){var r=ja(e)?kt:Mt,i=arguments.length<3;return r(e,ao(t,4),n,i,hr)},Rn.repeat=function(e,t,r){return t=(r?yo(e,t,r):t===n)?1:fs(t),zr(vs(e),t)},Rn.replace=function(){var e=arguments,t=vs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Rn.result=function(e,t,r){var i=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=n);++i<o;){var a=null==e?n:e[Lo(t[i])];a===n&&(i=o,a=r),e=Xa(a)?a.call(e):a}return e},Rn.round=Iu,Rn.runInContext=e,Rn.sample=function(e){return(ja(e)?Xn:Yr)(e)},Rn.size=function(e){if(null==e)return 0;if(qa(e))return as(e)?nn(e):e.length;var t=ho(e);return t==b||t==x?e.size:Ur(e).length},Rn.snakeCase=Vs,Rn.some=function(e,t,r){var i=ja(e)?St:ni;return r&&yo(e,t,r)&&(t=n),i(e,ao(t,3))},Rn.sortedIndex=function(e,t){return ri(e,t)},Rn.sortedIndexBy=function(e,t,n){return ii(e,t,ao(n,2))},Rn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ri(e,t);if(r<n&&Ra(e[r],t))return r}return-1},Rn.sortedLastIndex=function(e,t){return ri(e,t,!0)},Rn.sortedLastIndexBy=function(e,t,n){return ii(e,t,ao(n,2),!0)},Rn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ri(e,t,!0)-1;if(Ra(e[n],t))return n}return-1},Rn.startCase=zs,Rn.startsWith=function(e,t,n){return e=vs(e),n=null==n?0:ar(fs(n),0,e.length),t=si(t),e.slice(n,n+t.length)==t},Rn.subtract=Bu,Rn.sum=function(e){return e&&e.length?Rt(e,nu):0},Rn.sumBy=function(e,t){return e&&e.length?Rt(e,ao(t,2)):0},Rn.template=function(e,t,r){var i=Rn.templateSettings;r&&yo(e,t,r)&&(t=n),e=vs(e),t=ws({},t,i,Xi);var o,a,s=ws({},t.imports,i.imports,Xi),u=_s(s),l=jt(s,u),A=0,c=t.interpolate||ye,h="__p += '",f=xe((t.escape||ye).source+"|"+c.source+"|"+(c===X?Ae:ye).source+"|"+(t.evaluate||ye).source+"|$","g"),d="//# sourceURL="+(Pe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Xe+"]")+"\n";e.replace(f,(function(t,n,r,i,s,u){return r||(r=i),h+=e.slice(A,u).replace(me,Xt),n&&(o=!0,h+="' +\n__e("+n+") +\n'"),s&&(a=!0,h+="';\n"+s+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),A=u+t.length,t})),h+="';\n";var p=Pe.call(t,"variable")&&t.variable;if(p){if(ue.test(p))throw new Ie("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(a?h.replace(H,""):h).replace(K,"$1").replace(j,"$1;"),h="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var g=Ws((function(){return Be(u,d+"return "+h).apply(n,l)}));if(g.source=h,Ya(g))throw g;return g},Rn.times=function(e,t){if((e=fs(e))<1||e>A)return[];var n=h,r=yn(e,h);t=ao(t),e-=h;for(var i=Ot(r,t);++n<e;)t(n);return i},Rn.toFinite=hs,Rn.toInteger=fs,Rn.toLength=ds,Rn.toLower=function(e){return vs(e).toLowerCase()},Rn.toNumber=ps,Rn.toSafeInteger=function(e){return e?ar(fs(e),-9007199254740991,A):0===e?e:0},Rn.toString=vs,Rn.toUpper=function(e){return vs(e).toUpperCase()},Rn.trim=function(e,t,r){if((e=vs(e))&&(r||t===n))return Ht(e);if(!e||!(t=si(t)))return e;var i=rn(e),o=rn(t);return mi(i,qt(i,o),Vt(i,o)+1).join("")},Rn.trimEnd=function(e,t,r){if((e=vs(e))&&(r||t===n))return e.slice(0,on(e)+1);if(!e||!(t=si(t)))return e;var i=rn(e);return mi(i,0,Vt(i,rn(t))+1).join("")},Rn.trimStart=function(e,t,r){if((e=vs(e))&&(r||t===n))return e.replace(ne,"");if(!e||!(t=si(t)))return e;var i=rn(e);return mi(i,qt(i,rn(t))).join("")},Rn.truncate=function(e,t){var r=30,i="...";if($a(t)){var o="separator"in t?t.separator:o;r="length"in t?fs(t.length):r,i="omission"in t?si(t.omission):i}var a=(e=vs(e)).length;if(Wt(e)){var s=rn(e);a=s.length}if(r>=a)return e;var u=r-nn(i);if(u<1)return i;var l=s?mi(s,0,u).join(""):e.slice(0,u);if(o===n)return l+i;if(s&&(u+=l.length-u),is(o)){if(e.slice(u).search(o)){var A,c=l;for(o.global||(o=xe(o.source,vs(ce.exec(o))+"g")),o.lastIndex=0;A=o.exec(c);)var h=A.index;l=l.slice(0,h===n?u:h)}}else if(e.indexOf(si(o),u)!=u){var f=l.lastIndexOf(o);f>-1&&(l=l.slice(0,f))}return l+i},Rn.unescape=function(e){return(e=vs(e))&&V.test(e)?e.replace(G,an):e},Rn.uniqueId=function(e){var t=++Ue;return vs(e)+t},Rn.upperCase=Js,Rn.upperFirst=Ys,Rn.each=va,Rn.eachRight=ya,Rn.first=qo,au(Rn,(gu={},mr(Rn,(function(e,t){Pe.call(Rn.prototype,t)||(gu[t]=e)})),gu),{chain:!1}),Rn.VERSION="4.17.21",yt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Rn[e].placeholder=Rn})),yt(["drop","take"],(function(e,t){jn.prototype[e]=function(r){r=r===n?1:vn(fs(r),0);var i=this.__filtered__&&!t?new jn(this):this.clone();return i.__filtered__?i.__takeCount__=yn(r,i.__takeCount__):i.__views__.push({size:yn(r,h),type:e+(i.__dir__<0?"Right":"")}),i},jn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),yt(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;jn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:ao(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),yt(["head","last"],(function(e,t){var n="take"+(t?"Right":"");jn.prototype[e]=function(){return this[n](1).value()[0]}})),yt(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");jn.prototype[e]=function(){return this.__filtered__?new jn(this):this[n](1)}})),jn.prototype.compact=function(){return this.filter(nu)},jn.prototype.find=function(e){return this.filter(e).head()},jn.prototype.findLast=function(e){return this.reverse().find(e)},jn.prototype.invokeMap=Jr((function(e,t){return"function"==typeof e?new jn(this):this.map((function(n){return Qr(n,e,t)}))})),jn.prototype.reject=function(e){return this.filter(Pa(ao(e)))},jn.prototype.slice=function(e,t){e=fs(e);var r=this;return r.__filtered__&&(e>0||t<0)?new jn(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==n&&(r=(t=fs(t))<0?r.dropRight(-t):r.take(t-e)),r)},jn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},jn.prototype.toArray=function(){return this.take(h)},mr(jn.prototype,(function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=Rn[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(Rn.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,u=t instanceof jn,l=s[0],A=u||ja(t),c=function(e){var t=o.apply(Rn,Ct([e],s));return i&&h?t[0]:t};A&&r&&"function"==typeof l&&1!=l.length&&(u=A=!1);var h=this.__chain__,f=!!this.__actions__.length,d=a&&!h,p=u&&!f;if(!a&&A){t=p?t:new jn(this);var g=e.apply(t,s);return g.__actions__.push({func:ha,args:[c],thisArg:n}),new Kn(g,h)}return d&&p?e.apply(this,s):(g=this.thru(c),d?i?g.value()[0]:g.value():g)})})),yt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Qe[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Rn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(ja(i)?i:[],e)}return this[n]((function(n){return t.apply(ja(n)?n:[],e)}))}})),mr(jn.prototype,(function(e,t){var n=Rn[t];if(n){var r=n.name+"";Pe.call(_n,r)||(_n[r]=[]),_n[r].push({name:t,func:n})}})),_n[Mi(n,2).name]=[{name:"wrapper",func:n}],jn.prototype.clone=function(){var e=new jn(this.__wrapped__);return e.__actions__=ki(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=ki(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=ki(this.__views__),e},jn.prototype.reverse=function(){if(this.__filtered__){var e=new jn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},jn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=ja(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=yn(t,e+a);break;case"takeRight":e=vn(e,t-a)}}return{start:e,end:t}}(0,i,this.__views__),a=o.start,s=o.end,u=s-a,l=r?s:a-1,A=this.__iteratees__,c=A.length,h=0,f=yn(u,this.__takeCount__);if(!n||!r&&i==u&&f==u)return hi(e,this.__actions__);var d=[];e:for(;u--&&h<f;){for(var p=-1,g=e[l+=t];++p<c;){var v=A[p],y=v.iteratee,m=v.type,w=y(g);if(2==m)g=w;else if(!w){if(1==m)continue e;break e}}d[h++]=g}return d},Rn.prototype.at=fa,Rn.prototype.chain=function(){return ca(this)},Rn.prototype.commit=function(){return new Kn(this.value(),this.__chain__)},Rn.prototype.next=function(){this.__values__===n&&(this.__values__=cs(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?n:this.__values__[this.__index__++]}},Rn.prototype.plant=function(e){for(var t,r=this;r instanceof Hn;){var i=Mo(r);i.__index__=0,i.__values__=n,t?o.__wrapped__=i:t=i;var o=i;r=r.__wrapped__}return o.__wrapped__=e,t},Rn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof jn){var t=e;return this.__actions__.length&&(t=new jn(this)),(t=t.reverse()).__actions__.push({func:ha,args:[$o],thisArg:n}),new Kn(t,this.__chain__)}return this.thru($o)},Rn.prototype.toJSON=Rn.prototype.valueOf=Rn.prototype.value=function(){return hi(this.__wrapped__,this.__actions__)},Rn.prototype.first=Rn.prototype.head,ut&&(Rn.prototype[ut]=function(){return this}),Rn}();at?((at.exports=sn)._=sn,ot._=sn):it._=sn}).call(Do)}(Iq,Iq.exports);var Bq=gj.validate,Eq=vj,Cq=yj,xq=cq.exports,kq=Iq.exports,Sq=function(){function e(t){if(s(this,e),!Bq(t))throw new Error("JSON is invalid. Cannot construct Encoder.");this.json=t}return l(e,[{key:"constructRootMap",value:function(){var e=this;return Object.keys(this.json).map((function(t){var n=e.json[t];return"string"==typeof n&&(n=Cq.encode(Xo.from(n,"hex"))),n instanceof Array&&("anchors"===t&&(n=e.constructAnchorsMap(n)),"path"===t&&(n=e.constructPathMap(n))),[Eq.root[t],n]}))}},{key:"constructAnchorsMap",value:function(e){return e.map((function(e){var t=e.split(":");return t.shift(),t.map((function(e,n){return 0===n?[n,Eq.chain[e].id]:1===n?[n,Eq.chain[t[n-1]].networks[e]]:[n,Cq.encode(Xo.from(e,"hex"))]}))}))}},{key:"constructPathMap",value:function(e){return kq.flatten(e.map((function(e){return Object.keys(e).map((function(t){return[Eq.path[t],Cq.encode(Xo.from(e[t],"hex"))]}))})))}},{key:"encode",value:function(){var e=this.constructRootMap(),t=Cq.encode(e);return xq.encode("base58btc",t)}}]),e}(),Qq=vj,_q=yj,Nq=cq.exports,Dq=Iq.exports,Fq=function(){function e(t){if(s(this,e),!Nq.isEncoded(t))throw new Error("Base58 string is invalid. Cannot construct Decoder.");this.base58=t}return l(e,[{key:"constructRootJSON",value:function(e){var t=this,n=Dq.invert(Qq.root);return e.reduce((function(e,r){var i=n[r[0]],o=r[1];return o instanceof Array&&("anchors"===i&&(o=t.constructAnchorsJSON(o)),"path"===i&&(o=t.constructPathJSON(o))),o instanceof Xo&&(o=_q.decode(o).toString("hex")),e[i]=o,e}),{})}},{key:"constructAnchorsJSON",value:function(e){var t=Dq.invertBy(Qq.chain,(function(e){return e.id}));return e.map((function(e){return e.reduce((function(e,n){if(0===n[0])return"".concat(e,":").concat(t[n[1]]);if(1===n[0]){var r=e.split(":").pop();return"".concat(e,":").concat(Dq.invert(Qq.chain[r].networks)[n[1]])}return"".concat(e,":").concat(_q.decode(n[1]).toString("hex"))}),"blink")}))}},{key:"constructPathJSON",value:function(e){var t=Dq.invert(Qq.path);return e.map((function(e){return A({},t[e[0]],_q.decode(e[1]).toString("hex"))}))}},{key:"decode",value:function(){var e=Nq.decode(this.base58),t=_q.decode(e);return this.constructRootJSON(t)}}]),e}(),Pq={Encoder:Sq,Decoder:Fq,Keymap:vj};function Uq(e){var t=Object.keys(Ll).map((function(e){return Ll[e]})).find((function(t){return t.signatureValue===e}));return t}function Lq(e,t){var n=e.findIndex((function(e){return e===t}));n>-1&&e.splice(n,1)}var Tq={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",obi:"https://w3id.org/openbadges#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2017:"sec:MerkleProof2017",RecipientProfile:"bc:RecipientProfile",SignatureLine:"bc:SignatureLine",MerkleProofVerification2017:"bc:MerkleProofVerification2017",recipientProfile:"bc:recipientProfile",signatureLines:"bc:signatureLines",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},subtitle:"bc:subtitle",jobTitle:"schema:jobTitle",creator:{"@id":"dc:creator","@type":"@id"},expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},revoked:{"@id":"sec:expiration","@type":"xsd:dateTime"},CryptographicKey:"sec:Key",signature:"sec:signature",verification:"bc:verification",publicKeys:"bc:publicKeys",ChainpointSHA256v2:"cp:ChainpointSHA256v2",BTCOpReturn:"cp:BTCOpReturn",targetHash:"cp:targetHash",merkleRoot:"cp:merkleRoot",proof:"cp:proof",anchors:"cp:anchors",sourceId:"cp:sourceId",right:"cp:right",left:"cp:left"},"obi:validation":[{"obi:validatesType":"RecipientProfile","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/recipientSchema.json"},{"obi:validatesType":"SignatureLine","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/signatureLineSchema.json"},{"obi:validatesType":"MerkleProof2017","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/merkleProof2017Schema.json"}]},Mq={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"bc:created","@type":"xsd:dateTime"},name:{"@id":"schema:name"}}},Rq={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",vc:"https://www.w3.org/2018/credentials/v1",schema:"https://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},metadata:"bc:metadata",display:{"@id":"bc:display","@context":{id:"@id",type:"@type",contentMediaType:{"@id":"bc:contentMediaType","@type":"@id"},contentEncoding:{"@id":"bc:contentEncoding","@type":"@id"},content:{"@id":"bc:content","@type":"@id"}}},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"https://purl.org/dc/terms/created","@type":"xsd:dateTime"},challenge:"sec:challenge",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},name:{"@id":"schema:name"},description:{"@id":"schema:description"},email:{"@id":"schema:email"},publicKey:{"@id":"sec:publicKey","@type":"@id"},url:{"@id":"schema:url","@type":"@id"},image:{"@id":"schema:image","@type":"@id"}}};function Oq(e){e=e.trim();for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substring(n,n+2),16));return t}Of["https://w3id.org/blockcerts/schema/2.0-alpha/context.json"]=Tq,Of["https://www.blockcerts.org/schema/2.0-alpha/context.json"]=Tq,Of["https://www.blockcerts.org/schema/3.0-alpha/context.json"]=Mq,Of["https://w3id.org/blockcerts/schema/3.0-alpha/context.json"]=Mq,Of["https://w3id.org/blockcerts/v3.0-alpha"]=Mq,Of["https://www.blockcerts.org/schema/3.0-beta/context.json"]=Rq,Of["https://w3id.org/blockcerts/schema/3.0-beta/context.json"]=Rq,Of["https://w3id.org/blockcerts/v3.0-beta"]=Rq,Of["https://w3id.org/security/suites/ed25519-2020/v1"]={"@context":{id:"@id",type:"@type","@protected":!0,proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},Ed25519VerificationKey2020:{"@id":"https://w3id.org/security#Ed25519VerificationKey2020","@context":{"@protected":!0,id:"@id",type:"@type",controller:{"@id":"https://w3id.org/security#controller","@type":"@id"},revoked:{"@id":"https://w3id.org/security#revoked","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},publicKeyMultibase:{"@id":"https://w3id.org/security#publicKeyMultibase","@type":"https://w3id.org/security#multibase"}}},Ed25519Signature2020:{"@id":"https://w3id.org/security#Ed25519Signature2020","@context":{"@protected":!0,id:"@id",type:"@type",challenge:"https://w3id.org/security#challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},domain:"https://w3id.org/security#domain",expires:{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},nonce:"https://w3id.org/security#nonce",proofPurpose:{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":!0,id:"@id",type:"@type",assertionMethod:{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},capabilityInvocation:{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},capabilityDelegation:{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},keyAgreement:{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},proofValue:{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},verificationMethod:{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}}}};var Hq=function(e){c(n,e);var t=b(n);function n(e,r){var i;return s(this,n),(i=t.call(this,r)).stepCode=e,i}return l(n)}(g(Error)),Kq="en-US",jq={"en-US":{errors:{ensureHashesEqual:"Computed hash does not match remote hash",ensureMerkleRootEqual:"Merkle root does not match remote hash.",ensureValidReceipt:"The receipt is malformed. There was a problem navigating the merkle tree in the receipt.",failedJsonLdNormalization:"Failed JSON-LD normalization",foundUnmappedFields:"Found unmapped fields during JSON-LD normalization",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Cannot verify this certificate without a transaction ID to compare against.",invalidMerkleReceipt:"Invalid Merkle Receipt. Proof hash did not match Merkle root",isTransactionIdValid:"Cannot verify this certificate without a transaction ID to compare against.",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},fr:{errors:{ensureHashesEqual:"Calcul du hash local différent du hash distant",ensureMerkleRootEqual:"Le Merkle root ne correspond pas au hash distant",ensureValidReceipt:"Erreur d'écriture du reçu. Un problème est survenu lors de la navigation de l'arbre Merkle du reçu.",failedJsonLdNormalization:"Erreur de normalisation JSON-LD",foundUnmappedFields:"Champs non liés découverts durant la normalisation JSON-LD",identityErrorBaseMessage:"Identité de l'émetteur invalide",deriveIssuingAddressFromPublicKey:"Cette blockchain n'est pas supportée pour la vérification de l'identité décentralisée.",compareIssuingAddress:"La méthode de vérification n'a pas permis d'établir l'identité de l'émetteur.",getTransactionId:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",invalidMerkleReceipt:"Reçu Merkle invalide. Hash de preuve différent du Merkle root",isTransactionIdValid:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",noProofSpecified:"La propriété 'proof' du document est un tableau mais aucune preuve n'a été passée pour savoir ce qu'il faut vérifier"}},es:{errors:{ensureHashesEqual:"La cadena binaria calculada no corresponde con la cadena binaria remota",ensureMerkleRootEqual:"La raíz Merkle no corresponde con la cadena binaria remota",ensureValidReceipt:"El recibo está malformado. Hubo un problema navegando el árbol Merkle en el recibo",failedJsonLdNormalization:"La normalización del JSON-LD ha fallado",foundUnmappedFields:"Se han encontrado campos no mapeados durante la normalización de JSON-LD",identityErrorBaseMessage:"Identitad del emisor inválida",deriveIssuingAddressFromPublicKey:"No se puede validar la identitad decentalisada con esta cadena binaria.",compareIssuingAddress:"El metodo de verificación no corresponde a la identitad del emisor.",getTransactionId:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",invalidMerkleReceipt:"Recibo Merkle inválido. La cadena binaria de prueba no corresponde con la raíz Merkle",isTransactionIdValid:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",noProofSpecified:"La propiedad 'proof' del documento es una lista, pero no prueba especifica ha sido declarada para conocer el punto de verificación"}},mt:{errors:{ensureHashesEqual:"Il-hash ikkalkulat ma jikkorrispondix mar-remote hash",ensureMerkleRootEqual:"Merkle root ma taqbilx mar-remote hash",ensureValidReceipt:"L-irċevuta hija malformata. Kien hemm problema fin-navigazzjoni tal-merkle tree fl-irċevuta",failedJsonLdNormalization:"In-normalizzazzjoni ta' JSON-LD ma rnexxietx",foundUnmappedFields:"Instabu unmapped fields matul in-normalizzazzjoni JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",invalidMerkleReceipt:"Irċevuta Merkle invalida. Il-proof hash ma kienx jaqbel mal-Merkle root",isTransactionIdValid:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},"it-IT":{errors:{ensureHashesEqual:"L'hash calcolato non corrisponde all'hash remoto",ensureMerkleRootEqual:"La radice di Merkle non corrisponde all'hash remoto.",ensureValidReceipt:"La ricevuta è malformata. C'è stato un problema nella navigazione dell'albero di Merkle nella ricevuta.",failedJsonLdNormalization:"Normalizzazione JSON-LD fallita",foundUnmappedFields:"Campi non mappati trovati durante la normalizzazione JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",invalidMerkleReceipt:"Ricevuta Merkle non valida. L'hash di prova non corrisponde alla radice di Merkle",isTransactionIdValid:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},ja:{errors:{ensureHashesEqual:"算出されたハッシュがリモートハッシュと一致しませんでした",ensureMerkleRootEqual:"Merkle rootがリモートハッシュと一致しませんでした",ensureValidReceipt:"レシートが異常です。レシート内のMerkle treeを辿る際に問題が発生しました。",failedJsonLdNormalization:"JSON-LDの正規化に失敗しました",foundUnmappedFields:"JSON-LDの正規化時にマップされていないフィールドを検出しました",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"照合のための取引IDがないため、この証明書を認証できません。",invalidMerkleReceipt:"Merkleレシートが無効です。証明ハッシュがMerkle rootと一致しませんでした。",isTransactionIdValid:"照合するための取引IDがないため、この証明書を認証できません。",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}}};function Gq(e,t){return e&&t?jq[Kq]?jq[Kq][e]?jq[Kq][e][t]?jq[Kq][e][t]||"":"[missing locale item data]":"[missing locale group data]":"[missing locale data]":""}var qq=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}u((r=r.apply(e,t||[])).next())}))};function Vq(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){};return qq(this,void 0,void 0,r().mark((function i(){var o,a,s,u,l;return r().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(e["@context"].find((function(e){return(t=e)===Object(t)&&"@vocab"in e;var t}))||e["@context"].push({"@vocab":"http://fallback.org/"}),o=JSON.parse(JSON.stringify(e)),!Array.isArray(o.proof)){i.next=9;break}if(t){i.next=5;break}throw new Hq("computeLocalHash",Gq("errors","noProofSpecified"));case 5:a=o.proof.findIndex((function(e){return e.proofValue===t.proofValue})),o.proof=o.proof.slice(0,a),i.next=10;break;case 9:delete o.proof;case 10:return s={algorithm:"URDNA2015",format:"application/nquads",documentLoader:function(e){return qq(this,void 0,void 0,r().mark((function t(){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=null!=n,!t.t0){t.next=4;break}return t.next=4,n(e);case 4:return t.abrupt("return",e in Of?{contextUrl:null,document:Of[e],documentUrl:e}:rw.documentLoader(e));case 5:case"end":return t.stop()}}),t)})))}},i.prev=11,i.next=14,rw.normalize(o,s);case 14:u=i.sent,i.next=20;break;case 17:throw i.prev=17,i.t0=i.catch(11),console.error(i.t0),new Hq("computeLocalHash",Gq("errors","failedJsonLdNormalization"));case 20:if(l=function(e){var t=e.split("\n"),n=/<http:\/\/fallback\.org\/(.*)>/,r=t.map((function(e){return n.exec(e)})).filter((function(e){return null!=e}));if(r.length>0){var i=r.map((function(e){return e[1]})).sort();return Array.from(new Set(i))}return null}(u),!l){i.next=23;break}throw new Hq("computeLocalHash","".concat(Gq("errors","foundUnmappedFields"),": ").concat(l.join(", ")));case 23:return i.abrupt("return",qO(function(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t.push(r):r<2048?t.push(192|r>>6,128|63&r):r<55296||r>=57344?t.push(224|r>>12,128|r>>6&63,128|63&r):(n++,r=65536+((1023&r)<<10|1023&e.charCodeAt(n)),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return t}(u)));case 24:case"end":return i.stop()}}),i,null,[[11,17]])})))}var zq=Xo,Jq={},Yq={},Xq={};Object.defineProperty(Xq,"__esModule",{value:!0}),Xq.testnet=Xq.regtest=Xq.bitcoin=void 0,Xq.bitcoin={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},Xq.regtest={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},Xq.testnet={messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239};var Wq={},Zq={},$q={},eV={};Object.defineProperty(eV,"__esModule",{value:!0}),eV.encode=eV.decode=eV.check=void 0,eV.check=function(e){if(e.length<8)return!1;if(e.length>72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;var t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;var n=e[5+t];return!(0===n||6+t+n!==e.length||128&e[4]||t>1&&0===e[4]&&!(128&e[5])||128&e[t+6]||n>1&&0===e[t+6]&&!(128&e[t+7]))},eV.decode=function(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");var t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");var n=e[5+t];if(0===n)throw new Error("S length is zero");if(6+t+n!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(n>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}},eV.encode=function(e,t){var n=e.length,r=t.length;if(0===n)throw new Error("R length is zero");if(0===r)throw new Error("S length is zero");if(n>33)throw new Error("R length is too long");if(r>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&t[0])throw new Error("S value is negative");if(n>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(r>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");var i=Xo.allocUnsafe(6+n+r);return i[0]=48,i[1]=i.length-2,i[2]=2,i[3]=e.length,e.copy(i,4),i[4+n]=2,i[5+n]=t.length,t.copy(i,6+n),i};var tV={};Object.defineProperty(tV,"__esModule",{value:!0}),tV.REVERSE_OPS=tV.OPS=void 0;var nV={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};tV.OPS=nV;var rV={};tV.REVERSE_OPS=rV;for(var iV=0,oV=Object.keys(nV);iV<oV.length;iV++){var aV=oV[iV];rV[nV[aV]]=aV}var sV={};Object.defineProperty(sV,"__esModule",{value:!0}),sV.decode=sV.encode=sV.encodingLength=void 0;var uV=tV;function lV(e){return e<uV.OPS.OP_PUSHDATA1?1:e<=255?2:e<=65535?3:5}sV.encodingLength=lV,sV.encode=function(e,t,n){var r=lV(t);return 1===r?e.writeUInt8(t,n):2===r?(e.writeUInt8(uV.OPS.OP_PUSHDATA1,n),e.writeUInt8(t,n+1)):3===r?(e.writeUInt8(uV.OPS.OP_PUSHDATA2,n),e.writeUInt16LE(t,n+1)):(e.writeUInt8(uV.OPS.OP_PUSHDATA4,n),e.writeUInt32LE(t,n+1)),r},sV.decode=function(e,t){var n,r,i=e.readUInt8(t);if(i<uV.OPS.OP_PUSHDATA1)n=i,r=1;else if(i===uV.OPS.OP_PUSHDATA1){if(t+2>e.length)return null;n=e.readUInt8(t+1),r=2}else if(i===uV.OPS.OP_PUSHDATA2){if(t+3>e.length)return null;n=e.readUInt16LE(t+1),r=3}else{if(t+5>e.length)return null;if(i!==uV.OPS.OP_PUSHDATA4)throw new Error("Unexpected opcode");n=e.readUInt32LE(t+1),r=5}return{opcode:i,number:n,size:r}};var AV={};Object.defineProperty(AV,"__esModule",{value:!0}),AV.encode=AV.decode=void 0,AV.decode=function(e,t,n){t=t||4,n=void 0===n||n;var r=e.length;if(0===r)return 0;if(r>t)throw new TypeError("Script number overflow");if(n&&0==(127&e[r-1])&&(r<=1||0==(128&e[r-2])))throw new Error("Non-minimally encoded script number");if(5===r){var i=e.readUInt32LE(0),o=e.readUInt8(4);return 128&o?-(4294967296*(-129&o)+i):4294967296*o+i}for(var a=0,s=0;s<r;++s)a|=e[s]<<8*s;return 128&e[r-1]?-(a&~(128<<8*(r-1))):a},AV.encode=function(e){for(var t,n=Math.abs(e),r=(t=n)>2147483647?5:t>8388607?4:t>32767?3:t>127?2:t>0?1:0,i=Xo.allocUnsafe(r),o=e<0,a=0;a<r;++a)i.writeUInt8(255&n,a),n>>=8;return 128&i[r-1]?i.writeUInt8(o?128:0,r-1):o&&(i[r-1]|=128),i};var cV={},hV={},fV={Array:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return null!=e&&e.constructor===Array})),Boolean:function(e){return"boolean"==typeof e},Function:function(e){return"function"==typeof e},Nil:function(e){return null==e},Number:function(e){return"number"==typeof e},Object:function(e){return"object"==i(e)},String:function(e){return"string"==typeof e},"":function(){return!0}};for(var dV in fV.Null=fV.Nil,fV)fV[dV].toJSON=function(e){return e}.bind(null,dV);var pV=fV,gV=pV;function vV(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function yV(e){return gV.Nil(e)?"":vV(e.constructor)}function mV(e,t){Error.captureStackTrace&&Error.captureStackTrace(e,t)}function wV(e){return gV.Function(e)?e.toJSON?e.toJSON():vV(e):gV.Array(e)?"Array":e&&gV.Object(e)?"Object":void 0!==e?e:""}function bV(e,t,n){var r=function(e){return gV.Function(e)?"":gV.String(e)?JSON.stringify(e):e&&gV.Object(e)?"":e}(t);return"Expected "+wV(e)+", got"+(""!==n?" "+n:"")+(""!==r?" "+r:"")}function IV(e,t,n){n=n||yV(t),this.message=bV(e,t,n),mV(this,IV),this.__type=e,this.__value=t,this.__valueTypeName=n}function BV(e,t,n,r,i){e?(i=i||yV(r),this.message=function(e,t,n,r,i){var o='" of type ';return"key"===t&&(o='" with key type '),bV('property "'+wV(n)+o+wV(e),r,i)}(e,n,t,r,i)):this.message='Unexpected property "'+t+'"',mV(this,IV),this.__label=n,this.__property=t,this.__type=e,this.__value=r,this.__valueTypeName=i}IV.prototype=Object.create(Error.prototype),IV.prototype.constructor=IV,BV.prototype=Object.create(Error.prototype),BV.prototype.constructor=IV;var EV={TfTypeError:IV,TfPropertyTypeError:BV,tfCustomError:function(e,t){return new IV(e,{},t)},tfSubError:function(e,t,n){return e instanceof BV?(t=t+"."+e.__property,e=new BV(e.__type,t,e.__label,e.__value,e.__valueTypeName)):e instanceof IV&&(e=new BV(e.__type,t,n,e.__value,e.__valueTypeName)),mV(e),e},tfJSON:wV,getValueTypeName:yV},CV=pV,xV=EV;function kV(e){return Da(e)}function SV(e){return"string"==typeof e&&/^([0-9a-f]{2})+$/i.test(e)}function QV(e,t){var n=e.toJSON();function r(r){if(!e(r))return!1;if(r.length===t)return!0;throw xV.tfCustomError(n+"(Length: "+t+")",n+"(Length: "+r.length+")")}return r.toJSON=function(){return n},r}var _V=QV.bind(null,CV.Array),NV=QV.bind(null,kV),DV=QV.bind(null,SV),FV=QV.bind(null,CV.String),PV=Math.pow(2,53)-1,UV={ArrayN:_V,Buffer:kV,BufferN:NV,Finite:function(e){return"number"==typeof e&&isFinite(e)},Hex:SV,HexN:DV,Int8:function(e){return e<<24>>24===e},Int16:function(e){return e<<16>>16===e},Int32:function(e){return(0|e)===e},Int53:function(e){return"number"==typeof e&&e>=-PV&&e<=PV&&Math.floor(e)===e},Range:function(e,t,n){function r(r,i){return n(r,i)&&r>e&&r<t}return n=n||CV.Number,r.toJSON=function(){return"".concat(n.toJSON()," between [").concat(e,", ").concat(t,"]")},r},StringN:FV,UInt8:function(e){return(255&e)===e},UInt16:function(e){return(65535&e)===e},UInt32:function(e){return e>>>0===e},UInt53:function(e){return"number"==typeof e&&e>=0&&e<=PV&&Math.floor(e)===e}};for(var LV in UV)UV[LV].toJSON=function(e){return e}.bind(null,LV);var TV=UV,MV=pV,RV=EV.tfJSON,OV=EV.TfTypeError,HV=EV.TfPropertyTypeError,KV=EV.tfSubError,jV=EV.getValueTypeName,GV={arrayOf:function(e,t){function n(n,r){return!!MV.Array(n)&&!MV.Nil(n)&&!(void 0!==t.minLength&&n.length<t.minLength)&&!(void 0!==t.maxLength&&n.length>t.maxLength)&&(void 0===t.length||n.length===t.length)&&n.every((function(t,n){try{return VV(e,t,r)}catch(e){throw KV(e,n)}}))}return e=qV(e),t=t||{},n.toJSON=function(){var n="["+RV(e)+"]";return void 0!==t.length?n+="{"+t.length+"}":void 0===t.minLength&&void 0===t.maxLength||(n+="{"+(void 0===t.minLength?0:t.minLength)+","+(void 0===t.maxLength?1/0:t.maxLength)+"}"),n},n},maybe:function e(t){function n(n,r){return MV.Nil(n)||t(n,r,e)}return t=qV(t),n.toJSON=function(){return"?"+RV(t)},n},map:function(e,t){function n(n,r){if(!MV.Object(n))return!1;if(MV.Nil(n))return!1;for(var i in n){try{t&&VV(t,i,r)}catch(e){throw KV(e,i,"key")}try{var o=n[i];VV(e,o,r)}catch(e){throw KV(e,i)}}return!0}return e=qV(e),t&&(t=qV(t)),n.toJSON=t?function(){return"{"+RV(t)+": "+RV(e)+"}"}:function(){return"{"+RV(e)+"}"},n},object:function(e){var t={};for(var n in e)t[n]=qV(e[n]);function r(e,n){if(!MV.Object(e))return!1;if(MV.Nil(e))return!1;var r;try{for(r in t)VV(t[r],e[r],n)}catch(e){throw KV(e,r)}if(n)for(r in e)if(!t[r])throw new HV(void 0,r);return!0}return r.toJSON=function(){return RV(t)},r},anyOf:function(){var e=[].slice.call(arguments).map(qV);function t(t,n){return e.some((function(e){try{return VV(e,t,n)}catch(e){return!1}}))}return t.toJSON=function(){return e.map(RV).join("|")},t},allOf:function(){var e=[].slice.call(arguments).map(qV);function t(t,n){return e.every((function(e){try{return VV(e,t,n)}catch(e){return!1}}))}return t.toJSON=function(){return e.map(RV).join(" & ")},t},quacksLike:function(e){function t(t){return e===jV(t)}return t.toJSON=function(){return e},t},tuple:function(){var e=[].slice.call(arguments).map(qV);function t(t,n){return!MV.Nil(t)&&!MV.Nil(t.length)&&(!n||t.length===e.length)&&e.every((function(e,r){try{return VV(e,t[r],n)}catch(e){throw KV(e,r)}}))}return t.toJSON=function(){return"("+e.map(RV).join(", ")+")"},t},value:function(e){function t(t){return t===e}return t.toJSON=function(){return e},t}};function qV(e){if(MV.String(e))return"?"===e[0]?GV.maybe(e.slice(1)):MV[e]||GV.quacksLike(e);if(e&&MV.Object(e)){if(MV.Array(e)){if(1!==e.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return GV.arrayOf(e[0])}return GV.object(e)}return MV.Function(e)?e:GV.value(e)}function VV(e,t,n,r){if(MV.Function(e)){if(e(t,n))return!0;throw new OV(r||e,t)}return VV(qV(e),t,n)}for(var zV in GV.oneOf=GV.anyOf,MV)VV[zV]=MV[zV];for(zV in GV)VV[zV]=GV[zV];var JV=TV;for(zV in JV)VV[zV]=JV[zV];VV.compile=qV,VV.TfTypeError=OV,VV.TfPropertyTypeError=HV;var YV=VV;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.oneOf=e.Null=e.BufferN=e.Function=e.UInt32=e.UInt8=e.tuple=e.maybe=e.Hex=e.Buffer=e.String=e.Boolean=e.Array=e.Number=e.Hash256bit=e.Hash160bit=e.Buffer256bit=e.Network=e.ECPoint=e.Satoshi=e.Signer=e.BIP32Path=e.UInt31=e.isPoint=e.typeforce=void 0;var t=Pa;e.typeforce=YV;var n=t.Buffer.alloc(32,0),r=t.Buffer.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex");e.isPoint=function(e){if(!t.Buffer.isBuffer(e))return!1;if(e.length<33)return!1;var i=e[0],o=e.slice(1,33);if(0===o.compare(n))return!1;if(o.compare(r)>=0)return!1;if((2===i||3===i)&&33===e.length)return!0;var a=e.slice(33);return 0!==a.compare(n)&&!(a.compare(r)>=0)&&4===i&&65===e.length};var i=Math.pow(2,31)-1;function o(t){return e.typeforce.String(t)&&!!t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}e.UInt31=function(t){return e.typeforce.UInt32(t)&&t<=i},e.BIP32Path=o,o.toJSON=function(){return"BIP32 derivation path"},e.Signer=function(t){return(e.typeforce.Buffer(t.publicKey)||"function"==typeof t.getPublicKey)&&"function"==typeof t.sign},e.Satoshi=function(t){return e.typeforce.UInt53(t)&&t<=21e14},e.ECPoint=e.typeforce.quacksLike("Point"),e.Network=e.typeforce.compile({messagePrefix:e.typeforce.oneOf(e.typeforce.Buffer,e.typeforce.String),bip32:{public:e.typeforce.UInt32,private:e.typeforce.UInt32},pubKeyHash:e.typeforce.UInt8,scriptHash:e.typeforce.UInt8,wif:e.typeforce.UInt8}),e.Buffer256bit=e.typeforce.BufferN(32),e.Hash160bit=e.typeforce.BufferN(20),e.Hash256bit=e.typeforce.BufferN(32),e.Number=e.typeforce.Number,e.Array=e.typeforce.Array,e.Boolean=e.typeforce.Boolean,e.String=e.typeforce.String,e.Buffer=e.typeforce.Buffer,e.Hex=e.typeforce.Hex,e.maybe=e.typeforce.maybe,e.tuple=e.typeforce.tuple,e.UInt8=e.typeforce.UInt8,e.UInt32=e.typeforce.UInt32,e.Function=e.typeforce.Function,e.BufferN=e.typeforce.BufferN,e.Null=e.typeforce.Null,e.oneOf=e.typeforce.oneOf}(hV),Object.defineProperty(cV,"__esModule",{value:!0}),cV.encode=cV.decode=void 0;var XV=eV,WV=hV,ZV=WV.typeforce,$V=Xo.alloc(1,0);function ez(e){for(var t=0;0===e[t];)++t;return t===e.length?$V:128&(e=e.slice(t))[0]?Xo.concat([$V,e],1+e.length):e}function tz(e){0===e[0]&&(e=e.slice(1));var t=Xo.alloc(32,0),n=Math.max(0,32-e.length);return e.copy(t,n),t}cV.decode=function(e){var t=e.readUInt8(e.length-1),n=-129&t;if(n<=0||n>=4)throw new Error("Invalid hashType "+t);var r=XV.decode(e.slice(0,-1)),i=tz(r.r),o=tz(r.s);return{signature:Xo.concat([i,o],64),hashType:t}},cV.encode=function(e,t){ZV({signature:WV.BufferN(64),hashType:WV.UInt8},{signature:e,hashType:t});var n=-129&t;if(n<=0||n>=4)throw new Error("Invalid hashType "+t);var r=Xo.allocUnsafe(1);r.writeUInt8(t,0);var i=ez(e.slice(0,32)),o=ez(e.slice(32,64));return Xo.concat([XV.encode(i,o),r])},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.signature=e.number=e.isCanonicalScriptSignature=e.isDefinedHashType=e.isCanonicalPubKey=e.toStack=e.fromASM=e.toASM=e.decompile=e.compile=e.isPushOnly=e.OPS=void 0;var t=eV,n=tV;Object.defineProperty(e,"OPS",{enumerable:!0,get:function(){return n.OPS}});var r=sV,i=AV,o=cV,a=hV,s=a.typeforce,u=n.OPS.OP_RESERVED;function l(e){return a.Buffer(e)||function(e){return a.Number(e)&&(e===n.OPS.OP_0||e>=n.OPS.OP_1&&e<=n.OPS.OP_16||e===n.OPS.OP_1NEGATE)}(e)}function A(e){return a.Array(e)&&e.every(l)}function c(e){return 0===e.length?n.OPS.OP_0:1===e.length?e[0]>=1&&e[0]<=16?u+e[0]:129===e[0]?n.OPS.OP_1NEGATE:void 0:void 0}function h(e){return Da(e)}function f(e){return Da(e)}function d(e){if(h(e))return e;s(a.Array,e);var t=e.reduce((function(e,t){return f(t)?1===t.length&&void 0!==c(t)?e+1:e+r.encodingLength(t.length)+t.length:e+1}),0),n=Xo.allocUnsafe(t),i=0;if(e.forEach((function(e){if(f(e)){var t=c(e);if(void 0!==t)return n.writeUInt8(t,i),void(i+=1);i+=r.encode(n,e.length,i),e.copy(n,i),i+=e.length}else n.writeUInt8(e,i),i+=1})),i!==n.length)throw new Error("Could not decode chunks");return n}function p(e){if(t=e,a.Array(t))return e;var t;s(a.Buffer,e);for(var i=[],o=0;o<e.length;){var u=e[o];if(u>n.OPS.OP_0&&u<=n.OPS.OP_PUSHDATA4){var l=r.decode(e,o);if(null===l)return null;if((o+=l.size)+l.number>e.length)return null;var A=e.slice(o,o+l.number);o+=l.number;var h=c(A);void 0!==h?i.push(h):i.push(A)}else i.push(u),o+=1}return i}function g(e){var t=-129&e;return t>0&&t<4}e.isPushOnly=A,e.compile=d,e.decompile=p,e.toASM=function(e){return h(e)&&(e=p(e)),e.map((function(e){if(f(e)){var t=c(e);if(void 0===t)return e.toString("hex");e=t}return n.REVERSE_OPS[e]})).join(" ")},e.fromASM=function(e){return s(a.String,e),d(e.split(" ").map((function(e){return void 0!==n.OPS[e]?n.OPS[e]:(s(a.Hex,e),Xo.from(e,"hex"))})))},e.toStack=function(e){return e=p(e),s(A,e),e.map((function(e){return f(e)?e:e===n.OPS.OP_0?Xo.allocUnsafe(0):i.encode(e-u)}))},e.isCanonicalPubKey=function(e){return a.isPoint(e)},e.isDefinedHashType=g,e.isCanonicalScriptSignature=function(e){return!!Da(e)&&!!g(e[e.length-1])&&t.check(e.slice(0,-1))},e.number=i,e.signature=o}($q);var nz={};Object.defineProperty(nz,"__esModule",{value:!0}),nz.value=nz.prop=void 0,nz.prop=function(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:function(){var e=n.call(this);return this[t]=e,e},set:function(e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}})},nz.value=function(e){var t;return function(){return void 0!==t||(t=e()),t}},Object.defineProperty(Zq,"__esModule",{value:!0}),Zq.p2data=void 0;var rz=Xq,iz=$q,oz=hV,az=nz,sz=iz.OPS;Zq.p2data=function(e,t){if(!e.data&&!e.output)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,oz.typeforce)({network:oz.typeforce.maybe(oz.typeforce.Object),output:oz.typeforce.maybe(oz.typeforce.Buffer),data:oz.typeforce.maybe(oz.typeforce.arrayOf(oz.typeforce.Buffer))},e);var n={name:"embed",network:e.network||rz.bitcoin};if(az.prop(n,"output",(function(){if(e.data)return iz.compile([sz.OP_RETURN].concat(e.data))})),az.prop(n,"data",(function(){if(e.output)return iz.decompile(e.output).slice(1)})),t.validate&&e.output){var r=iz.decompile(e.output);if(r[0]!==sz.OP_RETURN)throw new TypeError("Output is invalid");if(!r.slice(1).every(oz.typeforce.Buffer))throw new TypeError("Output is invalid");if(e.data&&!function(e,t){return e.length===t.length&&e.every((function(e,n){return e.equals(t[n])}))}(e.data,n.data))throw new TypeError("Data mismatch")}return Object.assign(n,e)};var uz={};Object.defineProperty(uz,"__esModule",{value:!0}),uz.p2ms=void 0;var lz=Xq,Az=$q,cz=hV,hz=nz,fz=Az.OPS,dz=fz.OP_RESERVED;function pz(e,t){return e.length===t.length&&e.every((function(e,n){return e.equals(t[n])}))}uz.p2ms=function(e,t){if(!(e.input||e.output||e.pubkeys&&void 0!==e.m||e.signatures))throw new TypeError("Not enough data");function n(e){return Az.isCanonicalScriptSignature(e)||void 0!==(t.allowIncomplete&&e===fz.OP_0)}t=Object.assign({validate:!0},t||{}),(0,cz.typeforce)({network:cz.typeforce.maybe(cz.typeforce.Object),m:cz.typeforce.maybe(cz.typeforce.Number),n:cz.typeforce.maybe(cz.typeforce.Number),output:cz.typeforce.maybe(cz.typeforce.Buffer),pubkeys:cz.typeforce.maybe(cz.typeforce.arrayOf(cz.isPoint)),signatures:cz.typeforce.maybe(cz.typeforce.arrayOf(n)),input:cz.typeforce.maybe(cz.typeforce.Buffer)},e);var r={network:e.network||lz.bitcoin},i=[],o=!1;function a(e){o||(o=!0,i=Az.decompile(e),r.m=i[0]-dz,r.n=i[i.length-2]-dz,r.pubkeys=i.slice(1,-2))}if(hz.prop(r,"output",(function(){if(e.m&&r.n&&e.pubkeys)return Az.compile([].concat(dz+e.m,e.pubkeys,dz+r.n,fz.OP_CHECKMULTISIG))})),hz.prop(r,"m",(function(){if(r.output)return a(r.output),r.m})),hz.prop(r,"n",(function(){if(r.pubkeys)return r.pubkeys.length})),hz.prop(r,"pubkeys",(function(){if(e.output)return a(e.output),r.pubkeys})),hz.prop(r,"signatures",(function(){if(e.input)return Az.decompile(e.input).slice(1)})),hz.prop(r,"input",(function(){if(e.signatures)return Az.compile([fz.OP_0].concat(e.signatures))})),hz.prop(r,"witness",(function(){if(r.input)return[]})),hz.prop(r,"name",(function(){if(r.m&&r.n)return"p2ms(".concat(r.m," of ").concat(r.n,")")})),t.validate){if(e.output){if(a(e.output),!cz.typeforce.Number(i[0]))throw new TypeError("Output is invalid");if(!cz.typeforce.Number(i[i.length-2]))throw new TypeError("Output is invalid");if(i[i.length-1]!==fz.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(r.m<=0||r.n>16||r.m>r.n||r.n!==i.length-3)throw new TypeError("Output is invalid");if(!r.pubkeys.every((function(e){return(0,cz.isPoint)(e)})))throw new TypeError("Output is invalid");if(void 0!==e.m&&e.m!==r.m)throw new TypeError("m mismatch");if(void 0!==e.n&&e.n!==r.n)throw new TypeError("n mismatch");if(e.pubkeys&&!pz(e.pubkeys,r.pubkeys))throw new TypeError("Pubkeys mismatch")}if(e.pubkeys){if(void 0!==e.n&&e.n!==e.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(r.n=e.pubkeys.length,r.n<r.m)throw new TypeError("Pubkey count cannot be less than m")}if(e.signatures){if(e.signatures.length<r.m)throw new TypeError("Not enough signatures provided");if(e.signatures.length>r.m)throw new TypeError("Too many signatures provided")}if(e.input){if(e.input[0]!==fz.OP_0)throw new TypeError("Input is invalid");if(0===r.signatures.length||!r.signatures.every(n))throw new TypeError("Input has invalid signature(s)");if(e.signatures&&!pz(e.signatures,r.signatures))throw new TypeError("Signature mismatch");if(void 0!==e.m&&e.m!==e.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(r,e)};var gz={};Object.defineProperty(gz,"__esModule",{value:!0}),gz.p2pk=void 0;var vz=Xq,yz=$q,mz=hV,wz=nz,bz=yz.OPS;gz.p2pk=function(e,t){if(!(e.input||e.output||e.pubkey||e.input||e.signature))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,mz.typeforce)({network:mz.typeforce.maybe(mz.typeforce.Object),output:mz.typeforce.maybe(mz.typeforce.Buffer),pubkey:mz.typeforce.maybe(mz.isPoint),signature:mz.typeforce.maybe(yz.isCanonicalScriptSignature),input:mz.typeforce.maybe(mz.typeforce.Buffer)},e);var n=wz.value((function(){return yz.decompile(e.input)})),r={name:"p2pk",network:e.network||vz.bitcoin};if(wz.prop(r,"output",(function(){if(e.pubkey)return yz.compile([e.pubkey,bz.OP_CHECKSIG])})),wz.prop(r,"pubkey",(function(){if(e.output)return e.output.slice(1,-1)})),wz.prop(r,"signature",(function(){if(e.input)return n()[0]})),wz.prop(r,"input",(function(){if(e.signature)return yz.compile([e.signature])})),wz.prop(r,"witness",(function(){if(r.input)return[]})),t.validate){if(e.output){if(e.output[e.output.length-1]!==bz.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!(0,mz.isPoint)(r.pubkey))throw new TypeError("Output pubkey is invalid");if(e.pubkey&&!e.pubkey.equals(r.pubkey))throw new TypeError("Pubkey mismatch")}if(e.signature&&e.input&&!e.input.equals(r.input))throw new TypeError("Signature mismatch");if(e.input){if(1!==n().length)throw new TypeError("Input is invalid");if(!yz.isCanonicalScriptSignature(r.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(r,e)};var Iz={},Bz={};Object.defineProperty(Bz,"__esModule",{value:!0}),Bz.taggedHash=Bz.hash256=Bz.hash160=Bz.sha256=Bz.sha1=Bz.ripemd160=void 0;var Ez=QM,Cz=nT;function xz(e){try{return Ez("rmd160").update(e).digest()}catch(t){try{return Ez("ripemd160").update(e).digest()}catch(t){return(new Cz).update(e).digest()}}}function kz(e){return Ez("sha256").update(e).digest()}Bz.ripemd160=xz,Bz.sha1=function(e){return Ez("sha1").update(e).digest()},Bz.sha256=kz,Bz.hash160=function(e){return xz(kz(e))},Bz.hash256=function(e){return kz(kz(e))};var Sz=Object.fromEntries(["BIP0340/challenge","BIP0340/aux","BIP0340/nonce","TapLeaf","TapBranch","TapSighash","TapTweak","KeyAgg list","KeyAgg coefficient"].map((function(e){var t=kz(Xo.from(e));return[e,Xo.concat([t,t])]})));Bz.taggedHash=function(e,t){return kz(Xo.concat([Sz[e],t]))};var Qz=FO,_z=LF.exports.Buffer,Nz=QM,Dz=function(e){function t(t){var n=t.slice(0,-4),r=t.slice(-4),i=e(n);if(!(r[0]^i[0]|r[1]^i[1]|r[2]^i[2]|r[3]^i[3]))return n}return{encode:function(t){var n=e(t);return Qz.encode(_z.concat([t,n],t.length+4))},decode:function(e){var n=t(Qz.decode(e));if(!n)throw new Error("Invalid checksum");return n},decodeUnsafe:function(e){var n=Qz.decodeUnsafe(e);if(n)return t(n)}}}((function(e){var t=Nz("sha256").update(e).digest();return Nz("sha256").update(t).digest()}));Object.defineProperty(Iz,"__esModule",{value:!0}),Iz.p2pkh=void 0;var Fz=Bz,Pz=Xq,Uz=$q,Lz=hV,Tz=nz,Mz=Dz,Rz=Uz.OPS;Iz.p2pkh=function(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,Lz.typeforce)({network:Lz.typeforce.maybe(Lz.typeforce.Object),address:Lz.typeforce.maybe(Lz.typeforce.String),hash:Lz.typeforce.maybe(Lz.typeforce.BufferN(20)),output:Lz.typeforce.maybe(Lz.typeforce.BufferN(25)),pubkey:Lz.typeforce.maybe(Lz.isPoint),signature:Lz.typeforce.maybe(Uz.isCanonicalScriptSignature),input:Lz.typeforce.maybe(Lz.typeforce.Buffer)},e);var n=Tz.value((function(){var t=Mz.decode(e.address);return{version:t.readUInt8(0),hash:t.slice(1)}})),r=Tz.value((function(){return Uz.decompile(e.input)})),i=e.network||Pz.bitcoin,o={name:"p2pkh",network:i};if(Tz.prop(o,"address",(function(){if(o.hash){var e=Xo.allocUnsafe(21);return e.writeUInt8(i.pubKeyHash,0),o.hash.copy(e,1),Mz.encode(e)}})),Tz.prop(o,"hash",(function(){return e.output?e.output.slice(3,23):e.address?n().hash:e.pubkey||o.pubkey?Fz.hash160(e.pubkey||o.pubkey):void 0})),Tz.prop(o,"output",(function(){if(o.hash)return Uz.compile([Rz.OP_DUP,Rz.OP_HASH160,o.hash,Rz.OP_EQUALVERIFY,Rz.OP_CHECKSIG])})),Tz.prop(o,"pubkey",(function(){if(e.input)return r()[1]})),Tz.prop(o,"signature",(function(){if(e.input)return r()[0]})),Tz.prop(o,"input",(function(){if(e.pubkey&&e.signature)return Uz.compile([e.signature,e.pubkey])})),Tz.prop(o,"witness",(function(){if(o.input)return[]})),t.validate){var a=Xo.from([]);if(e.address){if(n().version!==i.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(20!==n().hash.length)throw new TypeError("Invalid address");a=n().hash}if(e.hash){if(a.length>0&&!a.equals(e.hash))throw new TypeError("Hash mismatch");a=e.hash}if(e.output){if(25!==e.output.length||e.output[0]!==Rz.OP_DUP||e.output[1]!==Rz.OP_HASH160||20!==e.output[2]||e.output[23]!==Rz.OP_EQUALVERIFY||e.output[24]!==Rz.OP_CHECKSIG)throw new TypeError("Output is invalid");var s=e.output.slice(3,23);if(a.length>0&&!a.equals(s))throw new TypeError("Hash mismatch");a=s}if(e.pubkey){var u=Fz.hash160(e.pubkey);if(a.length>0&&!a.equals(u))throw new TypeError("Hash mismatch");a=u}if(e.input){var l=r();if(2!==l.length)throw new TypeError("Input is invalid");if(!Uz.isCanonicalScriptSignature(l[0]))throw new TypeError("Input has invalid signature");if(!(0,Lz.isPoint)(l[1]))throw new TypeError("Input has invalid pubkey");if(e.signature&&!e.signature.equals(l[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(l[1]))throw new TypeError("Pubkey mismatch");var A=Fz.hash160(l[1]);if(a.length>0&&!a.equals(A))throw new TypeError("Hash mismatch")}}return Object.assign(o,e)};var Oz={};Object.defineProperty(Oz,"__esModule",{value:!0}),Oz.p2sh=void 0;var Hz=Bz,Kz=Xq,jz=$q,Gz=hV,qz=nz,Vz=Dz,zz=jz.OPS;Oz.p2sh=function(e,t){if(!(e.address||e.hash||e.output||e.redeem||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,Gz.typeforce)({network:Gz.typeforce.maybe(Gz.typeforce.Object),address:Gz.typeforce.maybe(Gz.typeforce.String),hash:Gz.typeforce.maybe(Gz.typeforce.BufferN(20)),output:Gz.typeforce.maybe(Gz.typeforce.BufferN(23)),redeem:Gz.typeforce.maybe({network:Gz.typeforce.maybe(Gz.typeforce.Object),output:Gz.typeforce.maybe(Gz.typeforce.Buffer),input:Gz.typeforce.maybe(Gz.typeforce.Buffer),witness:Gz.typeforce.maybe(Gz.typeforce.arrayOf(Gz.typeforce.Buffer))}),input:Gz.typeforce.maybe(Gz.typeforce.Buffer),witness:Gz.typeforce.maybe(Gz.typeforce.arrayOf(Gz.typeforce.Buffer))},e);var n=e.network;n||(n=e.redeem&&e.redeem.network||Kz.bitcoin);var r={network:n},i=qz.value((function(){var t=Vz.decode(e.address);return{version:t.readUInt8(0),hash:t.slice(1)}})),o=qz.value((function(){return jz.decompile(e.input)})),a=qz.value((function(){var t=o(),r=t[t.length-1];return{network:n,output:r===zz.OP_FALSE?Xo.from([]):r,input:jz.compile(t.slice(0,-1)),witness:e.witness||[]}}));if(qz.prop(r,"address",(function(){if(r.hash){var e=Xo.allocUnsafe(21);return e.writeUInt8(r.network.scriptHash,0),r.hash.copy(e,1),Vz.encode(e)}})),qz.prop(r,"hash",(function(){return e.output?e.output.slice(2,22):e.address?i().hash:r.redeem&&r.redeem.output?Hz.hash160(r.redeem.output):void 0})),qz.prop(r,"output",(function(){if(r.hash)return jz.compile([zz.OP_HASH160,r.hash,zz.OP_EQUAL])})),qz.prop(r,"redeem",(function(){if(e.input)return a()})),qz.prop(r,"input",(function(){if(e.redeem&&e.redeem.input&&e.redeem.output)return jz.compile([].concat(jz.decompile(e.redeem.input),e.redeem.output))})),qz.prop(r,"witness",(function(){return r.redeem&&r.redeem.witness?r.redeem.witness:r.input?[]:void 0})),qz.prop(r,"name",(function(){var e=["p2sh"];return void 0!==r.redeem&&void 0!==r.redeem.name&&e.push(r.redeem.name),e.join("-")})),t.validate){var s=Xo.from([]);if(e.address){if(i().version!==n.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(20!==i().hash.length)throw new TypeError("Invalid address");s=i().hash}if(e.hash){if(s.length>0&&!s.equals(e.hash))throw new TypeError("Hash mismatch");s=e.hash}if(e.output){if(23!==e.output.length||e.output[0]!==zz.OP_HASH160||20!==e.output[1]||e.output[22]!==zz.OP_EQUAL)throw new TypeError("Output is invalid");var u=e.output.slice(2,22);if(s.length>0&&!s.equals(u))throw new TypeError("Hash mismatch");s=u}var l=function(e){if(e.output){var t=jz.decompile(e.output);if(!t||t.length<1)throw new TypeError("Redeem.output too short");var n=Hz.hash160(e.output);if(s.length>0&&!s.equals(n))throw new TypeError("Hash mismatch");s=n}if(e.input){var r=e.input.length>0,i=e.witness&&e.witness.length>0;if(!r&&!i)throw new TypeError("Empty input");if(r&&i)throw new TypeError("Input and witness provided");if(r){var o=jz.decompile(e.input);if(!jz.isPushOnly(o))throw new TypeError("Non push-only scriptSig")}}};if(e.input){var A=o();if(!A||A.length<1)throw new TypeError("Input too short");if(!Da(a().output))throw new TypeError("Input is invalid");l(a())}if(e.redeem){if(e.redeem.network&&e.redeem.network!==n)throw new TypeError("Network mismatch");if(e.input){var c=a();if(e.redeem.output&&!e.redeem.output.equals(c.output))throw new TypeError("Redeem.output mismatch");if(e.redeem.input&&!e.redeem.input.equals(c.input))throw new TypeError("Redeem.input mismatch")}l(e.redeem)}if(e.witness&&e.redeem&&e.redeem.witness&&!function(e,t){return e.length===t.length&&e.every((function(e,n){return e.equals(t[n])}))}(e.redeem.witness,e.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(r,e)};var Jz={},Yz={};Object.defineProperty(Yz,"__esModule",{value:!0}),Yz.bech32m=Yz.bech32=void 0;for(var Xz="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Wz={},Zz=0;Zz<Xz.length;Zz++){var $z=Xz.charAt(Zz);Wz[$z]=Zz}function eJ(e){var t=e>>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function tJ(e){for(var t=1,n=0;n<e.length;++n){var r=e.charCodeAt(n);if(r<33||r>126)return"Invalid prefix ("+e+")";t=eJ(t)^r>>5}t=eJ(t);for(var i=0;i<e.length;++i){var o=e.charCodeAt(i);t=eJ(t)^31&o}return t}function nJ(e,t,n,r){for(var i=0,o=0,a=(1<<n)-1,s=[],u=0;u<e.length;++u)for(i=i<<t|e[u],o+=t;o>=n;)o-=n,s.push(i>>o&a);if(r)o>0&&s.push(i<<n-o&a);else{if(o>=t)return"Excess padding";if(i<<n-o&a)return"Non-zero padding"}return s}function rJ(e){return nJ(e,8,5,!0)}function iJ(e){var t=nJ(e,5,8,!1);if(Array.isArray(t))return t}function oJ(e){var t=nJ(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function aJ(e){var t;function n(e,n){if(n=n||90,e.length<8)return e+" too short";if(e.length>n)return"Exceeds length limit";var r=e.toLowerCase(),i=e.toUpperCase();if(e!==r&&e!==i)return"Mixed-case string "+e;var o=(e=r).lastIndexOf("1");if(-1===o)return"No separator character for "+e;if(0===o)return"Missing prefix for "+e;var a=e.slice(0,o),s=e.slice(o+1);if(s.length<6)return"Data too short";var u=tJ(a);if("string"==typeof u)return u;for(var l=[],A=0;A<s.length;++A){var c=s.charAt(A),h=Wz[c];if(void 0===h)return"Unknown character "+c;u=eJ(u)^h,A+6>=s.length||l.push(h)}return u!==t?"Invalid checksum for "+e:{prefix:a,words:l}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){var r=n(e,t);if("object"==i(r))return r},decode:function(e,t){var r=n(e,t);if("object"==i(r))return r;throw new Error(r)},encode:function(e,n,r){if(r=r||90,e.length+7+n.length>r)throw new TypeError("Exceeds length limit");var i=tJ(e=e.toLowerCase());if("string"==typeof i)throw new Error(i);for(var o=e+"1",a=0;a<n.length;++a){var s=n[a];if(s>>5!=0)throw new Error("Non 5-bit word");i=eJ(i)^s,o+=Xz.charAt(s)}for(var u=0;u<6;++u)i=eJ(i);i^=t;for(var l=0;l<6;++l)o+=Xz.charAt(i>>5*(5-l)&31);return o},toWords:rJ,fromWordsUnsafe:iJ,fromWords:oJ}}Yz.bech32=aJ("bech32"),Yz.bech32m=aJ("bech32m"),Object.defineProperty(Jz,"__esModule",{value:!0}),Jz.p2wpkh=void 0;var sJ=Bz,uJ=Xq,lJ=$q,AJ=hV,cJ=nz,hJ=Yz,fJ=lJ.OPS,dJ=Xo.alloc(0);Jz.p2wpkh=function(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.witness))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,AJ.typeforce)({address:AJ.typeforce.maybe(AJ.typeforce.String),hash:AJ.typeforce.maybe(AJ.typeforce.BufferN(20)),input:AJ.typeforce.maybe(AJ.typeforce.BufferN(0)),network:AJ.typeforce.maybe(AJ.typeforce.Object),output:AJ.typeforce.maybe(AJ.typeforce.BufferN(22)),pubkey:AJ.typeforce.maybe(AJ.isPoint),signature:AJ.typeforce.maybe(lJ.isCanonicalScriptSignature),witness:AJ.typeforce.maybe(AJ.typeforce.arrayOf(AJ.typeforce.Buffer))},e);var n=cJ.value((function(){var t=hJ.bech32.decode(e.address),n=t.words.shift(),r=hJ.bech32.fromWords(t.words);return{version:n,prefix:t.prefix,data:Xo.from(r)}})),r=e.network||uJ.bitcoin,i={name:"p2wpkh",network:r};if(cJ.prop(i,"address",(function(){if(i.hash){var e=hJ.bech32.toWords(i.hash);return e.unshift(0),hJ.bech32.encode(r.bech32,e)}})),cJ.prop(i,"hash",(function(){return e.output?e.output.slice(2,22):e.address?n().data:e.pubkey||i.pubkey?sJ.hash160(e.pubkey||i.pubkey):void 0})),cJ.prop(i,"output",(function(){if(i.hash)return lJ.compile([fJ.OP_0,i.hash])})),cJ.prop(i,"pubkey",(function(){return e.pubkey?e.pubkey:e.witness?e.witness[1]:void 0})),cJ.prop(i,"signature",(function(){if(e.witness)return e.witness[0]})),cJ.prop(i,"input",(function(){if(i.witness)return dJ})),cJ.prop(i,"witness",(function(){if(e.pubkey&&e.signature)return[e.signature,e.pubkey]})),t.validate){var o=Xo.from([]);if(e.address){if(r&&r.bech32!==n().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(0!==n().version)throw new TypeError("Invalid address version");if(20!==n().data.length)throw new TypeError("Invalid address data");o=n().data}if(e.hash){if(o.length>0&&!o.equals(e.hash))throw new TypeError("Hash mismatch");o=e.hash}if(e.output){if(22!==e.output.length||e.output[0]!==fJ.OP_0||20!==e.output[1])throw new TypeError("Output is invalid");if(o.length>0&&!o.equals(e.output.slice(2)))throw new TypeError("Hash mismatch");o=e.output.slice(2)}if(e.pubkey){var a=sJ.hash160(e.pubkey);if(o.length>0&&!o.equals(a))throw new TypeError("Hash mismatch");if(o=a,!(0,AJ.isPoint)(e.pubkey)||33!==e.pubkey.length)throw new TypeError("Invalid pubkey for p2wpkh")}if(e.witness){if(2!==e.witness.length)throw new TypeError("Witness is invalid");if(!lJ.isCanonicalScriptSignature(e.witness[0]))throw new TypeError("Witness has invalid signature");if(!(0,AJ.isPoint)(e.witness[1])||33!==e.witness[1].length)throw new TypeError("Witness has invalid pubkey");if(e.signature&&!e.signature.equals(e.witness[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(e.witness[1]))throw new TypeError("Pubkey mismatch");var s=sJ.hash160(e.witness[1]);if(o.length>0&&!o.equals(s))throw new TypeError("Hash mismatch")}}return Object.assign(i,e)};var pJ={};Object.defineProperty(pJ,"__esModule",{value:!0}),pJ.p2wsh=void 0;var gJ=Bz,vJ=Xq,yJ=$q,mJ=hV,wJ=nz,bJ=Yz,IJ=yJ.OPS,BJ=Xo.alloc(0);function EJ(e){return!(!Da(e)||65!==e.length||4!==e[0]||!(0,mJ.isPoint)(e))}pJ.p2wsh=function(e,t){if(!(e.address||e.hash||e.output||e.redeem||e.witness))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,mJ.typeforce)({network:mJ.typeforce.maybe(mJ.typeforce.Object),address:mJ.typeforce.maybe(mJ.typeforce.String),hash:mJ.typeforce.maybe(mJ.typeforce.BufferN(32)),output:mJ.typeforce.maybe(mJ.typeforce.BufferN(34)),redeem:mJ.typeforce.maybe({input:mJ.typeforce.maybe(mJ.typeforce.Buffer),network:mJ.typeforce.maybe(mJ.typeforce.Object),output:mJ.typeforce.maybe(mJ.typeforce.Buffer),witness:mJ.typeforce.maybe(mJ.typeforce.arrayOf(mJ.typeforce.Buffer))}),input:mJ.typeforce.maybe(mJ.typeforce.BufferN(0)),witness:mJ.typeforce.maybe(mJ.typeforce.arrayOf(mJ.typeforce.Buffer))},e);var n=wJ.value((function(){var t=bJ.bech32.decode(e.address),n=t.words.shift(),r=bJ.bech32.fromWords(t.words);return{version:n,prefix:t.prefix,data:Xo.from(r)}})),r=wJ.value((function(){return yJ.decompile(e.redeem.input)})),i=e.network;i||(i=e.redeem&&e.redeem.network||vJ.bitcoin);var o={network:i};if(wJ.prop(o,"address",(function(){if(o.hash){var e=bJ.bech32.toWords(o.hash);return e.unshift(0),bJ.bech32.encode(i.bech32,e)}})),wJ.prop(o,"hash",(function(){return e.output?e.output.slice(2):e.address?n().data:o.redeem&&o.redeem.output?gJ.sha256(o.redeem.output):void 0})),wJ.prop(o,"output",(function(){if(o.hash)return yJ.compile([IJ.OP_0,o.hash])})),wJ.prop(o,"redeem",(function(){if(e.witness)return{output:e.witness[e.witness.length-1],input:BJ,witness:e.witness.slice(0,-1)}})),wJ.prop(o,"input",(function(){if(o.witness)return BJ})),wJ.prop(o,"witness",(function(){if(e.redeem&&e.redeem.input&&e.redeem.input.length>0&&e.redeem.output&&e.redeem.output.length>0){var t=yJ.toStack(r());return o.redeem=Object.assign({witness:t},e.redeem),o.redeem.input=BJ,[].concat(t,e.redeem.output)}if(e.redeem&&e.redeem.output&&e.redeem.witness)return[].concat(e.redeem.witness,e.redeem.output)})),wJ.prop(o,"name",(function(){var e=["p2wsh"];return void 0!==o.redeem&&void 0!==o.redeem.name&&e.push(o.redeem.name),e.join("-")})),t.validate){var a=Xo.from([]);if(e.address){if(n().prefix!==i.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(0!==n().version)throw new TypeError("Invalid address version");if(32!==n().data.length)throw new TypeError("Invalid address data");a=n().data}if(e.hash){if(a.length>0&&!a.equals(e.hash))throw new TypeError("Hash mismatch");a=e.hash}if(e.output){if(34!==e.output.length||e.output[0]!==IJ.OP_0||32!==e.output[1])throw new TypeError("Output is invalid");var s=e.output.slice(2);if(a.length>0&&!a.equals(s))throw new TypeError("Hash mismatch");a=s}if(e.redeem){if(e.redeem.network&&e.redeem.network!==i)throw new TypeError("Network mismatch");if(e.redeem.input&&e.redeem.input.length>0&&e.redeem.witness&&e.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(e.redeem.output){if(0===yJ.decompile(e.redeem.output).length)throw new TypeError("Redeem.output is invalid");var u=gJ.sha256(e.redeem.output);if(a.length>0&&!a.equals(u))throw new TypeError("Hash mismatch");a=u}if(e.redeem.input&&!yJ.isPushOnly(r()))throw new TypeError("Non push-only scriptSig");if(e.witness&&e.redeem.witness&&!function(e,t){return e.length===t.length&&e.every((function(e,n){return e.equals(t[n])}))}(e.witness,e.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch");if(e.redeem.input&&r().some(EJ)||e.redeem.output&&(yJ.decompile(e.redeem.output)||[]).some(EJ))throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(e.witness&&e.witness.length>0){var l=e.witness[e.witness.length-1];if(e.redeem&&e.redeem.output&&!e.redeem.output.equals(l))throw new TypeError("Witness and redeem.output mismatch");if(e.witness.some(EJ)||(yJ.decompile(l)||[]).some(EJ))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(o,e)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.p2wsh=e.p2wpkh=e.p2sh=e.p2pkh=e.p2pk=e.p2ms=e.embed=void 0;var t=Zq;Object.defineProperty(e,"embed",{enumerable:!0,get:function(){return t.p2data}});var n=uz;Object.defineProperty(e,"p2ms",{enumerable:!0,get:function(){return n.p2ms}});var r=gz;Object.defineProperty(e,"p2pk",{enumerable:!0,get:function(){return r.p2pk}});var i=Iz;Object.defineProperty(e,"p2pkh",{enumerable:!0,get:function(){return i.p2pkh}});var o=Oz;Object.defineProperty(e,"p2sh",{enumerable:!0,get:function(){return o.p2sh}});var a=Jz;Object.defineProperty(e,"p2wpkh",{enumerable:!0,get:function(){return a.p2wpkh}});var s=pJ;Object.defineProperty(e,"p2wsh",{enumerable:!0,get:function(){return s.p2wsh}})}(Wq),Object.defineProperty(Yq,"__esModule",{value:!0}),Yq.toOutputScript=Yq.fromOutputScript=Yq.toBech32=Yq.toBase58Check=Yq.fromBech32=Yq.fromBase58Check=void 0;var CJ=Xq,xJ=Wq,kJ=$q,SJ=hV,QJ=Yz,_J=Dz,NJ=SJ.typeforce,DJ="WARNING: Sending to a future segwit version address can lead to loss of funds. End users MUST be warned carefully in the GUI and asked if they wish to proceed with caution. Wallets should verify the segwit version from the output of fromBech32, then decide when it is safe to use which version of segwit.";function FJ(e){var t=_J.decode(e);if(t.length<21)throw new TypeError(e+" is too short");if(t.length>21)throw new TypeError(e+" is too long");return{version:t.readUInt8(0),hash:t.slice(1)}}function PJ(e){var t,n;try{t=QJ.bech32.decode(e)}catch(e){}if(t){if(0!==(n=t.words[0]))throw new TypeError(e+" uses wrong encoding")}else if(0===(n=(t=QJ.bech32m.decode(e)).words[0]))throw new TypeError(e+" uses wrong encoding");var r=QJ.bech32.fromWords(t.words.slice(1));return{version:n,prefix:t.prefix,data:Xo.from(r)}}function UJ(e,t,n){var r=QJ.bech32.toWords(e);return r.unshift(t),0===t?QJ.bech32.encode(n,r):QJ.bech32m.encode(n,r)}Yq.fromBase58Check=FJ,Yq.fromBech32=PJ,Yq.toBase58Check=function(e,t){NJ(SJ.tuple(SJ.Hash160bit,SJ.UInt8),arguments);var n=Xo.allocUnsafe(21);return n.writeUInt8(t,0),e.copy(n,1),_J.encode(n)},Yq.toBech32=UJ,Yq.fromOutputScript=function(e,t){t=t||CJ.bitcoin;try{return xJ.p2pkh({output:e,network:t}).address}catch(e){}try{return xJ.p2sh({output:e,network:t}).address}catch(e){}try{return xJ.p2wpkh({output:e,network:t}).address}catch(e){}try{return xJ.p2wsh({output:e,network:t}).address}catch(e){}try{return function(e,t){var n=e.slice(2);if(n.length<2||n.length>40)throw new TypeError("Invalid program length for segwit address");var r=e[0]-80;if(r<1||r>16)throw new TypeError("Invalid version for segwit address");if(e[1]!==n.length)throw new TypeError("Invalid script for segwit address");return console.warn(DJ),UJ(n,r,t.bech32)}(e,t)}catch(e){}throw new Error(kJ.toASM(e)+" has no matching Address")},Yq.toOutputScript=function(e,t){var n,r;t=t||CJ.bitcoin;try{n=FJ(e)}catch(e){}if(n){if(n.version===t.pubKeyHash)return xJ.p2pkh({hash:n.hash}).output;if(n.version===t.scriptHash)return xJ.p2sh({hash:n.hash}).output}else{try{r=PJ(e)}catch(e){}if(r){if(r.prefix!==t.bech32)throw new Error(e+" has an invalid prefix");if(0===r.version){if(20===r.data.length)return xJ.p2wpkh({hash:r.data}).output;if(32===r.data.length)return xJ.p2wsh({hash:r.data}).output}else if(r.version>=1&&r.version<=16&&r.data.length>=2&&r.data.length<=40)return console.warn(DJ),kJ.compile([r.version+80,r.data])}}throw new Error(e+" has no matching Script")};var LJ={},TJ={},MJ=LF.exports.Buffer;function RJ(e){if(e<0||e>9007199254740991||e%1!=0)throw new RangeError("value out of range")}function OJ(e){return RJ(e),e<253?1:e<=65535?3:e<=4294967295?5:9}var HJ={encode:function e(t,n,r){if(RJ(t),n||(n=MJ.allocUnsafe(OJ(t))),!MJ.isBuffer(n))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),t<253?(n.writeUInt8(t,r),e.bytes=1):t<=65535?(n.writeUInt8(253,r),n.writeUInt16LE(t,r+1),e.bytes=3):t<=4294967295?(n.writeUInt8(254,r),n.writeUInt32LE(t,r+1),e.bytes=5):(n.writeUInt8(255,r),n.writeUInt32LE(t>>>0,r+1),n.writeUInt32LE(t/4294967296|0,r+5),e.bytes=9),n},decode:function e(t,n){if(!MJ.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");n||(n=0);var r=t.readUInt8(n);if(r<253)return e.bytes=1,r;if(253===r)return e.bytes=3,t.readUInt16LE(n+1);if(254===r)return e.bytes=5,t.readUInt32LE(n+1);e.bytes=9;var i=t.readUInt32LE(n+1),o=4294967296*t.readUInt32LE(n+5)+i;return RJ(o),o},encodingLength:OJ};Object.defineProperty(TJ,"__esModule",{value:!0}),TJ.BufferReader=TJ.BufferWriter=TJ.cloneBuffer=TJ.reverseBuffer=TJ.writeUInt64LE=TJ.readUInt64LE=TJ.varuint=void 0;var KJ=hV,jJ=KJ.typeforce,GJ=HJ;function qJ(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}function VJ(e,t){var n=e.readUInt32LE(t),r=e.readUInt32LE(t+4);return qJ((r*=4294967296)+n,9007199254740991),r+n}function zJ(e,t,n){return qJ(t,9007199254740991),e.writeInt32LE(-1&t,n),e.writeUInt32LE(Math.floor(t/4294967296),n+4),n+8}TJ.varuint=GJ,TJ.readUInt64LE=VJ,TJ.writeUInt64LE=zJ,TJ.reverseBuffer=function(e){if(e.length<1)return e;for(var t=e.length-1,n=0,r=0;r<e.length/2;r++)n=e[r],e[r]=e[t],e[t]=n,t--;return e},TJ.cloneBuffer=function(e){var t=Xo.allocUnsafe(e.length);return e.copy(t),t};var JJ=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;s(this,e),this.buffer=t,this.offset=n,jJ(KJ.tuple(KJ.Buffer,KJ.UInt32),[t,n])}return l(e,[{key:"writeUInt8",value:function(e){this.offset=this.buffer.writeUInt8(e,this.offset)}},{key:"writeInt32",value:function(e){this.offset=this.buffer.writeInt32LE(e,this.offset)}},{key:"writeUInt32",value:function(e){this.offset=this.buffer.writeUInt32LE(e,this.offset)}},{key:"writeUInt64",value:function(e){this.offset=zJ(this.buffer,e,this.offset)}},{key:"writeVarInt",value:function(e){GJ.encode(e,this.buffer,this.offset),this.offset+=GJ.encode.bytes}},{key:"writeSlice",value:function(e){if(this.buffer.length<this.offset+e.length)throw new Error("Cannot write slice out of bounds");this.offset+=e.copy(this.buffer,this.offset)}},{key:"writeVarSlice",value:function(e){this.writeVarInt(e.length),this.writeSlice(e)}},{key:"writeVector",value:function(e){var t=this;this.writeVarInt(e.length),e.forEach((function(e){return t.writeVarSlice(e)}))}},{key:"end",value:function(){if(this.buffer.length===this.offset)return this.buffer;throw new Error("buffer size ".concat(this.buffer.length,", offset ").concat(this.offset))}}],[{key:"withCapacity",value:function(t){return new e(Xo.alloc(t))}}]),e}();TJ.BufferWriter=JJ,TJ.BufferReader=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;s(this,e),this.buffer=t,this.offset=n,jJ(KJ.tuple(KJ.Buffer,KJ.UInt32),[t,n])}return l(e,[{key:"readUInt8",value:function(){var e=this.buffer.readUInt8(this.offset);return this.offset++,e}},{key:"readInt32",value:function(){var e=this.buffer.readInt32LE(this.offset);return this.offset+=4,e}},{key:"readUInt32",value:function(){var e=this.buffer.readUInt32LE(this.offset);return this.offset+=4,e}},{key:"readUInt64",value:function(){var e=VJ(this.buffer,this.offset);return this.offset+=8,e}},{key:"readVarInt",value:function(){var e=GJ.decode(this.buffer,this.offset);return this.offset+=GJ.decode.bytes,e}},{key:"readSlice",value:function(e){if(this.buffer.length<this.offset+e)throw new Error("Cannot read slice out of bounds");var t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}},{key:"readVarSlice",value:function(){return this.readSlice(this.readVarInt())}},{key:"readVector",value:function(){for(var e=this.readVarInt(),t=[],n=0;n<e;n++)t.push(this.readVarSlice());return t}}]),e}();var YJ={};Object.defineProperty(YJ,"__esModule",{value:!0}),YJ.fastMerkleRoot=void 0,YJ.fastMerkleRoot=function(e,t){if(!Array.isArray(e))throw TypeError("Expected values Array");if("function"!=typeof t)throw TypeError("Expected digest Function");for(var n=e.length,r=e.concat();n>1;){for(var i=0,o=0;o<n;o+=2,++i){var a=r[o],s=o+1===n?a:r[o+1],u=Xo.concat([a,s]);r[i]=t(u)}n=i}return r[0]};var XJ={};Object.defineProperty(XJ,"__esModule",{value:!0}),XJ.Transaction=void 0;var WJ=TJ,ZJ=Bz,$J=$q,eY=$q,tY=hV,nY=tY.typeforce;function rY(e){var t=e.length;return WJ.varuint.encodingLength(t)+t}var iY=Xo.allocUnsafe(0),oY=[],aY=Xo.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),sY=Xo.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),uY=Xo.from("ffffffffffffffff","hex"),lY={script:iY,valueBuffer:uY},AY=function(){function e(){s(this,e),this.version=1,this.locktime=0,this.ins=[],this.outs=[]}return l(e,[{key:"isCoinbase",value:function(){return 1===this.ins.length&&e.isCoinbaseHash(this.ins[0].hash)}},{key:"addInput",value:function(t,n,r,i){return nY(tY.tuple(tY.Hash256bit,tY.UInt32,tY.maybe(tY.UInt32),tY.maybe(tY.Buffer)),arguments),tY.Null(r)&&(r=e.DEFAULT_SEQUENCE),this.ins.push({hash:t,index:n,script:i||iY,sequence:r,witness:oY})-1}},{key:"addOutput",value:function(e,t){return nY(tY.tuple(tY.Buffer,tY.Satoshi),arguments),this.outs.push({script:e,value:t})-1}},{key:"hasWitnesses",value:function(){return this.ins.some((function(e){return 0!==e.witness.length}))}},{key:"weight",value:function(){return 3*this.byteLength(!1)+this.byteLength(!0)}},{key:"virtualSize",value:function(){return Math.ceil(this.weight()/4)}},{key:"byteLength",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=e&&this.hasWitnesses();return(t?10:8)+WJ.varuint.encodingLength(this.ins.length)+WJ.varuint.encodingLength(this.outs.length)+this.ins.reduce((function(e,t){return e+40+rY(t.script)}),0)+this.outs.reduce((function(e,t){return e+8+rY(t.script)}),0)+(t?this.ins.reduce((function(e,t){return e+function(e){var t=e.length;return WJ.varuint.encodingLength(t)+e.reduce((function(e,t){return e+rY(t)}),0)}(t.witness)}),0):0)}},{key:"clone",value:function(){var t=new e;return t.version=this.version,t.locktime=this.locktime,t.ins=this.ins.map((function(e){return{hash:e.hash,index:e.index,script:e.script,sequence:e.sequence,witness:e.witness}})),t.outs=this.outs.map((function(e){return{script:e.script,value:e.value}})),t}},{key:"hashForSignature",value:function(t,n,r){if(nY(tY.tuple(tY.UInt32,tY.Buffer,tY.Number),arguments),t>=this.ins.length)return sY;var i=$J.compile($J.decompile(n).filter((function(e){return e!==eY.OPS.OP_CODESEPARATOR}))),o=this.clone();if((31&r)===e.SIGHASH_NONE)o.outs=[],o.ins.forEach((function(e,n){n!==t&&(e.sequence=0)}));else if((31&r)===e.SIGHASH_SINGLE){if(t>=this.outs.length)return sY;o.outs.length=t+1;for(var a=0;a<t;a++)o.outs[a]=lY;o.ins.forEach((function(e,n){n!==t&&(e.sequence=0)}))}r&e.SIGHASH_ANYONECANPAY?(o.ins=[o.ins[t]],o.ins[0].script=i):(o.ins.forEach((function(e){e.script=iY})),o.ins[t].script=i);var s=Xo.allocUnsafe(o.byteLength(!1)+4);return s.writeInt32LE(r,s.length-4),o.__toBuffer(s,0,!1),ZJ.hash256(s)}},{key:"hashForWitnessV1",value:function(t,n,r,i,o,a){if(nY(tY.tuple(tY.UInt32,nY.arrayOf(tY.Buffer),nY.arrayOf(tY.Satoshi),tY.UInt32),arguments),r.length!==this.ins.length||n.length!==this.ins.length)throw new Error("Must supply prevout script and value for all inputs");var s=i===e.SIGHASH_DEFAULT?e.SIGHASH_ALL:i&e.SIGHASH_OUTPUT_MASK,u=(i&e.SIGHASH_INPUT_MASK)===e.SIGHASH_ANYONECANPAY,l=s===e.SIGHASH_NONE,A=s===e.SIGHASH_SINGLE,c=iY,h=iY,f=iY,d=iY,p=iY;if(!u){var g=WJ.BufferWriter.withCapacity(36*this.ins.length);this.ins.forEach((function(e){g.writeSlice(e.hash),g.writeUInt32(e.index)})),c=ZJ.sha256(g.end()),g=WJ.BufferWriter.withCapacity(8*this.ins.length),r.forEach((function(e){return g.writeUInt64(e)})),h=ZJ.sha256(g.end()),g=WJ.BufferWriter.withCapacity(n.map(rY).reduce((function(e,t){return e+t}))),n.forEach((function(e){return g.writeVarSlice(e)})),f=ZJ.sha256(g.end()),g=WJ.BufferWriter.withCapacity(4*this.ins.length),this.ins.forEach((function(e){return g.writeUInt32(e.sequence)})),d=ZJ.sha256(g.end())}if(l||A){if(A&&t<this.outs.length){var v=this.outs[t],y=WJ.BufferWriter.withCapacity(8+rY(v.script));y.writeUInt64(v.value),y.writeVarSlice(v.script),p=ZJ.sha256(y.end())}}else{var m=this.outs.map((function(e){return 8+rY(e.script)})).reduce((function(e,t){return e+t})),w=WJ.BufferWriter.withCapacity(m);this.outs.forEach((function(e){w.writeUInt64(e.value),w.writeVarSlice(e.script)})),p=ZJ.sha256(w.end())}var b=(o?2:0)+(a?1:0),I=174-(u?49:0)-(l?32:0)+(a?32:0)+(o?37:0),B=WJ.BufferWriter.withCapacity(I);if(B.writeUInt8(i),B.writeInt32(this.version),B.writeUInt32(this.locktime),B.writeSlice(c),B.writeSlice(h),B.writeSlice(f),B.writeSlice(d),l||A||B.writeSlice(p),B.writeUInt8(b),u){var E=this.ins[t];B.writeSlice(E.hash),B.writeUInt32(E.index),B.writeUInt64(r[t]),B.writeVarSlice(n[t]),B.writeUInt32(E.sequence)}else B.writeUInt32(t);if(a){var C=WJ.BufferWriter.withCapacity(rY(a));C.writeVarSlice(a),B.writeSlice(ZJ.sha256(C.end()))}return A&&B.writeSlice(p),o&&(B.writeSlice(o),B.writeUInt8(0),B.writeUInt32(4294967295)),ZJ.taggedHash("TapSighash",Xo.concat([Xo.of(0),B.end()]))}},{key:"hashForWitnessV0",value:function(t,n,r,i){nY(tY.tuple(tY.UInt32,tY.Buffer,tY.Satoshi,tY.UInt32),arguments);var o,a=Xo.from([]),s=aY,u=aY,l=aY;if(i&e.SIGHASH_ANYONECANPAY||(a=Xo.allocUnsafe(36*this.ins.length),o=new WJ.BufferWriter(a,0),this.ins.forEach((function(e){o.writeSlice(e.hash),o.writeUInt32(e.index)})),u=ZJ.hash256(a)),i&e.SIGHASH_ANYONECANPAY||(31&i)===e.SIGHASH_SINGLE||(31&i)===e.SIGHASH_NONE||(a=Xo.allocUnsafe(4*this.ins.length),o=new WJ.BufferWriter(a,0),this.ins.forEach((function(e){o.writeUInt32(e.sequence)})),l=ZJ.hash256(a)),(31&i)!==e.SIGHASH_SINGLE&&(31&i)!==e.SIGHASH_NONE){var A=this.outs.reduce((function(e,t){return e+8+rY(t.script)}),0);a=Xo.allocUnsafe(A),o=new WJ.BufferWriter(a,0),this.outs.forEach((function(e){o.writeUInt64(e.value),o.writeVarSlice(e.script)})),s=ZJ.hash256(a)}else if((31&i)===e.SIGHASH_SINGLE&&t<this.outs.length){var c=this.outs[t];a=Xo.allocUnsafe(8+rY(c.script)),(o=new WJ.BufferWriter(a,0)).writeUInt64(c.value),o.writeVarSlice(c.script),s=ZJ.hash256(a)}a=Xo.allocUnsafe(156+rY(n)),o=new WJ.BufferWriter(a,0);var h=this.ins[t];return o.writeInt32(this.version),o.writeSlice(u),o.writeSlice(l),o.writeSlice(h.hash),o.writeUInt32(h.index),o.writeVarSlice(n),o.writeUInt64(r),o.writeUInt32(h.sequence),o.writeSlice(s),o.writeUInt32(this.locktime),o.writeUInt32(i),ZJ.hash256(a)}},{key:"getHash",value:function(e){return e&&this.isCoinbase()?Xo.alloc(32,0):ZJ.hash256(this.__toBuffer(void 0,void 0,e))}},{key:"getId",value:function(){return(0,WJ.reverseBuffer)(this.getHash(!1)).toString("hex")}},{key:"toBuffer",value:function(e,t){return this.__toBuffer(e,t,!0)}},{key:"toHex",value:function(){return this.toBuffer(void 0,void 0).toString("hex")}},{key:"setInputScript",value:function(e,t){nY(tY.tuple(tY.Number,tY.Buffer),arguments),this.ins[e].script=t}},{key:"setWitness",value:function(e,t){nY(tY.tuple(tY.Number,[tY.Buffer]),arguments),this.ins[e].witness=t}},{key:"__toBuffer",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t||(t=Xo.allocUnsafe(this.byteLength(r)));var i=new WJ.BufferWriter(t,n||0);i.writeInt32(this.version);var o=r&&this.hasWitnesses();return o&&(i.writeUInt8(e.ADVANCED_TRANSACTION_MARKER),i.writeUInt8(e.ADVANCED_TRANSACTION_FLAG)),i.writeVarInt(this.ins.length),this.ins.forEach((function(e){i.writeSlice(e.hash),i.writeUInt32(e.index),i.writeVarSlice(e.script),i.writeUInt32(e.sequence)})),i.writeVarInt(this.outs.length),this.outs.forEach((function(e){void 0!==e.value?i.writeUInt64(e.value):i.writeSlice(e.valueBuffer),i.writeVarSlice(e.script)})),o&&this.ins.forEach((function(e){i.writeVector(e.witness)})),i.writeUInt32(this.locktime),void 0!==n?t.slice(n,i.offset):t}}],[{key:"fromBuffer",value:function(t,n){var r=new WJ.BufferReader(t),i=new e;i.version=r.readInt32();var o=r.readUInt8(),a=r.readUInt8(),s=!1;o===e.ADVANCED_TRANSACTION_MARKER&&a===e.ADVANCED_TRANSACTION_FLAG?s=!0:r.offset-=2;for(var u=r.readVarInt(),l=0;l<u;++l)i.ins.push({hash:r.readSlice(32),index:r.readUInt32(),script:r.readVarSlice(),sequence:r.readUInt32(),witness:oY});for(var A=r.readVarInt(),c=0;c<A;++c)i.outs.push({value:r.readUInt64(),script:r.readVarSlice()});if(s){for(var h=0;h<u;++h)i.ins[h].witness=r.readVector();if(!i.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(i.locktime=r.readUInt32(),n)return i;if(r.offset!==t.length)throw new Error("Transaction has unexpected data");return i}},{key:"fromHex",value:function(t){return e.fromBuffer(Xo.from(t,"hex"),!1)}},{key:"isCoinbaseHash",value:function(e){nY(tY.Hash256bit,e);for(var t=0;t<32;++t)if(0!==e[t])return!1;return!0}}]),e}();XJ.Transaction=AY,AY.DEFAULT_SEQUENCE=4294967295,AY.SIGHASH_DEFAULT=0,AY.SIGHASH_ALL=1,AY.SIGHASH_NONE=2,AY.SIGHASH_SINGLE=3,AY.SIGHASH_ANYONECANPAY=128,AY.SIGHASH_OUTPUT_MASK=3,AY.SIGHASH_INPUT_MASK=128,AY.ADVANCED_TRANSACTION_MARKER=0,AY.ADVANCED_TRANSACTION_FLAG=1,Object.defineProperty(LJ,"__esModule",{value:!0}),LJ.Block=void 0;var cY=TJ,hY=Bz,fY=YJ,dY=XJ,pY=hV,gY=pY.typeforce,vY=new TypeError("Cannot compute merkle root for zero transactions"),yY=new TypeError("Cannot compute witness commit for non-segwit block"),mY=function(){function e(){s(this,e),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}return l(e,[{key:"getWitnessCommit",value:function(){if(!wY(this.transactions))return null;var e=this.transactions[0].outs.filter((function(e){return e.script.slice(0,6).equals(Xo.from("6a24aa21a9ed","hex"))})).map((function(e){return e.script.slice(6,38)}));if(0===e.length)return null;var t=e[e.length-1];return t instanceof Xo&&32===t.length?t:null}},{key:"hasWitnessCommit",value:function(){return this.witnessCommit instanceof Xo&&32===this.witnessCommit.length||null!==this.getWitnessCommit()}},{key:"hasWitness",value:function(){return(e=this.transactions)instanceof Array&&e.some((function(e){return"object"==i(e)&&e.ins instanceof Array&&e.ins.some((function(e){return"object"==i(e)&&e.witness instanceof Array&&e.witness.length>0}))}));var e}},{key:"weight",value:function(){return 3*this.byteLength(!1,!1)+this.byteLength(!1,!0)}},{key:"byteLength",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e||!this.transactions?80:80+cY.varuint.encodingLength(this.transactions.length)+this.transactions.reduce((function(e,n){return e+n.byteLength(t)}),0)}},{key:"getHash",value:function(){return hY.hash256(this.toBuffer(!0))}},{key:"getId",value:function(){return(0,cY.reverseBuffer)(this.getHash()).toString("hex")}},{key:"getUTCDate",value:function(){var e=new Date(0);return e.setUTCSeconds(this.timestamp),e}},{key:"toBuffer",value:function(e){var t=Xo.allocUnsafe(this.byteLength(e)),n=new cY.BufferWriter(t);return n.writeInt32(this.version),n.writeSlice(this.prevHash),n.writeSlice(this.merkleRoot),n.writeUInt32(this.timestamp),n.writeUInt32(this.bits),n.writeUInt32(this.nonce),e||!this.transactions||(cY.varuint.encode(this.transactions.length,t,n.offset),n.offset+=cY.varuint.encode.bytes,this.transactions.forEach((function(e){var r=e.byteLength();e.toBuffer(t,n.offset),n.offset+=r}))),t}},{key:"toHex",value:function(e){return this.toBuffer(e).toString("hex")}},{key:"checkTxRoots",value:function(){var e=this.hasWitnessCommit();return!(!e&&this.hasWitness())&&this.__checkMerkleRoot()&&(!e||this.__checkWitnessCommit())}},{key:"checkProofOfWork",value:function(){var t=(0,cY.reverseBuffer)(this.getHash()),n=e.calculateTarget(this.bits);return t.compare(n)<=0}},{key:"__checkMerkleRoot",value:function(){if(!this.transactions)throw vY;var t=e.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(t)}},{key:"__checkWitnessCommit",value:function(){if(!this.transactions)throw vY;if(!this.hasWitnessCommit())throw yY;var t=e.calculateMerkleRoot(this.transactions,!0);return 0===this.witnessCommit.compare(t)}}],[{key:"fromBuffer",value:function(t){if(t.length<80)throw new Error("Buffer too small (< 80 bytes)");var n=new cY.BufferReader(t),r=new e;if(r.version=n.readInt32(),r.prevHash=n.readSlice(32),r.merkleRoot=n.readSlice(32),r.timestamp=n.readUInt32(),r.bits=n.readUInt32(),r.nonce=n.readUInt32(),80===t.length)return r;var i=function(){var e=dY.Transaction.fromBuffer(n.buffer.slice(n.offset),!0);return n.offset+=e.byteLength(),e},o=n.readVarInt();r.transactions=[];for(var a=0;a<o;++a){var s=i();r.transactions.push(s)}var u=r.getWitnessCommit();return u&&(r.witnessCommit=u),r}},{key:"fromHex",value:function(t){return e.fromBuffer(Xo.from(t,"hex"))}},{key:"calculateTarget",value:function(e){var t=((4278190080&e)>>24)-3,n=8388607&e,r=Xo.alloc(32,0);return r.writeUIntBE(n,29-t,3),r}},{key:"calculateMerkleRoot",value:function(e,t){if(gY([{getHash:pY.Function}],e),0===e.length)throw vY;if(t&&!wY(e))throw yY;var n=e.map((function(e){return e.getHash(t)})),r=(0,fY.fastMerkleRoot)(n,hY.hash256);return t?hY.hash256(Xo.concat([r,e[0].ins[0].witness[0]])):r}}]),e}();function wY(e){return e instanceof Array&&e[0]&&e[0].ins&&e[0].ins instanceof Array&&e[0].ins[0]&&e[0].ins[0].witness&&e[0].ins[0].witness instanceof Array&&e[0].ins[0].witness.length>0}LJ.Block=mY;var bY={},IY={},BY={},EY={},CY={},xY={},kY={};!function(e){var t,n,r;Object.defineProperty(e,"__esModule",{value:!0}),(t=e.GlobalTypes||(e.GlobalTypes={}))[t.UNSIGNED_TX=0]="UNSIGNED_TX",t[t.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",n[n.TAP_KEY_SIG=19]="TAP_KEY_SIG",n[n.TAP_SCRIPT_SIG=20]="TAP_SCRIPT_SIG",n[n.TAP_LEAF_SCRIPT=21]="TAP_LEAF_SCRIPT",n[n.TAP_BIP32_DERIVATION=22]="TAP_BIP32_DERIVATION",n[n.TAP_INTERNAL_KEY=23]="TAP_INTERNAL_KEY",n[n.TAP_MERKLE_ROOT=24]="TAP_MERKLE_ROOT",e.INPUT_TYPE_NAMES=["nonWitnessUtxo","witnessUtxo","partialSig","sighashType","redeemScript","witnessScript","bip32Derivation","finalScriptSig","finalScriptWitness","porCommitment","tapKeySig","tapScriptSig","tapLeafScript","tapBip32Derivation","tapInternalKey","tapMerkleRoot"],(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",r[r.TAP_INTERNAL_KEY=5]="TAP_INTERNAL_KEY",r[r.TAP_TREE=6]="TAP_TREE",r[r.TAP_BIP32_DERIVATION=7]="TAP_BIP32_DERIVATION",e.OUTPUT_TYPE_NAMES=["redeemScript","witnessScript","bip32Derivation","tapInternalKey","tapTree","tapBip32Derivation"]}(kY);var SY={};Object.defineProperty(SY,"__esModule",{value:!0});var QY=kY;SY.decode=function(e){if(e.key[0]!==QY.GlobalTypes.GLOBAL_XPUB)throw new Error("Decode Error: could not decode globalXpub with key 0x"+e.key.toString("hex"));if(79!==e.key.length||![2,3].includes(e.key[46]))throw new Error("Decode Error: globalXpub has invalid extended pubkey in key 0x"+e.key.toString("hex"));if(e.value.length/4%1!=0)throw new Error("Decode Error: Global GLOBAL_XPUB value length should be multiple of 4");for(var t,n=e.key.slice(1),r={masterFingerprint:e.value.slice(0,4),extendedPubkey:n,path:"m"},i=0,o=(t=e.value.length/4-1,k(Array(t).keys()));i<o.length;i++){var a=o[i],s=e.value.readUInt32LE(4*a+4),u=!!(2147483648&s),l=2147483647&s;r.path+="/"+l.toString(10)+(u?"'":"")}return r},SY.encode=function(e){var t=Xo.from([QY.GlobalTypes.GLOBAL_XPUB]),n=Xo.concat([t,e.extendedPubkey]),r=e.path.split("/"),i=Xo.allocUnsafe(4*r.length);e.masterFingerprint.copy(i,0);var o=4;return r.slice(1).forEach((function(e){var t="'"===e.slice(-1),n=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(n+=2147483648),i.writeUInt32LE(n,o),o+=4})),{key:n,value:i}},SY.expected="{ masterFingerprint: Buffer; extendedPubkey: Buffer; path: string; }",SY.check=function(e){var t=e.extendedPubkey,n=e.masterFingerprint,r=e.path;return Da(t)&&78===t.length&&[2,3].indexOf(t[45])>-1&&Da(n)&&4===n.length&&"string"==typeof r&&!!r.match(/^m(\/\d+'?)*$/)},SY.canAddToArray=function(e,t,n){var r=t.extendedPubkey.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((function(e){return e.extendedPubkey.equals(t.extendedPubkey)})).length)};var _Y={};Object.defineProperty(_Y,"__esModule",{value:!0});var NY=kY;_Y.encode=function(e){return{key:Xo.from([NY.GlobalTypes.UNSIGNED_TX]),value:e.toBuffer()}};var DY={};Object.defineProperty(DY,"__esModule",{value:!0});var FY=kY;DY.decode=function(e){if(e.key[0]!==FY.InputTypes.FINAL_SCRIPTSIG)throw new Error("Decode Error: could not decode finalScriptSig with key 0x"+e.key.toString("hex"));return e.value},DY.encode=function(e){return{key:Xo.from([FY.InputTypes.FINAL_SCRIPTSIG]),value:e}},DY.expected="Buffer",DY.check=function(e){return Da(e)},DY.canAdd=function(e,t){return!!e&&!!t&&void 0===e.finalScriptSig};var PY={};Object.defineProperty(PY,"__esModule",{value:!0});var UY=kY;PY.decode=function(e){if(e.key[0]!==UY.InputTypes.FINAL_SCRIPTWITNESS)throw new Error("Decode Error: could not decode finalScriptWitness with key 0x"+e.key.toString("hex"));return e.value},PY.encode=function(e){return{key:Xo.from([UY.InputTypes.FINAL_SCRIPTWITNESS]),value:e}},PY.expected="Buffer",PY.check=function(e){return Da(e)},PY.canAdd=function(e,t){return!!e&&!!t&&void 0===e.finalScriptWitness};var LY={};Object.defineProperty(LY,"__esModule",{value:!0});var TY=kY;LY.decode=function(e){if(e.key[0]!==TY.InputTypes.NON_WITNESS_UTXO)throw new Error("Decode Error: could not decode nonWitnessUtxo with key 0x"+e.key.toString("hex"));return e.value},LY.encode=function(e){return{key:Xo.from([TY.InputTypes.NON_WITNESS_UTXO]),value:e}},LY.expected="Buffer",LY.check=function(e){return Da(e)},LY.canAdd=function(e,t){return!!e&&!!t&&void 0===e.nonWitnessUtxo};var MY={};Object.defineProperty(MY,"__esModule",{value:!0});var RY=kY;MY.decode=function(e){if(e.key[0]!==RY.InputTypes.PARTIAL_SIG)throw new Error("Decode Error: could not decode partialSig 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: partialSig has invalid pubkey in key 0x"+e.key.toString("hex"));return{pubkey:e.key.slice(1),signature:e.value}},MY.encode=function(e){var t=Xo.from([RY.InputTypes.PARTIAL_SIG]);return{key:Xo.concat([t,e.pubkey]),value:e.signature}},MY.expected="{ pubkey: Buffer; signature: Buffer; }",MY.check=function(e){return Da(e.pubkey)&&Da(e.signature)&&[33,65].includes(e.pubkey.length)&&[2,3,4].includes(e.pubkey[0])&&function(e){if(!Da(e)||e.length<9)return!1;if(48!==e[0])return!1;if(e.length!==e[1]+3)return!1;if(2!==e[2])return!1;var t=e[3];if(t>33||t<1)return!1;if(2!==e[3+t+1])return!1;var n=e[3+t+2];return!(n>33||n<1)&&e.length===3+t+2+n+2}(e.signature)},MY.canAddToArray=function(e,t,n){var r=t.pubkey.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((function(e){return e.pubkey.equals(t.pubkey)})).length)};var OY={};Object.defineProperty(OY,"__esModule",{value:!0});var HY=kY;OY.decode=function(e){if(e.key[0]!==HY.InputTypes.POR_COMMITMENT)throw new Error("Decode Error: could not decode porCommitment with key 0x"+e.key.toString("hex"));return e.value.toString("utf8")},OY.encode=function(e){return{key:Xo.from([HY.InputTypes.POR_COMMITMENT]),value:Xo.from(e,"utf8")}},OY.expected="string",OY.check=function(e){return"string"==typeof e},OY.canAdd=function(e,t){return!!e&&!!t&&void 0===e.porCommitment};var KY={};Object.defineProperty(KY,"__esModule",{value:!0});var jY=kY;KY.decode=function(e){if(e.key[0]!==jY.InputTypes.SIGHASH_TYPE)throw new Error("Decode Error: could not decode sighashType with key 0x"+e.key.toString("hex"));return e.value.readUInt32LE(0)},KY.encode=function(e){var t=Xo.from([jY.InputTypes.SIGHASH_TYPE]),n=Xo.allocUnsafe(4);return n.writeUInt32LE(e,0),{key:t,value:n}},KY.expected="number",KY.check=function(e){return"number"==typeof e},KY.canAdd=function(e,t){return!!e&&!!t&&void 0===e.sighashType};var GY={};Object.defineProperty(GY,"__esModule",{value:!0});var qY=kY;function VY(e){return Da(e)&&(64===e.length||65===e.length)}GY.decode=function(e){if(e.key[0]!==qY.InputTypes.TAP_KEY_SIG||1!==e.key.length)throw new Error("Decode Error: could not decode tapKeySig with key 0x"+e.key.toString("hex"));if(!VY(e.value))throw new Error("Decode Error: tapKeySig not a valid 64-65-byte BIP340 signature");return e.value},GY.encode=function(e){return{key:Xo.from([qY.InputTypes.TAP_KEY_SIG]),value:e}},GY.expected="Buffer",GY.check=VY,GY.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapKeySig};var zY={};Object.defineProperty(zY,"__esModule",{value:!0});var JY=kY;zY.decode=function(e){if(e.key[0]!==JY.InputTypes.TAP_LEAF_SCRIPT)throw new Error("Decode Error: could not decode tapLeafScript with key 0x"+e.key.toString("hex"));if((e.key.length-2)%32!=0)throw new Error("Decode Error: tapLeafScript has invalid control block in key 0x"+e.key.toString("hex"));var t=e.value[e.value.length-1];if((254&e.key[1])!==t)throw new Error("Decode Error: tapLeafScript bad leaf version in key 0x"+e.key.toString("hex"));var n=e.value.slice(0,-1);return{controlBlock:e.key.slice(1),script:n,leafVersion:t}},zY.encode=function(e){var t=Xo.from([JY.InputTypes.TAP_LEAF_SCRIPT]),n=Xo.from([e.leafVersion]);return{key:Xo.concat([t,e.controlBlock]),value:Xo.concat([e.script,n])}},zY.expected="{ controlBlock: Buffer; leafVersion: number, script: Buffer; }",zY.check=function(e){return Da(e.controlBlock)&&(e.controlBlock.length-1)%32==0&&(254&e.controlBlock[0])===e.leafVersion&&Da(e.script)},zY.canAddToArray=function(e,t,n){var r=t.controlBlock.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((function(e){return e.controlBlock.equals(t.controlBlock)})).length)};var YY={};Object.defineProperty(YY,"__esModule",{value:!0});var XY=kY;function WY(e){return Da(e)&&32===e.length}YY.decode=function(e){if(e.key[0]!==XY.InputTypes.TAP_MERKLE_ROOT||1!==e.key.length)throw new Error("Decode Error: could not decode tapMerkleRoot with key 0x"+e.key.toString("hex"));if(!WY(e.value))throw new Error("Decode Error: tapMerkleRoot not a 32-byte hash");return e.value},YY.encode=function(e){return{key:Xo.from([XY.InputTypes.TAP_MERKLE_ROOT]),value:e}},YY.expected="Buffer",YY.check=WY,YY.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapMerkleRoot};var ZY={};Object.defineProperty(ZY,"__esModule",{value:!0});var $Y=kY;ZY.decode=function(e){if(e.key[0]!==$Y.InputTypes.TAP_SCRIPT_SIG)throw new Error("Decode Error: could not decode tapScriptSig with key 0x"+e.key.toString("hex"));if(65!==e.key.length)throw new Error("Decode Error: tapScriptSig has invalid key 0x"+e.key.toString("hex"));if(64!==e.value.length&&65!==e.value.length)throw new Error("Decode Error: tapScriptSig has invalid signature in key 0x"+e.key.toString("hex"));return{pubkey:e.key.slice(1,33),leafHash:e.key.slice(33),signature:e.value}},ZY.encode=function(e){var t=Xo.from([$Y.InputTypes.TAP_SCRIPT_SIG]);return{key:Xo.concat([t,e.pubkey,e.leafHash]),value:e.signature}},ZY.expected="{ pubkey: Buffer; leafHash: Buffer; signature: Buffer; }",ZY.check=function(e){return Da(e.pubkey)&&Da(e.leafHash)&&Da(e.signature)&&32===e.pubkey.length&&32===e.leafHash.length&&(64===e.signature.length||65===e.signature.length)},ZY.canAddToArray=function(e,t,n){var r=t.pubkey.toString("hex")+t.leafHash.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((function(e){return e.pubkey.equals(t.pubkey)&&e.leafHash.equals(t.leafHash)})).length)};var eX={},tX={},nX={};function rX(e){if(e<0||e>9007199254740991||e%1!=0)throw new RangeError("value out of range")}function iX(e){return rX(e),e<253?1:e<=65535?3:e<=4294967295?5:9}Object.defineProperty(nX,"__esModule",{value:!0}),nX.encode=function e(t,n,r){if(rX(t),n||(n=Xo.allocUnsafe(iX(t))),!Da(n))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),t<253?(n.writeUInt8(t,r),Object.assign(e,{bytes:1})):t<=65535?(n.writeUInt8(253,r),n.writeUInt16LE(t,r+1),Object.assign(e,{bytes:3})):t<=4294967295?(n.writeUInt8(254,r),n.writeUInt32LE(t,r+1),Object.assign(e,{bytes:5})):(n.writeUInt8(255,r),n.writeUInt32LE(t>>>0,r+1),n.writeUInt32LE(t/4294967296|0,r+5),Object.assign(e,{bytes:9})),n},nX.decode=function e(t,n){if(!Da(t))throw new TypeError("buffer must be a Buffer instance");n||(n=0);var r=t.readUInt8(n);if(r<253)return Object.assign(e,{bytes:1}),r;if(253===r)return Object.assign(e,{bytes:3}),t.readUInt16LE(n+1);if(254===r)return Object.assign(e,{bytes:5}),t.readUInt32LE(n+1);Object.assign(e,{bytes:9});var i=t.readUInt32LE(n+1),o=4294967296*t.readUInt32LE(n+5)+i;return rX(o),o},nX.encodingLength=iX,Object.defineProperty(tX,"__esModule",{value:!0});var oX=nX;function aX(e){var t=e.key.length,n=e.value.length,r=oX.encodingLength(t),i=oX.encodingLength(n),o=Xo.allocUnsafe(r+t+i+n);return oX.encode(t,o,0),e.key.copy(o,r),oX.encode(n,o,r+t),e.value.copy(o,r+t+i),o}function sX(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}tX.range=function(e){return k(Array(e).keys())},tX.reverseBuffer=function(e){if(e.length<1)return e;for(var t=e.length-1,n=0,r=0;r<e.length/2;r++)n=e[r],e[r]=e[t],e[t]=n,t--;return e},tX.keyValsToBuffer=function(e){var t=e.map(aX);return t.push(Xo.from([0])),Xo.concat(t)},tX.keyValToBuffer=aX,tX.readUInt64LE=function(e,t){var n=e.readUInt32LE(t),r=e.readUInt32LE(t+4);return sX((r*=4294967296)+n,9007199254740991),r+n},tX.writeUInt64LE=function(e,t,n){return sX(t,9007199254740991),e.writeInt32LE(-1&t,n),e.writeUInt32LE(Math.floor(t/4294967296),n+4),n+8},Object.defineProperty(eX,"__esModule",{value:!0});var uX=kY,lX=tX,AX=nX;eX.decode=function(e){if(e.key[0]!==uX.InputTypes.WITNESS_UTXO)throw new Error("Decode Error: could not decode witnessUtxo with key 0x"+e.key.toString("hex"));var t=lX.readUInt64LE(e.value,0),n=8,r=AX.decode(e.value,n);n+=AX.encodingLength(r);var i=e.value.slice(n);if(i.length!==r)throw new Error("Decode Error: WITNESS_UTXO script is not proper length");return{script:i,value:t}},eX.encode=function(e){var t=e.script,n=e.value,r=AX.encodingLength(t.length),i=Xo.allocUnsafe(8+r+t.length);return lX.writeUInt64LE(i,n,0),AX.encode(t.length,i,8),t.copy(i,8+r),{key:Xo.from([uX.InputTypes.WITNESS_UTXO]),value:i}},eX.expected="{ script: Buffer; value: number; }",eX.check=function(e){return Da(e.script)&&"number"==typeof e.value},eX.canAdd=function(e,t){return!!e&&!!t&&void 0===e.witnessUtxo};var cX={};Object.defineProperty(cX,"__esModule",{value:!0});var hX=kY,fX=nX;cX.decode=function(e){if(e.key[0]!==hX.OutputTypes.TAP_TREE||1!==e.key.length)throw new Error("Decode Error: could not decode tapTree with key 0x"+e.key.toString("hex"));for(var t=0,n=[];t<e.value.length;){var r=e.value[t++],i=e.value[t++],o=fX.decode(e.value,t);t+=fX.encodingLength(o),n.push({depth:r,leafVersion:i,script:e.value.slice(t,t+o)}),t+=o}return{leaves:n}},cX.encode=function(e){var t,n=Xo.from([hX.OutputTypes.TAP_TREE]),r=(t=[]).concat.apply(t,k(e.leaves.map((function(e){return[Xo.of(e.depth,e.leafVersion),fX.encode(e.script.length),e.script]}))));return{key:n,value:Xo.concat(r)}},cX.expected="{ leaves: [{ depth: number; leafVersion: number, script: Buffer; }] }",cX.check=function(e){return Array.isArray(e.leaves)&&e.leaves.every((function(e){return e.depth>=0&&e.depth<=128&&(254&e.leafVersion)===e.leafVersion&&Da(e.script)}))},cX.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapTree};var dX={};Object.defineProperty(dX,"__esModule",{value:!0});var pX=function(e){return 33===e.length&&[2,3].includes(e[0])||65===e.length&&4===e[0]};dX.makeConverter=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pX;return{decode:function(n){if(n.key[0]!==e)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+n.key.toString("hex"));var r=n.key.slice(1);if(!t(r))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+n.key.toString("hex"));if(n.value.length/4%1!=0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");for(var i,o={masterFingerprint:n.value.slice(0,4),pubkey:r,path:"m"},a=0,s=(i=n.value.length/4-1,k(Array(i).keys()));a<s.length;a++){var u=s[a],l=n.value.readUInt32LE(4*u+4),A=!!(2147483648&l),c=2147483647&l;o.path+="/"+c.toString(10)+(A?"'":"")}return o},encode:function(t){var n=Xo.from([e]),r=Xo.concat([n,t.pubkey]),i=t.path.split("/"),o=Xo.allocUnsafe(4*i.length);t.masterFingerprint.copy(o,0);var a=4;return i.slice(1).forEach((function(e){var t="'"===e.slice(-1),n=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(n+=2147483648),o.writeUInt32LE(n,a),a+=4})),{key:r,value:o}},check:function(e){return Da(e.pubkey)&&Da(e.masterFingerprint)&&"string"==typeof e.path&&t(e.pubkey)&&4===e.masterFingerprint.length},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; }",canAddToArray:function(e,t,n){var r=t.pubkey.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((function(e){return e.pubkey.equals(t.pubkey)})).length)}}};var gX={};Object.defineProperty(gX,"__esModule",{value:!0}),gX.makeChecker=function(e){return function(t){var n;if(e.includes(t.key[0])&&(33!==(n=t.key.slice(1)).length&&65!==n.length||![2,3,4].includes(n[0])))throw new Error("Format Error: invalid pubkey in key 0x"+t.key.toString("hex"));return n}};var vX={};Object.defineProperty(vX,"__esModule",{value:!0}),vX.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode redeemScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(t){return{key:Xo.from([e]),value:t}},check:function(e){return Da(e)},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.redeemScript}}};var yX={};Object.defineProperty(yX,"__esModule",{value:!0});var mX=nX,wX=dX,bX=function(e){return 32===e.length};yX.makeConverter=function(e){var t=wX.makeConverter(e,bX);return{decode:function(e){for(var n=mX.decode(e.value),r=mX.encodingLength(n),i=t.decode({key:e.key,value:e.value.slice(r+32*n)}),o=new Array(n),a=0,s=r;a<n;a++,s+=32)o[a]=e.value.slice(s,s+32);return Object.assign({},i,{leafHashes:o})},encode:function(e){var n=t.encode(e),r=mX.encodingLength(e.leafHashes.length),i=Xo.allocUnsafe(r);mX.encode(e.leafHashes.length,i);var o=Xo.concat([i].concat(k(e.leafHashes),[n.value]));return Object.assign({},n,{value:o})},check:function(e){return Array.isArray(e.leafHashes)&&e.leafHashes.every((function(e){return Da(e)&&32===e.length}))&&t.check(e)},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; leafHashes: Buffer[]; }",canAddToArray:t.canAddToArray}};var IX={};Object.defineProperty(IX,"__esModule",{value:!0}),IX.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e||1!==t.key.length)throw new Error("Decode Error: could not decode tapInternalKey with key 0x"+t.key.toString("hex"));if(32!==t.value.length)throw new Error("Decode Error: tapInternalKey not a 32-byte x-only pubkey");return t.value},encode:function(t){return{key:Xo.from([e]),value:t}},check:function(e){return Da(e)&&32===e.length},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.tapInternalKey}}};var BX={};Object.defineProperty(BX,"__esModule",{value:!0}),BX.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode witnessScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(t){return{key:Xo.from([e]),value:t}},check:function(e){return Da(e)},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.witnessScript}}},Object.defineProperty(xY,"__esModule",{value:!0});var EX=kY,CX=DY,xX=PY,kX=LY,SX=MY,QX=OY,_X=KY,NX=GY,DX=zY,FX=YY,PX=ZY,UX=eX,LX=cX,TX=dX,MX=gX,RX=vX,OX=yX,HX=IX,KX=BX,jX={unsignedTx:_Y,globalXpub:SY,checkPubkey:MX.makeChecker([])};xY.globals=jX;var GX={nonWitnessUtxo:kX,partialSig:SX,sighashType:_X,finalScriptSig:CX,finalScriptWitness:xX,porCommitment:QX,witnessUtxo:UX,bip32Derivation:TX.makeConverter(EX.InputTypes.BIP32_DERIVATION),redeemScript:RX.makeConverter(EX.InputTypes.REDEEM_SCRIPT),witnessScript:KX.makeConverter(EX.InputTypes.WITNESS_SCRIPT),checkPubkey:MX.makeChecker([EX.InputTypes.PARTIAL_SIG,EX.InputTypes.BIP32_DERIVATION]),tapKeySig:NX,tapScriptSig:PX,tapLeafScript:DX,tapBip32Derivation:OX.makeConverter(EX.InputTypes.TAP_BIP32_DERIVATION),tapInternalKey:HX.makeConverter(EX.InputTypes.TAP_INTERNAL_KEY),tapMerkleRoot:FX};xY.inputs=GX;var qX={bip32Derivation:TX.makeConverter(EX.OutputTypes.BIP32_DERIVATION),redeemScript:RX.makeConverter(EX.OutputTypes.REDEEM_SCRIPT),witnessScript:KX.makeConverter(EX.OutputTypes.WITNESS_SCRIPT),checkPubkey:MX.makeChecker([EX.OutputTypes.BIP32_DERIVATION]),tapBip32Derivation:OX.makeConverter(EX.OutputTypes.TAP_BIP32_DERIVATION),tapTree:LX,tapInternalKey:HX.makeConverter(EX.OutputTypes.TAP_INTERNAL_KEY)};xY.outputs=qX,Object.defineProperty(CY,"__esModule",{value:!0});var VX=xY,zX=tX,JX=nX,YX=kY;function XX(e,t,n){if(!t.equals(Xo.from([n])))throw new Error("Format Error: Invalid ".concat(e," key: ").concat(t.toString("hex")))}function WX(e,t){var n,r=t.globalMapKeyVals,i=t.inputKeyVals,o=t.outputKeyVals,a={unsignedTx:e},s=0,u=F(r);try{for(u.s();!(n=u.n()).done;){var l=n.value;switch(l.key[0]){case YX.GlobalTypes.UNSIGNED_TX:if(XX("global",l.key,YX.GlobalTypes.UNSIGNED_TX),s>0)throw new Error("Format Error: GlobalMap has multiple UNSIGNED_TX");s++;break;case YX.GlobalTypes.GLOBAL_XPUB:void 0===a.globalXpub&&(a.globalXpub=[]),a.globalXpub.push(VX.globals.globalXpub.decode(l));break;default:a.unknownKeyVals||(a.unknownKeyVals=[]),a.unknownKeyVals.push(l)}}}catch(e){u.e(e)}finally{u.f()}var A,c=i.length,h=o.length,f=[],d=[],p=F(zX.range(c));try{for(p.s();!(A=p.n()).done;){var g,v=A.value,y={},m=F(i[v]);try{for(m.s();!(g=m.n()).done;){var w=g.value;switch(VX.inputs.checkPubkey(w),w.key[0]){case YX.InputTypes.NON_WITNESS_UTXO:if(XX("input",w.key,YX.InputTypes.NON_WITNESS_UTXO),void 0!==y.nonWitnessUtxo)throw new Error("Format Error: Input has multiple NON_WITNESS_UTXO");y.nonWitnessUtxo=VX.inputs.nonWitnessUtxo.decode(w);break;case YX.InputTypes.WITNESS_UTXO:if(XX("input",w.key,YX.InputTypes.WITNESS_UTXO),void 0!==y.witnessUtxo)throw new Error("Format Error: Input has multiple WITNESS_UTXO");y.witnessUtxo=VX.inputs.witnessUtxo.decode(w);break;case YX.InputTypes.PARTIAL_SIG:void 0===y.partialSig&&(y.partialSig=[]),y.partialSig.push(VX.inputs.partialSig.decode(w));break;case YX.InputTypes.SIGHASH_TYPE:if(XX("input",w.key,YX.InputTypes.SIGHASH_TYPE),void 0!==y.sighashType)throw new Error("Format Error: Input has multiple SIGHASH_TYPE");y.sighashType=VX.inputs.sighashType.decode(w);break;case YX.InputTypes.REDEEM_SCRIPT:if(XX("input",w.key,YX.InputTypes.REDEEM_SCRIPT),void 0!==y.redeemScript)throw new Error("Format Error: Input has multiple REDEEM_SCRIPT");y.redeemScript=VX.inputs.redeemScript.decode(w);break;case YX.InputTypes.WITNESS_SCRIPT:if(XX("input",w.key,YX.InputTypes.WITNESS_SCRIPT),void 0!==y.witnessScript)throw new Error("Format Error: Input has multiple WITNESS_SCRIPT");y.witnessScript=VX.inputs.witnessScript.decode(w);break;case YX.InputTypes.BIP32_DERIVATION:void 0===y.bip32Derivation&&(y.bip32Derivation=[]),y.bip32Derivation.push(VX.inputs.bip32Derivation.decode(w));break;case YX.InputTypes.FINAL_SCRIPTSIG:XX("input",w.key,YX.InputTypes.FINAL_SCRIPTSIG),y.finalScriptSig=VX.inputs.finalScriptSig.decode(w);break;case YX.InputTypes.FINAL_SCRIPTWITNESS:XX("input",w.key,YX.InputTypes.FINAL_SCRIPTWITNESS),y.finalScriptWitness=VX.inputs.finalScriptWitness.decode(w);break;case YX.InputTypes.POR_COMMITMENT:XX("input",w.key,YX.InputTypes.POR_COMMITMENT),y.porCommitment=VX.inputs.porCommitment.decode(w);break;case YX.InputTypes.TAP_KEY_SIG:XX("input",w.key,YX.InputTypes.TAP_KEY_SIG),y.tapKeySig=VX.inputs.tapKeySig.decode(w);break;case YX.InputTypes.TAP_SCRIPT_SIG:void 0===y.tapScriptSig&&(y.tapScriptSig=[]),y.tapScriptSig.push(VX.inputs.tapScriptSig.decode(w));break;case YX.InputTypes.TAP_LEAF_SCRIPT:void 0===y.tapLeafScript&&(y.tapLeafScript=[]),y.tapLeafScript.push(VX.inputs.tapLeafScript.decode(w));break;case YX.InputTypes.TAP_BIP32_DERIVATION:void 0===y.tapBip32Derivation&&(y.tapBip32Derivation=[]),y.tapBip32Derivation.push(VX.inputs.tapBip32Derivation.decode(w));break;case YX.InputTypes.TAP_INTERNAL_KEY:XX("input",w.key,YX.InputTypes.TAP_INTERNAL_KEY),y.tapInternalKey=VX.inputs.tapInternalKey.decode(w);break;case YX.InputTypes.TAP_MERKLE_ROOT:XX("input",w.key,YX.InputTypes.TAP_MERKLE_ROOT),y.tapMerkleRoot=VX.inputs.tapMerkleRoot.decode(w);break;default:y.unknownKeyVals||(y.unknownKeyVals=[]),y.unknownKeyVals.push(w)}}}catch(e){m.e(e)}finally{m.f()}f.push(y)}}catch(e){p.e(e)}finally{p.f()}var b,I=F(zX.range(h));try{for(I.s();!(b=I.n()).done;){var B,E=b.value,C={},x=F(o[E]);try{for(x.s();!(B=x.n()).done;){var k=B.value;switch(VX.outputs.checkPubkey(k),k.key[0]){case YX.OutputTypes.REDEEM_SCRIPT:if(XX("output",k.key,YX.OutputTypes.REDEEM_SCRIPT),void 0!==C.redeemScript)throw new Error("Format Error: Output has multiple REDEEM_SCRIPT");C.redeemScript=VX.outputs.redeemScript.decode(k);break;case YX.OutputTypes.WITNESS_SCRIPT:if(XX("output",k.key,YX.OutputTypes.WITNESS_SCRIPT),void 0!==C.witnessScript)throw new Error("Format Error: Output has multiple WITNESS_SCRIPT");C.witnessScript=VX.outputs.witnessScript.decode(k);break;case YX.OutputTypes.BIP32_DERIVATION:void 0===C.bip32Derivation&&(C.bip32Derivation=[]),C.bip32Derivation.push(VX.outputs.bip32Derivation.decode(k));break;case YX.OutputTypes.TAP_INTERNAL_KEY:XX("output",k.key,YX.OutputTypes.TAP_INTERNAL_KEY),C.tapInternalKey=VX.outputs.tapInternalKey.decode(k);break;case YX.OutputTypes.TAP_TREE:XX("output",k.key,YX.OutputTypes.TAP_TREE),C.tapTree=VX.outputs.tapTree.decode(k);break;case YX.OutputTypes.TAP_BIP32_DERIVATION:void 0===C.tapBip32Derivation&&(C.tapBip32Derivation=[]),C.tapBip32Derivation.push(VX.outputs.tapBip32Derivation.decode(k));break;default:C.unknownKeyVals||(C.unknownKeyVals=[]),C.unknownKeyVals.push(k)}}}catch(e){x.e(e)}finally{x.f()}d.push(C)}}catch(e){I.e(e)}finally{I.f()}return{globalMap:a,inputs:f,outputs:d}}CY.psbtFromBuffer=function(e,t){var n=0;function r(){var t=JX.decode(e,n);n+=JX.encodingLength(t);var r=e.slice(n,n+t);return n+=t,r}function i(){return{key:r(),value:r()}}function o(){if(n>=e.length)throw new Error("Format Error: Unexpected End of PSBT");var t=0===e.readUInt8(n);return t&&n++,t}if(1886610036!==function(){var t=e.readUInt32BE(n);return n+=4,t}())throw new Error("Format Error: Invalid Magic Number");if(255!==function(){var t=e.readUInt8(n);return n+=1,t}())throw new Error("Format Error: Magic Number must be followed by 0xff separator");for(var a=[],s={};!o();){var u=i(),l=u.key.toString("hex");if(s[l])throw new Error("Format Error: Keys must be unique for global keymap: key "+l);s[l]=1,a.push(u)}var A=a.filter((function(e){return e.key[0]===YX.GlobalTypes.UNSIGNED_TX}));if(1!==A.length)throw new Error("Format Error: Only one UNSIGNED_TX allowed");var c,h=t(A[0].value),f=h.getInputOutputCounts(),d=f.inputCount,p=f.outputCount,g=[],v=[],y=F(zX.range(d));try{for(y.s();!(c=y.n()).done;){for(var m=c.value,w={},b=[];!o();){var I=i(),B=I.key.toString("hex");if(w[B])throw new Error("Format Error: Keys must be unique for each input: input index "+m+" key "+B);w[B]=1,b.push(I)}g.push(b)}}catch(e){y.e(e)}finally{y.f()}var E,C=F(zX.range(p));try{for(C.s();!(E=C.n()).done;){for(var x=E.value,k={},S=[];!o();){var Q=i(),_=Q.key.toString("hex");if(k[_])throw new Error("Format Error: Keys must be unique for each output: output index "+x+" key "+_);k[_]=1,S.push(Q)}v.push(S)}}catch(e){C.e(e)}finally{C.f()}return WX(h,{globalMapKeyVals:a,inputKeyVals:g,outputKeyVals:v})},CY.checkKeyBuffer=XX,CY.psbtFromKeyVals=WX;var ZX={};Object.defineProperty(ZX,"__esModule",{value:!0});var $X=xY,eW=tX;ZX.psbtToBuffer=function(e){var t=rW({globalMap:e.globalMap,inputs:e.inputs,outputs:e.outputs}),n=t.globalKeyVals,r=t.inputKeyVals,i=t.outputKeyVals,o=eW.keyValsToBuffer(n),a=function(e){return 0===e.length?[Xo.from([0])]:e.map(eW.keyValsToBuffer)},s=a(r),u=a(i),l=Xo.allocUnsafe(5);return l.writeUIntBE(482972169471,0,5),Xo.concat([l,o].concat(s,u))};var tW=function(e,t){return e.key.compare(t.key)};function nW(e,t){var n=new Set,r=Object.entries(e).reduce((function(e,r){var i=C(r,2),o=i[0],a=i[1];if("unknownKeyVals"===o)return e;var s=t[o];if(void 0===s)return e;var u=(Array.isArray(a)?a:[a]).map(s.encode);return u.map((function(e){return e.key.toString("hex")})).forEach((function(e){if(n.has(e))throw new Error("Serialize Error: Duplicate key: "+e);n.add(e)})),e.concat(u)}),[]),i=e.unknownKeyVals?e.unknownKeyVals.filter((function(e){return!n.has(e.key.toString("hex"))})):[];return r.concat(i).sort(tW)}function rW(e){var t=e.globalMap,n=e.inputs,r=e.outputs;return{globalKeyVals:nW(t,$X.globals),inputKeyVals:n.map((function(e){return nW(e,$X.inputs)})),outputKeyVals:r.map((function(e){return nW(e,$X.outputs)}))}}ZX.psbtToKeyVals=rW,function(e){function t(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),t(CY),t(ZX)}(EY),Object.defineProperty(BY,"__esModule",{value:!0});var iW=EY;function oW(e,t,n){return function(r){if(!e.has(r)){var i=n.filter((function(e){return e.key.toString("hex")===r}))[0];t.push(i),e.add(r)}}}function aW(e){return e.globalMap.unsignedTx}function sW(e){var t=new Set;return e.forEach((function(e){var n=e.key.toString("hex");if(t.has(n))throw new Error("Combine: KeyValue Map keys should be unique");t.add(n)})),t}BY.combine=function(e){var t=e[0],n=iW.psbtToKeyVals(t),r=e.slice(1);if(0===r.length)throw new Error("Combine: Nothing to combine");var i=aW(t);if(void 0===i)throw new Error("Combine: Self missing transaction");var o,a=sW(n.globalKeyVals),s=n.inputKeyVals.map(sW),u=n.outputKeyVals.map(sW),l=F(r);try{var A=function(){var e=o.value,t=aW(e);if(void 0===t||!t.toBuffer().equals(i.toBuffer()))throw new Error("Combine: One of the Psbts does not have the same transaction.");var r=iW.psbtToKeyVals(e);sW(r.globalKeyVals).forEach(oW(a,n.globalKeyVals,r.globalKeyVals)),r.inputKeyVals.map(sW).forEach((function(e,t){return e.forEach(oW(s[t],n.inputKeyVals[t],r.inputKeyVals[t]))})),r.outputKeyVals.map(sW).forEach((function(e,t){return e.forEach(oW(u[t],n.outputKeyVals[t],r.outputKeyVals[t]))}))};for(l.s();!(o=l.n()).done;)A()}catch(e){l.e(e)}finally{l.f()}return iW.psbtFromKeyVals(i,{globalMapKeyVals:n.globalKeyVals,inputKeyVals:n.inputKeyVals,outputKeyVals:n.outputKeyVals})};var uW={};!function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=xY;function n(e,t){var n=e[t];if(void 0===n)throw new Error("No input #".concat(t));return n}function r(e,t){var n=e[t];if(void 0===n)throw new Error("No output #".concat(t));return n}function i(e,t,n,r){throw new Error("Data for ".concat(e," key ").concat(t," is incorrect: Expected ").concat(n," and got ").concat(JSON.stringify(r)))}function o(e){return function(n,r){for(var o=function(){var o=s[a],u=n[o],l=t[e+"s"][o]||{},A=l.canAdd,c=l.canAddToArray,h=l.check,f=l.expected;if(h)if(!!c){if(!Array.isArray(u)||r[o]&&!Array.isArray(r[o]))throw new Error("Key type ".concat(o," must be an array"));u.every(h)||i(e,o,f,u);var d=r[o]||[],p=new Set;if(!u.every((function(e){return c(d,e,p)})))throw new Error("Can not add duplicate data to array");r[o]=d.concat(u)}else{if(h(u)||i(e,o,f,u),!A(r,u))throw new Error("Can not add duplicate data to ".concat(e));r[o]=u}},a=0,s=Object.keys(n);a<s.length;a++)o()}}e.checkForInput=n,e.checkForOutput=r,e.checkHasKey=function(e,t,n){if(e.key[0]<n)throw new Error("Use the method for your specific key instead of addUnknownKeyVal*");if(t&&0!==t.filter((function(t){return t.key.equals(e.key)})).length)throw new Error("Duplicate Key: ".concat(e.key.toString("hex")))},e.getEnumLength=function(e){var t=0;return Object.keys(e).forEach((function(e){Number(isNaN(Number(e)))&&t++})),t},e.inputCheckUncleanFinalized=function(e,t){var n=!1;if(t.nonWitnessUtxo||t.witnessUtxo){var r=!!t.redeemScript,i=!!t.witnessScript,o=!r||!!t.finalScriptSig,a=!i||!!t.finalScriptWitness,s=!!t.finalScriptSig||!!t.finalScriptWitness;n=o&&a&&s}if(!1===n)throw new Error("Input #".concat(e," has too much or too little data to clean"))},e.updateGlobal=o("global"),e.updateInput=o("input"),e.updateOutput=o("output"),e.addInputAttributes=function(t,r){var i=n(t,t.length-1);e.updateInput(r,i)},e.addOutputAttributes=function(t,n){var i=r(t,t.length-1);e.updateOutput(n,i)},e.defaultVersionSetter=function(e,t){if(!Da(t)||t.length<4)throw new Error("Set Version: Invalid Transaction");return t.writeUInt32LE(e,0),t},e.defaultLocktimeSetter=function(e,t){if(!Da(t)||t.length<4)throw new Error("Set Locktime: Invalid Transaction");return t.writeUInt32LE(e,t.length-4),t}}(uW),Object.defineProperty(IY,"__esModule",{value:!0});var lW=BY,AW=EY,cW=kY,hW=uW;IY.Psbt=function(){function e(t){s(this,e),this.inputs=[],this.outputs=[],this.globalMap={unsignedTx:t}}return l(e,[{key:"toBase64",value:function(){return this.toBuffer().toString("base64")}},{key:"toHex",value:function(){return this.toBuffer().toString("hex")}},{key:"toBuffer",value:function(){return AW.psbtToBuffer(this)}},{key:"updateGlobal",value:function(e){return hW.updateGlobal(e,this.globalMap),this}},{key:"updateInput",value:function(e,t){var n=hW.checkForInput(this.inputs,e);return hW.updateInput(t,n),this}},{key:"updateOutput",value:function(e,t){var n=hW.checkForOutput(this.outputs,e);return hW.updateOutput(t,n),this}},{key:"addUnknownKeyValToGlobal",value:function(e){return hW.checkHasKey(e,this.globalMap.unknownKeyVals,hW.getEnumLength(cW.GlobalTypes)),this.globalMap.unknownKeyVals||(this.globalMap.unknownKeyVals=[]),this.globalMap.unknownKeyVals.push(e),this}},{key:"addUnknownKeyValToInput",value:function(e,t){var n=hW.checkForInput(this.inputs,e);return hW.checkHasKey(t,n.unknownKeyVals,hW.getEnumLength(cW.InputTypes)),n.unknownKeyVals||(n.unknownKeyVals=[]),n.unknownKeyVals.push(t),this}},{key:"addUnknownKeyValToOutput",value:function(e,t){var n=hW.checkForOutput(this.outputs,e);return hW.checkHasKey(t,n.unknownKeyVals,hW.getEnumLength(cW.OutputTypes)),n.unknownKeyVals||(n.unknownKeyVals=[]),n.unknownKeyVals.push(t),this}},{key:"addInput",value:function(e){var t=this;this.globalMap.unsignedTx.addInput(e),this.inputs.push({unknownKeyVals:[]});var n=e.unknownKeyVals||[],r=this.inputs.length-1;if(!Array.isArray(n))throw new Error("unknownKeyVals must be an Array");return n.forEach((function(e){return t.addUnknownKeyValToInput(r,e)})),hW.addInputAttributes(this.inputs,e),this}},{key:"addOutput",value:function(e){var t=this;this.globalMap.unsignedTx.addOutput(e),this.outputs.push({unknownKeyVals:[]});var n=e.unknownKeyVals||[],r=this.outputs.length-1;if(!Array.isArray(n))throw new Error("unknownKeyVals must be an Array");return n.forEach((function(e){return t.addUnknownKeyValToInput(r,e)})),hW.addOutputAttributes(this.outputs,e),this}},{key:"clearFinalizedInput",value:function(e){var t=hW.checkForInput(this.inputs,e);hW.inputCheckUncleanFinalized(e,t);for(var n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];["witnessUtxo","nonWitnessUtxo","finalScriptSig","finalScriptWitness","unknownKeyVals"].includes(i)||delete t[i]}return this}},{key:"combine",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=lW.combine([this].concat(t));return Object.assign(this,r),this}},{key:"getTransaction",value:function(){return this.globalMap.unsignedTx.toBuffer()}}],[{key:"fromBase64",value:function(e,t){var n=Xo.from(e,"base64");return this.fromBuffer(n,t)}},{key:"fromHex",value:function(e,t){var n=Xo.from(e,"hex");return this.fromBuffer(n,t)}},{key:"fromBuffer",value:function(e,t){var n=AW.psbtFromBuffer(e,t),r=new this(n.globalMap.unsignedTx);return Object.assign(r,n),r}}]),e}(),Object.defineProperty(bY,"__esModule",{value:!0}),bY.Psbt=void 0;var fW=IY,dW=nX,pW=uW,gW=Yq,vW=TJ,yW=Bz,mW=Wq,wW=$q,bW=XJ,IW={network:Xq.bitcoin,maximumFeeRate:5e3},BW=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new fW.Psbt(new CW);s(this,e),this.data=n,this.opts=Object.assign({},IW,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);var r=function(e,t,n,r){return Object.defineProperty(e,t,{enumerable:n,writable:r})};r(this,"__CACHE",!1,!0),r(this,"opts",!1,!0)}return l(e,[{key:"inputCount",get:function(){return this.data.inputs.length}},{key:"version",get:function(){return this.__CACHE.__TX.version},set:function(e){this.setVersion(e)}},{key:"locktime",get:function(){return this.__CACHE.__TX.locktime},set:function(e){this.setLocktime(e)}},{key:"txInputs",get:function(){return this.__CACHE.__TX.ins.map((function(e){return{hash:(0,vW.cloneBuffer)(e.hash),index:e.index,sequence:e.sequence}}))}},{key:"txOutputs",get:function(){var e=this;return this.__CACHE.__TX.outs.map((function(t){var n;try{n=(0,gW.fromOutputScript)(t.script,e.opts.network)}catch(t){}return{script:(0,vW.cloneBuffer)(t.script),value:t.value,address:n}}))}},{key:"combine",value:function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=this.data).combine.apply(e,k(n.map((function(e){return e.data})))),this}},{key:"clone",value:function(){var t=e.fromBuffer(this.data.toBuffer());return t.opts=JSON.parse(JSON.stringify(this.opts)),t}},{key:"setMaximumFeeRate",value:function(e){TW(e),this.opts.maximumFeeRate=e}},{key:"setVersion",value:function(e){TW(e),MW(this.data.inputs,"setVersion");var t=this.__CACHE;return t.__TX.version=e,t.__EXTRACTED_TX=void 0,this}},{key:"setLocktime",value:function(e){TW(e),MW(this.data.inputs,"setLocktime");var t=this.__CACHE;return t.__TX.locktime=e,t.__EXTRACTED_TX=void 0,this}},{key:"setInputSequence",value:function(e,t){TW(t),MW(this.data.inputs,"setInputSequence");var n=this.__CACHE;if(n.__TX.ins.length<=e)throw new Error("Input index too high");return n.__TX.ins[e].sequence=t,n.__EXTRACTED_TX=void 0,this}},{key:"addInputs",value:function(e){var t=this;return e.forEach((function(e){return t.addInput(e)})),this}},{key:"addInput",value:function(e){if(arguments.length>1||!e||void 0===e.hash||void 0===e.index)throw new Error("Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]");MW(this.data.inputs,"addInput"),e.witnessScript&&nZ(e.witnessScript);var t=this.__CACHE;this.data.addInput(e),OW(t,t.__TX.ins[t.__TX.ins.length-1]);var n=this.data.inputs.length-1,r=this.data.inputs[n];return r.nonWitnessUtxo&&XW(this.__CACHE,r,n),t.__FEE=void 0,t.__FEE_RATE=void 0,t.__EXTRACTED_TX=void 0,this}},{key:"addOutputs",value:function(e){var t=this;return e.forEach((function(e){return t.addOutput(e)})),this}},{key:"addOutput",value:function(e){if(arguments.length>1||!e||void 0===e.value||void 0===e.address&&void 0===e.script)throw new Error("Invalid arguments for Psbt.addOutput. Requires single object with at least [script or address] and [value]");MW(this.data.inputs,"addOutput");var t=e,n=t.address;if("string"==typeof n){var r=this.opts.network,i=(0,gW.toOutputScript)(n,r);e=Object.assign(e,{script:i})}var o=this.__CACHE;return this.data.addOutput(e),o.__FEE=void 0,o.__FEE_RATE=void 0,o.__EXTRACTED_TX=void 0,this}},{key:"extractTransaction",value:function(e){if(!this.data.inputs.every(SW))throw new Error("Not finalized");var t=this.__CACHE;if(e||function(e,t,n){var r=t.__FEE_RATE||e.getFeeRate(),i=t.__EXTRACTED_TX.virtualSize(),o=r*i;if(r>=n.maximumFeeRate)throw new Error("Warning: You are paying around ".concat((o/1e8).toFixed(8)," in fees, which is ").concat(r," satoshi per byte for a transaction with a VSize of ").concat(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,t,this.opts),t.__EXTRACTED_TX)return t.__EXTRACTED_TX;var n=t.__TX.clone();return WW(this.data.inputs,n,t,!0),n}},{key:"getFeeRate",value:function(){return GW("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}},{key:"getFee",value:function(){return GW("__FEE","fee",this.data.inputs,this.__CACHE)}},{key:"finalizeAllInputs",value:function(){var e=this;return(0,pW.checkForInput)(this.data.inputs,0),oZ(this.data.inputs.length).forEach((function(t){return e.finalizeInput(t)})),this}},{key:"finalizeInput",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:qW,n=(0,pW.checkForInput)(this.data.inputs,e),r=function(e,t,n){var r=n.__TX,i={script:null,isSegwit:!1,isP2SH:!1,isP2WSH:!1};if(i.isP2SH=!!t.redeemScript,i.isP2WSH=!!t.witnessScript,t.witnessScript)i.script=t.witnessScript;else if(t.redeemScript)i.script=t.redeemScript;else if(t.nonWitnessUtxo){var o=ZW(n,t,e),a=r.ins[e].index;i.script=o.outs[a].script}else t.witnessUtxo&&(i.script=t.witnessUtxo.script);return(t.witnessScript||FW(i.script))&&(i.isSegwit=!0),i}(e,n,this.__CACHE),i=r.script,o=r.isP2SH,a=r.isP2WSH,s=r.isSegwit;if(!i)throw new Error("No script found for input #".concat(e));!function(e){if(e.sighashType&&e.partialSig){var t=e.partialSig,n=e.sighashType;t.forEach((function(e){var t=wW.signature.decode(e.signature).hashType;if(n!==t)throw new Error("Signature sighash does not match input sighash type")}))}}(n);var u=t(e,n,i,s,o,a),l=u.finalScriptSig,A=u.finalScriptWitness;if(l&&this.data.updateInput(e,{finalScriptSig:l}),A&&this.data.updateInput(e,{finalScriptWitness:A}),!l&&!A)throw new Error("Unknown error finalizing input #".concat(e));return this.data.clearFinalizedInput(e),this}},{key:"getInputType",value:function(e){var t=(0,pW.checkForInput)(this.data.inputs,e),n=tZ($W(e,t,this.__CACHE),e,"input",t.redeemScript||function(e){if(e){var t=wW.decompile(e);if(t){var n,r=t[t.length-1];if(Da(r)&&!eZ(r)&&(n=r,!wW.isCanonicalScriptSignature(n)))if(wW.decompile(r))return r}}}(t.finalScriptSig),t.witnessScript||function(e){if(e){var t=YW(e),n=t[t.length-1];if(!eZ(n)&&wW.decompile(n))return n}}(t.finalScriptWitness));return("raw"===n.type?"":n.type+"-")+iZ(n.meaningfulScript)}},{key:"inputHasPubkey",value:function(e,t){return function(e,t,n,r){return rZ(e,tZ($W(n,t,r),n,"input",t.redeemScript,t.witnessScript).meaningfulScript)}(t,(0,pW.checkForInput)(this.data.inputs,e),e,this.__CACHE)}},{key:"inputHasHDKey",value:function(e,t){var n=(0,pW.checkForInput)(this.data.inputs,e),r=LW(t);return!!n.bip32Derivation&&n.bip32Derivation.some(r)}},{key:"outputHasPubkey",value:function(e,t){return function(e,t,n,r){return rZ(e,tZ(r.__TX.outs[n].script,n,"output",t.redeemScript,t.witnessScript).meaningfulScript)}(t,(0,pW.checkForOutput)(this.data.outputs,e),e,this.__CACHE)}},{key:"outputHasHDKey",value:function(e,t){var n=(0,pW.checkForOutput)(this.data.outputs,e),r=LW(t);return!!n.bip32Derivation&&n.bip32Derivation.some(r)}},{key:"validateSignaturesOfAllInputs",value:function(e){var t=this;return(0,pW.checkForInput)(this.data.inputs,0),oZ(this.data.inputs.length).map((function(n){return t.validateSignaturesOfInput(n,e)})).reduce((function(e,t){return!0===t&&e}),!0)}},{key:"validateSignaturesOfInput",value:function(e,t,n){var r=this.data.inputs[e],i=(r||{}).partialSig;if(!r||!i||i.length<1)throw new Error("No signatures to validate");if("function"!=typeof t)throw new Error("Need validator function to validate signatures");var o=n?i.filter((function(e){return e.pubkey.equals(n)})):i;if(o.length<1)throw new Error("No signatures for this pubkey");var a,s,u,l,A=[],c=F(o);try{for(c.s();!(l=c.n()).done;){var h=l.value,f=wW.signature.decode(h.signature),d=u!==f.hashType?zW(e,Object.assign({},r,{sighashType:f.hashType}),this.__CACHE,!0):{hash:a,script:s},p=d.hash,g=d.script;u=f.hashType,a=p,s=g,RW(h.pubkey,g,"verify"),A.push(t(h.pubkey,p,f.signature))}}catch(e){c.e(e)}finally{c.f()}return A.every((function(e){return!0===e}))}},{key:"signAllInputsHD",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[bW.Transaction.SIGHASH_ALL];if(!e||!e.publicKey||!e.fingerprint)throw new Error("Need HDSigner to sign input");var n,r=[],i=F(oZ(this.data.inputs.length));try{for(i.s();!(n=i.n()).done;){var o=n.value;try{this.signInputHD(o,e,t),r.push(!0)}catch(e){r.push(!1)}}}catch(e){i.e(e)}finally{i.f()}if(r.every((function(e){return!1===e})))throw new Error("No inputs were signed");return this}},{key:"signAllInputsHDAsync",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[bW.Transaction.SIGHASH_ALL];return new Promise((function(r,i){if(!e||!e.publicKey||!e.fingerprint)return i(new Error("Need HDSigner to sign input"));var o,a=[],s=[],u=F(oZ(t.data.inputs.length));try{for(u.s();!(o=u.n()).done;){var l=o.value;s.push(t.signInputHDAsync(l,e,n).then((function(){a.push(!0)}),(function(){a.push(!1)})))}}catch(e){u.e(e)}finally{u.f()}return Promise.all(s).then((function(){if(a.every((function(e){return!1===e})))return i(new Error("No inputs were signed"));r()}))}))}},{key:"signInputHD",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[bW.Transaction.SIGHASH_ALL];if(!t||!t.publicKey||!t.fingerprint)throw new Error("Need HDSigner to sign input");return JW(e,this.data.inputs,t).forEach((function(t){return n.signInput(e,t,r)})),this}},{key:"signInputHDAsync",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[bW.Transaction.SIGHASH_ALL];return new Promise((function(i,o){if(!t||!t.publicKey||!t.fingerprint)return o(new Error("Need HDSigner to sign input"));var a=JW(e,n.data.inputs,t).map((function(t){return n.signInputAsync(e,t,r)}));return Promise.all(a).then((function(){i()})).catch(o)}))}},{key:"signAllInputs",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[bW.Transaction.SIGHASH_ALL];if(!e||!e.publicKey)throw new Error("Need Signer to sign input");var n,r=[],i=F(oZ(this.data.inputs.length));try{for(i.s();!(n=i.n()).done;){var o=n.value;try{this.signInput(o,e,t),r.push(!0)}catch(e){r.push(!1)}}}catch(e){i.e(e)}finally{i.f()}if(r.every((function(e){return!1===e})))throw new Error("No inputs were signed");return this}},{key:"signAllInputsAsync",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[bW.Transaction.SIGHASH_ALL];return new Promise((function(r,i){if(!e||!e.publicKey)return i(new Error("Need Signer to sign input"));var o,a=[],s=[],u=F(t.data.inputs.entries());try{for(u.s();!(o=u.n()).done;){var l=C(o.value,1)[0];s.push(t.signInputAsync(l,e,n).then((function(){a.push(!0)}),(function(){a.push(!1)})))}}catch(e){u.e(e)}finally{u.f()}return Promise.all(s).then((function(){if(a.every((function(e){return!1===e})))return i(new Error("No inputs were signed"));r()}))}))}},{key:"signInput",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[bW.Transaction.SIGHASH_ALL];if(!t||!t.publicKey)throw new Error("Need Signer to sign input");var r=VW(this.data.inputs,e,t.publicKey,this.__CACHE,n),i=r.hash,o=r.sighashType,a=[{pubkey:t.publicKey,signature:wW.signature.encode(t.sign(i),o)}];return this.data.updateInput(e,{partialSig:a}),this}},{key:"signInputAsync",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[bW.Transaction.SIGHASH_ALL];return Promise.resolve().then((function(){if(!t||!t.publicKey)throw new Error("Need Signer to sign input");var i=VW(n.data.inputs,e,t.publicKey,n.__CACHE,r),o=i.hash,a=i.sighashType;return Promise.resolve(t.sign(o)).then((function(r){var i=[{pubkey:t.publicKey,signature:wW.signature.encode(r,a)}];n.data.updateInput(e,{partialSig:i})}))}))}},{key:"toBuffer",value:function(){return xW(this.__CACHE),this.data.toBuffer()}},{key:"toHex",value:function(){return xW(this.__CACHE),this.data.toHex()}},{key:"toBase64",value:function(){return xW(this.__CACHE),this.data.toBase64()}},{key:"updateGlobal",value:function(e){return this.data.updateGlobal(e),this}},{key:"updateInput",value:function(e,t){return t.witnessScript&&nZ(t.witnessScript),this.data.updateInput(e,t),t.nonWitnessUtxo&&XW(this.__CACHE,this.data.inputs[e],e),this}},{key:"updateOutput",value:function(e,t){return this.data.updateOutput(e,t),this}},{key:"addUnknownKeyValToGlobal",value:function(e){return this.data.addUnknownKeyValToGlobal(e),this}},{key:"addUnknownKeyValToInput",value:function(e,t){return this.data.addUnknownKeyValToInput(e,t),this}},{key:"addUnknownKeyValToOutput",value:function(e,t){return this.data.addUnknownKeyValToOutput(e,t),this}},{key:"clearFinalizedInput",value:function(e){return this.data.clearFinalizedInput(e),this}}],[{key:"fromBase64",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Xo.from(e,"base64");return this.fromBuffer(n,t)}},{key:"fromHex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Xo.from(e,"hex");return this.fromBuffer(n,t)}},{key:"fromBuffer",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=fW.Psbt.fromBuffer(t,EW),i=new e(n,r);return function(e,t){e.ins.forEach((function(e){OW(t,e)}))}(i.__CACHE.__TX,i.__CACHE),i}}]),e}();bY.Psbt=BW;var EW=function(e){return new CW(e)},CW=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Xo.from([2,0,0,0,0,0,0,0,0,0]);s(this,e),this.tx=bW.Transaction.fromBuffer(t),function(e){if(!e.ins.every((function(e){return e.script&&0===e.script.length&&e.witness&&0===e.witness.length})))throw new Error("Format Error: Transaction ScriptSigs are not empty")}(this.tx),Object.defineProperty(this,"tx",{enumerable:!1,writable:!0})}return l(e,[{key:"getInputOutputCounts",value:function(){return{inputCount:this.tx.ins.length,outputCount:this.tx.outs.length}}},{key:"addInput",value:function(e){if(void 0===e.hash||void 0===e.index||!Da(e.hash)&&"string"!=typeof e.hash||"number"!=typeof e.index)throw new Error("Error adding input.");var t="string"==typeof e.hash?(0,vW.reverseBuffer)(Xo.from(e.hash,"hex")):e.hash;this.tx.addInput(t,e.index,e.sequence)}},{key:"addOutput",value:function(e){if(void 0===e.script||void 0===e.value||!Da(e.script)||"number"!=typeof e.value)throw new Error("Error adding output.");this.tx.addOutput(e.script,e.value)}},{key:"toBuffer",value:function(){return this.tx.toBuffer()}}]),e}();function xW(e){if(!1!==e.__UNSAFE_SIGN_NONSEGWIT)throw new Error("Not BIP174 compliant, can not export")}function kW(e,t,n){if(!t)return!1;var r;if(r=n?n.map((function(e){var n=function(e){if(65===e.length){var t=1&e[64],n=e.slice(0,33);return n[0]=2|t,n}return e.slice()}(e);return t.find((function(e){return e.pubkey.equals(n)}))})).filter((function(e){return!!e})):t,r.length>e)throw new Error("Too many signatures");return r.length===e}function SW(e){return!!e.finalScriptSig||!!e.finalScriptWitness}function QW(e){return function(t){try{return e({output:t}),!0}catch(e){return!1}}}var _W=QW(mW.p2ms),NW=QW(mW.p2pk),DW=QW(mW.p2pkh),FW=QW(mW.p2wpkh),PW=QW(mW.p2wsh),UW=QW(mW.p2sh);function LW(e){return function(t){return!!t.masterFingerprint.equals(e.fingerprint)&&!!e.derivePath(t.path).publicKey.equals(t.pubkey)}}function TW(e){if("number"!=typeof e||e!==Math.floor(e)||e>4294967295||e<0)throw new Error("Invalid 32 bit integer")}function MW(e,t){e.forEach((function(e){var n=!1,r=[];if(0===(e.partialSig||[]).length){if(!e.finalScriptSig&&!e.finalScriptWitness)return;r=function(e){var t=e.finalScriptSig&&wW.decompile(e.finalScriptSig)||[],n=e.finalScriptWitness&&wW.decompile(e.finalScriptWitness)||[];return t.concat(n).filter((function(e){return Da(e)&&wW.isCanonicalScriptSignature(e)})).map((function(e){return{signature:e}}))}(e)}else r=e.partialSig;if(r.forEach((function(e){var r=wW.signature.decode(e.signature).hashType,i=[];switch(r&bW.Transaction.SIGHASH_ANYONECANPAY&&i.push("addInput"),31&r){case bW.Transaction.SIGHASH_ALL:break;case bW.Transaction.SIGHASH_SINGLE:case bW.Transaction.SIGHASH_NONE:i.push("addOutput"),i.push("setInputSequence")}-1===i.indexOf(t)&&(n=!0)})),n)throw new Error("Can not modify transaction, signatures exist.")}))}function RW(e,t,n){if(!rZ(e,t))throw new Error("Can not ".concat(n," for this input with the key ").concat(e.toString("hex")))}function OW(e,t){var n=(0,vW.reverseBuffer)(Xo.from(t.hash)).toString("hex")+":"+t.index;if(e.__TX_IN_CACHE[n])throw new Error("Duplicate input detected.");e.__TX_IN_CACHE[n]=1}function HW(e,t){return function(n,r,i,o){var a=e({redeem:{output:i}}).output;if(!r.equals(a))throw new Error("".concat(t," for ").concat(o," #").concat(n," doesn't match the scriptPubKey in the prevout"))}}var KW=HW(mW.p2sh,"Redeem script"),jW=HW(mW.p2wsh,"Witness script");function GW(e,t,n,r){if(!n.every(SW))throw new Error("PSBT must be finalized to calculate ".concat(t));if("__FEE_RATE"===e&&r.__FEE_RATE)return r.__FEE_RATE;if("__FEE"===e&&r.__FEE)return r.__FEE;var i,o=!0;return r.__EXTRACTED_TX?(i=r.__EXTRACTED_TX,o=!1):i=r.__TX.clone(),WW(n,i,r,o),"__FEE_RATE"===e?r.__FEE_RATE:"__FEE"===e?r.__FEE:void 0}function qW(e,t,n,r,i,o){var a=iZ(n);if(!function(e,t,n){switch(n){case"pubkey":case"pubkeyhash":case"witnesspubkeyhash":return kW(1,e.partialSig);case"multisig":var r=mW.p2ms({output:t});return kW(r.m,e.partialSig,r.pubkeys);default:return!1}}(t,n,a))throw new Error("Can not finalize input #".concat(e));return function(e,t,n,r,i,o){var a,s,u=function(e,t,n){var r;switch(t){case"multisig":var i=function(e,t){return mW.p2ms({output:e}).pubkeys.map((function(e){return(t.filter((function(t){return t.pubkey.equals(e)}))[0]||{}).signature})).filter((function(e){return!!e}))}(e,n);r=mW.p2ms({output:e,signatures:i});break;case"pubkey":r=mW.p2pk({output:e,signature:n[0].signature});break;case"pubkeyhash":r=mW.p2pkh({output:e,pubkey:n[0].pubkey,signature:n[0].signature});break;case"witnesspubkeyhash":r=mW.p2wpkh({output:e,pubkey:n[0].pubkey,signature:n[0].signature})}return r}(e,t,n),l=o?mW.p2wsh({redeem:u}):null,A=i?mW.p2sh({redeem:l||u}):null;return r?(s=function(e){var t,n=Xo.allocUnsafe(0);function r(e){var t=n.length,r=dW.encodingLength(e);n=Xo.concat([n,Xo.allocUnsafe(r)]),dW.encode(e,n,t)}function i(e){r(e.length),function(e){n=Xo.concat([n,Xo.from(e)])}(e)}return r((t=e).length),t.forEach(i),n}(l?l.witness:u.witness),A&&(a=A.input)):a=A?A.input:u.input,{finalScriptSig:a,finalScriptWitness:s}}(n,a,t.partialSig,r,i,o)}function VW(e,t,n,r,i){var o=zW(t,(0,pW.checkForInput)(e,t),r,!1,i),a=o.hash,s=o.sighashType;return RW(n,o.script,"sign"),{hash:a,sighashType:s}}function zW(e,t,n,r,i){var o,a,s=n.__TX,u=t.sighashType||bW.Transaction.SIGHASH_ALL;if(i&&i.indexOf(u)<0){var l=function(e){var t=e&bW.Transaction.SIGHASH_ANYONECANPAY?"SIGHASH_ANYONECANPAY | ":"";switch(31&e){case bW.Transaction.SIGHASH_ALL:t+="SIGHASH_ALL";break;case bW.Transaction.SIGHASH_SINGLE:t+="SIGHASH_SINGLE";break;case bW.Transaction.SIGHASH_NONE:t+="SIGHASH_NONE"}return t}(u);throw new Error("Sighash type is not allowed. Retry the sign method passing the sighashTypes array of whitelisted types. Sighash type: ".concat(l))}if(t.nonWitnessUtxo){var A=ZW(n,t,e),c=s.ins[e].hash,h=A.getHash();if(!c.equals(h))throw new Error("Non-witness UTXO hash for input #".concat(e," doesn't match the hash specified in the prevout"));var f=s.ins[e].index;a=A.outs[f]}else{if(!t.witnessUtxo)throw new Error("Need a Utxo input item for signing");a=t.witnessUtxo}var d=tZ(a.script,e,"input",t.redeemScript,t.witnessScript),p=d.meaningfulScript,g=d.type;if(["p2sh-p2wsh","p2wsh"].indexOf(g)>=0)o=s.hashForWitnessV0(e,p,a.value,u);else if(FW(p)){var v=mW.p2pkh({hash:p.slice(2)}).output;o=s.hashForWitnessV0(e,v,a.value,u)}else{if(void 0===t.nonWitnessUtxo&&!1===n.__UNSAFE_SIGN_NONSEGWIT)throw new Error("Input #".concat(e," has witnessUtxo but non-segwit script: ").concat(p.toString("hex")));r||!1===n.__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 Psbt's predecesor (TransactionBuilder - now removed) 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*********************"),o=s.hashForSignature(e,p,u)}return{script:p,sighashType:u,hash:o}}function JW(e,t,n){var r=(0,pW.checkForInput)(t,e);if(!r.bip32Derivation||0===r.bip32Derivation.length)throw new Error("Need bip32Derivation to sign with HD");var i=r.bip32Derivation.map((function(e){return e.masterFingerprint.equals(n.fingerprint)?e:void 0})).filter((function(e){return!!e}));if(0===i.length)throw new Error("Need one bip32Derivation masterFingerprint to match the HDSigner fingerprint");var o=i.map((function(e){var t=n.derivePath(e.path);if(!e.pubkey.equals(t.publicKey))throw new Error("pubkey did not match bip32Derivation");return t}));return o}function YW(e){var t=0;function n(){var n=dW.decode(e,t);return t+=dW.decode.bytes,n}function r(){return r=n(),t+=r,e.slice(t-r,t);var r}return function(){for(var e=n(),t=[],i=0;i<e;i++)t.push(r());return t}()}function XW(e,t,n){e.__NON_WITNESS_UTXO_BUF_CACHE[n]=t.nonWitnessUtxo;var r=bW.Transaction.fromBuffer(t.nonWitnessUtxo);e.__NON_WITNESS_UTXO_TX_CACHE[n]=r;var i=e,o=n;delete t.nonWitnessUtxo,Object.defineProperty(t,"nonWitnessUtxo",{enumerable:!0,get:function(){var e=i.__NON_WITNESS_UTXO_BUF_CACHE[o],t=i.__NON_WITNESS_UTXO_TX_CACHE[o];if(void 0!==e)return e;var n=t.toBuffer();return i.__NON_WITNESS_UTXO_BUF_CACHE[o]=n,n},set:function(e){i.__NON_WITNESS_UTXO_BUF_CACHE[o]=e}})}function WW(e,t,n,r){var i=0;e.forEach((function(e,o){if(r&&e.finalScriptSig&&(t.ins[o].script=e.finalScriptSig),r&&e.finalScriptWitness&&(t.ins[o].witness=YW(e.finalScriptWitness)),e.witnessUtxo)i+=e.witnessUtxo.value;else if(e.nonWitnessUtxo){var a=ZW(n,e,o),s=t.ins[o].index,u=a.outs[s];i+=u.value}}));var o=t.outs.reduce((function(e,t){return e+t.value}),0),a=i-o;if(a<0)throw new Error("Outputs are spending more than Inputs");var s=t.virtualSize();n.__FEE=a,n.__EXTRACTED_TX=t,n.__FEE_RATE=Math.floor(a/s)}function ZW(e,t,n){var r=e.__NON_WITNESS_UTXO_TX_CACHE;return r[n]||XW(e,t,n),r[n]}function $W(e,t,n){if(void 0!==t.witnessUtxo)return t.witnessUtxo.script;if(void 0!==t.nonWitnessUtxo)return ZW(n,t,e).outs[n.__TX.ins[e].index].script;throw new Error("Can't find pubkey in input without Utxo data")}function eZ(e){return 33===e.length&&wW.isCanonicalPubKey(e)}function tZ(e,t,n,r,i){var o,a=UW(e),s=a&&r&&PW(r),u=PW(e);if(a&&void 0===r)throw new Error("scriptPubkey is P2SH but redeemScript missing");if((u||s)&&void 0===i)throw new Error("scriptPubkey or redeemScript is P2WSH but witnessScript missing");return s?(o=i,KW(t,e,r,n),jW(t,r,i,n),nZ(o)):u?(o=i,jW(t,e,i,n),nZ(o)):a?(o=r,KW(t,e,r,n)):o=e,{meaningfulScript:o,type:s?"p2sh-p2wsh":a?"p2sh":u?"p2wsh":"raw"}}function nZ(e){if(FW(e)||UW(e))throw new Error("P2WPKH or P2SH can not be contained within P2WSH")}function rZ(e,t){var n=(0,yW.hash160)(e),r=wW.decompile(t);if(null===r)throw new Error("Unknown script error");return r.some((function(t){return"number"!=typeof t&&(t.equals(e)||t.equals(n))}))}function iZ(e){return FW(e)?"witnesspubkeyhash":DW(e)?"pubkeyhash":_W(e)?"multisig":NW(e)?"pubkey":"nonstandard"}function oZ(e){return k(Array(e).keys())}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Transaction=e.opcodes=e.Psbt=e.Block=e.script=e.payments=e.networks=e.crypto=e.address=void 0;var t=Yq;e.address=t;var n=Bz;e.crypto=n;var r=Xq;e.networks=r;var i=Wq;e.payments=i;var o=$q;e.script=o;var a=LJ;Object.defineProperty(e,"Block",{enumerable:!0,get:function(){return a.Block}});var s=bY;Object.defineProperty(e,"Psbt",{enumerable:!0,get:function(){return s.Psbt}});var u=tV;Object.defineProperty(e,"opcodes",{enumerable:!0,get:function(){return u.OPS}});var l=XJ;Object.defineProperty(e,"Transaction",{enumerable:!0,get:function(){return l.Transaction}})}(Jq);var aZ={exports:{}};function sZ(e,t){var n=function(e){for(var t=function(e){var t=IO.from(Object.assign(Object.assign({},e),{crv:"K-256"}),"jwk").toString("blk","public"),n=fx.publicKeyConvert(zq.from(t,"hex"),!0);return zq.from(n).toString("hex")}(e),n=zq.from(t,"hex"),r=32-n.length;r>0;)n=zq.concat([zq.from("00","hex"),n]),r--;return n}(e.publicKeyJwk),r=Gq("errors","identityErrorBaseMessage"),i="";switch(t.code){case Fl.Bitcoin:case Fl.Mocknet:case Fl.Testnet:i=function(e,t){return Jq.payments.p2pkh({pubkey:e,network:Jq.networks[t.code]}).address}(n,t);break;case Fl.Ethmain:case Fl.Ethropst:case Fl.Ethrinkeby:case Fl.Ethgoerli:case Fl.Ethsepolia:i=function(e,t){var n=e.toString("hex"),r=new EI.ec("secp256k1").keyFromPublic(n,"hex").getPublic().encode("hex").slice(2),i=Xo;return"0x".concat(aZ.exports.keccak256(i.from(r,"hex")).slice(24).toString())}(n);break;default:throw new Hq("deriveIssuingAddressFromPublicKey","".concat(r," - ").concat(Gq("errors","deriveIssuingAddressFromPublicKey")))}return i}function uZ(e){if(e){var t="string"==typeof e?e:e.code;return!!Object.keys(Ll).some((function(e){return e===t}))&&!!Ll[t].test}return!1}!function(e){!function(){var t="input is invalid type",n="object"==("undefined"==typeof window?"undefined":i(window)),r=n?window:{};r.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&"object"==("undefined"==typeof self?"undefined":i(self));!r.JS_SHA3_NO_NODE_JS&&"object"==i(AA)&&AA.versions&&AA.versions.node?r=Do:o&&(r=self);var a=!r.JS_SHA3_NO_COMMON_JS&&e.exports,s=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,u="0123456789abcdef".split(""),l=[4,1024,262144,67108864],A=[0,8,16,24],c=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],h=[224,256,384,512],f=[128,256],d=["hex","buffer","arrayBuffer","array","digest"],p={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!s||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==i(e)&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var g=function(e,t,n){return function(r){return new N(e,t,e).update(r)[n]()}},v=function(e,t,n){return function(r,i){return new N(e,t,i).update(r)[n]()}},y=function(e,t,n){return function(t,r,i,o){return B["cshake"+e].update(t,r,i,o)[n]()}},m=function(e,t,n){return function(t,r,i,o){return B["kmac"+e].update(t,r,i,o)[n]()}},w=function(e,t,n,r){for(var i=0;i<d.length;++i){var o=d[i];e[o]=t(n,r,o)}return e},b=function(e,t){var n=g(e,t,"hex");return n.create=function(){return new N(e,t,e)},n.update=function(e){return n.create().update(e)},w(n,g,e,t)},I=[{name:"keccak",padding:[1,256,65536,16777216],bits:h,createMethod:b},{name:"sha3",padding:[6,1536,393216,100663296],bits:h,createMethod:b},{name:"shake",padding:[31,7936,2031616,520093696],bits:f,createMethod:function(e,t){var n=v(e,t,"hex");return n.create=function(n){return new N(e,t,n)},n.update=function(e,t){return n.create(t).update(e)},w(n,v,e,t)}},{name:"cshake",padding:l,bits:f,createMethod:function(e,t){var n=p[e],r=y(e,0,"hex");return r.create=function(r,i,o){return i||o?new N(e,t,r).bytepad([i,o],n):B["shake"+e].create(r)},r.update=function(e,t,n,i){return r.create(t,n,i).update(e)},w(r,y,e,t)}},{name:"kmac",padding:l,bits:f,createMethod:function(e,t){var n=p[e],r=m(e,0,"hex");return r.create=function(r,i,o){return new D(e,t,i).bytepad(["KMAC",o],n).bytepad([r],n)},r.update=function(e,t,n,i){return r.create(e,n,i).update(t)},w(r,m,e,t)}}],B={},E=[],C=0;C<I.length;++C)for(var x=I[C],k=x.bits,S=0;S<k.length;++S){var Q=x.name+"_"+k[S];if(E.push(Q),B[Q]=x.createMethod(k[S],x.padding),"sha3"!==x.name){var _=x.name+k[S];E.push(_),B[_]=B[Q]}}function N(e,t,n){this.blocks=[],this.s=[],this.padding=t,this.outputBits=n,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function D(e,t,n){N.call(this,e,t,n)}N.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var n,r=i(e);if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(s&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||s&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}for(var o,a,u=this.blocks,l=this.byteCount,c=e.length,h=this.blockCount,f=0,d=this.s;f<c;){if(this.reset)for(this.reset=!1,u[0]=this.block,o=1;o<h+1;++o)u[o]=0;if(n)for(o=this.start;f<c&&o<l;++f)u[o>>2]|=e[f]<<A[3&o++];else for(o=this.start;f<c&&o<l;++f)(a=e.charCodeAt(f))<128?u[o>>2]|=a<<A[3&o++]:a<2048?(u[o>>2]|=(192|a>>6)<<A[3&o++],u[o>>2]|=(128|63&a)<<A[3&o++]):a<55296||a>=57344?(u[o>>2]|=(224|a>>12)<<A[3&o++],u[o>>2]|=(128|a>>6&63)<<A[3&o++],u[o>>2]|=(128|63&a)<<A[3&o++]):(a=65536+((1023&a)<<10|1023&e.charCodeAt(++f)),u[o>>2]|=(240|a>>18)<<A[3&o++],u[o>>2]|=(128|a>>12&63)<<A[3&o++],u[o>>2]|=(128|a>>6&63)<<A[3&o++],u[o>>2]|=(128|63&a)<<A[3&o++]);if(this.lastByteIndex=o,o>=l){for(this.start=o-l,this.block=u[h],o=0;o<h;++o)d[o]^=u[o];F(d),this.reset=!0}else this.start=o}return this},N.prototype.encode=function(e,t){var n=255&e,r=1,i=[n];for(n=255&(e>>=8);n>0;)i.unshift(n),n=255&(e>>=8),++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},N.prototype.encodeString=function(e){var n,r=i(e);if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(s&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||s&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}var o=0,a=e.length;if(n)o=a;else for(var u=0;u<e.length;++u){var l=e.charCodeAt(u);l<128?o+=1:l<2048?o+=2:l<55296||l>=57344?o+=3:(l=65536+((1023&l)<<10|1023&e.charCodeAt(++u)),o+=4)}return o+=this.encode(8*o),this.update(e),o},N.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r<e.length;++r)n+=this.encodeString(e[r]);var i=t-n%t,o=[];return o.length=i,this.update(o),this},N.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,n=this.blockCount,r=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t<n+1;++t)e[t]=0;for(e[n-1]|=2147483648,t=0;t<n;++t)r[t]^=e[t];F(r)}},N.prototype.toString=N.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s="";a<r;){for(o=0;o<t&&a<r;++o,++a)e=n[o],s+=u[e>>4&15]+u[15&e]+u[e>>12&15]+u[e>>8&15]+u[e>>20&15]+u[e>>16&15]+u[e>>28&15]+u[e>>24&15];a%t==0&&(F(n),o=0)}return i&&(e=n[o],s+=u[e>>4&15]+u[15&e],i>1&&(s+=u[e>>12&15]+u[e>>8&15]),i>2&&(s+=u[e>>20&15]+u[e>>16&15])),s},N.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(e);a<r;){for(o=0;o<t&&a<r;++o,++a)u[a]=n[o];a%t==0&&F(n)}return i&&(u[o]=n[o],e=e.slice(0,s)),e},N.prototype.buffer=N.prototype.arrayBuffer,N.prototype.digest=N.prototype.array=function(){this.finalize();for(var e,t,n=this.blockCount,r=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];s<i;){for(a=0;a<n&&s<i;++a,++s)e=s<<2,t=r[a],u[e]=255&t,u[e+1]=t>>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;s%n==0&&F(r)}return o&&(e=s<<2,t=r[a],u[e]=255&t,o>1&&(u[e+1]=t>>8&255),o>2&&(u[e+2]=t>>16&255)),u},D.prototype=new N,D.prototype.finalize=function(){return this.encode(this.outputBits,!0),N.prototype.finalize.call(this)};var F=function(e){var t,n,r,i,o,a,s,u,l,A,h,f,d,p,g,v,y,m,w,b,I,B,E,C,x,k,S,Q,_,N,D,F,P,U,L,T,M,R,O,H,K,j,G,q,V,z,J,Y,X,W,Z,$,ee,te,ne,re,ie,oe,ae,se,ue,le,Ae;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],l=e[5]^e[15]^e[25]^e[35]^e[45],A=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(f=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),n=(d=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(u<<1|l>>>31),n=o^(l<<1|u>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=a^(A<<1|h>>>31),n=s^(h<<1|A>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=u^(f<<1|d>>>31),n=l^(d<<1|f>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=A^(i<<1|o>>>31),n=h^(o<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,p=e[0],g=e[1],z=e[11]<<4|e[10]>>>28,J=e[10]<<4|e[11]>>>28,Q=e[20]<<3|e[21]>>>29,_=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ue=e[30]<<9|e[31]>>>23,j=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,U=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,v=e[13]<<12|e[12]>>>20,y=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,X=e[23]<<10|e[22]>>>22,N=e[33]<<13|e[32]>>>19,D=e[32]<<13|e[33]>>>19,le=e[42]<<2|e[43]>>>30,Ae=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,T=e[14]<<6|e[15]>>>26,M=e[15]<<6|e[14]>>>26,m=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,W=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,F=e[45]<<29|e[44]>>>3,P=e[44]<<29|e[45]>>>3,C=e[6]<<28|e[7]>>>4,x=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,R=e[26]<<25|e[27]>>>7,O=e[27]<<25|e[26]>>>7,b=e[36]<<21|e[37]>>>11,I=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,q=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,k=e[18]<<20|e[19]>>>12,S=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ae=e[28]<<7|e[29]>>>25,H=e[38]<<8|e[39]>>>24,K=e[39]<<8|e[38]>>>24,B=e[48]<<14|e[49]>>>18,E=e[49]<<14|e[48]>>>18,e[0]=p^~v&m,e[1]=g^~y&w,e[10]=C^~k&Q,e[11]=x^~S&_,e[20]=U^~T&R,e[21]=L^~M&O,e[30]=q^~z&Y,e[31]=V^~J&X,e[40]=te^~re&oe,e[41]=ne^~ie&ae,e[2]=v^~m&b,e[3]=y^~w&I,e[12]=k^~Q&N,e[13]=S^~_&D,e[22]=T^~R&H,e[23]=M^~O&K,e[32]=z^~Y&W,e[33]=J^~X&Z,e[42]=re^~oe&se,e[43]=ie^~ae&ue,e[4]=m^~b&B,e[5]=w^~I&E,e[14]=Q^~N&F,e[15]=_^~D&P,e[24]=R^~H&j,e[25]=O^~K&G,e[34]=Y^~W&$,e[35]=X^~Z&ee,e[44]=oe^~se&le,e[45]=ae^~ue&Ae,e[6]=b^~B&p,e[7]=I^~E&g,e[16]=N^~F&C,e[17]=D^~P&x,e[26]=H^~j&U,e[27]=K^~G&L,e[36]=W^~$&q,e[37]=Z^~ee&V,e[46]=se^~le&te,e[47]=ue^~Ae&ne,e[8]=B^~p&v,e[9]=E^~g&y,e[18]=F^~C&k,e[19]=P^~x&S,e[28]=j^~U&T,e[29]=G^~L&M,e[38]=$^~q&z,e[39]=ee^~V&J,e[48]=le^~te&re,e[49]=Ae^~ne&ie,e[0]^=c[r],e[1]^=c[r+1]};if(a)e.exports=B;else for(C=0;C<E.length;++C)r[E[C]]=B[E[C]]}()}(aZ);var lZ,AZ,cZ=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}u((r=r.apply(e,t||[])).next())}))},hZ=function(e){c(n,e);var t=b(n);function n(e){var r,i=e.issuer,o=void 0===i?null:i,a=e.verificationMethod,u=void 0===a?null:a,l=e.document,A=void 0===l?null:l,c=e.proof,h=void 0===c?null:c,f=e.options,d=void 0===f?{}:f;if(s(this,n),(r=t.call(this,{type:"MerkleProof2019"})).type="MerkleProof2019",r.issuer=null,r.verificationMethod=null,r.proof=null,r.proofValue=null,r.document=null,r.explorerAPIs=[],r.documentLoader=null,r.proofVerificationProcess=["getTransactionId","computeLocalHash","fetchRemoteHash","compareHashes","checkMerkleRoot","checkReceipt"],r.identityVerificationProcess=["deriveIssuingAddressFromPublicKey","compareIssuingAddress"],r.transactionId="",!A)throw new Error("A document signed by MerkleProof2019 is required for the verification process.");return r.issuer=o,r.verificationMethod=u,r.document=A,r.setProof(h),r.setOptions(d),r.getChain(),uZ(r.chain)&&(r.adaptProofVerificationProcessToMocknet(),r.adaptIdentityVerificationProcessToMocknet()),w(r)}return l(n,[{key:"setProof",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=null!=e?e:this.document.proof;if(!t)throw new Error("The passed document is not signed.");this.proof=t,this.proofValue=n.decodeMerkleProof2019(this.proof)}},{key:"verifyProof",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{documentLoader:function(e){},verifyIdentity:!0},t=e.documentLoader,n=e.verifyIdentity;return cZ(this,void 0,void 0,r().mark((function e(){var i,o;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.documentLoader=t,o="",e.prev=2,e.next=5,this.verifyProcess(this.proofVerificationProcess);case 5:if(e.t0=n,!e.t0){e.next=9;break}return e.next=9,this.verifyIdentity();case 9:i=!0,e.next=15;break;case 12:e.prev=12,e.t1=e.catch(2),console.error(e.t1),i=!1,o=e.t1.message;case 15:return e.abrupt("return",{verificationMethod:this.verificationMethod,verified:i,error:o});case 16:case"end":return e.stop()}}),e,this,[[2,12]])})))}},{key:"verifyIdentity",value:function(){return cZ(this,void 0,void 0,r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==this.verificationMethod){e.next=9;break}return e.prev=1,e.next=4,this.verifyProcess(this.identityVerificationProcess);case 4:e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(1),new Error(e.t0);case 9:case"end":return e.stop()}}),e,this,[[1,6]])})))}},{key:"getProofVerificationProcess",value:function(){return this.proofVerificationProcess}},{key:"getIdentityVerificationProcess",value:function(){return this.identityVerificationProcess}},{key:"getIssuerPublicKey",value:function(){var e,t;return uZ(this.chain)?"This mock chain does not support issuing addresses":null!==(t=null===(e=this.getTxData())||void 0===e?void 0:e.issuingAddress)&&void 0!==t?t:""}},{key:"getIssuanceTime",value:function(){var e,t;return null!==(t=null===(e=this.getTxData())||void 0===e?void 0:e.time)&&void 0!==t?t:""}},{key:"getChain",value:function(){return this.chain||(this.chain=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(null==e?void 0:e.anchors){var t=e.anchors[0];if("string"==typeof t)return function(e){var t,n=e.split(":");switch(n[1]){case Ll.mocknet.blinkCode:return Uq(Ll.mocknet.signatureValue);case Ll.bitcoin.blinkCode:t=Ll.bitcoin.name;break;case Ll.ethmain.blinkCode:t=Ll.ethmain.name;break;default:throw new Error("Could not retrieve chain.")}var r=n[2],i=t.toLowerCase()+function(e){var t=e.substr(0,1),n=e.substr(1,e.length-1);return t.toUpperCase()+n.toLowerCase()}(r);return Uq(i)}(t)}return null}(this.proofValue)),this.chain}},{key:"getTxData",value:function(){return this.txData?this.txData:(console.error("Trying to access issuing address when txData not available yet. Did you run the `verify` method yet?"),null)}},{key:"adaptProofVerificationProcessToMocknet",value:function(){Lq(this.proofVerificationProcess,"getTransactionId"),Lq(this.proofVerificationProcess,"fetchRemoteHash"),Lq(this.proofVerificationProcess,"checkMerkleRoot")}},{key:"adaptIdentityVerificationProcessToMocknet",value:function(){this.identityVerificationProcess=[]}},{key:"setOptions",value:function(e){var t;this.explorerAPIs=null!==(t=e.explorerAPIs)&&void 0!==t?t:[],e.executeStepMethod&&"function"==typeof e.executeStepMethod&&(this.executeStep=e.executeStepMethod)}},{key:"executeStep",value:function(e,t){return cZ(this,void 0,void 0,r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))}},{key:"verifyProcess",value:function(e){return cZ(this,void 0,void 0,r().mark((function t(){var n,i,o;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=F(e),t.prev=1,n.s();case 3:if((i=n.n()).done){t.next=11;break}if(this[o=i.value]){t.next=7;break}return t.abrupt("return",void console.error("verification logic for",o,"not implemented"));case 7:return t.next=9,this[o]();case 9:t.next=3;break;case 11:t.next=16;break;case 13:t.prev=13,t.t0=t.catch(1),n.e(t.t0);case 16:return t.prev=16,n.f(),t.finish(16);case 19:case"end":return t.stop()}}),t,this,[[1,13,16,19]])})))}},{key:"checkMerkleRoot",value:function(){return cZ(this,void 0,void 0,r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep("checkMerkleRoot",(function(){return function(e,t){if(e!==t)throw new Hq("checkMerkleRoot",Gq("errors","ensureMerkleRootEqual"));return!0}(t.proofValue.merkleRoot,t.txData.remoteHash)}),this.type);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"compareHashes",value:function(){return cZ(this,void 0,void 0,r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep("compareHashes",(function(){return function(e,t){if(e!==t)throw new Hq("compareHashes",Gq("errors","ensureHashesEqual"));return!0}(t.localDocumentHash,t.proofValue.targetHash)}),this.type);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"computeLocalHash",value:function(){return cZ(this,void 0,void 0,r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep("computeLocalHash",(function(){return cZ(t,void 0,void 0,r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Vq(this.document,this.proof,this.documentLoader);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}),this.type);case 2:this.localDocumentHash=e.sent;case 3:case"end":return e.stop()}}),e,this)})))}},{key:"checkReceipt",value:function(){return cZ(this,void 0,void 0,r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep("checkReceipt",(function(){return function(e){var t=e.targetHash,n=e.merkleRoot;try{var r=e.path;if(r&&t)for(var i in r){var o=r[i],a=void 0;if(void 0!==o.left)a=Oq("".concat(o.left).concat(t)),t=qO(a);else{if(void 0===o.right)throw new Hq("checkReceipt","Trigger catch error.");a=Oq("".concat(t).concat(o.right)),t=qO(a)}}}catch(e){throw new Hq("checkReceipt",Gq("errors","ensureValidReceipt"))}if(t!==n)throw new Hq("checkReceipt",Gq("errors","invalidMerkleReceipt"))}(t.proofValue)}),this.type);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getTransactionId",value:function(){return cZ(this,void 0,void 0,r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.transactionId=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!e)throw new Error("DecodedProof is not set");var t=e.anchors,n=t[0];if("string"==typeof n)return n.split(":").pop();throw new Error("Could not retrieve transaction id as was provided an unexpected format")}(this.proofValue),e.next=3,this.executeStep("getTransactionId",(function(){return function(e){if("string"==typeof e&&e.length>0)return e;throw new Hq("getTransactionId",Gq("errors","isTransactionIdValid"))}(t.transactionId)}),this.type);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"fetchRemoteHash",value:function(){return cZ(this,void 0,void 0,r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep("fetchRemoteHash",(function(){return cZ(t,void 0,void 0,r().mark((function e(){var t;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Pf({transactionId:this.transactionId,chain:null===(t=this.chain)||void 0===t?void 0:t.code,explorerAPIs:this.explorerAPIs});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}),this.type);case 2:this.txData=e.sent;case 3:case"end":return e.stop()}}),e,this)})))}},{key:"deriveIssuingAddressFromPublicKey",value:function(){return cZ(this,void 0,void 0,r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep("deriveIssuingAddressFromPublicKey",(function(){return sZ(t.verificationMethod,t.chain)}),this.type);case 2:this.derivedIssuingAddress=e.sent;case 3:case"end":return e.stop()}}),e,this)})))}},{key:"compareIssuingAddress",value:function(){return cZ(this,void 0,void 0,r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep("compareIssuingAddress",(function(){return function(e,t){var n=Gq("errors","identityErrorBaseMessage");if(e!==t)throw new Hq("compareIssuingAddress","".concat(n," - ").concat(Gq("errors","compareIssuingAddress")))}(t.getIssuerPublicKey(),t.derivedIssuingAddress)}),this.type);case 2:case"end":return e.stop()}}),e,this)})))}}],[{key:"decodeMerkleProof2019",value:function(e){return new Pq.Decoder(e.proofValue).decode()}}]),n}(IN.suites.LinkedDataProof);function fZ(e){return Array.isArray(e)?e.find((function(e){return"ChainedProof2021"!==e.type})).verificationMethod:e.verificationMethod}!function(e){e.getTransactionId="getTransactionId",e.computeLocalHash="computeLocalHash",e.fetchRemoteHash="fetchRemoteHash",e.parseIssuerKeys="parseIssuerKeys",e.compareHashes="compareHashes",e.checkImagesIntegrity="checkImagesIntegrity",e.checkMerkleRoot="checkMerkleRoot",e.checkReceipt="checkReceipt",e.retrieveVerificationMethodPublicKey="retrieveVerificationMethodPublicKey",e.deriveIssuingAddressFromPublicKey="deriveIssuingAddressFromPublicKey",e.compareIssuingAddress="compareIssuingAddress",e.checkAuthenticity="checkAuthenticity"}(lZ||(lZ={}));var dZ=function(e){c(v,e);var t,n,i,o,u,h,f,d,p,g=b(v);function v(e){var t,n;return s(this,v),A(m(t=g.call(this,e)),"proofVerificationProcess",[lZ.parseIssuerKeys,lZ.checkAuthenticity]),A(m(t),"transactionId",void 0),A(m(t),"localHash",void 0),A(m(t),"documentToVerify",void 0),A(m(t),"txData",void 0),A(m(t),"chain",void 0),A(m(t),"explorerAPIs",void 0),A(m(t),"receipt",void 0),A(m(t),"issuerPublicKeyList",void 0),A(m(t),"issuer",void 0),A(m(t),"verificationMethodPublicKey",void 0),A(m(t),"derivedIssuingAddress",void 0),A(m(t),"hasDid",void 0),A(m(t),"proof",void 0),A(m(t),"type","MerkleProof2019"),A(m(t),"suite",void 0),t.executeStep=e.executeStep,t.documentToVerify=e.document,t.explorerAPIs=e.explorerAPIs,t.proof=e.proof,t.issuer=e.issuer,t.validateProofType(),t.receipt=(n=t.proof,hZ.decodeMerkleProof2019(n)),t.transactionId=tk.certificates.getTransactionId(t.receipt),t.setHasDid(),t}return l(v,[{key:"init",value:(p=a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setVerificationSuite();case 2:this.chain=this.suite.getChain(),this.adaptVerificationProcessToChain();case 4:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"verifyProof",value:(d=a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.suite.verifyProof({verifyIdentity:!1});case 2:return e.next=4,this.verifyProcess(this.proofVerificationProcess);case 4:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"verifyIdentity",value:(f=a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.suite.verifyIdentity();case 2:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"getProofVerificationSteps",value:function(e){return[].concat(k(this.suite.getProofVerificationProcess()),k(this.proofVerificationProcess)).map((function(t){return tk.verifier.convertToVerificationSubsteps(e,t)}))}},{key:"getIdentityVerificationSteps",value:function(e){return this.hasDid?this.suite.getIdentityVerificationProcess().map((function(t){return tk.verifier.convertToVerificationSubsteps(e,t)})):[]}},{key:"getIssuerPublicKey",value:function(){return this.suite.getIssuerPublicKey()}},{key:"getIssuanceTime",value:function(){return this.suite.getIssuanceTime()}},{key:"getIssuerName",value:function(){return this.issuer.name}},{key:"getIssuerProfileDomain",value:function(){var e;return null===(e=new URL(this.getIssuerProfileUrl()))||void 0===e?void 0:e.hostname}},{key:"getIssuerProfileUrl",value:function(){return this.issuer.id}},{key:"getSigningDate",value:function(){return this.proof.created}},{key:"getChain",value:function(){return this.suite.getChain()}},{key:"getReceipt",value:function(){return this.receipt}},{key:"getTransactionIdString",value:function(){return tk.certificates.getTransactionId(this.getReceipt())}},{key:"getTransactionLink",value:function(){return tk.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).transactionLink}},{key:"getRawTransactionLink",value:function(){return tk.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).rawTransactionLink}},{key:"executeStep",value:(h=a(r().mark((function e(t,n,i){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("executeStep method needs to be overwritten by injecting from Verifier");case 1:case"end":return e.stop()}}),e)}))),function(e,t,n){return h.apply(this,arguments)})},{key:"setVerificationSuite",value:(u=a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setIssuerFromProofVerificationMethod();case 2:this.verificationMethodPublicKey=ZO(this.getTargetVerificationMethodContainer(),fZ(this.proof)),this.suite=new hZ({document:this.documentToVerify,proof:this.proof,verificationMethod:this.verificationMethodPublicKey,options:{explorerAPIs:this.explorerAPIs,executeStepMethod:this.executeStep}});case 4:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"adaptVerificationProcessToChain",value:function(){tk.chains.isMockChain(this.chain)&&(rd(this.proofVerificationProcess,lZ.parseIssuerKeys),rd(this.proofVerificationProcess,lZ.checkAuthenticity))}},{key:"getTargetVerificationMethodContainer",value:function(){var e;return null!==(e=this.issuer.didDocument)&&void 0!==e?e:this.issuer}},{key:"isProofChain",value:function(){return"ChainedProof2021"===this.proof.type}},{key:"setIssuerFromProofVerificationMethod",value:(o=a(r().mark((function e(){var t;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isProofChain()){e.next=5;break}return t=this.proof.verificationMethod.split("#")[0],e.next=4,tk.verifier.getIssuerProfile(t);case 4:this.issuer=e.sent;case 5:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"setHasDid",value:function(){if(this.isProofChain()){var e=this.proof.verificationMethod.split("#")[0];this.hasDid=Ad(e)}else this.hasDid=!!this.issuer.didDocument}},{key:"validateProofType",value:function(){var e=this.isProofChain()?this.proof.chainedProofType:this.proof.type;if(e!==this.type)throw new Error("Incompatible proof type passed. Expected: ".concat(this.type,", Got: ").concat(e))}},{key:"verifyProcess",value:(i=a(r().mark((function e(t){var n,i,o;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=F(t),e.prev=1,n.s();case 3:if((i=n.n()).done){e.next=11;break}if(this[o=i.value]){e.next=7;break}return e.abrupt("return",void console.error("verification logic for",o,"not implemented"));case 7:return e.next=9,this[o]();case 9:e.next=3;break;case 11:e.next=16;break;case 13:e.prev=13,e.t0=e.catch(1),n.e(e.t0);case 16:return e.prev=16,n.f(),e.finish(16);case 19:case"end":return e.stop()}}),e,this,[[1,13,16,19]])}))),function(e){return i.apply(this,arguments)})},{key:"parseIssuerKeys",value:(n=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(lZ.parseIssuerKeys,(function(){return tk.verifier.parseIssuerKeys(t.issuer)}),this.type);case 2:this.issuerPublicKeyList=e.sent;case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"checkAuthenticity",value:(t=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(lZ.checkAuthenticity,(function(){return XO(t.issuerPublicKeyList,t.getIssuerPublicKey(),t.getIssuanceTime())}),this.type);case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),v}(wF);!function(e){e.getTransactionId="getTransactionId",e.computeLocalHash="computeLocalHash",e.fetchRemoteHash="fetchRemoteHash",e.parseIssuerKeys="parseIssuerKeys",e.compareHashes="compareHashes",e.checkMerkleRoot="checkMerkleRoot",e.checkReceipt="checkReceipt",e.checkAuthenticity="checkAuthenticity"}(AZ||(AZ={}));var pZ=function(e){c(I,e);var t,n,i,o,u,h,f,d,p,g,v,y,w=b(I);function I(e){var t;return s(this,I),A(m(t=w.call(this,e)),"verificationProcess",[AZ.getTransactionId,AZ.computeLocalHash,AZ.fetchRemoteHash,AZ.compareHashes,AZ.checkMerkleRoot,AZ.checkReceipt,AZ.parseIssuerKeys,AZ.checkAuthenticity]),A(m(t),"transactionId",void 0),A(m(t),"localHash",void 0),A(m(t),"documentToVerify",void 0),A(m(t),"txData",void 0),A(m(t),"chain",void 0),A(m(t),"explorerAPIs",void 0),A(m(t),"receipt",void 0),A(m(t),"issuerPublicKeyList",void 0),A(m(t),"issuer",void 0),A(m(t),"proof",void 0),A(m(t),"type","MerkleProof2017"),e.executeStep&&(t.executeStep=e.executeStep),t.documentToVerify=e.document,t.explorerAPIs=e.explorerAPIs,t.issuer=e.issuer,t.proof=e.proof,t.validateProofType(),t.receipt=t.documentToVerify.signature,t.chain=tk.certificates.getChain("",t.receipt),t.transactionId=tk.certificates.getTransactionId(t.receipt),t.adaptVerificationProcessToChain(),t}return l(I,[{key:"init",value:(y=a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(){return y.apply(this,arguments)})},{key:"verifyProof",value:(v=a(r().mark((function e(){var t,n,i;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=F(this.verificationProcess),e.prev=1,t.s();case 3:if((n=t.n()).done){e.next=11;break}if(this[i=n.value]){e.next=7;break}return e.abrupt("return",void console.error("verification logic for",i,"not implemented"));case 7:return e.next=9,this[i]();case 9:e.next=3;break;case 11:e.next=16;break;case 13:e.prev=13,e.t0=e.catch(1),t.e(e.t0);case 16:return e.prev=16,t.f(),e.finish(16);case 19:case"end":return e.stop()}}),e,this,[[1,13,16,19]])}))),function(){return v.apply(this,arguments)})},{key:"verifyIdentity",value:(g=a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(){return g.apply(this,arguments)})},{key:"getProofVerificationSteps",value:function(e){return this.verificationProcess.map((function(t){return tk.verifier.convertToVerificationSubsteps(e,t)}))}},{key:"getIdentityVerificationSteps",value:function(){return[]}},{key:"getIssuerPublicKey",value:function(){return tk.chains.isMockChain(this.chain)?"This mock chain does not support issuing addresses":this.txData?this.txData.issuingAddress:void console.error("Trying to access issuing address when txData not available yet. Did you run the `verify` method yet?")}},{key:"getIssuerName",value:function(){return this.issuer.name}},{key:"getIssuerProfileDomain",value:function(){var e;return null===(e=new URL(this.getIssuerProfileUrl()))||void 0===e?void 0:e.hostname}},{key:"getIssuerProfileUrl",value:function(){return this.issuer.id}},{key:"getSigningDate",value:function(){return this.documentToVerify.issuedOn}},{key:"getChain",value:function(){return this.chain}},{key:"getReceipt",value:function(){return this.receipt}},{key:"getTransactionIdString",value:function(){return tk.certificates.getTransactionId(this.getReceipt())}},{key:"getTransactionLink",value:function(){return tk.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).transactionLink}},{key:"getRawTransactionLink",value:function(){return tk.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).rawTransactionLink}},{key:"validateProofType",value:function(){if(this.proof.type[0]!==this.type)throw new Error("Incompatible proof type passed. Expected: ".concat(this.type,", Got: ").concat(this.proof.type[0]))}},{key:"adaptVerificationProcessToChain",value:function(){tk.chains.isMockChain(this.chain)&&(rd(this.verificationProcess,AZ.getTransactionId),rd(this.verificationProcess,AZ.fetchRemoteHash),rd(this.verificationProcess,AZ.parseIssuerKeys),rd(this.verificationProcess,AZ.checkMerkleRoot),rd(this.verificationProcess,AZ.checkAuthenticity))}},{key:"executeStep",value:(p=a(r().mark((function e(t,n,i){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("doAction method needs to be overwritten by injecting from CVJS");case 1:case"end":return e.stop()}}),e)}))),function(e,t,n){return p.apply(this,arguments)})},{key:"getTransactionId",value:(d=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(AZ.getTransactionId,(function(){return function(e){if("string"==typeof e&&e.length>0)return e;throw new ed("getTransactionId",Jf("errors","isTransactionIdValid"))}(t.transactionId)}),this.type);case 2:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"computeLocalHash",value:(f=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(AZ.computeLocalHash,a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,JO(t.documentToVerify);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),this.type);case 2:this.localHash=e.sent;case 3:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"fetchRemoteHash",value:(h=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(AZ.fetchRemoteHash,a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,tk.verifier.lookForTx({transactionId:t.transactionId,chain:t.chain.code,explorerAPIs:t.explorerAPIs});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),this.type);case 2:this.txData=e.sent;case 3:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"compareHashes",value:(u=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(AZ.compareHashes,(function(){return function(e,t){if(e!==t)throw new ed("compareHashes",Jf("errors","ensureHashesEqual"));return!0}(t.localHash,t.receipt.targetHash)}),this.type);case 2:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"checkMerkleRoot",value:(o=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(AZ.checkMerkleRoot,(function(){return function(e,t){if(e!==t)throw new ed("checkMerkleRoot",Jf("errors","ensureMerkleRootEqual"));return!0}(t.receipt.merkleRoot,t.txData.remoteHash)}),this.type);case 2:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"checkReceipt",value:(i=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(AZ.checkReceipt,(function(){return function(e){var t=e.targetHash,n=e.merkleRoot;try{var r=e.proof||e.path;if(r)for(var i in r){var o=r[i],a=void 0;if(void 0!==o.left)a=VO("".concat(o.left).concat(t)),t=qO(a);else{if(void 0===o.right)throw new ed("checkReceipt","Trigger catch error.");a=VO("".concat(t).concat(o.right)),t=qO(a)}}}catch(e){throw new ed("checkReceipt",Jf("errors","ensureValidReceipt"))}if(t!==n)throw new ed("checkReceipt",Jf("errors","invalidMerkleReceipt"))}(t.receipt)}),this.type);case 2:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"parseIssuerKeys",value:(n=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(AZ.parseIssuerKeys,(function(){return tk.verifier.parseIssuerKeys(t.issuer)}),this.type);case 2:this.issuerPublicKeyList=e.sent;case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"checkAuthenticity",value:(t=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(AZ.checkAuthenticity,(function(){return XO(t.issuerPublicKeyList,t.txData.issuingAddress,t.txData.time)}),this.type);case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),I}(wF),gZ=dk("Verifier"),vZ=function(){function e(t){var n=t.certificateJson,r=t.expires,i=t.hashlinkVerifier,o=t.id,a=t.issuer,u=t.revocationKey,l=t.explorerAPIs;s(this,e),A(this,"expires",void 0),A(this,"id",void 0),A(this,"issuer",void 0),A(this,"revocationKey",void 0),A(this,"documentToVerify",void 0),A(this,"explorerAPIs",void 0),A(this,"txData",void 0),A(this,"_stepsStatuses",[]),A(this,"hashlinkVerifier",void 0),A(this,"verificationSteps",void 0),A(this,"supportedVerificationSuites",void 0),A(this,"proofVerifiers",[]),A(this,"verificationProcess",void 0),A(this,"proofMap",void 0),this.expires=r,this.id=o,this.issuer=a,this.hashlinkVerifier=i,this.revocationKey=u,this.explorerAPIs=l,this.documentToVerify=Object.assign({},n)}var t,i,o,u,c,h,f;return l(e,[{key:"getVerificationSteps",value:function(){return this.verificationSteps}},{key:"getSignersData",value:function(){return this.proofVerifiers.map((function(e){var t,n,r,i;return{signingDate:e.getSigningDate(),signatureSuiteType:e.type,issuerPublicKey:e.getIssuerPublicKey(),issuerName:e.getIssuerName(),issuerProfileDomain:e.getIssuerProfileDomain(),issuerProfileUrl:e.getIssuerProfileUrl(),chain:null===(t=e.getChain)||void 0===t?void 0:t.call(e),transactionId:null===(n=e.getTransactionIdString)||void 0===n?void 0:n.call(e),transactionLink:null===(r=e.getTransactionLink)||void 0===r?void 0:r.call(e),rawTransactionLink:null===(i=e.getRawTransactionLink)||void 0===i?void 0:i.call(e)}}))}},{key:"init",value:(f=a(r().mark((function e(){var t,n,i;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.instantiateProofVerifiers(),t=F(this.proofVerifiers),e.prev=2,t.s();case 4:if((n=t.n()).done){e.next=10;break}return i=n.value,e.next=8,i.init();case 8:e.next=4;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),t.e(e.t0);case 15:return e.prev=15,t.f(),e.finish(15);case 18:this.prepareVerificationProcess();case 19:case"end":return e.stop()}}),e,this,[[2,12,15,18]])}))),function(){return f.apply(this,arguments)})},{key:"verify",value:(h=a(r().mark((function e(){var t,n,i,o,a,s,u,l=arguments;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=l.length>0&&void 0!==l[0]?l[0]:function(){},this._stepCallback=t,this._stepsStatuses=[],n=0;case 3:if(!(n<this.proofVerifiers.length)){e.next=9;break}return e.next=6,this.proofVerifiers[n].verifyProof();case 6:n++,e.next=3;break;case 9:i=F(this.verificationProcess),e.prev=10,i.s();case 12:if((o=i.n()).done){e.next=20;break}if(this[a=o.value]){e.next=16;break}return e.abrupt("return",void console.error("verification logic for",a,"not implemented"));case 16:return e.next=18,this[a]();case 18:e.next=12;break;case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(10),i.e(e.t0);case 25:return e.prev=25,i.f(),e.finish(25);case 28:s=0;case 29:if(!(s<this.proofVerifiers.length)){e.next=35;break}return e.next=32,this.proofVerifiers[s].verifyIdentity();case 32:s++,e.next=29;break;case 35:return u=this._stepsStatuses.find((function(e){return e.status===zx.FAILURE})),e.abrupt("return",u?this._failed(u):this._succeed());case 37:case"end":return e.stop()}}),e,this,[[10,22,25,28]])}))),function(){return h.apply(this,arguments)})},{key:"getRevocationListUrl",value:function(){return this.issuer.revocationList}},{key:"getProofTypes",value:function(){var e=[];return this.proofMap.forEach((function(t){var n=t.type;"ChainedProof2021"===n&&(n=t.chainedProofType),Array.isArray(n)&&(n=n[0]),e.push(n)})),e}},{key:"getProofMap",value:function(e){var t=new Map;return"proof"in e?Array.isArray(e.proof)?e.proof.forEach((function(e,n){return t.set(n,e)})):t.set(0,e.proof):"signature"in e&&t.set(0,e.signature),t}},{key:"instantiateProofVerifiers",value:function(){var e=this;this.supportedVerificationSuites={MerkleProof2017:pZ,MerkleProof2019:dZ,Ed25519Signature2020:xF,EcdsaSecp256k1Signature2019:LO},this.proofMap=this.getProofMap(this.documentToVerify);var t=this.getProofTypes(),n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return t.filter((function(t){return!e.includes(t)}))}(Object.keys(this.supportedVerificationSuites),t);if(n.length)throw new Error("No support for proof verification of type: ".concat(n.join(", ")));this.proofMap.forEach((function(n,r){var i={executeStep:e.executeStep.bind(e),document:e.documentToVerify,proof:n,explorerAPIs:e.explorerAPIs,issuer:e.issuer};e.proofVerifiers.push(new e.supportedVerificationSuites[t[r]](i))}))}},{key:"prepareVerificationProcess",value:function(){var e=tk.certificates.getVerificationMap(!!this.issuer.didDocument,this.hashlinkVerifier.hasHashlinksToVerify());this.verificationSteps=e.verificationMap,this.verificationProcess=e.verificationProcess,this.registerSignatureVerificationSteps(),this.registerIdentityVerificationSteps(),this.verificationSteps=this.verificationSteps.filter((function(e){var t,n;return(null===(t=e.subSteps)||void 0===t?void 0:t.length)>0||(null===(n=e.suites)||void 0===n?void 0:n.some((function(e){return e.subSteps.length>0})))}))}},{key:"registerSignatureVerificationSteps",value:function(){var e=Yf.proofVerification;this.verificationSteps.find((function(t){return t.code===e})).suites=this.getSuiteSubsteps(e)}},{key:"getSuiteSubsteps",value:function(e){var t,n=(A(t={},Yf.proofVerification,"getProofVerificationSteps"),A(t,Yf.identityVerification,"getIdentityVerificationSteps"),t);return this.proofVerifiers.map((function(t){return{proofType:t.type,subSteps:t[n[e]](e)}}))}},{key:"registerIdentityVerificationSteps",value:function(){var e=Yf.identityVerification;this.verificationSteps.find((function(t){return t.code===e})).suites=this.getSuiteSubsteps(e)}},{key:"executeStep",value:(c=a(r().mark((function e(t,n,i){var o,a;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isFailing()){e.next=2;break}return e.abrupt("return");case 2:return t&&(o=tk.i18n.getText("subSteps","".concat(t,"LabelPending")),gZ(o),this._updateStatusCallback(t,zx.STARTING,i)),e.prev=3,e.next=6,n();case 6:return a=e.sent,e.abrupt("return",(t&&(this._updateStatusCallback(t,zx.SUCCESS,i),this._stepsStatuses.push({code:t,status:zx.SUCCESS})),a));case 10:e.prev=10,e.t0=e.catch(3),console.error(e.t0),t&&(this._updateStatusCallback(t,zx.FAILURE,i,e.t0.message),this._stepsStatuses.push({code:t,message:e.t0.message,status:zx.FAILURE}));case 13:case"end":return e.stop()}}),e,this,[[3,10]])}))),function(e,t,n){return c.apply(this,arguments)})},{key:"_stepCallback",value:function(e){}},{key:"checkImagesIntegrity",value:(u=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(Xf.checkImagesIntegrity,a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.hashlinkVerifier.verifyHashlinkTable().catch((function(e){throw console.error("hashlink verification error",e),new ed(Xf.checkImagesIntegrity,Jf("errors","checkImagesIntegrity"))}));case 2:case"end":return e.stop()}}),e)}))));case 2:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"checkRevokedStatus",value:(o=a(r().mark((function e(){var t,n,i=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.documentToVerify.credentialStatus){e.next=4;break}return e.next=3,this.executeStep(Xf.checkRevokedStatus,a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,function(){var e=a(r().mark((function e(t){var n,i,o,a,s,u,l;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Array.isArray(t)||(t=[t]),n=F(t),e.prev=2,n.s();case 4:if((i=n.n()).done){e.next=22;break}return o=i.value,a=parseInt(o.statusListIndex,10),e.next=9,TO(o.statusListCredential);case 9:if(s=e.sent){e.next=12;break}throw new ed(Xf.checkRevokedStatus,"No status list could be found at the specified URL for 'statusListCredential': ".concat(o.statusListCredential,"."));case 12:return e.next=14,OO(s);case 14:return u=s.credentialSubject.encodedList,e.next=17,x_({encodedList:u});case 17:if(!e.sent.isRevoked(a)){e.next=20;break}throw l="revocation"===o.statusPurpose?"revoked":"suspended",new ed(Xf.checkRevokedStatus,"Certificate has been ".concat(l,"."));case 20:e.next=4;break;case 22:e.next=27;break;case 24:e.prev=24,e.t0=e.catch(2),n.e(e.t0);case 27:return e.prev=27,n.f(),e.finish(27);case 30:case"end":return e.stop()}}),e,null,[[2,24,27,30]])})));return function(t){return e.apply(this,arguments)}}()(i.documentToVerify.credentialStatus);case 2:case"end":return e.stop()}}),e)}))));case 3:case 9:return e.abrupt("return",void e.sent);case 4:if(t=this.getRevocationListUrl()){e.next=10;break}return console.warn("No revocation list url was set on the issuer."),e.next=9,this.executeStep(Xf.checkRevokedStatus,(function(){return!0}));case 10:return e.next=12,this.executeStep(null,a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,tk.verifier.getRevokedAssertions(t,i.id);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))));case 12:return n=e.sent,e.next=15,this.executeStep(Xf.checkRevokedStatus,(function(){return function(e,t){if(e&&t){Array.isArray(t)||(t=[t]),t=t.filter((function(e){return null!=e}));var n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.filter((function(e){return t.includes(e)})).filter((function(e,t,n){return n.indexOf(e)===t}))}(t,e.map((function(e){return e.id})));if(n.length>0){var r=e.findIndex((function(e){return e.id===n[0]}));if(r>-1)throw new ed(Xf.checkRevokedStatus,tk.certificates.generateRevocationReason(e[r].revocationReason))}}}(n,i.id)}));case 15:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"checkExpiresDate",value:(i=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(Xf.checkExpiresDate,(function(){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(e){var t=Wx(e);if((new Date).getTime()>=t)throw new ed(Xf.checkExpiresDate,Jf("errors","ensureNotExpired"))}}(t.expires)}));case 2:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"controlVerificationMethod",value:(t=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(Xf.controlVerificationMethod,(function(){!function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=function(e){return e.id}(e);if(n!==t.split("#")[0])throw new ed(Xf.controlVerificationMethod,"".concat(WO," - ").concat(tk.i18n.getText("errors","controlVerificationMethod")))}(t.issuer.didDocument,fZ(t.documentToVerify.proof))}));case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"findStepFromVerificationProcess",value:function(e,t){return tk.verifier.findVerificationSubstep(e,this.verificationSteps,t)}},{key:"_failed",value:function(e){var t=e.message;return gZ("failure:".concat(t)),this._setFinalStep({status:zx.FAILURE,message:t})}},{key:"_isFailing",value:function(){return this._stepsStatuses.some((function(e){return e.status===zx.FAILURE}))}},{key:"_succeed",value:function(){var e;return 1===this.proofVerifiers.length&&(this.proofVerifiers[0].type.includes("MerkleProof")?(e=tk.chains.isMockChain(this.proofVerifiers[0].getChain())?tk.i18n.getComposedText("success","mocknet"):tk.i18n.getComposedText("success","blockchain"),gZ(e)):e=n(n({},tk.i18n.getComposedText("success","generic")),{},{description:tk.i18n.getComposedText("success","generic").description.replace("${SIGNATURE_TYPE}",this.proofVerifiers[0].type)})),this.proofVerifiers.length>1&&(e=tk.i18n.getComposedText("success","multisign")),this._setFinalStep({status:zx.SUCCESS,message:e})}},{key:"_setFinalStep",value:function(e){var t=e.status,n=e.message;return{code:Yf.final,status:t,message:n}}},{key:"_updateStatusCallback",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(null!=e){var i=this.findStepFromVerificationProcess(e,n);if(void 0===i)return void console.warn("step with code",e,"was not found for suite",n,"ignoring but you should not.");var o={code:e,status:t,parentStep:i.parentStep,label:i.labelPending};r&&(o.errorMessage=r),this._stepCallback(o)}}}]),e}();function yZ(e,t){return mZ.apply(this,arguments)}function mZ(){return mZ=a(r().mark((function e(t,n){var i,o;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=k(t.matchAll(/hl:{1}[a-zA-Z0-9]+:{1}[a-zA-Z0-9]+/gm)).map((function(e){return e[0]})).filter((function(e){return!!e}))).length){e.next=6;break}return e.next=4,function(){var e=a(r().mark((function e(t,n){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(t.map(function(){var e=a(r().mark((function e(t){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.decode(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 2:return e.abrupt("return",e.sent.reduce((function(e,t){return e.push(t.meta.url[0]),e}),[]));case 3:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()(i,n);case 4:o=e.sent,t=function(e,t,n){return t.forEach((function(t,r){e=e.replace(n[r],t)})),e}(t,o,i);case 6:return e.abrupt("return",t);case 7:case"end":return e.stop()}}),e)}))),mZ.apply(this,arguments)}var wZ=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(s(this,e),A(this,"certificateImage",void 0),A(this,"certificateJson",void 0),A(this,"description",void 0),A(this,"display",void 0),A(this,"expires",void 0),A(this,"explorerAPIs",[]),A(this,"id",void 0),A(this,"isFormatValid",void 0),A(this,"issuedOn",void 0),A(this,"issuer",void 0),A(this,"locale",void 0),A(this,"metadataJson",void 0),A(this,"name",void 0),A(this,"options",void 0),A(this,"recipientFullName",void 0),A(this,"recordLink",void 0),A(this,"revocationKey",void 0),A(this,"sealImage",void 0),A(this,"signature",void 0),A(this,"signatureImage",void 0),A(this,"signers",[]),A(this,"subtitle",void 0),A(this,"hashlinkVerifier",void 0),A(this,"verificationSteps",void 0),A(this,"verifier",void 0),this._setOptions(n),"object"!=i(t))try{t=JSON.parse(t)}catch(t){throw new Error(tk.i18n.getText("errors","certificateNotValid"))}this.certificateJson=BF(t),this.hashlinkVerifier=new Ql}var t,n,o,u,c;return l(e,[{key:"init",value:(c=a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.parseJson(this.certificateJson);case 2:return this.verifier=new vZ({certificateJson:this.certificateJson,expires:this.expires,id:this.id,issuer:this.issuer,hashlinkVerifier:this.hashlinkVerifier,revocationKey:this.revocationKey,explorerAPIs:BF(this.explorerAPIs)}),e.next=5,this.verifier.init();case 5:this.verificationSteps=this.verifier.getVerificationSteps();case 6:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"verify",value:(u=a(r().mark((function e(t){var n;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.verifier.verify(t);case 2:return n=e.sent,e.abrupt("return",(this.setSigners(),n));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"parseJson",value:(o=a(r().mark((function e(t){var n;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,function(){var e=a(r().mark((function e(t){var n,i;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=rk(t["@context"]),e.next=4,ak[n.versionNumber](t);case 4:return i=e.sent,e.abrupt("return",(i.isFormatValid=!0,i));case 8:return e.prev=8,e.t0=e.catch(0),e.abrupt("return",(console.error(e.t0),{isFormatValid:!1,error:e.t0.message}));case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(t){return e.apply(this,arguments)}}()(t);case 2:if((n=e.sent).isFormatValid){e.next=5;break}throw new Error(n.error);case 5:return e.next=7,this._setProperties(n);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"setSigners",value:function(){this.signers=this.verifier.getSignersData()}},{key:"_setOptions",value:function(e){this.options=Object.assign({},Gf,e),this.locale=tk.i18n.ensureIsSupported("auto"===this.options.locale?tk.i18n.detectLocale():this.options.locale),this.explorerAPIs=this.options.explorerAPIs||[],e.didResolverUrl&&(tk.did.didResolver.url=e.didResolverUrl),Vf.locale=this.locale}},{key:"_setProperties",value:(n=a(r().mark((function e(t){var n,i,o,a,s,u,l,A,c,h,f,d,p,g,v,y,m;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.certificateImage,i=t.description,o=t.display,a=t.expires,s=t.id,u=t.isFormatValid,l=t.issuedOn,A=t.issuer,c=t.metadataJson,h=t.name,f=t.recipientFullName,d=t.recordLink,p=t.revocationKey,g=t.sealImage,v=t.signature,y=t.signatureImage,m=t.subtitle,this.isFormatValid=u,this.certificateImage=n,this.description=i,this.expires=a,this.id=s,this.issuedOn=l,this.issuer=A,this.metadataJson=c,this.name=h,this.recipientFullName=f,this.recordLink=d,this.revocationKey=p,this.sealImage=g,this.signature=v,this.signatureImage=y,this.subtitle=m,e.next=19,this.parseHashlinksInDisplay(o);case 19:this.display=e.sent;case 20:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"parseHashlinksInDisplay",value:(t=a(r().mark((function e(t){var n;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=BF(t))){e.next=8;break}if(e.t0="text/html"!==n.contentMediaType,e.t0){e.next=7;break}return e.next=6,yZ(n.content,this.hashlinkVerifier);case 6:n.content=e.sent;case 7:return e.abrupt("return",n);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}();function bZ(e){return/^(ftp|http|https):\/\/[^ "]+$/.test(e)}function IZ(e){return/^(\.\/|\.\.\/|[A-Z]:\/\/|\/)[^ "]+$/.test(e)}function BZ(){return{certificateDefinition:null,errorMessage:"errors.invalidBlockcertsUrl"}}function EZ(e){return new Promise((function(t,n){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=r.onabort=n,r.readAsText(e)}))}function CZ(){return(CZ=a(r().mark((function e(t){var n;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,EZ(t);case 4:return n=e.sent,e.abrupt("return",n);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var xZ,kZ,SZ,QZ,_Z,NZ=["documentLoader"];
598
+ */!function(e,t){(function(){var n,r="Expected a function",o="__lodash_hash_undefined__",a="__lodash_placeholder__",s=32,u=128,l=1/0,A=9007199254740991,c=NaN,h=4294967295,f=[["ary",u],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",s],["partialRight",64],["rearg",256]],d="[object Arguments]",p="[object Array]",g="[object Boolean]",v="[object Date]",y="[object Error]",m="[object Function]",w="[object GeneratorFunction]",b="[object Map]",I="[object Number]",B="[object Object]",E="[object Promise]",C="[object RegExp]",x="[object Set]",k="[object String]",S="[object Symbol]",Q="[object WeakMap]",_="[object ArrayBuffer]",N="[object DataView]",D="[object Float32Array]",F="[object Float64Array]",P="[object Int8Array]",U="[object Int16Array]",L="[object Int32Array]",T="[object Uint8Array]",M="[object Uint8ClampedArray]",R="[object Uint16Array]",O="[object Uint32Array]",H=/\b__p \+= '';/g,K=/\b(__p \+=) '' \+/g,j=/(__e\(.*?\)|\b__t\)) \+\n'';/g,G=/&(?:amp|lt|gt|quot|#39);/g,q=/[&<>"']/g,V=RegExp(G.source),z=RegExp(q.source),J=/<%-([\s\S]+?)%>/g,Y=/<%([\s\S]+?)%>/g,X=/<%=([\s\S]+?)%>/g,W=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z=/^\w*$/,$=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ee=/[\\^$.*+?()[\]{}|]/g,te=RegExp(ee.source),ne=/^\s+/,re=/\s/,ie=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,oe=/\{\n\/\* \[wrapped with (.+)\] \*/,ae=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ue=/[()=,{}\[\]\/\s]/,le=/\\(\\)?/g,Ae=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ce=/\w*$/,he=/^[-+]0x[0-9a-f]+$/i,fe=/^0b[01]+$/i,de=/^\[object .+?Constructor\]$/,pe=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,ve=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ye=/($^)/,me=/['\n\r\u2028\u2029\\]/g,we="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",be="a-z\\xdf-\\xf6\\xf8-\\xff",Ie="A-Z\\xc0-\\xd6\\xd8-\\xde",Be="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="["+Be+"]",Ce="["+we+"]",xe="\\d+",ke="["+be+"]",Se="[^\\ud800-\\udfff"+Be+xe+"\\u2700-\\u27bf"+be+Ie+"]",Qe="\\ud83c[\\udffb-\\udfff]",_e="[^\\ud800-\\udfff]",Ne="(?:\\ud83c[\\udde6-\\uddff]){2}",De="[\\ud800-\\udbff][\\udc00-\\udfff]",Fe="["+Ie+"]",Pe="(?:"+ke+"|"+Se+")",Ue="(?:"+Fe+"|"+Se+")",Le="(?:['’](?:d|ll|m|re|s|t|ve))?",Te="(?:['’](?:D|LL|M|RE|S|T|VE))?",Me="(?:"+Ce+"|"+Qe+")?",Re="[\\ufe0e\\ufe0f]?",Oe=Re+Me+"(?:\\u200d(?:"+[_e,Ne,De].join("|")+")"+Re+Me+")*",He="(?:"+["[\\u2700-\\u27bf]",Ne,De].join("|")+")"+Oe,Ke="(?:"+[_e+Ce+"?",Ce,Ne,De,"[\\ud800-\\udfff]"].join("|")+")",je=RegExp("['’]","g"),Ge=RegExp(Ce,"g"),qe=RegExp(Qe+"(?="+Qe+")|"+Ke+Oe,"g"),Ve=RegExp([Fe+"?"+ke+"+"+Le+"(?="+[Ee,Fe,"$"].join("|")+")",Ue+"+"+Te+"(?="+[Ee,Fe+Pe,"$"].join("|")+")",Fe+"?"+Pe+"+"+Le,Fe+"+"+Te,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",xe,He].join("|"),"g"),ze=RegExp("[\\u200d\\ud800-\\udfff"+we+"\\ufe0e\\ufe0f]"),Je=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ye=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Xe=-1,We={};We[D]=We[F]=We[P]=We[U]=We[L]=We[T]=We[M]=We[R]=We[O]=!0,We[d]=We[p]=We[_]=We[g]=We[N]=We[v]=We[y]=We[m]=We[b]=We[I]=We[B]=We[C]=We[x]=We[k]=We[Q]=!1;var Ze={};Ze[d]=Ze[p]=Ze[_]=Ze[N]=Ze[g]=Ze[v]=Ze[D]=Ze[F]=Ze[P]=Ze[U]=Ze[L]=Ze[b]=Ze[I]=Ze[B]=Ze[C]=Ze[x]=Ze[k]=Ze[S]=Ze[T]=Ze[M]=Ze[R]=Ze[O]=!0,Ze[y]=Ze[m]=Ze[Q]=!1;var $e={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},et=parseFloat,tt=parseInt,nt="object"==i(Do)&&Do&&Do.Object===Object&&Do,rt="object"==("undefined"==typeof self?"undefined":i(self))&&self&&self.Object===Object&&self,it=nt||rt||Function("return this")(),ot=t&&!t.nodeType&&t,at=ot&&e&&!e.nodeType&&e,st=at&&at.exports===ot,ut=st&&nt.process,lt=function(){try{return at&&at.require&&at.require("util").types||ut&&ut.binding&&ut.binding("util")}catch(e){}}(),At=lt&&lt.isArrayBuffer,ct=lt&&lt.isDate,ht=lt&&lt.isMap,ft=lt&&lt.isRegExp,dt=lt&&lt.isSet,pt=lt&&lt.isTypedArray;function gt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function vt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i<o;){var a=e[i];t(r,a,n(a),e)}return r}function yt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function mt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function wt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function bt(e,t){for(var n=-1,r=null==e?0:e.length,i=0,o=[];++n<r;){var a=e[n];t(a,n,e)&&(o[i++]=a)}return o}function It(e,t){return!(null==e||!e.length)&&Dt(e,t,0)>-1}function Bt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function Et(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function Ct(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function xt(e,t,n,r){var i=-1,o=null==e?0:e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}function kt(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function St(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Qt=Lt("length");function _t(e,t,n){var r;return n(e,(function(e,n,i){if(t(e,n,i))return r=n,!1})),r}function Nt(e,t,n,r){for(var i=e.length,o=n+(r?1:-1);r?o--:++o<i;)if(t(e[o],o,e))return o;return-1}function Dt(e,t,n){return t==t?function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):Nt(e,Pt,n)}function Ft(e,t,n,r){for(var i=n-1,o=e.length;++i<o;)if(r(e[i],t))return i;return-1}function Pt(e){return e!=e}function Ut(e,t){var n=null==e?0:e.length;return n?Rt(e,t)/n:c}function Lt(e){return function(t){return null==t?n:t[e]}}function Tt(e){return function(t){return null==e?n:e[t]}}function Mt(e,t,n,r,i){return i(e,(function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)})),n}function Rt(e,t){for(var r,i=-1,o=e.length;++i<o;){var a=t(e[i]);a!==n&&(r=r===n?a:r+a)}return r}function Ot(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Ht(e){return e?e.slice(0,on(e)+1).replace(ne,""):e}function Kt(e){return function(t){return e(t)}}function jt(e,t){return Et(t,(function(t){return e[t]}))}function Gt(e,t){return e.has(t)}function qt(e,t){for(var n=-1,r=e.length;++n<r&&Dt(t,e[n],0)>-1;);return n}function Vt(e,t){for(var n=e.length;n--&&Dt(t,e[n],0)>-1;);return n}function zt(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var Jt=Tt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Yt=Tt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function Xt(e){return"\\"+$e[e]}function Wt(e){return ze.test(e)}function Zt(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function $t(e,t){return function(n){return e(t(n))}}function en(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var s=e[n];s!==t&&s!==a||(e[n]=a,o[i++]=n)}return o}function tn(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}function nn(e){return Wt(e)?function(e){for(var t=qe.lastIndex=0;qe.test(e);)++t;return t}(e):Qt(e)}function rn(e){return Wt(e)?function(e){return e.match(qe)||[]}(e):function(e){return e.split("")}(e)}function on(e){for(var t=e.length;t--&&re.test(e.charAt(t)););return t}var an=Tt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),sn=function e(t){var re,we=(t=null==t?it:sn.defaults(it.Object(),t,sn.pick(it,Ye))).Array,be=t.Date,Ie=t.Error,Be=t.Function,Ee=t.Math,Ce=t.Object,xe=t.RegExp,ke=t.String,Se=t.TypeError,Qe=we.prototype,_e=Be.prototype,Ne=Ce.prototype,De=t["__core-js_shared__"],Fe=_e.toString,Pe=Ne.hasOwnProperty,Ue=0,Le=(re=/[^.]+$/.exec(De&&De.keys&&De.keys.IE_PROTO||""))?"Symbol(src)_1."+re:"",Te=Ne.toString,Me=Fe.call(Ce),Re=it._,Oe=xe("^"+Fe.call(Pe).replace(ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),He=st?t.Buffer:n,Ke=t.Symbol,qe=t.Uint8Array,ze=He?He.allocUnsafe:n,$e=$t(Ce.getPrototypeOf,Ce),nt=Ce.create,rt=Ne.propertyIsEnumerable,ot=Qe.splice,at=Ke?Ke.isConcatSpreadable:n,ut=Ke?Ke.iterator:n,lt=Ke?Ke.toStringTag:n,Qt=function(){try{var e=lo(Ce,"defineProperty");return e({},"",{}),e}catch(e){}}(),Tt=t.clearTimeout!==it.clearTimeout&&t.clearTimeout,un=be&&be.now!==it.Date.now&&be.now,ln=t.setTimeout!==it.setTimeout&&t.setTimeout,An=Ee.ceil,cn=Ee.floor,hn=Ce.getOwnPropertySymbols,fn=He?He.isBuffer:n,dn=t.isFinite,pn=Qe.join,gn=$t(Ce.keys,Ce),vn=Ee.max,yn=Ee.min,mn=be.now,wn=t.parseInt,bn=Ee.random,In=Qe.reverse,Bn=lo(t,"DataView"),En=lo(t,"Map"),Cn=lo(t,"Promise"),xn=lo(t,"Set"),kn=lo(t,"WeakMap"),Sn=lo(Ce,"create"),Qn=kn&&new kn,_n={},Nn=To(Bn),Dn=To(En),Fn=To(Cn),Pn=To(xn),Un=To(kn),Ln=Ke?Ke.prototype:n,Tn=Ln?Ln.valueOf:n,Mn=Ln?Ln.toString:n;function Rn(e){if(es(e)&&!ja(e)&&!(e instanceof jn)){if(e instanceof Kn)return e;if(Pe.call(e,"__wrapped__"))return Mo(e)}return new Kn(e)}var On=function(){function e(){}return function(t){if(!$a(t))return{};if(nt)return nt(t);e.prototype=t;var r=new e;return e.prototype=n,r}}();function Hn(){}function Kn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=n}function jn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=h,this.__views__=[]}function Gn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function qn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Vn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function zn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Vn;++t<n;)this.add(e[t])}function Jn(e){var t=this.__data__=new qn(e);this.size=t.size}function Yn(e,t){var n=ja(e),r=!n&&Ka(e),i=!n&&!r&&za(e),o=!n&&!r&&!i&&us(e),a=n||r||i||o,s=a?Ot(e.length,ke):[],u=s.length;for(var l in e)!t&&!Pe.call(e,l)||a&&("length"==l||i&&("offset"==l||"parent"==l)||o&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||vo(l,u))||s.push(l);return s}function Xn(e){var t=e.length;return t?e[Vr(0,t-1)]:n}function Wn(e,t){return Po(ki(e),ar(t,0,e.length))}function Zn(e){return Po(ki(e))}function $n(e,t,r){(r!==n&&!Ra(e[t],r)||r===n&&!(t in e))&&ir(e,t,r)}function er(e,t,r){var i=e[t];Pe.call(e,t)&&Ra(i,r)&&(r!==n||t in e)||ir(e,t,r)}function tr(e,t){for(var n=e.length;n--;)if(Ra(e[n][0],t))return n;return-1}function nr(e,t,n,r){return cr(e,(function(e,i,o){t(r,e,n(e),o)})),r}function rr(e,t){return e&&Si(t,_s(t),e)}function ir(e,t,n){"__proto__"==t&&Qt?Qt(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function or(e,t){for(var r=-1,i=t.length,o=we(i),a=null==e;++r<i;)o[r]=a?n:Cs(e,t[r]);return o}function ar(e,t,r){return e==e&&(r!==n&&(e=e<=r?e:r),t!==n&&(e=e>=t?e:t)),e}function sr(e,t,r,i,o,a){var s,u=1&t,l=2&t,A=4&t;if(r&&(s=o?r(e,i,o,a):r(e)),s!==n)return s;if(!$a(e))return e;var c=ja(e);if(c){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Pe.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!u)return ki(e,s)}else{var h=ho(e),f=h==m||h==w;if(za(e))return bi(e,u);if(h==B||h==d||f&&!o){if(s=l||f?{}:po(e),!u)return l?function(e,t){return Si(e,co(e),t)}(e,function(e,t){return e&&Si(t,Ns(t),e)}(s,e)):function(e,t){return Si(e,Ao(e),t)}(e,rr(s,e))}else{if(!Ze[h])return o?e:{};s=function(e,t,n){var r,i=e.constructor;switch(t){case _:return Ii(e);case g:case v:return new i(+e);case N:return function(e,t){var n=t?Ii(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case D:case F:case P:case U:case L:case T:case M:case R:case O:return Bi(e,n);case b:return new i;case I:case k:return new i(e);case C:return function(e){var t=new e.constructor(e.source,ce.exec(e));return t.lastIndex=e.lastIndex,t}(e);case x:return new i;case S:return r=e,Tn?Ce(Tn.call(r)):{}}}(e,h,u)}}a||(a=new Jn);var p=a.get(e);if(p)return p;a.set(e,s),os(e)?e.forEach((function(n){s.add(sr(n,t,r,n,e,a))})):ts(e)&&e.forEach((function(n,i){s.set(i,sr(n,t,r,i,e,a))}));var y=c?n:(A?l?no:to:l?Ns:_s)(e);return yt(y||e,(function(n,i){y&&(n=e[i=n]),er(s,i,sr(n,t,r,i,e,a))})),s}function ur(e,t,r){var i=r.length;if(null==e)return!i;for(e=Ce(e);i--;){var o=r[i],a=t[o],s=e[o];if(s===n&&!(o in e)||!a(s))return!1}return!0}function lr(e,t,i){if("function"!=typeof e)throw new Se(r);return _o((function(){e.apply(n,i)}),t)}function Ar(e,t,n,r){var i=-1,o=It,a=!0,s=e.length,u=[],l=t.length;if(!s)return u;n&&(t=Et(t,Kt(n))),r?(o=Bt,a=!1):t.length>=200&&(o=Gt,a=!1,t=new zn(t));e:for(;++i<s;){var A=e[i],c=null==n?A:n(A);if(A=r||0!==A?A:0,a&&c==c){for(var h=l;h--;)if(t[h]===c)continue e;u.push(A)}else o(t,c,r)||u.push(A)}return u}Rn.templateSettings={escape:J,evaluate:Y,interpolate:X,variable:"",imports:{_:Rn}},Rn.prototype=Hn.prototype,Rn.prototype.constructor=Rn,Kn.prototype=On(Hn.prototype),Kn.prototype.constructor=Kn,jn.prototype=On(Hn.prototype),jn.prototype.constructor=jn,Gn.prototype.clear=function(){this.__data__=Sn?Sn(null):{},this.size=0},Gn.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Gn.prototype.get=function(e){var t=this.__data__;if(Sn){var r=t[e];return r===o?n:r}return Pe.call(t,e)?t[e]:n},Gn.prototype.has=function(e){var t=this.__data__;return Sn?t[e]!==n:Pe.call(t,e)},Gn.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=Sn&&t===n?o:t,this},qn.prototype.clear=function(){this.__data__=[],this.size=0},qn.prototype.delete=function(e){var t=this.__data__,n=tr(t,e);return!(n<0||(n==t.length-1?t.pop():ot.call(t,n,1),--this.size,0))},qn.prototype.get=function(e){var t=this.__data__,r=tr(t,e);return r<0?n:t[r][1]},qn.prototype.has=function(e){return tr(this.__data__,e)>-1},qn.prototype.set=function(e,t){var n=this.__data__,r=tr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Vn.prototype.clear=function(){this.size=0,this.__data__={hash:new Gn,map:new(En||qn),string:new Gn}},Vn.prototype.delete=function(e){var t=so(this,e).delete(e);return this.size-=t?1:0,t},Vn.prototype.get=function(e){return so(this,e).get(e)},Vn.prototype.has=function(e){return so(this,e).has(e)},Vn.prototype.set=function(e,t){var n=so(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},zn.prototype.add=zn.prototype.push=function(e){return this.__data__.set(e,o),this},zn.prototype.has=function(e){return this.__data__.has(e)},Jn.prototype.clear=function(){this.__data__=new qn,this.size=0},Jn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Jn.prototype.get=function(e){return this.__data__.get(e)},Jn.prototype.has=function(e){return this.__data__.has(e)},Jn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof qn){var r=n.__data__;if(!En||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Vn(r)}return n.set(e,t),this.size=n.size,this};var cr=Ni(mr),hr=Ni(wr,!0);function fr(e,t){var n=!0;return cr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function dr(e,t,r){for(var i=-1,o=e.length;++i<o;){var a=e[i],s=t(a);if(null!=s&&(u===n?s==s&&!ss(s):r(s,u)))var u=s,l=a}return l}function pr(e,t){var n=[];return cr(e,(function(e,r,i){t(e,r,i)&&n.push(e)})),n}function gr(e,t,n,r,i){var o=-1,a=e.length;for(n||(n=go),i||(i=[]);++o<a;){var s=e[o];t>0&&n(s)?t>1?gr(s,t-1,n,r,i):Ct(i,s):r||(i[i.length]=s)}return i}var vr=Di(),yr=Di(!0);function mr(e,t){return e&&vr(e,t,_s)}function wr(e,t){return e&&yr(e,t,_s)}function br(e,t){return bt(t,(function(t){return Xa(e[t])}))}function Ir(e,t){for(var r=0,i=(t=vi(t,e)).length;null!=e&&r<i;)e=e[Lo(t[r++])];return r&&r==i?e:n}function Br(e,t,n){var r=t(e);return ja(e)?r:Ct(r,n(e))}function Er(e){return null==e?e===n?"[object Undefined]":"[object Null]":lt&&lt in Ce(e)?function(e){var t=Pe.call(e,lt),r=e[lt];try{e[lt]=n;var i=!0}catch(e){}var o=Te.call(e);return i&&(t?e[lt]=r:delete e[lt]),o}(e):function(e){return Te.call(e)}(e)}function Cr(e,t){return e>t}function xr(e,t){return null!=e&&Pe.call(e,t)}function kr(e,t){return null!=e&&t in Ce(e)}function Sr(e,t,r){for(var i=r?Bt:It,o=e[0].length,a=e.length,s=a,u=we(a),l=1/0,A=[];s--;){var c=e[s];s&&t&&(c=Et(c,Kt(t))),l=yn(c.length,l),u[s]=!r&&(t||o>=120&&c.length>=120)?new zn(s&&c):n}c=e[0];var h=-1,f=u[0];e:for(;++h<o&&A.length<l;){var d=c[h],p=t?t(d):d;if(d=r||0!==d?d:0,!(f?Gt(f,p):i(A,p,r))){for(s=a;--s;){var g=u[s];if(!(g?Gt(g,p):i(e[s],p,r)))continue e}f&&f.push(p),A.push(d)}}return A}function Qr(e,t,r){var i=null==(e=xo(e,t=vi(t,e)))?e:e[Lo(Yo(t))];return null==i?n:gt(i,e,r)}function _r(e){return es(e)&&Er(e)==d}function Nr(e,t,r,i,o){return e===t||(null==e||null==t||!es(e)&&!es(t)?e!=e&&t!=t:function(e,t,r,i,o,a){var s=ja(e),u=ja(t),l=s?p:ho(e),A=u?p:ho(t),c=(l=l==d?B:l)==B,h=(A=A==d?B:A)==B,f=l==A;if(f&&za(e)){if(!za(t))return!1;s=!0,c=!1}if(f&&!c)return a||(a=new Jn),s||us(e)?$i(e,t,r,i,o,a):function(e,t,n,r,i,o,a){switch(n){case N:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case _:return!(e.byteLength!=t.byteLength||!o(new qe(e),new qe(t)));case g:case v:case I:return Ra(+e,+t);case y:return e.name==t.name&&e.message==t.message;case C:case k:return e==t+"";case b:var s=Zt;case x:var u=1&r;if(s||(s=tn),e.size!=t.size&&!u)return!1;var l=a.get(e);if(l)return l==t;r|=2,a.set(e,t);var A=$i(s(e),s(t),r,i,o,a);return a.delete(e),A;case S:if(Tn)return Tn.call(e)==Tn.call(t)}return!1}(e,t,l,r,i,o,a);if(!(1&r)){var m=c&&Pe.call(e,"__wrapped__"),w=h&&Pe.call(t,"__wrapped__");if(m||w){var E=m?e.value():e,Q=w?t.value():t;return a||(a=new Jn),o(E,Q,r,i,a)}}return!!f&&(a||(a=new Jn),function(e,t,r,i,o,a){var s=1&r,u=to(e),l=u.length;if(l!=to(t).length&&!s)return!1;for(var A=l;A--;){var c=u[A];if(!(s?c in t:Pe.call(t,c)))return!1}var h=a.get(e),f=a.get(t);if(h&&f)return h==t&&f==e;var d=!0;a.set(e,t),a.set(t,e);for(var p=s;++A<l;){var g=e[c=u[A]],v=t[c];if(i)var y=s?i(v,g,c,t,e,a):i(g,v,c,e,t,a);if(!(y===n?g===v||o(g,v,r,i,a):y)){d=!1;break}p||(p="constructor"==c)}if(d&&!p){var m=e.constructor,w=t.constructor;m==w||!("constructor"in e)||!("constructor"in t)||"function"==typeof m&&m instanceof m&&"function"==typeof w&&w instanceof w||(d=!1)}return a.delete(e),a.delete(t),d}(e,t,r,i,o,a))}(e,t,r,i,Nr,o))}function Dr(e,t,r,i){var o=r.length,a=o,s=!i;if(null==e)return!a;for(e=Ce(e);o--;){var u=r[o];if(s&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++o<a;){var l=(u=r[o])[0],A=e[l],c=u[1];if(s&&u[2]){if(A===n&&!(l in e))return!1}else{var h=new Jn;if(i)var f=i(A,c,l,e,t,h);if(!(f===n?Nr(c,A,3,i,h):f))return!1}}return!0}function Fr(e){return!(!$a(e)||(t=e,Le&&Le in t))&&(Xa(e)?Oe:de).test(To(e));var t}function Pr(e){return"function"==typeof e?e:null==e?nu:"object"==i(e)?ja(e)?Rr(e[0],e[1]):Mr(e):cu(e)}function Ur(e){if(!Io(e))return gn(e);var t=[];for(var n in Ce(e))Pe.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Lr(e,t){return e<t}function Tr(e,t){var n=-1,r=qa(e)?we(e.length):[];return cr(e,(function(e,i,o){r[++n]=t(e,i,o)})),r}function Mr(e){var t=uo(e);return 1==t.length&&t[0][2]?Eo(t[0][0],t[0][1]):function(n){return n===e||Dr(n,e,t)}}function Rr(e,t){return mo(e)&&Bo(t)?Eo(Lo(e),t):function(r){var i=Cs(r,e);return i===n&&i===t?xs(r,e):Nr(t,i,3)}}function Or(e,t,r,i,o){e!==t&&vr(t,(function(a,s){if(o||(o=new Jn),$a(a))!function(e,t,r,i,o,a,s){var u=So(e,r),l=So(t,r),A=s.get(l);if(A)$n(e,r,A);else{var c=a?a(u,l,r+"",e,t,s):n,h=c===n;if(h){var f=ja(l),d=!f&&za(l),p=!f&&!d&&us(l);c=l,f||d||p?ja(u)?c=u:Va(u)?c=ki(u):d?(h=!1,c=bi(l,!0)):p?(h=!1,c=Bi(l,!0)):c=[]:rs(l)||Ka(l)?(c=u,Ka(u)?c=gs(u):$a(u)&&!Xa(u)||(c=po(l))):h=!1}h&&(s.set(l,c),o(c,l,i,a,s),s.delete(l)),$n(e,r,c)}}(e,t,s,r,Or,i,o);else{var u=i?i(So(e,s),a,s+"",e,t,o):n;u===n&&(u=a),$n(e,s,u)}}),Ns)}function Hr(e,t){var r=e.length;if(r)return vo(t+=t<0?r:0,r)?e[t]:n}function Kr(e,t,n){t=t.length?Et(t,(function(e){return ja(e)?function(t){return Ir(t,1===e.length?e[0]:e)}:e})):[nu];var r=-1;t=Et(t,Kt(ao()));var i=Tr(e,(function(e,n,i){var o=Et(t,(function(t){return t(e)}));return{criteria:o,index:++r,value:e}}));return function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(i,(function(e,t){return function(e,t,n){for(var r=-1,i=e.criteria,o=t.criteria,a=i.length,s=n.length;++r<a;){var u=Ei(i[r],o[r]);if(u)return r>=s?u:u*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function jr(e,t,n){for(var r=-1,i=t.length,o={};++r<i;){var a=t[r],s=Ir(e,a);n(s,a)&&Wr(o,vi(a,e),s)}return o}function Gr(e,t,n,r){var i=r?Ft:Dt,o=-1,a=t.length,s=e;for(e===t&&(t=ki(t)),n&&(s=Et(e,Kt(n)));++o<a;)for(var u=0,l=t[o],A=n?n(l):l;(u=i(s,A,u,r))>-1;)s!==e&&ot.call(s,u,1),ot.call(e,u,1);return e}function qr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;vo(i)?ot.call(e,i,1):li(e,i)}}return e}function Vr(e,t){return e+cn(bn()*(t-e+1))}function zr(e,t){var n="";if(!e||t<1||t>A)return n;do{t%2&&(n+=e),(t=cn(t/2))&&(e+=e)}while(t);return n}function Jr(e,t){return No(Co(e,t,nu),e+"")}function Yr(e){return Xn(Rs(e))}function Xr(e,t){var n=Rs(e);return Po(n,ar(t,0,n.length))}function Wr(e,t,r,i){if(!$a(e))return e;for(var o=-1,a=(t=vi(t,e)).length,s=a-1,u=e;null!=u&&++o<a;){var l=Lo(t[o]),A=r;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(o!=s){var c=u[l];(A=i?i(c,l,u):n)===n&&(A=$a(c)?c:vo(t[o+1])?[]:{})}er(u,l,A),u=u[l]}return e}var Zr=Qn?function(e,t){return Qn.set(e,t),e}:nu,$r=Qt?function(e,t){return Qt(e,"toString",{configurable:!0,enumerable:!1,value:$s(t),writable:!0})}:nu;function ei(e){return Po(Rs(e))}function ti(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=we(i);++r<i;)o[r]=e[r+t];return o}function ni(e,t){var n;return cr(e,(function(e,r,i){return!(n=t(e,r,i))})),!!n}function ri(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var o=r+i>>>1,a=e[o];null!==a&&!ss(a)&&(n?a<=t:a<t)?r=o+1:i=o}return i}return ii(e,t,nu,n)}function ii(e,t,r,i){var o=0,a=null==e?0:e.length;if(0===a)return 0;for(var s=(t=r(t))!=t,u=null===t,l=ss(t),A=t===n;o<a;){var c=cn((o+a)/2),h=r(e[c]),f=h!==n,d=null===h,p=h==h,g=ss(h);if(s)var v=i||p;else v=A?p&&(i||f):u?p&&f&&(i||!d):l?p&&f&&!d&&(i||!g):!d&&!g&&(i?h<=t:h<t);v?o=c+1:a=c}return yn(a,4294967294)}function oi(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var a=e[n],s=t?t(a):a;if(!n||!Ra(s,u)){var u=s;o[i++]=0===a?0:a}}return o}function ai(e){return"number"==typeof e?e:ss(e)?c:+e}function si(e){if("string"==typeof e)return e;if(ja(e))return Et(e,si)+"";if(ss(e))return Mn?Mn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ui(e,t,n){var r=-1,i=It,o=e.length,a=!0,s=[],u=s;if(n)a=!1,i=Bt;else if(o>=200){var l=t?null:zi(e);if(l)return tn(l);a=!1,i=Gt,u=new zn}else u=t?[]:s;e:for(;++r<o;){var A=e[r],c=t?t(A):A;if(A=n||0!==A?A:0,a&&c==c){for(var h=u.length;h--;)if(u[h]===c)continue e;t&&u.push(c),s.push(A)}else i(u,c,n)||(u!==s&&u.push(c),s.push(A))}return s}function li(e,t){return null==(e=xo(e,t=vi(t,e)))||delete e[Lo(Yo(t))]}function Ai(e,t,n,r){return Wr(e,t,n(Ir(e,t)),r)}function ci(e,t,n,r){for(var i=e.length,o=r?i:-1;(r?o--:++o<i)&&t(e[o],o,e););return n?ti(e,r?0:o,r?o+1:i):ti(e,r?o+1:0,r?i:o)}function hi(e,t){var n=e;return n instanceof jn&&(n=n.value()),xt(t,(function(e,t){return t.func.apply(t.thisArg,Ct([e],t.args))}),n)}function fi(e,t,n){var r=e.length;if(r<2)return r?ui(e[0]):[];for(var i=-1,o=we(r);++i<r;)for(var a=e[i],s=-1;++s<r;)s!=i&&(o[i]=Ar(o[i]||a,e[s],t,n));return ui(gr(o,1),t,n)}function di(e,t,r){for(var i=-1,o=e.length,a=t.length,s={};++i<o;){var u=i<a?t[i]:n;r(s,e[i],u)}return s}function pi(e){return Va(e)?e:[]}function gi(e){return"function"==typeof e?e:nu}function vi(e,t){return ja(e)?e:mo(e,t)?[e]:Uo(vs(e))}var yi=Jr;function mi(e,t,r){var i=e.length;return r=r===n?i:r,!t&&r>=i?e:ti(e,t,r)}var wi=Tt||function(e){return it.clearTimeout(e)};function bi(e,t){if(t)return e.slice();var n=e.length,r=ze?ze(n):new e.constructor(n);return e.copy(r),r}function Ii(e){var t=new e.constructor(e.byteLength);return new qe(t).set(new qe(e)),t}function Bi(e,t){var n=t?Ii(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ei(e,t){if(e!==t){var r=e!==n,i=null===e,o=e==e,a=ss(e),s=t!==n,u=null===t,l=t==t,A=ss(t);if(!u&&!A&&!a&&e>t||a&&s&&l&&!u&&!A||i&&s&&l||!r&&l||!o)return 1;if(!i&&!a&&!A&&e<t||A&&r&&o&&!i&&!a||u&&r&&o||!s&&o||!l)return-1}return 0}function Ci(e,t,n,r){for(var i=-1,o=e.length,a=n.length,s=-1,u=t.length,l=vn(o-a,0),A=we(u+l),c=!r;++s<u;)A[s]=t[s];for(;++i<a;)(c||i<o)&&(A[n[i]]=e[i]);for(;l--;)A[s++]=e[i++];return A}function xi(e,t,n,r){for(var i=-1,o=e.length,a=-1,s=n.length,u=-1,l=t.length,A=vn(o-s,0),c=we(A+l),h=!r;++i<A;)c[i]=e[i];for(var f=i;++u<l;)c[f+u]=t[u];for(;++a<s;)(h||i<o)&&(c[f+n[a]]=e[i++]);return c}function ki(e,t){var n=-1,r=e.length;for(t||(t=we(r));++n<r;)t[n]=e[n];return t}function Si(e,t,r,i){var o=!r;r||(r={});for(var a=-1,s=t.length;++a<s;){var u=t[a],l=i?i(r[u],e[u],u,r,e):n;l===n&&(l=e[u]),o?ir(r,u,l):er(r,u,l)}return r}function Qi(e,t){return function(n,r){var i=ja(n)?vt:nr,o=t?t():{};return i(n,e,ao(r,2),o)}}function _i(e){return Jr((function(t,r){var i=-1,o=r.length,a=o>1?r[o-1]:n,s=o>2?r[2]:n;for(a=e.length>3&&"function"==typeof a?(o--,a):n,s&&yo(r[0],r[1],s)&&(a=o<3?n:a,o=1),t=Ce(t);++i<o;){var u=r[i];u&&e(t,u,i,a)}return t}))}function Ni(e,t){return function(n,r){if(null==n)return n;if(!qa(n))return e(n,r);for(var i=n.length,o=t?i:-1,a=Ce(n);(t?o--:++o<i)&&!1!==r(a[o],o,a););return n}}function Di(e){return function(t,n,r){for(var i=-1,o=Ce(t),a=r(t),s=a.length;s--;){var u=a[e?s:++i];if(!1===n(o[u],u,o))break}return t}}function Fi(e){return function(t){var r=Wt(t=vs(t))?rn(t):n,i=r?r[0]:t.charAt(0),o=r?mi(r,1).join(""):t.slice(1);return i[e]()+o}}function Pi(e){return function(t){return xt(Xs(Ks(t).replace(je,"")),e,"")}}function Ui(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=On(e.prototype),r=e.apply(n,t);return $a(r)?r:n}}function Li(e){return function(t,r,i){var o=Ce(t);if(!qa(t)){var a=ao(r,3);t=_s(t),r=function(e){return a(o[e],e,o)}}var s=e(t,r,i);return s>-1?o[a?t[s]:s]:n}}function Ti(e){return eo((function(t){var i=t.length,o=i,a=Kn.prototype.thru;for(e&&t.reverse();o--;){var s=t[o];if("function"!=typeof s)throw new Se(r);if(a&&!u&&"wrapper"==io(s))var u=new Kn([],!0)}for(o=u?o:i;++o<i;){var l=io(s=t[o]),A="wrapper"==l?ro(s):n;u=A&&wo(A[0])&&424==A[1]&&!A[4].length&&1==A[9]?u[io(A[0])].apply(u,A[3]):1==s.length&&wo(s)?u[l]():u.thru(s)}return function(){var e=arguments,n=e[0];if(u&&1==e.length&&ja(n))return u.plant(n).value();for(var r=0,o=i?t[r].apply(this,e):n;++r<i;)o=t[r].call(this,o);return o}}))}function Mi(e,t,r,i,o,a,s,l,A,c){var h=t&u,f=1&t,d=2&t,p=24&t,g=512&t,v=d?n:Ui(e);return function n(){for(var u=arguments.length,y=we(u),m=u;m--;)y[m]=arguments[m];if(p)var w=oo(n),b=zt(y,w);if(i&&(y=Ci(y,i,o,p)),a&&(y=xi(y,a,s,p)),u-=b,p&&u<c){var I=en(y,w);return qi(e,t,Mi,n.placeholder,r,y,I,l,A,c-u)}var B=f?r:this,E=d?B[e]:e;return u=y.length,l?y=ko(y,l):g&&u>1&&y.reverse(),h&&A<u&&(y.length=A),this&&this!==it&&this instanceof n&&(E=v||Ui(E)),E.apply(B,y)}}function Ri(e,t){return function(n,r){return function(e,t,n,r){return mr(e,(function(e,i,o){t(r,n(e),i,o)})),r}(n,e,t(r),{})}}function Oi(e,t){return function(r,i){var o;if(r===n&&i===n)return t;if(r!==n&&(o=r),i!==n){if(o===n)return i;"string"==typeof r||"string"==typeof i?(r=si(r),i=si(i)):(r=ai(r),i=ai(i)),o=e(r,i)}return o}}function Hi(e){return eo((function(t){return t=Et(t,Kt(ao())),Jr((function(n){var r=this;return e(t,(function(e){return gt(e,r,n)}))}))}))}function Ki(e,t){var r=(t=t===n?" ":si(t)).length;if(r<2)return r?zr(t,e):t;var i=zr(t,An(e/nn(t)));return Wt(t)?mi(rn(i),0,e).join(""):i.slice(0,e)}function ji(e){return function(t,r,i){return i&&"number"!=typeof i&&yo(t,r,i)&&(r=i=n),t=hs(t),r===n?(r=t,t=0):r=hs(r),function(e,t,n,r){for(var i=-1,o=vn(An((t-e)/(n||1)),0),a=we(o);o--;)a[r?o:++i]=e,e+=n;return a}(t,r,i=i===n?t<r?1:-1:hs(i),e)}}function Gi(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=ps(t),n=ps(n)),e(t,n)}}function qi(e,t,r,i,o,a,u,l,A,c){var h=8&t;t|=h?s:64,4&(t&=~(h?64:s))||(t&=-4);var f=[e,t,o,h?a:n,h?u:n,h?n:a,h?n:u,l,A,c],d=r.apply(n,f);return wo(e)&&Qo(d,f),d.placeholder=i,Do(d,e,t)}function Vi(e){var t=Ee[e];return function(e,n){if(e=ps(e),(n=null==n?0:yn(fs(n),292))&&dn(e)){var r=(vs(e)+"e").split("e");return+((r=(vs(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var zi=xn&&1/tn(new xn([,-0]))[1]==l?function(e){return new xn(e)}:su;function Ji(e){return function(t){var n=ho(t);return n==b?Zt(t):n==x?function(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=[e,e]})),n}(t):function(e,t){return Et(t,(function(t){return[t,e[t]]}))}(t,e(t))}}function Yi(e,t,i,o,l,A,c,h){var f=2&t;if(!f&&"function"!=typeof e)throw new Se(r);var d=o?o.length:0;if(d||(t&=-97,o=l=n),c=c===n?c:vn(fs(c),0),h=h===n?h:fs(h),d-=l?l.length:0,64&t){var p=o,g=l;o=l=n}var v=f?n:ro(e),y=[e,t,i,o,l,p,g,A,c,h];if(v&&function(e,t){var n=e[1],r=t[1],i=n|r,o=i<131,s=r==u&&8==n||r==u&&256==n&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!o&&!s)return e;1&r&&(e[2]=t[2],i|=1&n?0:4);var l=t[3];if(l){var A=e[3];e[3]=A?Ci(A,l,t[4]):l,e[4]=A?en(e[3],a):t[4]}(l=t[5])&&(A=e[5],e[5]=A?xi(A,l,t[6]):l,e[6]=A?en(e[5],a):t[6]),(l=t[7])&&(e[7]=l),r&u&&(e[8]=null==e[8]?t[8]:yn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(y,v),e=y[0],t=y[1],i=y[2],o=y[3],l=y[4],!(h=y[9]=y[9]===n?f?0:e.length:vn(y[9]-d,0))&&24&t&&(t&=-25),t&&1!=t)m=8==t||16==t?function(e,t,r){var i=Ui(e);return function o(){for(var a=arguments.length,s=we(a),u=a,l=oo(o);u--;)s[u]=arguments[u];var A=a<3&&s[0]!==l&&s[a-1]!==l?[]:en(s,l);return(a-=A.length)<r?qi(e,t,Mi,o.placeholder,n,s,A,n,n,r-a):gt(this&&this!==it&&this instanceof o?i:e,this,s)}}(e,t,h):t!=s&&33!=t||l.length?Mi.apply(n,y):function(e,t,n,r){var i=1&t,o=Ui(e);return function t(){for(var a=-1,s=arguments.length,u=-1,l=r.length,A=we(l+s),c=this&&this!==it&&this instanceof t?o:e;++u<l;)A[u]=r[u];for(;s--;)A[u++]=arguments[++a];return gt(c,i?n:this,A)}}(e,t,i,o);else var m=function(e,t,n){var r=1&t,i=Ui(e);return function t(){return(this&&this!==it&&this instanceof t?i:e).apply(r?n:this,arguments)}}(e,t,i);return Do((v?Zr:Qo)(m,y),e,t)}function Xi(e,t,r,i){return e===n||Ra(e,Ne[r])&&!Pe.call(i,r)?t:e}function Wi(e,t,r,i,o,a){return $a(e)&&$a(t)&&(a.set(t,e),Or(e,t,n,Wi,a),a.delete(t)),e}function Zi(e){return rs(e)?n:e}function $i(e,t,r,i,o,a){var s=1&r,u=e.length,l=t.length;if(u!=l&&!(s&&l>u))return!1;var A=a.get(e),c=a.get(t);if(A&&c)return A==t&&c==e;var h=-1,f=!0,d=2&r?new zn:n;for(a.set(e,t),a.set(t,e);++h<u;){var p=e[h],g=t[h];if(i)var v=s?i(g,p,h,t,e,a):i(p,g,h,e,t,a);if(v!==n){if(v)continue;f=!1;break}if(d){if(!St(t,(function(e,t){if(!Gt(d,t)&&(p===e||o(p,e,r,i,a)))return d.push(t)}))){f=!1;break}}else if(p!==g&&!o(p,g,r,i,a)){f=!1;break}}return a.delete(e),a.delete(t),f}function eo(e){return No(Co(e,n,Go),e+"")}function to(e){return Br(e,_s,Ao)}function no(e){return Br(e,Ns,co)}var ro=Qn?function(e){return Qn.get(e)}:su;function io(e){for(var t=e.name+"",n=_n[t],r=Pe.call(_n,t)?n.length:0;r--;){var i=n[r],o=i.func;if(null==o||o==e)return i.name}return t}function oo(e){return(Pe.call(Rn,"placeholder")?Rn:e).placeholder}function ao(){var e=Rn.iteratee||ru;return e=e===ru?Pr:e,arguments.length?e(arguments[0],arguments[1]):e}function so(e,t){var n=e.__data__;return function(e){var t=i(e);return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}(t)?n["string"==typeof t?"string":"hash"]:n.map}function uo(e){for(var t=_s(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Bo(i)]}return t}function lo(e,t){var r=function(e,t){return null==e?n:e[t]}(e,t);return Fr(r)?r:n}var Ao=hn?function(e){return null==e?[]:(e=Ce(e),bt(hn(e),(function(t){return rt.call(e,t)})))}:du,co=hn?function(e){for(var t=[];e;)Ct(t,Ao(e)),e=$e(e);return t}:du,ho=Er;function fo(e,t,n){for(var r=-1,i=(t=vi(t,e)).length,o=!1;++r<i;){var a=Lo(t[r]);if(!(o=null!=e&&n(e,a)))break;e=e[a]}return o||++r!=i?o:!!(i=null==e?0:e.length)&&Za(i)&&vo(a,i)&&(ja(e)||Ka(e))}function po(e){return"function"!=typeof e.constructor||Io(e)?{}:On($e(e))}function go(e){return ja(e)||Ka(e)||!!(at&&e&&e[at])}function vo(e,t){var n=i(e);return!!(t=null==t?A:t)&&("number"==n||"symbol"!=n&&ge.test(e))&&e>-1&&e%1==0&&e<t}function yo(e,t,n){if(!$a(n))return!1;var r=i(t);return!!("number"==r?qa(n)&&vo(t,n.length):"string"==r&&t in n)&&Ra(n[t],e)}function mo(e,t){if(ja(e))return!1;var n=i(e);return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!ss(e))||Z.test(e)||!W.test(e)||null!=t&&e in Ce(t)}function wo(e){var t=io(e),n=Rn[t];if("function"!=typeof n||!(t in jn.prototype))return!1;if(e===n)return!0;var r=ro(n);return!!r&&e===r[0]}(Bn&&ho(new Bn(new ArrayBuffer(1)))!=N||En&&ho(new En)!=b||Cn&&ho(Cn.resolve())!=E||xn&&ho(new xn)!=x||kn&&ho(new kn)!=Q)&&(ho=function(e){var t=Er(e),r=t==B?e.constructor:n,i=r?To(r):"";if(i)switch(i){case Nn:return N;case Dn:return b;case Fn:return E;case Pn:return x;case Un:return Q}return t});var bo=De?Xa:pu;function Io(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ne)}function Bo(e){return e==e&&!$a(e)}function Eo(e,t){return function(r){return null!=r&&r[e]===t&&(t!==n||e in Ce(r))}}function Co(e,t,r){return t=vn(t===n?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=vn(n.length-t,0),a=we(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=we(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),gt(e,this,s)}}function xo(e,t){return t.length<2?e:Ir(e,ti(t,0,-1))}function ko(e,t){for(var r=e.length,i=yn(t.length,r),o=ki(e);i--;){var a=t[i];e[i]=vo(a,r)?o[a]:n}return e}function So(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Qo=Fo(Zr),_o=ln||function(e,t){return it.setTimeout(e,t)},No=Fo($r);function Do(e,t,n){var r=t+"";return No(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ie,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return yt(f,(function(n){var r="_."+n[0];t&n[1]&&!It(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(oe);return t?t[1].split(ae):[]}(r),n)))}function Fo(e){var t=0,r=0;return function(){var i=mn(),o=16-(i-r);if(r=i,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(n,arguments)}}function Po(e,t){var r=-1,i=e.length,o=i-1;for(t=t===n?i:t;++r<t;){var a=Vr(r,o),s=e[a];e[a]=e[r],e[r]=s}return e.length=t,e}var Uo=function(e){var t=Fa((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace($,(function(e,n,r,i){t.push(r?i.replace(le,"$1"):n||e)})),t}),(function(e){return 500===n.size&&n.clear(),e})),n=t.cache;return t}();function Lo(e){if("string"==typeof e||ss(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function To(e){if(null!=e){try{return Fe.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function Mo(e){if(e instanceof jn)return e.clone();var t=new Kn(e.__wrapped__,e.__chain__);return t.__actions__=ki(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var Ro=Jr((function(e,t){return Va(e)?Ar(e,gr(t,1,Va,!0)):[]})),Oo=Jr((function(e,t){var r=Yo(t);return Va(r)&&(r=n),Va(e)?Ar(e,gr(t,1,Va,!0),ao(r,2)):[]})),Ho=Jr((function(e,t){var r=Yo(t);return Va(r)&&(r=n),Va(e)?Ar(e,gr(t,1,Va,!0),n,r):[]}));function Ko(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:fs(n);return i<0&&(i=vn(r+i,0)),Nt(e,ao(t,3),i)}function jo(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var o=i-1;return r!==n&&(o=fs(r),o=r<0?vn(i+o,0):yn(o,i-1)),Nt(e,ao(t,3),o,!0)}function Go(e){return null!=e&&e.length?gr(e,1):[]}function qo(e){return e&&e.length?e[0]:n}var Vo=Jr((function(e){var t=Et(e,pi);return t.length&&t[0]===e[0]?Sr(t):[]})),zo=Jr((function(e){var t=Yo(e),r=Et(e,pi);return t===Yo(r)?t=n:r.pop(),r.length&&r[0]===e[0]?Sr(r,ao(t,2)):[]})),Jo=Jr((function(e){var t=Yo(e),r=Et(e,pi);return(t="function"==typeof t?t:n)&&r.pop(),r.length&&r[0]===e[0]?Sr(r,n,t):[]}));function Yo(e){var t=null==e?0:e.length;return t?e[t-1]:n}var Xo=Jr(Wo);function Wo(e,t){return e&&e.length&&t&&t.length?Gr(e,t):e}var Zo=eo((function(e,t){var n=null==e?0:e.length,r=or(e,t);return qr(e,Et(t,(function(e){return vo(e,n)?+e:e})).sort(Ei)),r}));function $o(e){return null==e?e:In.call(e)}var ea=Jr((function(e){return ui(gr(e,1,Va,!0))})),ta=Jr((function(e){var t=Yo(e);return Va(t)&&(t=n),ui(gr(e,1,Va,!0),ao(t,2))})),na=Jr((function(e){var t=Yo(e);return t="function"==typeof t?t:n,ui(gr(e,1,Va,!0),n,t)}));function ra(e){if(!e||!e.length)return[];var t=0;return e=bt(e,(function(e){if(Va(e))return t=vn(e.length,t),!0})),Ot(t,(function(t){return Et(e,Lt(t))}))}function ia(e,t){if(!e||!e.length)return[];var r=ra(e);return null==t?r:Et(r,(function(e){return gt(t,n,e)}))}var oa=Jr((function(e,t){return Va(e)?Ar(e,t):[]})),aa=Jr((function(e){return fi(bt(e,Va))})),sa=Jr((function(e){var t=Yo(e);return Va(t)&&(t=n),fi(bt(e,Va),ao(t,2))})),ua=Jr((function(e){var t=Yo(e);return t="function"==typeof t?t:n,fi(bt(e,Va),n,t)})),la=Jr(ra),Aa=Jr((function(e){var t=e.length,r=t>1?e[t-1]:n;return r="function"==typeof r?(e.pop(),r):n,ia(e,r)}));function ca(e){var t=Rn(e);return t.__chain__=!0,t}function ha(e,t){return t(e)}var fa=eo((function(e){var t=e.length,r=t?e[0]:0,i=this.__wrapped__,o=function(t){return or(t,e)};return!(t>1||this.__actions__.length)&&i instanceof jn&&vo(r)?((i=i.slice(r,+r+(t?1:0))).__actions__.push({func:ha,args:[o],thisArg:n}),new Kn(i,this.__chain__).thru((function(e){return t&&!e.length&&e.push(n),e}))):this.thru(o)})),da=Qi((function(e,t,n){Pe.call(e,n)?++e[n]:ir(e,n,1)})),pa=Li(Ko),ga=Li(jo);function va(e,t){return(ja(e)?yt:cr)(e,ao(t,3))}function ya(e,t){return(ja(e)?mt:hr)(e,ao(t,3))}var ma=Qi((function(e,t,n){Pe.call(e,n)?e[n].push(t):ir(e,n,[t])})),wa=Jr((function(e,t,n){var r=-1,i="function"==typeof t,o=qa(e)?we(e.length):[];return cr(e,(function(e){o[++r]=i?gt(t,e,n):Qr(e,t,n)})),o})),ba=Qi((function(e,t,n){ir(e,n,t)}));function Ia(e,t){return(ja(e)?Et:Tr)(e,ao(t,3))}var Ba=Qi((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Ea=Jr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&yo(e,t[0],t[1])?t=[]:n>2&&yo(t[0],t[1],t[2])&&(t=[t[0]]),Kr(e,gr(t,1),[])})),Ca=un||function(){return it.Date.now()};function xa(e,t,r){return t=r?n:t,t=e&&null==t?e.length:t,Yi(e,u,n,n,n,n,t)}function ka(e,t){var i;if("function"!=typeof t)throw new Se(r);return e=fs(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=n),i}}var Sa=Jr((function(e,t,n){var r=1;if(n.length){var i=en(n,oo(Sa));r|=s}return Yi(e,r,t,n,i)})),Qa=Jr((function(e,t,n){var r=3;if(n.length){var i=en(n,oo(Qa));r|=s}return Yi(t,r,e,n,i)}));function _a(e,t,i){var o,a,s,u,l,A,c=0,h=!1,f=!1,d=!0;if("function"!=typeof e)throw new Se(r);function p(t){var r=o,i=a;return o=a=n,c=t,u=e.apply(i,r)}function g(e){return c=e,l=_o(y,t),h?p(e):u}function v(e){var r=e-A;return A===n||r>=t||r<0||f&&e-c>=s}function y(){var e=Ca();if(v(e))return m(e);l=_o(y,function(e){var n=t-(e-A);return f?yn(n,s-(e-c)):n}(e))}function m(e){return l=n,d&&o?p(e):(o=a=n,u)}function w(){var e=Ca(),r=v(e);if(o=arguments,a=this,A=e,r){if(l===n)return g(A);if(f)return wi(l),l=_o(y,t),p(A)}return l===n&&(l=_o(y,t)),u}return t=ps(t)||0,$a(i)&&(h=!!i.leading,s=(f="maxWait"in i)?vn(ps(i.maxWait)||0,t):s,d="trailing"in i?!!i.trailing:d),w.cancel=function(){l!==n&&wi(l),c=0,o=A=a=l=n},w.flush=function(){return l===n?u:m(Ca())},w}var Na=Jr((function(e,t){return lr(e,1,t)})),Da=Jr((function(e,t,n){return lr(e,ps(t)||0,n)}));function Fa(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Se(r);var n=function n(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(Fa.Cache||Vn),n}function Pa(e){if("function"!=typeof e)throw new Se(r);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Fa.Cache=Vn;var Ua=yi((function(e,t){var n=(t=1==t.length&&ja(t[0])?Et(t[0],Kt(ao())):Et(gr(t,1),Kt(ao()))).length;return Jr((function(r){for(var i=-1,o=yn(r.length,n);++i<o;)r[i]=t[i].call(this,r[i]);return gt(e,this,r)}))})),La=Jr((function(e,t){var r=en(t,oo(La));return Yi(e,s,n,t,r)})),Ta=Jr((function(e,t){var r=en(t,oo(Ta));return Yi(e,64,n,t,r)})),Ma=eo((function(e,t){return Yi(e,256,n,n,n,t)}));function Ra(e,t){return e===t||e!=e&&t!=t}var Oa=Gi(Cr),Ha=Gi((function(e,t){return e>=t})),Ka=_r(function(){return arguments}())?_r:function(e){return es(e)&&Pe.call(e,"callee")&&!rt.call(e,"callee")},ja=we.isArray,Ga=At?Kt(At):function(e){return es(e)&&Er(e)==_};function qa(e){return null!=e&&Za(e.length)&&!Xa(e)}function Va(e){return es(e)&&qa(e)}var za=fn||pu,Ja=ct?Kt(ct):function(e){return es(e)&&Er(e)==v};function Ya(e){if(!es(e))return!1;var t=Er(e);return t==y||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!rs(e)}function Xa(e){if(!$a(e))return!1;var t=Er(e);return t==m||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Wa(e){return"number"==typeof e&&e==fs(e)}function Za(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=A}function $a(e){var t=i(e);return null!=e&&("object"==t||"function"==t)}function es(e){return null!=e&&"object"==i(e)}var ts=ht?Kt(ht):function(e){return es(e)&&ho(e)==b};function ns(e){return"number"==typeof e||es(e)&&Er(e)==I}function rs(e){if(!es(e)||Er(e)!=B)return!1;var t=$e(e);if(null===t)return!0;var n=Pe.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Fe.call(n)==Me}var is=ft?Kt(ft):function(e){return es(e)&&Er(e)==C},os=dt?Kt(dt):function(e){return es(e)&&ho(e)==x};function as(e){return"string"==typeof e||!ja(e)&&es(e)&&Er(e)==k}function ss(e){return"symbol"==i(e)||es(e)&&Er(e)==S}var us=pt?Kt(pt):function(e){return es(e)&&Za(e.length)&&!!We[Er(e)]},ls=Gi(Lr),As=Gi((function(e,t){return e<=t}));function cs(e){if(!e)return[];if(qa(e))return as(e)?rn(e):ki(e);if(ut&&e[ut])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[ut]());var t=ho(e);return(t==b?Zt:t==x?tn:Rs)(e)}function hs(e){return e?(e=ps(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function fs(e){var t=hs(e),n=t%1;return t==t?n?t-n:t:0}function ds(e){return e?ar(fs(e),0,h):0}function ps(e){if("number"==typeof e)return e;if(ss(e))return c;if($a(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=$a(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Ht(e);var n=fe.test(e);return n||pe.test(e)?tt(e.slice(2),n?2:8):he.test(e)?c:+e}function gs(e){return Si(e,Ns(e))}function vs(e){return null==e?"":si(e)}var ys=_i((function(e,t){if(Io(t)||qa(t))Si(t,_s(t),e);else for(var n in t)Pe.call(t,n)&&er(e,n,t[n])})),ms=_i((function(e,t){Si(t,Ns(t),e)})),ws=_i((function(e,t,n,r){Si(t,Ns(t),e,r)})),bs=_i((function(e,t,n,r){Si(t,_s(t),e,r)})),Is=eo(or),Bs=Jr((function(e,t){e=Ce(e);var r=-1,i=t.length,o=i>2?t[2]:n;for(o&&yo(t[0],t[1],o)&&(i=1);++r<i;)for(var a=t[r],s=Ns(a),u=-1,l=s.length;++u<l;){var A=s[u],c=e[A];(c===n||Ra(c,Ne[A])&&!Pe.call(e,A))&&(e[A]=a[A])}return e})),Es=Jr((function(e){return e.push(n,Wi),gt(Fs,n,e)}));function Cs(e,t,r){var i=null==e?n:Ir(e,t);return i===n?r:i}function xs(e,t){return null!=e&&fo(e,t,kr)}var ks=Ri((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),e[t]=n}),$s(nu)),Ss=Ri((function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=Te.call(t)),Pe.call(e,t)?e[t].push(n):e[t]=[n]}),ao),Qs=Jr(Qr);function _s(e){return qa(e)?Yn(e):Ur(e)}function Ns(e){return qa(e)?Yn(e,!0):function(e){if(!$a(e))return function(e){var t=[];if(null!=e)for(var n in Ce(e))t.push(n);return t}(e);var t=Io(e),n=[];for(var r in e)("constructor"!=r||!t&&Pe.call(e,r))&&n.push(r);return n}(e)}var Ds=_i((function(e,t,n){Or(e,t,n)})),Fs=_i((function(e,t,n,r){Or(e,t,n,r)})),Ps=eo((function(e,t){var n={};if(null==e)return n;var r=!1;t=Et(t,(function(t){return t=vi(t,e),r||(r=t.length>1),t})),Si(e,no(e),n),r&&(n=sr(n,7,Zi));for(var i=t.length;i--;)li(n,t[i]);return n})),Us=eo((function(e,t){return null==e?{}:function(e,t){return jr(e,t,(function(t,n){return xs(e,n)}))}(e,t)}));function Ls(e,t){if(null==e)return{};var n=Et(no(e),(function(e){return[e]}));return t=ao(t),jr(e,n,(function(e,n){return t(e,n[0])}))}var Ts=Ji(_s),Ms=Ji(Ns);function Rs(e){return null==e?[]:jt(e,_s(e))}var Os=Pi((function(e,t,n){return t=t.toLowerCase(),e+(n?Hs(t):t)}));function Hs(e){return Ys(vs(e).toLowerCase())}function Ks(e){return(e=vs(e))&&e.replace(ve,Jt).replace(Ge,"")}var js=Pi((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Gs=Pi((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),qs=Fi("toLowerCase"),Vs=Pi((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),zs=Pi((function(e,t,n){return e+(n?" ":"")+Ys(t)})),Js=Pi((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Ys=Fi("toUpperCase");function Xs(e,t,r){return e=vs(e),(t=r?n:t)===n?function(e){return Je.test(e)}(e)?function(e){return e.match(Ve)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Ws=Jr((function(e,t){try{return gt(e,n,t)}catch(e){return Ya(e)?e:new Ie(e)}})),Zs=eo((function(e,t){return yt(t,(function(t){t=Lo(t),ir(e,t,Sa(e[t],e))})),e}));function $s(e){return function(){return e}}var eu=Ti(),tu=Ti(!0);function nu(e){return e}function ru(e){return Pr("function"==typeof e?e:sr(e,1))}var iu=Jr((function(e,t){return function(n){return Qr(n,e,t)}})),ou=Jr((function(e,t){return function(n){return Qr(e,n,t)}}));function au(e,t,n){var r=_s(t),i=br(t,r);null!=n||$a(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=br(t,_s(t)));var o=!($a(n)&&"chain"in n&&!n.chain),a=Xa(e);return yt(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),i=n.__actions__=ki(this.__actions__);return i.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Ct([this.value()],arguments))})})),e}function su(){}var uu=Hi(Et),lu=Hi(wt),Au=Hi(St);function cu(e){return mo(e)?Lt(Lo(e)):function(e){return function(t){return Ir(t,e)}}(e)}var hu=ji(),fu=ji(!0);function du(){return[]}function pu(){return!1}var gu,vu=Oi((function(e,t){return e+t}),0),yu=Vi("ceil"),mu=Oi((function(e,t){return e/t}),1),wu=Vi("floor"),bu=Oi((function(e,t){return e*t}),1),Iu=Vi("round"),Bu=Oi((function(e,t){return e-t}),0);return Rn.after=function(e,t){if("function"!=typeof t)throw new Se(r);return e=fs(e),function(){if(--e<1)return t.apply(this,arguments)}},Rn.ary=xa,Rn.assign=ys,Rn.assignIn=ms,Rn.assignInWith=ws,Rn.assignWith=bs,Rn.at=Is,Rn.before=ka,Rn.bind=Sa,Rn.bindAll=Zs,Rn.bindKey=Qa,Rn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return ja(e)?e:[e]},Rn.chain=ca,Rn.chunk=function(e,t,r){t=(r?yo(e,t,r):t===n)?1:vn(fs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,a=0,s=we(An(i/t));o<i;)s[a++]=ti(e,o,o+=t);return s},Rn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var o=e[t];o&&(i[r++]=o)}return i},Rn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=we(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Ct(ja(n)?ki(n):[n],gr(t,1))},Rn.cond=function(e){var t=null==e?0:e.length,n=ao();return e=t?Et(e,(function(e){if("function"!=typeof e[1])throw new Se(r);return[n(e[0]),e[1]]})):[],Jr((function(n){for(var r=-1;++r<t;){var i=e[r];if(gt(i[0],this,n))return gt(i[1],this,n)}}))},Rn.conforms=function(e){return function(e){var t=_s(e);return function(n){return ur(n,e,t)}}(sr(e,1))},Rn.constant=$s,Rn.countBy=da,Rn.create=function(e,t){var n=On(e);return null==t?n:rr(n,t)},Rn.curry=function e(t,r,i){var o=Yi(t,8,n,n,n,n,n,r=i?n:r);return o.placeholder=e.placeholder,o},Rn.curryRight=function e(t,r,i){var o=Yi(t,16,n,n,n,n,n,r=i?n:r);return o.placeholder=e.placeholder,o},Rn.debounce=_a,Rn.defaults=Bs,Rn.defaultsDeep=Es,Rn.defer=Na,Rn.delay=Da,Rn.difference=Ro,Rn.differenceBy=Oo,Rn.differenceWith=Ho,Rn.drop=function(e,t,r){var i=null==e?0:e.length;return i?ti(e,(t=r||t===n?1:fs(t))<0?0:t,i):[]},Rn.dropRight=function(e,t,r){var i=null==e?0:e.length;return i?ti(e,0,(t=i-(t=r||t===n?1:fs(t)))<0?0:t):[]},Rn.dropRightWhile=function(e,t){return e&&e.length?ci(e,ao(t,3),!0,!0):[]},Rn.dropWhile=function(e,t){return e&&e.length?ci(e,ao(t,3),!0):[]},Rn.fill=function(e,t,r,i){var o=null==e?0:e.length;return o?(r&&"number"!=typeof r&&yo(e,t,r)&&(r=0,i=o),function(e,t,r,i){var o=e.length;for((r=fs(r))<0&&(r=-r>o?0:o+r),(i=i===n||i>o?o:fs(i))<0&&(i+=o),i=r>i?0:ds(i);r<i;)e[r++]=t;return e}(e,t,r,i)):[]},Rn.filter=function(e,t){return(ja(e)?bt:pr)(e,ao(t,3))},Rn.flatMap=function(e,t){return gr(Ia(e,t),1)},Rn.flatMapDeep=function(e,t){return gr(Ia(e,t),l)},Rn.flatMapDepth=function(e,t,r){return r=r===n?1:fs(r),gr(Ia(e,t),r)},Rn.flatten=Go,Rn.flattenDeep=function(e){return null!=e&&e.length?gr(e,l):[]},Rn.flattenDepth=function(e,t){return null!=e&&e.length?gr(e,t=t===n?1:fs(t)):[]},Rn.flip=function(e){return Yi(e,512)},Rn.flow=eu,Rn.flowRight=tu,Rn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];r[i[0]]=i[1]}return r},Rn.functions=function(e){return null==e?[]:br(e,_s(e))},Rn.functionsIn=function(e){return null==e?[]:br(e,Ns(e))},Rn.groupBy=ma,Rn.initial=function(e){return null!=e&&e.length?ti(e,0,-1):[]},Rn.intersection=Vo,Rn.intersectionBy=zo,Rn.intersectionWith=Jo,Rn.invert=ks,Rn.invertBy=Ss,Rn.invokeMap=wa,Rn.iteratee=ru,Rn.keyBy=ba,Rn.keys=_s,Rn.keysIn=Ns,Rn.map=Ia,Rn.mapKeys=function(e,t){var n={};return t=ao(t,3),mr(e,(function(e,r,i){ir(n,t(e,r,i),e)})),n},Rn.mapValues=function(e,t){var n={};return t=ao(t,3),mr(e,(function(e,r,i){ir(n,r,t(e,r,i))})),n},Rn.matches=function(e){return Mr(sr(e,1))},Rn.matchesProperty=function(e,t){return Rr(e,sr(t,1))},Rn.memoize=Fa,Rn.merge=Ds,Rn.mergeWith=Fs,Rn.method=iu,Rn.methodOf=ou,Rn.mixin=au,Rn.negate=Pa,Rn.nthArg=function(e){return e=fs(e),Jr((function(t){return Hr(t,e)}))},Rn.omit=Ps,Rn.omitBy=function(e,t){return Ls(e,Pa(ao(t)))},Rn.once=function(e){return ka(2,e)},Rn.orderBy=function(e,t,r,i){return null==e?[]:(ja(t)||(t=null==t?[]:[t]),ja(r=i?n:r)||(r=null==r?[]:[r]),Kr(e,t,r))},Rn.over=uu,Rn.overArgs=Ua,Rn.overEvery=lu,Rn.overSome=Au,Rn.partial=La,Rn.partialRight=Ta,Rn.partition=Ba,Rn.pick=Us,Rn.pickBy=Ls,Rn.property=cu,Rn.propertyOf=function(e){return function(t){return null==e?n:Ir(e,t)}},Rn.pull=Xo,Rn.pullAll=Wo,Rn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?Gr(e,t,ao(n,2)):e},Rn.pullAllWith=function(e,t,r){return e&&e.length&&t&&t.length?Gr(e,t,n,r):e},Rn.pullAt=Zo,Rn.range=hu,Rn.rangeRight=fu,Rn.rearg=Ma,Rn.reject=function(e,t){return(ja(e)?bt:pr)(e,Pa(ao(t,3)))},Rn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],o=e.length;for(t=ao(t,3);++r<o;){var a=e[r];t(a,r,e)&&(n.push(a),i.push(r))}return qr(e,i),n},Rn.rest=function(e,t){if("function"!=typeof e)throw new Se(r);return Jr(e,t=t===n?t:fs(t))},Rn.reverse=$o,Rn.sampleSize=function(e,t,r){return t=(r?yo(e,t,r):t===n)?1:fs(t),(ja(e)?Wn:Xr)(e,t)},Rn.set=function(e,t,n){return null==e?e:Wr(e,t,n)},Rn.setWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:Wr(e,t,r,i)},Rn.shuffle=function(e){return(ja(e)?Zn:ei)(e)},Rn.slice=function(e,t,r){var i=null==e?0:e.length;return i?(r&&"number"!=typeof r&&yo(e,t,r)?(t=0,r=i):(t=null==t?0:fs(t),r=r===n?i:fs(r)),ti(e,t,r)):[]},Rn.sortBy=Ea,Rn.sortedUniq=function(e){return e&&e.length?oi(e):[]},Rn.sortedUniqBy=function(e,t){return e&&e.length?oi(e,ao(t,2)):[]},Rn.split=function(e,t,r){return r&&"number"!=typeof r&&yo(e,t,r)&&(t=r=n),(r=r===n?h:r>>>0)?(e=vs(e))&&("string"==typeof t||null!=t&&!is(t))&&!(t=si(t))&&Wt(e)?mi(rn(e),0,r):e.split(t,r):[]},Rn.spread=function(e,t){if("function"!=typeof e)throw new Se(r);return t=null==t?0:vn(fs(t),0),Jr((function(n){var r=n[t],i=mi(n,0,t);return r&&Ct(i,r),gt(e,this,i)}))},Rn.tail=function(e){var t=null==e?0:e.length;return t?ti(e,1,t):[]},Rn.take=function(e,t,r){return e&&e.length?ti(e,0,(t=r||t===n?1:fs(t))<0?0:t):[]},Rn.takeRight=function(e,t,r){var i=null==e?0:e.length;return i?ti(e,(t=i-(t=r||t===n?1:fs(t)))<0?0:t,i):[]},Rn.takeRightWhile=function(e,t){return e&&e.length?ci(e,ao(t,3),!1,!0):[]},Rn.takeWhile=function(e,t){return e&&e.length?ci(e,ao(t,3)):[]},Rn.tap=function(e,t){return t(e),e},Rn.throttle=function(e,t,n){var i=!0,o=!0;if("function"!=typeof e)throw new Se(r);return $a(n)&&(i="leading"in n?!!n.leading:i,o="trailing"in n?!!n.trailing:o),_a(e,t,{leading:i,maxWait:t,trailing:o})},Rn.thru=ha,Rn.toArray=cs,Rn.toPairs=Ts,Rn.toPairsIn=Ms,Rn.toPath=function(e){return ja(e)?Et(e,Lo):ss(e)?[e]:ki(Uo(vs(e)))},Rn.toPlainObject=gs,Rn.transform=function(e,t,n){var r=ja(e),i=r||za(e)||us(e);if(t=ao(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:$a(e)&&Xa(o)?On($e(e)):{}}return(i?yt:mr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Rn.unary=function(e){return xa(e,1)},Rn.union=ea,Rn.unionBy=ta,Rn.unionWith=na,Rn.uniq=function(e){return e&&e.length?ui(e):[]},Rn.uniqBy=function(e,t){return e&&e.length?ui(e,ao(t,2)):[]},Rn.uniqWith=function(e,t){return t="function"==typeof t?t:n,e&&e.length?ui(e,n,t):[]},Rn.unset=function(e,t){return null==e||li(e,t)},Rn.unzip=ra,Rn.unzipWith=ia,Rn.update=function(e,t,n){return null==e?e:Ai(e,t,gi(n))},Rn.updateWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:Ai(e,t,gi(r),i)},Rn.values=Rs,Rn.valuesIn=function(e){return null==e?[]:jt(e,Ns(e))},Rn.without=oa,Rn.words=Xs,Rn.wrap=function(e,t){return La(gi(t),e)},Rn.xor=aa,Rn.xorBy=sa,Rn.xorWith=ua,Rn.zip=la,Rn.zipObject=function(e,t){return di(e||[],t||[],er)},Rn.zipObjectDeep=function(e,t){return di(e||[],t||[],Wr)},Rn.zipWith=Aa,Rn.entries=Ts,Rn.entriesIn=Ms,Rn.extend=ms,Rn.extendWith=ws,au(Rn,Rn),Rn.add=vu,Rn.attempt=Ws,Rn.camelCase=Os,Rn.capitalize=Hs,Rn.ceil=yu,Rn.clamp=function(e,t,r){return r===n&&(r=t,t=n),r!==n&&(r=(r=ps(r))==r?r:0),t!==n&&(t=(t=ps(t))==t?t:0),ar(ps(e),t,r)},Rn.clone=function(e){return sr(e,4)},Rn.cloneDeep=function(e){return sr(e,5)},Rn.cloneDeepWith=function(e,t){return sr(e,5,t="function"==typeof t?t:n)},Rn.cloneWith=function(e,t){return sr(e,4,t="function"==typeof t?t:n)},Rn.conformsTo=function(e,t){return null==t||ur(e,t,_s(t))},Rn.deburr=Ks,Rn.defaultTo=function(e,t){return null==e||e!=e?t:e},Rn.divide=mu,Rn.endsWith=function(e,t,r){e=vs(e),t=si(t);var i=e.length,o=r=r===n?i:ar(fs(r),0,i);return(r-=t.length)>=0&&e.slice(r,o)==t},Rn.eq=Ra,Rn.escape=function(e){return(e=vs(e))&&z.test(e)?e.replace(q,Yt):e},Rn.escapeRegExp=function(e){return(e=vs(e))&&te.test(e)?e.replace(ee,"\\$&"):e},Rn.every=function(e,t,r){var i=ja(e)?wt:fr;return r&&yo(e,t,r)&&(t=n),i(e,ao(t,3))},Rn.find=pa,Rn.findIndex=Ko,Rn.findKey=function(e,t){return _t(e,ao(t,3),mr)},Rn.findLast=ga,Rn.findLastIndex=jo,Rn.findLastKey=function(e,t){return _t(e,ao(t,3),wr)},Rn.floor=wu,Rn.forEach=va,Rn.forEachRight=ya,Rn.forIn=function(e,t){return null==e?e:vr(e,ao(t,3),Ns)},Rn.forInRight=function(e,t){return null==e?e:yr(e,ao(t,3),Ns)},Rn.forOwn=function(e,t){return e&&mr(e,ao(t,3))},Rn.forOwnRight=function(e,t){return e&&wr(e,ao(t,3))},Rn.get=Cs,Rn.gt=Oa,Rn.gte=Ha,Rn.has=function(e,t){return null!=e&&fo(e,t,xr)},Rn.hasIn=xs,Rn.head=qo,Rn.identity=nu,Rn.includes=function(e,t,n,r){e=qa(e)?e:Rs(e),n=n&&!r?fs(n):0;var i=e.length;return n<0&&(n=vn(i+n,0)),as(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Dt(e,t,n)>-1},Rn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:fs(n);return i<0&&(i=vn(r+i,0)),Dt(e,t,i)},Rn.inRange=function(e,t,r){return t=hs(t),r===n?(r=t,t=0):r=hs(r),function(e,t,n){return e>=yn(t,n)&&e<vn(t,n)}(e=ps(e),t,r)},Rn.invoke=Qs,Rn.isArguments=Ka,Rn.isArray=ja,Rn.isArrayBuffer=Ga,Rn.isArrayLike=qa,Rn.isArrayLikeObject=Va,Rn.isBoolean=function(e){return!0===e||!1===e||es(e)&&Er(e)==g},Rn.isBuffer=za,Rn.isDate=Ja,Rn.isElement=function(e){return es(e)&&1===e.nodeType&&!rs(e)},Rn.isEmpty=function(e){if(null==e)return!0;if(qa(e)&&(ja(e)||"string"==typeof e||"function"==typeof e.splice||za(e)||us(e)||Ka(e)))return!e.length;var t=ho(e);if(t==b||t==x)return!e.size;if(Io(e))return!Ur(e).length;for(var n in e)if(Pe.call(e,n))return!1;return!0},Rn.isEqual=function(e,t){return Nr(e,t)},Rn.isEqualWith=function(e,t,r){var i=(r="function"==typeof r?r:n)?r(e,t):n;return i===n?Nr(e,t,n,r):!!i},Rn.isError=Ya,Rn.isFinite=function(e){return"number"==typeof e&&dn(e)},Rn.isFunction=Xa,Rn.isInteger=Wa,Rn.isLength=Za,Rn.isMap=ts,Rn.isMatch=function(e,t){return e===t||Dr(e,t,uo(t))},Rn.isMatchWith=function(e,t,r){return r="function"==typeof r?r:n,Dr(e,t,uo(t),r)},Rn.isNaN=function(e){return ns(e)&&e!=+e},Rn.isNative=function(e){if(bo(e))throw new Ie("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Fr(e)},Rn.isNil=function(e){return null==e},Rn.isNull=function(e){return null===e},Rn.isNumber=ns,Rn.isObject=$a,Rn.isObjectLike=es,Rn.isPlainObject=rs,Rn.isRegExp=is,Rn.isSafeInteger=function(e){return Wa(e)&&e>=-9007199254740991&&e<=A},Rn.isSet=os,Rn.isString=as,Rn.isSymbol=ss,Rn.isTypedArray=us,Rn.isUndefined=function(e){return e===n},Rn.isWeakMap=function(e){return es(e)&&ho(e)==Q},Rn.isWeakSet=function(e){return es(e)&&"[object WeakSet]"==Er(e)},Rn.join=function(e,t){return null==e?"":pn.call(e,t)},Rn.kebabCase=js,Rn.last=Yo,Rn.lastIndexOf=function(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var o=i;return r!==n&&(o=(o=fs(r))<0?vn(i+o,0):yn(o,i-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Nt(e,Pt,o,!0)},Rn.lowerCase=Gs,Rn.lowerFirst=qs,Rn.lt=ls,Rn.lte=As,Rn.max=function(e){return e&&e.length?dr(e,nu,Cr):n},Rn.maxBy=function(e,t){return e&&e.length?dr(e,ao(t,2),Cr):n},Rn.mean=function(e){return Ut(e,nu)},Rn.meanBy=function(e,t){return Ut(e,ao(t,2))},Rn.min=function(e){return e&&e.length?dr(e,nu,Lr):n},Rn.minBy=function(e,t){return e&&e.length?dr(e,ao(t,2),Lr):n},Rn.stubArray=du,Rn.stubFalse=pu,Rn.stubObject=function(){return{}},Rn.stubString=function(){return""},Rn.stubTrue=function(){return!0},Rn.multiply=bu,Rn.nth=function(e,t){return e&&e.length?Hr(e,fs(t)):n},Rn.noConflict=function(){return it._===this&&(it._=Re),this},Rn.noop=su,Rn.now=Ca,Rn.pad=function(e,t,n){e=vs(e);var r=(t=fs(t))?nn(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Ki(cn(i),n)+e+Ki(An(i),n)},Rn.padEnd=function(e,t,n){e=vs(e);var r=(t=fs(t))?nn(e):0;return t&&r<t?e+Ki(t-r,n):e},Rn.padStart=function(e,t,n){e=vs(e);var r=(t=fs(t))?nn(e):0;return t&&r<t?Ki(t-r,n)+e:e},Rn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),wn(vs(e).replace(ne,""),t||0)},Rn.random=function(e,t,r){if(r&&"boolean"!=typeof r&&yo(e,t,r)&&(t=r=n),r===n&&("boolean"==typeof t?(r=t,t=n):"boolean"==typeof e&&(r=e,e=n)),e===n&&t===n?(e=0,t=1):(e=hs(e),t===n?(t=e,e=0):t=hs(t)),e>t){var i=e;e=t,t=i}if(r||e%1||t%1){var o=bn();return yn(e+o*(t-e+et("1e-"+((o+"").length-1))),t)}return Vr(e,t)},Rn.reduce=function(e,t,n){var r=ja(e)?xt:Mt,i=arguments.length<3;return r(e,ao(t,4),n,i,cr)},Rn.reduceRight=function(e,t,n){var r=ja(e)?kt:Mt,i=arguments.length<3;return r(e,ao(t,4),n,i,hr)},Rn.repeat=function(e,t,r){return t=(r?yo(e,t,r):t===n)?1:fs(t),zr(vs(e),t)},Rn.replace=function(){var e=arguments,t=vs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Rn.result=function(e,t,r){var i=-1,o=(t=vi(t,e)).length;for(o||(o=1,e=n);++i<o;){var a=null==e?n:e[Lo(t[i])];a===n&&(i=o,a=r),e=Xa(a)?a.call(e):a}return e},Rn.round=Iu,Rn.runInContext=e,Rn.sample=function(e){return(ja(e)?Xn:Yr)(e)},Rn.size=function(e){if(null==e)return 0;if(qa(e))return as(e)?nn(e):e.length;var t=ho(e);return t==b||t==x?e.size:Ur(e).length},Rn.snakeCase=Vs,Rn.some=function(e,t,r){var i=ja(e)?St:ni;return r&&yo(e,t,r)&&(t=n),i(e,ao(t,3))},Rn.sortedIndex=function(e,t){return ri(e,t)},Rn.sortedIndexBy=function(e,t,n){return ii(e,t,ao(n,2))},Rn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ri(e,t);if(r<n&&Ra(e[r],t))return r}return-1},Rn.sortedLastIndex=function(e,t){return ri(e,t,!0)},Rn.sortedLastIndexBy=function(e,t,n){return ii(e,t,ao(n,2),!0)},Rn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ri(e,t,!0)-1;if(Ra(e[n],t))return n}return-1},Rn.startCase=zs,Rn.startsWith=function(e,t,n){return e=vs(e),n=null==n?0:ar(fs(n),0,e.length),t=si(t),e.slice(n,n+t.length)==t},Rn.subtract=Bu,Rn.sum=function(e){return e&&e.length?Rt(e,nu):0},Rn.sumBy=function(e,t){return e&&e.length?Rt(e,ao(t,2)):0},Rn.template=function(e,t,r){var i=Rn.templateSettings;r&&yo(e,t,r)&&(t=n),e=vs(e),t=ws({},t,i,Xi);var o,a,s=ws({},t.imports,i.imports,Xi),u=_s(s),l=jt(s,u),A=0,c=t.interpolate||ye,h="__p += '",f=xe((t.escape||ye).source+"|"+c.source+"|"+(c===X?Ae:ye).source+"|"+(t.evaluate||ye).source+"|$","g"),d="//# sourceURL="+(Pe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Xe+"]")+"\n";e.replace(f,(function(t,n,r,i,s,u){return r||(r=i),h+=e.slice(A,u).replace(me,Xt),n&&(o=!0,h+="' +\n__e("+n+") +\n'"),s&&(a=!0,h+="';\n"+s+";\n__p += '"),r&&(h+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),A=u+t.length,t})),h+="';\n";var p=Pe.call(t,"variable")&&t.variable;if(p){if(ue.test(p))throw new Ie("Invalid `variable` option passed into `_.template`")}else h="with (obj) {\n"+h+"\n}\n";h=(a?h.replace(H,""):h).replace(K,"$1").replace(j,"$1;"),h="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+h+"return __p\n}";var g=Ws((function(){return Be(u,d+"return "+h).apply(n,l)}));if(g.source=h,Ya(g))throw g;return g},Rn.times=function(e,t){if((e=fs(e))<1||e>A)return[];var n=h,r=yn(e,h);t=ao(t),e-=h;for(var i=Ot(r,t);++n<e;)t(n);return i},Rn.toFinite=hs,Rn.toInteger=fs,Rn.toLength=ds,Rn.toLower=function(e){return vs(e).toLowerCase()},Rn.toNumber=ps,Rn.toSafeInteger=function(e){return e?ar(fs(e),-9007199254740991,A):0===e?e:0},Rn.toString=vs,Rn.toUpper=function(e){return vs(e).toUpperCase()},Rn.trim=function(e,t,r){if((e=vs(e))&&(r||t===n))return Ht(e);if(!e||!(t=si(t)))return e;var i=rn(e),o=rn(t);return mi(i,qt(i,o),Vt(i,o)+1).join("")},Rn.trimEnd=function(e,t,r){if((e=vs(e))&&(r||t===n))return e.slice(0,on(e)+1);if(!e||!(t=si(t)))return e;var i=rn(e);return mi(i,0,Vt(i,rn(t))+1).join("")},Rn.trimStart=function(e,t,r){if((e=vs(e))&&(r||t===n))return e.replace(ne,"");if(!e||!(t=si(t)))return e;var i=rn(e);return mi(i,qt(i,rn(t))).join("")},Rn.truncate=function(e,t){var r=30,i="...";if($a(t)){var o="separator"in t?t.separator:o;r="length"in t?fs(t.length):r,i="omission"in t?si(t.omission):i}var a=(e=vs(e)).length;if(Wt(e)){var s=rn(e);a=s.length}if(r>=a)return e;var u=r-nn(i);if(u<1)return i;var l=s?mi(s,0,u).join(""):e.slice(0,u);if(o===n)return l+i;if(s&&(u+=l.length-u),is(o)){if(e.slice(u).search(o)){var A,c=l;for(o.global||(o=xe(o.source,vs(ce.exec(o))+"g")),o.lastIndex=0;A=o.exec(c);)var h=A.index;l=l.slice(0,h===n?u:h)}}else if(e.indexOf(si(o),u)!=u){var f=l.lastIndexOf(o);f>-1&&(l=l.slice(0,f))}return l+i},Rn.unescape=function(e){return(e=vs(e))&&V.test(e)?e.replace(G,an):e},Rn.uniqueId=function(e){var t=++Ue;return vs(e)+t},Rn.upperCase=Js,Rn.upperFirst=Ys,Rn.each=va,Rn.eachRight=ya,Rn.first=qo,au(Rn,(gu={},mr(Rn,(function(e,t){Pe.call(Rn.prototype,t)||(gu[t]=e)})),gu),{chain:!1}),Rn.VERSION="4.17.21",yt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Rn[e].placeholder=Rn})),yt(["drop","take"],(function(e,t){jn.prototype[e]=function(r){r=r===n?1:vn(fs(r),0);var i=this.__filtered__&&!t?new jn(this):this.clone();return i.__filtered__?i.__takeCount__=yn(r,i.__takeCount__):i.__views__.push({size:yn(r,h),type:e+(i.__dir__<0?"Right":"")}),i},jn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),yt(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;jn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:ao(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),yt(["head","last"],(function(e,t){var n="take"+(t?"Right":"");jn.prototype[e]=function(){return this[n](1).value()[0]}})),yt(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");jn.prototype[e]=function(){return this.__filtered__?new jn(this):this[n](1)}})),jn.prototype.compact=function(){return this.filter(nu)},jn.prototype.find=function(e){return this.filter(e).head()},jn.prototype.findLast=function(e){return this.reverse().find(e)},jn.prototype.invokeMap=Jr((function(e,t){return"function"==typeof e?new jn(this):this.map((function(n){return Qr(n,e,t)}))})),jn.prototype.reject=function(e){return this.filter(Pa(ao(e)))},jn.prototype.slice=function(e,t){e=fs(e);var r=this;return r.__filtered__&&(e>0||t<0)?new jn(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==n&&(r=(t=fs(t))<0?r.dropRight(-t):r.take(t-e)),r)},jn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},jn.prototype.toArray=function(){return this.take(h)},mr(jn.prototype,(function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),o=Rn[i?"take"+("last"==t?"Right":""):t],a=i||/^find/.test(t);o&&(Rn.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,u=t instanceof jn,l=s[0],A=u||ja(t),c=function(e){var t=o.apply(Rn,Ct([e],s));return i&&h?t[0]:t};A&&r&&"function"==typeof l&&1!=l.length&&(u=A=!1);var h=this.__chain__,f=!!this.__actions__.length,d=a&&!h,p=u&&!f;if(!a&&A){t=p?t:new jn(this);var g=e.apply(t,s);return g.__actions__.push({func:ha,args:[c],thisArg:n}),new Kn(g,h)}return d&&p?e.apply(this,s):(g=this.thru(c),d?i?g.value()[0]:g.value():g)})})),yt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Qe[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Rn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(ja(i)?i:[],e)}return this[n]((function(n){return t.apply(ja(n)?n:[],e)}))}})),mr(jn.prototype,(function(e,t){var n=Rn[t];if(n){var r=n.name+"";Pe.call(_n,r)||(_n[r]=[]),_n[r].push({name:t,func:n})}})),_n[Mi(n,2).name]=[{name:"wrapper",func:n}],jn.prototype.clone=function(){var e=new jn(this.__wrapped__);return e.__actions__=ki(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=ki(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=ki(this.__views__),e},jn.prototype.reverse=function(){if(this.__filtered__){var e=new jn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},jn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=ja(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r<i;){var o=n[r],a=o.size;switch(o.type){case"drop":e+=a;break;case"dropRight":t-=a;break;case"take":t=yn(t,e+a);break;case"takeRight":e=vn(e,t-a)}}return{start:e,end:t}}(0,i,this.__views__),a=o.start,s=o.end,u=s-a,l=r?s:a-1,A=this.__iteratees__,c=A.length,h=0,f=yn(u,this.__takeCount__);if(!n||!r&&i==u&&f==u)return hi(e,this.__actions__);var d=[];e:for(;u--&&h<f;){for(var p=-1,g=e[l+=t];++p<c;){var v=A[p],y=v.iteratee,m=v.type,w=y(g);if(2==m)g=w;else if(!w){if(1==m)continue e;break e}}d[h++]=g}return d},Rn.prototype.at=fa,Rn.prototype.chain=function(){return ca(this)},Rn.prototype.commit=function(){return new Kn(this.value(),this.__chain__)},Rn.prototype.next=function(){this.__values__===n&&(this.__values__=cs(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?n:this.__values__[this.__index__++]}},Rn.prototype.plant=function(e){for(var t,r=this;r instanceof Hn;){var i=Mo(r);i.__index__=0,i.__values__=n,t?o.__wrapped__=i:t=i;var o=i;r=r.__wrapped__}return o.__wrapped__=e,t},Rn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof jn){var t=e;return this.__actions__.length&&(t=new jn(this)),(t=t.reverse()).__actions__.push({func:ha,args:[$o],thisArg:n}),new Kn(t,this.__chain__)}return this.thru($o)},Rn.prototype.toJSON=Rn.prototype.valueOf=Rn.prototype.value=function(){return hi(this.__wrapped__,this.__actions__)},Rn.prototype.first=Rn.prototype.head,ut&&(Rn.prototype[ut]=function(){return this}),Rn}();at?((at.exports=sn)._=sn,ot._=sn):it._=sn}).call(Do)}(Iq,Iq.exports);var Bq=gj.validate,Eq=vj,Cq=yj,xq=cq.exports,kq=Iq.exports,Sq=function(){function e(t){if(s(this,e),!Bq(t))throw new Error("JSON is invalid. Cannot construct Encoder.");this.json=t}return l(e,[{key:"constructRootMap",value:function(){var e=this;return Object.keys(this.json).map((function(t){var n=e.json[t];return"string"==typeof n&&(n=Cq.encode(Xo.from(n,"hex"))),n instanceof Array&&("anchors"===t&&(n=e.constructAnchorsMap(n)),"path"===t&&(n=e.constructPathMap(n))),[Eq.root[t],n]}))}},{key:"constructAnchorsMap",value:function(e){return e.map((function(e){var t=e.split(":");return t.shift(),t.map((function(e,n){return 0===n?[n,Eq.chain[e].id]:1===n?[n,Eq.chain[t[n-1]].networks[e]]:[n,Cq.encode(Xo.from(e,"hex"))]}))}))}},{key:"constructPathMap",value:function(e){return kq.flatten(e.map((function(e){return Object.keys(e).map((function(t){return[Eq.path[t],Cq.encode(Xo.from(e[t],"hex"))]}))})))}},{key:"encode",value:function(){var e=this.constructRootMap(),t=Cq.encode(e);return xq.encode("base58btc",t)}}]),e}(),Qq=vj,_q=yj,Nq=cq.exports,Dq=Iq.exports,Fq=function(){function e(t){if(s(this,e),!Nq.isEncoded(t))throw new Error("Base58 string is invalid. Cannot construct Decoder.");this.base58=t}return l(e,[{key:"constructRootJSON",value:function(e){var t=this,n=Dq.invert(Qq.root);return e.reduce((function(e,r){var i=n[r[0]],o=r[1];return o instanceof Array&&("anchors"===i&&(o=t.constructAnchorsJSON(o)),"path"===i&&(o=t.constructPathJSON(o))),o instanceof Xo&&(o=_q.decode(o).toString("hex")),e[i]=o,e}),{})}},{key:"constructAnchorsJSON",value:function(e){var t=Dq.invertBy(Qq.chain,(function(e){return e.id}));return e.map((function(e){return e.reduce((function(e,n){if(0===n[0])return"".concat(e,":").concat(t[n[1]]);if(1===n[0]){var r=e.split(":").pop();return"".concat(e,":").concat(Dq.invert(Qq.chain[r].networks)[n[1]])}return"".concat(e,":").concat(_q.decode(n[1]).toString("hex"))}),"blink")}))}},{key:"constructPathJSON",value:function(e){var t=Dq.invert(Qq.path);return e.map((function(e){return A({},t[e[0]],_q.decode(e[1]).toString("hex"))}))}},{key:"decode",value:function(){var e=Nq.decode(this.base58),t=_q.decode(e);return this.constructRootJSON(t)}}]),e}(),Pq={Encoder:Sq,Decoder:Fq,Keymap:vj};function Uq(e){var t=Object.keys(Ll).map((function(e){return Ll[e]})).find((function(t){return t.signatureValue===e}));return t}function Lq(e,t){var n=e.findIndex((function(e){return e===t}));n>-1&&e.splice(n,1)}var Tq={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",obi:"https://w3id.org/openbadges#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2017:"sec:MerkleProof2017",RecipientProfile:"bc:RecipientProfile",SignatureLine:"bc:SignatureLine",MerkleProofVerification2017:"bc:MerkleProofVerification2017",recipientProfile:"bc:recipientProfile",signatureLines:"bc:signatureLines",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},subtitle:"bc:subtitle",jobTitle:"schema:jobTitle",creator:{"@id":"dc:creator","@type":"@id"},expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},revoked:{"@id":"sec:expiration","@type":"xsd:dateTime"},CryptographicKey:"sec:Key",signature:"sec:signature",verification:"bc:verification",publicKeys:"bc:publicKeys",ChainpointSHA256v2:"cp:ChainpointSHA256v2",BTCOpReturn:"cp:BTCOpReturn",targetHash:"cp:targetHash",merkleRoot:"cp:merkleRoot",proof:"cp:proof",anchors:"cp:anchors",sourceId:"cp:sourceId",right:"cp:right",left:"cp:left"},"obi:validation":[{"obi:validatesType":"RecipientProfile","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/recipientSchema.json"},{"obi:validatesType":"SignatureLine","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/signatureLineSchema.json"},{"obi:validatesType":"MerkleProof2017","obi:validationSchema":"https://w3id.org/blockcerts/schema/2.0-alpha/merkleProof2017Schema.json"}]},Mq={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",schema:"http://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"bc:created","@type":"xsd:dateTime"},name:{"@id":"schema:name"}}},Rq={"@context":{id:"@id",type:"@type",bc:"https://w3id.org/blockcerts#",cp:"https://w3id.org/chainpoint#",vc:"https://www.w3.org/2018/credentials/v1",schema:"https://schema.org/",sec:"https://w3id.org/security#",xsd:"http://www.w3.org/2001/XMLSchema#",MerkleProof2019:"sec:MerkleProof2019",BlockcertsCredential:"bc:BlockcertsCredential",introductionUrl:{"@id":"bc:introductionUrl","@type":"@id"},metadata:"bc:metadata",display:{"@id":"bc:display","@context":{id:"@id",type:"@type",contentMediaType:{"@id":"bc:contentMediaType","@type":"@id"},contentEncoding:{"@id":"bc:contentEncoding","@type":"@id"},content:{"@id":"bc:content","@type":"@id"}}},CryptographicKey:"sec:Key",domain:"sec:domain",nonce:"sec:nonce",proofValue:"sec:proofValue",assertionMethod:{"@id":"sec:assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"sec:authenticationMethod","@type":"@id","@container":"@set"},proofPurpose:{"@id":"sec:proofPurpose","@type":"@vocab"},verificationMethod:{"@id":"sec:verificationMethod","@type":"@id"},created:{"@id":"https://purl.org/dc/terms/created","@type":"xsd:dateTime"},challenge:"sec:challenge",expires:{"@id":"sec:expiration","@type":"xsd:dateTime"},name:{"@id":"schema:name"},description:{"@id":"schema:description"},email:{"@id":"schema:email"},publicKey:{"@id":"sec:publicKey","@type":"@id"},url:{"@id":"schema:url","@type":"@id"},image:{"@id":"schema:image","@type":"@id"}}};function Oq(e){e=e.trim();for(var t=[],n=0;n<e.length;n+=2)t.push(parseInt(e.substring(n,n+2),16));return t}Of["https://w3id.org/blockcerts/schema/2.0-alpha/context.json"]=Tq,Of["https://www.blockcerts.org/schema/2.0-alpha/context.json"]=Tq,Of["https://www.blockcerts.org/schema/3.0-alpha/context.json"]=Mq,Of["https://w3id.org/blockcerts/schema/3.0-alpha/context.json"]=Mq,Of["https://w3id.org/blockcerts/v3.0-alpha"]=Mq,Of["https://www.blockcerts.org/schema/3.0-beta/context.json"]=Rq,Of["https://w3id.org/blockcerts/schema/3.0-beta/context.json"]=Rq,Of["https://w3id.org/blockcerts/v3.0-beta"]=Rq,Of["https://w3id.org/security/suites/ed25519-2020/v1"]={"@context":{id:"@id",type:"@type","@protected":!0,proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},Ed25519VerificationKey2020:{"@id":"https://w3id.org/security#Ed25519VerificationKey2020","@context":{"@protected":!0,id:"@id",type:"@type",controller:{"@id":"https://w3id.org/security#controller","@type":"@id"},revoked:{"@id":"https://w3id.org/security#revoked","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},publicKeyMultibase:{"@id":"https://w3id.org/security#publicKeyMultibase","@type":"https://w3id.org/security#multibase"}}},Ed25519Signature2020:{"@id":"https://w3id.org/security#Ed25519Signature2020","@context":{"@protected":!0,id:"@id",type:"@type",challenge:"https://w3id.org/security#challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},domain:"https://w3id.org/security#domain",expires:{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},nonce:"https://w3id.org/security#nonce",proofPurpose:{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":!0,id:"@id",type:"@type",assertionMethod:{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},capabilityInvocation:{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},capabilityDelegation:{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},keyAgreement:{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},proofValue:{"@id":"https://w3id.org/security#proofValue","@type":"https://w3id.org/security#multibase"},verificationMethod:{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}}}};var Hq=function(e){c(n,e);var t=b(n);function n(e,r){var i;return s(this,n),(i=t.call(this,r)).stepCode=e,i}return l(n)}(g(Error)),Kq="en-US",jq={"en-US":{errors:{ensureHashesEqual:"Computed hash does not match remote hash",ensureMerkleRootEqual:"Merkle root does not match remote hash.",ensureValidReceipt:"The receipt is malformed. There was a problem navigating the merkle tree in the receipt.",failedJsonLdNormalization:"Failed JSON-LD normalization",foundUnmappedFields:"Found unmapped fields during JSON-LD normalization",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Cannot verify this certificate without a transaction ID to compare against.",invalidMerkleReceipt:"Invalid Merkle Receipt. Proof hash did not match Merkle root",isTransactionIdValid:"Cannot verify this certificate without a transaction ID to compare against.",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},fr:{errors:{ensureHashesEqual:"Calcul du hash local différent du hash distant",ensureMerkleRootEqual:"Le Merkle root ne correspond pas au hash distant",ensureValidReceipt:"Erreur d'écriture du reçu. Un problème est survenu lors de la navigation de l'arbre Merkle du reçu.",failedJsonLdNormalization:"Erreur de normalisation JSON-LD",foundUnmappedFields:"Champs non liés découverts durant la normalisation JSON-LD",identityErrorBaseMessage:"Identité de l'émetteur invalide",deriveIssuingAddressFromPublicKey:"Cette blockchain n'est pas supportée pour la vérification de l'identité décentralisée.",compareIssuingAddress:"La méthode de vérification n'a pas permis d'établir l'identité de l'émetteur.",getTransactionId:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",invalidMerkleReceipt:"Reçu Merkle invalide. Hash de preuve différent du Merkle root",isTransactionIdValid:"Impossible de vérifier ce certificat sans un identifiant de transaction valide",noProofSpecified:"La propriété 'proof' du document est un tableau mais aucune preuve n'a été passée pour savoir ce qu'il faut vérifier"}},es:{errors:{ensureHashesEqual:"La cadena binaria calculada no corresponde con la cadena binaria remota",ensureMerkleRootEqual:"La raíz Merkle no corresponde con la cadena binaria remota",ensureValidReceipt:"El recibo está malformado. Hubo un problema navegando el árbol Merkle en el recibo",failedJsonLdNormalization:"La normalización del JSON-LD ha fallado",foundUnmappedFields:"Se han encontrado campos no mapeados durante la normalización de JSON-LD",identityErrorBaseMessage:"Identitad del emisor inválida",deriveIssuingAddressFromPublicKey:"No se puede validar la identitad decentalisada con esta cadena binaria.",compareIssuingAddress:"El metodo de verificación no corresponde a la identitad del emisor.",getTransactionId:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",invalidMerkleReceipt:"Recibo Merkle inválido. La cadena binaria de prueba no corresponde con la raíz Merkle",isTransactionIdValid:"No se puede verificar este certificado sin una identificación de transacción que sirva como comparación",noProofSpecified:"La propiedad 'proof' del documento es una lista, pero no prueba especifica ha sido declarada para conocer el punto de verificación"}},mt:{errors:{ensureHashesEqual:"Il-hash ikkalkulat ma jikkorrispondix mar-remote hash",ensureMerkleRootEqual:"Merkle root ma taqbilx mar-remote hash",ensureValidReceipt:"L-irċevuta hija malformata. Kien hemm problema fin-navigazzjoni tal-merkle tree fl-irċevuta",failedJsonLdNormalization:"In-normalizzazzjoni ta' JSON-LD ma rnexxietx",foundUnmappedFields:"Instabu unmapped fields matul in-normalizzazzjoni JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",invalidMerkleReceipt:"Irċevuta Merkle invalida. Il-proof hash ma kienx jaqbel mal-Merkle root",isTransactionIdValid:"Dan iċ-ċertifikat ma jistax jiġi vverifikat mingħajr ID ta' tranżazzjoni mqabbla miegħu",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},"it-IT":{errors:{ensureHashesEqual:"L'hash calcolato non corrisponde all'hash remoto",ensureMerkleRootEqual:"La radice di Merkle non corrisponde all'hash remoto.",ensureValidReceipt:"La ricevuta è malformata. C'è stato un problema nella navigazione dell'albero di Merkle nella ricevuta.",failedJsonLdNormalization:"Normalizzazione JSON-LD fallita",foundUnmappedFields:"Campi non mappati trovati durante la normalizzazione JSON-LD",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",invalidMerkleReceipt:"Ricevuta Merkle non valida. L'hash di prova non corrisponde alla radice di Merkle",isTransactionIdValid:"Impossibile verificare questo certificato senza un ID transazione da confrontare.",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}},ja:{errors:{ensureHashesEqual:"算出されたハッシュがリモートハッシュと一致しませんでした",ensureMerkleRootEqual:"Merkle rootがリモートハッシュと一致しませんでした",ensureValidReceipt:"レシートが異常です。レシート内のMerkle treeを辿る際に問題が発生しました。",failedJsonLdNormalization:"JSON-LDの正規化に失敗しました",foundUnmappedFields:"JSON-LDの正規化時にマップされていないフィールドを検出しました",identityErrorBaseMessage:"Issuer identity mismatch",deriveIssuingAddressFromPublicKey:"Unsupported blockchain for DID verification",compareIssuingAddress:"The provided verification method does not match the issuer identity",getTransactionId:"照合のための取引IDがないため、この証明書を認証できません。",invalidMerkleReceipt:"Merkleレシートが無効です。証明ハッシュがMerkle rootと一致しませんでした。",isTransactionIdValid:"照合するための取引IDがないため、この証明書を認証できません。",noProofSpecified:"Document proof is an array but no target proof was specified to know what to verify."}}};function Gq(e,t){return e&&t?jq[Kq]?jq[Kq][e]?jq[Kq][e][t]?jq[Kq][e][t]||"":"[missing locale item data]":"[missing locale group data]":"[missing locale data]":""}var qq=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}u((r=r.apply(e,t||[])).next())}))};function Vq(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){};return qq(this,void 0,void 0,r().mark((function i(){var o,a,s,u,l;return r().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(e["@context"].find((function(e){return(t=e)===Object(t)&&"@vocab"in e;var t}))||e["@context"].push({"@vocab":"http://fallback.org/"}),o=JSON.parse(JSON.stringify(e)),!Array.isArray(o.proof)){i.next=9;break}if(t){i.next=5;break}throw new Hq("computeLocalHash",Gq("errors","noProofSpecified"));case 5:a=o.proof.findIndex((function(e){return e.proofValue===t.proofValue})),o.proof=o.proof.slice(0,a),i.next=10;break;case 9:delete o.proof;case 10:return s={algorithm:"URDNA2015",format:"application/nquads",documentLoader:function(e){return qq(this,void 0,void 0,r().mark((function t(){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=null!=n,!t.t0){t.next=4;break}return t.next=4,n(e);case 4:return t.abrupt("return",e in Of?{contextUrl:null,document:Of[e],documentUrl:e}:rw.documentLoader(e));case 5:case"end":return t.stop()}}),t)})))}},i.prev=11,i.next=14,rw.normalize(o,s);case 14:u=i.sent,i.next=20;break;case 17:throw i.prev=17,i.t0=i.catch(11),console.error(i.t0),new Hq("computeLocalHash",Gq("errors","failedJsonLdNormalization"));case 20:if(l=function(e){var t=e.split("\n"),n=/<http:\/\/fallback\.org\/(.*)>/,r=t.map((function(e){return n.exec(e)})).filter((function(e){return null!=e}));if(r.length>0){var i=r.map((function(e){return e[1]})).sort();return Array.from(new Set(i))}return null}(u),!l){i.next=23;break}throw new Hq("computeLocalHash","".concat(Gq("errors","foundUnmappedFields"),": ").concat(l.join(", ")));case 23:return i.abrupt("return",qO(function(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t.push(r):r<2048?t.push(192|r>>6,128|63&r):r<55296||r>=57344?t.push(224|r>>12,128|r>>6&63,128|63&r):(n++,r=65536+((1023&r)<<10|1023&e.charCodeAt(n)),t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r))}return t}(u)));case 24:case"end":return i.stop()}}),i,null,[[11,17]])})))}var zq=Xo,Jq={},Yq={},Xq={};Object.defineProperty(Xq,"__esModule",{value:!0}),Xq.testnet=Xq.regtest=Xq.bitcoin=void 0,Xq.bitcoin={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128},Xq.regtest={messagePrefix:"Bitcoin Signed Message:\n",bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239},Xq.testnet={messagePrefix:"Bitcoin Signed Message:\n",bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239};var Wq={},Zq={},$q={},eV={};Object.defineProperty(eV,"__esModule",{value:!0}),eV.encode=eV.decode=eV.check=void 0,eV.check=function(e){if(e.length<8)return!1;if(e.length>72)return!1;if(48!==e[0])return!1;if(e[1]!==e.length-2)return!1;if(2!==e[2])return!1;var t=e[3];if(0===t)return!1;if(5+t>=e.length)return!1;if(2!==e[4+t])return!1;var n=e[5+t];return!(0===n||6+t+n!==e.length||128&e[4]||t>1&&0===e[4]&&!(128&e[5])||128&e[t+6]||n>1&&0===e[t+6]&&!(128&e[t+7]))},eV.decode=function(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(48!==e[0])throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(2!==e[2])throw new Error("Expected DER integer");var t=e[3];if(0===t)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(2!==e[4+t])throw new Error("Expected DER integer (2)");var n=e[5+t];if(0===n)throw new Error("S length is zero");if(6+t+n!==e.length)throw new Error("S length is invalid");if(128&e[4])throw new Error("R value is negative");if(t>1&&0===e[4]&&!(128&e[5]))throw new Error("R value excessively padded");if(128&e[t+6])throw new Error("S value is negative");if(n>1&&0===e[t+6]&&!(128&e[t+7]))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}},eV.encode=function(e,t){var n=e.length,r=t.length;if(0===n)throw new Error("R length is zero");if(0===r)throw new Error("S length is zero");if(n>33)throw new Error("R length is too long");if(r>33)throw new Error("S length is too long");if(128&e[0])throw new Error("R value is negative");if(128&t[0])throw new Error("S value is negative");if(n>1&&0===e[0]&&!(128&e[1]))throw new Error("R value excessively padded");if(r>1&&0===t[0]&&!(128&t[1]))throw new Error("S value excessively padded");var i=Xo.allocUnsafe(6+n+r);return i[0]=48,i[1]=i.length-2,i[2]=2,i[3]=e.length,e.copy(i,4),i[4+n]=2,i[5+n]=t.length,t.copy(i,6+n),i};var tV={};Object.defineProperty(tV,"__esModule",{value:!0}),tV.REVERSE_OPS=tV.OPS=void 0;var nV={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};tV.OPS=nV;var rV={};tV.REVERSE_OPS=rV;for(var iV=0,oV=Object.keys(nV);iV<oV.length;iV++){var aV=oV[iV];rV[nV[aV]]=aV}var sV={};Object.defineProperty(sV,"__esModule",{value:!0}),sV.decode=sV.encode=sV.encodingLength=void 0;var uV=tV;function lV(e){return e<uV.OPS.OP_PUSHDATA1?1:e<=255?2:e<=65535?3:5}sV.encodingLength=lV,sV.encode=function(e,t,n){var r=lV(t);return 1===r?e.writeUInt8(t,n):2===r?(e.writeUInt8(uV.OPS.OP_PUSHDATA1,n),e.writeUInt8(t,n+1)):3===r?(e.writeUInt8(uV.OPS.OP_PUSHDATA2,n),e.writeUInt16LE(t,n+1)):(e.writeUInt8(uV.OPS.OP_PUSHDATA4,n),e.writeUInt32LE(t,n+1)),r},sV.decode=function(e,t){var n,r,i=e.readUInt8(t);if(i<uV.OPS.OP_PUSHDATA1)n=i,r=1;else if(i===uV.OPS.OP_PUSHDATA1){if(t+2>e.length)return null;n=e.readUInt8(t+1),r=2}else if(i===uV.OPS.OP_PUSHDATA2){if(t+3>e.length)return null;n=e.readUInt16LE(t+1),r=3}else{if(t+5>e.length)return null;if(i!==uV.OPS.OP_PUSHDATA4)throw new Error("Unexpected opcode");n=e.readUInt32LE(t+1),r=5}return{opcode:i,number:n,size:r}};var AV={};Object.defineProperty(AV,"__esModule",{value:!0}),AV.encode=AV.decode=void 0,AV.decode=function(e,t,n){t=t||4,n=void 0===n||n;var r=e.length;if(0===r)return 0;if(r>t)throw new TypeError("Script number overflow");if(n&&0==(127&e[r-1])&&(r<=1||0==(128&e[r-2])))throw new Error("Non-minimally encoded script number");if(5===r){var i=e.readUInt32LE(0),o=e.readUInt8(4);return 128&o?-(4294967296*(-129&o)+i):4294967296*o+i}for(var a=0,s=0;s<r;++s)a|=e[s]<<8*s;return 128&e[r-1]?-(a&~(128<<8*(r-1))):a},AV.encode=function(e){for(var t,n=Math.abs(e),r=(t=n)>2147483647?5:t>8388607?4:t>32767?3:t>127?2:t>0?1:0,i=Xo.allocUnsafe(r),o=e<0,a=0;a<r;++a)i.writeUInt8(255&n,a),n>>=8;return 128&i[r-1]?i.writeUInt8(o?128:0,r-1):o&&(i[r-1]|=128),i};var cV={},hV={},fV={Array:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){return null!=e&&e.constructor===Array})),Boolean:function(e){return"boolean"==typeof e},Function:function(e){return"function"==typeof e},Nil:function(e){return null==e},Number:function(e){return"number"==typeof e},Object:function(e){return"object"==i(e)},String:function(e){return"string"==typeof e},"":function(){return!0}};for(var dV in fV.Null=fV.Nil,fV)fV[dV].toJSON=function(e){return e}.bind(null,dV);var pV=fV,gV=pV;function vV(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function yV(e){return gV.Nil(e)?"":vV(e.constructor)}function mV(e,t){Error.captureStackTrace&&Error.captureStackTrace(e,t)}function wV(e){return gV.Function(e)?e.toJSON?e.toJSON():vV(e):gV.Array(e)?"Array":e&&gV.Object(e)?"Object":void 0!==e?e:""}function bV(e,t,n){var r=function(e){return gV.Function(e)?"":gV.String(e)?JSON.stringify(e):e&&gV.Object(e)?"":e}(t);return"Expected "+wV(e)+", got"+(""!==n?" "+n:"")+(""!==r?" "+r:"")}function IV(e,t,n){n=n||yV(t),this.message=bV(e,t,n),mV(this,IV),this.__type=e,this.__value=t,this.__valueTypeName=n}function BV(e,t,n,r,i){e?(i=i||yV(r),this.message=function(e,t,n,r,i){var o='" of type ';return"key"===t&&(o='" with key type '),bV('property "'+wV(n)+o+wV(e),r,i)}(e,n,t,r,i)):this.message='Unexpected property "'+t+'"',mV(this,IV),this.__label=n,this.__property=t,this.__type=e,this.__value=r,this.__valueTypeName=i}IV.prototype=Object.create(Error.prototype),IV.prototype.constructor=IV,BV.prototype=Object.create(Error.prototype),BV.prototype.constructor=IV;var EV={TfTypeError:IV,TfPropertyTypeError:BV,tfCustomError:function(e,t){return new IV(e,{},t)},tfSubError:function(e,t,n){return e instanceof BV?(t=t+"."+e.__property,e=new BV(e.__type,t,e.__label,e.__value,e.__valueTypeName)):e instanceof IV&&(e=new BV(e.__type,t,n,e.__value,e.__valueTypeName)),mV(e),e},tfJSON:wV,getValueTypeName:yV},CV=pV,xV=EV;function kV(e){return Da(e)}function SV(e){return"string"==typeof e&&/^([0-9a-f]{2})+$/i.test(e)}function QV(e,t){var n=e.toJSON();function r(r){if(!e(r))return!1;if(r.length===t)return!0;throw xV.tfCustomError(n+"(Length: "+t+")",n+"(Length: "+r.length+")")}return r.toJSON=function(){return n},r}var _V=QV.bind(null,CV.Array),NV=QV.bind(null,kV),DV=QV.bind(null,SV),FV=QV.bind(null,CV.String),PV=Math.pow(2,53)-1,UV={ArrayN:_V,Buffer:kV,BufferN:NV,Finite:function(e){return"number"==typeof e&&isFinite(e)},Hex:SV,HexN:DV,Int8:function(e){return e<<24>>24===e},Int16:function(e){return e<<16>>16===e},Int32:function(e){return(0|e)===e},Int53:function(e){return"number"==typeof e&&e>=-PV&&e<=PV&&Math.floor(e)===e},Range:function(e,t,n){function r(r,i){return n(r,i)&&r>e&&r<t}return n=n||CV.Number,r.toJSON=function(){return"".concat(n.toJSON()," between [").concat(e,", ").concat(t,"]")},r},StringN:FV,UInt8:function(e){return(255&e)===e},UInt16:function(e){return(65535&e)===e},UInt32:function(e){return e>>>0===e},UInt53:function(e){return"number"==typeof e&&e>=0&&e<=PV&&Math.floor(e)===e}};for(var LV in UV)UV[LV].toJSON=function(e){return e}.bind(null,LV);var TV=UV,MV=pV,RV=EV.tfJSON,OV=EV.TfTypeError,HV=EV.TfPropertyTypeError,KV=EV.tfSubError,jV=EV.getValueTypeName,GV={arrayOf:function(e,t){function n(n,r){return!!MV.Array(n)&&!MV.Nil(n)&&!(void 0!==t.minLength&&n.length<t.minLength)&&!(void 0!==t.maxLength&&n.length>t.maxLength)&&(void 0===t.length||n.length===t.length)&&n.every((function(t,n){try{return VV(e,t,r)}catch(e){throw KV(e,n)}}))}return e=qV(e),t=t||{},n.toJSON=function(){var n="["+RV(e)+"]";return void 0!==t.length?n+="{"+t.length+"}":void 0===t.minLength&&void 0===t.maxLength||(n+="{"+(void 0===t.minLength?0:t.minLength)+","+(void 0===t.maxLength?1/0:t.maxLength)+"}"),n},n},maybe:function e(t){function n(n,r){return MV.Nil(n)||t(n,r,e)}return t=qV(t),n.toJSON=function(){return"?"+RV(t)},n},map:function(e,t){function n(n,r){if(!MV.Object(n))return!1;if(MV.Nil(n))return!1;for(var i in n){try{t&&VV(t,i,r)}catch(e){throw KV(e,i,"key")}try{var o=n[i];VV(e,o,r)}catch(e){throw KV(e,i)}}return!0}return e=qV(e),t&&(t=qV(t)),n.toJSON=t?function(){return"{"+RV(t)+": "+RV(e)+"}"}:function(){return"{"+RV(e)+"}"},n},object:function(e){var t={};for(var n in e)t[n]=qV(e[n]);function r(e,n){if(!MV.Object(e))return!1;if(MV.Nil(e))return!1;var r;try{for(r in t)VV(t[r],e[r],n)}catch(e){throw KV(e,r)}if(n)for(r in e)if(!t[r])throw new HV(void 0,r);return!0}return r.toJSON=function(){return RV(t)},r},anyOf:function(){var e=[].slice.call(arguments).map(qV);function t(t,n){return e.some((function(e){try{return VV(e,t,n)}catch(e){return!1}}))}return t.toJSON=function(){return e.map(RV).join("|")},t},allOf:function(){var e=[].slice.call(arguments).map(qV);function t(t,n){return e.every((function(e){try{return VV(e,t,n)}catch(e){return!1}}))}return t.toJSON=function(){return e.map(RV).join(" & ")},t},quacksLike:function(e){function t(t){return e===jV(t)}return t.toJSON=function(){return e},t},tuple:function(){var e=[].slice.call(arguments).map(qV);function t(t,n){return!MV.Nil(t)&&!MV.Nil(t.length)&&(!n||t.length===e.length)&&e.every((function(e,r){try{return VV(e,t[r],n)}catch(e){throw KV(e,r)}}))}return t.toJSON=function(){return"("+e.map(RV).join(", ")+")"},t},value:function(e){function t(t){return t===e}return t.toJSON=function(){return e},t}};function qV(e){if(MV.String(e))return"?"===e[0]?GV.maybe(e.slice(1)):MV[e]||GV.quacksLike(e);if(e&&MV.Object(e)){if(MV.Array(e)){if(1!==e.length)throw new TypeError("Expected compile() parameter of type Array of length 1");return GV.arrayOf(e[0])}return GV.object(e)}return MV.Function(e)?e:GV.value(e)}function VV(e,t,n,r){if(MV.Function(e)){if(e(t,n))return!0;throw new OV(r||e,t)}return VV(qV(e),t,n)}for(var zV in GV.oneOf=GV.anyOf,MV)VV[zV]=MV[zV];for(zV in GV)VV[zV]=GV[zV];var JV=TV;for(zV in JV)VV[zV]=JV[zV];VV.compile=qV,VV.TfTypeError=OV,VV.TfPropertyTypeError=HV;var YV=VV;!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.oneOf=e.Null=e.BufferN=e.Function=e.UInt32=e.UInt8=e.tuple=e.maybe=e.Hex=e.Buffer=e.String=e.Boolean=e.Array=e.Number=e.Hash256bit=e.Hash160bit=e.Buffer256bit=e.Network=e.ECPoint=e.Satoshi=e.Signer=e.BIP32Path=e.UInt31=e.isPoint=e.typeforce=void 0;var t=Pa;e.typeforce=YV;var n=t.Buffer.alloc(32,0),r=t.Buffer.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex");e.isPoint=function(e){if(!t.Buffer.isBuffer(e))return!1;if(e.length<33)return!1;var i=e[0],o=e.slice(1,33);if(0===o.compare(n))return!1;if(o.compare(r)>=0)return!1;if((2===i||3===i)&&33===e.length)return!0;var a=e.slice(33);return 0!==a.compare(n)&&!(a.compare(r)>=0)&&4===i&&65===e.length};var i=Math.pow(2,31)-1;function o(t){return e.typeforce.String(t)&&!!t.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}e.UInt31=function(t){return e.typeforce.UInt32(t)&&t<=i},e.BIP32Path=o,o.toJSON=function(){return"BIP32 derivation path"},e.Signer=function(t){return(e.typeforce.Buffer(t.publicKey)||"function"==typeof t.getPublicKey)&&"function"==typeof t.sign},e.Satoshi=function(t){return e.typeforce.UInt53(t)&&t<=21e14},e.ECPoint=e.typeforce.quacksLike("Point"),e.Network=e.typeforce.compile({messagePrefix:e.typeforce.oneOf(e.typeforce.Buffer,e.typeforce.String),bip32:{public:e.typeforce.UInt32,private:e.typeforce.UInt32},pubKeyHash:e.typeforce.UInt8,scriptHash:e.typeforce.UInt8,wif:e.typeforce.UInt8}),e.Buffer256bit=e.typeforce.BufferN(32),e.Hash160bit=e.typeforce.BufferN(20),e.Hash256bit=e.typeforce.BufferN(32),e.Number=e.typeforce.Number,e.Array=e.typeforce.Array,e.Boolean=e.typeforce.Boolean,e.String=e.typeforce.String,e.Buffer=e.typeforce.Buffer,e.Hex=e.typeforce.Hex,e.maybe=e.typeforce.maybe,e.tuple=e.typeforce.tuple,e.UInt8=e.typeforce.UInt8,e.UInt32=e.typeforce.UInt32,e.Function=e.typeforce.Function,e.BufferN=e.typeforce.BufferN,e.Null=e.typeforce.Null,e.oneOf=e.typeforce.oneOf}(hV),Object.defineProperty(cV,"__esModule",{value:!0}),cV.encode=cV.decode=void 0;var XV=eV,WV=hV,ZV=WV.typeforce,$V=Xo.alloc(1,0);function ez(e){for(var t=0;0===e[t];)++t;return t===e.length?$V:128&(e=e.slice(t))[0]?Xo.concat([$V,e],1+e.length):e}function tz(e){0===e[0]&&(e=e.slice(1));var t=Xo.alloc(32,0),n=Math.max(0,32-e.length);return e.copy(t,n),t}cV.decode=function(e){var t=e.readUInt8(e.length-1),n=-129&t;if(n<=0||n>=4)throw new Error("Invalid hashType "+t);var r=XV.decode(e.slice(0,-1)),i=tz(r.r),o=tz(r.s);return{signature:Xo.concat([i,o],64),hashType:t}},cV.encode=function(e,t){ZV({signature:WV.BufferN(64),hashType:WV.UInt8},{signature:e,hashType:t});var n=-129&t;if(n<=0||n>=4)throw new Error("Invalid hashType "+t);var r=Xo.allocUnsafe(1);r.writeUInt8(t,0);var i=ez(e.slice(0,32)),o=ez(e.slice(32,64));return Xo.concat([XV.encode(i,o),r])},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.signature=e.number=e.isCanonicalScriptSignature=e.isDefinedHashType=e.isCanonicalPubKey=e.toStack=e.fromASM=e.toASM=e.decompile=e.compile=e.isPushOnly=e.OPS=void 0;var t=eV,n=tV;Object.defineProperty(e,"OPS",{enumerable:!0,get:function(){return n.OPS}});var r=sV,i=AV,o=cV,a=hV,s=a.typeforce,u=n.OPS.OP_RESERVED;function l(e){return a.Buffer(e)||function(e){return a.Number(e)&&(e===n.OPS.OP_0||e>=n.OPS.OP_1&&e<=n.OPS.OP_16||e===n.OPS.OP_1NEGATE)}(e)}function A(e){return a.Array(e)&&e.every(l)}function c(e){return 0===e.length?n.OPS.OP_0:1===e.length?e[0]>=1&&e[0]<=16?u+e[0]:129===e[0]?n.OPS.OP_1NEGATE:void 0:void 0}function h(e){return Da(e)}function f(e){return Da(e)}function d(e){if(h(e))return e;s(a.Array,e);var t=e.reduce((function(e,t){return f(t)?1===t.length&&void 0!==c(t)?e+1:e+r.encodingLength(t.length)+t.length:e+1}),0),n=Xo.allocUnsafe(t),i=0;if(e.forEach((function(e){if(f(e)){var t=c(e);if(void 0!==t)return n.writeUInt8(t,i),void(i+=1);i+=r.encode(n,e.length,i),e.copy(n,i),i+=e.length}else n.writeUInt8(e,i),i+=1})),i!==n.length)throw new Error("Could not decode chunks");return n}function p(e){if(t=e,a.Array(t))return e;var t;s(a.Buffer,e);for(var i=[],o=0;o<e.length;){var u=e[o];if(u>n.OPS.OP_0&&u<=n.OPS.OP_PUSHDATA4){var l=r.decode(e,o);if(null===l)return null;if((o+=l.size)+l.number>e.length)return null;var A=e.slice(o,o+l.number);o+=l.number;var h=c(A);void 0!==h?i.push(h):i.push(A)}else i.push(u),o+=1}return i}function g(e){var t=-129&e;return t>0&&t<4}e.isPushOnly=A,e.compile=d,e.decompile=p,e.toASM=function(e){return h(e)&&(e=p(e)),e.map((function(e){if(f(e)){var t=c(e);if(void 0===t)return e.toString("hex");e=t}return n.REVERSE_OPS[e]})).join(" ")},e.fromASM=function(e){return s(a.String,e),d(e.split(" ").map((function(e){return void 0!==n.OPS[e]?n.OPS[e]:(s(a.Hex,e),Xo.from(e,"hex"))})))},e.toStack=function(e){return e=p(e),s(A,e),e.map((function(e){return f(e)?e:e===n.OPS.OP_0?Xo.allocUnsafe(0):i.encode(e-u)}))},e.isCanonicalPubKey=function(e){return a.isPoint(e)},e.isDefinedHashType=g,e.isCanonicalScriptSignature=function(e){return!!Da(e)&&!!g(e[e.length-1])&&t.check(e.slice(0,-1))},e.number=i,e.signature=o}($q);var nz={};Object.defineProperty(nz,"__esModule",{value:!0}),nz.value=nz.prop=void 0,nz.prop=function(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:function(){var e=n.call(this);return this[t]=e,e},set:function(e){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:e,writable:!0})}})},nz.value=function(e){var t;return function(){return void 0!==t||(t=e()),t}},Object.defineProperty(Zq,"__esModule",{value:!0}),Zq.p2data=void 0;var rz=Xq,iz=$q,oz=hV,az=nz,sz=iz.OPS;Zq.p2data=function(e,t){if(!e.data&&!e.output)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,oz.typeforce)({network:oz.typeforce.maybe(oz.typeforce.Object),output:oz.typeforce.maybe(oz.typeforce.Buffer),data:oz.typeforce.maybe(oz.typeforce.arrayOf(oz.typeforce.Buffer))},e);var n={name:"embed",network:e.network||rz.bitcoin};if(az.prop(n,"output",(function(){if(e.data)return iz.compile([sz.OP_RETURN].concat(e.data))})),az.prop(n,"data",(function(){if(e.output)return iz.decompile(e.output).slice(1)})),t.validate&&e.output){var r=iz.decompile(e.output);if(r[0]!==sz.OP_RETURN)throw new TypeError("Output is invalid");if(!r.slice(1).every(oz.typeforce.Buffer))throw new TypeError("Output is invalid");if(e.data&&!function(e,t){return e.length===t.length&&e.every((function(e,n){return e.equals(t[n])}))}(e.data,n.data))throw new TypeError("Data mismatch")}return Object.assign(n,e)};var uz={};Object.defineProperty(uz,"__esModule",{value:!0}),uz.p2ms=void 0;var lz=Xq,Az=$q,cz=hV,hz=nz,fz=Az.OPS,dz=fz.OP_RESERVED;function pz(e,t){return e.length===t.length&&e.every((function(e,n){return e.equals(t[n])}))}uz.p2ms=function(e,t){if(!(e.input||e.output||e.pubkeys&&void 0!==e.m||e.signatures))throw new TypeError("Not enough data");function n(e){return Az.isCanonicalScriptSignature(e)||void 0!==(t.allowIncomplete&&e===fz.OP_0)}t=Object.assign({validate:!0},t||{}),(0,cz.typeforce)({network:cz.typeforce.maybe(cz.typeforce.Object),m:cz.typeforce.maybe(cz.typeforce.Number),n:cz.typeforce.maybe(cz.typeforce.Number),output:cz.typeforce.maybe(cz.typeforce.Buffer),pubkeys:cz.typeforce.maybe(cz.typeforce.arrayOf(cz.isPoint)),signatures:cz.typeforce.maybe(cz.typeforce.arrayOf(n)),input:cz.typeforce.maybe(cz.typeforce.Buffer)},e);var r={network:e.network||lz.bitcoin},i=[],o=!1;function a(e){o||(o=!0,i=Az.decompile(e),r.m=i[0]-dz,r.n=i[i.length-2]-dz,r.pubkeys=i.slice(1,-2))}if(hz.prop(r,"output",(function(){if(e.m&&r.n&&e.pubkeys)return Az.compile([].concat(dz+e.m,e.pubkeys,dz+r.n,fz.OP_CHECKMULTISIG))})),hz.prop(r,"m",(function(){if(r.output)return a(r.output),r.m})),hz.prop(r,"n",(function(){if(r.pubkeys)return r.pubkeys.length})),hz.prop(r,"pubkeys",(function(){if(e.output)return a(e.output),r.pubkeys})),hz.prop(r,"signatures",(function(){if(e.input)return Az.decompile(e.input).slice(1)})),hz.prop(r,"input",(function(){if(e.signatures)return Az.compile([fz.OP_0].concat(e.signatures))})),hz.prop(r,"witness",(function(){if(r.input)return[]})),hz.prop(r,"name",(function(){if(r.m&&r.n)return"p2ms(".concat(r.m," of ").concat(r.n,")")})),t.validate){if(e.output){if(a(e.output),!cz.typeforce.Number(i[0]))throw new TypeError("Output is invalid");if(!cz.typeforce.Number(i[i.length-2]))throw new TypeError("Output is invalid");if(i[i.length-1]!==fz.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(r.m<=0||r.n>16||r.m>r.n||r.n!==i.length-3)throw new TypeError("Output is invalid");if(!r.pubkeys.every((function(e){return(0,cz.isPoint)(e)})))throw new TypeError("Output is invalid");if(void 0!==e.m&&e.m!==r.m)throw new TypeError("m mismatch");if(void 0!==e.n&&e.n!==r.n)throw new TypeError("n mismatch");if(e.pubkeys&&!pz(e.pubkeys,r.pubkeys))throw new TypeError("Pubkeys mismatch")}if(e.pubkeys){if(void 0!==e.n&&e.n!==e.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(r.n=e.pubkeys.length,r.n<r.m)throw new TypeError("Pubkey count cannot be less than m")}if(e.signatures){if(e.signatures.length<r.m)throw new TypeError("Not enough signatures provided");if(e.signatures.length>r.m)throw new TypeError("Too many signatures provided")}if(e.input){if(e.input[0]!==fz.OP_0)throw new TypeError("Input is invalid");if(0===r.signatures.length||!r.signatures.every(n))throw new TypeError("Input has invalid signature(s)");if(e.signatures&&!pz(e.signatures,r.signatures))throw new TypeError("Signature mismatch");if(void 0!==e.m&&e.m!==e.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(r,e)};var gz={};Object.defineProperty(gz,"__esModule",{value:!0}),gz.p2pk=void 0;var vz=Xq,yz=$q,mz=hV,wz=nz,bz=yz.OPS;gz.p2pk=function(e,t){if(!(e.input||e.output||e.pubkey||e.input||e.signature))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,mz.typeforce)({network:mz.typeforce.maybe(mz.typeforce.Object),output:mz.typeforce.maybe(mz.typeforce.Buffer),pubkey:mz.typeforce.maybe(mz.isPoint),signature:mz.typeforce.maybe(yz.isCanonicalScriptSignature),input:mz.typeforce.maybe(mz.typeforce.Buffer)},e);var n=wz.value((function(){return yz.decompile(e.input)})),r={name:"p2pk",network:e.network||vz.bitcoin};if(wz.prop(r,"output",(function(){if(e.pubkey)return yz.compile([e.pubkey,bz.OP_CHECKSIG])})),wz.prop(r,"pubkey",(function(){if(e.output)return e.output.slice(1,-1)})),wz.prop(r,"signature",(function(){if(e.input)return n()[0]})),wz.prop(r,"input",(function(){if(e.signature)return yz.compile([e.signature])})),wz.prop(r,"witness",(function(){if(r.input)return[]})),t.validate){if(e.output){if(e.output[e.output.length-1]!==bz.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!(0,mz.isPoint)(r.pubkey))throw new TypeError("Output pubkey is invalid");if(e.pubkey&&!e.pubkey.equals(r.pubkey))throw new TypeError("Pubkey mismatch")}if(e.signature&&e.input&&!e.input.equals(r.input))throw new TypeError("Signature mismatch");if(e.input){if(1!==n().length)throw new TypeError("Input is invalid");if(!yz.isCanonicalScriptSignature(r.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(r,e)};var Iz={},Bz={};Object.defineProperty(Bz,"__esModule",{value:!0}),Bz.taggedHash=Bz.hash256=Bz.hash160=Bz.sha256=Bz.sha1=Bz.ripemd160=void 0;var Ez=QM,Cz=nT;function xz(e){try{return Ez("rmd160").update(e).digest()}catch(t){try{return Ez("ripemd160").update(e).digest()}catch(t){return(new Cz).update(e).digest()}}}function kz(e){return Ez("sha256").update(e).digest()}Bz.ripemd160=xz,Bz.sha1=function(e){return Ez("sha1").update(e).digest()},Bz.sha256=kz,Bz.hash160=function(e){return xz(kz(e))},Bz.hash256=function(e){return kz(kz(e))};var Sz=Object.fromEntries(["BIP0340/challenge","BIP0340/aux","BIP0340/nonce","TapLeaf","TapBranch","TapSighash","TapTweak","KeyAgg list","KeyAgg coefficient"].map((function(e){var t=kz(Xo.from(e));return[e,Xo.concat([t,t])]})));Bz.taggedHash=function(e,t){return kz(Xo.concat([Sz[e],t]))};var Qz=FO,_z=LF.exports.Buffer,Nz=QM,Dz=function(e){function t(t){var n=t.slice(0,-4),r=t.slice(-4),i=e(n);if(!(r[0]^i[0]|r[1]^i[1]|r[2]^i[2]|r[3]^i[3]))return n}return{encode:function(t){var n=e(t);return Qz.encode(_z.concat([t,n],t.length+4))},decode:function(e){var n=t(Qz.decode(e));if(!n)throw new Error("Invalid checksum");return n},decodeUnsafe:function(e){var n=Qz.decodeUnsafe(e);if(n)return t(n)}}}((function(e){var t=Nz("sha256").update(e).digest();return Nz("sha256").update(t).digest()}));Object.defineProperty(Iz,"__esModule",{value:!0}),Iz.p2pkh=void 0;var Fz=Bz,Pz=Xq,Uz=$q,Lz=hV,Tz=nz,Mz=Dz,Rz=Uz.OPS;Iz.p2pkh=function(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,Lz.typeforce)({network:Lz.typeforce.maybe(Lz.typeforce.Object),address:Lz.typeforce.maybe(Lz.typeforce.String),hash:Lz.typeforce.maybe(Lz.typeforce.BufferN(20)),output:Lz.typeforce.maybe(Lz.typeforce.BufferN(25)),pubkey:Lz.typeforce.maybe(Lz.isPoint),signature:Lz.typeforce.maybe(Uz.isCanonicalScriptSignature),input:Lz.typeforce.maybe(Lz.typeforce.Buffer)},e);var n=Tz.value((function(){var t=Mz.decode(e.address);return{version:t.readUInt8(0),hash:t.slice(1)}})),r=Tz.value((function(){return Uz.decompile(e.input)})),i=e.network||Pz.bitcoin,o={name:"p2pkh",network:i};if(Tz.prop(o,"address",(function(){if(o.hash){var e=Xo.allocUnsafe(21);return e.writeUInt8(i.pubKeyHash,0),o.hash.copy(e,1),Mz.encode(e)}})),Tz.prop(o,"hash",(function(){return e.output?e.output.slice(3,23):e.address?n().hash:e.pubkey||o.pubkey?Fz.hash160(e.pubkey||o.pubkey):void 0})),Tz.prop(o,"output",(function(){if(o.hash)return Uz.compile([Rz.OP_DUP,Rz.OP_HASH160,o.hash,Rz.OP_EQUALVERIFY,Rz.OP_CHECKSIG])})),Tz.prop(o,"pubkey",(function(){if(e.input)return r()[1]})),Tz.prop(o,"signature",(function(){if(e.input)return r()[0]})),Tz.prop(o,"input",(function(){if(e.pubkey&&e.signature)return Uz.compile([e.signature,e.pubkey])})),Tz.prop(o,"witness",(function(){if(o.input)return[]})),t.validate){var a=Xo.from([]);if(e.address){if(n().version!==i.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(20!==n().hash.length)throw new TypeError("Invalid address");a=n().hash}if(e.hash){if(a.length>0&&!a.equals(e.hash))throw new TypeError("Hash mismatch");a=e.hash}if(e.output){if(25!==e.output.length||e.output[0]!==Rz.OP_DUP||e.output[1]!==Rz.OP_HASH160||20!==e.output[2]||e.output[23]!==Rz.OP_EQUALVERIFY||e.output[24]!==Rz.OP_CHECKSIG)throw new TypeError("Output is invalid");var s=e.output.slice(3,23);if(a.length>0&&!a.equals(s))throw new TypeError("Hash mismatch");a=s}if(e.pubkey){var u=Fz.hash160(e.pubkey);if(a.length>0&&!a.equals(u))throw new TypeError("Hash mismatch");a=u}if(e.input){var l=r();if(2!==l.length)throw new TypeError("Input is invalid");if(!Uz.isCanonicalScriptSignature(l[0]))throw new TypeError("Input has invalid signature");if(!(0,Lz.isPoint)(l[1]))throw new TypeError("Input has invalid pubkey");if(e.signature&&!e.signature.equals(l[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(l[1]))throw new TypeError("Pubkey mismatch");var A=Fz.hash160(l[1]);if(a.length>0&&!a.equals(A))throw new TypeError("Hash mismatch")}}return Object.assign(o,e)};var Oz={};Object.defineProperty(Oz,"__esModule",{value:!0}),Oz.p2sh=void 0;var Hz=Bz,Kz=Xq,jz=$q,Gz=hV,qz=nz,Vz=Dz,zz=jz.OPS;Oz.p2sh=function(e,t){if(!(e.address||e.hash||e.output||e.redeem||e.input))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,Gz.typeforce)({network:Gz.typeforce.maybe(Gz.typeforce.Object),address:Gz.typeforce.maybe(Gz.typeforce.String),hash:Gz.typeforce.maybe(Gz.typeforce.BufferN(20)),output:Gz.typeforce.maybe(Gz.typeforce.BufferN(23)),redeem:Gz.typeforce.maybe({network:Gz.typeforce.maybe(Gz.typeforce.Object),output:Gz.typeforce.maybe(Gz.typeforce.Buffer),input:Gz.typeforce.maybe(Gz.typeforce.Buffer),witness:Gz.typeforce.maybe(Gz.typeforce.arrayOf(Gz.typeforce.Buffer))}),input:Gz.typeforce.maybe(Gz.typeforce.Buffer),witness:Gz.typeforce.maybe(Gz.typeforce.arrayOf(Gz.typeforce.Buffer))},e);var n=e.network;n||(n=e.redeem&&e.redeem.network||Kz.bitcoin);var r={network:n},i=qz.value((function(){var t=Vz.decode(e.address);return{version:t.readUInt8(0),hash:t.slice(1)}})),o=qz.value((function(){return jz.decompile(e.input)})),a=qz.value((function(){var t=o(),r=t[t.length-1];return{network:n,output:r===zz.OP_FALSE?Xo.from([]):r,input:jz.compile(t.slice(0,-1)),witness:e.witness||[]}}));if(qz.prop(r,"address",(function(){if(r.hash){var e=Xo.allocUnsafe(21);return e.writeUInt8(r.network.scriptHash,0),r.hash.copy(e,1),Vz.encode(e)}})),qz.prop(r,"hash",(function(){return e.output?e.output.slice(2,22):e.address?i().hash:r.redeem&&r.redeem.output?Hz.hash160(r.redeem.output):void 0})),qz.prop(r,"output",(function(){if(r.hash)return jz.compile([zz.OP_HASH160,r.hash,zz.OP_EQUAL])})),qz.prop(r,"redeem",(function(){if(e.input)return a()})),qz.prop(r,"input",(function(){if(e.redeem&&e.redeem.input&&e.redeem.output)return jz.compile([].concat(jz.decompile(e.redeem.input),e.redeem.output))})),qz.prop(r,"witness",(function(){return r.redeem&&r.redeem.witness?r.redeem.witness:r.input?[]:void 0})),qz.prop(r,"name",(function(){var e=["p2sh"];return void 0!==r.redeem&&void 0!==r.redeem.name&&e.push(r.redeem.name),e.join("-")})),t.validate){var s=Xo.from([]);if(e.address){if(i().version!==n.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(20!==i().hash.length)throw new TypeError("Invalid address");s=i().hash}if(e.hash){if(s.length>0&&!s.equals(e.hash))throw new TypeError("Hash mismatch");s=e.hash}if(e.output){if(23!==e.output.length||e.output[0]!==zz.OP_HASH160||20!==e.output[1]||e.output[22]!==zz.OP_EQUAL)throw new TypeError("Output is invalid");var u=e.output.slice(2,22);if(s.length>0&&!s.equals(u))throw new TypeError("Hash mismatch");s=u}var l=function(e){if(e.output){var t=jz.decompile(e.output);if(!t||t.length<1)throw new TypeError("Redeem.output too short");var n=Hz.hash160(e.output);if(s.length>0&&!s.equals(n))throw new TypeError("Hash mismatch");s=n}if(e.input){var r=e.input.length>0,i=e.witness&&e.witness.length>0;if(!r&&!i)throw new TypeError("Empty input");if(r&&i)throw new TypeError("Input and witness provided");if(r){var o=jz.decompile(e.input);if(!jz.isPushOnly(o))throw new TypeError("Non push-only scriptSig")}}};if(e.input){var A=o();if(!A||A.length<1)throw new TypeError("Input too short");if(!Da(a().output))throw new TypeError("Input is invalid");l(a())}if(e.redeem){if(e.redeem.network&&e.redeem.network!==n)throw new TypeError("Network mismatch");if(e.input){var c=a();if(e.redeem.output&&!e.redeem.output.equals(c.output))throw new TypeError("Redeem.output mismatch");if(e.redeem.input&&!e.redeem.input.equals(c.input))throw new TypeError("Redeem.input mismatch")}l(e.redeem)}if(e.witness&&e.redeem&&e.redeem.witness&&!function(e,t){return e.length===t.length&&e.every((function(e,n){return e.equals(t[n])}))}(e.redeem.witness,e.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(r,e)};var Jz={},Yz={};Object.defineProperty(Yz,"__esModule",{value:!0}),Yz.bech32m=Yz.bech32=void 0;for(var Xz="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Wz={},Zz=0;Zz<Xz.length;Zz++){var $z=Xz.charAt(Zz);Wz[$z]=Zz}function eJ(e){var t=e>>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function tJ(e){for(var t=1,n=0;n<e.length;++n){var r=e.charCodeAt(n);if(r<33||r>126)return"Invalid prefix ("+e+")";t=eJ(t)^r>>5}t=eJ(t);for(var i=0;i<e.length;++i){var o=e.charCodeAt(i);t=eJ(t)^31&o}return t}function nJ(e,t,n,r){for(var i=0,o=0,a=(1<<n)-1,s=[],u=0;u<e.length;++u)for(i=i<<t|e[u],o+=t;o>=n;)o-=n,s.push(i>>o&a);if(r)o>0&&s.push(i<<n-o&a);else{if(o>=t)return"Excess padding";if(i<<n-o&a)return"Non-zero padding"}return s}function rJ(e){return nJ(e,8,5,!0)}function iJ(e){var t=nJ(e,5,8,!1);if(Array.isArray(t))return t}function oJ(e){var t=nJ(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function aJ(e){var t;function n(e,n){if(n=n||90,e.length<8)return e+" too short";if(e.length>n)return"Exceeds length limit";var r=e.toLowerCase(),i=e.toUpperCase();if(e!==r&&e!==i)return"Mixed-case string "+e;var o=(e=r).lastIndexOf("1");if(-1===o)return"No separator character for "+e;if(0===o)return"Missing prefix for "+e;var a=e.slice(0,o),s=e.slice(o+1);if(s.length<6)return"Data too short";var u=tJ(a);if("string"==typeof u)return u;for(var l=[],A=0;A<s.length;++A){var c=s.charAt(A),h=Wz[c];if(void 0===h)return"Unknown character "+c;u=eJ(u)^h,A+6>=s.length||l.push(h)}return u!==t?"Invalid checksum for "+e:{prefix:a,words:l}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){var r=n(e,t);if("object"==i(r))return r},decode:function(e,t){var r=n(e,t);if("object"==i(r))return r;throw new Error(r)},encode:function(e,n,r){if(r=r||90,e.length+7+n.length>r)throw new TypeError("Exceeds length limit");var i=tJ(e=e.toLowerCase());if("string"==typeof i)throw new Error(i);for(var o=e+"1",a=0;a<n.length;++a){var s=n[a];if(s>>5!=0)throw new Error("Non 5-bit word");i=eJ(i)^s,o+=Xz.charAt(s)}for(var u=0;u<6;++u)i=eJ(i);i^=t;for(var l=0;l<6;++l)o+=Xz.charAt(i>>5*(5-l)&31);return o},toWords:rJ,fromWordsUnsafe:iJ,fromWords:oJ}}Yz.bech32=aJ("bech32"),Yz.bech32m=aJ("bech32m"),Object.defineProperty(Jz,"__esModule",{value:!0}),Jz.p2wpkh=void 0;var sJ=Bz,uJ=Xq,lJ=$q,AJ=hV,cJ=nz,hJ=Yz,fJ=lJ.OPS,dJ=Xo.alloc(0);Jz.p2wpkh=function(e,t){if(!(e.address||e.hash||e.output||e.pubkey||e.witness))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,AJ.typeforce)({address:AJ.typeforce.maybe(AJ.typeforce.String),hash:AJ.typeforce.maybe(AJ.typeforce.BufferN(20)),input:AJ.typeforce.maybe(AJ.typeforce.BufferN(0)),network:AJ.typeforce.maybe(AJ.typeforce.Object),output:AJ.typeforce.maybe(AJ.typeforce.BufferN(22)),pubkey:AJ.typeforce.maybe(AJ.isPoint),signature:AJ.typeforce.maybe(lJ.isCanonicalScriptSignature),witness:AJ.typeforce.maybe(AJ.typeforce.arrayOf(AJ.typeforce.Buffer))},e);var n=cJ.value((function(){var t=hJ.bech32.decode(e.address),n=t.words.shift(),r=hJ.bech32.fromWords(t.words);return{version:n,prefix:t.prefix,data:Xo.from(r)}})),r=e.network||uJ.bitcoin,i={name:"p2wpkh",network:r};if(cJ.prop(i,"address",(function(){if(i.hash){var e=hJ.bech32.toWords(i.hash);return e.unshift(0),hJ.bech32.encode(r.bech32,e)}})),cJ.prop(i,"hash",(function(){return e.output?e.output.slice(2,22):e.address?n().data:e.pubkey||i.pubkey?sJ.hash160(e.pubkey||i.pubkey):void 0})),cJ.prop(i,"output",(function(){if(i.hash)return lJ.compile([fJ.OP_0,i.hash])})),cJ.prop(i,"pubkey",(function(){return e.pubkey?e.pubkey:e.witness?e.witness[1]:void 0})),cJ.prop(i,"signature",(function(){if(e.witness)return e.witness[0]})),cJ.prop(i,"input",(function(){if(i.witness)return dJ})),cJ.prop(i,"witness",(function(){if(e.pubkey&&e.signature)return[e.signature,e.pubkey]})),t.validate){var o=Xo.from([]);if(e.address){if(r&&r.bech32!==n().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(0!==n().version)throw new TypeError("Invalid address version");if(20!==n().data.length)throw new TypeError("Invalid address data");o=n().data}if(e.hash){if(o.length>0&&!o.equals(e.hash))throw new TypeError("Hash mismatch");o=e.hash}if(e.output){if(22!==e.output.length||e.output[0]!==fJ.OP_0||20!==e.output[1])throw new TypeError("Output is invalid");if(o.length>0&&!o.equals(e.output.slice(2)))throw new TypeError("Hash mismatch");o=e.output.slice(2)}if(e.pubkey){var a=sJ.hash160(e.pubkey);if(o.length>0&&!o.equals(a))throw new TypeError("Hash mismatch");if(o=a,!(0,AJ.isPoint)(e.pubkey)||33!==e.pubkey.length)throw new TypeError("Invalid pubkey for p2wpkh")}if(e.witness){if(2!==e.witness.length)throw new TypeError("Witness is invalid");if(!lJ.isCanonicalScriptSignature(e.witness[0]))throw new TypeError("Witness has invalid signature");if(!(0,AJ.isPoint)(e.witness[1])||33!==e.witness[1].length)throw new TypeError("Witness has invalid pubkey");if(e.signature&&!e.signature.equals(e.witness[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(e.witness[1]))throw new TypeError("Pubkey mismatch");var s=sJ.hash160(e.witness[1]);if(o.length>0&&!o.equals(s))throw new TypeError("Hash mismatch")}}return Object.assign(i,e)};var pJ={};Object.defineProperty(pJ,"__esModule",{value:!0}),pJ.p2wsh=void 0;var gJ=Bz,vJ=Xq,yJ=$q,mJ=hV,wJ=nz,bJ=Yz,IJ=yJ.OPS,BJ=Xo.alloc(0);function EJ(e){return!(!Da(e)||65!==e.length||4!==e[0]||!(0,mJ.isPoint)(e))}pJ.p2wsh=function(e,t){if(!(e.address||e.hash||e.output||e.redeem||e.witness))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,mJ.typeforce)({network:mJ.typeforce.maybe(mJ.typeforce.Object),address:mJ.typeforce.maybe(mJ.typeforce.String),hash:mJ.typeforce.maybe(mJ.typeforce.BufferN(32)),output:mJ.typeforce.maybe(mJ.typeforce.BufferN(34)),redeem:mJ.typeforce.maybe({input:mJ.typeforce.maybe(mJ.typeforce.Buffer),network:mJ.typeforce.maybe(mJ.typeforce.Object),output:mJ.typeforce.maybe(mJ.typeforce.Buffer),witness:mJ.typeforce.maybe(mJ.typeforce.arrayOf(mJ.typeforce.Buffer))}),input:mJ.typeforce.maybe(mJ.typeforce.BufferN(0)),witness:mJ.typeforce.maybe(mJ.typeforce.arrayOf(mJ.typeforce.Buffer))},e);var n=wJ.value((function(){var t=bJ.bech32.decode(e.address),n=t.words.shift(),r=bJ.bech32.fromWords(t.words);return{version:n,prefix:t.prefix,data:Xo.from(r)}})),r=wJ.value((function(){return yJ.decompile(e.redeem.input)})),i=e.network;i||(i=e.redeem&&e.redeem.network||vJ.bitcoin);var o={network:i};if(wJ.prop(o,"address",(function(){if(o.hash){var e=bJ.bech32.toWords(o.hash);return e.unshift(0),bJ.bech32.encode(i.bech32,e)}})),wJ.prop(o,"hash",(function(){return e.output?e.output.slice(2):e.address?n().data:o.redeem&&o.redeem.output?gJ.sha256(o.redeem.output):void 0})),wJ.prop(o,"output",(function(){if(o.hash)return yJ.compile([IJ.OP_0,o.hash])})),wJ.prop(o,"redeem",(function(){if(e.witness)return{output:e.witness[e.witness.length-1],input:BJ,witness:e.witness.slice(0,-1)}})),wJ.prop(o,"input",(function(){if(o.witness)return BJ})),wJ.prop(o,"witness",(function(){if(e.redeem&&e.redeem.input&&e.redeem.input.length>0&&e.redeem.output&&e.redeem.output.length>0){var t=yJ.toStack(r());return o.redeem=Object.assign({witness:t},e.redeem),o.redeem.input=BJ,[].concat(t,e.redeem.output)}if(e.redeem&&e.redeem.output&&e.redeem.witness)return[].concat(e.redeem.witness,e.redeem.output)})),wJ.prop(o,"name",(function(){var e=["p2wsh"];return void 0!==o.redeem&&void 0!==o.redeem.name&&e.push(o.redeem.name),e.join("-")})),t.validate){var a=Xo.from([]);if(e.address){if(n().prefix!==i.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(0!==n().version)throw new TypeError("Invalid address version");if(32!==n().data.length)throw new TypeError("Invalid address data");a=n().data}if(e.hash){if(a.length>0&&!a.equals(e.hash))throw new TypeError("Hash mismatch");a=e.hash}if(e.output){if(34!==e.output.length||e.output[0]!==IJ.OP_0||32!==e.output[1])throw new TypeError("Output is invalid");var s=e.output.slice(2);if(a.length>0&&!a.equals(s))throw new TypeError("Hash mismatch");a=s}if(e.redeem){if(e.redeem.network&&e.redeem.network!==i)throw new TypeError("Network mismatch");if(e.redeem.input&&e.redeem.input.length>0&&e.redeem.witness&&e.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(e.redeem.output){if(0===yJ.decompile(e.redeem.output).length)throw new TypeError("Redeem.output is invalid");var u=gJ.sha256(e.redeem.output);if(a.length>0&&!a.equals(u))throw new TypeError("Hash mismatch");a=u}if(e.redeem.input&&!yJ.isPushOnly(r()))throw new TypeError("Non push-only scriptSig");if(e.witness&&e.redeem.witness&&!function(e,t){return e.length===t.length&&e.every((function(e,n){return e.equals(t[n])}))}(e.witness,e.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch");if(e.redeem.input&&r().some(EJ)||e.redeem.output&&(yJ.decompile(e.redeem.output)||[]).some(EJ))throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(e.witness&&e.witness.length>0){var l=e.witness[e.witness.length-1];if(e.redeem&&e.redeem.output&&!e.redeem.output.equals(l))throw new TypeError("Witness and redeem.output mismatch");if(e.witness.some(EJ)||(yJ.decompile(l)||[]).some(EJ))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(o,e)},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.p2wsh=e.p2wpkh=e.p2sh=e.p2pkh=e.p2pk=e.p2ms=e.embed=void 0;var t=Zq;Object.defineProperty(e,"embed",{enumerable:!0,get:function(){return t.p2data}});var n=uz;Object.defineProperty(e,"p2ms",{enumerable:!0,get:function(){return n.p2ms}});var r=gz;Object.defineProperty(e,"p2pk",{enumerable:!0,get:function(){return r.p2pk}});var i=Iz;Object.defineProperty(e,"p2pkh",{enumerable:!0,get:function(){return i.p2pkh}});var o=Oz;Object.defineProperty(e,"p2sh",{enumerable:!0,get:function(){return o.p2sh}});var a=Jz;Object.defineProperty(e,"p2wpkh",{enumerable:!0,get:function(){return a.p2wpkh}});var s=pJ;Object.defineProperty(e,"p2wsh",{enumerable:!0,get:function(){return s.p2wsh}})}(Wq),Object.defineProperty(Yq,"__esModule",{value:!0}),Yq.toOutputScript=Yq.fromOutputScript=Yq.toBech32=Yq.toBase58Check=Yq.fromBech32=Yq.fromBase58Check=void 0;var CJ=Xq,xJ=Wq,kJ=$q,SJ=hV,QJ=Yz,_J=Dz,NJ=SJ.typeforce,DJ="WARNING: Sending to a future segwit version address can lead to loss of funds. End users MUST be warned carefully in the GUI and asked if they wish to proceed with caution. Wallets should verify the segwit version from the output of fromBech32, then decide when it is safe to use which version of segwit.";function FJ(e){var t=_J.decode(e);if(t.length<21)throw new TypeError(e+" is too short");if(t.length>21)throw new TypeError(e+" is too long");return{version:t.readUInt8(0),hash:t.slice(1)}}function PJ(e){var t,n;try{t=QJ.bech32.decode(e)}catch(e){}if(t){if(0!==(n=t.words[0]))throw new TypeError(e+" uses wrong encoding")}else if(0===(n=(t=QJ.bech32m.decode(e)).words[0]))throw new TypeError(e+" uses wrong encoding");var r=QJ.bech32.fromWords(t.words.slice(1));return{version:n,prefix:t.prefix,data:Xo.from(r)}}function UJ(e,t,n){var r=QJ.bech32.toWords(e);return r.unshift(t),0===t?QJ.bech32.encode(n,r):QJ.bech32m.encode(n,r)}Yq.fromBase58Check=FJ,Yq.fromBech32=PJ,Yq.toBase58Check=function(e,t){NJ(SJ.tuple(SJ.Hash160bit,SJ.UInt8),arguments);var n=Xo.allocUnsafe(21);return n.writeUInt8(t,0),e.copy(n,1),_J.encode(n)},Yq.toBech32=UJ,Yq.fromOutputScript=function(e,t){t=t||CJ.bitcoin;try{return xJ.p2pkh({output:e,network:t}).address}catch(e){}try{return xJ.p2sh({output:e,network:t}).address}catch(e){}try{return xJ.p2wpkh({output:e,network:t}).address}catch(e){}try{return xJ.p2wsh({output:e,network:t}).address}catch(e){}try{return function(e,t){var n=e.slice(2);if(n.length<2||n.length>40)throw new TypeError("Invalid program length for segwit address");var r=e[0]-80;if(r<1||r>16)throw new TypeError("Invalid version for segwit address");if(e[1]!==n.length)throw new TypeError("Invalid script for segwit address");return console.warn(DJ),UJ(n,r,t.bech32)}(e,t)}catch(e){}throw new Error(kJ.toASM(e)+" has no matching Address")},Yq.toOutputScript=function(e,t){var n,r;t=t||CJ.bitcoin;try{n=FJ(e)}catch(e){}if(n){if(n.version===t.pubKeyHash)return xJ.p2pkh({hash:n.hash}).output;if(n.version===t.scriptHash)return xJ.p2sh({hash:n.hash}).output}else{try{r=PJ(e)}catch(e){}if(r){if(r.prefix!==t.bech32)throw new Error(e+" has an invalid prefix");if(0===r.version){if(20===r.data.length)return xJ.p2wpkh({hash:r.data}).output;if(32===r.data.length)return xJ.p2wsh({hash:r.data}).output}else if(r.version>=1&&r.version<=16&&r.data.length>=2&&r.data.length<=40)return console.warn(DJ),kJ.compile([r.version+80,r.data])}}throw new Error(e+" has no matching Script")};var LJ={},TJ={},MJ=LF.exports.Buffer;function RJ(e){if(e<0||e>9007199254740991||e%1!=0)throw new RangeError("value out of range")}function OJ(e){return RJ(e),e<253?1:e<=65535?3:e<=4294967295?5:9}var HJ={encode:function e(t,n,r){if(RJ(t),n||(n=MJ.allocUnsafe(OJ(t))),!MJ.isBuffer(n))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),t<253?(n.writeUInt8(t,r),e.bytes=1):t<=65535?(n.writeUInt8(253,r),n.writeUInt16LE(t,r+1),e.bytes=3):t<=4294967295?(n.writeUInt8(254,r),n.writeUInt32LE(t,r+1),e.bytes=5):(n.writeUInt8(255,r),n.writeUInt32LE(t>>>0,r+1),n.writeUInt32LE(t/4294967296|0,r+5),e.bytes=9),n},decode:function e(t,n){if(!MJ.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");n||(n=0);var r=t.readUInt8(n);if(r<253)return e.bytes=1,r;if(253===r)return e.bytes=3,t.readUInt16LE(n+1);if(254===r)return e.bytes=5,t.readUInt32LE(n+1);e.bytes=9;var i=t.readUInt32LE(n+1),o=4294967296*t.readUInt32LE(n+5)+i;return RJ(o),o},encodingLength:OJ};Object.defineProperty(TJ,"__esModule",{value:!0}),TJ.BufferReader=TJ.BufferWriter=TJ.cloneBuffer=TJ.reverseBuffer=TJ.writeUInt64LE=TJ.readUInt64LE=TJ.varuint=void 0;var KJ=hV,jJ=KJ.typeforce,GJ=HJ;function qJ(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}function VJ(e,t){var n=e.readUInt32LE(t),r=e.readUInt32LE(t+4);return qJ((r*=4294967296)+n,9007199254740991),r+n}function zJ(e,t,n){return qJ(t,9007199254740991),e.writeInt32LE(-1&t,n),e.writeUInt32LE(Math.floor(t/4294967296),n+4),n+8}TJ.varuint=GJ,TJ.readUInt64LE=VJ,TJ.writeUInt64LE=zJ,TJ.reverseBuffer=function(e){if(e.length<1)return e;for(var t=e.length-1,n=0,r=0;r<e.length/2;r++)n=e[r],e[r]=e[t],e[t]=n,t--;return e},TJ.cloneBuffer=function(e){var t=Xo.allocUnsafe(e.length);return e.copy(t),t};var JJ=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;s(this,e),this.buffer=t,this.offset=n,jJ(KJ.tuple(KJ.Buffer,KJ.UInt32),[t,n])}return l(e,[{key:"writeUInt8",value:function(e){this.offset=this.buffer.writeUInt8(e,this.offset)}},{key:"writeInt32",value:function(e){this.offset=this.buffer.writeInt32LE(e,this.offset)}},{key:"writeUInt32",value:function(e){this.offset=this.buffer.writeUInt32LE(e,this.offset)}},{key:"writeUInt64",value:function(e){this.offset=zJ(this.buffer,e,this.offset)}},{key:"writeVarInt",value:function(e){GJ.encode(e,this.buffer,this.offset),this.offset+=GJ.encode.bytes}},{key:"writeSlice",value:function(e){if(this.buffer.length<this.offset+e.length)throw new Error("Cannot write slice out of bounds");this.offset+=e.copy(this.buffer,this.offset)}},{key:"writeVarSlice",value:function(e){this.writeVarInt(e.length),this.writeSlice(e)}},{key:"writeVector",value:function(e){var t=this;this.writeVarInt(e.length),e.forEach((function(e){return t.writeVarSlice(e)}))}},{key:"end",value:function(){if(this.buffer.length===this.offset)return this.buffer;throw new Error("buffer size ".concat(this.buffer.length,", offset ").concat(this.offset))}}],[{key:"withCapacity",value:function(t){return new e(Xo.alloc(t))}}]),e}();TJ.BufferWriter=JJ,TJ.BufferReader=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;s(this,e),this.buffer=t,this.offset=n,jJ(KJ.tuple(KJ.Buffer,KJ.UInt32),[t,n])}return l(e,[{key:"readUInt8",value:function(){var e=this.buffer.readUInt8(this.offset);return this.offset++,e}},{key:"readInt32",value:function(){var e=this.buffer.readInt32LE(this.offset);return this.offset+=4,e}},{key:"readUInt32",value:function(){var e=this.buffer.readUInt32LE(this.offset);return this.offset+=4,e}},{key:"readUInt64",value:function(){var e=VJ(this.buffer,this.offset);return this.offset+=8,e}},{key:"readVarInt",value:function(){var e=GJ.decode(this.buffer,this.offset);return this.offset+=GJ.decode.bytes,e}},{key:"readSlice",value:function(e){if(this.buffer.length<this.offset+e)throw new Error("Cannot read slice out of bounds");var t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}},{key:"readVarSlice",value:function(){return this.readSlice(this.readVarInt())}},{key:"readVector",value:function(){for(var e=this.readVarInt(),t=[],n=0;n<e;n++)t.push(this.readVarSlice());return t}}]),e}();var YJ={};Object.defineProperty(YJ,"__esModule",{value:!0}),YJ.fastMerkleRoot=void 0,YJ.fastMerkleRoot=function(e,t){if(!Array.isArray(e))throw TypeError("Expected values Array");if("function"!=typeof t)throw TypeError("Expected digest Function");for(var n=e.length,r=e.concat();n>1;){for(var i=0,o=0;o<n;o+=2,++i){var a=r[o],s=o+1===n?a:r[o+1],u=Xo.concat([a,s]);r[i]=t(u)}n=i}return r[0]};var XJ={};Object.defineProperty(XJ,"__esModule",{value:!0}),XJ.Transaction=void 0;var WJ=TJ,ZJ=Bz,$J=$q,eY=$q,tY=hV,nY=tY.typeforce;function rY(e){var t=e.length;return WJ.varuint.encodingLength(t)+t}var iY=Xo.allocUnsafe(0),oY=[],aY=Xo.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),sY=Xo.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),uY=Xo.from("ffffffffffffffff","hex"),lY={script:iY,valueBuffer:uY},AY=function(){function e(){s(this,e),this.version=1,this.locktime=0,this.ins=[],this.outs=[]}return l(e,[{key:"isCoinbase",value:function(){return 1===this.ins.length&&e.isCoinbaseHash(this.ins[0].hash)}},{key:"addInput",value:function(t,n,r,i){return nY(tY.tuple(tY.Hash256bit,tY.UInt32,tY.maybe(tY.UInt32),tY.maybe(tY.Buffer)),arguments),tY.Null(r)&&(r=e.DEFAULT_SEQUENCE),this.ins.push({hash:t,index:n,script:i||iY,sequence:r,witness:oY})-1}},{key:"addOutput",value:function(e,t){return nY(tY.tuple(tY.Buffer,tY.Satoshi),arguments),this.outs.push({script:e,value:t})-1}},{key:"hasWitnesses",value:function(){return this.ins.some((function(e){return 0!==e.witness.length}))}},{key:"weight",value:function(){return 3*this.byteLength(!1)+this.byteLength(!0)}},{key:"virtualSize",value:function(){return Math.ceil(this.weight()/4)}},{key:"byteLength",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=e&&this.hasWitnesses();return(t?10:8)+WJ.varuint.encodingLength(this.ins.length)+WJ.varuint.encodingLength(this.outs.length)+this.ins.reduce((function(e,t){return e+40+rY(t.script)}),0)+this.outs.reduce((function(e,t){return e+8+rY(t.script)}),0)+(t?this.ins.reduce((function(e,t){return e+function(e){var t=e.length;return WJ.varuint.encodingLength(t)+e.reduce((function(e,t){return e+rY(t)}),0)}(t.witness)}),0):0)}},{key:"clone",value:function(){var t=new e;return t.version=this.version,t.locktime=this.locktime,t.ins=this.ins.map((function(e){return{hash:e.hash,index:e.index,script:e.script,sequence:e.sequence,witness:e.witness}})),t.outs=this.outs.map((function(e){return{script:e.script,value:e.value}})),t}},{key:"hashForSignature",value:function(t,n,r){if(nY(tY.tuple(tY.UInt32,tY.Buffer,tY.Number),arguments),t>=this.ins.length)return sY;var i=$J.compile($J.decompile(n).filter((function(e){return e!==eY.OPS.OP_CODESEPARATOR}))),o=this.clone();if((31&r)===e.SIGHASH_NONE)o.outs=[],o.ins.forEach((function(e,n){n!==t&&(e.sequence=0)}));else if((31&r)===e.SIGHASH_SINGLE){if(t>=this.outs.length)return sY;o.outs.length=t+1;for(var a=0;a<t;a++)o.outs[a]=lY;o.ins.forEach((function(e,n){n!==t&&(e.sequence=0)}))}r&e.SIGHASH_ANYONECANPAY?(o.ins=[o.ins[t]],o.ins[0].script=i):(o.ins.forEach((function(e){e.script=iY})),o.ins[t].script=i);var s=Xo.allocUnsafe(o.byteLength(!1)+4);return s.writeInt32LE(r,s.length-4),o.__toBuffer(s,0,!1),ZJ.hash256(s)}},{key:"hashForWitnessV1",value:function(t,n,r,i,o,a){if(nY(tY.tuple(tY.UInt32,nY.arrayOf(tY.Buffer),nY.arrayOf(tY.Satoshi),tY.UInt32),arguments),r.length!==this.ins.length||n.length!==this.ins.length)throw new Error("Must supply prevout script and value for all inputs");var s=i===e.SIGHASH_DEFAULT?e.SIGHASH_ALL:i&e.SIGHASH_OUTPUT_MASK,u=(i&e.SIGHASH_INPUT_MASK)===e.SIGHASH_ANYONECANPAY,l=s===e.SIGHASH_NONE,A=s===e.SIGHASH_SINGLE,c=iY,h=iY,f=iY,d=iY,p=iY;if(!u){var g=WJ.BufferWriter.withCapacity(36*this.ins.length);this.ins.forEach((function(e){g.writeSlice(e.hash),g.writeUInt32(e.index)})),c=ZJ.sha256(g.end()),g=WJ.BufferWriter.withCapacity(8*this.ins.length),r.forEach((function(e){return g.writeUInt64(e)})),h=ZJ.sha256(g.end()),g=WJ.BufferWriter.withCapacity(n.map(rY).reduce((function(e,t){return e+t}))),n.forEach((function(e){return g.writeVarSlice(e)})),f=ZJ.sha256(g.end()),g=WJ.BufferWriter.withCapacity(4*this.ins.length),this.ins.forEach((function(e){return g.writeUInt32(e.sequence)})),d=ZJ.sha256(g.end())}if(l||A){if(A&&t<this.outs.length){var v=this.outs[t],y=WJ.BufferWriter.withCapacity(8+rY(v.script));y.writeUInt64(v.value),y.writeVarSlice(v.script),p=ZJ.sha256(y.end())}}else{var m=this.outs.map((function(e){return 8+rY(e.script)})).reduce((function(e,t){return e+t})),w=WJ.BufferWriter.withCapacity(m);this.outs.forEach((function(e){w.writeUInt64(e.value),w.writeVarSlice(e.script)})),p=ZJ.sha256(w.end())}var b=(o?2:0)+(a?1:0),I=174-(u?49:0)-(l?32:0)+(a?32:0)+(o?37:0),B=WJ.BufferWriter.withCapacity(I);if(B.writeUInt8(i),B.writeInt32(this.version),B.writeUInt32(this.locktime),B.writeSlice(c),B.writeSlice(h),B.writeSlice(f),B.writeSlice(d),l||A||B.writeSlice(p),B.writeUInt8(b),u){var E=this.ins[t];B.writeSlice(E.hash),B.writeUInt32(E.index),B.writeUInt64(r[t]),B.writeVarSlice(n[t]),B.writeUInt32(E.sequence)}else B.writeUInt32(t);if(a){var C=WJ.BufferWriter.withCapacity(rY(a));C.writeVarSlice(a),B.writeSlice(ZJ.sha256(C.end()))}return A&&B.writeSlice(p),o&&(B.writeSlice(o),B.writeUInt8(0),B.writeUInt32(4294967295)),ZJ.taggedHash("TapSighash",Xo.concat([Xo.of(0),B.end()]))}},{key:"hashForWitnessV0",value:function(t,n,r,i){nY(tY.tuple(tY.UInt32,tY.Buffer,tY.Satoshi,tY.UInt32),arguments);var o,a=Xo.from([]),s=aY,u=aY,l=aY;if(i&e.SIGHASH_ANYONECANPAY||(a=Xo.allocUnsafe(36*this.ins.length),o=new WJ.BufferWriter(a,0),this.ins.forEach((function(e){o.writeSlice(e.hash),o.writeUInt32(e.index)})),u=ZJ.hash256(a)),i&e.SIGHASH_ANYONECANPAY||(31&i)===e.SIGHASH_SINGLE||(31&i)===e.SIGHASH_NONE||(a=Xo.allocUnsafe(4*this.ins.length),o=new WJ.BufferWriter(a,0),this.ins.forEach((function(e){o.writeUInt32(e.sequence)})),l=ZJ.hash256(a)),(31&i)!==e.SIGHASH_SINGLE&&(31&i)!==e.SIGHASH_NONE){var A=this.outs.reduce((function(e,t){return e+8+rY(t.script)}),0);a=Xo.allocUnsafe(A),o=new WJ.BufferWriter(a,0),this.outs.forEach((function(e){o.writeUInt64(e.value),o.writeVarSlice(e.script)})),s=ZJ.hash256(a)}else if((31&i)===e.SIGHASH_SINGLE&&t<this.outs.length){var c=this.outs[t];a=Xo.allocUnsafe(8+rY(c.script)),(o=new WJ.BufferWriter(a,0)).writeUInt64(c.value),o.writeVarSlice(c.script),s=ZJ.hash256(a)}a=Xo.allocUnsafe(156+rY(n)),o=new WJ.BufferWriter(a,0);var h=this.ins[t];return o.writeInt32(this.version),o.writeSlice(u),o.writeSlice(l),o.writeSlice(h.hash),o.writeUInt32(h.index),o.writeVarSlice(n),o.writeUInt64(r),o.writeUInt32(h.sequence),o.writeSlice(s),o.writeUInt32(this.locktime),o.writeUInt32(i),ZJ.hash256(a)}},{key:"getHash",value:function(e){return e&&this.isCoinbase()?Xo.alloc(32,0):ZJ.hash256(this.__toBuffer(void 0,void 0,e))}},{key:"getId",value:function(){return(0,WJ.reverseBuffer)(this.getHash(!1)).toString("hex")}},{key:"toBuffer",value:function(e,t){return this.__toBuffer(e,t,!0)}},{key:"toHex",value:function(){return this.toBuffer(void 0,void 0).toString("hex")}},{key:"setInputScript",value:function(e,t){nY(tY.tuple(tY.Number,tY.Buffer),arguments),this.ins[e].script=t}},{key:"setWitness",value:function(e,t){nY(tY.tuple(tY.Number,[tY.Buffer]),arguments),this.ins[e].witness=t}},{key:"__toBuffer",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t||(t=Xo.allocUnsafe(this.byteLength(r)));var i=new WJ.BufferWriter(t,n||0);i.writeInt32(this.version);var o=r&&this.hasWitnesses();return o&&(i.writeUInt8(e.ADVANCED_TRANSACTION_MARKER),i.writeUInt8(e.ADVANCED_TRANSACTION_FLAG)),i.writeVarInt(this.ins.length),this.ins.forEach((function(e){i.writeSlice(e.hash),i.writeUInt32(e.index),i.writeVarSlice(e.script),i.writeUInt32(e.sequence)})),i.writeVarInt(this.outs.length),this.outs.forEach((function(e){void 0!==e.value?i.writeUInt64(e.value):i.writeSlice(e.valueBuffer),i.writeVarSlice(e.script)})),o&&this.ins.forEach((function(e){i.writeVector(e.witness)})),i.writeUInt32(this.locktime),void 0!==n?t.slice(n,i.offset):t}}],[{key:"fromBuffer",value:function(t,n){var r=new WJ.BufferReader(t),i=new e;i.version=r.readInt32();var o=r.readUInt8(),a=r.readUInt8(),s=!1;o===e.ADVANCED_TRANSACTION_MARKER&&a===e.ADVANCED_TRANSACTION_FLAG?s=!0:r.offset-=2;for(var u=r.readVarInt(),l=0;l<u;++l)i.ins.push({hash:r.readSlice(32),index:r.readUInt32(),script:r.readVarSlice(),sequence:r.readUInt32(),witness:oY});for(var A=r.readVarInt(),c=0;c<A;++c)i.outs.push({value:r.readUInt64(),script:r.readVarSlice()});if(s){for(var h=0;h<u;++h)i.ins[h].witness=r.readVector();if(!i.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(i.locktime=r.readUInt32(),n)return i;if(r.offset!==t.length)throw new Error("Transaction has unexpected data");return i}},{key:"fromHex",value:function(t){return e.fromBuffer(Xo.from(t,"hex"),!1)}},{key:"isCoinbaseHash",value:function(e){nY(tY.Hash256bit,e);for(var t=0;t<32;++t)if(0!==e[t])return!1;return!0}}]),e}();XJ.Transaction=AY,AY.DEFAULT_SEQUENCE=4294967295,AY.SIGHASH_DEFAULT=0,AY.SIGHASH_ALL=1,AY.SIGHASH_NONE=2,AY.SIGHASH_SINGLE=3,AY.SIGHASH_ANYONECANPAY=128,AY.SIGHASH_OUTPUT_MASK=3,AY.SIGHASH_INPUT_MASK=128,AY.ADVANCED_TRANSACTION_MARKER=0,AY.ADVANCED_TRANSACTION_FLAG=1,Object.defineProperty(LJ,"__esModule",{value:!0}),LJ.Block=void 0;var cY=TJ,hY=Bz,fY=YJ,dY=XJ,pY=hV,gY=pY.typeforce,vY=new TypeError("Cannot compute merkle root for zero transactions"),yY=new TypeError("Cannot compute witness commit for non-segwit block"),mY=function(){function e(){s(this,e),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}return l(e,[{key:"getWitnessCommit",value:function(){if(!wY(this.transactions))return null;var e=this.transactions[0].outs.filter((function(e){return e.script.slice(0,6).equals(Xo.from("6a24aa21a9ed","hex"))})).map((function(e){return e.script.slice(6,38)}));if(0===e.length)return null;var t=e[e.length-1];return t instanceof Xo&&32===t.length?t:null}},{key:"hasWitnessCommit",value:function(){return this.witnessCommit instanceof Xo&&32===this.witnessCommit.length||null!==this.getWitnessCommit()}},{key:"hasWitness",value:function(){return(e=this.transactions)instanceof Array&&e.some((function(e){return"object"==i(e)&&e.ins instanceof Array&&e.ins.some((function(e){return"object"==i(e)&&e.witness instanceof Array&&e.witness.length>0}))}));var e}},{key:"weight",value:function(){return 3*this.byteLength(!1,!1)+this.byteLength(!1,!0)}},{key:"byteLength",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return e||!this.transactions?80:80+cY.varuint.encodingLength(this.transactions.length)+this.transactions.reduce((function(e,n){return e+n.byteLength(t)}),0)}},{key:"getHash",value:function(){return hY.hash256(this.toBuffer(!0))}},{key:"getId",value:function(){return(0,cY.reverseBuffer)(this.getHash()).toString("hex")}},{key:"getUTCDate",value:function(){var e=new Date(0);return e.setUTCSeconds(this.timestamp),e}},{key:"toBuffer",value:function(e){var t=Xo.allocUnsafe(this.byteLength(e)),n=new cY.BufferWriter(t);return n.writeInt32(this.version),n.writeSlice(this.prevHash),n.writeSlice(this.merkleRoot),n.writeUInt32(this.timestamp),n.writeUInt32(this.bits),n.writeUInt32(this.nonce),e||!this.transactions||(cY.varuint.encode(this.transactions.length,t,n.offset),n.offset+=cY.varuint.encode.bytes,this.transactions.forEach((function(e){var r=e.byteLength();e.toBuffer(t,n.offset),n.offset+=r}))),t}},{key:"toHex",value:function(e){return this.toBuffer(e).toString("hex")}},{key:"checkTxRoots",value:function(){var e=this.hasWitnessCommit();return!(!e&&this.hasWitness())&&this.__checkMerkleRoot()&&(!e||this.__checkWitnessCommit())}},{key:"checkProofOfWork",value:function(){var t=(0,cY.reverseBuffer)(this.getHash()),n=e.calculateTarget(this.bits);return t.compare(n)<=0}},{key:"__checkMerkleRoot",value:function(){if(!this.transactions)throw vY;var t=e.calculateMerkleRoot(this.transactions);return 0===this.merkleRoot.compare(t)}},{key:"__checkWitnessCommit",value:function(){if(!this.transactions)throw vY;if(!this.hasWitnessCommit())throw yY;var t=e.calculateMerkleRoot(this.transactions,!0);return 0===this.witnessCommit.compare(t)}}],[{key:"fromBuffer",value:function(t){if(t.length<80)throw new Error("Buffer too small (< 80 bytes)");var n=new cY.BufferReader(t),r=new e;if(r.version=n.readInt32(),r.prevHash=n.readSlice(32),r.merkleRoot=n.readSlice(32),r.timestamp=n.readUInt32(),r.bits=n.readUInt32(),r.nonce=n.readUInt32(),80===t.length)return r;var i=function(){var e=dY.Transaction.fromBuffer(n.buffer.slice(n.offset),!0);return n.offset+=e.byteLength(),e},o=n.readVarInt();r.transactions=[];for(var a=0;a<o;++a){var s=i();r.transactions.push(s)}var u=r.getWitnessCommit();return u&&(r.witnessCommit=u),r}},{key:"fromHex",value:function(t){return e.fromBuffer(Xo.from(t,"hex"))}},{key:"calculateTarget",value:function(e){var t=((4278190080&e)>>24)-3,n=8388607&e,r=Xo.alloc(32,0);return r.writeUIntBE(n,29-t,3),r}},{key:"calculateMerkleRoot",value:function(e,t){if(gY([{getHash:pY.Function}],e),0===e.length)throw vY;if(t&&!wY(e))throw yY;var n=e.map((function(e){return e.getHash(t)})),r=(0,fY.fastMerkleRoot)(n,hY.hash256);return t?hY.hash256(Xo.concat([r,e[0].ins[0].witness[0]])):r}}]),e}();function wY(e){return e instanceof Array&&e[0]&&e[0].ins&&e[0].ins instanceof Array&&e[0].ins[0]&&e[0].ins[0].witness&&e[0].ins[0].witness instanceof Array&&e[0].ins[0].witness.length>0}LJ.Block=mY;var bY={},IY={},BY={},EY={},CY={},xY={},kY={};!function(e){var t,n,r;Object.defineProperty(e,"__esModule",{value:!0}),(t=e.GlobalTypes||(e.GlobalTypes={}))[t.UNSIGNED_TX=0]="UNSIGNED_TX",t[t.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",n[n.TAP_KEY_SIG=19]="TAP_KEY_SIG",n[n.TAP_SCRIPT_SIG=20]="TAP_SCRIPT_SIG",n[n.TAP_LEAF_SCRIPT=21]="TAP_LEAF_SCRIPT",n[n.TAP_BIP32_DERIVATION=22]="TAP_BIP32_DERIVATION",n[n.TAP_INTERNAL_KEY=23]="TAP_INTERNAL_KEY",n[n.TAP_MERKLE_ROOT=24]="TAP_MERKLE_ROOT",e.INPUT_TYPE_NAMES=["nonWitnessUtxo","witnessUtxo","partialSig","sighashType","redeemScript","witnessScript","bip32Derivation","finalScriptSig","finalScriptWitness","porCommitment","tapKeySig","tapScriptSig","tapLeafScript","tapBip32Derivation","tapInternalKey","tapMerkleRoot"],(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",r[r.TAP_INTERNAL_KEY=5]="TAP_INTERNAL_KEY",r[r.TAP_TREE=6]="TAP_TREE",r[r.TAP_BIP32_DERIVATION=7]="TAP_BIP32_DERIVATION",e.OUTPUT_TYPE_NAMES=["redeemScript","witnessScript","bip32Derivation","tapInternalKey","tapTree","tapBip32Derivation"]}(kY);var SY={};Object.defineProperty(SY,"__esModule",{value:!0});var QY=kY;SY.decode=function(e){if(e.key[0]!==QY.GlobalTypes.GLOBAL_XPUB)throw new Error("Decode Error: could not decode globalXpub with key 0x"+e.key.toString("hex"));if(79!==e.key.length||![2,3].includes(e.key[46]))throw new Error("Decode Error: globalXpub has invalid extended pubkey in key 0x"+e.key.toString("hex"));if(e.value.length/4%1!=0)throw new Error("Decode Error: Global GLOBAL_XPUB value length should be multiple of 4");for(var t,n=e.key.slice(1),r={masterFingerprint:e.value.slice(0,4),extendedPubkey:n,path:"m"},i=0,o=(t=e.value.length/4-1,k(Array(t).keys()));i<o.length;i++){var a=o[i],s=e.value.readUInt32LE(4*a+4),u=!!(2147483648&s),l=2147483647&s;r.path+="/"+l.toString(10)+(u?"'":"")}return r},SY.encode=function(e){var t=Xo.from([QY.GlobalTypes.GLOBAL_XPUB]),n=Xo.concat([t,e.extendedPubkey]),r=e.path.split("/"),i=Xo.allocUnsafe(4*r.length);e.masterFingerprint.copy(i,0);var o=4;return r.slice(1).forEach((function(e){var t="'"===e.slice(-1),n=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(n+=2147483648),i.writeUInt32LE(n,o),o+=4})),{key:n,value:i}},SY.expected="{ masterFingerprint: Buffer; extendedPubkey: Buffer; path: string; }",SY.check=function(e){var t=e.extendedPubkey,n=e.masterFingerprint,r=e.path;return Da(t)&&78===t.length&&[2,3].indexOf(t[45])>-1&&Da(n)&&4===n.length&&"string"==typeof r&&!!r.match(/^m(\/\d+'?)*$/)},SY.canAddToArray=function(e,t,n){var r=t.extendedPubkey.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((function(e){return e.extendedPubkey.equals(t.extendedPubkey)})).length)};var _Y={};Object.defineProperty(_Y,"__esModule",{value:!0});var NY=kY;_Y.encode=function(e){return{key:Xo.from([NY.GlobalTypes.UNSIGNED_TX]),value:e.toBuffer()}};var DY={};Object.defineProperty(DY,"__esModule",{value:!0});var FY=kY;DY.decode=function(e){if(e.key[0]!==FY.InputTypes.FINAL_SCRIPTSIG)throw new Error("Decode Error: could not decode finalScriptSig with key 0x"+e.key.toString("hex"));return e.value},DY.encode=function(e){return{key:Xo.from([FY.InputTypes.FINAL_SCRIPTSIG]),value:e}},DY.expected="Buffer",DY.check=function(e){return Da(e)},DY.canAdd=function(e,t){return!!e&&!!t&&void 0===e.finalScriptSig};var PY={};Object.defineProperty(PY,"__esModule",{value:!0});var UY=kY;PY.decode=function(e){if(e.key[0]!==UY.InputTypes.FINAL_SCRIPTWITNESS)throw new Error("Decode Error: could not decode finalScriptWitness with key 0x"+e.key.toString("hex"));return e.value},PY.encode=function(e){return{key:Xo.from([UY.InputTypes.FINAL_SCRIPTWITNESS]),value:e}},PY.expected="Buffer",PY.check=function(e){return Da(e)},PY.canAdd=function(e,t){return!!e&&!!t&&void 0===e.finalScriptWitness};var LY={};Object.defineProperty(LY,"__esModule",{value:!0});var TY=kY;LY.decode=function(e){if(e.key[0]!==TY.InputTypes.NON_WITNESS_UTXO)throw new Error("Decode Error: could not decode nonWitnessUtxo with key 0x"+e.key.toString("hex"));return e.value},LY.encode=function(e){return{key:Xo.from([TY.InputTypes.NON_WITNESS_UTXO]),value:e}},LY.expected="Buffer",LY.check=function(e){return Da(e)},LY.canAdd=function(e,t){return!!e&&!!t&&void 0===e.nonWitnessUtxo};var MY={};Object.defineProperty(MY,"__esModule",{value:!0});var RY=kY;MY.decode=function(e){if(e.key[0]!==RY.InputTypes.PARTIAL_SIG)throw new Error("Decode Error: could not decode partialSig 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: partialSig has invalid pubkey in key 0x"+e.key.toString("hex"));return{pubkey:e.key.slice(1),signature:e.value}},MY.encode=function(e){var t=Xo.from([RY.InputTypes.PARTIAL_SIG]);return{key:Xo.concat([t,e.pubkey]),value:e.signature}},MY.expected="{ pubkey: Buffer; signature: Buffer; }",MY.check=function(e){return Da(e.pubkey)&&Da(e.signature)&&[33,65].includes(e.pubkey.length)&&[2,3,4].includes(e.pubkey[0])&&function(e){if(!Da(e)||e.length<9)return!1;if(48!==e[0])return!1;if(e.length!==e[1]+3)return!1;if(2!==e[2])return!1;var t=e[3];if(t>33||t<1)return!1;if(2!==e[3+t+1])return!1;var n=e[3+t+2];return!(n>33||n<1)&&e.length===3+t+2+n+2}(e.signature)},MY.canAddToArray=function(e,t,n){var r=t.pubkey.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((function(e){return e.pubkey.equals(t.pubkey)})).length)};var OY={};Object.defineProperty(OY,"__esModule",{value:!0});var HY=kY;OY.decode=function(e){if(e.key[0]!==HY.InputTypes.POR_COMMITMENT)throw new Error("Decode Error: could not decode porCommitment with key 0x"+e.key.toString("hex"));return e.value.toString("utf8")},OY.encode=function(e){return{key:Xo.from([HY.InputTypes.POR_COMMITMENT]),value:Xo.from(e,"utf8")}},OY.expected="string",OY.check=function(e){return"string"==typeof e},OY.canAdd=function(e,t){return!!e&&!!t&&void 0===e.porCommitment};var KY={};Object.defineProperty(KY,"__esModule",{value:!0});var jY=kY;KY.decode=function(e){if(e.key[0]!==jY.InputTypes.SIGHASH_TYPE)throw new Error("Decode Error: could not decode sighashType with key 0x"+e.key.toString("hex"));return e.value.readUInt32LE(0)},KY.encode=function(e){var t=Xo.from([jY.InputTypes.SIGHASH_TYPE]),n=Xo.allocUnsafe(4);return n.writeUInt32LE(e,0),{key:t,value:n}},KY.expected="number",KY.check=function(e){return"number"==typeof e},KY.canAdd=function(e,t){return!!e&&!!t&&void 0===e.sighashType};var GY={};Object.defineProperty(GY,"__esModule",{value:!0});var qY=kY;function VY(e){return Da(e)&&(64===e.length||65===e.length)}GY.decode=function(e){if(e.key[0]!==qY.InputTypes.TAP_KEY_SIG||1!==e.key.length)throw new Error("Decode Error: could not decode tapKeySig with key 0x"+e.key.toString("hex"));if(!VY(e.value))throw new Error("Decode Error: tapKeySig not a valid 64-65-byte BIP340 signature");return e.value},GY.encode=function(e){return{key:Xo.from([qY.InputTypes.TAP_KEY_SIG]),value:e}},GY.expected="Buffer",GY.check=VY,GY.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapKeySig};var zY={};Object.defineProperty(zY,"__esModule",{value:!0});var JY=kY;zY.decode=function(e){if(e.key[0]!==JY.InputTypes.TAP_LEAF_SCRIPT)throw new Error("Decode Error: could not decode tapLeafScript with key 0x"+e.key.toString("hex"));if((e.key.length-2)%32!=0)throw new Error("Decode Error: tapLeafScript has invalid control block in key 0x"+e.key.toString("hex"));var t=e.value[e.value.length-1];if((254&e.key[1])!==t)throw new Error("Decode Error: tapLeafScript bad leaf version in key 0x"+e.key.toString("hex"));var n=e.value.slice(0,-1);return{controlBlock:e.key.slice(1),script:n,leafVersion:t}},zY.encode=function(e){var t=Xo.from([JY.InputTypes.TAP_LEAF_SCRIPT]),n=Xo.from([e.leafVersion]);return{key:Xo.concat([t,e.controlBlock]),value:Xo.concat([e.script,n])}},zY.expected="{ controlBlock: Buffer; leafVersion: number, script: Buffer; }",zY.check=function(e){return Da(e.controlBlock)&&(e.controlBlock.length-1)%32==0&&(254&e.controlBlock[0])===e.leafVersion&&Da(e.script)},zY.canAddToArray=function(e,t,n){var r=t.controlBlock.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((function(e){return e.controlBlock.equals(t.controlBlock)})).length)};var YY={};Object.defineProperty(YY,"__esModule",{value:!0});var XY=kY;function WY(e){return Da(e)&&32===e.length}YY.decode=function(e){if(e.key[0]!==XY.InputTypes.TAP_MERKLE_ROOT||1!==e.key.length)throw new Error("Decode Error: could not decode tapMerkleRoot with key 0x"+e.key.toString("hex"));if(!WY(e.value))throw new Error("Decode Error: tapMerkleRoot not a 32-byte hash");return e.value},YY.encode=function(e){return{key:Xo.from([XY.InputTypes.TAP_MERKLE_ROOT]),value:e}},YY.expected="Buffer",YY.check=WY,YY.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapMerkleRoot};var ZY={};Object.defineProperty(ZY,"__esModule",{value:!0});var $Y=kY;ZY.decode=function(e){if(e.key[0]!==$Y.InputTypes.TAP_SCRIPT_SIG)throw new Error("Decode Error: could not decode tapScriptSig with key 0x"+e.key.toString("hex"));if(65!==e.key.length)throw new Error("Decode Error: tapScriptSig has invalid key 0x"+e.key.toString("hex"));if(64!==e.value.length&&65!==e.value.length)throw new Error("Decode Error: tapScriptSig has invalid signature in key 0x"+e.key.toString("hex"));return{pubkey:e.key.slice(1,33),leafHash:e.key.slice(33),signature:e.value}},ZY.encode=function(e){var t=Xo.from([$Y.InputTypes.TAP_SCRIPT_SIG]);return{key:Xo.concat([t,e.pubkey,e.leafHash]),value:e.signature}},ZY.expected="{ pubkey: Buffer; leafHash: Buffer; signature: Buffer; }",ZY.check=function(e){return Da(e.pubkey)&&Da(e.leafHash)&&Da(e.signature)&&32===e.pubkey.length&&32===e.leafHash.length&&(64===e.signature.length||65===e.signature.length)},ZY.canAddToArray=function(e,t,n){var r=t.pubkey.toString("hex")+t.leafHash.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((function(e){return e.pubkey.equals(t.pubkey)&&e.leafHash.equals(t.leafHash)})).length)};var eX={},tX={},nX={};function rX(e){if(e<0||e>9007199254740991||e%1!=0)throw new RangeError("value out of range")}function iX(e){return rX(e),e<253?1:e<=65535?3:e<=4294967295?5:9}Object.defineProperty(nX,"__esModule",{value:!0}),nX.encode=function e(t,n,r){if(rX(t),n||(n=Xo.allocUnsafe(iX(t))),!Da(n))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),t<253?(n.writeUInt8(t,r),Object.assign(e,{bytes:1})):t<=65535?(n.writeUInt8(253,r),n.writeUInt16LE(t,r+1),Object.assign(e,{bytes:3})):t<=4294967295?(n.writeUInt8(254,r),n.writeUInt32LE(t,r+1),Object.assign(e,{bytes:5})):(n.writeUInt8(255,r),n.writeUInt32LE(t>>>0,r+1),n.writeUInt32LE(t/4294967296|0,r+5),Object.assign(e,{bytes:9})),n},nX.decode=function e(t,n){if(!Da(t))throw new TypeError("buffer must be a Buffer instance");n||(n=0);var r=t.readUInt8(n);if(r<253)return Object.assign(e,{bytes:1}),r;if(253===r)return Object.assign(e,{bytes:3}),t.readUInt16LE(n+1);if(254===r)return Object.assign(e,{bytes:5}),t.readUInt32LE(n+1);Object.assign(e,{bytes:9});var i=t.readUInt32LE(n+1),o=4294967296*t.readUInt32LE(n+5)+i;return rX(o),o},nX.encodingLength=iX,Object.defineProperty(tX,"__esModule",{value:!0});var oX=nX;function aX(e){var t=e.key.length,n=e.value.length,r=oX.encodingLength(t),i=oX.encodingLength(n),o=Xo.allocUnsafe(r+t+i+n);return oX.encode(t,o,0),e.key.copy(o,r),oX.encode(n,o,r+t),e.value.copy(o,r+t+i),o}function sX(e,t){if("number"!=typeof e)throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}tX.range=function(e){return k(Array(e).keys())},tX.reverseBuffer=function(e){if(e.length<1)return e;for(var t=e.length-1,n=0,r=0;r<e.length/2;r++)n=e[r],e[r]=e[t],e[t]=n,t--;return e},tX.keyValsToBuffer=function(e){var t=e.map(aX);return t.push(Xo.from([0])),Xo.concat(t)},tX.keyValToBuffer=aX,tX.readUInt64LE=function(e,t){var n=e.readUInt32LE(t),r=e.readUInt32LE(t+4);return sX((r*=4294967296)+n,9007199254740991),r+n},tX.writeUInt64LE=function(e,t,n){return sX(t,9007199254740991),e.writeInt32LE(-1&t,n),e.writeUInt32LE(Math.floor(t/4294967296),n+4),n+8},Object.defineProperty(eX,"__esModule",{value:!0});var uX=kY,lX=tX,AX=nX;eX.decode=function(e){if(e.key[0]!==uX.InputTypes.WITNESS_UTXO)throw new Error("Decode Error: could not decode witnessUtxo with key 0x"+e.key.toString("hex"));var t=lX.readUInt64LE(e.value,0),n=8,r=AX.decode(e.value,n);n+=AX.encodingLength(r);var i=e.value.slice(n);if(i.length!==r)throw new Error("Decode Error: WITNESS_UTXO script is not proper length");return{script:i,value:t}},eX.encode=function(e){var t=e.script,n=e.value,r=AX.encodingLength(t.length),i=Xo.allocUnsafe(8+r+t.length);return lX.writeUInt64LE(i,n,0),AX.encode(t.length,i,8),t.copy(i,8+r),{key:Xo.from([uX.InputTypes.WITNESS_UTXO]),value:i}},eX.expected="{ script: Buffer; value: number; }",eX.check=function(e){return Da(e.script)&&"number"==typeof e.value},eX.canAdd=function(e,t){return!!e&&!!t&&void 0===e.witnessUtxo};var cX={};Object.defineProperty(cX,"__esModule",{value:!0});var hX=kY,fX=nX;cX.decode=function(e){if(e.key[0]!==hX.OutputTypes.TAP_TREE||1!==e.key.length)throw new Error("Decode Error: could not decode tapTree with key 0x"+e.key.toString("hex"));for(var t=0,n=[];t<e.value.length;){var r=e.value[t++],i=e.value[t++],o=fX.decode(e.value,t);t+=fX.encodingLength(o),n.push({depth:r,leafVersion:i,script:e.value.slice(t,t+o)}),t+=o}return{leaves:n}},cX.encode=function(e){var t,n=Xo.from([hX.OutputTypes.TAP_TREE]),r=(t=[]).concat.apply(t,k(e.leaves.map((function(e){return[Xo.of(e.depth,e.leafVersion),fX.encode(e.script.length),e.script]}))));return{key:n,value:Xo.concat(r)}},cX.expected="{ leaves: [{ depth: number; leafVersion: number, script: Buffer; }] }",cX.check=function(e){return Array.isArray(e.leaves)&&e.leaves.every((function(e){return e.depth>=0&&e.depth<=128&&(254&e.leafVersion)===e.leafVersion&&Da(e.script)}))},cX.canAdd=function(e,t){return!!e&&!!t&&void 0===e.tapTree};var dX={};Object.defineProperty(dX,"__esModule",{value:!0});var pX=function(e){return 33===e.length&&[2,3].includes(e[0])||65===e.length&&4===e[0]};dX.makeConverter=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:pX;return{decode:function(n){if(n.key[0]!==e)throw new Error("Decode Error: could not decode bip32Derivation with key 0x"+n.key.toString("hex"));var r=n.key.slice(1);if(!t(r))throw new Error("Decode Error: bip32Derivation has invalid pubkey in key 0x"+n.key.toString("hex"));if(n.value.length/4%1!=0)throw new Error("Decode Error: Input BIP32_DERIVATION value length should be multiple of 4");for(var i,o={masterFingerprint:n.value.slice(0,4),pubkey:r,path:"m"},a=0,s=(i=n.value.length/4-1,k(Array(i).keys()));a<s.length;a++){var u=s[a],l=n.value.readUInt32LE(4*u+4),A=!!(2147483648&l),c=2147483647&l;o.path+="/"+c.toString(10)+(A?"'":"")}return o},encode:function(t){var n=Xo.from([e]),r=Xo.concat([n,t.pubkey]),i=t.path.split("/"),o=Xo.allocUnsafe(4*i.length);t.masterFingerprint.copy(o,0);var a=4;return i.slice(1).forEach((function(e){var t="'"===e.slice(-1),n=2147483647&parseInt(t?e.slice(0,-1):e,10);t&&(n+=2147483648),o.writeUInt32LE(n,a),a+=4})),{key:r,value:o}},check:function(e){return Da(e.pubkey)&&Da(e.masterFingerprint)&&"string"==typeof e.path&&t(e.pubkey)&&4===e.masterFingerprint.length},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; }",canAddToArray:function(e,t,n){var r=t.pubkey.toString("hex");return!n.has(r)&&(n.add(r),0===e.filter((function(e){return e.pubkey.equals(t.pubkey)})).length)}}};var gX={};Object.defineProperty(gX,"__esModule",{value:!0}),gX.makeChecker=function(e){return function(t){var n;if(e.includes(t.key[0])&&(33!==(n=t.key.slice(1)).length&&65!==n.length||![2,3,4].includes(n[0])))throw new Error("Format Error: invalid pubkey in key 0x"+t.key.toString("hex"));return n}};var vX={};Object.defineProperty(vX,"__esModule",{value:!0}),vX.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode redeemScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(t){return{key:Xo.from([e]),value:t}},check:function(e){return Da(e)},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.redeemScript}}};var yX={};Object.defineProperty(yX,"__esModule",{value:!0});var mX=nX,wX=dX,bX=function(e){return 32===e.length};yX.makeConverter=function(e){var t=wX.makeConverter(e,bX);return{decode:function(e){for(var n=mX.decode(e.value),r=mX.encodingLength(n),i=t.decode({key:e.key,value:e.value.slice(r+32*n)}),o=new Array(n),a=0,s=r;a<n;a++,s+=32)o[a]=e.value.slice(s,s+32);return Object.assign({},i,{leafHashes:o})},encode:function(e){var n=t.encode(e),r=mX.encodingLength(e.leafHashes.length),i=Xo.allocUnsafe(r);mX.encode(e.leafHashes.length,i);var o=Xo.concat([i].concat(k(e.leafHashes),[n.value]));return Object.assign({},n,{value:o})},check:function(e){return Array.isArray(e.leafHashes)&&e.leafHashes.every((function(e){return Da(e)&&32===e.length}))&&t.check(e)},expected:"{ masterFingerprint: Buffer; pubkey: Buffer; path: string; leafHashes: Buffer[]; }",canAddToArray:t.canAddToArray}};var IX={};Object.defineProperty(IX,"__esModule",{value:!0}),IX.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e||1!==t.key.length)throw new Error("Decode Error: could not decode tapInternalKey with key 0x"+t.key.toString("hex"));if(32!==t.value.length)throw new Error("Decode Error: tapInternalKey not a 32-byte x-only pubkey");return t.value},encode:function(t){return{key:Xo.from([e]),value:t}},check:function(e){return Da(e)&&32===e.length},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.tapInternalKey}}};var BX={};Object.defineProperty(BX,"__esModule",{value:!0}),BX.makeConverter=function(e){return{decode:function(t){if(t.key[0]!==e)throw new Error("Decode Error: could not decode witnessScript with key 0x"+t.key.toString("hex"));return t.value},encode:function(t){return{key:Xo.from([e]),value:t}},check:function(e){return Da(e)},expected:"Buffer",canAdd:function(e,t){return!!e&&!!t&&void 0===e.witnessScript}}},Object.defineProperty(xY,"__esModule",{value:!0});var EX=kY,CX=DY,xX=PY,kX=LY,SX=MY,QX=OY,_X=KY,NX=GY,DX=zY,FX=YY,PX=ZY,UX=eX,LX=cX,TX=dX,MX=gX,RX=vX,OX=yX,HX=IX,KX=BX,jX={unsignedTx:_Y,globalXpub:SY,checkPubkey:MX.makeChecker([])};xY.globals=jX;var GX={nonWitnessUtxo:kX,partialSig:SX,sighashType:_X,finalScriptSig:CX,finalScriptWitness:xX,porCommitment:QX,witnessUtxo:UX,bip32Derivation:TX.makeConverter(EX.InputTypes.BIP32_DERIVATION),redeemScript:RX.makeConverter(EX.InputTypes.REDEEM_SCRIPT),witnessScript:KX.makeConverter(EX.InputTypes.WITNESS_SCRIPT),checkPubkey:MX.makeChecker([EX.InputTypes.PARTIAL_SIG,EX.InputTypes.BIP32_DERIVATION]),tapKeySig:NX,tapScriptSig:PX,tapLeafScript:DX,tapBip32Derivation:OX.makeConverter(EX.InputTypes.TAP_BIP32_DERIVATION),tapInternalKey:HX.makeConverter(EX.InputTypes.TAP_INTERNAL_KEY),tapMerkleRoot:FX};xY.inputs=GX;var qX={bip32Derivation:TX.makeConverter(EX.OutputTypes.BIP32_DERIVATION),redeemScript:RX.makeConverter(EX.OutputTypes.REDEEM_SCRIPT),witnessScript:KX.makeConverter(EX.OutputTypes.WITNESS_SCRIPT),checkPubkey:MX.makeChecker([EX.OutputTypes.BIP32_DERIVATION]),tapBip32Derivation:OX.makeConverter(EX.OutputTypes.TAP_BIP32_DERIVATION),tapTree:LX,tapInternalKey:HX.makeConverter(EX.OutputTypes.TAP_INTERNAL_KEY)};xY.outputs=qX,Object.defineProperty(CY,"__esModule",{value:!0});var VX=xY,zX=tX,JX=nX,YX=kY;function XX(e,t,n){if(!t.equals(Xo.from([n])))throw new Error("Format Error: Invalid ".concat(e," key: ").concat(t.toString("hex")))}function WX(e,t){var n,r=t.globalMapKeyVals,i=t.inputKeyVals,o=t.outputKeyVals,a={unsignedTx:e},s=0,u=F(r);try{for(u.s();!(n=u.n()).done;){var l=n.value;switch(l.key[0]){case YX.GlobalTypes.UNSIGNED_TX:if(XX("global",l.key,YX.GlobalTypes.UNSIGNED_TX),s>0)throw new Error("Format Error: GlobalMap has multiple UNSIGNED_TX");s++;break;case YX.GlobalTypes.GLOBAL_XPUB:void 0===a.globalXpub&&(a.globalXpub=[]),a.globalXpub.push(VX.globals.globalXpub.decode(l));break;default:a.unknownKeyVals||(a.unknownKeyVals=[]),a.unknownKeyVals.push(l)}}}catch(e){u.e(e)}finally{u.f()}var A,c=i.length,h=o.length,f=[],d=[],p=F(zX.range(c));try{for(p.s();!(A=p.n()).done;){var g,v=A.value,y={},m=F(i[v]);try{for(m.s();!(g=m.n()).done;){var w=g.value;switch(VX.inputs.checkPubkey(w),w.key[0]){case YX.InputTypes.NON_WITNESS_UTXO:if(XX("input",w.key,YX.InputTypes.NON_WITNESS_UTXO),void 0!==y.nonWitnessUtxo)throw new Error("Format Error: Input has multiple NON_WITNESS_UTXO");y.nonWitnessUtxo=VX.inputs.nonWitnessUtxo.decode(w);break;case YX.InputTypes.WITNESS_UTXO:if(XX("input",w.key,YX.InputTypes.WITNESS_UTXO),void 0!==y.witnessUtxo)throw new Error("Format Error: Input has multiple WITNESS_UTXO");y.witnessUtxo=VX.inputs.witnessUtxo.decode(w);break;case YX.InputTypes.PARTIAL_SIG:void 0===y.partialSig&&(y.partialSig=[]),y.partialSig.push(VX.inputs.partialSig.decode(w));break;case YX.InputTypes.SIGHASH_TYPE:if(XX("input",w.key,YX.InputTypes.SIGHASH_TYPE),void 0!==y.sighashType)throw new Error("Format Error: Input has multiple SIGHASH_TYPE");y.sighashType=VX.inputs.sighashType.decode(w);break;case YX.InputTypes.REDEEM_SCRIPT:if(XX("input",w.key,YX.InputTypes.REDEEM_SCRIPT),void 0!==y.redeemScript)throw new Error("Format Error: Input has multiple REDEEM_SCRIPT");y.redeemScript=VX.inputs.redeemScript.decode(w);break;case YX.InputTypes.WITNESS_SCRIPT:if(XX("input",w.key,YX.InputTypes.WITNESS_SCRIPT),void 0!==y.witnessScript)throw new Error("Format Error: Input has multiple WITNESS_SCRIPT");y.witnessScript=VX.inputs.witnessScript.decode(w);break;case YX.InputTypes.BIP32_DERIVATION:void 0===y.bip32Derivation&&(y.bip32Derivation=[]),y.bip32Derivation.push(VX.inputs.bip32Derivation.decode(w));break;case YX.InputTypes.FINAL_SCRIPTSIG:XX("input",w.key,YX.InputTypes.FINAL_SCRIPTSIG),y.finalScriptSig=VX.inputs.finalScriptSig.decode(w);break;case YX.InputTypes.FINAL_SCRIPTWITNESS:XX("input",w.key,YX.InputTypes.FINAL_SCRIPTWITNESS),y.finalScriptWitness=VX.inputs.finalScriptWitness.decode(w);break;case YX.InputTypes.POR_COMMITMENT:XX("input",w.key,YX.InputTypes.POR_COMMITMENT),y.porCommitment=VX.inputs.porCommitment.decode(w);break;case YX.InputTypes.TAP_KEY_SIG:XX("input",w.key,YX.InputTypes.TAP_KEY_SIG),y.tapKeySig=VX.inputs.tapKeySig.decode(w);break;case YX.InputTypes.TAP_SCRIPT_SIG:void 0===y.tapScriptSig&&(y.tapScriptSig=[]),y.tapScriptSig.push(VX.inputs.tapScriptSig.decode(w));break;case YX.InputTypes.TAP_LEAF_SCRIPT:void 0===y.tapLeafScript&&(y.tapLeafScript=[]),y.tapLeafScript.push(VX.inputs.tapLeafScript.decode(w));break;case YX.InputTypes.TAP_BIP32_DERIVATION:void 0===y.tapBip32Derivation&&(y.tapBip32Derivation=[]),y.tapBip32Derivation.push(VX.inputs.tapBip32Derivation.decode(w));break;case YX.InputTypes.TAP_INTERNAL_KEY:XX("input",w.key,YX.InputTypes.TAP_INTERNAL_KEY),y.tapInternalKey=VX.inputs.tapInternalKey.decode(w);break;case YX.InputTypes.TAP_MERKLE_ROOT:XX("input",w.key,YX.InputTypes.TAP_MERKLE_ROOT),y.tapMerkleRoot=VX.inputs.tapMerkleRoot.decode(w);break;default:y.unknownKeyVals||(y.unknownKeyVals=[]),y.unknownKeyVals.push(w)}}}catch(e){m.e(e)}finally{m.f()}f.push(y)}}catch(e){p.e(e)}finally{p.f()}var b,I=F(zX.range(h));try{for(I.s();!(b=I.n()).done;){var B,E=b.value,C={},x=F(o[E]);try{for(x.s();!(B=x.n()).done;){var k=B.value;switch(VX.outputs.checkPubkey(k),k.key[0]){case YX.OutputTypes.REDEEM_SCRIPT:if(XX("output",k.key,YX.OutputTypes.REDEEM_SCRIPT),void 0!==C.redeemScript)throw new Error("Format Error: Output has multiple REDEEM_SCRIPT");C.redeemScript=VX.outputs.redeemScript.decode(k);break;case YX.OutputTypes.WITNESS_SCRIPT:if(XX("output",k.key,YX.OutputTypes.WITNESS_SCRIPT),void 0!==C.witnessScript)throw new Error("Format Error: Output has multiple WITNESS_SCRIPT");C.witnessScript=VX.outputs.witnessScript.decode(k);break;case YX.OutputTypes.BIP32_DERIVATION:void 0===C.bip32Derivation&&(C.bip32Derivation=[]),C.bip32Derivation.push(VX.outputs.bip32Derivation.decode(k));break;case YX.OutputTypes.TAP_INTERNAL_KEY:XX("output",k.key,YX.OutputTypes.TAP_INTERNAL_KEY),C.tapInternalKey=VX.outputs.tapInternalKey.decode(k);break;case YX.OutputTypes.TAP_TREE:XX("output",k.key,YX.OutputTypes.TAP_TREE),C.tapTree=VX.outputs.tapTree.decode(k);break;case YX.OutputTypes.TAP_BIP32_DERIVATION:void 0===C.tapBip32Derivation&&(C.tapBip32Derivation=[]),C.tapBip32Derivation.push(VX.outputs.tapBip32Derivation.decode(k));break;default:C.unknownKeyVals||(C.unknownKeyVals=[]),C.unknownKeyVals.push(k)}}}catch(e){x.e(e)}finally{x.f()}d.push(C)}}catch(e){I.e(e)}finally{I.f()}return{globalMap:a,inputs:f,outputs:d}}CY.psbtFromBuffer=function(e,t){var n=0;function r(){var t=JX.decode(e,n);n+=JX.encodingLength(t);var r=e.slice(n,n+t);return n+=t,r}function i(){return{key:r(),value:r()}}function o(){if(n>=e.length)throw new Error("Format Error: Unexpected End of PSBT");var t=0===e.readUInt8(n);return t&&n++,t}if(1886610036!==function(){var t=e.readUInt32BE(n);return n+=4,t}())throw new Error("Format Error: Invalid Magic Number");if(255!==function(){var t=e.readUInt8(n);return n+=1,t}())throw new Error("Format Error: Magic Number must be followed by 0xff separator");for(var a=[],s={};!o();){var u=i(),l=u.key.toString("hex");if(s[l])throw new Error("Format Error: Keys must be unique for global keymap: key "+l);s[l]=1,a.push(u)}var A=a.filter((function(e){return e.key[0]===YX.GlobalTypes.UNSIGNED_TX}));if(1!==A.length)throw new Error("Format Error: Only one UNSIGNED_TX allowed");var c,h=t(A[0].value),f=h.getInputOutputCounts(),d=f.inputCount,p=f.outputCount,g=[],v=[],y=F(zX.range(d));try{for(y.s();!(c=y.n()).done;){for(var m=c.value,w={},b=[];!o();){var I=i(),B=I.key.toString("hex");if(w[B])throw new Error("Format Error: Keys must be unique for each input: input index "+m+" key "+B);w[B]=1,b.push(I)}g.push(b)}}catch(e){y.e(e)}finally{y.f()}var E,C=F(zX.range(p));try{for(C.s();!(E=C.n()).done;){for(var x=E.value,k={},S=[];!o();){var Q=i(),_=Q.key.toString("hex");if(k[_])throw new Error("Format Error: Keys must be unique for each output: output index "+x+" key "+_);k[_]=1,S.push(Q)}v.push(S)}}catch(e){C.e(e)}finally{C.f()}return WX(h,{globalMapKeyVals:a,inputKeyVals:g,outputKeyVals:v})},CY.checkKeyBuffer=XX,CY.psbtFromKeyVals=WX;var ZX={};Object.defineProperty(ZX,"__esModule",{value:!0});var $X=xY,eW=tX;ZX.psbtToBuffer=function(e){var t=rW({globalMap:e.globalMap,inputs:e.inputs,outputs:e.outputs}),n=t.globalKeyVals,r=t.inputKeyVals,i=t.outputKeyVals,o=eW.keyValsToBuffer(n),a=function(e){return 0===e.length?[Xo.from([0])]:e.map(eW.keyValsToBuffer)},s=a(r),u=a(i),l=Xo.allocUnsafe(5);return l.writeUIntBE(482972169471,0,5),Xo.concat([l,o].concat(s,u))};var tW=function(e,t){return e.key.compare(t.key)};function nW(e,t){var n=new Set,r=Object.entries(e).reduce((function(e,r){var i=C(r,2),o=i[0],a=i[1];if("unknownKeyVals"===o)return e;var s=t[o];if(void 0===s)return e;var u=(Array.isArray(a)?a:[a]).map(s.encode);return u.map((function(e){return e.key.toString("hex")})).forEach((function(e){if(n.has(e))throw new Error("Serialize Error: Duplicate key: "+e);n.add(e)})),e.concat(u)}),[]),i=e.unknownKeyVals?e.unknownKeyVals.filter((function(e){return!n.has(e.key.toString("hex"))})):[];return r.concat(i).sort(tW)}function rW(e){var t=e.globalMap,n=e.inputs,r=e.outputs;return{globalKeyVals:nW(t,$X.globals),inputKeyVals:n.map((function(e){return nW(e,$X.inputs)})),outputKeyVals:r.map((function(e){return nW(e,$X.outputs)}))}}ZX.psbtToKeyVals=rW,function(e){function t(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,"__esModule",{value:!0}),t(CY),t(ZX)}(EY),Object.defineProperty(BY,"__esModule",{value:!0});var iW=EY;function oW(e,t,n){return function(r){if(!e.has(r)){var i=n.filter((function(e){return e.key.toString("hex")===r}))[0];t.push(i),e.add(r)}}}function aW(e){return e.globalMap.unsignedTx}function sW(e){var t=new Set;return e.forEach((function(e){var n=e.key.toString("hex");if(t.has(n))throw new Error("Combine: KeyValue Map keys should be unique");t.add(n)})),t}BY.combine=function(e){var t=e[0],n=iW.psbtToKeyVals(t),r=e.slice(1);if(0===r.length)throw new Error("Combine: Nothing to combine");var i=aW(t);if(void 0===i)throw new Error("Combine: Self missing transaction");var o,a=sW(n.globalKeyVals),s=n.inputKeyVals.map(sW),u=n.outputKeyVals.map(sW),l=F(r);try{var A=function(){var e=o.value,t=aW(e);if(void 0===t||!t.toBuffer().equals(i.toBuffer()))throw new Error("Combine: One of the Psbts does not have the same transaction.");var r=iW.psbtToKeyVals(e);sW(r.globalKeyVals).forEach(oW(a,n.globalKeyVals,r.globalKeyVals)),r.inputKeyVals.map(sW).forEach((function(e,t){return e.forEach(oW(s[t],n.inputKeyVals[t],r.inputKeyVals[t]))})),r.outputKeyVals.map(sW).forEach((function(e,t){return e.forEach(oW(u[t],n.outputKeyVals[t],r.outputKeyVals[t]))}))};for(l.s();!(o=l.n()).done;)A()}catch(e){l.e(e)}finally{l.f()}return iW.psbtFromKeyVals(i,{globalMapKeyVals:n.globalKeyVals,inputKeyVals:n.inputKeyVals,outputKeyVals:n.outputKeyVals})};var uW={};!function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=xY;function n(e,t){var n=e[t];if(void 0===n)throw new Error("No input #".concat(t));return n}function r(e,t){var n=e[t];if(void 0===n)throw new Error("No output #".concat(t));return n}function i(e,t,n,r){throw new Error("Data for ".concat(e," key ").concat(t," is incorrect: Expected ").concat(n," and got ").concat(JSON.stringify(r)))}function o(e){return function(n,r){for(var o=function(){var o=s[a],u=n[o],l=t[e+"s"][o]||{},A=l.canAdd,c=l.canAddToArray,h=l.check,f=l.expected;if(h)if(!!c){if(!Array.isArray(u)||r[o]&&!Array.isArray(r[o]))throw new Error("Key type ".concat(o," must be an array"));u.every(h)||i(e,o,f,u);var d=r[o]||[],p=new Set;if(!u.every((function(e){return c(d,e,p)})))throw new Error("Can not add duplicate data to array");r[o]=d.concat(u)}else{if(h(u)||i(e,o,f,u),!A(r,u))throw new Error("Can not add duplicate data to ".concat(e));r[o]=u}},a=0,s=Object.keys(n);a<s.length;a++)o()}}e.checkForInput=n,e.checkForOutput=r,e.checkHasKey=function(e,t,n){if(e.key[0]<n)throw new Error("Use the method for your specific key instead of addUnknownKeyVal*");if(t&&0!==t.filter((function(t){return t.key.equals(e.key)})).length)throw new Error("Duplicate Key: ".concat(e.key.toString("hex")))},e.getEnumLength=function(e){var t=0;return Object.keys(e).forEach((function(e){Number(isNaN(Number(e)))&&t++})),t},e.inputCheckUncleanFinalized=function(e,t){var n=!1;if(t.nonWitnessUtxo||t.witnessUtxo){var r=!!t.redeemScript,i=!!t.witnessScript,o=!r||!!t.finalScriptSig,a=!i||!!t.finalScriptWitness,s=!!t.finalScriptSig||!!t.finalScriptWitness;n=o&&a&&s}if(!1===n)throw new Error("Input #".concat(e," has too much or too little data to clean"))},e.updateGlobal=o("global"),e.updateInput=o("input"),e.updateOutput=o("output"),e.addInputAttributes=function(t,r){var i=n(t,t.length-1);e.updateInput(r,i)},e.addOutputAttributes=function(t,n){var i=r(t,t.length-1);e.updateOutput(n,i)},e.defaultVersionSetter=function(e,t){if(!Da(t)||t.length<4)throw new Error("Set Version: Invalid Transaction");return t.writeUInt32LE(e,0),t},e.defaultLocktimeSetter=function(e,t){if(!Da(t)||t.length<4)throw new Error("Set Locktime: Invalid Transaction");return t.writeUInt32LE(e,t.length-4),t}}(uW),Object.defineProperty(IY,"__esModule",{value:!0});var lW=BY,AW=EY,cW=kY,hW=uW;IY.Psbt=function(){function e(t){s(this,e),this.inputs=[],this.outputs=[],this.globalMap={unsignedTx:t}}return l(e,[{key:"toBase64",value:function(){return this.toBuffer().toString("base64")}},{key:"toHex",value:function(){return this.toBuffer().toString("hex")}},{key:"toBuffer",value:function(){return AW.psbtToBuffer(this)}},{key:"updateGlobal",value:function(e){return hW.updateGlobal(e,this.globalMap),this}},{key:"updateInput",value:function(e,t){var n=hW.checkForInput(this.inputs,e);return hW.updateInput(t,n),this}},{key:"updateOutput",value:function(e,t){var n=hW.checkForOutput(this.outputs,e);return hW.updateOutput(t,n),this}},{key:"addUnknownKeyValToGlobal",value:function(e){return hW.checkHasKey(e,this.globalMap.unknownKeyVals,hW.getEnumLength(cW.GlobalTypes)),this.globalMap.unknownKeyVals||(this.globalMap.unknownKeyVals=[]),this.globalMap.unknownKeyVals.push(e),this}},{key:"addUnknownKeyValToInput",value:function(e,t){var n=hW.checkForInput(this.inputs,e);return hW.checkHasKey(t,n.unknownKeyVals,hW.getEnumLength(cW.InputTypes)),n.unknownKeyVals||(n.unknownKeyVals=[]),n.unknownKeyVals.push(t),this}},{key:"addUnknownKeyValToOutput",value:function(e,t){var n=hW.checkForOutput(this.outputs,e);return hW.checkHasKey(t,n.unknownKeyVals,hW.getEnumLength(cW.OutputTypes)),n.unknownKeyVals||(n.unknownKeyVals=[]),n.unknownKeyVals.push(t),this}},{key:"addInput",value:function(e){var t=this;this.globalMap.unsignedTx.addInput(e),this.inputs.push({unknownKeyVals:[]});var n=e.unknownKeyVals||[],r=this.inputs.length-1;if(!Array.isArray(n))throw new Error("unknownKeyVals must be an Array");return n.forEach((function(e){return t.addUnknownKeyValToInput(r,e)})),hW.addInputAttributes(this.inputs,e),this}},{key:"addOutput",value:function(e){var t=this;this.globalMap.unsignedTx.addOutput(e),this.outputs.push({unknownKeyVals:[]});var n=e.unknownKeyVals||[],r=this.outputs.length-1;if(!Array.isArray(n))throw new Error("unknownKeyVals must be an Array");return n.forEach((function(e){return t.addUnknownKeyValToInput(r,e)})),hW.addOutputAttributes(this.outputs,e),this}},{key:"clearFinalizedInput",value:function(e){var t=hW.checkForInput(this.inputs,e);hW.inputCheckUncleanFinalized(e,t);for(var n=0,r=Object.keys(t);n<r.length;n++){var i=r[n];["witnessUtxo","nonWitnessUtxo","finalScriptSig","finalScriptWitness","unknownKeyVals"].includes(i)||delete t[i]}return this}},{key:"combine",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=lW.combine([this].concat(t));return Object.assign(this,r),this}},{key:"getTransaction",value:function(){return this.globalMap.unsignedTx.toBuffer()}}],[{key:"fromBase64",value:function(e,t){var n=Xo.from(e,"base64");return this.fromBuffer(n,t)}},{key:"fromHex",value:function(e,t){var n=Xo.from(e,"hex");return this.fromBuffer(n,t)}},{key:"fromBuffer",value:function(e,t){var n=AW.psbtFromBuffer(e,t),r=new this(n.globalMap.unsignedTx);return Object.assign(r,n),r}}]),e}(),Object.defineProperty(bY,"__esModule",{value:!0}),bY.Psbt=void 0;var fW=IY,dW=nX,pW=uW,gW=Yq,vW=TJ,yW=Bz,mW=Wq,wW=$q,bW=XJ,IW={network:Xq.bitcoin,maximumFeeRate:5e3},BW=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new fW.Psbt(new CW);s(this,e),this.data=n,this.opts=Object.assign({},IW,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);var r=function(e,t,n,r){return Object.defineProperty(e,t,{enumerable:n,writable:r})};r(this,"__CACHE",!1,!0),r(this,"opts",!1,!0)}return l(e,[{key:"inputCount",get:function(){return this.data.inputs.length}},{key:"version",get:function(){return this.__CACHE.__TX.version},set:function(e){this.setVersion(e)}},{key:"locktime",get:function(){return this.__CACHE.__TX.locktime},set:function(e){this.setLocktime(e)}},{key:"txInputs",get:function(){return this.__CACHE.__TX.ins.map((function(e){return{hash:(0,vW.cloneBuffer)(e.hash),index:e.index,sequence:e.sequence}}))}},{key:"txOutputs",get:function(){var e=this;return this.__CACHE.__TX.outs.map((function(t){var n;try{n=(0,gW.fromOutputScript)(t.script,e.opts.network)}catch(t){}return{script:(0,vW.cloneBuffer)(t.script),value:t.value,address:n}}))}},{key:"combine",value:function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return(e=this.data).combine.apply(e,k(n.map((function(e){return e.data})))),this}},{key:"clone",value:function(){var t=e.fromBuffer(this.data.toBuffer());return t.opts=JSON.parse(JSON.stringify(this.opts)),t}},{key:"setMaximumFeeRate",value:function(e){TW(e),this.opts.maximumFeeRate=e}},{key:"setVersion",value:function(e){TW(e),MW(this.data.inputs,"setVersion");var t=this.__CACHE;return t.__TX.version=e,t.__EXTRACTED_TX=void 0,this}},{key:"setLocktime",value:function(e){TW(e),MW(this.data.inputs,"setLocktime");var t=this.__CACHE;return t.__TX.locktime=e,t.__EXTRACTED_TX=void 0,this}},{key:"setInputSequence",value:function(e,t){TW(t),MW(this.data.inputs,"setInputSequence");var n=this.__CACHE;if(n.__TX.ins.length<=e)throw new Error("Input index too high");return n.__TX.ins[e].sequence=t,n.__EXTRACTED_TX=void 0,this}},{key:"addInputs",value:function(e){var t=this;return e.forEach((function(e){return t.addInput(e)})),this}},{key:"addInput",value:function(e){if(arguments.length>1||!e||void 0===e.hash||void 0===e.index)throw new Error("Invalid arguments for Psbt.addInput. Requires single object with at least [hash] and [index]");MW(this.data.inputs,"addInput"),e.witnessScript&&nZ(e.witnessScript);var t=this.__CACHE;this.data.addInput(e),OW(t,t.__TX.ins[t.__TX.ins.length-1]);var n=this.data.inputs.length-1,r=this.data.inputs[n];return r.nonWitnessUtxo&&XW(this.__CACHE,r,n),t.__FEE=void 0,t.__FEE_RATE=void 0,t.__EXTRACTED_TX=void 0,this}},{key:"addOutputs",value:function(e){var t=this;return e.forEach((function(e){return t.addOutput(e)})),this}},{key:"addOutput",value:function(e){if(arguments.length>1||!e||void 0===e.value||void 0===e.address&&void 0===e.script)throw new Error("Invalid arguments for Psbt.addOutput. Requires single object with at least [script or address] and [value]");MW(this.data.inputs,"addOutput");var t=e,n=t.address;if("string"==typeof n){var r=this.opts.network,i=(0,gW.toOutputScript)(n,r);e=Object.assign(e,{script:i})}var o=this.__CACHE;return this.data.addOutput(e),o.__FEE=void 0,o.__FEE_RATE=void 0,o.__EXTRACTED_TX=void 0,this}},{key:"extractTransaction",value:function(e){if(!this.data.inputs.every(SW))throw new Error("Not finalized");var t=this.__CACHE;if(e||function(e,t,n){var r=t.__FEE_RATE||e.getFeeRate(),i=t.__EXTRACTED_TX.virtualSize(),o=r*i;if(r>=n.maximumFeeRate)throw new Error("Warning: You are paying around ".concat((o/1e8).toFixed(8)," in fees, which is ").concat(r," satoshi per byte for a transaction with a VSize of ").concat(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,t,this.opts),t.__EXTRACTED_TX)return t.__EXTRACTED_TX;var n=t.__TX.clone();return WW(this.data.inputs,n,t,!0),n}},{key:"getFeeRate",value:function(){return GW("__FEE_RATE","fee rate",this.data.inputs,this.__CACHE)}},{key:"getFee",value:function(){return GW("__FEE","fee",this.data.inputs,this.__CACHE)}},{key:"finalizeAllInputs",value:function(){var e=this;return(0,pW.checkForInput)(this.data.inputs,0),oZ(this.data.inputs.length).forEach((function(t){return e.finalizeInput(t)})),this}},{key:"finalizeInput",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:qW,n=(0,pW.checkForInput)(this.data.inputs,e),r=function(e,t,n){var r=n.__TX,i={script:null,isSegwit:!1,isP2SH:!1,isP2WSH:!1};if(i.isP2SH=!!t.redeemScript,i.isP2WSH=!!t.witnessScript,t.witnessScript)i.script=t.witnessScript;else if(t.redeemScript)i.script=t.redeemScript;else if(t.nonWitnessUtxo){var o=ZW(n,t,e),a=r.ins[e].index;i.script=o.outs[a].script}else t.witnessUtxo&&(i.script=t.witnessUtxo.script);return(t.witnessScript||FW(i.script))&&(i.isSegwit=!0),i}(e,n,this.__CACHE),i=r.script,o=r.isP2SH,a=r.isP2WSH,s=r.isSegwit;if(!i)throw new Error("No script found for input #".concat(e));!function(e){if(e.sighashType&&e.partialSig){var t=e.partialSig,n=e.sighashType;t.forEach((function(e){var t=wW.signature.decode(e.signature).hashType;if(n!==t)throw new Error("Signature sighash does not match input sighash type")}))}}(n);var u=t(e,n,i,s,o,a),l=u.finalScriptSig,A=u.finalScriptWitness;if(l&&this.data.updateInput(e,{finalScriptSig:l}),A&&this.data.updateInput(e,{finalScriptWitness:A}),!l&&!A)throw new Error("Unknown error finalizing input #".concat(e));return this.data.clearFinalizedInput(e),this}},{key:"getInputType",value:function(e){var t=(0,pW.checkForInput)(this.data.inputs,e),n=tZ($W(e,t,this.__CACHE),e,"input",t.redeemScript||function(e){if(e){var t=wW.decompile(e);if(t){var n,r=t[t.length-1];if(Da(r)&&!eZ(r)&&(n=r,!wW.isCanonicalScriptSignature(n)))if(wW.decompile(r))return r}}}(t.finalScriptSig),t.witnessScript||function(e){if(e){var t=YW(e),n=t[t.length-1];if(!eZ(n)&&wW.decompile(n))return n}}(t.finalScriptWitness));return("raw"===n.type?"":n.type+"-")+iZ(n.meaningfulScript)}},{key:"inputHasPubkey",value:function(e,t){return function(e,t,n,r){return rZ(e,tZ($W(n,t,r),n,"input",t.redeemScript,t.witnessScript).meaningfulScript)}(t,(0,pW.checkForInput)(this.data.inputs,e),e,this.__CACHE)}},{key:"inputHasHDKey",value:function(e,t){var n=(0,pW.checkForInput)(this.data.inputs,e),r=LW(t);return!!n.bip32Derivation&&n.bip32Derivation.some(r)}},{key:"outputHasPubkey",value:function(e,t){return function(e,t,n,r){return rZ(e,tZ(r.__TX.outs[n].script,n,"output",t.redeemScript,t.witnessScript).meaningfulScript)}(t,(0,pW.checkForOutput)(this.data.outputs,e),e,this.__CACHE)}},{key:"outputHasHDKey",value:function(e,t){var n=(0,pW.checkForOutput)(this.data.outputs,e),r=LW(t);return!!n.bip32Derivation&&n.bip32Derivation.some(r)}},{key:"validateSignaturesOfAllInputs",value:function(e){var t=this;return(0,pW.checkForInput)(this.data.inputs,0),oZ(this.data.inputs.length).map((function(n){return t.validateSignaturesOfInput(n,e)})).reduce((function(e,t){return!0===t&&e}),!0)}},{key:"validateSignaturesOfInput",value:function(e,t,n){var r=this.data.inputs[e],i=(r||{}).partialSig;if(!r||!i||i.length<1)throw new Error("No signatures to validate");if("function"!=typeof t)throw new Error("Need validator function to validate signatures");var o=n?i.filter((function(e){return e.pubkey.equals(n)})):i;if(o.length<1)throw new Error("No signatures for this pubkey");var a,s,u,l,A=[],c=F(o);try{for(c.s();!(l=c.n()).done;){var h=l.value,f=wW.signature.decode(h.signature),d=u!==f.hashType?zW(e,Object.assign({},r,{sighashType:f.hashType}),this.__CACHE,!0):{hash:a,script:s},p=d.hash,g=d.script;u=f.hashType,a=p,s=g,RW(h.pubkey,g,"verify"),A.push(t(h.pubkey,p,f.signature))}}catch(e){c.e(e)}finally{c.f()}return A.every((function(e){return!0===e}))}},{key:"signAllInputsHD",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[bW.Transaction.SIGHASH_ALL];if(!e||!e.publicKey||!e.fingerprint)throw new Error("Need HDSigner to sign input");var n,r=[],i=F(oZ(this.data.inputs.length));try{for(i.s();!(n=i.n()).done;){var o=n.value;try{this.signInputHD(o,e,t),r.push(!0)}catch(e){r.push(!1)}}}catch(e){i.e(e)}finally{i.f()}if(r.every((function(e){return!1===e})))throw new Error("No inputs were signed");return this}},{key:"signAllInputsHDAsync",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[bW.Transaction.SIGHASH_ALL];return new Promise((function(r,i){if(!e||!e.publicKey||!e.fingerprint)return i(new Error("Need HDSigner to sign input"));var o,a=[],s=[],u=F(oZ(t.data.inputs.length));try{for(u.s();!(o=u.n()).done;){var l=o.value;s.push(t.signInputHDAsync(l,e,n).then((function(){a.push(!0)}),(function(){a.push(!1)})))}}catch(e){u.e(e)}finally{u.f()}return Promise.all(s).then((function(){if(a.every((function(e){return!1===e})))return i(new Error("No inputs were signed"));r()}))}))}},{key:"signInputHD",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[bW.Transaction.SIGHASH_ALL];if(!t||!t.publicKey||!t.fingerprint)throw new Error("Need HDSigner to sign input");return JW(e,this.data.inputs,t).forEach((function(t){return n.signInput(e,t,r)})),this}},{key:"signInputHDAsync",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[bW.Transaction.SIGHASH_ALL];return new Promise((function(i,o){if(!t||!t.publicKey||!t.fingerprint)return o(new Error("Need HDSigner to sign input"));var a=JW(e,n.data.inputs,t).map((function(t){return n.signInputAsync(e,t,r)}));return Promise.all(a).then((function(){i()})).catch(o)}))}},{key:"signAllInputs",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[bW.Transaction.SIGHASH_ALL];if(!e||!e.publicKey)throw new Error("Need Signer to sign input");var n,r=[],i=F(oZ(this.data.inputs.length));try{for(i.s();!(n=i.n()).done;){var o=n.value;try{this.signInput(o,e,t),r.push(!0)}catch(e){r.push(!1)}}}catch(e){i.e(e)}finally{i.f()}if(r.every((function(e){return!1===e})))throw new Error("No inputs were signed");return this}},{key:"signAllInputsAsync",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[bW.Transaction.SIGHASH_ALL];return new Promise((function(r,i){if(!e||!e.publicKey)return i(new Error("Need Signer to sign input"));var o,a=[],s=[],u=F(t.data.inputs.entries());try{for(u.s();!(o=u.n()).done;){var l=C(o.value,1)[0];s.push(t.signInputAsync(l,e,n).then((function(){a.push(!0)}),(function(){a.push(!1)})))}}catch(e){u.e(e)}finally{u.f()}return Promise.all(s).then((function(){if(a.every((function(e){return!1===e})))return i(new Error("No inputs were signed"));r()}))}))}},{key:"signInput",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[bW.Transaction.SIGHASH_ALL];if(!t||!t.publicKey)throw new Error("Need Signer to sign input");var r=VW(this.data.inputs,e,t.publicKey,this.__CACHE,n),i=r.hash,o=r.sighashType,a=[{pubkey:t.publicKey,signature:wW.signature.encode(t.sign(i),o)}];return this.data.updateInput(e,{partialSig:a}),this}},{key:"signInputAsync",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[bW.Transaction.SIGHASH_ALL];return Promise.resolve().then((function(){if(!t||!t.publicKey)throw new Error("Need Signer to sign input");var i=VW(n.data.inputs,e,t.publicKey,n.__CACHE,r),o=i.hash,a=i.sighashType;return Promise.resolve(t.sign(o)).then((function(r){var i=[{pubkey:t.publicKey,signature:wW.signature.encode(r,a)}];n.data.updateInput(e,{partialSig:i})}))}))}},{key:"toBuffer",value:function(){return xW(this.__CACHE),this.data.toBuffer()}},{key:"toHex",value:function(){return xW(this.__CACHE),this.data.toHex()}},{key:"toBase64",value:function(){return xW(this.__CACHE),this.data.toBase64()}},{key:"updateGlobal",value:function(e){return this.data.updateGlobal(e),this}},{key:"updateInput",value:function(e,t){return t.witnessScript&&nZ(t.witnessScript),this.data.updateInput(e,t),t.nonWitnessUtxo&&XW(this.__CACHE,this.data.inputs[e],e),this}},{key:"updateOutput",value:function(e,t){return this.data.updateOutput(e,t),this}},{key:"addUnknownKeyValToGlobal",value:function(e){return this.data.addUnknownKeyValToGlobal(e),this}},{key:"addUnknownKeyValToInput",value:function(e,t){return this.data.addUnknownKeyValToInput(e,t),this}},{key:"addUnknownKeyValToOutput",value:function(e,t){return this.data.addUnknownKeyValToOutput(e,t),this}},{key:"clearFinalizedInput",value:function(e){return this.data.clearFinalizedInput(e),this}}],[{key:"fromBase64",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Xo.from(e,"base64");return this.fromBuffer(n,t)}},{key:"fromHex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Xo.from(e,"hex");return this.fromBuffer(n,t)}},{key:"fromBuffer",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=fW.Psbt.fromBuffer(t,EW),i=new e(n,r);return function(e,t){e.ins.forEach((function(e){OW(t,e)}))}(i.__CACHE.__TX,i.__CACHE),i}}]),e}();bY.Psbt=BW;var EW=function(e){return new CW(e)},CW=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Xo.from([2,0,0,0,0,0,0,0,0,0]);s(this,e),this.tx=bW.Transaction.fromBuffer(t),function(e){if(!e.ins.every((function(e){return e.script&&0===e.script.length&&e.witness&&0===e.witness.length})))throw new Error("Format Error: Transaction ScriptSigs are not empty")}(this.tx),Object.defineProperty(this,"tx",{enumerable:!1,writable:!0})}return l(e,[{key:"getInputOutputCounts",value:function(){return{inputCount:this.tx.ins.length,outputCount:this.tx.outs.length}}},{key:"addInput",value:function(e){if(void 0===e.hash||void 0===e.index||!Da(e.hash)&&"string"!=typeof e.hash||"number"!=typeof e.index)throw new Error("Error adding input.");var t="string"==typeof e.hash?(0,vW.reverseBuffer)(Xo.from(e.hash,"hex")):e.hash;this.tx.addInput(t,e.index,e.sequence)}},{key:"addOutput",value:function(e){if(void 0===e.script||void 0===e.value||!Da(e.script)||"number"!=typeof e.value)throw new Error("Error adding output.");this.tx.addOutput(e.script,e.value)}},{key:"toBuffer",value:function(){return this.tx.toBuffer()}}]),e}();function xW(e){if(!1!==e.__UNSAFE_SIGN_NONSEGWIT)throw new Error("Not BIP174 compliant, can not export")}function kW(e,t,n){if(!t)return!1;var r;if(r=n?n.map((function(e){var n=function(e){if(65===e.length){var t=1&e[64],n=e.slice(0,33);return n[0]=2|t,n}return e.slice()}(e);return t.find((function(e){return e.pubkey.equals(n)}))})).filter((function(e){return!!e})):t,r.length>e)throw new Error("Too many signatures");return r.length===e}function SW(e){return!!e.finalScriptSig||!!e.finalScriptWitness}function QW(e){return function(t){try{return e({output:t}),!0}catch(e){return!1}}}var _W=QW(mW.p2ms),NW=QW(mW.p2pk),DW=QW(mW.p2pkh),FW=QW(mW.p2wpkh),PW=QW(mW.p2wsh),UW=QW(mW.p2sh);function LW(e){return function(t){return!!t.masterFingerprint.equals(e.fingerprint)&&!!e.derivePath(t.path).publicKey.equals(t.pubkey)}}function TW(e){if("number"!=typeof e||e!==Math.floor(e)||e>4294967295||e<0)throw new Error("Invalid 32 bit integer")}function MW(e,t){e.forEach((function(e){var n=!1,r=[];if(0===(e.partialSig||[]).length){if(!e.finalScriptSig&&!e.finalScriptWitness)return;r=function(e){var t=e.finalScriptSig&&wW.decompile(e.finalScriptSig)||[],n=e.finalScriptWitness&&wW.decompile(e.finalScriptWitness)||[];return t.concat(n).filter((function(e){return Da(e)&&wW.isCanonicalScriptSignature(e)})).map((function(e){return{signature:e}}))}(e)}else r=e.partialSig;if(r.forEach((function(e){var r=wW.signature.decode(e.signature).hashType,i=[];switch(r&bW.Transaction.SIGHASH_ANYONECANPAY&&i.push("addInput"),31&r){case bW.Transaction.SIGHASH_ALL:break;case bW.Transaction.SIGHASH_SINGLE:case bW.Transaction.SIGHASH_NONE:i.push("addOutput"),i.push("setInputSequence")}-1===i.indexOf(t)&&(n=!0)})),n)throw new Error("Can not modify transaction, signatures exist.")}))}function RW(e,t,n){if(!rZ(e,t))throw new Error("Can not ".concat(n," for this input with the key ").concat(e.toString("hex")))}function OW(e,t){var n=(0,vW.reverseBuffer)(Xo.from(t.hash)).toString("hex")+":"+t.index;if(e.__TX_IN_CACHE[n])throw new Error("Duplicate input detected.");e.__TX_IN_CACHE[n]=1}function HW(e,t){return function(n,r,i,o){var a=e({redeem:{output:i}}).output;if(!r.equals(a))throw new Error("".concat(t," for ").concat(o," #").concat(n," doesn't match the scriptPubKey in the prevout"))}}var KW=HW(mW.p2sh,"Redeem script"),jW=HW(mW.p2wsh,"Witness script");function GW(e,t,n,r){if(!n.every(SW))throw new Error("PSBT must be finalized to calculate ".concat(t));if("__FEE_RATE"===e&&r.__FEE_RATE)return r.__FEE_RATE;if("__FEE"===e&&r.__FEE)return r.__FEE;var i,o=!0;return r.__EXTRACTED_TX?(i=r.__EXTRACTED_TX,o=!1):i=r.__TX.clone(),WW(n,i,r,o),"__FEE_RATE"===e?r.__FEE_RATE:"__FEE"===e?r.__FEE:void 0}function qW(e,t,n,r,i,o){var a=iZ(n);if(!function(e,t,n){switch(n){case"pubkey":case"pubkeyhash":case"witnesspubkeyhash":return kW(1,e.partialSig);case"multisig":var r=mW.p2ms({output:t});return kW(r.m,e.partialSig,r.pubkeys);default:return!1}}(t,n,a))throw new Error("Can not finalize input #".concat(e));return function(e,t,n,r,i,o){var a,s,u=function(e,t,n){var r;switch(t){case"multisig":var i=function(e,t){return mW.p2ms({output:e}).pubkeys.map((function(e){return(t.filter((function(t){return t.pubkey.equals(e)}))[0]||{}).signature})).filter((function(e){return!!e}))}(e,n);r=mW.p2ms({output:e,signatures:i});break;case"pubkey":r=mW.p2pk({output:e,signature:n[0].signature});break;case"pubkeyhash":r=mW.p2pkh({output:e,pubkey:n[0].pubkey,signature:n[0].signature});break;case"witnesspubkeyhash":r=mW.p2wpkh({output:e,pubkey:n[0].pubkey,signature:n[0].signature})}return r}(e,t,n),l=o?mW.p2wsh({redeem:u}):null,A=i?mW.p2sh({redeem:l||u}):null;return r?(s=function(e){var t,n=Xo.allocUnsafe(0);function r(e){var t=n.length,r=dW.encodingLength(e);n=Xo.concat([n,Xo.allocUnsafe(r)]),dW.encode(e,n,t)}function i(e){r(e.length),function(e){n=Xo.concat([n,Xo.from(e)])}(e)}return r((t=e).length),t.forEach(i),n}(l?l.witness:u.witness),A&&(a=A.input)):a=A?A.input:u.input,{finalScriptSig:a,finalScriptWitness:s}}(n,a,t.partialSig,r,i,o)}function VW(e,t,n,r,i){var o=zW(t,(0,pW.checkForInput)(e,t),r,!1,i),a=o.hash,s=o.sighashType;return RW(n,o.script,"sign"),{hash:a,sighashType:s}}function zW(e,t,n,r,i){var o,a,s=n.__TX,u=t.sighashType||bW.Transaction.SIGHASH_ALL;if(i&&i.indexOf(u)<0){var l=function(e){var t=e&bW.Transaction.SIGHASH_ANYONECANPAY?"SIGHASH_ANYONECANPAY | ":"";switch(31&e){case bW.Transaction.SIGHASH_ALL:t+="SIGHASH_ALL";break;case bW.Transaction.SIGHASH_SINGLE:t+="SIGHASH_SINGLE";break;case bW.Transaction.SIGHASH_NONE:t+="SIGHASH_NONE"}return t}(u);throw new Error("Sighash type is not allowed. Retry the sign method passing the sighashTypes array of whitelisted types. Sighash type: ".concat(l))}if(t.nonWitnessUtxo){var A=ZW(n,t,e),c=s.ins[e].hash,h=A.getHash();if(!c.equals(h))throw new Error("Non-witness UTXO hash for input #".concat(e," doesn't match the hash specified in the prevout"));var f=s.ins[e].index;a=A.outs[f]}else{if(!t.witnessUtxo)throw new Error("Need a Utxo input item for signing");a=t.witnessUtxo}var d=tZ(a.script,e,"input",t.redeemScript,t.witnessScript),p=d.meaningfulScript,g=d.type;if(["p2sh-p2wsh","p2wsh"].indexOf(g)>=0)o=s.hashForWitnessV0(e,p,a.value,u);else if(FW(p)){var v=mW.p2pkh({hash:p.slice(2)}).output;o=s.hashForWitnessV0(e,v,a.value,u)}else{if(void 0===t.nonWitnessUtxo&&!1===n.__UNSAFE_SIGN_NONSEGWIT)throw new Error("Input #".concat(e," has witnessUtxo but non-segwit script: ").concat(p.toString("hex")));r||!1===n.__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 Psbt's predecesor (TransactionBuilder - now removed) 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*********************"),o=s.hashForSignature(e,p,u)}return{script:p,sighashType:u,hash:o}}function JW(e,t,n){var r=(0,pW.checkForInput)(t,e);if(!r.bip32Derivation||0===r.bip32Derivation.length)throw new Error("Need bip32Derivation to sign with HD");var i=r.bip32Derivation.map((function(e){return e.masterFingerprint.equals(n.fingerprint)?e:void 0})).filter((function(e){return!!e}));if(0===i.length)throw new Error("Need one bip32Derivation masterFingerprint to match the HDSigner fingerprint");var o=i.map((function(e){var t=n.derivePath(e.path);if(!e.pubkey.equals(t.publicKey))throw new Error("pubkey did not match bip32Derivation");return t}));return o}function YW(e){var t=0;function n(){var n=dW.decode(e,t);return t+=dW.decode.bytes,n}function r(){return r=n(),t+=r,e.slice(t-r,t);var r}return function(){for(var e=n(),t=[],i=0;i<e;i++)t.push(r());return t}()}function XW(e,t,n){e.__NON_WITNESS_UTXO_BUF_CACHE[n]=t.nonWitnessUtxo;var r=bW.Transaction.fromBuffer(t.nonWitnessUtxo);e.__NON_WITNESS_UTXO_TX_CACHE[n]=r;var i=e,o=n;delete t.nonWitnessUtxo,Object.defineProperty(t,"nonWitnessUtxo",{enumerable:!0,get:function(){var e=i.__NON_WITNESS_UTXO_BUF_CACHE[o],t=i.__NON_WITNESS_UTXO_TX_CACHE[o];if(void 0!==e)return e;var n=t.toBuffer();return i.__NON_WITNESS_UTXO_BUF_CACHE[o]=n,n},set:function(e){i.__NON_WITNESS_UTXO_BUF_CACHE[o]=e}})}function WW(e,t,n,r){var i=0;e.forEach((function(e,o){if(r&&e.finalScriptSig&&(t.ins[o].script=e.finalScriptSig),r&&e.finalScriptWitness&&(t.ins[o].witness=YW(e.finalScriptWitness)),e.witnessUtxo)i+=e.witnessUtxo.value;else if(e.nonWitnessUtxo){var a=ZW(n,e,o),s=t.ins[o].index,u=a.outs[s];i+=u.value}}));var o=t.outs.reduce((function(e,t){return e+t.value}),0),a=i-o;if(a<0)throw new Error("Outputs are spending more than Inputs");var s=t.virtualSize();n.__FEE=a,n.__EXTRACTED_TX=t,n.__FEE_RATE=Math.floor(a/s)}function ZW(e,t,n){var r=e.__NON_WITNESS_UTXO_TX_CACHE;return r[n]||XW(e,t,n),r[n]}function $W(e,t,n){if(void 0!==t.witnessUtxo)return t.witnessUtxo.script;if(void 0!==t.nonWitnessUtxo)return ZW(n,t,e).outs[n.__TX.ins[e].index].script;throw new Error("Can't find pubkey in input without Utxo data")}function eZ(e){return 33===e.length&&wW.isCanonicalPubKey(e)}function tZ(e,t,n,r,i){var o,a=UW(e),s=a&&r&&PW(r),u=PW(e);if(a&&void 0===r)throw new Error("scriptPubkey is P2SH but redeemScript missing");if((u||s)&&void 0===i)throw new Error("scriptPubkey or redeemScript is P2WSH but witnessScript missing");return s?(o=i,KW(t,e,r,n),jW(t,r,i,n),nZ(o)):u?(o=i,jW(t,e,i,n),nZ(o)):a?(o=r,KW(t,e,r,n)):o=e,{meaningfulScript:o,type:s?"p2sh-p2wsh":a?"p2sh":u?"p2wsh":"raw"}}function nZ(e){if(FW(e)||UW(e))throw new Error("P2WPKH or P2SH can not be contained within P2WSH")}function rZ(e,t){var n=(0,yW.hash160)(e),r=wW.decompile(t);if(null===r)throw new Error("Unknown script error");return r.some((function(t){return"number"!=typeof t&&(t.equals(e)||t.equals(n))}))}function iZ(e){return FW(e)?"witnesspubkeyhash":DW(e)?"pubkeyhash":_W(e)?"multisig":NW(e)?"pubkey":"nonstandard"}function oZ(e){return k(Array(e).keys())}!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Transaction=e.opcodes=e.Psbt=e.Block=e.script=e.payments=e.networks=e.crypto=e.address=void 0;var t=Yq;e.address=t;var n=Bz;e.crypto=n;var r=Xq;e.networks=r;var i=Wq;e.payments=i;var o=$q;e.script=o;var a=LJ;Object.defineProperty(e,"Block",{enumerable:!0,get:function(){return a.Block}});var s=bY;Object.defineProperty(e,"Psbt",{enumerable:!0,get:function(){return s.Psbt}});var u=tV;Object.defineProperty(e,"opcodes",{enumerable:!0,get:function(){return u.OPS}});var l=XJ;Object.defineProperty(e,"Transaction",{enumerable:!0,get:function(){return l.Transaction}})}(Jq);var aZ={exports:{}};function sZ(e,t){var n=function(e){for(var t=function(e){var t=IO.from(Object.assign(Object.assign({},e),{crv:"K-256"}),"jwk").toString("blk","public"),n=fx.publicKeyConvert(zq.from(t,"hex"),!0);return zq.from(n).toString("hex")}(e),n=zq.from(t,"hex"),r=32-n.length;r>0;)n=zq.concat([zq.from("00","hex"),n]),r--;return n}(e.publicKeyJwk),r=Gq("errors","identityErrorBaseMessage"),i="";switch(t.code){case Fl.Bitcoin:case Fl.Mocknet:case Fl.Testnet:i=function(e,t){return Jq.payments.p2pkh({pubkey:e,network:Jq.networks[t.code]}).address}(n,t);break;case Fl.Ethmain:case Fl.Ethropst:case Fl.Ethrinkeby:case Fl.Ethgoerli:case Fl.Ethsepolia:i=function(e,t){var n=e.toString("hex"),r=new EI.ec("secp256k1").keyFromPublic(n,"hex").getPublic().encode("hex").slice(2),i=Xo;return"0x".concat(aZ.exports.keccak256(i.from(r,"hex")).slice(24).toString())}(n);break;default:throw new Hq("deriveIssuingAddressFromPublicKey","".concat(r," - ").concat(Gq("errors","deriveIssuingAddressFromPublicKey")))}return i}function uZ(e){if(e){var t="string"==typeof e?e:e.code;return!!Object.keys(Ll).some((function(e){return e===t}))&&!!Ll[t].test}return!1}!function(e){!function(){var t="input is invalid type",n="object"==("undefined"==typeof window?"undefined":i(window)),r=n?window:{};r.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&"object"==("undefined"==typeof self?"undefined":i(self));!r.JS_SHA3_NO_NODE_JS&&"object"==i(AA)&&AA.versions&&AA.versions.node?r=Do:o&&(r=self);var a=!r.JS_SHA3_NO_COMMON_JS&&e.exports,s=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,u="0123456789abcdef".split(""),l=[4,1024,262144,67108864],A=[0,8,16,24],c=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],h=[224,256,384,512],f=[128,256],d=["hex","buffer","arrayBuffer","array","digest"],p={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!s||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==i(e)&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var g=function(e,t,n){return function(r){return new N(e,t,e).update(r)[n]()}},v=function(e,t,n){return function(r,i){return new N(e,t,i).update(r)[n]()}},y=function(e,t,n){return function(t,r,i,o){return B["cshake"+e].update(t,r,i,o)[n]()}},m=function(e,t,n){return function(t,r,i,o){return B["kmac"+e].update(t,r,i,o)[n]()}},w=function(e,t,n,r){for(var i=0;i<d.length;++i){var o=d[i];e[o]=t(n,r,o)}return e},b=function(e,t){var n=g(e,t,"hex");return n.create=function(){return new N(e,t,e)},n.update=function(e){return n.create().update(e)},w(n,g,e,t)},I=[{name:"keccak",padding:[1,256,65536,16777216],bits:h,createMethod:b},{name:"sha3",padding:[6,1536,393216,100663296],bits:h,createMethod:b},{name:"shake",padding:[31,7936,2031616,520093696],bits:f,createMethod:function(e,t){var n=v(e,t,"hex");return n.create=function(n){return new N(e,t,n)},n.update=function(e,t){return n.create(t).update(e)},w(n,v,e,t)}},{name:"cshake",padding:l,bits:f,createMethod:function(e,t){var n=p[e],r=y(e,0,"hex");return r.create=function(r,i,o){return i||o?new N(e,t,r).bytepad([i,o],n):B["shake"+e].create(r)},r.update=function(e,t,n,i){return r.create(t,n,i).update(e)},w(r,y,e,t)}},{name:"kmac",padding:l,bits:f,createMethod:function(e,t){var n=p[e],r=m(e,0,"hex");return r.create=function(r,i,o){return new D(e,t,i).bytepad(["KMAC",o],n).bytepad([r],n)},r.update=function(e,t,n,i){return r.create(e,n,i).update(t)},w(r,m,e,t)}}],B={},E=[],C=0;C<I.length;++C)for(var x=I[C],k=x.bits,S=0;S<k.length;++S){var Q=x.name+"_"+k[S];if(E.push(Q),B[Q]=x.createMethod(k[S],x.padding),"sha3"!==x.name){var _=x.name+k[S];E.push(_),B[_]=B[Q]}}function N(e,t,n){this.blocks=[],this.s=[],this.padding=t,this.outputBits=n,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function D(e,t,n){N.call(this,e,t,n)}N.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var n,r=i(e);if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(s&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||s&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}for(var o,a,u=this.blocks,l=this.byteCount,c=e.length,h=this.blockCount,f=0,d=this.s;f<c;){if(this.reset)for(this.reset=!1,u[0]=this.block,o=1;o<h+1;++o)u[o]=0;if(n)for(o=this.start;f<c&&o<l;++f)u[o>>2]|=e[f]<<A[3&o++];else for(o=this.start;f<c&&o<l;++f)(a=e.charCodeAt(f))<128?u[o>>2]|=a<<A[3&o++]:a<2048?(u[o>>2]|=(192|a>>6)<<A[3&o++],u[o>>2]|=(128|63&a)<<A[3&o++]):a<55296||a>=57344?(u[o>>2]|=(224|a>>12)<<A[3&o++],u[o>>2]|=(128|a>>6&63)<<A[3&o++],u[o>>2]|=(128|63&a)<<A[3&o++]):(a=65536+((1023&a)<<10|1023&e.charCodeAt(++f)),u[o>>2]|=(240|a>>18)<<A[3&o++],u[o>>2]|=(128|a>>12&63)<<A[3&o++],u[o>>2]|=(128|a>>6&63)<<A[3&o++],u[o>>2]|=(128|63&a)<<A[3&o++]);if(this.lastByteIndex=o,o>=l){for(this.start=o-l,this.block=u[h],o=0;o<h;++o)d[o]^=u[o];F(d),this.reset=!0}else this.start=o}return this},N.prototype.encode=function(e,t){var n=255&e,r=1,i=[n];for(n=255&(e>>=8);n>0;)i.unshift(n),n=255&(e>>=8),++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},N.prototype.encodeString=function(e){var n,r=i(e);if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(s&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||s&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}var o=0,a=e.length;if(n)o=a;else for(var u=0;u<e.length;++u){var l=e.charCodeAt(u);l<128?o+=1:l<2048?o+=2:l<55296||l>=57344?o+=3:(l=65536+((1023&l)<<10|1023&e.charCodeAt(++u)),o+=4)}return o+=this.encode(8*o),this.update(e),o},N.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r<e.length;++r)n+=this.encodeString(e[r]);var i=t-n%t,o=[];return o.length=i,this.update(o),this},N.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,n=this.blockCount,r=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t<n+1;++t)e[t]=0;for(e[n-1]|=2147483648,t=0;t<n;++t)r[t]^=e[t];F(r)}},N.prototype.toString=N.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s="";a<r;){for(o=0;o<t&&a<r;++o,++a)e=n[o],s+=u[e>>4&15]+u[15&e]+u[e>>12&15]+u[e>>8&15]+u[e>>20&15]+u[e>>16&15]+u[e>>28&15]+u[e>>24&15];a%t==0&&(F(n),o=0)}return i&&(e=n[o],s+=u[e>>4&15]+u[15&e],i>1&&(s+=u[e>>12&15]+u[e>>8&15]),i>2&&(s+=u[e>>20&15]+u[e>>16&15])),s},N.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(e);a<r;){for(o=0;o<t&&a<r;++o,++a)u[a]=n[o];a%t==0&&F(n)}return i&&(u[o]=n[o],e=e.slice(0,s)),e},N.prototype.buffer=N.prototype.arrayBuffer,N.prototype.digest=N.prototype.array=function(){this.finalize();for(var e,t,n=this.blockCount,r=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];s<i;){for(a=0;a<n&&s<i;++a,++s)e=s<<2,t=r[a],u[e]=255&t,u[e+1]=t>>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;s%n==0&&F(r)}return o&&(e=s<<2,t=r[a],u[e]=255&t,o>1&&(u[e+1]=t>>8&255),o>2&&(u[e+2]=t>>16&255)),u},D.prototype=new N,D.prototype.finalize=function(){return this.encode(this.outputBits,!0),N.prototype.finalize.call(this)};var F=function(e){var t,n,r,i,o,a,s,u,l,A,h,f,d,p,g,v,y,m,w,b,I,B,E,C,x,k,S,Q,_,N,D,F,P,U,L,T,M,R,O,H,K,j,G,q,V,z,J,Y,X,W,Z,$,ee,te,ne,re,ie,oe,ae,se,ue,le,Ae;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],l=e[5]^e[15]^e[25]^e[35]^e[45],A=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(f=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),n=(d=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(u<<1|l>>>31),n=o^(l<<1|u>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=a^(A<<1|h>>>31),n=s^(h<<1|A>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=u^(f<<1|d>>>31),n=l^(d<<1|f>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=A^(i<<1|o>>>31),n=h^(o<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,p=e[0],g=e[1],z=e[11]<<4|e[10]>>>28,J=e[10]<<4|e[11]>>>28,Q=e[20]<<3|e[21]>>>29,_=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ue=e[30]<<9|e[31]>>>23,j=e[40]<<18|e[41]>>>14,G=e[41]<<18|e[40]>>>14,U=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,v=e[13]<<12|e[12]>>>20,y=e[12]<<12|e[13]>>>20,Y=e[22]<<10|e[23]>>>22,X=e[23]<<10|e[22]>>>22,N=e[33]<<13|e[32]>>>19,D=e[32]<<13|e[33]>>>19,le=e[42]<<2|e[43]>>>30,Ae=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,T=e[14]<<6|e[15]>>>26,M=e[15]<<6|e[14]>>>26,m=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,W=e[34]<<15|e[35]>>>17,Z=e[35]<<15|e[34]>>>17,F=e[45]<<29|e[44]>>>3,P=e[44]<<29|e[45]>>>3,C=e[6]<<28|e[7]>>>4,x=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,R=e[26]<<25|e[27]>>>7,O=e[27]<<25|e[26]>>>7,b=e[36]<<21|e[37]>>>11,I=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,q=e[8]<<27|e[9]>>>5,V=e[9]<<27|e[8]>>>5,k=e[18]<<20|e[19]>>>12,S=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ae=e[28]<<7|e[29]>>>25,H=e[38]<<8|e[39]>>>24,K=e[39]<<8|e[38]>>>24,B=e[48]<<14|e[49]>>>18,E=e[49]<<14|e[48]>>>18,e[0]=p^~v&m,e[1]=g^~y&w,e[10]=C^~k&Q,e[11]=x^~S&_,e[20]=U^~T&R,e[21]=L^~M&O,e[30]=q^~z&Y,e[31]=V^~J&X,e[40]=te^~re&oe,e[41]=ne^~ie&ae,e[2]=v^~m&b,e[3]=y^~w&I,e[12]=k^~Q&N,e[13]=S^~_&D,e[22]=T^~R&H,e[23]=M^~O&K,e[32]=z^~Y&W,e[33]=J^~X&Z,e[42]=re^~oe&se,e[43]=ie^~ae&ue,e[4]=m^~b&B,e[5]=w^~I&E,e[14]=Q^~N&F,e[15]=_^~D&P,e[24]=R^~H&j,e[25]=O^~K&G,e[34]=Y^~W&$,e[35]=X^~Z&ee,e[44]=oe^~se&le,e[45]=ae^~ue&Ae,e[6]=b^~B&p,e[7]=I^~E&g,e[16]=N^~F&C,e[17]=D^~P&x,e[26]=H^~j&U,e[27]=K^~G&L,e[36]=W^~$&q,e[37]=Z^~ee&V,e[46]=se^~le&te,e[47]=ue^~Ae&ne,e[8]=B^~p&v,e[9]=E^~g&y,e[18]=F^~C&k,e[19]=P^~x&S,e[28]=j^~U&T,e[29]=G^~L&M,e[38]=$^~q&z,e[39]=ee^~V&J,e[48]=le^~te&re,e[49]=Ae^~ne&ie,e[0]^=c[r],e[1]^=c[r+1]};if(a)e.exports=B;else for(C=0;C<E.length;++C)r[E[C]]=B[E[C]]}()}(aZ);var lZ,AZ,cZ=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){e.done?i(e.value):function(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(a,s)}u((r=r.apply(e,t||[])).next())}))},hZ=function(e){c(n,e);var t=b(n);function n(e){var r,i=e.issuer,o=void 0===i?null:i,a=e.verificationMethod,u=void 0===a?null:a,l=e.document,A=void 0===l?null:l,c=e.proof,h=void 0===c?null:c,f=e.options,d=void 0===f?{}:f;if(s(this,n),(r=t.call(this,{type:"MerkleProof2019"})).type="MerkleProof2019",r.issuer=null,r.verificationMethod=null,r.proof=null,r.proofValue=null,r.document=null,r.explorerAPIs=[],r.documentLoader=null,r.proofVerificationProcess=["getTransactionId","computeLocalHash","fetchRemoteHash","compareHashes","checkMerkleRoot","checkReceipt"],r.identityVerificationProcess=["deriveIssuingAddressFromPublicKey","compareIssuingAddress"],r.transactionId="",!A)throw new Error("A document signed by MerkleProof2019 is required for the verification process.");return r.issuer=o,r.verificationMethod=u,r.document=A,r.setProof(h),r.setOptions(d),r.getChain(),uZ(r.chain)&&(r.adaptProofVerificationProcessToMocknet(),r.adaptIdentityVerificationProcessToMocknet()),w(r)}return l(n,[{key:"setProof",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=null!=e?e:this.document.proof;if(!t)throw new Error("The passed document is not signed.");this.proof=t,this.proofValue=n.decodeMerkleProof2019(this.proof)}},{key:"verifyProof",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{documentLoader:function(e){},verifyIdentity:!0},t=e.documentLoader,n=e.verifyIdentity;return cZ(this,void 0,void 0,r().mark((function e(){var i,o;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.documentLoader=t,o="",e.prev=2,e.next=5,this.verifyProcess(this.proofVerificationProcess);case 5:if(e.t0=n,!e.t0){e.next=9;break}return e.next=9,this.verifyIdentity();case 9:i=!0,e.next=15;break;case 12:e.prev=12,e.t1=e.catch(2),console.error(e.t1),i=!1,o=e.t1.message;case 15:return e.abrupt("return",{verificationMethod:this.verificationMethod,verified:i,error:o});case 16:case"end":return e.stop()}}),e,this,[[2,12]])})))}},{key:"verifyIdentity",value:function(){return cZ(this,void 0,void 0,r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null==this.verificationMethod){e.next=9;break}return e.prev=1,e.next=4,this.verifyProcess(this.identityVerificationProcess);case 4:e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(1),new Error(e.t0);case 9:case"end":return e.stop()}}),e,this,[[1,6]])})))}},{key:"getProofVerificationProcess",value:function(){return this.proofVerificationProcess}},{key:"getIdentityVerificationProcess",value:function(){return this.identityVerificationProcess}},{key:"getIssuerPublicKey",value:function(){var e,t;return uZ(this.chain)?"This mock chain does not support issuing addresses":null!==(t=null===(e=this.getTxData())||void 0===e?void 0:e.issuingAddress)&&void 0!==t?t:""}},{key:"getIssuanceTime",value:function(){var e,t;return null!==(t=null===(e=this.getTxData())||void 0===e?void 0:e.time)&&void 0!==t?t:""}},{key:"getChain",value:function(){return this.chain||(this.chain=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(null==e?void 0:e.anchors){var t=e.anchors[0];if("string"==typeof t)return function(e){var t,n=e.split(":");switch(n[1]){case Ll.mocknet.blinkCode:return Uq(Ll.mocknet.signatureValue);case Ll.bitcoin.blinkCode:t=Ll.bitcoin.name;break;case Ll.ethmain.blinkCode:t=Ll.ethmain.name;break;default:throw new Error("Could not retrieve chain.")}var r=n[2],i=t.toLowerCase()+function(e){var t=e.substr(0,1),n=e.substr(1,e.length-1);return t.toUpperCase()+n.toLowerCase()}(r);return Uq(i)}(t)}return null}(this.proofValue)),this.chain}},{key:"getTxData",value:function(){return this.txData?this.txData:(console.error("Trying to access issuing address when txData not available yet. Did you run the `verify` method yet?"),null)}},{key:"adaptProofVerificationProcessToMocknet",value:function(){Lq(this.proofVerificationProcess,"getTransactionId"),Lq(this.proofVerificationProcess,"fetchRemoteHash"),Lq(this.proofVerificationProcess,"checkMerkleRoot")}},{key:"adaptIdentityVerificationProcessToMocknet",value:function(){this.identityVerificationProcess=[]}},{key:"setOptions",value:function(e){var t;this.explorerAPIs=null!==(t=e.explorerAPIs)&&void 0!==t?t:[],e.executeStepMethod&&"function"==typeof e.executeStepMethod&&(this.executeStep=e.executeStepMethod)}},{key:"executeStep",value:function(e,t){return cZ(this,void 0,void 0,r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))}},{key:"verifyProcess",value:function(e){return cZ(this,void 0,void 0,r().mark((function t(){var n,i,o;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=F(e),t.prev=1,n.s();case 3:if((i=n.n()).done){t.next=11;break}if(this[o=i.value]){t.next=7;break}return t.abrupt("return",void console.error("verification logic for",o,"not implemented"));case 7:return t.next=9,this[o]();case 9:t.next=3;break;case 11:t.next=16;break;case 13:t.prev=13,t.t0=t.catch(1),n.e(t.t0);case 16:return t.prev=16,n.f(),t.finish(16);case 19:case"end":return t.stop()}}),t,this,[[1,13,16,19]])})))}},{key:"checkMerkleRoot",value:function(){return cZ(this,void 0,void 0,r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep("checkMerkleRoot",(function(){return function(e,t){if(e!==t)throw new Hq("checkMerkleRoot",Gq("errors","ensureMerkleRootEqual"));return!0}(t.proofValue.merkleRoot,t.txData.remoteHash)}),this.type);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"compareHashes",value:function(){return cZ(this,void 0,void 0,r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep("compareHashes",(function(){return function(e,t){if(e!==t)throw new Hq("compareHashes",Gq("errors","ensureHashesEqual"));return!0}(t.localDocumentHash,t.proofValue.targetHash)}),this.type);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"computeLocalHash",value:function(){return cZ(this,void 0,void 0,r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep("computeLocalHash",(function(){return cZ(t,void 0,void 0,r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Vq(this.document,this.proof,this.documentLoader);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}),this.type);case 2:this.localDocumentHash=e.sent;case 3:case"end":return e.stop()}}),e,this)})))}},{key:"checkReceipt",value:function(){return cZ(this,void 0,void 0,r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep("checkReceipt",(function(){return function(e){var t=e.targetHash,n=e.merkleRoot;try{var r=e.path;if(r&&t)for(var i in r){var o=r[i],a=void 0;if(void 0!==o.left)a=Oq("".concat(o.left).concat(t)),t=qO(a);else{if(void 0===o.right)throw new Hq("checkReceipt","Trigger catch error.");a=Oq("".concat(t).concat(o.right)),t=qO(a)}}}catch(e){throw new Hq("checkReceipt",Gq("errors","ensureValidReceipt"))}if(t!==n)throw new Hq("checkReceipt",Gq("errors","invalidMerkleReceipt"))}(t.proofValue)}),this.type);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"getTransactionId",value:function(){return cZ(this,void 0,void 0,r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.transactionId=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!e)throw new Error("DecodedProof is not set");var t=e.anchors,n=t[0];if("string"==typeof n)return n.split(":").pop();throw new Error("Could not retrieve transaction id as was provided an unexpected format")}(this.proofValue),e.next=3,this.executeStep("getTransactionId",(function(){return function(e){if("string"==typeof e&&e.length>0)return e;throw new Hq("getTransactionId",Gq("errors","isTransactionIdValid"))}(t.transactionId)}),this.type);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"fetchRemoteHash",value:function(){return cZ(this,void 0,void 0,r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep("fetchRemoteHash",(function(){return cZ(t,void 0,void 0,r().mark((function e(){var t;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Pf({transactionId:this.transactionId,chain:null===(t=this.chain)||void 0===t?void 0:t.code,explorerAPIs:this.explorerAPIs});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}),this.type);case 2:this.txData=e.sent;case 3:case"end":return e.stop()}}),e,this)})))}},{key:"deriveIssuingAddressFromPublicKey",value:function(){return cZ(this,void 0,void 0,r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep("deriveIssuingAddressFromPublicKey",(function(){return sZ(t.verificationMethod,t.chain)}),this.type);case 2:this.derivedIssuingAddress=e.sent;case 3:case"end":return e.stop()}}),e,this)})))}},{key:"compareIssuingAddress",value:function(){return cZ(this,void 0,void 0,r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep("compareIssuingAddress",(function(){return function(e,t){var n=Gq("errors","identityErrorBaseMessage");if(e!==t)throw new Hq("compareIssuingAddress","".concat(n," - ").concat(Gq("errors","compareIssuingAddress")))}(t.getIssuerPublicKey(),t.derivedIssuingAddress)}),this.type);case 2:case"end":return e.stop()}}),e,this)})))}}],[{key:"decodeMerkleProof2019",value:function(e){return new Pq.Decoder(e.proofValue).decode()}}]),n}(IN.suites.LinkedDataProof);function fZ(e){return Array.isArray(e)?e.find((function(e){return"ChainedProof2021"!==e.type})).verificationMethod:e.verificationMethod}!function(e){e.getTransactionId="getTransactionId",e.computeLocalHash="computeLocalHash",e.fetchRemoteHash="fetchRemoteHash",e.parseIssuerKeys="parseIssuerKeys",e.compareHashes="compareHashes",e.checkImagesIntegrity="checkImagesIntegrity",e.checkMerkleRoot="checkMerkleRoot",e.checkReceipt="checkReceipt",e.retrieveVerificationMethodPublicKey="retrieveVerificationMethodPublicKey",e.deriveIssuingAddressFromPublicKey="deriveIssuingAddressFromPublicKey",e.compareIssuingAddress="compareIssuingAddress",e.checkAuthenticity="checkAuthenticity"}(lZ||(lZ={}));var dZ=function(e){c(v,e);var t,n,i,o,u,h,f,d,p,g=b(v);function v(e){var t,n;return s(this,v),A(m(t=g.call(this,e)),"proofVerificationProcess",[lZ.parseIssuerKeys,lZ.checkAuthenticity]),A(m(t),"transactionId",void 0),A(m(t),"localHash",void 0),A(m(t),"documentToVerify",void 0),A(m(t),"txData",void 0),A(m(t),"chain",void 0),A(m(t),"explorerAPIs",void 0),A(m(t),"receipt",void 0),A(m(t),"issuerPublicKeyList",void 0),A(m(t),"issuer",void 0),A(m(t),"verificationMethodPublicKey",void 0),A(m(t),"derivedIssuingAddress",void 0),A(m(t),"hasDid",void 0),A(m(t),"proof",void 0),A(m(t),"type","MerkleProof2019"),A(m(t),"suite",void 0),t.executeStep=e.executeStep,t.documentToVerify=e.document,t.explorerAPIs=e.explorerAPIs,t.proof=e.proof,t.issuer=e.issuer,t.validateProofType(),t.receipt=(n=t.proof,hZ.decodeMerkleProof2019(n)),t.transactionId=tk.certificates.getTransactionId(t.receipt),t.setHasDid(),t}return l(v,[{key:"init",value:(p=a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setVerificationSuite();case 2:this.chain=this.suite.getChain(),this.adaptVerificationProcessToChain();case 4:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"verifyProof",value:(d=a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.suite.verifyProof({verifyIdentity:!1});case 2:return e.next=4,this.verifyProcess(this.proofVerificationProcess);case 4:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"verifyIdentity",value:(f=a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.suite.verifyIdentity();case 2:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"getProofVerificationSteps",value:function(e){return[].concat(k(this.suite.getProofVerificationProcess()),k(this.proofVerificationProcess)).map((function(t){return tk.verifier.convertToVerificationSubsteps(e,t)}))}},{key:"getIdentityVerificationSteps",value:function(e){return this.hasDid?this.suite.getIdentityVerificationProcess().map((function(t){return tk.verifier.convertToVerificationSubsteps(e,t)})):[]}},{key:"getIssuerPublicKey",value:function(){return this.suite.getIssuerPublicKey()}},{key:"getIssuanceTime",value:function(){return this.suite.getIssuanceTime()}},{key:"getIssuerName",value:function(){return this.issuer.name}},{key:"getIssuerProfileDomain",value:function(){var e;return null===(e=new URL(this.getIssuerProfileUrl()))||void 0===e?void 0:e.hostname}},{key:"getIssuerProfileUrl",value:function(){return this.issuer.id}},{key:"getSigningDate",value:function(){return this.proof.created}},{key:"getChain",value:function(){return this.suite.getChain()}},{key:"getReceipt",value:function(){return this.receipt}},{key:"getTransactionIdString",value:function(){return tk.certificates.getTransactionId(this.getReceipt())}},{key:"getTransactionLink",value:function(){return tk.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).transactionLink}},{key:"getRawTransactionLink",value:function(){return tk.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).rawTransactionLink}},{key:"executeStep",value:(h=a(r().mark((function e(t,n,i){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("executeStep method needs to be overwritten by injecting from Verifier");case 1:case"end":return e.stop()}}),e)}))),function(e,t,n){return h.apply(this,arguments)})},{key:"setVerificationSuite",value:(u=a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setIssuerFromProofVerificationMethod();case 2:this.verificationMethodPublicKey=ZO(this.getTargetVerificationMethodContainer(),fZ(this.proof)),this.suite=new hZ({document:this.documentToVerify,proof:this.proof,verificationMethod:this.verificationMethodPublicKey,options:{explorerAPIs:this.explorerAPIs,executeStepMethod:this.executeStep}});case 4:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"adaptVerificationProcessToChain",value:function(){tk.chains.isMockChain(this.chain)&&(rd(this.proofVerificationProcess,lZ.parseIssuerKeys),rd(this.proofVerificationProcess,lZ.checkAuthenticity))}},{key:"getTargetVerificationMethodContainer",value:function(){var e;return null!==(e=this.issuer.didDocument)&&void 0!==e?e:this.issuer}},{key:"isProofChain",value:function(){return"ChainedProof2021"===this.proof.type}},{key:"isMultipleProof",value:function(){return Array.isArray(this.documentToVerify.proof)}},{key:"getProofIndex",value:function(){var e=this;return this.isMultipleProof()?this.documentToVerify.proof.findIndex((function(t){return t.proofValue===e.proof.proofValue})):-1}},{key:"setIssuerFromProofVerificationMethod",value:(o=a(r().mark((function e(){var t;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(this.getProofIndex()>0)){e.next=5;break}return t=this.proof.verificationMethod.split("#")[0],e.next=4,tk.verifier.getIssuerProfile(t);case 4:this.issuer=e.sent;case 5:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"setHasDid",value:function(){if(this.getProofIndex()>0){var e=this.proof.verificationMethod.split("#")[0];this.hasDid=Ad(e)}else this.hasDid=!!this.issuer.didDocument}},{key:"validateProofType",value:function(){var e=this.isProofChain()?this.proof.chainedProofType:this.proof.type;if(e!==this.type)throw new Error("Incompatible proof type passed. Expected: ".concat(this.type,", Got: ").concat(e))}},{key:"verifyProcess",value:(i=a(r().mark((function e(t){var n,i,o;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=F(t),e.prev=1,n.s();case 3:if((i=n.n()).done){e.next=11;break}if(this[o=i.value]){e.next=7;break}return e.abrupt("return",void console.error("verification logic for",o,"not implemented"));case 7:return e.next=9,this[o]();case 9:e.next=3;break;case 11:e.next=16;break;case 13:e.prev=13,e.t0=e.catch(1),n.e(e.t0);case 16:return e.prev=16,n.f(),e.finish(16);case 19:case"end":return e.stop()}}),e,this,[[1,13,16,19]])}))),function(e){return i.apply(this,arguments)})},{key:"parseIssuerKeys",value:(n=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(lZ.parseIssuerKeys,(function(){return tk.verifier.parseIssuerKeys(t.issuer)}),this.type);case 2:this.issuerPublicKeyList=e.sent;case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"checkAuthenticity",value:(t=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(lZ.checkAuthenticity,(function(){return XO(t.issuerPublicKeyList,t.getIssuerPublicKey(),t.getIssuanceTime())}),this.type);case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),v}(wF);!function(e){e.getTransactionId="getTransactionId",e.computeLocalHash="computeLocalHash",e.fetchRemoteHash="fetchRemoteHash",e.parseIssuerKeys="parseIssuerKeys",e.compareHashes="compareHashes",e.checkMerkleRoot="checkMerkleRoot",e.checkReceipt="checkReceipt",e.checkAuthenticity="checkAuthenticity"}(AZ||(AZ={}));var pZ=function(e){c(I,e);var t,n,i,o,u,h,f,d,p,g,v,y,w=b(I);function I(e){var t;return s(this,I),A(m(t=w.call(this,e)),"verificationProcess",[AZ.getTransactionId,AZ.computeLocalHash,AZ.fetchRemoteHash,AZ.compareHashes,AZ.checkMerkleRoot,AZ.checkReceipt,AZ.parseIssuerKeys,AZ.checkAuthenticity]),A(m(t),"transactionId",void 0),A(m(t),"localHash",void 0),A(m(t),"documentToVerify",void 0),A(m(t),"txData",void 0),A(m(t),"chain",void 0),A(m(t),"explorerAPIs",void 0),A(m(t),"receipt",void 0),A(m(t),"issuerPublicKeyList",void 0),A(m(t),"issuer",void 0),A(m(t),"proof",void 0),A(m(t),"type","MerkleProof2017"),e.executeStep&&(t.executeStep=e.executeStep),t.documentToVerify=e.document,t.explorerAPIs=e.explorerAPIs,t.issuer=e.issuer,t.proof=e.proof,t.validateProofType(),t.receipt=t.documentToVerify.signature,t.chain=tk.certificates.getChain("",t.receipt),t.transactionId=tk.certificates.getTransactionId(t.receipt),t.adaptVerificationProcessToChain(),t}return l(I,[{key:"init",value:(y=a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(){return y.apply(this,arguments)})},{key:"verifyProof",value:(v=a(r().mark((function e(){var t,n,i;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=F(this.verificationProcess),e.prev=1,t.s();case 3:if((n=t.n()).done){e.next=11;break}if(this[i=n.value]){e.next=7;break}return e.abrupt("return",void console.error("verification logic for",i,"not implemented"));case 7:return e.next=9,this[i]();case 9:e.next=3;break;case 11:e.next=16;break;case 13:e.prev=13,e.t0=e.catch(1),t.e(e.t0);case 16:return e.prev=16,t.f(),e.finish(16);case 19:case"end":return e.stop()}}),e,this,[[1,13,16,19]])}))),function(){return v.apply(this,arguments)})},{key:"verifyIdentity",value:(g=a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(){return g.apply(this,arguments)})},{key:"getProofVerificationSteps",value:function(e){return this.verificationProcess.map((function(t){return tk.verifier.convertToVerificationSubsteps(e,t)}))}},{key:"getIdentityVerificationSteps",value:function(){return[]}},{key:"getIssuerPublicKey",value:function(){return tk.chains.isMockChain(this.chain)?"This mock chain does not support issuing addresses":this.txData?this.txData.issuingAddress:void console.error("Trying to access issuing address when txData not available yet. Did you run the `verify` method yet?")}},{key:"getIssuerName",value:function(){return this.issuer.name}},{key:"getIssuerProfileDomain",value:function(){var e;return null===(e=new URL(this.getIssuerProfileUrl()))||void 0===e?void 0:e.hostname}},{key:"getIssuerProfileUrl",value:function(){return this.issuer.id}},{key:"getSigningDate",value:function(){return this.documentToVerify.issuedOn}},{key:"getChain",value:function(){return this.chain}},{key:"getReceipt",value:function(){return this.receipt}},{key:"getTransactionIdString",value:function(){return tk.certificates.getTransactionId(this.getReceipt())}},{key:"getTransactionLink",value:function(){return tk.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).transactionLink}},{key:"getRawTransactionLink",value:function(){return tk.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).rawTransactionLink}},{key:"validateProofType",value:function(){if(this.proof.type[0]!==this.type)throw new Error("Incompatible proof type passed. Expected: ".concat(this.type,", Got: ").concat(this.proof.type[0]))}},{key:"adaptVerificationProcessToChain",value:function(){tk.chains.isMockChain(this.chain)&&(rd(this.verificationProcess,AZ.getTransactionId),rd(this.verificationProcess,AZ.fetchRemoteHash),rd(this.verificationProcess,AZ.parseIssuerKeys),rd(this.verificationProcess,AZ.checkMerkleRoot),rd(this.verificationProcess,AZ.checkAuthenticity))}},{key:"executeStep",value:(p=a(r().mark((function e(t,n,i){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Error("doAction method needs to be overwritten by injecting from CVJS");case 1:case"end":return e.stop()}}),e)}))),function(e,t,n){return p.apply(this,arguments)})},{key:"getTransactionId",value:(d=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(AZ.getTransactionId,(function(){return function(e){if("string"==typeof e&&e.length>0)return e;throw new ed("getTransactionId",Jf("errors","isTransactionIdValid"))}(t.transactionId)}),this.type);case 2:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"computeLocalHash",value:(f=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(AZ.computeLocalHash,a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,JO(t.documentToVerify);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),this.type);case 2:this.localHash=e.sent;case 3:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"fetchRemoteHash",value:(h=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(AZ.fetchRemoteHash,a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,tk.verifier.lookForTx({transactionId:t.transactionId,chain:t.chain.code,explorerAPIs:t.explorerAPIs});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),this.type);case 2:this.txData=e.sent;case 3:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"compareHashes",value:(u=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(AZ.compareHashes,(function(){return function(e,t){if(e!==t)throw new ed("compareHashes",Jf("errors","ensureHashesEqual"));return!0}(t.localHash,t.receipt.targetHash)}),this.type);case 2:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"checkMerkleRoot",value:(o=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(AZ.checkMerkleRoot,(function(){return function(e,t){if(e!==t)throw new ed("checkMerkleRoot",Jf("errors","ensureMerkleRootEqual"));return!0}(t.receipt.merkleRoot,t.txData.remoteHash)}),this.type);case 2:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"checkReceipt",value:(i=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(AZ.checkReceipt,(function(){return function(e){var t=e.targetHash,n=e.merkleRoot;try{var r=e.proof||e.path;if(r)for(var i in r){var o=r[i],a=void 0;if(void 0!==o.left)a=VO("".concat(o.left).concat(t)),t=qO(a);else{if(void 0===o.right)throw new ed("checkReceipt","Trigger catch error.");a=VO("".concat(t).concat(o.right)),t=qO(a)}}}catch(e){throw new ed("checkReceipt",Jf("errors","ensureValidReceipt"))}if(t!==n)throw new ed("checkReceipt",Jf("errors","invalidMerkleReceipt"))}(t.receipt)}),this.type);case 2:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"parseIssuerKeys",value:(n=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(AZ.parseIssuerKeys,(function(){return tk.verifier.parseIssuerKeys(t.issuer)}),this.type);case 2:this.issuerPublicKeyList=e.sent;case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"checkAuthenticity",value:(t=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(AZ.checkAuthenticity,(function(){return XO(t.issuerPublicKeyList,t.txData.issuingAddress,t.txData.time)}),this.type);case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),I}(wF),gZ=dk("Verifier"),vZ=function(){function e(t){var n=t.certificateJson,r=t.expires,i=t.hashlinkVerifier,o=t.id,a=t.issuer,u=t.revocationKey,l=t.explorerAPIs;s(this,e),A(this,"expires",void 0),A(this,"id",void 0),A(this,"issuer",void 0),A(this,"revocationKey",void 0),A(this,"documentToVerify",void 0),A(this,"explorerAPIs",void 0),A(this,"txData",void 0),A(this,"_stepsStatuses",[]),A(this,"hashlinkVerifier",void 0),A(this,"verificationSteps",void 0),A(this,"supportedVerificationSuites",void 0),A(this,"proofVerifiers",[]),A(this,"verificationProcess",void 0),A(this,"proofMap",void 0),this.expires=r,this.id=o,this.issuer=a,this.hashlinkVerifier=i,this.revocationKey=u,this.explorerAPIs=l,this.documentToVerify=Object.assign({},n)}var t,i,o,u,c,h,f;return l(e,[{key:"getVerificationSteps",value:function(){return this.verificationSteps}},{key:"getSignersData",value:function(){return this.proofVerifiers.map((function(e){var t,n,r,i;return{signingDate:e.getSigningDate(),signatureSuiteType:e.type,issuerPublicKey:e.getIssuerPublicKey(),issuerName:e.getIssuerName(),issuerProfileDomain:e.getIssuerProfileDomain(),issuerProfileUrl:e.getIssuerProfileUrl(),chain:null===(t=e.getChain)||void 0===t?void 0:t.call(e),transactionId:null===(n=e.getTransactionIdString)||void 0===n?void 0:n.call(e),transactionLink:null===(r=e.getTransactionLink)||void 0===r?void 0:r.call(e),rawTransactionLink:null===(i=e.getRawTransactionLink)||void 0===i?void 0:i.call(e)}}))}},{key:"init",value:(f=a(r().mark((function e(){var t,n,i;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.instantiateProofVerifiers(),t=F(this.proofVerifiers),e.prev=2,t.s();case 4:if((n=t.n()).done){e.next=10;break}return i=n.value,e.next=8,i.init();case 8:e.next=4;break;case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(2),t.e(e.t0);case 15:return e.prev=15,t.f(),e.finish(15);case 18:this.prepareVerificationProcess();case 19:case"end":return e.stop()}}),e,this,[[2,12,15,18]])}))),function(){return f.apply(this,arguments)})},{key:"verify",value:(h=a(r().mark((function e(){var t,n,i,o,a,s,u,l=arguments;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=l.length>0&&void 0!==l[0]?l[0]:function(){},this._stepCallback=t,this._stepsStatuses=[],n=0;case 3:if(!(n<this.proofVerifiers.length)){e.next=9;break}return e.next=6,this.proofVerifiers[n].verifyProof();case 6:n++,e.next=3;break;case 9:i=F(this.verificationProcess),e.prev=10,i.s();case 12:if((o=i.n()).done){e.next=20;break}if(this[a=o.value]){e.next=16;break}return e.abrupt("return",void console.error("verification logic for",a,"not implemented"));case 16:return e.next=18,this[a]();case 18:e.next=12;break;case 20:e.next=25;break;case 22:e.prev=22,e.t0=e.catch(10),i.e(e.t0);case 25:return e.prev=25,i.f(),e.finish(25);case 28:s=0;case 29:if(!(s<this.proofVerifiers.length)){e.next=35;break}return e.next=32,this.proofVerifiers[s].verifyIdentity();case 32:s++,e.next=29;break;case 35:return u=this._stepsStatuses.find((function(e){return e.status===zx.FAILURE})),e.abrupt("return",u?this._failed(u):this._succeed());case 37:case"end":return e.stop()}}),e,this,[[10,22,25,28]])}))),function(){return h.apply(this,arguments)})},{key:"getRevocationListUrl",value:function(){return this.issuer.revocationList}},{key:"getProofTypes",value:function(){var e=[];return this.proofMap.forEach((function(t){var n=t.type;"ChainedProof2021"===n&&(n=t.chainedProofType),Array.isArray(n)&&(n=n[0]),e.push(n)})),e}},{key:"getProofMap",value:function(e){var t=new Map;return"proof"in e?Array.isArray(e.proof)?e.proof.forEach((function(e,n){return t.set(n,e)})):t.set(0,e.proof):"signature"in e&&t.set(0,e.signature),t}},{key:"instantiateProofVerifiers",value:function(){var e=this;this.supportedVerificationSuites={MerkleProof2017:pZ,MerkleProof2019:dZ,Ed25519Signature2020:xF,EcdsaSecp256k1Signature2019:LO},this.proofMap=this.getProofMap(this.documentToVerify);var t=this.getProofTypes(),n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return t.filter((function(t){return!e.includes(t)}))}(Object.keys(this.supportedVerificationSuites),t);if(n.length)throw new Error("No support for proof verification of type: ".concat(n.join(", ")));this.proofMap.forEach((function(n,r){var i={executeStep:e.executeStep.bind(e),document:e.documentToVerify,proof:n,explorerAPIs:e.explorerAPIs,issuer:e.issuer};e.proofVerifiers.push(new e.supportedVerificationSuites[t[r]](i))}))}},{key:"prepareVerificationProcess",value:function(){var e=tk.certificates.getVerificationMap(!!this.issuer.didDocument,this.hashlinkVerifier.hasHashlinksToVerify());this.verificationSteps=e.verificationMap,this.verificationProcess=e.verificationProcess,this.registerSignatureVerificationSteps(),this.registerIdentityVerificationSteps(),this.verificationSteps=this.verificationSteps.filter((function(e){var t,n;return(null===(t=e.subSteps)||void 0===t?void 0:t.length)>0||(null===(n=e.suites)||void 0===n?void 0:n.some((function(e){return e.subSteps.length>0})))}))}},{key:"registerSignatureVerificationSteps",value:function(){var e=Yf.proofVerification;this.verificationSteps.find((function(t){return t.code===e})).suites=this.getSuiteSubsteps(e)}},{key:"getSuiteSubsteps",value:function(e){var t,n=(A(t={},Yf.proofVerification,"getProofVerificationSteps"),A(t,Yf.identityVerification,"getIdentityVerificationSteps"),t);return this.proofVerifiers.map((function(t){return{proofType:t.type,subSteps:t[n[e]](e)}}))}},{key:"registerIdentityVerificationSteps",value:function(){var e=Yf.identityVerification;this.verificationSteps.find((function(t){return t.code===e})).suites=this.getSuiteSubsteps(e)}},{key:"executeStep",value:(c=a(r().mark((function e(t,n,i){var o,a;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isFailing()){e.next=2;break}return e.abrupt("return");case 2:return t&&(o=tk.i18n.getText("subSteps","".concat(t,"LabelPending")),gZ(o),this._updateStatusCallback(t,zx.STARTING,i)),e.prev=3,e.next=6,n();case 6:return a=e.sent,e.abrupt("return",(t&&(this._updateStatusCallback(t,zx.SUCCESS,i),this._stepsStatuses.push({code:t,status:zx.SUCCESS})),a));case 10:e.prev=10,e.t0=e.catch(3),console.error(e.t0),t&&(this._updateStatusCallback(t,zx.FAILURE,i,e.t0.message),this._stepsStatuses.push({code:t,message:e.t0.message,status:zx.FAILURE}));case 13:case"end":return e.stop()}}),e,this,[[3,10]])}))),function(e,t,n){return c.apply(this,arguments)})},{key:"_stepCallback",value:function(e){}},{key:"checkImagesIntegrity",value:(u=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(Xf.checkImagesIntegrity,a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.hashlinkVerifier.verifyHashlinkTable().catch((function(e){throw console.error("hashlink verification error",e),new ed(Xf.checkImagesIntegrity,Jf("errors","checkImagesIntegrity"))}));case 2:case"end":return e.stop()}}),e)}))));case 2:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"checkRevokedStatus",value:(o=a(r().mark((function e(){var t,n,i=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.documentToVerify.credentialStatus){e.next=4;break}return e.next=3,this.executeStep(Xf.checkRevokedStatus,a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,function(){var e=a(r().mark((function e(t){var n,i,o,a,s,u,l;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Array.isArray(t)||(t=[t]),n=F(t),e.prev=2,n.s();case 4:if((i=n.n()).done){e.next=22;break}return o=i.value,a=parseInt(o.statusListIndex,10),e.next=9,TO(o.statusListCredential);case 9:if(s=e.sent){e.next=12;break}throw new ed(Xf.checkRevokedStatus,"No status list could be found at the specified URL for 'statusListCredential': ".concat(o.statusListCredential,"."));case 12:return e.next=14,OO(s);case 14:return u=s.credentialSubject.encodedList,e.next=17,x_({encodedList:u});case 17:if(!e.sent.isRevoked(a)){e.next=20;break}throw l="revocation"===o.statusPurpose?"revoked":"suspended",new ed(Xf.checkRevokedStatus,"Certificate has been ".concat(l,"."));case 20:e.next=4;break;case 22:e.next=27;break;case 24:e.prev=24,e.t0=e.catch(2),n.e(e.t0);case 27:return e.prev=27,n.f(),e.finish(27);case 30:case"end":return e.stop()}}),e,null,[[2,24,27,30]])})));return function(t){return e.apply(this,arguments)}}()(i.documentToVerify.credentialStatus);case 2:case"end":return e.stop()}}),e)}))));case 3:case 9:return e.abrupt("return",void e.sent);case 4:if(t=this.getRevocationListUrl()){e.next=10;break}return console.warn("No revocation list url was set on the issuer."),e.next=9,this.executeStep(Xf.checkRevokedStatus,(function(){return!0}));case 10:return e.next=12,this.executeStep(null,a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,tk.verifier.getRevokedAssertions(t,i.id);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))));case 12:return n=e.sent,e.next=15,this.executeStep(Xf.checkRevokedStatus,(function(){return function(e,t){if(e&&t){Array.isArray(t)||(t=[t]),t=t.filter((function(e){return null!=e}));var n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return e.filter((function(e){return t.includes(e)})).filter((function(e,t,n){return n.indexOf(e)===t}))}(t,e.map((function(e){return e.id})));if(n.length>0){var r=e.findIndex((function(e){return e.id===n[0]}));if(r>-1)throw new ed(Xf.checkRevokedStatus,tk.certificates.generateRevocationReason(e[r].revocationReason))}}}(n,i.id)}));case 15:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"checkExpiresDate",value:(i=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(Xf.checkExpiresDate,(function(){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(e){var t=Wx(e);if((new Date).getTime()>=t)throw new ed(Xf.checkExpiresDate,Jf("errors","ensureNotExpired"))}}(t.expires)}));case 2:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"controlVerificationMethod",value:(t=a(r().mark((function e(){var t=this;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.executeStep(Xf.controlVerificationMethod,(function(){!function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=function(e){return e.id}(e);if(n!==t.split("#")[0])throw new ed(Xf.controlVerificationMethod,"".concat(WO," - ").concat(tk.i18n.getText("errors","controlVerificationMethod")))}(t.issuer.didDocument,fZ(t.documentToVerify.proof))}));case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"findStepFromVerificationProcess",value:function(e,t){return tk.verifier.findVerificationSubstep(e,this.verificationSteps,t)}},{key:"_failed",value:function(e){var t=e.message;return gZ("failure:".concat(t)),this._setFinalStep({status:zx.FAILURE,message:t})}},{key:"_isFailing",value:function(){return this._stepsStatuses.some((function(e){return e.status===zx.FAILURE}))}},{key:"_succeed",value:function(){var e;return 1===this.proofVerifiers.length&&(this.proofVerifiers[0].type.includes("MerkleProof")?(e=tk.chains.isMockChain(this.proofVerifiers[0].getChain())?tk.i18n.getComposedText("success","mocknet"):tk.i18n.getComposedText("success","blockchain"),gZ(e)):e=n(n({},tk.i18n.getComposedText("success","generic")),{},{description:tk.i18n.getComposedText("success","generic").description.replace("${SIGNATURE_TYPE}",this.proofVerifiers[0].type)})),this.proofVerifiers.length>1&&(e=tk.i18n.getComposedText("success","multisign")),this._setFinalStep({status:zx.SUCCESS,message:e})}},{key:"_setFinalStep",value:function(e){var t=e.status,n=e.message;return{code:Yf.final,status:t,message:n}}},{key:"_updateStatusCallback",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";if(null!=e){var i=this.findStepFromVerificationProcess(e,n);if(void 0===i)return void console.warn("step with code",e,"was not found for suite",n,"ignoring but you should not.");var o={code:e,status:t,parentStep:i.parentStep,label:i.labelPending};r&&(o.errorMessage=r),this._stepCallback(o)}}}]),e}();function yZ(e,t){return mZ.apply(this,arguments)}function mZ(){return mZ=a(r().mark((function e(t,n){var i,o;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(i=k(t.matchAll(/hl:{1}[a-zA-Z0-9]+:{1}[a-zA-Z0-9]+/gm)).map((function(e){return e[0]})).filter((function(e){return!!e}))).length){e.next=6;break}return e.next=4,function(){var e=a(r().mark((function e(t,n){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(t.map(function(){var e=a(r().mark((function e(t){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.decode(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 2:return e.abrupt("return",e.sent.reduce((function(e,t){return e.push(t.meta.url[0]),e}),[]));case 3:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()(i,n);case 4:o=e.sent,t=function(e,t,n){return t.forEach((function(t,r){e=e.replace(n[r],t)})),e}(t,o,i);case 6:return e.abrupt("return",t);case 7:case"end":return e.stop()}}),e)}))),mZ.apply(this,arguments)}var wZ=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(s(this,e),A(this,"certificateImage",void 0),A(this,"certificateJson",void 0),A(this,"description",void 0),A(this,"display",void 0),A(this,"expires",void 0),A(this,"explorerAPIs",[]),A(this,"id",void 0),A(this,"isFormatValid",void 0),A(this,"issuedOn",void 0),A(this,"issuer",void 0),A(this,"locale",void 0),A(this,"metadataJson",void 0),A(this,"name",void 0),A(this,"options",void 0),A(this,"recipientFullName",void 0),A(this,"recordLink",void 0),A(this,"revocationKey",void 0),A(this,"sealImage",void 0),A(this,"signature",void 0),A(this,"signatureImage",void 0),A(this,"signers",[]),A(this,"subtitle",void 0),A(this,"hashlinkVerifier",void 0),A(this,"verificationSteps",void 0),A(this,"verifier",void 0),this._setOptions(n),"object"!=i(t))try{t=JSON.parse(t)}catch(t){throw new Error(tk.i18n.getText("errors","certificateNotValid"))}this.certificateJson=BF(t),this.hashlinkVerifier=new Ql}var t,n,o,u,c;return l(e,[{key:"init",value:(c=a(r().mark((function e(){return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.parseJson(this.certificateJson);case 2:return this.verifier=new vZ({certificateJson:this.certificateJson,expires:this.expires,id:this.id,issuer:this.issuer,hashlinkVerifier:this.hashlinkVerifier,revocationKey:this.revocationKey,explorerAPIs:BF(this.explorerAPIs)}),e.next=5,this.verifier.init();case 5:this.verificationSteps=this.verifier.getVerificationSteps();case 6:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"verify",value:(u=a(r().mark((function e(t){var n;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.verifier.verify(t);case 2:return n=e.sent,e.abrupt("return",(this.setSigners(),n));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"parseJson",value:(o=a(r().mark((function e(t){var n;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,function(){var e=a(r().mark((function e(t){var n,i;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n=rk(t["@context"]),e.next=4,ak[n.versionNumber](t);case 4:return i=e.sent,e.abrupt("return",(i.isFormatValid=!0,i));case 8:return e.prev=8,e.t0=e.catch(0),e.abrupt("return",(console.error(e.t0),{isFormatValid:!1,error:e.t0.message}));case 11:case"end":return e.stop()}}),e,null,[[0,8]])})));return function(t){return e.apply(this,arguments)}}()(t);case 2:if((n=e.sent).isFormatValid){e.next=5;break}throw new Error(n.error);case 5:return e.next=7,this._setProperties(n);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"setSigners",value:function(){this.signers=this.verifier.getSignersData()}},{key:"_setOptions",value:function(e){this.options=Object.assign({},Gf,e),this.locale=tk.i18n.ensureIsSupported("auto"===this.options.locale?tk.i18n.detectLocale():this.options.locale),this.explorerAPIs=this.options.explorerAPIs||[],e.didResolverUrl&&(tk.did.didResolver.url=e.didResolverUrl),Vf.locale=this.locale}},{key:"_setProperties",value:(n=a(r().mark((function e(t){var n,i,o,a,s,u,l,A,c,h,f,d,p,g,v,y,m;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.certificateImage,i=t.description,o=t.display,a=t.expires,s=t.id,u=t.isFormatValid,l=t.issuedOn,A=t.issuer,c=t.metadataJson,h=t.name,f=t.recipientFullName,d=t.recordLink,p=t.revocationKey,g=t.sealImage,v=t.signature,y=t.signatureImage,m=t.subtitle,this.isFormatValid=u,this.certificateImage=n,this.description=i,this.expires=a,this.id=s,this.issuedOn=l,this.issuer=A,this.metadataJson=c,this.name=h,this.recipientFullName=f,this.recordLink=d,this.revocationKey=p,this.sealImage=g,this.signature=v,this.signatureImage=y,this.subtitle=m,e.next=19,this.parseHashlinksInDisplay(o);case 19:this.display=e.sent;case 20:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"parseHashlinksInDisplay",value:(t=a(r().mark((function e(t){var n;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=BF(t))){e.next=8;break}if(e.t0="text/html"!==n.contentMediaType,e.t0){e.next=7;break}return e.next=6,yZ(n.content,this.hashlinkVerifier);case 6:n.content=e.sent;case 7:return e.abrupt("return",n);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}();function bZ(e){return/^(ftp|http|https):\/\/[^ "]+$/.test(e)}function IZ(e){return/^(\.\/|\.\.\/|[A-Z]:\/\/|\/)[^ "]+$/.test(e)}function BZ(){return{certificateDefinition:null,errorMessage:"errors.invalidBlockcertsUrl"}}function EZ(e){return new Promise((function(t,n){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=r.onabort=n,r.readAsText(e)}))}function CZ(){return(CZ=a(r().mark((function e(t){var n;return r().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,EZ(t);case 4:return n=e.sent,e.abrupt("return",n);case 6:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var xZ,kZ,SZ,QZ,_Z,NZ=["documentLoader"];
599
599
  /*! *****************************************************************************
600
600
  Copyright (c) Microsoft Corporation.
601
601