window.nostr.js 0.4.8 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.html +1 -1
- package/dist/window.nostr.js +13 -13
- package/package.json +1 -1
- package/postcss.config.js +2 -2
- package/src/App.svelte +2 -2
- package/tailwind.config.js +92 -15
package/dist/index.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>dev</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-Ba-DM_o1.js"></script>
|
|
8
8
|
</head>
|
|
9
9
|
<body
|
|
10
10
|
style="
|
package/dist/window.nostr.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
var aa=Object.defineProperty;var la=(qe,U,je)=>U in qe?aa(qe,U,{enumerable:!0,configurable:!0,writable:!0,value:je}):qe[U]=je;var v=(qe,U,je)=>la(qe,typeof U!="symbol"?U+"":U,je);(function(){"use strict";var fo,ho,bo,go,po;const qe='*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.fixed{position:fixed}.absolute{position:absolute}.bottom-1{bottom:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.top-0{top:0}.z-\\[9000\\]{z-index:9000}.m-auto{margin:auto}.my-2{margin-top:.5rem;margin-bottom:.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.mr-2{margin-right:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.box-border{box-sizing:border-box}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.h-10{height:2.5rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.w-10{width:2.5rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-full{width:100%}.max-w-56{max-width:14rem}@keyframes moveIn{0%{transform:translateY(-10px)}to{transform:translateY(0)}}.animate-fadein{animation:fadeIn 1s ease-in-out,moveIn 1s ease-in-out}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.animate-show{animation:fadeIn .2s ease-in-out}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-grabbing{cursor:grabbing}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:.5rem}.overflow-hidden{overflow:hidden}.overflow-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-md{border-radius:.375rem}.border-0{border-width:0px}.border-2{border-width:2px}.border-solid{border-style:solid}.border-transparent{border-color:transparent}.bg-cyan-700{--tw-bg-opacity: 1;background-color:rgb(14 116 144 / var(--tw-bg-opacity))}.bg-cyan-800{--tw-bg-opacity: 1;background-color:rgb(21 94 117 / var(--tw-bg-opacity))}.bg-cyan-900{--tw-bg-opacity: 1;background-color:rgb(22 78 99 / var(--tw-bg-opacity))}.bg-cyan-950{--tw-bg-opacity: 1;background-color:rgb(8 51 68 / var(--tw-bg-opacity))}.bg-green-700{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity))}.bg-green-800{--tw-bg-opacity: 1;background-color:rgb(22 101 52 / var(--tw-bg-opacity))}.bg-green-900{--tw-bg-opacity: 1;background-color:rgb(20 83 45 / var(--tw-bg-opacity))}.bg-green-950{--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity))}.bg-neutral-700{--tw-bg-opacity: 1;background-color:rgb(64 64 64 / var(--tw-bg-opacity))}.bg-neutral-800{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.bg-neutral-900{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity))}.bg-neutral-950{--tw-bg-opacity: 1;background-color:rgb(10 10 10 / var(--tw-bg-opacity))}.bg-orange-700{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity))}.bg-orange-800{--tw-bg-opacity: 1;background-color:rgb(154 52 18 / var(--tw-bg-opacity))}.bg-orange-900{--tw-bg-opacity: 1;background-color:rgb(124 45 18 / var(--tw-bg-opacity))}.bg-orange-950{--tw-bg-opacity: 1;background-color:rgb(67 20 7 / var(--tw-bg-opacity))}.bg-purple-700{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity))}.bg-purple-800{--tw-bg-opacity: 1;background-color:rgb(107 33 168 / var(--tw-bg-opacity))}.bg-purple-900{--tw-bg-opacity: 1;background-color:rgb(88 28 135 / var(--tw-bg-opacity))}.bg-purple-950{--tw-bg-opacity: 1;background-color:rgb(59 7 100 / var(--tw-bg-opacity))}.bg-red-700{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity))}.bg-red-800{--tw-bg-opacity: 1;background-color:rgb(153 27 27 / var(--tw-bg-opacity))}.bg-red-900{--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity))}.bg-red-950{--tw-bg-opacity: 1;background-color:rgb(69 10 10 / var(--tw-bg-opacity))}.bg-stone-700{--tw-bg-opacity: 1;background-color:rgb(68 64 60 / var(--tw-bg-opacity))}.bg-stone-800{--tw-bg-opacity: 1;background-color:rgb(41 37 36 / var(--tw-bg-opacity))}.bg-stone-900{--tw-bg-opacity: 1;background-color:rgb(28 25 23 / var(--tw-bg-opacity))}.bg-stone-950{--tw-bg-opacity: 1;background-color:rgb(12 10 9 / var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity))}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.from-cyan-900{--tw-gradient-from: #164e63 var(--tw-gradient-from-position);--tw-gradient-to: rgb(22 78 99 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-900{--tw-gradient-from: #14532d var(--tw-gradient-from-position);--tw-gradient-to: rgb(20 83 45 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-neutral-900{--tw-gradient-from: #171717 var(--tw-gradient-from-position);--tw-gradient-to: rgb(23 23 23 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-900{--tw-gradient-from: #7c2d12 var(--tw-gradient-from-position);--tw-gradient-to: rgb(124 45 18 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-900{--tw-gradient-from: #581c87 var(--tw-gradient-from-position);--tw-gradient-to: rgb(88 28 135 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-900{--tw-gradient-from: #7f1d1d var(--tw-gradient-from-position);--tw-gradient-to: rgb(127 29 29 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-stone-900{--tw-gradient-from: #1c1917 var(--tw-gradient-from-position);--tw-gradient-to: rgb(28 25 23 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-cyan-700{--tw-gradient-to: #0e7490 var(--tw-gradient-to-position)}.to-green-700{--tw-gradient-to: #15803d var(--tw-gradient-to-position)}.to-neutral-700{--tw-gradient-to: #404040 var(--tw-gradient-to-position)}.to-orange-700{--tw-gradient-to: #c2410c var(--tw-gradient-to-position)}.to-purple-700{--tw-gradient-to: #7e22ce var(--tw-gradient-to-position)}.to-red-700{--tw-gradient-to: #b91c1c var(--tw-gradient-to-position)}.to-stone-700{--tw-gradient-to: #44403c var(--tw-gradient-to-position)}.p-2{padding:.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.text-center{text-align:center}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.leading-3{line-height:.75rem}.leading-4{line-height:1rem}.leading-5{line-height:1.25rem}.text-cyan-600{--tw-text-opacity: 1;color:rgb(8 145 178 / var(--tw-text-opacity))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity))}.text-neutral-600{--tw-text-opacity: 1;color:rgb(82 82 82 / var(--tw-text-opacity))}.text-neutral-800{--tw-text-opacity: 1;color:rgb(38 38 38 / var(--tw-text-opacity))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity))}.text-stone-600{--tw-text-opacity: 1;color:rgb(87 83 78 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.underline{text-decoration-line:underline}.no-underline{text-decoration-line:none}.decoration-2{text-decoration-thickness:2px}.underline-offset-4{text-underline-offset:4px}.opacity-25{opacity:.25}.opacity-75{opacity:.75}.shadow-\\[0_0px_10px_0px_rgba\\(0\\,0\\,0\\,0\\.3\\)\\]{--tw-shadow: 0 0px 10px 0px rgba(0,0,0,.3);--tw-shadow-colored: 0 0px 10px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_0px_30px_0px_rgba\\(0\\,0\\,0\\,0\\.6\\)\\]{--tw-shadow: 0 0px 30px 0px rgba(0,0,0,.6);--tw-shadow-colored: 0 0px 30px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline-dashed{outline-style:dashed}.outline-1{outline-width:1px}.outline-offset-4{outline-offset:4px}.outline-cyan-500{outline-color:#06b6d4}.outline-green-500{outline-color:#22c55e}.outline-neutral-500{outline-color:#737373}.outline-orange-500{outline-color:#f97316}.outline-purple-500{outline-color:#a855f7}.outline-red-500{outline-color:#ef4444}.outline-stone-500{outline-color:#78716c}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.hover\\:bg-cyan-700:hover{--tw-bg-opacity: 1;background-color:rgb(14 116 144 / var(--tw-bg-opacity))}.hover\\:bg-cyan-800:hover{--tw-bg-opacity: 1;background-color:rgb(21 94 117 / var(--tw-bg-opacity))}.hover\\:bg-cyan-900:hover{--tw-bg-opacity: 1;background-color:rgb(22 78 99 / var(--tw-bg-opacity))}.hover\\:bg-cyan-950:hover{--tw-bg-opacity: 1;background-color:rgb(8 51 68 / var(--tw-bg-opacity))}.hover\\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity))}.hover\\:bg-green-800:hover{--tw-bg-opacity: 1;background-color:rgb(22 101 52 / var(--tw-bg-opacity))}.hover\\:bg-green-900:hover{--tw-bg-opacity: 1;background-color:rgb(20 83 45 / var(--tw-bg-opacity))}.hover\\:bg-green-950:hover{--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity))}.hover\\:bg-neutral-700:hover{--tw-bg-opacity: 1;background-color:rgb(64 64 64 / var(--tw-bg-opacity))}.hover\\:bg-neutral-800:hover{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.hover\\:bg-neutral-900:hover{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity))}.hover\\:bg-neutral-950:hover{--tw-bg-opacity: 1;background-color:rgb(10 10 10 / var(--tw-bg-opacity))}.hover\\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity))}.hover\\:bg-orange-800:hover{--tw-bg-opacity: 1;background-color:rgb(154 52 18 / var(--tw-bg-opacity))}.hover\\:bg-orange-900:hover{--tw-bg-opacity: 1;background-color:rgb(124 45 18 / var(--tw-bg-opacity))}.hover\\:bg-orange-950:hover{--tw-bg-opacity: 1;background-color:rgb(67 20 7 / var(--tw-bg-opacity))}.hover\\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity))}.hover\\:bg-purple-800:hover{--tw-bg-opacity: 1;background-color:rgb(107 33 168 / var(--tw-bg-opacity))}.hover\\:bg-purple-900:hover{--tw-bg-opacity: 1;background-color:rgb(88 28 135 / var(--tw-bg-opacity))}.hover\\:bg-purple-950:hover{--tw-bg-opacity: 1;background-color:rgb(59 7 100 / var(--tw-bg-opacity))}.hover\\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity))}.hover\\:bg-red-800:hover{--tw-bg-opacity: 1;background-color:rgb(153 27 27 / var(--tw-bg-opacity))}.hover\\:bg-red-900:hover{--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity))}.hover\\:bg-red-950:hover{--tw-bg-opacity: 1;background-color:rgb(69 10 10 / var(--tw-bg-opacity))}.hover\\:bg-stone-700:hover{--tw-bg-opacity: 1;background-color:rgb(68 64 60 / var(--tw-bg-opacity))}.hover\\:bg-stone-800:hover{--tw-bg-opacity: 1;background-color:rgb(41 37 36 / var(--tw-bg-opacity))}.hover\\:bg-stone-900:hover{--tw-bg-opacity: 1;background-color:rgb(28 25 23 / var(--tw-bg-opacity))}.hover\\:bg-stone-950:hover{--tw-bg-opacity: 1;background-color:rgb(12 10 9 / var(--tw-bg-opacity))}.disabled\\:cursor-default:disabled{cursor:default}.disabled\\:bg-neutral-400:disabled{--tw-bg-opacity: 1;background-color:rgb(163 163 163 / var(--tw-bg-opacity))}.disabled\\:text-neutral-200:disabled{--tw-text-opacity: 1;color:rgb(229 229 229 / var(--tw-text-opacity))}.group:hover .group-hover\\:underline{text-decoration-line:underline}@media (min-width: 640px){.sm\\:w-96{width:24rem}}';function U(){}function je(t){return t()}function Rn(){return Object.create(null)}function Be(t){t.forEach(je)}function qt(t){return typeof t=="function"}function jt(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let gt;function Ge(t,e){return t===e?!0:(gt||(gt=document.createElement("a")),gt.href=e,t===gt.href)}function vo(t){return Object.keys(t).length===0}function xo(t,...e){if(t==null){for(const r of e)r(void 0);return U}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function Eo(t,e,n){t.$$.on_destroy.push(xo(e,n))}const _o=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function B(t,e){t.appendChild(e)}function H(t,e,n){t.insertBefore(e,n||null)}function R(t){t.parentNode&&t.parentNode.removeChild(t)}function O(t){return document.createElement(t)}function $t(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function z(t){return document.createTextNode(t)}function Z(){return z(" ")}function Hn(){return z("")}function te(t,e,n,r){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)}function E(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function ko(t){return Array.from(t.childNodes)}function Ie(t,e){e=""+e,t.data!==e&&(t.data=e)}function Un(t,e){t.value=e??""}function Mn(t,e,n){t.classList.toggle(e,!!n)}let at;function lt(t){at=t}function So(){if(!at)throw new Error("Function called outside component initialization");return at}function Ao(t){So().$$.on_mount.push(t)}const Ye=[],pt=[];let Ze=[];const qn=[],Bo=Promise.resolve();let zt=!1;function Io(){zt||(zt=!0,Bo.then(jn))}function Kt(t){Ze.push(t)}const Wt=new Set;let Je=0;function jn(){if(Je!==0)return;const t=at;do{try{for(;Je<Ye.length;){const e=Ye[Je];Je++,lt(e),Oo(e.$$)}}catch(e){throw Ye.length=0,Je=0,e}for(lt(null),Ye.length=0,Je=0;pt.length;)pt.pop()();for(let e=0;e<Ze.length;e+=1){const n=Ze[e];Wt.has(n)||(Wt.add(n),n())}Ze.length=0}while(Ye.length);for(;qn.length;)qn.pop()();zt=!1,Wt.clear(),lt(t)}function Oo(t){if(t.fragment!==null){t.update(),Be(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(Kt)}}function To(t){const e=[],n=[];Ze.forEach(r=>t.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),Ze=e}const wt=new Set;let $e;function yt(){$e={r:0,c:[],p:$e}}function mt(){$e.r||Be($e.c),$e=$e.p}function he(t,e){t&&t.i&&(wt.delete(t),t.i(e))}function ge(t,e,n,r){if(t&&t.o){if(wt.has(t))return;wt.add(t),$e.c.push(()=>{wt.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}function $n(t){t&&t.c()}function Dt(t,e,n){const{fragment:r,after_update:o}=t.$$;r&&r.m(e,n),Kt(()=>{const i=t.$$.on_mount.map(je).filter(qt);t.$$.on_destroy?t.$$.on_destroy.push(...i):Be(i),t.$$.on_mount=[]}),o.forEach(Kt)}function Vt(t,e){const n=t.$$;n.fragment!==null&&(To(n.after_update),Be(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function No(t,e){t.$$.dirty[0]===-1&&(Ye.push(t),Io(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function zn(t,e,n,r,o,i,s=null,c=[-1]){const a=at;lt(t);const l=t.$$={fragment:null,ctx:[],props:i,update:U,not_equal:o,bound:Rn(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(a?a.$$.context:[])),callbacks:Rn(),dirty:c,skip_bound:!1,root:e.target||a.$$.root};s&&s(l.root);let f=!1;if(l.ctx=n?n(t,e.props||{},(u,h,...d)=>{const w=d.length?d[0]:h;return l.ctx&&o(l.ctx[u],l.ctx[u]=w)&&(!l.skip_bound&&l.bound[u]&&l.bound[u](w),f&&No(t,u)),h}):[],l.update(),f=!0,Be(l.before_update),l.fragment=r?r(l.ctx):!1,e.target){if(e.hydrate){const u=ko(e.target);l.fragment&&l.fragment.l(u),u.forEach(R)}else l.fragment&&l.fragment.c();e.intro&&he(t.$$.fragment),Dt(t,e.target,e.anchor),jn()}lt(a)}class Kn{constructor(){v(this,"$$");v(this,"$$set")}$destroy(){Vt(this,1),this.$destroy=U}$on(e,n){if(!qt(n))return U;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const o=r.indexOf(n);o!==-1&&r.splice(o,1)}}$set(e){this.$$set&&!vo(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const Po="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Po);function Co(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ft={exports:{}};function Wn(t,e=100,n={}){if(typeof t!="function")throw new TypeError(`Expected the first parameter to be a function, got \`${typeof t}\`.`);if(e<0)throw new RangeError("`wait` must not be negative.");const{immediate:r}=typeof n=="boolean"?{immediate:n}:n;let o,i,s,c,a;function l(){const u=Date.now()-c;if(u<e&&u>=0)s=setTimeout(l,e-u);else if(s=void 0,!r){const h=o,d=i;o=void 0,i=void 0,a=t.apply(h,d)}}const f=function(...u){if(o&&this!==o)throw new Error("Debounced method called with different contexts.");o=this,i=u,c=Date.now();const h=r&&!s;if(s||(s=setTimeout(l,e)),h){const d=o,w=i;o=void 0,i=void 0,a=t.apply(d,w)}return a};return f.clear=()=>{s&&(clearTimeout(s),s=void 0)},f.flush=()=>{if(!s)return;const u=o,h=i;o=void 0,i=void 0,a=t.apply(u,h),clearTimeout(s),s=void 0},f}Ft.exports.debounce=Wn,Ft.exports=Wn;var Lo=Ft.exports;const Ro=Co(Lo),Gt=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Yt=t=>t instanceof Uint8Array,Zt=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),pe=(t,e)=>t<<32-e|t>>>e;if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");const Ho=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function ce(t){if(!Yt(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n<t.length;n++)e+=Ho[t[n]];return e}function Dn(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(e/2);for(let r=0;r<n.length;r++){const o=r*2,i=t.slice(o,o+2),s=Number.parseInt(i,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");n[r]=s}return n}function Uo(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function ut(t){if(typeof t=="string"&&(t=Uo(t)),!Yt(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function Jt(...t){const e=new Uint8Array(t.reduce((r,o)=>r+o.length,0));let n=0;return t.forEach(r=>{if(!Yt(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}let Vn=class{clone(){return this._cloneInto()}};function Fn(t){const e=r=>t().update(ut(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function Mo(t=32){if(Gt&&typeof Gt.getRandomValues=="function")return Gt.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}function Gn(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function Yn(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function qo(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Gn(t.outputLen),Gn(t.blockLen)}function vt(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function jo(t,e){Yn(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const Qt=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Zn=t=>t instanceof Uint8Array,Xt=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),we=(t,e)=>t<<32-e|t>>>e;if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");function $o(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function en(t){if(typeof t=="string"&&(t=$o(t)),!Zn(t))throw new Error(`expected Uint8Array, got ${typeof t}`);return t}function zo(...t){const e=new Uint8Array(t.reduce((r,o)=>r+o.length,0));let n=0;return t.forEach(r=>{if(!Zn(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}class Jn{clone(){return this._cloneInto()}}function Ko(t){const e=r=>t().update(en(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function Qn(t=32){if(Qt&&typeof Qt.getRandomValues=="function")return Qt.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}function Wo(t,e,n,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,r);const o=BigInt(32),i=BigInt(4294967295),s=Number(n>>o&i),c=Number(n&i),a=r?4:0,l=r?0:4;t.setUint32(e+a,s,r),t.setUint32(e+l,c,r)}let Do=class extends Jn{constructor(e,n,r,o){super(),this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Xt(this.buffer)}update(e){vt(this);const{view:n,buffer:r,blockLen:o}=this;e=en(e);const i=e.length;for(let s=0;s<i;){const c=Math.min(o-this.pos,i-s);if(c===o){const a=Xt(e);for(;o<=i-s;s+=o)this.process(a,s);continue}r.set(e.subarray(s,s+c),this.pos),this.pos+=c,s+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){vt(this),jo(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:i}=this;let{pos:s}=this;n[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>o-s&&(this.process(r,0),s=0);for(let u=s;u<o;u++)n[u]=0;Wo(r,o-8,BigInt(this.length*8),i),this.process(r,0);const c=Xt(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,f=this.get();if(l>f.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)c.setUint32(4*u,f[u],i)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:i,destroyed:s,pos:c}=this;return e.length=o,e.pos=c,e.finished=i,e.destroyed=s,o%n&&e.buffer.set(r),e}};const Vo=(t,e,n)=>t&e^~t&n,Fo=(t,e,n)=>t&e^t&n^e&n,Go=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]),Oe=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Te=new Uint32Array(64);let Yo=class extends Do{constructor(){super(64,32,8,!1),this.A=Oe[0]|0,this.B=Oe[1]|0,this.C=Oe[2]|0,this.D=Oe[3]|0,this.E=Oe[4]|0,this.F=Oe[5]|0,this.G=Oe[6]|0,this.H=Oe[7]|0}get(){const{A:e,B:n,C:r,D:o,E:i,F:s,G:c,H:a}=this;return[e,n,r,o,i,s,c,a]}set(e,n,r,o,i,s,c,a){this.A=e|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=i|0,this.F=s|0,this.G=c|0,this.H=a|0}process(e,n){for(let u=0;u<16;u++,n+=4)Te[u]=e.getUint32(n,!1);for(let u=16;u<64;u++){const h=Te[u-15],d=Te[u-2],w=we(h,7)^we(h,18)^h>>>3,b=we(d,17)^we(d,19)^d>>>10;Te[u]=b+Te[u-7]+w+Te[u-16]|0}let{A:r,B:o,C:i,D:s,E:c,F:a,G:l,H:f}=this;for(let u=0;u<64;u++){const h=we(c,6)^we(c,11)^we(c,25),d=f+h+Vo(c,a,l)+Go[u]+Te[u]|0,b=(we(r,2)^we(r,13)^we(r,22))+Fo(r,o,i)|0;f=l,l=a,a=c,c=s+d|0,s=i,i=o,o=r,r=d+b|0}r=r+this.A|0,o=o+this.B|0,i=i+this.C|0,s=s+this.D|0,c=c+this.E|0,a=a+this.F|0,l=l+this.G|0,f=f+this.H|0,this.set(r,o,i,s,c,a,l,f)}roundClean(){Te.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const tn=Ko(()=>new Yo);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Xn=BigInt(0),xt=BigInt(1),Zo=BigInt(2),Et=t=>t instanceof Uint8Array,Jo=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Qe(t){if(!Et(t))throw new Error("Uint8Array expected");let e="";for(let n=0;n<t.length;n++)e+=Jo[t[n]];return e}function er(t){const e=t.toString(16);return e.length&1?`0${e}`:e}function nn(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}function Xe(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);const e=t.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const n=new Uint8Array(e/2);for(let r=0;r<n.length;r++){const o=r*2,i=t.slice(o,o+2),s=Number.parseInt(i,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");n[r]=s}return n}function se(t){return nn(Qe(t))}function rn(t){if(!Et(t))throw new Error("Uint8Array expected");return nn(Qe(Uint8Array.from(t).reverse()))}function Ne(t,e){return Xe(t.toString(16).padStart(e*2,"0"))}function on(t,e){return Ne(t,e).reverse()}function Qo(t){return Xe(er(t))}function re(t,e,n){let r;if(typeof e=="string")try{r=Xe(e)}catch(i){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${i}`)}else if(Et(e))r=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);const o=r.length;if(typeof n=="number"&&o!==n)throw new Error(`${t} expected ${n} bytes, got ${o}`);return r}function ze(...t){const e=new Uint8Array(t.reduce((r,o)=>r+o.length,0));let n=0;return t.forEach(r=>{if(!Et(r))throw new Error("Uint8Array expected");e.set(r,n),n+=r.length}),e}function Xo(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function ei(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function ti(t){let e;for(e=0;t>Xn;t>>=xt,e+=1);return e}function ni(t,e){return t>>BigInt(e)&xt}const ri=(t,e,n)=>t|(n?xt:Xn)<<BigInt(e),sn=t=>(Zo<<BigInt(t-1))-xt,cn=t=>new Uint8Array(t),tr=t=>Uint8Array.from(t);function nr(t,e,n){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=cn(t),o=cn(t),i=0;const s=()=>{r.fill(1),o.fill(0),i=0},c=(...u)=>n(o,r,...u),a=(u=cn())=>{o=c(tr([0]),u),r=c(),u.length!==0&&(o=c(tr([1]),u),r=c())},l=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let u=0;const h=[];for(;u<e;){r=c();const d=r.slice();h.push(d),u+=r.length}return ze(...h)};return(u,h)=>{s(),a(u);let d;for(;!(d=h(l()));)a();return s(),d}}const oi={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",stringOrUint8Array:t=>typeof t=="string"||t instanceof Uint8Array,isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function ft(t,e,n={}){const r=(o,i,s)=>{const c=oi[i];if(typeof c!="function")throw new Error(`Invalid validator "${i}", expected function`);const a=t[o];if(!(s&&a===void 0)&&!c(a,t))throw new Error(`Invalid param ${String(o)}=${a} (${typeof a}), expected ${i}`)};for(const[o,i]of Object.entries(e))r(o,i,!1);for(const[o,i]of Object.entries(n))r(o,i,!0);return t}const ii=Object.freeze(Object.defineProperty({__proto__:null,bitGet:ni,bitLen:ti,bitMask:sn,bitSet:ri,bytesToHex:Qe,bytesToNumberBE:se,bytesToNumberLE:rn,concatBytes:ze,createHmacDrbg:nr,ensureBytes:re,equalBytes:Xo,hexToBytes:Xe,hexToNumber:nn,numberToBytesBE:Ne,numberToBytesLE:on,numberToHexUnpadded:er,numberToVarBytesBE:Qo,utf8ToBytes:ei,validateObject:ft},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const X=BigInt(0),J=BigInt(1),Ke=BigInt(2),si=BigInt(3),an=BigInt(4),rr=BigInt(5),or=BigInt(8);BigInt(9),BigInt(16);function ne(t,e){const n=t%e;return n>=X?n:e+n}function ci(t,e,n){if(n<=X||e<X)throw new Error("Expected power/modulo > 0");if(n===J)return X;let r=J;for(;e>X;)e&J&&(r=r*t%n),t=t*t%n,e>>=J;return r}function ue(t,e,n){let r=t;for(;e-- >X;)r*=r,r%=n;return r}function ln(t,e){if(t===X||e<=X)throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);let n=ne(t,e),r=e,o=X,i=J;for(;n!==X;){const c=r/n,a=r%n,l=o-i*c;r=n,n=a,o=i,i=l}if(r!==J)throw new Error("invert: does not exist");return ne(o,e)}function ai(t){const e=(t-J)/Ke;let n,r,o;for(n=t-J,r=0;n%Ke===X;n/=Ke,r++);for(o=Ke;o<t&&ci(o,e,t)!==t-J;o++);if(r===1){const s=(t+J)/an;return function(a,l){const f=a.pow(l,s);if(!a.eql(a.sqr(f),l))throw new Error("Cannot find square root");return f}}const i=(n+J)/Ke;return function(c,a){if(c.pow(a,e)===c.neg(c.ONE))throw new Error("Cannot find square root");let l=r,f=c.pow(c.mul(c.ONE,o),n),u=c.pow(a,i),h=c.pow(a,n);for(;!c.eql(h,c.ONE);){if(c.eql(h,c.ZERO))return c.ZERO;let d=1;for(let b=c.sqr(h);d<l&&!c.eql(b,c.ONE);d++)b=c.sqr(b);const w=c.pow(f,J<<BigInt(l-d-1));f=c.sqr(w),u=c.mul(u,w),h=c.mul(h,f),l=d}return u}}function li(t){if(t%an===si){const e=(t+J)/an;return function(r,o){const i=r.pow(o,e);if(!r.eql(r.sqr(i),o))throw new Error("Cannot find square root");return i}}if(t%or===rr){const e=(t-rr)/or;return function(r,o){const i=r.mul(o,Ke),s=r.pow(i,e),c=r.mul(o,s),a=r.mul(r.mul(c,Ke),s),l=r.mul(c,r.sub(a,r.ONE));if(!r.eql(r.sqr(l),o))throw new Error("Cannot find square root");return l}}return ai(t)}const ui=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function fi(t){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=ui.reduce((r,o)=>(r[o]="function",r),e);return ft(t,n)}function di(t,e,n){if(n<X)throw new Error("Expected power > 0");if(n===X)return t.ONE;if(n===J)return e;let r=t.ONE,o=e;for(;n>X;)n&J&&(r=t.mul(r,o)),o=t.sqr(o),n>>=J;return r}function hi(t,e){const n=new Array(e.length),r=e.reduce((i,s,c)=>t.is0(s)?i:(n[c]=i,t.mul(i,s)),t.ONE),o=t.inv(r);return e.reduceRight((i,s,c)=>t.is0(s)?i:(n[c]=t.mul(i,n[c]),t.mul(i,s)),o),n}function ir(t,e){const n=e!==void 0?e:t.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function bi(t,e,n=!1,r={}){if(t<=X)throw new Error(`Expected Field ORDER > 0, got ${t}`);const{nBitLength:o,nByteLength:i}=ir(t,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=li(t),c=Object.freeze({ORDER:t,BITS:o,BYTES:i,MASK:sn(o),ZERO:X,ONE:J,create:a=>ne(a,t),isValid:a=>{if(typeof a!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof a}`);return X<=a&&a<t},is0:a=>a===X,isOdd:a=>(a&J)===J,neg:a=>ne(-a,t),eql:(a,l)=>a===l,sqr:a=>ne(a*a,t),add:(a,l)=>ne(a+l,t),sub:(a,l)=>ne(a-l,t),mul:(a,l)=>ne(a*l,t),pow:(a,l)=>di(c,a,l),div:(a,l)=>ne(a*ln(l,t),t),sqrN:a=>a*a,addN:(a,l)=>a+l,subN:(a,l)=>a-l,mulN:(a,l)=>a*l,inv:a=>ln(a,t),sqrt:r.sqrt||(a=>s(c,a)),invertBatch:a=>hi(c,a),cmov:(a,l,f)=>f?l:a,toBytes:a=>n?on(a,i):Ne(a,i),fromBytes:a=>{if(a.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${a.length}`);return n?rn(a):se(a)}});return Object.freeze(c)}function sr(t){if(typeof t!="bigint")throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function cr(t){const e=sr(t);return e+Math.ceil(e/2)}function gi(t,e,n=!1){const r=t.length,o=sr(e),i=cr(e);if(r<16||r<i||r>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${r}`);const s=n?se(t):rn(t),c=ne(s,e-J)+J;return n?on(c,o):Ne(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const pi=BigInt(0),un=BigInt(1);function wi(t,e){const n=(o,i)=>{const s=i.negate();return o?s:i},r=o=>{const i=Math.ceil(e/o)+1,s=2**(o-1);return{windows:i,windowSize:s}};return{constTimeNegate:n,unsafeLadder(o,i){let s=t.ZERO,c=o;for(;i>pi;)i&un&&(s=s.add(c)),c=c.double(),i>>=un;return s},precomputeWindow(o,i){const{windows:s,windowSize:c}=r(i),a=[];let l=o,f=l;for(let u=0;u<s;u++){f=l,a.push(f);for(let h=1;h<c;h++)f=f.add(l),a.push(f);l=f.double()}return a},wNAF(o,i,s){const{windows:c,windowSize:a}=r(o);let l=t.ZERO,f=t.BASE;const u=BigInt(2**o-1),h=2**o,d=BigInt(o);for(let w=0;w<c;w++){const b=w*a;let g=Number(s&u);s>>=d,g>a&&(g-=h,s+=un);const p=b,y=b+Math.abs(g)-1,k=w%2!==0,C=g<0;g===0?f=f.add(n(k,i[p])):l=l.add(n(C,i[y]))}return{p:l,f}},wNAFCached(o,i,s,c){const a=o._WINDOW_SIZE||1;let l=i.get(o);return l||(l=this.precomputeWindow(o,a),a!==1&&i.set(o,c(l))),this.wNAF(a,l,s)}}}function ar(t){return fi(t.Fp),ft(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...ir(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function yi(t){const e=ar(t);ft(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:o}=e;if(n){if(!r.eql(o,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({...e})}const{bytesToNumberBE:mi,hexToBytes:vi}=ii,We={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(t){const{Err:e}=We;if(t.length<2||t[0]!==2)throw new e("Invalid signature integer tag");const n=t[1],r=t.subarray(2,n+2);if(!n||r.length!==n)throw new e("Invalid signature integer: wrong length");if(r[0]&128)throw new e("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:mi(r),l:t.subarray(n+2)}},toSig(t){const{Err:e}=We,n=typeof t=="string"?vi(t):t;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||n[0]!=48)throw new e("Invalid signature tag");if(n[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:o,l:i}=We._parseInt(n.subarray(2)),{d:s,l:c}=We._parseInt(i);if(c.length)throw new e("Invalid signature: left bytes after parsing");return{r:o,s}},hexFromSig(t){const e=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=e(n(t.s)),o=e(n(t.r)),i=r.length/2,s=o.length/2,c=n(i),a=n(s);return`30${n(s+i+4)}02${a}${o}02${c}${r}`}},ve=BigInt(0),fe=BigInt(1);BigInt(2);const lr=BigInt(3);BigInt(4);function xi(t){const e=yi(t),{Fp:n}=e,r=e.toBytes||((w,b,g)=>{const p=b.toAffine();return ze(Uint8Array.from([4]),n.toBytes(p.x),n.toBytes(p.y))}),o=e.fromBytes||(w=>{const b=w.subarray(1),g=n.fromBytes(b.subarray(0,n.BYTES)),p=n.fromBytes(b.subarray(n.BYTES,2*n.BYTES));return{x:g,y:p}});function i(w){const{a:b,b:g}=e,p=n.sqr(w),y=n.mul(p,w);return n.add(n.add(y,n.mul(w,b)),g)}if(!n.eql(n.sqr(e.Gy),i(e.Gx)))throw new Error("bad generator point: equation left != right");function s(w){return typeof w=="bigint"&&ve<w&&w<e.n}function c(w){if(!s(w))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function a(w){const{allowedPrivateKeyLengths:b,nByteLength:g,wrapPrivateKey:p,n:y}=e;if(b&&typeof w!="bigint"){if(w instanceof Uint8Array&&(w=Qe(w)),typeof w!="string"||!b.includes(w.length))throw new Error("Invalid key");w=w.padStart(g*2,"0")}let k;try{k=typeof w=="bigint"?w:se(re("private key",w,g))}catch{throw new Error(`private key must be ${g} bytes, hex or bigint, not ${typeof w}`)}return p&&(k=ne(k,y)),c(k),k}const l=new Map;function f(w){if(!(w instanceof u))throw new Error("ProjectivePoint expected")}class u{constructor(b,g,p){if(this.px=b,this.py=g,this.pz=p,b==null||!n.isValid(b))throw new Error("x required");if(g==null||!n.isValid(g))throw new Error("y required");if(p==null||!n.isValid(p))throw new Error("z required")}static fromAffine(b){const{x:g,y:p}=b||{};if(!b||!n.isValid(g)||!n.isValid(p))throw new Error("invalid affine point");if(b instanceof u)throw new Error("projective point not allowed");const y=k=>n.eql(k,n.ZERO);return y(g)&&y(p)?u.ZERO:new u(g,p,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(b){const g=n.invertBatch(b.map(p=>p.pz));return b.map((p,y)=>p.toAffine(g[y])).map(u.fromAffine)}static fromHex(b){const g=u.fromAffine(o(re("pointHex",b)));return g.assertValidity(),g}static fromPrivateKey(b){return u.BASE.multiply(a(b))}_setWindowSize(b){this._WINDOW_SIZE=b,l.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:b,y:g}=this.toAffine();if(!n.isValid(b)||!n.isValid(g))throw new Error("bad point: x or y not FE");const p=n.sqr(g),y=i(b);if(!n.eql(p,y))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:b}=this.toAffine();if(n.isOdd)return!n.isOdd(b);throw new Error("Field doesn't support isOdd")}equals(b){f(b);const{px:g,py:p,pz:y}=this,{px:k,py:C,pz:T}=b,S=n.eql(n.mul(g,T),n.mul(k,y)),_=n.eql(n.mul(p,T),n.mul(C,y));return S&&_}negate(){return new u(this.px,n.neg(this.py),this.pz)}double(){const{a:b,b:g}=e,p=n.mul(g,lr),{px:y,py:k,pz:C}=this;let T=n.ZERO,S=n.ZERO,_=n.ZERO,m=n.mul(y,y),N=n.mul(k,k),L=n.mul(C,C),q=n.mul(y,k);return q=n.add(q,q),_=n.mul(y,C),_=n.add(_,_),T=n.mul(b,_),S=n.mul(p,L),S=n.add(T,S),T=n.sub(N,S),S=n.add(N,S),S=n.mul(T,S),T=n.mul(q,T),_=n.mul(p,_),L=n.mul(b,L),q=n.sub(m,L),q=n.mul(b,q),q=n.add(q,_),_=n.add(m,m),m=n.add(_,m),m=n.add(m,L),m=n.mul(m,q),S=n.add(S,m),L=n.mul(k,C),L=n.add(L,L),m=n.mul(L,q),T=n.sub(T,m),_=n.mul(L,N),_=n.add(_,_),_=n.add(_,_),new u(T,S,_)}add(b){f(b);const{px:g,py:p,pz:y}=this,{px:k,py:C,pz:T}=b;let S=n.ZERO,_=n.ZERO,m=n.ZERO;const N=e.a,L=n.mul(e.b,lr);let q=n.mul(g,k),G=n.mul(p,C),K=n.mul(y,T),W=n.add(g,p),x=n.add(k,C);W=n.mul(W,x),x=n.add(q,G),W=n.sub(W,x),x=n.add(g,y);let A=n.add(k,T);return x=n.mul(x,A),A=n.add(q,K),x=n.sub(x,A),A=n.add(p,y),S=n.add(C,T),A=n.mul(A,S),S=n.add(G,K),A=n.sub(A,S),m=n.mul(N,x),S=n.mul(L,K),m=n.add(S,m),S=n.sub(G,m),m=n.add(G,m),_=n.mul(S,m),G=n.add(q,q),G=n.add(G,q),K=n.mul(N,K),x=n.mul(L,x),G=n.add(G,K),K=n.sub(q,K),K=n.mul(N,K),x=n.add(x,K),q=n.mul(G,x),_=n.add(_,q),q=n.mul(A,x),S=n.mul(W,S),S=n.sub(S,q),q=n.mul(W,G),m=n.mul(A,m),m=n.add(m,q),new u(S,_,m)}subtract(b){return this.add(b.negate())}is0(){return this.equals(u.ZERO)}wNAF(b){return d.wNAFCached(this,l,b,g=>{const p=n.invertBatch(g.map(y=>y.pz));return g.map((y,k)=>y.toAffine(p[k])).map(u.fromAffine)})}multiplyUnsafe(b){const g=u.ZERO;if(b===ve)return g;if(c(b),b===fe)return this;const{endo:p}=e;if(!p)return d.unsafeLadder(this,b);let{k1neg:y,k1:k,k2neg:C,k2:T}=p.splitScalar(b),S=g,_=g,m=this;for(;k>ve||T>ve;)k&fe&&(S=S.add(m)),T&fe&&(_=_.add(m)),m=m.double(),k>>=fe,T>>=fe;return y&&(S=S.negate()),C&&(_=_.negate()),_=new u(n.mul(_.px,p.beta),_.py,_.pz),S.add(_)}multiply(b){c(b);let g=b,p,y;const{endo:k}=e;if(k){const{k1neg:C,k1:T,k2neg:S,k2:_}=k.splitScalar(g);let{p:m,f:N}=this.wNAF(T),{p:L,f:q}=this.wNAF(_);m=d.constTimeNegate(C,m),L=d.constTimeNegate(S,L),L=new u(n.mul(L.px,k.beta),L.py,L.pz),p=m.add(L),y=N.add(q)}else{const{p:C,f:T}=this.wNAF(g);p=C,y=T}return u.normalizeZ([p,y])[0]}multiplyAndAddUnsafe(b,g,p){const y=u.BASE,k=(T,S)=>S===ve||S===fe||!T.equals(y)?T.multiplyUnsafe(S):T.multiply(S),C=k(this,g).add(k(b,p));return C.is0()?void 0:C}toAffine(b){const{px:g,py:p,pz:y}=this,k=this.is0();b==null&&(b=k?n.ONE:n.inv(y));const C=n.mul(g,b),T=n.mul(p,b),S=n.mul(y,b);if(k)return{x:n.ZERO,y:n.ZERO};if(!n.eql(S,n.ONE))throw new Error("invZ was invalid");return{x:C,y:T}}isTorsionFree(){const{h:b,isTorsionFree:g}=e;if(b===fe)return!0;if(g)return g(u,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:b,clearCofactor:g}=e;return b===fe?this:g?g(u,this):this.multiplyUnsafe(e.h)}toRawBytes(b=!0){return this.assertValidity(),r(u,this,b)}toHex(b=!0){return Qe(this.toRawBytes(b))}}u.BASE=new u(e.Gx,e.Gy,n.ONE),u.ZERO=new u(n.ZERO,n.ONE,n.ZERO);const h=e.nBitLength,d=wi(u,e.endo?Math.ceil(h/2):h);return{CURVE:e,ProjectivePoint:u,normPrivateKeyToScalar:a,weierstrassEquation:i,isWithinCurveOrder:s}}function Ei(t){const e=ar(t);return ft(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function _i(t){const e=Ei(t),{Fp:n,n:r}=e,o=n.BYTES+1,i=2*n.BYTES+1;function s(x){return ve<x&&x<n.ORDER}function c(x){return ne(x,r)}function a(x){return ln(x,r)}const{ProjectivePoint:l,normPrivateKeyToScalar:f,weierstrassEquation:u,isWithinCurveOrder:h}=xi({...e,toBytes(x,A,P){const j=A.toAffine(),M=n.toBytes(j.x),$=ze;return P?$(Uint8Array.from([A.hasEvenY()?2:3]),M):$(Uint8Array.from([4]),M,n.toBytes(j.y))},fromBytes(x){const A=x.length,P=x[0],j=x.subarray(1);if(A===o&&(P===2||P===3)){const M=se(j);if(!s(M))throw new Error("Point is not on curve");const $=u(M);let D=n.sqrt($);const F=(D&fe)===fe;return(P&1)===1!==F&&(D=n.neg(D)),{x:M,y:D}}else if(A===i&&P===4){const M=n.fromBytes(j.subarray(0,n.BYTES)),$=n.fromBytes(j.subarray(n.BYTES,2*n.BYTES));return{x:M,y:$}}else throw new Error(`Point of length ${A} was invalid. Expected ${o} compressed bytes or ${i} uncompressed bytes`)}}),d=x=>Qe(Ne(x,e.nByteLength));function w(x){const A=r>>fe;return x>A}function b(x){return w(x)?c(-x):x}const g=(x,A,P)=>se(x.slice(A,P));class p{constructor(A,P,j){this.r=A,this.s=P,this.recovery=j,this.assertValidity()}static fromCompact(A){const P=e.nByteLength;return A=re("compactSignature",A,P*2),new p(g(A,0,P),g(A,P,2*P))}static fromDER(A){const{r:P,s:j}=We.toSig(re("DER",A));return new p(P,j)}assertValidity(){if(!h(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!h(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(A){return new p(this.r,this.s,A)}recoverPublicKey(A){const{r:P,s:j,recovery:M}=this,$=_(re("msgHash",A));if(M==null||![0,1,2,3].includes(M))throw new Error("recovery id invalid");const D=M===2||M===3?P+e.n:P;if(D>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const F=M&1?"03":"02",Q=l.fromHex(F+d(D)),de=a(D),ee=c(-$*de),me=c(j*de),be=l.BASE.multiplyAndAddUnsafe(Q,ee,me);if(!be)throw new Error("point at infinify");return be.assertValidity(),be}hasHighS(){return w(this.s)}normalizeS(){return this.hasHighS()?new p(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return Xe(this.toDERHex())}toDERHex(){return We.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Xe(this.toCompactHex())}toCompactHex(){return d(this.r)+d(this.s)}}const y={isValidPrivateKey(x){try{return f(x),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const x=cr(e.n);return gi(e.randomBytes(x),e.n)},precompute(x=8,A=l.BASE){return A._setWindowSize(x),A.multiply(BigInt(3)),A}};function k(x,A=!0){return l.fromPrivateKey(x).toRawBytes(A)}function C(x){const A=x instanceof Uint8Array,P=typeof x=="string",j=(A||P)&&x.length;return A?j===o||j===i:P?j===2*o||j===2*i:x instanceof l}function T(x,A,P=!0){if(C(x))throw new Error("first arg must be private key");if(!C(A))throw new Error("second arg must be public key");return l.fromHex(A).multiply(f(x)).toRawBytes(P)}const S=e.bits2int||function(x){const A=se(x),P=x.length*8-e.nBitLength;return P>0?A>>BigInt(P):A},_=e.bits2int_modN||function(x){return c(S(x))},m=sn(e.nBitLength);function N(x){if(typeof x!="bigint")throw new Error("bigint expected");if(!(ve<=x&&x<m))throw new Error(`bigint expected < 2^${e.nBitLength}`);return Ne(x,e.nByteLength)}function L(x,A,P=q){if(["recovered","canonical"].some(ae=>ae in P))throw new Error("sign() legacy options not supported");const{hash:j,randomBytes:M}=e;let{lowS:$,prehash:D,extraEntropy:F}=P;$==null&&($=!0),x=re("msgHash",x),D&&(x=re("prehashed msgHash",j(x)));const Q=_(x),de=f(A),ee=[N(de),N(Q)];if(F!=null){const ae=F===!0?M(n.BYTES):F;ee.push(re("extraEntropy",ae))}const me=ze(...ee),be=Q;function Fe(ae){const ke=S(ae);if(!h(ke))return;const bt=a(ke),Se=l.BASE.multiply(ke).toAffine(),le=c(Se.x);if(le===ve)return;const Ae=c(bt*c(be+le*de));if(Ae===ve)return;let Ue=(Se.x===le?0:2)|Number(Se.y&fe),Me=Ae;return $&&w(Ae)&&(Me=b(Ae),Ue^=1),new p(le,Me,Ue)}return{seed:me,k2sig:Fe}}const q={lowS:e.lowS,prehash:!1},G={lowS:e.lowS,prehash:!1};function K(x,A,P=q){const{seed:j,k2sig:M}=L(x,A,P),$=e;return nr($.hash.outputLen,$.nByteLength,$.hmac)(j,M)}l.BASE._setWindowSize(8);function W(x,A,P,j=G){var Se;const M=x;if(A=re("msgHash",A),P=re("publicKey",P),"strict"in j)throw new Error("options.strict was renamed to lowS");const{lowS:$,prehash:D}=j;let F,Q;try{if(typeof M=="string"||M instanceof Uint8Array)try{F=p.fromDER(M)}catch(le){if(!(le instanceof We.Err))throw le;F=p.fromCompact(M)}else if(typeof M=="object"&&typeof M.r=="bigint"&&typeof M.s=="bigint"){const{r:le,s:Ae}=M;F=new p(le,Ae)}else throw new Error("PARSE");Q=l.fromHex(P)}catch(le){if(le.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if($&&F.hasHighS())return!1;D&&(A=e.hash(A));const{r:de,s:ee}=F,me=_(A),be=a(ee),Fe=c(me*be),ae=c(de*be),ke=(Se=l.BASE.multiplyAndAddUnsafe(Q,Fe,ae))==null?void 0:Se.toAffine();return ke?c(ke.x)===de:!1}return{CURVE:e,getPublicKey:k,getSharedSecret:T,sign:K,verify:W,ProjectivePoint:l,Signature:p,utils:y}}let ur=class extends Jn{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,qo(e);const r=en(n);if(this.iHash=e.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 o=this.blockLen,i=new Uint8Array(o);i.set(r.length>o?e.create().update(r).digest():r);for(let s=0;s<i.length;s++)i[s]^=54;this.iHash.update(i),this.oHash=e.create();for(let s=0;s<i.length;s++)i[s]^=106;this.oHash.update(i),i.fill(0)}update(e){return vt(this),this.iHash.update(e),this}digestInto(e){vt(this),Yn(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:i,blockLen:s,outputLen:c}=this;return e=e,e.finished=o,e.destroyed=i,e.blockLen=s,e.outputLen=c,e.oHash=n._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const fr=(t,e,n)=>new ur(t,e).update(n).digest();fr.create=(t,e)=>new ur(t,e);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ki(t){return{hash:t,hmac:(e,...n)=>fr(t,e,zo(...n)),randomBytes:Qn}}function Si(t,e){const n=r=>_i({...t,...ki(r)});return Object.freeze({...n(e),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _t=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),kt=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),dr=BigInt(1),St=BigInt(2),hr=(t,e)=>(t+e/St)/e;function br(t){const e=_t,n=BigInt(3),r=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),c=BigInt(44),a=BigInt(88),l=t*t*t%e,f=l*l*t%e,u=ue(f,n,e)*f%e,h=ue(u,n,e)*f%e,d=ue(h,St,e)*l%e,w=ue(d,o,e)*d%e,b=ue(w,i,e)*w%e,g=ue(b,c,e)*b%e,p=ue(g,a,e)*g%e,y=ue(p,c,e)*b%e,k=ue(y,n,e)*f%e,C=ue(k,s,e)*w%e,T=ue(C,r,e)*l%e,S=ue(T,St,e);if(!fn.eql(fn.sqr(S),t))throw new Error("Cannot find square root");return S}const fn=bi(_t,void 0,void 0,{sqrt:br}),At=Si({a:BigInt(0),b:BigInt(7),Fp:fn,n:kt,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=kt,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-dr*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,s=BigInt("0x100000000000000000000000000000000"),c=hr(i*t,e),a=hr(-r*t,e);let l=ne(t-c*n-a*o,e),f=ne(-c*r-a*i,e);const u=l>s,h=f>s;if(u&&(l=e-l),h&&(f=e-f),l>s||f>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:u,k1:l,k2neg:h,k2:f}}}},tn),Bt=BigInt(0),gr=t=>typeof t=="bigint"&&Bt<t&&t<_t,Ai=t=>typeof t=="bigint"&&Bt<t&&t<kt,pr={};function It(t,...e){let n=pr[t];if(n===void 0){const r=tn(Uint8Array.from(t,o=>o.charCodeAt(0)));n=ze(r,r),pr[t]=n}return tn(ze(n,...e))}const dn=t=>t.toRawBytes(!0).slice(1),hn=t=>Ne(t,32),bn=t=>ne(t,_t),dt=t=>ne(t,kt),gn=At.ProjectivePoint,Bi=(t,e,n)=>gn.BASE.multiplyAndAddUnsafe(t,e,n);function pn(t){let e=At.utils.normPrivateKeyToScalar(t),n=gn.fromPrivateKey(e);return{scalar:n.hasEvenY()?e:dt(-e),bytes:dn(n)}}function wr(t){if(!gr(t))throw new Error("bad x: need 0 < x < p");const e=bn(t*t),n=bn(e*t+BigInt(7));let r=br(n);r%St!==Bt&&(r=bn(-r));const o=new gn(t,r,dr);return o.assertValidity(),o}function yr(...t){return dt(se(It("BIP0340/challenge",...t)))}function Ii(t){return pn(t).bytes}function Oi(t,e,n=Qn(32)){const r=re("message",t),{bytes:o,scalar:i}=pn(e),s=re("auxRand",n,32),c=hn(i^se(It("BIP0340/aux",s))),a=It("BIP0340/nonce",c,o,r),l=dt(se(a));if(l===Bt)throw new Error("sign failed: k is zero");const{bytes:f,scalar:u}=pn(l),h=yr(f,o,r),d=new Uint8Array(64);if(d.set(f,0),d.set(hn(dt(u+h*i)),32),!mr(d,r,o))throw new Error("sign: Invalid signature produced");return d}function mr(t,e,n){const r=re("signature",t,64),o=re("message",e),i=re("publicKey",n,32);try{const s=wr(se(i)),c=se(r.subarray(0,32));if(!gr(c))return!1;const a=se(r.subarray(32,64));if(!Ai(a))return!1;const l=yr(hn(c),dn(s),o),f=Bi(s,a,dt(-l));return!(!f||!f.hasEvenY()||f.toAffine().x!==c)}catch{return!1}}const oe={getPublicKey:Ii,sign:Oi,verify:mr,utils:{randomPrivateKey:At.utils.randomPrivateKey,lift_x:wr,pointToBytes:dn,numberToBytesBE:Ne,bytesToNumberBE:se,taggedHash:It,mod:ne}};function wn(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`Wrong positive integer: ${t}`)}function Ti(t){if(typeof t!="boolean")throw new Error(`Expected boolean, not ${t}`)}function vr(t,...e){if(!(t instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(t.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`)}function Ni(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");wn(t.outputLen),wn(t.blockLen)}function Pi(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Ci(t,e){vr(t);const n=e.outputLen;if(t.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const ye={number:wn,bool:Ti,bytes:vr,hash:Ni,exists:Pi,output:Ci};function Li(t,e,n,r){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,n,r);const o=BigInt(32),i=BigInt(4294967295),s=Number(n>>o&i),c=Number(n&i),a=r?4:0,l=r?0:4;t.setUint32(e+a,s,r),t.setUint32(e+l,c,r)}class Ri extends Vn{constructor(e,n,r,o){super(),this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Zt(this.buffer)}update(e){ye.exists(this);const{view:n,buffer:r,blockLen:o}=this;e=ut(e);const i=e.length;for(let s=0;s<i;){const c=Math.min(o-this.pos,i-s);if(c===o){const a=Zt(e);for(;o<=i-s;s+=o)this.process(a,s);continue}r.set(e.subarray(s,s+c),this.pos),this.pos+=c,s+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){ye.exists(this),ye.output(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:i}=this;let{pos:s}=this;n[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>o-s&&(this.process(r,0),s=0);for(let u=s;u<o;u++)n[u]=0;Li(r,o-8,BigInt(this.length*8),i),this.process(r,0);const c=Zt(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,f=this.get();if(l>f.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)c.setUint32(4*u,f[u],i)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:i,destroyed:s,pos:c}=this;return e.length=o,e.pos=c,e.finished=i,e.destroyed=s,o%n&&e.buffer.set(r),e}}const Hi=(t,e,n)=>t&e^~t&n,Ui=(t,e,n)=>t&e^t&n^e&n,Mi=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]),Pe=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ce=new Uint32Array(64);class xr extends Ri{constructor(){super(64,32,8,!1),this.A=Pe[0]|0,this.B=Pe[1]|0,this.C=Pe[2]|0,this.D=Pe[3]|0,this.E=Pe[4]|0,this.F=Pe[5]|0,this.G=Pe[6]|0,this.H=Pe[7]|0}get(){const{A:e,B:n,C:r,D:o,E:i,F:s,G:c,H:a}=this;return[e,n,r,o,i,s,c,a]}set(e,n,r,o,i,s,c,a){this.A=e|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=i|0,this.F=s|0,this.G=c|0,this.H=a|0}process(e,n){for(let u=0;u<16;u++,n+=4)Ce[u]=e.getUint32(n,!1);for(let u=16;u<64;u++){const h=Ce[u-15],d=Ce[u-2],w=pe(h,7)^pe(h,18)^h>>>3,b=pe(d,17)^pe(d,19)^d>>>10;Ce[u]=b+Ce[u-7]+w+Ce[u-16]|0}let{A:r,B:o,C:i,D:s,E:c,F:a,G:l,H:f}=this;for(let u=0;u<64;u++){const h=pe(c,6)^pe(c,11)^pe(c,25),d=f+h+Hi(c,a,l)+Mi[u]+Ce[u]|0,b=(pe(r,2)^pe(r,13)^pe(r,22))+Ui(r,o,i)|0;f=l,l=a,a=c,c=s+d|0,s=i,i=o,o=r,r=d+b|0}r=r+this.A|0,o=o+this.B|0,i=i+this.C|0,s=s+this.D|0,c=c+this.E|0,a=a+this.F|0,l=l+this.G|0,f=f+this.H|0,this.set(r,o,i,s,c,a,l,f)}roundClean(){Ce.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class qi extends xr{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 et=Fn(()=>new xr);Fn(()=>new qi);var tt=Symbol("verified"),ji=t=>t instanceof Object;function $i(t){if(!ji(t)||typeof t.kind!="number"||typeof t.content!="string"||typeof t.created_at!="number"||typeof t.pubkey!="string"||!t.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(t.tags))return!1;for(let e=0;e<t.tags.length;e++){let n=t.tags[e];if(!Array.isArray(n))return!1;for(let r=0;r<n.length;r++)if(typeof n[r]=="object")return!1}return!0}new TextDecoder("utf-8");var zi=new TextEncoder,Ki=class{generateSecretKey(){return oe.utils.randomPrivateKey()}getPublicKey(e){return ce(oe.getPublicKey(e))}finalizeEvent(e,n){const r=e;return r.pubkey=ce(oe.getPublicKey(n)),r.id=yn(r),r.sig=ce(oe.sign(yn(r),n)),r[tt]=!0,r}verifyEvent(e){if(typeof e[tt]=="boolean")return e[tt];const n=yn(e);if(n!==e.id)return e[tt]=!1,!1;try{const r=oe.verify(e.sig,n,e.pubkey);return e[tt]=r,r}catch{return e[tt]=!1,!1}}};function Wi(t){if(!$i(t))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,t.pubkey,t.created_at,t.kind,t.tags,t.content])}function yn(t){let e=et(zi.encode(Wi(t)));return ce(e)}var Ot=new Ki,Di=Ot.generateSecretKey,Er=Ot.getPublicKey;Ot.finalizeEvent,Ot.verifyEvent;var De=Symbol("verified"),Vi=t=>t instanceof Object;function Fi(t){if(!Vi(t)||typeof t.kind!="number"||typeof t.content!="string"||typeof t.created_at!="number"||typeof t.pubkey!="string"||!t.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(t.tags))return!1;for(let e=0;e<t.tags.length;e++){let n=t.tags[e];if(!Array.isArray(n))return!1;for(let r=0;r<n.length;r++)if(typeof n[r]=="object")return!1}return!0}new TextDecoder("utf-8");var Gi=new TextEncoder;function nt(t){t.indexOf("://")===-1&&(t="wss://"+t);let e=new URL(t);return e.pathname=e.pathname.replace(/\/+/g,"/"),e.pathname.endsWith("/")&&(e.pathname=e.pathname.slice(0,-1)),(e.port==="80"&&e.protocol==="ws:"||e.port==="443"&&e.protocol==="wss:")&&(e.port=""),e.searchParams.sort(),e.hash="",e.toString()}var Yi=class{constructor(e){v(this,"value");v(this,"next",null);v(this,"prev",null);this.value=e}},Zi=class{constructor(){v(this,"first");v(this,"last");this.first=null,this.last=null}enqueue(e){const n=new Yi(e);return this.last?this.last===this.first?(this.last=n,this.last.prev=this.first,this.first.next=n):(n.prev=this.last,this.last.next=n,this.last=n):(this.first=n,this.last=n),!0}dequeue(){if(!this.first)return null;if(this.first===this.last){const n=this.first;return this.first=null,this.last=null,n.value}const e=this.first;return this.first=e.next,e.value}},Ji=class{generateSecretKey(){return oe.utils.randomPrivateKey()}getPublicKey(e){return ce(oe.getPublicKey(e))}finalizeEvent(e,n){const r=e;return r.pubkey=ce(oe.getPublicKey(n)),r.id=mn(r),r.sig=ce(oe.sign(mn(r),n)),r[De]=!0,r}verifyEvent(e){if(typeof e[De]=="boolean")return e[De];const n=mn(e);if(n!==e.id)return e[De]=!1,!1;try{const r=oe.verify(e.sig,n,e.pubkey);return e[De]=r,r}catch{return e[De]=!1,!1}}};function Qi(t){if(!Fi(t))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,t.pubkey,t.created_at,t.kind,t.tags,t.content])}function mn(t){let e=et(Gi.encode(Qi(t)));return ce(e)}var Tt=new Ji;Tt.generateSecretKey,Tt.getPublicKey,Tt.finalizeEvent;var Xi=Tt.verifyEvent,es=22242;function ts(t,e){if(t.ids&&t.ids.indexOf(e.id)===-1||t.kinds&&t.kinds.indexOf(e.kind)===-1||t.authors&&t.authors.indexOf(e.pubkey)===-1)return!1;for(let n in t)if(n[0]==="#"){let r=n.slice(1),o=t[`#${r}`];if(o&&!e.tags.find(([i,s])=>i===n.slice(1)&&o.indexOf(s)!==-1))return!1}return!(t.since&&e.created_at<t.since||t.until&&e.created_at>t.until)}function ns(t,e){for(let n=0;n<t.length;n++)if(ts(t[n],e))return!0;return!1}function rs(t,e){let n=e.length+3,r=t.indexOf(`"${e}":`)+n,o=t.slice(r).indexOf('"')+r+1;return t.slice(o,o+64)}function os(t){let e=t.slice(0,22).indexOf('"EVENT"');if(e===-1)return null;let n=t.slice(e+7+1).indexOf('"');if(n===-1)return null;let r=e+7+1+n,o=t.slice(r+1,80).indexOf('"');if(o===-1)return null;let i=r+1+o;return t.slice(r+1,i)}function is(t,e){return{kind:es,created_at:Math.floor(Date.now()/1e3),tags:[["relay",t],["challenge",e]],content:""}}async function ss(){return new Promise(t=>{const e=new MessageChannel,n=()=>{e.port1.removeEventListener("message",n),t()};e.port1.addEventListener("message",n),e.port2.postMessage(0),e.port1.start()})}var cs=t=>(t[De]=!0,!0),_r=class{constructor(e,n){v(this,"url");v(this,"_connected",!1);v(this,"onclose",null);v(this,"onnotice",e=>console.debug(`NOTICE from ${this.url}: ${e}`));v(this,"_onauth",null);v(this,"baseEoseTimeout",4400);v(this,"connectionTimeout",4400);v(this,"publishTimeout",4400);v(this,"openSubs",new Map);v(this,"connectionTimeoutHandle");v(this,"connectionPromise");v(this,"openCountRequests",new Map);v(this,"openEventPublishes",new Map);v(this,"ws");v(this,"incomingMessageQueue",new Zi);v(this,"queueRunning",!1);v(this,"challenge");v(this,"authPromise");v(this,"serial",0);v(this,"verifyEvent");v(this,"_WebSocket");this.url=nt(e),this.verifyEvent=n.verifyEvent,this._WebSocket=n.websocketImplementation||WebSocket}static async connect(e,n){const r=new _r(e,n);return await r.connect(),r}closeAllSubscriptions(e){for(let[n,r]of this.openSubs)r.close(e);this.openSubs.clear();for(let[n,r]of this.openEventPublishes)r.reject(new Error(e));this.openEventPublishes.clear();for(let[n,r]of this.openCountRequests)r.reject(new Error(e));this.openCountRequests.clear()}get connected(){return this._connected}async connect(){return this.connectionPromise?this.connectionPromise:(this.challenge=void 0,this.authPromise=void 0,this.connectionPromise=new Promise((e,n)=>{this.connectionTimeoutHandle=setTimeout(()=>{var r;n("connection timed out"),this.connectionPromise=void 0,(r=this.onclose)==null||r.call(this),this.closeAllSubscriptions("relay connection timed out")},this.connectionTimeout);try{this.ws=new this._WebSocket(this.url)}catch(r){n(r);return}this.ws.onopen=()=>{clearTimeout(this.connectionTimeoutHandle),this._connected=!0,e()},this.ws.onerror=r=>{var o;n(r.message||"websocket error"),this._connected&&(this._connected=!1,this.connectionPromise=void 0,(o=this.onclose)==null||o.call(this),this.closeAllSubscriptions("relay connection errored"))},this.ws.onclose=async()=>{var r;this._connected&&(this._connected=!1,this.connectionPromise=void 0,(r=this.onclose)==null||r.call(this),this.closeAllSubscriptions("relay connection closed"))},this.ws.onmessage=this._onmessage.bind(this)}),this.connectionPromise)}async runQueue(){for(this.queueRunning=!0;this.handleNext()!==!1;)await ss();this.queueRunning=!1}handleNext(){var r,o,i;const e=this.incomingMessageQueue.dequeue();if(!e)return!1;const n=os(e);if(n){const s=this.openSubs.get(n);if(!s)return;const c=rs(e,"id"),a=(r=s.alreadyHaveEvent)==null?void 0:r.call(s,c);if((o=s.receivedEvent)==null||o.call(s,this,c),a)return}try{let s=JSON.parse(e);switch(s[0]){case"EVENT":{const c=this.openSubs.get(s[1]),a=s[2];this.verifyEvent(a)&&ns(c.filters,a)&&c.onevent(a);return}case"COUNT":{const c=s[1],a=s[2],l=this.openCountRequests.get(c);l&&(l.resolve(a.count),this.openCountRequests.delete(c));return}case"EOSE":{const c=this.openSubs.get(s[1]);if(!c)return;c.receivedEose();return}case"OK":{const c=s[1],a=s[2],l=s[3],f=this.openEventPublishes.get(c);f&&(clearTimeout(f.timeout),a?f.resolve(l):f.reject(new Error(l)),this.openEventPublishes.delete(c));return}case"CLOSED":{const c=s[1],a=this.openSubs.get(c);if(!a)return;a.closed=!0,a.close(s[2]);return}case"NOTICE":this.onnotice(s[1]);return;case"AUTH":{this.challenge=s[1],this.authPromise=void 0,(i=this._onauth)==null||i.call(this,s[1]);return}}}catch{return}}async send(e){if(!this.connectionPromise)throw new Error("sending on closed connection");this.connectionPromise.then(()=>{var n;(n=this.ws)==null||n.send(e)})}async auth(e){if(!this.challenge)throw new Error("can't perform auth, no challenge was received");if(this.authPromise)return this.authPromise;const n=await e(is(this.url,this.challenge));return this.authPromise=new Promise((r,o)=>{const i=setTimeout(()=>{const s=this.openEventPublishes.get(n.id);s&&(s.reject(new Error("auth timed out")),this.openEventPublishes.delete(n.id))},this.publishTimeout);this.openEventPublishes.set(n.id,{resolve:r,reject:o,timeout:i})}),this.send('["AUTH",'+JSON.stringify(n)+"]"),this.authPromise}async publish(e){const n=new Promise((r,o)=>{const i=setTimeout(()=>{const s=this.openEventPublishes.get(e.id);s&&(s.reject(new Error("publish timed out")),this.openEventPublishes.delete(e.id))},this.publishTimeout);this.openEventPublishes.set(e.id,{resolve:r,reject:o,timeout:i})});return this.send('["EVENT",'+JSON.stringify(e)+"]"),n}async count(e,n){this.serial++;const r=(n==null?void 0:n.id)||"count:"+this.serial,o=new Promise((i,s)=>{this.openCountRequests.set(r,{resolve:i,reject:s})});return this.send('["COUNT","'+r+'",'+JSON.stringify(e).substring(1)),o}subscribe(e,n){const r=this.prepareSubscription(e,n);return r.fire(),r}prepareSubscription(e,n){this.serial++;const r=n.id||(n.label?n.label+":":"sub:")+this.serial,o=new as(this,r,e,n);return this.openSubs.set(r,o),o}close(){var e;this.closeAllSubscriptions("relay connection closed by us"),this._connected=!1,(e=this.ws)==null||e.close()}_onmessage(e){this.incomingMessageQueue.enqueue(e.data),this.queueRunning||this.runQueue()}},as=class{constructor(e,n,r,o){v(this,"relay");v(this,"id");v(this,"closed",!1);v(this,"eosed",!1);v(this,"filters");v(this,"alreadyHaveEvent");v(this,"receivedEvent");v(this,"onevent");v(this,"oneose");v(this,"onclose");v(this,"eoseTimeout");v(this,"eoseTimeoutHandle");this.relay=e,this.filters=r,this.id=n,this.alreadyHaveEvent=o.alreadyHaveEvent,this.receivedEvent=o.receivedEvent,this.eoseTimeout=o.eoseTimeout||e.baseEoseTimeout,this.oneose=o.oneose,this.onclose=o.onclose,this.onevent=o.onevent||(i=>{console.warn(`onevent() callback not defined for subscription '${this.id}' in relay ${this.relay.url}. event received:`,i)})}fire(){this.relay.send('["REQ","'+this.id+'",'+JSON.stringify(this.filters).substring(1)),this.eoseTimeoutHandle=setTimeout(this.receivedEose.bind(this),this.eoseTimeout)}receivedEose(){var e;this.eosed||(clearTimeout(this.eoseTimeoutHandle),this.eosed=!0,(e=this.oneose)==null||e.call(this))}close(e="closed by caller"){var n;!this.closed&&this.relay.connected&&(this.relay.send('["CLOSE",'+JSON.stringify(this.id)+"]"),this.closed=!0),this.relay.openSubs.delete(this.id),(n=this.onclose)==null||n.call(this,e)}},ls=class{constructor(e){v(this,"relays",new Map);v(this,"seenOn",new Map);v(this,"trackRelays",!1);v(this,"verifyEvent");v(this,"trustedRelayURLs",new Set);v(this,"_WebSocket");this.verifyEvent=e.verifyEvent,this._WebSocket=e.websocketImplementation}async ensureRelay(e,n){e=nt(e);let r=this.relays.get(e);return r||(r=new _r(e,{verifyEvent:this.trustedRelayURLs.has(e)?cs:this.verifyEvent,websocketImplementation:this._WebSocket}),n!=null&&n.connectionTimeout&&(r.connectionTimeout=n.connectionTimeout),this.relays.set(e,r)),await r.connect(),r}close(e){e.map(nt).forEach(n=>{var r;(r=this.relays.get(n))==null||r.close()})}subscribe(e,n,r){return this.subscribeMap(e.map(o=>({url:o,filter:n})),r)}subscribeMany(e,n,r){return this.subscribeMap(e.flatMap(o=>n.map(i=>({url:o,filter:i}))),r)}subscribeMap(e,n){this.trackRelays&&(n.receivedEvent=(u,h)=>{let d=this.seenOn.get(h);d||(d=new Set,this.seenOn.set(h,d)),d.add(u)});const r=new Set,o=[],i=[];let s=u=>{var h;i[u]||(i[u]=!0,i.filter(d=>d).length===e.length&&((h=n.oneose)==null||h.call(n),s=()=>{}))};const c=[];let a=(u,h)=>{var d;c[u]||(s(u),c[u]=h,c.filter(w=>w).length===e.length&&((d=n.onclose)==null||d.call(n,c),a=()=>{}))};const l=u=>{var d;if((d=n.alreadyHaveEvent)!=null&&d.call(n,u))return!0;const h=r.has(u);return r.add(u),h},f=Promise.all(e.map(async({url:u,filter:h},d)=>{u=nt(u);let w;try{w=await this.ensureRelay(u,{connectionTimeout:n.maxWait?Math.max(n.maxWait*.8,n.maxWait-1e3):void 0})}catch(g){a(d,(g==null?void 0:g.message)||String(g));return}let b=w.subscribe([h],{...n,oneose:()=>s(d),onclose:g=>{g.startsWith("auth-required:")&&n.doauth?w.auth(n.doauth).then(()=>{w.subscribe([h],{...n,oneose:()=>s(d),onclose:p=>{a(d,p)},alreadyHaveEvent:l,eoseTimeout:n.maxWait})}).catch(p=>{a(d,`auth was required and attempted, but failed with: ${p}`)}):a(d,g)},alreadyHaveEvent:l,eoseTimeout:n.maxWait});o.push(b)}));return{async close(){await f,o.forEach(u=>{u.close()})}}}subscribeManyMap(e,n){this.trackRelays&&(n.receivedEvent=(h,d)=>{let w=this.seenOn.get(d);w||(w=new Set,this.seenOn.set(d,w)),w.add(h)});const r=new Set,o=[],i=Object.keys(e).length,s=[];let c=h=>{var d;s[h]||(s[h]=!0,s.filter(w=>w).length===i&&((d=n.oneose)==null||d.call(n),c=()=>{}))};const a=[];let l=(h,d)=>{var w;a[h]||(c(h),a[h]=d,a.filter(b=>b).length===i&&((w=n.onclose)==null||w.call(n,a),l=()=>{}))};const f=h=>{var w;if((w=n.alreadyHaveEvent)!=null&&w.call(n,h))return!0;const d=r.has(h);return r.add(h),d},u=Promise.all(Object.entries(e).map(async(h,d,w)=>{if(w.indexOf(h)!==d){l(d,"duplicate url");return}let[b,g]=h;b=nt(b);let p;try{p=await this.ensureRelay(b,{connectionTimeout:n.maxWait?Math.max(n.maxWait*.8,n.maxWait-1e3):void 0})}catch(k){l(d,(k==null?void 0:k.message)||String(k));return}let y=p.subscribe(g,{...n,oneose:()=>c(d),onclose:k=>{k.startsWith("auth-required:")&&n.doauth?p.auth(n.doauth).then(()=>{p.subscribe(g,{...n,oneose:()=>c(d),onclose:C=>{l(d,C)},alreadyHaveEvent:f,eoseTimeout:n.maxWait})}).catch(C=>{l(d,`auth was required and attempted, but failed with: ${C}`)}):l(d,k)},alreadyHaveEvent:f,eoseTimeout:n.maxWait});o.push(y)}));return{async close(){await u,o.forEach(h=>{h.close()})}}}subscribeEose(e,n,r){const o=this.subscribe(e,n,{...r,oneose(){o.close()}});return o}subscribeManyEose(e,n,r){const o=this.subscribeMany(e,n,{...r,oneose(){o.close()}});return o}async querySync(e,n,r){return new Promise(async o=>{const i=[];this.subscribeEose(e,n,{...r,onevent(s){i.push(s)},onclose(s){o(i)}})})}async get(e,n,r){n.limit=1;const o=await this.querySync(e,n,r);return o.sort((i,s)=>s.created_at-i.created_at),o[0]||null}publish(e,n){return e.map(nt).map(async(r,o,i)=>{if(i.indexOf(r)!==o)return Promise.reject("duplicate url");let s=await this.ensureRelay(r);return s.publish(n).then(c=>{if(this.trackRelays){let a=this.seenOn.get(n.id);a||(a=new Set,this.seenOn.set(n.id,a)),a.add(s)}return c})})}listConnectionStatus(){const e=new Map;return this.relays.forEach((n,r)=>e.set(r,n.connected)),e}destroy(){this.relays.forEach(e=>e.close()),this.relays=new Map}},kr;try{kr=WebSocket}catch{}var us=class extends ls{constructor(){super({verifyEvent:Xi,websocketImplementation:kr})}};function vn(t){if(!Number.isSafeInteger(t)||t<0)throw new Error(`positive integer expected, not ${t}`)}function Sr(t){if(typeof t!="boolean")throw new Error(`boolean expected, not ${t}`)}function fs(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function Nt(t,...e){if(!fs(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */const Le=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4));if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");function ds(t,e){if(e==null||typeof e!="object")throw new Error("options must be defined");return Object.assign(t,e)}function hs(t,e){if(t.length!==e.length)return!1;let n=0;for(let r=0;r<t.length;r++)n|=t[r]^e[r];return n===0}const Ar=t=>Uint8Array.from(t.split("").map(e=>e.charCodeAt(0))),bs=Ar("expand 16-byte k"),gs=Ar("expand 32-byte k"),ps=Le(bs),Br=Le(gs);Br.slice();function V(t,e){return t<<e|t>>>32-e}function xn(t){return t.byteOffset%4===0}const Pt=64,ws=16,Ir=2**32-1,Or=new Uint32Array;function ys(t,e,n,r,o,i,s,c){const a=o.length,l=new Uint8Array(Pt),f=Le(l),u=xn(o)&&xn(i),h=u?Le(o):Or,d=u?Le(i):Or;for(let w=0;w<a;s++){if(t(e,n,r,f,s,c),s>=Ir)throw new Error("arx: counter overflow");const b=Math.min(Pt,a-w);if(u&&b===Pt){const g=w/4;if(w%4!==0)throw new Error("arx: invalid block position");for(let p=0,y;p<ws;p++)y=g+p,d[y]=h[y]^f[p];w+=Pt;continue}for(let g=0,p;g<b;g++)p=w+g,i[p]=o[p]^l[g];w+=b}}function ms(t,e){const{allowShortKeys:n,extendNonceFn:r,counterLength:o,counterRight:i,rounds:s}=ds({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if(typeof t!="function")throw new Error("core must be a function");return vn(o),vn(s),Sr(i),Sr(n),(c,a,l,f,u=0)=>{Nt(c),Nt(a),Nt(l);const h=l.length;if(f||(f=new Uint8Array(h)),Nt(f),vn(u),u<0||u>=Ir)throw new Error("arx: counter overflow");if(f.length<h)throw new Error(`arx: output (${f.length}) is shorter than data (${h})`);const d=[];let w=c.length,b,g;if(w===32)b=c.slice(),d.push(b),g=Br;else if(w===16&&n)b=new Uint8Array(32),b.set(c),b.set(c,16),g=ps,d.push(b);else throw new Error(`arx: invalid 32-byte key, got length=${w}`);xn(a)||(a=a.slice(),d.push(a));const p=Le(b);if(r){if(a.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(g,p,Le(a.subarray(0,16)),p),a=a.subarray(16)}const y=16-o;if(y!==a.length)throw new Error(`arx: nonce must be ${y} or 16 bytes`);if(y!==12){const C=new Uint8Array(12);C.set(a,i?0:12-a.length),a=C,d.push(a)}const k=Le(a);for(ys(t,g,p,k,l,f,u,s);d.length>0;)d.pop().fill(0);return f}}function vs(t,e,n,r,o,i=20){let s=t[0],c=t[1],a=t[2],l=t[3],f=e[0],u=e[1],h=e[2],d=e[3],w=e[4],b=e[5],g=e[6],p=e[7],y=o,k=n[0],C=n[1],T=n[2],S=s,_=c,m=a,N=l,L=f,q=u,G=h,K=d,W=w,x=b,A=g,P=p,j=y,M=k,$=C,D=T;for(let Q=0;Q<i;Q+=2)S=S+L|0,j=V(j^S,16),W=W+j|0,L=V(L^W,12),S=S+L|0,j=V(j^S,8),W=W+j|0,L=V(L^W,7),_=_+q|0,M=V(M^_,16),x=x+M|0,q=V(q^x,12),_=_+q|0,M=V(M^_,8),x=x+M|0,q=V(q^x,7),m=m+G|0,$=V($^m,16),A=A+$|0,G=V(G^A,12),m=m+G|0,$=V($^m,8),A=A+$|0,G=V(G^A,7),N=N+K|0,D=V(D^N,16),P=P+D|0,K=V(K^P,12),N=N+K|0,D=V(D^N,8),P=P+D|0,K=V(K^P,7),S=S+q|0,D=V(D^S,16),A=A+D|0,q=V(q^A,12),S=S+q|0,D=V(D^S,8),A=A+D|0,q=V(q^A,7),_=_+G|0,j=V(j^_,16),P=P+j|0,G=V(G^P,12),_=_+G|0,j=V(j^_,8),P=P+j|0,G=V(G^P,7),m=m+K|0,M=V(M^m,16),W=W+M|0,K=V(K^W,12),m=m+K|0,M=V(M^m,8),W=W+M|0,K=V(K^W,7),N=N+L|0,$=V($^N,16),x=x+$|0,L=V(L^x,12),N=N+L|0,$=V($^N,8),x=x+$|0,L=V(L^x,7);let F=0;r[F++]=s+S|0,r[F++]=c+_|0,r[F++]=a+m|0,r[F++]=l+N|0,r[F++]=f+L|0,r[F++]=u+q|0,r[F++]=h+G|0,r[F++]=d+K|0,r[F++]=w+W|0,r[F++]=b+x|0,r[F++]=g+A|0,r[F++]=p+P|0,r[F++]=y+j|0,r[F++]=k+M|0,r[F++]=C+$|0,r[F++]=T+D|0}const Tr=ms(vs,{counterRight:!1,counterLength:4,allowShortKeys:!1});class Nr extends Vn{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,ye.hash(e);const r=ut(n);if(this.iHash=e.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 o=this.blockLen,i=new Uint8Array(o);i.set(r.length>o?e.create().update(r).digest():r);for(let s=0;s<i.length;s++)i[s]^=54;this.iHash.update(i),this.oHash=e.create();for(let s=0;s<i.length;s++)i[s]^=106;this.oHash.update(i),i.fill(0)}update(e){return ye.exists(this),this.iHash.update(e),this}digestInto(e){ye.exists(this),ye.bytes(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:i,blockLen:s,outputLen:c}=this;return e=e,e.finished=o,e.destroyed=i,e.blockLen=s,e.outputLen=c,e.oHash=n._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Ct=(t,e,n)=>new Nr(t,e).update(n).digest();Ct.create=(t,e)=>new Nr(t,e);function xs(t,e,n){return ye.hash(t),Ct(t,ut(n),ut(e))}const En=new Uint8Array([0]),Pr=new Uint8Array;function Es(t,e,n,r=32){if(ye.hash(t),ye.number(r),r>255*t.outputLen)throw new Error("Length should be <= 255*HashLen");const o=Math.ceil(r/t.outputLen);n===void 0&&(n=Pr);const i=new Uint8Array(o*t.outputLen),s=Ct.create(t,e),c=s._cloneInto(),a=new Uint8Array(s.outputLen);for(let l=0;l<o;l++)En[0]=l+1,c.update(l===0?Pr:a).update(n).update(En).digestInto(a),i.set(a,t.outputLen*l),s._cloneInto(c);return s.destroy(),c.destroy(),a.fill(0),En.fill(0),i.slice(0,r)}/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function rt(t){if(!Number.isSafeInteger(t))throw new Error(`Wrong integer: ${t}`)}function xe(...t){const e=(o,i)=>s=>o(i(s)),n=Array.from(t).reverse().reduce((o,i)=>o?e(o,i.encode):i.encode,void 0),r=t.reduce((o,i)=>o?e(o,i.decode):i.decode,void 0);return{encode:n,decode:r}}function Ee(t){return{encode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return e.map(n=>{if(rt(n),n<0||n>=t.length)throw new Error(`Digit index outside alphabet: ${n} (alphabet: ${t.length})`);return t[n]})},decode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("alphabet.decode input should be array of strings");return e.map(n=>{if(typeof n!="string")throw new Error(`alphabet.decode: not string element=${n}`);const r=t.indexOf(n);if(r===-1)throw new Error(`Unknown letter: "${n}". Allowed: ${t}`);return r})}}}function _e(t=""){if(typeof t!="string")throw new Error("join separator should be string");return{encode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="string")throw new Error("join.encode input should be array of strings");for(let n of e)if(typeof n!="string")throw new Error(`join.encode: non-string input=${n}`);return e.join(t)},decode:e=>{if(typeof e!="string")throw new Error("join.decode input should be string");return e.split(t)}}}function Lt(t,e="="){if(rt(t),typeof e!="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*t%8;)n.push(e);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 o of n)if(typeof o!="string")throw new Error(`padding.decode: non-string input=${o}`);let r=n.length;if(r*t%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&n[r-1]===e;r--)if(!((r-1)*t%8))throw new Error("Invalid padding: string has too much padding");return n.slice(0,r)}}}function Cr(t){if(typeof t!="function")throw new Error("normalize fn should be function");return{encode:e=>e,decode:e=>t(e)}}function Lr(t,e,n){if(e<2)throw new Error(`convertRadix: wrong from=${e}, 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(t))throw new Error("convertRadix: data should be array");if(!t.length)return[];let r=0;const o=[],i=Array.from(t);for(i.forEach(s=>{if(rt(s),s<0||s>=e)throw new Error(`Wrong integer: ${s}`)});;){let s=0,c=!0;for(let a=r;a<i.length;a++){const l=i[a],f=e*s+l;if(!Number.isSafeInteger(f)||e*s/e!==s||f-l!==e*s)throw new Error("convertRadix: carry overflow");if(s=f%n,i[a]=Math.floor(f/n),!Number.isSafeInteger(i[a])||i[a]*n+s!==f)throw new Error("convertRadix: carry overflow");if(c)i[a]?c=!1:r=a;else continue}if(o.push(s),c)break}for(let s=0;s<t.length-1&&t[s]===0;s++)o.push(0);return o.reverse()}const Rr=(t,e)=>e?Rr(e,t%e):t,Rt=(t,e)=>t+(e-Rr(t,e));function _n(t,e,n,r){if(!Array.isArray(t))throw new Error("convertRadix2: data should be array");if(e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(Rt(e,n)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${n} carryBits=${Rt(e,n)}`);let o=0,i=0;const s=2**n-1,c=[];for(const a of t){if(rt(a),a>=2**e)throw new Error(`convertRadix2: invalid data word=${a} from=${e}`);if(o=o<<e|a,i+e>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${e}`);for(i+=e;i>=n;i-=n)c.push((o>>i-n&s)>>>0);o&=2**i-1}if(o=o<<n-i&s,!r&&i>=e)throw new Error("Excess padding");if(!r&&o)throw new Error(`Non-zero padding: ${o}`);return r&&i>0&&c.push(o>>>0),c}function _s(t){return rt(t),{encode:e=>{if(!(e instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return Lr(Array.from(e),2**8,t)},decode:e=>{if(!Array.isArray(e)||e.length&&typeof e[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(Lr(e,t,2**8))}}}function Re(t,e=!1){if(rt(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(Rt(8,t)>32||Rt(t,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 _n(Array.from(n),8,t,!e)},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(_n(n,t,8,e))}}}function Hr(t){if(typeof t!="function")throw new Error("unsafeWrapper fn should be function");return function(...e){try{return t.apply(null,e)}catch{}}}const ks=xe(Re(4),Ee("0123456789ABCDEF"),_e("")),Ss=xe(Re(5),Ee("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Lt(5),_e(""));xe(Re(5),Ee("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Lt(5),_e("")),xe(Re(5),Ee("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),_e(""),Cr(t=>t.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));const kn=xe(Re(6),Ee("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Lt(6),_e("")),As=xe(Re(6),Ee("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Lt(6),_e("")),Sn=t=>xe(_s(58),Ee(t),_e("")),An=Sn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");Sn("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),Sn("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const Ur=[0,2,3,5,6,7,9,10,11],Bs={encode(t){let e="";for(let n=0;n<t.length;n+=8){const r=t.subarray(n,n+8);e+=An.encode(r).padStart(Ur[r.length],"1")}return e},decode(t){let e=[];for(let n=0;n<t.length;n+=11){const r=t.slice(n,n+11),o=Ur.indexOf(r.length),i=An.decode(r);for(let s=0;s<i.length-o;s++)if(i[s]!==0)throw new Error("base58xmr: wrong padding");e=e.concat(Array.from(i.slice(i.length-o)))}return Uint8Array.from(e)}},Bn=xe(Ee("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),_e("")),Mr=[996825010,642813549,513874426,1027748829,705979059];function ht(t){const e=t>>25;let n=(t&33554431)<<5;for(let r=0;r<Mr.length;r++)(e>>r&1)===1&&(n^=Mr[r]);return n}function qr(t,e,n=1){const r=t.length;let o=1;for(let i=0;i<r;i++){const s=t.charCodeAt(i);if(s<33||s>126)throw new Error(`Invalid prefix (${t})`);o=ht(o)^s>>5}o=ht(o);for(let i=0;i<r;i++)o=ht(o)^t.charCodeAt(i)&31;for(let i of e)o=ht(o)^i;for(let i=0;i<6;i++)o=ht(o);return o^=n,Bn.encode(_n([o%2**30],30,5,!1))}function jr(t){const e=t==="bech32"?1:734539939,n=Re(5),r=n.decode,o=n.encode,i=Hr(r);function s(f,u,h=90){if(typeof f!="string")throw new Error(`bech32.encode prefix should be string, not ${typeof f}`);if(!Array.isArray(u)||u.length&&typeof u[0]!="number")throw new Error(`bech32.encode words should be array of numbers, not ${typeof u}`);const d=f.length+7+u.length;if(h!==!1&&d>h)throw new TypeError(`Length ${d} exceeds limit ${h}`);return f=f.toLowerCase(),`${f}1${Bn.encode(u)}${qr(f,u,e)}`}function c(f,u=90){if(typeof f!="string")throw new Error(`bech32.decode input should be string, not ${typeof f}`);if(f.length<8||u!==!1&&f.length>u)throw new TypeError(`Wrong string length: ${f.length} (${f}). Expected (8..${u})`);const h=f.toLowerCase();if(f!==h&&f!==f.toUpperCase())throw new Error("String must be lowercase or uppercase");f=h;const d=f.lastIndexOf("1");if(d===0||d===-1)throw new Error('Letter "1" must be present between prefix and data only');const w=f.slice(0,d),b=f.slice(d+1);if(b.length<6)throw new Error("Data must be at least 6 characters long");const g=Bn.decode(b).slice(0,-6),p=qr(w,g,e);if(!b.endsWith(p))throw new Error(`Invalid checksum in ${f}: expected "${p}"`);return{prefix:w,words:g}}const a=Hr(c);function l(f){const{prefix:u,words:h}=c(f,!1);return{prefix:u,words:h,bytes:r(h)}}return{encode:s,decode:c,decodeToBytes:l,decodeUnsafe:a,fromWords:r,fromWordsUnsafe:i,toWords:o}}const $r=jr("bech32");jr("bech32m");const Is={encode:t=>new TextDecoder().decode(t),decode:t=>new TextEncoder().encode(t)},Os=xe(Re(4),Ee("0123456789abcdef"),_e(""),Cr(t=>{if(typeof t!="string"||t.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof t} with length ${t.length}`);return t.toLowerCase()}));`${Object.keys({utf8:Is,hex:Os,base16:ks,base32:Ss,base64:kn,base64url:As,base58:An,base58xmr:Bs}).join(", ")}`;var Ve=Symbol("verified"),Ts=t=>t instanceof Object;function Ns(t){if(!Ts(t)||typeof t.kind!="number"||typeof t.content!="string"||typeof t.created_at!="number"||typeof t.pubkey!="string"||!t.pubkey.match(/^[a-f0-9]{64}$/)||!Array.isArray(t.tags))return!1;for(let e=0;e<t.tags.length;e++){let n=t.tags[e];if(!Array.isArray(n))return!1;for(let r=0;r<n.length;r++)if(typeof n[r]=="object")return!1}return!0}var Ps=new TextDecoder("utf-8"),zr=new TextEncoder;function ot(t){t.indexOf("://")===-1&&(t="wss://"+t);let e=new URL(t);return e.pathname=e.pathname.replace(/\/+/g,"/"),e.pathname.endsWith("/")&&(e.pathname=e.pathname.slice(0,-1)),(e.port==="80"&&e.protocol==="ws:"||e.port==="443"&&e.protocol==="wss:")&&(e.port=""),e.searchParams.sort(),e.hash="",e.toString()}var Cs=class{constructor(t){v(this,"value");v(this,"next",null);v(this,"prev",null);this.value=t}},Ls=class{constructor(){v(this,"first");v(this,"last");this.first=null,this.last=null}enqueue(t){const e=new Cs(t);return this.last?this.last===this.first?(this.last=e,this.last.prev=this.first,this.first.next=e):(e.prev=this.last,this.last.next=e,this.last=e):(this.first=e,this.last=e),!0}dequeue(){if(!this.first)return null;if(this.first===this.last){const e=this.first;return this.first=null,this.last=null,e.value}const t=this.first;return this.first=t.next,t.value}},Rs=class{generateSecretKey(){return oe.utils.randomPrivateKey()}getPublicKey(t){return ce(oe.getPublicKey(t))}finalizeEvent(t,e){const n=t;return n.pubkey=ce(oe.getPublicKey(e)),n.id=In(n),n.sig=ce(oe.sign(In(n),e)),n[Ve]=!0,n}verifyEvent(t){if(typeof t[Ve]=="boolean")return t[Ve];const e=In(t);if(e!==t.id)return t[Ve]=!1,!1;try{const n=oe.verify(t.sig,e,t.pubkey);return t[Ve]=n,n}catch{return t[Ve]=!1,!1}}};function Hs(t){if(!Ns(t))throw new Error("can't serialize event with wrong or missing properties");return JSON.stringify([0,t.pubkey,t.created_at,t.kind,t.tags,t.content])}function In(t){let e=et(zr.encode(Hs(t)));return ce(e)}var Ht=new Rs;Ht.generateSecretKey;var Us=Ht.getPublicKey,Ms=Ht.finalizeEvent,Kr=Ht.verifyEvent,Wr=1,Dr=65535;function qs(t,e){const n=At.getSharedSecret(t,"02"+e).subarray(1,33);return xs(et,n,"nip44-v2")}function Vr(t,e){const n=Es(et,t,e,76);return{chacha_key:n.subarray(0,32),chacha_nonce:n.subarray(32,44),hmac_key:n.subarray(44,76)}}function Fr(t){if(!Number.isSafeInteger(t)||t<1)throw new Error("expected positive integer");if(t<=32)return 32;const e=1<<Math.floor(Math.log2(t-1))+1,n=e<=256?32:e/8;return n*(Math.floor((t-1)/n)+1)}function js(t){if(!Number.isSafeInteger(t)||t<Wr||t>Dr)throw new Error("invalid plaintext size: must be between 1 and 65535 bytes");const e=new Uint8Array(2);return new DataView(e.buffer).setUint16(0,t,!1),e}function $s(t){const e=zr.encode(t),n=e.length,r=js(n),o=new Uint8Array(Fr(n)-n);return Jt(r,e,o)}function zs(t){const e=new DataView(t.buffer).getUint16(0),n=t.subarray(2,2+e);if(e<Wr||e>Dr||n.length!==e||t.length!==2+Fr(e))throw new Error("invalid padding");return Ps.decode(n)}function Gr(t,e,n){if(n.length!==32)throw new Error("AAD associated data must be 32 bytes");const r=Jt(n,e);return Ct(et,t,r)}function Ks(t){if(typeof t!="string")throw new Error("payload must be a valid string");const e=t.length;if(e<132||e>87472)throw new Error("invalid payload length: "+e);if(t[0]==="#")throw new Error("unknown encryption version");let n;try{n=kn.decode(t)}catch(i){throw new Error("invalid base64: "+i.message)}const r=n.length;if(r<99||r>65603)throw new Error("invalid data length: "+r);const o=n[0];if(o!==2)throw new Error("unknown encryption version "+o);return{nonce:n.subarray(1,33),ciphertext:n.subarray(33,-32),mac:n.subarray(-32)}}function Ws(t,e,n=Mo(32)){const{chacha_key:r,chacha_nonce:o,hmac_key:i}=Vr(e,n),s=$s(t),c=Tr(r,o,s),a=Gr(i,c,n);return kn.encode(Jt(new Uint8Array([2]),n,c,a))}function Ds(t,e){const{nonce:n,ciphertext:r,mac:o}=Ks(t),{chacha_key:i,chacha_nonce:s,hmac_key:c}=Vr(e,n),a=Gr(c,r,n);if(!hs(a,o))throw new Error("invalid MAC");const l=Tr(i,s,r);return zs(l)}var Vs=/^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,Fs;try{Fs=fetch}catch{}var Gs=22242,Yr=24133;function Ys(t,e){if(t.ids&&t.ids.indexOf(e.id)===-1||t.kinds&&t.kinds.indexOf(e.kind)===-1||t.authors&&t.authors.indexOf(e.pubkey)===-1)return!1;for(let n in t)if(n[0]==="#"){let r=n.slice(1),o=t[`#${r}`];if(o&&!e.tags.find(([i,s])=>i===n.slice(1)&&o.indexOf(s)!==-1))return!1}return!(t.since&&e.created_at<t.since||t.until&&e.created_at>t.until)}function Zs(t,e){for(let n=0;n<t.length;n++)if(Ys(t[n],e))return!0;return!1}function Js(t,e){let n=e.length+3,r=t.indexOf(`"${e}":`)+n,o=t.slice(r).indexOf('"')+r+1;return t.slice(o,o+64)}function Qs(t){let e=t.slice(0,22).indexOf('"EVENT"');if(e===-1)return null;let n=t.slice(e+7+1).indexOf('"');if(n===-1)return null;let r=e+7+1+n,o=t.slice(r+1,80).indexOf('"');if(o===-1)return null;let i=r+1+o;return t.slice(r+1,i)}function Xs(t,e){return{kind:Gs,created_at:Math.floor(Date.now()/1e3),tags:[["relay",t],["challenge",e]],content:""}}async function ec(){return new Promise(t=>{const e=new MessageChannel,n=()=>{e.port1.removeEventListener("message",n),t()};e.port1.addEventListener("message",n),e.port2.postMessage(0),e.port1.start()})}var tc=t=>(t[Ve]=!0,!0),Zr=class{constructor(t,e){v(this,"url");v(this,"_connected",!1);v(this,"onclose",null);v(this,"onnotice",t=>console.debug(`NOTICE from ${this.url}: ${t}`));v(this,"_onauth",null);v(this,"baseEoseTimeout",4400);v(this,"connectionTimeout",4400);v(this,"publishTimeout",4400);v(this,"openSubs",new Map);v(this,"connectionTimeoutHandle");v(this,"connectionPromise");v(this,"openCountRequests",new Map);v(this,"openEventPublishes",new Map);v(this,"ws");v(this,"incomingMessageQueue",new Ls);v(this,"queueRunning",!1);v(this,"challenge");v(this,"authPromise");v(this,"serial",0);v(this,"verifyEvent");v(this,"_WebSocket");this.url=ot(t),this.verifyEvent=e.verifyEvent,this._WebSocket=e.websocketImplementation||WebSocket}static async connect(t,e){const n=new Zr(t,e);return await n.connect(),n}closeAllSubscriptions(t){for(let[e,n]of this.openSubs)n.close(t);this.openSubs.clear();for(let[e,n]of this.openEventPublishes)n.reject(new Error(t));this.openEventPublishes.clear();for(let[e,n]of this.openCountRequests)n.reject(new Error(t));this.openCountRequests.clear()}get connected(){return this._connected}async connect(){return this.connectionPromise?this.connectionPromise:(this.challenge=void 0,this.authPromise=void 0,this.connectionPromise=new Promise((t,e)=>{this.connectionTimeoutHandle=setTimeout(()=>{var n;e("connection timed out"),this.connectionPromise=void 0,(n=this.onclose)==null||n.call(this),this.closeAllSubscriptions("relay connection timed out")},this.connectionTimeout);try{this.ws=new this._WebSocket(this.url)}catch(n){e(n);return}this.ws.onopen=()=>{clearTimeout(this.connectionTimeoutHandle),this._connected=!0,t()},this.ws.onerror=n=>{var r;e(n.message||"websocket error"),this._connected&&(this._connected=!1,this.connectionPromise=void 0,(r=this.onclose)==null||r.call(this),this.closeAllSubscriptions("relay connection errored"))},this.ws.onclose=async()=>{var n;this._connected&&(this._connected=!1,this.connectionPromise=void 0,(n=this.onclose)==null||n.call(this),this.closeAllSubscriptions("relay connection closed"))},this.ws.onmessage=this._onmessage.bind(this)}),this.connectionPromise)}async runQueue(){for(this.queueRunning=!0;this.handleNext()!==!1;)await ec();this.queueRunning=!1}handleNext(){var n,r,o;const t=this.incomingMessageQueue.dequeue();if(!t)return!1;const e=Qs(t);if(e){const i=this.openSubs.get(e);if(!i)return;const s=Js(t,"id"),c=(n=i.alreadyHaveEvent)==null?void 0:n.call(i,s);if((r=i.receivedEvent)==null||r.call(i,this,s),c)return}try{let i=JSON.parse(t);switch(i[0]){case"EVENT":{const s=this.openSubs.get(i[1]),c=i[2];this.verifyEvent(c)&&Zs(s.filters,c)&&s.onevent(c);return}case"COUNT":{const s=i[1],c=i[2],a=this.openCountRequests.get(s);a&&(a.resolve(c.count),this.openCountRequests.delete(s));return}case"EOSE":{const s=this.openSubs.get(i[1]);if(!s)return;s.receivedEose();return}case"OK":{const s=i[1],c=i[2],a=i[3],l=this.openEventPublishes.get(s);l&&(clearTimeout(l.timeout),c?l.resolve(a):l.reject(new Error(a)),this.openEventPublishes.delete(s));return}case"CLOSED":{const s=i[1],c=this.openSubs.get(s);if(!c)return;c.closed=!0,c.close(i[2]);return}case"NOTICE":this.onnotice(i[1]);return;case"AUTH":{this.challenge=i[1],this.authPromise=void 0,(o=this._onauth)==null||o.call(this,i[1]);return}}}catch{return}}async send(t){if(!this.connectionPromise)throw new Error("sending on closed connection");this.connectionPromise.then(()=>{var e;(e=this.ws)==null||e.send(t)})}async auth(t){if(!this.challenge)throw new Error("can't perform auth, no challenge was received");if(this.authPromise)return this.authPromise;const e=await t(Xs(this.url,this.challenge));return this.authPromise=new Promise((n,r)=>{const o=setTimeout(()=>{const i=this.openEventPublishes.get(e.id);i&&(i.reject(new Error("auth timed out")),this.openEventPublishes.delete(e.id))},this.publishTimeout);this.openEventPublishes.set(e.id,{resolve:n,reject:r,timeout:o})}),this.send('["AUTH",'+JSON.stringify(e)+"]"),this.authPromise}async publish(t){const e=new Promise((n,r)=>{const o=setTimeout(()=>{const i=this.openEventPublishes.get(t.id);i&&(i.reject(new Error("publish timed out")),this.openEventPublishes.delete(t.id))},this.publishTimeout);this.openEventPublishes.set(t.id,{resolve:n,reject:r,timeout:o})});return this.send('["EVENT",'+JSON.stringify(t)+"]"),e}async count(t,e){this.serial++;const n=(e==null?void 0:e.id)||"count:"+this.serial,r=new Promise((o,i)=>{this.openCountRequests.set(n,{resolve:o,reject:i})});return this.send('["COUNT","'+n+'",'+JSON.stringify(t).substring(1)),r}subscribe(t,e){const n=this.prepareSubscription(t,e);return n.fire(),n}prepareSubscription(t,e){this.serial++;const n=e.id||(e.label?e.label+":":"sub:")+this.serial,r=new nc(this,n,t,e);return this.openSubs.set(n,r),r}close(){var t;this.closeAllSubscriptions("relay connection closed by us"),this._connected=!1,(t=this.ws)==null||t.close()}_onmessage(t){this.incomingMessageQueue.enqueue(t.data),this.queueRunning||this.runQueue()}},nc=class{constructor(t,e,n,r){v(this,"relay");v(this,"id");v(this,"closed",!1);v(this,"eosed",!1);v(this,"filters");v(this,"alreadyHaveEvent");v(this,"receivedEvent");v(this,"onevent");v(this,"oneose");v(this,"onclose");v(this,"eoseTimeout");v(this,"eoseTimeoutHandle");this.relay=t,this.filters=n,this.id=e,this.alreadyHaveEvent=r.alreadyHaveEvent,this.receivedEvent=r.receivedEvent,this.eoseTimeout=r.eoseTimeout||t.baseEoseTimeout,this.oneose=r.oneose,this.onclose=r.onclose,this.onevent=r.onevent||(o=>{console.warn(`onevent() callback not defined for subscription '${this.id}' in relay ${this.relay.url}. event received:`,o)})}fire(){this.relay.send('["REQ","'+this.id+'",'+JSON.stringify(this.filters).substring(1)),this.eoseTimeoutHandle=setTimeout(this.receivedEose.bind(this),this.eoseTimeout)}receivedEose(){var t;this.eosed||(clearTimeout(this.eoseTimeoutHandle),this.eosed=!0,(t=this.oneose)==null||t.call(this))}close(t="closed by caller"){var e;!this.closed&&this.relay.connected&&(this.relay.send('["CLOSE",'+JSON.stringify(this.id)+"]"),this.closed=!0),this.relay.openSubs.delete(this.id),(e=this.onclose)==null||e.call(this,t)}},rc=class{constructor(t){v(this,"relays",new Map);v(this,"seenOn",new Map);v(this,"trackRelays",!1);v(this,"verifyEvent");v(this,"trustedRelayURLs",new Set);v(this,"_WebSocket");this.verifyEvent=t.verifyEvent,this._WebSocket=t.websocketImplementation}async ensureRelay(t,e){t=ot(t);let n=this.relays.get(t);return n||(n=new Zr(t,{verifyEvent:this.trustedRelayURLs.has(t)?tc:this.verifyEvent,websocketImplementation:this._WebSocket}),e!=null&&e.connectionTimeout&&(n.connectionTimeout=e.connectionTimeout),this.relays.set(t,n)),await n.connect(),n}close(t){t.map(ot).forEach(e=>{var n;(n=this.relays.get(e))==null||n.close()})}subscribe(t,e,n){return this.subscribeMap(t.map(r=>({url:r,filter:e})),n)}subscribeMany(t,e,n){return this.subscribeMap(t.flatMap(r=>e.map(o=>({url:r,filter:o}))),n)}subscribeMap(t,e){this.trackRelays&&(e.receivedEvent=(f,u)=>{let h=this.seenOn.get(u);h||(h=new Set,this.seenOn.set(u,h)),h.add(f)});const n=new Set,r=[],o=[];let i=f=>{var u;o[f]||(o[f]=!0,o.filter(h=>h).length===t.length&&((u=e.oneose)==null||u.call(e),i=()=>{}))};const s=[];let c=(f,u)=>{var h;s[f]||(i(f),s[f]=u,s.filter(d=>d).length===t.length&&((h=e.onclose)==null||h.call(e,s),c=()=>{}))};const a=f=>{var h;if((h=e.alreadyHaveEvent)!=null&&h.call(e,f))return!0;const u=n.has(f);return n.add(f),u},l=Promise.all(t.map(async({url:f,filter:u},h)=>{f=ot(f);let d;try{d=await this.ensureRelay(f,{connectionTimeout:e.maxWait?Math.max(e.maxWait*.8,e.maxWait-1e3):void 0})}catch(b){c(h,(b==null?void 0:b.message)||String(b));return}let w=d.subscribe([u],{...e,oneose:()=>i(h),onclose:b=>{b.startsWith("auth-required:")&&e.doauth?d.auth(e.doauth).then(()=>{d.subscribe([u],{...e,oneose:()=>i(h),onclose:g=>{c(h,g)},alreadyHaveEvent:a,eoseTimeout:e.maxWait})}).catch(g=>{c(h,`auth was required and attempted, but failed with: ${g}`)}):c(h,b)},alreadyHaveEvent:a,eoseTimeout:e.maxWait});r.push(w)}));return{async close(){await l,r.forEach(f=>{f.close()})}}}subscribeManyMap(t,e){this.trackRelays&&(e.receivedEvent=(u,h)=>{let d=this.seenOn.get(h);d||(d=new Set,this.seenOn.set(h,d)),d.add(u)});const n=new Set,r=[],o=Object.keys(t).length,i=[];let s=u=>{var h;i[u]||(i[u]=!0,i.filter(d=>d).length===o&&((h=e.oneose)==null||h.call(e),s=()=>{}))};const c=[];let a=(u,h)=>{var d;c[u]||(s(u),c[u]=h,c.filter(w=>w).length===o&&((d=e.onclose)==null||d.call(e,c),a=()=>{}))};const l=u=>{var d;if((d=e.alreadyHaveEvent)!=null&&d.call(e,u))return!0;const h=n.has(u);return n.add(u),h},f=Promise.all(Object.entries(t).map(async(u,h,d)=>{if(d.indexOf(u)!==h){a(h,"duplicate url");return}let[w,b]=u;w=ot(w);let g;try{g=await this.ensureRelay(w,{connectionTimeout:e.maxWait?Math.max(e.maxWait*.8,e.maxWait-1e3):void 0})}catch(y){a(h,(y==null?void 0:y.message)||String(y));return}let p=g.subscribe(b,{...e,oneose:()=>s(h),onclose:y=>{y.startsWith("auth-required:")&&e.doauth?g.auth(e.doauth).then(()=>{g.subscribe(b,{...e,oneose:()=>s(h),onclose:k=>{a(h,k)},alreadyHaveEvent:l,eoseTimeout:e.maxWait})}).catch(k=>{a(h,`auth was required and attempted, but failed with: ${k}`)}):a(h,y)},alreadyHaveEvent:l,eoseTimeout:e.maxWait});r.push(p)}));return{async close(){await f,r.forEach(u=>{u.close()})}}}subscribeEose(t,e,n){const r=this.subscribe(t,e,{...n,oneose(){r.close()}});return r}subscribeManyEose(t,e,n){const r=this.subscribeMany(t,e,{...n,oneose(){r.close()}});return r}async querySync(t,e,n){return new Promise(async r=>{const o=[];this.subscribeEose(t,e,{...n,onevent(i){o.push(i)},onclose(i){r(o)}})})}async get(t,e,n){e.limit=1;const r=await this.querySync(t,e,n);return r.sort((o,i)=>i.created_at-o.created_at),r[0]||null}publish(t,e){return t.map(ot).map(async(n,r,o)=>{if(o.indexOf(n)!==r)return Promise.reject("duplicate url");let i=await this.ensureRelay(n);return i.publish(e).then(s=>{if(this.trackRelays){let c=this.seenOn.get(e.id);c||(c=new Set,this.seenOn.set(e.id,c)),c.add(i)}return s})})}listConnectionStatus(){const t=new Map;return this.relays.forEach((e,n)=>t.set(n,e.connected)),t}destroy(){this.relays.forEach(t=>t.close()),this.relays=new Map}},Jr;try{Jr=WebSocket}catch{}var oc=class extends rc{constructor(){super({verifyEvent:Kr,websocketImplementation:Jr})}},Qr;try{Qr=fetch}catch{}var Ut=/^bunker:\/\/([0-9a-f]{64})\??([?\/\w:.=&%-]*)$/;async function ic(t){let e=t.match(Ut);if(e)try{const n=e[1],r=new URLSearchParams(e[2]);return{pubkey:n,relays:r.getAll("relay"),secret:r.get("secret")}}catch{}return sc(t)}async function sc(t){const e=t.match(Vs);if(!e)return null;const[n,r="_",o]=e;try{const i=`https://${o}/.well-known/nostr.json?name=${r}`,s=await(await Qr(i,{redirect:"error"})).json();let c=s.names[r],a=s.nip46[c]||[];return{pubkey:c,relays:a,secret:null}}catch{return null}}var cc=class{constructor(t,e,n={}){v(this,"pool");v(this,"subCloser");v(this,"isOpen");v(this,"serial");v(this,"idPrefix");v(this,"listeners");v(this,"waitingForAuth");v(this,"secretKey");v(this,"conversationKey");v(this,"bp");v(this,"cachedPubKey");if(e.relays.length===0)throw new Error("no relays are specified for this bunker");this.pool=n.pool||new oc,this.secretKey=t,this.conversationKey=qs(t,e.pubkey),this.bp=e,this.isOpen=!1,this.idPrefix=Math.random().toString(36).substring(7),this.serial=0,this.listeners={},this.waitingForAuth={},this.setupSubscription(n)}setupSubscription(t){const e=this.listeners,n=this.waitingForAuth,r=this.conversationKey;this.subCloser=this.pool.subscribe(this.bp.relays,{kinds:[Yr],authors:[this.bp.pubkey],"#p":[Us(this.secretKey)]},{onevent:async o=>{const i=JSON.parse(Ds(o.content,r)),{id:s,result:c,error:a}=i;if(c==="auth_url"&&n[s]){delete n[s],t.onauth?t.onauth(a):console.warn(`nostr-tools/nip46: remote signer ${this.bp.pubkey} tried to send an "auth_url"='${a}' but there was no onauth() callback configured.`);return}let l=e[s];l&&(a?l.reject(a):c&&l.resolve(c),delete e[s])},onclose:()=>{this.isOpen&&(this.subCloser.close(),this.setupSubscription(t))}}),this.isOpen=!0}async close(){this.isOpen=!1,this.subCloser.close()}async sendRequest(t,e){return new Promise(async(n,r)=>{try{if(!this.isOpen)throw new Error("this signer is not open anymore, create a new one");this.serial++;const o=`${this.idPrefix}-${this.serial}`,i=Ws(JSON.stringify({id:o,method:t,params:e}),this.conversationKey),s=Ms({kind:Yr,tags:[["p",this.bp.pubkey]],content:i,created_at:Math.floor(Date.now()/1e3)},this.secretKey);this.listeners[o]={resolve:n,reject:r},this.waitingForAuth[o]=!0,await Promise.any(this.pool.publish(this.bp.relays,s))}catch(o){r(o)}})}async ping(){let t=await this.sendRequest("ping",[]);if(t!=="pong")throw new Error(`result is not pong: ${t}`)}async connect(){await this.sendRequest("connect",[this.bp.pubkey,this.bp.secret||""])}async getPublicKey(){return this.cachedPubKey||(this.cachedPubKey=await this.sendRequest("get_public_key",[])),this.cachedPubKey}async getRelays(){return JSON.parse(await this.sendRequest("get_relays",[]))}async signEvent(t){let e=await this.sendRequest("sign_event",[JSON.stringify(t)]),n=JSON.parse(e);if(Kr(n))return n;throw new Error(`event returned from bunker is improperly signed: ${JSON.stringify(n)}`)}async nip04Encrypt(t,e){return await this.sendRequest("nip04_encrypt",[t,e])}async nip04Decrypt(t,e){return await this.sendRequest("nip04_decrypt",[t,e])}async nip44Encrypt(t,e){return await this.sendRequest("nip44_encrypt",[t,e])}async nip44Decrypt(t,e){return await this.sendRequest("nip44_decrypt",[t,e])}},ac=/^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,lc;try{lc=fetch}catch{}new TextDecoder("utf-8"),new TextEncoder;var uc=5e3;function fc(t){return hc("npub",Dn(t))}function dc(t,e){let n=$r.toWords(e);return $r.encode(t,n,uc)}function hc(t,e){return dc(t,e)}const it=[];function bc(t,e=U){let n;const r=new Set;function o(c){if(jt(t,c)&&(t=c,n)){const a=!it.length;for(const l of r)l[1](),it.push(l,t);if(a){for(let l=0;l<it.length;l+=2)it[l][0](it[l+1]);it.length=0}}}function i(c){o(c(t))}function s(c,a=U){const l=[c,a];return r.add(l),r.size===1&&(n=e(o,i)||U),c(t),()=>{r.delete(l),r.size===0&&n&&(n(),n=null)}}return{set:o,update:i,subscribe:s}}const gc=t=>{const{subscribe:e,set:n}=bc(void 0,()=>{const r=window.matchMedia(t);n(r.matches);const o=()=>n(r.matches);return r.addEventListener("change",o),()=>{r.removeEventListener("change",o)}});return{subscribe:e}};function pc(t){let e,n,r;return{c(){e=$t("svg"),n=$t("circle"),r=$t("path"),E(n,"class","opacity-25"),E(n,"cx","12"),E(n,"cy","12"),E(n,"r","10"),E(n,"stroke","currentColor"),E(n,"stroke-width","4"),E(r,"class","opacity-75"),E(r,"fill","currentColor"),E(r,"d","M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"),E(e,"class","ml-2 h-5 w-5 animate-spin text-white"),E(e,"xmlns","http://www.w3.org/2000/svg"),E(e,"fill","none"),E(e,"viewBox","0 0 24 24")},m(o,i){H(o,e,i),B(e,n),B(e,r)},p:U,i:U,o:U,d(o){o&&R(e)}}}class Xr extends Kn{constructor(e){super(),zn(this,e,null,pc,jt,{})}}const{window:On}=_o;function wc(t){let e,n,r,o,i,s,c,a,l,f,u,h,d=!t[17]&&!t[10]&&!t[11]&&!t[12]&&eo(t);const w=[Ac,Sc,kc,_c,Ec,xc,vc],b=[];function g(p,y){return p[10]?0:p[11]?1:p[12]?2:p[17]?3:p[15]?4:p[18]?6:5}return c=g(t),a=b[c]=w[c](t),{c(){e=O("div"),n=O("button"),r=z("⤫"),i=Z(),d&&d.c(),s=Z(),a.c(),E(n,"class",o="absolute right-2 top-0 cursor-pointer bg-transparent text-3xl text-"+t[0]+"-600"),E(e,"class",l="animate-show rounded-md bg-gradient-to-b px-8 py-8 shadow-[0_0px_30px_0px_rgba(0,0,0,0.6)] transition-all sm:w-96 from-"+t[0]+"-900 to-"+t[0]+"-700 "+t[23])},m(p,y){H(p,e,y),B(e,n),B(n,r),B(e,i),d&&d.m(e,null),B(e,s),b[c].m(e,null),f=!0,u||(h=te(n,"click",function(){qt(t[17]?t[29]:t[27])&&(t[17]?t[29]:t[27]).apply(this,arguments)}),u=!0)},p(p,y){t=p,(!f||y[0]&1&&o!==(o="absolute right-2 top-0 cursor-pointer bg-transparent text-3xl text-"+t[0]+"-600"))&&E(n,"class",o),!t[17]&&!t[10]&&!t[11]&&!t[12]?d?d.p(t,y):(d=eo(t),d.c(),d.m(e,s)):d&&(d.d(1),d=null);let k=c;c=g(t),c===k?b[c].p(t,y):(yt(),ge(b[k],1,1,()=>{b[k]=null}),mt(),a=b[c],a?a.p(t,y):(a=b[c]=w[c](t),a.c()),he(a,1),a.m(e,null)),(!f||y[0]&8388609&&l!==(l="animate-show rounded-md bg-gradient-to-b px-8 py-8 shadow-[0_0px_30px_0px_rgba(0,0,0,0.6)] transition-all sm:w-96 from-"+t[0]+"-900 to-"+t[0]+"-700 "+t[23]))&&E(e,"class",l)},i(p){f||(he(a),f=!0)},o(p){ge(a),f=!1},d(p){p&&R(e),d&&d.d(),b[c].d(),u=!1,h()}}}function yc(t){let e,n,r,o,i;const s=[Lc,Cc,Pc,Nc],c=[];function a(l,f){return l[9]?0:l[18]?l[2]?3:2:1}return n=a(t),r=c[n]=s[n](t),{c(){e=O("div"),r.c(),E(e,"class",o="rounded px-2 py-2 shadow-[0_0px_10px_0px_rgba(0,0,0,0.3)] transition-all duration-200 bg-"+t[0]+"-700 hover:bg-"+t[0]+"-800 "+t[23])},m(l,f){H(l,e,f),c[n].m(e,null),i=!0},p(l,f){let u=n;n=a(l),n===u?c[n].p(l,f):(yt(),ge(c[u],1,1,()=>{c[u]=null}),mt(),r=c[n],r?r.p(l,f):(r=c[n]=s[n](l),r.c()),he(r,1),r.m(e,null)),(!i||f[0]&8388609&&o!==(o="rounded px-2 py-2 shadow-[0_0px_10px_0px_rgba(0,0,0,0.3)] transition-all duration-200 bg-"+l[0]+"-700 hover:bg-"+l[0]+"-800 "+l[23]))&&E(e,"class",o)},i(l){i||(he(r),i=!0)},o(l){ge(r),i=!1},d(l){l&&R(e),c[n].d()}}}function mc(t){return{c:U,m:U,p:U,i:U,o:U,d:U}}function eo(t){let e,n,r,o,i;return{c(){e=O("button"),n=z("?"),E(e,"class",r="absolute bottom-1 right-3 cursor-pointer bg-transparent text-xl text-"+t[0]+"-600")},m(s,c){H(s,e,c),B(e,n),o||(i=te(e,"click",t[28]),o=!0)},p(s,c){c[0]&1&&r!==(r="absolute bottom-1 right-3 cursor-pointer bg-transparent text-xl text-"+s[0]+"-600")&&E(e,"class",r)},d(s){s&&R(e),o=!1,i()}}}function vc(t){let e,n,r,o,i,s,c=t[18].npub+"",a,l,f,u,h,d,w,b,g,p,y,k=Er(t[8])+"",C,T,S,_=(t[18].picture||t[18].name)&&to(t);return{c(){e=O("div"),n=O("div"),n.textContent="You are connected to Nostr as",r=Z(),o=O("a"),_&&_.c(),i=Z(),s=O("div"),a=z(c),f=Z(),u=O("button"),h=z("Disconnect"),w=Z(),b=O("div"),g=z("This webpage is using the public key:"),p=O("br"),y=Z(),C=z(k),E(n,"class","mb-4 text-sm"),E(s,"class","block break-all"),E(o,"target","_blank"),E(o,"href",l="https://nosta.me/"+t[18].npub),E(o,"class","group text-white no-underline"),E(e,"class","text-center"),E(u,"class",d="my-2 mt-6 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white bg-"+t[0]+"-900 hover:bg-"+t[0]+"-950"),E(b,"class","mt-6 block break-all text-center text-sm")},m(m,N){H(m,e,N),B(e,n),B(e,r),B(e,o),_&&_.m(o,null),B(o,i),B(o,s),B(s,a),H(m,f,N),H(m,u,N),B(u,h),H(m,w,N),H(m,b,N),B(b,g),B(b,p),B(b,y),B(b,C),T||(S=te(u,"click",t[31]),T=!0)},p(m,N){m[18].picture||m[18].name?_?_.p(m,N):(_=to(m),_.c(),_.m(o,i)):_&&(_.d(1),_=null),N[0]&262144&&c!==(c=m[18].npub+"")&&Ie(a,c),N[0]&262144&&l!==(l="https://nosta.me/"+m[18].npub)&&E(o,"href",l),N[0]&1&&d!==(d="my-2 mt-6 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white bg-"+m[0]+"-900 hover:bg-"+m[0]+"-950")&&E(u,"class",d),N[0]&256&&k!==(k=Er(m[8])+"")&&Ie(C,k)},i:U,o:U,d(m){m&&(R(e),R(f),R(u),R(w),R(b)),_&&_.d(),T=!1,S()}}}function xc(t){let e,n,r,o,i,s,c,a,l,f,u,h,d,w,b,g,p,y=t[16]&&oo(t);const k=[Ic,Bc],C=[];function T(m,N){return m[9]?0:1}a=T(t),l=C[a]=k[a](t);let S=t[9]&&t[13]&&io(t),_=!t[9]&&so(t);return{c(){e=O("div"),e.textContent="How do you want to connect to Nostr?",n=Z(),r=O("form"),o=O("input"),i=Z(),y&&y.c(),s=Z(),c=O("button"),l.c(),h=Z(),S&&S.c(),d=Z(),_&&_.c(),w=Hn(),E(e,"class","text-center text-lg"),E(o,"class","box-border w-full rounded px-2 py-1 text-lg text-neutral-800 outline-none"),E(o,"placeholder","user@provider or bunker://..."),o.autofocus=!0,o.disabled=t[9],E(o,"autocapitalize","none"),E(c,"class",f="mt-4 flex w-full cursor-pointer items-center justify-center rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-"+t[0]+"-900 hover:bg-"+t[0]+"-950"),c.disabled=u=!t[22]||t[9],E(r,"class","mb-1 mt-4 flex flex-col")},m(m,N){H(m,e,N),H(m,n,N),H(m,r,N),B(r,o),t[45](o),Un(o,t[4]),B(r,i),y&&y.m(r,null),B(r,s),B(r,c),C[a].m(c,null),B(r,h),S&&S.m(r,null),H(m,d,N),_&&_.m(m,N),H(m,w,N),b=!0,o.focus(),g||(p=[te(o,"input",t[46]),te(r,"submit",t[30])],g=!0)},p(m,N){(!b||N[0]&512)&&(o.disabled=m[9]),N[0]&16&&o.value!==m[4]&&Un(o,m[4]),m[16]?y?y.p(m,N):(y=oo(m),y.c(),y.m(r,s)):y&&(y.d(1),y=null);let L=a;a=T(m),a!==L&&(yt(),ge(C[L],1,1,()=>{C[L]=null}),mt(),l=C[a],l||(l=C[a]=k[a](m),l.c()),he(l,1),l.m(c,null)),(!b||N[0]&1&&f!==(f="mt-4 flex w-full cursor-pointer items-center justify-center rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-"+m[0]+"-900 hover:bg-"+m[0]+"-950"))&&E(c,"class",f),(!b||N[0]&4194816&&u!==(u=!m[22]||m[9]))&&(c.disabled=u),m[9]&&m[13]?S?S.p(m,N):(S=io(m),S.c(),S.m(r,null)):S&&(S.d(1),S=null),m[9]?_&&(_.d(1),_=null):_?_.p(m,N):(_=so(m),_.c(),_.m(w.parentNode,w))},i(m){b||(he(l),b=!0)},o(m){ge(l),b=!1},d(m){m&&(R(e),R(n),R(r),R(d),R(w)),t[45](null),y&&y.d(),C[a].d(),S&&S.d(),_&&_.d(m),g=!1,Be(p)}}}function Ec(t){let e,n,r,o,i,s,c,a,l,f,u,h,d,w,b;return{c(){e=O("div"),e.textContent="Create a Nostr account",n=Z(),r=O("div"),r.textContent=`To use this Nostr app you need a profile. The following button opens a
|
|
1
|
+
var Xa=Object.defineProperty;var tl=(Yt,$,Pt)=>$ in Yt?Xa(Yt,$,{enumerable:!0,configurable:!0,writable:!0,value:Pt}):Yt[$]=Pt;var v=(Yt,$,Pt)=>(tl(Yt,typeof $!="symbol"?$+"":$,Pt),Pt);(function(){"use strict";var Co,Ro,Ho,Mo,jo;const Yt='*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.fixed{position:fixed}.absolute{position:absolute}.bottom-1{bottom:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.top-0{top:0}.z-\\[9000\\]{z-index:9000}.m-auto{margin:auto}.my-2{margin-top:.5rem;margin-bottom:.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.mr-2{margin-right:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.box-border{box-sizing:border-box}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.h-10{height:2.5rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.w-10{width:2.5rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-full{width:100%}.max-w-56{max-width:14rem}@keyframes moveIn{0%{transform:translateY(-10px)}to{transform:translateY(0)}}.animate-fadein{animation:fadeIn 1s ease-in-out,moveIn 1s ease-in-out}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}.animate-show{animation:fadeIn .2s ease-in-out}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-grabbing{cursor:grabbing}.cursor-pointer{cursor:pointer}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.gap-2{gap:.5rem}.overflow-hidden{overflow:hidden}.overflow-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-md{border-radius:.375rem}.border-0{border-width:0px}.border-2{border-width:2px}.border-solid{border-style:solid}.border-transparent{border-color:transparent}.bg-cyan-700{--tw-bg-opacity: 1;background-color:rgb(14 116 144 / var(--tw-bg-opacity))}.bg-cyan-800{--tw-bg-opacity: 1;background-color:rgb(21 94 117 / var(--tw-bg-opacity))}.bg-cyan-900{--tw-bg-opacity: 1;background-color:rgb(22 78 99 / var(--tw-bg-opacity))}.bg-cyan-950{--tw-bg-opacity: 1;background-color:rgb(8 51 68 / var(--tw-bg-opacity))}.bg-green-700{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity))}.bg-green-800{--tw-bg-opacity: 1;background-color:rgb(22 101 52 / var(--tw-bg-opacity))}.bg-green-900{--tw-bg-opacity: 1;background-color:rgb(20 83 45 / var(--tw-bg-opacity))}.bg-green-950{--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity))}.bg-neutral-700{--tw-bg-opacity: 1;background-color:rgb(64 64 64 / var(--tw-bg-opacity))}.bg-neutral-800{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.bg-neutral-900{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity))}.bg-neutral-950{--tw-bg-opacity: 1;background-color:rgb(10 10 10 / var(--tw-bg-opacity))}.bg-orange-700{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity))}.bg-orange-800{--tw-bg-opacity: 1;background-color:rgb(154 52 18 / var(--tw-bg-opacity))}.bg-orange-900{--tw-bg-opacity: 1;background-color:rgb(124 45 18 / var(--tw-bg-opacity))}.bg-orange-950{--tw-bg-opacity: 1;background-color:rgb(67 20 7 / var(--tw-bg-opacity))}.bg-purple-700{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity))}.bg-purple-800{--tw-bg-opacity: 1;background-color:rgb(107 33 168 / var(--tw-bg-opacity))}.bg-purple-900{--tw-bg-opacity: 1;background-color:rgb(88 28 135 / var(--tw-bg-opacity))}.bg-purple-950{--tw-bg-opacity: 1;background-color:rgb(59 7 100 / var(--tw-bg-opacity))}.bg-red-700{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity))}.bg-red-800{--tw-bg-opacity: 1;background-color:rgb(153 27 27 / var(--tw-bg-opacity))}.bg-red-900{--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity))}.bg-red-950{--tw-bg-opacity: 1;background-color:rgb(69 10 10 / var(--tw-bg-opacity))}.bg-stone-700{--tw-bg-opacity: 1;background-color:rgb(68 64 60 / var(--tw-bg-opacity))}.bg-stone-800{--tw-bg-opacity: 1;background-color:rgb(41 37 36 / var(--tw-bg-opacity))}.bg-stone-900{--tw-bg-opacity: 1;background-color:rgb(28 25 23 / var(--tw-bg-opacity))}.bg-stone-950{--tw-bg-opacity: 1;background-color:rgb(12 10 9 / var(--tw-bg-opacity))}.bg-transparent{background-color:transparent}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity))}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.from-cyan-900{--tw-gradient-from: #164e63 var(--tw-gradient-from-position);--tw-gradient-to: rgb(22 78 99 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-900{--tw-gradient-from: #14532d var(--tw-gradient-from-position);--tw-gradient-to: rgb(20 83 45 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-neutral-900{--tw-gradient-from: #171717 var(--tw-gradient-from-position);--tw-gradient-to: rgb(23 23 23 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-900{--tw-gradient-from: #7c2d12 var(--tw-gradient-from-position);--tw-gradient-to: rgb(124 45 18 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-900{--tw-gradient-from: #581c87 var(--tw-gradient-from-position);--tw-gradient-to: rgb(88 28 135 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-900{--tw-gradient-from: #7f1d1d var(--tw-gradient-from-position);--tw-gradient-to: rgb(127 29 29 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-stone-900{--tw-gradient-from: #1c1917 var(--tw-gradient-from-position);--tw-gradient-to: rgb(28 25 23 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-cyan-700{--tw-gradient-to: #0e7490 var(--tw-gradient-to-position)}.to-green-700{--tw-gradient-to: #15803d var(--tw-gradient-to-position)}.to-neutral-700{--tw-gradient-to: #404040 var(--tw-gradient-to-position)}.to-orange-700{--tw-gradient-to: #c2410c var(--tw-gradient-to-position)}.to-purple-700{--tw-gradient-to: #7e22ce var(--tw-gradient-to-position)}.to-red-700{--tw-gradient-to: #b91c1c var(--tw-gradient-to-position)}.to-stone-700{--tw-gradient-to: #44403c var(--tw-gradient-to-position)}.p-2{padding:.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.text-center{text-align:center}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.leading-3{line-height:.75rem}.leading-4{line-height:1rem}.leading-5{line-height:1.25rem}.text-cyan-600{--tw-text-opacity: 1;color:rgb(8 145 178 / var(--tw-text-opacity))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity))}.text-neutral-600{--tw-text-opacity: 1;color:rgb(82 82 82 / var(--tw-text-opacity))}.text-neutral-800{--tw-text-opacity: 1;color:rgb(38 38 38 / var(--tw-text-opacity))}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity))}.text-stone-600{--tw-text-opacity: 1;color:rgb(87 83 78 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.underline{text-decoration-line:underline}.no-underline{text-decoration-line:none}.decoration-2{text-decoration-thickness:2px}.underline-offset-4{text-underline-offset:4px}.opacity-25{opacity:.25}.opacity-75{opacity:.75}.shadow-\\[0_0px_10px_0px_rgba\\(0\\,0\\,0\\,0\\.3\\)\\]{--tw-shadow: 0 0px 10px 0px rgba(0,0,0,.3);--tw-shadow-colored: 0 0px 10px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\\[0_0px_30px_0px_rgba\\(0\\,0\\,0\\,0\\.6\\)\\]{--tw-shadow: 0 0px 30px 0px rgba(0,0,0,.6);--tw-shadow-colored: 0 0px 30px 0px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline-dashed{outline-style:dashed}.outline-1{outline-width:1px}.outline-offset-4{outline-offset:4px}.outline-cyan-500{outline-color:#06b6d4}.outline-green-500{outline-color:#22c55e}.outline-neutral-500{outline-color:#737373}.outline-orange-500{outline-color:#f97316}.outline-purple-500{outline-color:#a855f7}.outline-red-500{outline-color:#ef4444}.outline-stone-500{outline-color:#78716c}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.hover\\:bg-cyan-700:hover{--tw-bg-opacity: 1;background-color:rgb(14 116 144 / var(--tw-bg-opacity))}.hover\\:bg-cyan-800:hover{--tw-bg-opacity: 1;background-color:rgb(21 94 117 / var(--tw-bg-opacity))}.hover\\:bg-cyan-900:hover{--tw-bg-opacity: 1;background-color:rgb(22 78 99 / var(--tw-bg-opacity))}.hover\\:bg-cyan-950:hover{--tw-bg-opacity: 1;background-color:rgb(8 51 68 / var(--tw-bg-opacity))}.hover\\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity))}.hover\\:bg-green-800:hover{--tw-bg-opacity: 1;background-color:rgb(22 101 52 / var(--tw-bg-opacity))}.hover\\:bg-green-900:hover{--tw-bg-opacity: 1;background-color:rgb(20 83 45 / var(--tw-bg-opacity))}.hover\\:bg-green-950:hover{--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity))}.hover\\:bg-neutral-700:hover{--tw-bg-opacity: 1;background-color:rgb(64 64 64 / var(--tw-bg-opacity))}.hover\\:bg-neutral-800:hover{--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity))}.hover\\:bg-neutral-900:hover{--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity))}.hover\\:bg-neutral-950:hover{--tw-bg-opacity: 1;background-color:rgb(10 10 10 / var(--tw-bg-opacity))}.hover\\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity))}.hover\\:bg-orange-800:hover{--tw-bg-opacity: 1;background-color:rgb(154 52 18 / var(--tw-bg-opacity))}.hover\\:bg-orange-900:hover{--tw-bg-opacity: 1;background-color:rgb(124 45 18 / var(--tw-bg-opacity))}.hover\\:bg-orange-950:hover{--tw-bg-opacity: 1;background-color:rgb(67 20 7 / var(--tw-bg-opacity))}.hover\\:bg-purple-700:hover{--tw-bg-opacity: 1;background-color:rgb(126 34 206 / var(--tw-bg-opacity))}.hover\\:bg-purple-800:hover{--tw-bg-opacity: 1;background-color:rgb(107 33 168 / var(--tw-bg-opacity))}.hover\\:bg-purple-900:hover{--tw-bg-opacity: 1;background-color:rgb(88 28 135 / var(--tw-bg-opacity))}.hover\\:bg-purple-950:hover{--tw-bg-opacity: 1;background-color:rgb(59 7 100 / var(--tw-bg-opacity))}.hover\\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity))}.hover\\:bg-red-800:hover{--tw-bg-opacity: 1;background-color:rgb(153 27 27 / var(--tw-bg-opacity))}.hover\\:bg-red-900:hover{--tw-bg-opacity: 1;background-color:rgb(127 29 29 / var(--tw-bg-opacity))}.hover\\:bg-red-950:hover{--tw-bg-opacity: 1;background-color:rgb(69 10 10 / var(--tw-bg-opacity))}.hover\\:bg-stone-700:hover{--tw-bg-opacity: 1;background-color:rgb(68 64 60 / var(--tw-bg-opacity))}.hover\\:bg-stone-800:hover{--tw-bg-opacity: 1;background-color:rgb(41 37 36 / var(--tw-bg-opacity))}.hover\\:bg-stone-900:hover{--tw-bg-opacity: 1;background-color:rgb(28 25 23 / var(--tw-bg-opacity))}.hover\\:bg-stone-950:hover{--tw-bg-opacity: 1;background-color:rgb(12 10 9 / var(--tw-bg-opacity))}.disabled\\:cursor-default:disabled{cursor:default}.disabled\\:bg-neutral-400:disabled{--tw-bg-opacity: 1;background-color:rgb(163 163 163 / var(--tw-bg-opacity))}.disabled\\:text-neutral-200:disabled{--tw-text-opacity: 1;color:rgb(229 229 229 / var(--tw-text-opacity))}.group:hover .group-hover\\:underline{text-decoration-line:underline}@media (min-width: 640px){.sm\\:w-96{width:24rem}}';function $(){}function Pt(e){return e()}function Jn(){return Object.create(null)}function Ct(e){e.forEach(Pt)}function Ye(e){return typeof e=="function"}function Ze(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}let Ie;function re(e,t){return e===t?!0:(Ie||(Ie=document.createElement("a")),Ie.href=t,e===Ie.href)}function Ko(e){return Object.keys(e).length===0}function Wo(e,...t){if(e==null){for(const r of t)r(void 0);return $}const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}function Do(e,t,n){e.$$.on_destroy.push(Wo(t,n))}const Vo=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function I(e,t){e.appendChild(t)}function j(e,t,n){e.insertBefore(t,n||null)}function M(e){e.parentNode&&e.parentNode.removeChild(e)}function C(e){return document.createElement(e)}function Je(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function F(e){return document.createTextNode(e)}function Z(){return F(" ")}function Qn(){return F("")}function ot(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function S(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function Fo(e){return Array.from(e.childNodes)}function Rt(e,t){t=""+t,e.data!==t&&(e.data=t)}function Xn(e,t){e.value=t??""}function tr(e,t,n){e.classList.toggle(t,!!n)}let we;function ye(e){we=e}function Go(){if(!we)throw new Error("Function called outside component initialization");return we}function Yo(e){Go().$$.on_mount.push(e)}const oe=[],Te=[];let ie=[];const er=[],Zo=Promise.resolve();let Qe=!1;function Jo(){Qe||(Qe=!0,Zo.then(nr))}function Xe(e){ie.push(e)}const tn=new Set;let se=0;function nr(){if(se!==0)return;const e=we;do{try{for(;se<oe.length;){const t=oe[se];se++,ye(t),Qo(t.$$)}}catch(t){throw oe.length=0,se=0,t}for(ye(null),oe.length=0,se=0;Te.length;)Te.pop()();for(let t=0;t<ie.length;t+=1){const n=ie[t];tn.has(n)||(tn.add(n),n())}ie.length=0}while(oe.length);for(;er.length;)er.pop()();Qe=!1,tn.clear(),ye(e)}function Qo(e){if(e.fragment!==null){e.update(),Ct(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(Xe)}}function Xo(e){const t=[],n=[];ie.forEach(r=>e.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),ie=t}const Oe=new Set;let Zt;function Le(){Zt={r:0,c:[],p:Zt}}function Ne(){Zt.r||Ct(Zt.c),Zt=Zt.p}function vt(e,t){e&&e.i&&(Oe.delete(e),e.i(t))}function Et(e,t,n,r){if(e&&e.o){if(Oe.has(e))return;Oe.add(e),Zt.c.push(()=>{Oe.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}else r&&r()}function rr(e){e&&e.c()}function en(e,t,n){const{fragment:r,after_update:o}=e.$$;r&&r.m(t,n),Xe(()=>{const i=e.$$.on_mount.map(Pt).filter(Ye);e.$$.on_destroy?e.$$.on_destroy.push(...i):Ct(i),e.$$.on_mount=[]}),o.forEach(Xe)}function nn(e,t){const n=e.$$;n.fragment!==null&&(Xo(n.after_update),Ct(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function ti(e,t){e.$$.dirty[0]===-1&&(oe.push(e),Jo(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function or(e,t,n,r,o,i,s=null,c=[-1]){const a=we;ye(e);const l=e.$$={fragment:null,ctx:[],props:i,update:$,not_equal:o,bound:Jn(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(a?a.$$.context:[])),callbacks:Jn(),dirty:c,skip_bound:!1,root:t.target||a.$$.root};s&&s(l.root);let f=!1;if(l.ctx=n?n(e,t.props||{},(u,g,...h)=>{const p=h.length?h[0]:g;return l.ctx&&o(l.ctx[u],l.ctx[u]=p)&&(!l.skip_bound&&l.bound[u]&&l.bound[u](p),f&&ti(e,u)),g}):[],l.update(),f=!0,Ct(l.before_update),l.fragment=r?r(l.ctx):!1,t.target){if(t.hydrate){const u=Fo(t.target);l.fragment&&l.fragment.l(u),u.forEach(M)}else l.fragment&&l.fragment.c();t.intro&&vt(e.$$.fragment),en(e,t.target,t.anchor),nr()}ye(a)}class ir{constructor(){v(this,"$$");v(this,"$$set")}$destroy(){nn(this,1),this.$destroy=$}$on(t,n){if(!Ye(n))return $;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const o=r.indexOf(n);o!==-1&&r.splice(o,1)}}$set(t){this.$$set&&!Ko(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const ei="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(ei);function ni(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var rn={exports:{}};function sr(e,t=100,n={}){if(typeof e!="function")throw new TypeError(`Expected the first parameter to be a function, got \`${typeof e}\`.`);if(t<0)throw new RangeError("`wait` must not be negative.");const{immediate:r}=typeof n=="boolean"?{immediate:n}:n;let o,i,s,c,a;function l(){const u=Date.now()-c;if(u<t&&u>=0)s=setTimeout(l,t-u);else if(s=void 0,!r){const g=o,h=i;o=void 0,i=void 0,a=e.apply(g,h)}}const f=function(...u){if(o&&this!==o)throw new Error("Debounced method called with different contexts.");o=this,i=u,c=Date.now();const g=r&&!s;if(s||(s=setTimeout(l,t)),g){const h=o,p=i;o=void 0,i=void 0,a=e.apply(h,p)}return a};return f.clear=()=>{s&&(clearTimeout(s),s=void 0)},f.flush=()=>{if(!s)return;const u=o,g=i;o=void 0,i=void 0,a=e.apply(u,g),clearTimeout(s),s=void 0},f}rn.exports.debounce=sr,rn.exports=sr;var ri=rn.exports;const oi=ni(ri),on=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const sn=e=>e instanceof Uint8Array,cn=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),_t=(e,t)=>e<<32-t|e>>>t;if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");const ii=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ht(e){if(!sn(e))throw new Error("Uint8Array expected");let t="";for(let n=0;n<e.length;n++)t+=ii[e[n]];return t}function cr(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(t/2);for(let r=0;r<n.length;r++){const o=r*2,i=e.slice(o,o+2),s=Number.parseInt(i,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");n[r]=s}return n}function si(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function me(e){if(typeof e=="string"&&(e=si(e)),!sn(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}function an(...e){const t=new Uint8Array(e.reduce((r,o)=>r+o.length,0));let n=0;return e.forEach(r=>{if(!sn(r))throw new Error("Uint8Array expected");t.set(r,n),n+=r.length}),t}let ar=class{clone(){return this._cloneInto()}};function lr(e){const t=r=>e().update(me(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function ci(e=32){if(on&&typeof on.getRandomValues=="function")return on.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function ur(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function fr(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 ai(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ur(e.outputLen),ur(e.blockLen)}function Ue(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 li(e,t){fr(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const ln=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const dr=e=>e instanceof Uint8Array,un=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),kt=(e,t)=>e<<32-t|e>>>t;if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");function ui(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function fn(e){if(typeof e=="string"&&(e=ui(e)),!dr(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}function fi(...e){const t=new Uint8Array(e.reduce((r,o)=>r+o.length,0));let n=0;return e.forEach(r=>{if(!dr(r))throw new Error("Uint8Array expected");t.set(r,n),n+=r.length}),t}class hr{clone(){return this._cloneInto()}}function di(e){const t=r=>e().update(fn(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function gr(e=32){if(ln&&typeof ln.getRandomValues=="function")return ln.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function hi(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),i=BigInt(4294967295),s=Number(n>>o&i),c=Number(n&i),a=r?4:0,l=r?0:4;e.setUint32(t+a,s,r),e.setUint32(t+l,c,r)}let gi=class extends hr{constructor(t,n,r,o){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=un(this.buffer)}update(t){Ue(this);const{view:n,buffer:r,blockLen:o}=this;t=fn(t);const i=t.length;for(let s=0;s<i;){const c=Math.min(o-this.pos,i-s);if(c===o){const a=un(t);for(;o<=i-s;s+=o)this.process(a,s);continue}r.set(t.subarray(s,s+c),this.pos),this.pos+=c,s+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ue(this),li(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:i}=this;let{pos:s}=this;n[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>o-s&&(this.process(r,0),s=0);for(let u=s;u<o;u++)n[u]=0;hi(r,o-8,BigInt(this.length*8),i),this.process(r,0);const c=un(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,f=this.get();if(l>f.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)c.setUint32(4*u,f[u],i)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:i,destroyed:s,pos:c}=this;return t.length=o,t.pos=c,t.finished=i,t.destroyed=s,o%n&&t.buffer.set(r),t}};const bi=(e,t,n)=>e&t^~e&n,pi=(e,t,n)=>e&t^e&n^t&n,wi=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]),Ht=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Mt=new Uint32Array(64);let yi=class extends gi{constructor(){super(64,32,8,!1),this.A=Ht[0]|0,this.B=Ht[1]|0,this.C=Ht[2]|0,this.D=Ht[3]|0,this.E=Ht[4]|0,this.F=Ht[5]|0,this.G=Ht[6]|0,this.H=Ht[7]|0}get(){const{A:t,B:n,C:r,D:o,E:i,F:s,G:c,H:a}=this;return[t,n,r,o,i,s,c,a]}set(t,n,r,o,i,s,c,a){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=i|0,this.F=s|0,this.G=c|0,this.H=a|0}process(t,n){for(let u=0;u<16;u++,n+=4)Mt[u]=t.getUint32(n,!1);for(let u=16;u<64;u++){const g=Mt[u-15],h=Mt[u-2],p=kt(g,7)^kt(g,18)^g>>>3,d=kt(h,17)^kt(h,19)^h>>>10;Mt[u]=d+Mt[u-7]+p+Mt[u-16]|0}let{A:r,B:o,C:i,D:s,E:c,F:a,G:l,H:f}=this;for(let u=0;u<64;u++){const g=kt(c,6)^kt(c,11)^kt(c,25),h=f+g+bi(c,a,l)+wi[u]+Mt[u]|0,d=(kt(r,2)^kt(r,13)^kt(r,22))+pi(r,o,i)|0;f=l,l=a,a=c,c=s+h|0,s=i,i=o,o=r,r=h+d|0}r=r+this.A|0,o=o+this.B|0,i=i+this.C|0,s=s+this.D|0,c=c+this.E|0,a=a+this.F|0,l=l+this.G|0,f=f+this.H|0,this.set(r,o,i,s,c,a,l,f)}roundClean(){Mt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const dn=di(()=>new yi);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const br=BigInt(0),Pe=BigInt(1),mi=BigInt(2),Ce=e=>e instanceof Uint8Array,xi=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ce(e){if(!Ce(e))throw new Error("Uint8Array expected");let t="";for(let n=0;n<e.length;n++)t+=xi[e[n]];return t}function pr(e){const t=e.toString(16);return t.length&1?`0${t}`:t}function hn(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return BigInt(e===""?"0":`0x${e}`)}function ae(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(t/2);for(let r=0;r<n.length;r++){const o=r*2,i=e.slice(o,o+2),s=Number.parseInt(i,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");n[r]=s}return n}function gt(e){return hn(ce(e))}function gn(e){if(!Ce(e))throw new Error("Uint8Array expected");return hn(ce(Uint8Array.from(e).reverse()))}function jt(e,t){return ae(e.toString(16).padStart(t*2,"0"))}function bn(e,t){return jt(e,t).reverse()}function vi(e){return ae(pr(e))}function at(e,t,n){let r;if(typeof t=="string")try{r=ae(t)}catch(i){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${i}`)}else if(Ce(t))r=Uint8Array.from(t);else throw new Error(`${e} must be hex string or Uint8Array`);const o=r.length;if(typeof n=="number"&&o!==n)throw new Error(`${e} expected ${n} bytes, got ${o}`);return r}function Jt(...e){const t=new Uint8Array(e.reduce((r,o)=>r+o.length,0));let n=0;return e.forEach(r=>{if(!Ce(r))throw new Error("Uint8Array expected");t.set(r,n),n+=r.length}),t}function Ei(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function _i(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function ki(e){let t;for(t=0;e>br;e>>=Pe,t+=1);return t}function Si(e,t){return e>>BigInt(t)&Pe}const Ai=(e,t,n)=>e|(n?Pe:br)<<BigInt(t),pn=e=>(mi<<BigInt(e-1))-Pe,wn=e=>new Uint8Array(e),wr=e=>Uint8Array.from(e);function yr(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=wn(e),o=wn(e),i=0;const s=()=>{r.fill(1),o.fill(0),i=0},c=(...u)=>n(o,r,...u),a=(u=wn())=>{o=c(wr([0]),u),r=c(),u.length!==0&&(o=c(wr([1]),u),r=c())},l=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let u=0;const g=[];for(;u<t;){r=c();const h=r.slice();g.push(h),u+=r.length}return Jt(...g)};return(u,g)=>{s(),a(u);let h;for(;!(h=g(l()));)a();return s(),h}}const Bi={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 xe(e,t,n={}){const r=(o,i,s)=>{const c=Bi[i];if(typeof c!="function")throw new Error(`Invalid validator "${i}", expected function`);const a=e[o];if(!(s&&a===void 0)&&!c(a,e))throw new Error(`Invalid param ${String(o)}=${a} (${typeof a}), expected ${i}`)};for(const[o,i]of Object.entries(t))r(o,i,!1);for(const[o,i]of Object.entries(n))r(o,i,!0);return e}const Ii=Object.freeze(Object.defineProperty({__proto__:null,bitGet:Si,bitLen:ki,bitMask:pn,bitSet:Ai,bytesToHex:ce,bytesToNumberBE:gt,bytesToNumberLE:gn,concatBytes:Jt,createHmacDrbg:yr,ensureBytes:at,equalBytes:Ei,hexToBytes:ae,hexToNumber:hn,numberToBytesBE:jt,numberToBytesLE:bn,numberToHexUnpadded:pr,numberToVarBytesBE:vi,utf8ToBytes:_i,validateObject:xe},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const nt=BigInt(0),X=BigInt(1),Qt=BigInt(2),Ti=BigInt(3),yn=BigInt(4),mr=BigInt(5),xr=BigInt(8);BigInt(9),BigInt(16);function it(e,t){const n=e%t;return n>=nt?n:t+n}function Oi(e,t,n){if(n<=nt||t<nt)throw new Error("Expected power/modulo > 0");if(n===X)return nt;let r=X;for(;t>nt;)t&X&&(r=r*e%n),e=e*e%n,t>>=X;return r}function pt(e,t,n){let r=e;for(;t-- >nt;)r*=r,r%=n;return r}function mn(e,t){if(e===nt||t<=nt)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=it(e,t),r=t,o=nt,i=X;for(;n!==nt;){const c=r/n,a=r%n,l=o-i*c;r=n,n=a,o=i,i=l}if(r!==X)throw new Error("invert: does not exist");return it(o,t)}function Li(e){const t=(e-X)/Qt;let n,r,o;for(n=e-X,r=0;n%Qt===nt;n/=Qt,r++);for(o=Qt;o<e&&Oi(o,t,e)!==e-X;o++);if(r===1){const s=(e+X)/yn;return function(a,l){const f=a.pow(l,s);if(!a.eql(a.sqr(f),l))throw new Error("Cannot find square root");return f}}const i=(n+X)/Qt;return function(c,a){if(c.pow(a,t)===c.neg(c.ONE))throw new Error("Cannot find square root");let l=r,f=c.pow(c.mul(c.ONE,o),n),u=c.pow(a,i),g=c.pow(a,n);for(;!c.eql(g,c.ONE);){if(c.eql(g,c.ZERO))return c.ZERO;let h=1;for(let d=c.sqr(g);h<l&&!c.eql(d,c.ONE);h++)d=c.sqr(d);const p=c.pow(f,X<<BigInt(l-h-1));f=c.sqr(p),u=c.mul(u,p),g=c.mul(g,f),l=h}return u}}function Ni(e){if(e%yn===Ti){const t=(e+X)/yn;return function(r,o){const i=r.pow(o,t);if(!r.eql(r.sqr(i),o))throw new Error("Cannot find square root");return i}}if(e%xr===mr){const t=(e-mr)/xr;return function(r,o){const i=r.mul(o,Qt),s=r.pow(i,t),c=r.mul(o,s),a=r.mul(r.mul(c,Qt),s),l=r.mul(c,r.sub(a,r.ONE));if(!r.eql(r.sqr(l),o))throw new Error("Cannot find square root");return l}}return Li(e)}const Ui=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Pi(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=Ui.reduce((r,o)=>(r[o]="function",r),t);return xe(e,n)}function Ci(e,t,n){if(n<nt)throw new Error("Expected power > 0");if(n===nt)return e.ONE;if(n===X)return t;let r=e.ONE,o=t;for(;n>nt;)n&X&&(r=e.mul(r,o)),o=e.sqr(o),n>>=X;return r}function Ri(e,t){const n=new Array(t.length),r=t.reduce((i,s,c)=>e.is0(s)?i:(n[c]=i,e.mul(i,s)),e.ONE),o=e.inv(r);return t.reduceRight((i,s,c)=>e.is0(s)?i:(n[c]=e.mul(i,n[c]),e.mul(i,s)),o),n}function vr(e,t){const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function Hi(e,t,n=!1,r={}){if(e<=nt)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:o,nByteLength:i}=vr(e,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=Ni(e),c=Object.freeze({ORDER:e,BITS:o,BYTES:i,MASK:pn(o),ZERO:nt,ONE:X,create:a=>it(a,e),isValid:a=>{if(typeof a!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof a}`);return nt<=a&&a<e},is0:a=>a===nt,isOdd:a=>(a&X)===X,neg:a=>it(-a,e),eql:(a,l)=>a===l,sqr:a=>it(a*a,e),add:(a,l)=>it(a+l,e),sub:(a,l)=>it(a-l,e),mul:(a,l)=>it(a*l,e),pow:(a,l)=>Ci(c,a,l),div:(a,l)=>it(a*mn(l,e),e),sqrN:a=>a*a,addN:(a,l)=>a+l,subN:(a,l)=>a-l,mulN:(a,l)=>a*l,inv:a=>mn(a,e),sqrt:r.sqrt||(a=>s(c,a)),invertBatch:a=>Ri(c,a),cmov:(a,l,f)=>f?l:a,toBytes:a=>n?bn(a,i):jt(a,i),fromBytes:a=>{if(a.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${a.length}`);return n?gn(a):gt(a)}});return Object.freeze(c)}function Er(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 _r(e){const t=Er(e);return t+Math.ceil(t/2)}function Mi(e,t,n=!1){const r=e.length,o=Er(t),i=_r(t);if(r<16||r<i||r>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${r}`);const s=n?gt(e):gn(e),c=it(s,t-X)+X;return n?bn(c,o):jt(c,o)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ji=BigInt(0),xn=BigInt(1);function $i(e,t){const n=(o,i)=>{const s=i.negate();return o?s:i},r=o=>{const i=Math.ceil(t/o)+1,s=2**(o-1);return{windows:i,windowSize:s}};return{constTimeNegate:n,unsafeLadder(o,i){let s=e.ZERO,c=o;for(;i>ji;)i&xn&&(s=s.add(c)),c=c.double(),i>>=xn;return s},precomputeWindow(o,i){const{windows:s,windowSize:c}=r(i),a=[];let l=o,f=l;for(let u=0;u<s;u++){f=l,a.push(f);for(let g=1;g<c;g++)f=f.add(l),a.push(f);l=f.double()}return a},wNAF(o,i,s){const{windows:c,windowSize:a}=r(o);let l=e.ZERO,f=e.BASE;const u=BigInt(2**o-1),g=2**o,h=BigInt(o);for(let p=0;p<c;p++){const d=p*a;let b=Number(s&u);s>>=h,b>a&&(b-=g,s+=xn);const w=d,y=d+Math.abs(b)-1,k=p%2!==0,P=b<0;b===0?f=f.add(n(k,i[w])):l=l.add(n(P,i[y]))}return{p:l,f}},wNAFCached(o,i,s,c){const a=o._WINDOW_SIZE||1;let l=i.get(o);return l||(l=this.precomputeWindow(o,a),a!==1&&i.set(o,c(l))),this.wNAF(a,l,s)}}}function kr(e){return Pi(e.Fp),xe(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...vr(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function qi(e){const t=kr(e);xe(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:o}=t;if(n){if(!r.eql(o,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:zi,hexToBytes:Ki}=Ii,Xt={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(e){const{Err:t}=Xt;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:zi(r),l:e.subarray(n+2)}},toSig(e){const{Err:t}=Xt,n=typeof e=="string"?Ki(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:o,l:i}=Xt._parseInt(n.subarray(2)),{d:s,l:c}=Xt._parseInt(i);if(c.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,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)),o=t(n(e.r)),i=r.length/2,s=o.length/2,c=n(i),a=n(s);return`30${n(s+i+4)}02${a}${o}02${c}${r}`}},It=BigInt(0),wt=BigInt(1);BigInt(2);const Sr=BigInt(3);BigInt(4);function Wi(e){const t=qi(e),{Fp:n}=t,r=t.toBytes||((p,d,b)=>{const w=d.toAffine();return Jt(Uint8Array.from([4]),n.toBytes(w.x),n.toBytes(w.y))}),o=t.fromBytes||(p=>{const d=p.subarray(1),b=n.fromBytes(d.subarray(0,n.BYTES)),w=n.fromBytes(d.subarray(n.BYTES,2*n.BYTES));return{x:b,y:w}});function i(p){const{a:d,b}=t,w=n.sqr(p),y=n.mul(w,p);return n.add(n.add(y,n.mul(p,d)),b)}if(!n.eql(n.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function s(p){return typeof p=="bigint"&&It<p&&p<t.n}function c(p){if(!s(p))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function a(p){const{allowedPrivateKeyLengths:d,nByteLength:b,wrapPrivateKey:w,n:y}=t;if(d&&typeof p!="bigint"){if(p instanceof Uint8Array&&(p=ce(p)),typeof p!="string"||!d.includes(p.length))throw new Error("Invalid key");p=p.padStart(b*2,"0")}let k;try{k=typeof p=="bigint"?p:gt(at("private key",p,b))}catch{throw new Error(`private key must be ${b} bytes, hex or bigint, not ${typeof p}`)}return w&&(k=it(k,y)),c(k),k}const l=new Map;function f(p){if(!(p instanceof u))throw new Error("ProjectivePoint expected")}class u{constructor(d,b,w){if(this.px=d,this.py=b,this.pz=w,d==null||!n.isValid(d))throw new Error("x required");if(b==null||!n.isValid(b))throw new Error("y required");if(w==null||!n.isValid(w))throw new Error("z required")}static fromAffine(d){const{x:b,y:w}=d||{};if(!d||!n.isValid(b)||!n.isValid(w))throw new Error("invalid affine point");if(d instanceof u)throw new Error("projective point not allowed");const y=k=>n.eql(k,n.ZERO);return y(b)&&y(w)?u.ZERO:new u(b,w,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(d){const b=n.invertBatch(d.map(w=>w.pz));return d.map((w,y)=>w.toAffine(b[y])).map(u.fromAffine)}static fromHex(d){const b=u.fromAffine(o(at("pointHex",d)));return b.assertValidity(),b}static fromPrivateKey(d){return u.BASE.multiply(a(d))}_setWindowSize(d){this._WINDOW_SIZE=d,l.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:d,y:b}=this.toAffine();if(!n.isValid(d)||!n.isValid(b))throw new Error("bad point: x or y not FE");const w=n.sqr(b),y=i(d);if(!n.eql(w,y))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:d}=this.toAffine();if(n.isOdd)return!n.isOdd(d);throw new Error("Field doesn't support isOdd")}equals(d){f(d);const{px:b,py:w,pz:y}=this,{px:k,py:P,pz:N}=d,E=n.eql(n.mul(b,N),n.mul(k,y)),_=n.eql(n.mul(w,N),n.mul(P,y));return E&&_}negate(){return new u(this.px,n.neg(this.py),this.pz)}double(){const{a:d,b}=t,w=n.mul(b,Sr),{px:y,py:k,pz:P}=this;let N=n.ZERO,E=n.ZERO,_=n.ZERO,m=n.mul(y,y),T=n.mul(k,k),U=n.mul(P,P),R=n.mul(y,k);return R=n.add(R,R),_=n.mul(y,P),_=n.add(_,_),N=n.mul(d,_),E=n.mul(w,U),E=n.add(N,E),N=n.sub(T,E),E=n.add(T,E),E=n.mul(N,E),N=n.mul(R,N),_=n.mul(w,_),U=n.mul(d,U),R=n.sub(m,U),R=n.mul(d,R),R=n.add(R,_),_=n.add(m,m),m=n.add(_,m),m=n.add(m,U),m=n.mul(m,R),E=n.add(E,m),U=n.mul(k,P),U=n.add(U,U),m=n.mul(U,R),N=n.sub(N,m),_=n.mul(U,T),_=n.add(_,_),_=n.add(_,_),new u(N,E,_)}add(d){f(d);const{px:b,py:w,pz:y}=this,{px:k,py:P,pz:N}=d;let E=n.ZERO,_=n.ZERO,m=n.ZERO;const T=t.a,U=n.mul(t.b,Sr);let R=n.mul(b,k),D=n.mul(w,P),q=n.mul(y,N),W=n.add(b,w),x=n.add(k,P);W=n.mul(W,x),x=n.add(R,D),W=n.sub(W,x),x=n.add(b,y);let A=n.add(k,N);return x=n.mul(x,A),A=n.add(R,q),x=n.sub(x,A),A=n.add(w,y),E=n.add(P,N),A=n.mul(A,E),E=n.add(D,q),A=n.sub(A,E),m=n.mul(T,x),E=n.mul(U,q),m=n.add(E,m),E=n.sub(D,m),m=n.add(D,m),_=n.mul(E,m),D=n.add(R,R),D=n.add(D,R),q=n.mul(T,q),x=n.mul(U,x),D=n.add(D,q),q=n.sub(R,q),q=n.mul(T,q),x=n.add(x,q),R=n.mul(D,x),_=n.add(_,R),R=n.mul(A,x),E=n.mul(W,E),E=n.sub(E,R),R=n.mul(W,D),m=n.mul(A,m),m=n.add(m,R),new u(E,_,m)}subtract(d){return this.add(d.negate())}is0(){return this.equals(u.ZERO)}wNAF(d){return h.wNAFCached(this,l,d,b=>{const w=n.invertBatch(b.map(y=>y.pz));return b.map((y,k)=>y.toAffine(w[k])).map(u.fromAffine)})}multiplyUnsafe(d){const b=u.ZERO;if(d===It)return b;if(c(d),d===wt)return this;const{endo:w}=t;if(!w)return h.unsafeLadder(this,d);let{k1neg:y,k1:k,k2neg:P,k2:N}=w.splitScalar(d),E=b,_=b,m=this;for(;k>It||N>It;)k&wt&&(E=E.add(m)),N&wt&&(_=_.add(m)),m=m.double(),k>>=wt,N>>=wt;return y&&(E=E.negate()),P&&(_=_.negate()),_=new u(n.mul(_.px,w.beta),_.py,_.pz),E.add(_)}multiply(d){c(d);let b=d,w,y;const{endo:k}=t;if(k){const{k1neg:P,k1:N,k2neg:E,k2:_}=k.splitScalar(b);let{p:m,f:T}=this.wNAF(N),{p:U,f:R}=this.wNAF(_);m=h.constTimeNegate(P,m),U=h.constTimeNegate(E,U),U=new u(n.mul(U.px,k.beta),U.py,U.pz),w=m.add(U),y=T.add(R)}else{const{p:P,f:N}=this.wNAF(b);w=P,y=N}return u.normalizeZ([w,y])[0]}multiplyAndAddUnsafe(d,b,w){const y=u.BASE,k=(N,E)=>E===It||E===wt||!N.equals(y)?N.multiplyUnsafe(E):N.multiply(E),P=k(this,b).add(k(d,w));return P.is0()?void 0:P}toAffine(d){const{px:b,py:w,pz:y}=this,k=this.is0();d==null&&(d=k?n.ONE:n.inv(y));const P=n.mul(b,d),N=n.mul(w,d),E=n.mul(y,d);if(k)return{x:n.ZERO,y:n.ZERO};if(!n.eql(E,n.ONE))throw new Error("invZ was invalid");return{x:P,y:N}}isTorsionFree(){const{h:d,isTorsionFree:b}=t;if(d===wt)return!0;if(b)return b(u,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:d,clearCofactor:b}=t;return d===wt?this:b?b(u,this):this.multiplyUnsafe(t.h)}toRawBytes(d=!0){return this.assertValidity(),r(u,this,d)}toHex(d=!0){return ce(this.toRawBytes(d))}}u.BASE=new u(t.Gx,t.Gy,n.ONE),u.ZERO=new u(n.ZERO,n.ONE,n.ZERO);const g=t.nBitLength,h=$i(u,t.endo?Math.ceil(g/2):g);return{CURVE:t,ProjectivePoint:u,normPrivateKeyToScalar:a,weierstrassEquation:i,isWithinCurveOrder:s}}function Di(e){const t=kr(e);return xe(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Vi(e){const t=Di(e),{Fp:n,n:r}=t,o=n.BYTES+1,i=2*n.BYTES+1;function s(x){return It<x&&x<n.ORDER}function c(x){return it(x,r)}function a(x){return mn(x,r)}const{ProjectivePoint:l,normPrivateKeyToScalar:f,weierstrassEquation:u,isWithinCurveOrder:g}=Wi({...t,toBytes(x,A,O){const H=A.toAffine(),B=n.toBytes(H.x),z=Jt;return O?z(Uint8Array.from([A.hasEvenY()?2:3]),B):z(Uint8Array.from([4]),B,n.toBytes(H.y))},fromBytes(x){const A=x.length,O=x[0],H=x.subarray(1);if(A===o&&(O===2||O===3)){const B=gt(H);if(!s(B))throw new Error("Point is not on curve");const z=u(B);let V=n.sqrt(z);const K=(V&wt)===wt;return(O&1)===1!==K&&(V=n.neg(V)),{x:B,y:V}}else if(A===i&&O===4){const B=n.fromBytes(H.subarray(0,n.BYTES)),z=n.fromBytes(H.subarray(n.BYTES,2*n.BYTES));return{x:B,y:z}}else throw new Error(`Point of length ${A} was invalid. Expected ${o} compressed bytes or ${i} uncompressed bytes`)}}),h=x=>ce(jt(x,t.nByteLength));function p(x){const A=r>>wt;return x>A}function d(x){return p(x)?c(-x):x}const b=(x,A,O)=>gt(x.slice(A,O));class w{constructor(A,O,H){this.r=A,this.s=O,this.recovery=H,this.assertValidity()}static fromCompact(A){const O=t.nByteLength;return A=at("compactSignature",A,O*2),new w(b(A,0,O),b(A,O,2*O))}static fromDER(A){const{r:O,s:H}=Xt.toSig(at("DER",A));return new w(O,H)}assertValidity(){if(!g(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!g(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(A){return new w(this.r,this.s,A)}recoverPublicKey(A){const{r:O,s:H,recovery:B}=this,z=_(at("msgHash",A));if(B==null||![0,1,2,3].includes(B))throw new Error("recovery id invalid");const V=B===2||B===3?O+t.n:O;if(V>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const K=B&1?"03":"02",Q=l.fromHex(K+h(V)),J=a(V),rt=c(-z*J),ft=c(H*J),et=l.BASE.multiplyAndAddUnsafe(Q,rt,ft);if(!et)throw new Error("point at infinify");return et.assertValidity(),et}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new w(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return ae(this.toDERHex())}toDERHex(){return Xt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return ae(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const y={isValidPrivateKey(x){try{return f(x),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const x=_r(t.n);return Mi(t.randomBytes(x),t.n)},precompute(x=8,A=l.BASE){return A._setWindowSize(x),A.multiply(BigInt(3)),A}};function k(x,A=!0){return l.fromPrivateKey(x).toRawBytes(A)}function P(x){const A=x instanceof Uint8Array,O=typeof x=="string",H=(A||O)&&x.length;return A?H===o||H===i:O?H===2*o||H===2*i:x instanceof l}function N(x,A,O=!0){if(P(x))throw new Error("first arg must be private key");if(!P(A))throw new Error("second arg must be public key");return l.fromHex(A).multiply(f(x)).toRawBytes(O)}const E=t.bits2int||function(x){const A=gt(x),O=x.length*8-t.nBitLength;return O>0?A>>BigInt(O):A},_=t.bits2int_modN||function(x){return c(E(x))},m=pn(t.nBitLength);function T(x){if(typeof x!="bigint")throw new Error("bigint expected");if(!(It<=x&&x<m))throw new Error(`bigint expected < 2^${t.nBitLength}`);return jt(x,t.nByteLength)}function U(x,A,O=R){if(["recovered","canonical"].some(ct=>ct in O))throw new Error("sign() legacy options not supported");const{hash:H,randomBytes:B}=t;let{lowS:z,prehash:V,extraEntropy:K}=O;z==null&&(z=!0),x=at("msgHash",x),V&&(x=at("prehashed msgHash",H(x)));const Q=_(x),J=f(A),rt=[T(J),T(Q)];if(K!=null){const ct=K===!0?B(n.BYTES):K;rt.push(at("extraEntropy",ct))}const ft=Jt(...rt),et=Q;function lt(ct){const Ut=E(ct);if(!g(Ut))return;const Be=a(Ut),Ft=l.BASE.multiply(Ut).toAffine(),bt=c(Ft.x);if(bt===It)return;const xt=c(Be*c(et+bt*J));if(xt===It)return;let Gt=(Ft.x===bt?0:2)|Number(Ft.y&wt),ne=xt;return z&&p(xt)&&(ne=d(xt),Gt^=1),new w(bt,ne,Gt)}return{seed:ft,k2sig:lt}}const R={lowS:t.lowS,prehash:!1},D={lowS:t.lowS,prehash:!1};function q(x,A,O=R){const{seed:H,k2sig:B}=U(x,A,O),z=t;return yr(z.hash.outputLen,z.nByteLength,z.hmac)(H,B)}l.BASE._setWindowSize(8);function W(x,A,O,H=D){var Ft;const B=x;if(A=at("msgHash",A),O=at("publicKey",O),"strict"in H)throw new Error("options.strict was renamed to lowS");const{lowS:z,prehash:V}=H;let K,Q;try{if(typeof B=="string"||B instanceof Uint8Array)try{K=w.fromDER(B)}catch(bt){if(!(bt instanceof Xt.Err))throw bt;K=w.fromCompact(B)}else if(typeof B=="object"&&typeof B.r=="bigint"&&typeof B.s=="bigint"){const{r:bt,s:xt}=B;K=new w(bt,xt)}else throw new Error("PARSE");Q=l.fromHex(O)}catch(bt){if(bt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(z&&K.hasHighS())return!1;V&&(A=t.hash(A));const{r:J,s:rt}=K,ft=_(A),et=a(rt),lt=c(ft*et),ct=c(J*et),Ut=(Ft=l.BASE.multiplyAndAddUnsafe(Q,lt,ct))==null?void 0:Ft.toAffine();return Ut?c(Ut.x)===J:!1}return{CURVE:t,getPublicKey:k,getSharedSecret:N,sign:q,verify:W,ProjectivePoint:l,Signature:w,utils:y}}let Ar=class extends hr{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,ai(t);const r=fn(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 o=this.blockLen,i=new Uint8Array(o);i.set(r.length>o?t.create().update(r).digest():r);for(let s=0;s<i.length;s++)i[s]^=54;this.iHash.update(i),this.oHash=t.create();for(let s=0;s<i.length;s++)i[s]^=106;this.oHash.update(i),i.fill(0)}update(t){return Ue(this),this.iHash.update(t),this}digestInto(t){Ue(this),fr(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:i,blockLen:s,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=i,t.blockLen=s,t.outputLen=c,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const Br=(e,t,n)=>new Ar(e,t).update(n).digest();Br.create=(e,t)=>new Ar(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Fi(e){return{hash:e,hmac:(t,...n)=>Br(e,t,fi(...n)),randomBytes:gr}}function Gi(e,t){const n=r=>Vi({...e,...Fi(r)});return Object.freeze({...n(t),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Re=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),He=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Ir=BigInt(1),Me=BigInt(2),Tr=(e,t)=>(e+t/Me)/t;function Or(e){const t=Re,n=BigInt(3),r=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),c=BigInt(44),a=BigInt(88),l=e*e*e%t,f=l*l*e%t,u=pt(f,n,t)*f%t,g=pt(u,n,t)*f%t,h=pt(g,Me,t)*l%t,p=pt(h,o,t)*h%t,d=pt(p,i,t)*p%t,b=pt(d,c,t)*d%t,w=pt(b,a,t)*b%t,y=pt(w,c,t)*d%t,k=pt(y,n,t)*f%t,P=pt(k,s,t)*p%t,N=pt(P,r,t)*l%t,E=pt(N,Me,t);if(!vn.eql(vn.sqr(E),e))throw new Error("Cannot find square root");return E}const vn=Hi(Re,void 0,void 0,{sqrt:Or}),ve=Gi({a:BigInt(0),b:BigInt(7),Fp:vn,n:He,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=He,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Ir*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,s=BigInt("0x100000000000000000000000000000000"),c=Tr(i*e,t),a=Tr(-r*e,t);let l=it(e-c*n-a*o,t),f=it(-c*r-a*i,t);const u=l>s,g=f>s;if(u&&(l=t-l),g&&(f=t-f),l>s||f>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:u,k1:l,k2neg:g,k2:f}}}},dn),je=BigInt(0),Lr=e=>typeof e=="bigint"&&je<e&&e<Re,Yi=e=>typeof e=="bigint"&&je<e&&e<He,Nr={};function $e(e,...t){let n=Nr[e];if(n===void 0){const r=dn(Uint8Array.from(e,o=>o.charCodeAt(0)));n=Jt(r,r),Nr[e]=n}return dn(Jt(n,...t))}const En=e=>e.toRawBytes(!0).slice(1),_n=e=>jt(e,32),kn=e=>it(e,Re),Ee=e=>it(e,He),Sn=ve.ProjectivePoint,Zi=(e,t,n)=>Sn.BASE.multiplyAndAddUnsafe(e,t,n);function An(e){let t=ve.utils.normPrivateKeyToScalar(e),n=Sn.fromPrivateKey(t);return{scalar:n.hasEvenY()?t:Ee(-t),bytes:En(n)}}function Ur(e){if(!Lr(e))throw new Error("bad x: need 0 < x < p");const t=kn(e*e),n=kn(t*e+BigInt(7));let r=Or(n);r%Me!==je&&(r=kn(-r));const o=new Sn(e,r,Ir);return o.assertValidity(),o}function Pr(...e){return Ee(gt($e("BIP0340/challenge",...e)))}function Ji(e){return An(e).bytes}function Qi(e,t,n=gr(32)){const r=at("message",e),{bytes:o,scalar:i}=An(t),s=at("auxRand",n,32),c=_n(i^gt($e("BIP0340/aux",s))),a=$e("BIP0340/nonce",c,o,r),l=Ee(gt(a));if(l===je)throw new Error("sign failed: k is zero");const{bytes:f,scalar:u}=An(l),g=Pr(f,o,r),h=new Uint8Array(64);if(h.set(f,0),h.set(_n(Ee(u+g*i)),32),!Cr(h,r,o))throw new Error("sign: Invalid signature produced");return h}function Cr(e,t,n){const r=at("signature",e,64),o=at("message",t),i=at("publicKey",n,32);try{const s=Ur(gt(i)),c=gt(r.subarray(0,32));if(!Lr(c))return!1;const a=gt(r.subarray(32,64));if(!Yi(a))return!1;const l=Pr(_n(c),En(s),o),f=Zi(s,a,Ee(-l));return!(!f||!f.hasEvenY()||f.toAffine().x!==c)}catch{return!1}}const ut={getPublicKey:Ji,sign:Qi,verify:Cr,utils:{randomPrivateKey:ve.utils.randomPrivateKey,lift_x:Ur,pointToBytes:En,numberToBytesBE:jt,bytesToNumberBE:gt,taggedHash:$e,mod:it}};function Bn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function Xi(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}function Rr(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");Bn(e.outputLen),Bn(e.blockLen)}function es(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 ns(e,t){Rr(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const St={number:Bn,bool:Xi,bytes:Rr,hash:ts,exists:es,output:ns};function rs(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),i=BigInt(4294967295),s=Number(n>>o&i),c=Number(n&i),a=r?4:0,l=r?0:4;e.setUint32(t+a,s,r),e.setUint32(t+l,c,r)}class os extends ar{constructor(t,n,r,o){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=cn(this.buffer)}update(t){St.exists(this);const{view:n,buffer:r,blockLen:o}=this;t=me(t);const i=t.length;for(let s=0;s<i;){const c=Math.min(o-this.pos,i-s);if(c===o){const a=cn(t);for(;o<=i-s;s+=o)this.process(a,s);continue}r.set(t.subarray(s,s+c),this.pos),this.pos+=c,s+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){St.exists(this),St.output(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:i}=this;let{pos:s}=this;n[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>o-s&&(this.process(r,0),s=0);for(let u=s;u<o;u++)n[u]=0;rs(r,o-8,BigInt(this.length*8),i),this.process(r,0);const c=cn(t),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=a/4,f=this.get();if(l>f.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)c.setUint32(4*u,f[u],i)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:i,destroyed:s,pos:c}=this;return t.length=o,t.pos=c,t.finished=i,t.destroyed=s,o%n&&t.buffer.set(r),t}}const is=(e,t,n)=>e&t^~e&n,ss=(e,t,n)=>e&t^e&n^t&n,cs=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]),$t=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),qt=new Uint32Array(64);class Hr extends os{constructor(){super(64,32,8,!1),this.A=$t[0]|0,this.B=$t[1]|0,this.C=$t[2]|0,this.D=$t[3]|0,this.E=$t[4]|0,this.F=$t[5]|0,this.G=$t[6]|0,this.H=$t[7]|0}get(){const{A:t,B:n,C:r,D:o,E:i,F:s,G:c,H:a}=this;return[t,n,r,o,i,s,c,a]}set(t,n,r,o,i,s,c,a){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=i|0,this.F=s|0,this.G=c|0,this.H=a|0}process(t,n){for(let u=0;u<16;u++,n+=4)qt[u]=t.getUint32(n,!1);for(let u=16;u<64;u++){const g=qt[u-15],h=qt[u-2],p=_t(g,7)^_t(g,18)^g>>>3,d=_t(h,17)^_t(h,19)^h>>>10;qt[u]=d+qt[u-7]+p+qt[u-16]|0}let{A:r,B:o,C:i,D:s,E:c,F:a,G:l,H:f}=this;for(let u=0;u<64;u++){const g=_t(c,6)^_t(c,11)^_t(c,25),h=f+g+is(c,a,l)+cs[u]+qt[u]|0,d=(_t(r,2)^_t(r,13)^_t(r,22))+ss(r,o,i)|0;f=l,l=a,a=c,c=s+h|0,s=i,i=o,o=r,r=h+d|0}r=r+this.A|0,o=o+this.B|0,i=i+this.C|0,s=s+this.D|0,c=c+this.E|0,a=a+this.F|0,l=l+this.G|0,f=f+this.H|0,this.set(r,o,i,s,c,a,l,f)}roundClean(){qt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class as extends Hr{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 le=lr(()=>new Hr);lr(()=>new as);var ue=Symbol("verified"),ls=e=>e instanceof Object;function us(e){if(!ls(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;t<e.tags.length;t++){let n=e.tags[t];if(!Array.isArray(n))return!1;for(let r=0;r<n.length;r++)if(typeof n[r]=="object")return!1}return!0}new TextDecoder("utf-8");var fs=new TextEncoder,ds=class{generateSecretKey(){return ut.utils.randomPrivateKey()}getPublicKey(t){return ht(ut.getPublicKey(t))}finalizeEvent(t,n){const r=t;return r.pubkey=ht(ut.getPublicKey(n)),r.id=In(r),r.sig=ht(ut.sign(In(r),n)),r[ue]=!0,r}verifyEvent(t){if(typeof t[ue]=="boolean")return t[ue];const n=In(t);if(n!==t.id)return t[ue]=!1,!1;try{const r=ut.verify(t.sig,n,t.pubkey);return t[ue]=r,r}catch{return t[ue]=!1,!1}}};function hs(e){if(!us(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 In(e){let t=le(fs.encode(hs(e)));return ht(t)}var qe=new ds,gs=qe.generateSecretKey,Mr=qe.getPublicKey;qe.finalizeEvent,qe.verifyEvent;var te=Symbol("verified"),bs=e=>e instanceof Object;function ps(e){if(!bs(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;t<e.tags.length;t++){let n=e.tags[t];if(!Array.isArray(n))return!1;for(let r=0;r<n.length;r++)if(typeof n[r]=="object")return!1}return!0}new TextDecoder("utf-8");var ws=new TextEncoder;function _e(e){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()}var ys=class{constructor(t){v(this,"value");v(this,"next",null);v(this,"prev",null);this.value=t}},ms=class{constructor(){v(this,"first");v(this,"last");this.first=null,this.last=null}enqueue(t){const n=new ys(t);return this.last?this.last===this.first?(this.last=n,this.last.prev=this.first,this.first.next=n):(n.prev=this.last,this.last.next=n,this.last=n):(this.first=n,this.last=n),!0}dequeue(){if(!this.first)return null;if(this.first===this.last){const n=this.first;return this.first=null,this.last=null,n.value}const t=this.first;return this.first=t.next,t.value}},xs=class{generateSecretKey(){return ut.utils.randomPrivateKey()}getPublicKey(t){return ht(ut.getPublicKey(t))}finalizeEvent(t,n){const r=t;return r.pubkey=ht(ut.getPublicKey(n)),r.id=Tn(r),r.sig=ht(ut.sign(Tn(r),n)),r[te]=!0,r}verifyEvent(t){if(typeof t[te]=="boolean")return t[te];const n=Tn(t);if(n!==t.id)return t[te]=!1,!1;try{const r=ut.verify(t.sig,n,t.pubkey);return t[te]=r,r}catch{return t[te]=!1,!1}}};function vs(e){if(!ps(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 Tn(e){let t=le(ws.encode(vs(e)));return ht(t)}var ze=new xs;ze.generateSecretKey,ze.getPublicKey,ze.finalizeEvent;var Es=ze.verifyEvent,_s=22242;function ks(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),o=e[`#${r}`];if(o&&!t.tags.find(([i,s])=>i===n.slice(1)&&o.indexOf(s)!==-1))return!1}return!(e.since&&t.created_at<e.since||e.until&&t.created_at>e.until)}function Ss(e,t){for(let n=0;n<e.length;n++)if(ks(e[n],t))return!0;return!1}function As(e,t){let n=t.length+3,r=e.indexOf(`"${t}":`)+n,o=e.slice(r).indexOf('"')+r+1;return e.slice(o,o+64)}function Bs(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,o=e.slice(r+1,80).indexOf('"');if(o===-1)return null;let i=r+1+o;return e.slice(r+1,i)}function Is(e,t){return{kind:_s,created_at:Math.floor(Date.now()/1e3),tags:[["relay",e],["challenge",t]],content:""}}async function Ts(){return new Promise(e=>{const t=new MessageChannel,n=()=>{t.port1.removeEventListener("message",n),e()};t.port1.addEventListener("message",n),t.port2.postMessage(0),t.port1.start()})}var Os=e=>(e[te]=!0,!0),jr=class{constructor(t,n){v(this,"url");v(this,"_connected",!1);v(this,"onclose",null);v(this,"onnotice",t=>console.debug(`NOTICE from ${this.url}: ${t}`));v(this,"_onauth",null);v(this,"baseEoseTimeout",4400);v(this,"connectionTimeout",4400);v(this,"publishTimeout",4400);v(this,"openSubs",new Map);v(this,"connectionTimeoutHandle");v(this,"connectionPromise");v(this,"openCountRequests",new Map);v(this,"openEventPublishes",new Map);v(this,"ws");v(this,"incomingMessageQueue",new ms);v(this,"queueRunning",!1);v(this,"challenge");v(this,"serial",0);v(this,"verifyEvent");v(this,"_WebSocket");this.url=_e(t),this.verifyEvent=n.verifyEvent,this._WebSocket=n.websocketImplementation||WebSocket}static async connect(t,n){const r=new jr(t,n);return await r.connect(),r}closeAllSubscriptions(t){for(let[n,r]of this.openSubs)r.close(t);this.openSubs.clear();for(let[n,r]of this.openEventPublishes)r.reject(new Error(t));this.openEventPublishes.clear();for(let[n,r]of this.openCountRequests)r.reject(new Error(t));this.openCountRequests.clear()}get connected(){return this._connected}async connect(){return this.connectionPromise?this.connectionPromise:(this.challenge=void 0,this.connectionPromise=new Promise((t,n)=>{this.connectionTimeoutHandle=setTimeout(()=>{var r;n("connection timed out"),this.connectionPromise=void 0,(r=this.onclose)==null||r.call(this),this.closeAllSubscriptions("relay connection timed out")},this.connectionTimeout);try{this.ws=new this._WebSocket(this.url)}catch(r){n(r);return}this.ws.onopen=()=>{clearTimeout(this.connectionTimeoutHandle),this._connected=!0,t()},this.ws.onerror=r=>{var o;n(r.message||"websocket error"),this._connected&&(this._connected=!1,this.connectionPromise=void 0,(o=this.onclose)==null||o.call(this),this.closeAllSubscriptions("relay connection errored"))},this.ws.onclose=async()=>{var r;this._connected&&(this._connected=!1,this.connectionPromise=void 0,(r=this.onclose)==null||r.call(this),this.closeAllSubscriptions("relay connection closed"))},this.ws.onmessage=this._onmessage.bind(this)}),this.connectionPromise)}async runQueue(){for(this.queueRunning=!0;this.handleNext()!==!1;)await Ts();this.queueRunning=!1}handleNext(){var r,o,i;const t=this.incomingMessageQueue.dequeue();if(!t)return!1;const n=Bs(t);if(n){const s=this.openSubs.get(n);if(!s)return;const c=As(t,"id"),a=(r=s.alreadyHaveEvent)==null?void 0:r.call(s,c);if((o=s.receivedEvent)==null||o.call(s,this,c),a)return}try{let s=JSON.parse(t);switch(s[0]){case"EVENT":{const c=this.openSubs.get(s[1]),a=s[2];this.verifyEvent(a)&&Ss(c.filters,a)&&c.onevent(a);return}case"COUNT":{const c=s[1],a=s[2],l=this.openCountRequests.get(c);l&&(l.resolve(a.count),this.openCountRequests.delete(c));return}case"EOSE":{const c=this.openSubs.get(s[1]);if(!c)return;c.receivedEose();return}case"OK":{const c=s[1],a=s[2],l=s[3],f=this.openEventPublishes.get(c);f&&(clearTimeout(f.timeout),a?f.resolve(l):f.reject(new Error(l)),this.openEventPublishes.delete(c));return}case"CLOSED":{const c=s[1],a=this.openSubs.get(c);if(!a)return;a.closed=!0,a.close(s[2]);return}case"NOTICE":this.onnotice(s[1]);return;case"AUTH":{this.challenge=s[1],(i=this._onauth)==null||i.call(this,s[1]);return}}}catch{return}}async send(t){if(!this.connectionPromise)throw new Error("sending on closed connection");this.connectionPromise.then(()=>{var n;(n=this.ws)==null||n.send(t)})}async auth(t){if(!this.challenge)throw new Error("can't perform auth, no challenge was received");const n=await t(Is(this.url,this.challenge)),r=new Promise((o,i)=>{const s=setTimeout(()=>{const c=this.openEventPublishes.get(n.id);c&&(c.reject(new Error("auth timed out")),this.openEventPublishes.delete(n.id))},this.publishTimeout);this.openEventPublishes.set(n.id,{resolve:o,reject:i,timeout:s})});return this.send('["AUTH",'+JSON.stringify(n)+"]"),r}async publish(t){const n=new Promise((r,o)=>{const i=setTimeout(()=>{const s=this.openEventPublishes.get(t.id);s&&(s.reject(new Error("publish timed out")),this.openEventPublishes.delete(t.id))},this.publishTimeout);this.openEventPublishes.set(t.id,{resolve:r,reject:o,timeout:i})});return this.send('["EVENT",'+JSON.stringify(t)+"]"),n}async count(t,n){this.serial++;const r=(n==null?void 0:n.id)||"count:"+this.serial,o=new Promise((i,s)=>{this.openCountRequests.set(r,{resolve:i,reject:s})});return this.send('["COUNT","'+r+'",'+JSON.stringify(t).substring(1)),o}subscribe(t,n){const r=this.prepareSubscription(t,n);return r.fire(),r}prepareSubscription(t,n){this.serial++;const r=n.id||(n.label?n.label+":":"sub:")+this.serial,o=new Ls(this,r,t,n);return this.openSubs.set(r,o),o}close(){var t;this.closeAllSubscriptions("relay connection closed by us"),this._connected=!1,(t=this.ws)==null||t.close()}_onmessage(t){this.incomingMessageQueue.enqueue(t.data),this.queueRunning||this.runQueue()}},Ls=class{constructor(t,n,r,o){v(this,"relay");v(this,"id");v(this,"closed",!1);v(this,"eosed",!1);v(this,"filters");v(this,"alreadyHaveEvent");v(this,"receivedEvent");v(this,"onevent");v(this,"oneose");v(this,"onclose");v(this,"eoseTimeout");v(this,"eoseTimeoutHandle");this.relay=t,this.filters=r,this.id=n,this.alreadyHaveEvent=o.alreadyHaveEvent,this.receivedEvent=o.receivedEvent,this.eoseTimeout=o.eoseTimeout||t.baseEoseTimeout,this.oneose=o.oneose,this.onclose=o.onclose,this.onevent=o.onevent||(i=>{console.warn(`onevent() callback not defined for subscription '${this.id}' in relay ${this.relay.url}. event received:`,i)})}fire(){this.relay.send('["REQ","'+this.id+'",'+JSON.stringify(this.filters).substring(1)),this.eoseTimeoutHandle=setTimeout(this.receivedEose.bind(this),this.eoseTimeout)}receivedEose(){var t;this.eosed||(clearTimeout(this.eoseTimeoutHandle),this.eosed=!0,(t=this.oneose)==null||t.call(this))}close(t="closed by caller"){var n;!this.closed&&this.relay.connected&&(this.relay.send('["CLOSE",'+JSON.stringify(this.id)+"]"),this.closed=!0),this.relay.openSubs.delete(this.id),(n=this.onclose)==null||n.call(this,t)}},Ns=class{constructor(t){v(this,"relays",new Map);v(this,"seenOn",new Map);v(this,"trackRelays",!1);v(this,"verifyEvent");v(this,"trustedRelayURLs",new Set);v(this,"_WebSocket");this.verifyEvent=t.verifyEvent,this._WebSocket=t.websocketImplementation}async ensureRelay(t,n){t=_e(t);let r=this.relays.get(t);return r||(r=new jr(t,{verifyEvent:this.trustedRelayURLs.has(t)?Os:this.verifyEvent,websocketImplementation:this._WebSocket}),n!=null&&n.connectionTimeout&&(r.connectionTimeout=n.connectionTimeout),this.relays.set(t,r)),await r.connect(),r}close(t){t.map(_e).forEach(n=>{var r;(r=this.relays.get(n))==null||r.close()})}subscribeMany(t,n,r){return this.subscribeManyMap(Object.fromEntries(t.map(o=>[o,n])),r)}subscribeManyMap(t,n){this.trackRelays&&(n.receivedEvent=(g,h)=>{let p=this.seenOn.get(h);p||(p=new Set,this.seenOn.set(h,p)),p.add(g)});const r=new Set,o=[],i=Object.keys(t).length,s=[];let c=g=>{var h;s[g]||(s[g]=!0,s.filter(p=>p).length===i&&((h=n.oneose)==null||h.call(n),c=()=>{}))};const a=[];let l=(g,h)=>{var p;a[g]||(c(g),a[g]=h,a.filter(d=>d).length===i&&((p=n.onclose)==null||p.call(n,a),l=()=>{}))};const f=g=>{var p;if((p=n.alreadyHaveEvent)!=null&&p.call(n,g))return!0;const h=r.has(g);return r.add(g),h},u=Promise.all(Object.entries(t).map(async(g,h,p)=>{if(p.indexOf(g)!==h){l(h,"duplicate url");return}let[d,b]=g;d=_e(d);let w;try{w=await this.ensureRelay(d,{connectionTimeout:n.maxWait?Math.max(n.maxWait*.8,n.maxWait-1e3):void 0})}catch(k){l(h,(k==null?void 0:k.message)||String(k));return}let y=w.subscribe(b,{...n,oneose:()=>c(h),onclose:k=>l(h,k),alreadyHaveEvent:f,eoseTimeout:n.maxWait});o.push(y)}));return{async close(){await u,o.forEach(g=>{g.close()})}}}subscribeManyEose(t,n,r){const o=this.subscribeMany(t,n,{...r,oneose(){o.close()}});return o}async querySync(t,n,r){return new Promise(async o=>{const i=[];this.subscribeManyEose(t,[n],{...r,onevent(s){i.push(s)},onclose(s){o(i)}})})}async get(t,n,r){n.limit=1;const o=await this.querySync(t,n,r);return o.sort((i,s)=>s.created_at-i.created_at),o[0]||null}publish(t,n){return t.map(_e).map(async(r,o,i)=>{if(i.indexOf(r)!==o)return Promise.reject("duplicate url");let s=await this.ensureRelay(r);return s.publish(n).then(c=>{if(this.trackRelays){let a=this.seenOn.get(n.id);a||(a=new Set,this.seenOn.set(n.id,a)),a.add(s)}return c})})}listConnectionStatus(){const t=new Map;return this.relays.forEach((n,r)=>t.set(r,n.connected)),t}destroy(){this.relays.forEach(t=>t.close()),this.relays=new Map}},$r;try{$r=WebSocket}catch{}var Us=class extends Ns{constructor(){super({verifyEvent:Es,websocketImplementation:$r})}};function On(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function qr(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function zr(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function yt(e,...t){if(!zr(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function fe(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 Ln(e,t){yt(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */const tt=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),Ps=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");function Nn(e){if(typeof e!="string")throw new Error(`string expected, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function zt(e){if(typeof e=="string")e=Nn(e);else if(zr(e))e=e.slice();else throw new Error(`Uint8Array expected, got ${typeof e}`);return e}function Cs(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function Rs(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}const Hs=(e,t)=>(Object.assign(t,e),t),Tt=16,Un=new Uint8Array(16),At=tt(Un),Ms=225,js=(e,t,n,r)=>{const o=r&1;return{s3:n<<31|r>>>1,s2:t<<31|n>>>1,s1:e<<31|t>>>1,s0:e>>>1^Ms<<24&-(o&1)}},mt=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255|0;function $s(e){e.reverse();const t=e[15]&1;let n=0;for(let r=0;r<e.length;r++){const o=e[r];e[r]=o>>>1|n,n=(o&1)<<7}return e[0]^=-t&225,e}const qs=e=>e>64*1024?8:e>1024?4:2;class Kr{constructor(t,n){this.blockLen=Tt,this.outputLen=Tt,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,t=zt(t),yt(t,16);const r=Ps(t);let o=r.getUint32(0,!1),i=r.getUint32(4,!1),s=r.getUint32(8,!1),c=r.getUint32(12,!1);const a=[];for(let p=0;p<128;p++)a.push({s0:mt(o),s1:mt(i),s2:mt(s),s3:mt(c)}),{s0:o,s1:i,s2:s,s3:c}=js(o,i,s,c);const l=qs(n||1024);if(![1,2,4,8].includes(l))throw new Error(`ghash: wrong window size=${l}, should be 2, 4 or 8`);this.W=l;const u=128/l,g=this.windowSize=2**l,h=[];for(let p=0;p<u;p++)for(let d=0;d<g;d++){let b=0,w=0,y=0,k=0;for(let P=0;P<l;P++){if(!(d>>>l-P-1&1))continue;const{s0:E,s1:_,s2:m,s3:T}=a[l*p+P];b^=E,w^=_,y^=m,k^=T}h.push({s0:b,s1:w,s2:y,s3:k})}this.t=h}_updateBlock(t,n,r,o){t^=this.s0,n^=this.s1,r^=this.s2,o^=this.s3;const{W:i,t:s,windowSize:c}=this;let a=0,l=0,f=0,u=0;const g=(1<<i)-1;let h=0;for(const p of[t,n,r,o])for(let d=0;d<4;d++){const b=p>>>8*d&255;for(let w=8/i-1;w>=0;w--){const y=b>>>i*w&g,{s0:k,s1:P,s2:N,s3:E}=s[h*c+y];a^=k,l^=P,f^=N,u^=E,h+=1}}this.s0=a,this.s1=l,this.s2=f,this.s3=u}update(t){t=zt(t),fe(this);const n=tt(t),r=Math.floor(t.length/Tt),o=t.length%Tt;for(let i=0;i<r;i++)this._updateBlock(n[i*4+0],n[i*4+1],n[i*4+2],n[i*4+3]);return o&&(Un.set(t.subarray(r*Tt)),this._updateBlock(At[0],At[1],At[2],At[3]),At.fill(0)),this}destroy(){const{t}=this;for(const n of t)n.s0=0,n.s1=0,n.s2=0,n.s3=0}digestInto(t){fe(this),Ln(t,this),this.finished=!0;const{s0:n,s1:r,s2:o,s3:i}=this,s=tt(t);return s[0]=n,s[1]=r,s[2]=o,s[3]=i,t}digest(){const t=new Uint8Array(Tt);return this.digestInto(t),this.destroy(),t}}class zs extends Kr{constructor(t,n){t=zt(t);const r=$s(t.slice());super(r,n),r.fill(0)}update(t){t=zt(t),fe(this);const n=tt(t),r=t.length%Tt,o=Math.floor(t.length/Tt);for(let i=0;i<o;i++)this._updateBlock(mt(n[i*4+3]),mt(n[i*4+2]),mt(n[i*4+1]),mt(n[i*4+0]));return r&&(Un.set(t.subarray(o*Tt)),this._updateBlock(mt(At[3]),mt(At[2]),mt(At[1]),mt(At[0])),At.fill(0)),this}digestInto(t){fe(this),Ln(t,this),this.finished=!0;const{s0:n,s1:r,s2:o,s3:i}=this,s=tt(t);return s[0]=n,s[1]=r,s[2]=o,s[3]=i,t.reverse()}}function Wr(e){const t=(r,o)=>e(o,r.length).update(zt(r)).digest(),n=e(new Uint8Array(16),0);return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=(r,o)=>e(r,o),t}Wr((e,t)=>new Kr(e,t)),Wr((e,t)=>new zs(e,t));const Kt=16,Ks=283;function Pn(e){return e<<1^Ks&-(e>>7)}function de(e,t){let n=0;for(;t>0;t>>=1)n^=e&-(t&1),e=Pn(e);return n}const Cn=(()=>{let e=new Uint8Array(256);for(let n=0,r=1;n<256;n++,r^=Pn(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})(),Ws=Cn.map((e,t)=>Cn.indexOf(t)),Ds=e=>e<<24|e>>>8,Rn=e=>e<<8|e>>>24;function Dr(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(Rn),o=r.map(Rn),i=o.map(Rn),s=new Uint32Array(256*256),c=new Uint32Array(256*256),a=new Uint16Array(256*256);for(let l=0;l<256;l++)for(let f=0;f<256;f++){const u=l*256+f;s[u]=n[l]^r[f],c[u]=o[l]^i[f],a[u]=e[l]<<8|e[f]}return{sbox:e,sbox2:a,T0:n,T1:r,T2:o,T3:i,T01:s,T23:c}}const Hn=Dr(Cn,e=>de(e,3)<<24|e<<16|e<<8|de(e,2)),Vr=Dr(Ws,e=>de(e,11)<<24|de(e,13)<<16|de(e,9)<<8|de(e,14)),Vs=(()=>{const e=new Uint8Array(16);for(let t=0,n=1;t<16;t++,n=Pn(n))e[t]=n;return e})();function Fr(e){yt(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}=Hn,r=tt(e),o=r.length,i=c=>Bt(n,c,c,c,c),s=new Uint32Array(t+28);s.set(r);for(let c=o;c<s.length;c++){let a=s[c-1];c%o===0?a=i(Ds(a))^Vs[c/o-1]:o>6&&c%o===4&&(a=i(a)),s[c]=s[c-o]^a}return s}function Fs(e){const t=Fr(e),n=t.slice(),r=t.length,{sbox2:o}=Hn,{T0:i,T1:s,T2:c,T3:a}=Vr;for(let l=0;l<r;l+=4)for(let f=0;f<4;f++)n[l+f]=t[r-l-4+f];t.fill(0);for(let l=4;l<r-4;l++){const f=n[l],u=Bt(o,f,f,f,f);n[l]=i[u&255]^s[u>>>8&255]^c[u>>>16&255]^a[u>>>24]}return n}function Wt(e,t,n,r,o,i){return e[n<<8&65280|r>>>8&255]^t[o>>>8&65280|i>>>24&255]}function Bt(e,t,n,r,o){return e[t&255|n&65280]|e[r>>>16&255|o>>>16&65280]<<16}function Gr(e,t,n,r,o){const{sbox2:i,T01:s,T23:c}=Hn;let a=0;t^=e[a++],n^=e[a++],r^=e[a++],o^=e[a++];const l=e.length/4-2;for(let p=0;p<l;p++){const d=e[a++]^Wt(s,c,t,n,r,o),b=e[a++]^Wt(s,c,n,r,o,t),w=e[a++]^Wt(s,c,r,o,t,n),y=e[a++]^Wt(s,c,o,t,n,r);t=d,n=b,r=w,o=y}const f=e[a++]^Bt(i,t,n,r,o),u=e[a++]^Bt(i,n,r,o,t),g=e[a++]^Bt(i,r,o,t,n),h=e[a++]^Bt(i,o,t,n,r);return{s0:f,s1:u,s2:g,s3:h}}function Gs(e,t,n,r,o){const{sbox2:i,T01:s,T23:c}=Vr;let a=0;t^=e[a++],n^=e[a++],r^=e[a++],o^=e[a++];const l=e.length/4-2;for(let p=0;p<l;p++){const d=e[a++]^Wt(s,c,t,o,r,n),b=e[a++]^Wt(s,c,n,t,o,r),w=e[a++]^Wt(s,c,r,n,t,o),y=e[a++]^Wt(s,c,o,r,n,t);t=d,n=b,r=w,o=y}const f=e[a++]^Bt(i,t,o,r,n),u=e[a++]^Bt(i,n,t,o,r),g=e[a++]^Bt(i,r,n,t,o),h=e[a++]^Bt(i,o,r,n,t);return{s0:f,s1:u,s2:g,s3:h}}function Yr(e,t){if(!t)return new Uint8Array(e);if(yt(t),t.length<e)throw new Error(`aes: wrong destination length, expected at least ${e}, got: ${t.length}`);return t}function Ys(e){if(yt(e),e.length%Kt!==0)throw new Error(`aes/(cbc-ecb).decrypt ciphertext should consist of blocks with size ${Kt}`)}function Zs(e,t,n){let r=e.length;const o=r%Kt;if(!t&&o!==0)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");const i=tt(e);if(t){let a=Kt-o;a||(a=Kt),r=r+a}const s=Yr(r,n),c=tt(s);return{b:i,o:c,out:s}}function Js(e,t){if(!t)return e;const n=e.length;if(!n)throw new Error("aes/pcks5: empty ciphertext not allowed");const r=e[n-1];if(r<=0||r>16)throw new Error(`aes/pcks5: wrong padding byte: ${r}`);const o=e.subarray(0,-r);for(let i=0;i<r;i++)if(e[n-i-1]!==r)throw new Error("aes/pcks5: wrong padding");return o}function Qs(e){const t=new Uint8Array(16),n=tt(t);t.set(e);const r=Kt-e.length;for(let o=Kt-r;o<Kt;o++)t[o]=r;return n}const Xs=Hs({blockSize:16,nonceLength:16},function(t,n,r={}){yt(t),yt(n,16);const o=!r.disablePadding;return{encrypt:(i,s)=>{const c=Fr(t),{b:a,o:l,out:f}=Zs(i,o,s),u=tt(n);let g=u[0],h=u[1],p=u[2],d=u[3],b=0;for(;b+4<=a.length;)g^=a[b+0],h^=a[b+1],p^=a[b+2],d^=a[b+3],{s0:g,s1:h,s2:p,s3:d}=Gr(c,g,h,p,d),l[b++]=g,l[b++]=h,l[b++]=p,l[b++]=d;if(o){const w=Qs(i.subarray(b*4));g^=w[0],h^=w[1],p^=w[2],d^=w[3],{s0:g,s1:h,s2:p,s3:d}=Gr(c,g,h,p,d),l[b++]=g,l[b++]=h,l[b++]=p,l[b++]=d}return c.fill(0),f},decrypt:(i,s)=>{Ys(i);const c=Fs(t),a=tt(n),l=Yr(i.length,s),f=tt(i),u=tt(l);let g=a[0],h=a[1],p=a[2],d=a[3];for(let b=0;b+4<=f.length;){const w=g,y=h,k=p,P=d;g=f[b+0],h=f[b+1],p=f[b+2],d=f[b+3];const{s0:N,s1:E,s2:_,s3:m}=Gs(c,g,h,p,d);u[b++]=N^w,u[b++]=E^y,u[b++]=_^k,u[b++]=m^P}return c.fill(0),Js(l,o)}}});/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function he(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function Ot(...e){const t=(o,i)=>s=>o(i(s)),n=Array.from(e).reverse().reduce((o,i)=>o?t(o,i.encode):i.encode,void 0),r=e.reduce((o,i)=>o?t(o,i.decode):i.decode,void 0);return{encode:n,decode:r}}function Lt(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(he(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 Nt(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 Ke(e,t="="){if(he(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 o of n)if(typeof o!="string")throw new Error(`padding.decode: non-string input=${o}`);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 Zr(e){if(typeof e!="function")throw new Error("normalize fn should be function");return{encode:t=>t,decode:t=>e(t)}}function Jr(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 o=[],i=Array.from(e);for(i.forEach(s=>{if(he(s),s<0||s>=t)throw new Error(`Wrong integer: ${s}`)});;){let s=0,c=!0;for(let a=r;a<i.length;a++){const l=i[a],f=t*s+l;if(!Number.isSafeInteger(f)||t*s/t!==s||f-l!==t*s)throw new Error("convertRadix: carry overflow");if(s=f%n,i[a]=Math.floor(f/n),!Number.isSafeInteger(i[a])||i[a]*n+s!==f)throw new Error("convertRadix: carry overflow");if(c)i[a]?c=!1:r=a;else continue}if(o.push(s),c)break}for(let s=0;s<e.length-1&&e[s]===0;s++)o.push(0);return o.reverse()}const Qr=(e,t)=>t?Qr(t,e%t):e,We=(e,t)=>e+(t-Qr(e,t));function Mn(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(We(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${We(t,n)}`);let o=0,i=0;const s=2**n-1,c=[];for(const a of e){if(he(a),a>=2**t)throw new Error(`convertRadix2: invalid data word=${a} from=${t}`);if(o=o<<t|a,i+t>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=n;i-=n)c.push((o>>i-n&s)>>>0);o&=2**i-1}if(o=o<<n-i&s,!r&&i>=t)throw new Error("Excess padding");if(!r&&o)throw new Error(`Non-zero padding: ${o}`);return r&&i>0&&c.push(o>>>0),c}function tc(e){return he(e),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return Jr(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(Jr(t,e,2**8))}}}function Dt(e,t=!1){if(he(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(We(8,e)>32||We(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 Mn(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(Mn(n,e,8,t))}}}function Xr(e){if(typeof e!="function")throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch{}}}const ec=Ot(Dt(4),Lt("0123456789ABCDEF"),Nt("")),nc=Ot(Dt(5),Lt("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Ke(5),Nt(""));Ot(Dt(5),Lt("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Ke(5),Nt("")),Ot(Dt(5),Lt("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),Nt(""),Zr(e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")));const ke=Ot(Dt(6),Lt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Ke(6),Nt("")),rc=Ot(Dt(6),Lt("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Ke(6),Nt("")),jn=e=>Ot(tc(58),Lt(e),Nt("")),$n=jn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");jn("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),jn("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const to=[0,2,3,5,6,7,9,10,11],oc={encode(e){let t="";for(let n=0;n<e.length;n+=8){const r=e.subarray(n,n+8);t+=$n.encode(r).padStart(to[r.length],"1")}return t},decode(e){let t=[];for(let n=0;n<e.length;n+=11){const r=e.slice(n,n+11),o=to.indexOf(r.length),i=$n.decode(r);for(let s=0;s<i.length-o;s++)if(i[s]!==0)throw new Error("base58xmr: wrong padding");t=t.concat(Array.from(i.slice(i.length-o)))}return Uint8Array.from(t)}},qn=Ot(Lt("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),Nt("")),eo=[996825010,642813549,513874426,1027748829,705979059];function Se(e){const t=e>>25;let n=(e&33554431)<<5;for(let r=0;r<eo.length;r++)(t>>r&1)===1&&(n^=eo[r]);return n}function no(e,t,n=1){const r=e.length;let o=1;for(let i=0;i<r;i++){const s=e.charCodeAt(i);if(s<33||s>126)throw new Error(`Invalid prefix (${e})`);o=Se(o)^s>>5}o=Se(o);for(let i=0;i<r;i++)o=Se(o)^e.charCodeAt(i)&31;for(let i of t)o=Se(o)^i;for(let i=0;i<6;i++)o=Se(o);return o^=n,qn.encode(Mn([o%2**30],30,5,!1))}function ro(e){const t=e==="bech32"?1:734539939,n=Dt(5),r=n.decode,o=n.encode,i=Xr(r);function s(f,u,g=90){if(typeof f!="string")throw new Error(`bech32.encode prefix should be string, not ${typeof f}`);if(!Array.isArray(u)||u.length&&typeof u[0]!="number")throw new Error(`bech32.encode words should be array of numbers, not ${typeof u}`);const h=f.length+7+u.length;if(g!==!1&&h>g)throw new TypeError(`Length ${h} exceeds limit ${g}`);return f=f.toLowerCase(),`${f}1${qn.encode(u)}${no(f,u,t)}`}function c(f,u=90){if(typeof f!="string")throw new Error(`bech32.decode input should be string, not ${typeof f}`);if(f.length<8||u!==!1&&f.length>u)throw new TypeError(`Wrong string length: ${f.length} (${f}). Expected (8..${u})`);const g=f.toLowerCase();if(f!==g&&f!==f.toUpperCase())throw new Error("String must be lowercase or uppercase");f=g;const h=f.lastIndexOf("1");if(h===0||h===-1)throw new Error('Letter "1" must be present between prefix and data only');const p=f.slice(0,h),d=f.slice(h+1);if(d.length<6)throw new Error("Data must be at least 6 characters long");const b=qn.decode(d).slice(0,-6),w=no(p,b,t);if(!d.endsWith(w))throw new Error(`Invalid checksum in ${f}: expected "${w}"`);return{prefix:p,words:b}}const a=Xr(c);function l(f){const{prefix:u,words:g}=c(f,!1);return{prefix:u,words:g,bytes:r(g)}}return{encode:s,decode:c,decodeToBytes:l,decodeUnsafe:a,fromWords:r,fromWordsUnsafe:i,toWords:o}}const oo=ro("bech32");ro("bech32m");const ic={encode:e=>new TextDecoder().decode(e),decode:e=>new TextEncoder().encode(e)},sc=Ot(Dt(4),Lt("0123456789abcdef"),Nt(""),Zr(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()}));`${Object.keys({utf8:ic,hex:sc,base16:ec,base32:nc,base64:ke,base64url:rc,base58:$n,base58xmr:oc}).join(", ")}`;const st=(e,t)=>e[t++]&255|(e[t++]&255)<<8;class cc{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,t=zt(t),yt(t,32);const n=st(t,0),r=st(t,2),o=st(t,4),i=st(t,6),s=st(t,8),c=st(t,10),a=st(t,12),l=st(t,14);this.r[0]=n&8191,this.r[1]=(n>>>13|r<<3)&8191,this.r[2]=(r>>>10|o<<6)&7939,this.r[3]=(o>>>7|i<<9)&8191,this.r[4]=(i>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|c<<2)&8191,this.r[7]=(c>>>11|a<<5)&8065,this.r[8]=(a>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let f=0;f<8;f++)this.pad[f]=st(t,16+2*f)}process(t,n,r=!1){const o=r?0:2048,{h:i,r:s}=this,c=s[0],a=s[1],l=s[2],f=s[3],u=s[4],g=s[5],h=s[6],p=s[7],d=s[8],b=s[9],w=st(t,n+0),y=st(t,n+2),k=st(t,n+4),P=st(t,n+6),N=st(t,n+8),E=st(t,n+10),_=st(t,n+12),m=st(t,n+14);let T=i[0]+(w&8191),U=i[1]+((w>>>13|y<<3)&8191),R=i[2]+((y>>>10|k<<6)&8191),D=i[3]+((k>>>7|P<<9)&8191),q=i[4]+((P>>>4|N<<12)&8191),W=i[5]+(N>>>1&8191),x=i[6]+((N>>>14|E<<2)&8191),A=i[7]+((E>>>11|_<<5)&8191),O=i[8]+((_>>>8|m<<8)&8191),H=i[9]+(m>>>5|o),B=0,z=B+T*c+U*(5*b)+R*(5*d)+D*(5*p)+q*(5*h);B=z>>>13,z&=8191,z+=W*(5*g)+x*(5*u)+A*(5*f)+O*(5*l)+H*(5*a),B+=z>>>13,z&=8191;let V=B+T*a+U*c+R*(5*b)+D*(5*d)+q*(5*p);B=V>>>13,V&=8191,V+=W*(5*h)+x*(5*g)+A*(5*u)+O*(5*f)+H*(5*l),B+=V>>>13,V&=8191;let K=B+T*l+U*a+R*c+D*(5*b)+q*(5*d);B=K>>>13,K&=8191,K+=W*(5*p)+x*(5*h)+A*(5*g)+O*(5*u)+H*(5*f),B+=K>>>13,K&=8191;let Q=B+T*f+U*l+R*a+D*c+q*(5*b);B=Q>>>13,Q&=8191,Q+=W*(5*d)+x*(5*p)+A*(5*h)+O*(5*g)+H*(5*u),B+=Q>>>13,Q&=8191;let J=B+T*u+U*f+R*l+D*a+q*c;B=J>>>13,J&=8191,J+=W*(5*b)+x*(5*d)+A*(5*p)+O*(5*h)+H*(5*g),B+=J>>>13,J&=8191;let rt=B+T*g+U*u+R*f+D*l+q*a;B=rt>>>13,rt&=8191,rt+=W*c+x*(5*b)+A*(5*d)+O*(5*p)+H*(5*h),B+=rt>>>13,rt&=8191;let ft=B+T*h+U*g+R*u+D*f+q*l;B=ft>>>13,ft&=8191,ft+=W*a+x*c+A*(5*b)+O*(5*d)+H*(5*p),B+=ft>>>13,ft&=8191;let et=B+T*p+U*h+R*g+D*u+q*f;B=et>>>13,et&=8191,et+=W*l+x*a+A*c+O*(5*b)+H*(5*d),B+=et>>>13,et&=8191;let lt=B+T*d+U*p+R*h+D*g+q*u;B=lt>>>13,lt&=8191,lt+=W*f+x*l+A*a+O*c+H*(5*b),B+=lt>>>13,lt&=8191;let ct=B+T*b+U*d+R*p+D*h+q*g;B=ct>>>13,ct&=8191,ct+=W*u+x*f+A*l+O*a+H*c,B+=ct>>>13,ct&=8191,B=(B<<2)+B|0,B=B+z|0,z=B&8191,B=B>>>13,V+=B,i[0]=z,i[1]=V,i[2]=K,i[3]=Q,i[4]=J,i[5]=rt,i[6]=ft,i[7]=et,i[8]=lt,i[9]=ct}finalize(){const{h:t,pad:n}=this,r=new Uint16Array(10);let o=t[1]>>>13;t[1]&=8191;for(let c=2;c<10;c++)t[c]+=o,o=t[c]>>>13,t[c]&=8191;t[0]+=o*5,o=t[0]>>>13,t[0]&=8191,t[1]+=o,o=t[1]>>>13,t[1]&=8191,t[2]+=o,r[0]=t[0]+5,o=r[0]>>>13,r[0]&=8191;for(let c=1;c<10;c++)r[c]=t[c]+o,o=r[c]>>>13,r[c]&=8191;r[9]-=8192;let i=(o^1)-1;for(let c=0;c<10;c++)r[c]&=i;i=~i;for(let c=0;c<10;c++)t[c]=t[c]&i|r[c];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let s=t[0]+n[0];t[0]=s&65535;for(let c=1;c<8;c++)s=(t[c]+n[c]|0)+(s>>>16)|0,t[c]=s&65535}update(t){fe(this);const{buffer:n,blockLen:r}=this;t=zt(t);const o=t.length;for(let i=0;i<o;){const s=Math.min(r-this.pos,o-i);if(s===r){for(;r<=o-i;i+=r)this.process(t,i);continue}n.set(t.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===r&&(this.process(n,0,!1),this.pos=0)}return this}destroy(){this.h.fill(0),this.r.fill(0),this.buffer.fill(0),this.pad.fill(0)}digestInto(t){fe(this),Ln(t,this),this.finished=!0;const{buffer:n,h:r}=this;let{pos:o}=this;if(o){for(n[o++]=1;o<16;o++)n[o]=0;this.process(n,0,!0)}this.finalize();let i=0;for(let s=0;s<8;s++)t[i++]=r[s]>>>0,t[i++]=r[s]>>>8;return t}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}}function ac(e){const t=(r,o)=>e(o).update(zt(r)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}ac(e=>new cc(e));const lc=Nn("expand 16-byte k"),uc=Nn("expand 32-byte k"),fc=tt(lc),dc=tt(uc);function G(e,t){return e<<t|e>>>32-t}function zn(e){return e.byteOffset%4===0}const De=64,hc=16,io=2**32-1,so=new Uint32Array;function gc(e,t,n,r,o,i,s,c){const a=o.length,l=new Uint8Array(De),f=tt(l),u=zn(o)&&zn(i),g=u?tt(o):so,h=u?tt(i):so;for(let p=0;p<a;s++){if(e(t,n,r,f,s,c),s>=io)throw new Error("arx: counter overflow");const d=Math.min(De,a-p);if(u&&d===De){const b=p/4;if(p%4!==0)throw new Error("arx: invalid block position");for(let w=0,y;w<hc;w++)y=b+w,h[y]=g[y]^f[w];p+=De;continue}for(let b=0,w;b<d;b++)w=p+b,i[w]=o[w]^l[b];p+=d}}function bc(e,t){const{allowShortKeys:n,extendNonceFn:r,counterLength:o,counterRight:i,rounds:s}=Cs({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return On(o),On(s),qr(i),qr(n),(c,a,l,f,u=0)=>{yt(c),yt(a),yt(l);const g=l.length;if(f||(f=new Uint8Array(g)),yt(f),On(u),u<0||u>=io)throw new Error("arx: counter overflow");if(f.length<g)throw new Error(`arx: output (${f.length}) is shorter than data (${g})`);const h=[];let p=c.length,d,b;if(p===32)d=c.slice(),h.push(d),b=dc;else if(p===16&&n)d=new Uint8Array(32),d.set(c),d.set(c,16),b=fc,h.push(d);else throw new Error(`arx: invalid 32-byte key, got length=${p}`);zn(a)||(a=a.slice(),h.push(a));const w=tt(d);if(r){if(a.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(b,w,tt(a.subarray(0,16)),w),a=a.subarray(16)}const y=16-o;if(y!==a.length)throw new Error(`arx: nonce must be ${y} or 16 bytes`);if(y!==12){const P=new Uint8Array(12);P.set(a,i?0:12-a.length),a=P,h.push(a)}const k=tt(a);for(gc(e,b,w,k,l,f,u,s);h.length>0;)h.pop().fill(0);return f}}function pc(e,t,n,r,o,i=20){let s=e[0],c=e[1],a=e[2],l=e[3],f=t[0],u=t[1],g=t[2],h=t[3],p=t[4],d=t[5],b=t[6],w=t[7],y=o,k=n[0],P=n[1],N=n[2],E=s,_=c,m=a,T=l,U=f,R=u,D=g,q=h,W=p,x=d,A=b,O=w,H=y,B=k,z=P,V=N;for(let Q=0;Q<i;Q+=2)E=E+U|0,H=G(H^E,16),W=W+H|0,U=G(U^W,12),E=E+U|0,H=G(H^E,8),W=W+H|0,U=G(U^W,7),_=_+R|0,B=G(B^_,16),x=x+B|0,R=G(R^x,12),_=_+R|0,B=G(B^_,8),x=x+B|0,R=G(R^x,7),m=m+D|0,z=G(z^m,16),A=A+z|0,D=G(D^A,12),m=m+D|0,z=G(z^m,8),A=A+z|0,D=G(D^A,7),T=T+q|0,V=G(V^T,16),O=O+V|0,q=G(q^O,12),T=T+q|0,V=G(V^T,8),O=O+V|0,q=G(q^O,7),E=E+R|0,V=G(V^E,16),A=A+V|0,R=G(R^A,12),E=E+R|0,V=G(V^E,8),A=A+V|0,R=G(R^A,7),_=_+D|0,H=G(H^_,16),O=O+H|0,D=G(D^O,12),_=_+D|0,H=G(H^_,8),O=O+H|0,D=G(D^O,7),m=m+q|0,B=G(B^m,16),W=W+B|0,q=G(q^W,12),m=m+q|0,B=G(B^m,8),W=W+B|0,q=G(q^W,7),T=T+U|0,z=G(z^T,16),x=x+z|0,U=G(U^x,12),T=T+U|0,z=G(z^T,8),x=x+z|0,U=G(U^x,7);let K=0;r[K++]=s+E|0,r[K++]=c+_|0,r[K++]=a+m|0,r[K++]=l+T|0,r[K++]=f+U|0,r[K++]=u+R|0,r[K++]=g+D|0,r[K++]=h+q|0,r[K++]=p+W|0,r[K++]=d+x|0,r[K++]=b+A|0,r[K++]=w+O|0,r[K++]=y+H|0,r[K++]=k+B|0,r[K++]=P+z|0,r[K++]=N+V|0}const co=bc(pc,{counterRight:!1,counterLength:4,allowShortKeys:!1});class ao extends ar{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,St.hash(t);const r=me(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 o=this.blockLen,i=new Uint8Array(o);i.set(r.length>o?t.create().update(r).digest():r);for(let s=0;s<i.length;s++)i[s]^=54;this.iHash.update(i),this.oHash=t.create();for(let s=0;s<i.length;s++)i[s]^=106;this.oHash.update(i),i.fill(0)}update(t){return St.exists(this),this.iHash.update(t),this}digestInto(t){St.exists(this),St.bytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:o,destroyed:i,blockLen:s,outputLen:c}=this;return t=t,t.finished=o,t.destroyed=i,t.blockLen=s,t.outputLen=c,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Ve=(e,t,n)=>new ao(e,t).update(n).digest();Ve.create=(e,t)=>new ao(e,t);function wc(e,t,n){return St.hash(e),n===void 0&&(n=new Uint8Array(e.outputLen)),Ve(e,me(n),me(t))}const Kn=new Uint8Array([0]),lo=new Uint8Array;function yc(e,t,n,r=32){if(St.hash(e),St.number(r),r>255*e.outputLen)throw new Error("Length should be <= 255*HashLen");const o=Math.ceil(r/e.outputLen);n===void 0&&(n=lo);const i=new Uint8Array(o*e.outputLen),s=Ve.create(e,t),c=s._cloneInto(),a=new Uint8Array(s.outputLen);for(let l=0;l<o;l++)Kn[0]=l+1,c.update(l===0?lo:a).update(n).update(Kn).digestInto(a),i.set(a,e.outputLen*l),s._cloneInto(c);return s.destroy(),c.destroy(),a.fill(0),Kn.fill(0),i.slice(0,r)}var ee=Symbol("verified"),mc=e=>e instanceof Object;function xc(e){if(!mc(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;t<e.tags.length;t++){let n=e.tags[t];if(!Array.isArray(n))return!1;for(let r=0;r<n.length;r++)if(typeof n[r]=="object")return!1}return!0}var uo=new TextDecoder("utf-8"),fo=new TextEncoder;function Ae(e){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()}var vc=class{constructor(e){v(this,"value");v(this,"next",null);v(this,"prev",null);this.value=e}},Ec=class{constructor(){v(this,"first");v(this,"last");this.first=null,this.last=null}enqueue(e){const t=new vc(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,e.value}},_c=class{generateSecretKey(){return ut.utils.randomPrivateKey()}getPublicKey(e){return ht(ut.getPublicKey(e))}finalizeEvent(e,t){const n=e;return n.pubkey=ht(ut.getPublicKey(t)),n.id=Wn(n),n.sig=ht(ut.sign(Wn(n),t)),n[ee]=!0,n}verifyEvent(e){if(typeof e[ee]=="boolean")return e[ee];const t=Wn(e);if(t!==e.id)return e[ee]=!1,!1;try{const n=ut.verify(e.sig,t,e.pubkey);return e[ee]=n,n}catch{return e[ee]=!1,!1}}};function kc(e){if(!xc(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 Wn(e){let t=le(fo.encode(kc(e)));return ht(t)}var Fe=new _c;Fe.generateSecretKey;var Sc=Fe.getPublicKey,Ac=Fe.finalizeEvent,ho=Fe.verifyEvent;async function Bc(e,t,n){const r=e instanceof Uint8Array?ht(e):e;let[o,i]=n.split("?iv="),s=ve.getSharedSecret(r,"02"+t),c=Ic(s),a=ke.decode(i),l=ke.decode(o),f=Xs(c,a).decrypt(l);return uo.decode(f)}function Ic(e){return e.slice(1,33)}var go=1,bo=65535;function Tc(e,t){const n=ve.getSharedSecret(e,"02"+t).subarray(1,33);return wc(le,n,"nip44-v2")}function po(e,t){const n=yc(le,e,t,76);return{chacha_key:n.subarray(0,32),chacha_nonce:n.subarray(32,44),hmac_key:n.subarray(44,76)}}function wo(e){if(!Number.isSafeInteger(e)||e<1)throw new Error("expected positive integer");if(e<=32)return 32;const t=1<<Math.floor(Math.log2(e-1))+1,n=t<=256?32:t/8;return n*(Math.floor((e-1)/n)+1)}function Oc(e){if(!Number.isSafeInteger(e)||e<go||e>bo)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 Lc(e){const t=fo.encode(e),n=t.length,r=Oc(n),o=new Uint8Array(wo(n)-n);return an(r,t,o)}function Nc(e){const t=new DataView(e.buffer).getUint16(0),n=e.subarray(2,2+t);if(t<go||t>bo||n.length!==t||e.length!==2+wo(t))throw new Error("invalid padding");return uo.decode(n)}function yo(e,t,n){if(n.length!==32)throw new Error("AAD associated data must be 32 bytes");const r=an(n,t);return Ve(le,e,r)}function Uc(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=ke.decode(e)}catch(i){throw new Error("invalid base64: "+i.message)}const r=n.length;if(r<99||r>65603)throw new Error("invalid data length: "+r);const o=n[0];if(o!==2)throw new Error("unknown encryption version "+o);return{nonce:n.subarray(1,33),ciphertext:n.subarray(33,-32),mac:n.subarray(-32)}}function Pc(e,t,n=ci(32)){const{chacha_key:r,chacha_nonce:o,hmac_key:i}=po(t,n),s=Lc(e),c=co(r,o,s),a=yo(i,c,n);return ke.encode(an(new Uint8Array([2]),n,c,a))}function Cc(e,t){const{nonce:n,ciphertext:r,mac:o}=Uc(e),{chacha_key:i,chacha_nonce:s,hmac_key:c}=po(t,n),a=yo(c,r,n);if(!Rs(a,o))throw new Error("invalid MAC");const l=co(i,s,r);return Nc(l)}var Rc=/^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,Hc;try{Hc=fetch}catch{}var Mc=22242,mo=24133;function jc(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),o=e[`#${r}`];if(o&&!t.tags.find(([i,s])=>i===n.slice(1)&&o.indexOf(s)!==-1))return!1}return!(e.since&&t.created_at<e.since||e.until&&t.created_at>e.until)}function $c(e,t){for(let n=0;n<e.length;n++)if(jc(e[n],t))return!0;return!1}function qc(e,t){let n=t.length+3,r=e.indexOf(`"${t}":`)+n,o=e.slice(r).indexOf('"')+r+1;return e.slice(o,o+64)}function zc(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,o=e.slice(r+1,80).indexOf('"');if(o===-1)return null;let i=r+1+o;return e.slice(r+1,i)}function Kc(e,t){return{kind:Mc,created_at:Math.floor(Date.now()/1e3),tags:[["relay",e],["challenge",t]],content:""}}async function Wc(){return new Promise(e=>{const t=new MessageChannel,n=()=>{t.port1.removeEventListener("message",n),e()};t.port1.addEventListener("message",n),t.port2.postMessage(0),t.port1.start()})}var Dc=e=>(e[ee]=!0,!0),xo=class{constructor(e,t){v(this,"url");v(this,"_connected",!1);v(this,"onclose",null);v(this,"onnotice",e=>console.debug(`NOTICE from ${this.url}: ${e}`));v(this,"_onauth",null);v(this,"baseEoseTimeout",4400);v(this,"connectionTimeout",4400);v(this,"publishTimeout",4400);v(this,"openSubs",new Map);v(this,"connectionTimeoutHandle");v(this,"connectionPromise");v(this,"openCountRequests",new Map);v(this,"openEventPublishes",new Map);v(this,"ws");v(this,"incomingMessageQueue",new Ec);v(this,"queueRunning",!1);v(this,"challenge");v(this,"serial",0);v(this,"verifyEvent");v(this,"_WebSocket");this.url=Ae(e),this.verifyEvent=t.verifyEvent,this._WebSocket=t.websocketImplementation||WebSocket}static async connect(e,t){const n=new xo(e,t);return await n.connect(),n}closeAllSubscriptions(e){for(let[t,n]of this.openSubs)n.close(e);this.openSubs.clear();for(let[t,n]of this.openEventPublishes)n.reject(new Error(e));this.openEventPublishes.clear();for(let[t,n]of this.openCountRequests)n.reject(new Error(e));this.openCountRequests.clear()}get connected(){return this._connected}async connect(){return this.connectionPromise?this.connectionPromise:(this.challenge=void 0,this.connectionPromise=new Promise((e,t)=>{this.connectionTimeoutHandle=setTimeout(()=>{var n;t("connection timed out"),this.connectionPromise=void 0,(n=this.onclose)==null||n.call(this),this.closeAllSubscriptions("relay connection timed out")},this.connectionTimeout);try{this.ws=new this._WebSocket(this.url)}catch(n){t(n);return}this.ws.onopen=()=>{clearTimeout(this.connectionTimeoutHandle),this._connected=!0,e()},this.ws.onerror=n=>{var r;t(n.message||"websocket error"),this._connected&&(this._connected=!1,this.connectionPromise=void 0,(r=this.onclose)==null||r.call(this),this.closeAllSubscriptions("relay connection errored"))},this.ws.onclose=async()=>{var n;this._connected&&(this._connected=!1,this.connectionPromise=void 0,(n=this.onclose)==null||n.call(this),this.closeAllSubscriptions("relay connection closed"))},this.ws.onmessage=this._onmessage.bind(this)}),this.connectionPromise)}async runQueue(){for(this.queueRunning=!0;this.handleNext()!==!1;)await Wc();this.queueRunning=!1}handleNext(){var n,r,o;const e=this.incomingMessageQueue.dequeue();if(!e)return!1;const t=zc(e);if(t){const i=this.openSubs.get(t);if(!i)return;const s=qc(e,"id"),c=(n=i.alreadyHaveEvent)==null?void 0:n.call(i,s);if((r=i.receivedEvent)==null||r.call(i,this,s),c)return}try{let i=JSON.parse(e);switch(i[0]){case"EVENT":{const s=this.openSubs.get(i[1]),c=i[2];this.verifyEvent(c)&&$c(s.filters,c)&&s.onevent(c);return}case"COUNT":{const s=i[1],c=i[2],a=this.openCountRequests.get(s);a&&(a.resolve(c.count),this.openCountRequests.delete(s));return}case"EOSE":{const s=this.openSubs.get(i[1]);if(!s)return;s.receivedEose();return}case"OK":{const s=i[1],c=i[2],a=i[3],l=this.openEventPublishes.get(s);l&&(clearTimeout(l.timeout),c?l.resolve(a):l.reject(new Error(a)),this.openEventPublishes.delete(s));return}case"CLOSED":{const s=i[1],c=this.openSubs.get(s);if(!c)return;c.closed=!0,c.close(i[2]);return}case"NOTICE":this.onnotice(i[1]);return;case"AUTH":{this.challenge=i[1],(o=this._onauth)==null||o.call(this,i[1]);return}}}catch{return}}async send(e){if(!this.connectionPromise)throw new Error("sending on closed connection");this.connectionPromise.then(()=>{var t;(t=this.ws)==null||t.send(e)})}async auth(e){if(!this.challenge)throw new Error("can't perform auth, no challenge was received");const t=await e(Kc(this.url,this.challenge)),n=new Promise((r,o)=>{const i=setTimeout(()=>{const s=this.openEventPublishes.get(t.id);s&&(s.reject(new Error("auth timed out")),this.openEventPublishes.delete(t.id))},this.publishTimeout);this.openEventPublishes.set(t.id,{resolve:r,reject:o,timeout:i})});return this.send('["AUTH",'+JSON.stringify(t)+"]"),n}async publish(e){const t=new Promise((n,r)=>{const o=setTimeout(()=>{const i=this.openEventPublishes.get(e.id);i&&(i.reject(new Error("publish timed out")),this.openEventPublishes.delete(e.id))},this.publishTimeout);this.openEventPublishes.set(e.id,{resolve:n,reject:r,timeout:o})});return this.send('["EVENT",'+JSON.stringify(e)+"]"),t}async count(e,t){this.serial++;const n=(t==null?void 0:t.id)||"count:"+this.serial,r=new Promise((o,i)=>{this.openCountRequests.set(n,{resolve:o,reject:i})});return this.send('["COUNT","'+n+'",'+JSON.stringify(e).substring(1)),r}subscribe(e,t){const n=this.prepareSubscription(e,t);return n.fire(),n}prepareSubscription(e,t){this.serial++;const n=t.id||(t.label?t.label+":":"sub:")+this.serial,r=new Vc(this,n,e,t);return this.openSubs.set(n,r),r}close(){var e;this.closeAllSubscriptions("relay connection closed by us"),this._connected=!1,(e=this.ws)==null||e.close()}_onmessage(e){this.incomingMessageQueue.enqueue(e.data),this.queueRunning||this.runQueue()}},Vc=class{constructor(e,t,n,r){v(this,"relay");v(this,"id");v(this,"closed",!1);v(this,"eosed",!1);v(this,"filters");v(this,"alreadyHaveEvent");v(this,"receivedEvent");v(this,"onevent");v(this,"oneose");v(this,"onclose");v(this,"eoseTimeout");v(this,"eoseTimeoutHandle");this.relay=e,this.filters=n,this.id=t,this.alreadyHaveEvent=r.alreadyHaveEvent,this.receivedEvent=r.receivedEvent,this.eoseTimeout=r.eoseTimeout||e.baseEoseTimeout,this.oneose=r.oneose,this.onclose=r.onclose,this.onevent=r.onevent||(o=>{console.warn(`onevent() callback not defined for subscription '${this.id}' in relay ${this.relay.url}. event received:`,o)})}fire(){this.relay.send('["REQ","'+this.id+'",'+JSON.stringify(this.filters).substring(1)),this.eoseTimeoutHandle=setTimeout(this.receivedEose.bind(this),this.eoseTimeout)}receivedEose(){var e;this.eosed||(clearTimeout(this.eoseTimeoutHandle),this.eosed=!0,(e=this.oneose)==null||e.call(this))}close(e="closed by caller"){var t;!this.closed&&this.relay.connected&&(this.relay.send('["CLOSE",'+JSON.stringify(this.id)+"]"),this.closed=!0),this.relay.openSubs.delete(this.id),(t=this.onclose)==null||t.call(this,e)}},Fc=class{constructor(e){v(this,"relays",new Map);v(this,"seenOn",new Map);v(this,"trackRelays",!1);v(this,"verifyEvent");v(this,"trustedRelayURLs",new Set);v(this,"_WebSocket");this.verifyEvent=e.verifyEvent,this._WebSocket=e.websocketImplementation}async ensureRelay(e,t){e=Ae(e);let n=this.relays.get(e);return n||(n=new xo(e,{verifyEvent:this.trustedRelayURLs.has(e)?Dc:this.verifyEvent,websocketImplementation:this._WebSocket}),t!=null&&t.connectionTimeout&&(n.connectionTimeout=t.connectionTimeout),this.relays.set(e,n)),await n.connect(),n}close(e){e.map(Ae).forEach(t=>{var n;(n=this.relays.get(t))==null||n.close()})}subscribeMany(e,t,n){return this.subscribeManyMap(Object.fromEntries(e.map(r=>[r,t])),n)}subscribeManyMap(e,t){this.trackRelays&&(t.receivedEvent=(u,g)=>{let h=this.seenOn.get(g);h||(h=new Set,this.seenOn.set(g,h)),h.add(u)});const n=new Set,r=[],o=Object.keys(e).length,i=[];let s=u=>{var g;i[u]||(i[u]=!0,i.filter(h=>h).length===o&&((g=t.oneose)==null||g.call(t),s=()=>{}))};const c=[];let a=(u,g)=>{var h;c[u]||(s(u),c[u]=g,c.filter(p=>p).length===o&&((h=t.onclose)==null||h.call(t,c),a=()=>{}))};const l=u=>{var h;if((h=t.alreadyHaveEvent)!=null&&h.call(t,u))return!0;const g=n.has(u);return n.add(u),g},f=Promise.all(Object.entries(e).map(async(u,g,h)=>{if(h.indexOf(u)!==g){a(g,"duplicate url");return}let[p,d]=u;p=Ae(p);let b;try{b=await this.ensureRelay(p,{connectionTimeout:t.maxWait?Math.max(t.maxWait*.8,t.maxWait-1e3):void 0})}catch(y){a(g,(y==null?void 0:y.message)||String(y));return}let w=b.subscribe(d,{...t,oneose:()=>s(g),onclose:y=>a(g,y),alreadyHaveEvent:l,eoseTimeout:t.maxWait});r.push(w)}));return{async close(){await f,r.forEach(u=>{u.close()})}}}subscribeManyEose(e,t,n){const r=this.subscribeMany(e,t,{...n,oneose(){r.close()}});return r}async querySync(e,t,n){return new Promise(async r=>{const o=[];this.subscribeManyEose(e,[t],{...n,onevent(i){o.push(i)},onclose(i){r(o)}})})}async get(e,t,n){t.limit=1;const r=await this.querySync(e,t,n);return r.sort((o,i)=>i.created_at-o.created_at),r[0]||null}publish(e,t){return e.map(Ae).map(async(n,r,o)=>{if(o.indexOf(n)!==r)return Promise.reject("duplicate url");let i=await this.ensureRelay(n);return i.publish(t).then(s=>{if(this.trackRelays){let c=this.seenOn.get(t.id);c||(c=new Set,this.seenOn.set(t.id,c)),c.add(i)}return s})})}listConnectionStatus(){const e=new Map;return this.relays.forEach((t,n)=>e.set(n,t.connected)),e}destroy(){this.relays.forEach(e=>e.close()),this.relays=new Map}},vo;try{vo=WebSocket}catch{}var Gc=class extends Fc{constructor(){super({verifyEvent:ho,websocketImplementation:vo})}},Eo;try{Eo=fetch}catch{}var Ge=/^bunker:\/\/([0-9a-f]{64})\??([?\/\w:.=&%-]*)$/;async function Yc(e){let t=e.match(Ge);if(t)try{const n=t[1],r=new URLSearchParams(t[2]);return{pubkey:n,relays:r.getAll("relay"),secret:r.get("secret")}}catch{}return Zc(e)}async function Zc(e){const t=e.match(Rc);if(!t)return null;const[n,r="_",o]=t;try{const i=`https://${o}/.well-known/nostr.json?name=${r}`,s=await(await Eo(i,{redirect:"error"})).json();let c=s.names[r],a=s.nip46[c]||[];return{pubkey:c,relays:a,secret:null}}catch{return null}}var Jc=class{constructor(e,t,n={}){v(this,"pool");v(this,"subCloser");v(this,"isOpen");v(this,"serial");v(this,"idPrefix");v(this,"listeners");v(this,"waitingForAuth");v(this,"secretKey");v(this,"conversationKey");v(this,"bp");v(this,"cachedPubKey");if(t.relays.length===0)throw new Error("no relays are specified for this bunker");this.pool=n.pool||new Gc,this.secretKey=e,this.conversationKey=Tc(e,t.pubkey),this.bp=t,this.isOpen=!1,this.idPrefix=Math.random().toString(36).substring(7),this.serial=0,this.listeners={},this.waitingForAuth={};const r=this.listeners,o=this.waitingForAuth,i=this.conversationKey;this.subCloser=this.pool.subscribeMany(this.bp.relays,[{kinds:[mo],authors:[t.pubkey],"#p":[Sc(this.secretKey)]}],{async onevent(s){let c;try{c=JSON.parse(Cc(s.content,i))}catch{c=JSON.parse(await Bc(e,s.pubkey,s.content))}const{id:a,result:l,error:f}=c;if(l==="auth_url"&&o[a]){delete o[a],n.onauth?n.onauth(f):console.warn(`nostr-tools/nip46: remote signer ${t.pubkey} tried to send an "auth_url"='${f}' but there was no onauth() callback configured.`);return}let u=r[a];u&&(f?u.reject(f):l&&u.resolve(l),delete r[a])}}),this.isOpen=!0}async close(){this.isOpen=!1,this.subCloser.close()}async sendRequest(e,t){return new Promise(async(n,r)=>{try{if(!this.isOpen)throw new Error("this signer is not open anymore, create a new one");this.serial++;const o=`${this.idPrefix}-${this.serial}`,i=Pc(JSON.stringify({id:o,method:e,params:t}),this.conversationKey),s=Ac({kind:mo,tags:[["p",this.bp.pubkey]],content:i,created_at:Math.floor(Date.now()/1e3)},this.secretKey);this.listeners[o]={resolve:n,reject:r},this.waitingForAuth[o]=!0,await Promise.any(this.pool.publish(this.bp.relays,s))}catch(o){r(o)}})}async ping(){let e=await this.sendRequest("ping",[]);if(e!=="pong")throw new Error(`result is not pong: ${e}`)}async connect(){await this.sendRequest("connect",[this.bp.pubkey,this.bp.secret||""])}async getPublicKey(){return this.cachedPubKey||(this.cachedPubKey=await this.sendRequest("get_public_key",[])),this.cachedPubKey}async getRelays(){return JSON.parse(await this.sendRequest("get_relays",[]))}async signEvent(e){let t=await this.sendRequest("sign_event",[JSON.stringify(e)]),n=JSON.parse(t);if(ho(n))return n;throw new Error(`event returned from bunker is improperly signed: ${JSON.stringify(n)}`)}async nip04Encrypt(e,t){return await this.sendRequest("nip04_encrypt",[e,t])}async nip04Decrypt(e,t){return await this.sendRequest("nip04_decrypt",[e,t])}async nip44Encrypt(e,t){return await this.sendRequest("nip44_encrypt",[e,t])}async nip44Decrypt(e,t){return await this.sendRequest("nip44_decrypt",[e,t])}},Qc=/^(?:([\w.+-]+)@)?([\w_-]+(\.[\w_-]+)+)$/,Xc;try{Xc=fetch}catch{}new TextDecoder("utf-8"),new TextEncoder;var ta=5e3;function ea(e){return ra("npub",cr(e))}function na(e,t){let n=oo.toWords(t);return oo.encode(e,n,ta)}function ra(e,t){return na(e,t)}const ge=[];function oa(e,t=$){let n;const r=new Set;function o(c){if(Ze(e,c)&&(e=c,n)){const a=!ge.length;for(const l of r)l[1](),ge.push(l,e);if(a){for(let l=0;l<ge.length;l+=2)ge[l][0](ge[l+1]);ge.length=0}}}function i(c){o(c(e))}function s(c,a=$){const l=[c,a];return r.add(l),r.size===1&&(n=t(o,i)||$),c(e),()=>{r.delete(l),r.size===0&&n&&(n(),n=null)}}return{set:o,update:i,subscribe:s}}const ia=e=>{const{subscribe:t,set:n}=oa(void 0,()=>{const r=window.matchMedia(e);n(r.matches);const o=()=>n(r.matches);return r.addEventListener("change",o),()=>{r.removeEventListener("change",o)}});return{subscribe:t}};function sa(e){let t,n,r;return{c(){t=Je("svg"),n=Je("circle"),r=Je("path"),S(n,"class","opacity-25"),S(n,"cx","12"),S(n,"cy","12"),S(n,"r","10"),S(n,"stroke","currentColor"),S(n,"stroke-width","4"),S(r,"class","opacity-75"),S(r,"fill","currentColor"),S(r,"d","M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"),S(t,"class","ml-2 h-5 w-5 animate-spin text-white"),S(t,"xmlns","http://www.w3.org/2000/svg"),S(t,"fill","none"),S(t,"viewBox","0 0 24 24")},m(o,i){j(o,t,i),I(t,n),I(t,r)},p:$,i:$,o:$,d(o){o&&M(t)}}}class _o extends ir{constructor(t){super(),or(this,t,null,sa,Ze,{})}}const{window:Dn}=Vo;function ca(e){let t,n,r,o,i,s,c,a,l,f,u,g,h=!e[17]&&!e[10]&&!e[11]&&!e[12]&&ko(e);const p=[pa,ba,ga,ha,da,fa,ua],d=[];function b(w,y){return w[10]?0:w[11]?1:w[12]?2:w[17]?3:w[15]?4:w[18]?6:5}return c=b(e),a=d[c]=p[c](e),{c(){t=C("div"),n=C("button"),r=F("⤫"),i=Z(),h&&h.c(),s=Z(),a.c(),S(n,"class",o="absolute right-2 top-0 cursor-pointer bg-transparent text-3xl text-"+e[0]+"-600"),S(t,"class",l="animate-show rounded-md bg-gradient-to-b px-8 py-8 shadow-[0_0px_30px_0px_rgba(0,0,0,0.6)] transition-all sm:w-96 bg-"+e[0]+"-800 from-"+e[0]+"-900 to-"+e[0]+"-700 "+e[23])},m(w,y){j(w,t,y),I(t,n),I(n,r),I(t,i),h&&h.m(t,null),I(t,s),d[c].m(t,null),f=!0,u||(g=ot(n,"click",function(){Ye(e[17]?e[28]:e[26])&&(e[17]?e[28]:e[26]).apply(this,arguments)}),u=!0)},p(w,y){e=w,(!f||y[0]&1&&o!==(o="absolute right-2 top-0 cursor-pointer bg-transparent text-3xl text-"+e[0]+"-600"))&&S(n,"class",o),!e[17]&&!e[10]&&!e[11]&&!e[12]?h?h.p(e,y):(h=ko(e),h.c(),h.m(t,s)):h&&(h.d(1),h=null);let k=c;c=b(e),c===k?d[c].p(e,y):(Le(),Et(d[k],1,1,()=>{d[k]=null}),Ne(),a=d[c],a?a.p(e,y):(a=d[c]=p[c](e),a.c()),vt(a,1),a.m(t,null)),(!f||y[0]&8388609&&l!==(l="animate-show rounded-md bg-gradient-to-b px-8 py-8 shadow-[0_0px_30px_0px_rgba(0,0,0,0.6)] transition-all sm:w-96 bg-"+e[0]+"-800 from-"+e[0]+"-900 to-"+e[0]+"-700 "+e[23]))&&S(t,"class",l)},i(w){f||(vt(a),f=!0)},o(w){Et(a),f=!1},d(w){w&&M(t),h&&h.d(),d[c].d(),u=!1,g()}}}function aa(e){let t,n,r,o,i;const s=[ka,_a,Ea,va],c=[];function a(l,f){return l[9]?0:l[18]?l[2]?3:2:1}return n=a(e),r=c[n]=s[n](e),{c(){t=C("div"),r.c(),S(t,"class",o="rounded px-2 py-2 shadow-[0_0px_10px_0px_rgba(0,0,0,0.3)] transition-all duration-200 bg-"+e[0]+"-700 hover:bg-"+e[0]+"-800 "+e[23])},m(l,f){j(l,t,f),c[n].m(t,null),i=!0},p(l,f){let u=n;n=a(l),n===u?c[n].p(l,f):(Le(),Et(c[u],1,1,()=>{c[u]=null}),Ne(),r=c[n],r?r.p(l,f):(r=c[n]=s[n](l),r.c()),vt(r,1),r.m(t,null)),(!i||f[0]&8388609&&o!==(o="rounded px-2 py-2 shadow-[0_0px_10px_0px_rgba(0,0,0,0.3)] transition-all duration-200 bg-"+l[0]+"-700 hover:bg-"+l[0]+"-800 "+l[23]))&&S(t,"class",o)},i(l){i||(vt(r),i=!0)},o(l){Et(r),i=!1},d(l){l&&M(t),c[n].d()}}}function la(e){return{c:$,m:$,p:$,i:$,o:$,d:$}}function ko(e){let t,n,r,o,i;return{c(){t=C("button"),n=F("?"),S(t,"class",r="absolute bottom-1 right-3 cursor-pointer bg-transparent text-xl text-"+e[0]+"-600")},m(s,c){j(s,t,c),I(t,n),o||(i=ot(t,"click",e[27]),o=!0)},p(s,c){c[0]&1&&r!==(r="absolute bottom-1 right-3 cursor-pointer bg-transparent text-xl text-"+s[0]+"-600")&&S(t,"class",r)},d(s){s&&M(t),o=!1,i()}}}function ua(e){let t,n,r,o,i,s,c=e[18].npub+"",a,l,f,u,g,h,p,d,b,w,y,k=Mr(e[8])+"",P,N,E,_=(e[18].picture||e[18].name)&&So(e);return{c(){t=C("div"),n=C("div"),n.textContent="You are connected to Nostr as",r=Z(),o=C("a"),_&&_.c(),i=Z(),s=C("div"),a=F(c),f=Z(),u=C("button"),g=F("Disconnect"),p=Z(),d=C("div"),b=F("This webpage is using the public key:"),w=C("br"),y=Z(),P=F(k),S(n,"class","mb-4 text-sm"),S(s,"class","block break-all"),S(o,"target","_blank"),S(o,"href",l="https://nosta.me/"+e[18].npub),S(o,"class","group text-white no-underline"),S(t,"class","text-center"),S(u,"class",h="my-2 mt-6 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white bg-"+e[0]+"-900 hover:bg-"+e[0]+"-950"),S(d,"class","mt-6 block break-all text-center text-sm")},m(m,T){j(m,t,T),I(t,n),I(t,r),I(t,o),_&&_.m(o,null),I(o,i),I(o,s),I(s,a),j(m,f,T),j(m,u,T),I(u,g),j(m,p,T),j(m,d,T),I(d,b),I(d,w),I(d,y),I(d,P),N||(E=ot(u,"click",e[30]),N=!0)},p(m,T){m[18].picture||m[18].name?_?_.p(m,T):(_=So(m),_.c(),_.m(o,i)):_&&(_.d(1),_=null),T[0]&262144&&c!==(c=m[18].npub+"")&&Rt(a,c),T[0]&262144&&l!==(l="https://nosta.me/"+m[18].npub)&&S(o,"href",l),T[0]&1&&h!==(h="my-2 mt-6 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white bg-"+m[0]+"-900 hover:bg-"+m[0]+"-950")&&S(u,"class",h),T[0]&256&&k!==(k=Mr(m[8])+"")&&Rt(P,k)},i:$,o:$,d(m){m&&(M(t),M(f),M(u),M(p),M(d)),_&&_.d(),N=!1,E()}}}function fa(e){let t,n,r,o,i,s,c,a,l,f,u,g,h,p,d,b,w,y=e[16]&&Io(e);const k=[ya,wa],P=[];function N(m,T){return m[9]?0:1}a=N(e),l=P[a]=k[a](e);let E=e[9]&&e[13]&&To(e),_=!e[9]&&Oo(e);return{c(){t=C("div"),t.textContent="How do you want to connect to Nostr?",n=Z(),r=C("form"),o=C("input"),i=Z(),y&&y.c(),s=Z(),c=C("button"),l.c(),g=Z(),E&&E.c(),h=Z(),_&&_.c(),p=Qn(),S(t,"class","text-center text-lg"),S(o,"class","box-border w-full rounded px-2 py-1 text-lg text-neutral-800 outline-none"),S(o,"placeholder","user@provider or bunker://..."),o.autofocus=!0,o.disabled=e[9],S(o,"autocapitalize","none"),S(c,"class",f="mt-4 flex w-full cursor-pointer items-center justify-center rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-"+e[0]+"-900 hover:bg-"+e[0]+"-950"),c.disabled=u=!e[22]||e[9],S(r,"class","mb-1 mt-4 flex flex-col")},m(m,T){j(m,t,T),j(m,n,T),j(m,r,T),I(r,o),e[44](o),Xn(o,e[4]),I(r,i),y&&y.m(r,null),I(r,s),I(r,c),P[a].m(c,null),I(r,g),E&&E.m(r,null),j(m,h,T),_&&_.m(m,T),j(m,p,T),d=!0,o.focus(),b||(w=[ot(o,"input",e[45]),ot(r,"submit",e[29])],b=!0)},p(m,T){(!d||T[0]&512)&&(o.disabled=m[9]),T[0]&16&&o.value!==m[4]&&Xn(o,m[4]),m[16]?y?y.p(m,T):(y=Io(m),y.c(),y.m(r,s)):y&&(y.d(1),y=null);let U=a;a=N(m),a!==U&&(Le(),Et(P[U],1,1,()=>{P[U]=null}),Ne(),l=P[a],l||(l=P[a]=k[a](m),l.c()),vt(l,1),l.m(c,null)),(!d||T[0]&1&&f!==(f="mt-4 flex w-full cursor-pointer items-center justify-center rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-"+m[0]+"-900 hover:bg-"+m[0]+"-950"))&&S(c,"class",f),(!d||T[0]&4194816&&u!==(u=!m[22]||m[9]))&&(c.disabled=u),m[9]&&m[13]?E?E.p(m,T):(E=To(m),E.c(),E.m(r,null)):E&&(E.d(1),E=null),m[9]?_&&(_.d(1),_=null):_?_.p(m,T):(_=Oo(m),_.c(),_.m(p.parentNode,p))},i(m){d||(vt(l),d=!0)},o(m){Et(l),d=!1},d(m){m&&(M(t),M(n),M(r),M(h),M(p)),e[44](null),y&&y.d(),P[a].d(),E&&E.d(),_&&_.d(m),b=!1,Ct(w)}}}function da(e){let t,n,r,o,i,s,c,a,l,f,u,g,h,p,d;return{c(){t=C("div"),t.textContent="Create a Nostr account",n=Z(),r=C("div"),r.textContent=`To use this Nostr app you need a profile. The following button opens a
|
|
2
2
|
wizard that help you to create your keypair and safely manage it in a
|
|
3
|
-
few steps. Are you ready?`,o=Z(),i=
|
|
3
|
+
few steps. Are you ready?`,o=Z(),i=C("button"),s=F("Create an account »"),a=Z(),l=C("div"),f=F("Do you already have a Nostr address?"),u=C("br"),g=Z(),h=C("button"),h.textContent="Login now",S(t,"class","text-center text-lg"),S(r,"class","mt-4 text-base leading-5"),S(i,"class",c="mt-4 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-"+e[0]+"-900 hover:bg-"+e[0]+"-950"),i.disabled=Oa,S(h,"class","cursor-pointer border-0 bg-transparent text-sm text-white underline"),S(l,"class","mt-6 text-center text-sm leading-3")},m(b,w){j(b,t,w),j(b,n,w),j(b,r,w),j(b,o,w),j(b,i,w),I(i,s),j(b,a,w),j(b,l,w),I(l,f),I(l,u),I(l,g),I(l,h),p||(d=[ot(i,"click",e[37]),ot(h,"click",e[32])],p=!0)},p(b,w){w[0]&1&&c!==(c="mt-4 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-"+b[0]+"-900 hover:bg-"+b[0]+"-950")&&S(i,"class",c)},i:$,o:$,d(b){b&&(M(t),M(n),M(r),M(o),M(i),M(a),M(l)),p=!1,Ct(d)}}}function ha(e){let t,n,r;return{c(){t=C("div"),t.textContent="What is that?",n=Z(),r=C("div"),r.innerHTML=`<p class="mb mt-4">This widget is created with <i>window.nostr.js</i>, a small script
|
|
4
4
|
you can drop in any page that already uses NIP-07 and make it also
|
|
5
5
|
work with NIP-46 automatically when the user doesn't have an
|
|
6
6
|
extension installed.
|
|
7
7
|
<br/>
|
|
8
8
|
It adds a small floating button on the side of the window that users
|
|
9
9
|
can use to create Nostr accuonts or connect to their NIP-46 bunkers.</p> <p class="mt-4">This tool is opensource, get the code from the <a target="_blank" class="underline" href="https://github.com/fiatjaf/window.nostr.js">project's page</a>.</p> <p class="mt-4">You don't know what Nostr is?
|
|
10
|
-
<a target="_blank" class="underline" href="https://www.nostr.com">Learn more</a>.</p>`,
|
|
10
|
+
<a target="_blank" class="underline" href="https://www.nostr.com">Learn more</a>.</p>`,S(t,"class","text-center text-lg"),S(r,"class","text-base leading-5")},m(o,i){j(o,t,i),j(o,n,i),j(o,r,i)},p:$,i:$,o:$,d(o){o&&(M(t),M(n),M(r))}}}function ga(e){let t,n,r,o,i,s,c=new URL(e[12]).host+"",a,l,f,u,g,h,p,d,b,w;return{c(){t=C("div"),n=C("div"),n.textContent="An action requires your confirmation",r=Z(),o=C("div"),i=F("Now you a new window will bring you to "),s=C("strong"),a=F(c),l=F(`
|
|
11
11
|
where you can approve the current action. If nothing happens check that
|
|
12
|
-
if your browser is blocking popups, pleaase.`),f=
|
|
13
|
-
After that you will be returned to this page.`),
|
|
12
|
+
if your browser is blocking popups, pleaase.`),f=C("br"),u=F(`
|
|
13
|
+
After that you will be returned to this page.`),g=Z(),h=C("button"),p=F("Confirm action »"),S(n,"class","text-center text-lg"),S(o,"class","mt-4 text-center text-sm leading-4"),S(h,"class",d="mt-4 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-"+e[0]+"-900 hover:bg-"+e[0]+"-950"),S(t,"class","m-auto w-full")},m(y,k){j(y,t,k),I(t,n),I(t,r),I(t,o),I(o,i),I(o,s),I(s,a),I(o,l),I(o,f),I(o,u),I(t,g),I(t,h),I(h,p),b||(w=ot(h,"click",e[43]),b=!0)},p(y,k){k[0]&4096&&c!==(c=new URL(y[12]).host+"")&&Rt(a,c),k[0]&1&&d!==(d="mt-4 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-"+y[0]+"-900 hover:bg-"+y[0]+"-950")&&S(h,"class",d)},i:$,o:$,d(y){y&&M(t),b=!1,w()}}}function ba(e){let t,n,r,o,i,s,c=new URL(e[11]).host+"",a,l,f,u,g,h,p,d,b,w;return{c(){t=C("div"),n=C("div"),n.textContent="Login into a Nostr account",r=Z(),o=C("div"),i=F("Now you a new window will bring you to "),s=C("strong"),a=F(c),l=F(`
|
|
14
14
|
where you can login and approve the permissions. If nothing happens check
|
|
15
|
-
that if your browser is blocking popups, pleaase.`),f=
|
|
16
|
-
After that you will be returned to this page.`),
|
|
15
|
+
that if your browser is blocking popups, pleaase.`),f=C("br"),u=F(`
|
|
16
|
+
After that you will be returned to this page.`),g=Z(),h=C("button"),p=F("Login now »"),S(n,"class","text-center text-lg"),S(o,"class","mt-4 text-center text-sm leading-4"),S(h,"class",d="mt-4 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-"+e[0]+"-900 hover:bg-"+e[0]+"-950"),S(t,"class","m-auto w-full")},m(y,k){j(y,t,k),I(t,n),I(t,r),I(t,o),I(o,i),I(o,s),I(s,a),I(o,l),I(o,f),I(o,u),I(t,g),I(t,h),I(h,p),b||(w=ot(h,"click",e[42]),b=!0)},p(y,k){k[0]&2048&&c!==(c=new URL(y[11]).host+"")&&Rt(a,c),k[0]&1&&d!==(d="mt-4 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-"+y[0]+"-900 hover:bg-"+y[0]+"-950")&&S(h,"class",d)},i:$,o:$,d(y){y&&M(t),b=!1,w()}}}function pa(e){let t,n,r,o,i,s,c=new URL(e[10]).host+"",a,l,f,u,g,h,p,d,b,w;return{c(){t=C("div"),n=C("div"),n.textContent="Create a Nostr account",r=Z(),o=C("div"),i=F("Now you a new window will bring you to "),s=C("strong"),a=F(c),l=F(`
|
|
17
17
|
where the account creation will take place. If nothing happens check
|
|
18
|
-
that if your browser is blocking popups, pleaase.`),f=
|
|
19
|
-
After that you will be returned to this page.`),
|
|
20
|
-
`)
|
|
21
|
-
`),r=
|
|
22
|
-
`)
|
|
18
|
+
that if your browser is blocking popups, pleaase.`),f=C("br"),u=F(`
|
|
19
|
+
After that you will be returned to this page.`),g=Z(),h=C("button"),p=F("Start account creation »"),S(n,"class","text-center text-lg"),S(o,"class","mt-4 text-center text-sm leading-4"),S(h,"class",d="mt-4 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-"+e[0]+"-900 hover:bg-"+e[0]+"-950"),S(t,"class","m-auto w-full")},m(y,k){j(y,t,k),I(t,n),I(t,r),I(t,o),I(o,i),I(o,s),I(s,a),I(o,l),I(o,f),I(o,u),I(t,g),I(t,h),I(h,p),b||(w=ot(h,"click",e[41]),b=!0)},p(y,k){k[0]&1024&&c!==(c=new URL(y[10]).host+"")&&Rt(a,c),k[0]&1&&d!==(d="mt-4 block w-full cursor-pointer rounded border-0 px-2 py-1 text-lg text-white disabled:cursor-default disabled:bg-neutral-400 disabled:text-neutral-200 bg-"+y[0]+"-900 hover:bg-"+y[0]+"-950")&&S(h,"class",d)},i:$,o:$,d(y){y&&M(t),b=!1,w()}}}function So(e){let t,n,r=e[18].picture&&Ao(e),o=e[18].name&&Bo(e);return{c(){t=C("div"),r&&r.c(),n=Z(),o&&o.c(),S(t,"class","mb-2 flex items-center justify-center gap-2")},m(i,s){j(i,t,s),r&&r.m(t,null),I(t,n),o&&o.m(t,null)},p(i,s){i[18].picture?r?r.p(i,s):(r=Ao(i),r.c(),r.m(t,n)):r&&(r.d(1),r=null),i[18].name?o?o.p(i,s):(o=Bo(i),o.c(),o.m(t,null)):o&&(o.d(1),o=null)},d(i){i&&M(t),r&&r.d(),o&&o.d()}}}function Ao(e){let t,n,r;return{c(){t=C("img"),re(t.src,n=e[18].picture)||S(t,"src",n),S(t,"alt",""),S(t,"class",r="h-10 w-10 rounded-full border-2 border-solid border-transparent group-hover:border-"+e[0]+"-100")},m(o,i){j(o,t,i)},p(o,i){i[0]&262144&&!re(t.src,n=o[18].picture)&&S(t,"src",n),i[0]&1&&r!==(r="h-10 w-10 rounded-full border-2 border-solid border-transparent group-hover:border-"+o[0]+"-100")&&S(t,"class",r)},d(o){o&&M(t)}}}function Bo(e){let t,n=e[18].name+"",r;return{c(){t=C("div"),r=F(n),S(t,"class","text-3xl decoration-2 underline-offset-4 group-hover:underline")},m(o,i){j(o,t,i),I(t,r)},p(o,i){i[0]&262144&&n!==(n=o[18].name+"")&&Rt(r,n)},d(o){o&&M(t)}}}function Io(e){let t,n;return{c(){t=C("div"),n=F(e[16]),S(t,"class","my-2 rounded bg-yellow-100 p-2 text-center text-sm leading-4 text-red-400")},m(r,o){j(r,t,o),I(t,n)},p(r,o){o[0]&65536&&Rt(n,r[16])},d(r){r&&M(t)}}}function wa(e){let t;return{c(){t=F("Connect »")},m(n,r){j(n,t,r)},i:$,o:$,d(n){n&&M(t)}}}function ya(e){let t,n,r;return n=new _o({}),{c(){t=F(`Connecting to bunker
|
|
20
|
+
`),rr(n.$$.fragment)},m(o,i){j(o,t,i),en(n,o,i),r=!0},i(o){r||(vt(n.$$.fragment,o),r=!0)},o(o){Et(n.$$.fragment,o),r=!1},d(o){o&&M(t),nn(n,o)}}}function To(e){let t,n,r,o,i;return{c(){t=C("div"),n=F(`Waiting too much?
|
|
21
|
+
`),r=C("button"),r.textContent="Cancel the connection",S(r,"class","cursor-pointer border-0 bg-transparent text-sm text-white underline"),S(t,"class","mt-6 text-center text-sm leading-3")},m(s,c){j(s,t,c),I(t,n),I(t,r),o||(i=ot(r,"click",e[33]),o=!0)},p:$,d(s){s&&M(t),o=!1,i()}}}function Oo(e){let t;function n(i,s){return i[14]?xa:ma}let r=n(e),o=r(e);return{c(){t=C("div"),o.c(),S(t,"class","mt-6 text-center text-sm leading-3")},m(i,s){j(i,t,s),o.m(t,null)},p(i,s){r===(r=n(i))&&o?o.p(i,s):(o.d(1),o=r(i),o&&(o.c(),o.m(t,null)))},d(i){i&&M(t),o.d()}}}function ma(e){let t,n,r,o,i,s;return{c(){t=F("Do you need a Nostr account?"),n=C("br"),r=Z(),o=C("button"),o.textContent="Sign up now",S(o,"class","cursor-pointer border-0 bg-transparent text-sm text-white underline")},m(c,a){j(c,t,a),j(c,n,a),j(c,r,a),j(c,o,a),i||(s=ot(o,"click",e[37]),i=!0)},p:$,d(c){c&&(M(t),M(n),M(r),M(o)),i=!1,s()}}}function xa(e){let t,n,r,o,i,s;return{c(){t=F("Is this bunker provider broken?"),n=C("br"),r=Z(),o=C("button"),o.textContent="Clear it",S(o,"class","cursor-pointer border-0 bg-transparent text-sm text-white underline")},m(c,a){j(c,t,a),j(c,n,a),j(c,r,a),j(c,o,a),i||(s=ot(o,"click",e[31]),i=!0)},p:$,d(c){c&&(M(t),M(n),M(r),M(o)),i=!1,s()}}}function va(e){let t,n;return{c(){t=C("img"),re(t.src,n=e[18].picture)||S(t,"src",n),S(t,"alt",""),S(t,"class","h-6 w-6 rounded-full")},m(r,o){j(r,t,o)},p(r,o){o[0]&262144&&!re(t.src,n=r[18].picture)&&S(t,"src",n)},i:$,o:$,d(r){r&&M(t)}}}function Ea(e){let t,n,r,o=(e[18].name||e[18].npub.slice(0,7)+"…"+e[18].npub.slice(-4))+"",i;function s(l,f){return l[18].picture?Aa:Sa}let c=s(e),a=c(e);return{c(){t=C("div"),a.c(),n=Z(),r=C("div"),i=F(o),S(r,"class","inline-block max-w-56 overflow-hidden overflow-ellipsis whitespace-nowrap"),S(t,"class","flex items-center px-2")},m(l,f){j(l,t,f),a.m(t,null),I(t,n),I(t,r),I(r,i)},p(l,f){c===(c=s(l))&&a?a.p(l,f):(a.d(1),a=c(l),a&&(a.c(),a.m(t,n))),f[0]&262144&&o!==(o=(l[18].name||l[18].npub.slice(0,7)+"…"+l[18].npub.slice(-4))+"")&&Rt(i,o)},i:$,o:$,d(l){l&&M(t),a.d()}}}function _a(e){let t;function n(i,s){return i[2]?Ia:Ba}let r=n(e),o=r(e);return{c(){o.c(),t=Qn()},m(i,s){o.m(i,s),j(i,t,s)},p(i,s){r!==(r=n(i))&&(o.d(1),o=r(i),o&&(o.c(),o.m(t.parentNode,t)))},i:$,o:$,d(i){i&&M(t),o.d(i)}}}function ka(e){let t,n,r,o;return r=new _o({}),{c(){t=C("div"),n=F(`Connecting to bunker
|
|
22
|
+
`),rr(r.$$.fragment),S(t,"class","flex items-center px-2")},m(i,s){j(i,t,s),I(t,n),en(r,t,null),o=!0},p:$,i(i){o||(vt(r.$$.fragment,i),o=!0)},o(i){Et(r.$$.fragment,i),o=!1},d(i){i&&M(t),nn(r)}}}function Sa(e){let t;return{c(){t=C("span"),t.textContent="☉",S(t,"class","mr-2")},m(n,r){j(n,t,r)},p:$,d(n){n&&M(t)}}}function Aa(e){let t,n;return{c(){t=C("img"),re(t.src,n=e[18].picture)||S(t,"src",n),S(t,"alt",""),S(t,"class","mr-2 h-5 w-5 rounded-full")},m(r,o){j(r,t,o)},p(r,o){o[0]&262144&&!re(t.src,n=r[18].picture)&&S(t,"src",n)},d(r){r&&M(t)}}}function Ba(e){let t;return{c(){t=C("div"),t.textContent="Connect with Nostr",S(t,"class","flex items-center px-2")},m(n,r){j(n,t,r)},d(n){n&&M(t)}}}function Ia(e){let t;return{c(){t=C("div"),t.textContent="N",S(t,"class","w-6 text-center")},m(n,r){j(n,t,r)},d(n){n&&M(t)}}}function Ta(e){let t,n,r,o,i,s,c;const a=[la,aa,ca],l=[];function f(u,g){return!u[21]&&!u[18]&&u[1]?0:u[21]?2:1}return n=f(e),r=l[n]=a[n](e),{c(){t=C("div"),r.c(),S(t,"class","draggable z-[9000] animate-fadein font-sans text-white"),S(t,"style",o="position: fixed; "+(e[21]&&e[5]?"width: 100vw;":"")+"; right: "+(e[21]&&e[5]?"0":e[3])+"px; user-select: none; "+(e[21]&&e[5]?"bottom: 0px":e[20]+":"+e[19]+"px")),tr(t,"cursor-pointer",!e[18]&&!e[21])},m(u,g){j(u,t,g),l[n].m(t,null),e[46](t),i=!0,s||(c=[ot(Dn,"click",e[25]),ot(Dn,"mouseup",e[36]),ot(Dn,"mousemove",e[35]),ot(t,"mousedown",e[34])],s=!0)},p(u,g){let h=n;n=f(u),n===h?l[n].p(u,g):(Le(),Et(l[h],1,1,()=>{l[h]=null}),Ne(),r=l[n],r?r.p(u,g):(r=l[n]=a[n](u),r.c()),vt(r,1),r.m(t,null)),(!i||g[0]&3670056&&o!==(o="position: fixed; "+(u[21]&&u[5]?"width: 100vw;":"")+"; right: "+(u[21]&&u[5]?"0":u[3])+"px; user-select: none; "+(u[21]&&u[5]?"bottom: 0px":u[20]+":"+u[19]+"px")))&&S(t,"style",o),(!i||g[0]&2359296)&&tr(t,"cursor-pointer",!u[18]&&!u[21])},i(u){i||(vt(r),i=!0)},o(u){Et(r),i=!1},d(u){u&&M(t),l[n].d(),e[46](null),s=!1,Ct(c)}}}let Oa=!1;const Lo="We could not connect to a NIP-46 bunker with that url, are you sure it is set up correctly?",No="We were not able to connect using this address. For it to work it has to come from a NIP-46 provider.",Vt=20;function Vn(e){return window.open(e,"window.nostr","width=600,height=800,popup=yes")}function La(e,t,n){let r,o,i,s,c,a;const l=window.location.hostname,f=window.location.protocol,u=ia("only screen and (max-width: 640px)");Do(e,u,L=>n(5,a=L));const g={ORIGIN:"wnj:origin",CLIENT_SECRET:"wnj:clientSecret",Y_POS:"wnj:ypos",CALLBACK_TOKEN:"wnj:callbackToken",BUNKER_POINTER:"wnj:bunkerPointer"};let h,{accent:p}=t,{position:d="top"}=t,{startHidden:b}=t,{compactMode:w}=t;const y=window,k=new Us;let P,N,E;const _=localStorage.getItem(g.CLIENT_SECRET);_?E=cr(_):(E=gs(),localStorage.setItem(g.CLIENT_SECRET,ht(E)));let m="closed",T=!1,U,R,D,q,W,x,A=null,O=null,H=null,B=!1,z=!1,V,K,Q=!1,J,rt,{right:ft=20}=t,et=!1,lt=!1,ct,Ut,Be;const Ft={pool:k,onauth(L){V?n(10,A=L):J?(n(12,H=L),n(39,m="opened")):n(11,O=L)}},bt=oi(()=>{switch(m){case"justopened":n(39,m="opened");break;case"justclosed":n(39,m="closed");break}},500);function xt(){n(39,m="justopened"),bt()}function Gt(){n(39,m="justclosed"),bt()}function ne(){if(U&&!x){Zn();return}xt()}Yn();let $o={isWnj:!0,async getPublicKey(){return!W&&!x&&ne(),(await q).getPublicKey()},async signEvent(L){try{return!W&&!x&&ne(),await(await q).signEvent(L)}finally{n(12,H=null),Gt()}},async getRelays(){return{}},nip04:{async encrypt(L,Y){return!W&&!x&&ne(),(await q).nip04Encrypt(L,Y)},async decrypt(L,Y){return!W&&!x&&ne(),(await q).nip04Decrypt(L,Y)}}};function Yn(){Gt(),U=null,q=new Promise((L,Y)=>{R=L,D=Y}),n(18,J=null),n(9,W=!1),n(13,B=!1),n(15,V=!1),x=!1,rt=null,n(16,K="")}Yo(()=>{const L=window.location.hash;if(L.startsWith("#nostr-login=")){const Y=L.substring(L.indexOf("=")+1),dt=window.location.href.split("#")[0];if(history.replaceState(null,"",dt),Y.startsWith("bunker://")){n(4,N=Y);const pe=new SubmitEvent("submit",{bubbles:!0,cancelable:!0});T=!0,xt(),qo(pe)}}if(!U){let Y=localStorage.getItem(g.BUNKER_POINTER);if(Y){U=JSON.parse(Y);let dt=new URL(`bunker://${U.pubkey}`);U.relays.forEach(pe=>{dt.searchParams.append("relay",pe)}),U.secret&&dt.searchParams.set("secret",U.secret),n(4,N=dt.toString()),zo(),Zn()}}if(y.nostr&&!y.nostr.isWnj){y.destroyWnj();return}else Object.defineProperty(window,"nostr",{get(){return $o},set(Y){$o=Y,Y.isWnj||y.destroyWnj()},configurable:!0});return()=>{rt&&rt.close()}});function Pa(L){Math.abs(o-Ut)>6||Date.now()-Be>600||m==="justopened"||m==="justclosed"||(L.composedPath().find(Y=>Y.id==="wnj")?xt():Gt())}function Ca(L){Gt(),n(15,V=!1),n(10,A=null),n(11,O=null),n(12,H=null),L.stopPropagation()}function Ra(L){n(17,Q=!0),L.stopPropagation()}function Ha(L){n(17,Q=!1),L.stopPropagation()}async function qo(L){L.preventDefault();try{if(U=await Yc(N),!U){N.match(Ge)?n(16,K=Lo):n(16,K=No);return}P.setCustomValidity(""),n(16,K=""),await Zn(),zo()}catch{N.match(Ge)?n(16,K=Lo):n(16,K=No),n(9,W=!1)}}async function Ma(L){L.preventDefault(),localStorage.removeItem(g.BUNKER_POINTER),Yn()}async function ja(L){L.preventDefault(),n(4,N=""),localStorage.removeItem(g.BUNKER_POINTER),n(14,z=!1)}function $a(L){n(15,V=!1)}function qa(){n(13,B=!1),n(9,W=!1),D("connection aborted"),Yn(),xt()}async function Zn(L=void 0){L=L||new Jc(E,U,Ft),n(9,W=!0);let Y=setTimeout(()=>{n(13,B=!0),n(39,m="opened")},5e3);try{await L.connect(),x=!0,localStorage.setItem(g.BUNKER_POINTER,JSON.stringify(U)),Gt(),R(L)}catch(dt){D((dt==null?void 0:dt.message)||String(dt))}finally{clearTimeout(Y),n(9,W=!1),n(13,B=!1),n(10,A=null),n(11,O=null),n(12,H=null),T&&xt()}}async function zo(){let L;try{L=await(await q).getPublicKey()}catch{n(14,z=!0);return}n(18,J={pubkey:L,npub:ea(L),event:null}),rt=k.subscribeMany(["wss://purplepag.es","wss://relay.snort.social","wss://relay.nos.social"],[{kinds:[0],authors:[L]}],{onevent(Y){var dt;if(!((((dt=J.event)==null?void 0:dt.created_at)||0)>=Y.created_at))try{let{name:pe,picture:Qa}=JSON.parse(Y.content);n(18,J.event=Y,J),n(18,J.name=pe,J),n(18,J.picture=Qa,J)}catch{}}})}function za(L){if(i)return;et=!0;const Y=h.getBoundingClientRect();ct=L.clientY-Y.top,Ut=o,Be=Date.now()}function Ka(L){et&&(r==="top"?n(19,o=L.clientY):n(19,o=window.innerHeight-L.clientY),n(19,o-=ct),n(40,lt=!0),o<Vt&&n(19,o=Vt),o>window.innerHeight-Vt&&n(19,o=window.innerHeight-Vt))}function Wa(){if(et=!1,setTimeout(()=>{n(40,lt=!1)},10),lt){const L=h.getBoundingClientRect(),Y=window.innerHeight,dt=Y/2;L.top<dt?(n(20,r="top"),n(19,o=L.top)):(n(20,r="bottom"),n(19,o=Y-L.bottom)),o<Vt&&n(19,o=Vt),localStorage.setItem(g.ORIGIN,r),localStorage.setItem(g.Y_POS,o.toString())}}function Da(){window.location.href=`https://nstart.me?an=${l}&at=web&ac=${f}//${l}&sfb=yes`}const Va=()=>Vn(A),Fa=()=>Vn(O),Ga=()=>{Vn(H)};function Ya(L){Te[L?"unshift":"push"](()=>{P=L,n(7,P)})}function Za(){N=this.value,n(4,N)}function Ja(L){Te[L?"unshift":"push"](()=>{h=L,n(6,h)})}return e.$$set=L=>{"accent"in L&&n(0,p=L.accent),"position"in L&&n(38,d=L.position),"startHidden"in L&&n(1,b=L.startHidden),"compactMode"in L&&n(2,w=L.compactMode),"right"in L&&n(3,ft=L.right)},e.$$.update=()=>{e.$$.dirty[0]&32|e.$$.dirty[1]&128&&n(20,r=a?"bottom":localStorage.getItem(g.ORIGIN)||d),e.$$.dirty[0]&32&&n(19,o=a?Vt:parseInt(localStorage.getItem(g.Y_POS)||"0")||Vt),e.$$.dirty[1]&256&&n(21,i=m==="justopened"||m==="opened"),e.$$.dirty[0]&1|e.$$.dirty[1]&512&&n(23,s=lt?"cursor-grabbing outline-dashed outline-"+p+"-500 outline-1 outline-offset-4":"outline-none"),e.$$.dirty[0]&16&&n(22,c=N&&(N.match(Ge)||N.match(Qc)))},[p,b,w,ft,N,a,h,P,E,W,A,O,H,B,z,V,K,Q,J,o,r,i,c,s,u,Pa,Ca,Ra,Ha,qo,Ma,ja,$a,qa,za,Ka,Wa,Da,d,m,lt,Va,Fa,Ga,Ya,Za,Ja]}class Na extends ir{constructor(t){super(),or(this,t,La,Ta,Ze,{accent:0,position:38,startHidden:1,compactMode:2,right:3},null,[-1,-1,-1])}}const be=window;be.destroyWnj=()=>{setTimeout(()=>{Ua.$destroy()},1)};const Fn=document.createElement("div");Fn.style.zIndex="90000",document.body.appendChild(Fn);const Gn=document.createElement("div");Gn.id="wnj";const Uo=document.createElement("style");Uo.innerHTML=Yt;const Po=Fn.attachShadow({mode:"open"});Po.appendChild(Gn),Po.appendChild(Uo);const Ua=new Na({target:Gn,props:{accent:((Co=be.wnjParams)==null?void 0:Co.accent)||"cyan",position:((Ro=be.wnjParams)==null?void 0:Ro.position)==="bottom"?"bottom":"top",startHidden:(Ho=be.wnjParams)==null?void 0:Ho.startHidden,compactMode:(Mo=be.wnjParams)==null?void 0:Mo.compactMode}});if(!((jo=be.wnjParams)!=null&&jo.disableOverflowFix)){const e=document.createElement("style"),t=`
|
|
23
23
|
html, body {
|
|
24
24
|
overflow: auto;
|
|
25
25
|
height: 100%;
|
|
26
26
|
}
|
|
27
|
-
`;
|
|
27
|
+
`;e.innerHTML=t,document.head.appendChild(e)}})();
|
package/package.json
CHANGED
package/postcss.config.js
CHANGED
package/src/App.svelte
CHANGED
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
let takingTooLong = false
|
|
71
71
|
let hasTriedToConnectButFailed = false
|
|
72
72
|
let creating: boolean
|
|
73
|
-
let awaitingCreation: boolean
|
|
73
|
+
let awaitingCreation: boolean = false
|
|
74
74
|
let errorMessage: string
|
|
75
75
|
let showInfo = false
|
|
76
76
|
let identity: null | {
|
|
@@ -565,7 +565,7 @@
|
|
|
565
565
|
<!-- Open status ################### -->
|
|
566
566
|
{:else}
|
|
567
567
|
<div
|
|
568
|
-
class="animate-show rounded-md bg-gradient-to-b px-8 py-8 shadow-[0_0px_30px_0px_rgba(0,0,0,0.6)] transition-all sm:w-96 from-{accent}-900 to-{accent}-700 {movingStyle}"
|
|
568
|
+
class="animate-show rounded-md bg-gradient-to-b px-8 py-8 shadow-[0_0px_30px_0px_rgba(0,0,0,0.6)] transition-all sm:w-96 bg-{accent}-800 from-{accent}-900 to-{accent}-700 {movingStyle}"
|
|
569
569
|
>
|
|
570
570
|
<button
|
|
571
571
|
on:click={showInfo ? handleCloseInfo : handleCloseModal}
|
package/tailwind.config.js
CHANGED
|
@@ -5,30 +5,107 @@ export default {
|
|
|
5
5
|
extend: {
|
|
6
6
|
animation: {
|
|
7
7
|
fadein: 'fadeIn 1s ease-in-out, moveIn 1s ease-in-out',
|
|
8
|
-
show: 'fadeIn 200ms ease-in-out'
|
|
8
|
+
show: 'fadeIn 200ms ease-in-out'
|
|
9
9
|
},
|
|
10
10
|
// that is actual animation
|
|
11
|
-
keyframes:
|
|
11
|
+
keyframes: _ => ({
|
|
12
12
|
fadeIn: {
|
|
13
|
-
'0%': {
|
|
14
|
-
'100%': {
|
|
13
|
+
'0%': {opacity: 0},
|
|
14
|
+
'100%': {opacity: 1}
|
|
15
15
|
},
|
|
16
16
|
moveIn: {
|
|
17
|
-
'0%': {
|
|
18
|
-
'100%': {
|
|
19
|
-
}
|
|
20
|
-
})
|
|
17
|
+
'0%': {transform: 'translateY(-10px)'},
|
|
18
|
+
'100%': {transform: 'translateY(0)'}
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
plugins: [],
|
|
24
24
|
prefix: '',
|
|
25
25
|
safelist: [
|
|
26
|
-
'bg-cyan-700',
|
|
27
|
-
'
|
|
28
|
-
'bg-
|
|
29
|
-
'
|
|
30
|
-
'bg-
|
|
31
|
-
'
|
|
32
|
-
'bg-
|
|
26
|
+
'bg-cyan-700',
|
|
27
|
+
'hover:bg-cyan-700',
|
|
28
|
+
'bg-cyan-800',
|
|
29
|
+
'hover:bg-cyan-800',
|
|
30
|
+
'bg-cyan-900',
|
|
31
|
+
'hover:bg-cyan-900',
|
|
32
|
+
'bg-cyan-950',
|
|
33
|
+
'hover:bg-cyan-950',
|
|
34
|
+
'text-cyan-600',
|
|
35
|
+
'outline-cyan-500',
|
|
36
|
+
'from-cyan-900',
|
|
37
|
+
'to-cyan-700',
|
|
38
|
+
'bg-green-700',
|
|
39
|
+
'hover:bg-green-700',
|
|
40
|
+
'bg-green-800',
|
|
41
|
+
'hover:bg-green-800',
|
|
42
|
+
'bg-green-900',
|
|
43
|
+
'hover:bg-green-900',
|
|
44
|
+
'bg-green-950',
|
|
45
|
+
'hover:bg-green-950',
|
|
46
|
+
'text-green-600',
|
|
47
|
+
'outline-green-500',
|
|
48
|
+
'from-green-900',
|
|
49
|
+
'to-green-700',
|
|
50
|
+
'bg-purple-700',
|
|
51
|
+
'hover:bg-purple-700',
|
|
52
|
+
'bg-purple-800',
|
|
53
|
+
'hover:bg-purple-800',
|
|
54
|
+
'bg-purple-900',
|
|
55
|
+
'hover:bg-purple-900',
|
|
56
|
+
'bg-purple-950',
|
|
57
|
+
'hover:bg-purple-950',
|
|
58
|
+
'text-purple-600',
|
|
59
|
+
'outline-purple-500',
|
|
60
|
+
'from-purple-900',
|
|
61
|
+
'to-purple-700',
|
|
62
|
+
'bg-red-700',
|
|
63
|
+
'hover:bg-red-700',
|
|
64
|
+
'bg-red-800',
|
|
65
|
+
'hover:bg-red-800',
|
|
66
|
+
'bg-red-900',
|
|
67
|
+
'hover:bg-red-900',
|
|
68
|
+
'bg-red-950',
|
|
69
|
+
'hover:bg-red-950',
|
|
70
|
+
'text-red-600',
|
|
71
|
+
'outline-red-500',
|
|
72
|
+
'from-red-900',
|
|
73
|
+
'to-red-700',
|
|
74
|
+
'bg-orange-700',
|
|
75
|
+
'hover:bg-orange-700',
|
|
76
|
+
'bg-orange-800',
|
|
77
|
+
'hover:bg-orange-800',
|
|
78
|
+
'bg-orange-900',
|
|
79
|
+
'hover:bg-orange-900',
|
|
80
|
+
'bg-orange-950',
|
|
81
|
+
'hover:bg-orange-950',
|
|
82
|
+
'text-orange-600',
|
|
83
|
+
'outline-orange-500',
|
|
84
|
+
'from-orange-900',
|
|
85
|
+
'to-orange-700',
|
|
86
|
+
'bg-neutral-700',
|
|
87
|
+
'hover:bg-neutral-700',
|
|
88
|
+
'bg-neutral-800',
|
|
89
|
+
'hover:bg-neutral-800',
|
|
90
|
+
'bg-neutral-900',
|
|
91
|
+
'hover:bg-neutral-900',
|
|
92
|
+
'bg-neutral-950',
|
|
93
|
+
'hover:bg-neutral-950',
|
|
94
|
+
'text-neutral-600',
|
|
95
|
+
'outline-neutral-500',
|
|
96
|
+
'from-neutral-900',
|
|
97
|
+
'to-neutral-700',
|
|
98
|
+
'bg-stone-700',
|
|
99
|
+
'hover:bg-stone-700',
|
|
100
|
+
'bg-stone-800',
|
|
101
|
+
'hover:bg-stone-800',
|
|
102
|
+
'bg-stone-900',
|
|
103
|
+
'hover:bg-stone-900',
|
|
104
|
+
'bg-stone-950',
|
|
105
|
+
'hover:bg-stone-950',
|
|
106
|
+
'text-stone-600',
|
|
107
|
+
'outline-stone-500',
|
|
108
|
+
'from-stone-900',
|
|
109
|
+
'to-stone-700'
|
|
33
110
|
]
|
|
34
111
|
}
|