diff --git a/dist/assets/index-4FXhSRz4.js b/dist/assets/index-4FXhSRz4.js deleted file mode 100644 index 810ccb24..00000000 --- a/dist/assets/index-4FXhSRz4.js +++ /dev/null @@ -1,2095 +0,0 @@ -var B2=Object.defineProperty;var A2=(e,t,n)=>t in e?B2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ye=(e,t,n)=>A2(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function kf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function mu(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var Wp={exports:{}},wu={},Gp={exports:{}},ve={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var bs=Symbol.for("react.element"),C2=Symbol.for("react.portal"),I2=Symbol.for("react.fragment"),T2=Symbol.for("react.strict_mode"),U2=Symbol.for("react.profiler"),L2=Symbol.for("react.provider"),O2=Symbol.for("react.context"),N2=Symbol.for("react.forward_ref"),R2=Symbol.for("react.suspense"),P2=Symbol.for("react.memo"),$2=Symbol.for("react.lazy"),$h=Symbol.iterator;function M2(e){return e===null||typeof e!="object"?null:(e=$h&&e[$h]||e["@@iterator"],typeof e=="function"?e:null)}var Zp={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Qp=Object.assign,Yp={};function ho(e,t,n){this.props=e,this.context=t,this.refs=Yp,this.updater=n||Zp}ho.prototype.isReactComponent={};ho.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ho.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function Xp(){}Xp.prototype=ho.prototype;function _f(e,t,n){this.props=e,this.context=t,this.refs=Yp,this.updater=n||Zp}var Bf=_f.prototype=new Xp;Bf.constructor=_f;Qp(Bf,ho.prototype);Bf.isPureReactComponent=!0;var Mh=Array.isArray,Jp=Object.prototype.hasOwnProperty,Af={current:null},ey={key:!0,ref:!0,__self:!0,__source:!0};function ty(e,t,n){var r,i={},o=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(o=""+t.key),t)Jp.call(t,r)&&!ey.hasOwnProperty(r)&&(i[r]=t[r]);var a=arguments.length-2;if(a===1)i.children=n;else if(1>>1,$=m[T];if(0>>1;Ti(X,U))ie<$&&0>i(ue,X)?(m[T]=ue,m[ie]=U,T=ie):(m[T]=X,m[Y]=U,T=Y);else if(ie<$&&0>i(ue,U))m[T]=ue,m[ie]=U,T=ie;else break e}}return k}function i(m,k){var U=m.sortIndex-k.sortIndex;return U!==0?U:m.id-k.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var u=[],l=[],f=1,c=null,p=3,y=!1,E=!1,w=!1,A=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(m){for(var k=n(l);k!==null;){if(k.callback===null)r(l);else if(k.startTime<=m)r(l),k.sortIndex=k.expirationTime,t(u,k);else break;k=n(l)}}function L(m){if(w=!1,x(m),!E)if(n(u)!==null)E=!0,C(N);else{var k=n(l);k!==null&&B(L,k.startTime-m)}}function N(m,k){E=!1,w&&(w=!1,v(F),F=-1),y=!0;var U=p;try{for(x(k),c=n(u);c!==null&&(!(c.expirationTime>k)||m&&!P());){var T=c.callback;if(typeof T=="function"){c.callback=null,p=c.priorityLevel;var $=T(c.expirationTime<=k);k=e.unstable_now(),typeof $=="function"?c.callback=$:c===n(u)&&r(u),x(k)}else r(u);c=n(u)}if(c!==null)var V=!0;else{var Y=n(l);Y!==null&&B(L,Y.startTime-k),V=!1}return V}finally{c=null,p=U,y=!1}}var R=!1,H=null,F=-1,q=5,K=-1;function P(){return!(e.unstable_now()-Km||125T?(m.sortIndex=U,t(l,m),n(u)===null&&m===n(l)&&(w?(v(F),F=-1):w=!0,B(L,U-T))):(m.sortIndex=$,t(u,m),E||y||(E=!0,C(N))),m},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(m){var k=p;return function(){var U=p;p=k;try{return m.apply(this,arguments)}finally{p=U}}}})(sy);oy.exports=sy;var Q2=oy.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Y2=St,Qt=Q2;function Z(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),oc=Object.prototype.hasOwnProperty,X2=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Fh={},jh={};function J2(e){return oc.call(jh,e)?!0:oc.call(Fh,e)?!1:X2.test(e)?jh[e]=!0:(Fh[e]=!0,!1)}function eb(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function tb(e,t,n,r){if(t===null||typeof t>"u"||eb(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Bt(e,t,n,r,i,o,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var at={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){at[e]=new Bt(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];at[t]=new Bt(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){at[e]=new Bt(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){at[e]=new Bt(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){at[e]=new Bt(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){at[e]=new Bt(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){at[e]=new Bt(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){at[e]=new Bt(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){at[e]=new Bt(e,5,!1,e.toLowerCase(),null,!1,!1)});var If=/[\-:]([a-z])/g;function Tf(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(If,Tf);at[t]=new Bt(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(If,Tf);at[t]=new Bt(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(If,Tf);at[t]=new Bt(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){at[e]=new Bt(e,1,!1,e.toLowerCase(),null,!1,!1)});at.xlinkHref=new Bt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){at[e]=new Bt(e,1,!1,e.toLowerCase(),null,!0,!0)});function Uf(e,t,n,r){var i=at.hasOwnProperty(t)?at[t]:null;(i!==null?i.type!==0:r||!(2a||i[s]!==o[a]){var u=` -`+i[s].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=s&&0<=a);break}}}finally{ll=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?No(e):""}function nb(e){switch(e.tag){case 5:return No(e.type);case 16:return No("Lazy");case 13:return No("Suspense");case 19:return No("SuspenseList");case 0:case 2:case 15:return e=cl(e.type,!1),e;case 11:return e=cl(e.type.render,!1),e;case 1:return e=cl(e.type,!0),e;default:return""}}function lc(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Li:return"Fragment";case Ui:return"Portal";case sc:return"Profiler";case Lf:return"StrictMode";case ac:return"Suspense";case uc:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ly:return(e.displayName||"Context")+".Consumer";case uy:return(e._context.displayName||"Context")+".Provider";case Of:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Nf:return t=e.displayName||null,t!==null?t:lc(e.type)||"Memo";case Ar:t=e._payload,e=e._init;try{return lc(e(t))}catch{}}return null}function rb(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return lc(t);case 8:return t===Lf?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Vr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function fy(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ib(e){var t=fy(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Fs(e){e._valueTracker||(e._valueTracker=ib(e))}function dy(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=fy(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ca(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function cc(e,t){var n=t.checked;return He({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function zh(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Vr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function hy(e,t){t=t.checked,t!=null&&Uf(e,"checked",t,!1)}function fc(e,t){hy(e,t);var n=Vr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?dc(e,t.type,n):t.hasOwnProperty("defaultValue")&&dc(e,t.type,Vr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Kh(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function dc(e,t,n){(t!=="number"||Ca(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Ro=Array.isArray;function Ki(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=js.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Yo(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Fo={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ob=["Webkit","ms","Moz","O"];Object.keys(Fo).forEach(function(e){ob.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Fo[t]=Fo[e]})});function my(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Fo.hasOwnProperty(e)&&Fo[e]?(""+t).trim():t+"px"}function wy(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=my(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var sb=He({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function yc(e,t){if(t){if(sb[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Z(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Z(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Z(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Z(62))}}function gc(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var mc=null;function Rf(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var wc=null,Vi=null,qi=null;function Wh(e){if(e=Ss(e)){if(typeof wc!="function")throw Error(Z(280));var t=e.stateNode;t&&(t=Su(t),wc(e.stateNode,e.type,t))}}function vy(e){Vi?qi?qi.push(e):qi=[e]:Vi=e}function by(){if(Vi){var e=Vi,t=qi;if(qi=Vi=null,Wh(e),t)for(e=0;e>>=0,e===0?32:31-(mb(e)/wb|0)|0}var Ds=64,zs=4194304;function Po(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function La(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~i;a!==0?r=Po(a):(o&=s,o!==0&&(r=Po(o)))}else s=n&~i,s!==0?r=Po(s):o!==0&&(r=Po(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Es(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-bn(t),e[t]=n}function xb(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Do),n0=" ",r0=!1;function Fy(e,t){switch(e){case"keyup":return Qb.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jy(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Oi=!1;function Xb(e,t){switch(e){case"compositionend":return jy(t);case"keypress":return t.which!==32?null:(r0=!0,n0);case"textInput":return e=t.data,e===n0&&r0?null:e;default:return null}}function Jb(e,t){if(Oi)return e==="compositionend"||!zf&&Fy(e,t)?(e=My(),ca=Ff=Lr=null,Oi=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=a0(n)}}function Vy(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Vy(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function qy(){for(var e=window,t=Ca();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ca(e.document)}return t}function Kf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function uE(e){var t=qy(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Vy(n.ownerDocument.documentElement,n)){if(r!==null&&Kf(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=u0(n,o);var s=u0(n,r);i&&s&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Ni=null,kc=null,Ko=null,_c=!1;function l0(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;_c||Ni==null||Ni!==Ca(r)||(r=Ni,"selectionStart"in r&&Kf(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Ko&&rs(Ko,r)||(Ko=r,r=Ra(kc,"onSelect"),0$i||(e.current=Uc[$i],Uc[$i]=null,$i--)}function Te(e,t){$i++,Uc[$i]=e.current,e.current=t}var qr={},vt=Qr(qr),Pt=Qr(!1),pi=qr;function eo(e,t){var n=e.type.contextTypes;if(!n)return qr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function $t(e){return e=e.childContextTypes,e!=null}function $a(){Le(Pt),Le(vt)}function g0(e,t,n){if(vt.current!==qr)throw Error(Z(168));Te(vt,t),Te(Pt,n)}function tg(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(Z(108,rb(e)||"Unknown",i));return He({},n,r)}function Ma(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||qr,pi=vt.current,Te(vt,e),Te(Pt,Pt.current),!0}function m0(e,t,n){var r=e.stateNode;if(!r)throw Error(Z(169));n?(e=tg(e,t,pi),r.__reactInternalMemoizedMergedChildContext=e,Le(Pt),Le(vt),Te(vt,e)):Le(Pt),Te(Pt,n)}var Kn=null,ku=!1,kl=!1;function ng(e){Kn===null?Kn=[e]:Kn.push(e)}function bE(e){ku=!0,ng(e)}function Yr(){if(!kl&&Kn!==null){kl=!0;var e=0,t=ke;try{var n=Kn;for(ke=1;e>=s,i-=s,qn=1<<32-bn(t)+i|n<F?(q=H,H=null):q=H.sibling;var K=p(v,H,x[F],L);if(K===null){H===null&&(H=q);break}e&&H&&K.alternate===null&&t(v,H),S=o(K,S,F),R===null?N=K:R.sibling=K,R=K,H=q}if(F===x.length)return n(v,H),Re&&ti(v,F),N;if(H===null){for(;FF?(q=H,H=null):q=H.sibling;var P=p(v,H,K.value,L);if(P===null){H===null&&(H=q);break}e&&H&&P.alternate===null&&t(v,H),S=o(P,S,F),R===null?N=P:R.sibling=P,R=P,H=q}if(K.done)return n(v,H),Re&&ti(v,F),N;if(H===null){for(;!K.done;F++,K=x.next())K=c(v,K.value,L),K!==null&&(S=o(K,S,F),R===null?N=K:R.sibling=K,R=K);return Re&&ti(v,F),N}for(H=r(v,H);!K.done;F++,K=x.next())K=y(H,v,F,K.value,L),K!==null&&(e&&K.alternate!==null&&H.delete(K.key===null?F:K.key),S=o(K,S,F),R===null?N=K:R.sibling=K,R=K);return e&&H.forEach(function(D){return t(v,D)}),Re&&ti(v,F),N}function A(v,S,x,L){if(typeof x=="object"&&x!==null&&x.type===Li&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case Hs:e:{for(var N=x.key,R=S;R!==null;){if(R.key===N){if(N=x.type,N===Li){if(R.tag===7){n(v,R.sibling),S=i(R,x.props.children),S.return=v,v=S;break e}}else if(R.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Ar&&b0(N)===R.type){n(v,R.sibling),S=i(R,x.props),S.ref=Co(v,R,x),S.return=v,v=S;break e}n(v,R);break}else t(v,R);R=R.sibling}x.type===Li?(S=fi(x.props.children,v.mode,L,x.key),S.return=v,v=S):(L=wa(x.type,x.key,x.props,null,v.mode,L),L.ref=Co(v,S,x),L.return=v,v=L)}return s(v);case Ui:e:{for(R=x.key;S!==null;){if(S.key===R)if(S.tag===4&&S.stateNode.containerInfo===x.containerInfo&&S.stateNode.implementation===x.implementation){n(v,S.sibling),S=i(S,x.children||[]),S.return=v,v=S;break e}else{n(v,S);break}else t(v,S);S=S.sibling}S=Ll(x,v.mode,L),S.return=v,v=S}return s(v);case Ar:return R=x._init,A(v,S,R(x._payload),L)}if(Ro(x))return E(v,S,x,L);if(So(x))return w(v,S,x,L);Qs(v,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,S!==null&&S.tag===6?(n(v,S.sibling),S=i(S,x),S.return=v,v=S):(n(v,S),S=Ul(x,v.mode,L),S.return=v,v=S),s(v)):n(v,S)}return A}var no=sg(!0),ag=sg(!1),ja=Qr(null),Da=null,Fi=null,Gf=null;function Zf(){Gf=Fi=Da=null}function Qf(e){var t=ja.current;Le(ja),e._currentValue=t}function Nc(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Gi(e,t){Da=e,Gf=Fi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Nt=!0),e.firstContext=null)}function cn(e){var t=e._currentValue;if(Gf!==e)if(e={context:e,memoizedValue:t,next:null},Fi===null){if(Da===null)throw Error(Z(308));Fi=e,Da.dependencies={lanes:0,firstContext:e}}else Fi=Fi.next=e;return t}var oi=null;function Yf(e){oi===null?oi=[e]:oi.push(e)}function ug(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,Yf(t)):(n.next=i.next,i.next=n),t.interleaved=n,nr(e,r)}function nr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Cr=!1;function Xf(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function lg(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Yn(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Hr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,xe&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,nr(e,n)}return i=r.interleaved,i===null?(t.next=t,Yf(r)):(t.next=i.next,i.next=t),r.interleaved=t,nr(e,n)}function da(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$f(e,n)}}function E0(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?i=o=t:o=o.next=t}else i=o=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function za(e,t,n,r){var i=e.updateQueue;Cr=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var u=a,l=u.next;u.next=null,s===null?o=l:s.next=l,s=u;var f=e.alternate;f!==null&&(f=f.updateQueue,a=f.lastBaseUpdate,a!==s&&(a===null?f.firstBaseUpdate=l:a.next=l,f.lastBaseUpdate=u))}if(o!==null){var c=i.baseState;s=0,f=l=u=null,a=o;do{var p=a.lane,y=a.eventTime;if((r&p)===p){f!==null&&(f=f.next={eventTime:y,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var E=e,w=a;switch(p=t,y=n,w.tag){case 1:if(E=w.payload,typeof E=="function"){c=E.call(y,c,p);break e}c=E;break e;case 3:E.flags=E.flags&-65537|128;case 0:if(E=w.payload,p=typeof E=="function"?E.call(y,c,p):E,p==null)break e;c=He({},c,p);break e;case 2:Cr=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,p=i.effects,p===null?i.effects=[a]:p.push(a))}else y={eventTime:y,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},f===null?(l=f=y,u=c):f=f.next=y,s|=p;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;p=a,a=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(f===null&&(u=c),i.baseState=u,i.firstBaseUpdate=l,i.lastBaseUpdate=f,t=i.shared.interleaved,t!==null){i=t;do s|=i.lane,i=i.next;while(i!==t)}else o===null&&(i.shared.lanes=0);mi|=s,e.lanes=s,e.memoizedState=c}}function x0(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Bl.transition;Bl.transition={};try{e(!1),t()}finally{ke=n,Bl.transition=r}}function Bg(){return fn().memoizedState}function kE(e,t,n){var r=jr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Ag(e))Cg(t,n);else if(n=ug(e,t,n,r),n!==null){var i=kt();En(n,e,r,i),Ig(n,t,r)}}function _E(e,t,n){var r=jr(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ag(e))Cg(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,a=o(s,n);if(i.hasEagerState=!0,i.eagerState=a,xn(a,s)){var u=t.interleaved;u===null?(i.next=i,Yf(t)):(i.next=u.next,u.next=i),t.interleaved=i;return}}catch{}finally{}n=ug(e,t,i,r),n!==null&&(i=kt(),En(n,e,r,i),Ig(n,t,r))}}function Ag(e){var t=e.alternate;return e===Me||t!==null&&t===Me}function Cg(e,t){Vo=Va=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ig(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,$f(e,n)}}var qa={readContext:cn,useCallback:lt,useContext:lt,useEffect:lt,useImperativeHandle:lt,useInsertionEffect:lt,useLayoutEffect:lt,useMemo:lt,useReducer:lt,useRef:lt,useState:lt,useDebugValue:lt,useDeferredValue:lt,useTransition:lt,useMutableSource:lt,useSyncExternalStore:lt,useId:lt,unstable_isNewReconciler:!1},BE={readContext:cn,useCallback:function(e,t){return In().memoizedState=[e,t===void 0?null:t],e},useContext:cn,useEffect:k0,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,pa(4194308,4,Eg.bind(null,t,e),n)},useLayoutEffect:function(e,t){return pa(4194308,4,e,t)},useInsertionEffect:function(e,t){return pa(4,2,e,t)},useMemo:function(e,t){var n=In();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=In();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=kE.bind(null,Me,e),[r.memoizedState,e]},useRef:function(e){var t=In();return e={current:e},t.memoizedState=e},useState:S0,useDebugValue:sd,useDeferredValue:function(e){return In().memoizedState=e},useTransition:function(){var e=S0(!1),t=e[0];return e=SE.bind(null,e[1]),In().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Me,i=In();if(Re){if(n===void 0)throw Error(Z(407));n=n()}else{if(n=t(),Je===null)throw Error(Z(349));gi&30||hg(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,k0(yg.bind(null,r,o,e),[e]),r.flags|=2048,fs(9,pg.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=In(),t=Je.identifierPrefix;if(Re){var n=Wn,r=qn;n=(r&~(1<<32-bn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ls++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Tn]=t,e[ss]=r,Hg(e,t,!1,!1),t.stateNode=e;e:{switch(s=gc(n,r),n){case"dialog":Ue("cancel",e),Ue("close",e),i=r;break;case"iframe":case"object":case"embed":Ue("load",e),i=r;break;case"video":case"audio":for(i=0;i<$o.length;i++)Ue($o[i],e);i=r;break;case"source":Ue("error",e),i=r;break;case"img":case"image":case"link":Ue("error",e),Ue("load",e),i=r;break;case"details":Ue("toggle",e),i=r;break;case"input":zh(e,r),i=cc(e,r),Ue("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=He({},r,{value:void 0}),Ue("invalid",e);break;case"textarea":Vh(e,r),i=hc(e,r),Ue("invalid",e);break;default:i=r}yc(n,i),a=i;for(o in a)if(a.hasOwnProperty(o)){var u=a[o];o==="style"?wy(e,u):o==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&gy(e,u)):o==="children"?typeof u=="string"?(n!=="textarea"||u!=="")&&Yo(e,u):typeof u=="number"&&Yo(e,""+u):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Qo.hasOwnProperty(o)?u!=null&&o==="onScroll"&&Ue("scroll",e):u!=null&&Uf(e,o,u,s))}switch(n){case"input":Fs(e),Kh(e,r,!1);break;case"textarea":Fs(e),qh(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Vr(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?Ki(e,!!r.multiple,o,!1):r.defaultValue!=null&&Ki(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=Pa)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return ct(t),null;case 6:if(e&&t.stateNode!=null)jg(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Z(166));if(n=si(us.current),si(Rn.current),Zs(t)){if(r=t.stateNode,n=t.memoizedProps,r[Tn]=t,(o=r.nodeValue!==n)&&(e=Zt,e!==null))switch(e.tag){case 3:Gs(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Gs(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Tn]=t,t.stateNode=r}return ct(t),null;case 13:if(Le($e),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Re&&Wt!==null&&t.mode&1&&!(t.flags&128))og(),to(),t.flags|=98560,o=!1;else if(o=Zs(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(Z(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(Z(317));o[Tn]=t}else to(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;ct(t),o=!1}else vn!==null&&(Qc(vn),vn=null),o=!0;if(!o)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||$e.current&1?Ge===0&&(Ge=3):hd())),t.updateQueue!==null&&(t.flags|=4),ct(t),null);case 4:return ro(),Dc(e,t),e===null&&is(t.stateNode.containerInfo),ct(t),null;case 10:return Qf(t.type._context),ct(t),null;case 17:return $t(t.type)&&$a(),ct(t),null;case 19:if(Le($e),o=t.memoizedState,o===null)return ct(t),null;if(r=(t.flags&128)!==0,s=o.rendering,s===null)if(r)Io(o,!1);else{if(Ge!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=Ka(e),s!==null){for(t.flags|=128,Io(o,!1),r=s.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)o=n,e=r,o.flags&=14680066,s=o.alternate,s===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=s.childLanes,o.lanes=s.lanes,o.child=s.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=s.memoizedProps,o.memoizedState=s.memoizedState,o.updateQueue=s.updateQueue,o.type=s.type,e=s.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Te($e,$e.current&1|2),t.child}e=e.sibling}o.tail!==null&&De()>oo&&(t.flags|=128,r=!0,Io(o,!1),t.lanes=4194304)}else{if(!r)if(e=Ka(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Io(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!Re)return ct(t),null}else 2*De()-o.renderingStartTime>oo&&n!==1073741824&&(t.flags|=128,r=!0,Io(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=De(),t.sibling=null,n=$e.current,Te($e,r?n&1|2:n&1),t):(ct(t),null);case 22:case 23:return dd(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?qt&1073741824&&(ct(t),t.subtreeFlags&6&&(t.flags|=8192)):ct(t),null;case 24:return null;case 25:return null}throw Error(Z(156,t.tag))}function NE(e,t){switch(qf(t),t.tag){case 1:return $t(t.type)&&$a(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ro(),Le(Pt),Le(vt),td(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ed(t),null;case 13:if(Le($e),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Z(340));to()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Le($e),null;case 4:return ro(),null;case 10:return Qf(t.type._context),null;case 22:case 23:return dd(),null;case 24:return null;default:return null}}var Xs=!1,gt=!1,RE=typeof WeakSet=="function"?WeakSet:Set,J=null;function ji(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){je(e,t,r)}else n.current=null}function zc(e,t,n){try{n()}catch(r){je(e,t,r)}}var R0=!1;function PE(e,t){if(Bc=Oa,e=qy(),Kf(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,a=-1,u=-1,l=0,f=0,c=e,p=null;t:for(;;){for(var y;c!==n||i!==0&&c.nodeType!==3||(a=s+i),c!==o||r!==0&&c.nodeType!==3||(u=s+r),c.nodeType===3&&(s+=c.nodeValue.length),(y=c.firstChild)!==null;)p=c,c=y;for(;;){if(c===e)break t;if(p===n&&++l===i&&(a=s),p===o&&++f===r&&(u=s),(y=c.nextSibling)!==null)break;c=p,p=c.parentNode}c=y}n=a===-1||u===-1?null:{start:a,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ac={focusedElem:e,selectionRange:n},Oa=!1,J=t;J!==null;)if(t=J,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,J=e;else for(;J!==null;){t=J;try{var E=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(E!==null){var w=E.memoizedProps,A=E.memoizedState,v=t.stateNode,S=v.getSnapshotBeforeUpdate(t.elementType===t.type?w:gn(t.type,w),A);v.__reactInternalSnapshotBeforeUpdate=S}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Z(163))}}catch(L){je(t,t.return,L)}if(e=t.sibling,e!==null){e.return=t.return,J=e;break}J=t.return}return E=R0,R0=!1,E}function qo(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&zc(t,n,o)}i=i.next}while(i!==r)}}function Au(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Kc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Dg(e){var t=e.alternate;t!==null&&(e.alternate=null,Dg(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Tn],delete t[ss],delete t[Tc],delete t[wE],delete t[vE])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function zg(e){return e.tag===5||e.tag===3||e.tag===4}function P0(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||zg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Vc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Pa));else if(r!==4&&(e=e.child,e!==null))for(Vc(e,t,n),e=e.sibling;e!==null;)Vc(e,t,n),e=e.sibling}function qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(qc(e,t,n),e=e.sibling;e!==null;)qc(e,t,n),e=e.sibling}var nt=null,mn=!1;function hr(e,t,n){for(n=n.child;n!==null;)Kg(e,t,n),n=n.sibling}function Kg(e,t,n){if(Nn&&typeof Nn.onCommitFiberUnmount=="function")try{Nn.onCommitFiberUnmount(vu,n)}catch{}switch(n.tag){case 5:gt||ji(n,t);case 6:var r=nt,i=mn;nt=null,hr(e,t,n),nt=r,mn=i,nt!==null&&(mn?(e=nt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):nt.removeChild(n.stateNode));break;case 18:nt!==null&&(mn?(e=nt,n=n.stateNode,e.nodeType===8?Sl(e.parentNode,n):e.nodeType===1&&Sl(e,n),ts(e)):Sl(nt,n.stateNode));break;case 4:r=nt,i=mn,nt=n.stateNode.containerInfo,mn=!0,hr(e,t,n),nt=r,mn=i;break;case 0:case 11:case 14:case 15:if(!gt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&zc(n,t,s),i=i.next}while(i!==r)}hr(e,t,n);break;case 1:if(!gt&&(ji(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){je(n,t,a)}hr(e,t,n);break;case 21:hr(e,t,n);break;case 22:n.mode&1?(gt=(r=gt)||n.memoizedState!==null,hr(e,t,n),gt=r):hr(e,t,n);break;default:hr(e,t,n)}}function $0(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new RE),t.forEach(function(r){var i=VE.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function pn(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=De()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ME(r/1960))-r,10e?16:e,Or===null)var r=!1;else{if(e=Or,Or=null,Za=0,xe&6)throw Error(Z(331));var i=xe;for(xe|=4,J=e.current;J!==null;){var o=J,s=o.child;if(J.flags&16){var a=o.deletions;if(a!==null){for(var u=0;uDe()-cd?ci(e,0):ld|=n),Mt(e,t)}function Xg(e,t){t===0&&(e.mode&1?(t=zs,zs<<=1,!(zs&130023424)&&(zs=4194304)):t=1);var n=kt();e=nr(e,t),e!==null&&(Es(e,t,n),Mt(e,n))}function KE(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Xg(e,n)}function VE(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Z(314))}r!==null&&r.delete(t),Xg(e,n)}var Jg;Jg=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Pt.current)Nt=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Nt=!1,LE(e,t,n);Nt=!!(e.flags&131072)}else Nt=!1,Re&&t.flags&1048576&&rg(t,Fa,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;ya(e,t),e=t.pendingProps;var i=eo(t,vt.current);Gi(t,n),i=rd(null,t,r,e,i,n);var o=id();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,$t(r)?(o=!0,Ma(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Xf(t),i.updater=Bu,t.stateNode=i,i._reactInternals=t,Pc(t,r,e,n),t=Hc(null,t,r,!0,o,n)):(t.tag=0,Re&&o&&Vf(t),Et(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(ya(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=WE(r),e=gn(r,e),i){case 0:t=Mc(null,t,r,e,n);break e;case 1:t=L0(null,t,r,e,n);break e;case 11:t=T0(null,t,r,e,n);break e;case 14:t=U0(null,t,r,gn(r.type,e),n);break e}throw Error(Z(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:gn(r,i),Mc(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:gn(r,i),L0(e,t,r,i,n);case 3:e:{if(Pg(t),e===null)throw Error(Z(387));r=t.pendingProps,o=t.memoizedState,i=o.element,lg(e,t),za(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=io(Error(Z(423)),t),t=O0(e,t,r,n,i);break e}else if(r!==i){i=io(Error(Z(424)),t),t=O0(e,t,r,n,i);break e}else for(Wt=Mr(t.stateNode.containerInfo.firstChild),Zt=t,Re=!0,vn=null,n=ag(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(to(),r===i){t=rr(e,t,n);break e}Et(e,t,r,n)}t=t.child}return t;case 5:return cg(t),e===null&&Oc(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,Cc(r,i)?s=null:o!==null&&Cc(r,o)&&(t.flags|=32),Rg(e,t),Et(e,t,s,n),t.child;case 6:return e===null&&Oc(t),null;case 13:return $g(e,t,n);case 4:return Jf(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=no(t,null,r,n):Et(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:gn(r,i),T0(e,t,r,i,n);case 7:return Et(e,t,t.pendingProps,n),t.child;case 8:return Et(e,t,t.pendingProps.children,n),t.child;case 12:return Et(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,s=i.value,Te(ja,r._currentValue),r._currentValue=s,o!==null)if(xn(o.value,s)){if(o.children===i.children&&!Pt.current){t=rr(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var a=o.dependencies;if(a!==null){s=o.child;for(var u=a.firstContext;u!==null;){if(u.context===r){if(o.tag===1){u=Yn(-1,n&-n),u.tag=2;var l=o.updateQueue;if(l!==null){l=l.shared;var f=l.pending;f===null?u.next=u:(u.next=f.next,f.next=u),l.pending=u}}o.lanes|=n,u=o.alternate,u!==null&&(u.lanes|=n),Nc(o.return,n,t),a.lanes|=n;break}u=u.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(Z(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Nc(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Et(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Gi(t,n),i=cn(i),r=r(i),t.flags|=1,Et(e,t,r,n),t.child;case 14:return r=t.type,i=gn(r,t.pendingProps),i=gn(r.type,i),U0(e,t,r,i,n);case 15:return Og(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:gn(r,i),ya(e,t),t.tag=1,$t(r)?(e=!0,Ma(t)):e=!1,Gi(t,n),Tg(t,r,i),Pc(t,r,i,n),Hc(null,t,r,!0,e,n);case 19:return Mg(e,t,n);case 22:return Ng(e,t,n)}throw Error(Z(156,t.tag))};function em(e,t){return Ay(e,t)}function qE(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function un(e,t,n,r){return new qE(e,t,n,r)}function pd(e){return e=e.prototype,!(!e||!e.isReactComponent)}function WE(e){if(typeof e=="function")return pd(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Of)return 11;if(e===Nf)return 14}return 2}function Dr(e,t){var n=e.alternate;return n===null?(n=un(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function wa(e,t,n,r,i,o){var s=2;if(r=e,typeof e=="function")pd(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Li:return fi(n.children,i,o,t);case Lf:s=8,i|=8;break;case sc:return e=un(12,n,t,i|2),e.elementType=sc,e.lanes=o,e;case ac:return e=un(13,n,t,i),e.elementType=ac,e.lanes=o,e;case uc:return e=un(19,n,t,i),e.elementType=uc,e.lanes=o,e;case cy:return Iu(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case uy:s=10;break e;case ly:s=9;break e;case Of:s=11;break e;case Nf:s=14;break e;case Ar:s=16,r=null;break e}throw Error(Z(130,e==null?e:typeof e,""))}return t=un(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function fi(e,t,n,r){return e=un(7,e,r,t),e.lanes=n,e}function Iu(e,t,n,r){return e=un(22,e,r,t),e.elementType=cy,e.lanes=n,e.stateNode={isHidden:!1},e}function Ul(e,t,n){return e=un(6,e,null,t),e.lanes=n,e}function Ll(e,t,n){return t=un(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function GE(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=dl(0),this.expirationTimes=dl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dl(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function yd(e,t,n,r,i,o,s,a,u){return e=new GE(e,t,n,a,u),t===1?(t=1,o===!0&&(t|=8)):t=0,o=un(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xf(o),e}function ZE(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(im)}catch(e){console.error(e)}}im(),iy.exports=Yt;var ex=iy.exports,V0=ex;ic.createRoot=V0.createRoot,ic.hydrateRoot=V0.hydrateRoot;St.createContext(void 0);var Yc=function(e,t){return Yc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},Yc(e,t)};function ur(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Yc(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function tx(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(f){try{l(r.next(f))}catch(c){s(c)}}function u(f){try{l(r.throw(f))}catch(c){s(c)}}function l(f){f.done?o(f.value):i(f.value).then(a,u)}l((r=r.apply(e,t||[])).next())})}function om(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(f){return u([l,f])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,i=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ir(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(a){s={error:a}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function or(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r1||u(y,w)})},E&&(i[y]=E(i[y])))}function u(y,E){try{l(r[y](E))}catch(w){p(o[0][3],w)}}function l(y){y.value instanceof Qi?Promise.resolve(y.value.v).then(f,c):p(o[0][2],y)}function f(y){u("next",y)}function c(y){u("throw",y)}function p(y,E){y(E),o.shift(),o.length&&u(o[0][0],o[0][1])}}function rx(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof so=="function"?so(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(s){return new Promise(function(a,u){s=e[o](s),i(a,u,s.done,s.value)})}}function i(o,s,a,u){Promise.resolve(u).then(function(l){o({value:l,done:a})},s)}}function Ke(e){return typeof e=="function"}function sm(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var Ol=sm(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription: -`+n.map(function(r,i){return i+1+") "+r.toString()}).join(` - `):"",this.name="UnsubscriptionError",this.errors=n}});function Xa(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var _s=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=so(s),u=a.next();!u.done;u=a.next()){var l=u.value;l.remove(this)}}catch(w){t={error:w}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}else s.remove(this);var f=this.initialTeardown;if(Ke(f))try{f()}catch(w){o=w instanceof Ol?w.errors:[w]}var c=this._finalizers;if(c){this._finalizers=null;try{for(var p=so(c),y=p.next();!y.done;y=p.next()){var E=y.value;try{q0(E)}catch(w){o=o??[],w instanceof Ol?o=or(or([],ir(o)),ir(w.errors)):o.push(w)}}}catch(w){r={error:w}}finally{try{y&&!y.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}}if(o)throw new Ol(o)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)q0(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&Xa(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&Xa(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),am=_s.EMPTY;function um(e){return e instanceof _s||e&&"closed"in e&&Ke(e.remove)&&Ke(e.add)&&Ke(e.unsubscribe)}function q0(e){Ke(e)?e():e.unsubscribe()}var ix={Promise:void 0},ox={setTimeout:function(e,t){for(var n=[],r=2;r0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(n){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,n)},t.prototype._subscribe=function(n){return this._throwIfClosed(),this._checkFinalizedStatuses(n),this._innerSubscribe(n)},t.prototype._innerSubscribe=function(n){var r=this,i=this,o=i.hasError,s=i.isStopped,a=i.observers;return o||s?am:(this.currentObservers=null,a.push(n),new _s(function(){r.currentObservers=null,Xa(a,n)}))},t.prototype._checkFinalizedStatuses=function(n){var r=this,i=r.hasError,o=r.thrownError,s=r.isStopped;i?n.error(o):s&&n.complete()},t.prototype.asObservable=function(){var n=new bt;return n.source=this,n},t.create=function(n,r){return new G0(n,r)},t}(bt),G0=function(e){ur(t,e);function t(n,r){var i=e.call(this)||this;return i.destination=n,i.source=r,i}return t.prototype.next=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.next)===null||i===void 0||i.call(r,n)},t.prototype.error=function(n){var r,i;(i=(r=this.destination)===null||r===void 0?void 0:r.error)===null||i===void 0||i.call(r,n)},t.prototype.complete=function(){var n,r;(r=(n=this.destination)===null||n===void 0?void 0:n.complete)===null||r===void 0||r.call(n)},t.prototype._subscribe=function(n){var r,i;return(i=(r=this.source)===null||r===void 0?void 0:r.subscribe(n))!==null&&i!==void 0?i:am},t}(Yi),Ed={now:function(){return(Ed.delegate||Date).now()},delegate:void 0},yx=function(e){ur(t,e);function t(n,r,i){n===void 0&&(n=1/0),r===void 0&&(r=1/0),i===void 0&&(i=Ed);var o=e.call(this)||this;return o._bufferSize=n,o._windowTime=r,o._timestampProvider=i,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=r===1/0,o._bufferSize=Math.max(1,n),o._windowTime=Math.max(1,r),o}return t.prototype.next=function(n){var r=this,i=r.isStopped,o=r._buffer,s=r._infiniteTimeWindow,a=r._timestampProvider,u=r._windowTime;i||(o.push(n),!s&&o.push(a.now()+u)),this._trimBuffer(),e.prototype.next.call(this,n)},t.prototype._subscribe=function(n){this._throwIfClosed(),this._trimBuffer();for(var r=this._innerSubscribe(n),i=this,o=i._infiniteTimeWindow,s=i._buffer,a=s.slice(),u=0;u=2,!0))}function r3(e){e===void 0&&(e={});var t=e.connector,n=t===void 0?function(){return new Yi}:t,r=e.resetOnError,i=r===void 0?!0:r,o=e.resetOnComplete,s=o===void 0?!0:o,a=e.resetOnRefCountZero,u=a===void 0?!0:a;return function(l){var f,c,p,y=0,E=!1,w=!1,A=function(){c==null||c.unsubscribe(),c=void 0},v=function(){A(),f=p=void 0,E=w=!1},S=function(){var x=f;v(),x==null||x.unsubscribe()};return Ft(function(x,L){y++,!w&&!E&&A();var N=p=p??n();L.add(function(){y--,y===0&&!w&&!E&&(c=Nl(S,u))}),N.subscribe(L),!f&&y>0&&(f=new hs({next:function(R){return N.next(R)},error:function(R){w=!0,A(),c=Nl(v,i,R),N.error(R)},complete:function(){E=!0,A(),c=Nl(v,s),N.complete()}}),Mn(x).subscribe(f))})(l)}}function Nl(e,t){for(var n=[],r=2;r0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function o3(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ep(e.outputLen),ep(e.blockLen)}function Ja(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function s3(e,t){Bm(e);const n=t.outputLen;if(e.lengthe instanceof Uint8Array,Pl=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Bn=(e,t)=>e<<32-t|e>>>t,a3=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!a3)throw new Error("Non little-endian hardware is not supported");function u3(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Ad(e){if(typeof e=="string"&&(e=u3(e)),!Am(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}function l3(...e){const t=new Uint8Array(e.reduce((r,i)=>r+i.length,0));let n=0;return e.forEach(r=>{if(!Am(r))throw new Error("Uint8Array expected");t.set(r,n),n+=r.length}),t}let Cm=class{clone(){return this._cloneInto()}};function c3(e){const t=r=>e().update(Ad(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Im(e=32){if(Rl&&typeof Rl.getRandomValues=="function")return Rl.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function f3(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),u=r?4:0,l=r?0:4;e.setUint32(t+u,s,r),e.setUint32(t+l,a,r)}let d3=class extends Cm{constructor(t,n,r,i){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Pl(this.buffer)}update(t){Ja(this);const{view:n,buffer:r,blockLen:i}=this;t=Ad(t);const o=t.length;for(let s=0;si-s&&(this.process(r,0),s=0);for(let c=s;cf.length)throw new Error("_sha2: outputLen bigger than state");for(let c=0;ce&t^~e&n,p3=(e,t,n)=>e&t^e&n^t&n,y3=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),pr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),yr=new Uint32Array(64);let g3=class extends d3{constructor(){super(64,32,8,!1),this.A=pr[0]|0,this.B=pr[1]|0,this.C=pr[2]|0,this.D=pr[3]|0,this.E=pr[4]|0,this.F=pr[5]|0,this.G=pr[6]|0,this.H=pr[7]|0}get(){const{A:t,B:n,C:r,D:i,E:o,F:s,G:a,H:u}=this;return[t,n,r,i,o,s,a,u]}set(t,n,r,i,o,s,a,u){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=u|0}process(t,n){for(let c=0;c<16;c++,n+=4)yr[c]=t.getUint32(n,!1);for(let c=16;c<64;c++){const p=yr[c-15],y=yr[c-2],E=Bn(p,7)^Bn(p,18)^p>>>3,w=Bn(y,17)^Bn(y,19)^y>>>10;yr[c]=w+yr[c-7]+E+yr[c-16]|0}let{A:r,B:i,C:o,D:s,E:a,F:u,G:l,H:f}=this;for(let c=0;c<64;c++){const p=Bn(a,6)^Bn(a,11)^Bn(a,25),y=f+p+h3(a,u,l)+y3[c]+yr[c]|0,w=(Bn(r,2)^Bn(r,13)^Bn(r,22))+p3(r,i,o)|0;f=l,l=u,u=a,a=s+y|0,s=o,o=i,i=r,r=y+w|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,f=f+this.H|0,this.set(r,i,o,s,a,u,l,f)}roundClean(){yr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const Jc=c3(()=>new g3);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Tm=BigInt(0),Mu=BigInt(1),m3=BigInt(2),Hu=e=>e instanceof Uint8Array,w3=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ao(e){if(!Hu(e))throw new Error("Uint8Array expected");let t="";for(let n=0;nr+i.length,0));let n=0;return e.forEach(r=>{if(!Hu(r))throw new Error("Uint8Array expected");t.set(r,n),n+=r.length}),t}function b3(e,t){if(e.length!==t.length)return!1;for(let n=0;nTm;e>>=Mu,t+=1);return t}function S3(e,t){return e>>BigInt(t)&Mu}const k3=(e,t,n)=>e|(n?Mu:Tm)<(m3<new Uint8Array(e),tp=e=>Uint8Array.from(e);function Lm(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=$l(e),i=$l(e),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},a=(...c)=>n(i,r,...c),u=(c=$l())=>{i=a(tp([0]),c),r=a(),c.length!==0&&(i=a(tp([1]),c),r=a())},l=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let c=0;const p=[];for(;c{s(),u(c);let y;for(;!(y=p(l()));)u();return s(),y}}const _3={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function As(e,t,n={}){const r=(i,o,s)=>{const a=_3[o];if(typeof a!="function")throw new Error(`Invalid validator "${o}", expected function`);const u=e[i];if(!(s&&u===void 0)&&!a(u,e))throw new Error(`Invalid param ${String(i)}=${u} (${typeof u}), expected ${o}`)};for(const[i,o]of Object.entries(t))r(i,o,!1);for(const[i,o]of Object.entries(n))r(i,o,!0);return e}const B3=Object.freeze(Object.defineProperty({__proto__:null,bitGet:S3,bitLen:x3,bitMask:Ud,bitSet:k3,bytesToHex:ao,bytesToNumberBE:Ht,bytesToNumberLE:Id,concatBytes:vi,createHmacDrbg:Lm,ensureBytes:pt,equalBytes:b3,hexToBytes:uo,hexToNumber:Cd,numberToBytesBE:Wr,numberToBytesLE:Td,numberToHexUnpadded:Um,numberToVarBytesBE:v3,utf8ToBytes:E3,validateObject:As},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Xe=BigInt(0),ze=BigInt(1),ri=BigInt(2),A3=BigInt(3),ef=BigInt(4),np=BigInt(5),rp=BigInt(8);BigInt(9);BigInt(16);function rt(e,t){const n=e%t;return n>=Xe?n:t+n}function C3(e,t,n){if(n<=Xe||t 0");if(n===ze)return Xe;let r=ze;for(;t>Xe;)t&ze&&(r=r*e%n),e=e*e%n,t>>=ze;return r}function en(e,t,n){let r=e;for(;t-- >Xe;)r*=r,r%=n;return r}function tf(e,t){if(e===Xe||t<=Xe)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=rt(e,t),r=t,i=Xe,o=ze;for(;n!==Xe;){const a=r/n,u=r%n,l=i-o*a;r=n,n=u,i=o,o=l}if(r!==ze)throw new Error("invert: does not exist");return rt(i,t)}function I3(e){const t=(e-ze)/ri;let n,r,i;for(n=e-ze,r=0;n%ri===Xe;n/=ri,r++);for(i=ri;i(r[i]="function",r),t);return As(e,n)}function O3(e,t,n){if(n 0");if(n===Xe)return e.ONE;if(n===ze)return t;let r=e.ONE,i=t;for(;n>Xe;)n&ze&&(r=e.mul(r,i)),i=e.sqr(i),n>>=ze;return r}function N3(e,t){const n=new Array(t.length),r=t.reduce((o,s,a)=>e.is0(s)?o:(n[a]=o,e.mul(o,s)),e.ONE),i=e.inv(r);return t.reduceRight((o,s,a)=>e.is0(s)?o:(n[a]=e.mul(o,n[a]),e.mul(o,s)),i),n}function Om(e,t){const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function R3(e,t,n=!1,r={}){if(e<=Xe)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:o}=Om(e,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=T3(e),a=Object.freeze({ORDER:e,BITS:i,BYTES:o,MASK:Ud(i),ZERO:Xe,ONE:ze,create:u=>rt(u,e),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return Xe<=u&&uu===Xe,isOdd:u=>(u&ze)===ze,neg:u=>rt(-u,e),eql:(u,l)=>u===l,sqr:u=>rt(u*u,e),add:(u,l)=>rt(u+l,e),sub:(u,l)=>rt(u-l,e),mul:(u,l)=>rt(u*l,e),pow:(u,l)=>O3(a,u,l),div:(u,l)=>rt(u*tf(l,e),e),sqrN:u=>u*u,addN:(u,l)=>u+l,subN:(u,l)=>u-l,mulN:(u,l)=>u*l,inv:u=>tf(u,e),sqrt:r.sqrt||(u=>s(a,u)),invertBatch:u=>N3(a,u),cmov:(u,l,f)=>f?l:u,toBytes:u=>n?Td(u,o):Wr(u,o),fromBytes:u=>{if(u.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${u.length}`);return n?Id(u):Ht(u)}});return Object.freeze(a)}function Nm(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function Rm(e){const t=Nm(e);return t+Math.ceil(t/2)}function P3(e,t,n=!1){const r=e.length,i=Nm(t),o=Rm(t);if(r<16||r1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const s=n?Ht(e):Id(e),a=rt(s,t-ze)+ze;return n?Td(a,i):Wr(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const $3=BigInt(0),Ml=BigInt(1);function M3(e,t){const n=(i,o)=>{const s=o.negate();return i?s:o},r=i=>{const o=Math.ceil(t/i)+1,s=2**(i-1);return{windows:o,windowSize:s}};return{constTimeNegate:n,unsafeLadder(i,o){let s=e.ZERO,a=i;for(;o>$3;)o&Ml&&(s=s.add(a)),a=a.double(),o>>=Ml;return s},precomputeWindow(i,o){const{windows:s,windowSize:a}=r(o),u=[];let l=i,f=l;for(let c=0;c>=y,A>u&&(A-=p,s+=Ml);const v=w,S=w+Math.abs(A)-1,x=E%2!==0,L=A<0;A===0?f=f.add(n(x,o[v])):l=l.add(n(L,o[S]))}return{p:l,f}},wNAFCached(i,o,s,a){const u=i._WINDOW_SIZE||1;let l=o.get(i);return l||(l=this.precomputeWindow(i,u),u!==1&&o.set(i,a(l))),this.wNAF(u,l,s)}}}function Pm(e){return L3(e.Fp),As(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Om(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function H3(e){const t=Pm(e);As(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=t;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:F3,hexToBytes:j3}=B3,ai={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(e){const{Err:t}=ai;if(e.length<2||e[0]!==2)throw new t("Invalid signature integer tag");const n=e[1],r=e.subarray(2,n+2);if(!n||r.length!==n)throw new t("Invalid signature integer: wrong length");if(r[0]&128)throw new t("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:F3(r),l:e.subarray(n+2)}},toSig(e){const{Err:t}=ai,n=typeof e=="string"?j3(e):e;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||n[0]!=48)throw new t("Invalid signature tag");if(n[1]!==r-2)throw new t("Invalid signature: incorrect length");const{d:i,l:o}=ai._parseInt(n.subarray(2)),{d:s,l:a}=ai._parseInt(o);if(a.length)throw new t("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(e){const t=l=>Number.parseInt(l[0],16)&8?"00"+l:l,n=l=>{const f=l.toString(16);return f.length&1?`0${f}`:f},r=t(n(e.s)),i=t(n(e.r)),o=r.length/2,s=i.length/2,a=n(o),u=n(s);return`30${n(s+o+4)}02${u}${i}02${a}${r}`}},Vn=BigInt(0),on=BigInt(1);BigInt(2);const ip=BigInt(3);BigInt(4);function D3(e){const t=H3(e),{Fp:n}=t,r=t.toBytes||((E,w,A)=>{const v=w.toAffine();return vi(Uint8Array.from([4]),n.toBytes(v.x),n.toBytes(v.y))}),i=t.fromBytes||(E=>{const w=E.subarray(1),A=n.fromBytes(w.subarray(0,n.BYTES)),v=n.fromBytes(w.subarray(n.BYTES,2*n.BYTES));return{x:A,y:v}});function o(E){const{a:w,b:A}=t,v=n.sqr(E),S=n.mul(v,E);return n.add(n.add(S,n.mul(E,w)),A)}if(!n.eql(n.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function s(E){return typeof E=="bigint"&&Vnn.eql(x,n.ZERO);return S(A)&&S(v)?c.ZERO:new c(A,v,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(w){const A=n.invertBatch(w.map(v=>v.pz));return w.map((v,S)=>v.toAffine(A[S])).map(c.fromAffine)}static fromHex(w){const A=c.fromAffine(i(pt("pointHex",w)));return A.assertValidity(),A}static fromPrivateKey(w){return c.BASE.multiply(u(w))}_setWindowSize(w){this._WINDOW_SIZE=w,l.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:w,y:A}=this.toAffine();if(!n.isValid(w)||!n.isValid(A))throw new Error("bad point: x or y not FE");const v=n.sqr(A),S=o(w);if(!n.eql(v,S))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:w}=this.toAffine();if(n.isOdd)return!n.isOdd(w);throw new Error("Field doesn't support isOdd")}equals(w){f(w);const{px:A,py:v,pz:S}=this,{px:x,py:L,pz:N}=w,R=n.eql(n.mul(A,N),n.mul(x,S)),H=n.eql(n.mul(v,N),n.mul(L,S));return R&&H}negate(){return new c(this.px,n.neg(this.py),this.pz)}double(){const{a:w,b:A}=t,v=n.mul(A,ip),{px:S,py:x,pz:L}=this;let N=n.ZERO,R=n.ZERO,H=n.ZERO,F=n.mul(S,S),q=n.mul(x,x),K=n.mul(L,L),P=n.mul(S,x);return P=n.add(P,P),H=n.mul(S,L),H=n.add(H,H),N=n.mul(w,H),R=n.mul(v,K),R=n.add(N,R),N=n.sub(q,R),R=n.add(q,R),R=n.mul(N,R),N=n.mul(P,N),H=n.mul(v,H),K=n.mul(w,K),P=n.sub(F,K),P=n.mul(w,P),P=n.add(P,H),H=n.add(F,F),F=n.add(H,F),F=n.add(F,K),F=n.mul(F,P),R=n.add(R,F),K=n.mul(x,L),K=n.add(K,K),F=n.mul(K,P),N=n.sub(N,F),H=n.mul(K,q),H=n.add(H,H),H=n.add(H,H),new c(N,R,H)}add(w){f(w);const{px:A,py:v,pz:S}=this,{px:x,py:L,pz:N}=w;let R=n.ZERO,H=n.ZERO,F=n.ZERO;const q=t.a,K=n.mul(t.b,ip);let P=n.mul(A,x),D=n.mul(v,L),M=n.mul(S,N),z=n.add(A,v),b=n.add(x,L);z=n.mul(z,b),b=n.add(P,D),z=n.sub(z,b),b=n.add(A,S);let C=n.add(x,N);return b=n.mul(b,C),C=n.add(P,M),b=n.sub(b,C),C=n.add(v,S),R=n.add(L,N),C=n.mul(C,R),R=n.add(D,M),C=n.sub(C,R),F=n.mul(q,b),R=n.mul(K,M),F=n.add(R,F),R=n.sub(D,F),F=n.add(D,F),H=n.mul(R,F),D=n.add(P,P),D=n.add(D,P),M=n.mul(q,M),b=n.mul(K,b),D=n.add(D,M),M=n.sub(P,M),M=n.mul(q,M),b=n.add(b,M),P=n.mul(D,b),H=n.add(H,P),P=n.mul(C,b),R=n.mul(z,R),R=n.sub(R,P),P=n.mul(z,D),F=n.mul(C,F),F=n.add(F,P),new c(R,H,F)}subtract(w){return this.add(w.negate())}is0(){return this.equals(c.ZERO)}wNAF(w){return y.wNAFCached(this,l,w,A=>{const v=n.invertBatch(A.map(S=>S.pz));return A.map((S,x)=>S.toAffine(v[x])).map(c.fromAffine)})}multiplyUnsafe(w){const A=c.ZERO;if(w===Vn)return A;if(a(w),w===on)return this;const{endo:v}=t;if(!v)return y.unsafeLadder(this,w);let{k1neg:S,k1:x,k2neg:L,k2:N}=v.splitScalar(w),R=A,H=A,F=this;for(;x>Vn||N>Vn;)x&on&&(R=R.add(F)),N&on&&(H=H.add(F)),F=F.double(),x>>=on,N>>=on;return S&&(R=R.negate()),L&&(H=H.negate()),H=new c(n.mul(H.px,v.beta),H.py,H.pz),R.add(H)}multiply(w){a(w);let A=w,v,S;const{endo:x}=t;if(x){const{k1neg:L,k1:N,k2neg:R,k2:H}=x.splitScalar(A);let{p:F,f:q}=this.wNAF(N),{p:K,f:P}=this.wNAF(H);F=y.constTimeNegate(L,F),K=y.constTimeNegate(R,K),K=new c(n.mul(K.px,x.beta),K.py,K.pz),v=F.add(K),S=q.add(P)}else{const{p:L,f:N}=this.wNAF(A);v=L,S=N}return c.normalizeZ([v,S])[0]}multiplyAndAddUnsafe(w,A,v){const S=c.BASE,x=(N,R)=>R===Vn||R===on||!N.equals(S)?N.multiplyUnsafe(R):N.multiply(R),L=x(this,A).add(x(w,v));return L.is0()?void 0:L}toAffine(w){const{px:A,py:v,pz:S}=this,x=this.is0();w==null&&(w=x?n.ONE:n.inv(S));const L=n.mul(A,w),N=n.mul(v,w),R=n.mul(S,w);if(x)return{x:n.ZERO,y:n.ZERO};if(!n.eql(R,n.ONE))throw new Error("invZ was invalid");return{x:L,y:N}}isTorsionFree(){const{h:w,isTorsionFree:A}=t;if(w===on)return!0;if(A)return A(c,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:w,clearCofactor:A}=t;return w===on?this:A?A(c,this):this.multiplyUnsafe(t.h)}toRawBytes(w=!0){return this.assertValidity(),r(c,this,w)}toHex(w=!0){return ao(this.toRawBytes(w))}}c.BASE=new c(t.Gx,t.Gy,n.ONE),c.ZERO=new c(n.ZERO,n.ONE,n.ZERO);const p=t.nBitLength,y=M3(c,t.endo?Math.ceil(p/2):p);return{CURVE:t,ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:s}}function z3(e){const t=Pm(e);return As(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function K3(e){const t=z3(e),{Fp:n,n:r}=t,i=n.BYTES+1,o=2*n.BYTES+1;function s(b){return Vnao(Wr(b,t.nByteLength));function E(b){const C=r>>on;return b>C}function w(b){return E(b)?a(-b):b}const A=(b,C,B)=>Ht(b.slice(C,B));class v{constructor(C,B,m){this.r=C,this.s=B,this.recovery=m,this.assertValidity()}static fromCompact(C){const B=t.nByteLength;return C=pt("compactSignature",C,B*2),new v(A(C,0,B),A(C,B,2*B))}static fromDER(C){const{r:B,s:m}=ai.toSig(pt("DER",C));return new v(B,m)}assertValidity(){if(!p(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!p(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(C){return new v(this.r,this.s,C)}recoverPublicKey(C){const{r:B,s:m,recovery:k}=this,U=H(pt("msgHash",C));if(k==null||![0,1,2,3].includes(k))throw new Error("recovery id invalid");const T=k===2||k===3?B+t.n:B;if(T>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const $=k&1?"03":"02",V=l.fromHex($+y(T)),Y=u(T),X=a(-U*Y),ie=a(m*Y),ue=l.BASE.multiplyAndAddUnsafe(V,X,ie);if(!ue)throw new Error("point at infinify");return ue.assertValidity(),ue}hasHighS(){return E(this.s)}normalizeS(){return this.hasHighS()?new v(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return uo(this.toDERHex())}toDERHex(){return ai.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return uo(this.toCompactHex())}toCompactHex(){return y(this.r)+y(this.s)}}const S={isValidPrivateKey(b){try{return f(b),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const b=Rm(t.n);return P3(t.randomBytes(b),t.n)},precompute(b=8,C=l.BASE){return C._setWindowSize(b),C.multiply(BigInt(3)),C}};function x(b,C=!0){return l.fromPrivateKey(b).toRawBytes(C)}function L(b){const C=b instanceof Uint8Array,B=typeof b=="string",m=(C||B)&&b.length;return C?m===i||m===o:B?m===2*i||m===2*o:b instanceof l}function N(b,C,B=!0){if(L(b))throw new Error("first arg must be private key");if(!L(C))throw new Error("second arg must be public key");return l.fromHex(C).multiply(f(b)).toRawBytes(B)}const R=t.bits2int||function(b){const C=Ht(b),B=b.length*8-t.nBitLength;return B>0?C>>BigInt(B):C},H=t.bits2int_modN||function(b){return a(R(b))},F=Ud(t.nBitLength);function q(b){if(typeof b!="bigint")throw new Error("bigint expected");if(!(Vn<=b&&bre in B))throw new Error("sign() legacy options not supported");const{hash:m,randomBytes:k}=t;let{lowS:U,prehash:T,extraEntropy:$}=B;U==null&&(U=!0),b=pt("msgHash",b),T&&(b=pt("prehashed msgHash",m(b)));const V=H(b),Y=f(C),X=[q(Y),q(V)];if($!=null){const re=$===!0?k(n.BYTES):$;X.push(pt("extraEntropy",re))}const ie=vi(...X),ue=V;function ee(re){const se=R(re);if(!p(se))return;const we=u(se),de=l.BASE.multiply(se).toAffine(),pe=a(de.x);if(pe===Vn)return;const le=a(we*a(ue+pe*Y));if(le===Vn)return;let _e=(de.x===pe?0:2)|Number(de.y&on),et=le;return U&&E(le)&&(et=w(le),_e^=1),new v(pe,et,_e)}return{seed:ie,k2sig:ee}}const P={lowS:t.lowS,prehash:!1},D={lowS:t.lowS,prehash:!1};function M(b,C,B=P){const{seed:m,k2sig:k}=K(b,C,B),U=t;return Lm(U.hash.outputLen,U.nByteLength,U.hmac)(m,k)}l.BASE._setWindowSize(8);function z(b,C,B,m=D){var de;const k=b;if(C=pt("msgHash",C),B=pt("publicKey",B),"strict"in m)throw new Error("options.strict was renamed to lowS");const{lowS:U,prehash:T}=m;let $,V;try{if(typeof k=="string"||k instanceof Uint8Array)try{$=v.fromDER(k)}catch(pe){if(!(pe instanceof ai.Err))throw pe;$=v.fromCompact(k)}else if(typeof k=="object"&&typeof k.r=="bigint"&&typeof k.s=="bigint"){const{r:pe,s:le}=k;$=new v(pe,le)}else throw new Error("PARSE");V=l.fromHex(B)}catch(pe){if(pe.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(U&&$.hasHighS())return!1;T&&(C=t.hash(C));const{r:Y,s:X}=$,ie=H(C),ue=u(X),ee=a(ie*ue),re=a(Y*ue),se=(de=l.BASE.multiplyAndAddUnsafe(V,ee,re))==null?void 0:de.toAffine();return se?a(se.x)===Y:!1}return{CURVE:t,getPublicKey:x,getSharedSecret:N,sign:M,verify:z,ProjectivePoint:l,Signature:v,utils:S}}let $m=class extends Cm{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,o3(t);const r=Ad(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,o=new Uint8Array(i);o.set(r.length>i?t.create().update(r).digest():r);for(let s=0;snew $m(e,t).update(n).digest();Mm.create=(e,t)=>new $m(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function V3(e){return{hash:e,hmac:(t,...n)=>Mm(e,t,l3(...n)),randomBytes:Im}}function q3(e,t){const n=r=>K3({...e,...V3(r)});return Object.freeze({...n(t),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Fu=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),eu=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Hm=BigInt(1),tu=BigInt(2),op=(e,t)=>(e+t/tu)/t;function Fm(e){const t=Fu,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),l=e*e*e%t,f=l*l*e%t,c=en(f,n,t)*f%t,p=en(c,n,t)*f%t,y=en(p,tu,t)*l%t,E=en(y,i,t)*y%t,w=en(E,o,t)*E%t,A=en(w,a,t)*w%t,v=en(A,u,t)*A%t,S=en(v,a,t)*w%t,x=en(S,n,t)*f%t,L=en(x,s,t)*E%t,N=en(L,r,t)*l%t,R=en(N,tu,t);if(!nf.eql(nf.sqr(R),e))throw new Error("Cannot find square root");return R}const nf=R3(Fu,void 0,void 0,{sqrt:Fm}),mo=q3({a:BigInt(0),b:BigInt(7),Fp:nf,n:eu,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=eu,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Hm*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=op(o*e,t),u=op(-r*e,t);let l=rt(e-a*n-u*i,t),f=rt(-a*r-u*o,t);const c=l>s,p=f>s;if(c&&(l=t-l),p&&(f=t-f),l>s||f>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:c,k1:l,k2neg:p,k2:f}}}},Jc),ju=BigInt(0),jm=e=>typeof e=="bigint"&&jutypeof e=="bigint"&&jui.charCodeAt(0)));n=vi(r,r),sp[e]=n}return Jc(vi(n,...t))}const Ld=e=>e.toRawBytes(!0).slice(1),rf=e=>Wr(e,32),Hl=e=>rt(e,Fu),ps=e=>rt(e,eu),Od=mo.ProjectivePoint,G3=(e,t,n)=>Od.BASE.multiplyAndAddUnsafe(e,t,n);function of(e){let t=mo.utils.normPrivateKeyToScalar(e),n=Od.fromPrivateKey(t);return{scalar:n.hasEvenY()?t:ps(-t),bytes:Ld(n)}}function Dm(e){if(!jm(e))throw new Error("bad x: need 0 < x < p");const t=Hl(e*e),n=Hl(t*e+BigInt(7));let r=Fm(n);r%tu!==ju&&(r=Hl(-r));const i=new Od(e,r,Hm);return i.assertValidity(),i}function zm(...e){return ps(Ht(nu("BIP0340/challenge",...e)))}function Z3(e){return of(e).bytes}function Q3(e,t,n=Im(32)){const r=pt("message",e),{bytes:i,scalar:o}=of(t),s=pt("auxRand",n,32),a=rf(o^Ht(nu("BIP0340/aux",s))),u=nu("BIP0340/nonce",a,i,r),l=ps(Ht(u));if(l===ju)throw new Error("sign failed: k is zero");const{bytes:f,scalar:c}=of(l),p=zm(f,i,r),y=new Uint8Array(64);if(y.set(f,0),y.set(rf(ps(c+p*o)),32),!Km(y,r,i))throw new Error("sign: Invalid signature produced");return y}function Km(e,t,n){const r=pt("signature",e,64),i=pt("message",t),o=pt("publicKey",n,32);try{const s=Dm(Ht(o)),a=Ht(r.subarray(0,32));if(!jm(a))return!1;const u=Ht(r.subarray(32,64));if(!W3(u))return!1;const l=zm(rf(a),Ld(s),i),f=G3(s,u,ps(-l));return!(!f||!f.hasEvenY()||f.toAffine().x!==a)}catch{return!1}}const Uo={getPublicKey:Z3,sign:Q3,verify:Km,utils:{randomPrivateKey:mo.utils.randomPrivateKey,lift_x:Dm,pointToBytes:Ld,numberToBytesBE:Wr,bytesToNumberBE:Ht,taggedHash:nu,mod:rt}},Fl=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Nd=e=>e instanceof Uint8Array,jl=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),An=(e,t)=>e<<32-t|e>>>t,Y3=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Y3)throw new Error("Non little-endian hardware is not supported");const X3=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function yt(e){if(!Nd(e))throw new Error("Uint8Array expected");let t="";for(let n=0;nr+i.length,0));let n=0;return e.forEach(r=>{if(!Nd(r))throw new Error("Uint8Array expected");t.set(r,n),n+=r.length}),t}let Vm=class{clone(){return this._cloneInto()}};function qm(e){const t=r=>e().update(ys(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Wm(e=32){if(Fl&&typeof Fl.getRandomValues=="function")return Fl.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function sf(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function eS(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}function Gm(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function tS(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");sf(e.outputLen),sf(e.blockLen)}function nS(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function rS(e,t){Gm(e);const n=t.outputLen;if(e.length>i&o),a=Number(n&o),u=r?4:0,l=r?0:4;e.setUint32(t+u,s,r),e.setUint32(t+l,a,r)}class oS extends Vm{constructor(t,n,r,i){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=jl(this.buffer)}update(t){Ln.exists(this);const{view:n,buffer:r,blockLen:i}=this;t=ys(t);const o=t.length;for(let s=0;si-s&&(this.process(r,0),s=0);for(let c=s;cf.length)throw new Error("_sha2: outputLen bigger than state");for(let c=0;ce&t^~e&n,aS=(e,t,n)=>e&t^e&n^t&n,uS=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),gr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),mr=new Uint32Array(64);let Zm=class extends oS{constructor(){super(64,32,8,!1),this.A=gr[0]|0,this.B=gr[1]|0,this.C=gr[2]|0,this.D=gr[3]|0,this.E=gr[4]|0,this.F=gr[5]|0,this.G=gr[6]|0,this.H=gr[7]|0}get(){const{A:t,B:n,C:r,D:i,E:o,F:s,G:a,H:u}=this;return[t,n,r,i,o,s,a,u]}set(t,n,r,i,o,s,a,u){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=u|0}process(t,n){for(let c=0;c<16;c++,n+=4)mr[c]=t.getUint32(n,!1);for(let c=16;c<64;c++){const p=mr[c-15],y=mr[c-2],E=An(p,7)^An(p,18)^p>>>3,w=An(y,17)^An(y,19)^y>>>10;mr[c]=w+mr[c-7]+E+mr[c-16]|0}let{A:r,B:i,C:o,D:s,E:a,F:u,G:l,H:f}=this;for(let c=0;c<64;c++){const p=An(a,6)^An(a,11)^An(a,25),y=f+p+sS(a,u,l)+uS[c]+mr[c]|0,w=(An(r,2)^An(r,13)^An(r,22))+aS(r,i,o)|0;f=l,l=u,u=a,a=s+y|0,s=o,o=i,i=r,r=y+w|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,f=f+this.H|0,this.set(r,i,o,s,a,u,l,f)}roundClean(){mr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},lS=class extends Zm{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}};const wo=qm(()=>new Zm);qm(()=>new lS);/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function vo(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function cr(...e){const t=(i,o)=>s=>i(o(s)),n=Array.from(e).reverse().reduce((i,o)=>i?t(i,o.encode):o.encode,void 0),r=e.reduce((i,o)=>i?t(i,o.decode):o.decode,void 0);return{encode:n,decode:r}}function fr(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(n=>{if(vo(n),n<0||n>=e.length)throw new Error(`Digit index outside alphabet: ${n} (alphabet: ${e.length})`);return e[n]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(n=>{if(typeof n!="string")throw new Error(`alphabet.decode: not string element=${n}`);const r=e.indexOf(n);if(r===-1)throw new Error(`Unknown letter: "${n}". Allowed: ${e}`);return r})}}}function dr(e=""){if(typeof e!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let n of t)if(typeof n!="string")throw new Error(`join.encode: non-string input=${n}`);return t.join(e)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(e)}}}function zu(e,t="="){if(vo(e),typeof t!="string")throw new Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&typeof n[0]!="string")throw new Error("padding.encode input should be array of strings");for(let r of n)if(typeof r!="string")throw new Error(`padding.encode: non-string input=${r}`);for(;n.length*e%8;)n.push(t);return n},decode(n){if(!Array.isArray(n)||n.length&&typeof n[0]!="string")throw new Error("padding.encode input should be array of strings");for(let i of n)if(typeof i!="string")throw new Error(`padding.decode: non-string input=${i}`);let r=n.length;if(r*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--)if(!((r-1)*e%8))throw new Error("Invalid padding: string has too much padding");return n.slice(0,r)}}}function Qm(e){if(typeof e!="function")throw new Error("normalize fn should be function");return{encode:t=>t,decode:t=>e(t)}}function ap(e,t,n){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: wrong to=${n}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let r=0;const i=[],o=Array.from(e);for(o.forEach(s=>{if(vo(s),s<0||s>=t)throw new Error(`Wrong integer: ${s}`)});;){let s=0,a=!0;for(let u=r;ut?Ym(t,e%t):e,ru=(e,t)=>e+(t-Ym(e,t));function af(e,t,n,r){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(ru(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${ru(t,n)}`);let i=0,o=0;const s=2**n-1,a=[];for(const u of e){if(vo(u),u>=2**t)throw new Error(`convertRadix2: invalid data word=${u} from=${t}`);if(i=i<32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${t}`);for(o+=t;o>=n;o-=n)a.push((i>>o-n&s)>>>0);i&=2**o-1}if(i=i<=t)throw new Error("Excess padding");if(!r&&i)throw new Error(`Non-zero padding: ${i}`);return r&&o>0&&a.push(i>>>0),a}function cS(e){return vo(e),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return ap(Array.from(t),2**8,e)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(ap(t,e,2**8))}}}function Xr(e,t=!1){if(vo(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(ru(8,e)>32||ru(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!(n instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return af(Array.from(n),8,e,!t)},decode:n=>{if(!Array.isArray(n)||n.length&&typeof n[0]!="number")throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(af(n,e,8,t))}}}function up(e){if(typeof e!="function")throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch{}}}const fS=cr(Xr(4),fr("0123456789ABCDEF"),dr("")),dS=cr(Xr(5),fr("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),zu(5),dr(""));cr(Xr(5),fr("0123456789ABCDEFGHIJKLMNOPQRSTUV"),zu(5),dr(""));cr(Xr(5),fr("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),dr(""),Qm(e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));const sr=cr(Xr(6),fr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),zu(6),dr("")),hS=cr(Xr(6),fr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),zu(6),dr("")),Rd=e=>cr(cS(58),fr(e),dr("")),uf=Rd("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");Rd("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ");Rd("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const lp=[0,2,3,5,6,7,9,10,11],pS={encode(e){let t="";for(let n=0;n>25;let n=(e&33554431)<<5;for(let r=0;r>r&1)===1&&(n^=cp[r]);return n}function fp(e,t,n=1){const r=e.length;let i=1;for(let o=0;o126)throw new Error(`Invalid prefix (${e})`);i=Lo(i)^s>>5}i=Lo(i);for(let o=0;op)throw new TypeError(`Length ${y} exceeds limit ${p}`);return f=f.toLowerCase(),`${f}1${lf.encode(c)}${fp(f,c,t)}`}function a(f,c=90){if(typeof f!="string")throw new Error(`bech32.decode input should be string, not ${typeof f}`);if(f.length<8||c!==!1&&f.length>c)throw new TypeError(`Wrong string length: ${f.length} (${f}). Expected (8..${c})`);const p=f.toLowerCase();if(f!==p&&f!==f.toUpperCase())throw new Error("String must be lowercase or uppercase");f=p;const y=f.lastIndexOf("1");if(y===0||y===-1)throw new Error('Letter "1" must be present between prefix and data only');const E=f.slice(0,y),w=f.slice(y+1);if(w.length<6)throw new Error("Data must be at least 6 characters long");const A=lf.decode(w).slice(0,-6),v=fp(E,A,t);if(!w.endsWith(v))throw new Error(`Invalid checksum in ${f}: expected "${v}"`);return{prefix:E,words:A}}const u=up(a);function l(f){const{prefix:c,words:p}=a(f,!1);return{prefix:c,words:p,bytes:r(p)}}return{encode:s,decode:a,decodeToBytes:l,decodeUnsafe:u,fromWords:r,fromWordsUnsafe:o,toWords:i}}const lo=Xm("bech32");Xm("bech32m");const yS={encode:e=>new TextDecoder().decode(e),decode:e=>new TextEncoder().encode(e)},gS=cr(Xr(4),fr("0123456789abcdef"),dr(""),Qm(e=>{if(typeof e!="string"||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})),mS={utf8:yS,hex:gS,base16:fS,base32:dS,base64:sr,base64url:hS,base58:uf,base58xmr:pS};`${Object.keys(mS).join(", ")}`;function Dl(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function dp(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function wS(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Gn(e,...t){if(!wS(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */const wt=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),vS=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!vS)throw new Error("Non little-endian hardware is not supported");function bS(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function ES(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r(Object.assign(t,e),t),Kr=16,SS=283;function Pd(e){return e<<1^SS&-(e>>7)}function zi(e,t){let n=0;for(;t>0;t>>=1)n^=e&-(t&1),e=Pd(e);return n}const cf=(()=>{let e=new Uint8Array(256);for(let n=0,r=1;n<256;n++,r^=Pd(r))e[n]=r;const t=new Uint8Array(256);t[0]=99;for(let n=0;n<255;n++){let r=e[255-n];r|=r<<8,t[e[n]]=(r^r>>4^r>>5^r>>6^r>>7^99)&255}return t})(),kS=cf.map((e,t)=>cf.indexOf(t)),_S=e=>e<<24|e>>>8,zl=e=>e<<8|e>>>24;function Jm(e,t){if(e.length!==256)throw new Error("Wrong sbox length");const n=new Uint32Array(256).map((l,f)=>t(e[f])),r=n.map(zl),i=r.map(zl),o=i.map(zl),s=new Uint32Array(256*256),a=new Uint32Array(256*256),u=new Uint16Array(256*256);for(let l=0;l<256;l++)for(let f=0;f<256;f++){const c=l*256+f;s[c]=n[l]^r[f],a[c]=i[l]^o[f],u[c]=e[l]<<8|e[f]}return{sbox:e,sbox2:u,T0:n,T1:r,T2:i,T3:o,T01:s,T23:a}}const $d=Jm(cf,e=>zi(e,3)<<24|e<<16|e<<8|zi(e,2)),ew=Jm(kS,e=>zi(e,11)<<24|zi(e,13)<<16|zi(e,9)<<8|zi(e,14)),BS=(()=>{const e=new Uint8Array(16);for(let t=0,n=1;t<16;t++,n=Pd(n))e[t]=n;return e})();function tw(e){Gn(e);const t=e.length;if(![16,24,32].includes(t))throw new Error(`aes: wrong key size: should be 16, 24 or 32, got: ${t}`);const{sbox2:n}=$d,r=wt(e),i=r.length,o=a=>On(n,a,a,a,a),s=new Uint32Array(t+28);s.set(r);for(let a=i;a6&&a%i===4&&(u=o(u)),s[a]=s[a-i]^u}return s}function AS(e){const t=tw(e),n=t.slice(),r=t.length,{sbox2:i}=$d,{T0:o,T1:s,T2:a,T3:u}=ew;for(let l=0;l>>8&255]^a[c>>>16&255]^u[c>>>24]}return n}function Nr(e,t,n,r,i,o){return e[n<<8&65280|r>>>8&255]^t[i>>>8&65280|o>>>24&255]}function On(e,t,n,r,i){return e[t&255|n&65280]|e[r>>>16&255|i>>>16&65280]<<16}function hp(e,t,n,r,i){const{sbox2:o,T01:s,T23:a}=$d;let u=0;t^=e[u++],n^=e[u++],r^=e[u++],i^=e[u++];const l=e.length/4-2;for(let E=0;E16)throw new Error(`aes/pcks5: wrong padding byte: ${r}`);const i=e.subarray(0,-r);for(let o=0;o{const a=tw(t),{b:u,o:l,out:f}=TS(o,i,s),c=wt(n);let p=c[0],y=c[1],E=c[2],w=c[3],A=0;for(;A+4<=u.length;)p^=u[A+0],y^=u[A+1],E^=u[A+2],w^=u[A+3],{s0:p,s1:y,s2:E,s3:w}=hp(a,p,y,E,w),l[A++]=p,l[A++]=y,l[A++]=E,l[A++]=w;if(i){const v=LS(o.subarray(A*4));p^=v[0],y^=v[1],E^=v[2],w^=v[3],{s0:p,s1:y,s2:E,s3:w}=hp(a,p,y,E,w),l[A++]=p,l[A++]=y,l[A++]=E,l[A++]=w}return a.fill(0),f},decrypt:(o,s)=>{IS(o);const a=AS(t),u=wt(n),l=nw(o.length,s),f=wt(o),c=wt(l);let p=u[0],y=u[1],E=u[2],w=u[3];for(let A=0;A+4<=f.length;){const v=p,S=y,x=E,L=w;p=f[A+0],y=f[A+1],E=f[A+2],w=f[A+3];const{s0:N,s1:R,s2:H,s3:F}=CS(a,p,y,E,w);c[A++]=N^v,c[A++]=R^S,c[A++]=H^x,c[A++]=F^L}return a.fill(0),US(l,i)}}}),iw=e=>Uint8Array.from(e.split("").map(t=>t.charCodeAt(0))),OS=iw("expand 16-byte k"),NS=iw("expand 32-byte k"),RS=wt(OS),ow=wt(NS);ow.slice();function Se(e,t){return e<>>32-t}function ff(e){return e.byteOffset%4===0}const na=64,PS=16,sw=2**32-1,pp=new Uint32Array;function $S(e,t,n,r,i,o,s,a){const u=i.length,l=new Uint8Array(na),f=wt(l),c=ff(i)&&ff(o),p=c?wt(i):pp,y=c?wt(o):pp;for(let E=0;E=sw)throw new Error("arx: counter overflow");const w=Math.min(na,u-E);if(c&&w===na){const A=E/4;if(E%4!==0)throw new Error("arx: invalid block position");for(let v=0,S;v{Gn(a),Gn(u),Gn(l);const p=l.length;if(f||(f=new Uint8Array(p)),Gn(f),Dl(c),c<0||c>=sw)throw new Error("arx: counter overflow");if(f.length0;)y.pop().fill(0);return f}}function HS(e,t,n,r,i,o=20){let s=e[0],a=e[1],u=e[2],l=e[3],f=t[0],c=t[1],p=t[2],y=t[3],E=t[4],w=t[5],A=t[6],v=t[7],S=i,x=n[0],L=n[1],N=n[2],R=s,H=a,F=u,q=l,K=f,P=c,D=p,M=y,z=E,b=w,C=A,B=v,m=S,k=x,U=L,T=N;for(let V=0;Vi?t.create().update(r).digest():r);for(let s=0;snew uw(e,t).update(n).digest();Ku.create=(e,t)=>new uw(e,t);function FS(e,t,n){return Ln.hash(e),Ku(e,ys(n),ys(t))}const Kl=new Uint8Array([0]),yp=new Uint8Array;function jS(e,t,n,r=32){if(Ln.hash(e),Ln.number(r),r>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(r/e.outputLen);n===void 0&&(n=yp);const o=new Uint8Array(i*e.outputLen),s=Ku.create(e,t),a=s._cloneInto(),u=new Uint8Array(s.outputLen);for(let l=0;l{for(var n in t)DS(e,n,{get:t[n],enumerable:!0})},Bi=Symbol("verified"),zS=e=>e instanceof Object;function Md(e){if(!zS(e)||typeof e.kind!="number"||typeof e.content!="string"||typeof e.created_at!="number"||typeof e.pubkey!="string"||!e.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(e.tags))return!1;for(let t=0;tGS,QueueNode:()=>lw,binarySearch:()=>Hd,bytesToHex:()=>yt,hexToBytes:()=>bi,insertEventIntoAscendingList:()=>WS,insertEventIntoDescendingList:()=>qS,normalizeURL:()=>VS,utf8Decoder:()=>Zn,utf8Encoder:()=>Sn});var Zn=new TextDecoder("utf-8"),Sn=new TextEncoder;function VS(e){try{e.indexOf("://")===-1&&(e="wss://"+e);let t=new URL(e);return t.pathname=t.pathname.replace(/\/+/g,"/"),t.pathname.endsWith("/")&&(t.pathname=t.pathname.slice(0,-1)),(t.port==="80"&&t.protocol==="ws:"||t.port==="443"&&t.protocol==="wss:")&&(t.port=""),t.searchParams.sort(),t.hash="",t.toString()}catch{throw new Error(`Invalid URL: ${e}`)}}function qS(e,t){const[n,r]=Hd(e,i=>t.id===i.id?0:t.created_at===i.created_at?-1:i.created_at-t.created_at);return r||e.splice(n,0,t),e}function WS(e,t){const[n,r]=Hd(e,i=>t.id===i.id?0:t.created_at===i.created_at?-1:t.created_at-i.created_at);return r||e.splice(n,0,t),e}function Hd(e,t){let n=0,r=e.length-1;for(;n<=r;){const i=Math.floor((n+r)/2),o=t(e[i]);if(o===0)return[i,!0];o<0?r=i-1:n=i+1}return[n,!1]}var lw=class{constructor(e){ye(this,"value");ye(this,"next",null);ye(this,"prev",null);this.value=e}},GS=class{constructor(){ye(this,"first");ye(this,"last");this.first=null,this.last=null}enqueue(e){const t=new lw(e);return this.last?this.last===this.first?(this.last=t,this.last.prev=this.first,this.first.next=t):(t.prev=this.last,this.last.next=t,this.last=t):(this.first=t,this.last=t),!0}dequeue(){if(!this.first)return null;if(this.first===this.last){const t=this.first;return this.first=null,this.last=null,t.value}const e=this.first;return this.first=e.next,this.first&&(this.first.prev=null),e.value}},ZS=class{generateSecretKey(){return Uo.utils.randomPrivateKey()}getPublicKey(e){return yt(Uo.getPublicKey(e))}finalizeEvent(e,t){const n=e;return n.pubkey=yt(Uo.getPublicKey(t)),n.id=ba(n),n.sig=yt(Uo.sign(ba(n),t)),n[Bi]=!0,n}verifyEvent(e){if(typeof e[Bi]=="boolean")return e[Bi];const t=ba(e);if(t!==e.id)return e[Bi]=!1,!1;try{const n=Uo.verify(e.sig,t,e.pubkey);return e[Bi]=n,n}catch{return e[Bi]=!1,!1}}};function QS(e){if(!Md(e))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content])}function ba(e){let t=wo(Sn.encode(QS(e)));return yt(t)}var Vu=new ZS,YS=Vu.generateSecretKey,Fd=Vu.getPublicKey,Hn=Vu.finalizeEvent,jd=Vu.verifyEvent,Ce={};Pe(Ce,{Application:()=>Q8,BadgeAward:()=>o8,BadgeDefinition:()=>z8,BlockedRelaysList:()=>A8,BookmarkList:()=>k8,Bookmarksets:()=>F8,Calendar:()=>r4,CalendarEventRSVP:()=>i4,ChannelCreation:()=>yw,ChannelHideMessage:()=>ww,ChannelMessage:()=>mw,ChannelMetadata:()=>gw,ChannelMuteUser:()=>vw,ClassifiedListing:()=>J8,ClientAuth:()=>Ew,CommunitiesList:()=>_8,CommunityDefinition:()=>a4,CommunityPostApproval:()=>h8,Contacts:()=>n8,CreateOrUpdateProduct:()=>q8,CreateOrUpdateStall:()=>V8,Curationsets:()=>j8,Date:()=>t4,DirectMessageRelaysList:()=>U8,DraftClassifiedListing:()=>e4,DraftLong:()=>G8,Emojisets:()=>Z8,EncryptedDirectMessage:()=>r8,EventDeletion:()=>i8,FileMetadata:()=>a8,FileServerPreference:()=>L8,Followsets:()=>$8,GenericRepost:()=>qd,Genericlists:()=>M8,GiftWrap:()=>bw,HTTPAuth:()=>Wd,Handlerinformation:()=>s4,Handlerrecommendation:()=>o4,Highlights:()=>b8,InterestsList:()=>I8,Interestsets:()=>K8,JobFeedback:()=>g8,JobRequest:()=>p8,JobResult:()=>y8,Label:()=>d8,LightningPubRPC:()=>N8,LiveChatMessage:()=>u8,LiveEvent:()=>Y8,LongFormArticle:()=>W8,Metadata:()=>e8,Mutelist:()=>E8,NWCWalletInfo:()=>O8,NWCWalletRequest:()=>xw,NWCWalletResponse:()=>R8,NostrConnect:()=>P8,OpenTimestamps:()=>s8,Pinlist:()=>x8,PrivateDirectMessage:()=>pw,ProblemTracker:()=>l8,ProfileBadges:()=>D8,PublicChatsList:()=>B8,Reaction:()=>Vd,RecommendRelay:()=>t8,RelayList:()=>S8,Relaysets:()=>H8,Report:()=>c8,Reporting:()=>f8,Repost:()=>Kd,Seal:()=>hw,SearchRelaysList:()=>C8,ShortTextNote:()=>dw,Time:()=>n4,UserEmojiList:()=>T8,UserStatuses:()=>X8,Zap:()=>v8,ZapGoal:()=>m8,ZapRequest:()=>w8,classifyKind:()=>XS,isAddressableKind:()=>zd,isEphemeralKind:()=>fw,isKind:()=>JS,isRegularKind:()=>cw,isReplaceableKind:()=>Dd});function cw(e){return 1e3<=e&&e<1e4||[1,2,4,5,6,7,8,16,40,41,42,43,44].includes(e)}function Dd(e){return[0,3].includes(e)||1e4<=e&&e<2e4}function fw(e){return 2e4<=e&&e<3e4}function zd(e){return 3e4<=e&&e<4e4}function XS(e){return cw(e)?"regular":Dd(e)?"replaceable":fw(e)?"ephemeral":zd(e)?"parameterized":"unknown"}function JS(e,t){const n=t instanceof Array?t:[t];return Md(e)&&n.includes(e.kind)||!1}var e8=0,dw=1,t8=2,n8=3,r8=4,i8=5,Kd=6,Vd=7,o8=8,hw=13,pw=14,qd=16,yw=40,gw=41,mw=42,ww=43,vw=44,s8=1040,bw=1059,a8=1063,u8=1311,l8=1971,c8=1984,f8=1984,d8=1985,h8=4550,p8=5999,y8=6999,g8=7e3,m8=9041,w8=9734,v8=9735,b8=9802,E8=1e4,x8=10001,S8=10002,k8=10003,_8=10004,B8=10005,A8=10006,C8=10007,I8=10015,T8=10030,U8=10050,L8=10096,O8=13194,N8=21e3,Ew=22242,xw=23194,R8=23195,P8=24133,Wd=27235,$8=3e4,M8=30001,H8=30002,F8=30003,j8=30004,D8=30008,z8=30009,K8=30015,V8=30017,q8=30018,W8=30023,G8=30024,Z8=30030,Q8=30078,Y8=30311,X8=30315,J8=30402,e4=30403,t4=31922,n4=31923,r4=31924,i4=31925,o4=31989,s4=31990,a4=34550,u4={};Pe(u4,{getHex64:()=>Gd,getInt:()=>Sw,getSubscriptionId:()=>l4,matchEventId:()=>c4,matchEventKind:()=>d4,matchEventPubkey:()=>f4});function Gd(e,t){let n=t.length+3,r=e.indexOf(`"${t}":`)+n,i=e.slice(r).indexOf('"')+r+1;return e.slice(i,i+64)}function Sw(e,t){let n=t.length,r=e.indexOf(`"${t}":`)+n+3,i=e.slice(r),o=Math.min(i.indexOf(","),i.indexOf("}"));return parseInt(i.slice(0,o),10)}function l4(e){let t=e.slice(0,22).indexOf('"EVENT"');if(t===-1)return null;let n=e.slice(t+7+1).indexOf('"');if(n===-1)return null;let r=t+7+1+n,i=e.slice(r+1,80).indexOf('"');if(i===-1)return null;let o=r+1+i;return e.slice(r+1,o)}function c4(e,t){return t===Gd(e,"id")}function f4(e,t){return t===Gd(e,"pubkey")}function d4(e,t){return t===Sw(e,"kind")}var h4={};Pe(h4,{makeAuthEvent:()=>p4});function p4(e,t){return{kind:Ew,created_at:Math.floor(Date.now()/1e3),tags:[["relay",e],["challenge",t]],content:""}}var y4;try{y4=WebSocket}catch{}var g4;try{g4=WebSocket}catch{}var m4={};Pe(m4,{BECH32_REGEX:()=>kw,Bech32MaxSize:()=>Zd,NostrTypeGuard:()=>w4,decode:()=>qu,decodeNostrURI:()=>b4,encodeBytes:()=>Gu,naddrEncode:()=>B4,neventEncode:()=>_4,noteEncode:()=>S4,nprofileEncode:()=>k4,npubEncode:()=>x4,nsecEncode:()=>E4});var w4={isNProfile:e=>/^nprofile1[a-z\d]+$/.test(e||""),isNEvent:e=>/^nevent1[a-z\d]+$/.test(e||""),isNAddr:e=>/^naddr1[a-z\d]+$/.test(e||""),isNSec:e=>/^nsec1[a-z\d]{58}$/.test(e||""),isNPub:e=>/^npub1[a-z\d]{58}$/.test(e||""),isNote:e=>/^note1[a-z\d]+$/.test(e||""),isNcryptsec:e=>/^ncryptsec1[a-z\d]+$/.test(e||"")},Zd=5e3,kw=/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;function v4(e){const t=new Uint8Array(4);return t[0]=e>>24&255,t[1]=e>>16&255,t[2]=e>>8&255,t[3]=e&255,t}function b4(e){try{return e.startsWith("nostr:")&&(e=e.substring(6)),qu(e)}catch{return{type:"invalid",data:null}}}function qu(e){var i,o,s,a,u,l,f;let{prefix:t,words:n}=lo.decode(e,Zd),r=new Uint8Array(lo.fromWords(n));switch(t){case"nprofile":{let c=Vl(r);if(!((i=c[0])!=null&&i[0]))throw new Error("missing TLV 0 for nprofile");if(c[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:yt(c[0][0]),relays:c[1]?c[1].map(p=>Zn.decode(p)):[]}}}case"nevent":{let c=Vl(r);if(!((o=c[0])!=null&&o[0]))throw new Error("missing TLV 0 for nevent");if(c[0][0].length!==32)throw new Error("TLV 0 should be 32 bytes");if(c[2]&&c[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(c[3]&&c[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"nevent",data:{id:yt(c[0][0]),relays:c[1]?c[1].map(p=>Zn.decode(p)):[],author:(s=c[2])!=null&&s[0]?yt(c[2][0]):void 0,kind:(a=c[3])!=null&&a[0]?parseInt(yt(c[3][0]),16):void 0}}}case"naddr":{let c=Vl(r);if(!((u=c[0])!=null&&u[0]))throw new Error("missing TLV 0 for naddr");if(!((l=c[2])!=null&&l[0]))throw new Error("missing TLV 2 for naddr");if(c[2][0].length!==32)throw new Error("TLV 2 should be 32 bytes");if(!((f=c[3])!=null&&f[0]))throw new Error("missing TLV 3 for naddr");if(c[3][0].length!==4)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:Zn.decode(c[0][0]),pubkey:yt(c[2][0]),kind:parseInt(yt(c[3][0]),16),relays:c[1]?c[1].map(p=>Zn.decode(p)):[]}}}case"nsec":return{type:t,data:r};case"npub":case"note":return{type:t,data:yt(r)};default:throw new Error(`unknown prefix ${t}`)}}function Vl(e){let t={},n=e;for(;n.length>0;){let r=n[0],i=n[1],o=n.slice(2,2+i);if(n=n.slice(2+i),o.lengthSn.encode(n))});return Wu("nprofile",t)}function _4(e){let t;e.kind!==void 0&&(t=v4(e.kind));let n=Qd({0:[bi(e.id)],1:(e.relays||[]).map(r=>Sn.encode(r)),2:e.author?[bi(e.author)]:[],3:t?[new Uint8Array(t)]:[]});return Wu("nevent",n)}function B4(e){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,e.kind,!1);let n=Qd({0:[Sn.encode(e.identifier)],1:(e.relays||[]).map(r=>Sn.encode(r)),2:[bi(e.pubkey)],3:[new Uint8Array(t)]});return Wu("naddr",n)}function Qd(e){let t=[];return Object.entries(e).reverse().forEach(([n,r])=>{r.forEach(i=>{let o=new Uint8Array(i.length+2);o.set([parseInt(n)],0),o.set([i.length],1),o.set(i,2),t.push(o)})}),Du(...t)}var A4={};Pe(A4,{decrypt:()=>C4,encrypt:()=>_w});function _w(e,t,n){const r=e instanceof Uint8Array?yt(e):e,i=mo.getSharedSecret(r,"02"+t),o=Bw(i);let s=Uint8Array.from(Wm(16)),a=Sn.encode(n),u=rw(o,s).encrypt(a),l=sr.encode(new Uint8Array(u)),f=sr.encode(new Uint8Array(s.buffer));return`${l}?iv=${f}`}function C4(e,t,n){const r=e instanceof Uint8Array?yt(e):e;let[i,o]=n.split("?iv="),s=mo.getSharedSecret(r,"02"+t),a=Bw(s),u=sr.decode(o),l=sr.decode(i),f=rw(a,u).decrypt(l);return Zn.decode(f)}function Bw(e){return e.slice(1,33)}var I4={};Pe(I4,{NIP05_REGEX:()=>Yd,isNip05:()=>T4,isValid:()=>O4,queryProfile:()=>Aw,searchDomain:()=>L4,useFetchImplementation:()=>U4});var Yd=/^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,T4=e=>Yd.test(e||""),Zu;try{Zu=fetch}catch{}function U4(e){Zu=e}async function L4(e,t=""){try{const n=`https://${e}/.well-known/nostr.json?name=${t}`,r=await Zu(n,{redirect:"manual"});if(r.status!==200)throw Error("Wrong response code");return(await r.json()).names}catch{return{}}}async function Aw(e){var i;const t=e.match(Yd);if(!t)return null;const[,n="_",r]=t;try{const o=`https://${r}/.well-known/nostr.json?name=${n}`,s=await Zu(o,{redirect:"manual"});if(s.status!==200)throw Error("Wrong response code");const a=await s.json(),u=a.names[n];return u?{pubkey:u,relays:(i=a.relays)==null?void 0:i[u]}:null}catch{return null}}async function O4(e,t){const n=await Aw(t);return n?n.pubkey===e:!1}var N4={};Pe(N4,{parse:()=>R4});function R4(e){const t={reply:void 0,root:void 0,mentions:[],profiles:[],quotes:[]};let n,r;for(let i=e.tags.length-1;i>=0;i--){const o=e.tags[i];if(o[0]==="e"&&o[1]){const[s,a,u,l,f]=o,c={id:a,relays:u?[u]:[],author:f};if(l==="root"){t.root=c;continue}if(l==="reply"){t.reply=c;continue}if(l==="mention"){t.mentions.push(c);continue}n?r=c:n=c,t.mentions.push(c);continue}if(o[0]==="q"&&o[1]){const[s,a,u]=o;t.quotes.push({id:a,relays:u?[u]:[]})}if(o[0]==="p"&&o[1]){t.profiles.push({pubkey:o[1],relays:o[2]?[o[2]]:[]});continue}}return t.root||(t.root=r||n||t.reply),t.reply||(t.reply=n||t.root),[t.reply,t.root].forEach(i=>{if(!i)return;let o=t.mentions.indexOf(i);if(o!==-1&&t.mentions.splice(o,1),i.author){let s=t.profiles.find(a=>a.pubkey===i.author);s&&s.relays&&(i.relays||(i.relays=[]),s.relays.forEach(a=>{var u;((u=i.relays)==null?void 0:u.indexOf(a))===-1&&i.relays.push(a)}),s.relays=i.relays)}}),t.mentions.forEach(i=>{if(i.author){let o=t.profiles.find(s=>s.pubkey===i.author);o&&o.relays&&(i.relays||(i.relays=[]),o.relays.forEach(s=>{i.relays.indexOf(s)===-1&&i.relays.push(s)}),o.relays=i.relays)}}),t}var P4={};Pe(P4,{fetchRelayInformation:()=>M4,useFetchImplementation:()=>$4});var Cw;try{Cw=fetch}catch{}function $4(e){Cw=e}async function M4(e){return await(await fetch(e.replace("ws://","http://").replace("wss://","https://"),{headers:{Accept:"application/nostr+json"}})).json()}var H4={};Pe(H4,{fastEventHash:()=>Tw,getPow:()=>Iw,minePow:()=>F4});function Iw(e){let t=0;for(let n=0;n<64;n+=8){const r=parseInt(e.substring(n,n+8),16);if(r===0)t+=32;else{t+=Math.clz32(r);break}}return t}function F4(e,t){let n=0;const r=e,i=["nonce",n.toString(),t.toString()];for(r.tags.push(i);;){const o=Math.floor(new Date().getTime()/1e3);if(o!==r.created_at&&(n=0,r.created_at=o),i[1]=(++n).toString(),r.id=Tw(r),Iw(r.id)>=t)break}return r}function Tw(e){return yt(wo(Sn.encode(JSON.stringify([0,e.pubkey,e.created_at,e.kind,e.tags,e.content]))))}var j4={};Pe(j4,{unwrapEvent:()=>J4,unwrapManyEvents:()=>ek,wrapEvent:()=>zw,wrapManyEvents:()=>X4});var D4={};Pe(D4,{createRumor:()=>Hw,createSeal:()=>Fw,createWrap:()=>jw,unwrapEvent:()=>nh,unwrapManyEvents:()=>Dw,wrapEvent:()=>iu,wrapManyEvents:()=>Q4});var z4={};Pe(z4,{decrypt:()=>th,encrypt:()=>eh,getConversationKey:()=>Xd,v2:()=>G4});var Uw=1,Lw=65535;function Xd(e,t){const n=mo.getSharedSecret(e,"02"+t).subarray(1,33);return FS(wo,n,"nip44-v2")}function Ow(e,t){const n=jS(wo,e,t,76);return{chacha_key:n.subarray(0,32),chacha_nonce:n.subarray(32,44),hmac_key:n.subarray(44,76)}}function Jd(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("expected positive integer");if(e<=32)return 32;const t=1<Lw)throw new Error("invalid plaintext size: must be between 1 and 65535 bytes");const t=new Uint8Array(2);return new DataView(t.buffer).setUint16(0,e,!1),t}function V4(e){const t=Sn.encode(e),n=t.length,r=K4(n),i=new Uint8Array(Jd(n)-n);return Du(r,t,i)}function q4(e){const t=new DataView(e.buffer).getUint16(0),n=e.subarray(2,2+t);if(tLw||n.length!==t||e.length!==2+Jd(t))throw new Error("invalid padding");return Zn.decode(n)}function Nw(e,t,n){if(n.length!==32)throw new Error("AAD associated data must be 32 bytes");const r=Du(n,t);return Ku(wo,e,r)}function W4(e){if(typeof e!="string")throw new Error("payload must be a valid string");const t=e.length;if(t<132||t>87472)throw new Error("invalid payload length: "+t);if(e[0]==="#")throw new Error("unknown encryption version");let n;try{n=sr.decode(e)}catch(o){throw new Error("invalid base64: "+o.message)}const r=n.length;if(r<99||r>65603)throw new Error("invalid data length: "+r);const i=n[0];if(i!==2)throw new Error("unknown encryption version "+i);return{nonce:n.subarray(1,33),ciphertext:n.subarray(33,-32),mac:n.subarray(-32)}}function eh(e,t,n=Wm(32)){const{chacha_key:r,chacha_nonce:i,hmac_key:o}=Ow(t,n),s=V4(e),a=aw(r,i,s),u=Nw(o,a,n);return sr.encode(Du(new Uint8Array([2]),n,a,u))}function th(e,t){const{nonce:n,ciphertext:r,mac:i}=W4(e),{chacha_key:o,chacha_nonce:s,hmac_key:a}=Ow(t,n),u=Nw(a,r,n);if(!ES(u,i))throw new Error("invalid MAC");const l=aw(o,s,r);return q4(l)}var G4={utils:{getConversationKey:Xd,calcPaddedLen:Jd},encrypt:eh,decrypt:th},Z4=2*24*60*60,Rw=()=>Math.round(Date.now()/1e3),Pw=()=>Math.round(Rw()-Math.random()*Z4),$w=(e,t)=>Xd(e,t),Mw=(e,t,n)=>eh(JSON.stringify(e),$w(t,n)),gp=(e,t)=>JSON.parse(th(e.content,$w(t,e.pubkey)));function Hw(e,t){const n={created_at:Rw(),content:"",tags:[],...e,pubkey:Fd(t)};return n.id=ba(n),n}function Fw(e,t,n){return Hn({kind:hw,content:Mw(e,t,n),created_at:Pw(),tags:[]},t)}function jw(e,t){const n=YS();return Hn({kind:bw,content:Mw(e,n,t),created_at:Pw(),tags:[["p",t]]},n)}function iu(e,t,n){const r=Hw(e,t),i=Fw(r,t,n);return jw(i,n)}function Q4(e,t,n){if(!n||n.length===0)throw new Error("At least one recipient is required.");const r=Fd(t),i=[iu(e,t,r)];return n.forEach(o=>{i.push(iu(e,t,o))}),i}function nh(e,t){const n=gp(e,t);return gp(n,t)}function Dw(e,t){let n=[];return e.forEach(r=>{n.push(nh(r,t))}),n.sort((r,i)=>r.created_at-i.created_at),n}function Y4(e,t,n,r){const i={created_at:Math.ceil(Date.now()/1e3),kind:pw,tags:[],content:t};return(Array.isArray(e)?e:[e]).forEach(({publicKey:s,relayUrl:a})=>{i.tags.push(a?["p",s,a]:["p",s])}),r&&i.tags.push(["e",r.eventId,r.relayUrl||"","reply"]),n&&i.tags.push(["subject",n]),i}function zw(e,t,n,r,i){const o=Y4(t,n,r,i);return iu(o,e,t.publicKey)}function X4(e,t,n,r,i){if(!t||t.length===0)throw new Error("At least one recipient is required.");return[{publicKey:Fd(e)},...t].map(s=>zw(e,s,n,r,i))}var J4=nh,ek=Dw,tk={};Pe(tk,{finishRepostEvent:()=>nk,getRepostedEvent:()=>rk,getRepostedEventPointer:()=>Kw});function nk(e,t,n,r){var s;let i;const o=[...e.tags??[],["e",t.id,n],["p",t.pubkey]];return t.kind===dw?i=Kd:(i=qd,o.push(["k",String(t.kind)])),Hn({kind:i,tags:o,content:e.content===""||(s=t.tags)!=null&&s.find(a=>a[0]==="-")?"":JSON.stringify(t),created_at:e.created_at},r)}function Kw(e){if(![Kd,qd].includes(e.kind))return;let t,n;for(let r=e.tags.length-1;r>=0&&(t===void 0||n===void 0);r--){const i=e.tags[r];i.length>=2&&(i[0]==="e"&&t===void 0?t=i:i[0]==="p"&&n===void 0&&(n=i))}if(t!==void 0)return{id:t[1],relays:[t[2],n==null?void 0:n[2]].filter(r=>typeof r=="string"),author:n==null?void 0:n[1]}}function rk(e,{skipVerification:t}={}){const n=Kw(e);if(n===void 0||e.content==="")return;let r;try{r=JSON.parse(e.content)}catch{return}if(r.id===n.id&&!(!t&&!jd(r)))return r}var ik={};Pe(ik,{NOSTR_URI_REGEX:()=>rh,parse:()=>sk,test:()=>ok});var rh=new RegExp(`nostr:(${kw.source})`);function ok(e){return typeof e=="string"&&new RegExp(`^${rh.source}$`).test(e)}function sk(e){const t=e.match(new RegExp(`^${rh.source}$`));if(!t)throw new Error(`Invalid Nostr URI: ${e}`);return{uri:t[0],value:t[1],decoded:qu(t[1])}}var ak={};Pe(ak,{finishReactionEvent:()=>uk,getReactedEventPointer:()=>lk});function uk(e,t,n){const r=t.tags.filter(i=>i.length>=2&&(i[0]==="e"||i[0]==="p"));return Hn({...e,kind:Vd,tags:[...e.tags??[],...r,["e",t.id],["p",t.pubkey]],content:e.content??"+"},n)}function lk(e){if(e.kind!==Vd)return;let t,n;for(let r=e.tags.length-1;r>=0&&(t===void 0||n===void 0);r--){const i=e.tags[r];i.length>=2&&(i[0]==="e"&&t===void 0?t=i:i[0]==="p"&&n===void 0&&(n=i))}if(!(t===void 0||n===void 0))return{id:t[1],relays:[t[2],n[2]].filter(r=>r!==void 0),author:n[1]}}var ck={};Pe(ck,{parse:()=>dk});var fk=/\W/m,mp=/\W |\W$|$|,| /m;function*dk(e){const t=e.length;let n=0,r=0;for(;rpk,channelHideMessageEvent:()=>mk,channelMessageEvent:()=>gk,channelMetadataEvent:()=>yk,channelMuteUserEvent:()=>wk});var pk=(e,t)=>{let n;if(typeof e.content=="object")n=JSON.stringify(e.content);else if(typeof e.content=="string")n=e.content;else return;return Hn({kind:yw,tags:[...e.tags??[]],content:n,created_at:e.created_at},t)},yk=(e,t)=>{let n;if(typeof e.content=="object")n=JSON.stringify(e.content);else if(typeof e.content=="string")n=e.content;else return;return Hn({kind:gw,tags:[["e",e.channel_create_event_id],...e.tags??[]],content:n,created_at:e.created_at},t)},gk=(e,t)=>{const n=[["e",e.channel_create_event_id,e.relay_url,"root"]];return e.reply_to_channel_message_event_id&&n.push(["e",e.reply_to_channel_message_event_id,e.relay_url,"reply"]),Hn({kind:mw,tags:[...n,...e.tags??[]],content:e.content,created_at:e.created_at},t)},mk=(e,t)=>{let n;if(typeof e.content=="object")n=JSON.stringify(e.content);else if(typeof e.content=="string")n=e.content;else return;return Hn({kind:ww,tags:[["e",e.channel_message_event_id],...e.tags??[]],content:n,created_at:e.created_at},t)},wk=(e,t)=>{let n;if(typeof e.content=="object")n=JSON.stringify(e.content);else if(typeof e.content=="string")n=e.content;else return;return Hn({kind:vw,tags:[["p",e.pubkey_to_mute],...e.tags??[]],content:n,created_at:e.created_at},t)},vk={};Pe(vk,{EMOJI_SHORTCODE_REGEX:()=>Vw,matchAll:()=>bk,regex:()=>ih,replaceAll:()=>Ek});var Vw=/:(\w+):/,ih=()=>new RegExp(`\\B${Vw.source}\\B`,"g");function*bk(e){const t=e.matchAll(ih());for(const n of t)try{const[r,i]=n;yield{shortcode:r,name:i,start:n.index,end:n.index+r.length}}catch{}}function Ek(e,t){return e.replaceAll(ih(),(n,r)=>t({shortcode:n,name:r}))}var xk={};Pe(xk,{useFetchImplementation:()=>Sk,validateGithub:()=>kk});var oh;try{oh=fetch}catch{}function Sk(e){oh=e}async function kk(e,t,n){try{return await(await oh(`https://gist.github.com/${t}/${n}/raw`)).text()===`Verifying that I control the following Nostr public key: ${e}`}catch{return!1}}var _k={};Pe(_k,{makeNwcRequestEvent:()=>Ak,parseConnectionString:()=>Bk});function Bk(e){const{host:t,pathname:n,searchParams:r}=new URL(e),i=n||t,o=r.get("relay"),s=r.get("secret");if(!i||!o||!s)throw new Error("invalid connection string");return{pubkey:i,relay:o,secret:s}}async function Ak(e,t,n){const i=_w(t,e,JSON.stringify({method:"pay_invoice",params:{invoice:n}})),o={kind:xw,created_at:Math.round(Date.now()/1e3),content:i,tags:[["p",e]]};return Hn(o,t)}var Ck={};Pe(Ck,{normalizeIdentifier:()=>Ik});function Ik(e){return e=e.trim().toLowerCase(),e=e.normalize("NFKC"),Array.from(e).map(t=>new RegExp("\\p{Letter}","u").test(t)||new RegExp("\\p{Number}","u").test(t)?t:"-").join("")}var Tk={};Pe(Tk,{getSatoshisAmountFromBolt11:()=>Pk,getZapEndpoint:()=>Lk,makeZapReceipt:()=>Rk,makeZapRequest:()=>Ok,useFetchImplementation:()=>Uk,validateZapRequest:()=>Nk});var sh;try{sh=fetch}catch{}function Uk(e){sh=e}async function Lk(e){try{let t="",{lud06:n,lud16:r}=JSON.parse(e.content);if(n){let{words:s}=lo.decode(n,1e3),a=lo.fromWords(s);t=Zn.decode(a)}else if(r){let[s,a]=r.split("@");t=new URL(`/.well-known/lnurlp/${s}`,`https://${a}`).toString()}else return null;let o=await(await sh(t)).json();if(o.allowsNostr&&o.nostrPubkey)return o.callback}catch{}return null}function Ok({profile:e,event:t,amount:n,relays:r,comment:i=""}){if(!n)throw new Error("amount not given");if(!e)throw new Error("profile not given");let o={kind:9734,created_at:Math.round(Date.now()/1e3),content:i,tags:[["p",e],["amount",n.toString()],["relays",...r]]};if(t&&typeof t=="string"&&o.tags.push(["e",t]),t&&typeof t=="object"){if(Dd(t.kind)){const s=["a",`${t.kind}:${t.pubkey}:`];o.tags.push(s)}else if(zd(t.kind)){let s=t.tags.find(([u,l])=>u==="d"&&l);if(!s)throw new Error("d tag not found or is empty");const a=["a",`${t.kind}:${t.pubkey}:${s[1]}`];o.tags.push(a)}}return o}function Nk(e){let t;try{t=JSON.parse(e)}catch{return"Invalid zap request JSON."}if(!Md(t))return"Zap request is not a valid Nostr event.";if(!jd(t))return"Invalid signature on zap request.";let n=t.tags.find(([o,s])=>o==="p"&&s);if(!n)return"Zap request doesn't have a 'p' tag.";if(!n[1].match(/^[a-f0-9]{64}$/))return"Zap request 'p' tag is not valid hex.";let r=t.tags.find(([o,s])=>o==="e"&&s);return r&&!r[1].match(/^[a-f0-9]{64}$/)?"Zap request 'e' tag is not valid hex.":t.tags.find(([o,s])=>o==="relays"&&s)?null:"Zap request doesn't have a 'relays' tag."}function Rk({zapRequest:e,preimage:t,bolt11:n,paidAt:r}){let i=JSON.parse(e),o=i.tags.filter(([a])=>a==="e"||a==="p"||a==="a"),s={kind:9735,created_at:Math.round(r.getTime()/1e3),content:"",tags:[...o,["P",i.pubkey],["bolt11",n],["description",e]]};return t&&s.tags.push(["preimage",t]),s}function Pk(e){if(e.length<50)return 0;e=e.substring(0,50);const t=e.lastIndexOf("1");if(t===-1)return 0;const n=e.substring(0,t);if(!n.startsWith("lnbc"))return 0;const r=n.substring(4);if(r.length<1)return 0;const i=r[r.length-1],o=i.charCodeAt(0)-48,s=o>=0&&o<=9;let a=r.length-1;if(s&&a++,a<1)return 0;const u=parseInt(r.substring(0,a));switch(i){case"m":return u*1e5;case"u":return u*100;case"n":return u/10;case"p":return u/1e4;default:return u*1e8}}var $k={};Pe($k,{getToken:()=>Mk,hashPayload:()=>ah,unpackEventFromToken:()=>Ww,validateEvent:()=>Jw,validateEventKind:()=>Zw,validateEventMethodTag:()=>Yw,validateEventPayloadTag:()=>Xw,validateEventTimestamp:()=>Gw,validateEventUrlTag:()=>Qw,validateToken:()=>Hk});var qw="Nostr ";async function Mk(e,t,n,r=!1,i){const o={kind:Wd,tags:[["u",e],["method",t]],created_at:Math.round(new Date().getTime()/1e3),content:""};i&&o.tags.push(["payload",ah(i)]);const s=await n(o);return(r?qw:"")+sr.encode(Sn.encode(JSON.stringify(s)))}async function Hk(e,t,n){const r=await Ww(e).catch(o=>{throw o});return await Jw(r,t,n).catch(o=>{throw o})}async function Ww(e){if(!e)throw new Error("Missing token");e=e.replace(qw,"");const t=Zn.decode(sr.decode(e));if(!t||t.length===0||!t.startsWith("{"))throw new Error("Invalid token");return JSON.parse(t)}function Gw(e){return e.created_at?Math.round(new Date().getTime()/1e3)-e.created_at<60:!1}function Zw(e){return e.kind===Wd}function Qw(e,t){const n=e.tags.find(r=>r[0]==="u");return n?n.length>0&&n[1]===t:!1}function Yw(e,t){const n=e.tags.find(r=>r[0]==="method");return n?n.length>0&&n[1].toLowerCase()===t.toLowerCase():!1}function ah(e){const t=wo(Sn.encode(JSON.stringify(e)));return yt(t)}function Xw(e,t){const n=e.tags.find(i=>i[0]==="payload");if(!n)return!1;const r=ah(t);return n.length>0&&n[1]===r}async function Jw(e,t,n,r){if(!jd(e))throw new Error("Invalid nostr event, signature invalid");if(!Zw(e))throw new Error("Invalid nostr event, kind invalid");if(!Gw(e))throw new Error("Invalid nostr event, created_at timestamp invalid");if(!Qw(e,t))throw new Error("Invalid nostr event, url tag invalid");if(!Yw(e,n))throw new Error("Invalid nostr event, method tag invalid");if(r&&typeof r=="object"&&Object.keys(r).length>0&&!Xw(e,r))throw new Error("Invalid nostr event, payload tag does not match request body hash");return!0}function Fk(e){return[0,3].includes(e)||1e4<=e&&e<2e4}function Qu(e){return 3e4<=e&&e<4e4}function jk(e,t){for(;e.lengtht.reduce((n,r)=>{const i=[];for(const o of n)try{const s=r(o);if(s===void 0)continue;i.push(s)}catch{}return i},e);function Zk(e){return e.tags.filter(tv).map(t=>t[1])}function Qk(e){return e.tags.filter(Wk).map(t=>t[1])}function hn(e,t,n){if(Reflect.has(e,t))return Reflect.get(e,t);{const r=n();return Reflect.set(e,t,r),r}}const wp=Symbol.for("event-store"),vp=Symbol.for("event-uid"),Yk=Symbol.for("replaceable-address"),ql=Symbol.for("from-cache"),Xk=Symbol.for("replaceable-identifier");function Pn(e){return Fk(e)||Qu(e)}function Xi(e){let t=Reflect.get(e,vp);return t||(Pn(e.kind)?t=nv(e):t=e.id,Reflect.set(e,vp,t)),t}function nv(e){if(!Pn(e.kind))throw new Error("Event is not replaceable or addressable");return hn(e,Yk,()=>{const t=Qu(e.kind)?rv(e):void 0;return Ur(e.kind,e.pubkey,t)})}function Ur(e,t,n){return e+":"+t+":"+(n??"")}function rv(e){return hn(e,Xk,()=>{var t;return((t=e.tags.find(n=>n[0]==="d"))==null?void 0:t[1])??""})}function Wl(){return Math.round(Date.now()/1e3)}const Jk=Symbol("expiration-timestamp");function Gl(e){return hn(e,Jk,()=>{var n;const t=(n=e.tags.find(r=>r[0]==="expiration"))==null?void 0:n[1];return t?parseInt(t):void 0})}const iv=Symbol.for("encrypted-content"),ov={[Ce.EncryptedDirectMessage]:"nip04",[Ce.Seal]:"nip44",[Ce.GiftWrap]:"nip44"};function sv(e,t){return ov[e]=t,e}function e_(e){return ov[e]!==void 0}function t_(e){return Reflect.get(e,iv)}function n_(e){return Reflect.has(e,iv)===!1}const av=new Set([sv(Ce.DraftLong,"nip04")]);function tn(e,t){return av.add(sv(e,t)),e}function uv(e){return e_(e)&&av.has(e)}function lv(e){return n_(e)}function r_(e){if(!(!uv(e.kind)||lv(e)))return t_(e)}function cv(e){let t=new URL(e);return t.pathname=t.pathname.replace(/\/+/g,"/"),(t.port==="80"&&(t.protocol==="ws:"||t.protocol==="http:")||t.port==="443"&&(t.protocol==="wss:"||t.protocol==="https:"))&&(t.port=""),typeof e=="string"?t.toString():t}const i_=10009,o_=Symbol.for("hidden-tags"),s_=new Set([tn(Ce.BookmarkList,"nip04"),tn(Ce.InterestsList,"nip04"),tn(Ce.Mutelist,"nip04"),tn(Ce.CommunitiesList,"nip04"),tn(Ce.PublicChatsList,"nip04"),tn(Ce.SearchRelaysList,"nip04"),tn(i_,"nip04"),tn(Ce.Bookmarksets,"nip04"),tn(Ce.Relaysets,"nip04"),tn(Ce.Followsets,"nip04"),tn(Ce.Curationsets,"nip04"),tn(Ce.Interestsets,"nip04")]);function a_(e){return uv(e)&&s_.has(e)}function fv(e){if(!(!a_(e.kind)||ch(e)))return hn(e,o_,()=>{const t=r_(e),n=JSON.parse(t);if(!Array.isArray(n))throw new Error("Content is not an array of tags");return n.filter(r=>Array.isArray(r)).map(r=>r.map(i=>String(i)))})}function ch(e){return lv(e)}const bp="abcdefghijklmnopqrstuvwxyz",dv=new Set((bp+bp.toUpperCase()).split("")),Ep=Symbol.for("indexable-tags");function Ea(e){let t=Reflect.get(e,Ep);if(!t){const n=new Set;for(const r of e.tags)r.length>=2&&r[0].length===1&&dv.has(r[0])&&n.add(r[0]+":"+r[1]);t=n,Reflect.set(e,Ep,n)}return t}function u_(e,t){if(e.ids&&e.ids.indexOf(t.id)===-1||e.kinds&&e.kinds.indexOf(t.kind)===-1||e.authors&&e.authors.indexOf(t.pubkey)===-1)return!1;for(let n in e)if(n[0]==="#"){let r=n.slice(1),i=e[n];if(i){const o=Ea(t);if(i.some(s=>o.has(r+":"+s))===!1)return!1}}return!(e.since&&t.created_ate.until)}function df(e,t){for(let n=0;n=8&&c_.test(e)}function f_(e){var t;return!!((t=e==null?void 0:e.toLowerCase())!=null&&t.match(/^[0-9a-f]{64}$/))}const Ai=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function hv(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function hf(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function ki(e,...t){if(!hv(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function d_(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");hf(e.outputLen),hf(e.blockLen)}function pf(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function pv(e,t){ki(e);const n=t.outputLen;if(e.length>>t}function y_(e,t){return e<>>32-t>>>0}const fh=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function dh(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const yv=fh?e=>e:e=>dh(e),g_=yv;function gv(e){for(let t=0;te:gv,mv=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",w_=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function wv(e){if(ki(e),mv)return e.toHex();let t="";for(let n=0;n=Dn._0&&e<=Dn._9)return e-Dn._0;if(e>=Dn.A&&e<=Dn.F)return e-(Dn.A-10);if(e>=Dn.a&&e<=Dn.f)return e-(Dn.a-10)}function v_(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(mv)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,o=0;i{};async function b_(e,t,n){let r=Date.now();for(let i=0;i=0&&oe().update(Ts(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Ev(e){const t=(r,i)=>e(i).update(Ts(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}function xv(e){const t=(r,i)=>e(i).update(Ts(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const __=Yu,B_=Ev,A_=xv;function Sv(e=32){if(Ai&&typeof Ai.getRandomValues=="function")return Ai.getRandomValues(new Uint8Array(e));if(Ai&&typeof Ai.randomBytes=="function")return Uint8Array.from(Ai.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const C_=Object.freeze(Object.defineProperty({__proto__:null,Hash:bv,abytes:ki,aexists:pf,ahash:d_,anumber:hf,aoutput:pv,asyncLoop:b_,byteSwap:dh,byteSwap32:gv,byteSwapIfBE:g_,bytesToHex:wv,bytesToUtf8:E_,checkOpts:k_,clean:ou,concatBytes:S_,createHasher:Yu,createOptHasher:Ev,createView:xa,createXOFer:xv,hexToBytes:v_,isBytes:hv,isLE:fh,kdfInputToBytes:x_,nextTick:vv,randomBytes:Sv,rotl:y_,rotr:yn,swap32IfBE:m_,swap8IfBE:yv,toBytes:Ts,u32:p_,u8:h_,utf8ToBytes:hh,wrapConstructor:__,wrapConstructorWithOpts:B_,wrapXOFConstructorWithOpts:A_},Symbol.toStringTag,{value:"Module"}));function kv(e,t=!1,n=!0){const r=e.split(":"),i=r[0]?parseInt(r[0]):void 0,o=r[1],s=r[2];if(i===void 0){if(n)return null;throw new Error("Missing kind")}if(o===void 0||o===""){if(n)return null;throw new Error("Missing pubkey")}if(t&&s===void 0){if(n)return null;throw new Error("Missing identifier")}return{kind:i,pubkey:o,identifier:s}}function kp(e){if(!e[1])throw new Error("Missing coordinate in tag");const t=kv(e[1],!0,!1);return e[2]&&Is(e[2])&&(t.relays=[e[2]]),t}function _v(e){if(!e[1])throw new Error("Missing pubkey in tag");if(!f_(e[1]))throw new Error("Invalid pubkey");const t={pubkey:e[1]};return e[2]&&Is(e[2])&&(t.relays=[e[2]]),t}function I_(e){return typeof e!="string"&&Reflect.has(e,"identifier")&&Reflect.has(e,"pubkey")&&Reflect.has(e,"kind")}function _p(e){return e.kind+":"+e.pubkey+":"+e.identifier}const T_=10063;function U_(e){const t=Array.isArray(e)?e:e.tags;return lh(t,n=>{if(Cs(n,"server")&&URL.canParse(n[1]))return new URL("/",n[1])})}function L_(e){return typeof e=="string"&&(e={pubkey:e}),t=>t.replaceable({kind:T_,pubkey:e.pubkey,relays:e.relays}).pipe(lr(n=>n?U_(n):[]))}new TextDecoder("utf-8");new TextEncoder;function Sa(e,t){const[n,r]=yf(e,i=>t.id===i.id?0:t.created_at===i.created_at?-1:i.created_at-t.created_at);return r||e.splice(n,0,t),e}function yf(e,t){let n=0,r=e.length-1;for(;n<=r;){const i=Math.floor((n+r)/2),o=t(e[i]);if(o===0)return[i,!0];o<0?r=i-1:n=i+1}return[n,!1]}const O_=Symbol.for("profile-content");function Bv(e){return hn(e,O_,()=>{var n,r;const t=JSON.parse(e.content);return t.nip05&&typeof t.nip05!="string"&&(t.nip05=String(t.nip05)),t.website&&((n=t.website)==null?void 0:n.length)>0&&((r=t.website)==null?void 0:r.startsWith("http"))===!1&&(t.website="https://"+t.website),t})}function N_(e){if(!e||e.kind!==Ce.Metadata&&e.kind!==Ce.Handlerinformation)return!1;try{return Bv(e),!0}catch{return!1}}var Av={};(function(e){/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.bytes=e.stringToBytes=e.str=e.bytesToString=e.hex=e.utf8=e.bech32m=e.bech32=e.base58check=e.base58xmr=e.base58xrp=e.base58flickr=e.base58=e.base64url=e.base64=e.base32crockford=e.base32hex=e.base32=e.base16=e.utils=e.assertNumber=void 0;function t(P){if(!Number.isSafeInteger(P))throw new Error(`Wrong integer: ${P}`)}e.assertNumber=t;function n(...P){const D=(b,C)=>B=>b(C(B)),M=Array.from(P).reverse().reduce((b,C)=>b?D(b,C.encode):C.encode,void 0),z=P.reduce((b,C)=>b?D(b,C.decode):C.decode,void 0);return{encode:M,decode:z}}function r(P){return{encode:D=>{if(!Array.isArray(D)||D.length&&typeof D[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return D.map(M=>{if(t(M),M<0||M>=P.length)throw new Error(`Digit index outside alphabet: ${M} (alphabet: ${P.length})`);return P[M]})},decode:D=>{if(!Array.isArray(D)||D.length&&typeof D[0]!="string")throw new Error("alphabet.decode input should be array of strings");return D.map(M=>{if(typeof M!="string")throw new Error(`alphabet.decode: not string element=${M}`);const z=P.indexOf(M);if(z===-1)throw new Error(`Unknown letter: "${M}". Allowed: ${P}`);return z})}}}function i(P=""){if(typeof P!="string")throw new Error("join separator should be string");return{encode:D=>{if(!Array.isArray(D)||D.length&&typeof D[0]!="string")throw new Error("join.encode input should be array of strings");for(let M of D)if(typeof M!="string")throw new Error(`join.encode: non-string input=${M}`);return D.join(P)},decode:D=>{if(typeof D!="string")throw new Error("join.decode input should be string");return D.split(P)}}}function o(P,D="="){if(t(P),typeof D!="string")throw new Error("padding chr should be string");return{encode(M){if(!Array.isArray(M)||M.length&&typeof M[0]!="string")throw new Error("padding.encode input should be array of strings");for(let z of M)if(typeof z!="string")throw new Error(`padding.encode: non-string input=${z}`);for(;M.length*P%8;)M.push(D);return M},decode(M){if(!Array.isArray(M)||M.length&&typeof M[0]!="string")throw new Error("padding.encode input should be array of strings");for(let b of M)if(typeof b!="string")throw new Error(`padding.decode: non-string input=${b}`);let z=M.length;if(z*P%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;z>0&&M[z-1]===D;z--)if(!((z-1)*P%8))throw new Error("Invalid padding: string has too much padding");return M.slice(0,z)}}}function s(P){if(typeof P!="function")throw new Error("normalize fn should be function");return{encode:D=>D,decode:D=>P(D)}}function a(P,D,M){if(D<2)throw new Error(`convertRadix: wrong from=${D}, base cannot be less than 2`);if(M<2)throw new Error(`convertRadix: wrong to=${M}, base cannot be less than 2`);if(!Array.isArray(P))throw new Error("convertRadix: data should be array");if(!P.length)return[];let z=0;const b=[],C=Array.from(P);for(C.forEach(B=>{if(t(B),B<0||B>=D)throw new Error(`Wrong integer: ${B}`)});;){let B=0,m=!0;for(let k=z;kD?u(D,P%D):P,l=(P,D)=>P+(D-u(P,D));function f(P,D,M,z){if(!Array.isArray(P))throw new Error("convertRadix2: data should be array");if(D<=0||D>32)throw new Error(`convertRadix2: wrong from=${D}`);if(M<=0||M>32)throw new Error(`convertRadix2: wrong to=${M}`);if(l(D,M)>32)throw new Error(`convertRadix2: carry overflow from=${D} to=${M} carryBits=${l(D,M)}`);let b=0,C=0;const B=2**M-1,m=[];for(const k of P){if(t(k),k>=2**D)throw new Error(`convertRadix2: invalid data word=${k} from=${D}`);if(b=b<32)throw new Error(`convertRadix2: carry overflow pos=${C} from=${D}`);for(C+=D;C>=M;C-=M)m.push((b>>C-M&B)>>>0);b&=2**C-1}if(b=b<=D)throw new Error("Excess padding");if(!z&&b)throw new Error(`Non-zero padding: ${b}`);return z&&C>0&&m.push(b>>>0),m}function c(P){return t(P),{encode:D=>{if(!(D instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return a(Array.from(D),2**8,P)},decode:D=>{if(!Array.isArray(D)||D.length&&typeof D[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(a(D,P,2**8))}}}function p(P,D=!1){if(t(P),P<=0||P>32)throw new Error("radix2: bits should be in (0..32]");if(l(8,P)>32||l(P,8)>32)throw new Error("radix2: carry overflow");return{encode:M=>{if(!(M instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return f(Array.from(M),8,P,!D)},decode:M=>{if(!Array.isArray(M)||M.length&&typeof M[0]!="number")throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(f(M,P,8,D))}}}function y(P){if(typeof P!="function")throw new Error("unsafeWrapper fn should be function");return function(...D){try{return P.apply(null,D)}catch{}}}function E(P,D){if(t(P),typeof D!="function")throw new Error("checksum fn should be function");return{encode(M){if(!(M instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");const z=D(M).slice(0,P),b=new Uint8Array(M.length+P);return b.set(M),b.set(z,M.length),b},decode(M){if(!(M instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");const z=M.slice(0,-P),b=D(z).slice(0,P),C=M.slice(-P);for(let B=0;BP.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),e.base64=n(p(6),r("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),o(6),i("")),e.base64url=n(p(6),r("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),o(6),i(""));const w=P=>n(c(58),r(P),i(""));e.base58=w("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),e.base58flickr=w("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),e.base58xrp=w("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const A=[0,2,3,5,6,7,9,10,11];e.base58xmr={encode(P){let D="";for(let M=0;Mn(E(4,D=>P(P(D))),e.base58);e.base58check=v;const S=n(r("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),i("")),x=[996825010,642813549,513874426,1027748829,705979059];function L(P){const D=P>>25;let M=(P&33554431)<<5;for(let z=0;z>z&1)===1&&(M^=x[z]);return M}function N(P,D,M=1){const z=P.length;let b=1;for(let C=0;C126)throw new Error(`Invalid prefix (${P})`);b=L(b)^B>>5}b=L(b);for(let C=0;CV)throw new TypeError(`Length ${Y} exceeds limit ${V}`);return T=T.toLowerCase(),`${T}1${S.encode($)}${N(T,$,D)}`}function m(T,$=90){if(typeof T!="string")throw new Error(`bech32.decode input should be string, not ${typeof T}`);if(T.length<8||$!==!1&&T.length>$)throw new TypeError(`Wrong string length: ${T.length} (${T}). Expected (8..${$})`);const V=T.toLowerCase();if(T!==V&&T!==T.toUpperCase())throw new Error("String must be lowercase or uppercase");T=V;const Y=T.lastIndexOf("1");if(Y===0||Y===-1)throw new Error('Letter "1" must be present between prefix and data only');const X=T.slice(0,Y),ie=T.slice(Y+1);if(ie.length<6)throw new Error("Data must be at least 6 characters long");const ue=S.decode(ie).slice(0,-6),ee=N(X,ue,D);if(!ie.endsWith(ee))throw new Error(`Invalid checksum in ${T}: expected "${ee}"`);return{prefix:X,words:ue}}const k=y(m);function U(T){const{prefix:$,words:V}=m(T,!1);return{prefix:$,words:V,bytes:z(V)}}return{encode:B,decode:m,decodeToBytes:U,decodeUnsafe:k,fromWords:z,fromWordsUnsafe:C,toWords:b}}e.bech32=R("bech32"),e.bech32m=R("bech32m"),e.utf8={encode:P=>new TextDecoder().decode(P),decode:P=>new TextEncoder().encode(P)},e.hex=n(p(4),r("0123456789abcdef"),i(""),s(P=>{if(typeof P!="string"||P.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof P} with length ${P.length}`);return P.toLowerCase()}));const H={utf8:e.utf8,hex:e.hex,base16:e.base16,base32:e.base32,base64:e.base64,base64url:e.base64url,base58:e.base58,base58xmr:e.base58xmr},F=`Invalid encoding type. Available types: ${Object.keys(H).join(", ")}`,q=(P,D)=>{if(typeof P!="string"||!H.hasOwnProperty(P))throw new TypeError(F);if(!(D instanceof Uint8Array))throw new TypeError("bytesToString() expects Uint8Array");return H[P].encode(D)};e.bytesToString=q,e.str=e.bytesToString;const K=(P,D)=>{if(!H.hasOwnProperty(P))throw new TypeError(F);if(typeof D!="string")throw new TypeError("stringToBytes() expects string");return H[P].decode(D)};e.stringToBytes=K,e.bytes=e.stringToBytes})(Av);const{bech32:sC,hex:aC,utf8:uC}=Av;BigInt(1e3),BigInt(1e6),BigInt(1e9),BigInt(1e12);BigInt("2100000000000000000");BigInt(1e11);const Bp={payment_hash:1,payment_secret:16,description:13,payee:19,description_hash:23,expiry:6,min_final_cltv_expiry:24,fallback_address:9,route_hint:3,feature_bits:5,metadata:27};for(let e=0,t=Object.keys(Bp);elh(e.tags,t=>uh(t)?t:void 0,_v))}function F_(e){if(!ch(e))return hn(e,P_,()=>lh(fv(e),t=>uh(t)?t:void 0,_v))}var gf={exports:{}},Zl,Cp;function j_(){if(Cp)return Zl;Cp=1;var e=1e3,t=e*60,n=t*60,r=n*24,i=r*7,o=r*365.25;Zl=function(f,c){c=c||{};var p=typeof f;if(p==="string"&&f.length>0)return s(f);if(p==="number"&&isFinite(f))return c.long?u(f):a(f);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(f))};function s(f){if(f=String(f),!(f.length>100)){var c=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(f);if(c){var p=parseFloat(c[1]),y=(c[2]||"ms").toLowerCase();switch(y){case"years":case"year":case"yrs":case"yr":case"y":return p*o;case"weeks":case"week":case"w":return p*i;case"days":case"day":case"d":return p*r;case"hours":case"hour":case"hrs":case"hr":case"h":return p*n;case"minutes":case"minute":case"mins":case"min":case"m":return p*t;case"seconds":case"second":case"secs":case"sec":case"s":return p*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return p;default:return}}}}function a(f){var c=Math.abs(f);return c>=r?Math.round(f/r)+"d":c>=n?Math.round(f/n)+"h":c>=t?Math.round(f/t)+"m":c>=e?Math.round(f/e)+"s":f+"ms"}function u(f){var c=Math.abs(f);return c>=r?l(f,c,r,"day"):c>=n?l(f,c,n,"hour"):c>=t?l(f,c,t,"minute"):c>=e?l(f,c,e,"second"):f+" ms"}function l(f,c,p,y){var E=c>=p*1.5;return Math.round(f/p)+" "+y+(E?"s":"")}return Zl}function D_(e){n.debug=n,n.default=n,n.coerce=u,n.disable=s,n.enable=i,n.enabled=a,n.humanize=j_(),n.destroy=l,Object.keys(e).forEach(f=>{n[f]=e[f]}),n.names=[],n.skips=[],n.formatters={};function t(f){let c=0;for(let p=0;p{if(R==="%%")return"%";L++;const F=n.formatters[H];if(typeof F=="function"){const q=A[L];R=F.call(v,q),A.splice(L,1),L--}return R}),n.formatArgs.call(v,A),(v.log||n.log).apply(v,A)}return w.namespace=f,w.useColors=n.useColors(),w.color=n.selectColor(f),w.extend=r,w.destroy=n.destroy,Object.defineProperty(w,"enabled",{enumerable:!0,configurable:!1,get:()=>p!==null?p:(y!==n.namespaces&&(y=n.namespaces,E=n.enabled(f)),E),set:A=>{p=A}}),typeof n.init=="function"&&n.init(w),w}function r(f,c){const p=n(this.namespace+(typeof c>"u"?":":c)+f);return p.log=this.log,p}function i(f){n.save(f),n.namespaces=f,n.names=[],n.skips=[];const c=(typeof f=="string"?f:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(const p of c)p[0]==="-"?n.skips.push(p.slice(1)):n.names.push(p)}function o(f,c){let p=0,y=0,E=-1,w=0;for(;p"-"+c)].join(",");return n.enable(""),f}function a(f){for(const c of n.skips)if(o(f,c))return!1;for(const c of n.names)if(o(f,c))return!0;return!1}function u(f){return f instanceof Error?f.stack||f.message:f}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}var z_=D_;(function(e,t){var n={};t.formatArgs=i,t.save=o,t.load=s,t.useColors=r,t.storage=a(),t.destroy=(()=>{let l=!1;return()=>{l||(l=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let l;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(l=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(l[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function i(l){if(l[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+l[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const f="color: "+this.color;l.splice(1,0,f,"color: inherit");let c=0,p=0;l[0].replace(/%[a-zA-Z%]/g,y=>{y!=="%%"&&(c++,y==="%c"&&(p=c))}),l.splice(p,0,f)}t.log=console.debug||console.log||(()=>{});function o(l){try{l?t.storage.setItem("debug",l):t.storage.removeItem("debug")}catch{}}function s(){let l;try{l=t.storage.getItem("debug")||t.storage.getItem("DEBUG")}catch{}return!l&&typeof process<"u"&&"env"in process&&(l=n.DEBUG),l}function a(){try{return localStorage}catch{}}e.exports=z_(t);const{formatters:u}=e.exports;u.j=function(l){try{return JSON.stringify(l)}catch(f){return"[UnexpectedJSONParseError]: "+f.message}}})(gf,gf.exports);var K_=gf.exports;const V_=kf(K_),ph=V_("applesauce");class Ip{constructor(t=0,n=0,r=!1){ye(this,"first",null);ye(this,"items",Object.create(null));ye(this,"last",null);ye(this,"max");ye(this,"resetTtl");ye(this,"size");ye(this,"ttl");this.first=null,this.items=Object.create(null),this.last=null,this.max=t,this.resetTtl=r,this.size=0,this.ttl=n}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(t){if(this.has(t)){const n=this.items[t];delete this.items[t],this.size--,n.prev!==null&&(n.prev.next=n.next),n.next!==null&&(n.next.prev=n.prev),this.first===n&&(this.first=n.next),this.last===n&&(this.last=n.prev)}return this}entries(t=this.keys()){return t.map(n=>[n,this.get(n)])}evict(t=!1){if(t||this.size>0){const n=this.first;delete this.items[n.key],--this.size===0?(this.first=null,this.last=null):(this.first=n.next,this.first.prev=null)}return this}expiresAt(t){let n;return this.has(t)&&(n=this.items[t].expiry),n}get(t){let n;if(this.has(t)){const r=this.items[t];this.ttl>0&&r.expiry<=Date.now()?this.delete(t):(n=r.value,this.set(t,n,!0))}return n}has(t){return t in this.items}keys(){const t=[];let n=this.first;for(;n!==null;)t.push(n.key),n=n.next;return t}set(t,n,r=!1,i=this.resetTtl){let o;if(r||this.has(t)){if(o=this.items[t],o.value=n,r===!1&&i&&(o.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==o){const s=this.last,a=o.next,u=o.prev;this.first===o&&(this.first=o.next),o.next=null,o.prev=this.last,s.next=o,u!==null&&(u.next=a),a!==null&&(a.prev=u)}}else this.max>0&&this.size===this.max&&this.evict(!0),o=this.items[t]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:t,prev:this.last,next:null,value:n},++this.size===1?this.first=o:this.last.next=o;return this.last=o,this}values(t=this.keys()){return t.map(n=>this.get(n))}}class q_{constructor(){ye(this,"log",ph.extend("EventSet"));ye(this,"kinds",new Map);ye(this,"authors",new Map);ye(this,"tags",new Ip);ye(this,"created_at",[]);ye(this,"events",new Ip);ye(this,"replaceable",new Map);ye(this,"insert$",new Yi);ye(this,"update$",new Yi);ye(this,"remove$",new Yi);ye(this,"onBeforeInsert");ye(this,"claims",new WeakMap)}get size(){return this.events.size}touch(t){this.events.set(t.id,t)}hasEvent(t){return this.events.has(t)}getEvent(t){return this.events.get(t)}hasReplaceable(t,n,r){const i=this.replaceable.get(Ur(t,n,r));return!!i&&i.length>0}getReplaceable(t,n,r){const i=Ur(t,n,r),o=this.replaceable.get(i);return o==null?void 0:o[0]}getReplaceableHistory(t,n,r){const i=Ur(t,n,r);return this.replaceable.get(i)}getByFilters(t){return this.getEventsForFilters(Array.isArray(t)?t:[t])}getTimeline(t){const n=[],r=this.getEventsForFilters(Array.isArray(t)?t:[t]);for(const i of r)Sa(n,i);return n}add(t){var i,o;const n=t.id,r=this.events.get(n);if(r)return r;if(((i=this.onBeforeInsert)==null?void 0:i.call(this,t))===!1)return null;this.events.set(n,t),this.getKindIndex(t.kind).add(t),this.getAuthorsIndex(t.pubkey).add(t);for(const s of Ea(t))this.tags.has(s)&&this.getTagIndex(s).add(t);if(Sa(this.created_at,t),Pn(t.kind)){const s=(o=t.tags.find(l=>l[0]==="d"))==null?void 0:o[1],a=Ur(t.kind,t.pubkey,s);let u=this.replaceable.get(a);this.replaceable.has(a)||(u=[],this.replaceable.set(a,u)),Sa(u,t)}return this.insert$.next(t),t}update(t){const n=this.add(t);return n&&this.update$.next(n),n!==null}remove(t){var o;let n=typeof t=="string"?this.events.get(t):t;if(!n)throw new Error("Missing event");const r=n.id;if(!this.events.has(r))return!1;this.getAuthorsIndex(n.pubkey).delete(n),this.getKindIndex(n.kind).delete(n);for(const s of Ea(n))this.tags.has(s)&&this.getTagIndex(s).delete(n);const i=this.created_at.indexOf(n);if(this.created_at.splice(i,1),this.events.delete(r),Pn(n.kind)){const s=(o=n.tags.find(l=>l[0]==="d"))==null?void 0:o[1],a=Ur(n.kind,n.pubkey,s),u=this.replaceable.get(a);if(u&&u.includes(n)){const l=u.indexOf(n);u.splice(l,1)}}return this.claims.delete(n),this.remove$.next(n),!0}claim(t,n){this.claims.has(t)||this.claims.set(t,n),this.touch(t)}isClaimed(t){return this.claims.has(t)}removeClaim(t,n){this.claims.get(t)===n&&this.claims.delete(t)}clearClaim(t){this.claims.delete(t)}getKindIndex(t){return this.kinds.has(t)||this.kinds.set(t,new Set),this.kinds.get(t)}getAuthorsIndex(t){return this.authors.has(t)||this.authors.set(t,new Set),this.authors.get(t)}getTagIndex(t){if(!this.tags.has(t)){const n=new Set,r=Date.now();for(const o of this.events.values())Ea(o).has(t)&&n.add(o);const i=Date.now()-r;i>100&&this.log(`Built index ${t} took ${i}ms`),this.tags.set(t,n)}return this.tags.get(t)}*iterateAuthors(t){for(const n of t){const r=this.authors.get(n);if(r)for(const i of r)yield i}}*iterateTag(t,n){for(const r of n){const i=this.getTagIndex(t+":"+r);if(i)for(const o of i)yield o}}*iterateKinds(t){for(const n of t){const r=this.kinds.get(n);if(r)for(const i of r)yield i}}*iterateTime(t,n){let r=0,i=this.created_at.length-1,o=n?yf(this.created_at,a=>a.created_at-n):void 0;o&&(r=o[0]);const s=t?yf(this.created_at,a=>a.created_at-t):void 0;s&&(i=s[0]);for(let a=r;a{const a=s instanceof Set?s:new Set(s);if(n)r=a,n=!1;else for(const u of r)a.has(u)||r.delete(u);return r};t.ids&&i(this.iterateIds(t.ids));let o=null;t.since!==void 0&&(o=Array.from(this.iterateTime(t.since,t.until)),i(o));for(const s of dv){const a=`#${s}`,u=t[a];u!=null&&u.length&&i(this.iterateTag(s,u))}if(t.authors&&i(this.iterateAuthors(t.authors)),t.kinds&&i(this.iterateKinds(t.kinds)),t.since===void 0&&t.until!==void 0&&(o=Array.from(this.iterateTime(t.since,t.until)),i(o)),t.limit&&o){const s=new Set;for(const a of o){if(s.size>=t.limit)break;r.has(a)&&s.add(a)}return s}return r}getEventsForFilters(t){if(t.length===0)throw new Error("No Filters");let n=new Set;for(const r of t){const i=this.getEventsForFilter(r);for(const o of i)n.add(o)}return n}prune(t=1e3){let n=0,r=this.events.first;for(;r;){const i=r.value;if(!this.isClaimed(i)&&(this.remove(i),n++,n>=t))break;r=r.next}return n}reset(){this.events.clear(),this.kinds.clear(),this.authors.clear(),this.tags.clear(),this.created_at=[],this.replaceable.clear(),this.claims=new WeakMap}}ph.extend("EncryptedContentCache");ph.extend("event-cache");/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ei(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function yh(e,...t){if(!Ei(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Cv(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(n=>typeof n=="string"):t.every(n=>Number.isSafeInteger(n)):!1}function gh(e){if(typeof e!="function")throw new Error("function expected");return!0}function Gr(e,t){if(typeof t!="string")throw new Error(`${e}: string expected`);return!0}function bo(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function su(e){if(!Array.isArray(e))throw new Error("array expected")}function au(e,t){if(!Cv(!0,t))throw new Error(`${e}: array of strings expected`)}function mh(e,t){if(!Cv(!1,t))throw new Error(`${e}: array of numbers expected`)}function At(...e){const t=o=>o,n=(o,s)=>a=>o(s(a)),r=e.map(o=>o.encode).reduceRight(n,t),i=e.map(o=>o.decode).reduce(n,t);return{encode:r,decode:i}}function jt(e){const t=typeof e=="string"?e.split(""):e,n=t.length;au("alphabet",t);const r=new Map(t.map((i,o)=>[i,o]));return{encode:i=>(su(i),i.map(o=>{if(!Number.isSafeInteger(o)||o<0||o>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${o}". Allowed: ${e}`);return t[o]})),decode:i=>(su(i),i.map(o=>{Gr("alphabet.decode",o);const s=r.get(o);if(s===void 0)throw new Error(`Unknown letter: "${o}". Allowed: ${e}`);return s}))}}function Dt(e=""){return Gr("join",e),{encode:t=>(au("join.decode",t),t.join(e)),decode:t=>(Gr("join.decode",t),t.split(e))}}function Us(e,t="="){return bo(e),Gr("padding",t),{encode(n){for(au("padding.encode",n);n.length*e%8;)n.push(t);return n},decode(n){au("padding.decode",n);let r=n.length;if(r*e%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--)if((r-1)*e%8===0)throw new Error("padding: invalid, string has too much padding");return n.slice(0,r)}}}function Iv(e){return gh(e),{encode:t=>t,decode:t=>e(t)}}function mf(e,t,n){if(t<2)throw new Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: invalid to=${n}, base cannot be less than 2`);if(su(e),!e.length)return[];let r=0;const i=[],o=Array.from(e,a=>{if(bo(a),a<0||a>=t)throw new Error(`invalid integer: ${a}`);return a}),s=o.length;for(;;){let a=0,u=!0;for(let l=r;lt===0?e:Tv(t,e%t),uu=(e,t)=>e+(t-Tv(e,t)),ka=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function lu(e,t,n,r){if(su(e),t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(uu(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${uu(t,n)}`);let i=0,o=0;const s=ka[t],a=ka[n]-1,u=[];for(const l of e){if(bo(l),l>=s)throw new Error(`convertRadix2: invalid data word=${l} from=${t}`);if(i=i<32)throw new Error(`convertRadix2: carry overflow pos=${o} from=${t}`);for(o+=t;o>=n;o-=n)u.push((i>>o-n&a)>>>0);const f=ka[o];if(f===void 0)throw new Error("invalid carry");i&=f-1}if(i=i<=t)throw new Error("Excess padding");if(!r&&i>0)throw new Error(`Non-zero padding: ${i}`);return r&&o>0&&u.push(i>>>0),u}function Uv(e){bo(e);const t=2**8;return{encode:n=>{if(!Ei(n))throw new Error("radix.encode input should be Uint8Array");return mf(Array.from(n),t,e)},decode:n=>(mh("radix.decode",n),Uint8Array.from(mf(n,e,t)))}}function Jt(e,t=!1){if(bo(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(uu(8,e)>32||uu(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!Ei(n))throw new Error("radix2.encode input should be Uint8Array");return lu(Array.from(n),8,e,!t)},decode:n=>(mh("radix2.decode",n),Uint8Array.from(lu(n,e,8,t)))}}function Tp(e){return gh(e),function(...t){try{return e.apply(null,t)}catch{}}}function Lv(e,t){return bo(e),gh(t),{encode(n){if(!Ei(n))throw new Error("checksum.encode: input should be Uint8Array");const r=t(n).slice(0,e),i=new Uint8Array(n.length+e);return i.set(n),i.set(r,n.length),i},decode(n){if(!Ei(n))throw new Error("checksum.decode: input should be Uint8Array");const r=n.slice(0,-e),i=n.slice(-e),o=t(r).slice(0,e);for(let s=0;se.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),Rv=typeof Uint8Array.from([]).toBase64=="function"&&typeof Uint8Array.fromBase64=="function",Pv=(e,t)=>{Gr("base64",e);const n=t?/^[A-Za-z0-9=_-]+$/:/^[A-Za-z0-9=+/]+$/,r=t?"base64url":"base64";if(e.length>0&&!n.test(e))throw new Error("invalid base64");return Uint8Array.fromBase64(e,{alphabet:r,lastChunkHandling:"strict"})},$v=Rv?{encode(e){return yh(e),e.toBase64()},decode(e){return Pv(e,!1)}}:At(Jt(6),jt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Us(6),Dt("")),X_=At(Jt(6),jt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Dt("")),Mv=Rv?{encode(e){return yh(e),e.toBase64({alphabet:"base64url"})},decode(e){return Pv(e,!0)}}:At(Jt(6),jt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Us(6),Dt("")),J_=At(Jt(6),jt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Dt("")),wh=e=>At(Uv(58),jt(e),Dt("")),gs=wh("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),e6=wh("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),t6=wh("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"),Up=[0,2,3,5,6,7,9,10,11],Hv={encode(e){let t="";for(let n=0;nAt(Lv(4,t=>e(e(t))),gs),n6=Fv,wf=At(jt("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),Dt("")),Lp=[996825010,642813549,513874426,1027748829,705979059];function Oo(e){const t=e>>25;let n=(e&33554431)<<5;for(let r=0;r>r&1)===1&&(n^=Lp[r]);return n}function Op(e,t,n=1){const r=e.length;let i=1;for(let o=0;o126)throw new Error(`Invalid prefix (${e})`);i=Oo(i)^s>>5}i=Oo(i);for(let o=0;oy)throw new TypeError(`Length ${w} exceeds limit ${y}`);const A=c.toLowerCase(),v=Op(A,p,t);return`${A}1${wf.encode(p)}${v}`}function a(c,p=90){Gr("bech32.decode input",c);const y=c.length;if(y<8||p!==!1&&y>p)throw new TypeError(`invalid string length: ${y} (${c}). Expected (8..${p})`);const E=c.toLowerCase();if(c!==E&&c!==c.toUpperCase())throw new Error("String must be lowercase or uppercase");const w=E.lastIndexOf("1");if(w===0||w===-1)throw new Error('Letter "1" must be present between prefix and data only');const A=E.slice(0,w),v=E.slice(w+1);if(v.length<6)throw new Error("Data must be at least 6 characters long");const S=wf.decode(v).slice(0,-6),x=Op(A,S,t);if(!v.endsWith(x))throw new Error(`Invalid checksum in ${c}: expected "${x}"`);return{prefix:A,words:S}}const u=Tp(a);function l(c){const{prefix:p,words:y}=a(c,!1);return{prefix:p,words:y,bytes:r(y)}}function f(c,p){return s(c,i(p))}return{encode:s,decode:a,encodeFromBytes:f,decodeToBytes:l,decodeUnsafe:u,fromWords:r,fromWordsUnsafe:o,toWords:i}}const r6=jv("bech32"),i6=jv("bech32m"),Dv={encode:e=>new TextDecoder().decode(e),decode:e=>new TextEncoder().encode(e)},o6=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",s6={encode(e){return yh(e),e.toHex()},decode(e){return Gr("hex",e),Uint8Array.fromHex(e)}},zv=o6?s6:At(Jt(4),jt("0123456789abcdef"),Dt(""),Iv(e=>{if(typeof e!="string"||e.length%2!==0)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})),cu={utf8:Dv,hex:zv,base16:Ov,base32:Nv,base64:$v,base64url:Mv,base58:gs,base58xmr:Hv},Kv="Invalid encoding type. Available types: utf8, hex, base16, base32, base64, base64url, base58, base58xmr",Vv=(e,t)=>{if(typeof e!="string"||!cu.hasOwnProperty(e))throw new TypeError(Kv);if(!Ei(t))throw new TypeError("bytesToString() expects Uint8Array");return cu[e].encode(t)},a6=Vv,qv=(e,t)=>{if(!cu.hasOwnProperty(e))throw new TypeError(Kv);if(typeof t!="string")throw new TypeError("stringToBytes() expects string");return cu[e].decode(t)},u6=qv,l6=Object.freeze(Object.defineProperty({__proto__:null,base16:Ov,base32:Nv,base32crockford:Y_,base32hex:Z_,base32hexnopad:Q_,base32nopad:G_,base58:gs,base58check:n6,base58flickr:e6,base58xmr:Hv,base58xrp:t6,base64:$v,base64nopad:X_,base64url:Mv,base64urlnopad:J_,bech32:r6,bech32m:i6,bytes:u6,bytesToString:Vv,createBase58check:Fv,hex:zv,str:a6,stringToBytes:qv,utf8:Dv,utils:W_},Symbol.toStringTag,{value:"Module"}));new TextDecoder;const c6=Symbol.for("mailboxes-inboxes"),f6=Symbol.for("mailboxes-outboxes");function d6(e){return hn(e,c6,()=>{const t=[];for(const n of e.tags){const[r,i,o]=n;r==="r"&&i&&Is(i)&&!t.includes(i)&&(o==="read"||o===void 0)&&t.push(cv(i))}return t})}function h6(e){return hn(e,f6,()=>{const t=[];for(const n of e.tags){const[r,i,o]=n;r==="r"&&i&&Is(i)&&!t.includes(i)&&(o==="write"||o===void 0)&&t.push(cv(i))}return t})}const p6=Symbol.for("mute-public"),y6=Symbol.for("mute-hidden");function g6(...e){const t={pubkeys:new Set,threads:new Set,hashtags:new Set,words:new Set};for(const n of e){for(const r of n.pubkeys)t.pubkeys.add(r);for(const r of n.threads)t.threads.add(r);for(const r of n.hashtags)t.hashtags.add(r);for(const r of n.words)t.words.add(r)}return t}function Wv(e){const t=new Set(e.filter(uh).map(o=>o[1])),n=new Set(e.filter(tv).map(o=>o[1])),r=new Set(e.filter(Gk).map(o=>o[1].toLocaleLowerCase())),i=new Set(e.filter(o=>o[0]==="word"&&o[1]).map(o=>o[1].toLocaleLowerCase()));return{pubkeys:t,threads:n,hashtags:r,words:i}}function m6(e){const t=v6(e),n=w6(e);return t?g6(t,n):n}function w6(e){return hn(e,p6,()=>Wv(e.tags))}function v6(e){if(!ch(e))return hn(e,y6,()=>Wv(fv(e)))}var Np;(function(e){e.nudity="nudity",e.malware="malware",e.profanity="profanity",e.illegal="illegal",e.spam="spam",e.impersonation="impersonation",e.other="other"})(Np||(Np={}));const b6=Symbol.for("nip10-thread-refs");function Rp(e){if(!e[1])throw new Error("Missing event id in tag");let t={id:e[1]};return e[2]&&Is(e[2])&&(t.relays=[e[2]]),e[0]==="e"&&(e[3]==="root"||e[3]==="reply"||e[3]==="mention")&&e[4]&&e[4].length===64&&(t.author=e[4]),t}function E6(e){const t=e.filter(a=>a[0]==="e"&&a[1]),n=e.filter(a=>a[0]==="a"&&a[1]);let r=t.find(a=>a[3]==="root"),i=t.find(a=>a[3]==="reply"),o=n.find(a=>a[3]==="root"),s=n.find(a=>a[3]==="reply");if((!r||!i)&&(r=i=r||i),(!o||!s)&&(o=s=o||s),!r&&!i){const a=t.filter(u=>!u[3]);a.length>=1&&(r=a[0],i=a[a.length-1]??r)}return{root:r||o?{e:r,a:o}:void 0,reply:i||s?{e:i,a:s}:void 0}}function x6(e){return hn(e,b6,()=>{const t=E6(e.tags);let n;if(t.root)try{n={e:t.root.e&&Rp(t.root.e),a:t.root.a&&kp(t.root.a)}}catch{}let r;if(t.reply)try{r={e:t.reply.e&&Rp(t.reply.e),a:t.reply.a&&kp(t.reply.a)}}catch{}return{root:n,reply:r}})}function Pp(e){return t=>{const n=new Set;return t.pipe($u(r=>{if(r!==void 0)if(Array.isArray(r))for(const i of r)n.add(i),e.claim(i,t);else n.add(r),e.claim(r,t)}),Pu(()=>{for(const r of n)e.removeClaim(r,t)}))}}function Gv(e){return t=>{let n;return t.pipe($u(r=>{n&&e.removeClaim(n,t),r&&e.claim(r,t),n=r}),Pu(()=>{n&&e.removeClaim(n,t)}))}}function vh(e){return t=>new bt(n=>{let r=!1;const i=t.subscribe({next:o=>{r=!0,n.next(o)},error:o=>n.error(o),complete:()=>n.complete()});return r||n.next(e),i})}function Zv(e){return typeof e=="string"&&(e={id:e}),t=>Ru(_d(()=>{let n=t.getEvent(e.id);return n?Nu(n):t.eventLoader?$n(t.eventLoader(e)).pipe(Gt(r=>!!r)):Xn}),t.insert$.pipe(Gt(n=>n.id===e.id)),t.removed(e.id).pipe(_m(void 0))).pipe(Gv(t),Bd((n,r)=>(n==null?void 0:n.id)===(r==null?void 0:r.id)),vh(void 0))}function vf(e){return t=>{let n;return Ru(_d(()=>{let r=t.getReplaceable(e.kind,e.pubkey,e.identifier);return r?Nu(r):e.identifier!==void 0?t.addressableLoader?$n(t.addressableLoader(e)).pipe(Gt(i=>!!i)):Xn:t.replaceableLoader?$n(t.replaceableLoader(e)).pipe(Gt(i=>!!i)):Xn}),t.insert$.pipe(Gt(r=>r.pubkey==e.pubkey&&r.kind===e.kind&&(e.identifier!==void 0?rv(r)===e.identifier:!0)))).pipe(Bd((r,i)=>r.created_at>=i.created_at),$u(r=>n=r),i3(t.remove$.pipe(Gt(r=>r.id===(n==null?void 0:n.id)))),_m(void 0),t3(),Gv(t),vh(void 0))}}function S6(e,t){return e=Array.isArray(e)?e:[e],n=>{const r=new Map;return _d(()=>Nu(Array.from(n.getTimeline(e)))).pipe(Pp(n),J0(n.insert$.pipe(Gt(i=>df(e,i)),Pp(n))),J0(n.remove$.pipe(Gt(i=>df(e,i)),lr(i=>i.id))),n3((i,o)=>{if(typeof o=="string")return i.filter(a=>a.id!==o);if(Array.isArray(o)){if(!t)for(const a of o)Pn(a.kind)&&r.set(Xi(a),a);return o}let s=[...i];if(!t&&Pn(o.kind)){const a=Xi(o),u=r.get(a);if(u&&o.created_atr.clear()))}}function k6(e){return t=>km(Object.fromEntries(e.map(n=>[n,t.model(Zv,{id:n})])))}function _6(e){return t=>km(Object.fromEntries(e.map(n=>[Ur(n.kind,n.pubkey,n.identifier),t.model(vf,n)])))}function Qv(e){return t=>{let n;return Ru(t.pipe($u(r=>n=r)),e.update$.pipe(Gt(r=>r.id===(n==null?void 0:n.id))))}}function B6(e){return typeof e=="string"&&(e={pubkey:e}),t=>t.replaceable({kind:Ce.Contacts,pubkey:e.pubkey,relays:e.relays}).pipe(Qv(t),lr(n=>n?M_(n):[]))}function A6(e){return t=>{const n=[{kinds:[Ap],"#e":[e.id]}];return Qu(e.kind)&&n.push({kinds:[Ap],"#a":[nv(e)]}),t.timeline(n)}}function C6(e){return typeof e=="string"&&(e={pubkey:e}),t=>t.replaceable({kind:Ce.RelayList,pubkey:e.pubkey,relays:e.relays}).pipe(lr(n=>n&&{inboxes:d6(n),outboxes:h6(n)}))}function I6(e){return typeof e=="string"&&(e={pubkey:e}),t=>t.replaceable({kind:Ce.Mutelist,pubkey:e.pubkey,relays:e.relays}).pipe(Qv(t),lr(n=>n&&m6(n)))}function T6(e){return typeof e=="string"&&(e={pubkey:e}),t=>t.replaceable({kind:Ce.Metadata,pubkey:e.pubkey,relays:e.relays}).pipe(Gt(N_),lr(n=>n&&Bv(n)),vh(void 0))}function U6(e){return t=>t.timeline(Pn(e.kind)?[{kinds:[Ce.Reaction],"#e":[e.id]},{kinds:[Ce.Reaction],"#a":[Xi(e)]}]:[{kinds:[Ce.Reaction],"#e":[e.id]}])}const L6={kinds:[Ce.ShortTextNote]};function O6(e,t){const n=new Map,r=new Map,{kinds:i}={...L6,...t};let o="";const s={},a={kinds:i};return I_(e)?(o=_p(e),s.kinds=[e.kind],s.authors=[e.pubkey],s["#d"]=[e.identifier],a["#a"]=[o]):typeof e=="string"?(o=e,s.ids=[e],a["#e"]=[e]):(o=e.id,s.ids=[e.id],a["#e"]=[e.id]),u=>u.filters([s,a]).pipe(lr(l=>{var f,c;if(!r.has(Xi(l))){const p=x6(l),y=n.get(Xi(l))||new Set,E={event:l,refs:p,replies:y};for(const w of y)w.parent=E;if((f=p.reply)!=null&&f.e||(c=p.reply)!=null&&c.a){let w=p.reply.e?p.reply.e.id:_p(p.reply.a);if(E.parent=r.get(w),E.parent)E.parent.replies.add(E);else{let A=n.get(w);A||(A=new Set,n.set(w,A)),A.add(E)}}r.set(Xi(l),E)}return{root:r.get(o),all:r}}))}class Zo{constructor(){ye(this,"database");ye(this,"keepOldVersions",!1);ye(this,"keepExpired",!1);ye(this,"verifyEvent");ye(this,"insert$");ye(this,"update$");ye(this,"remove$");ye(this,"eventLoader");ye(this,"replaceableLoader");ye(this,"addressableLoader");ye(this,"deletedIds",new Set);ye(this,"deletedCoords",new Map);ye(this,"expirations",new Map);ye(this,"expirationTimeout",null);ye(this,"nextExpirationCheck",null);ye(this,"models",new Map);ye(this,"modelKeepWarm",6e4);this.database=new q_,this.database.onBeforeInsert=t=>!(this.verifyEvent&&this.verifyEvent(t)===!1),this.database.insert$.subscribe(t=>{Reflect.set(t,wp,this)}),this.database.remove$.subscribe(t=>{Reflect.deleteProperty(t,wp)}),this.insert$=this.database.insert$,this.update$=this.database.update$,this.remove$=this.database.remove$}checkDeleted(t){var n;if(typeof t=="string")return this.deletedIds.has(t);if(this.deletedIds.has(t.id))return!0;if(Qu(t.kind)){const r=(n=t.tags.find(o=>o[0]==="d"))==null?void 0:n[1],i=this.deletedCoords.get(Ur(t.kind,t.pubkey,r));if(i)return i>t.created_at}return!1}addExpiration(t){const n=Gl(t);n&&Number.isFinite(n)&&this.expirations.set(t.id,n)}handleExpiringEvent(t){const n=Gl(t);if(!n||(this.expirations.set(t.id,n),this.expirationTimeout&&this.nextExpirationCheck&&this.nextExpirationChecka[0]==="d"))==null?void 0:s[1]:void 0;if(!this.keepOldVersions&&Pn(t.kind)){const a=this.database.getReplaceableHistory(t.kind,t.pubkey,i);if(a&&a.length>0&&a[0].created_at>=t.created_at)return Zo.mergeDuplicateEvent(t,a[0]),a[0]}else if(this.database.hasEvent(t.id)){const a=this.database.getEvent(t.id);if(a)return Zo.mergeDuplicateEvent(t,a),a}const o=this.database.add(t);if(o===null)return null;if(t!==o&&Zo.mergeDuplicateEvent(t,o),n&&xp(o,n),!this.keepOldVersions&&Pn(t.kind)){const a=this.database.getReplaceableHistory(t.kind,t.pubkey,i);if(a){const u=Array.from(a).filter(l=>l.created_at{r.get(i)===o&&r.delete(i)};o=t(...n)(this).pipe(Pu(s),r3({connector:()=>new yx(1),resetOnComplete:()=>X0(this.modelKeepWarm),resetOnRefCountZero:()=>X0(this.modelKeepWarm)})),r.set(i,o)}return o}filters(t,n=!1){return t=Array.isArray(t)?t:[t],Ru(n?Xn:$n(this.getByFilters(t)),this.insert$.pipe(Gt(r=>df(t,r))))}removed(t){return this.checkDeleted(t)?Xn:this.remove$.pipe(Gt(r=>r.id===t),Xx(1),Sd(()=>Xn))}updated(t){return this.database.update$.pipe(Gt(n=>n.id===t||n===t))}event(t){return typeof t=="string"&&(t={id:t}),this.model(Zv,t)}replaceable(...t){let n;if(t.length===1)n=t[0];else if(t.length===3||t.length===2){let[r,i,o]=t;n={kind:r,pubkey:i,identifier:o}}if(!n)throw new Error("Invalid arguments, expected address pointer or kind, pubkey, identifier");return this.model(vf,n)}addressable(t){return this.model(vf,t)}timeline(t,n=!1){return this.model(S6,t,n)}profile(t){return this.model(T6,t)}contacts(t){return typeof t=="string"&&(t={pubkey:t}),this.model(B6,t)}mutes(t){return typeof t=="string"&&(t={pubkey:t}),this.model(I6,t)}mailboxes(t){return typeof t=="string"&&(t={pubkey:t}),this.model(C6,t)}blossomServers(t){return typeof t=="string"&&(t={pubkey:t}),this.model(L_,t)}reactions(t){return this.model(U6,t)}thread(t){return this.model(O6,t)}comments(t){return this.model(A6,t)}events(t){return this.model(k6,t)}replaceableSet(t){return this.model(_6,t)}}const Yv=St.createContext(null);function N6({eventStore:e,children:t}){return be.jsx(Yv.Provider,{value:e,children:t})}var $p;(function(e){e.UNSPENT="UNSPENT",e.PENDING="PENDING",e.SPENT="SPENT"})($p||($p={}));var co;(function(e){e.UNPAID="UNPAID",e.PENDING="PENDING",e.PAID="PAID"})(co||(co={}));var fu;(function(e){e.UNPAID="UNPAID",e.PAID="PAID",e.ISSUED="ISSUED"})(fu||(fu={}));var Mp;(function(e){e.POST="post",e.NOSTR="nostr"})(Mp||(Mp={}));var R6=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Hp=function(e){R6(t,e);function t(n,r){var i=e.call(this,n)||this;return i.status=r,i}return t}(Error),di=function(){return di=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function j6(e){var t=e1(e),n=t[0],r=t[1];return(n+r)*3/4-r}function D6(e,t,n){return(t+n)*3/4-n}function z6(e){var t,n=e1(e),r=n[0],i=n[1],o=new H6(D6(e,r,i)),s=0,a=i>0?r-4:r,u;for(u=0;u>16&255,o[s++]=t>>8&255,o[s++]=t&255;return i===2&&(t=rn[e.charCodeAt(u)]<<2|rn[e.charCodeAt(u+1)]>>4,o[s++]=t&255),i===1&&(t=rn[e.charCodeAt(u)]<<10|rn[e.charCodeAt(u+1)]<<4|rn[e.charCodeAt(u+2)]>>2,o[s++]=t>>8&255,o[s++]=t&255),o}function K6(e){return Un[e>>18&63]+Un[e>>12&63]+Un[e>>6&63]+Un[e&63]}function V6(e,t,n){for(var r,i=[],o=t;oa?a:s+o));return r===1?(t=e[n-1],i.push(Un[t>>2]+Un[t<<4&63]+"==")):r===2&&(t=(e[n-2]<<8)+e[n-1],i.push(Un[t>>10]+Un[t>>4&63]+Un[t<<2&63]+"=")),i.join("")}var bh={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */bh.read=function(e,t,n,r,i){var o,s,a=i*8-r-1,u=(1<>1,f=-7,c=n?i-1:0,p=n?-1:1,y=e[t+c];for(c+=p,o=y&(1<<-f)-1,y>>=-f,f+=a;f>0;o=o*256+e[t+c],c+=p,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=r;f>0;s=s*256+e[t+c],c+=p,f-=8);if(o===0)o=1-l;else{if(o===u)return s?NaN:(y?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-l}return(y?-1:1)*s*Math.pow(2,o-r)};bh.write=function(e,t,n,r,i,o){var s,a,u,l=o*8-i-1,f=(1<>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=r?0:o-1,E=r?1:-1,w=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=f):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+c>=1?t+=p/u:t+=p*Math.pow(2,1-c),t*u>=2&&(s++,u/=2),s+c>=f?(a=0,s=f):s+c>=1?(a=(t*u-1)*Math.pow(2,i),s=s+c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;e[n+y]=a&255,y+=E,a/=256,i-=8);for(s=s<0;e[n+y]=s&255,y+=E,s/=256,l-=8);e[n+y-E]|=w*128};/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */(function(e){const t=Xu,n=bh,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=S,e.INSPECT_MAX_BYTES=50;const i=2147483647;e.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=o(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{const g=new Uint8Array(1),d={foo:function(){return 42}};return Object.setPrototypeOf(d,Uint8Array.prototype),Object.setPrototypeOf(g,d),g.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function s(g){if(g>i)throw new RangeError('The value "'+g+'" is invalid for option "size"');const d=new Uint8Array(g);return Object.setPrototypeOf(d,a.prototype),d}function a(g,d,h){if(typeof g=="number"){if(typeof d=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return c(g)}return u(g,d,h)}a.poolSize=8192;function u(g,d,h){if(typeof g=="string")return p(g,d);if(ArrayBuffer.isView(g))return E(g);if(g==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof g);if(Qe(g,ArrayBuffer)||g&&Qe(g.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Qe(g,SharedArrayBuffer)||g&&Qe(g.buffer,SharedArrayBuffer)))return w(g,d,h);if(typeof g=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const _=g.valueOf&&g.valueOf();if(_!=null&&_!==g)return a.from(_,d,h);const I=A(g);if(I)return I;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof g[Symbol.toPrimitive]=="function")return a.from(g[Symbol.toPrimitive]("string"),d,h);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof g)}a.from=function(g,d,h){return u(g,d,h)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function l(g){if(typeof g!="number")throw new TypeError('"size" argument must be of type number');if(g<0)throw new RangeError('The value "'+g+'" is invalid for option "size"')}function f(g,d,h){return l(g),g<=0?s(g):d!==void 0?typeof h=="string"?s(g).fill(d,h):s(g).fill(d):s(g)}a.alloc=function(g,d,h){return f(g,d,h)};function c(g){return l(g),s(g<0?0:v(g)|0)}a.allocUnsafe=function(g){return c(g)},a.allocUnsafeSlow=function(g){return c(g)};function p(g,d){if((typeof d!="string"||d==="")&&(d="utf8"),!a.isEncoding(d))throw new TypeError("Unknown encoding: "+d);const h=x(g,d)|0;let _=s(h);const I=_.write(g,d);return I!==h&&(_=_.slice(0,I)),_}function y(g){const d=g.length<0?0:v(g.length)|0,h=s(d);for(let _=0;_=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return g|0}function S(g){return+g!=g&&(g=0),a.alloc(+g)}a.isBuffer=function(d){return d!=null&&d._isBuffer===!0&&d!==a.prototype},a.compare=function(d,h){if(Qe(d,Uint8Array)&&(d=a.from(d,d.offset,d.byteLength)),Qe(h,Uint8Array)&&(h=a.from(h,h.offset,h.byteLength)),!a.isBuffer(d)||!a.isBuffer(h))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(d===h)return 0;let _=d.length,I=h.length;for(let O=0,j=Math.min(_,I);OI.length?(a.isBuffer(j)||(j=a.from(j)),j.copy(I,O)):Uint8Array.prototype.set.call(I,j,O);else if(a.isBuffer(j))j.copy(I,O);else throw new TypeError('"list" argument must be an Array of Buffers');O+=j.length}return I};function x(g,d){if(a.isBuffer(g))return g.length;if(ArrayBuffer.isView(g)||Qe(g,ArrayBuffer))return g.byteLength;if(typeof g!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof g);const h=g.length,_=arguments.length>2&&arguments[2]===!0;if(!_&&h===0)return 0;let I=!1;for(;;)switch(d){case"ascii":case"latin1":case"binary":return h;case"utf8":case"utf-8":return zt(g).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return h*2;case"hex":return h>>>1;case"base64":return me(g).length;default:if(I)return _?-1:zt(g).length;d=(""+d).toLowerCase(),I=!0}}a.byteLength=x;function L(g,d,h){let _=!1;if((d===void 0||d<0)&&(d=0),d>this.length||((h===void 0||h>this.length)&&(h=this.length),h<=0)||(h>>>=0,d>>>=0,h<=d))return"";for(g||(g="utf8");;)switch(g){case"hex":return k(this,d,h);case"utf8":case"utf-8":return z(this,d,h);case"ascii":return B(this,d,h);case"latin1":case"binary":return m(this,d,h);case"base64":return M(this,d,h);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,d,h);default:if(_)throw new TypeError("Unknown encoding: "+g);g=(g+"").toLowerCase(),_=!0}}a.prototype._isBuffer=!0;function N(g,d,h){const _=g[d];g[d]=g[h],g[h]=_}a.prototype.swap16=function(){const d=this.length;if(d%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let h=0;hh&&(d+=" ... "),""},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(d,h,_,I,O){if(Qe(d,Uint8Array)&&(d=a.from(d,d.offset,d.byteLength)),!a.isBuffer(d))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof d);if(h===void 0&&(h=0),_===void 0&&(_=d?d.length:0),I===void 0&&(I=0),O===void 0&&(O=this.length),h<0||_>d.length||I<0||O>this.length)throw new RangeError("out of range index");if(I>=O&&h>=_)return 0;if(I>=O)return-1;if(h>=_)return 1;if(h>>>=0,_>>>=0,I>>>=0,O>>>=0,this===d)return 0;let j=O-I,te=_-h;const ae=Math.min(j,te),ne=this.slice(I,O),fe=d.slice(h,_);for(let ce=0;ce2147483647?h=2147483647:h<-2147483648&&(h=-2147483648),h=+h,Ee(h)&&(h=I?0:g.length-1),h<0&&(h=g.length+h),h>=g.length){if(I)return-1;h=g.length-1}else if(h<0)if(I)h=0;else return-1;if(typeof d=="string"&&(d=a.from(d,_)),a.isBuffer(d))return d.length===0?-1:H(g,d,h,_,I);if(typeof d=="number")return d=d&255,typeof Uint8Array.prototype.indexOf=="function"?I?Uint8Array.prototype.indexOf.call(g,d,h):Uint8Array.prototype.lastIndexOf.call(g,d,h):H(g,[d],h,_,I);throw new TypeError("val must be string, number or Buffer")}function H(g,d,h,_,I){let O=1,j=g.length,te=d.length;if(_!==void 0&&(_=String(_).toLowerCase(),_==="ucs2"||_==="ucs-2"||_==="utf16le"||_==="utf-16le")){if(g.length<2||d.length<2)return-1;O=2,j/=2,te/=2,h/=2}function ae(fe,ce){return O===1?fe[ce]:fe.readUInt16BE(ce*O)}let ne;if(I){let fe=-1;for(ne=h;nej&&(h=j-te),ne=h;ne>=0;ne--){let fe=!0;for(let ce=0;ceI&&(_=I)):_=I;const O=d.length;_>O/2&&(_=O/2);let j;for(j=0;j<_;++j){const te=parseInt(d.substr(j*2,2),16);if(Ee(te))return j;g[h+j]=te}return j}function q(g,d,h,_){return Fn(zt(d,g.length-h),g,h,_)}function K(g,d,h,_){return Fn(Kt(d),g,h,_)}function P(g,d,h,_){return Fn(me(d),g,h,_)}function D(g,d,h,_){return Fn(Ct(d,g.length-h),g,h,_)}a.prototype.write=function(d,h,_,I){if(h===void 0)I="utf8",_=this.length,h=0;else if(_===void 0&&typeof h=="string")I=h,_=this.length,h=0;else if(isFinite(h))h=h>>>0,isFinite(_)?(_=_>>>0,I===void 0&&(I="utf8")):(I=_,_=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const O=this.length-h;if((_===void 0||_>O)&&(_=O),d.length>0&&(_<0||h<0)||h>this.length)throw new RangeError("Attempt to write outside buffer bounds");I||(I="utf8");let j=!1;for(;;)switch(I){case"hex":return F(this,d,h,_);case"utf8":case"utf-8":return q(this,d,h,_);case"ascii":case"latin1":case"binary":return K(this,d,h,_);case"base64":return P(this,d,h,_);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,d,h,_);default:if(j)throw new TypeError("Unknown encoding: "+I);I=(""+I).toLowerCase(),j=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function M(g,d,h){return d===0&&h===g.length?t.fromByteArray(g):t.fromByteArray(g.slice(d,h))}function z(g,d,h){h=Math.min(g.length,h);const _=[];let I=d;for(;I239?4:O>223?3:O>191?2:1;if(I+te<=h){let ae,ne,fe,ce;switch(te){case 1:O<128&&(j=O);break;case 2:ae=g[I+1],(ae&192)===128&&(ce=(O&31)<<6|ae&63,ce>127&&(j=ce));break;case 3:ae=g[I+1],ne=g[I+2],(ae&192)===128&&(ne&192)===128&&(ce=(O&15)<<12|(ae&63)<<6|ne&63,ce>2047&&(ce<55296||ce>57343)&&(j=ce));break;case 4:ae=g[I+1],ne=g[I+2],fe=g[I+3],(ae&192)===128&&(ne&192)===128&&(fe&192)===128&&(ce=(O&15)<<18|(ae&63)<<12|(ne&63)<<6|fe&63,ce>65535&&ce<1114112&&(j=ce))}}j===null?(j=65533,te=1):j>65535&&(j-=65536,_.push(j>>>10&1023|55296),j=56320|j&1023),_.push(j),I+=te}return C(_)}const b=4096;function C(g){const d=g.length;if(d<=b)return String.fromCharCode.apply(String,g);let h="",_=0;for(;__)&&(h=_);let I="";for(let O=d;O_&&(d=_),h<0?(h+=_,h<0&&(h=0)):h>_&&(h=_),hh)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(d,h,_){d=d>>>0,h=h>>>0,_||T(d,h,this.length);let I=this[d],O=1,j=0;for(;++j>>0,h=h>>>0,_||T(d,h,this.length);let I=this[d+--h],O=1;for(;h>0&&(O*=256);)I+=this[d+--h]*O;return I},a.prototype.readUint8=a.prototype.readUInt8=function(d,h){return d=d>>>0,h||T(d,1,this.length),this[d]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(d,h){return d=d>>>0,h||T(d,2,this.length),this[d]|this[d+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(d,h){return d=d>>>0,h||T(d,2,this.length),this[d]<<8|this[d+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(d,h){return d=d>>>0,h||T(d,4,this.length),(this[d]|this[d+1]<<8|this[d+2]<<16)+this[d+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(d,h){return d=d>>>0,h||T(d,4,this.length),this[d]*16777216+(this[d+1]<<16|this[d+2]<<8|this[d+3])},a.prototype.readBigUInt64LE=G(function(d){d=d>>>0,pe(d,"offset");const h=this[d],_=this[d+7];(h===void 0||_===void 0)&&le(d,this.length-8);const I=h+this[++d]*2**8+this[++d]*2**16+this[++d]*2**24,O=this[++d]+this[++d]*2**8+this[++d]*2**16+_*2**24;return BigInt(I)+(BigInt(O)<>>0,pe(d,"offset");const h=this[d],_=this[d+7];(h===void 0||_===void 0)&&le(d,this.length-8);const I=h*2**24+this[++d]*2**16+this[++d]*2**8+this[++d],O=this[++d]*2**24+this[++d]*2**16+this[++d]*2**8+_;return(BigInt(I)<>>0,h=h>>>0,_||T(d,h,this.length);let I=this[d],O=1,j=0;for(;++j=O&&(I-=Math.pow(2,8*h)),I},a.prototype.readIntBE=function(d,h,_){d=d>>>0,h=h>>>0,_||T(d,h,this.length);let I=h,O=1,j=this[d+--I];for(;I>0&&(O*=256);)j+=this[d+--I]*O;return O*=128,j>=O&&(j-=Math.pow(2,8*h)),j},a.prototype.readInt8=function(d,h){return d=d>>>0,h||T(d,1,this.length),this[d]&128?(255-this[d]+1)*-1:this[d]},a.prototype.readInt16LE=function(d,h){d=d>>>0,h||T(d,2,this.length);const _=this[d]|this[d+1]<<8;return _&32768?_|4294901760:_},a.prototype.readInt16BE=function(d,h){d=d>>>0,h||T(d,2,this.length);const _=this[d+1]|this[d]<<8;return _&32768?_|4294901760:_},a.prototype.readInt32LE=function(d,h){return d=d>>>0,h||T(d,4,this.length),this[d]|this[d+1]<<8|this[d+2]<<16|this[d+3]<<24},a.prototype.readInt32BE=function(d,h){return d=d>>>0,h||T(d,4,this.length),this[d]<<24|this[d+1]<<16|this[d+2]<<8|this[d+3]},a.prototype.readBigInt64LE=G(function(d){d=d>>>0,pe(d,"offset");const h=this[d],_=this[d+7];(h===void 0||_===void 0)&&le(d,this.length-8);const I=this[d+4]+this[d+5]*2**8+this[d+6]*2**16+(_<<24);return(BigInt(I)<>>0,pe(d,"offset");const h=this[d],_=this[d+7];(h===void 0||_===void 0)&&le(d,this.length-8);const I=(h<<24)+this[++d]*2**16+this[++d]*2**8+this[++d];return(BigInt(I)<>>0,h||T(d,4,this.length),n.read(this,d,!0,23,4)},a.prototype.readFloatBE=function(d,h){return d=d>>>0,h||T(d,4,this.length),n.read(this,d,!1,23,4)},a.prototype.readDoubleLE=function(d,h){return d=d>>>0,h||T(d,8,this.length),n.read(this,d,!0,52,8)},a.prototype.readDoubleBE=function(d,h){return d=d>>>0,h||T(d,8,this.length),n.read(this,d,!1,52,8)};function $(g,d,h,_,I,O){if(!a.isBuffer(g))throw new TypeError('"buffer" argument must be a Buffer instance');if(d>I||dg.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(d,h,_,I){if(d=+d,h=h>>>0,_=_>>>0,!I){const te=Math.pow(2,8*_)-1;$(this,d,h,_,te,0)}let O=1,j=0;for(this[h]=d&255;++j<_&&(O*=256);)this[h+j]=d/O&255;return h+_},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(d,h,_,I){if(d=+d,h=h>>>0,_=_>>>0,!I){const te=Math.pow(2,8*_)-1;$(this,d,h,_,te,0)}let O=_-1,j=1;for(this[h+O]=d&255;--O>=0&&(j*=256);)this[h+O]=d/j&255;return h+_},a.prototype.writeUint8=a.prototype.writeUInt8=function(d,h,_){return d=+d,h=h>>>0,_||$(this,d,h,1,255,0),this[h]=d&255,h+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(d,h,_){return d=+d,h=h>>>0,_||$(this,d,h,2,65535,0),this[h]=d&255,this[h+1]=d>>>8,h+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(d,h,_){return d=+d,h=h>>>0,_||$(this,d,h,2,65535,0),this[h]=d>>>8,this[h+1]=d&255,h+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(d,h,_){return d=+d,h=h>>>0,_||$(this,d,h,4,4294967295,0),this[h+3]=d>>>24,this[h+2]=d>>>16,this[h+1]=d>>>8,this[h]=d&255,h+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(d,h,_){return d=+d,h=h>>>0,_||$(this,d,h,4,4294967295,0),this[h]=d>>>24,this[h+1]=d>>>16,this[h+2]=d>>>8,this[h+3]=d&255,h+4};function V(g,d,h,_,I){de(d,_,I,g,h,7);let O=Number(d&BigInt(4294967295));g[h++]=O,O=O>>8,g[h++]=O,O=O>>8,g[h++]=O,O=O>>8,g[h++]=O;let j=Number(d>>BigInt(32)&BigInt(4294967295));return g[h++]=j,j=j>>8,g[h++]=j,j=j>>8,g[h++]=j,j=j>>8,g[h++]=j,h}function Y(g,d,h,_,I){de(d,_,I,g,h,7);let O=Number(d&BigInt(4294967295));g[h+7]=O,O=O>>8,g[h+6]=O,O=O>>8,g[h+5]=O,O=O>>8,g[h+4]=O;let j=Number(d>>BigInt(32)&BigInt(4294967295));return g[h+3]=j,j=j>>8,g[h+2]=j,j=j>>8,g[h+1]=j,j=j>>8,g[h]=j,h+8}a.prototype.writeBigUInt64LE=G(function(d,h=0){return V(this,d,h,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=G(function(d,h=0){return Y(this,d,h,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(d,h,_,I){if(d=+d,h=h>>>0,!I){const ae=Math.pow(2,8*_-1);$(this,d,h,_,ae-1,-ae)}let O=0,j=1,te=0;for(this[h]=d&255;++O<_&&(j*=256);)d<0&&te===0&&this[h+O-1]!==0&&(te=1),this[h+O]=(d/j>>0)-te&255;return h+_},a.prototype.writeIntBE=function(d,h,_,I){if(d=+d,h=h>>>0,!I){const ae=Math.pow(2,8*_-1);$(this,d,h,_,ae-1,-ae)}let O=_-1,j=1,te=0;for(this[h+O]=d&255;--O>=0&&(j*=256);)d<0&&te===0&&this[h+O+1]!==0&&(te=1),this[h+O]=(d/j>>0)-te&255;return h+_},a.prototype.writeInt8=function(d,h,_){return d=+d,h=h>>>0,_||$(this,d,h,1,127,-128),d<0&&(d=255+d+1),this[h]=d&255,h+1},a.prototype.writeInt16LE=function(d,h,_){return d=+d,h=h>>>0,_||$(this,d,h,2,32767,-32768),this[h]=d&255,this[h+1]=d>>>8,h+2},a.prototype.writeInt16BE=function(d,h,_){return d=+d,h=h>>>0,_||$(this,d,h,2,32767,-32768),this[h]=d>>>8,this[h+1]=d&255,h+2},a.prototype.writeInt32LE=function(d,h,_){return d=+d,h=h>>>0,_||$(this,d,h,4,2147483647,-2147483648),this[h]=d&255,this[h+1]=d>>>8,this[h+2]=d>>>16,this[h+3]=d>>>24,h+4},a.prototype.writeInt32BE=function(d,h,_){return d=+d,h=h>>>0,_||$(this,d,h,4,2147483647,-2147483648),d<0&&(d=4294967295+d+1),this[h]=d>>>24,this[h+1]=d>>>16,this[h+2]=d>>>8,this[h+3]=d&255,h+4},a.prototype.writeBigInt64LE=G(function(d,h=0){return V(this,d,h,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=G(function(d,h=0){return Y(this,d,h,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function X(g,d,h,_,I,O){if(h+_>g.length)throw new RangeError("Index out of range");if(h<0)throw new RangeError("Index out of range")}function ie(g,d,h,_,I){return d=+d,h=h>>>0,I||X(g,d,h,4),n.write(g,d,h,_,23,4),h+4}a.prototype.writeFloatLE=function(d,h,_){return ie(this,d,h,!0,_)},a.prototype.writeFloatBE=function(d,h,_){return ie(this,d,h,!1,_)};function ue(g,d,h,_,I){return d=+d,h=h>>>0,I||X(g,d,h,8),n.write(g,d,h,_,52,8),h+8}a.prototype.writeDoubleLE=function(d,h,_){return ue(this,d,h,!0,_)},a.prototype.writeDoubleBE=function(d,h,_){return ue(this,d,h,!1,_)},a.prototype.copy=function(d,h,_,I){if(!a.isBuffer(d))throw new TypeError("argument should be a Buffer");if(_||(_=0),!I&&I!==0&&(I=this.length),h>=d.length&&(h=d.length),h||(h=0),I>0&&I<_&&(I=_),I===_||d.length===0||this.length===0)return 0;if(h<0)throw new RangeError("targetStart out of bounds");if(_<0||_>=this.length)throw new RangeError("Index out of range");if(I<0)throw new RangeError("sourceEnd out of bounds");I>this.length&&(I=this.length),d.length-h>>0,_=_===void 0?this.length:_>>>0,d||(d=0);let O;if(typeof d=="number")for(O=h;O<_;++O)this[O]=d;else{const j=a.isBuffer(d)?d:a.from(d,I),te=j.length;if(te===0)throw new TypeError('The value "'+d+'" is invalid for argument "value"');for(O=0;O<_-h;++O)this[O+h]=j[O%te]}return this};const ee={};function re(g,d,h){ee[g]=class extends h{constructor(){super(),Object.defineProperty(this,"message",{value:d.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${g}]`,this.stack,delete this.name}get code(){return g}set code(I){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:I,writable:!0})}toString(){return`${this.name} [${g}]: ${this.message}`}}}re("ERR_BUFFER_OUT_OF_BOUNDS",function(g){return g?`${g} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),re("ERR_INVALID_ARG_TYPE",function(g,d){return`The "${g}" argument must be of type number. Received type ${typeof d}`},TypeError),re("ERR_OUT_OF_RANGE",function(g,d,h){let _=`The value of "${g}" is out of range.`,I=h;return Number.isInteger(h)&&Math.abs(h)>2**32?I=se(String(h)):typeof h=="bigint"&&(I=String(h),(h>BigInt(2)**BigInt(32)||h<-(BigInt(2)**BigInt(32)))&&(I=se(I)),I+="n"),_+=` It must be ${d}. Received ${I}`,_},RangeError);function se(g){let d="",h=g.length;const _=g[0]==="-"?1:0;for(;h>=_+4;h-=3)d=`_${g.slice(h-3,h)}${d}`;return`${g.slice(0,h)}${d}`}function we(g,d,h){pe(d,"offset"),(g[d]===void 0||g[d+h]===void 0)&&le(d,g.length-(h+1))}function de(g,d,h,_,I,O){if(g>h||g= 0${j} and < 2${j} ** ${(O+1)*8}${j}`:te=`>= -(2${j} ** ${(O+1)*8-1}${j}) and < 2 ** ${(O+1)*8-1}${j}`,new ee.ERR_OUT_OF_RANGE("value",te,g)}we(_,I,O)}function pe(g,d){if(typeof g!="number")throw new ee.ERR_INVALID_ARG_TYPE(d,"number",g)}function le(g,d,h){throw Math.floor(g)!==g?(pe(g,h),new ee.ERR_OUT_OF_RANGE("offset","an integer",g)):d<0?new ee.ERR_BUFFER_OUT_OF_BOUNDS:new ee.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${d}`,g)}const _e=/[^+/0-9A-Za-z-_]/g;function et(g){if(g=g.split("=")[0],g=g.trim().replace(_e,""),g.length<2)return"";for(;g.length%4!==0;)g=g+"=";return g}function zt(g,d){d=d||1/0;let h;const _=g.length;let I=null;const O=[];for(let j=0;j<_;++j){if(h=g.charCodeAt(j),h>55295&&h<57344){if(!I){if(h>56319){(d-=3)>-1&&O.push(239,191,189);continue}else if(j+1===_){(d-=3)>-1&&O.push(239,191,189);continue}I=h;continue}if(h<56320){(d-=3)>-1&&O.push(239,191,189),I=h;continue}h=(I-55296<<10|h-56320)+65536}else I&&(d-=3)>-1&&O.push(239,191,189);if(I=null,h<128){if((d-=1)<0)break;O.push(h)}else if(h<2048){if((d-=2)<0)break;O.push(h>>6|192,h&63|128)}else if(h<65536){if((d-=3)<0)break;O.push(h>>12|224,h>>6&63|128,h&63|128)}else if(h<1114112){if((d-=4)<0)break;O.push(h>>18|240,h>>12&63|128,h>>6&63|128,h&63|128)}else throw new Error("Invalid code point")}return O}function Kt(g){const d=[];for(let h=0;h>8,I=h%256,O.push(I),O.push(_);return O}function me(g){return t.toByteArray(et(g))}function Fn(g,d,h,_){let I;for(I=0;I<_&&!(I+h>=d.length||I>=g.length);++I)d[I+h]=g[I];return I}function Qe(g,d){return g instanceof d||g!=null&&g.constructor!=null&&g.constructor.name!=null&&g.constructor.name===d.name}function Ee(g){return g!==g}const Q=function(){const g="0123456789abcdef",d=new Array(256);for(let h=0;h<16;++h){const _=h*16;for(let I=0;I<16;++I)d[_+I]=g[h]+g[I]}return d}();function G(g){return typeof BigInt>"u"?W:g}function W(){throw new Error("BigInt not supported")}})(Ls);function W6(e){return Ls.Buffer.from(e,"base64")}function G6(e){var t=Ls.Buffer.from(Z6(e),"base64").toString(),n=JSON.parse(t);return n}function Z6(e){return e.replace(/-/g,"+").replace(/_/g,"/").split("=")[0]}var Ie={},Ju={};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.crypto=void 0;Ju.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;(function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.Hash=e.nextTick=e.swap32IfBE=e.byteSwapIfBE=e.swap8IfBE=e.isLE=void 0,e.isBytes=n,e.anumber=r,e.abytes=i,e.ahash=o,e.aexists=s,e.aoutput=a,e.u8=u,e.u32=l,e.clean=f,e.createView=c,e.rotr=p,e.rotl=y,e.byteSwap=E,e.byteSwap32=w,e.bytesToHex=S,e.hexToBytes=N,e.asyncLoop=H,e.utf8ToBytes=F,e.bytesToUtf8=q,e.toBytes=K,e.kdfInputToBytes=P,e.concatBytes=D,e.checkOpts=M,e.createHasher=b,e.createOptHasher=C,e.createXOFer=B,e.randomBytes=m;const t=Ju;function n(k){return k instanceof Uint8Array||ArrayBuffer.isView(k)&&k.constructor.name==="Uint8Array"}function r(k){if(!Number.isSafeInteger(k)||k<0)throw new Error("positive integer expected, got "+k)}function i(k,...U){if(!n(k))throw new Error("Uint8Array expected");if(U.length>0&&!U.includes(k.length))throw new Error("Uint8Array expected of length "+U+", got length="+k.length)}function o(k){if(typeof k!="function"||typeof k.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");r(k.outputLen),r(k.blockLen)}function s(k,U=!0){if(k.destroyed)throw new Error("Hash instance has been destroyed");if(U&&k.finished)throw new Error("Hash#digest() has already been called")}function a(k,U){i(k);const T=U.outputLen;if(k.length>>U}function y(k,U){return k<>>32-U>>>0}e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function E(k){return k<<24&4278190080|k<<8&16711680|k>>>8&65280|k>>>24&255}e.swap8IfBE=e.isLE?k=>k:k=>E(k),e.byteSwapIfBE=e.swap8IfBE;function w(k){for(let U=0;Uk:w;const A=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",v=Array.from({length:256},(k,U)=>U.toString(16).padStart(2,"0"));function S(k){if(i(k),A)return k.toHex();let U="";for(let T=0;T=x._0&&k<=x._9)return k-x._0;if(k>=x.A&&k<=x.F)return k-(x.A-10);if(k>=x.a&&k<=x.f)return k-(x.a-10)}function N(k){if(typeof k!="string")throw new Error("hex string expected, got "+typeof k);if(A)return Uint8Array.fromHex(k);const U=k.length,T=U/2;if(U%2)throw new Error("hex string expected, got unpadded hex of length "+U);const $=new Uint8Array(T);for(let V=0,Y=0;V{};e.nextTick=R;async function H(k,U,T){let $=Date.now();for(let V=0;V=0&&Yk().update(K($)).digest(),T=k();return U.outputLen=T.outputLen,U.blockLen=T.blockLen,U.create=()=>k(),U}function C(k){const U=($,V)=>k(V).update(K($)).digest(),T=k({});return U.outputLen=T.outputLen,U.blockLen=T.blockLen,U.create=$=>k($),U}function B(k){const U=($,V)=>k(V).update(K($)).digest(),T=k({});return U.outputLen=T.outputLen,U.blockLen=T.blockLen,U.create=$=>k($),U}e.wrapConstructor=b,e.wrapConstructorWithOpts=C,e.wrapXOFConstructorWithOpts=B;function m(k=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(k));if(t.crypto&&typeof t.crypto.randomBytes=="function")return Uint8Array.from(t.crypto.randomBytes(k));throw new Error("crypto.getRandomValues must be defined")}})(Ie);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const el=BigInt(0),ms=BigInt(1);function Q6(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function t1(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Eh(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?el:BigInt("0x"+e)}function Y6(e){return Eh(Ie.bytesToHex(e))}function X6(e){return Ie.abytes(e),Eh(Ie.bytesToHex(Uint8Array.from(e).reverse()))}function n1(e,t){return Ie.hexToBytes(e.toString(16).padStart(t*2,"0"))}function J6(e,t){return n1(e,t).reverse()}function eB(e){return Ie.hexToBytes(t1(e))}function tB(e,t,n){let r;if(typeof t=="string")try{r=Ie.hexToBytes(t)}catch(o){throw new Error(e+" must be hex string or Uint8Array, cause: "+o)}else if(Ie.isBytes(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const i=r.length;if(typeof n=="number"&&i!==n)throw new Error(e+" of length "+n+" expected, got "+i);return r}function nB(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r{const r=t.charCodeAt(0);if(t.length!==1||r>127)throw new Error(`string contains non-ASCII character "${e[n]}" with code ${r} at position ${n}`);return r})}const Yl=e=>typeof e=="bigint"&&el<=e;function r1(e,t,n){return Yl(e)&&Yl(t)&&Yl(n)&&t<=e&&eel;e>>=ms,t+=1);return t}function aB(e,t){return e>>BigInt(t)&ms}function uB(e,t,n){return e|(n?ms:el)<(ms<new Uint8Array(y),i=y=>Uint8Array.of(y);let o=r(e),s=r(e),a=0;const u=()=>{o.fill(1),s.fill(0),a=0},l=(...y)=>n(s,o,...y),f=(y=r(0))=>{s=l(i(0),y),o=l(),y.length!==0&&(s=l(i(1),y),o=l())},c=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let y=0;const E=[];for(;y{u(),f(y);let w;for(;!(w=E(c()));)f();return u(),w}}const fB={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Ie.isBytes(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function dB(e,t,n={}){const r=(i,o,s)=>{const a=fB[o];if(typeof a!="function")throw new Error("invalid validator function");const u=e[i];if(!(s&&u===void 0)&&!a(u,e))throw new Error("param "+String(i)+" is invalid. Expected "+o+", got "+u)};for(const[i,o]of Object.entries(t))r(i,o,!1);for(const[i,o]of Object.entries(n))r(i,o,!0);return e}function hB(e){return typeof e=="function"&&Number.isSafeInteger(e.outputLen)}const pB=()=>{throw new Error("not implemented")};function yB(e){const t=new WeakMap;return(n,...r)=>{const i=t.get(n);if(i!==void 0)return i;const o=e(n,...r);return t.set(n,o),o}}const gB=Ie.abytes,mB=Ie.anumber,du=Ie.bytesToHex,wB=Ie.bytesToUtf8,vB=Ie.concatBytes,bB=Ie.hexToBytes,EB=Ie.isBytes,xB=Ie.randomBytes,SB=Ie.utf8ToBytes,kB=Q6,_B=t1,BB=Eh,AB=Y6,CB=X6,IB=n1,TB=J6,UB=eB,LB=tB,OB=nB,NB=rB,RB=iB,PB=r1,$B=oB,MB=sB,HB=aB,FB=uB,jB=lB,DB=cB,zB=pB,KB=yB,VB=dB,qB=hB,WB=Object.freeze(Object.defineProperty({__proto__:null,aInRange:$B,abool:kB,abytes:gB,anumber:mB,asciiToBytes:RB,bitGet:HB,bitLen:MB,bitMask:jB,bitSet:FB,bytesToHex:du,bytesToNumberBE:AB,bytesToNumberLE:CB,bytesToUtf8:wB,concatBytes:vB,copyBytes:NB,createHmacDrbg:DB,ensureBytes:LB,equalBytes:OB,hexToBytes:bB,hexToNumber:BB,inRange:PB,isBytes:EB,isHash:qB,memoized:KB,notImplemented:zB,numberToBytesBE:IB,numberToBytesLE:TB,numberToHexUnpadded:_B,numberToVarBytesBE:UB,randomBytes:xB,utf8ToBytes:SB,validateObject:VB},Symbol.toStringTag,{value:"Module"}));function GB(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),u=r?4:0,l=r?0:4;e.setUint32(t+u,s,r),e.setUint32(t+l,a,r)}function ZB(e,t,n){return e&t^~e&n}function QB(e,t,n){return e&t^e&n^t&n}let YB=class extends bv{constructor(t,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=xa(this.buffer)}update(t){pf(this),t=Ts(t),ki(t);const{view:n,buffer:r,blockLen:i}=this,o=t.length;for(let s=0;si-s&&(this.process(r,0),s=0);for(let c=s;cf.length)throw new Error("_sha2: outputLen bigger than state");for(let c=0;c>>3,w=yn(y,17)^yn(y,19)^y>>>10;br[c]=w+br[c-7]+E+br[c-16]|0}let{A:r,B:i,C:o,D:s,E:a,F:u,G:l,H:f}=this;for(let c=0;c<64;c++){const p=yn(a,6)^yn(a,11)^yn(a,25),y=f+p+ZB(a,u,l)+XB[c]+br[c]|0,w=(yn(r,2)^yn(r,13)^yn(r,22))+QB(r,i,o)|0;f=l,l=u,u=a,a=s+y|0,s=o,o=i,i=r,r=y+w|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,f=f+this.H|0,this.set(r,i,o,s,a,u,l,f)}roundClean(){ou(br)}destroy(){this.set(0,0,0,0,0,0,0,0),ou(this.buffer)}},i1=class extends xh{constructor(){super(28),this.A=vr[0]|0,this.B=vr[1]|0,this.C=vr[2]|0,this.D=vr[3]|0,this.E=vr[4]|0,this.F=vr[5]|0,this.G=vr[6]|0,this.H=vr[7]|0}};const JB=Yu(()=>new xh),eA=Yu(()=>new i1),tA=xh,nA=JB,rA=i1,iA=eA,oA=Object.freeze(Object.defineProperty({__proto__:null,SHA224:rA,SHA256:tA,sha224:iA,sha256:nA},Symbol.toStringTag,{value:"Module"}));function sA(e){return typeof e=="number"||typeof e=="string"}function aA(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=hu(t,0);return n.value}function hu(e,t){if(t>=e.byteLength)throw new Error("Unexpected end of data");var n=e.getUint8(t++),r=n>>5,i=n&31;switch(r){case 0:return uA(e,t,i);case 1:return lA(e,t,i);case 2:return cA(e,t,i);case 3:return fA(e,t,i);case 4:return dA(e,t,i);case 5:return hA(e,t,i);case 7:return yA(e,t,i);default:throw new Error("Unsupported major type: ".concat(r))}}function Eo(e,t,n){if(n<24)return{value:n,offset:t};if(n===24)return{value:e.getUint8(t++),offset:t};if(n===25){var r=e.getUint16(t,!1);return t+=2,{value:r,offset:t}}if(n===26){var r=e.getUint32(t,!1);return t+=4,{value:r,offset:t}}if(n===27){var i=e.getUint32(t,!1),o=e.getUint32(t+4,!1);return t+=8,{value:i*Math.pow(2,32)+o,offset:t}}throw new Error("Unsupported length: ".concat(n))}function uA(e,t,n){var r=Eo(e,t,n),i=r.value,o=r.offset;return{value:i,offset:o}}function lA(e,t,n){var r=Eo(e,t,n),i=r.value,o=r.offset;return{value:-1-i,offset:o}}function cA(e,t,n){var r=Eo(e,t,n),i=r.value,o=r.offset;if(o+i>e.byteLength)throw new Error("Byte string length exceeds data length");var s=new Uint8Array(e.buffer,e.byteOffset+o,i);return{value:s,offset:o+i}}function fA(e,t,n){var r=Eo(e,t,n),i=r.value,o=r.offset;if(o+i>e.byteLength)throw new Error("String length exceeds data length");var s=new Uint8Array(e.buffer,e.byteOffset+o,i),a=new TextDecoder().decode(s);return{value:a,offset:o+i}}function dA(e,t,n){for(var r=Eo(e,t,n),i=r.value,o=r.offset,s=[],a=o,u=0;u>10,n=e&1023,r=e&32768?-1:1;return t===0?r*Math.pow(2,-14)*(n/1024):t===31?n?NaN:r*(1/0):r*Math.pow(2,t-15)*(1+n/1024)}function yA(e,t,n){if(n<24)switch(n){case 20:return{value:!1,offset:t};case 21:return{value:!0,offset:t};case 22:return{value:null,offset:t};case 23:return{value:void 0,offset:t};default:throw new Error("Unknown simple value: ".concat(n))}if(n===24)return{value:e.getUint8(t++),offset:t};if(n===25){var r=pA(e.getUint16(t,!1));return t+=2,{value:r,offset:t}}if(n===26){var r=e.getFloat32(t,!1);return t+=4,{value:r,offset:t}}if(n===27){var r=e.getFloat64(t,!1);return t+=8,{value:r,offset:t}}throw new Error("Unknown simple or float value: ".concat(n))}function Ii(e,t,n,r){if(n){if(n.reduce(function(o,s){return o+s},0)>e)throw new Error("Split is greater than total amount: ".concat(n.reduce(function(o,s){return o+s},0)," > ").concat(e));n.forEach(function(o){if(!gA(o,t))throw new Error("Provided amount preferences do not match the amounts of the mint keyset.")}),e=e-n.reduce(function(o,s){return o+s},0)}else n=[];var i=o1(t);return i.forEach(function(o){for(var s=Math.floor(e/o),a=0;at);++y)i.push(f)});var a=t-i.reduce(function(f,c){return f+c},0);if(a){var u=Ii(a,n);u.forEach(function(f){i.push(f)})}var l=i.sort(function(f,c){return f-c});return l}function o1(e,t){return t===void 0&&(t="desc"),t=="desc"?Object.keys(e).map(function(n){return parseInt(n)}).sort(function(n,r){return r-n}):Object.keys(e).map(function(n){return parseInt(n)}).sort(function(n,r){return n-r})}function gA(e,t){return e in t}function mA(e){return wA(du(e))}function wA(e){return BigInt("0x".concat(e))}function vA(e){var t=["web+cashu://","cashu://","cashu:","cashu"];return t.forEach(function(n){e.startsWith(n)&&(e=e.slice(n.length))}),bA(e)}function bA(e){var t=e.slice(0,1),n=e.slice(1);if(t==="A"){var r=G6(n);if(r.token.length>1)throw new Error("Multi entry token are not supported");var i=r.token[0],o={mint:i.mint,proofs:i.proofs,unit:r.unit||"sat"};return r.memo&&(o.memo=r.memo),o}else if(t==="B"){var s=W6(n),a=aA(s),u=[];a.t.forEach(function(f){return f.p.forEach(function(c){u.push({secret:c.s,C:du(c.c),amount:c.a,id:du(f.i)})})});var l={mint:a.m,proofs:u,unit:a.u||"sat"};return a.d&&(l.memo=a.d),l}throw new Error("Token version is not supported")}function Er(e){return typeof e=="object"}function Vt(){for(var e=[],t=0;t0&&(e.contact=e.contact.map(function(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="string"&&typeof t[1]=="string"?(console.warn("Mint returned deprecated 'contact' field: Update NUT-06: https://github.com/cashubtc/nuts/pull/117"),{method:t[0],info:t[1]}):t})),e}var Oe=function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(f){try{l(r.next(f))}catch(c){s(c)}}function u(f){try{l(r.throw(f))}catch(c){s(c)}}function l(f){f.done?o(f.value):i(f.value).then(a,u)}l((r=r.apply(e,t||[])).next())})},Ne=function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(f){return u([l,f])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,i=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]>i&o),a=Number(n&o),u=r?4:0,l=r?0:4;e.setUint32(t+u,s,r),e.setUint32(t+l,a,r)}function kA(e,t,n){return e&t^~e&n}function _A(e,t,n){return e&t^e&n^t&n}class BA extends Cn.Hash{constructor(t,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=(0,Cn.createView)(this.buffer)}update(t){(0,Cn.aexists)(this),t=(0,Cn.toBytes)(t),(0,Cn.abytes)(t);const{view:n,buffer:r,blockLen:i}=this,o=t.length;for(let s=0;si-s&&(this.process(r,0),s=0);for(let c=s;cf.length)throw new Error("_sha2: outputLen bigger than state");for(let c=0;c>bf&ra)}:{h:Number(e>>bf&ra)|0,l:Number(e&ra)|0}}function a1(e,t=!1){const n=e.length;let r=new Uint32Array(n),i=new Uint32Array(n);for(let o=0;oBigInt(e>>>0)<>>0);he.toBig=u1;const l1=(e,t,n)=>e>>>n;he.shrSH=l1;const c1=(e,t,n)=>e<<32-n|t>>>n;he.shrSL=c1;const f1=(e,t,n)=>e>>>n|t<<32-n;he.rotrSH=f1;const d1=(e,t,n)=>e<<32-n|t>>>n;he.rotrSL=d1;const h1=(e,t,n)=>e<<64-n|t>>>n-32;he.rotrBH=h1;const p1=(e,t,n)=>e>>>n-32|t<<64-n;he.rotrBL=p1;const y1=(e,t)=>t;he.rotr32H=y1;const g1=(e,t)=>e;he.rotr32L=g1;const m1=(e,t,n)=>e<>>32-n;he.rotlSH=m1;const w1=(e,t,n)=>t<>>32-n;he.rotlSL=w1;const v1=(e,t,n)=>t<>>64-n;he.rotlBH=v1;const b1=(e,t,n)=>e<>>64-n;he.rotlBL=b1;function E1(e,t,n,r){const i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}const x1=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0);he.add3L=x1;const S1=(e,t,n,r)=>t+n+r+(e/2**32|0)|0;he.add3H=S1;const k1=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0);he.add4L=k1;const _1=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0;he.add4H=_1;const B1=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0);he.add5L=B1;const A1=(e,t,n,r,i,o)=>t+n+r+i+o+(e/2**32|0)|0;he.add5H=A1;const AA={fromBig:Sh,split:a1,toBig:u1,shrSH:l1,shrSL:c1,rotrSH:f1,rotrSL:d1,rotrBH:h1,rotrBL:p1,rotr32H:y1,rotr32L:g1,rotlSH:m1,rotlSL:w1,rotlBH:v1,rotlBL:b1,add:E1,add3L:x1,add3H:S1,add4L:k1,add4H:_1,add5H:A1,add5L:B1};he.default=AA;Object.defineProperty(Be,"__esModule",{value:!0});Be.sha512_224=Be.sha512_256=Be.sha384=Be.sha512=Be.sha224=Be.sha256=Be.SHA512_256=Be.SHA512_224=Be.SHA384=Be.SHA512=Be.SHA224=Be.SHA256=void 0;const oe=mt,ge=he,Ve=Ie,CA=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),xr=new Uint32Array(64);class kh extends oe.HashMD{constructor(t=32){super(64,t,8,!1),this.A=oe.SHA256_IV[0]|0,this.B=oe.SHA256_IV[1]|0,this.C=oe.SHA256_IV[2]|0,this.D=oe.SHA256_IV[3]|0,this.E=oe.SHA256_IV[4]|0,this.F=oe.SHA256_IV[5]|0,this.G=oe.SHA256_IV[6]|0,this.H=oe.SHA256_IV[7]|0}get(){const{A:t,B:n,C:r,D:i,E:o,F:s,G:a,H:u}=this;return[t,n,r,i,o,s,a,u]}set(t,n,r,i,o,s,a,u){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=u|0}process(t,n){for(let c=0;c<16;c++,n+=4)xr[c]=t.getUint32(n,!1);for(let c=16;c<64;c++){const p=xr[c-15],y=xr[c-2],E=(0,Ve.rotr)(p,7)^(0,Ve.rotr)(p,18)^p>>>3,w=(0,Ve.rotr)(y,17)^(0,Ve.rotr)(y,19)^y>>>10;xr[c]=w+xr[c-7]+E+xr[c-16]|0}let{A:r,B:i,C:o,D:s,E:a,F:u,G:l,H:f}=this;for(let c=0;c<64;c++){const p=(0,Ve.rotr)(a,6)^(0,Ve.rotr)(a,11)^(0,Ve.rotr)(a,25),y=f+p+(0,oe.Chi)(a,u,l)+CA[c]+xr[c]|0,w=((0,Ve.rotr)(r,2)^(0,Ve.rotr)(r,13)^(0,Ve.rotr)(r,22))+(0,oe.Maj)(r,i,o)|0;f=l,l=u,u=a,a=s+y|0,s=o,o=i,i=r,r=y+w|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,u=u+this.F|0,l=l+this.G|0,f=f+this.H|0,this.set(r,i,o,s,a,u,l,f)}roundClean(){(0,Ve.clean)(xr)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,Ve.clean)(this.buffer)}}Be.SHA256=kh;class C1 extends kh{constructor(){super(28),this.A=oe.SHA224_IV[0]|0,this.B=oe.SHA224_IV[1]|0,this.C=oe.SHA224_IV[2]|0,this.D=oe.SHA224_IV[3]|0,this.E=oe.SHA224_IV[4]|0,this.F=oe.SHA224_IV[5]|0,this.G=oe.SHA224_IV[6]|0,this.H=oe.SHA224_IV[7]|0}}Be.SHA224=C1;const I1=ge.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),IA=I1[0],TA=I1[1],Sr=new Uint32Array(80),kr=new Uint32Array(80);class Ns extends oe.HashMD{constructor(t=64){super(128,t,16,!1),this.Ah=oe.SHA512_IV[0]|0,this.Al=oe.SHA512_IV[1]|0,this.Bh=oe.SHA512_IV[2]|0,this.Bl=oe.SHA512_IV[3]|0,this.Ch=oe.SHA512_IV[4]|0,this.Cl=oe.SHA512_IV[5]|0,this.Dh=oe.SHA512_IV[6]|0,this.Dl=oe.SHA512_IV[7]|0,this.Eh=oe.SHA512_IV[8]|0,this.El=oe.SHA512_IV[9]|0,this.Fh=oe.SHA512_IV[10]|0,this.Fl=oe.SHA512_IV[11]|0,this.Gh=oe.SHA512_IV[12]|0,this.Gl=oe.SHA512_IV[13]|0,this.Hh=oe.SHA512_IV[14]|0,this.Hl=oe.SHA512_IV[15]|0}get(){const{Ah:t,Al:n,Bh:r,Bl:i,Ch:o,Cl:s,Dh:a,Dl:u,Eh:l,El:f,Fh:c,Fl:p,Gh:y,Gl:E,Hh:w,Hl:A}=this;return[t,n,r,i,o,s,a,u,l,f,c,p,y,E,w,A]}set(t,n,r,i,o,s,a,u,l,f,c,p,y,E,w,A){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=a|0,this.Dl=u|0,this.Eh=l|0,this.El=f|0,this.Fh=c|0,this.Fl=p|0,this.Gh=y|0,this.Gl=E|0,this.Hh=w|0,this.Hl=A|0}process(t,n){for(let x=0;x<16;x++,n+=4)Sr[x]=t.getUint32(n),kr[x]=t.getUint32(n+=4);for(let x=16;x<80;x++){const L=Sr[x-15]|0,N=kr[x-15]|0,R=ge.rotrSH(L,N,1)^ge.rotrSH(L,N,8)^ge.shrSH(L,N,7),H=ge.rotrSL(L,N,1)^ge.rotrSL(L,N,8)^ge.shrSL(L,N,7),F=Sr[x-2]|0,q=kr[x-2]|0,K=ge.rotrSH(F,q,19)^ge.rotrBH(F,q,61)^ge.shrSH(F,q,6),P=ge.rotrSL(F,q,19)^ge.rotrBL(F,q,61)^ge.shrSL(F,q,6),D=ge.add4L(H,P,kr[x-7],kr[x-16]),M=ge.add4H(D,R,K,Sr[x-7],Sr[x-16]);Sr[x]=M|0,kr[x]=D|0}let{Ah:r,Al:i,Bh:o,Bl:s,Ch:a,Cl:u,Dh:l,Dl:f,Eh:c,El:p,Fh:y,Fl:E,Gh:w,Gl:A,Hh:v,Hl:S}=this;for(let x=0;x<80;x++){const L=ge.rotrSH(c,p,14)^ge.rotrSH(c,p,18)^ge.rotrBH(c,p,41),N=ge.rotrSL(c,p,14)^ge.rotrSL(c,p,18)^ge.rotrBL(c,p,41),R=c&y^~c&w,H=p&E^~p&A,F=ge.add5L(S,N,H,TA[x],kr[x]),q=ge.add5H(F,v,L,R,IA[x],Sr[x]),K=F|0,P=ge.rotrSH(r,i,28)^ge.rotrBH(r,i,34)^ge.rotrBH(r,i,39),D=ge.rotrSL(r,i,28)^ge.rotrBL(r,i,34)^ge.rotrBL(r,i,39),M=r&o^r&a^o&a,z=i&s^i&u^s&u;v=w|0,S=A|0,w=y|0,A=E|0,y=c|0,E=p|0,{h:c,l:p}=ge.add(l|0,f|0,q|0,K|0),l=a|0,f=u|0,a=o|0,u=s|0,o=r|0,s=i|0;const b=ge.add3L(K,D,z);r=ge.add3H(b,q,P,M),i=b|0}({h:r,l:i}=ge.add(this.Ah|0,this.Al|0,r|0,i|0)),{h:o,l:s}=ge.add(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:u}=ge.add(this.Ch|0,this.Cl|0,a|0,u|0),{h:l,l:f}=ge.add(this.Dh|0,this.Dl|0,l|0,f|0),{h:c,l:p}=ge.add(this.Eh|0,this.El|0,c|0,p|0),{h:y,l:E}=ge.add(this.Fh|0,this.Fl|0,y|0,E|0),{h:w,l:A}=ge.add(this.Gh|0,this.Gl|0,w|0,A|0),{h:v,l:S}=ge.add(this.Hh|0,this.Hl|0,v|0,S|0),this.set(r,i,o,s,a,u,l,f,c,p,y,E,w,A,v,S)}roundClean(){(0,Ve.clean)(Sr,kr)}destroy(){(0,Ve.clean)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}Be.SHA512=Ns;class T1 extends Ns{constructor(){super(48),this.Ah=oe.SHA384_IV[0]|0,this.Al=oe.SHA384_IV[1]|0,this.Bh=oe.SHA384_IV[2]|0,this.Bl=oe.SHA384_IV[3]|0,this.Ch=oe.SHA384_IV[4]|0,this.Cl=oe.SHA384_IV[5]|0,this.Dh=oe.SHA384_IV[6]|0,this.Dl=oe.SHA384_IV[7]|0,this.Eh=oe.SHA384_IV[8]|0,this.El=oe.SHA384_IV[9]|0,this.Fh=oe.SHA384_IV[10]|0,this.Fl=oe.SHA384_IV[11]|0,this.Gh=oe.SHA384_IV[12]|0,this.Gl=oe.SHA384_IV[13]|0,this.Hh=oe.SHA384_IV[14]|0,this.Hl=oe.SHA384_IV[15]|0}}Be.SHA384=T1;const ft=Uint32Array.from([2352822216,424955298,1944164710,2312950998,502970286,855612546,1738396948,1479516111,258812777,2077511080,2011393907,79989058,1067287976,1780299464,286451373,2446758561]),dt=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class U1 extends Ns{constructor(){super(28),this.Ah=ft[0]|0,this.Al=ft[1]|0,this.Bh=ft[2]|0,this.Bl=ft[3]|0,this.Ch=ft[4]|0,this.Cl=ft[5]|0,this.Dh=ft[6]|0,this.Dl=ft[7]|0,this.Eh=ft[8]|0,this.El=ft[9]|0,this.Fh=ft[10]|0,this.Fl=ft[11]|0,this.Gh=ft[12]|0,this.Gl=ft[13]|0,this.Hh=ft[14]|0,this.Hl=ft[15]|0}}Be.SHA512_224=U1;class L1 extends Ns{constructor(){super(32),this.Ah=dt[0]|0,this.Al=dt[1]|0,this.Bh=dt[2]|0,this.Bl=dt[3]|0,this.Ch=dt[4]|0,this.Cl=dt[5]|0,this.Dh=dt[6]|0,this.Dl=dt[7]|0,this.Eh=dt[8]|0,this.El=dt[9]|0,this.Fh=dt[10]|0,this.Fl=dt[11]|0,this.Gh=dt[12]|0,this.Gl=dt[13]|0,this.Hh=dt[14]|0,this.Hl=dt[15]|0}}Be.SHA512_256=L1;Be.sha256=(0,Ve.createHasher)(()=>new kh);Be.sha224=(0,Ve.createHasher)(()=>new C1);Be.sha512=(0,Ve.createHasher)(()=>new Ns);Be.sha384=(0,Ve.createHasher)(()=>new T1);Be.sha512_256=(0,Ve.createHasher)(()=>new L1);Be.sha512_224=(0,Ve.createHasher)(()=>new U1);var tl={},_h={},nl={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const t=Ie;class n extends t.Hash{constructor(o,s){super(),this.finished=!1,this.destroyed=!1,(0,t.ahash)(o);const a=(0,t.toBytes)(s);if(this.iHash=o.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const u=this.blockLen,l=new Uint8Array(u);l.set(a.length>u?o.create().update(a).digest():a);for(let f=0;fnew n(i,o).update(s).digest();e.hmac=r,e.hmac.create=(i,o)=>new n(i,o)})(nl);const Rs=mu(C_);var xo={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.notImplemented=e.bitMask=e.utf8ToBytes=e.randomBytes=e.isBytes=e.hexToBytes=e.concatBytes=e.bytesToUtf8=e.bytesToHex=e.anumber=e.abytes=void 0,e.abool=o,e._abool2=s,e._abytes2=a,e.numberToHexUnpadded=u,e.hexToNumber=l,e.bytesToNumberBE=f,e.bytesToNumberLE=c,e.numberToBytesBE=p,e.numberToBytesLE=y,e.numberToVarBytesBE=E,e.ensureBytes=w,e.equalBytes=A,e.copyBytes=v,e.asciiToBytes=S,e.inRange=L,e.aInRange=N,e.bitLen=R,e.bitGet=H,e.bitSet=F,e.createHmacDrbg=K,e.validateObject=D,e.isHash=M,e._validateObject=z,e.memoized=C;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=Ie;var n=Ie;Object.defineProperty(e,"abytes",{enumerable:!0,get:function(){return n.abytes}}),Object.defineProperty(e,"anumber",{enumerable:!0,get:function(){return n.anumber}}),Object.defineProperty(e,"bytesToHex",{enumerable:!0,get:function(){return n.bytesToHex}}),Object.defineProperty(e,"bytesToUtf8",{enumerable:!0,get:function(){return n.bytesToUtf8}}),Object.defineProperty(e,"concatBytes",{enumerable:!0,get:function(){return n.concatBytes}}),Object.defineProperty(e,"hexToBytes",{enumerable:!0,get:function(){return n.hexToBytes}}),Object.defineProperty(e,"isBytes",{enumerable:!0,get:function(){return n.isBytes}}),Object.defineProperty(e,"randomBytes",{enumerable:!0,get:function(){return n.randomBytes}}),Object.defineProperty(e,"utf8ToBytes",{enumerable:!0,get:function(){return n.utf8ToBytes}});const r=BigInt(0),i=BigInt(1);function o(B,m){if(typeof m!="boolean")throw new Error(B+" boolean expected, got "+m)}function s(B,m=""){if(typeof B!="boolean"){const k=m&&`"${m}"`;throw new Error(k+"expected boolean, got type="+typeof B)}return B}function a(B,m,k=""){const U=(0,t.isBytes)(B),T=B==null?void 0:B.length,$=m!==void 0;if(!U||$&&T!==m){const V=k&&`"${k}" `,Y=$?` of length ${m}`:"",X=U?`length=${T}`:`type=${typeof B}`;throw new Error(V+"expected Uint8Array"+Y+", got "+X)}return B}function u(B){const m=B.toString(16);return m.length&1?"0"+m:m}function l(B){if(typeof B!="string")throw new Error("hex string expected, got "+typeof B);return B===""?r:BigInt("0x"+B)}function f(B){return l((0,t.bytesToHex)(B))}function c(B){return(0,t.abytes)(B),l((0,t.bytesToHex)(Uint8Array.from(B).reverse()))}function p(B,m){return(0,t.hexToBytes)(B.toString(16).padStart(m*2,"0"))}function y(B,m){return p(B,m).reverse()}function E(B){return(0,t.hexToBytes)(u(B))}function w(B,m,k){let U;if(typeof m=="string")try{U=(0,t.hexToBytes)(m)}catch($){throw new Error(B+" must be hex string or Uint8Array, cause: "+$)}else if((0,t.isBytes)(m))U=Uint8Array.from(m);else throw new Error(B+" must be hex string or Uint8Array");const T=U.length;if(typeof k=="number"&&T!==k)throw new Error(B+" of length "+k+" expected, got "+T);return U}function A(B,m){if(B.length!==m.length)return!1;let k=0;for(let U=0;U{const U=m.charCodeAt(0);if(m.length!==1||U>127)throw new Error(`string contains non-ASCII character "${B[k]}" with code ${U} at position ${k}`);return U})}const x=B=>typeof B=="bigint"&&r<=B;function L(B,m,k){return x(B)&&x(m)&&x(k)&&m<=B&&Br;B>>=i,m+=1);return m}function H(B,m){return B>>BigInt(m)&i}function F(B,m,k){return B|(k?i:r)<(i<new Uint8Array(se),T=se=>Uint8Array.of(se);let $=U(B),V=U(B),Y=0;const X=()=>{$.fill(1),V.fill(0),Y=0},ie=(...se)=>k(V,$,...se),ue=(se=U(0))=>{V=ie(T(0),se),$=ie(),se.length!==0&&(V=ie(T(1),se),$=ie())},ee=()=>{if(Y++>=1e3)throw new Error("drbg: tried 1000 values");let se=0;const we=[];for(;se{X(),ue(se);let de;for(;!(de=we(ee()));)ue();return X(),de}}const P={bigint:B=>typeof B=="bigint",function:B=>typeof B=="function",boolean:B=>typeof B=="boolean",string:B=>typeof B=="string",stringOrUint8Array:B=>typeof B=="string"||(0,t.isBytes)(B),isSafeInteger:B=>Number.isSafeInteger(B),array:B=>Array.isArray(B),field:(B,m)=>m.Fp.isValid(B),hash:B=>typeof B=="function"&&Number.isSafeInteger(B.outputLen)};function D(B,m,k={}){const U=(T,$,V)=>{const Y=P[$];if(typeof Y!="function")throw new Error("invalid validator function");const X=B[T];if(!(V&&X===void 0)&&!Y(X,B))throw new Error("param "+String(T)+" is invalid. Expected "+$+", got "+X)};for(const[T,$]of Object.entries(m))U(T,$,!1);for(const[T,$]of Object.entries(k))U(T,$,!0);return B}function M(B){return typeof B=="function"&&Number.isSafeInteger(B.outputLen)}function z(B,m,k={}){if(!B||typeof B!="object")throw new Error("expected valid options object");function U(T,$,V){const Y=B[T];if(V&&Y===void 0)return;const X=typeof Y;if(X!==$||Y===null)throw new Error(`param "${T}" is invalid: expected ${$}, got ${X}`)}Object.entries(m).forEach(([T,$])=>U(T,$,!1)),Object.entries(k).forEach(([T,$])=>U(T,$,!0))}const b=()=>{throw new Error("not implemented")};e.notImplemented=b;function C(B){const m=new WeakMap;return(k,...U)=>{const T=m.get(k);if(T!==void 0)return T;const $=B(k,...U);return m.set(k,$),$}}})(xo);var kn={},Ae={};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.isNegativeLE=void 0;Ae.mod=Tt;Ae.pow=OA;Ae.pow2=NA;Ae.invert=pu;Ae.tonelliShanks=Ah;Ae.FpSqrt=H1;Ae.validateField=HA;Ae.FpPow=Ch;Ae.FpInvertBatch=F1;Ae.FpDiv=FA;Ae.FpLegendre=yu;Ae.FpIsSquare=jA;Ae.nLength=Ih;Ae.Field=rl;Ae.FpSqrtOdd=DA;Ae.FpSqrtEven=zA;Ae.hashToPrivateScalar=KA;Ae.getFieldBytesLength=Th;Ae.getMinHashLength=j1;Ae.mapHashToField=VA;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ot=xo,Rt=BigInt(0),Ze=BigInt(1),ui=BigInt(2),O1=BigInt(3),N1=BigInt(4),R1=BigInt(5),UA=BigInt(7),P1=BigInt(8),LA=BigInt(9),$1=BigInt(16);function Tt(e,t){const n=e%t;return n>=Rt?n:t+n}function OA(e,t,n){return Ch(rl(n),e,t)}function NA(e,t,n){let r=e;for(;t-- >Rt;)r*=r,r%=n;return r}function pu(e,t){if(e===Rt)throw new Error("invert: expected non-zero number");if(t<=Rt)throw new Error("invert: expected positive modulus, got "+t);let n=Tt(e,t),r=t,i=Rt,o=Ze;for(;n!==Rt;){const a=r/n,u=r%n,l=i-o*a;r=n,n=u,i=o,o=l}if(r!==Ze)throw new Error("invert: does not exist");return Tt(i,t)}function Bh(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function M1(e,t){const n=(e.ORDER+Ze)/N1,r=e.pow(t,n);return Bh(e,r,t),r}function RA(e,t){const n=(e.ORDER-R1)/P1,r=e.mul(t,ui),i=e.pow(r,n),o=e.mul(t,i),s=e.mul(e.mul(o,ui),i),a=e.mul(o,e.sub(s,e.ONE));return Bh(e,a,t),a}function PA(e){const t=rl(e),n=Ah(e),r=n(t,t.neg(t.ONE)),i=n(t,r),o=n(t,t.neg(r)),s=(e+UA)/$1;return(a,u)=>{let l=a.pow(u,s),f=a.mul(l,r);const c=a.mul(l,i),p=a.mul(l,o),y=a.eql(a.sqr(f),u),E=a.eql(a.sqr(c),u);l=a.cmov(l,f,y),f=a.cmov(p,c,E);const w=a.eql(a.sqr(f),u),A=a.cmov(l,f,w);return Bh(a,A,u),A}}function Ah(e){if(e1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return M1;let o=i.pow(r,t);const s=(t+Ze)/ui;return function(u,l){if(u.is0(l))return l;if(yu(u,l)!==1)throw new Error("Cannot find square root");let f=n,c=u.mul(u.ONE,o),p=u.pow(l,t),y=u.pow(l,s);for(;!u.eql(p,u.ONE);){if(u.is0(p))return u.ZERO;let E=1,w=u.sqr(p);for(;!u.eql(w,u.ONE);)if(E++,w=u.sqr(w),E===f)throw new Error("Cannot find square root");const A=Ze<(Tt(e,t)&Ze)===Ze;Ae.isNegativeLE=$A;const MA=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function HA(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=MA.reduce((r,i)=>(r[i]="function",r),t);return(0,Ot._validateObject)(e,n),e}function Ch(e,t,n){if(nRt;)n&Ze&&(r=e.mul(r,i)),i=e.sqr(i),n>>=Ze;return r}function F1(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),i=t.reduce((s,a,u)=>e.is0(a)?s:(r[u]=s,e.mul(s,a)),e.ONE),o=e.inv(i);return t.reduceRight((s,a,u)=>e.is0(a)?s:(r[u]=e.mul(s,r[u]),e.mul(s,a)),o),r}function FA(e,t,n){return e.mul(t,typeof n=="bigint"?pu(n,e.ORDER):e.inv(n))}function yu(e,t){const n=(e.ORDER-Ze)/ui,r=e.pow(t,n),i=e.eql(r,e.ONE),o=e.eql(r,e.ZERO),s=e.eql(r,e.neg(e.ONE));if(!i&&!o&&!s)throw new Error("invalid Legendre symbol result");return i?1:o?0:-1}function jA(e,t){return yu(e,t)===1}function Ih(e,t){t!==void 0&&(0,Ot.anumber)(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function rl(e,t,n=!1,r={}){if(e<=Rt)throw new Error("invalid field: expected ORDER > 0, got "+e);let i,o,s=!1,a;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const p=t;p.BITS&&(i=p.BITS),p.sqrt&&(o=p.sqrt),typeof p.isLE=="boolean"&&(n=p.isLE),typeof p.modFromBytes=="boolean"&&(s=p.modFromBytes),a=p.allowedLengths}else typeof t=="number"&&(i=t),r.sqrt&&(o=r.sqrt);const{nBitLength:u,nByteLength:l}=Ih(e,i);if(l>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let f;const c=Object.freeze({ORDER:e,isLE:n,BITS:u,BYTES:l,MASK:(0,Ot.bitMask)(u),ZERO:Rt,ONE:Ze,allowedLengths:a,create:p=>Tt(p,e),isValid:p=>{if(typeof p!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof p);return Rt<=p&&pp===Rt,isValidNot0:p=>!c.is0(p)&&c.isValid(p),isOdd:p=>(p&Ze)===Ze,neg:p=>Tt(-p,e),eql:(p,y)=>p===y,sqr:p=>Tt(p*p,e),add:(p,y)=>Tt(p+y,e),sub:(p,y)=>Tt(p-y,e),mul:(p,y)=>Tt(p*y,e),pow:(p,y)=>Ch(c,p,y),div:(p,y)=>Tt(p*pu(y,e),e),sqrN:p=>p*p,addN:(p,y)=>p+y,subN:(p,y)=>p-y,mulN:(p,y)=>p*y,inv:p=>pu(p,e),sqrt:o||(p=>(f||(f=H1(e)),f(c,p))),toBytes:p=>n?(0,Ot.numberToBytesLE)(p,l):(0,Ot.numberToBytesBE)(p,l),fromBytes:(p,y=!0)=>{if(a){if(!a.includes(p.length)||p.length>l)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+p.length);const w=new Uint8Array(l);w.set(p,n?0:w.length-p.length),p=w}if(p.length!==l)throw new Error("Field.fromBytes: expected "+l+" bytes, got "+p.length);let E=n?(0,Ot.bytesToNumberLE)(p):(0,Ot.bytesToNumberBE)(p);if(s&&(E=Tt(E,e)),!y&&!c.isValid(E))throw new Error("invalid field element: outside of range 0..ORDER");return E},invertBatch:p=>F1(c,p),cmov:(p,y,E)=>E?y:p});return Object.freeze(c)}function DA(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const n=e.sqrt(t);return e.isOdd(n)?n:e.neg(n)}function zA(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const n=e.sqrt(t);return e.isOdd(n)?e.neg(n):n}function KA(e,t,n=!1){e=(0,Ot.ensureBytes)("privateHash",e);const r=e.length,i=Ih(t).nByteLength+8;if(i<24||r1024)throw new Error("hashToPrivateScalar: expected "+i+"-1024 bytes of input, got "+r);const o=n?(0,Ot.bytesToNumberLE)(e):(0,Ot.bytesToNumberBE)(e);return Tt(o,t-Ze)+Ze}function Th(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function j1(e){const t=Th(e);return t+Math.ceil(t/2)}function VA(e,t,n=!1){const r=e.length,i=Th(t),o=j1(t);if(r<16||r1024)throw new Error("expected "+o+"-1024 bytes of input, got "+r);const s=n?(0,Ot.bytesToNumberLE)(e):(0,Ot.bytesToNumberBE)(e),a=Tt(s,t-Ze)+Ze;return n?(0,Ot.numberToBytesLE)(a,i):(0,Ot.numberToBytesBE)(a,i)}Object.defineProperty(kn,"__esModule",{value:!0});kn.wNAF=void 0;kn.negateCt=Ef;kn.normalizeZ=qA;kn.mulEndoUnsafe=GA;kn.pippenger=ZA;kn.precomputeMSMUnsafe=QA;kn.validateBasic=YA;kn._createCurveFields=XA;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ws=xo,vs=Ae,fo=BigInt(0),li=BigInt(1);function Ef(e,t){const n=t.negate();return e?n:t}function qA(e,t){const n=(0,vs.FpInvertBatch)(e.Fp,t.map(r=>r.Z));return t.map((r,i)=>e.fromAffine(r.toAffine(n[i])))}function Uh(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Jl(e,t){Uh(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),i=2**e,o=(0,ws.bitMask)(e),s=BigInt(e);return{windows:n,windowSize:r,mask:o,maxNumber:i,shiftBy:s}}function Dp(e,t,n){const{windowSize:r,mask:i,maxNumber:o,shiftBy:s}=n;let a=Number(e&i),u=e>>s;a>r&&(a-=o,u+=li);const l=t*r,f=l+Math.abs(a)-1,c=a===0,p=a<0,y=t%2!==0;return{nextN:u,offset:f,isZero:c,isNeg:p,isNegF:y,offsetF:l}}function D1(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function z1(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const ec=new WeakMap,K1=new WeakMap;function tc(e){return K1.get(e)||1}function zp(e){if(e!==fo)throw new Error("invalid wNAF")}class WA{constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let i=t;for(;n>fo;)n&li&&(r=r.add(i)),i=i.double(),n>>=li;return r}precomputeWindow(t,n){const{windows:r,windowSize:i}=Jl(n,this.bits),o=[];let s=t,a=s;for(let u=0;ufo||r>fo;)n&li&&(o=o.add(i)),r&li&&(s=s.add(i)),i=i.double(),n>>=li,r>>=li;return{p1:o,p2:s}}function ZA(e,t,n,r){D1(n,e),z1(r,t);const i=n.length,o=r.length;if(i!==o)throw new Error("arrays of points and scalars must have equal length");const s=e.ZERO,a=(0,ws.bitLen)(BigInt(i));let u=1;a>12?u=a-3:a>4?u=a-2:a>0&&(u=2);const l=(0,ws.bitMask)(u),f=new Array(Number(l)+1).fill(s),c=Math.floor((t.BITS-1)/u)*u;let p=s;for(let y=c;y>=0;y-=u){f.fill(s);for(let w=0;w>BigInt(y)&l);f[v]=f[v].add(n[w])}let E=s;for(let w=f.length-1,A=s;w>0;w--)A=A.add(f[w]),E=E.add(A);if(p=p.add(E),y!==0)for(let w=0;w{const f=[];for(let c=0,p=l;c{if(z1(l,t),l.length>n.length)throw new Error("array of scalars must be smaller than array of points");let f=i;for(let c=0;c>p&a);w&&(f=f.add(u[y][w-1]))}}return f}}function YA(e){return(0,vs.validateField)(e.Fp),(0,ws.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,vs.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function Kp(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return(0,vs.validateField)(t),t}else return(0,vs.Field)(e,{isLE:n})}function XA(e,t,n={},r){if(r===void 0&&(r=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const u of["p","n","h"]){const l=t[u];if(!(typeof l=="bigint"&&l>fo))throw new Error(`CURVE.${u} must be positive bigint`)}const i=Kp(t.p,n.Fp,r),o=Kp(t.n,n.Fn,r),a=["Gx","Gy","a",e==="weierstrass"?"b":"d"];for(const u of a)if(!i.isValid(t[u]))throw new Error(`CURVE.${u} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:i,Fn:o}}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=e.DERErr=void 0,e._splitEndoScalar=a,e._normFnElement=A,e.weierstrassN=v,e.SWUFpSqrtRatio=x,e.mapToCurveSimpleSWU=L,e.ecdh=R,e.ecdsa=H,e.weierstrassPoints=F,e._legacyHelperEquat=P,e.weierstrass=z;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=nl,n=Rs,r=xo,i=kn,o=Ae,s=(b,C)=>(b+(b>=0?C:-C)/y)/C;function a(b,C,B){const[[m,k],[U,T]]=C,$=s(T*b,B),V=s(-k*b,B);let Y=b-$*m-V*U,X=-$*k-V*T;const ie=Y=ee||X=ee)throw new Error("splitScalar (endomorphism): failed, k="+b);return{k1neg:ie,k1:Y,k2neg:ue,k2:X}}function u(b){if(!["compact","recovered","der"].includes(b))throw new Error('Signature format must be "compact", "recovered", or "der"');return b}function l(b,C){const B={};for(let m of Object.keys(C))B[m]=b[m]===void 0?C[m]:b[m];return(0,r._abool2)(B.lowS,"lowS"),(0,r._abool2)(B.prehash,"prehash"),B.format!==void 0&&u(B.format),B}class f extends Error{constructor(C=""){super(C)}}e.DERErr=f,e.DER={Err:f,_tlv:{encode:(b,C)=>{const{Err:B}=e.DER;if(b<0||b>256)throw new B("tlv.encode: wrong tag");if(C.length&1)throw new B("tlv.encode: unpadded data");const m=C.length/2,k=(0,r.numberToHexUnpadded)(m);if(k.length/2&128)throw new B("tlv.encode: long form length too big");const U=m>127?(0,r.numberToHexUnpadded)(k.length/2|128):"";return(0,r.numberToHexUnpadded)(b)+U+k+C},decode(b,C){const{Err:B}=e.DER;let m=0;if(b<0||b>256)throw new B("tlv.encode: wrong tag");if(C.length<2||C[m++]!==b)throw new B("tlv.decode: wrong tlv");const k=C[m++],U=!!(k&128);let T=0;if(!U)T=k;else{const V=k&127;if(!V)throw new B("tlv.decode(long): indefinite length not supported");if(V>4)throw new B("tlv.decode(long): byte length is too big");const Y=C.subarray(m,m+V);if(Y.length!==V)throw new B("tlv.decode: length bytes not complete");if(Y[0]===0)throw new B("tlv.decode(long): zero leftmost byte");for(const X of Y)T=T<<8|X;if(m+=V,T<128)throw new B("tlv.decode(long): not minimal encoding")}const $=C.subarray(m,m+T);if($.length!==T)throw new B("tlv.decode: wrong value length");return{v:$,l:C.subarray(m+T)}}},_int:{encode(b){const{Err:C}=e.DER;if(b{const{X:G,Y:W,Z:g}=Ee;if(m.eql(g,m.ONE))return{x:G,y:W};const d=Ee.is0();Q==null&&(Q=d?m.ONE:m.inv(g));const h=m.mul(G,Q),_=m.mul(W,Q),I=m.mul(g,Q);if(d)return{x:m.ZERO,y:m.ZERO};if(!m.eql(I,m.ONE))throw new Error("invZ was invalid");return{x:h,y:_}}),Kt=(0,r.memoized)(Ee=>{if(Ee.is0()){if(C.allowInfinityPoint&&!m.is0(Ee.Y))return;throw new Error("bad point: ZERO")}const{x:Q,y:G}=Ee.toAffine();if(!m.isValid(Q)||!m.isValid(G))throw new Error("bad point: x or y not field elements");if(!we(Q,G))throw new Error("bad point: equation left != right");if(!Ee.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function Ct(Ee,Q,G,W,g){return G=new me(m.mul(G.X,Ee),G.Y,G.Z),Q=(0,i.negateCt)(W,Q),G=(0,i.negateCt)(g,G),Q.add(G)}class me{constructor(Q,G,W){this.X=le("x",Q),this.Y=le("y",G,!0),this.Z=le("z",W),Object.freeze(this)}static CURVE(){return U}static fromAffine(Q){const{x:G,y:W}=Q||{};if(!Q||!m.isValid(G)||!m.isValid(W))throw new Error("invalid affine point");if(Q instanceof me)throw new Error("projective point not allowed");return m.is0(G)&&m.is0(W)?me.ZERO:new me(G,W,m.ONE)}static fromBytes(Q){const G=me.fromAffine(re((0,r._abytes2)(Q,void 0,"point")));return G.assertValidity(),G}static fromHex(Q){return me.fromBytes((0,r.ensureBytes)("pointHex",Q))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(Q=8,G=!0){return Qe.createCache(this,Q),G||this.multiply(E),this}assertValidity(){Kt(this)}hasEvenY(){const{y:Q}=this.toAffine();if(!m.isOdd)throw new Error("Field doesn't support isOdd");return!m.isOdd(Q)}equals(Q){_e(Q);const{X:G,Y:W,Z:g}=this,{X:d,Y:h,Z:_}=Q,I=m.eql(m.mul(G,_),m.mul(d,g)),O=m.eql(m.mul(W,_),m.mul(h,g));return I&&O}negate(){return new me(this.X,m.neg(this.Y),this.Z)}double(){const{a:Q,b:G}=U,W=m.mul(G,E),{X:g,Y:d,Z:h}=this;let _=m.ZERO,I=m.ZERO,O=m.ZERO,j=m.mul(g,g),te=m.mul(d,d),ae=m.mul(h,h),ne=m.mul(g,d);return ne=m.add(ne,ne),O=m.mul(g,h),O=m.add(O,O),_=m.mul(Q,O),I=m.mul(W,ae),I=m.add(_,I),_=m.sub(te,I),I=m.add(te,I),I=m.mul(_,I),_=m.mul(ne,_),O=m.mul(W,O),ae=m.mul(Q,ae),ne=m.sub(j,ae),ne=m.mul(Q,ne),ne=m.add(ne,O),O=m.add(j,j),j=m.add(O,j),j=m.add(j,ae),j=m.mul(j,ne),I=m.add(I,j),ae=m.mul(d,h),ae=m.add(ae,ae),j=m.mul(ae,ne),_=m.sub(_,j),O=m.mul(ae,te),O=m.add(O,O),O=m.add(O,O),new me(_,I,O)}add(Q){_e(Q);const{X:G,Y:W,Z:g}=this,{X:d,Y:h,Z:_}=Q;let I=m.ZERO,O=m.ZERO,j=m.ZERO;const te=U.a,ae=m.mul(U.b,E);let ne=m.mul(G,d),fe=m.mul(W,h),ce=m.mul(g,_),It=m.add(G,W),Fe=m.add(d,h);It=m.mul(It,Fe),Fe=m.add(ne,fe),It=m.sub(It,Fe),Fe=m.add(G,g);let ut=m.add(d,_);return Fe=m.mul(Fe,ut),ut=m.add(ne,ce),Fe=m.sub(Fe,ut),ut=m.add(W,g),I=m.add(h,_),ut=m.mul(ut,I),I=m.add(fe,ce),ut=m.sub(ut,I),j=m.mul(te,Fe),I=m.mul(ae,ce),j=m.add(I,j),I=m.sub(fe,j),j=m.add(fe,j),O=m.mul(I,j),fe=m.add(ne,ne),fe=m.add(fe,ne),ce=m.mul(te,ce),Fe=m.mul(ae,Fe),fe=m.add(fe,ce),ce=m.sub(ne,ce),ce=m.mul(te,ce),Fe=m.add(Fe,ce),ne=m.mul(fe,Fe),O=m.add(O,ne),ne=m.mul(ut,Fe),I=m.mul(It,I),I=m.sub(I,ne),ne=m.mul(It,fe),j=m.mul(ut,j),j=m.add(j,ne),new me(I,O,j)}subtract(Q){return this.add(Q.negate())}is0(){return this.equals(me.ZERO)}multiply(Q){const{endo:G}=C;if(!k.isValidNot0(Q))throw new Error("invalid scalar: out of range");let W,g;const d=h=>Qe.cached(this,h,_=>(0,i.normalizeZ)(me,_));if(G){const{k1neg:h,k1:_,k2neg:I,k2:O}=et(Q),{p:j,f:te}=d(_),{p:ae,f:ne}=d(O);g=te.add(ne),W=Ct(G.beta,j,ae,h,I)}else{const{p:h,f:_}=d(Q);W=h,g=_}return(0,i.normalizeZ)(me,[W,g])[0]}multiplyUnsafe(Q){const{endo:G}=C,W=this;if(!k.isValid(Q))throw new Error("invalid scalar: out of range");if(Q===c||W.is0())return me.ZERO;if(Q===p)return W;if(Qe.hasCache(this))return this.multiply(Q);if(G){const{k1neg:g,k1:d,k2neg:h,k2:_}=et(Q),{p1:I,p2:O}=(0,i.mulEndoUnsafe)(me,W,d,_);return Ct(G.beta,I,O,g,h)}else return Qe.unsafe(W,Q)}multiplyAndAddUnsafe(Q,G,W){const g=this.multiplyUnsafe(G).add(Q.multiplyUnsafe(W));return g.is0()?void 0:g}toAffine(Q){return zt(this,Q)}isTorsionFree(){const{isTorsionFree:Q}=C;return T===p?!0:Q?Q(me,this):Qe.unsafe(this,$).is0()}clearCofactor(){const{clearCofactor:Q}=C;return T===p?this:Q?Q(me,this):this.multiplyUnsafe(T)}isSmallOrder(){return this.multiplyUnsafe(T).is0()}toBytes(Q=!0){return(0,r._abool2)(Q,"isCompressed"),this.assertValidity(),ee(me,this,Q)}toHex(Q=!0){return(0,r.bytesToHex)(this.toBytes(Q))}toString(){return``}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(Q=!0){return this.toBytes(Q)}_setWindowSize(Q){this.precompute(Q)}static normalizeZ(Q){return(0,i.normalizeZ)(me,Q)}static msm(Q,G){return(0,i.pippenger)(me,k,Q,G)}static fromPrivateKey(Q){return me.BASE.multiply(A(k,Q))}}me.BASE=new me(U.Gx,U.Gy,m.ONE),me.ZERO=new me(m.ZERO,m.ONE,m.ZERO),me.Fp=m,me.Fn=k;const Fn=k.BITS,Qe=new i.wNAF(me,C.endo?Math.ceil(Fn/2):Fn);return me.BASE.precompute(8),me}function S(b){return Uint8Array.of(b?2:3)}function x(b,C){const B=b.ORDER;let m=c;for(let re=B-p;re%y===c;re/=y)m+=p;const k=m,U=y<{let we=ie,de=b.pow(se,Y),pe=b.sqr(de);pe=b.mul(pe,se);let le=b.mul(re,pe);le=b.pow(le,V),le=b.mul(le,de),de=b.mul(le,se),pe=b.mul(le,re);let _e=b.mul(pe,de);le=b.pow(_e,X);let et=b.eql(le,b.ONE);de=b.mul(pe,ue),le=b.mul(_e,we),pe=b.cmov(de,pe,et),_e=b.cmov(le,_e,et);for(let zt=k;zt>p;zt--){let Kt=zt-y;Kt=y<{let pe=b.sqr(de);const le=b.mul(we,de);pe=b.mul(pe,le);let _e=b.pow(pe,re);_e=b.mul(_e,le);const et=b.mul(_e,se),zt=b.mul(b.sqr(_e),de),Kt=b.eql(zt,we);let Ct=b.cmov(et,_e,Kt);return{isValid:Kt,value:Ct}}}return ee}function L(b,C){(0,o.validateField)(b);const{A:B,B:m,Z:k}=C;if(!b.isValid(B)||!b.isValid(m)||!b.isValid(k))throw new Error("mapToCurveSimpleSWU: invalid opts");const U=x(b,k);if(!b.isOdd)throw new Error("Field does not have .isOdd()");return T=>{let $,V,Y,X,ie,ue,ee,re;$=b.sqr(T),$=b.mul($,k),V=b.sqr($),V=b.add(V,$),Y=b.add(V,b.ONE),Y=b.mul(Y,m),X=b.cmov(k,b.neg(V),!b.eql(V,b.ZERO)),X=b.mul(X,B),V=b.sqr(Y),ue=b.sqr(X),ie=b.mul(ue,B),V=b.add(V,ie),V=b.mul(V,Y),ue=b.mul(ue,X),ie=b.mul(ue,m),V=b.add(V,ie),ee=b.mul($,Y);const{isValid:se,value:we}=U(V,ue);re=b.mul($,T),re=b.mul(re,we),ee=b.cmov(ee,Y,se),re=b.cmov(re,we,se);const de=b.isOdd(T)===b.isOdd(re);re=b.cmov(b.neg(re),re,de);const pe=(0,o.FpInvertBatch)(b,[X],!0)[0];return ee=b.mul(ee,pe),{x:ee,y:re}}}function N(b,C){return{secretKey:C.BYTES,publicKey:1+b.BYTES,publicKeyUncompressed:1+2*b.BYTES,publicKeyHasPrefix:!0,signature:2*C.BYTES}}function R(b,C={}){const{Fn:B}=b,m=C.randomBytes||r.randomBytes,k=Object.assign(N(b.Fp,B),{seed:(0,o.getMinHashLength)(B.ORDER)});function U(ee){try{return!!A(B,ee)}catch{return!1}}function T(ee,re){const{publicKey:se,publicKeyUncompressed:we}=k;try{const de=ee.length;return re===!0&&de!==se||re===!1&&de!==we?!1:!!b.fromBytes(ee)}catch{return!1}}function $(ee=m(k.seed)){return(0,o.mapHashToField)((0,r._abytes2)(ee,k.seed,"seed"),B.ORDER)}function V(ee,re=!0){return b.BASE.multiply(A(B,ee)).toBytes(re)}function Y(ee){const re=$(ee);return{secretKey:re,publicKey:V(re)}}function X(ee){if(typeof ee=="bigint")return!1;if(ee instanceof b)return!0;const{secretKey:re,publicKey:se,publicKeyUncompressed:we}=k;if(B.allowedLengths||re===se)return;const de=(0,r.ensureBytes)("key",ee).length;return de===se||de===we}function ie(ee,re,se=!0){if(X(ee)===!0)throw new Error("first arg must be private key");if(X(re)===!1)throw new Error("second arg must be public key");const we=A(B,ee);return b.fromHex(re).multiply(we).toBytes(se)}return Object.freeze({getPublicKey:V,getSharedSecret:ie,keygen:Y,Point:b,utils:{isValidSecretKey:U,isValidPublicKey:T,randomSecretKey:$,isValidPrivateKey:U,randomPrivateKey:$,normPrivateKeyToScalar:ee=>A(B,ee),precompute(ee=8,re=b.BASE){return re.precompute(ee,!1)}},lengths:k})}function H(b,C,B={}){(0,n.ahash)(C),(0,r._validateObject)(B,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const m=B.randomBytes||r.randomBytes,k=B.hmac||((G,...W)=>(0,t.hmac)(C,G,(0,r.concatBytes)(...W))),{Fp:U,Fn:T}=b,{ORDER:$,BITS:V}=T,{keygen:Y,getPublicKey:X,getSharedSecret:ie,utils:ue,lengths:ee}=R(b,B),re={prehash:!1,lowS:typeof B.lowS=="boolean"?B.lowS:!1,format:void 0,extraEntropy:!1},se="compact";function we(G){const W=$>>p;return G>W}function de(G,W){if(!T.isValidNot0(W))throw new Error(`invalid signature ${G}: out of range 1..Point.Fn.ORDER`);return W}function pe(G,W){u(W);const g=ee.signature,d=W==="compact"?g:W==="recovered"?g+1:void 0;return(0,r._abytes2)(G,d,`${W} signature`)}class le{constructor(W,g,d){this.r=de("r",W),this.s=de("s",g),d!=null&&(this.recovery=d),Object.freeze(this)}static fromBytes(W,g=se){pe(W,g);let d;if(g==="der"){const{r:O,s:j}=e.DER.toSig((0,r._abytes2)(W));return new le(O,j)}g==="recovered"&&(d=W[0],g="compact",W=W.subarray(1));const h=T.BYTES,_=W.subarray(0,h),I=W.subarray(h,h*2);return new le(T.fromBytes(_),T.fromBytes(I),d)}static fromHex(W,g){return this.fromBytes((0,r.hexToBytes)(W),g)}addRecoveryBit(W){return new le(this.r,this.s,W)}recoverPublicKey(W){const g=U.ORDER,{r:d,s:h,recovery:_}=this;if(_==null||![0,1,2,3].includes(_))throw new Error("recovery id invalid");if($*y1)throw new Error("recovery id is ambiguous for h>1 curve");const O=_===2||_===3?d+$:d;if(!U.isValid(O))throw new Error("recovery id 2 or 3 invalid");const j=U.toBytes(O),te=b.fromBytes((0,r.concatBytes)(S((_&1)===0),j)),ae=T.inv(O),ne=et((0,r.ensureBytes)("msgHash",W)),fe=T.create(-ne*ae),ce=T.create(h*ae),It=b.BASE.multiplyUnsafe(fe).add(te.multiplyUnsafe(ce));if(It.is0())throw new Error("point at infinify");return It.assertValidity(),It}hasHighS(){return we(this.s)}toBytes(W=se){if(u(W),W==="der")return(0,r.hexToBytes)(e.DER.hexFromSig(this));const g=T.toBytes(this.r),d=T.toBytes(this.s);if(W==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return(0,r.concatBytes)(Uint8Array.of(this.recovery),g,d)}return(0,r.concatBytes)(g,d)}toHex(W){return(0,r.bytesToHex)(this.toBytes(W))}assertValidity(){}static fromCompact(W){return le.fromBytes((0,r.ensureBytes)("sig",W),"compact")}static fromDER(W){return le.fromBytes((0,r.ensureBytes)("sig",W),"der")}normalizeS(){return this.hasHighS()?new le(this.r,T.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return(0,r.bytesToHex)(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return(0,r.bytesToHex)(this.toBytes("compact"))}}const _e=B.bits2int||function(W){if(W.length>8192)throw new Error("input is too large");const g=(0,r.bytesToNumberBE)(W),d=W.length*8-V;return d>0?g>>BigInt(d):g},et=B.bits2int_modN||function(W){return T.create(_e(W))},zt=(0,r.bitMask)(V);function Kt(G){return(0,r.aInRange)("num < 2^"+V,G,c,zt),T.toBytes(G)}function Ct(G,W){return(0,r._abytes2)(G,void 0,"message"),W?(0,r._abytes2)(C(G),void 0,"prehashed message"):G}function me(G,W,g){if(["recovered","canonical"].some(fe=>fe in g))throw new Error("sign() legacy options not supported");const{lowS:d,prehash:h,extraEntropy:_}=l(g,re);G=Ct(G,h);const I=et(G),O=A(T,W),j=[Kt(O),Kt(I)];if(_!=null&&_!==!1){const fe=_===!0?m(ee.secretKey):_;j.push((0,r.ensureBytes)("extraEntropy",fe))}const te=(0,r.concatBytes)(...j),ae=I;function ne(fe){const ce=_e(fe);if(!T.isValidNot0(ce))return;const It=T.inv(ce),Fe=b.BASE.multiply(ce).toAffine(),ut=T.create(Fe.x);if(ut===c)return;const $s=T.create(It*T.create(ae+ut*O));if($s===c)return;let Rh=(Fe.x===ut?0:2)|Number(Fe.y&p),Ph=$s;return d&&we($s)&&(Ph=T.neg($s),Rh^=1),new le(ut,Ph,Rh)}return{seed:te,k2sig:ne}}function Fn(G,W,g={}){G=(0,r.ensureBytes)("message",G);const{seed:d,k2sig:h}=me(G,W,g);return(0,r.createHmacDrbg)(C.outputLen,T.BYTES,k)(d,h)}function Qe(G){let W;const g=typeof G=="string"||(0,r.isBytes)(G),d=!g&&G!==null&&typeof G=="object"&&typeof G.r=="bigint"&&typeof G.s=="bigint";if(!g&&!d)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(d)W=new le(G.r,G.s);else if(g){try{W=le.fromBytes((0,r.ensureBytes)("sig",G),"der")}catch(h){if(!(h instanceof e.DER.Err))throw h}if(!W)try{W=le.fromBytes((0,r.ensureBytes)("sig",G),"compact")}catch{return!1}}return W||!1}function Ee(G,W,g,d={}){const{lowS:h,prehash:_,format:I}=l(d,re);if(g=(0,r.ensureBytes)("publicKey",g),W=Ct((0,r.ensureBytes)("message",W),_),"strict"in d)throw new Error("options.strict was renamed to lowS");const O=I===void 0?Qe(G):le.fromBytes((0,r.ensureBytes)("sig",G),I);if(O===!1)return!1;try{const j=b.fromBytes(g);if(h&&O.hasHighS())return!1;const{r:te,s:ae}=O,ne=et(W),fe=T.inv(ae),ce=T.create(ne*fe),It=T.create(te*fe),Fe=b.BASE.multiplyUnsafe(ce).add(j.multiplyUnsafe(It));return Fe.is0()?!1:T.create(Fe.x)===te}catch{return!1}}function Q(G,W,g={}){const{prehash:d}=l(g,re);return W=Ct(W,d),le.fromBytes(G,"recovered").recoverPublicKey(W).toBytes()}return Object.freeze({keygen:Y,getPublicKey:X,getSharedSecret:ie,utils:ue,lengths:ee,Point:b,sign:Fn,verify:Ee,recoverPublicKey:Q,Signature:le,hash:C})}function F(b){const{CURVE:C,curveOpts:B}=q(b),m=v(C,B);return D(b,m)}function q(b){const C={a:b.a,b:b.b,p:b.Fp.ORDER,n:b.n,h:b.h,Gx:b.Gx,Gy:b.Gy},B=b.Fp;let m=b.allowedPrivateKeyLengths?Array.from(new Set(b.allowedPrivateKeyLengths.map(T=>Math.ceil(T/2)))):void 0;const k=(0,o.Field)(C.n,{BITS:b.nBitLength,allowedLengths:m,modFromBytes:b.wrapPrivateKey}),U={Fp:B,Fn:k,allowInfinityPoint:b.allowInfinityPoint,endo:b.endo,isTorsionFree:b.isTorsionFree,clearCofactor:b.clearCofactor,fromBytes:b.fromBytes,toBytes:b.toBytes};return{CURVE:C,curveOpts:U}}function K(b){const{CURVE:C,curveOpts:B}=q(b),m={hmac:b.hmac,randomBytes:b.randomBytes,lowS:b.lowS,bits2int:b.bits2int,bits2int_modN:b.bits2int_modN};return{CURVE:C,curveOpts:B,hash:b.hash,ecdsaOpts:m}}function P(b,C,B){function m(k){const U=b.sqr(k),T=b.mul(U,k);return b.add(b.add(T,b.mul(k,C)),B)}return m}function D(b,C){const{Fp:B,Fn:m}=C;function k(T){return(0,r.inRange)(T,p,m.ORDER)}const U=P(B,b.a,b.b);return Object.assign({},{CURVE:b,Point:C,ProjectivePoint:C,normPrivateKeyToScalar:T=>A(m,T),weierstrassEquation:U,isWithinCurveOrder:k})}function M(b,C){const B=C.Point;return Object.assign({},C,{ProjectivePoint:B,CURVE:Object.assign({},b,(0,o.nLength)(B.Fn.ORDER,B.Fn.BITS))})}function z(b){const{CURVE:C,curveOpts:B,hash:m,ecdsaOpts:k}=K(b),U=v(C,B),T=H(U,m,k);return M(b,T)}})(_h);Object.defineProperty(tl,"__esModule",{value:!0});tl.getHash=e5;tl.createCurve=t5;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const JA=_h;function e5(e){return{hash:e}}function t5(e,t){const n=r=>(0,JA.weierstrass)({...e,hash:r});return{...n(t),create:n}}var V1={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._DST_scalar=void 0,e.expand_message_xmd=u,e.expand_message_xof=l,e.hash_to_field=f,e.isogenyMap=c,e.createHasher=p;const t=xo,n=Ae,r=t.bytesToNumberBE;function i(y,E){if(s(y),s(E),y<0||y>=1<<8*E)throw new Error("invalid I2OSP input: "+y);const w=Array.from({length:E}).fill(0);for(let A=E-1;A>=0;A--)w[A]=y&255,y>>>=8;return new Uint8Array(w)}function o(y,E){const w=new Uint8Array(y.length);for(let A=0;A255&&(E=A((0,t.concatBytes)((0,t.utf8ToBytes)("H2C-OVERSIZE-DST-"),E)));const{outputLen:v,blockLen:S}=A,x=Math.ceil(w/v);if(w>65535||x>255)throw new Error("expand_message_xmd: invalid lenInBytes");const L=(0,t.concatBytes)(E,i(E.length,1)),N=i(0,S),R=i(w,2),H=new Array(x),F=A((0,t.concatBytes)(N,y,R,i(0,1),L));H[0]=A((0,t.concatBytes)(F,i(1,1),L));for(let K=1;K<=x;K++){const P=[o(F,H[K-1]),i(K+1,1),L];H[K]=A((0,t.concatBytes)(...P))}return(0,t.concatBytes)(...H).slice(0,w)}function l(y,E,w,A,v){if((0,t.abytes)(y),s(w),E=a(E),E.length>255){const S=Math.ceil(2*A/8);E=v.create({dkLen:S}).update((0,t.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(E).digest()}if(w>65535||E.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return v.create({dkLen:w}).update(y).update(i(w,2)).update(E).update(i(E.length,1)).digest()}function f(y,E,w){(0,t._validateObject)(w,{p:"bigint",m:"number",k:"number",hash:"function"});const{p:A,k:v,m:S,hash:x,expand:L,DST:N}=w;if(!(0,t.isHash)(w.hash))throw new Error("expected valid hash");(0,t.abytes)(y),s(E);const R=A.toString(2).length,H=Math.ceil((R+v)/8),F=E*S*H;let q;if(L==="xmd")q=u(y,N,F,x);else if(L==="xof")q=l(y,N,F,v,x);else if(L==="_internal_pass")q=y;else throw new Error('expand must be "xmd" or "xof"');const K=new Array(E);for(let P=0;PArray.from(A).reverse());return(A,v)=>{const[S,x,L,N]=w.map(F=>F.reduce((q,K)=>y.add(y.mul(q,A),K))),[R,H]=(0,n.FpInvertBatch)(y,[x,N],!0);return A=y.mul(S,R),v=y.mul(v,y.mul(L,H)),{x:A,y:v}}}e._DST_scalar=(0,t.utf8ToBytes)("HashToScalar-");function p(y,E,w){if(typeof E!="function")throw new Error("mapToCurve() must be defined");function A(S){return y.fromAffine(E(S))}function v(S){const x=S.clearCofactor();return x.equals(y.ZERO)?y.ZERO:(x.assertValidity(),x)}return{defaults:w,hashToCurve(S,x){const L=Object.assign({},w,x),N=f(S,2,L),R=A(N[0]),H=A(N[1]);return v(R.add(H))},encodeToCurve(S,x){const L=w.encodeDST?{DST:w.encodeDST}:{},N=Object.assign({},w,L,x),R=f(S,1,N),H=A(R[0]);return v(H)},mapToCurve(S){if(!Array.isArray(S))throw new Error("expected array of bigints");for(const x of S)if(typeof x!="bigint")throw new Error("expected array of bigints");return v(A(S))},hashToScalar(S,x){const L=y.Fn.ORDER,N=Object.assign({},w,{p:L,m:1,DST:e._DST_scalar},x);return f(S,1,N)[0][0]}}}})(V1);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.secp256k1_hasher=e.schnorr=e.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=Be,n=Ie,r=tl,i=V1,o=Ae,s=_h,a=xo,u={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},l={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},f=BigInt(0),c=BigInt(1),p=BigInt(2);function y(M){const z=u.p,b=BigInt(3),C=BigInt(6),B=BigInt(11),m=BigInt(22),k=BigInt(23),U=BigInt(44),T=BigInt(88),$=M*M*M%z,V=$*$*M%z,Y=(0,o.pow2)(V,b,z)*V%z,X=(0,o.pow2)(Y,b,z)*V%z,ie=(0,o.pow2)(X,p,z)*$%z,ue=(0,o.pow2)(ie,B,z)*ie%z,ee=(0,o.pow2)(ue,m,z)*ue%z,re=(0,o.pow2)(ee,U,z)*ee%z,se=(0,o.pow2)(re,T,z)*re%z,we=(0,o.pow2)(se,U,z)*ee%z,de=(0,o.pow2)(we,b,z)*V%z,pe=(0,o.pow2)(de,k,z)*ue%z,le=(0,o.pow2)(pe,C,z)*$%z,_e=(0,o.pow2)(le,p,z);if(!E.eql(E.sqr(_e),M))throw new Error("Cannot find square root");return _e}const E=(0,o.Field)(u.p,{sqrt:y});e.secp256k1=(0,r.createCurve)({...u,Fp:E,lowS:!0,endo:l},t.sha256);const w={};function A(M,...z){let b=w[M];if(b===void 0){const C=(0,t.sha256)((0,a.utf8ToBytes)(M));b=(0,a.concatBytes)(C,C),w[M]=b}return(0,t.sha256)((0,a.concatBytes)(b,...z))}const v=M=>M.toBytes(!0).slice(1),S=e.secp256k1.Point,x=M=>M%p===f;function L(M){const{Fn:z,BASE:b}=S,C=(0,s._normFnElement)(z,M),B=b.multiply(C);return{scalar:x(B.y)?C:z.neg(C),bytes:v(B)}}function N(M){const z=E;if(!z.isValidNot0(M))throw new Error("invalid x: Fail if x ≥ p");const b=z.create(M*M),C=z.create(b*M+BigInt(7));let B=z.sqrt(C);x(B)||(B=z.neg(B));const m=S.fromAffine({x:M,y:B});return m.assertValidity(),m}const R=a.bytesToNumberBE;function H(...M){return S.Fn.create(R(A("BIP0340/challenge",...M)))}function F(M){return L(M).bytes}function q(M,z,b=(0,n.randomBytes)(32)){const{Fn:C}=S,B=(0,a.ensureBytes)("message",M),{bytes:m,scalar:k}=L(z),U=(0,a.ensureBytes)("auxRand",b,32),T=C.toBytes(k^R(A("BIP0340/aux",U))),$=A("BIP0340/nonce",T,m,B),{bytes:V,scalar:Y}=L($),X=H(V,m,B),ie=new Uint8Array(64);if(ie.set(V,0),ie.set(C.toBytes(C.create(Y+X*k)),32),!K(ie,B,m))throw new Error("sign: Invalid signature produced");return ie}function K(M,z,b){const{Fn:C,BASE:B}=S,m=(0,a.ensureBytes)("signature",M,64),k=(0,a.ensureBytes)("message",z),U=(0,a.ensureBytes)("publicKey",b,32);try{const T=N(R(U)),$=R(m.subarray(0,32));if(!(0,a.inRange)($,c,u.p))return!1;const V=R(m.subarray(32,64));if(!(0,a.inRange)(V,c,u.n))return!1;const Y=H(C.toBytes($),v(T),k),X=B.multiplyUnsafe(V).add(T.multiplyUnsafe(C.neg(Y))),{x:ie,y:ue}=X.toAffine();return!(X.is0()||!x(ue)||ie!==$)}catch{return!1}}e.schnorr=(()=>{const b=(B=(0,n.randomBytes)(48))=>(0,o.mapHashToField)(B,u.n);e.secp256k1.utils.randomSecretKey;function C(B){const m=b(B);return{secretKey:m,publicKey:F(m)}}return{keygen:C,getPublicKey:F,sign:q,verify:K,Point:S,utils:{randomSecretKey:b,randomPrivateKey:b,taggedHash:A,lift_x:N,pointToBytes:v,numberToBytesBE:a.numberToBytesBE,bytesToNumberBE:a.bytesToNumberBE,mod:o.mod},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:32*2,seed:48}}})();const P=(0,i.isogenyMap)(E,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(M=>M.map(z=>BigInt(z)))),D=(0,s.mapToCurveSimpleSWU)(E,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:E.create(BigInt("-11"))});e.secp256k1_hasher=(0,i.createHasher)(e.secp256k1.Point,M=>{const{x:z,y:b}=D(E.create(M[0]));return P(z,b)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:E.ORDER,m:1,k:128,expand:"xmd",hash:t.sha256}),e.hashToCurve=e.secp256k1_hasher.hashToCurve,e.encodeToCurve=e.secp256k1_hasher.encodeToCurve})(Os);const q1=mu(oA),Lh=mu(WB);var Jn={};Object.defineProperty(Jn,"__esModule",{value:!0});Jn.encodeBase64toUint8=Jn.hexToNumber=Jn.bytesToNumber=void 0;const n5=Lh,r5=Ls;function i5(e){return W1((0,n5.bytesToHex)(e))}Jn.bytesToNumber=i5;function W1(e){return BigInt(`0x${e}`)}Jn.hexToNumber=W1;function o5(e){return r5.Buffer.from(e,"base64")}Jn.encodeBase64toUint8=o5;Object.defineProperty(it,"__esModule",{value:!0});it.deriveKeysetId=it.deserializeMintKeys=it.serializeMintKeys=it.createRandomPrivateKey=it.getKeysetIdInt=Ho=it.pointFromHex=Z1=it.hashToCurve=void 0;const G1=Os,xf=q1,Ps=Lh,nc=Jn,_a=Ls,s5=(0,Ps.hexToBytes)("536563703235366b315f48617368546f43757276655f43617368755f");function a5(e){const t=(0,xf.sha256)(_a.Buffer.concat([s5,e])),n=new Uint32Array(1),r=2**16;for(let i=0;i{let t;return/^[a-fA-F0-9]+$/.test(e)?t=(0,nc.hexToNumber)(e)%BigInt(2**31-1):t=(0,nc.bytesToNumber)((0,nc.encodeBase64toUint8)(e))%BigInt(2**31-1),t};it.getKeysetIdInt=u5;function l5(){return G1.secp256k1.utils.randomPrivateKey()}it.createRandomPrivateKey=l5;function Y1(e){const t={};return Object.keys(e).forEach(n=>{t[n]=(0,Ps.bytesToHex)(e[n])}),t}it.serializeMintKeys=Y1;function c5(e){const t={};return Object.keys(e).forEach(n=>{t[n]=(0,Ps.hexToBytes)(e[n])}),t}it.deserializeMintKeys=c5;function f5(e){const t=o=>[BigInt(o[0]),o[1]],n=Object.entries(Y1(e)).map(t).sort((o,s)=>o[0]s[0]?1:0).map(([,o])=>(0,Ps.hexToBytes)(o)).reduce((o,s)=>d5(o,s),new Uint8Array),r=(0,xf.sha256)(n);return"00"+_a.Buffer.from(r).toString("hex").slice(0,14)}it.deriveKeysetId=f5;function d5(e,t){const n=new Uint8Array(e.length+t.length);return n.set(e),n.set(t,e.length),n}var xt={};Object.defineProperty(xt,"__esModule",{value:!0});xt.serializeBlindedMessage=xt.deserializeProof=Ba=xt.serializeProof=n2=xt.constructProofFromPromise=xt.unblindSignature=e2=xt.blindMessage=xt.createRandomBlindedMessage=void 0;const Vp=Os,h5=Rs,p5=Jn,X1=it;function y5(){return J1((0,h5.randomBytes)(32))}xt.createRandomBlindedMessage=y5;function J1(e,t){const n=(0,X1.hashToCurve)(e);t||(t=(0,p5.bytesToNumber)(Vp.secp256k1.utils.randomPrivateKey()));const r=Vp.secp256k1.ProjectivePoint.BASE.multiply(t);return{B_:n.add(r),r:t,secret:e}}var e2=xt.blindMessage=J1;function t2(e,t,n){return e.subtract(n.multiply(t))}xt.unblindSignature=t2;function g5(e,t,n,r){const i=r,o=t2(e.C_,t,i);return{id:e.id,amount:e.amount,secret:n,C:o}}var n2=xt.constructProofFromPromise=g5;const m5=e=>({amount:e.amount,C:e.C.toHex(!0),id:e.id,secret:new TextDecoder().decode(e.secret),witness:JSON.stringify(e.witness)});var Ba=xt.serializeProof=m5;const w5=e=>({amount:e.amount,C:(0,X1.pointFromHex)(e.C),id:e.id,secret:new TextEncoder().encode(e.secret),witness:e.witness?JSON.parse(e.witness):void 0});xt.deserializeProof=w5;const v5=(e,t)=>({B_:e.B_.toHex(!0),amount:t});xt.serializeBlindedMessage=v5;var Qn={},r2={},Lt={};Object.defineProperty(Lt,"__esModule",{value:!0});Lt.ripemd160=Lt.RIPEMD160=Lt.md5=Lt.MD5=Lt.sha1=Lt.SHA1=void 0;const hi=mt,ot=Ie,Ti=Uint32Array.from([1732584193,4023233417,2562383102,271733878,3285377520]),_r=new Uint32Array(80);class i2 extends hi.HashMD{constructor(){super(64,20,8,!1),this.A=Ti[0]|0,this.B=Ti[1]|0,this.C=Ti[2]|0,this.D=Ti[3]|0,this.E=Ti[4]|0}get(){const{A:t,B:n,C:r,D:i,E:o}=this;return[t,n,r,i,o]}set(t,n,r,i,o){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=o|0}process(t,n){for(let u=0;u<16;u++,n+=4)_r[u]=t.getUint32(n,!1);for(let u=16;u<80;u++)_r[u]=(0,ot.rotl)(_r[u-3]^_r[u-8]^_r[u-14]^_r[u-16],1);let{A:r,B:i,C:o,D:s,E:a}=this;for(let u=0;u<80;u++){let l,f;u<20?(l=(0,hi.Chi)(i,o,s),f=1518500249):u<40?(l=i^o^s,f=1859775393):u<60?(l=(0,hi.Maj)(i,o,s),f=2400959708):(l=i^o^s,f=3395469782);const c=(0,ot.rotl)(r,5)+l+a+f+_r[u]|0;a=s,s=o,o=(0,ot.rotl)(i,30),i=r,r=c}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,this.set(r,i,o,s,a)}roundClean(){(0,ot.clean)(_r)}destroy(){this.set(0,0,0,0,0),(0,ot.clean)(this.buffer)}}Lt.SHA1=i2;Lt.sha1=(0,ot.createHasher)(()=>new i2);const b5=Math.pow(2,32),E5=Array.from({length:64},(e,t)=>Math.floor(b5*Math.abs(Math.sin(t+1)))),ia=Ti.slice(0,4),rc=new Uint32Array(16);class o2 extends hi.HashMD{constructor(){super(64,16,8,!0),this.A=ia[0]|0,this.B=ia[1]|0,this.C=ia[2]|0,this.D=ia[3]|0}get(){const{A:t,B:n,C:r,D:i}=this;return[t,n,r,i]}set(t,n,r,i){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0}process(t,n){for(let a=0;a<16;a++,n+=4)rc[a]=t.getUint32(n,!0);let{A:r,B:i,C:o,D:s}=this;for(let a=0;a<64;a++){let u,l,f;a<16?(u=(0,hi.Chi)(i,o,s),l=a,f=[7,12,17,22]):a<32?(u=(0,hi.Chi)(s,i,o),l=(5*a+1)%16,f=[5,9,14,20]):a<48?(u=i^o^s,l=(3*a+5)%16,f=[4,11,16,23]):(u=o^(i|~s),l=7*a%16,f=[6,10,15,21]),u=u+r+E5[a]+rc[l],r=s,s=o,o=i,i=i+(0,ot.rotl)(u,f[a%4])}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,this.set(r,i,o,s)}roundClean(){(0,ot.clean)(rc)}destroy(){this.set(0,0,0,0),(0,ot.clean)(this.buffer)}}Lt.MD5=o2;Lt.md5=(0,ot.createHasher)(()=>new o2);const x5=Uint8Array.from([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),s2=Uint8Array.from(new Array(16).fill(0).map((e,t)=>t)),S5=s2.map(e=>(9*e+5)%16),a2=(()=>{const n=[[s2],[S5]];for(let r=0;r<4;r++)for(let i of n)i.push(i[r].map(o=>x5[o]));return n})(),u2=a2[0],l2=a2[1],c2=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>Uint8Array.from(e)),k5=u2.map((e,t)=>e.map(n=>c2[t][n])),_5=l2.map((e,t)=>e.map(n=>c2[t][n])),B5=Uint32Array.from([0,1518500249,1859775393,2400959708,2840853838]),A5=Uint32Array.from([1352829926,1548603684,1836072691,2053994217,0]);function qp(e,t,n,r){return e===0?t^n^r:e===1?t&n|~t&r:e===2?(t|~n)^r:e===3?t&r|n&~r:t^(n|~r)}const oa=new Uint32Array(16);class f2 extends hi.HashMD{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:t,h1:n,h2:r,h3:i,h4:o}=this;return[t,n,r,i,o]}set(t,n,r,i,o){this.h0=t|0,this.h1=n|0,this.h2=r|0,this.h3=i|0,this.h4=o|0}process(t,n){for(let y=0;y<16;y++,n+=4)oa[y]=t.getUint32(n,!0);let r=this.h0|0,i=r,o=this.h1|0,s=o,a=this.h2|0,u=a,l=this.h3|0,f=l,c=this.h4|0,p=c;for(let y=0;y<5;y++){const E=4-y,w=B5[y],A=A5[y],v=u2[y],S=l2[y],x=k5[y],L=_5[y];for(let N=0;N<16;N++){const R=(0,ot.rotl)(r+qp(y,o,a,l)+oa[v[N]]+w,x[N])+c|0;r=c,c=l,l=(0,ot.rotl)(a,10)|0,a=o,o=R}for(let N=0;N<16;N++){const R=(0,ot.rotl)(i+qp(E,s,u,f)+oa[S[N]]+A,L[N])+p|0;i=p,p=f,f=(0,ot.rotl)(u,10)|0,u=s,s=R}}this.set(this.h1+a+f|0,this.h2+l+p|0,this.h3+c+i|0,this.h4+r+s|0,this.h0+o+u|0)}roundClean(){(0,ot.clean)(oa)}destroy(){this.destroyed=!0,(0,ot.clean)(this.buffer),this.set(0,0,0,0,0)}}Lt.RIPEMD160=f2;Lt.ripemd160=(0,ot.createHasher)(()=>new f2);const d2=mu(l6);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.HDKey=e.HARDENED_OFFSET=void 0;/*! scure-bip32 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */const t=Ae,n=Os,r=nl,i=Lt,o=Be,s=Rs,a=d2,u=n.secp256k1.ProjectivePoint,l=(0,a.createBase58check)(o.sha256);function f(S){(0,s.abytes)(S);const x=S.length===0?"0":(0,s.bytesToHex)(S);return BigInt("0x"+x)}function c(S){if(typeof S!="bigint")throw new Error("bigint expected");return(0,s.hexToBytes)(S.toString(16).padStart(64,"0"))}const p=(0,s.utf8ToBytes)("Bitcoin seed"),y={private:76066276,public:76067358};e.HARDENED_OFFSET=2147483648;const E=S=>(0,i.ripemd160)((0,o.sha256)(S)),w=S=>(0,s.createView)(S).getUint32(0,!1),A=S=>{if(!Number.isSafeInteger(S)||S<0||S>2**32-1)throw new Error("invalid number, should be from 0 to 2**32-1, got "+S);const x=new Uint8Array(4);return(0,s.createView)(x).setUint32(0,S,!1),x};class v{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return w(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){const x=this.privateKey;if(!x)throw new Error("No private key");return l.encode(this.serialize(this.versions.private,(0,s.concatBytes)(new Uint8Array([0]),x)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return l.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(x,L=y){if((0,s.abytes)(x),8*x.length<128||8*x.length>512)throw new Error("HDKey: seed length must be between 128 and 512 bits; 256 bits is advised, got "+x.length);const N=(0,r.hmac)(o.sha512,p,x);return new v({versions:L,chainCode:N.slice(32),privateKey:N.slice(0,32)})}static fromExtendedKey(x,L=y){const N=l.decode(x),R=(0,s.createView)(N),H=R.getUint32(0,!1),F={versions:L,depth:N[4],parentFingerprint:R.getUint32(5,!1),index:R.getUint32(9,!1),chainCode:N.slice(13,45)},q=N.slice(45),K=q[0]===0;if(H!==L[K?"private":"public"])throw new Error("Version mismatch");return K?new v({...F,privateKey:q.slice(1)}):new v({...F,publicKey:q})}static fromJSON(x){return v.fromExtendedKey(x.xpriv)}constructor(x){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!x||typeof x!="object")throw new Error("HDKey.constructor must not be called directly");if(this.versions=x.versions||y,this.depth=x.depth||0,this.chainCode=x.chainCode||null,this.index=x.index||0,this.parentFingerprint=x.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(x.publicKey&&x.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(x.privateKey){if(!n.secp256k1.utils.isValidPrivateKey(x.privateKey))throw new Error("Invalid private key");this.privKey=typeof x.privateKey=="bigint"?x.privateKey:f(x.privateKey),this.privKeyBytes=c(this.privKey),this.pubKey=n.secp256k1.getPublicKey(x.privateKey,!0)}else if(x.publicKey)this.pubKey=u.fromHex(x.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=E(this.pubKey)}derive(x){if(!/^[mM]'?/.test(x))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(x))return this;const L=x.replace(/^[mM]'?\//,"").split("/");let N=this;for(const R of L){const H=/^(\d+)('?)$/.exec(R),F=H&&H[1];if(!H||H.length!==3||typeof F!="string")throw new Error("invalid child index: "+R);let q=+F;if(!Number.isSafeInteger(q)||q>=e.HARDENED_OFFSET)throw new Error("Invalid index");H[2]==="'"&&(q+=e.HARDENED_OFFSET),N=N.deriveChild(q)}return N}deriveChild(x){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let L=A(x);if(x>=e.HARDENED_OFFSET){const q=this.privateKey;if(!q)throw new Error("Could not derive hardened child key");L=(0,s.concatBytes)(new Uint8Array([0]),q,L)}else L=(0,s.concatBytes)(this.pubKey,L);const N=(0,r.hmac)(o.sha512,this.chainCode,L),R=f(N.slice(0,32)),H=N.slice(32);if(!n.secp256k1.utils.isValidPrivateKey(R))throw new Error("Tweak bigger than curve order");const F={versions:this.versions,chainCode:H,depth:this.depth+1,parentFingerprint:this.fingerprint,index:x};try{if(this.privateKey){const q=(0,t.mod)(this.privKey+R,n.secp256k1.CURVE.n);if(!n.secp256k1.utils.isValidPrivateKey(q))throw new Error("The tweak was out of range or the resulted private key is invalid");F.privateKey=q}else{const q=u.fromHex(this.pubKey).add(u.fromPrivateKey(R));if(q.equals(u.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");F.publicKey=q.toRawBytes(!0)}return new v(F)}catch{return this.deriveChild(x+1)}}sign(x){if(!this.privateKey)throw new Error("No privateKey set!");return(0,s.abytes)(x,32),n.secp256k1.sign(x,this.privKey).toCompactRawBytes()}verify(x,L){if((0,s.abytes)(x,32),(0,s.abytes)(L,64),!this.publicKey)throw new Error("No publicKey set!");let N;try{N=n.secp256k1.Signature.fromCompact(L)}catch{return!1}return n.secp256k1.verify(N,x,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(x,L){if(!this.chainCode)throw new Error("No chainCode set");return(0,s.abytes)(L,33),(0,s.concatBytes)(A(x),new Uint8Array([this.depth]),A(this.parentFingerprint),A(this.index),this.chainCode,L)}}e.HDKey=v})(r2);var Jr={},il={};Object.defineProperty(il,"__esModule",{value:!0});il.pbkdf2=I5;il.pbkdf2Async=T5;const C5=nl,wn=Ie;function h2(e,t,n,r){(0,wn.ahash)(e);const i=(0,wn.checkOpts)({dkLen:32,asyncTick:10},r),{c:o,dkLen:s,asyncTick:a}=i;if((0,wn.anumber)(o),(0,wn.anumber)(s),(0,wn.anumber)(a),o<1)throw new Error("iterations (c) should be >= 1");const u=(0,wn.kdfInputToBytes)(t),l=(0,wn.kdfInputToBytes)(n),f=new Uint8Array(s),c=C5.hmac.create(e,u),p=c._cloneInto().update(l);return{c:o,dkLen:s,asyncTick:a,DK:f,PRF:c,PRFSalt:p}}function p2(e,t,n,r,i){return e.destroy(),t.destroy(),r&&r.destroy(),(0,wn.clean)(i),n}function I5(e,t,n,r){const{c:i,dkLen:o,DK:s,PRF:a,PRFSalt:u}=h2(e,t,n,r);let l;const f=new Uint8Array(4),c=(0,wn.createView)(f),p=new Uint8Array(a.outputLen);for(let y=1,E=0;E{u._cloneInto(f).update(y).digestInto(y);for(let v=0;ve[0]==="あいこくしん";function g2(e){if(typeof e!="string")throw new TypeError("invalid mnemonic type: "+typeof e);return e.normalize("NFKD")}function Nh(e){const t=g2(e),n=t.split(" ");if(![12,15,18,21,24].includes(n.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:n}}function m2(e){(0,Sf.abytes)(e,16,20,24,28,32)}function L5(e,t=128){if((0,Sf.anumber)(t),t%32!==0||t>256)throw new TypeError("Invalid entropy");return b2((0,Sf.randomBytes)(t/8),e)}const O5=e=>{const t=8-e.length/4;return new Uint8Array([(0,Oh.sha256)(e)[0]>>t<{if(typeof t!="string")throw new Error("wordlist: non-string element: "+t)}),sa.utils.chain(sa.utils.checksum(1,O5),sa.utils.radix2(11,!0),sa.utils.alphabet(e))}function v2(e,t){const{words:n}=Nh(e),r=w2(t).decode(n);return m2(r),r}function b2(e,t){return m2(e),w2(t).encode(e).join(U5(t)?" ":" ")}function N5(e,t){try{v2(e,t)}catch{return!1}return!0}const E2=e=>g2("mnemonic"+e);function R5(e,t=""){return(0,y2.pbkdf2Async)(Oh.sha512,Nh(e).nfkd,E2(t),{c:2048,dkLen:64})}function P5(e,t=""){return(0,y2.pbkdf2)(Oh.sha512,Nh(e).nfkd,E2(t),{c:2048,dkLen:64})}var ol={};Object.defineProperty(ol,"__esModule",{value:!0});ol.wordlist=void 0;ol.wordlist=`abandon -ability -able -about -above -absent -absorb -abstract -absurd -abuse -access -accident -account -accuse -achieve -acid -acoustic -acquire -across -act -action -actor -actress -actual -adapt -add -addict -address -adjust -admit -adult -advance -advice -aerobic -affair -afford -afraid -again -age -agent -agree -ahead -aim -air -airport -aisle -alarm -album -alcohol -alert -alien -all -alley -allow -almost -alone -alpha -already -also -alter -always -amateur -amazing -among -amount -amused -analyst -anchor -ancient -anger -angle -angry -animal -ankle -announce -annual -another -answer -antenna -antique -anxiety -any -apart -apology -appear -apple -approve -april -arch -arctic -area -arena -argue -arm -armed -armor -army -around -arrange -arrest -arrive -arrow -art -artefact -artist -artwork -ask -aspect -assault -asset -assist -assume -asthma -athlete -atom -attack -attend -attitude -attract -auction -audit -august -aunt -author -auto -autumn -average -avocado -avoid -awake -aware -away -awesome -awful -awkward -axis -baby -bachelor -bacon -badge -bag -balance -balcony -ball -bamboo -banana -banner -bar -barely -bargain -barrel -base -basic -basket -battle -beach -bean -beauty -because -become -beef -before -begin -behave -behind -believe -below -belt -bench -benefit -best -betray -better -between -beyond -bicycle -bid -bike -bind -biology -bird -birth -bitter -black -blade -blame -blanket -blast -bleak -bless -blind -blood -blossom -blouse -blue -blur -blush -board -boat -body -boil -bomb -bone -bonus -book -boost -border -boring -borrow -boss -bottom -bounce -box -boy -bracket -brain -brand -brass -brave -bread -breeze -brick -bridge -brief -bright -bring -brisk -broccoli -broken -bronze -broom -brother -brown -brush -bubble -buddy -budget -buffalo -build -bulb -bulk -bullet -bundle -bunker -burden -burger -burst -bus -business -busy -butter -buyer -buzz -cabbage -cabin -cable -cactus -cage -cake -call -calm -camera -camp -can -canal -cancel -candy -cannon -canoe -canvas -canyon -capable -capital -captain -car -carbon -card -cargo -carpet -carry -cart -case -cash -casino -castle -casual -cat -catalog -catch -category -cattle -caught -cause -caution -cave -ceiling -celery -cement -census -century -cereal -certain -chair -chalk -champion -change -chaos -chapter -charge -chase -chat -cheap -check -cheese -chef -cherry -chest -chicken -chief -child -chimney -choice -choose -chronic -chuckle -chunk -churn -cigar -cinnamon -circle -citizen -city -civil -claim -clap -clarify -claw -clay -clean -clerk -clever -click -client -cliff -climb -clinic -clip -clock -clog -close -cloth -cloud -clown -club -clump -cluster -clutch -coach -coast -coconut -code -coffee -coil -coin -collect -color -column -combine -come -comfort -comic -common -company -concert -conduct -confirm -congress -connect -consider -control -convince -cook -cool -copper -copy -coral -core -corn -correct -cost -cotton -couch -country -couple -course -cousin -cover -coyote -crack -cradle -craft -cram -crane -crash -crater -crawl -crazy -cream -credit -creek -crew -cricket -crime -crisp -critic -crop -cross -crouch -crowd -crucial -cruel -cruise -crumble -crunch -crush -cry -crystal -cube -culture -cup -cupboard -curious -current -curtain -curve -cushion -custom -cute -cycle -dad -damage -damp -dance -danger -daring -dash -daughter -dawn -day -deal -debate -debris -decade -december -decide -decline -decorate -decrease -deer -defense -define -defy -degree -delay -deliver -demand -demise -denial -dentist -deny -depart -depend -deposit -depth -deputy -derive -describe -desert -design -desk -despair -destroy -detail -detect -develop -device -devote -diagram -dial -diamond -diary -dice -diesel -diet -differ -digital -dignity -dilemma -dinner -dinosaur -direct -dirt -disagree -discover -disease -dish -dismiss -disorder -display -distance -divert -divide -divorce -dizzy -doctor -document -dog -doll -dolphin -domain -donate -donkey -donor -door -dose -double -dove -draft -dragon -drama -drastic -draw -dream -dress -drift -drill -drink -drip -drive -drop -drum -dry -duck -dumb -dune -during -dust -dutch -duty -dwarf -dynamic -eager -eagle -early -earn -earth -easily -east -easy -echo -ecology -economy -edge -edit -educate -effort -egg -eight -either -elbow -elder -electric -elegant -element -elephant -elevator -elite -else -embark -embody -embrace -emerge -emotion -employ -empower -empty -enable -enact -end -endless -endorse -enemy -energy -enforce -engage -engine -enhance -enjoy -enlist -enough -enrich -enroll -ensure -enter -entire -entry -envelope -episode -equal -equip -era -erase -erode -erosion -error -erupt -escape -essay -essence -estate -eternal -ethics -evidence -evil -evoke -evolve -exact -example -excess -exchange -excite -exclude -excuse -execute -exercise -exhaust -exhibit -exile -exist -exit -exotic -expand -expect -expire -explain -expose -express -extend -extra -eye -eyebrow -fabric -face -faculty -fade -faint -faith -fall -false -fame -family -famous -fan -fancy -fantasy -farm -fashion -fat -fatal -father -fatigue -fault -favorite -feature -february -federal -fee -feed -feel -female -fence -festival -fetch -fever -few -fiber -fiction -field -figure -file -film -filter -final -find -fine -finger -finish -fire -firm -first -fiscal -fish -fit -fitness -fix -flag -flame -flash -flat -flavor -flee -flight -flip -float -flock -floor -flower -fluid -flush -fly -foam -focus -fog -foil -fold -follow -food -foot -force -forest -forget -fork -fortune -forum -forward -fossil -foster -found -fox -fragile -frame -frequent -fresh -friend -fringe -frog -front -frost -frown -frozen -fruit -fuel -fun -funny -furnace -fury -future -gadget -gain -galaxy -gallery -game -gap -garage -garbage -garden -garlic -garment -gas -gasp -gate -gather -gauge -gaze -general -genius -genre -gentle -genuine -gesture -ghost -giant -gift -giggle -ginger -giraffe -girl -give -glad -glance -glare -glass -glide -glimpse -globe -gloom -glory -glove -glow -glue -goat -goddess -gold -good -goose -gorilla -gospel -gossip -govern -gown -grab -grace -grain -grant -grape -grass -gravity -great -green -grid -grief -grit -grocery -group -grow -grunt -guard -guess -guide -guilt -guitar -gun -gym -habit -hair -half -hammer -hamster -hand -happy -harbor -hard -harsh -harvest -hat -have -hawk -hazard -head -health -heart -heavy -hedgehog -height -hello -helmet -help -hen -hero -hidden -high -hill -hint -hip -hire -history -hobby -hockey -hold -hole -holiday -hollow -home -honey -hood -hope -horn -horror -horse -hospital -host -hotel -hour -hover -hub -huge -human -humble -humor -hundred -hungry -hunt -hurdle -hurry -hurt -husband -hybrid -ice -icon -idea -identify -idle -ignore -ill -illegal -illness -image -imitate -immense -immune -impact -impose -improve -impulse -inch -include -income -increase -index -indicate -indoor -industry -infant -inflict -inform -inhale -inherit -initial -inject -injury -inmate -inner -innocent -input -inquiry -insane -insect -inside -inspire -install -intact -interest -into -invest -invite -involve -iron -island -isolate -issue -item -ivory -jacket -jaguar -jar -jazz -jealous -jeans -jelly -jewel -job -join -joke -journey -joy -judge -juice -jump -jungle -junior -junk -just -kangaroo -keen -keep -ketchup -key -kick -kid -kidney -kind -kingdom -kiss -kit -kitchen -kite -kitten -kiwi -knee -knife -knock -know -lab -label -labor -ladder -lady -lake -lamp -language -laptop -large -later -latin -laugh -laundry -lava -law -lawn -lawsuit -layer -lazy -leader -leaf -learn -leave -lecture -left -leg -legal -legend -leisure -lemon -lend -length -lens -leopard -lesson -letter -level -liar -liberty -library -license -life -lift -light -like -limb -limit -link -lion -liquid -list -little -live -lizard -load -loan -lobster -local -lock -logic -lonely -long -loop -lottery -loud -lounge -love -loyal -lucky -luggage -lumber -lunar -lunch -luxury -lyrics -machine -mad -magic -magnet -maid -mail -main -major -make -mammal -man -manage -mandate -mango -mansion -manual -maple -marble -march -margin -marine -market -marriage -mask -mass -master -match -material -math -matrix -matter -maximum -maze -meadow -mean -measure -meat -mechanic -medal -media -melody -melt -member -memory -mention -menu -mercy -merge -merit -merry -mesh -message -metal -method -middle -midnight -milk -million -mimic -mind -minimum -minor -minute -miracle -mirror -misery -miss -mistake -mix -mixed -mixture -mobile -model -modify -mom -moment -monitor -monkey -monster -month -moon -moral -more -morning -mosquito -mother -motion -motor -mountain -mouse -move -movie -much -muffin -mule -multiply -muscle -museum -mushroom -music -must -mutual -myself -mystery -myth -naive -name -napkin -narrow -nasty -nation -nature -near -neck -need -negative -neglect -neither -nephew -nerve -nest -net -network -neutral -never -news -next -nice -night -noble -noise -nominee -noodle -normal -north -nose -notable -note -nothing -notice -novel -now -nuclear -number -nurse -nut -oak -obey -object -oblige -obscure -observe -obtain -obvious -occur -ocean -october -odor -off -offer -office -often -oil -okay -old -olive -olympic -omit -once -one -onion -online -only -open -opera -opinion -oppose -option -orange -orbit -orchard -order -ordinary -organ -orient -original -orphan -ostrich -other -outdoor -outer -output -outside -oval -oven -over -own -owner -oxygen -oyster -ozone -pact -paddle -page -pair -palace -palm -panda -panel -panic -panther -paper -parade -parent -park -parrot -party -pass -patch -path -patient -patrol -pattern -pause -pave -payment -peace -peanut -pear -peasant -pelican -pen -penalty -pencil -people -pepper -perfect -permit -person -pet -phone -photo -phrase -physical -piano -picnic -picture -piece -pig -pigeon -pill -pilot -pink -pioneer -pipe -pistol -pitch -pizza -place -planet -plastic -plate -play -please -pledge -pluck -plug -plunge -poem -poet -point -polar -pole -police -pond -pony -pool -popular -portion -position -possible -post -potato -pottery -poverty -powder -power -practice -praise -predict -prefer -prepare -present -pretty -prevent -price -pride -primary -print -priority -prison -private -prize -problem -process -produce -profit -program -project -promote -proof -property -prosper -protect -proud -provide -public -pudding -pull -pulp -pulse -pumpkin -punch -pupil -puppy -purchase -purity -purpose -purse -push -put -puzzle -pyramid -quality -quantum -quarter -question -quick -quit -quiz -quote -rabbit -raccoon -race -rack -radar -radio -rail -rain -raise -rally -ramp -ranch -random -range -rapid -rare -rate -rather -raven -raw -razor -ready -real -reason -rebel -rebuild -recall -receive -recipe -record -recycle -reduce -reflect -reform -refuse -region -regret -regular -reject -relax -release -relief -rely -remain -remember -remind -remove -render -renew -rent -reopen -repair -repeat -replace -report -require -rescue -resemble -resist -resource -response -result -retire -retreat -return -reunion -reveal -review -reward -rhythm -rib -ribbon -rice -rich -ride -ridge -rifle -right -rigid -ring -riot -ripple -risk -ritual -rival -river -road -roast -robot -robust -rocket -romance -roof -rookie -room -rose -rotate -rough -round -route -royal -rubber -rude -rug -rule -run -runway -rural -sad -saddle -sadness -safe -sail -salad -salmon -salon -salt -salute -same -sample -sand -satisfy -satoshi -sauce -sausage -save -say -scale -scan -scare -scatter -scene -scheme -school -science -scissors -scorpion -scout -scrap -screen -script -scrub -sea -search -season -seat -second -secret -section -security -seed -seek -segment -select -sell -seminar -senior -sense -sentence -series -service -session -settle -setup -seven -shadow -shaft -shallow -share -shed -shell -sheriff -shield -shift -shine -ship -shiver -shock -shoe -shoot -shop -short -shoulder -shove -shrimp -shrug -shuffle -shy -sibling -sick -side -siege -sight -sign -silent -silk -silly -silver -similar -simple -since -sing -siren -sister -situate -six -size -skate -sketch -ski -skill -skin -skirt -skull -slab -slam -sleep -slender -slice -slide -slight -slim -slogan -slot -slow -slush -small -smart -smile -smoke -smooth -snack -snake -snap -sniff -snow -soap -soccer -social -sock -soda -soft -solar -soldier -solid -solution -solve -someone -song -soon -sorry -sort -soul -sound -soup -source -south -space -spare -spatial -spawn -speak -special -speed -spell -spend -sphere -spice -spider -spike -spin -spirit -split -spoil -sponsor -spoon -sport -spot -spray -spread -spring -spy -square -squeeze -squirrel -stable -stadium -staff -stage -stairs -stamp -stand -start -state -stay -steak -steel -stem -step -stereo -stick -still -sting -stock -stomach -stone -stool -story -stove -strategy -street -strike -strong -struggle -student -stuff -stumble -style -subject -submit -subway -success -such -sudden -suffer -sugar -suggest -suit -summer -sun -sunny -sunset -super -supply -supreme -sure -surface -surge -surprise -surround -survey -suspect -sustain -swallow -swamp -swap -swarm -swear -sweet -swift -swim -swing -switch -sword -symbol -symptom -syrup -system -table -tackle -tag -tail -talent -talk -tank -tape -target -task -taste -tattoo -taxi -teach -team -tell -ten -tenant -tennis -tent -term -test -text -thank -that -theme -then -theory -there -they -thing -this -thought -three -thrive -throw -thumb -thunder -ticket -tide -tiger -tilt -timber -time -tiny -tip -tired -tissue -title -toast -tobacco -today -toddler -toe -together -toilet -token -tomato -tomorrow -tone -tongue -tonight -tool -tooth -top -topic -topple -torch -tornado -tortoise -toss -total -tourist -toward -tower -town -toy -track -trade -traffic -tragic -train -transfer -trap -trash -travel -tray -treat -tree -trend -trial -tribe -trick -trigger -trim -trip -trophy -trouble -truck -true -truly -trumpet -trust -truth -try -tube -tuition -tumble -tuna -tunnel -turkey -turn -turtle -twelve -twenty -twice -twin -twist -two -type -typical -ugly -umbrella -unable -unaware -uncle -uncover -under -undo -unfair -unfold -unhappy -uniform -unique -unit -universe -unknown -unlock -until -unusual -unveil -update -upgrade -uphold -upon -upper -upset -urban -urge -usage -use -used -useful -useless -usual -utility -vacant -vacuum -vague -valid -valley -valve -van -vanish -vapor -various -vast -vault -vehicle -velvet -vendor -venture -venue -verb -verify -version -very -vessel -veteran -viable -vibrant -vicious -victory -video -view -village -vintage -violin -virtual -virus -visa -visit -visual -vital -vivid -vocal -voice -void -volcano -volume -vote -voyage -wage -wagon -wait -walk -wall -walnut -want -warfare -warm -warrior -wash -wasp -waste -water -wave -way -wealth -weapon -wear -weasel -weather -web -wedding -weekend -weird -welcome -west -wet -whale -what -wheat -wheel -when -where -whip -whisper -wide -width -wife -wild -will -win -window -wine -wing -wink -winner -winter -wire -wisdom -wise -wish -witness -wolf -woman -wonder -wood -wool -word -work -world -worry -worth -wrap -wreck -wrestle -wrist -write -wrong -yard -year -yellow -you -young -youth -zebra -zero -zone -zoo`.split(` -`);Object.defineProperty(Qn,"__esModule",{value:!0});Qn.deriveSeedFromMnemonic=Qn.generateNewMnemonic=k2=Qn.deriveBlindingFactor=S2=Qn.deriveSecret=void 0;const $5=r2,M5=it,x2=Jr,H5=ol,F5="m/129372'/0'";var gu;(function(e){e[e.SECRET=0]="SECRET",e[e.BLINDING_FACTOR=1]="BLINDING_FACTOR"})(gu||(gu={}));const j5=(e,t,n)=>_2(e,t,n,gu.SECRET);var S2=Qn.deriveSecret=j5;const D5=(e,t,n)=>_2(e,t,n,gu.BLINDING_FACTOR);var k2=Qn.deriveBlindingFactor=D5;const _2=(e,t,n,r)=>{const i=$5.HDKey.fromMasterSeed(e),o=(0,M5.getKeysetIdInt)(t),s=`${F5}/${o}'/${n}'/${r}`,a=i.derive(s);if(a.privateKey===null)throw new Error("Could not derive private key");return a.privateKey},z5=()=>(0,x2.generateMnemonic)(H5.wordlist,128);Qn.generateNewMnemonic=z5;const K5=e=>(0,x2.mnemonicToSeedSync)(e);Qn.deriveSeedFromMnemonic=K5;var Aa={},sl={};Object.defineProperty(sl,"__esModule",{value:!0});sl.parseSecret=void 0;const V5=e=>{try{return e instanceof Uint8Array&&(e=new TextDecoder().decode(e)),JSON.parse(e)}catch{throw new Error("can't parse secret")}};sl.parseSecret=V5;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSignedProof=e.getSignedProofs=e.signP2PKsecret=e.createP2PKsecret=void 0;const t=Lh,n=q1,r=Os,i=Rs,o=sl,s=f=>{const c=["P2PK",{nonce:(0,t.bytesToHex)((0,i.randomBytes)(32)),data:f}],p=JSON.stringify(c);return new TextEncoder().encode(p)};e.createP2PKsecret=s;const a=(f,c)=>{const p=(0,n.sha256)(new TextDecoder().decode(f));return r.schnorr.sign(p,c)};e.signP2PKsecret=a;const u=(f,c)=>f.map(p=>{try{if((0,o.parseSecret)(p.secret)[0]!=="P2PK")throw new Error("unknown secret type");return(0,e.getSignedProof)(p,(0,t.hexToBytes)(c))}catch{return p}});e.getSignedProofs=u;const l=(f,c)=>(f.witness||(f.witness={signatures:[(0,t.bytesToHex)((0,e.signP2PKsecret)(f.secret,c))]}),f);e.getSignedProof=l})(Aa);var ht=function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(f){try{l(r.next(f))}catch(c){s(c)}}function u(f){try{l(r.throw(f))}catch(c){s(c)}}function l(f){f.done?o(f.value):i(f.value).then(a,u)}l((r=r.apply(e,t||[])).next())})},tt=function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(l){return function(f){return u([l,f])}}function u(l){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,i&&(o=l[0]&2?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,i=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){n=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]0)||n?[4,this.getKeySets()]:[3,2];case 1:o.sent(),o.label=2;case 2:return t||(r=this.getActiveKeyset(this._keysets),t=r.id),this._keysets.find(function(s){return s.id===t})?[3,4]:[4,this.getKeySets()];case 3:if(o.sent(),!this._keysets.find(function(s){return s.id===t}))throw new Error("could not initialize keys. No keyset with id '".concat(t,"' found"));o.label=4;case 4:return this._keys.get(t)?[3,6]:[4,this.mint.getKeys(t)];case 5:i=o.sent(),this._keys.set(t,i.keysets[0]),o.label=6;case 6:return this.keysetId=t,[2,this._keys.get(t)]}})})},e.prototype.receive=function(t,n){return ht(this,void 0,void 0,function(){var r,i,o,s,a,u,l;return tt(this,function(f){switch(f.label){case 0:return typeof t=="string"&&(t=vA(t)),[4,this.getKeys(n==null?void 0:n.keysetId)];case 1:return r=f.sent(),i=ei(t.proofs)-this.getFeesForProofs(t.proofs),o=this.createSwapPayload(i,t.proofs,r,n==null?void 0:n.outputAmounts,n==null?void 0:n.counter,n==null?void 0:n.pubkey,n==null?void 0:n.privkey),s=o.payload,a=o.blindingData,[4,this.mint.swap(s)];case 2:return u=f.sent().signatures,l=this.constructProofs(u,a.blindingFactors,a.secrets,r),[2,l]}})})},e.prototype.send=function(t,n,r){var i;return ht(this,void 0,void 0,function(){var o,s,a,u,l,f,c,p,y,E,w;return tt(this,function(A){switch(A.label){case 0:if(ei(n)n}).sort(function(A,v){return A.amount-v.amount}),a=s[0];if(!o.length&&a)return{keep:t.filter(function(A){return A.secret!==a.secret}),send:[a]};if(!o.length&&!a)return{keep:t,send:[]};var u=n,l=[o[0]],f=[],c=r?this.getFeesForProofs(l):0;if(u-=l[0].amount-c/1e3,u>0){var p=this.selectProofsToSend(o.slice(1),u,r),y=p.keep,E=p.send;l.push.apply(l,E),f.push.apply(f,y)}var w=r?this.getFeesForProofs(l):0;return ei(l)y;)y++,E=Ii(y,a.keys);p=p.concat(E),l+=y,c-=y}if(r&&!(!((o=r.outputAmounts)===null||o===void 0)&&o.keepAmounts)&&r.proofsWeHave)w=Fp(r.proofsWeHave,c,a.keys,this._denominationTarget);else if(r.outputAmounts){if(((s=r.outputAmounts.keepAmounts)===null||s===void 0?void 0:s.reduce(function(q,K){return q+K},0))!=c)throw new Error("Keep amounts do not match amount to keep");w=r.outputAmounts.keepAmounts}if(l+this.getFeesForProofs(u)>f)throw console.error("Not enough funds available (".concat(f,") for swap amountToSend: ").concat(l," + fee: ").concat(this.getFeesForProofs(u)," | length: ").concat(u.length)),new Error("Not enough funds available for swap");if(l+this.getFeesForProofs(u)+c!=f)throw new Error("Amounts do not match for swap");return r.outputAmounts={keepAmounts:w,sendAmounts:p},A=this.createSwapPayload(l,u,a,r==null?void 0:r.outputAmounts,r==null?void 0:r.counter,r==null?void 0:r.pubkey,r==null?void 0:r.privkey),v=A.payload,S=A.blindingData,[4,this.mint.swap(v)];case 2:return x=F.sent().signatures,L=this.constructProofs(x,S.blindingFactors,S.secrets,a),N=[],R=[],H=0,L.forEach(function(q){if(H{const[t,n]=St.useState(!1),r=async()=>{try{if(n(!0),!window.nostr)throw new Error("Nostr extension not found. Please install a nostr browser extension.");if(await window.nostr.getPublicKey())e();else throw new Error("Failed to get public key")}catch(i){console.error("Login failed:",i),alert("Login failed. Please install a nostr browser extension and try again.")}finally{n(!1)}};return be.jsx("div",{className:"login-container",children:be.jsxs("div",{className:"login-card",children:[be.jsx("h2",{children:"Welcome to Markr"}),be.jsx("p",{children:"Connect your nostr account to view your bookmarks"}),be.jsx("button",{onClick:r,disabled:t,className:"login-button",children:t?"Connecting...":"Connect with Nostr"})]})})},Z5=({onLogout:e})=>{const[t,n]=St.useState([]),[r,i]=St.useState(!0),o=St.useContext(Yv);St.useEffect(()=>{o&&s()},[o]);const s=async()=>{var l;if(o)try{i(!0);const f=await((l=window.nostr)==null?void 0:l.getPublicKey());if(!f)throw new Error("No public key available");const c=o.getByFilters([{kinds:[10003,30003],authors:[f]}]),p=[];for(const y of c){const E=a(y);E&&p.push(E)}n(p)}catch(f){console.error("Failed to fetch bookmarks:",f)}finally{i(!1)}},a=l=>{try{const f=JSON.parse(l.content||"{}");if(f.bookmarks&&Array.isArray(f.bookmarks))return{id:l.id,title:f.name||"Untitled Bookmark List",url:"",content:l.content,created_at:l.created_at,tags:l.tags};const c=l.tags.find(y=>y[0]==="r"&&y[1]),p=l.tags.find(y=>y[0]==="title"&&y[1]);return c?{id:l.id,title:(p==null?void 0:p[1])||"Untitled",url:c[1],content:l.content,created_at:l.created_at,tags:l.tags}:null}catch(f){return console.error("Error parsing bookmark event:",f),null}},u=l=>new Date(l*1e3).toLocaleDateString();return r?be.jsxs("div",{className:"bookmarks-container",children:[be.jsxs("div",{className:"bookmarks-header",children:[be.jsx("h2",{children:"Your Bookmarks"}),be.jsx("button",{onClick:e,className:"logout-button",children:"Logout"})]}),be.jsx("div",{className:"loading",children:"Loading bookmarks..."})]}):be.jsxs("div",{className:"bookmarks-container",children:[be.jsxs("div",{className:"bookmarks-header",children:[be.jsxs("h2",{children:["Your Bookmarks (",t.length,")"]}),be.jsx("button",{onClick:e,className:"logout-button",children:"Logout"})]}),t.length===0?be.jsxs("div",{className:"empty-state",children:[be.jsx("p",{children:"No bookmarks found."}),be.jsx("p",{children:"Add bookmarks using your nostr client to see them here."})]}):be.jsx("div",{className:"bookmarks-list",children:t.map(l=>be.jsxs("div",{className:"bookmark-item",children:[be.jsx("h3",{children:l.title}),l.url&&be.jsx("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",className:"bookmark-url",children:l.url}),l.content&&be.jsx("p",{className:"bookmark-content",children:l.content}),be.jsx("div",{className:"bookmark-meta",children:be.jsxs("span",{children:["Added: ",u(l.created_at)]})})]},l.id))})]})};function Q5(){const[e,t]=St.useState(null),[n,r]=St.useState(!1);return St.useEffect(()=>{const i=new Zo;t(i)},[]),e?be.jsx(N6,{eventStore:e,children:be.jsxs("div",{className:"app",children:[be.jsxs("header",{children:[be.jsx("h1",{children:"Markr"}),be.jsx("p",{children:"A minimal nostr bookmark client"})]}),n?be.jsx(Z5,{onLogout:()=>r(!1)}):be.jsx(G5,{onLogin:()=>r(!0)})]})}):be.jsx("div",{children:"Loading..."})}ic.createRoot(document.getElementById("root")).render(be.jsx(z2.StrictMode,{children:be.jsx(Q5,{})})); diff --git a/dist/assets/index-FV8IYC7S.css b/dist/assets/index-FV8IYC7S.css deleted file mode 100644 index 892b6260..00000000 --- a/dist/assets/index-FV8IYC7S.css +++ /dev/null @@ -1 +0,0 @@ -:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%}body{margin:0;min-width:320px;min-height:100vh}#root{max-width:1280px;margin:0 auto;padding:2rem}.app{text-align:center}.app header{margin-bottom:2rem}.app header h1{font-size:2.5rem;margin:0;color:#646cff}.app header p{margin:.5rem 0 0;color:#888}.login-container{display:flex;justify-content:center;align-items:center;min-height:50vh}.login-card{background:#1a1a1a;padding:2rem;border-radius:8px;border:1px solid #333;max-width:400px;width:100%}.login-card h2{margin:0 0 1rem;color:#fff}.login-card p{margin:0 0 1.5rem;color:#ccc}.login-button{background:#646cff;color:#fff;border:none;padding:.75rem 1.5rem;border-radius:4px;font-size:1rem;cursor:pointer;transition:background-color .2s}.login-button:hover:not(:disabled){background:#535bf2}.login-button:disabled{opacity:.6;cursor:not-allowed}.bookmarks-container{text-align:left}.bookmarks-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:2rem;padding-bottom:1rem;border-bottom:1px solid #333}.bookmarks-header h2{margin:0;color:#fff}.logout-button{background:#dc3545;color:#fff;border:none;padding:.5rem 1rem;border-radius:4px;cursor:pointer;transition:background-color .2s}.logout-button:hover{background:#c82333}.loading{text-align:center;padding:2rem;color:#ccc}.empty-state{text-align:center;padding:3rem;color:#888}.empty-state p{margin:.5rem 0}.bookmarks-list{display:grid;gap:1rem}.bookmark-item{background:#1a1a1a;padding:1.5rem;border-radius:8px;border:1px solid #333;transition:border-color .2s}.bookmark-item:hover{border-color:#646cff}.bookmark-item h3{margin:0 0 .5rem;color:#fff;font-size:1.2rem}.bookmark-url{color:#646cff;text-decoration:none;display:block;margin-bottom:.5rem;word-break:break-all}.bookmark-url:hover{text-decoration:underline}.bookmark-content{color:#ccc;margin:.5rem 0;line-height:1.4}.bookmark-meta{color:#888;font-size:.9rem;margin-top:.5rem}@media (prefers-color-scheme: light){:root{color:#213547;background-color:#fff}.login-card,.bookmark-item{background:#f9f9f9;border-color:#ddd}.bookmarks-header{border-bottom-color:#ddd}.bookmark-item h3{color:#213547}.bookmark-content{color:#666}} diff --git a/dist/index.html b/dist/index.html index 2e21dc9e..c96e1c24 100644 --- a/dist/index.html +++ b/dist/index.html @@ -5,10 +5,11 @@ Markr - Nostr Bookmarks - - + +
+ diff --git a/src/App.tsx b/src/App.tsx index 0abc9c39..80898fdb 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -7,6 +7,7 @@ import Bookmarks from './components/Bookmarks' function App() { const [eventStore, setEventStore] = useState(null) const [isAuthenticated, setIsAuthenticated] = useState(false) + const [userPublicKey, setUserPublicKey] = useState(null) useEffect(() => { // Initialize event store @@ -27,9 +28,18 @@ function App() { {!isAuthenticated ? ( - setIsAuthenticated(true)} /> + { + setIsAuthenticated(true) + setUserPublicKey(publicKey) + }} /> ) : ( - setIsAuthenticated(false)} /> + { + setIsAuthenticated(false) + setUserPublicKey(null) + }} + /> )} diff --git a/src/components/Bookmarks.tsx b/src/components/Bookmarks.tsx index 35f5bc4a..9098f48a 100644 --- a/src/components/Bookmarks.tsx +++ b/src/components/Bookmarks.tsx @@ -12,39 +12,34 @@ interface Bookmark { } interface BookmarksProps { + userPublicKey: string | null onLogout: () => void } -const Bookmarks: React.FC = ({ onLogout }) => { +const Bookmarks: React.FC = ({ userPublicKey, onLogout }) => { const [bookmarks, setBookmarks] = useState([]) const [loading, setLoading] = useState(true) const eventStore = useContext(EventStoreContext) useEffect(() => { - if (eventStore) { + if (eventStore && userPublicKey) { fetchBookmarks() } - }, [eventStore]) + }, [eventStore, userPublicKey]) const fetchBookmarks = async () => { - if (!eventStore) return + if (!eventStore || !userPublicKey) return try { setLoading(true) - // Get public key from nostr extension - const publicKey = await window.nostr?.getPublicKey() - if (!publicKey) { - throw new Error('No public key available') - } - // Fetch bookmarks according to NIP-51 // Kind 10003: bookmark lists // Kind 30003: parameterized replaceable events (bookmark lists with d-tag) const events = eventStore.getByFilters([ { kinds: [10003, 30003], - authors: [publicKey] + authors: [userPublicKey] } ]) @@ -109,11 +104,20 @@ const Bookmarks: React.FC = ({ onLogout }) => { return new Date(timestamp * 1000).toLocaleDateString() } + const formatPublicKey = (publicKey: string) => { + return `${publicKey.slice(0, 8)}...${publicKey.slice(-8)}` + } + if (loading) { return (
-

Your Bookmarks

+
+

Your Bookmarks

+ {userPublicKey && ( +

Logged in as: {formatPublicKey(userPublicKey)}

+ )} +
@@ -126,7 +130,12 @@ const Bookmarks: React.FC = ({ onLogout }) => { return (
-

Your Bookmarks ({bookmarks.length})

+
+

Your Bookmarks ({bookmarks.length})

+ {userPublicKey && ( +

Logged in as: {formatPublicKey(userPublicKey)}

+ )} +
diff --git a/src/components/Login.tsx b/src/components/Login.tsx index 75451aef..b8a5238c 100644 --- a/src/components/Login.tsx +++ b/src/components/Login.tsx @@ -1,7 +1,7 @@ import { useState } from 'react' interface LoginProps { - onLogin: () => void + onLogin: (publicKey: string) => void } const Login: React.FC = ({ onLogin }) => { @@ -20,7 +20,7 @@ const Login: React.FC = ({ onLogin }) => { const publicKey = await window.nostr.getPublicKey() if (publicKey) { - onLogin() + onLogin(publicKey) } else { throw new Error('Failed to get public key') } diff --git a/src/index.css b/src/index.css index d1fe26ef..4605671f 100644 --- a/src/index.css +++ b/src/index.css @@ -100,17 +100,28 @@ body { .bookmarks-header { display: flex; justify-content: space-between; - align-items: center; + align-items: flex-start; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 1px solid #333; } +.bookmarks-header > div { + flex: 1; +} + .bookmarks-header h2 { margin: 0; color: #fff; } +.user-info { + margin: 0.5rem 0 0 0; + color: #888; + font-size: 0.9rem; + font-family: monospace; +} + .logout-button { background: #dc3545; color: white; @@ -211,4 +222,8 @@ body { .bookmark-content { color: #666; } + + .user-info { + color: #666; + } }