diff --git a/package.json b/package.json index 5ad14ed..5832418 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,10 @@ "@rollup/plugin-commonjs": "^25.0.2", "@rollup/plugin-json": "^6.0.0", "@rollup/plugin-node-resolve": "^15.1.0", + "@tailwindcss/forms": "^0.5.3", "nostr": "^0.2.8", "nostr-tools": "^1.12.0", + "palettey": "^1.0.3", "rollup-plugin-css-only": "^4.3.0", "rollup-plugin-esformatter": "^3.0.0", "rollup-plugin-livereload": "^2.0.5", diff --git a/src/ConnectedWidget.svelte b/src/ConnectedWidget.svelte index 37b43af..b744f67 100644 --- a/src/ConnectedWidget.svelte +++ b/src/ConnectedWidget.svelte @@ -14,6 +14,7 @@ let responses = {}; let profiles = {}; + export let startPage; export let websiteOwnerPubkey; export let chatConfiguration; let prevChatConfiguration; @@ -344,7 +345,7 @@
{#if $selectedMessage} {#if !getEventById($selectedMessage)} @@ -383,7 +384,7 @@ class="overflow-auto overflow-x-hidden -mx-4 px-4 min-h-full h-full" > -
+
{#if $selectedMessage}
+ {/if} {#if !chatStarted} - + {:else}
- +
+ + {#if foundKeys} + + {#if showAdvanced == true} + + {/if} + {/if}
{/if}
diff --git a/src/Widget.svelte b/src/Widget.svelte index 689b8ea..bf9a6b9 100644 --- a/src/Widget.svelte +++ b/src/Widget.svelte @@ -1,6 +1,10 @@
- -
+ {#if simplifyNostrText !== "true"} + Nostri + {/if} + NostriChat + class={simplifyNostrText !== "true" ? "text-purple-300" : "text-white"} + >Chat - - - + + + {/if}
{#if showChat}
-
{/if}
@@ -85,6 +103,20 @@ @tailwind components; @tailwind utilities; + :root { + --nostri-chat-custom-accent-color-50: #faf5ff; + --nostri-chat-custom-accent-color-100: #f3e8ff; + --nostri-chat-custom-accent-color-200: #e9d5ff; + --nostri-chat-custom-accent-color-300: #d8b4fe; + --nostri-chat-custom-accent-color-400: #c084fc; + --nostri-chat-custom-accent-color-500: #a855f7; + --nostri-chat-custom-accent-color-600: #9333ea; + --nostri-chat-custom-accent-color-700: #7e22ce; + --nostri-chat-custom-accent-color-800: #6b21a8; + --nostri-chat-custom-accent-color-900: #581c87; + --nostri-chat-custom-accent-color-950: #3b0764; + } + #_chat-widget-container { z-index: 995; position: fixed; @@ -94,8 +126,8 @@ #_chat-popup { z-index: 996; - min-height: 600px; - max-height: 70vh; + min-height: 500px; + max-height: 72vh; transition: all 0.3s; overflow: hidden; } diff --git a/src/app.html b/src/app.html index bc4fe41..3a9d598 100644 --- a/src/app.html +++ b/src/app.html @@ -7,9 +7,7 @@ %sveltekit.head% - +
%sveltekit.body%
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 9c6cb15..418e897 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,376 +1,877 @@ - Nostri.chat / A NOSTR chat widget you control - - - + Nostri.chat / A NOSTR chat widget you control + + + -
-
-
-
-

Nostri.chat

- -

A chat widget for your site, powered by nostr

- -

- Simple, interoperable - communication with your visitors, in a way - that gives you and them complete ownership - over the data. -

-
-
- - -
-
- -
-
-
-
-

- Innovative modes -

- -

- Because we use Nostr for communicating, - Nostri.chat - can use some new, creative approaches to using chat widget, - depending on what you want to achieve. -

-
- -
-

- Classic mode - encrypted 1-on-1 chats -

- -

- Lorem ipsum dolor sit, amet consectetur adipisicing elit. Sapiente quae eveniet placeat, obcaecati nesciunt nam iure. Culpa omnis hic eaque illum alias iure autem atque? Distinctio facilis recusandae omnis expedita. -

- - {#if $chatAdapter} - {#if chatType === 'DM'} - - {:else} - - {/if} - {/if} -
- -
-

-
- 🫂 - - Public chat groups - public groups - -
-

- -

- Embed NIP-28 public chat groups on your site. -

- -
-
-

Group chat

- - - - - - -
-
- -

-
- 🔖 - - Tagged Global Chat - public discussion/support - -
-

- -

- Imagine having a global chat on your website about a certain topic. - Anyone can participate, from your website or from any Nostr client. -

- - -
-
-

🔖 Topic-based chats

- - - - - - -
- -
-

🌎 Website-based chats

- - - - - -
-
-
-
-
- -
-
-
- -
-

- Easy-peasy setup -

- -

- Just drop this snippet on your website and you're good to go. -

-
- -
Public group chat (GROUP)
-
-<script
-	src="https://nostri.chat/public/bundle.js"
-	data-chat-type="GROUP"
-	data-chat-id="<GROUP_ID_IN_HEX_FORMAT>"
-	data-relays="wss://relay.f7z.io,wss://nos.lol,wss://relay.nostr.band"
-></script>
-<link rel="stylesheet" href="https://nostri.chat/public/bundle.css">
- -
Public global notes (kind-1 short notes)
-
-<script
-src="https://nostri.chat/public/bundle.js"
-data-chat-type="GLOBAL"
-data-chat-tags="bitcoin"
-data-relays="wss://relay.f7z.io,wss://nos.lol,wss://relay.nostr.band"
-></script>
-<link rel="stylesheet" href="https://nostri.chat/public/bundle.css">
- -
Encrypted DMs
-
-<script
-src="https://nostri.chat/public/bundle.js"
-data-chat-type="DM"
-data-website-owner-pubkey="YOUR_PUBKEY_IN_HEX_FORMAT"
-data-relays="wss://relay.f7z.io,wss://nos.lol,wss://relay.nostr.band"
-></script>
-<link rel="stylesheet" href="https://nostri.chat/public/bundle.css">
-
-
-
- -
- +
+ + + +
+
+
+

Nostri.chat

+

A chat widget for your site, powered by nostr

+
+
+
+ + + +
+
+ + + +
+
+
+
+

Innovative modes

+

+ Because we use Nostr for communicating, Nostri.chat can use some + new, creative approaches to using chat widget, depending on what you + want to achieve. +

+

+ Click on the buttons below to try it out! +

+
+
+
+

+ 💬 Encrypted 1-on-1 +

+ + {#if chatType === "DM"} + + {:else} + + {/if} +
+
+

+ 🫂 Public groups +

+ + + + + +
+
+

+ 🔖 Topic-Based Chats +

+ + + + + +
+
+

+ 🌎 Website-Based Chats +

+ + + + + +
+
+
+
+
+ + + +
+
+
+
+

Easy-peasy setup

+

+ Configure with our easy configurator, add the snippet to your + website and you're good to go! +

+
+ + + + {#if stepper == 1} +
+
+ +
+ +
+
+
+ +
+ +
+
+ {#if type == 0} +
+ +
+ +
+
+ {/if} + {#if type == 1} +
+ +
+ +
+
+ {/if} + {#if type == 2} +
+ +
+ +
+
+ {/if} +
+ +
+
+ {#each newRelayList as relay, index} +
+
+
+ +
+
+ +
+
+
+ {/each} +
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ + +
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+ +
+
+ {:else if stepper == 2} +
+
+ +
+
+

+ Add this snippet to your website: +

+
+                        {theSnippet}
+                    
+ + {#if snippetActive === true} + + {:else} + + {/if} +
+
+ {/if} +
+
+
+ +
+ + + +
+ + +
+ + {#if nostriChatSimplified == !true} + Nostri + {/if} + Chat + + {#if hideNostrIcon == !true} + + + + {/if} +
+ {#if showChat} +
+ +
+ {/if}
- - \ No newline at end of file diff --git a/src/widget.js b/src/widget.js index e971427..93b9b14 100644 --- a/src/widget.js +++ b/src/widget.js @@ -8,6 +8,11 @@ let chatTags = script.getAttribute('data-chat-tags'); let chatId = script.getAttribute('data-chat-id'); let chatReferenceTags = script.getAttribute('data-chat-reference-tags'); let relays = script.getAttribute('data-relays'); +let startPage = script.getAttribute('data-start-page'); +let hideNostrIcon = script.getAttribute('data-hidenostricon'); +let simplifyNostrText = script.getAttribute('data-simplifynostrnext'); +let accentColor = script.getAttribute('data-accentcolor'); + script.parentNode.insertBefore(div, script); if (!relays) { @@ -17,10 +22,15 @@ if (!relays) { relays = relays.split(','); chatTags = chatTags ? chatTags.split(',') : []; chatReferenceTags = chatReferenceTags ? chatReferenceTags.split(',') : []; +accentColor = accentColor ? accentColor.split(',') : []; const embed = new Widget({ target: div, props: { + accentColor, + hideNostrIcon, + simplifyNostrText, + startPage, websiteOwnerPubkey, chatType, chatTags, diff --git a/static/demo b/static/demo index 6f5ab10..de462ab 100644 --- a/static/demo +++ b/static/demo @@ -3,21 +3,28 @@ Demo page -

Svelte embedding demo

-

Below,we have inserted a script tag that should +

Below, we have inserted a script tag that should renter a Svelte component upon loading this page.

+ + + src="/public/bundle.js" + data-chat-type="GLOBAL" + data-chat-tags="plebchain" + data-hidenostricon="false" + data-simplifynostrnext="false" + data-accentcolor="" + data-relays="wss://relay.f7z.io,wss://nos.lol,wss://relay.nostr.band,wss://relay.nostr.info,wss://nostr-pub.wellorder.net,wss://relay.current.fyi" + data-start-page="chat" +> + + +

This text will come after the embedded content.

diff --git a/static/public/bundle.css b/static/public/bundle.css index 75f4d92..dd0527c 100644 --- a/static/public/bundle.css +++ b/static/public/bundle.css @@ -1,5 +1,5 @@ -.svelte-bz3ser,.svelte-bz3ser::before,.svelte-bz3ser::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}.svelte-bz3ser::before,.svelte-bz3ser::after{--tw-content:''}h3.svelte-bz3ser{font-size:inherit;font-weight:inherit}button.svelte-bz3ser{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button.svelte-bz3ser{text-transform:none}button.svelte-bz3ser{-webkit-appearance:button;background-color:transparent;background-image:none}.svelte-bz3ser:-moz-focusring{outline:auto}.svelte-bz3ser:-moz-ui-invalid{box-shadow:none}.svelte-bz3ser::-webkit-inner-spin-button,.svelte-bz3ser::-webkit-outer-spin-button{height:auto}.svelte-bz3ser::-webkit-search-decoration{-webkit-appearance:none}.svelte-bz3ser::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}h3.svelte-bz3ser,p.svelte-bz3ser{margin:0}button.svelte-bz3ser{cursor:pointer}.svelte-bz3ser:disabled{cursor:default}svg.svelte-bz3ser{display:block;vertical-align:middle}.svelte-bz3ser,.svelte-bz3ser::before,.svelte-bz3ser::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 / 0.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: }.svelte-bz3ser::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 / 0.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: }@media(min-width: 640px){}@media(min-width: 768px){}@media(min-width: 1024px){}@media(min-width: 1280px){}@media(min-width: 1536px){}.m-0.svelte-bz3ser{margin:0px}.mb-3.svelte-bz3ser{margin-bottom:0.75rem}.flex.svelte-bz3ser{display:flex}.h-6.svelte-bz3ser{height:1.5rem}.w-6.svelte-bz3ser{width:1.5rem}.w-full.svelte-bz3ser{width:100%}.flex-1.svelte-bz3ser{flex:1 1 0%}.cursor-pointer.svelte-bz3ser{cursor:pointer}.flex-col.svelte-bz3ser{flex-direction:column}.items-center.svelte-bz3ser{align-items:center}.justify-between.svelte-bz3ser{justify-content:space-between}.gap-1.svelte-bz3ser{gap:0.25rem}.overflow-y-auto.svelte-bz3ser{overflow-y:auto}.rounded-xl.svelte-bz3ser{border-radius:0.75rem}.border-none.svelte-bz3ser{border-style:none}.bg-purple-700.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(126 34 206 / var(--tw-bg-opacity))}.bg-purple-800.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(107 33 168 / var(--tw-bg-opacity))}.bg-transparent.svelte-bz3ser{background-color:transparent}.bg-white.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.p-2.svelte-bz3ser{padding:0.5rem}.p-3.svelte-bz3ser{padding:0.75rem}.p-4.svelte-bz3ser{padding:1rem}.text-center.svelte-bz3ser{text-align:center}.text-lg.svelte-bz3ser{font-size:1.125rem;line-height:1.75rem}.text-xs.svelte-bz3ser{font-size:0.75rem;line-height:1rem}.font-bold.svelte-bz3ser{font-weight:700}.text-gray-200.svelte-bz3ser{--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity))}.text-gray-300.svelte-bz3ser{--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity))}.text-gray-400.svelte-bz3ser{--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-600.svelte-bz3ser{--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity))}.text-white.svelte-bz3ser{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity))}.hover\:bg-purple-700.svelte-bz3ser:hover{--tw-bg-opacity:1;background-color:rgb(126 34 206 / var(--tw-bg-opacity))}@media(prefers-color-scheme: dark){}@media(min-width: 768px){.md\:rounded-t-md.svelte-bz3ser{border-top-left-radius:0.375rem;border-top-right-radius:0.375rem}}@media(min-width: 1024px){}@media(min-width: 1280px){} -.svelte-bz3ser,.svelte-bz3ser::before,.svelte-bz3ser::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}.svelte-bz3ser::before,.svelte-bz3ser::after{--tw-content:''}a.svelte-bz3ser{color:inherit;text-decoration:inherit}button.svelte-bz3ser{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button.svelte-bz3ser{text-transform:none}button.svelte-bz3ser{-webkit-appearance:button;background-color:transparent;background-image:none}.svelte-bz3ser:-moz-focusring{outline:auto}.svelte-bz3ser:-moz-ui-invalid{box-shadow:none}.svelte-bz3ser::-webkit-inner-spin-button,.svelte-bz3ser::-webkit-outer-spin-button{height:auto}.svelte-bz3ser::-webkit-search-decoration{-webkit-appearance:none}.svelte-bz3ser::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}p.svelte-bz3ser{margin:0}button.svelte-bz3ser{cursor:pointer}.svelte-bz3ser:disabled{cursor:default}img.svelte-bz3ser{display:block;vertical-align:middle}img.svelte-bz3ser{max-width:100%;height:auto}.svelte-bz3ser,.svelte-bz3ser::before,.svelte-bz3ser::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 / 0.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: }.svelte-bz3ser::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 / 0.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: }@media(min-width: 640px){}@media(min-width: 768px){}@media(min-width: 1024px){}@media(min-width: 1280px){}@media(min-width: 1536px){}.absolute.svelte-bz3ser{position:absolute}.relative.svelte-bz3ser{position:relative}.z-10.svelte-bz3ser{z-index:10}.my-4.svelte-bz3ser{margin-top:1rem;margin-bottom:1rem}.mb-3.svelte-bz3ser{margin-bottom:0.75rem}.ml-5.svelte-bz3ser{margin-left:1.25rem}.mt-1.svelte-bz3ser{margin-top:0.25rem}.mt-10.svelte-bz3ser{margin-top:2.5rem}.block.svelte-bz3ser{display:block}.flex.svelte-bz3ser{display:flex}.h-12.svelte-bz3ser{height:3rem}.h-8.svelte-bz3ser{height:2rem}.max-h-64.svelte-bz3ser{max-height:16rem}.w-12.svelte-bz3ser{width:3rem}.w-8.svelte-bz3ser{width:2rem}.w-full.svelte-bz3ser{width:100%}.min-w-fit.svelte-bz3ser{min-width:-moz-fit-content;min-width:fit-content}.cursor-pointer.svelte-bz3ser{cursor:pointer}.flex-row.svelte-bz3ser{flex-direction:row}.flex-row-reverse.svelte-bz3ser{flex-direction:row-reverse}.flex-col.svelte-bz3ser{flex-direction:column}.items-center.svelte-bz3ser{align-items:center}.items-stretch.svelte-bz3ser{align-items:stretch}.justify-center.svelte-bz3ser{justify-content:center}.justify-between.svelte-bz3ser{justify-content:space-between}.gap-2.svelte-bz3ser{gap:0.5rem}.gap-3.svelte-bz3ser{gap:0.75rem}.gap-4.svelte-bz3ser{gap:1rem}.overflow-auto.svelte-bz3ser{overflow:auto}.overflow-hidden.svelte-bz3ser{overflow:hidden}.overflow-clip.svelte-bz3ser{overflow:clip}.text-ellipsis.svelte-bz3ser{text-overflow:ellipsis}.text-clip.svelte-bz3ser{text-overflow:clip}.whitespace-nowrap.svelte-bz3ser{white-space:nowrap}.rounded-2xl.svelte-bz3ser{border-radius:1rem}.rounded-full.svelte-bz3ser{border-radius:9999px}.rounded-t-xl.svelte-bz3ser{border-top-left-radius:0.75rem;border-top-right-radius:0.75rem}.border.svelte-bz3ser{border-width:1px}.border-2.svelte-bz3ser{border-width:2px}.border-l.svelte-bz3ser{border-left-width:1px}.border-gray-200.svelte-bz3ser{--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.border-slate-200.svelte-bz3ser{--tw-border-opacity:1;border-color:rgb(226 232 240 / var(--tw-border-opacity))}.border-l-gray-400.svelte-bz3ser{--tw-border-opacity:1;border-left-color:rgb(156 163 175 / var(--tw-border-opacity))}.bg-black.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-orange-500.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(249 115 22 / var(--tw-bg-opacity))}.bg-purple-700.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(126 34 206 / var(--tw-bg-opacity))}.bg-white.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.p-3.svelte-bz3ser{padding:0.75rem}.p-4.svelte-bz3ser{padding:1rem}.py-2.svelte-bz3ser{padding-top:0.5rem;padding-bottom:0.5rem}.pl-5.svelte-bz3ser{padding-left:1.25rem}.text-center.svelte-bz3ser{text-align:center}.text-base.svelte-bz3ser{font-size:1rem;line-height:1.5rem}.text-xl.svelte-bz3ser{font-size:1.25rem;line-height:1.75rem}.text-xs.svelte-bz3ser{font-size:0.75rem;line-height:1rem}.font-semibold.svelte-bz3ser{font-weight:600}.text-gray-400.svelte-bz3ser{--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-900.svelte-bz3ser{--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity))}.text-orange-500.svelte-bz3ser{--tw-text-opacity:1;color:rgb(249 115 22 / var(--tw-text-opacity))}.text-purple-500.svelte-bz3ser{--tw-text-opacity:1;color:rgb(168 85 247 / var(--tw-text-opacity))}.text-white.svelte-bz3ser{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity))}.opacity-10.svelte-bz3ser{opacity:0.1}.opacity-100.svelte-bz3ser{opacity:1}.shadow-sm.svelte-bz3ser{--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.ring-4.svelte-bz3ser{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.ring-purple-700.svelte-bz3ser{--tw-ring-opacity:1;--tw-ring-color:rgb(126 34 206 / var(--tw-ring-opacity))}.drop-shadow-xl.svelte-bz3ser{--tw-drop-shadow:drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\:bg-orange-500.svelte-bz3ser:hover{--tw-bg-opacity:1;background-color:rgb(249 115 22 / var(--tw-bg-opacity))}.hover\:bg-slate-100.svelte-bz3ser:hover{--tw-bg-opacity:1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.hover\:opacity-100.svelte-bz3ser:hover{opacity:1}@media(prefers-color-scheme: dark){}@media(min-width: 768px){}@media(min-width: 1024px){}@media(min-width: 1280px){} -.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser,.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser::before,.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser::before,.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser::after{--tw-content:''}h1.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser,h3.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-size:inherit;font-weight:inherit}b.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-weight:bolder}button.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser,input.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{text-transform:none}button.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{-webkit-appearance:button;background-color:transparent;background-image:none}.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser:-moz-focusring{outline:auto}.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser:-moz-ui-invalid{box-shadow:none}.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser::-webkit-inner-spin-button,.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser::-webkit-outer-spin-button{height:auto}.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser::-webkit-search-decoration{-webkit-appearance:none}.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}h1.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser,h3.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin:0}input.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser::-moz-placeholder{opacity:1;color:#9ca3af}input.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser::placeholder{opacity:1;color:#9ca3af}button.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{cursor:pointer}.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser:disabled{cursor:default}img.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser,svg.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{display:block;vertical-align:middle}img.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{max-width:100%;height:auto}.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser,.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser::before,.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser::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 / 0.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: }.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser::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 / 0.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: }.container.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{width:100%}@media(min-width: 640px){.container.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{max-width:640px}}@media(min-width: 768px){.container.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{max-width:768px}}@media(min-width: 1024px){.container.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{max-width:1024px}}@media(min-width: 1280px){.container.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{max-width:1280px}}@media(min-width: 1536px){.container.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{max-width:1536px}}.fixed.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{position:fixed}.absolute.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{position:absolute}.relative.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{position:relative}.sticky.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{position:sticky}.bottom-0.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{bottom:0px}.bottom-20.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{bottom:5rem}.right-0.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{right:0px}.z-10.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{z-index:10}.m-0.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin:0px}.-mx-1.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-left:-0.25rem;margin-right:-0.25rem}.-mx-4.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-left:-1rem;margin-right:-1rem}.mx-auto.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-left:auto;margin-right:auto}.my-2.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-top:0.5rem;margin-bottom:0.5rem}.my-4.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-top:1rem;margin-bottom:1rem}.my-5.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-top:1.25rem;margin-bottom:1.25rem}.-mb-2.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-bottom:-0.5rem}.-mt-3.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-top:-0.75rem}.mb-3.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-bottom:0.75rem}.mb-5.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-bottom:1.25rem}.mb-6.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-bottom:1.5rem}.ml-2.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-left:0.5rem}.ml-4.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-left:1rem}.ml-5.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-left:1.25rem}.ml-auto.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-left:auto}.mr-0.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-right:0px}.mr-2.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-right:0.5rem}.mt-1.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-top:0.25rem}.mt-10.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-top:2.5rem}.mt-12.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-top:3rem}.mt-2.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{margin-top:0.5rem}.block.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{display:block}.inline-block.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{display:inline-block}.flex.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{display:flex}.inline-flex.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{display:inline-flex}.grid.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{display:grid}.hidden.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{display:none}.h-12.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{height:3rem}.h-2.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{height:0.5rem}.h-6.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{height:1.5rem}.h-8.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{height:2rem}.h-full.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{height:100%}.max-h-64.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{max-height:16rem}.max-h-\[40px\].svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{max-height:40px}.min-h-\[384px\].svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{min-height:384px}.min-h-\[40px\].svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{min-height:40px}.min-h-full.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{min-height:100%}.min-h-screen.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{min-height:100vh}.w-12.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{width:3rem}.w-2.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{width:0.5rem}.w-3\/4.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{width:75%}.w-6.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{width:1.5rem}.w-8.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{width:2rem}.w-96.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{width:24rem}.w-fit.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{width:-moz-fit-content;width:fit-content}.w-full.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{width:100%}.min-w-fit.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{min-width:-moz-fit-content;min-width:fit-content}.max-w-prose.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{max-width:65ch}.max-w-screen-sm.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{max-width:640px}.flex-1.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{flex:1 1 0%}.rotate-90.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-rotate:90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{cursor:pointer}.resize-none.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{resize:none}.grid-cols-1.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{grid-template-columns:repeat(1, minmax(0, 1fr))}.flex-row.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{flex-direction:row}.flex-row-reverse.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{flex-direction:row-reverse}.flex-col.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{flex-direction:column}.items-end.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{align-items:flex-end}.items-center.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{align-items:center}.items-stretch.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{align-items:stretch}.justify-end.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{justify-content:flex-end}.justify-center.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{justify-content:center}.justify-between.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{justify-content:space-between}.gap-1.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{gap:0.25rem}.gap-10.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{gap:2.5rem}.gap-2.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{gap:0.5rem}.gap-20.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{gap:5rem}.gap-3.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{gap:0.75rem}.gap-4.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{gap:1rem}.gap-8.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{gap:2rem}.space-x-4.svelte-bz3ser>.svelte-bz3ser:not([hidden])~.svelte-bz3ser:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.overflow-auto.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{overflow:auto}.overflow-hidden.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{overflow:hidden}.overflow-clip.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{overflow:clip}.overflow-y-auto.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{overflow-y:auto}.overflow-x-hidden.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{overflow-x:hidden}.overflow-y-hidden.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{overflow-y:hidden}.truncate.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{text-overflow:ellipsis}.text-clip.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{text-overflow:clip}.whitespace-nowrap.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{white-space:nowrap}.rounded.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{border-radius:0.25rem}.rounded-2xl.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{border-radius:1rem}.rounded-full.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{border-radius:9999px}.rounded-lg.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{border-radius:0.5rem}.rounded-md.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{border-radius:0.375rem}.rounded-xl.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{border-radius:0.75rem}.rounded-l-md.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{border-top-left-radius:0.375rem;border-bottom-left-radius:0.375rem}.rounded-r-md.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{border-top-right-radius:0.375rem;border-bottom-right-radius:0.375rem}.rounded-t-xl.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{border-top-left-radius:0.75rem;border-top-right-radius:0.75rem}.border.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{border-width:1px}.border-2.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{border-width:2px}.border-y.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{border-top-width:1px;border-bottom-width:1px}.border-l.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{border-left-width:1px}.border-t.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{border-top-width:1px}.border-none.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{border-style:none}.border-gray-200.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.border-gray-300.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.border-orange-700.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-border-opacity:1;border-color:rgb(194 65 12 / var(--tw-border-opacity))}.border-orange-900.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-border-opacity:1;border-color:rgb(124 45 18 / var(--tw-border-opacity))}.border-slate-200.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-border-opacity:1;border-color:rgb(226 232 240 / var(--tw-border-opacity))}.border-transparent.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{border-color:transparent}.border-y-slate-200.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-border-opacity:1;border-top-color:rgb(226 232 240 / var(--tw-border-opacity));border-bottom-color:rgb(226 232 240 / var(--tw-border-opacity))}.border-l-gray-400.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-border-opacity:1;border-left-color:rgb(156 163 175 / var(--tw-border-opacity))}.bg-black.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-gray-100\/90.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{background-color:rgb(243 244 246 / 0.9)}.bg-gray-300.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(209 213 219 / var(--tw-bg-opacity))}.bg-green-500.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(34 197 94 / var(--tw-bg-opacity))}.bg-orange-500.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(249 115 22 / var(--tw-bg-opacity))}.bg-orange-700.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(194 65 12 / var(--tw-bg-opacity))}.bg-orange-900.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(124 45 18 / var(--tw-bg-opacity))}.bg-purple-700.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(126 34 206 / var(--tw-bg-opacity))}.bg-purple-800.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(107 33 168 / var(--tw-bg-opacity))}.bg-purple-900.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(88 28 135 / var(--tw-bg-opacity))}.bg-slate-100.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.bg-transparent.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{background-color:transparent}.bg-white.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-zinc-300.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(212 212 216 / var(--tw-bg-opacity))}.bg-gradient-to-b.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{background-image:linear-gradient(to bottom, var(--tw-gradient-stops))}.from-orange-500.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-gradient-from:#f97316 var(--tw-gradient-from-position);--tw-gradient-to:rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from), var(--tw-gradient-to)}.to-orange-800.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-gradient-to:#9a3412 var(--tw-gradient-to-position)}.p-0.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{padding:0px}.p-2.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{padding:0.5rem}.p-3.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{padding:0.75rem}.p-4.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{padding:1rem}.px-10.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{padding-left:2.5rem;padding-right:2.5rem}.px-2.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{padding-left:0.5rem;padding-right:0.5rem}.px-4.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{padding-left:1rem;padding-right:1rem}.py-2.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{padding-top:0.5rem;padding-bottom:0.5rem}.py-4.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{padding-top:1rem;padding-bottom:1rem}.py-5.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{padding-top:1.25rem;padding-bottom:1.25rem}.py-6.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{padding-top:1.5rem;padding-bottom:1.5rem}.pl-5.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{padding-left:1.25rem}.text-center.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{text-align:center}.text-justify.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{text-align:justify}.font-mono.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace}.font-sans.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-family:ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"}.text-2xl.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-size:1.5rem;line-height:2rem}.text-3xl.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-size:1.875rem;line-height:2.25rem}.text-6xl.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-size:3.75rem;line-height:1}.text-7xl.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-size:4.5rem;line-height:1}.text-base.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-size:1rem;line-height:1.5rem}.text-lg.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-size:1.125rem;line-height:1.75rem}.text-sm.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-size:0.875rem;line-height:1.25rem}.text-xl.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-size:1.25rem;line-height:1.75rem}.text-xs.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-size:0.75rem;line-height:1rem}.font-black.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-weight:900}.font-bold.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-weight:700}.font-extrabold.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-weight:800}.font-extralight.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-weight:200}.font-light.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-weight:300}.font-medium.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-weight:500}.font-normal.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-weight:400}.font-semibold.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-weight:600}.leading-8.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{line-height:2rem}.leading-9.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{line-height:2.25rem}.tracking-wide.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{letter-spacing:0.025em}.tracking-wider.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{letter-spacing:0.05em}.text-black.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-text-opacity:1;color:rgb(0 0 0 / var(--tw-text-opacity))}.text-gray-200.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity))}.text-gray-300.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity))}.text-gray-400.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-500.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity))}.text-gray-600.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity))}.text-gray-700.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity))}.text-gray-900.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity))}.text-orange-500.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-text-opacity:1;color:rgb(249 115 22 / var(--tw-text-opacity))}.text-orange-600.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-text-opacity:1;color:rgb(234 88 12 / var(--tw-text-opacity))}.text-orange-700.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-text-opacity:1;color:rgb(194 65 12 / var(--tw-text-opacity))}.text-purple-300.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-text-opacity:1;color:rgb(216 180 254 / var(--tw-text-opacity))}.text-purple-50.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-text-opacity:1;color:rgb(250 245 255 / var(--tw-text-opacity))}.text-purple-500.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-text-opacity:1;color:rgb(168 85 247 / var(--tw-text-opacity))}.text-slate-500.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-text-opacity:1;color:rgb(100 116 139 / var(--tw-text-opacity))}.text-white.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity))}.text-zinc-800.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-text-opacity:1;color:rgb(39 39 42 / var(--tw-text-opacity))}.opacity-10.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{opacity:0.1}.opacity-100.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{opacity:1}.opacity-50.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{opacity:0.5}.shadow-2xl.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-shadow:0 25px 50px -12px rgb(0 0 0 / 0.25);--tw-shadow-colored:0 25px 50px -12px 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-md.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px 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-sm.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 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.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{outline:2px solid transparent;outline-offset:2px}.ring-4.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.ring-indigo-500.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-ring-opacity:1;--tw-ring-color:rgb(99 102 241 / var(--tw-ring-opacity))}.ring-purple-700.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-ring-opacity:1;--tw-ring-color:rgb(126 34 206 / var(--tw-ring-opacity))}.drop-shadow-xl.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-drop-shadow:drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-backdrop-blur:blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.transition-all.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.hover\:bg-orange-500.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser:hover{--tw-bg-opacity:1;background-color:rgb(249 115 22 / var(--tw-bg-opacity))}.hover\:bg-purple-600.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser:hover{--tw-bg-opacity:1;background-color:rgb(147 51 234 / var(--tw-bg-opacity))}.hover\:bg-purple-700.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser:hover{--tw-bg-opacity:1;background-color:rgb(126 34 206 / var(--tw-bg-opacity))}.hover\:bg-slate-100.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser:hover{--tw-bg-opacity:1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.hover\:text-orange-400.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser:hover{--tw-text-opacity:1;color:rgb(251 146 60 / var(--tw-text-opacity))}.hover\:opacity-100.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser:hover{opacity:1}.focus\:outline-none.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.focus\:ring-purple-500.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(168 85 247 / var(--tw-ring-opacity))}.focus\:ring-offset-2.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser:focus{--tw-ring-offset-width:2px}@media(prefers-color-scheme: dark){.dark\:bg-black.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{--tw-bg-opacity:1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}}@media(min-width: 768px){.md\:flex.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{display:flex}.md\:hidden.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{display:none}.md\:w-4\/5.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{width:80%}.md\:w-5\/12.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{width:41.666667%}.md\:w-7\/12.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{width:58.333333%}.md\:flex-row.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{flex-direction:row}.md\:overflow-y-auto.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{overflow-y:auto}.md\:rounded-t-md.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{border-top-left-radius:0.375rem;border-top-right-radius:0.375rem}}@media(min-width: 1024px){.lg\:min-h-screen.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{min-height:100vh}.lg\:w-1\/2.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{width:50%}.lg\:w-3\/5.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{width:60%}.lg\:w-full.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{width:100%}.lg\:max-w-7xl.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{max-width:80rem}.lg\:flex-row.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{flex-direction:row}.lg\:px-0.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{padding-left:0px;padding-right:0px}.lg\:py-16.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{padding-top:4rem;padding-bottom:4rem}.lg\:text-4xl.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-size:2.25rem;line-height:2.5rem}.lg\:text-7xl.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{font-size:4.5rem;line-height:1}}@media(min-width: 1280px){.xl\:py-10.svelte-bz3ser.svelte-bz3ser.svelte-bz3ser{padding-top:2.5rem;padding-bottom:2.5rem}} -@media(min-width: 640px){}@media(min-width: 768px){}@media(min-width: 1024px){}@media(min-width: 1280px){}@media(min-width: 1536px){}@media(prefers-color-scheme: dark){}@media(min-width: 768px){}@media(min-width: 1024px){}@media(min-width: 1280px){} -.svelte-faqvv7,.svelte-faqvv7::before,.svelte-faqvv7::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}.svelte-faqvv7::before,.svelte-faqvv7::after{--tw-content:''}.svelte-faqvv7:-moz-focusring{outline:auto}.svelte-faqvv7:-moz-ui-invalid{box-shadow:none}.svelte-faqvv7::-webkit-inner-spin-button,.svelte-faqvv7::-webkit-outer-spin-button{height:auto}.svelte-faqvv7::-webkit-search-decoration{-webkit-appearance:none}.svelte-faqvv7::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}.svelte-faqvv7:disabled{cursor:default}svg.svelte-faqvv7{display:block;vertical-align:middle}.svelte-faqvv7,.svelte-faqvv7::before,.svelte-faqvv7::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 / 0.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: }.svelte-faqvv7::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 / 0.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: }@media(min-width: 640px){}@media(min-width: 768px){}@media(min-width: 1024px){}@media(min-width: 1280px){}@media(min-width: 1536px){}.absolute.svelte-faqvv7{position:absolute}.bottom-20.svelte-faqvv7{bottom:5rem}.right-0.svelte-faqvv7{right:0px}.flex.svelte-faqvv7{display:flex}.hidden.svelte-faqvv7{display:none}.w-96.svelte-faqvv7{width:24rem}.w-full.svelte-faqvv7{width:100%}.cursor-pointer.svelte-faqvv7{cursor:pointer}.flex-row.svelte-faqvv7{flex-direction:row}.flex-col.svelte-faqvv7{flex-direction:column}.items-center.svelte-faqvv7{align-items:center}.gap-4.svelte-faqvv7{gap:1rem}.rounded-full.svelte-faqvv7{border-radius:9999px}.rounded-md.svelte-faqvv7{border-radius:0.375rem}.bg-purple-900.svelte-faqvv7{--tw-bg-opacity:1;background-color:rgb(88 28 135 / var(--tw-bg-opacity))}.bg-white.svelte-faqvv7{--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.p-4.svelte-faqvv7{padding:1rem}.text-center.svelte-faqvv7{text-align:center}.font-sans.svelte-faqvv7{font-family:ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"}.text-sm.svelte-faqvv7{font-size:0.875rem;line-height:1.25rem}.font-semibold.svelte-faqvv7{font-weight:600}.tracking-wider.svelte-faqvv7{letter-spacing:0.05em}.text-purple-300.svelte-faqvv7{--tw-text-opacity:1;color:rgb(216 180 254 / var(--tw-text-opacity))}.text-white.svelte-faqvv7{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity))}.shadow-md.svelte-faqvv7{--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.transition-all.svelte-faqvv7{transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}#_chat-widget-container.svelte-faqvv7{z-index:995;position:fixed;bottom:20px;right:20px}#_chat-popup.svelte-faqvv7{z-index:996;min-height:600px;max-height:70vh;transition:all 0.3s;overflow:hidden}@media(max-width: 768px){#_chat-popup.svelte-faqvv7{position:fixed;top:0;right:0;bottom:0;left:0;width:100%;height:100%;max-height:100%;border-radius:0}}.hover\:bg-purple-700.svelte-faqvv7:hover{--tw-bg-opacity:1;background-color:rgb(126 34 206 / var(--tw-bg-opacity))}@media(prefers-color-scheme: dark){}@media(min-width: 768px){}@media(min-width: 1024px){}@media(min-width: 1280px){} +.svelte-cpjycc,.svelte-cpjycc::before,.svelte-cpjycc::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}.svelte-cpjycc::before,.svelte-cpjycc::after{--tw-content:''}h3.svelte-cpjycc{font-size:inherit;font-weight:inherit}button.svelte-cpjycc{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button.svelte-cpjycc{text-transform:none}button.svelte-cpjycc{-webkit-appearance:button;background-color:transparent;background-image:none}.svelte-cpjycc:-moz-focusring{outline:auto}.svelte-cpjycc:-moz-ui-invalid{box-shadow:none}.svelte-cpjycc::-webkit-inner-spin-button,.svelte-cpjycc::-webkit-outer-spin-button{height:auto}.svelte-cpjycc::-webkit-search-decoration{-webkit-appearance:none}.svelte-cpjycc::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}h3.svelte-cpjycc,p.svelte-cpjycc{margin:0}button.svelte-cpjycc{cursor:pointer}.svelte-cpjycc:disabled{cursor:default}svg.svelte-cpjycc{display:block;vertical-align:middle}.svelte-cpjycc::-webkit-datetime-edit-fields-wrapper{padding:0}.svelte-cpjycc::-webkit-date-and-time-value{min-height:1.5em}.svelte-cpjycc::-webkit-datetime-edit,.svelte-cpjycc::-webkit-datetime-edit-year-field,.svelte-cpjycc::-webkit-datetime-edit-month-field,.svelte-cpjycc::-webkit-datetime-edit-day-field,.svelte-cpjycc::-webkit-datetime-edit-hour-field,.svelte-cpjycc::-webkit-datetime-edit-minute-field,.svelte-cpjycc::-webkit-datetime-edit-second-field,.svelte-cpjycc::-webkit-datetime-edit-millisecond-field,.svelte-cpjycc::-webkit-datetime-edit-meridiem-field{padding-top:0;padding-bottom:0}.svelte-cpjycc,.svelte-cpjycc::before,.svelte-cpjycc::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 / 0.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: }.svelte-cpjycc::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 / 0.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: }@media(min-width: 640px){}@media(min-width: 768px){}@media(min-width: 1024px){}@media(min-width: 1280px){}@media(min-width: 1536px){}.m-0.svelte-cpjycc{margin:0px}.my-4.svelte-cpjycc{margin-top:1rem;margin-bottom:1rem}.mb-3.svelte-cpjycc{margin-bottom:0.75rem}.flex.svelte-cpjycc{display:flex}.h-6.svelte-cpjycc{height:1.5rem}.w-6.svelte-cpjycc{width:1.5rem}.w-full.svelte-cpjycc{width:100%}.flex-1.svelte-cpjycc{flex:1 1 0%}@keyframes svelte-cpjycc-bounce{0%,100%{transform:translateY(-25%);animation-timing-function:cubic-bezier(0.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,0.2,1)}}.cursor-pointer.svelte-cpjycc{cursor:pointer}.flex-col.svelte-cpjycc{flex-direction:column}.items-center.svelte-cpjycc{align-items:center}.justify-between.svelte-cpjycc{justify-content:space-between}.gap-1.svelte-cpjycc{gap:0.25rem}.overflow-y-auto.svelte-cpjycc{overflow-y:auto}.rounded-xl.svelte-cpjycc{border-radius:0.75rem}.border-none.svelte-cpjycc{border-style:none}.bg-purple-700.svelte-cpjycc{background-color:var(--nostri-chat-custom-accent-color-700)}.bg-purple-800.svelte-cpjycc{background-color:var(--nostri-chat-custom-accent-color-800)}.bg-red-700.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(185 28 28 / var(--tw-bg-opacity))}.bg-transparent.svelte-cpjycc{background-color:transparent}.bg-white.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.p-2.svelte-cpjycc{padding:0.5rem}.p-3.svelte-cpjycc{padding:0.75rem}.p-4.svelte-cpjycc{padding:1rem}.text-center.svelte-cpjycc{text-align:center}.text-lg.svelte-cpjycc{font-size:1.125rem;line-height:1.75rem}.text-xs.svelte-cpjycc{font-size:0.75rem;line-height:1rem}.font-bold.svelte-cpjycc{font-weight:700}.text-gray-200.svelte-cpjycc{--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity))}.text-gray-300.svelte-cpjycc{--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity))}.text-gray-400.svelte-cpjycc{--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-600.svelte-cpjycc{--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity))}.text-purple-700.svelte-cpjycc{color:var(--nostri-chat-custom-accent-color-700)}.text-white.svelte-cpjycc{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity))}.hover\:bg-purple-700.svelte-cpjycc:hover{background-color:var(--nostri-chat-custom-accent-color-700)}.hover\:bg-red-600.svelte-cpjycc:hover{--tw-bg-opacity:1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.hover\:underline.svelte-cpjycc:hover{text-decoration-line:underline}@media(prefers-color-scheme: dark){}@media(min-width: 640px){}@media(min-width: 768px){.md\:rounded-t-md.svelte-cpjycc{border-top-left-radius:0.375rem;border-top-right-radius:0.375rem}}@media(min-width: 1024px){}@media(min-width: 1280px){} +.svelte-cpjycc,.svelte-cpjycc::before,.svelte-cpjycc::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}.svelte-cpjycc::before,.svelte-cpjycc::after{--tw-content:''}a.svelte-cpjycc{color:inherit;text-decoration:inherit}button.svelte-cpjycc{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button.svelte-cpjycc{text-transform:none}button.svelte-cpjycc{-webkit-appearance:button;background-color:transparent;background-image:none}.svelte-cpjycc:-moz-focusring{outline:auto}.svelte-cpjycc:-moz-ui-invalid{box-shadow:none}.svelte-cpjycc::-webkit-inner-spin-button,.svelte-cpjycc::-webkit-outer-spin-button{height:auto}.svelte-cpjycc::-webkit-search-decoration{-webkit-appearance:none}.svelte-cpjycc::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}p.svelte-cpjycc{margin:0}button.svelte-cpjycc{cursor:pointer}.svelte-cpjycc:disabled{cursor:default}img.svelte-cpjycc{display:block;vertical-align:middle}img.svelte-cpjycc{max-width:100%;height:auto}.svelte-cpjycc::-webkit-datetime-edit-fields-wrapper{padding:0}.svelte-cpjycc::-webkit-date-and-time-value{min-height:1.5em}.svelte-cpjycc::-webkit-datetime-edit,.svelte-cpjycc::-webkit-datetime-edit-year-field,.svelte-cpjycc::-webkit-datetime-edit-month-field,.svelte-cpjycc::-webkit-datetime-edit-day-field,.svelte-cpjycc::-webkit-datetime-edit-hour-field,.svelte-cpjycc::-webkit-datetime-edit-minute-field,.svelte-cpjycc::-webkit-datetime-edit-second-field,.svelte-cpjycc::-webkit-datetime-edit-millisecond-field,.svelte-cpjycc::-webkit-datetime-edit-meridiem-field{padding-top:0;padding-bottom:0}.svelte-cpjycc,.svelte-cpjycc::before,.svelte-cpjycc::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 / 0.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: }.svelte-cpjycc::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 / 0.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: }@media(min-width: 640px){}@media(min-width: 768px){}@media(min-width: 1024px){}@media(min-width: 1280px){}@media(min-width: 1536px){}.absolute.svelte-cpjycc{position:absolute}.relative.svelte-cpjycc{position:relative}.z-10.svelte-cpjycc{z-index:10}.my-4.svelte-cpjycc{margin-top:1rem;margin-bottom:1rem}.mb-3.svelte-cpjycc{margin-bottom:0.75rem}.ml-5.svelte-cpjycc{margin-left:1.25rem}.mt-1.svelte-cpjycc{margin-top:0.25rem}.mt-10.svelte-cpjycc{margin-top:2.5rem}.block.svelte-cpjycc{display:block}.flex.svelte-cpjycc{display:flex}.h-12.svelte-cpjycc{height:3rem}.h-8.svelte-cpjycc{height:2rem}.max-h-64.svelte-cpjycc{max-height:16rem}.w-12.svelte-cpjycc{width:3rem}.w-8.svelte-cpjycc{width:2rem}.w-full.svelte-cpjycc{width:100%}.min-w-fit.svelte-cpjycc{min-width:-moz-fit-content;min-width:fit-content}@keyframes svelte-cpjycc-bounce{0%,100%{transform:translateY(-25%);animation-timing-function:cubic-bezier(0.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,0.2,1)}}.cursor-pointer.svelte-cpjycc{cursor:pointer}.flex-row.svelte-cpjycc{flex-direction:row}.flex-row-reverse.svelte-cpjycc{flex-direction:row-reverse}.flex-col.svelte-cpjycc{flex-direction:column}.items-center.svelte-cpjycc{align-items:center}.items-stretch.svelte-cpjycc{align-items:stretch}.justify-center.svelte-cpjycc{justify-content:center}.justify-between.svelte-cpjycc{justify-content:space-between}.gap-2.svelte-cpjycc{gap:0.5rem}.gap-3.svelte-cpjycc{gap:0.75rem}.gap-4.svelte-cpjycc{gap:1rem}.overflow-auto.svelte-cpjycc{overflow:auto}.overflow-hidden.svelte-cpjycc{overflow:hidden}.overflow-clip.svelte-cpjycc{overflow:clip}.text-ellipsis.svelte-cpjycc{text-overflow:ellipsis}.text-clip.svelte-cpjycc{text-overflow:clip}.whitespace-nowrap.svelte-cpjycc{white-space:nowrap}.rounded-2xl.svelte-cpjycc{border-radius:1rem}.rounded-full.svelte-cpjycc{border-radius:9999px}.rounded-t-xl.svelte-cpjycc{border-top-left-radius:0.75rem;border-top-right-radius:0.75rem}.border.svelte-cpjycc{border-width:1px}.border-2.svelte-cpjycc{border-width:2px}.border-l.svelte-cpjycc{border-left-width:1px}.border-gray-200.svelte-cpjycc{--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.border-slate-200.svelte-cpjycc{--tw-border-opacity:1;border-color:rgb(226 232 240 / var(--tw-border-opacity))}.border-l-gray-400.svelte-cpjycc{--tw-border-opacity:1;border-left-color:rgb(156 163 175 / var(--tw-border-opacity))}.bg-black.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-orange-500.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(249 115 22 / var(--tw-bg-opacity))}.bg-purple-700.svelte-cpjycc{background-color:var(--nostri-chat-custom-accent-color-700)}.bg-white.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.p-3.svelte-cpjycc{padding:0.75rem}.p-4.svelte-cpjycc{padding:1rem}.py-2.svelte-cpjycc{padding-top:0.5rem;padding-bottom:0.5rem}.pl-5.svelte-cpjycc{padding-left:1.25rem}.text-center.svelte-cpjycc{text-align:center}.text-base.svelte-cpjycc{font-size:1rem;line-height:1.5rem}.text-xl.svelte-cpjycc{font-size:1.25rem;line-height:1.75rem}.text-xs.svelte-cpjycc{font-size:0.75rem;line-height:1rem}.font-semibold.svelte-cpjycc{font-weight:600}.text-gray-400.svelte-cpjycc{--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-900.svelte-cpjycc{--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity))}.text-orange-500.svelte-cpjycc{--tw-text-opacity:1;color:rgb(249 115 22 / var(--tw-text-opacity))}.text-purple-500.svelte-cpjycc{color:var(--nostri-chat-custom-accent-color-500)}.text-white.svelte-cpjycc{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity))}.opacity-10.svelte-cpjycc{opacity:0.1}.opacity-100.svelte-cpjycc{opacity:1}.shadow-sm.svelte-cpjycc{--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.ring-4.svelte-cpjycc{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.ring-purple-700.svelte-cpjycc{--tw-ring-color:var(--nostri-chat-custom-accent-color-700)}.drop-shadow-xl.svelte-cpjycc{--tw-drop-shadow:drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\:bg-orange-500.svelte-cpjycc:hover{--tw-bg-opacity:1;background-color:rgb(249 115 22 / var(--tw-bg-opacity))}.hover\:bg-slate-100.svelte-cpjycc:hover{--tw-bg-opacity:1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.hover\:opacity-100.svelte-cpjycc:hover{opacity:1}@media(prefers-color-scheme: dark){}@media(min-width: 640px){}@media(min-width: 768px){}@media(min-width: 1024px){}@media(min-width: 1280px){} +.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc,.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::before,.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::before,.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::after{--tw-content:''}h1.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc,h3.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-size:inherit;font-weight:inherit}b.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-weight:bolder}button.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc,input.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{text-transform:none}button.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{-webkit-appearance:button;background-color:transparent;background-image:none}.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:-moz-focusring{outline:auto}.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:-moz-ui-invalid{box-shadow:none}.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::-webkit-inner-spin-button,.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::-webkit-outer-spin-button{height:auto}.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::-webkit-search-decoration{-webkit-appearance:none}.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}h1.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc,h3.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin:0}input.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::-moz-placeholder{opacity:1;color:#9ca3af}input.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::placeholder{opacity:1;color:#9ca3af}button.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{cursor:pointer}.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:disabled{cursor:default}img.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc,svg.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{display:block;vertical-align:middle}img.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{max-width:100%;height:auto}[type='text'].svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#6b7280;border-width:1px;border-radius:0px;padding-top:0.5rem;padding-right:0.75rem;padding-bottom:0.5rem;padding-left:0.75rem;font-size:1rem;line-height:1.5rem;--tw-shadow:0 0 #0000}[type='text'].svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-inset:var(--tw-empty,/*!*/ /*!*/);--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#2563eb;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);border-color:#2563eb}input.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::-moz-placeholder{color:#6b7280;opacity:1}input.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::placeholder{color:#6b7280;opacity:1}.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::-webkit-datetime-edit-fields-wrapper{padding:0}.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::-webkit-date-and-time-value{min-height:1.5em}.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::-webkit-datetime-edit,.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::-webkit-datetime-edit-year-field,.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::-webkit-datetime-edit-month-field,.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::-webkit-datetime-edit-day-field,.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::-webkit-datetime-edit-hour-field,.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::-webkit-datetime-edit-minute-field,.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::-webkit-datetime-edit-second-field,.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::-webkit-datetime-edit-millisecond-field,.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::-webkit-datetime-edit-meridiem-field{padding-top:0;padding-bottom:0}.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc,.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::before,.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::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 / 0.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: }.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc::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 / 0.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: }.container.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{width:100%}@media(min-width: 640px){.container.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{max-width:640px}}@media(min-width: 768px){.container.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{max-width:768px}}@media(min-width: 1024px){.container.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{max-width:1024px}}@media(min-width: 1280px){.container.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{max-width:1280px}}@media(min-width: 1536px){.container.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{max-width:1536px}}.fixed.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{position:fixed}.absolute.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{position:absolute}.relative.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{position:relative}.sticky.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{position:sticky}.bottom-0.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{bottom:0px}.bottom-20.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{bottom:5rem}.left-1\/2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{left:50%}.right-0.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{right:0px}.z-10.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{z-index:10}.m-0.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin:0px}.-mx-1.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-left:-0.25rem;margin-right:-0.25rem}.-mx-4.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-left:-1rem;margin-right:-1rem}.mx-auto.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-left:auto;margin-right:auto}.my-2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-top:0.5rem;margin-bottom:0.5rem}.my-4.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-top:1rem;margin-bottom:1rem}.my-5.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-top:1.25rem;margin-bottom:1.25rem}.-mb-2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-bottom:-0.5rem}.-mt-3.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-top:-0.75rem}.mb-1.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-bottom:0.25rem}.mb-12.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-bottom:3rem}.mb-24.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-bottom:6rem}.mb-3.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-bottom:0.75rem}.mb-5.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-bottom:1.25rem}.mb-6.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-bottom:1.5rem}.mb-8.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-bottom:2rem}.ml-2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-left:0.5rem}.ml-4.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-left:1rem}.ml-5.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-left:1.25rem}.ml-auto.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-left:auto}.mr-0.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-right:0px}.mr-2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-right:0.5rem}.mt-1.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-top:0.25rem}.mt-10.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-top:2.5rem}.mt-12.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-top:3rem}.mt-2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-top:0.5rem}.mt-96.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-top:24rem}.block.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{display:block}.inline-block.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{display:inline-block}.flex.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{display:flex}.inline-flex.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{display:inline-flex}.grid.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{display:grid}.hidden.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{display:none}.h-10.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{height:2.5rem}.h-12.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{height:3rem}.h-2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{height:0.5rem}.h-4.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{height:1rem}.h-5.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{height:1.25rem}.h-6.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{height:1.5rem}.h-8.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{height:2rem}.h-\[100vh\].svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{height:100vh}.h-full.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{height:100%}.max-h-64.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{max-height:16rem}.max-h-\[40px\].svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{max-height:40px}.min-h-\[100vh\].svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{min-height:100vh}.min-h-\[192px\].svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{min-height:192px}.min-h-\[40px\].svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{min-height:40px}.min-h-full.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{min-height:100%}.min-h-screen.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{min-height:100vh}.w-10.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{width:2.5rem}.w-12.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{width:3rem}.w-2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{width:0.5rem}.w-3\/4.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{width:75%}.w-4.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{width:1rem}.w-5.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{width:1.25rem}.w-6.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{width:1.5rem}.w-8.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{width:2rem}.w-96.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{width:24rem}.w-fit.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{width:-moz-fit-content;width:fit-content}.w-full.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{width:100%}.min-w-fit.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{min-width:-moz-fit-content;min-width:fit-content}.max-w-3xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{max-width:48rem}.max-w-lg.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{max-width:32rem}.max-w-prose.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{max-width:65ch}.max-w-screen-sm.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{max-width:640px}.max-w-xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{max-width:36rem}.flex-1.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{flex:1 1 0%}.-translate-x-1\/2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-rotate:90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes svelte-cpjycc-bounce{0%,100%{transform:translateY(-25%);animation-timing-function:cubic-bezier(0.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,0.2,1)}}.animate-bounce.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{animation:svelte-cpjycc-bounce 1s infinite}.cursor-pointer.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{cursor:pointer}.resize-none.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{resize:none}.grid-cols-1.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{grid-template-columns:repeat(1, minmax(0, 1fr))}.flex-row.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{flex-direction:row}.flex-row-reverse.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{flex-direction:row-reverse}.flex-col.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{flex-direction:column}.items-end.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{align-items:flex-end}.items-center.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{align-items:center}.items-stretch.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{align-items:stretch}.justify-end.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{justify-content:flex-end}.justify-center.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{justify-content:center}.justify-between.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{justify-content:space-between}.gap-1.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{gap:0.25rem}.gap-10.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{gap:2.5rem}.gap-2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{gap:0.5rem}.gap-20.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{gap:5rem}.gap-3.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{gap:0.75rem}.gap-4.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{gap:1rem}.gap-6.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{gap:1.5rem}.gap-8.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{gap:2rem}.space-x-4.svelte-cpjycc>.svelte-cpjycc:not([hidden])~.svelte-cpjycc:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.overflow-auto.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{overflow:auto}.overflow-hidden.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{overflow:hidden}.overflow-clip.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{overflow:clip}.overflow-x-auto.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{overflow-x:auto}.overflow-y-auto.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{overflow-y:auto}.overflow-x-hidden.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{overflow-x:hidden}.overflow-y-hidden.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{overflow-y:hidden}.scroll-smooth.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{scroll-behavior:smooth}.truncate.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{text-overflow:ellipsis}.text-clip.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{text-overflow:clip}.whitespace-nowrap.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{white-space:nowrap}.rounded.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-radius:0.25rem}.rounded-2xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-radius:1rem}.rounded-full.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-radius:9999px}.rounded-lg.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-radius:0.5rem}.rounded-md.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-radius:0.375rem}.rounded-xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-radius:0.75rem}.rounded-l.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-top-left-radius:0.25rem;border-bottom-left-radius:0.25rem}.rounded-l-md.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-top-left-radius:0.375rem;border-bottom-left-radius:0.375rem}.rounded-r.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-top-right-radius:0.25rem;border-bottom-right-radius:0.25rem}.rounded-r-md.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-top-right-radius:0.375rem;border-bottom-right-radius:0.375rem}.rounded-t-xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-top-left-radius:0.75rem;border-top-right-radius:0.75rem}.border.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-width:1px}.border-2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-width:2px}.border-y.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-top-width:1px;border-bottom-width:1px}.border-l.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-left-width:1px}.border-r.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-right-width:1px}.border-none.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-style:none}.border-gray-200.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.border-gray-300.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-border-opacity:1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.border-orange-700.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-border-opacity:1;border-color:rgb(194 65 12 / var(--tw-border-opacity))}.border-orange-900.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-border-opacity:1;border-color:rgb(124 45 18 / var(--tw-border-opacity))}.border-slate-200.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-border-opacity:1;border-color:rgb(226 232 240 / var(--tw-border-opacity))}.border-transparent.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-color:transparent}.border-y-slate-200.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-border-opacity:1;border-top-color:rgb(226 232 240 / var(--tw-border-opacity));border-bottom-color:rgb(226 232 240 / var(--tw-border-opacity))}.border-l-gray-400.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-border-opacity:1;border-left-color:rgb(156 163 175 / var(--tw-border-opacity))}.bg-black.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-gray-100\/90.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{background-color:rgb(243 244 246 / 0.9)}.bg-gray-200.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(229 231 235 / var(--tw-bg-opacity))}.bg-gray-300.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(209 213 219 / var(--tw-bg-opacity))}.bg-gray-50.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity))}.bg-green-500.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(34 197 94 / var(--tw-bg-opacity))}.bg-green-700.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(21 128 61 / var(--tw-bg-opacity))}.bg-orange-500.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(249 115 22 / var(--tw-bg-opacity))}.bg-orange-600.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(234 88 12 / var(--tw-bg-opacity))}.bg-orange-700.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(194 65 12 / var(--tw-bg-opacity))}.bg-orange-900.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(124 45 18 / var(--tw-bg-opacity))}.bg-purple-700.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{background-color:var(--nostri-chat-custom-accent-color-700)}.bg-purple-800.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{background-color:var(--nostri-chat-custom-accent-color-800)}.bg-purple-900.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{background-color:var(--nostri-chat-custom-accent-color-900)}.bg-red-700.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(185 28 28 / var(--tw-bg-opacity))}.bg-slate-100.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.bg-transparent.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{background-color:transparent}.bg-white.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-zinc-300.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(212 212 216 / var(--tw-bg-opacity))}.bg-gradient-to-b.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{background-image:linear-gradient(to bottom, var(--tw-gradient-stops))}.bg-gradient-to-bl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{background-image:linear-gradient(to bottom left, var(--tw-gradient-stops))}.from-orange-500.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-gradient-from:#f97316 var(--tw-gradient-from-position);--tw-gradient-to:rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from), var(--tw-gradient-to)}.to-orange-800.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-gradient-to:#9a3412 var(--tw-gradient-to-position)}.p-0.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding:0px}.p-2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding:0.5rem}.p-3.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding:0.75rem}.p-4.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding:1rem}.p-6.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding:1.5rem}.p-8.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding:2rem}.px-10.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-left:2.5rem;padding-right:2.5rem}.px-2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-left:0.5rem;padding-right:0.5rem}.px-4.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-left:1rem;padding-right:1rem}.px-6.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-left:1.5rem;padding-right:1.5rem}.py-16.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-top:4rem;padding-bottom:4rem}.py-2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-top:0.5rem;padding-bottom:0.5rem}.py-20.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-top:5rem;padding-bottom:5rem}.py-4.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-top:1rem;padding-bottom:1rem}.py-5.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-top:1.25rem;padding-bottom:1.25rem}.py-6.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-top:1.5rem;padding-bottom:1.5rem}.pb-16.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-bottom:4rem}.pl-4.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-left:1rem}.pl-5.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-left:1.25rem}.pt-12.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-top:3rem}.pt-2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-top:0.5rem}.text-center.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{text-align:center}.text-justify.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{text-align:justify}.font-mono.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace}.font-sans.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-family:ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"}.text-2xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-size:1.5rem;line-height:2rem}.text-3xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-size:1.875rem;line-height:2.25rem}.text-4xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-size:2.25rem;line-height:2.5rem}.text-5xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-size:3rem;line-height:1}.text-6xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-size:3.75rem;line-height:1}.text-7xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-size:4.5rem;line-height:1}.text-base.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-size:1rem;line-height:1.5rem}.text-lg.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-size:1.125rem;line-height:1.75rem}.text-sm.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-size:0.875rem;line-height:1.25rem}.text-xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-size:1.25rem;line-height:1.75rem}.text-xs.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-size:0.75rem;line-height:1rem}.font-black.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-weight:900}.font-bold.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-weight:700}.font-extrabold.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-weight:800}.font-extralight.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-weight:200}.font-light.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-weight:300}.font-medium.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-weight:500}.font-normal.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-weight:400}.font-semibold.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-weight:600}.leading-8.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{line-height:2rem}.leading-9.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{line-height:2.25rem}.tracking-wide.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{letter-spacing:0.025em}.tracking-wider.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{letter-spacing:0.05em}.text-black.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-text-opacity:1;color:rgb(0 0 0 / var(--tw-text-opacity))}.text-gray-200.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-text-opacity:1;color:rgb(229 231 235 / var(--tw-text-opacity))}.text-gray-300.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity))}.text-gray-400.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-text-opacity:1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-500.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-text-opacity:1;color:rgb(107 114 128 / var(--tw-text-opacity))}.text-gray-600.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-text-opacity:1;color:rgb(75 85 99 / var(--tw-text-opacity))}.text-gray-700.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-text-opacity:1;color:rgb(55 65 81 / var(--tw-text-opacity))}.text-gray-900.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-text-opacity:1;color:rgb(17 24 39 / var(--tw-text-opacity))}.text-green-500.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-text-opacity:1;color:rgb(34 197 94 / var(--tw-text-opacity))}.text-orange-500.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-text-opacity:1;color:rgb(249 115 22 / var(--tw-text-opacity))}.text-orange-600.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-text-opacity:1;color:rgb(234 88 12 / var(--tw-text-opacity))}.text-orange-700.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-text-opacity:1;color:rgb(194 65 12 / var(--tw-text-opacity))}.text-purple-300.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{color:var(--nostri-chat-custom-accent-color-300)}.text-purple-50.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-text-opacity:1;color:rgb(250 245 255 / var(--tw-text-opacity))}.text-purple-500.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{color:var(--nostri-chat-custom-accent-color-500)}.text-purple-700.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{color:var(--nostri-chat-custom-accent-color-700)}.text-red-500.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-text-opacity:1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-slate-500.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-text-opacity:1;color:rgb(100 116 139 / var(--tw-text-opacity))}.text-white.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity))}.text-zinc-800.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-text-opacity:1;color:rgb(39 39 42 / var(--tw-text-opacity))}.opacity-0.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{opacity:0}.opacity-10.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{opacity:0.1}.opacity-100.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{opacity:1}.opacity-50.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{opacity:0.5}.shadow.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px 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-2xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-shadow:0 25px 50px -12px rgb(0 0 0 / 0.25);--tw-shadow-colored:0 25px 50px -12px 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-md.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px 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-sm.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 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.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{outline:2px solid transparent;outline-offset:2px}.ring-4.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.ring-indigo-500.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-ring-opacity:1;--tw-ring-color:rgb(99 102 241 / var(--tw-ring-opacity))}.ring-purple-700.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-ring-color:var(--nostri-chat-custom-accent-color-700)}.drop-shadow-xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-drop-shadow:drop-shadow(0 20px 13px rgb(0 0 0 / 0.03)) drop-shadow(0 8px 5px rgb(0 0 0 / 0.08));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-backdrop-blur:blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.transition-all.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.hover\:bg-gray-50.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:hover{--tw-bg-opacity:1;background-color:rgb(249 250 251 / var(--tw-bg-opacity))}.hover\:bg-green-600.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:hover{--tw-bg-opacity:1;background-color:rgb(22 163 74 / var(--tw-bg-opacity))}.hover\:bg-orange-500.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:hover{--tw-bg-opacity:1;background-color:rgb(249 115 22 / var(--tw-bg-opacity))}.hover\:bg-orange-700.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:hover{--tw-bg-opacity:1;background-color:rgb(194 65 12 / var(--tw-bg-opacity))}.hover\:bg-purple-600.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:hover{background-color:var(--nostri-chat-custom-accent-color-600)}.hover\:bg-purple-700.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:hover{background-color:var(--nostri-chat-custom-accent-color-700)}.hover\:bg-red-600.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:hover{--tw-bg-opacity:1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.hover\:bg-slate-100.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:hover{--tw-bg-opacity:1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.hover\:text-gray-300.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:hover{--tw-text-opacity:1;color:rgb(209 213 219 / var(--tw-text-opacity))}.hover\:text-orange-400.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:hover{--tw-text-opacity:1;color:rgb(251 146 60 / var(--tw-text-opacity))}.hover\:text-orange-500.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:hover{--tw-text-opacity:1;color:rgb(249 115 22 / var(--tw-text-opacity))}.hover\:underline.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:hover{text-decoration-line:underline}.hover\:opacity-100.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:hover{opacity:1}.focus\:border-orange-500.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:focus{--tw-border-opacity:1;border-color:rgb(249 115 22 / var(--tw-border-opacity))}.focus\:outline-none.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.focus\:ring-green-500.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(34 197 94 / var(--tw-ring-opacity))}.focus\:ring-orange-500.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(249 115 22 / var(--tw-ring-opacity))}.focus\:ring-purple-500.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:focus{--tw-ring-color:var(--nostri-chat-custom-accent-color-500)}.focus\:ring-offset-2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc:focus{--tw-ring-offset-width:2px}@media(prefers-color-scheme: dark){.dark\:bg-black.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-bg-opacity:1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}}@media(min-width: 640px){.sm\:col-span-2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{grid-column:span 2 / span 2}.sm\:mb-3.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-bottom:0.75rem}.sm\:mt-0.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-top:0px}.sm\:mt-5.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-top:1.25rem}.sm\:mt-px.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-top:1px}.sm\:grid.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{display:grid}.sm\:min-w-\[256px\].svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{min-width:256px}.sm\:max-w-xs.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{max-width:20rem}.sm\:grid-cols-3.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{grid-template-columns:repeat(3, minmax(0, 1fr))}.sm\:items-start.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{align-items:flex-start}.sm\:gap-4.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{gap:1rem}.sm\:border-gray-200.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{--tw-border-opacity:1;border-color:rgb(229 231 235 / var(--tw-border-opacity))}.sm\:pt-2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-top:0.5rem}.sm\:pt-5.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-top:1.25rem}.sm\:text-left.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{text-align:left}.sm\:text-sm.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-size:0.875rem;line-height:1.25rem}}@media(min-width: 768px){.md\:mb-6.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-bottom:1.5rem}.md\:mb-8.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{margin-bottom:2rem}.md\:flex.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{display:flex}.md\:hidden.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{display:none}.md\:w-4\/5.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{width:80%}.md\:w-5\/12.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{width:41.666667%}.md\:w-7\/12.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{width:58.333333%}.md\:flex-row.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{flex-direction:row}.md\:overflow-y-auto.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{overflow-y:auto}.md\:rounded-t-md.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{border-top-left-radius:0.375rem;border-top-right-radius:0.375rem}}@media(min-width: 1024px){.lg\:flex.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{display:flex}.lg\:hidden.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{display:none}.lg\:min-h-screen.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{min-height:100vh}.lg\:w-1\/2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{width:50%}.lg\:w-3\/5.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{width:60%}.lg\:w-full.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{width:100%}.lg\:max-w-6xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{max-width:72rem}.lg\:grid-cols-2.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{grid-template-columns:repeat(2, minmax(0, 1fr))}.lg\:flex-row.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{flex-direction:row}.lg\:px-0.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-left:0px;padding-right:0px}.lg\:px-8.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-left:2rem;padding-right:2rem}.lg\:py-16.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-top:4rem;padding-bottom:4rem}.lg\:text-4xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-size:2.25rem;line-height:2.5rem}.lg\:text-5xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-size:3rem;line-height:1}.lg\:text-6xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-size:3.75rem;line-height:1}.lg\:text-7xl.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{font-size:4.5rem;line-height:1}}@media(min-width: 1280px){.xl\:py-10.svelte-cpjycc.svelte-cpjycc.svelte-cpjycc{padding-top:2.5rem;padding-bottom:2.5rem}} +@media(min-width: 640px){}@media(min-width: 768px){}@media(min-width: 1024px){}@media(min-width: 1280px){}@media(min-width: 1536px){}@keyframes svelte-cpjycc-bounce{{transform:translateY(-25%);animation-timing-function:cubic-bezier(0.8,0,1,1)}{transform:none;animation-timing-function:cubic-bezier(0,0,0.2,1)}}@media(prefers-color-scheme: dark){}@media(min-width: 640px){}@media(min-width: 768px){}@media(min-width: 1024px){}@media(min-width: 1280px){} +.svelte-ika13l,.svelte-ika13l::before,.svelte-ika13l::after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}.svelte-ika13l::before,.svelte-ika13l::after{--tw-content:''}.svelte-ika13l:-moz-focusring{outline:auto}.svelte-ika13l:-moz-ui-invalid{box-shadow:none}.svelte-ika13l::-webkit-inner-spin-button,.svelte-ika13l::-webkit-outer-spin-button{height:auto}.svelte-ika13l::-webkit-search-decoration{-webkit-appearance:none}.svelte-ika13l::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}.svelte-ika13l:disabled{cursor:default}svg.svelte-ika13l{display:block;vertical-align:middle}.svelte-ika13l::-webkit-datetime-edit-fields-wrapper{padding:0}.svelte-ika13l::-webkit-date-and-time-value{min-height:1.5em}.svelte-ika13l::-webkit-datetime-edit,.svelte-ika13l::-webkit-datetime-edit-year-field,.svelte-ika13l::-webkit-datetime-edit-month-field,.svelte-ika13l::-webkit-datetime-edit-day-field,.svelte-ika13l::-webkit-datetime-edit-hour-field,.svelte-ika13l::-webkit-datetime-edit-minute-field,.svelte-ika13l::-webkit-datetime-edit-second-field,.svelte-ika13l::-webkit-datetime-edit-millisecond-field,.svelte-ika13l::-webkit-datetime-edit-meridiem-field{padding-top:0;padding-bottom:0}.svelte-ika13l,.svelte-ika13l::before,.svelte-ika13l::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 / 0.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: }.svelte-ika13l::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 / 0.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: }@media(min-width: 640px){}@media(min-width: 768px){}@media(min-width: 1024px){}@media(min-width: 1280px){}@media(min-width: 1536px){}.absolute.svelte-ika13l{position:absolute}.bottom-20.svelte-ika13l{bottom:5rem}.right-0.svelte-ika13l{right:0px}.flex.svelte-ika13l{display:flex}.hidden.svelte-ika13l{display:none}.w-96.svelte-ika13l{width:24rem}.w-full.svelte-ika13l{width:100%}@keyframes svelte-ika13l-bounce{0%,100%{transform:translateY(-25%);animation-timing-function:cubic-bezier(0.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,0.2,1)}}.cursor-pointer.svelte-ika13l{cursor:pointer}.flex-row.svelte-ika13l{flex-direction:row}.flex-col.svelte-ika13l{flex-direction:column}.items-center.svelte-ika13l{align-items:center}.gap-4.svelte-ika13l{gap:1rem}.rounded-full.svelte-ika13l{border-radius:9999px}.rounded-md.svelte-ika13l{border-radius:0.375rem}.bg-purple-900.svelte-ika13l{background-color:var(--nostri-chat-custom-accent-color-900)}.bg-white.svelte-ika13l{--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.p-4.svelte-ika13l{padding:1rem}.text-center.svelte-ika13l{text-align:center}.font-sans.svelte-ika13l{font-family:ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"}.text-sm.svelte-ika13l{font-size:0.875rem;line-height:1.25rem}.font-semibold.svelte-ika13l{font-weight:600}.tracking-wider.svelte-ika13l{letter-spacing:0.05em}.text-purple-300.svelte-ika13l{color:var(--nostri-chat-custom-accent-color-300)}.text-white.svelte-ika13l{--tw-text-opacity:1;color:rgb(255 255 255 / var(--tw-text-opacity))}.shadow-md.svelte-ika13l{--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.transition-all.svelte-ika13l{transition-property:all;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}:root{--nostri-chat-custom-accent-color-50:#faf5ff;--nostri-chat-custom-accent-color-100:#f3e8ff;--nostri-chat-custom-accent-color-200:#e9d5ff;--nostri-chat-custom-accent-color-300:#d8b4fe;--nostri-chat-custom-accent-color-400:#c084fc;--nostri-chat-custom-accent-color-500:#a855f7;--nostri-chat-custom-accent-color-600:#9333ea;--nostri-chat-custom-accent-color-700:#7e22ce;--nostri-chat-custom-accent-color-800:#6b21a8;--nostri-chat-custom-accent-color-900:#581c87;--nostri-chat-custom-accent-color-950:#3b0764}#_chat-widget-container.svelte-ika13l{z-index:995;position:fixed;bottom:20px;right:20px}#_chat-popup.svelte-ika13l{z-index:996;min-height:500px;max-height:72vh;transition:all 0.3s;overflow:hidden}@media(max-width: 768px){#_chat-popup.svelte-ika13l{position:fixed;top:0;right:0;bottom:0;left:0;width:100%;height:100%;max-height:100%;border-radius:0}}.hover\:bg-purple-700.svelte-ika13l:hover{background-color:var(--nostri-chat-custom-accent-color-700)}@media(prefers-color-scheme: dark){}@media(min-width: 640px){}@media(min-width: 768px){}@media(min-width: 1024px){}@media(min-width: 1280px){} diff --git a/static/public/bundle.js b/static/public/bundle.js index 7bcf7f6..91b8a7c 100644 --- a/static/public/bundle.js +++ b/static/public/bundle.js @@ -1,20 +1,21 @@ -!function(){"use strict";function e(){}function t(e){return e()}function n(){return Object.create(null)}function r(e){e.forEach(t)}function o(e){return"function"==typeof e}function i(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}let s;function a(e,t){return s||(s=document.createElement("a")),s.href=t,e===s.href}function c(t,n,r){t.$$.on_destroy.push(function(t,...n){if(null==t){for(const e of n)e(void 0);return e}const r=t.subscribe(...n);return r.unsubscribe?()=>r.unsubscribe():r}(n,r))}function u(e,t,n){return e.set(n),t}const l="undefined"!=typeof window;let f=l?()=>window.performance.now():()=>Date.now(),h=l?e=>requestAnimationFrame(e):e;const d=new Set;function p(e){d.forEach((t=>{t.c(e)||(d.delete(t),t.f())})),0!==d.size&&h(p)}var y="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function g(e,t){e.appendChild(t)}function b(e,t,n){e.insertBefore(t,n||null)}function w(e){e.parentNode&&e.parentNode.removeChild(e)}function v(e,t){for(let n=0;ne.removeEventListener(t,n,r)}function S(e){return function(t){return t.preventDefault(),e.call(this,t)}}function A(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function O(e,t){t=""+t,e.data!==t&&(e.data=t)}let C;function I(e){C=e}function P(){if(!C)throw new Error("Function called outside component initialization");return C}function T(e){P().$$.on_mount.push(e)}const L=[],B=[];let R=[];const $=[],j=Promise.resolve();let U=!1;function N(e){R.push(e)}function H(e){$.push(e)}const z=new Set;let M=0;function q(){if(0!==M)return;const e=C;do{try{for(;M{D.delete(e),r&&(n&&e.d(1),r())})),e.o(t)}else r&&r()}function Z(e){return void 0!==e?.length?e:Array.from(e)}function J(e,t,n){const r=e.$$.props[t];void 0!==r&&(e.$$.bound[r]=n,n(e.$$.ctx[r]))}function Q(e){e&&e.c()}function X(e,n,i){const{fragment:s,after_update:a}=e.$$;s&&s.m(n,i),N((()=>{const n=e.$$.on_mount.map(t).filter(o);e.$$.on_destroy?e.$$.on_destroy.push(...n):r(n),e.$$.on_mount=[]})),a.forEach(N)}function ee(e,t){const n=e.$$;null!==n.fragment&&(!function(e){const t=[],n=[];R.forEach((r=>-1===e.indexOf(r)?t.push(r):n.push(r))),n.forEach((e=>e())),R=t}(n.after_update),r(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function te(e,t){-1===e.$$.dirty[0]&&(L.push(e),U||(U=!0,j.then(q)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const o=r.length?r[0]:n;return h.ctx&&a(h.ctx[e],h.ctx[e]=o)&&(!h.skip_bound&&h.bound[e]&&h.bound[e](o),d&&te(t,e)),n})):[],h.update(),d=!0,r(h.before_update),h.fragment=!!s&&s(h.ctx),o.target){if(o.hydrate){const e=function(e){return Array.from(e.childNodes)}(o.target);h.fragment&&h.fragment.l(e),e.forEach(w)}else h.fragment&&h.fragment.c();o.intro&&V(t.$$.fragment),X(t,o.target,o.anchor),q()}I(f)}class re{$$=void 0;$$set=void 0;$destroy(){ee(this,1),this.$destroy=e}$on(t,n){if(!o(n))return e;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const e=r.indexOf(n);-1!==e&&r.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");const oe=[];function ie(t,n=e){let r;const o=new Set;function s(e){if(i(t,e)&&(t=e,r)){const e=!oe.length;for(const e of o)e[1](),oe.push(e,t);if(e){for(let e=0;e{o.delete(u),0===o.size&&r&&(r(),r=null)}}}}const se=ie(null),ae=ie({events:[],profiles:{}}),ce=ie(null),ue=ie(null),le=ie({});function fe(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function he(e,...t){if(!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new TypeError(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}const de={number:fe,bool:function(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)},bytes:he,hash:function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");fe(e.outputLen),fe(e.blockLen)},exists:function(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")},output:function(e,t){he(e);const n=t.outputLen;if(e.lengthnew DataView(e.buffer,e.byteOffset,e.byteLength),ge=(e,t)=>e<<32-t|e>>>t;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");const be=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function we(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let n=0;ne instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(t);for(let t=0,r=0;te().update(_e(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Se(e=32){if(pe&&"function"==typeof pe.getRandomValues)return pe.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}let Ae=class extends Ee{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ye(this.buffer)}update(e){de.exists(this);const{view:t,buffer:n,blockLen:r}=this,o=(e=_e(e)).length;for(let i=0;ir-i&&(this.process(n,0),i=0);for(let e=i;e>o&i),a=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+u,a,r)}(n,r-8,BigInt(8*this.length),o),this.process(n,0);const s=ye(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;ee&t^e&n^t&n,Ce=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]),Ie=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Pe=new Uint32Array(64);let Te=class extends Ae{constructor(){super(64,32,8,!1),this.A=0|Ie[0],this.B=0|Ie[1],this.C=0|Ie[2],this.D=0|Ie[3],this.E=0|Ie[4],this.F=0|Ie[5],this.G=0|Ie[6],this.H=0|Ie[7]}get(){const{A:e,B:t,C:n,D:r,E:o,F:i,G:s,H:a}=this;return[e,t,n,r,o,i,s,a]}set(e,t,n,r,o,i,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|a}process(e,t){for(let n=0;n<16;n++,t+=4)Pe[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=Pe[e-15],n=Pe[e-2],r=ge(t,7)^ge(t,18)^t>>>3,o=ge(n,17)^ge(n,19)^n>>>10;Pe[e]=o+Pe[e-7]+r+Pe[e-16]|0}let{A:n,B:r,C:o,D:i,E:s,F:a,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(ge(s,6)^ge(s,11)^ge(s,25))+((l=s)&a^~l&c)+Ce[e]+Pe[e]|0,f=(ge(n,2)^ge(n,13)^ge(n,22))+Oe(n,r,o)|0;u=c,c=a,a=s,s=i+t|0,i=o,o=r,r=n,n=t+f|0}var l;n=n+this.A|0,r=r+this.B|0,o=o+this.C|0,i=i+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(n,r,o,i,s,a,c,u)}roundClean(){Pe.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Le=class extends Te{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 Be=ke((()=>new Te));ke((()=>new Le)); +!function(){"use strict";function e(){}function t(e){return e()}function n(){return Object.create(null)}function r(e){e.forEach(t)}function o(e){return"function"==typeof e}function i(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}let s;function a(e,t){return e===t||(s||(s=document.createElement("a")),s.href=t,e===s.href)}function c(t,n,r){t.$$.on_destroy.push(function(t,...n){if(null==t){for(const e of n)e(void 0);return e}const r=t.subscribe(...n);return r.unsubscribe?()=>r.unsubscribe():r}(n,r))}function u(e){return null==e?"":e}function l(e,t,n){return e.set(n),t}const h="undefined"!=typeof window;let f=h?()=>window.performance.now():()=>Date.now(),d=h?e=>requestAnimationFrame(e):e;const p=new Set;function y(e){p.forEach((t=>{t.c(e)||(p.delete(t),t.f())})),0!==p.size&&d(y)}var g="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function b(e,t){e.appendChild(t)}function w(e,t,n){e.insertBefore(t,n||null)}function v(e){e.parentNode&&e.parentNode.removeChild(e)}function m(e,t){for(let n=0;ne.removeEventListener(t,n,r)}function O(e){return function(t){return t.preventDefault(),e.call(this,t)}}function C(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function P(e,t){t=""+t,e.data!==t&&(e.data=t)}let I;function L(e){I=e}function j(){if(!I)throw new Error("Function called outside component initialization");return I}function T(e){j().$$.on_mount.push(e)}const B=[],R=[];let $=[];const U=[],N=Promise.resolve();let H=!1;function M(e){$.push(e)}function q(e){U.push(e)}const F=new Set;let D=0;function z(){if(0!==D)return;const e=I;do{try{for(;D{G.delete(e),r&&(n&&e.d(1),r())})),e.o(t)}else r&&r()}function Q(e){return void 0!==e?.length?e:Array.from(e)}function X(e,t,n){const r=e.$$.props[t];void 0!==r&&(e.$$.bound[r]=n,n(e.$$.ctx[r]))}function ee(e){e&&e.c()}function te(e,n,i){const{fragment:s,after_update:a}=e.$$;s&&s.m(n,i),M((()=>{const n=e.$$.on_mount.map(t).filter(o);e.$$.on_destroy?e.$$.on_destroy.push(...n):r(n),e.$$.on_mount=[]})),a.forEach(M)}function ne(e,t){const n=e.$$;null!==n.fragment&&(!function(e){const t=[],n=[];$.forEach((r=>-1===e.indexOf(r)?t.push(r):n.push(r))),n.forEach((e=>e())),$=t}(n.after_update),r(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function re(e,t){-1===e.$$.dirty[0]&&(B.push(e),H||(H=!0,N.then(z)),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const o=r.length?r[0]:n;return f.ctx&&a(f.ctx[e],f.ctx[e]=o)&&(!f.skip_bound&&f.bound[e]&&f.bound[e](o),d&&re(t,e)),n})):[],f.update(),d=!0,r(f.before_update),f.fragment=!!s&&s(f.ctx),o.target){if(o.hydrate){const e=function(e){return Array.from(e.childNodes)}(o.target);f.fragment&&f.fragment.l(e),e.forEach(v)}else f.fragment&&f.fragment.c();o.intro&&Z(t.$$.fragment),te(t,o.target,o.anchor),z()}L(h)}class ie{$$=void 0;$$set=void 0;$destroy(){ne(this,1),this.$destroy=e}$on(t,n){if(!o(n))return e;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const e=r.indexOf(n);-1!==e&&r.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");const se=[];function ae(t,n=e){let r;const o=new Set;function s(e){if(i(t,e)&&(t=e,r)){const e=!se.length;for(const e of o)e[1](),se.push(e,t);if(e){for(let e=0;e{o.delete(u),0===o.size&&r&&(r(),r=null)}}}}const ce=ae(null),ue=ae({events:[],profiles:{}}),le=ae(null),he=ae(null),fe=ae({});function de(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function pe(e,...t){if(!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new TypeError(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}const ye={number:de,bool:function(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)},bytes:pe,hash:function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");de(e.outputLen),de(e.blockLen)},exists:function(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")},output:function(e,t){pe(e);const n=t.outputLen;if(e.lengthnew DataView(e.buffer,e.byteOffset,e.byteLength),we=(e,t)=>e<<32-t|e>>>t;if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");function ve(e){if("string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new TypeError("utf8ToBytes expected string, got "+typeof e);return(new TextEncoder).encode(e)}(e)),!(e instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof e})`);return e}Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));let me=class{clone(){return this._cloneInto()}};function _e(e){const t=t=>e().update(ve(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function xe(e=32){if(ge&&"function"==typeof ge.getRandomValues)return ge.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}let Ee=class extends me{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=be(this.buffer)}update(e){ye.exists(this);const{view:t,buffer:n,blockLen:r}=this,o=(e=ve(e)).length;for(let i=0;ir-i&&(this.process(n,0),i=0);for(let e=i;e>o&i),a=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+u,a,r)}(n,r-8,BigInt(8*this.length),o),this.process(n,0);const s=be(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;ee&t^e&n^t&n,Se=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]),Ae=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Oe=new Uint32Array(64);let Ce=class extends Ee{constructor(){super(64,32,8,!1),this.A=0|Ae[0],this.B=0|Ae[1],this.C=0|Ae[2],this.D=0|Ae[3],this.E=0|Ae[4],this.F=0|Ae[5],this.G=0|Ae[6],this.H=0|Ae[7]}get(){const{A:e,B:t,C:n,D:r,E:o,F:i,G:s,H:a}=this;return[e,t,n,r,o,i,s,a]}set(e,t,n,r,o,i,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|a}process(e,t){for(let n=0;n<16;n++,t+=4)Oe[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=Oe[e-15],n=Oe[e-2],r=we(t,7)^we(t,18)^t>>>3,o=we(n,17)^we(n,19)^n>>>10;Oe[e]=o+Oe[e-7]+r+Oe[e-16]|0}let{A:n,B:r,C:o,D:i,E:s,F:a,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(we(s,6)^we(s,11)^we(s,25))+((l=s)&a^~l&c)+Se[e]+Oe[e]|0,h=(we(n,2)^we(n,13)^we(n,22))+ke(n,r,o)|0;u=c,c=a,a=s,s=i+t|0,i=o,o=r,r=n,n=t+h|0}var l;n=n+this.A|0,r=r+this.B|0,o=o+this.C|0,i=i+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(n,r,o,i,s,a,c,u)}roundClean(){Oe.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Pe=class extends Ce{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 Ie=_e((()=>new Ce));_e((()=>new Pe)); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -const Re=BigInt(0),$e=BigInt(1),je=BigInt(2),Ue=e=>e instanceof Uint8Array,Ne=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function He(e){if(!Ue(e))throw new Error("Uint8Array expected");let t="";for(let n=0;nqe(e.toString(16).padStart(2*t,"0")),Ge=(e,t)=>Ke(e,t).reverse();function We(e,t,n){let r;if("string"==typeof t)try{r=qe(t)}catch(n){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${n}`)}else{if(!Ue(t))throw new Error(`${e} must be hex string or Uint8Array`);r=Uint8Array.from(t)}const o=r.length;if("number"==typeof n&&o!==n)throw new Error(`${e} expected ${n} bytes, got ${o}`);return r}function Ve(...e){const t=new Uint8Array(e.reduce(((e,t)=>e+t.length),0));let n=0;return e.forEach((e=>{if(!Ue(e))throw new Error("Uint8Array expected");t.set(e,n),n+=e.length})),t}function Ye(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return(new TextEncoder).encode(e)}const Ze=e=>(je<new Uint8Array(e),Qe=e=>Uint8Array.from(e);function Xe(e,t,n){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=Je(e),o=Je(e),i=0;const s=()=>{r.fill(1),o.fill(0),i=0},a=(...e)=>n(o,r,...e),c=(e=Je())=>{o=a(Qe([0]),e),r=a(),0!==e.length&&(o=a(Qe([1]),e),r=a())},u=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const n=[];for(;e{let n;for(s(),c(e);!(n=t(u()));)c();return s(),n}}const et={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function tt(e,t,n={}){const r=(t,n,r)=>{const o=et[n];if("function"!=typeof o)throw new Error(`Invalid validator "${n}", expected function`);const i=e[t];if(!(r&&void 0===i||o(i,e)))throw new Error(`Invalid param ${String(t)}=${i} (${typeof i}), expected ${n}`)};for(const[e,n]of Object.entries(t))r(e,n,!1);for(const[e,t]of Object.entries(n))r(e,t,!0);return e}var nt=Object.freeze({__proto__:null,bitGet:(e,t)=>e>>BigInt(t)&$e,bitLen:function(e){let t;for(t=0;e>Re;e>>=$e,t+=1);return t},bitMask:Ze,bitSet:(e,t,n)=>e|(n?$e:Re)<qe(ze(e)),utf8ToBytes:Ye,validateObject:tt}); -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const rt=BigInt(0),ot=BigInt(1),it=BigInt(2),st=BigInt(3),at=BigInt(4),ct=BigInt(5),ut=BigInt(8);function lt(e,t){const n=e%t;return n>=rt?n:t+n}function ft(e,t,n){if(n<=rt||t 0");if(n===ot)return rt;let r=ot;for(;t>rt;)t&ot&&(r=r*e%n),e=e*e%n,t>>=ot;return r}function ht(e,t,n){let r=e;for(;t-- >rt;)r*=r,r%=n;return r}function dt(e,t){if(e===rt||t<=rt)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=lt(e,t),r=t,o=rt,i=ot;for(;n!==rt;){const e=r%n,t=o-i*(r/n);r=n,n=e,o=i,i=t}if(r!==ot)throw new Error("invert: does not exist");return lt(o,t)}function pt(e){if(e%at===st){const t=(e+ot)/at;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}if(e%ut===ct){const t=(e-ct)/ut;return function(e,n){const r=e.mul(n,it),o=e.pow(r,t),i=e.mul(n,o),s=e.mul(e.mul(i,it),o),a=e.mul(i,e.sub(s,e.ONE));if(!e.eql(e.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(e){const t=(e-ot)/it;let n,r,o;for(n=e-ot,r=0;n%it===rt;n/=it,r++);for(o=it;o(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"}))}function bt(e,t){const n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}} +const Le=BigInt(0),je=BigInt(1),Te=BigInt(2),Be=e=>e instanceof Uint8Array,Re=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function $e(e){if(!Be(e))throw new Error("Uint8Array expected");let t="";for(let n=0;nHe(e.toString(16).padStart(2*t,"0")),De=(e,t)=>Fe(e,t).reverse();function ze(e,t,n){let r;if("string"==typeof t)try{r=He(t)}catch(n){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${n}`)}else{if(!Be(t))throw new Error(`${e} must be hex string or Uint8Array`);r=Uint8Array.from(t)}const o=r.length;if("number"==typeof n&&o!==n)throw new Error(`${e} expected ${n} bytes, got ${o}`);return r}function Ke(...e){const t=new Uint8Array(e.reduce(((e,t)=>e+t.length),0));let n=0;return e.forEach((e=>{if(!Be(e))throw new Error("Uint8Array expected");t.set(e,n),n+=e.length})),t}function Ge(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return(new TextEncoder).encode(e)}const We=e=>(Te<new Uint8Array(e),Ye=e=>Uint8Array.from(e);function Ze(e,t,n){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=Ve(e),o=Ve(e),i=0;const s=()=>{r.fill(1),o.fill(0),i=0},a=(...e)=>n(o,r,...e),c=(e=Ve())=>{o=a(Ye([0]),e),r=a(),0!==e.length&&(o=a(Ye([1]),e),r=a())},u=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const n=[];for(;e{let n;for(s(),c(e);!(n=t(u()));)c();return s(),n}}const Je={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function Qe(e,t,n={}){const r=(t,n,r)=>{const o=Je[n];if("function"!=typeof o)throw new Error(`Invalid validator "${n}", expected function`);const i=e[t];if(!(r&&void 0===i||o(i,e)))throw new Error(`Invalid param ${String(t)}=${i} (${typeof i}), expected ${n}`)};for(const[e,n]of Object.entries(t))r(e,n,!1);for(const[e,t]of Object.entries(n))r(e,t,!0);return e}var Xe=Object.freeze({__proto__:null,bitGet:(e,t)=>e>>BigInt(t)&je,bitLen:function(e){let t;for(t=0;e>Le;e>>=je,t+=1);return t},bitMask:We,bitSet:(e,t,n)=>e|(n?je:Le)<He(Ue(e)),utf8ToBytes:Ge,validateObject:Qe}); +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const et=BigInt(0),tt=BigInt(1),nt=BigInt(2),rt=BigInt(3),ot=BigInt(4),it=BigInt(5),st=BigInt(8);function at(e,t){const n=e%t;return n>=et?n:t+n}function ct(e,t,n){if(n<=et||t 0");if(n===tt)return et;let r=tt;for(;t>et;)t&tt&&(r=r*e%n),e=e*e%n,t>>=tt;return r}function ut(e,t,n){let r=e;for(;t-- >et;)r*=r,r%=n;return r}function lt(e,t){if(e===et||t<=et)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=at(e,t),r=t,o=et,i=tt;for(;n!==et;){const e=r%n,t=o-i*(r/n);r=n,n=e,o=i,i=t}if(r!==tt)throw new Error("invert: does not exist");return at(o,t)}function ht(e){if(e%ot===rt){const t=(e+tt)/ot;return function(e,n){const r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw new Error("Cannot find square root");return r}}if(e%st===it){const t=(e-it)/st;return function(e,n){const r=e.mul(n,nt),o=e.pow(r,t),i=e.mul(n,o),s=e.mul(e.mul(i,nt),o),a=e.mul(i,e.sub(s,e.ONE));if(!e.eql(e.sqr(a),n))throw new Error("Cannot find square root");return a}}return function(e){const t=(e-tt)/nt;let n,r,o;for(n=e-tt,r=0;n%nt===et;n/=nt,r++);for(o=nt;o(e[t]="function",e)),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"}))}function pt(e,t){const n=void 0!==t?t:e.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}} /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -const wt=BigInt(0),vt=BigInt(1);function mt(e){return gt(e.Fp),tt(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...bt(e.n,e.nBitLength),...e,p:e.Fp.ORDER})} -/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const{bytesToNumberBE:_t,hexToBytes:xt}=nt,Et={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:t}=Et;if(e.length<2||2!==e[0])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(128&r[0])throw new t("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:_t(r),l:e.subarray(n+2)}},toSig(e){const{Err:t}=Et,n="string"==typeof e?xt(e):e;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||48!=n[0])throw new t("Invalid signature tag");if(n[1]!==r-2)throw new t("Invalid signature: incorrect length");const{d:o,l:i}=Et._parseInt(n.subarray(2)),{d:s,l:a}=Et._parseInt(i);if(a.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s:s}},hexFromSig(e){const t=e=>8&Number.parseInt(e[0],16)?"00"+e:e,n=e=>{const t=e.toString(16);return 1&t.length?`0${t}`:t},r=t(n(e.s)),o=t(n(e.r)),i=r.length/2,s=o.length/2,a=n(i),c=n(s);return`30${n(s+i+4)}02${c}${o}02${a}${r}`}},kt=BigInt(0),St=BigInt(1),At=BigInt(2),Ot=BigInt(3),Ct=BigInt(4);function It(e){const t=function(e){const t=mt(e);tt(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("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:n}=t,r=t.toBytes||((e,t,r)=>{const o=t.toAffine();return Ve(Uint8Array.from([4]),n.toBytes(o.x),n.toBytes(o.y))}),o=t.fromBytes||(e=>{const t=e.subarray(1);return{x:n.fromBytes(t.subarray(0,n.BYTES)),y:n.fromBytes(t.subarray(n.BYTES,2*n.BYTES))}});function i(e){const{a:r,b:o}=t,i=n.sqr(e),s=n.mul(i,e);return n.add(n.add(s,n.mul(e,r)),o)}if(!n.eql(n.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function s(e){return"bigint"==typeof e&&ktn.eql(e,n.ZERO);return o(t)&&o(r)?f.ZERO:new f(t,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=n.invertBatch(e.map((e=>e.pz)));return e.map(((e,n)=>e.toAffine(t[n]))).map(f.fromAffine)}static fromHex(e){const t=f.fromAffine(o(We("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return f.BASE.multiply(c(e))}_setWindowSize(e){this._WINDOW_SIZE=e,u.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint)return;throw new Error("bad point: ZERO")}const{x:e,y:r}=this.toAffine();if(!n.isValid(e)||!n.isValid(r))throw new Error("bad point: x or y not FE");const o=n.sqr(r),s=i(e);if(!n.eql(o,s))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(n.isOdd)return!n.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){l(e);const{px:t,py:r,pz:o}=this,{px:i,py:s,pz:a}=e,c=n.eql(n.mul(t,a),n.mul(i,o)),u=n.eql(n.mul(r,a),n.mul(s,o));return c&&u}negate(){return new f(this.px,n.neg(this.py),this.pz)}double(){const{a:e,b:r}=t,o=n.mul(r,Ot),{px:i,py:s,pz:a}=this;let c=n.ZERO,u=n.ZERO,l=n.ZERO,h=n.mul(i,i),d=n.mul(s,s),p=n.mul(a,a),y=n.mul(i,s);return y=n.add(y,y),l=n.mul(i,a),l=n.add(l,l),c=n.mul(e,l),u=n.mul(o,p),u=n.add(c,u),c=n.sub(d,u),u=n.add(d,u),u=n.mul(c,u),c=n.mul(y,c),l=n.mul(o,l),p=n.mul(e,p),y=n.sub(h,p),y=n.mul(e,y),y=n.add(y,l),l=n.add(h,h),h=n.add(l,h),h=n.add(h,p),h=n.mul(h,y),u=n.add(u,h),p=n.mul(s,a),p=n.add(p,p),h=n.mul(p,y),c=n.sub(c,h),l=n.mul(p,d),l=n.add(l,l),l=n.add(l,l),new f(c,u,l)}add(e){l(e);const{px:r,py:o,pz:i}=this,{px:s,py:a,pz:c}=e;let u=n.ZERO,h=n.ZERO,d=n.ZERO;const p=t.a,y=n.mul(t.b,Ot);let g=n.mul(r,s),b=n.mul(o,a),w=n.mul(i,c),v=n.add(r,o),m=n.add(s,a);v=n.mul(v,m),m=n.add(g,b),v=n.sub(v,m),m=n.add(r,i);let _=n.add(s,c);return m=n.mul(m,_),_=n.add(g,w),m=n.sub(m,_),_=n.add(o,i),u=n.add(a,c),_=n.mul(_,u),u=n.add(b,w),_=n.sub(_,u),d=n.mul(p,m),u=n.mul(y,w),d=n.add(u,d),u=n.sub(b,d),d=n.add(b,d),h=n.mul(u,d),b=n.add(g,g),b=n.add(b,g),w=n.mul(p,w),m=n.mul(y,m),b=n.add(b,w),w=n.sub(g,w),w=n.mul(p,w),m=n.add(m,w),g=n.mul(b,m),h=n.add(h,g),g=n.mul(_,m),u=n.mul(v,u),u=n.sub(u,g),g=n.mul(v,b),d=n.mul(_,d),d=n.add(d,g),new f(u,h,d)}subtract(e){return this.add(e.negate())}is0(){return this.equals(f.ZERO)}wNAF(e){return d.wNAFCached(this,u,e,(e=>{const t=n.invertBatch(e.map((e=>e.pz)));return e.map(((e,n)=>e.toAffine(t[n]))).map(f.fromAffine)}))}multiplyUnsafe(e){const r=f.ZERO;if(e===kt)return r;if(a(e),e===St)return this;const{endo:o}=t;if(!o)return d.unsafeLadder(this,e);let{k1neg:i,k1:s,k2neg:c,k2:u}=o.splitScalar(e),l=r,h=r,p=this;for(;s>kt||u>kt;)s&St&&(l=l.add(p)),u&St&&(h=h.add(p)),p=p.double(),s>>=St,u>>=St;return i&&(l=l.negate()),c&&(h=h.negate()),h=new f(n.mul(h.px,o.beta),h.py,h.pz),l.add(h)}multiply(e){a(e);let r,o,i=e;const{endo:s}=t;if(s){const{k1neg:e,k1:t,k2neg:a,k2:c}=s.splitScalar(i);let{p:u,f:l}=this.wNAF(t),{p:h,f:p}=this.wNAF(c);u=d.constTimeNegate(e,u),h=d.constTimeNegate(a,h),h=new f(n.mul(h.px,s.beta),h.py,h.pz),r=u.add(h),o=l.add(p)}else{const{p:e,f:t}=this.wNAF(i);r=e,o=t}return f.normalizeZ([r,o])[0]}multiplyAndAddUnsafe(e,t,n){const r=f.BASE,o=(e,t)=>t!==kt&&t!==St&&e.equals(r)?e.multiply(t):e.multiplyUnsafe(t),i=o(this,t).add(o(e,n));return i.is0()?void 0:i}toAffine(e){const{px:t,py:r,pz:o}=this,i=this.is0();null==e&&(e=i?n.ONE:n.inv(o));const s=n.mul(t,e),a=n.mul(r,e),c=n.mul(o,e);if(i)return{x:n.ZERO,y:n.ZERO};if(!n.eql(c,n.ONE))throw new Error("invZ was invalid");return{x:s,y:a}}isTorsionFree(){const{h:e,isTorsionFree:n}=t;if(e===St)return!0;if(n)return n(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:n}=t;return e===St?this:n?n(f,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return this.assertValidity(),r(f,this,e)}toHex(e=!0){return He(this.toRawBytes(e))}}f.BASE=new f(t.Gx,t.Gy,n.ONE),f.ZERO=new f(n.ZERO,n.ONE,n.ZERO);const h=t.nBitLength,d=function(e,t){const n=(e,t)=>{const n=t.negate();return e?n:t},r=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:n,unsafeLadder(t,n){let r=e.ZERO,o=t;for(;n>wt;)n&vt&&(r=r.add(o)),o=o.double(),n>>=vt;return r},precomputeWindow(e,t){const{windows:n,windowSize:o}=r(t),i=[];let s=e,a=s;for(let e=0;e>=h,r>a&&(r-=f,i+=vt);const s=t,d=t+Math.abs(r)-1,p=e%2!=0,y=r<0;0===r?u=u.add(n(p,o[s])):c=c.add(n(y,o[d]))}return{p:c,f:u}},wNAFCached(e,t,n,r){const o=e._WINDOW_SIZE||1;let i=t.get(e);return i||(i=this.precomputeWindow(e,o),1!==o&&t.set(e,r(i))),this.wNAF(o,i,n)}}}(f,t.endo?Math.ceil(h/2):h);return{CURVE:t,ProjectivePoint:f,normPrivateKeyToScalar:c,weierstrassEquation:i,isWithinCurveOrder:s}}function Pt(e){const t=function(e){const t=mt(e);return tt(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:n,n:r}=t,o=n.BYTES+1,i=2*n.BYTES+1;function s(e){return lt(e,r)}function a(e){return dt(e,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:f}=It({...t,toBytes(e,t,r){const o=t.toAffine(),i=n.toBytes(o.x),s=Ve;return r?s(Uint8Array.from([t.hasEvenY()?2:3]),i):s(Uint8Array.from([4]),i,n.toBytes(o.y))},fromBytes(e){const t=e.length,r=e[0],s=e.subarray(1);if(t!==o||2!==r&&3!==r){if(t===i&&4===r){return{x:n.fromBytes(s.subarray(0,n.BYTES)),y:n.fromBytes(s.subarray(n.BYTES,2*n.BYTES))}}throw new Error(`Point of length ${t} was invalid. Expected ${o} compressed bytes or ${i} uncompressed bytes`)}{const e=Fe(s);if(!(kt<(a=e)&&aHe(Ke(e,t.nByteLength));function d(e){return e>r>>St}const p=(e,t,n)=>Fe(e.slice(t,n));class y{constructor(e,t,n){this.r=e,this.s=t,this.recovery=n,this.assertValidity()}static fromCompact(e){const n=t.nByteLength;return e=We("compactSignature",e,2*n),new y(p(e,0,n),p(e,n,2*n))}static fromDER(e){const{r:t,s:n}=Et.toSig(We("DER",e));return new y(t,n)}assertValidity(){if(!f(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!f(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(e){return new y(this.r,this.s,e)}recoverPublicKey(e){const{r:r,s:o,recovery:i}=this,u=v(We("msgHash",e));if(null==i||![0,1,2,3].includes(i))throw new Error("recovery id invalid");const l=2===i||3===i?r+t.n:r;if(l>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const f=0==(1&i)?"02":"03",d=c.fromHex(f+h(l)),p=a(l),y=s(-u*p),g=s(o*p),b=c.BASE.multiplyAndAddUnsafe(d,y,g);if(!b)throw new Error("point at infinify");return b.assertValidity(),b}hasHighS(){return d(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return qe(this.toDERHex())}toDERHex(){return Et.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return qe(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const g={isValidPrivateKey(e){try{return u(e),!0}catch(e){return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const e=function(e,t,n=!1){const r=(e=We("privateHash",e)).length,o=bt(t).nByteLength+8;if(o<24||r1024)throw new Error(`hashToPrivateScalar: expected ${o}-1024 bytes of input, got ${r}`);return lt(n?De(e):Fe(e),t-ot)+ot}(t.randomBytes(n.BYTES+8),r);return Ke(e,t.nByteLength)},precompute:(e=8,t=c.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function b(e){const t=e instanceof Uint8Array,n="string"==typeof e,r=(t||n)&&e.length;return t?r===o||r===i:n?r===2*o||r===2*i:e instanceof c}const w=t.bits2int||function(e){const n=Fe(e),r=8*e.length-t.nBitLength;return r>0?n>>BigInt(r):n},v=t.bits2int_modN||function(e){return s(w(e))},m=Ze(t.nBitLength);function _(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(kt<=e&&ee in o)))throw new Error("sign() legacy options not supported");const{hash:i,randomBytes:l}=t;let{lowS:h,prehash:p,extraEntropy:g}=o;null==h&&(h=!0),e=We("msgHash",e),p&&(e=We("prehashed msgHash",i(e)));const b=v(e),m=u(r),x=[_(m),_(b)];if(null!=g){const e=!0===g?l(n.BYTES):g;x.push(We("extraEntropy",e,n.BYTES))}const k=Ve(...x),S=b;return{seed:k,k2sig:function(e){const t=w(e);if(!f(t))return;const n=a(t),r=c.BASE.multiply(t).toAffine(),o=s(r.x);if(o===kt)return;const i=s(n*s(S+o*m));if(i===kt)return;let u=(r.x===o?0:2)|Number(r.y&St),l=i;return h&&d(i)&&(l=function(e){return d(e)?s(-e):e}(i),u^=1),new y(o,l,u)}}}const E={lowS:t.lowS,prehash:!1},k={lowS:t.lowS,prehash:!1};return c.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return c.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,n=!0){if(b(e))throw new Error("first arg must be private key");if(!b(t))throw new Error("second arg must be public key");return c.fromHex(t).multiply(u(e)).toRawBytes(n)},sign:function(e,n,r=E){const{seed:o,k2sig:i}=x(e,n,r);return Xe(t.hash.outputLen,t.nByteLength,t.hmac)(o,i)},verify:function(e,n,r,o=k){const i=e;if(n=We("msgHash",n),r=We("publicKey",r),"strict"in o)throw new Error("options.strict was renamed to lowS");const{lowS:u,prehash:l}=o;let f,h;try{if("string"==typeof i||i instanceof Uint8Array)try{f=y.fromDER(i)}catch(e){if(!(e instanceof Et.Err))throw e;f=y.fromCompact(i)}else{if("object"!=typeof i||"bigint"!=typeof i.r||"bigint"!=typeof i.s)throw new Error("PARSE");{const{r:e,s:t}=i;f=new y(e,t)}}h=c.fromHex(r)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(u&&f.hasHighS())return!1;l&&(n=t.hash(n));const{r:d,s:p}=f,g=v(n),b=a(p),w=s(g*b),m=s(d*b),_=c.BASE.multiplyAndAddUnsafe(h,w,m)?.toAffine();return!!_&&s(_.x)===d},ProjectivePoint:c,Signature:y,utils:g}}class Tt extends Ee{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,de.hash(e);const n=_e(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,o=new Uint8Array(r);o.set(n.length>r?e.create().update(n).digest():n);for(let e=0;enew Tt(e,t).update(n).digest(); +const yt=BigInt(0),gt=BigInt(1);function bt(e){return dt(e.Fp),Qe(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...pt(e.n,e.nBitLength),...e,p:e.Fp.ORDER})} +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const{bytesToNumberBE:wt,hexToBytes:vt}=Xe,mt={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(e){const{Err:t}=mt;if(e.length<2||2!==e[0])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(128&r[0])throw new t("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:wt(r),l:e.subarray(n+2)}},toSig(e){const{Err:t}=mt,n="string"==typeof e?vt(e):e;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||48!=n[0])throw new t("Invalid signature tag");if(n[1]!==r-2)throw new t("Invalid signature: incorrect length");const{d:o,l:i}=mt._parseInt(n.subarray(2)),{d:s,l:a}=mt._parseInt(i);if(a.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s:s}},hexFromSig(e){const t=e=>8&Number.parseInt(e[0],16)?"00"+e:e,n=e=>{const t=e.toString(16);return 1&t.length?`0${t}`:t},r=t(n(e.s)),o=t(n(e.r)),i=r.length/2,s=o.length/2,a=n(i),c=n(s);return`30${n(s+i+4)}02${c}${o}02${a}${r}`}},_t=BigInt(0),xt=BigInt(1),Et=BigInt(2),kt=BigInt(3),St=BigInt(4);function At(e){const t=function(e){const t=bt(e);Qe(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("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:n}=t,r=t.toBytes||((e,t,r)=>{const o=t.toAffine();return Ke(Uint8Array.from([4]),n.toBytes(o.x),n.toBytes(o.y))}),o=t.fromBytes||(e=>{const t=e.subarray(1);return{x:n.fromBytes(t.subarray(0,n.BYTES)),y:n.fromBytes(t.subarray(n.BYTES,2*n.BYTES))}});function i(e){const{a:r,b:o}=t,i=n.sqr(e),s=n.mul(i,e);return n.add(n.add(s,n.mul(e,r)),o)}if(!n.eql(n.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function s(e){return"bigint"==typeof e&&_tn.eql(e,n.ZERO);return o(t)&&o(r)?h.ZERO:new h(t,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){const t=n.invertBatch(e.map((e=>e.pz)));return e.map(((e,n)=>e.toAffine(t[n]))).map(h.fromAffine)}static fromHex(e){const t=h.fromAffine(o(ze("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return h.BASE.multiply(c(e))}_setWindowSize(e){this._WINDOW_SIZE=e,u.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint)return;throw new Error("bad point: ZERO")}const{x:e,y:r}=this.toAffine();if(!n.isValid(e)||!n.isValid(r))throw new Error("bad point: x or y not FE");const o=n.sqr(r),s=i(e);if(!n.eql(o,s))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:e}=this.toAffine();if(n.isOdd)return!n.isOdd(e);throw new Error("Field doesn't support isOdd")}equals(e){l(e);const{px:t,py:r,pz:o}=this,{px:i,py:s,pz:a}=e,c=n.eql(n.mul(t,a),n.mul(i,o)),u=n.eql(n.mul(r,a),n.mul(s,o));return c&&u}negate(){return new h(this.px,n.neg(this.py),this.pz)}double(){const{a:e,b:r}=t,o=n.mul(r,kt),{px:i,py:s,pz:a}=this;let c=n.ZERO,u=n.ZERO,l=n.ZERO,f=n.mul(i,i),d=n.mul(s,s),p=n.mul(a,a),y=n.mul(i,s);return y=n.add(y,y),l=n.mul(i,a),l=n.add(l,l),c=n.mul(e,l),u=n.mul(o,p),u=n.add(c,u),c=n.sub(d,u),u=n.add(d,u),u=n.mul(c,u),c=n.mul(y,c),l=n.mul(o,l),p=n.mul(e,p),y=n.sub(f,p),y=n.mul(e,y),y=n.add(y,l),l=n.add(f,f),f=n.add(l,f),f=n.add(f,p),f=n.mul(f,y),u=n.add(u,f),p=n.mul(s,a),p=n.add(p,p),f=n.mul(p,y),c=n.sub(c,f),l=n.mul(p,d),l=n.add(l,l),l=n.add(l,l),new h(c,u,l)}add(e){l(e);const{px:r,py:o,pz:i}=this,{px:s,py:a,pz:c}=e;let u=n.ZERO,f=n.ZERO,d=n.ZERO;const p=t.a,y=n.mul(t.b,kt);let g=n.mul(r,s),b=n.mul(o,a),w=n.mul(i,c),v=n.add(r,o),m=n.add(s,a);v=n.mul(v,m),m=n.add(g,b),v=n.sub(v,m),m=n.add(r,i);let _=n.add(s,c);return m=n.mul(m,_),_=n.add(g,w),m=n.sub(m,_),_=n.add(o,i),u=n.add(a,c),_=n.mul(_,u),u=n.add(b,w),_=n.sub(_,u),d=n.mul(p,m),u=n.mul(y,w),d=n.add(u,d),u=n.sub(b,d),d=n.add(b,d),f=n.mul(u,d),b=n.add(g,g),b=n.add(b,g),w=n.mul(p,w),m=n.mul(y,m),b=n.add(b,w),w=n.sub(g,w),w=n.mul(p,w),m=n.add(m,w),g=n.mul(b,m),f=n.add(f,g),g=n.mul(_,m),u=n.mul(v,u),u=n.sub(u,g),g=n.mul(v,b),d=n.mul(_,d),d=n.add(d,g),new h(u,f,d)}subtract(e){return this.add(e.negate())}is0(){return this.equals(h.ZERO)}wNAF(e){return d.wNAFCached(this,u,e,(e=>{const t=n.invertBatch(e.map((e=>e.pz)));return e.map(((e,n)=>e.toAffine(t[n]))).map(h.fromAffine)}))}multiplyUnsafe(e){const r=h.ZERO;if(e===_t)return r;if(a(e),e===xt)return this;const{endo:o}=t;if(!o)return d.unsafeLadder(this,e);let{k1neg:i,k1:s,k2neg:c,k2:u}=o.splitScalar(e),l=r,f=r,p=this;for(;s>_t||u>_t;)s&xt&&(l=l.add(p)),u&xt&&(f=f.add(p)),p=p.double(),s>>=xt,u>>=xt;return i&&(l=l.negate()),c&&(f=f.negate()),f=new h(n.mul(f.px,o.beta),f.py,f.pz),l.add(f)}multiply(e){a(e);let r,o,i=e;const{endo:s}=t;if(s){const{k1neg:e,k1:t,k2neg:a,k2:c}=s.splitScalar(i);let{p:u,f:l}=this.wNAF(t),{p:f,f:p}=this.wNAF(c);u=d.constTimeNegate(e,u),f=d.constTimeNegate(a,f),f=new h(n.mul(f.px,s.beta),f.py,f.pz),r=u.add(f),o=l.add(p)}else{const{p:e,f:t}=this.wNAF(i);r=e,o=t}return h.normalizeZ([r,o])[0]}multiplyAndAddUnsafe(e,t,n){const r=h.BASE,o=(e,t)=>t!==_t&&t!==xt&&e.equals(r)?e.multiply(t):e.multiplyUnsafe(t),i=o(this,t).add(o(e,n));return i.is0()?void 0:i}toAffine(e){const{px:t,py:r,pz:o}=this,i=this.is0();null==e&&(e=i?n.ONE:n.inv(o));const s=n.mul(t,e),a=n.mul(r,e),c=n.mul(o,e);if(i)return{x:n.ZERO,y:n.ZERO};if(!n.eql(c,n.ONE))throw new Error("invZ was invalid");return{x:s,y:a}}isTorsionFree(){const{h:e,isTorsionFree:n}=t;if(e===xt)return!0;if(n)return n(h,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:e,clearCofactor:n}=t;return e===xt?this:n?n(h,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return this.assertValidity(),r(h,this,e)}toHex(e=!0){return $e(this.toRawBytes(e))}}h.BASE=new h(t.Gx,t.Gy,n.ONE),h.ZERO=new h(n.ZERO,n.ONE,n.ZERO);const f=t.nBitLength,d=function(e,t){const n=(e,t)=>{const n=t.negate();return e?n:t},r=e=>({windows:Math.ceil(t/e)+1,windowSize:2**(e-1)});return{constTimeNegate:n,unsafeLadder(t,n){let r=e.ZERO,o=t;for(;n>yt;)n>&&(r=r.add(o)),o=o.double(),n>>=gt;return r},precomputeWindow(e,t){const{windows:n,windowSize:o}=r(t),i=[];let s=e,a=s;for(let e=0;e>=f,r>a&&(r-=h,i+=gt);const s=t,d=t+Math.abs(r)-1,p=e%2!=0,y=r<0;0===r?u=u.add(n(p,o[s])):c=c.add(n(y,o[d]))}return{p:c,f:u}},wNAFCached(e,t,n,r){const o=e._WINDOW_SIZE||1;let i=t.get(e);return i||(i=this.precomputeWindow(e,o),1!==o&&t.set(e,r(i))),this.wNAF(o,i,n)}}}(h,t.endo?Math.ceil(f/2):f);return{CURVE:t,ProjectivePoint:h,normPrivateKeyToScalar:c,weierstrassEquation:i,isWithinCurveOrder:s}}function Ot(e){const t=function(e){const t=bt(e);return Qe(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:n,n:r}=t,o=n.BYTES+1,i=2*n.BYTES+1;function s(e){return at(e,r)}function a(e){return lt(e,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:l,isWithinCurveOrder:h}=At({...t,toBytes(e,t,r){const o=t.toAffine(),i=n.toBytes(o.x),s=Ke;return r?s(Uint8Array.from([t.hasEvenY()?2:3]),i):s(Uint8Array.from([4]),i,n.toBytes(o.y))},fromBytes(e){const t=e.length,r=e[0],s=e.subarray(1);if(t!==o||2!==r&&3!==r){if(t===i&&4===r){return{x:n.fromBytes(s.subarray(0,n.BYTES)),y:n.fromBytes(s.subarray(n.BYTES,2*n.BYTES))}}throw new Error(`Point of length ${t} was invalid. Expected ${o} compressed bytes or ${i} uncompressed bytes`)}{const e=Me(s);if(!(_t<(a=e)&&a$e(Fe(e,t.nByteLength));function d(e){return e>r>>xt}const p=(e,t,n)=>Me(e.slice(t,n));class y{constructor(e,t,n){this.r=e,this.s=t,this.recovery=n,this.assertValidity()}static fromCompact(e){const n=t.nByteLength;return e=ze("compactSignature",e,2*n),new y(p(e,0,n),p(e,n,2*n))}static fromDER(e){const{r:t,s:n}=mt.toSig(ze("DER",e));return new y(t,n)}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(e){return new y(this.r,this.s,e)}recoverPublicKey(e){const{r:r,s:o,recovery:i}=this,u=v(ze("msgHash",e));if(null==i||![0,1,2,3].includes(i))throw new Error("recovery id invalid");const l=2===i||3===i?r+t.n:r;if(l>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const h=0==(1&i)?"02":"03",d=c.fromHex(h+f(l)),p=a(l),y=s(-u*p),g=s(o*p),b=c.BASE.multiplyAndAddUnsafe(d,y,g);if(!b)throw new Error("point at infinify");return b.assertValidity(),b}hasHighS(){return d(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return He(this.toDERHex())}toDERHex(){return mt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return He(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const g={isValidPrivateKey(e){try{return u(e),!0}catch(e){return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const e=function(e,t,n=!1){const r=(e=ze("privateHash",e)).length,o=pt(t).nByteLength+8;if(o<24||r1024)throw new Error(`hashToPrivateScalar: expected ${o}-1024 bytes of input, got ${r}`);return at(n?qe(e):Me(e),t-tt)+tt}(t.randomBytes(n.BYTES+8),r);return Fe(e,t.nByteLength)},precompute:(e=8,t=c.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)};function b(e){const t=e instanceof Uint8Array,n="string"==typeof e,r=(t||n)&&e.length;return t?r===o||r===i:n?r===2*o||r===2*i:e instanceof c}const w=t.bits2int||function(e){const n=Me(e),r=8*e.length-t.nBitLength;return r>0?n>>BigInt(r):n},v=t.bits2int_modN||function(e){return s(w(e))},m=We(t.nBitLength);function _(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(_t<=e&&ee in o)))throw new Error("sign() legacy options not supported");const{hash:i,randomBytes:l}=t;let{lowS:f,prehash:p,extraEntropy:g}=o;null==f&&(f=!0),e=ze("msgHash",e),p&&(e=ze("prehashed msgHash",i(e)));const b=v(e),m=u(r),x=[_(m),_(b)];if(null!=g){const e=!0===g?l(n.BYTES):g;x.push(ze("extraEntropy",e,n.BYTES))}const k=Ke(...x),S=b;return{seed:k,k2sig:function(e){const t=w(e);if(!h(t))return;const n=a(t),r=c.BASE.multiply(t).toAffine(),o=s(r.x);if(o===_t)return;const i=s(n*s(S+o*m));if(i===_t)return;let u=(r.x===o?0:2)|Number(r.y&xt),l=i;return f&&d(i)&&(l=function(e){return d(e)?s(-e):e}(i),u^=1),new y(o,l,u)}}}const E={lowS:t.lowS,prehash:!1},k={lowS:t.lowS,prehash:!1};return c.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return c.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,n=!0){if(b(e))throw new Error("first arg must be private key");if(!b(t))throw new Error("second arg must be public key");return c.fromHex(t).multiply(u(e)).toRawBytes(n)},sign:function(e,n,r=E){const{seed:o,k2sig:i}=x(e,n,r);return Ze(t.hash.outputLen,t.nByteLength,t.hmac)(o,i)},verify:function(e,n,r,o=k){const i=e;if(n=ze("msgHash",n),r=ze("publicKey",r),"strict"in o)throw new Error("options.strict was renamed to lowS");const{lowS:u,prehash:l}=o;let h,f;try{if("string"==typeof i||i instanceof Uint8Array)try{h=y.fromDER(i)}catch(e){if(!(e instanceof mt.Err))throw e;h=y.fromCompact(i)}else{if("object"!=typeof i||"bigint"!=typeof i.r||"bigint"!=typeof i.s)throw new Error("PARSE");{const{r:e,s:t}=i;h=new y(e,t)}}f=c.fromHex(r)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(u&&h.hasHighS())return!1;l&&(n=t.hash(n));const{r:d,s:p}=h,g=v(n),b=a(p),w=s(g*b),m=s(d*b),_=c.BASE.multiplyAndAddUnsafe(f,w,m)?.toAffine();return!!_&&s(_.x)===d},ProjectivePoint:c,Signature:y,utils:g}}let Ct=class extends me{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,ye.hash(e);const n=ve(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,o=new Uint8Array(r);o.set(n.length>r?e.create().update(n).digest():n);for(let e=0;enew Ct(e,t).update(n).digest(); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -function Bt(e){return{hash:e,hmac:(t,...n)=>Lt(e,t,xe(...n)),randomBytes:Se}}Lt.create=(e,t)=>new Tt(e,t); +function It(e){return{hash:e,hmac:(t,...n)=>Pt(e,t,function(...e){if(!e.every((e=>e instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(t);for(let t=0,r=0;tnew Ct(e,t); /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -const Rt=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),$t=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),jt=BigInt(1),Ut=BigInt(2),Nt=(e,t)=>(e+t/Ut)/t;function Ht(e){const t=Rt,n=BigInt(3),r=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),a=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,f=ht(l,n,t)*l%t,h=ht(f,n,t)*l%t,d=ht(h,Ut,t)*u%t,p=ht(d,o,t)*d%t,y=ht(p,i,t)*p%t,g=ht(y,a,t)*y%t,b=ht(g,c,t)*g%t,w=ht(b,a,t)*y%t,v=ht(w,n,t)*l%t,m=ht(v,s,t)*p%t,_=ht(m,r,t)*u%t,x=ht(_,Ut,t);if(!zt.eql(zt.sqr(x),e))throw new Error("Cannot find square root");return x}const zt=function(e,t,n=!1,r={}){if(e<=rt)throw new Error(`Expected Fp ORDER > 0, got ${e}`);const{nBitLength:o,nByteLength:i}=bt(e,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=pt(e),a=Object.freeze({ORDER:e,BITS:o,BYTES:i,MASK:Ze(o),ZERO:rt,ONE:ot,create:t=>lt(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return rt<=t&&te===rt,isOdd:e=>(e&ot)===ot,neg:t=>lt(-t,e),eql:(e,t)=>e===t,sqr:t=>lt(t*t,e),add:(t,n)=>lt(t+n,e),sub:(t,n)=>lt(t-n,e),mul:(t,n)=>lt(t*n,e),pow:(e,t)=>function(e,t,n){if(n 0");if(n===rt)return e.ONE;if(n===ot)return t;let r=e.ONE,o=t;for(;n>rt;)n&ot&&(r=e.mul(r,o)),o=e.sqr(o),n>>=ot;return r}(a,e,t),div:(t,n)=>lt(t*dt(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>dt(t,e),sqrt:r.sqrt||(e=>s(a,e)),invertBatch:e=>function(e,t){const n=new Array(t.length),r=t.reduce(((t,r,o)=>e.is0(r)?t:(n[o]=t,e.mul(t,r))),e.ONE),o=e.inv(r);return t.reduceRight(((t,r,o)=>e.is0(r)?t:(n[o]=e.mul(t,n[o]),e.mul(t,r))),o),n}(a,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?Ge(e,i):Ke(e,i),fromBytes:e=>{if(e.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${e.length}`);return n?De(e):Fe(e)}});return Object.freeze(a)}(Rt,void 0,void 0,{sqrt:Ht}),Mt=function(e,t){const n=t=>Pt({...e,...Bt(t)});return Object.freeze({...n(t),create:n})}({a:BigInt(0),b:BigInt(7),Fp:zt,n:$t,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=$t,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-jt*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,s=BigInt("0x100000000000000000000000000000000"),a=Nt(i*e,t),c=Nt(-r*e,t);let u=lt(e-a*n-c*o,t),l=lt(-a*r-c*i,t);const f=u>s,h=l>s;if(f&&(u=t-u),h&&(l=t-l),u>s||l>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:u,k2neg:h,k2:l}}}},Be),qt=BigInt(0),Ft=e=>"bigint"==typeof e&&qt"bigint"==typeof e&&qte.charCodeAt(0))));n=Ve(t,t),Kt[e]=n}return Be(Ve(n,...t))}const Wt=e=>e.toRawBytes(!0).slice(1),Vt=e=>Ke(e,32),Yt=e=>lt(e,Rt),Zt=e=>lt(e,$t),Jt=Mt.ProjectivePoint,Qt=(e,t,n)=>Jt.BASE.multiplyAndAddUnsafe(e,t,n);function Xt(e){let t=Mt.utils.normPrivateKeyToScalar(e),n=Jt.fromPrivateKey(t);return{scalar:n.hasEvenY()?t:Zt(-t),bytes:Wt(n)}}function en(e){if(!Ft(e))throw new Error("bad x: need 0 < x < p");const t=Yt(e*e);let n=Ht(Yt(t*e+BigInt(7)));n%Ut!==qt&&(n=Yt(-n));const r=new Jt(e,n,jt);return r.assertValidity(),r}function tn(...e){return Zt(Fe(Gt("BIP0340/challenge",...e)))}function nn(e,t,n){const r=We("signature",e,64),o=We("message",t),i=We("publicKey",n,32);try{const e=en(Fe(i)),t=Fe(r.subarray(0,32));if(!Ft(t))return!1;const n=Fe(r.subarray(32,64));if(!Dt(n))return!1;const s=tn(Vt(t),Wt(e),o),a=Qt(e,n,Zt(-s));return!(!a||!a.hasEvenY()||a.toAffine().x!==t)}catch(e){return!1}}const rn={getPublicKey:function(e){return Xt(e).bytes},sign:function(e,t,n=Se(32)){const r=We("message",e),{bytes:o,scalar:i}=Xt(t),s=We("auxRand",n,32),a=Vt(i^Fe(Gt("BIP0340/aux",s))),c=Gt("BIP0340/nonce",a,o,r),u=Zt(Fe(c));if(u===qt)throw new Error("sign failed: k is zero");const{bytes:l,scalar:f}=Xt(u),h=tn(l,o,r),d=new Uint8Array(64);if(d.set(l,0),d.set(Vt(Zt(f+h*i)),32),!nn(d,r,o))throw new Error("sign: Invalid signature produced");return d},verify:nn,utils:{randomPrivateKey:Mt.utils.randomPrivateKey,lift_x:en,pointToBytes:Wt,numberToBytesBE:Ke,bytesToNumberBE:Fe,taggedHash:Gt,mod:lt}},on=function(e,t){const n=t.map((e=>Array.from(e).reverse()));return(t,r)=>{const[o,i,s,a]=n.map((n=>n.reduce(((n,r)=>e.add(e.mul(n,t),r)))));return t=e.div(o,i),r=e.mul(r,e.div(s,a)),{x:t,y:r}}}(zt,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map((e=>e.map((e=>BigInt(e)))))),sn=function(e,t){if(gt(e),!e.isValid(t.A)||!e.isValid(t.B)||!e.isValid(t.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const n=function(e,t){const n=e.ORDER;let r=kt;for(let e=n-St;e%At===kt;e/=At)r+=St;const o=r,i=(n-St)/At**o,s=(i-St)/At,a=At**o-St,c=At**(o-St),u=e.pow(t,i),l=e.pow(t,(i+St)/At);let f=(t,n)=>{let r=u,i=e.pow(n,a),f=e.sqr(i);f=e.mul(f,n);let h=e.mul(t,f);h=e.pow(h,s),h=e.mul(h,i),i=e.mul(h,n),f=e.mul(h,t);let d=e.mul(f,i);h=e.pow(d,c);let p=e.eql(h,e.ONE);i=e.mul(f,l),h=e.mul(d,r),f=e.cmov(i,f,p),d=e.cmov(h,d,p);for(let t=o;t>St;t--){let n=At**(t-At),o=e.pow(d,n);const s=e.eql(o,e.ONE);i=e.mul(f,r),r=e.mul(r,r),o=e.mul(d,r),f=e.cmov(i,f,s),d=e.cmov(o,d,s)}return{isValid:p,value:f}};if(e.ORDER%Ct===Ot){const n=(e.ORDER-Ot)/Ct,r=e.sqrt(e.neg(t));f=(t,o)=>{let i=e.sqr(o);const s=e.mul(t,o);i=e.mul(i,s);let a=e.pow(i,n);a=e.mul(a,s);const c=e.mul(a,r),u=e.mul(e.sqr(a),o),l=e.eql(u,t);return{isValid:l,value:e.cmov(c,a,l)}}}return f}(e,t.Z);if(!e.isOdd)throw new Error("Fp.isOdd is not implemented!");return r=>{let o,i,s,a,c,u,l,f;o=e.sqr(r),o=e.mul(o,t.Z),i=e.sqr(o),i=e.add(i,o),s=e.add(i,e.ONE),s=e.mul(s,t.B),a=e.cmov(t.Z,e.neg(i),!e.eql(i,e.ZERO)),a=e.mul(a,t.A),i=e.sqr(s),u=e.sqr(a),c=e.mul(u,t.A),i=e.add(i,c),i=e.mul(i,s),u=e.mul(u,a),c=e.mul(u,t.B),i=e.add(i,c),l=e.mul(o,s);const{isValid:h,value:d}=n(i,u);f=e.mul(o,r),f=e.mul(f,d),l=e.cmov(l,s,h),f=e.cmov(f,d,h);const p=e.isOdd(r)===e.isOdd(f);return f=e.cmov(e.neg(f),f,p),l=e.div(l,a),{x:l,y:f}}}(zt,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:zt.create(BigInt("-11"))}); +const Lt=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),jt=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Tt=BigInt(1),Bt=BigInt(2),Rt=(e,t)=>(e+t/Bt)/t;function $t(e){const t=Lt,n=BigInt(3),r=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),a=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,h=ut(l,n,t)*l%t,f=ut(h,n,t)*l%t,d=ut(f,Bt,t)*u%t,p=ut(d,o,t)*d%t,y=ut(p,i,t)*p%t,g=ut(y,a,t)*y%t,b=ut(g,c,t)*g%t,w=ut(b,a,t)*y%t,v=ut(w,n,t)*l%t,m=ut(v,s,t)*p%t,_=ut(m,r,t)*u%t,x=ut(_,Bt,t);if(!Ut.eql(Ut.sqr(x),e))throw new Error("Cannot find square root");return x}const Ut=function(e,t,n=!1,r={}){if(e<=et)throw new Error(`Expected Fp ORDER > 0, got ${e}`);const{nBitLength:o,nByteLength:i}=pt(e,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=ht(e),a=Object.freeze({ORDER:e,BITS:o,BYTES:i,MASK:We(o),ZERO:et,ONE:tt,create:t=>at(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return et<=t&&te===et,isOdd:e=>(e&tt)===tt,neg:t=>at(-t,e),eql:(e,t)=>e===t,sqr:t=>at(t*t,e),add:(t,n)=>at(t+n,e),sub:(t,n)=>at(t-n,e),mul:(t,n)=>at(t*n,e),pow:(e,t)=>function(e,t,n){if(n 0");if(n===et)return e.ONE;if(n===tt)return t;let r=e.ONE,o=t;for(;n>et;)n&tt&&(r=e.mul(r,o)),o=e.sqr(o),n>>=tt;return r}(a,e,t),div:(t,n)=>at(t*lt(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>lt(t,e),sqrt:r.sqrt||(e=>s(a,e)),invertBatch:e=>function(e,t){const n=new Array(t.length),r=t.reduce(((t,r,o)=>e.is0(r)?t:(n[o]=t,e.mul(t,r))),e.ONE),o=e.inv(r);return t.reduceRight(((t,r,o)=>e.is0(r)?t:(n[o]=e.mul(t,n[o]),e.mul(t,r))),o),n}(a,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?De(e,i):Fe(e,i),fromBytes:e=>{if(e.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${e.length}`);return n?qe(e):Me(e)}});return Object.freeze(a)}(Lt,void 0,void 0,{sqrt:$t}),Nt=function(e,t){const n=t=>Ot({...e,...It(t)});return Object.freeze({...n(t),create:n})}({a:BigInt(0),b:BigInt(7),Fp:Ut,n:jt,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=jt,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Tt*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,s=BigInt("0x100000000000000000000000000000000"),a=Rt(i*e,t),c=Rt(-r*e,t);let u=at(e-a*n-c*o,t),l=at(-a*r-c*i,t);const h=u>s,f=l>s;if(h&&(u=t-u),f&&(l=t-l),u>s||l>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:h,k1:u,k2neg:f,k2:l}}}},Ie),Ht=BigInt(0),Mt=e=>"bigint"==typeof e&&Ht"bigint"==typeof e&&Hte.charCodeAt(0))));n=Ke(t,t),Ft[e]=n}return Ie(Ke(n,...t))}const zt=e=>e.toRawBytes(!0).slice(1),Kt=e=>Fe(e,32),Gt=e=>at(e,Lt),Wt=e=>at(e,jt),Vt=Nt.ProjectivePoint,Yt=(e,t,n)=>Vt.BASE.multiplyAndAddUnsafe(e,t,n);function Zt(e){let t=Nt.utils.normPrivateKeyToScalar(e),n=Vt.fromPrivateKey(t);return{scalar:n.hasEvenY()?t:Wt(-t),bytes:zt(n)}}function Jt(e){if(!Mt(e))throw new Error("bad x: need 0 < x < p");const t=Gt(e*e);let n=$t(Gt(t*e+BigInt(7)));n%Bt!==Ht&&(n=Gt(-n));const r=new Vt(e,n,Tt);return r.assertValidity(),r}function Qt(...e){return Wt(Me(Dt("BIP0340/challenge",...e)))}function Xt(e,t,n){const r=ze("signature",e,64),o=ze("message",t),i=ze("publicKey",n,32);try{const e=Jt(Me(i)),t=Me(r.subarray(0,32));if(!Mt(t))return!1;const n=Me(r.subarray(32,64));if(!qt(n))return!1;const s=Qt(Kt(t),zt(e),o),a=Yt(e,n,Wt(-s));return!(!a||!a.hasEvenY()||a.toAffine().x!==t)}catch(e){return!1}}const en={getPublicKey:function(e){return Zt(e).bytes},sign:function(e,t,n=xe(32)){const r=ze("message",e),{bytes:o,scalar:i}=Zt(t),s=ze("auxRand",n,32),a=Kt(i^Me(Dt("BIP0340/aux",s))),c=Dt("BIP0340/nonce",a,o,r),u=Wt(Me(c));if(u===Ht)throw new Error("sign failed: k is zero");const{bytes:l,scalar:h}=Zt(u),f=Qt(l,o,r),d=new Uint8Array(64);if(d.set(l,0),d.set(Kt(Wt(h+f*i)),32),!Xt(d,r,o))throw new Error("sign: Invalid signature produced");return d},verify:Xt,utils:{randomPrivateKey:Nt.utils.randomPrivateKey,lift_x:Jt,pointToBytes:zt,numberToBytesBE:Fe,bytesToNumberBE:Me,taggedHash:Dt,mod:at}},tn=function(e,t){const n=t.map((e=>Array.from(e).reverse()));return(t,r)=>{const[o,i,s,a]=n.map((n=>n.reduce(((n,r)=>e.add(e.mul(n,t),r)))));return t=e.div(o,i),r=e.mul(r,e.div(s,a)),{x:t,y:r}}}(Ut,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map((e=>e.map((e=>BigInt(e)))))),nn=function(e,t){if(dt(e),!e.isValid(t.A)||!e.isValid(t.B)||!e.isValid(t.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const n=function(e,t){const n=e.ORDER;let r=_t;for(let e=n-xt;e%Et===_t;e/=Et)r+=xt;const o=r,i=(n-xt)/Et**o,s=(i-xt)/Et,a=Et**o-xt,c=Et**(o-xt),u=e.pow(t,i),l=e.pow(t,(i+xt)/Et);let h=(t,n)=>{let r=u,i=e.pow(n,a),h=e.sqr(i);h=e.mul(h,n);let f=e.mul(t,h);f=e.pow(f,s),f=e.mul(f,i),i=e.mul(f,n),h=e.mul(f,t);let d=e.mul(h,i);f=e.pow(d,c);let p=e.eql(f,e.ONE);i=e.mul(h,l),f=e.mul(d,r),h=e.cmov(i,h,p),d=e.cmov(f,d,p);for(let t=o;t>xt;t--){let n=Et**(t-Et),o=e.pow(d,n);const s=e.eql(o,e.ONE);i=e.mul(h,r),r=e.mul(r,r),o=e.mul(d,r),h=e.cmov(i,h,s),d=e.cmov(o,d,s)}return{isValid:p,value:h}};if(e.ORDER%St===kt){const n=(e.ORDER-kt)/St,r=e.sqrt(e.neg(t));h=(t,o)=>{let i=e.sqr(o);const s=e.mul(t,o);i=e.mul(i,s);let a=e.pow(i,n);a=e.mul(a,s);const c=e.mul(a,r),u=e.mul(e.sqr(a),o),l=e.eql(u,t);return{isValid:l,value:e.cmov(c,a,l)}}}return h}(e,t.Z);if(!e.isOdd)throw new Error("Fp.isOdd is not implemented!");return r=>{let o,i,s,a,c,u,l,h;o=e.sqr(r),o=e.mul(o,t.Z),i=e.sqr(o),i=e.add(i,o),s=e.add(i,e.ONE),s=e.mul(s,t.B),a=e.cmov(t.Z,e.neg(i),!e.eql(i,e.ZERO)),a=e.mul(a,t.A),i=e.sqr(s),u=e.sqr(a),c=e.mul(u,t.A),i=e.add(i,c),i=e.mul(i,s),u=e.mul(u,a),c=e.mul(u,t.B),i=e.add(i,c),l=e.mul(o,s);const{isValid:f,value:d}=n(i,u);h=e.mul(o,r),h=e.mul(h,d),l=e.cmov(l,s,f),h=e.cmov(h,d,f);const p=e.isOdd(r)===e.isOdd(h);return h=e.cmov(e.neg(h),h,p),l=e.div(l,a),{x:l,y:h}}}(Ut,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:Ut.create(BigInt("-11"))});!function(e,t,n){if("function"!=typeof t)throw new Error("mapToCurve() must be defined")}(Nt.ProjectivePoint,(e=>{const{x:t,y:n}=nn(Ut.create(e[0]));return tn(t,n)}),{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:Ut.ORDER,m:1,k:128,expand:"xmd",hash:Ie});const rn="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,on=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),sn=(e,t)=>e<<32-t|e>>>t; +/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");const an=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function cn(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let n=0;ne().update(ln(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function dn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function pn(e,...t){if(!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new TypeError(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}const yn={number:dn,bool:function(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)},bytes:pn,hash:function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");dn(e.outputLen),dn(e.blockLen)},exists:function(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")},output:function(e,t){pn(e);const n=t.outputLen;if(e.lengthr-i&&(this.process(n,0),i=0);for(let e=i;e>o&i),a=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+u,a,r)}(n,r-8,BigInt(8*this.length),o),this.process(n,0);const s=on(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;ee&t^e&n^t&n,wn=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]),vn=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),mn=new Uint32Array(64);let _n=class extends gn{constructor(){super(64,32,8,!1),this.A=0|vn[0],this.B=0|vn[1],this.C=0|vn[2],this.D=0|vn[3],this.E=0|vn[4],this.F=0|vn[5],this.G=0|vn[6],this.H=0|vn[7]}get(){const{A:e,B:t,C:n,D:r,E:o,F:i,G:s,H:a}=this;return[e,t,n,r,o,i,s,a]}set(e,t,n,r,o,i,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|a}process(e,t){for(let n=0;n<16;n++,t+=4)mn[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=mn[e-15],n=mn[e-2],r=sn(t,7)^sn(t,18)^t>>>3,o=sn(n,17)^sn(n,19)^n>>>10;mn[e]=o+mn[e-7]+r+mn[e-16]|0}let{A:n,B:r,C:o,D:i,E:s,F:a,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(sn(s,6)^sn(s,11)^sn(s,25))+((l=s)&a^~l&c)+wn[e]+mn[e]|0,h=(sn(n,2)^sn(n,13)^sn(n,22))+bn(n,r,o)|0;u=c,c=a,a=s,s=i+t|0,i=o,o=r,r=n,n=t+h|0}var l;n=n+this.A|0,r=r+this.B|0,o=o+this.C|0,i=i+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(n,r,o,i,s,a,c,u)}roundClean(){mn.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},xn=class extends _n{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 En=fn((()=>new _n)); /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */ -function an(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function cn(...e){const t=(e,t)=>n=>e(t(n));return{encode:Array.from(e).reverse().reduce(((e,n)=>e?t(e,n.encode):n.encode),void 0),decode:e.reduce(((e,n)=>e?t(e,n.decode):n.decode),void 0)}}function un(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map((t=>{if(an(t),t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]}))},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map((t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const n=e.indexOf(t);if(-1===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n}))}}}function ln(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function fn(e,t="="){if(an(e),"string"!=typeof t)throw new Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;n.length*e%8;)n.push(t);return n},decode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);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 hn(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function dn(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((e=>{if(an(e),e<0||e>=t)throw new Error(`Wrong integer: ${e}`)}));;){let e=0,s=!0;for(let o=r;o{const{x:t,y:n}=sn(zt.create(e[0]));return on(t,n)}),{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:zt.ORDER,m:1,k:128,expand:"xmd",hash:Be});const pn=(e,t)=>t?pn(t,e%t):e,yn=(e,t)=>e+(t-pn(e,t));function gn(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(yn(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${yn(t,n)}`);let o=0,i=0;const s=2**n-1,a=[];for(const r of e){if(an(r),r>=2**t)throw new Error(`convertRadix2: invalid data word=${r} from=${t}`);if(o=o<32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=n;i-=n)a.push((o>>i-n&s)>>>0);o&=2**i-1}if(o=o<=t)throw new Error("Excess padding");if(!r&&o)throw new Error(`Non-zero padding: ${o}`);return r&&i>0&&a.push(o>>>0),a}function bn(e,t=!1){if(an(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(yn(8,e)>32||yn(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 gn(Array.from(n),8,e,!t)},decode:n=>{if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(gn(n,e,8,t))}}}function wn(e){if("function"!=typeof e)throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch(e){}}}const vn=cn(bn(4),un("0123456789ABCDEF"),ln("")),mn=cn(bn(5),un("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),fn(5),ln(""));cn(bn(5),un("0123456789ABCDEFGHIJKLMNOPQRSTUV"),fn(5),ln("")),cn(bn(5),un("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),ln(""),hn((e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))));const _n=cn(bn(6),un("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),fn(6),ln("")),xn=cn(bn(6),un("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),fn(6),ln("")),En=e=>{return cn((an(t=58),{encode:e=>{if(!(e instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return dn(Array.from(e),256,t)},decode:e=>{if(!Array.isArray(e)||e.length&&"number"!=typeof e[0])throw new Error("radix.decode input should be array of strings");return Uint8Array.from(dn(e,t,256))}}),un(e),ln(""));var t},kn=En("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");En("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),En("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const Sn=[0,2,3,5,6,7,9,10,11],An={encode(e){let t="";for(let n=0;n>25;let n=(33554431&e)<<5;for(let e=0;e>e&1)&&(n^=Cn[e]);return n}function Pn(e,t,n=1){const r=e.length;let o=1;for(let t=0;t126)throw new Error(`Invalid prefix (${e})`);o=In(o)^n>>5}o=In(o);for(let t=0;tn)throw new TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${n})`);const r=e.toLowerCase();if(e!==r&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const o=(e=r).lastIndexOf("1");if(0===o||-1===o)throw new Error('Letter "1" must be present between prefix and data only');const i=e.slice(0,o),s=e.slice(o+1);if(s.length<6)throw new Error("Data must be at least 6 characters long");const a=On.decode(s).slice(0,-6),c=Pn(i,a,t);if(!s.endsWith(c))throw new Error(`Invalid checksum in ${e}: expected "${c}"`);return{prefix:i,words:a}}return{encode:function(e,n,r=90){if("string"!=typeof e)throw new Error("bech32.encode prefix should be string, not "+typeof e);if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof n);const o=e.length+7+n.length;if(!1!==r&&o>r)throw new TypeError(`Length ${o} exceeds limit ${r}`);return`${e=e.toLowerCase()}1${On.encode(n)}${Pn(e,n,t)}`},decode:s,decodeToBytes:function(e){const{prefix:t,words:n}=s(e,!1);return{prefix:t,words:n,bytes:r(n)}},decodeUnsafe:wn(s),fromWords:r,fromWordsUnsafe:i,toWords:o}}const Ln=Tn("bech32");Tn("bech32m");const Bn={utf8:{encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)},hex:cn(bn(4),un("0123456789abcdef"),ln(""),hn((e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()}))),base16:vn,base32:mn,base64:_n,base64url:xn,base58:kn,base58xmr:An};Object.keys(Bn).join(", ");var Rn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function $n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var jn={};Object.defineProperty(jn,"__esModule",{value:!0});var Un=jn.wordlist=void 0;Un=jn.wordlist="abandon\nability\nable\nabout\nabove\nabsent\nabsorb\nabstract\nabsurd\nabuse\naccess\naccident\naccount\naccuse\nachieve\nacid\nacoustic\nacquire\nacross\nact\naction\nactor\nactress\nactual\nadapt\nadd\naddict\naddress\nadjust\nadmit\nadult\nadvance\nadvice\naerobic\naffair\nafford\nafraid\nagain\nage\nagent\nagree\nahead\naim\nair\nairport\naisle\nalarm\nalbum\nalcohol\nalert\nalien\nall\nalley\nallow\nalmost\nalone\nalpha\nalready\nalso\nalter\nalways\namateur\namazing\namong\namount\namused\nanalyst\nanchor\nancient\nanger\nangle\nangry\nanimal\nankle\nannounce\nannual\nanother\nanswer\nantenna\nantique\nanxiety\nany\napart\napology\nappear\napple\napprove\napril\narch\narctic\narea\narena\nargue\narm\narmed\narmor\narmy\naround\narrange\narrest\narrive\narrow\nart\nartefact\nartist\nartwork\nask\naspect\nassault\nasset\nassist\nassume\nasthma\nathlete\natom\nattack\nattend\nattitude\nattract\nauction\naudit\naugust\naunt\nauthor\nauto\nautumn\naverage\navocado\navoid\nawake\naware\naway\nawesome\nawful\nawkward\naxis\nbaby\nbachelor\nbacon\nbadge\nbag\nbalance\nbalcony\nball\nbamboo\nbanana\nbanner\nbar\nbarely\nbargain\nbarrel\nbase\nbasic\nbasket\nbattle\nbeach\nbean\nbeauty\nbecause\nbecome\nbeef\nbefore\nbegin\nbehave\nbehind\nbelieve\nbelow\nbelt\nbench\nbenefit\nbest\nbetray\nbetter\nbetween\nbeyond\nbicycle\nbid\nbike\nbind\nbiology\nbird\nbirth\nbitter\nblack\nblade\nblame\nblanket\nblast\nbleak\nbless\nblind\nblood\nblossom\nblouse\nblue\nblur\nblush\nboard\nboat\nbody\nboil\nbomb\nbone\nbonus\nbook\nboost\nborder\nboring\nborrow\nboss\nbottom\nbounce\nbox\nboy\nbracket\nbrain\nbrand\nbrass\nbrave\nbread\nbreeze\nbrick\nbridge\nbrief\nbright\nbring\nbrisk\nbroccoli\nbroken\nbronze\nbroom\nbrother\nbrown\nbrush\nbubble\nbuddy\nbudget\nbuffalo\nbuild\nbulb\nbulk\nbullet\nbundle\nbunker\nburden\nburger\nburst\nbus\nbusiness\nbusy\nbutter\nbuyer\nbuzz\ncabbage\ncabin\ncable\ncactus\ncage\ncake\ncall\ncalm\ncamera\ncamp\ncan\ncanal\ncancel\ncandy\ncannon\ncanoe\ncanvas\ncanyon\ncapable\ncapital\ncaptain\ncar\ncarbon\ncard\ncargo\ncarpet\ncarry\ncart\ncase\ncash\ncasino\ncastle\ncasual\ncat\ncatalog\ncatch\ncategory\ncattle\ncaught\ncause\ncaution\ncave\nceiling\ncelery\ncement\ncensus\ncentury\ncereal\ncertain\nchair\nchalk\nchampion\nchange\nchaos\nchapter\ncharge\nchase\nchat\ncheap\ncheck\ncheese\nchef\ncherry\nchest\nchicken\nchief\nchild\nchimney\nchoice\nchoose\nchronic\nchuckle\nchunk\nchurn\ncigar\ncinnamon\ncircle\ncitizen\ncity\ncivil\nclaim\nclap\nclarify\nclaw\nclay\nclean\nclerk\nclever\nclick\nclient\ncliff\nclimb\nclinic\nclip\nclock\nclog\nclose\ncloth\ncloud\nclown\nclub\nclump\ncluster\nclutch\ncoach\ncoast\ncoconut\ncode\ncoffee\ncoil\ncoin\ncollect\ncolor\ncolumn\ncombine\ncome\ncomfort\ncomic\ncommon\ncompany\nconcert\nconduct\nconfirm\ncongress\nconnect\nconsider\ncontrol\nconvince\ncook\ncool\ncopper\ncopy\ncoral\ncore\ncorn\ncorrect\ncost\ncotton\ncouch\ncountry\ncouple\ncourse\ncousin\ncover\ncoyote\ncrack\ncradle\ncraft\ncram\ncrane\ncrash\ncrater\ncrawl\ncrazy\ncream\ncredit\ncreek\ncrew\ncricket\ncrime\ncrisp\ncritic\ncrop\ncross\ncrouch\ncrowd\ncrucial\ncruel\ncruise\ncrumble\ncrunch\ncrush\ncry\ncrystal\ncube\nculture\ncup\ncupboard\ncurious\ncurrent\ncurtain\ncurve\ncushion\ncustom\ncute\ncycle\ndad\ndamage\ndamp\ndance\ndanger\ndaring\ndash\ndaughter\ndawn\nday\ndeal\ndebate\ndebris\ndecade\ndecember\ndecide\ndecline\ndecorate\ndecrease\ndeer\ndefense\ndefine\ndefy\ndegree\ndelay\ndeliver\ndemand\ndemise\ndenial\ndentist\ndeny\ndepart\ndepend\ndeposit\ndepth\ndeputy\nderive\ndescribe\ndesert\ndesign\ndesk\ndespair\ndestroy\ndetail\ndetect\ndevelop\ndevice\ndevote\ndiagram\ndial\ndiamond\ndiary\ndice\ndiesel\ndiet\ndiffer\ndigital\ndignity\ndilemma\ndinner\ndinosaur\ndirect\ndirt\ndisagree\ndiscover\ndisease\ndish\ndismiss\ndisorder\ndisplay\ndistance\ndivert\ndivide\ndivorce\ndizzy\ndoctor\ndocument\ndog\ndoll\ndolphin\ndomain\ndonate\ndonkey\ndonor\ndoor\ndose\ndouble\ndove\ndraft\ndragon\ndrama\ndrastic\ndraw\ndream\ndress\ndrift\ndrill\ndrink\ndrip\ndrive\ndrop\ndrum\ndry\nduck\ndumb\ndune\nduring\ndust\ndutch\nduty\ndwarf\ndynamic\neager\neagle\nearly\nearn\nearth\neasily\neast\neasy\necho\necology\neconomy\nedge\nedit\neducate\neffort\negg\neight\neither\nelbow\nelder\nelectric\nelegant\nelement\nelephant\nelevator\nelite\nelse\nembark\nembody\nembrace\nemerge\nemotion\nemploy\nempower\nempty\nenable\nenact\nend\nendless\nendorse\nenemy\nenergy\nenforce\nengage\nengine\nenhance\nenjoy\nenlist\nenough\nenrich\nenroll\nensure\nenter\nentire\nentry\nenvelope\nepisode\nequal\nequip\nera\nerase\nerode\nerosion\nerror\nerupt\nescape\nessay\nessence\nestate\neternal\nethics\nevidence\nevil\nevoke\nevolve\nexact\nexample\nexcess\nexchange\nexcite\nexclude\nexcuse\nexecute\nexercise\nexhaust\nexhibit\nexile\nexist\nexit\nexotic\nexpand\nexpect\nexpire\nexplain\nexpose\nexpress\nextend\nextra\neye\neyebrow\nfabric\nface\nfaculty\nfade\nfaint\nfaith\nfall\nfalse\nfame\nfamily\nfamous\nfan\nfancy\nfantasy\nfarm\nfashion\nfat\nfatal\nfather\nfatigue\nfault\nfavorite\nfeature\nfebruary\nfederal\nfee\nfeed\nfeel\nfemale\nfence\nfestival\nfetch\nfever\nfew\nfiber\nfiction\nfield\nfigure\nfile\nfilm\nfilter\nfinal\nfind\nfine\nfinger\nfinish\nfire\nfirm\nfirst\nfiscal\nfish\nfit\nfitness\nfix\nflag\nflame\nflash\nflat\nflavor\nflee\nflight\nflip\nfloat\nflock\nfloor\nflower\nfluid\nflush\nfly\nfoam\nfocus\nfog\nfoil\nfold\nfollow\nfood\nfoot\nforce\nforest\nforget\nfork\nfortune\nforum\nforward\nfossil\nfoster\nfound\nfox\nfragile\nframe\nfrequent\nfresh\nfriend\nfringe\nfrog\nfront\nfrost\nfrown\nfrozen\nfruit\nfuel\nfun\nfunny\nfurnace\nfury\nfuture\ngadget\ngain\ngalaxy\ngallery\ngame\ngap\ngarage\ngarbage\ngarden\ngarlic\ngarment\ngas\ngasp\ngate\ngather\ngauge\ngaze\ngeneral\ngenius\ngenre\ngentle\ngenuine\ngesture\nghost\ngiant\ngift\ngiggle\nginger\ngiraffe\ngirl\ngive\nglad\nglance\nglare\nglass\nglide\nglimpse\nglobe\ngloom\nglory\nglove\nglow\nglue\ngoat\ngoddess\ngold\ngood\ngoose\ngorilla\ngospel\ngossip\ngovern\ngown\ngrab\ngrace\ngrain\ngrant\ngrape\ngrass\ngravity\ngreat\ngreen\ngrid\ngrief\ngrit\ngrocery\ngroup\ngrow\ngrunt\nguard\nguess\nguide\nguilt\nguitar\ngun\ngym\nhabit\nhair\nhalf\nhammer\nhamster\nhand\nhappy\nharbor\nhard\nharsh\nharvest\nhat\nhave\nhawk\nhazard\nhead\nhealth\nheart\nheavy\nhedgehog\nheight\nhello\nhelmet\nhelp\nhen\nhero\nhidden\nhigh\nhill\nhint\nhip\nhire\nhistory\nhobby\nhockey\nhold\nhole\nholiday\nhollow\nhome\nhoney\nhood\nhope\nhorn\nhorror\nhorse\nhospital\nhost\nhotel\nhour\nhover\nhub\nhuge\nhuman\nhumble\nhumor\nhundred\nhungry\nhunt\nhurdle\nhurry\nhurt\nhusband\nhybrid\nice\nicon\nidea\nidentify\nidle\nignore\nill\nillegal\nillness\nimage\nimitate\nimmense\nimmune\nimpact\nimpose\nimprove\nimpulse\ninch\ninclude\nincome\nincrease\nindex\nindicate\nindoor\nindustry\ninfant\ninflict\ninform\ninhale\ninherit\ninitial\ninject\ninjury\ninmate\ninner\ninnocent\ninput\ninquiry\ninsane\ninsect\ninside\ninspire\ninstall\nintact\ninterest\ninto\ninvest\ninvite\ninvolve\niron\nisland\nisolate\nissue\nitem\nivory\njacket\njaguar\njar\njazz\njealous\njeans\njelly\njewel\njob\njoin\njoke\njourney\njoy\njudge\njuice\njump\njungle\njunior\njunk\njust\nkangaroo\nkeen\nkeep\nketchup\nkey\nkick\nkid\nkidney\nkind\nkingdom\nkiss\nkit\nkitchen\nkite\nkitten\nkiwi\nknee\nknife\nknock\nknow\nlab\nlabel\nlabor\nladder\nlady\nlake\nlamp\nlanguage\nlaptop\nlarge\nlater\nlatin\nlaugh\nlaundry\nlava\nlaw\nlawn\nlawsuit\nlayer\nlazy\nleader\nleaf\nlearn\nleave\nlecture\nleft\nleg\nlegal\nlegend\nleisure\nlemon\nlend\nlength\nlens\nleopard\nlesson\nletter\nlevel\nliar\nliberty\nlibrary\nlicense\nlife\nlift\nlight\nlike\nlimb\nlimit\nlink\nlion\nliquid\nlist\nlittle\nlive\nlizard\nload\nloan\nlobster\nlocal\nlock\nlogic\nlonely\nlong\nloop\nlottery\nloud\nlounge\nlove\nloyal\nlucky\nluggage\nlumber\nlunar\nlunch\nluxury\nlyrics\nmachine\nmad\nmagic\nmagnet\nmaid\nmail\nmain\nmajor\nmake\nmammal\nman\nmanage\nmandate\nmango\nmansion\nmanual\nmaple\nmarble\nmarch\nmargin\nmarine\nmarket\nmarriage\nmask\nmass\nmaster\nmatch\nmaterial\nmath\nmatrix\nmatter\nmaximum\nmaze\nmeadow\nmean\nmeasure\nmeat\nmechanic\nmedal\nmedia\nmelody\nmelt\nmember\nmemory\nmention\nmenu\nmercy\nmerge\nmerit\nmerry\nmesh\nmessage\nmetal\nmethod\nmiddle\nmidnight\nmilk\nmillion\nmimic\nmind\nminimum\nminor\nminute\nmiracle\nmirror\nmisery\nmiss\nmistake\nmix\nmixed\nmixture\nmobile\nmodel\nmodify\nmom\nmoment\nmonitor\nmonkey\nmonster\nmonth\nmoon\nmoral\nmore\nmorning\nmosquito\nmother\nmotion\nmotor\nmountain\nmouse\nmove\nmovie\nmuch\nmuffin\nmule\nmultiply\nmuscle\nmuseum\nmushroom\nmusic\nmust\nmutual\nmyself\nmystery\nmyth\nnaive\nname\nnapkin\nnarrow\nnasty\nnation\nnature\nnear\nneck\nneed\nnegative\nneglect\nneither\nnephew\nnerve\nnest\nnet\nnetwork\nneutral\nnever\nnews\nnext\nnice\nnight\nnoble\nnoise\nnominee\nnoodle\nnormal\nnorth\nnose\nnotable\nnote\nnothing\nnotice\nnovel\nnow\nnuclear\nnumber\nnurse\nnut\noak\nobey\nobject\noblige\nobscure\nobserve\nobtain\nobvious\noccur\nocean\noctober\nodor\noff\noffer\noffice\noften\noil\nokay\nold\nolive\nolympic\nomit\nonce\none\nonion\nonline\nonly\nopen\nopera\nopinion\noppose\noption\norange\norbit\norchard\norder\nordinary\norgan\norient\noriginal\norphan\nostrich\nother\noutdoor\nouter\noutput\noutside\noval\noven\nover\nown\nowner\noxygen\noyster\nozone\npact\npaddle\npage\npair\npalace\npalm\npanda\npanel\npanic\npanther\npaper\nparade\nparent\npark\nparrot\nparty\npass\npatch\npath\npatient\npatrol\npattern\npause\npave\npayment\npeace\npeanut\npear\npeasant\npelican\npen\npenalty\npencil\npeople\npepper\nperfect\npermit\nperson\npet\nphone\nphoto\nphrase\nphysical\npiano\npicnic\npicture\npiece\npig\npigeon\npill\npilot\npink\npioneer\npipe\npistol\npitch\npizza\nplace\nplanet\nplastic\nplate\nplay\nplease\npledge\npluck\nplug\nplunge\npoem\npoet\npoint\npolar\npole\npolice\npond\npony\npool\npopular\nportion\nposition\npossible\npost\npotato\npottery\npoverty\npowder\npower\npractice\npraise\npredict\nprefer\nprepare\npresent\npretty\nprevent\nprice\npride\nprimary\nprint\npriority\nprison\nprivate\nprize\nproblem\nprocess\nproduce\nprofit\nprogram\nproject\npromote\nproof\nproperty\nprosper\nprotect\nproud\nprovide\npublic\npudding\npull\npulp\npulse\npumpkin\npunch\npupil\npuppy\npurchase\npurity\npurpose\npurse\npush\nput\npuzzle\npyramid\nquality\nquantum\nquarter\nquestion\nquick\nquit\nquiz\nquote\nrabbit\nraccoon\nrace\nrack\nradar\nradio\nrail\nrain\nraise\nrally\nramp\nranch\nrandom\nrange\nrapid\nrare\nrate\nrather\nraven\nraw\nrazor\nready\nreal\nreason\nrebel\nrebuild\nrecall\nreceive\nrecipe\nrecord\nrecycle\nreduce\nreflect\nreform\nrefuse\nregion\nregret\nregular\nreject\nrelax\nrelease\nrelief\nrely\nremain\nremember\nremind\nremove\nrender\nrenew\nrent\nreopen\nrepair\nrepeat\nreplace\nreport\nrequire\nrescue\nresemble\nresist\nresource\nresponse\nresult\nretire\nretreat\nreturn\nreunion\nreveal\nreview\nreward\nrhythm\nrib\nribbon\nrice\nrich\nride\nridge\nrifle\nright\nrigid\nring\nriot\nripple\nrisk\nritual\nrival\nriver\nroad\nroast\nrobot\nrobust\nrocket\nromance\nroof\nrookie\nroom\nrose\nrotate\nrough\nround\nroute\nroyal\nrubber\nrude\nrug\nrule\nrun\nrunway\nrural\nsad\nsaddle\nsadness\nsafe\nsail\nsalad\nsalmon\nsalon\nsalt\nsalute\nsame\nsample\nsand\nsatisfy\nsatoshi\nsauce\nsausage\nsave\nsay\nscale\nscan\nscare\nscatter\nscene\nscheme\nschool\nscience\nscissors\nscorpion\nscout\nscrap\nscreen\nscript\nscrub\nsea\nsearch\nseason\nseat\nsecond\nsecret\nsection\nsecurity\nseed\nseek\nsegment\nselect\nsell\nseminar\nsenior\nsense\nsentence\nseries\nservice\nsession\nsettle\nsetup\nseven\nshadow\nshaft\nshallow\nshare\nshed\nshell\nsheriff\nshield\nshift\nshine\nship\nshiver\nshock\nshoe\nshoot\nshop\nshort\nshoulder\nshove\nshrimp\nshrug\nshuffle\nshy\nsibling\nsick\nside\nsiege\nsight\nsign\nsilent\nsilk\nsilly\nsilver\nsimilar\nsimple\nsince\nsing\nsiren\nsister\nsituate\nsix\nsize\nskate\nsketch\nski\nskill\nskin\nskirt\nskull\nslab\nslam\nsleep\nslender\nslice\nslide\nslight\nslim\nslogan\nslot\nslow\nslush\nsmall\nsmart\nsmile\nsmoke\nsmooth\nsnack\nsnake\nsnap\nsniff\nsnow\nsoap\nsoccer\nsocial\nsock\nsoda\nsoft\nsolar\nsoldier\nsolid\nsolution\nsolve\nsomeone\nsong\nsoon\nsorry\nsort\nsoul\nsound\nsoup\nsource\nsouth\nspace\nspare\nspatial\nspawn\nspeak\nspecial\nspeed\nspell\nspend\nsphere\nspice\nspider\nspike\nspin\nspirit\nsplit\nspoil\nsponsor\nspoon\nsport\nspot\nspray\nspread\nspring\nspy\nsquare\nsqueeze\nsquirrel\nstable\nstadium\nstaff\nstage\nstairs\nstamp\nstand\nstart\nstate\nstay\nsteak\nsteel\nstem\nstep\nstereo\nstick\nstill\nsting\nstock\nstomach\nstone\nstool\nstory\nstove\nstrategy\nstreet\nstrike\nstrong\nstruggle\nstudent\nstuff\nstumble\nstyle\nsubject\nsubmit\nsubway\nsuccess\nsuch\nsudden\nsuffer\nsugar\nsuggest\nsuit\nsummer\nsun\nsunny\nsunset\nsuper\nsupply\nsupreme\nsure\nsurface\nsurge\nsurprise\nsurround\nsurvey\nsuspect\nsustain\nswallow\nswamp\nswap\nswarm\nswear\nsweet\nswift\nswim\nswing\nswitch\nsword\nsymbol\nsymptom\nsyrup\nsystem\ntable\ntackle\ntag\ntail\ntalent\ntalk\ntank\ntape\ntarget\ntask\ntaste\ntattoo\ntaxi\nteach\nteam\ntell\nten\ntenant\ntennis\ntent\nterm\ntest\ntext\nthank\nthat\ntheme\nthen\ntheory\nthere\nthey\nthing\nthis\nthought\nthree\nthrive\nthrow\nthumb\nthunder\nticket\ntide\ntiger\ntilt\ntimber\ntime\ntiny\ntip\ntired\ntissue\ntitle\ntoast\ntobacco\ntoday\ntoddler\ntoe\ntogether\ntoilet\ntoken\ntomato\ntomorrow\ntone\ntongue\ntonight\ntool\ntooth\ntop\ntopic\ntopple\ntorch\ntornado\ntortoise\ntoss\ntotal\ntourist\ntoward\ntower\ntown\ntoy\ntrack\ntrade\ntraffic\ntragic\ntrain\ntransfer\ntrap\ntrash\ntravel\ntray\ntreat\ntree\ntrend\ntrial\ntribe\ntrick\ntrigger\ntrim\ntrip\ntrophy\ntrouble\ntruck\ntrue\ntruly\ntrumpet\ntrust\ntruth\ntry\ntube\ntuition\ntumble\ntuna\ntunnel\nturkey\nturn\nturtle\ntwelve\ntwenty\ntwice\ntwin\ntwist\ntwo\ntype\ntypical\nugly\numbrella\nunable\nunaware\nuncle\nuncover\nunder\nundo\nunfair\nunfold\nunhappy\nuniform\nunique\nunit\nuniverse\nunknown\nunlock\nuntil\nunusual\nunveil\nupdate\nupgrade\nuphold\nupon\nupper\nupset\nurban\nurge\nusage\nuse\nused\nuseful\nuseless\nusual\nutility\nvacant\nvacuum\nvague\nvalid\nvalley\nvalve\nvan\nvanish\nvapor\nvarious\nvast\nvault\nvehicle\nvelvet\nvendor\nventure\nvenue\nverb\nverify\nversion\nvery\nvessel\nveteran\nviable\nvibrant\nvicious\nvictory\nvideo\nview\nvillage\nvintage\nviolin\nvirtual\nvirus\nvisa\nvisit\nvisual\nvital\nvivid\nvocal\nvoice\nvoid\nvolcano\nvolume\nvote\nvoyage\nwage\nwagon\nwait\nwalk\nwall\nwalnut\nwant\nwarfare\nwarm\nwarrior\nwash\nwasp\nwaste\nwater\nwave\nway\nwealth\nweapon\nwear\nweasel\nweather\nweb\nwedding\nweekend\nweird\nwelcome\nwest\nwet\nwhale\nwhat\nwheat\nwheel\nwhen\nwhere\nwhip\nwhisper\nwide\nwidth\nwife\nwild\nwill\nwin\nwindow\nwine\nwing\nwink\nwinner\nwinter\nwire\nwisdom\nwise\nwish\nwitness\nwolf\nwoman\nwonder\nwood\nwool\nword\nwork\nworld\nworry\nworth\nwrap\nwreck\nwrestle\nwrist\nwrite\nwrong\nyard\nyear\nyellow\nyou\nyoung\nyouth\nzebra\nzero\nzone\nzoo".split("\n");var Nn={},Hn={};function zn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function Mn(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)}function qn(e,...t){if(!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new TypeError(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function Fn(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");zn(e.outputLen),zn(e.blockLen)}function Dn(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 Kn(e,t){qn(e);const n=t.outputLen;if(e.lengthn=>e(t(n));return{encode:Array.from(e).reverse().reduce(((e,n)=>e?t(e,n.encode):n.encode),void 0),decode:e.reduce(((e,n)=>e?t(e,n.decode):n.decode),void 0)}}function An(e){return{encode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("alphabet.encode input should be an array of numbers");return t.map((t=>{if(kn(t),t<0||t>=e.length)throw new Error(`Digit index outside alphabet: ${t} (alphabet: ${e.length})`);return e[t]}))},decode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map((t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const n=e.indexOf(t);if(-1===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n}))}}}function On(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function Cn(e,t="="){if(kn(e),"string"!=typeof t)throw new Error("padding chr should be string");return{encode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;n.length*e%8;)n.push(t);return n},decode(n){if(!Array.isArray(n)||n.length&&"string"!=typeof n[0])throw new Error("padding.encode input should be array of strings");for(let e of n)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);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 Pn(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function In(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((e=>{if(kn(e),e<0||e>=t)throw new Error(`Wrong integer: ${e}`)}));;){let e=0,s=!0;for(let o=r;onew xn));const Ln=(e,t)=>t?Ln(t,e%t):e,jn=(e,t)=>e+(t-Ln(e,t));function Tn(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(jn(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${jn(t,n)}`);let o=0,i=0;const s=2**n-1,a=[];for(const r of e){if(kn(r),r>=2**t)throw new Error(`convertRadix2: invalid data word=${r} from=${t}`);if(o=o<32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=n;i-=n)a.push((o>>i-n&s)>>>0);o&=2**i-1}if(o=o<=t)throw new Error("Excess padding");if(!r&&o)throw new Error(`Non-zero padding: ${o}`);return r&&i>0&&a.push(o>>>0),a}function Bn(e,t=!1){if(kn(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(jn(8,e)>32||jn(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 Tn(Array.from(n),8,e,!t)},decode:n=>{if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(Tn(n,e,8,t))}}}function Rn(e){if("function"!=typeof e)throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch(e){}}}const $n=Sn(Bn(4),An("0123456789ABCDEF"),On("")),Un=Sn(Bn(5),An("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),Cn(5),On(""));Sn(Bn(5),An("0123456789ABCDEFGHIJKLMNOPQRSTUV"),Cn(5),On("")),Sn(Bn(5),An("0123456789ABCDEFGHJKMNPQRSTVWXYZ"),On(""),Pn((e=>e.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))));const Nn=Sn(Bn(6),An("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Cn(6),On("")),Hn=Sn(Bn(6),An("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),Cn(6),On("")),Mn=e=>{return Sn((kn(t=58),{encode:e=>{if(!(e instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return In(Array.from(e),256,t)},decode:e=>{if(!Array.isArray(e)||e.length&&"number"!=typeof e[0])throw new Error("radix.decode input should be array of strings");return Uint8Array.from(In(e,t,256))}}),An(e),On(""));var t},qn=Mn("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");Mn("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),Mn("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const Fn=[0,2,3,5,6,7,9,10,11],Dn={encode(e){let t="";for(let n=0;n>25;let n=(33554431&e)<<5;for(let e=0;e>e&1)&&(n^=Kn[e]);return n}function Wn(e,t,n=1){const r=e.length;let o=1;for(let t=0;t126)throw new Error(`Invalid prefix (${e})`);o=Gn(o)^n>>5}o=Gn(o);for(let t=0;tn)throw new TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${n})`);const r=e.toLowerCase();if(e!==r&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const o=(e=r).lastIndexOf("1");if(0===o||-1===o)throw new Error('Letter "1" must be present between prefix and data only');const i=e.slice(0,o),s=e.slice(o+1);if(s.length<6)throw new Error("Data must be at least 6 characters long");const a=zn.decode(s).slice(0,-6),c=Wn(i,a,t);if(!s.endsWith(c))throw new Error(`Invalid checksum in ${e}: expected "${c}"`);return{prefix:i,words:a}}return{encode:function(e,n,r=90){if("string"!=typeof e)throw new Error("bech32.encode prefix should be string, not "+typeof e);if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof n);const o=e.length+7+n.length;if(!1!==r&&o>r)throw new TypeError(`Length ${o} exceeds limit ${r}`);return`${e=e.toLowerCase()}1${zn.encode(n)}${Wn(e,n,t)}`},decode:s,decodeToBytes:function(e){const{prefix:t,words:n}=s(e,!1);return{prefix:t,words:n,bytes:r(n)}},decodeUnsafe:Rn(s),fromWords:r,fromWordsUnsafe:i,toWords:o}}const Yn=Vn("bech32");Vn("bech32m");const Zn={utf8:{encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)},hex:Sn(Bn(4),An("0123456789abcdef"),On(""),Pn((e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()}))),base16:$n,base32:Un,base64:Nn,base64url:Hn,base58:qn,base58xmr:Dn};Object.keys(Zn).join(", ");var Jn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Qn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Xn={};Object.defineProperty(Xn,"__esModule",{value:!0});var er=Xn.wordlist=void 0;er=Xn.wordlist="abandon\nability\nable\nabout\nabove\nabsent\nabsorb\nabstract\nabsurd\nabuse\naccess\naccident\naccount\naccuse\nachieve\nacid\nacoustic\nacquire\nacross\nact\naction\nactor\nactress\nactual\nadapt\nadd\naddict\naddress\nadjust\nadmit\nadult\nadvance\nadvice\naerobic\naffair\nafford\nafraid\nagain\nage\nagent\nagree\nahead\naim\nair\nairport\naisle\nalarm\nalbum\nalcohol\nalert\nalien\nall\nalley\nallow\nalmost\nalone\nalpha\nalready\nalso\nalter\nalways\namateur\namazing\namong\namount\namused\nanalyst\nanchor\nancient\nanger\nangle\nangry\nanimal\nankle\nannounce\nannual\nanother\nanswer\nantenna\nantique\nanxiety\nany\napart\napology\nappear\napple\napprove\napril\narch\narctic\narea\narena\nargue\narm\narmed\narmor\narmy\naround\narrange\narrest\narrive\narrow\nart\nartefact\nartist\nartwork\nask\naspect\nassault\nasset\nassist\nassume\nasthma\nathlete\natom\nattack\nattend\nattitude\nattract\nauction\naudit\naugust\naunt\nauthor\nauto\nautumn\naverage\navocado\navoid\nawake\naware\naway\nawesome\nawful\nawkward\naxis\nbaby\nbachelor\nbacon\nbadge\nbag\nbalance\nbalcony\nball\nbamboo\nbanana\nbanner\nbar\nbarely\nbargain\nbarrel\nbase\nbasic\nbasket\nbattle\nbeach\nbean\nbeauty\nbecause\nbecome\nbeef\nbefore\nbegin\nbehave\nbehind\nbelieve\nbelow\nbelt\nbench\nbenefit\nbest\nbetray\nbetter\nbetween\nbeyond\nbicycle\nbid\nbike\nbind\nbiology\nbird\nbirth\nbitter\nblack\nblade\nblame\nblanket\nblast\nbleak\nbless\nblind\nblood\nblossom\nblouse\nblue\nblur\nblush\nboard\nboat\nbody\nboil\nbomb\nbone\nbonus\nbook\nboost\nborder\nboring\nborrow\nboss\nbottom\nbounce\nbox\nboy\nbracket\nbrain\nbrand\nbrass\nbrave\nbread\nbreeze\nbrick\nbridge\nbrief\nbright\nbring\nbrisk\nbroccoli\nbroken\nbronze\nbroom\nbrother\nbrown\nbrush\nbubble\nbuddy\nbudget\nbuffalo\nbuild\nbulb\nbulk\nbullet\nbundle\nbunker\nburden\nburger\nburst\nbus\nbusiness\nbusy\nbutter\nbuyer\nbuzz\ncabbage\ncabin\ncable\ncactus\ncage\ncake\ncall\ncalm\ncamera\ncamp\ncan\ncanal\ncancel\ncandy\ncannon\ncanoe\ncanvas\ncanyon\ncapable\ncapital\ncaptain\ncar\ncarbon\ncard\ncargo\ncarpet\ncarry\ncart\ncase\ncash\ncasino\ncastle\ncasual\ncat\ncatalog\ncatch\ncategory\ncattle\ncaught\ncause\ncaution\ncave\nceiling\ncelery\ncement\ncensus\ncentury\ncereal\ncertain\nchair\nchalk\nchampion\nchange\nchaos\nchapter\ncharge\nchase\nchat\ncheap\ncheck\ncheese\nchef\ncherry\nchest\nchicken\nchief\nchild\nchimney\nchoice\nchoose\nchronic\nchuckle\nchunk\nchurn\ncigar\ncinnamon\ncircle\ncitizen\ncity\ncivil\nclaim\nclap\nclarify\nclaw\nclay\nclean\nclerk\nclever\nclick\nclient\ncliff\nclimb\nclinic\nclip\nclock\nclog\nclose\ncloth\ncloud\nclown\nclub\nclump\ncluster\nclutch\ncoach\ncoast\ncoconut\ncode\ncoffee\ncoil\ncoin\ncollect\ncolor\ncolumn\ncombine\ncome\ncomfort\ncomic\ncommon\ncompany\nconcert\nconduct\nconfirm\ncongress\nconnect\nconsider\ncontrol\nconvince\ncook\ncool\ncopper\ncopy\ncoral\ncore\ncorn\ncorrect\ncost\ncotton\ncouch\ncountry\ncouple\ncourse\ncousin\ncover\ncoyote\ncrack\ncradle\ncraft\ncram\ncrane\ncrash\ncrater\ncrawl\ncrazy\ncream\ncredit\ncreek\ncrew\ncricket\ncrime\ncrisp\ncritic\ncrop\ncross\ncrouch\ncrowd\ncrucial\ncruel\ncruise\ncrumble\ncrunch\ncrush\ncry\ncrystal\ncube\nculture\ncup\ncupboard\ncurious\ncurrent\ncurtain\ncurve\ncushion\ncustom\ncute\ncycle\ndad\ndamage\ndamp\ndance\ndanger\ndaring\ndash\ndaughter\ndawn\nday\ndeal\ndebate\ndebris\ndecade\ndecember\ndecide\ndecline\ndecorate\ndecrease\ndeer\ndefense\ndefine\ndefy\ndegree\ndelay\ndeliver\ndemand\ndemise\ndenial\ndentist\ndeny\ndepart\ndepend\ndeposit\ndepth\ndeputy\nderive\ndescribe\ndesert\ndesign\ndesk\ndespair\ndestroy\ndetail\ndetect\ndevelop\ndevice\ndevote\ndiagram\ndial\ndiamond\ndiary\ndice\ndiesel\ndiet\ndiffer\ndigital\ndignity\ndilemma\ndinner\ndinosaur\ndirect\ndirt\ndisagree\ndiscover\ndisease\ndish\ndismiss\ndisorder\ndisplay\ndistance\ndivert\ndivide\ndivorce\ndizzy\ndoctor\ndocument\ndog\ndoll\ndolphin\ndomain\ndonate\ndonkey\ndonor\ndoor\ndose\ndouble\ndove\ndraft\ndragon\ndrama\ndrastic\ndraw\ndream\ndress\ndrift\ndrill\ndrink\ndrip\ndrive\ndrop\ndrum\ndry\nduck\ndumb\ndune\nduring\ndust\ndutch\nduty\ndwarf\ndynamic\neager\neagle\nearly\nearn\nearth\neasily\neast\neasy\necho\necology\neconomy\nedge\nedit\neducate\neffort\negg\neight\neither\nelbow\nelder\nelectric\nelegant\nelement\nelephant\nelevator\nelite\nelse\nembark\nembody\nembrace\nemerge\nemotion\nemploy\nempower\nempty\nenable\nenact\nend\nendless\nendorse\nenemy\nenergy\nenforce\nengage\nengine\nenhance\nenjoy\nenlist\nenough\nenrich\nenroll\nensure\nenter\nentire\nentry\nenvelope\nepisode\nequal\nequip\nera\nerase\nerode\nerosion\nerror\nerupt\nescape\nessay\nessence\nestate\neternal\nethics\nevidence\nevil\nevoke\nevolve\nexact\nexample\nexcess\nexchange\nexcite\nexclude\nexcuse\nexecute\nexercise\nexhaust\nexhibit\nexile\nexist\nexit\nexotic\nexpand\nexpect\nexpire\nexplain\nexpose\nexpress\nextend\nextra\neye\neyebrow\nfabric\nface\nfaculty\nfade\nfaint\nfaith\nfall\nfalse\nfame\nfamily\nfamous\nfan\nfancy\nfantasy\nfarm\nfashion\nfat\nfatal\nfather\nfatigue\nfault\nfavorite\nfeature\nfebruary\nfederal\nfee\nfeed\nfeel\nfemale\nfence\nfestival\nfetch\nfever\nfew\nfiber\nfiction\nfield\nfigure\nfile\nfilm\nfilter\nfinal\nfind\nfine\nfinger\nfinish\nfire\nfirm\nfirst\nfiscal\nfish\nfit\nfitness\nfix\nflag\nflame\nflash\nflat\nflavor\nflee\nflight\nflip\nfloat\nflock\nfloor\nflower\nfluid\nflush\nfly\nfoam\nfocus\nfog\nfoil\nfold\nfollow\nfood\nfoot\nforce\nforest\nforget\nfork\nfortune\nforum\nforward\nfossil\nfoster\nfound\nfox\nfragile\nframe\nfrequent\nfresh\nfriend\nfringe\nfrog\nfront\nfrost\nfrown\nfrozen\nfruit\nfuel\nfun\nfunny\nfurnace\nfury\nfuture\ngadget\ngain\ngalaxy\ngallery\ngame\ngap\ngarage\ngarbage\ngarden\ngarlic\ngarment\ngas\ngasp\ngate\ngather\ngauge\ngaze\ngeneral\ngenius\ngenre\ngentle\ngenuine\ngesture\nghost\ngiant\ngift\ngiggle\nginger\ngiraffe\ngirl\ngive\nglad\nglance\nglare\nglass\nglide\nglimpse\nglobe\ngloom\nglory\nglove\nglow\nglue\ngoat\ngoddess\ngold\ngood\ngoose\ngorilla\ngospel\ngossip\ngovern\ngown\ngrab\ngrace\ngrain\ngrant\ngrape\ngrass\ngravity\ngreat\ngreen\ngrid\ngrief\ngrit\ngrocery\ngroup\ngrow\ngrunt\nguard\nguess\nguide\nguilt\nguitar\ngun\ngym\nhabit\nhair\nhalf\nhammer\nhamster\nhand\nhappy\nharbor\nhard\nharsh\nharvest\nhat\nhave\nhawk\nhazard\nhead\nhealth\nheart\nheavy\nhedgehog\nheight\nhello\nhelmet\nhelp\nhen\nhero\nhidden\nhigh\nhill\nhint\nhip\nhire\nhistory\nhobby\nhockey\nhold\nhole\nholiday\nhollow\nhome\nhoney\nhood\nhope\nhorn\nhorror\nhorse\nhospital\nhost\nhotel\nhour\nhover\nhub\nhuge\nhuman\nhumble\nhumor\nhundred\nhungry\nhunt\nhurdle\nhurry\nhurt\nhusband\nhybrid\nice\nicon\nidea\nidentify\nidle\nignore\nill\nillegal\nillness\nimage\nimitate\nimmense\nimmune\nimpact\nimpose\nimprove\nimpulse\ninch\ninclude\nincome\nincrease\nindex\nindicate\nindoor\nindustry\ninfant\ninflict\ninform\ninhale\ninherit\ninitial\ninject\ninjury\ninmate\ninner\ninnocent\ninput\ninquiry\ninsane\ninsect\ninside\ninspire\ninstall\nintact\ninterest\ninto\ninvest\ninvite\ninvolve\niron\nisland\nisolate\nissue\nitem\nivory\njacket\njaguar\njar\njazz\njealous\njeans\njelly\njewel\njob\njoin\njoke\njourney\njoy\njudge\njuice\njump\njungle\njunior\njunk\njust\nkangaroo\nkeen\nkeep\nketchup\nkey\nkick\nkid\nkidney\nkind\nkingdom\nkiss\nkit\nkitchen\nkite\nkitten\nkiwi\nknee\nknife\nknock\nknow\nlab\nlabel\nlabor\nladder\nlady\nlake\nlamp\nlanguage\nlaptop\nlarge\nlater\nlatin\nlaugh\nlaundry\nlava\nlaw\nlawn\nlawsuit\nlayer\nlazy\nleader\nleaf\nlearn\nleave\nlecture\nleft\nleg\nlegal\nlegend\nleisure\nlemon\nlend\nlength\nlens\nleopard\nlesson\nletter\nlevel\nliar\nliberty\nlibrary\nlicense\nlife\nlift\nlight\nlike\nlimb\nlimit\nlink\nlion\nliquid\nlist\nlittle\nlive\nlizard\nload\nloan\nlobster\nlocal\nlock\nlogic\nlonely\nlong\nloop\nlottery\nloud\nlounge\nlove\nloyal\nlucky\nluggage\nlumber\nlunar\nlunch\nluxury\nlyrics\nmachine\nmad\nmagic\nmagnet\nmaid\nmail\nmain\nmajor\nmake\nmammal\nman\nmanage\nmandate\nmango\nmansion\nmanual\nmaple\nmarble\nmarch\nmargin\nmarine\nmarket\nmarriage\nmask\nmass\nmaster\nmatch\nmaterial\nmath\nmatrix\nmatter\nmaximum\nmaze\nmeadow\nmean\nmeasure\nmeat\nmechanic\nmedal\nmedia\nmelody\nmelt\nmember\nmemory\nmention\nmenu\nmercy\nmerge\nmerit\nmerry\nmesh\nmessage\nmetal\nmethod\nmiddle\nmidnight\nmilk\nmillion\nmimic\nmind\nminimum\nminor\nminute\nmiracle\nmirror\nmisery\nmiss\nmistake\nmix\nmixed\nmixture\nmobile\nmodel\nmodify\nmom\nmoment\nmonitor\nmonkey\nmonster\nmonth\nmoon\nmoral\nmore\nmorning\nmosquito\nmother\nmotion\nmotor\nmountain\nmouse\nmove\nmovie\nmuch\nmuffin\nmule\nmultiply\nmuscle\nmuseum\nmushroom\nmusic\nmust\nmutual\nmyself\nmystery\nmyth\nnaive\nname\nnapkin\nnarrow\nnasty\nnation\nnature\nnear\nneck\nneed\nnegative\nneglect\nneither\nnephew\nnerve\nnest\nnet\nnetwork\nneutral\nnever\nnews\nnext\nnice\nnight\nnoble\nnoise\nnominee\nnoodle\nnormal\nnorth\nnose\nnotable\nnote\nnothing\nnotice\nnovel\nnow\nnuclear\nnumber\nnurse\nnut\noak\nobey\nobject\noblige\nobscure\nobserve\nobtain\nobvious\noccur\nocean\noctober\nodor\noff\noffer\noffice\noften\noil\nokay\nold\nolive\nolympic\nomit\nonce\none\nonion\nonline\nonly\nopen\nopera\nopinion\noppose\noption\norange\norbit\norchard\norder\nordinary\norgan\norient\noriginal\norphan\nostrich\nother\noutdoor\nouter\noutput\noutside\noval\noven\nover\nown\nowner\noxygen\noyster\nozone\npact\npaddle\npage\npair\npalace\npalm\npanda\npanel\npanic\npanther\npaper\nparade\nparent\npark\nparrot\nparty\npass\npatch\npath\npatient\npatrol\npattern\npause\npave\npayment\npeace\npeanut\npear\npeasant\npelican\npen\npenalty\npencil\npeople\npepper\nperfect\npermit\nperson\npet\nphone\nphoto\nphrase\nphysical\npiano\npicnic\npicture\npiece\npig\npigeon\npill\npilot\npink\npioneer\npipe\npistol\npitch\npizza\nplace\nplanet\nplastic\nplate\nplay\nplease\npledge\npluck\nplug\nplunge\npoem\npoet\npoint\npolar\npole\npolice\npond\npony\npool\npopular\nportion\nposition\npossible\npost\npotato\npottery\npoverty\npowder\npower\npractice\npraise\npredict\nprefer\nprepare\npresent\npretty\nprevent\nprice\npride\nprimary\nprint\npriority\nprison\nprivate\nprize\nproblem\nprocess\nproduce\nprofit\nprogram\nproject\npromote\nproof\nproperty\nprosper\nprotect\nproud\nprovide\npublic\npudding\npull\npulp\npulse\npumpkin\npunch\npupil\npuppy\npurchase\npurity\npurpose\npurse\npush\nput\npuzzle\npyramid\nquality\nquantum\nquarter\nquestion\nquick\nquit\nquiz\nquote\nrabbit\nraccoon\nrace\nrack\nradar\nradio\nrail\nrain\nraise\nrally\nramp\nranch\nrandom\nrange\nrapid\nrare\nrate\nrather\nraven\nraw\nrazor\nready\nreal\nreason\nrebel\nrebuild\nrecall\nreceive\nrecipe\nrecord\nrecycle\nreduce\nreflect\nreform\nrefuse\nregion\nregret\nregular\nreject\nrelax\nrelease\nrelief\nrely\nremain\nremember\nremind\nremove\nrender\nrenew\nrent\nreopen\nrepair\nrepeat\nreplace\nreport\nrequire\nrescue\nresemble\nresist\nresource\nresponse\nresult\nretire\nretreat\nreturn\nreunion\nreveal\nreview\nreward\nrhythm\nrib\nribbon\nrice\nrich\nride\nridge\nrifle\nright\nrigid\nring\nriot\nripple\nrisk\nritual\nrival\nriver\nroad\nroast\nrobot\nrobust\nrocket\nromance\nroof\nrookie\nroom\nrose\nrotate\nrough\nround\nroute\nroyal\nrubber\nrude\nrug\nrule\nrun\nrunway\nrural\nsad\nsaddle\nsadness\nsafe\nsail\nsalad\nsalmon\nsalon\nsalt\nsalute\nsame\nsample\nsand\nsatisfy\nsatoshi\nsauce\nsausage\nsave\nsay\nscale\nscan\nscare\nscatter\nscene\nscheme\nschool\nscience\nscissors\nscorpion\nscout\nscrap\nscreen\nscript\nscrub\nsea\nsearch\nseason\nseat\nsecond\nsecret\nsection\nsecurity\nseed\nseek\nsegment\nselect\nsell\nseminar\nsenior\nsense\nsentence\nseries\nservice\nsession\nsettle\nsetup\nseven\nshadow\nshaft\nshallow\nshare\nshed\nshell\nsheriff\nshield\nshift\nshine\nship\nshiver\nshock\nshoe\nshoot\nshop\nshort\nshoulder\nshove\nshrimp\nshrug\nshuffle\nshy\nsibling\nsick\nside\nsiege\nsight\nsign\nsilent\nsilk\nsilly\nsilver\nsimilar\nsimple\nsince\nsing\nsiren\nsister\nsituate\nsix\nsize\nskate\nsketch\nski\nskill\nskin\nskirt\nskull\nslab\nslam\nsleep\nslender\nslice\nslide\nslight\nslim\nslogan\nslot\nslow\nslush\nsmall\nsmart\nsmile\nsmoke\nsmooth\nsnack\nsnake\nsnap\nsniff\nsnow\nsoap\nsoccer\nsocial\nsock\nsoda\nsoft\nsolar\nsoldier\nsolid\nsolution\nsolve\nsomeone\nsong\nsoon\nsorry\nsort\nsoul\nsound\nsoup\nsource\nsouth\nspace\nspare\nspatial\nspawn\nspeak\nspecial\nspeed\nspell\nspend\nsphere\nspice\nspider\nspike\nspin\nspirit\nsplit\nspoil\nsponsor\nspoon\nsport\nspot\nspray\nspread\nspring\nspy\nsquare\nsqueeze\nsquirrel\nstable\nstadium\nstaff\nstage\nstairs\nstamp\nstand\nstart\nstate\nstay\nsteak\nsteel\nstem\nstep\nstereo\nstick\nstill\nsting\nstock\nstomach\nstone\nstool\nstory\nstove\nstrategy\nstreet\nstrike\nstrong\nstruggle\nstudent\nstuff\nstumble\nstyle\nsubject\nsubmit\nsubway\nsuccess\nsuch\nsudden\nsuffer\nsugar\nsuggest\nsuit\nsummer\nsun\nsunny\nsunset\nsuper\nsupply\nsupreme\nsure\nsurface\nsurge\nsurprise\nsurround\nsurvey\nsuspect\nsustain\nswallow\nswamp\nswap\nswarm\nswear\nsweet\nswift\nswim\nswing\nswitch\nsword\nsymbol\nsymptom\nsyrup\nsystem\ntable\ntackle\ntag\ntail\ntalent\ntalk\ntank\ntape\ntarget\ntask\ntaste\ntattoo\ntaxi\nteach\nteam\ntell\nten\ntenant\ntennis\ntent\nterm\ntest\ntext\nthank\nthat\ntheme\nthen\ntheory\nthere\nthey\nthing\nthis\nthought\nthree\nthrive\nthrow\nthumb\nthunder\nticket\ntide\ntiger\ntilt\ntimber\ntime\ntiny\ntip\ntired\ntissue\ntitle\ntoast\ntobacco\ntoday\ntoddler\ntoe\ntogether\ntoilet\ntoken\ntomato\ntomorrow\ntone\ntongue\ntonight\ntool\ntooth\ntop\ntopic\ntopple\ntorch\ntornado\ntortoise\ntoss\ntotal\ntourist\ntoward\ntower\ntown\ntoy\ntrack\ntrade\ntraffic\ntragic\ntrain\ntransfer\ntrap\ntrash\ntravel\ntray\ntreat\ntree\ntrend\ntrial\ntribe\ntrick\ntrigger\ntrim\ntrip\ntrophy\ntrouble\ntruck\ntrue\ntruly\ntrumpet\ntrust\ntruth\ntry\ntube\ntuition\ntumble\ntuna\ntunnel\nturkey\nturn\nturtle\ntwelve\ntwenty\ntwice\ntwin\ntwist\ntwo\ntype\ntypical\nugly\numbrella\nunable\nunaware\nuncle\nuncover\nunder\nundo\nunfair\nunfold\nunhappy\nuniform\nunique\nunit\nuniverse\nunknown\nunlock\nuntil\nunusual\nunveil\nupdate\nupgrade\nuphold\nupon\nupper\nupset\nurban\nurge\nusage\nuse\nused\nuseful\nuseless\nusual\nutility\nvacant\nvacuum\nvague\nvalid\nvalley\nvalve\nvan\nvanish\nvapor\nvarious\nvast\nvault\nvehicle\nvelvet\nvendor\nventure\nvenue\nverb\nverify\nversion\nvery\nvessel\nveteran\nviable\nvibrant\nvicious\nvictory\nvideo\nview\nvillage\nvintage\nviolin\nvirtual\nvirus\nvisa\nvisit\nvisual\nvital\nvivid\nvocal\nvoice\nvoid\nvolcano\nvolume\nvote\nvoyage\nwage\nwagon\nwait\nwalk\nwall\nwalnut\nwant\nwarfare\nwarm\nwarrior\nwash\nwasp\nwaste\nwater\nwave\nway\nwealth\nweapon\nwear\nweasel\nweather\nweb\nwedding\nweekend\nweird\nwelcome\nwest\nwet\nwhale\nwhat\nwheat\nwheel\nwhen\nwhere\nwhip\nwhisper\nwide\nwidth\nwife\nwild\nwill\nwin\nwindow\nwine\nwing\nwink\nwinner\nwinter\nwire\nwisdom\nwise\nwish\nwitness\nwolf\nwoman\nwonder\nwood\nwool\nword\nwork\nworld\nworry\nworth\nwrap\nwreck\nwrestle\nwrist\nwrite\nwrong\nyard\nyear\nyellow\nyou\nyoung\nyouth\nzebra\nzero\nzone\nzoo".split("\n");var tr={},nr={};function rr(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function or(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)}function ir(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 sr(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");rr(e.outputLen),rr(e.blockLen)}function ar(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 cr(e,t){ir(e);const n=t.outputLen;if(e.lengthnew Uint8Array(e.buffer,e.byteOffset,e.byteLength);e.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));e.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.rotr=(e,t)=>e<<32-t|e>>>t,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!e.isLE)throw new Error("Non little-endian hardware is not supported");const n=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));e.bytesToHex=function(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let r=0;r{},e.asyncLoop=async function(t,n,r){let o=Date.now();for(let i=0;i=0&&te instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(t);for(let t=0,r=0;te().update(o(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t},e.wrapConstructorWithOpts=function(e){const t=(t,n)=>e(n).update(o(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},e.randomBytes=function(e=32){if(t.crypto&&"function"==typeof t.crypto.getRandomValues)return t.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}}(Yn),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=void 0;const t=Hn,n=Yn;class r extends n.Hash{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,t.default.hash(e);const o=(0,n.toBytes)(r);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(o.length>i?e.create().update(o).digest():o);for(let e=0;enew r(e,t).update(n).digest(),e.hmac.create=(e,t)=>new r(e,t)}(Vn),Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.pbkdf2Async=Wn.pbkdf2=void 0;const Jn=Hn,Qn=Vn,Xn=Yn;function er(e,t,n,r){Jn.default.hash(e);const o=(0,Xn.checkOpts)({dkLen:32,asyncTick:10},r),{c:i,dkLen:s,asyncTick:a}=o;if(Jn.default.number(i),Jn.default.number(s),Jn.default.number(a),i<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const c=(0,Xn.toBytes)(t),u=(0,Xn.toBytes)(n),l=new Uint8Array(s),f=Qn.hmac.create(e,c),h=f._cloneInto().update(u);return{c:i,dkLen:s,asyncTick:a,DK:l,PRF:f,PRFSalt:h}}function tr(e,t,n,r,o){return e.destroy(),t.destroy(),r&&r.destroy(),o.fill(0),n}Wn.pbkdf2=function(e,t,n,r){const{c:o,dkLen:i,DK:s,PRF:a,PRFSalt:c}=er(e,t,n,r);let u;const l=new Uint8Array(4),f=(0,Xn.createView)(l),h=new Uint8Array(a.outputLen);for(let e=1,t=0;t{c._cloneInto(l).update(d).digestInto(d);for(let e=0;er-i&&(this.process(n,0),i=0);for(let e=i;e>o&i),a=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+u,a,r)}(n,r-8,BigInt(8*this.length),o),this.process(n,0);const s=(0,ir.createView)(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;ee&t^e&n^t&n,ur=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]),lr=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),fr=new Uint32Array(64);let hr=class extends sr.SHA2{constructor(){super(64,32,8,!1),this.A=0|lr[0],this.B=0|lr[1],this.C=0|lr[2],this.D=0|lr[3],this.E=0|lr[4],this.F=0|lr[5],this.G=0|lr[6],this.H=0|lr[7]}get(){const{A:e,B:t,C:n,D:r,E:o,F:i,G:s,H:a}=this;return[e,t,n,r,o,i,s,a]}set(e,t,n,r,o,i,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|a}process(e,t){for(let n=0;n<16;n++,t+=4)fr[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=fr[e-15],n=fr[e-2],r=(0,ar.rotr)(t,7)^(0,ar.rotr)(t,18)^t>>>3,o=(0,ar.rotr)(n,17)^(0,ar.rotr)(n,19)^n>>>10;fr[e]=o+fr[e-7]+r+fr[e-16]|0}let{A:n,B:r,C:o,D:i,E:s,F:a,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+((0,ar.rotr)(s,6)^(0,ar.rotr)(s,11)^(0,ar.rotr)(s,25))+((l=s)&a^~l&c)+ur[e]+fr[e]|0,f=((0,ar.rotr)(n,2)^(0,ar.rotr)(n,13)^(0,ar.rotr)(n,22))+cr(n,r,o)|0;u=c,c=a,a=s,s=i+t|0,i=o,o=r,r=n,n=t+f|0}var l;n=n+this.A|0,r=r+this.B|0,o=o+this.C|0,i=i+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(n,r,o,i,s,a,c,u)}roundClean(){fr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},dr=class 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}};nr.sha256=(0,ar.wrapConstructor)((()=>new hr)),nr.sha224=(0,ar.wrapConstructor)((()=>new dr));var pr={},yr={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.add=e.toBig=e.split=e.fromBig=void 0;const t=BigInt(2**32-1),n=BigInt(32);function r(e,r=!1){return r?{h:Number(e&t),l:Number(e>>n&t)}:{h:0|Number(e>>n&t),l:0|Number(e&t)}}function o(e,t=!1){let n=new Uint32Array(e.length),o=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0);function i(e,t,n,r){const o=(t>>>0)+(r>>>0);return{h:e+n+(o/2**32|0)|0,l:0|o}}e.add=i;const s={fromBig:r,split:o,toBig:e.toBig,shrSH:(e,t,n)=>e>>>n,shrSL:(e,t,n)=>e<<32-n|t>>>n,rotrSH:(e,t,n)=>e>>>n|t<<32-n,rotrSL:(e,t,n)=>e<<32-n|t>>>n,rotrBH:(e,t,n)=>e<<64-n|t>>>n-32,rotrBL:(e,t,n)=>e>>>n-32|t<<64-n,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,n)=>e<>>32-n,rotlSL:(e,t,n)=>t<>>32-n,rotlBH:(e,t,n)=>t<>>64-n,rotlBL:(e,t,n)=>e<>>64-n,add:i,add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,o)=>t+n+r+o+(e/2**32|0)|0,add5H:(e,t,n,r,o,i)=>t+n+r+o+i+(e/2**32|0)|0,add5L:(e,t,n,r,o)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(o>>>0)};e.default=s}(yr),Object.defineProperty(pr,"__esModule",{value:!0}),pr.sha384=pr.sha512_256=pr.sha512_224=pr.sha512=pr.SHA512=void 0;const gr=rr,br=yr,wr=Yn,[vr,mr]=br.default.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e=>BigInt(e)))),_r=new Uint32Array(80),xr=new Uint32Array(80);let Er=class extends gr.SHA2{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:n,Bl:r,Ch:o,Cl:i,Dh:s,Dl:a,Eh:c,El:u,Fh:l,Fl:f,Gh:h,Gl:d,Hh:p,Hl:y}=this;return[e,t,n,r,o,i,s,a,c,u,l,f,h,d,p,y]}set(e,t,n,r,o,i,s,a,c,u,l,f,h,d,p,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|o,this.Cl=0|i,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|u,this.Fh=0|l,this.Fl=0|f,this.Gh=0|h,this.Gl=0|d,this.Hh=0|p,this.Hl=0|y}process(e,t){for(let n=0;n<16;n++,t+=4)_r[n]=e.getUint32(t),xr[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|_r[e-15],n=0|xr[e-15],r=br.default.rotrSH(t,n,1)^br.default.rotrSH(t,n,8)^br.default.shrSH(t,n,7),o=br.default.rotrSL(t,n,1)^br.default.rotrSL(t,n,8)^br.default.shrSL(t,n,7),i=0|_r[e-2],s=0|xr[e-2],a=br.default.rotrSH(i,s,19)^br.default.rotrBH(i,s,61)^br.default.shrSH(i,s,6),c=br.default.rotrSL(i,s,19)^br.default.rotrBL(i,s,61)^br.default.shrSL(i,s,6),u=br.default.add4L(o,c,xr[e-7],xr[e-16]),l=br.default.add4H(u,r,a,_r[e-7],_r[e-16]);_r[e]=0|l,xr[e]=0|u}let{Ah:n,Al:r,Bh:o,Bl:i,Ch:s,Cl:a,Dh:c,Dl:u,Eh:l,El:f,Fh:h,Fl:d,Gh:p,Gl:y,Hh:g,Hl:b}=this;for(let e=0;e<80;e++){const t=br.default.rotrSH(l,f,14)^br.default.rotrSH(l,f,18)^br.default.rotrBH(l,f,41),w=br.default.rotrSL(l,f,14)^br.default.rotrSL(l,f,18)^br.default.rotrBL(l,f,41),v=l&h^~l&p,m=f&d^~f&y,_=br.default.add5L(b,w,m,mr[e],xr[e]),x=br.default.add5H(_,g,t,v,vr[e],_r[e]),E=0|_,k=br.default.rotrSH(n,r,28)^br.default.rotrBH(n,r,34)^br.default.rotrBH(n,r,39),S=br.default.rotrSL(n,r,28)^br.default.rotrBL(n,r,34)^br.default.rotrBL(n,r,39),A=n&o^n&s^o&s,O=r&i^r&a^i&a;g=0|p,b=0|y,p=0|h,y=0|d,h=0|l,d=0|f,({h:l,l:f}=br.default.add(0|c,0|u,0|x,0|E)),c=0|s,u=0|a,s=0|o,a=0|i,o=0|n,i=0|r;const C=br.default.add3L(E,S,O);n=br.default.add3H(C,x,k,A),r=0|C}({h:n,l:r}=br.default.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:o,l:i}=br.default.add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:a}=br.default.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=br.default.add(0|this.Dh,0|this.Dl,0|c,0|u)),({h:l,l:f}=br.default.add(0|this.Eh,0|this.El,0|l,0|f)),({h:h,l:d}=br.default.add(0|this.Fh,0|this.Fl,0|h,0|d)),({h:p,l:y}=br.default.add(0|this.Gh,0|this.Gl,0|p,0|y)),({h:g,l:b}=br.default.add(0|this.Hh,0|this.Hl,0|g,0|b)),this.set(n,r,o,i,s,a,c,u,l,f,h,d,p,y,g,b)}roundClean(){_r.fill(0),xr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};pr.SHA512=Er;let kr=class extends Er{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}},Sr=class extends Er{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}},Ar=class extends Er{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}};pr.sha512=(0,wr.wrapConstructor)((()=>new Er)),pr.sha512_224=(0,wr.wrapConstructor)((()=>new kr)),pr.sha512_256=(0,wr.wrapConstructor)((()=>new Sr)),pr.sha384=(0,wr.wrapConstructor)((()=>new Ar));var Or={};!function(e){function t(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function n(...e){const t=(e,t)=>n=>e(t(n));return{encode:Array.from(e).reverse().reduce(((e,n)=>e?t(e,n.encode):n.encode),void 0),decode:e.reduce(((e,n)=>e?t(e,n.decode):n.decode),void 0)}}function r(e){return{encode:n=>{if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("alphabet.encode input should be an array of numbers");return n.map((n=>{if(t(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&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map((t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const n=e.indexOf(t);if(-1===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n}))}}}function o(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function i(e,n="="){if(t(e),"string"!=typeof n)throw new Error("padding chr should be string");return{encode(t){if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("padding.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;t.length*e%8;)t.push(n);return t},decode(t){if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("padding.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let r=t.length;if(r*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&t[r-1]===n;r--)if(!((r-1)*e%8))throw new Error("Invalid padding: string has too much padding");return t.slice(0,r)}}}function s(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function a(e,n,r){if(n<2)throw new Error(`convertRadix: wrong from=${n}, base cannot be less than 2`);if(r<2)throw new Error(`convertRadix: wrong to=${r}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let o=0;const i=[],s=Array.from(e);for(s.forEach((e=>{if(t(e),e<0||e>=n)throw new Error(`Wrong integer: ${e}`)}));;){let e=0,t=!0;for(let i=o;ie instanceof Uint8Array;e.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);e.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));e.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(e.rotr=(e,t)=>e<<32-t|e>>>t,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!e.isLE)throw new Error("Non little-endian hardware is not supported");const r=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));e.bytesToHex=function(e){if(!n(e))throw new Error("Uint8Array expected");let t="";for(let n=0;n{},e.asyncLoop=async function(t,n,r){let o=Date.now();for(let i=0;i=0&&te+t.length),0));let r=0;return e.forEach((e=>{if(!n(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length})),t};e.Hash=class{clone(){return this._cloneInto()}};e.checkOpts=function(e,t){if(void 0!==t&&("object"!=typeof t||(n=t,"[object Object]"!==Object.prototype.toString.call(n)||n.constructor!==Object)))throw new Error("Options should be object or undefined");var n;return Object.assign(e,t)},e.wrapConstructor=function(e){const t=t=>e().update(i(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t},e.wrapConstructorWithOpts=function(e){const t=(t,n)=>e(n).update(i(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},e.wrapXOFConstructorWithOpts=function(e){const t=(t,n)=>e(n).update(i(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},e.randomBytes=function(e=32){if(t.crypto&&"function"==typeof t.crypto.getRandomValues)return t.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}}(fr),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const t=nr,n=fr;class r extends n.Hash{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,t.default.hash(e);const o=(0,n.toBytes)(r);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(o.length>i?e.create().update(o).digest():o);for(let e=0;enew r(e,t).update(n).digest(),e.hmac.create=(e,t)=>new r(e,t)}(hr),Object.defineProperty(lr,"__esModule",{value:!0}),lr.pbkdf2Async=lr.pbkdf2=void 0;const pr=nr,yr=hr,gr=fr;function br(e,t,n,r){pr.default.hash(e);const o=(0,gr.checkOpts)({dkLen:32,asyncTick:10},r),{c:i,dkLen:s,asyncTick:a}=o;if(pr.default.number(i),pr.default.number(s),pr.default.number(a),i<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const c=(0,gr.toBytes)(t),u=(0,gr.toBytes)(n),l=new Uint8Array(s),h=yr.hmac.create(e,c),f=h._cloneInto().update(u);return{c:i,dkLen:s,asyncTick:a,DK:l,PRF:h,PRFSalt:f}}function wr(e,t,n,r,o){return e.destroy(),t.destroy(),r&&r.destroy(),o.fill(0),n}lr.pbkdf2=function(e,t,n,r){const{c:o,dkLen:i,DK:s,PRF:a,PRFSalt:c}=br(e,t,n,r);let u;const l=new Uint8Array(4),h=(0,gr.createView)(l),f=new Uint8Array(a.outputLen);for(let e=1,t=0;t{c._cloneInto(l).update(d).digestInto(d);for(let e=0;er-i&&(this.process(n,0),i=0);for(let e=i;e>o&i),a=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+u,a,r)}(n,r-8,BigInt(8*this.length),o),this.process(n,0);const s=(0,xr.createView)(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;ee&t^e&n^t&n,Ar=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]),Or=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Cr=new Uint32Array(64);let Pr=class extends Er.SHA2{constructor(){super(64,32,8,!1),this.A=0|Or[0],this.B=0|Or[1],this.C=0|Or[2],this.D=0|Or[3],this.E=0|Or[4],this.F=0|Or[5],this.G=0|Or[6],this.H=0|Or[7]}get(){const{A:e,B:t,C:n,D:r,E:o,F:i,G:s,H:a}=this;return[e,t,n,r,o,i,s,a]}set(e,t,n,r,o,i,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|a}process(e,t){for(let n=0;n<16;n++,t+=4)Cr[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=Cr[e-15],n=Cr[e-2],r=(0,kr.rotr)(t,7)^(0,kr.rotr)(t,18)^t>>>3,o=(0,kr.rotr)(n,17)^(0,kr.rotr)(n,19)^n>>>10;Cr[e]=o+Cr[e-7]+r+Cr[e-16]|0}let{A:n,B:r,C:o,D:i,E:s,F:a,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+((0,kr.rotr)(s,6)^(0,kr.rotr)(s,11)^(0,kr.rotr)(s,25))+((l=s)&a^~l&c)+Ar[e]+Cr[e]|0,h=((0,kr.rotr)(n,2)^(0,kr.rotr)(n,13)^(0,kr.rotr)(n,22))+Sr(n,r,o)|0;u=c,c=a,a=s,s=i+t|0,i=o,o=r,r=n,n=t+h|0}var l;n=n+this.A|0,r=r+this.B|0,o=o+this.C|0,i=i+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(n,r,o,i,s,a,c,u)}roundClean(){Cr.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Ir=class extends Pr{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}};vr.sha256=(0,kr.wrapConstructor)((()=>new Pr)),vr.sha224=(0,kr.wrapConstructor)((()=>new Ir));var Lr={},jr={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.add=e.toBig=e.split=e.fromBig=void 0;const t=BigInt(2**32-1),n=BigInt(32);function r(e,r=!1){return r?{h:Number(e&t),l:Number(e>>n&t)}:{h:0|Number(e>>n&t),l:0|Number(e&t)}}function o(e,t=!1){let n=new Uint32Array(e.length),o=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0);function i(e,t,n,r){const o=(t>>>0)+(r>>>0);return{h:e+n+(o/2**32|0)|0,l:0|o}}e.add=i;const s={fromBig:r,split:o,toBig:e.toBig,shrSH:(e,t,n)=>e>>>n,shrSL:(e,t,n)=>e<<32-n|t>>>n,rotrSH:(e,t,n)=>e>>>n|t<<32-n,rotrSL:(e,t,n)=>e<<32-n|t>>>n,rotrBH:(e,t,n)=>e<<64-n|t>>>n-32,rotrBL:(e,t,n)=>e>>>n-32|t<<64-n,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,n)=>e<>>32-n,rotlSL:(e,t,n)=>t<>>32-n,rotlBH:(e,t,n)=>t<>>64-n,rotlBL:(e,t,n)=>e<>>64-n,add:i,add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,o)=>t+n+r+o+(e/2**32|0)|0,add5H:(e,t,n,r,o,i)=>t+n+r+o+i+(e/2**32|0)|0,add5L:(e,t,n,r,o)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(o>>>0)};e.default=s}(jr),Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.sha384=Lr.sha512_256=Lr.sha512_224=Lr.sha512=Lr.SHA512=void 0;const Tr=mr,Br=jr,Rr=fr,[$r,Ur]=Br.default.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e=>BigInt(e)))),Nr=new Uint32Array(80),Hr=new Uint32Array(80);let Mr=class extends Tr.SHA2{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:n,Bl:r,Ch:o,Cl:i,Dh:s,Dl:a,Eh:c,El:u,Fh:l,Fl:h,Gh:f,Gl:d,Hh:p,Hl:y}=this;return[e,t,n,r,o,i,s,a,c,u,l,h,f,d,p,y]}set(e,t,n,r,o,i,s,a,c,u,l,h,f,d,p,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|o,this.Cl=0|i,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|u,this.Fh=0|l,this.Fl=0|h,this.Gh=0|f,this.Gl=0|d,this.Hh=0|p,this.Hl=0|y}process(e,t){for(let n=0;n<16;n++,t+=4)Nr[n]=e.getUint32(t),Hr[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|Nr[e-15],n=0|Hr[e-15],r=Br.default.rotrSH(t,n,1)^Br.default.rotrSH(t,n,8)^Br.default.shrSH(t,n,7),o=Br.default.rotrSL(t,n,1)^Br.default.rotrSL(t,n,8)^Br.default.shrSL(t,n,7),i=0|Nr[e-2],s=0|Hr[e-2],a=Br.default.rotrSH(i,s,19)^Br.default.rotrBH(i,s,61)^Br.default.shrSH(i,s,6),c=Br.default.rotrSL(i,s,19)^Br.default.rotrBL(i,s,61)^Br.default.shrSL(i,s,6),u=Br.default.add4L(o,c,Hr[e-7],Hr[e-16]),l=Br.default.add4H(u,r,a,Nr[e-7],Nr[e-16]);Nr[e]=0|l,Hr[e]=0|u}let{Ah:n,Al:r,Bh:o,Bl:i,Ch:s,Cl:a,Dh:c,Dl:u,Eh:l,El:h,Fh:f,Fl:d,Gh:p,Gl:y,Hh:g,Hl:b}=this;for(let e=0;e<80;e++){const t=Br.default.rotrSH(l,h,14)^Br.default.rotrSH(l,h,18)^Br.default.rotrBH(l,h,41),w=Br.default.rotrSL(l,h,14)^Br.default.rotrSL(l,h,18)^Br.default.rotrBL(l,h,41),v=l&f^~l&p,m=h&d^~h&y,_=Br.default.add5L(b,w,m,Ur[e],Hr[e]),x=Br.default.add5H(_,g,t,v,$r[e],Nr[e]),E=0|_,k=Br.default.rotrSH(n,r,28)^Br.default.rotrBH(n,r,34)^Br.default.rotrBH(n,r,39),S=Br.default.rotrSL(n,r,28)^Br.default.rotrBL(n,r,34)^Br.default.rotrBL(n,r,39),A=n&o^n&s^o&s,O=r&i^r&a^i&a;g=0|p,b=0|y,p=0|f,y=0|d,f=0|l,d=0|h,({h:l,l:h}=Br.default.add(0|c,0|u,0|x,0|E)),c=0|s,u=0|a,s=0|o,a=0|i,o=0|n,i=0|r;const C=Br.default.add3L(E,S,O);n=Br.default.add3H(C,x,k,A),r=0|C}({h:n,l:r}=Br.default.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:o,l:i}=Br.default.add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:a}=Br.default.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=Br.default.add(0|this.Dh,0|this.Dl,0|c,0|u)),({h:l,l:h}=Br.default.add(0|this.Eh,0|this.El,0|l,0|h)),({h:f,l:d}=Br.default.add(0|this.Fh,0|this.Fl,0|f,0|d)),({h:p,l:y}=Br.default.add(0|this.Gh,0|this.Gl,0|p,0|y)),({h:g,l:b}=Br.default.add(0|this.Hh,0|this.Hl,0|g,0|b)),this.set(n,r,o,i,s,a,c,u,l,h,f,d,p,y,g,b)}roundClean(){Nr.fill(0),Hr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};Lr.SHA512=Mr;let qr=class extends Mr{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}},Fr=class extends Mr{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}},Dr=class extends Mr{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}};Lr.sha512=(0,Rr.wrapConstructor)((()=>new Mr)),Lr.sha512_224=(0,Rr.wrapConstructor)((()=>new qr)),Lr.sha512_256=(0,Rr.wrapConstructor)((()=>new Fr)),Lr.sha384=(0,Rr.wrapConstructor)((()=>new Dr));var zr={};!function(e){function t(e){if(!Number.isSafeInteger(e))throw new Error(`Wrong integer: ${e}`)}function n(...e){const t=(e,t)=>n=>e(t(n));return{encode:Array.from(e).reverse().reduce(((e,n)=>e?t(e,n.encode):n.encode),void 0),decode:e.reduce(((e,n)=>e?t(e,n.decode):n.decode),void 0)}}function r(e){return{encode:n=>{if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("alphabet.encode input should be an array of numbers");return n.map((n=>{if(t(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&&"string"!=typeof t[0])throw new Error("alphabet.decode input should be array of strings");return t.map((t=>{if("string"!=typeof t)throw new Error(`alphabet.decode: not string element=${t}`);const n=e.indexOf(t);if(-1===n)throw new Error(`Unknown letter: "${t}". Allowed: ${e}`);return n}))}}}function o(e=""){if("string"!=typeof e)throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("join.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`join.encode: non-string input=${e}`);return t.join(e)},decode:t=>{if("string"!=typeof t)throw new Error("join.decode input should be string");return t.split(e)}}}function i(e,n="="){if(t(e),"string"!=typeof n)throw new Error("padding chr should be string");return{encode(t){if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("padding.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`padding.encode: non-string input=${e}`);for(;t.length*e%8;)t.push(n);return t},decode(t){if(!Array.isArray(t)||t.length&&"string"!=typeof t[0])throw new Error("padding.encode input should be array of strings");for(let e of t)if("string"!=typeof e)throw new Error(`padding.decode: non-string input=${e}`);let r=t.length;if(r*e%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;r>0&&t[r-1]===n;r--)if(!((r-1)*e%8))throw new Error("Invalid padding: string has too much padding");return t.slice(0,r)}}}function s(e){if("function"!=typeof e)throw new Error("normalize fn should be function");return{encode:e=>e,decode:t=>e(t)}}function a(e,n,r){if(n<2)throw new Error(`convertRadix: wrong from=${n}, base cannot be less than 2`);if(r<2)throw new Error(`convertRadix: wrong to=${r}, base cannot be less than 2`);if(!Array.isArray(e))throw new Error("convertRadix: data should be array");if(!e.length)return[];let o=0;const i=[],s=Array.from(e);for(s.forEach((e=>{if(t(e),e<0||e>=n)throw new Error(`Wrong integer: ${e}`)}));;){let e=0,t=!0;for(let i=o;it?c(t,e%t):e,u=(e,t)=>e+(t-c(e,t));function l(e,n,r,o){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(n<=0||n>32)throw new Error(`convertRadix2: wrong from=${n}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(u(n,r)>32)throw new Error(`convertRadix2: carry overflow from=${n} to=${r} carryBits=${u(n,r)}`);let i=0,s=0;const a=2**r-1,c=[];for(const o of e){if(t(o),o>=2**n)throw new Error(`convertRadix2: invalid data word=${o} from=${n}`);if(i=i<32)throw new Error(`convertRadix2: carry overflow pos=${s} from=${n}`);for(s+=n;s>=r;s-=r)c.push((i>>s-r&a)>>>0);i&=2**s-1}if(i=i<=n)throw new Error("Excess padding");if(!o&&i)throw new Error(`Non-zero padding: ${i}`);return o&&s>0&&c.push(i>>>0),c}function f(e){return t(e),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return a(Array.from(t),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix.decode input should be array of strings");return Uint8Array.from(a(t,e,256))}}}function h(e,n=!1){if(t(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(u(8,e)>32||u(e,8)>32)throw new Error("radix2: carry overflow");return{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return l(Array.from(t),8,e,!n)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(l(t,e,8,n))}}}function d(e){if("function"!=typeof e)throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch(e){}}}function p(e,n){if(t(e),"function"!=typeof n)throw new Error("checksum fn should be function");return{encode(t){if(!(t instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");const r=n(t).slice(0,e),o=new Uint8Array(t.length+e);return o.set(t),o.set(r,t.length),o},decode(t){if(!(t instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");const r=t.slice(0,-e),o=n(r).slice(0,e),i=t.slice(-e);for(let t=0;te.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),e.base64=n(h(6),r("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),i(6),o("")),e.base64url=n(h(6),r("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),i(6),o(""));const y=e=>n(f(58),r(e),o(""));e.base58=y("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),e.base58flickr=y("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),e.base58xrp=y("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const g=[0,2,3,5,6,7,9,10,11];e.base58xmr={encode(t){let n="";for(let r=0;rn(p(4,(e=>t(t(e)))),e.base58);const b=n(r("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),o("")),w=[996825010,642813549,513874426,1027748829,705979059];function v(e){const t=e>>25;let n=(33554431&e)<<5;for(let e=0;e>e&1)&&(n^=w[e]);return n}function m(e,t,n=1){const r=e.length;let o=1;for(let t=0;t126)throw new Error(`Invalid prefix (${e})`);o=v(o)^n>>5}o=v(o);for(let t=0;tn)throw new TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${n})`);const r=e.toLowerCase();if(e!==r&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const o=(e=r).lastIndexOf("1");if(0===o||-1===o)throw new Error('Letter "1" must be present between prefix and data only');const i=e.slice(0,o),s=e.slice(o+1);if(s.length<6)throw new Error("Data must be at least 6 characters long");const a=b.decode(s).slice(0,-6),c=m(i,a,t);if(!s.endsWith(c))throw new Error(`Invalid checksum in ${e}: expected "${c}"`);return{prefix:i,words:a}}return{encode:function(e,n,r=90){if("string"!=typeof e)throw new Error("bech32.encode prefix should be string, not "+typeof e);if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof n);const o=e.length+7+n.length;if(!1!==r&&o>r)throw new TypeError(`Length ${o} exceeds limit ${r}`);return`${e=e.toLowerCase()}1${b.encode(n)}${m(e,n,t)}`},decode:s,decodeToBytes:function(e){const{prefix:t,words:n}=s(e,!1);return{prefix:t,words:n,bytes:r(n)}},decodeUnsafe:d(s),fromWords:r,fromWordsUnsafe:i,toWords:o}}e.bech32=_("bech32"),e.bech32m=_("bech32m"),e.utf8={encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)},e.hex=n(h(4),r("0123456789abcdef"),o(""),s((e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})));const x={utf8:e.utf8,hex:e.hex,base16:e.base16,base32:e.base32,base64:e.base64,base64url:e.base64url,base58:e.base58,base58xmr:e.base58xmr},E=`Invalid encoding type. Available types: ${Object.keys(x).join(", ")}`;e.bytesToString=(e,t)=>{if("string"!=typeof e||!x.hasOwnProperty(e))throw new TypeError(E);if(!(t instanceof Uint8Array))throw new TypeError("bytesToString() expects Uint8Array");return x[e].encode(t)},e.str=e.bytesToString;e.stringToBytes=(e,t)=>{if(!x.hasOwnProperty(e))throw new TypeError(E);if("string"!=typeof t)throw new TypeError("stringToBytes() expects string");return x[e].decode(t)},e.bytes=e.stringToBytes}(Or),Object.defineProperty(Nn,"__esModule",{value:!0});var Cr=Nn.mnemonicToSeedSync=Nn.mnemonicToSeed=Dr=Nn.validateMnemonic=Nn.entropyToMnemonic=Nn.mnemonicToEntropy=Hr=Nn.generateMnemonic=void 0; -/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */const Ir=Hn,Pr=Wn,Tr=nr,Lr=pr,Br=Yn,Rr=Or,$r=e=>"あいこくしん"===e[0];function jr(e){if("string"!=typeof e)throw new TypeError("Invalid mnemonic type: "+typeof e);return e.normalize("NFKD")}function Ur(e){const t=jr(e),n=t.split(" ");if(![12,15,18,21,24].includes(n.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:n}}function Nr(e){Ir.default.bytes(e,16,20,24,28,32)}var Hr=Nn.generateMnemonic=function(e,t=128){if(Ir.default.number(t),t%32!=0||t>256)throw new TypeError("Invalid entropy");return Fr((0,Br.randomBytes)(t/8),e)};const zr=e=>{const t=8-e.length/4;return new Uint8Array([(0,Tr.sha256)(e)[0]>>t<{if("string"!=typeof e)throw new Error(`Wordlist: non-string element: ${e}`)})),Rr.utils.chain(Rr.utils.checksum(1,zr),Rr.utils.radix2(11,!0),Rr.utils.alphabet(e))}function qr(e,t){const{words:n}=Ur(e),r=Mr(t).decode(n);return Nr(r),r}function Fr(e,t){Nr(e);return Mr(t).encode(e).join($r(t)?" ":" ")}Nn.mnemonicToEntropy=qr,Nn.entropyToMnemonic=Fr;var Dr=Nn.validateMnemonic=function(e,t){try{qr(e,t)}catch(e){return!1}return!0};const Kr=e=>jr(`mnemonic${e}`);Nn.mnemonicToSeed=function(e,t=""){return(0,Pr.pbkdf2Async)(Lr.sha512,Ur(e).nfkd,Kr(t),{c:2048,dkLen:64})},Cr=Nn.mnemonicToSeedSync=function(e,t=""){return(0,Pr.pbkdf2)(Lr.sha512,Ur(e).nfkd,Kr(t),{c:2048,dkLen:64})};const Gr=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Wr=Uint8Array.from({length:16},((e,t)=>t)),Vr=Wr.map((e=>(9*e+5)%16));let Yr=[Wr],Zr=[Vr];for(let e=0;e<4;e++)for(let t of[Yr,Zr])t.push(t[e].map((e=>Gr[e])));const Jr=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map((e=>new Uint8Array(e))),Qr=Yr.map(((e,t)=>e.map((e=>Jr[t][e])))),Xr=Zr.map(((e,t)=>e.map((e=>Jr[t][e])))),eo=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),to=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),no=(e,t)=>e<>>32-t;function ro(e,t,n,r){return 0===e?t^n^r:1===e?t&n|~t&r:2===e?(t|~n)^r:3===e?t&r|n&~r:t^(n|~r)}const oo=new Uint32Array(16);class io extends Ae{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:n,h3:r,h4:o}=this;return[e,t,n,r,o]}set(e,t,n,r,o){this.h0=0|e,this.h1=0|t,this.h2=0|n,this.h3=0|r,this.h4=0|o}process(e,t){for(let n=0;n<16;n++,t+=4)oo[n]=e.getUint32(t,!0);let n=0|this.h0,r=n,o=0|this.h1,i=o,s=0|this.h2,a=s,c=0|this.h3,u=c,l=0|this.h4,f=l;for(let e=0;e<5;e++){const t=4-e,h=eo[e],d=to[e],p=Yr[e],y=Zr[e],g=Qr[e],b=Xr[e];for(let t=0;t<16;t++){const r=no(n+ro(e,o,s,c)+oo[p[t]]+h,g[t])+l|0;n=l,l=c,c=0|no(s,10),s=o,o=r}for(let e=0;e<16;e++){const n=no(r+ro(t,i,a,u)+oo[y[e]]+d,b[e])+f|0;r=f,f=u,u=0|no(a,10),a=i,i=n}}this.set(this.h1+s+u|0,this.h2+c+f|0,this.h3+l+r|0,this.h4+n+i|0,this.h0+o+a|0)}roundClean(){oo.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const so=ke((()=>new io)),ao=BigInt(2**32-1),co=BigInt(32);function uo(e,t=!1){return t?{h:Number(e&ao),l:Number(e>>co&ao)}:{h:0|Number(e>>co&ao),l:0|Number(e&ao)}}const lo={fromBig:uo,split:function(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;oBigInt(e>>>0)<>>0),shrSH:(e,t,n)=>e>>>n,shrSL:(e,t,n)=>e<<32-n|t>>>n,rotrSH:(e,t,n)=>e>>>n|t<<32-n,rotrSL:(e,t,n)=>e<<32-n|t>>>n,rotrBH:(e,t,n)=>e<<64-n|t>>>n-32,rotrBL:(e,t,n)=>e>>>n-32|t<<64-n,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,n)=>e<>>32-n,rotlSL:(e,t,n)=>t<>>32-n,rotlBH:(e,t,n)=>t<>>64-n,rotlBL:(e,t,n)=>e<>>64-n,add:function(e,t,n,r){const o=(t>>>0)+(r>>>0);return{h:e+n+(o/2**32|0)|0,l:0|o}},add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,o)=>t+n+r+o+(e/2**32|0)|0,add5H:(e,t,n,r,o,i)=>t+n+r+o+i+(e/2**32|0)|0,add5L:(e,t,n,r,o)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(o>>>0)},[fo,ho]=lo.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e=>BigInt(e)))),po=new Uint32Array(80),yo=new Uint32Array(80);class go extends Ae{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:n,Bl:r,Ch:o,Cl:i,Dh:s,Dl:a,Eh:c,El:u,Fh:l,Fl:f,Gh:h,Gl:d,Hh:p,Hl:y}=this;return[e,t,n,r,o,i,s,a,c,u,l,f,h,d,p,y]}set(e,t,n,r,o,i,s,a,c,u,l,f,h,d,p,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|o,this.Cl=0|i,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|u,this.Fh=0|l,this.Fl=0|f,this.Gh=0|h,this.Gl=0|d,this.Hh=0|p,this.Hl=0|y}process(e,t){for(let n=0;n<16;n++,t+=4)po[n]=e.getUint32(t),yo[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|po[e-15],n=0|yo[e-15],r=lo.rotrSH(t,n,1)^lo.rotrSH(t,n,8)^lo.shrSH(t,n,7),o=lo.rotrSL(t,n,1)^lo.rotrSL(t,n,8)^lo.shrSL(t,n,7),i=0|po[e-2],s=0|yo[e-2],a=lo.rotrSH(i,s,19)^lo.rotrBH(i,s,61)^lo.shrSH(i,s,6),c=lo.rotrSL(i,s,19)^lo.rotrBL(i,s,61)^lo.shrSL(i,s,6),u=lo.add4L(o,c,yo[e-7],yo[e-16]),l=lo.add4H(u,r,a,po[e-7],po[e-16]);po[e]=0|l,yo[e]=0|u}let{Ah:n,Al:r,Bh:o,Bl:i,Ch:s,Cl:a,Dh:c,Dl:u,Eh:l,El:f,Fh:h,Fl:d,Gh:p,Gl:y,Hh:g,Hl:b}=this;for(let e=0;e<80;e++){const t=lo.rotrSH(l,f,14)^lo.rotrSH(l,f,18)^lo.rotrBH(l,f,41),w=lo.rotrSL(l,f,14)^lo.rotrSL(l,f,18)^lo.rotrBL(l,f,41),v=l&h^~l&p,m=f&d^~f&y,_=lo.add5L(b,w,m,ho[e],yo[e]),x=lo.add5H(_,g,t,v,fo[e],po[e]),E=0|_,k=lo.rotrSH(n,r,28)^lo.rotrBH(n,r,34)^lo.rotrBH(n,r,39),S=lo.rotrSL(n,r,28)^lo.rotrBL(n,r,34)^lo.rotrBL(n,r,39),A=n&o^n&s^o&s,O=r&i^r&a^i&a;g=0|p,b=0|y,p=0|h,y=0|d,h=0|l,d=0|f,({h:l,l:f}=lo.add(0|c,0|u,0|x,0|E)),c=0|s,u=0|a,s=0|o,a=0|i,o=0|n,i=0|r;const C=lo.add3L(E,S,O);n=lo.add3H(C,x,k,A),r=0|C}({h:n,l:r}=lo.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:o,l:i}=lo.add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:a}=lo.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=lo.add(0|this.Dh,0|this.Dl,0|c,0|u)),({h:l,l:f}=lo.add(0|this.Eh,0|this.El,0|l,0|f)),({h:h,l:d}=lo.add(0|this.Fh,0|this.Fl,0|h,0|d)),({h:p,l:y}=lo.add(0|this.Gh,0|this.Gl,0|p,0|y)),({h:g,l:b}=lo.add(0|this.Hh,0|this.Hl,0|g,0|b)),this.set(n,r,o,i,s,a,c,u,l,f,h,d,p,y,g,b)}roundClean(){po.fill(0),yo.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class bo extends go{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}class wo extends go{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class vo extends go{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}const mo=ke((()=>new go));ke((()=>new bo)),ke((()=>new wo)),ke((()=>new vo));const _o=Mt.ProjectivePoint,xo=(e=>cn(function(e,t){if(an(e),"function"!=typeof t)throw new Error("checksum fn should be function");return{encode(n){if(!(n instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");const r=t(n).slice(0,e),o=new Uint8Array(n.length+e);return o.set(n),o.set(r,n.length),o},decode(n){if(!(n instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");const r=n.slice(0,-e),o=t(r).slice(0,e),i=n.slice(-e);for(let t=0;te(e(t)))),kn))(Be);function Eo(e){return BigInt(`0x${we(e)}`)}const ko=me("Bitcoin seed"),So={private:76066276,public:76067358},Ao=2147483648,Oo=e=>{if(!Number.isSafeInteger(e)||e<0||e>2**32-1)throw new Error(`Invalid number=${e}. Should be from 0 to 2 ** 32 - 1`);const t=new Uint8Array(4);return ye(t).setUint32(0,e,!1),t};class Co{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return e=this.pubHash,ye(e).getUint32(0,!1);var e}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){const e=this.privateKey;if(!e)throw new Error("No private key");return xo.encode(this.serialize(this.versions.private,xe(new Uint8Array([0]),e)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return xo.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(e,t=So){if(he(e),8*e.length<128||8*e.length>512)throw new Error(`HDKey: wrong seed length=${e.length}. Should be between 128 and 512 bits; 256 bits is advised)`);const n=Lt(mo,ko,e);return new Co({versions:t,chainCode:n.slice(32),privateKey:n.slice(0,32)})}static fromExtendedKey(e,t=So){const n=xo.decode(e),r=ye(n),o=r.getUint32(0,!1),i={versions:t,depth:n[4],parentFingerprint:r.getUint32(5,!1),index:r.getUint32(9,!1),chainCode:n.slice(13,45)},s=n.slice(45),a=0===s[0];if(o!==t[a?"private":"public"])throw new Error("Version mismatch");return new Co(a?{...i,privateKey:s.slice(1)}:{...i,publicKey:s})}static fromJSON(e){return Co.fromExtendedKey(e.xpriv)}constructor(e){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!e||"object"!=typeof e)throw new Error("HDKey.constructor must not be called directly");if(this.versions=e.versions||So,this.depth=e.depth||0,this.chainCode=e.chainCode,this.index=e.index||0,this.parentFingerprint=e.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(e.publicKey&&e.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(e.privateKey){if(!Mt.utils.isValidPrivateKey(e.privateKey))throw new Error("Invalid private key");this.privKey="bigint"==typeof e.privateKey?e.privateKey:Eo(e.privateKey),this.privKeyBytes=ve(this.privKey.toString(16).padStart(64,"0")),this.pubKey=Mt.getPublicKey(e.privateKey,!0)}else{if(!e.publicKey)throw new Error("HDKey: no public or private key provided");this.pubKey=_o.fromHex(e.publicKey).toRawBytes(!0)}var t;this.pubHash=(t=this.pubKey,so(Be(t)))}derive(e){if(!/^[mM]'?/.test(e))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(e))return this;const t=e.replace(/^[mM]'?\//,"").split("/");let n=this;for(const e of t){const t=/^(\d+)('?)$/.exec(e);if(!t||3!==t.length)throw new Error(`Invalid child index: ${e}`);let r=+t[1];if(!Number.isSafeInteger(r)||r>=Ao)throw new Error("Invalid index");"'"===t[2]&&(r+=Ao),n=n.deriveChild(r)}return n}deriveChild(e){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let t=Oo(e);if(e>=Ao){const e=this.privateKey;if(!e)throw new Error("Could not derive hardened child key");t=xe(new Uint8Array([0]),e,t)}else t=xe(this.pubKey,t);const n=Lt(mo,this.chainCode,t),r=Eo(n.slice(0,32)),o=n.slice(32);if(!Mt.utils.isValidPrivateKey(r))throw new Error("Tweak bigger than curve order");const i={versions:this.versions,chainCode:o,depth:this.depth+1,parentFingerprint:this.fingerprint,index:e};try{if(this.privateKey){const e=lt(this.privKey+r,Mt.CURVE.n);if(!Mt.utils.isValidPrivateKey(e))throw new Error("The tweak was out of range or the resulted private key is invalid");i.privateKey=e}else{const e=_o.fromHex(this.pubKey).add(_o.fromPrivateKey(r));if(e.equals(_o.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");i.publicKey=e.toRawBytes(!0)}return new Co(i)}catch(t){return this.deriveChild(e+1)}}sign(e){if(!this.privateKey)throw new Error("No privateKey set!");return he(e,32),Mt.sign(e,this.privKey).toCompactRawBytes()}verify(e,t){if(he(e,32),he(t,64),!this.publicKey)throw new Error("No publicKey set!");let n;try{n=Mt.Signature.fromCompact(t)}catch(e){return!1}return Mt.verify(n,e,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(e,t){if(!this.chainCode)throw new Error("No chainCode set");return he(t,33),xe(Oo(e),new Uint8Array([this.depth]),Oo(this.parentFingerprint),Oo(this.index),this.chainCode,t)}}var Io=Object.defineProperty,Po=(e,t)=>{for(var n in t)Io(e,n,{get:t[n],enumerable:!0})};function To(){return we(rn.utils.randomPrivateKey())}function Lo(e){return we(rn.getPublicKey(e))}Po({},{MessageNode:()=>No,MessageQueue:()=>Ho,insertEventIntoAscendingList:()=>Uo,insertEventIntoDescendingList:()=>jo,normalizeURL:()=>$o,utf8Decoder:()=>Bo,utf8Encoder:()=>Ro});var Bo=new TextDecoder("utf-8"),Ro=new TextEncoder;function $o(e){let t=new URL(e);return t.pathname=t.pathname.replace(/\/+/g,"/"),t.pathname.endsWith("/")&&(t.pathname=t.pathname.slice(0,-1)),("80"===t.port&&"ws:"===t.protocol||"443"===t.port&&"wss:"===t.protocol)&&(t.port=""),t.searchParams.sort(),t.hash="",t.toString()}function jo(e,t){let n,r=0,o=e.length-1,i=r;if(o<0)i=0;else if(t.created_at=e[r].created_at)i=r;else for(;;){if(o<=r+1){i=o;break}if(n=Math.floor(r+(o-r)/2),e[n].created_at>t.created_at)r=n;else{if(!(e[n].created_ate[o].created_at)i=o+1;else if(t.created_at<=e[r].created_at)i=r;else for(;;){if(o<=r+1){i=o;break}if(n=Math.floor(r+(o-r)/2),e[n].created_att.created_at)){i=n;break}o=n}}return e[i]?.id!==t.id?[...e.slice(0,i),t,...e.slice(i)]:e}var No=class{_value;_next;get value(){return this._value}set value(e){this._value=e}get next(){return this._next}set next(e){this._next=e}constructor(e){this._value=e,this._next=null}},Ho=class{_first;_last;get first(){return this._first}set first(e){this._first=e}get last(){return this._last}set last(e){this._last=e}_size;get size(){return this._size}set size(e){this._size=e}constructor(){this._first=null,this._last=null,this._size=0}enqueue(e){const t=new No(e);return 0!==this._size&&this._last?(this._last.next=t,this._last=t):(this._first=t,this._last=t),this._size++,!0}dequeue(){if(0===this._size||!this._first)return null;let e=this._first;return this._first=e.next,e.next=null,this._size--,e.value}};function zo(e,t){let n=e;return n.pubkey=Lo(t),n.id=Mo(n),n.sig=Go(n,t),n}function Mo(e){return we(Be(Ro.encode(function(e){if(!Fo(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])}(e))))}var qo=e=>e instanceof Object;function Fo(e){if(!qo(e))return!1;if("number"!=typeof e.kind)return!1;if("string"!=typeof e.content)return!1;if("number"!=typeof e.created_at)return!1;if("string"!=typeof e.pubkey)return!1;if(!e.pubkey.match(/^[a-f0-9]{64}$/))return!1;if(!Array.isArray(e.tags))return!1;for(let t=0;tt.id.startsWith(e))))return!1;if(e.kinds&&-1===e.kinds.indexOf(t.kind))return!1;if(e.authors&&-1===e.authors.indexOf(t.pubkey)&&!e.authors.some((e=>t.pubkey.startsWith(e))))return!1;for(let n in e)if("#"===n[0]){let r=e[`#${n.slice(1)}`];if(r&&!t.tags.find((([e,t])=>e===n.slice(1)&&-1!==r.indexOf(t))))return!1}return!(e.since&&t.created_at=e.until)}function Vo(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 Yo(e,t){let n=t.length,r=e.indexOf(`"${t}":`)+n+3,o=e.slice(r),i=Math.min(o.indexOf(","),o.indexOf("}"));return parseInt(o.slice(0,i),10)}function Zo(e){let t=e.slice(0,22).indexOf('"EVENT"');if(-1===t)return null;let n=e.slice(t+7+1).indexOf('"');if(-1===n)return null;let r=t+7+1+n,o=e.slice(r+1,80).indexOf('"');if(-1===o)return null;let i=r+1+o;return e.slice(r+1,i)}function Jo(e,t){return t===Vo(e,"id")}function Qo(e,t){return t===Vo(e,"pubkey")}function Xo(e,t){return t===Yo(e,"kind")}Po({},{getHex64:()=>Vo,getInt:()=>Yo,getSubscriptionId:()=>Zo,matchEventId:()=>Jo,matchEventKind:()=>Xo,matchEventPubkey:()=>Qo});var ei=()=>({connect:[],disconnect:[],error:[],notice:[],auth:[]});function ti(e,t={}){let{listTimeout:n=3e3,getTimeout:r=3e3,countTimeout:o=3e3}=t;var i,s,a={},c=ei(),u={},l={};async function f(){return s||(s=new Promise(((t,n)=>{try{i=new WebSocket(e)}catch(e){n(e)}i.onopen=()=>{c.connect.forEach((e=>e())),t()},i.onerror=()=>{s=void 0,c.error.forEach((e=>e())),n()},i.onclose=async()=>{s=void 0,c.disconnect.forEach((e=>e()))};let r,o=new Ho;function f(){if(0===o.size)return clearInterval(r),void(r=null);var t=o.dequeue();if(!t)return;let n=Zo(t);if(n){let r=a[n];if(r&&r.alreadyHaveEvent&&r.alreadyHaveEvent(Vo(t,"id"),e))return}try{let e=JSON.parse(t);switch(e[0]){case"EVENT":{let t=e[1],n=e[2];return void(Fo(n)&&a[t]&&(a[t].skipVerification||Do(n))&&function(e,t){for(let n=0;ne(n)))))}case"COUNT":let t=e[1],n=e[2];return void(a[t]&&(u[t]?.count||[]).forEach((e=>e(n))));case"EOSE":{let t=e[1];return void(t in u&&(u[t].eose.forEach((e=>e())),u[t].eose=[]))}case"OK":{let t=e[1],n=e[2],r=e[3]||"";return void(t in l&&(n?l[t].ok.forEach((e=>e())):l[t].failed.forEach((e=>e(r))),l[t].ok=[],l[t].failed=[]))}case"NOTICE":let r=e[1];return void c.notice.forEach((e=>e(r)));case"AUTH":{let t=e[1];return void c.auth?.forEach((e=>e(t)))}}}catch(e){return}}i.onmessage=e=>{o.enqueue(e.data),r||(r=setInterval(f,0))}})),s)}function h(){return 1===i?.readyState}async function d(e){let t=JSON.stringify(e);if(h()||(await new Promise((e=>setTimeout(e,1e3))),h()))try{i.send(t)}catch(e){console.log(e)}}const p=(e,{verb:t="REQ",skipVerification:n=!1,alreadyHaveEvent:r=null,id:o=Math.random().toString().slice(2)}={})=>{let i=o;return a[i]={id:i,filters:e,skipVerification:n,alreadyHaveEvent:r},d([t,i,...e]),{sub:(t,o={})=>p(t||e,{skipVerification:o.skipVerification||n,alreadyHaveEvent:o.alreadyHaveEvent||r,id:i}),unsub:()=>{delete a[i],delete u[i],d(["CLOSE",i])},on:(e,t)=>{u[i]=u[i]||{event:[],count:[],eose:[]},u[i][e].push(t)},off:(e,t)=>{let n=u[i],r=n[e].indexOf(t);r>=0&&n[e].splice(r,1)}}};function y(e,t){if(!e.id)throw new Error(`event ${e} has no id`);let n=e.id;return d([t,e]),{on:(e,t)=>{l[n]=l[n]||{ok:[],failed:[]},l[n][e].push(t)},off:(e,t)=>{let r=l[n];if(!r)return;let o=r[e].indexOf(t);o>=0&&r[e].splice(o,1)}}}return{url:e,sub:p,on:(e,t)=>{c[e].push(t),"connect"===e&&1===i?.readyState&&t()},off:(e,t)=>{let n=c[e].indexOf(t);-1!==n&&c[e].splice(n,1)},list:(e,t)=>new Promise((r=>{let o=p(e,t),i=[],s=setTimeout((()=>{o.unsub(),r(i)}),n);o.on("eose",(()=>{o.unsub(),clearTimeout(s),r(i)})),o.on("event",(e=>{i.push(e)}))})),get:(e,t)=>new Promise((n=>{let o=p([e],t),i=setTimeout((()=>{o.unsub(),n(null)}),r);o.on("event",(e=>{o.unsub(),clearTimeout(i),n(e)}))})),count:e=>new Promise((t=>{let n=p(e,{...p,verb:"COUNT"}),r=setTimeout((()=>{n.unsub(),t(null)}),o);n.on("count",(e=>{n.unsub(),clearTimeout(r),t(e)}))})),publish:e=>y(e,"EVENT"),auth:e=>y(e,"AUTH"),connect:async function(){h()||await f()},close(){c=ei(),u={},l={},i.readyState===WebSocket.OPEN&&i?.close()},get status(){return i?.readyState??3}}}var ni={};Po(ni,{BECH32_REGEX:()=>oi,decode:()=>ii,naddrEncode:()=>di,neventEncode:()=>hi,noteEncode:()=>ui,nprofileEncode:()=>fi,npubEncode:()=>ci,nrelayEncode:()=>pi,nsecEncode:()=>ai});var ri=5e3,oi=/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;function ii(e){let{prefix:t,words:n}=Ln.decode(e,ri),r=new Uint8Array(Ln.fromWords(n));switch(t){case"nprofile":{let e=si(r);if(!e[0]?.[0])throw new Error("missing TLV 0 for nprofile");if(32!==e[0][0].length)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:we(e[0][0]),relays:e[1]?e[1].map((e=>Bo.decode(e))):[]}}}case"nevent":{let e=si(r);if(!e[0]?.[0])throw new Error("missing TLV 0 for nevent");if(32!==e[0][0].length)throw new Error("TLV 0 should be 32 bytes");if(e[2]&&32!==e[2][0].length)throw new Error("TLV 2 should be 32 bytes");return{type:"nevent",data:{id:we(e[0][0]),relays:e[1]?e[1].map((e=>Bo.decode(e))):[],author:e[2]?.[0]?we(e[2][0]):void 0}}}case"naddr":{let e=si(r);if(!e[0]?.[0])throw new Error("missing TLV 0 for naddr");if(!e[2]?.[0])throw new Error("missing TLV 2 for naddr");if(32!==e[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(!e[3]?.[0])throw new Error("missing TLV 3 for naddr");if(4!==e[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:Bo.decode(e[0][0]),pubkey:we(e[2][0]),kind:parseInt(we(e[3][0]),16),relays:e[1]?e[1].map((e=>Bo.decode(e))):[]}}}case"nrelay":{let e=si(r);if(!e[0]?.[0])throw new Error("missing TLV 0 for nrelay");return{type:"nrelay",data:Bo.decode(e[0][0])}}case"nsec":case"npub":case"note":return{type:t,data:we(r)};default:throw new Error(`unknown prefix ${t}`)}}function si(e){let t={},n=e;for(;n.length>0;){let e=n[0],r=n[1];if(!r)throw new Error(`malformed TLV ${e}`);let o=n.slice(2,2+r);if(n=n.slice(2+r),o.lengthRo.encode(e)))}),n=Ln.toWords(t);return Ln.encode("nprofile",n,ri)}function hi(e){let t=yi({0:[ve(e.id)],1:(e.relays||[]).map((e=>Ro.encode(e))),2:e.author?[ve(e.author)]:[]}),n=Ln.toWords(t);return Ln.encode("nevent",n,ri)}function di(e){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,e.kind,!1);let n=yi({0:[Ro.encode(e.identifier)],1:(e.relays||[]).map((e=>Ro.encode(e))),2:[ve(e.pubkey)],3:[new Uint8Array(t)]}),r=Ln.toWords(n);return Ln.encode("naddr",r,ri)}function pi(e){let t=yi({0:[Ro.encode(e)]}),n=Ln.toWords(t);return Ln.encode("nrelay",n,ri)}function yi(e){let t=[];return Object.entries(e).forEach((([e,n])=>{n.forEach((n=>{let r=new Uint8Array(n.length+2);r.set([parseInt(e)],0),r.set([n.length],1),r.set(n,2),t.push(r)}))})),xe(...t)}var gi={};async function bi(e,t,n){const r=vi(Mt.getSharedSecret(e,"02"+t));let o=Uint8Array.from(Se(16)),i=Ro.encode(n),s=await crypto.subtle.importKey("raw",r,{name:"AES-CBC"},!1,["encrypt"]),a=await crypto.subtle.encrypt({name:"AES-CBC",iv:o},s,i);return`${_n.encode(new Uint8Array(a))}?iv=${_n.encode(new Uint8Array(o.buffer))}`}async function wi(e,t,n){let[r,o]=n.split("?iv="),i=vi(Mt.getSharedSecret(e,"02"+t)),s=await crypto.subtle.importKey("raw",i,{name:"AES-CBC"},!1,["decrypt"]),a=_n.decode(r),c=_n.decode(o),u=await crypto.subtle.decrypt({name:"AES-CBC",iv:c},s,a);return Bo.decode(u)}function vi(e){return e.slice(1,33)}Po(gi,{decrypt:()=>wi,encrypt:()=>bi}),"undefined"!=typeof crypto&&!crypto.subtle&&crypto.webcrypto&&(crypto.subtle=crypto.webcrypto.subtle);var mi={};Po(mi,{NIP05_REGEX:()=>xi,queryProfile:()=>Si,searchDomain:()=>ki,useFetchImplementation:()=>Ei});var _i,xi=/^(?:([\w.+-]+)@)?([\w.-]+)$/;try{_i=fetch}catch{}function Ei(e){_i=e}async function ki(e,t=""){try{return(await(await _i(`https://${e}/.well-known/nostr.json?name=${t}`)).json()).names}catch(e){return{}}}async function Si(e){const t=e.match(xi);if(!t)return null;const[n,r="_",o]=t;try{const e=await _i(`https://${o}/.well-known/nostr.json?name=${r}`),{names:t,relays:n}=function(e){const t={names:{}};for(const[n,r]of Object.entries(e.names))"string"==typeof n&&"string"==typeof r&&(t.names[n]=r);if(e.relays){t.relays={};for(const[n,r]of Object.entries(e.relays))"string"==typeof n&&Array.isArray(r)&&(t.relays[n]=r.filter((e=>"string"==typeof e)))}return t}(await e.json()),i=t[r];return i?{pubkey:i,relays:n?.[i]}:null}catch(e){return null}}function Ai(e,t){let n=Co.fromMasterSeed(Cr(e,t)).derive("m/44'/1237'/0'/0/0").privateKey;if(!n)throw new Error("could not derive private key");return we(n)}function Oi(){return Hr(Un)}function Ci(e){return Dr(e,Un)}Po({},{generateSeedWords:()=>Oi,privateKeyFromSeedWords:()=>Ai,validateWords:()=>Ci});function Ii(e){const t={reply:void 0,root:void 0,mentions:[],profiles:[]},n=[];for(const r of e.tags)"e"===r[0]&&r[1]&&n.push(r),"p"===r[0]&&r[1]&&t.profiles.push({pubkey:r[1],relays:r[2]?[r[2]]:[]});for(let e=0;eIi});function Pi(e){return function(e){let t,n,r;for(n=0,t=0;n>=1;)t++;return 7-t}Po({},{getPow:()=>Pi});function Li(e,t,n,r){return zo({kind:6,tags:[...e.tags??[],["e",t.id,n],["p",t.pubkey]],content:""===e.content?"":JSON.stringify(t),created_at:e.created_at},r)}function Bi(e){if(6!==e.kind)return;let t,n;for(let r=e.tags.length-1;r>=0&&(void 0===t||void 0===n);r--){const o=e.tags[r];o.length>=2&&("e"===o[0]&&void 0===t?t=o:"p"===o[0]&&void 0===n&&(n=o))}return void 0!==t?{id:t[1],relays:[t[2],n?.[2]].filter((e=>"string"==typeof e)),author:n?.[1]}:void 0}function Ri(e,{skipVerification:t}={}){const n=Bi(e);if(void 0===n||""===e.content)return;let r;try{r=JSON.parse(e.content)}catch(e){return}return r.id===n.id&&(t||Do(r))?r:void 0}Po({},{finishRepostEvent:()=>Li,getRepostedEvent:()=>Ri,getRepostedEventPointer:()=>Bi});Po({},{NOSTR_URI_REGEX:()=>$i,parse:()=>Ui,test:()=>ji});var $i=new RegExp(`nostr:(${oi.source})`);function ji(e){return"string"==typeof e&&new RegExp(`^${$i.source}$`).test(e)}function Ui(e){const t=e.match(new RegExp(`^${$i.source}$`));if(!t)throw new Error(`Invalid Nostr URI: ${e}`);return{uri:t[0],value:t[1],decoded:ii(t[1])}}function Ni(e,t,n){const r=t.tags.filter((e=>e.length>=2&&("e"===e[0]||"p"===e[0])));return zo({...e,kind:7,tags:[...e.tags??[],...r,["e",t.id],["p",t.pubkey]],content:e.content??"+"},n)}function Hi(e){if(7!==e.kind)return;let t,n;for(let r=e.tags.length-1;r>=0&&(void 0===t||void 0===n);r--){const o=e.tags[r];o.length>=2&&("e"===o[0]&&void 0===t?t=o:"p"===o[0]&&void 0===n&&(n=o))}return void 0!==t&&void 0!==n?{id:t[1],relays:[t[2],n[2]].filter((e=>void 0!==e)),author:n[1]}:void 0}Po({},{finishReactionEvent:()=>Ni,getReactedEventPointer:()=>Hi});function zi(e,t){let n=[];(t.kind||-1)>=0&&n.push(`kind=${t.kind}`),t.until&&n.push(`created_at<${t.until}`),t.since&&n.push(`created_at>${t.since}`);let r=n.join("&");if(""===r)throw new Error("refusing to create a delegation without any conditions");let o=Be(Ro.encode(`nostr:delegation:${t.pubkey}:${r}`)),i=we(rn.sign(o,e));return{from:Lo(e),to:t.pubkey,cond:r,sig:i}}function Mi(e){let t=e.tags.find((e=>"delegation"===e[0]&&e.length>=4));if(!t)return null;let n=t[1],r=t[2],o=t[3],i=r.split("&");for(let t=0;t"===r&&e.created_at>parseInt(o)))return null}let s=Be(Ro.encode(`nostr:delegation:${e.pubkey}:${r}`));return rn.verify(o,s,n)?n:null}Po({},{createDelegation:()=>zi,getDelegator:()=>Mi});Po({},{matchAll:()=>Fi,regex:()=>qi,replaceAll:()=>Di});var qi=()=>new RegExp(`\\b${$i.source}\\b`,"g");function*Fi(e){const t=e.matchAll(qi());for(const e of t){const[t,n]=e;yield{uri:t,value:n,decoded:ii(n),start:e.index,end:e.index+t.length}}}function Di(e,t){return e.replaceAll(qi(),((e,n)=>t({uri:e,value:n,decoded:ii(n)})))}var Ki;Po({},{useFetchImplementation:()=>Gi,validateGithub:()=>Wi});try{Ki=fetch}catch{}function Gi(e){Ki=e}async function Wi(e,t,n){try{return await(await Ki(`https://gist.github.com/${t}/${n}/raw`)).text()===`Verifying that I control the following Nostr public key: ${e}`}catch(e){return!1}}Po({},{authenticate:()=>Ji});var Vi,Yi,Zi,Ji=async({challenge:e,relay:t,sign:n})=>{const r={kind:22242,created_at:Math.floor(Date.now()/1e3),tags:[["relay",t.url],["challenge",e]],content:""},o=t.auth(await n(r));return new Promise(((e,t)=>{o.on("ok",(function t(){o.off("ok",t),e()})),o.on("failed",(function e(n){o.off("failed",e),t(n)}))}))},Qi={};Po(Qi,{getZapEndpoint:()=>es,makeZapReceipt:()=>rs,makeZapRequest:()=>ts,useFetchImplementation:()=>Xi,validateZapRequest:()=>ns});try{Vi=fetch}catch{}function Xi(e){Vi=e}async function es(e){try{let t="",{lud06:n,lud16:r}=JSON.parse(e.content);if(n){let{words:e}=Ln.decode(n,1e3),r=Ln.fromWords(e);t=Bo.decode(r)}else{if(!r)return null;{let[e,n]=r.split("@");t=`https://${n}/.well-known/lnurlp/${e}`}}let o=await Vi(t),i=await o.json();if(i.allowsNostr&&i.nostrPubkey)return i.callback}catch(e){}return null}function ts({profile:e,event:t,amount:n,relays:r,comment:o=""}){if(!n)throw new Error("amount not given");if(!e)throw new Error("profile not given");let i={kind:9734,created_at:Math.round(Date.now()/1e3),content:o,tags:[["p",e],["amount",n.toString()],["relays",...r]]};return t&&i.tags.push(["e",t]),i}function ns(e){let t;try{t=JSON.parse(e)}catch(e){return"Invalid zap request JSON."}if(!Fo(t))return"Zap request is not a valid Nostr event.";if(!Do(t))return"Invalid signature on zap request.";let n=t.tags.find((([e,t])=>"p"===e&&t));if(!n)return"Zap request doesn't have a 'p' tag.";if(!n[1].match(/^[a-f0-9]{64}$/))return"Zap request 'p' tag is not valid hex.";let r=t.tags.find((([e,t])=>"e"===e&&t));return r&&!r[1].match(/^[a-f0-9]{64}$/)?"Zap request 'e' tag is not valid hex.":t.tags.find((([e,t])=>"relays"===e&&t))?null:"Zap request doesn't have a 'relays' tag."}function rs({zapRequest:e,preimage:t,bolt11:n,paidAt:r}){let o=JSON.parse(e).tags.filter((([e])=>"e"===e||"p"===e||"a"===e)),i={kind:9735,created_at:Math.round(r.getTime()/1e3),content:"",tags:[...o,["bolt11",n],["description",e]]};return t&&i.tags.push(["preimage",t]),i}const os="undefined"!=typeof WebSocket?WebSocket:Zi?Yi:(Zi=1,Yi=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")});function is(e,t={}){if(!(this instanceof is))return new is(e,t);this.url=e,this.opts=t,null==t.reconnect&&(t.reconnect=!0);const n=this;return n.onfn={},ss(n).catch((e=>{n.onfn.error&&n.onfn.error(e)})),this}function ss(e){return new Promise(((t,n)=>{const r=e.ws=new os(e.url);let o=!1;r.onmessage=t=>{!function(e,t){let n;try{n=JSON.parse(t.data)}catch(e){return void console.error("handle_nostr_message",e)}if(n.length>=2)switch(n[0]){case"EVENT":if(n.length<3)return;return e.onfn.event&&e.onfn.event(n[1],n[2]);case"EOSE":return e.onfn.eose&&e.onfn.eose(n[1]);case"NOTICE":return e.onfn.notice&&e.onfn.notice(...n.slice(1));case"OK":e.onfn.ok&&e.onfn.ok(...n.slice(1))}}(e,t),e.onfn.message&&e.onfn.message(t)},r.onclose=t=>{if(e.onfn.close&&e.onfn.close(t),e.reconnecting)return n(new Error("close during reconnect"));!e.manualClose&&e.opts.reconnect&&cs(e)},r.onerror=t=>{if(e.onfn.error&&e.onfn.error(t),e.reconnecting)return n(new Error("error during reconnect"));e.opts.reconnect&&cs(e)},r.onopen=n=>{e.onfn.open&&e.onfn.open(n),o||(o=!0,t(e))}}))}function as(e){return new Promise((t=>setTimeout(t,e)))}async function cs(e){let t=100;try{e.reconnecting=!0,await ss(e),e.reconnecting=!1}catch{await as(t),t*=1.5}}is.prototype.wait_connected=async function(e){let t=1e3;for(;;){if(1===this.ws.readyState)return;await as(t),t*=1.5}},is.prototype.on=function(e,t){return this.onfn[e]=t,this},is.prototype.close=function(){this.ws&&(this.manualClose=!0,this.ws.close())},is.prototype.subscribe=function(e,t){Array.isArray(t)?this.send(["REQ",e,...t]):this.send(["REQ",e,t])},is.prototype.unsubscribe=function(e){this.send(["CLOSE",e])},is.prototype.send=async function(e){await this.wait_connected(),this.ws.send(JSON.stringify(e))};const us=is;function ls(e,t){if(!(this instanceof ls))return new ls(e,t);this.onfn={},this.relays=[],this.opts=t;for(const t of e)this.add(t);return this}ls.prototype.close=function(){for(const e of this.relays)e.close()},ls.prototype.on=function(e,t){for(const n of this.relays)this.onfn[e]=t,n.onfn[e]=t.bind(null,n);return this},ls.prototype.has=function(e){for(const t of this.relays)if(t.url===e)return!0;return!1},ls.prototype.send=function(e,t){const n=t?this.find_relays(t):this.relays;for(const t of n)t.send(e)},ls.prototype.setupHandlers=function(){const e=Object.keys(this.onfn);for(const t of e)for(const e of this.relays)e.onfn[t]=this.onfn[t].bind(null,e)},ls.prototype.remove=function(e){let t=0;for(const n of this.relays){if(n.url===e)return n.ws&&n.ws.close(),this.relays=this.replays.splice(t,1),!0;t+=1}return!1},ls.prototype.subscribe=function(e,t,n){const r=n?this.find_relays(n):this.relays;for(const n of r)n.subscribe(e,t)},ls.prototype.unsubscribe=function(e,t){const n=t?this.find_relays(t):this.relays;for(const t of n)t.unsubscribe(e)},ls.prototype.add=function(e){if(e instanceof us)return!this.has(e.url)&&(this.relays.push(e),this.setupHandlers(),!0);if(this.has(e))return!1;const t=us(e,this.opts);return this.relays.push(t),this.setupHandlers(),!0},ls.prototype.find_relays=function(e){if(e instanceof us)return[e];if(0===e.length)return[];if(!e[0])throw new Error("what!?");return e[0]instanceof us?e:this.relays.reduce(((t,n)=>(e.some((e=>n.url===e))&&t.push(n),t)),[])};var fs=$n(ls);function hs(){}function ds(){ds.init.call(this)}function ps(e){return void 0===e._maxListeners?ds.defaultMaxListeners:e._maxListeners}function ys(e,t,n,r){var o,i,s,a;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((i=e._events)?(i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),s=i[t]):(i=e._events=new hs,e._eventsCount=0),s){if("function"==typeof s?s=i[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),!s.warned&&(o=ps(e))&&o>0&&s.length>o){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,"function"==typeof console.warn?console.warn(a):console.log(a)}}else s=i[t]=n,++e._eventsCount;return e}function gs(e,t,n){var r=!1;function o(){e.removeListener(t,o),r||(r=!0,n.apply(e,arguments))}return o.listener=n,o}function bs(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function ws(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}let vs;hs.prototype=Object.create(null),ds.EventEmitter=ds,ds.usingDomains=!1,ds.prototype.domain=void 0,ds.prototype._events=void 0,ds.prototype._maxListeners=void 0,ds.defaultMaxListeners=10,ds.init=function(){this.domain=null,ds.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new hs,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ds.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},ds.prototype.getMaxListeners=function(){return ps(this)},ds.prototype.emit=function(e){var t,n,r,o,i,s,a,c="error"===e;if(s=this._events)c=c&&null==s.error;else if(!c)return!1;if(a=this.domain,c){if(t=arguments[1],!a){if(t instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(n=s[e]))return!1;var l="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,o=ws(e,r),i=0;i0;)if(n[i]===t||n[i].listener&&n[i].listener===t){s=n[i].listener,o=i;break}if(o<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new hs,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,o=e.length;r0?Reflect.ownKeys(this._events):[]};const ms=new Uint8Array(16);function _s(){if(!vs&&(vs="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!vs))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return vs(ms)}const xs=[];for(let e=0;e<256;++e)xs.push((e+256).toString(16).slice(1));var Es={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ks(e,t,n){if(Es.randomUUID&&!t&&!e)return Es.randomUUID();const r=(e=e||{}).random||(e.rng||_s)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return function(e,t=0){return(xs[e[t+0]]+xs[e[t+1]]+xs[e[t+2]]+xs[e[t+3]]+"-"+xs[e[t+4]]+xs[e[t+5]]+"-"+xs[e[t+6]]+xs[e[t+7]]+"-"+xs[e[t+8]]+xs[e[t+9]]+"-"+xs[e[t+10]]+xs[e[t+11]]+xs[e[t+12]]+xs[e[t+13]]+xs[e[t+14]]+xs[e[t+15]]).toLowerCase()}(r)}function Ss(){throw new Error("setTimeout has not been defined")}function As(){throw new Error("clearTimeout has not been defined")}var Os=Ss,Cs=As;function Is(e){if(Os===setTimeout)return setTimeout(e,0);if((Os===Ss||!Os)&&setTimeout)return Os=setTimeout,setTimeout(e,0);try{return Os(e,0)}catch(t){try{return Os.call(null,e,0)}catch(t){return Os.call(this,e,0)}}}"function"==typeof y.setTimeout&&(Os=setTimeout),"function"==typeof y.clearTimeout&&(Cs=clearTimeout);var Ps,Ts=[],Ls=!1,Bs=-1;function Rs(){Ls&&Ps&&(Ls=!1,Ps.length?Ts=Ps.concat(Ts):Bs=-1,Ts.length&&$s())}function $s(){if(!Ls){var e=Is(Rs);Ls=!0;for(var t=Ts.length;t;){for(Ps=Ts,Ts=[];++Bs1)for(var n=1;n=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}return Vs=function(a,c){c=c||{};var u=typeof a;if("string"===u&&a.length>0)return function(s){if((s=String(s)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(s);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*i;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(a);if("number"===u&&isFinite(a))return c.long?function(o){var i=Math.abs(o);if(i>=r)return s(o,i,r,"day");if(i>=n)return s(o,i,n,"hour");if(i>=t)return s(o,i,t,"minute");if(i>=e)return s(o,i,e,"second");return o+" ms"}(a):function(o){var i=Math.abs(o);if(i>=r)return Math.round(o/r)+"d";if(i>=n)return Math.round(o/n)+"h";if(i>=t)return Math.round(o/t)+"m";if(i>=e)return Math.round(o/e)+"s";return o+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}var Xs=function(e){function t(e){let r,o,i,s=null;function a(...e){if(!a.enabled)return;const n=a,o=Number(new Date),i=o-(r||o);n.diff=i,n.prev=r,n.curr=o,r=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,o)=>{if("%%"===r)return"%";s++;const i=t.formatters[o];if("function"==typeof i){const t=e[s];r=i.call(n,t),e.splice(s,1),s--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(o!==t.namespaces&&(o=t.namespaces,i=t.enabled(e)),i),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{"%%"!==e&&(r++,"%c"===e&&(o=r))})),t.splice(o,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==Zs&&"env"in Zs&&(e=Zs.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Xs(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Js,Js.exports);var ea=$n(Js.exports),ta={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new o(r,i||e,s),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,r,o=[];if(0===this._eventsCount)return o;for(r in e=this._events)t.call(e,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},a.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,s=new Array(i);o>18&63]+ia[o>>12&63]+ia[o>>6&63]+ia[63&o]);return i.join("")}function fa(e){var t;ca||ua();for(var n=e.length,r=n%3,o="",i=[],s=16383,a=0,c=n-r;ac?c:a+s));return 1===r?(t=e[n-1],o+=ia[t>>2],o+=ia[t<<4&63],o+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],o+=ia[t>>10],o+=ia[t>>4&63],o+=ia[t<<2&63],o+="="),i.push(o),i.join("")}function ha(e,t,n,r,o){var i,s,a=8*o-r-1,c=(1<>1,l=-7,f=n?o-1:0,h=n?-1:1,d=e[t+f];for(f+=h,i=d&(1<<-l)-1,d>>=-l,l+=a;l>0;i=256*i+e[t+f],f+=h,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=r;l>0;s=256*s+e[t+f],f+=h,l-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),i-=u}return(d?-1:1)*s*Math.pow(2,i-r)}function da(e,t,n,r,o,i){var s,a,c,u=8*i-o-1,l=(1<>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,p=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+f>=1?h/c:h*Math.pow(2,1-f))*c>=2&&(s++,c/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*c-1)*Math.pow(2,o),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,o),s=0));o>=8;e[n+d]=255&a,d+=p,a/=256,o-=8);for(s=s<0;e[n+d]=255&s,d+=p,s/=256,u-=8);e[n+d-p]|=128*y}var pa={}.toString,ya=Array.isArray||function(e){return"[object Array]"==pa.call(e)};function ga(){return wa.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function ba(e,t){if(ga()=ga())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ga().toString(16)+" bytes");return 0|e}function ka(e){return!(null==e||!e._isBuffer)}function Sa(e,t){if(ka(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Qa(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Xa(e).length;default:if(r)return Qa(e).length;t=(""+t).toLowerCase(),r=!0}}function Aa(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Ma(this,t,n);case"utf8":case"utf-8":return Ua(this,t,n);case"ascii":return Ha(this,t,n);case"latin1":case"binary":return za(this,t,n);case"base64":return ja(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qa(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function Oa(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function Ca(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=wa.from(t,r)),ka(t))return 0===t.length?-1:Ia(e,t,n,r,o);if("number"==typeof t)return t&=255,wa.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):Ia(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function Ia(e,t,n,r,o){var i,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var l=-1;for(i=n;ia&&(n=a-c),i=n;i>=0;i--){for(var f=!0,h=0;ho&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var s=0;s>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function ja(e,t,n){return 0===t&&n===e.length?fa(e):fa(e.slice(t,n))}function Ua(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:u>223?3:u>191?2:1;if(o+f<=n)switch(f){case 1:u<128&&(l=u);break;case 2:128==(192&(i=e[o+1]))&&(c=(31&u)<<6|63&i)>127&&(l=c);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&(c=(15&u)<<12|(63&i)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),o+=f}return function(e){var t=e.length;if(t<=Na)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},wa.prototype.compare=function(e,t,n,r,o){if(!ka(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(i,s),c=this.slice(r,o),u=e.slice(t,n),l=0;lo)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return Pa(this,e,t,n);case"utf8":case"utf-8":return Ta(this,e,t,n);case"ascii":return La(this,e,t,n);case"latin1":case"binary":return Ba(this,e,t,n);case"base64":return Ra(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return $a(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},wa.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Na=4096;function Ha(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;or)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function Da(e,t,n,r,o,i){if(!ka(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function Ka(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function Ga(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function Wa(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Va(e,t,n,r,o){return o||Wa(e,0,n,4),da(e,t,n,r,23,4),n+4}function Ya(e,t,n,r,o){return o||Wa(e,0,n,8),da(e,t,n,r,52,8),n+8}wa.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},wa.prototype.readUInt8=function(e,t){return t||Fa(e,1,this.length),this[e]},wa.prototype.readUInt16LE=function(e,t){return t||Fa(e,2,this.length),this[e]|this[e+1]<<8},wa.prototype.readUInt16BE=function(e,t){return t||Fa(e,2,this.length),this[e]<<8|this[e+1]},wa.prototype.readUInt32LE=function(e,t){return t||Fa(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},wa.prototype.readUInt32BE=function(e,t){return t||Fa(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},wa.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||Fa(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},wa.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||Fa(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},wa.prototype.readInt8=function(e,t){return t||Fa(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},wa.prototype.readInt16LE=function(e,t){t||Fa(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},wa.prototype.readInt16BE=function(e,t){t||Fa(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},wa.prototype.readInt32LE=function(e,t){return t||Fa(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},wa.prototype.readInt32BE=function(e,t){return t||Fa(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},wa.prototype.readFloatLE=function(e,t){return t||Fa(e,4,this.length),ha(this,e,!0,23,4)},wa.prototype.readFloatBE=function(e,t){return t||Fa(e,4,this.length),ha(this,e,!1,23,4)},wa.prototype.readDoubleLE=function(e,t){return t||Fa(e,8,this.length),ha(this,e,!0,52,8)},wa.prototype.readDoubleBE=function(e,t){return t||Fa(e,8,this.length),ha(this,e,!1,52,8)},wa.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||Da(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},wa.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||Da(this,e,t,1,255,0),wa.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},wa.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||Da(this,e,t,2,65535,0),wa.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Ka(this,e,t,!0),t+2},wa.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||Da(this,e,t,2,65535,0),wa.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Ka(this,e,t,!1),t+2},wa.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||Da(this,e,t,4,4294967295,0),wa.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Ga(this,e,t,!0),t+4},wa.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||Da(this,e,t,4,4294967295,0),wa.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Ga(this,e,t,!1),t+4},wa.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);Da(this,e,t,n,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i>0)-a&255;return t+n},wa.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);Da(this,e,t,n,o-1,-o)}var i=n-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+n},wa.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||Da(this,e,t,1,127,-128),wa.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},wa.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||Da(this,e,t,2,32767,-32768),wa.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Ka(this,e,t,!0),t+2},wa.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||Da(this,e,t,2,32767,-32768),wa.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Ka(this,e,t,!1),t+2},wa.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||Da(this,e,t,4,2147483647,-2147483648),wa.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Ga(this,e,t,!0),t+4},wa.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||Da(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),wa.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Ga(this,e,t,!1),t+4},wa.prototype.writeFloatLE=function(e,t,n){return Va(this,e,t,!0,n)},wa.prototype.writeFloatBE=function(e,t,n){return Va(this,e,t,!1,n)},wa.prototype.writeDoubleLE=function(e,t,n){return Ya(this,e,t,!0,n)},wa.prototype.writeDoubleBE=function(e,t,n){return Ya(this,e,t,!1,n)},wa.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!wa.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function Xa(e){return function(e){var t,n,r,o,i,s;ca||ua();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i="="===e[a-2]?2:"="===e[a-1]?1:0,s=new aa(3*a/4-i),r=i>0?a-4:a;var c=0;for(t=0,n=0;t>16&255,s[c++]=o>>8&255,s[c++]=255&o;return 2===i?(o=sa[e.charCodeAt(t)]<<2|sa[e.charCodeAt(t+1)]>>4,s[c++]=255&o):1===i&&(o=sa[e.charCodeAt(t)]<<10|sa[e.charCodeAt(t+1)]<<4|sa[e.charCodeAt(t+2)]>>2,s[c++]=o>>8&255,s[c++]=255&o),s}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Za,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function ec(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function tc(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var nc,rc,oc={};var ic,sc,ac,cc,uc={name:"websocket",description:"Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.",keywords:["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],author:"Brian McKelvey (https://github.com/theturtle32)",contributors:["Iñaki Baz Castillo (http://dev.sipdoc.net)"],version:"1.0.34",repository:{type:"git",url:"https://github.com/theturtle32/WebSocket-Node.git"},homepage:"https://github.com/theturtle32/WebSocket-Node",engines:{node:">=4.0.0"},dependencies:{bufferutil:"^4.0.1",debug:"^2.2.0","es5-ext":"^0.10.50","typedarray-to-buffer":"^3.1.5","utf-8-validate":"^5.0.2",yaeti:"^0.0.6"},devDependencies:{"buffer-equal":"^1.0.0",gulp:"^4.0.2","gulp-jshint":"^2.0.4","jshint-stylish":"^2.2.1",jshint:"^2.0.0",tape:"^4.9.1"},config:{verbose:!1},scripts:{test:"tape test/unit/*.js",gulp:"gulp"},main:"index",directories:{lib:"./lib"},browser:"lib/browser.js",license:"Apache-2.0"};function lc(){if(cc)return ac;var e;if(cc=1,"object"==typeof globalThis)e=globalThis;else try{e=function(){if(rc)return nc;rc=1;var e=function(){if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;throw new Error("Unable to resolve global `this`")};return nc=function(){if(this)return this;if("object"==typeof globalThis&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(t){return e()}try{return __global__||e()}finally{delete Object.prototype.__global__}}()}()}catch(e){}finally{if(e||"undefined"==typeof window||(e=window),!e)throw new Error("Could not determine global this")}var t=e.WebSocket||e.MozWebSocket,n=sc?ic:(sc=1,ic=uc.version);function r(e,n){return n?new t(e,n):new t(e)}return t&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(e){Object.defineProperty(r,e,{get:function(){return t[e]}})})),ac={w3cwebsocket:t?r:null,version:n}}var fc,hc,dc={},pc={},yc={},gc={},bc={},wc={};function vc(){if(hc)return bc;hc=1;var e=Rn&&Rn.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(bc,"__esModule",{value:!0}),bc.Container=void 0;var t=function(){if(fc)return wc;fc=1,Object.defineProperty(wc,"__esModule",{value:!0}),wc.ForOfAdaptor=void 0;var e=function(){function e(e,t){this.it_=e,this.last_=t}return e.prototype.next=function(){if(this.it_.equals(this.last_))return{done:!0,value:void 0};var e=this.it_;return this.it_=this.it_.next(),{done:!1,value:e.value}},e.prototype[Symbol.iterator]=function(){return this},e}();return wc.ForOfAdaptor=e,wc}(),n=function(){function n(){}return n.prototype.empty=function(){return 0===this.size()},n.prototype.rbegin=function(){return this.end().reverse()},n.prototype.rend=function(){return this.begin().reverse()},n.prototype[Symbol.iterator]=function(){return new t.ForOfAdaptor(this.begin(),this.end())},n.prototype.toJSON=function(){var t,n,r=[];try{for(var o=e(this),i=o.next();!i.done;i=o.next()){var s=i.value;r.push(s)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return r},n}();return bc.Container=n,bc}var mc,_c,xc={};function Ec(){if(mc)return xc;mc=1;var e=Rn&&Rn.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};Object.defineProperty(xc,"__esModule",{value:!0}),xc.NativeArrayIterator=void 0;var t=function(){function t(e,t){this.data_=e,this.index_=t}return t.prototype.index=function(){return this.index_},Object.defineProperty(t.prototype,"value",{get:function(){return this.data_[this.index_]},enumerable:!1,configurable:!0}),t.prototype.prev=function(){return--this.index_,this},t.prototype.next=function(){return++this.index_,this},t.prototype.advance=function(e){return this.index_+=e,this},t.prototype.equals=function(e){return this.data_===e.data_&&this.index_===e.index_},t.prototype.swap=function(t){var n,r;n=e([t.data_,this.data_],2),this.data_=n[0],t.data_=n[1],r=e([t.index_,this.index_],2),this.index_=r[0],t.index_=r[1]},t}();return xc.NativeArrayIterator=t,xc}var kc,Sc,Ac,Oc={},Cc={},Ic={},Pc={};function Tc(){if(Sc)return Ic;Sc=1;var e,t=Rn&&Rn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(Ic,"__esModule",{value:!0}),Ic.LogicError=void 0;var n=function(){if(kc)return Pc;kc=1;var e,t=Rn&&Rn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(Pc,"__esModule",{value:!0}),Pc.Exception=void 0;var n=function(e){function n(t){var n=this.constructor,r=e.call(this,t)||this,o=n.prototype;return Object.setPrototypeOf?Object.setPrototypeOf(r,o):r.__proto__=o,r}return t(n,e),Object.defineProperty(n.prototype,"name",{get:function(){return this.constructor.name},enumerable:!1,configurable:!0}),n.prototype.what=function(){return this.message},n.prototype.toJSON=function(){return{name:this.name,message:this.message,stack:this.stack}},n}(Error);return Pc.Exception=n,Pc}(),r=function(e){function n(t){return e.call(this,t)||this}return t(n,e),n}(n.Exception);return Ic.LogicError=r,Ic}function Lc(){if(Ac)return Cc;Ac=1;var e,t=Rn&&Rn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(Cc,"__esModule",{value:!0}),Cc.InvalidArgument=void 0;var n=function(e){function n(t){return e.call(this,t)||this}return t(n,e),n}(Tc().LogicError);return Cc.InvalidArgument=n,Cc}var Bc,Rc,$c,jc={};function Uc(){return Rc||(Rc=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ErrorGenerator=void 0;var t=Lc(),n=function(){if(Bc)return jc;Bc=1;var e,t=Rn&&Rn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(jc,"__esModule",{value:!0}),jc.OutOfRange=void 0;var n=function(e){function n(t){return e.call(this,t)||this}return t(n,e),n}(Tc().LogicError);return jc.OutOfRange=n,jc}();!function(e){function r(e){if("string"==typeof e)return e;var t=e.constructor.name;return e.constructor.__MODULE&&(t="".concat(e.constructor.__MODULE,".").concat(t)),"std.".concat(t)}e.get_class_name=r,e.empty=function(e,t){return new n.OutOfRange("Error on ".concat(r(e),".").concat(t,"(): it's empty container."))},e.negative_index=function(e,t,o){return new n.OutOfRange("Error on ".concat(r(e),".").concat(t,"(): parametric index is negative -> (index = ").concat(o,")."))},e.excessive_index=function(e,t,o,i){return new n.OutOfRange("Error on ".concat(r(e),".").concat(t,"(): parametric index is equal or greater than size -> (index = ").concat(o,", size: ").concat(i,")."))},e.not_my_iterator=function(e,n){return new t.InvalidArgument("Error on ".concat(r(e),".").concat(n,"(): parametric iterator is not this container's own."))},e.erased_iterator=function(e,n){return new t.InvalidArgument("Error on ".concat(r(e),".").concat(n,"(): parametric iterator, it already has been erased."))},e.negative_iterator=function(e,t,o){return new n.OutOfRange("Error on ".concat(r(e),".").concat(t,"(): parametric iterator is directing negative position -> (index = ").concat(o,")."))},e.iterator_end_value=function(e,t){void 0===t&&(t="end");var o=r(e);return new n.OutOfRange("Error on ".concat(o,".Iterator.value: cannot access to the ").concat(o,".").concat(t,"().value."))},e.key_nout_found=function(e,t,o){throw new n.OutOfRange("Error on ".concat(r(e),".").concat(t,"(): unable to find the matched key -> ").concat(o))}}(e.ErrorGenerator||(e.ErrorGenerator={}))}(Oc)),Oc}function Nc(){if($c)return yc;$c=1;var e,t=Rn&&Rn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),n=Rn&&Rn.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},r=Rn&&Rn.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(Kc,"__esModule",{value:!0}),Kc.hash=void 0;var t=Vc();function n(e,t){return t^=e?1:0,t*=s}function r(e,t){return o(e.toString(),t)}function o(e,t){for(var n=0;n0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},n=Rn&&Rn.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},n=Rn&&Rn.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o=1&&i[0]instanceof Array?(r=function(){var r=i[0];e.push.apply(e,n([],t(r),!1))},o=i.slice(1)):i.length>=2&&i[0].next instanceof Function&&i[1].next instanceof Function?(r=function(){var t=i[0],n=i[1];e.assign(t,n)},o=i.slice(2)):(r=null,o=i),{ramda:r,tail:o}}}(e.IAssociativeContainer||(e.IAssociativeContainer={}))),Mc;var e,t,n}(),o=Yc(),i=Xc();!function(e){e.construct=function(e,s,a){for(var c=[],u=3;u=1&&(f=p.tail[0]),p.tail.length>=2&&(h=p.tail[1])}a(f,h),null!==l&&l()}}(e.IHashContainer||(e.IHashContainer={}))}(zc)),zc}var tu,nu={},ru={},ou={};function iu(){if(tu)return ou;tu=1,Object.defineProperty(ou,"__esModule",{value:!0}),ou.ListIterator=void 0;var e=Uc(),t=function(){function t(e,t,n){this.prev_=e,this.next_=t,this.value_=n}return t._Set_prev=function(e,t){e.prev_=t},t._Set_next=function(e,t){e.next_=t},t.prototype.prev=function(){return this.prev_},t.prototype.next=function(){return this.next_},Object.defineProperty(t.prototype,"value",{get:function(){return this._Try_value(),this.value_},enumerable:!1,configurable:!0}),t.prototype._Try_value=function(){if(void 0===this.value_&&!0===this.equals(this.source().end()))throw e.ErrorGenerator.iterator_end_value(this.source())},t.prototype.equals=function(e){return this===e},t}();return ou.ListIterator=t,ou}var su,au={};var cu,uu,lu={};function fu(){if(cu)return lu;cu=1,Object.defineProperty(lu,"__esModule",{value:!0}),lu.next=lu.prev=lu.advance=lu.distance=lu.size=lu.empty=void 0;var e=Lc();function t(t,n){if(0===n)return t;if(t.advance instanceof Function)return t.advance(n);var r;if(n<0){if(!(t.prev instanceof Function))throw new e.InvalidArgument("Error on std.advance(): parametric iterator is not a bi-directional iterator, thus advancing to negative direction is not possible.");r=function(e){return e.prev()},n=-n}else r=function(e){return e.next()};for(;n-- >0;)t=r(t);return t}return lu.empty=function(e){return e instanceof Array?0!==e.length:e.empty()},lu.size=function(e){return e instanceof Array?e.length:e.size()},lu.distance=function(e,t){if(e.index instanceof Function)return function(e,t){var n=e.index(),r=t.index();return e.base instanceof Function?n-r:r-n}(e,t);for(var n=0;!e.equals(t);e=e.next())++n;return n},lu.advance=t,lu.prev=function(e,n){return void 0===n&&(n=1),1===n?e.prev():t(e,-n)},lu.next=function(e,n){return void 0===n&&(n=1),1===n?e.next():t(e,n)},lu}function hu(){if(uu)return ru;uu=1;var e,t=Rn&&Rn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),n=Rn&&Rn.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};Object.defineProperty(ru,"__esModule",{value:!0}),ru.ListContainer=void 0;var r=vc(),o=iu(),i=function(){if(su)return au;su=1,Object.defineProperty(au,"__esModule",{value:!0}),au.Repeater=void 0;var e=function(){function e(e,t){this.index_=e,this.value_=t}return e.prototype.index=function(){return this.index_},Object.defineProperty(e.prototype,"value",{get:function(){return this.value_},enumerable:!1,configurable:!0}),e.prototype.next=function(){return++this.index_,this},e.prototype.equals=function(e){return this.index_===e.index_},e}();return au.Repeater=e,au}(),s=Ec(),a=fu(),c=Uc(),u=function(e){function r(){var t=e.call(this)||this;return t.end_=t._Create_iterator(null,null),t.clear(),t}return t(r,e),r.prototype.assign=function(e,t){this.clear(),this.insert(this.end(),e,t)},r.prototype.clear=function(){o.ListIterator._Set_prev(this.end_,this.end_),o.ListIterator._Set_next(this.end_,this.end_),this.begin_=this.end_,this.size_=0},r.prototype.resize=function(e){var t=e-this.size();t>0?this.insert(this.end(),t,void 0):t<0&&this.erase((0,a.advance)(this.end(),-t),this.end())},r.prototype.begin=function(){return this.begin_},r.prototype.end=function(){return this.end_},r.prototype.size=function(){return this.size_},r.prototype.push_front=function(e){this.insert(this.begin_,e)},r.prototype.push_back=function(e){this.insert(this.end_,e)},r.prototype.pop_front=function(){if(!0===this.empty())throw c.ErrorGenerator.empty(this.end_.source().constructor.name,"pop_front");this.erase(this.begin_)},r.prototype.pop_back=function(){if(!0===this.empty())throw c.ErrorGenerator.empty(this.end_.source().constructor.name,"pop_back");this.erase(this.end_.prev())},r.prototype.push=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(mu,"__esModule",{value:!0}),mu.HashBuckets=void 0;var t=function(){function t(e,t){this.fetcher_=e,this.hasher_=t,this.max_load_factor_=r,this.data_=[],this.size_=0,this.initialize()}return t.prototype.clear=function(){this.data_=[],this.size_=0,this.initialize()},t.prototype.rehash=function(t){var r,o,i,s;t=Math.max(t,n);for(var a=[],c=0;cthis.capacity()&&(e=Math.floor(e/this.max_load_factor_),this.rehash(e))},t.prototype.initialize=function(){for(var e=0;et&&this.reserve(2*t);var n=this.index(e);this.data_[n].push(e)},t.prototype.erase=function(e){for(var t=this.index(e),n=this.data_[t],r=0;r0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},o=Rn&&Rn.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};Object.defineProperty(e,"__esModule",{value:!0}),e.SetElementList=void 0;var o=hu(),i=iu(),s=gu(),a=function(e){function t(t){var n=e.call(this)||this;return n.associative_=t,n}return n(t,e),t.prototype._Create_iterator=function(e,n,r){return t.Iterator.create(this,e,n,r)},t._Swap_associative=function(e,t){var n;n=r([t.associative_,e.associative_],2),e.associative_=n[0],t.associative_=n[1]},t.prototype.associative=function(){return this.associative_},t}(o.ListContainer);e.SetElementList=a,function(e){var t=function(e){function t(t,n,r,o){var i=e.call(this,n,r,o)||this;return i.source_=t,i}return n(t,e),t.create=function(e,n,r,o){return new t(e,n,r,o)},t.prototype.reverse=function(){return new r(this)},t.prototype.source=function(){return this.source_.associative()},t}(i.ListIterator);e.Iterator=t;var r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype._Create_neighbor=function(e){return new t(e)},t}(s.ReverseIterator);e.ReverseIterator=r}(a=e.SetElementList||(e.SetElementList={})),e.SetElementList=a}(nu)),nu),c=function(){if(wu)return vu;wu=1;var e,t=Rn&&Rn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),n=Rn&&Rn.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},r=Rn&&Rn.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(vu,"__esModule",{value:!0}),vu.SetHashBuckets=void 0;var o=function(e){function o(t,n,r){var o=e.call(this,i,n)||this;return o.source_=t,o.key_eq_=r,o}return t(o,e),o._Swap_source=function(e,t){var r;r=n([t.source_,e.source_],2),e.source_=r[0],t.source_=r[1]},o.prototype.key_eq=function(){return this.key_eq_},o.prototype.find=function(e){var t,n,o=this.hash_function()(e)%this.length(),i=this.at(o);try{for(var s=r(i),a=s.next();!a.done;a=s.next()){var c=a.value;if(this.key_eq_(c.value,e))return c}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return this.source_.end()},o}(_u().HashBuckets);function i(e){return e.value}return vu.SetHashBuckets=o,vu}(),u=Su(),l=function(e){function t(){for(var n=[],i=0;i0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},r=Rn&&Rn.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},o=Rn&&Rn.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};Object.defineProperty(e,"__esModule",{value:!0}),e.MapElementList=void 0;var o=hu(),i=iu(),s=gu(),a=function(e){function t(t){var n=e.call(this)||this;return n.associative_=t,n}return n(t,e),t.prototype._Create_iterator=function(e,n,r){return t.Iterator.create(this,e,n,r)},t._Swap_associative=function(e,t){var n;n=r([t.associative_,e.associative_],2),e.associative_=n[0],t.associative_=n[1]},t.prototype.associative=function(){return this.associative_},t}(o.ListContainer);e.MapElementList=a,function(e){var t=function(e){function t(t,n,r,o){var i=e.call(this,n,r,o)||this;return i.list_=t,i}return n(t,e),t.create=function(e,n,r,o){return new t(e,n,r,o)},t.prototype.reverse=function(){return new r(this)},t.prototype.source=function(){return this.list_.associative()},Object.defineProperty(t.prototype,"first",{get:function(){return this.value.first},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"second",{get:function(){return this.value.second},set:function(e){this.value.second=e},enumerable:!1,configurable:!0}),t}(i.ListIterator);e.Iterator=t;var r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype._Create_neighbor=function(e){return new t(e)},Object.defineProperty(t.prototype,"first",{get:function(){return this.base_.first},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"second",{get:function(){return this.base_.second},set:function(e){this.base_.second=e},enumerable:!1,configurable:!0}),t}(s.ReverseIterator);e.ReverseIterator=r}(a=e.MapElementList||(e.MapElementList={})),e.MapElementList=a}(Ru)),Ru),c=function(){if($u)return ju;$u=1;var e,t=Rn&&Rn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),n=Rn&&Rn.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},r=Rn&&Rn.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(ju,"__esModule",{value:!0}),ju.MapHashBuckets=void 0;var o=function(e){function o(t,n,r){var o=e.call(this,i,n)||this;return o.source_=t,o.key_eq_=r,o}return t(o,e),o._Swap_source=function(e,t){var r;r=n([t.source_,e.source_],2),e.source_=r[0],t.source_=r[1]},o.prototype.key_eq=function(){return this.key_eq_},o.prototype.find=function(e){var t,n,o=this.hash_function()(e)%this.length(),i=this.at(o);try{for(var s=r(i),a=s.next();!a.done;a=s.next()){var c=a.value;if(this.key_eq_(c.first,e))return c}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return this.source_.end()},o}(_u().HashBuckets);function i(e){return e.first}return ju.MapHashBuckets=o,ju}(),u=function(){if(Uu)return zu;Uu=1,Object.defineProperty(zu,"__esModule",{value:!0}),zu.Entry=void 0;var e=Yc(),t=Xc(),n=function(){function n(e,t){this.first=e,this.second=t}return n.prototype.equals=function(e){return(0,t.equal_to)(this.first,e.first)},n.prototype.less=function(e){return(0,t.less)(this.first,e.first)},n.prototype.hashCode=function(){return(0,e.hash)(this.first)},n}();return zu.Entry=n,zu}(),l=Su(),f=function(e){function t(){for(var n=[],i=0;i0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}ra.is_node()&&(Rn.WebSocket=(Zu||(Zu=1,function(e){var t,n=Rn&&Rn.__extends||(t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},t(e,n)},function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),r=Rn&&Rn.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}};Object.defineProperty(dc,"__esModule",{value:!0});var t=Au(),n=Mu(),r=function(){function r(){this.listeners_=new n.HashMap,this.created_at_=new Date}return r.prototype.dispatchEvent=function(t){var n,r,o=this.listeners_.find(t.type);if(!o.equals(this.listeners_.end())){t.target=this,t.timeStamp=(new Date).getTime()-this.created_at_.getTime();try{for(var i=e(o.second),s=i.next();!s.done;s=i.next())(0,s.value)(t)}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}},r.prototype.addEventListener=function(e,n){var r=this.listeners_.find(e);r.equals(this.listeners_.end())&&(r=this.listeners_.emplace(e,new t.HashSet).first),r.second.insert(n)},r.prototype.removeEventListener=function(e,t){var n=this.listeners_.find(e);n.equals(this.listeners_.end())||(n.second.erase(t),n.second.empty()&&this.listeners_.erase(n))},r}();return dc.EventTarget=r,dc}(),s=Du(),a=function(){if(Ku)return Gu;Ku=1;var e,t=Rn&&Rn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)},function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(Gu,"__esModule",{value:!0});var n=function(e){function n(t,n){return e.call(this,t,n)||this}return t(n,e),n}(Du().Event);return Gu.CloseEvent=n,Gu}(),c=function(){if(Wu)return Vu;Wu=1;var e,t=Rn&&Rn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)},function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(Vu,"__esModule",{value:!0});var n=function(e){function n(t,n){return e.call(this,t,n)||this}return t(n,e),n}(Du().Event);return Vu.MessageEvent=n,Vu}(),u=function(){if(Yu)return Ju;Yu=1;var e,t=Rn&&Rn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)},function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(Ju,"__esModule",{value:!0});var n=function(e){function n(t,n){return e.call(this,t,n)||this}return t(n,e),n}(Du().Event);return Ju.ErrorEvent=n,Ju}(),l=function(e){function t(n,r){var i=e.call(this)||this;return i.on_={},i.state_=t.CONNECTING,i.client_=new o.client,i.client_.on("connect",i._Handle_connect.bind(i)),i.client_.on("connectFailed",i._Handle_error.bind(i)),"string"==typeof r&&(r=[r]),i.client_.connect(n,r),i}return n(t,e),t.prototype.close=function(e,n){this.state_=t.CLOSING,void 0===e?this.connection_.sendCloseFrame():this.connection_.sendCloseFrame(e,n,!0)},t.prototype.send=function(e){if("string"==typeof e.valueOf())this.connection_.sendUTF(e);else{var t=void 0;t=e instanceof wa?e:e instanceof Blob?new wa(e,"blob"):e.buffer?new wa(e.buffer):new wa(e),this.connection_.sendBytes(t)}},Object.defineProperty(t.prototype,"url",{get:function(){return this.client_.url.href},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"protocol",{get:function(){return this.client_.protocols?this.client_.protocols[0]:""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"extensions",{get:function(){return this.connection_&&this.connection_.extensions?this.connection_.extensions[0].name:""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"readyState",{get:function(){return this.state_},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bufferedAmount",{get:function(){return this.connection_.bytesWaitingToFlush},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"binaryType",{get:function(){return"arraybuffer"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onopen",{get:function(){return this.on_.open},set:function(e){this._Set_on("open",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onclose",{get:function(){return this.on_.close},set:function(e){this._Set_on("close",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onmessage",{get:function(){return this.on_.message},set:function(e){this._Set_on("message",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onerror",{get:function(){return this.on_.error},set:function(e){this._Set_on("error",e)},enumerable:!0,configurable:!0}),t.prototype._Set_on=function(e,t){this.on_[e]&&this.removeEventListener(e,this.on_[e]),this.addEventListener(e,t),this.on_[e]=t},t.prototype._Handle_connect=function(e){this.connection_=e,this.state_=t.OPEN,this.connection_.on("message",this._Handle_message.bind(this)),this.connection_.on("error",this._Handle_error.bind(this)),this.connection_.on("close",this._Handle_close.bind(this));var n=new s.Event("open",f);this.dispatchEvent(n)},t.prototype._Handle_close=function(e,n){var o=new a.CloseEvent("close",r({},f,{code:e,reason:n}));this.state_=t.CLOSED,this.dispatchEvent(o)},t.prototype._Handle_message=function(e){var t=new c.MessageEvent("message",r({},f,{data:e.binaryData?e.binaryData:e.utf8Data}));this.dispatchEvent(t)},t.prototype._Handle_error=function(e){var n=new u.ErrorEvent("error",r({},f,{error:e,message:e.message}));this.state_===t.CONNECTING&&(this.state_=t.CLOSED),this.dispatchEvent(n)},t}(i.EventTarget);e.WebSocket=l,function(e){e.CONNECTING=0,e.OPEN=1,e.CLOSING=2,e.CLOSED=3}(l=e.WebSocket||(e.WebSocket={})),e.WebSocket=l;var f={bubbles:!1,cancelable:!1}}(oc)),oc).WebSocket);const el={number:Qu,bool:function(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)},bytes:Xu,hash:function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");Qu(e.outputLen),Qu(e.blockLen)},exists:function(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")},output:function(e,t){Xu(e);const n=t.outputLen;if(e.lengthe instanceof Uint8Array,nl=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),rl=(e,t)=>e<<32-t|e>>>t; -/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");const ol=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function il(e){if("string"==typeof e&&(e=function(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}(e)),!tl(e))throw new Error("expected Uint8Array, got "+typeof e);return e}class sl{clone(){return this._cloneInto()}}function al(e){const t=t=>e().update(il(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}class cl extends sl{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=nl(this.buffer)}update(e){el.exists(this);const{view:t,buffer:n,blockLen:r}=this,o=(e=il(e)).length;for(let i=0;ir-i&&(this.process(n,0),i=0);for(let e=i;e>o&i),a=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+u,a,r)}(n,r-8,BigInt(8*this.length),o),this.process(n,0);const s=nl(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;ee&t^e&n^t&n,ll=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]),fl=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),hl=new Uint32Array(64);class dl extends cl{constructor(){super(64,32,8,!1),this.A=0|fl[0],this.B=0|fl[1],this.C=0|fl[2],this.D=0|fl[3],this.E=0|fl[4],this.F=0|fl[5],this.G=0|fl[6],this.H=0|fl[7]}get(){const{A:e,B:t,C:n,D:r,E:o,F:i,G:s,H:a}=this;return[e,t,n,r,o,i,s,a]}set(e,t,n,r,o,i,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|a}process(e,t){for(let n=0;n<16;n++,t+=4)hl[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=hl[e-15],n=hl[e-2],r=rl(t,7)^rl(t,18)^t>>>3,o=rl(n,17)^rl(n,19)^n>>>10;hl[e]=o+hl[e-7]+r+hl[e-16]|0}let{A:n,B:r,C:o,D:i,E:s,F:a,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(rl(s,6)^rl(s,11)^rl(s,25))+((l=s)&a^~l&c)+ll[e]+hl[e]|0,f=(rl(n,2)^rl(n,13)^rl(n,22))+ul(n,r,o)|0;u=c,c=a,a=s,s=i+t|0,i=o,o=r,r=n,n=t+f|0}var l;n=n+this.A|0,r=r+this.B|0,o=o+this.C|0,i=i+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(n,r,o,i,s,a,c,u)}roundClean(){hl.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class pl extends dl{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 yl=al((()=>new dl));al((()=>new pl));const{bech32:gl,hex:bl,utf8:wl}=Or,vl={bech32:"bc",pubKeyHash:0,scriptHash:5,validWitnessVersions:[0]},ml={bech32:"tb",pubKeyHash:111,scriptHash:196,validWitnessVersions:[0]},_l={bech32:"bcrt",pubKeyHash:111,scriptHash:196,validWitnessVersions:[0]},xl={bech32:"sb",pubKeyHash:63,scriptHash:123,validWitnessVersions:[0]},El=["option_data_loss_protect","initial_routing_sync","option_upfront_shutdown_script","gossip_queries","var_onion_optin","gossip_queries_ex","option_static_remotekey","payment_secret","basic_mpp","option_support_large_channel"],kl={m:BigInt(1e3),u:BigInt(1e6),n:BigInt(1e9),p:BigInt(1e12)},Sl=BigInt("2100000000000000000"),Al=BigInt(1e11),Ol={payment_hash:1,payment_secret:16,description:13,payee:19,description_hash:23,expiry:6,min_final_cltv_expiry:24,fallback_address:9,route_hint:3,feature_bits:5,metadata:27},Cl={};for(let e=0,t=Object.keys(Ol);ebl.encode(gl.fromWordsUnsafe(e)),16:e=>bl.encode(gl.fromWordsUnsafe(e)),13:e=>wl.encode(gl.fromWordsUnsafe(e)),19:e=>bl.encode(gl.fromWordsUnsafe(e)),23:e=>bl.encode(gl.fromWordsUnsafe(e)),27:e=>bl.encode(gl.fromWordsUnsafe(e)),6:Tl,24:Tl,3:function(e){const t=[];let n,r,o,i,s,a=gl.fromWordsUnsafe(e);for(;a.length>0;)n=bl.encode(a.slice(0,33)),r=bl.encode(a.slice(33,41)),o=parseInt(bl.encode(a.slice(41,45)),16),i=parseInt(bl.encode(a.slice(45,49)),16),s=parseInt(bl.encode(a.slice(49,51)),16),a=a.slice(51),t.push({pubkey:n,short_channel_id:r,fee_base_msat:o,fee_proportional_millionths:i,cltv_expiry_delta:s});return t},5:function(e){const t=e.slice().reverse().map((e=>[!!(1&e),!!(2&e),!!(4&e),!!(8&e),!!(16&e)])).reduce(((e,t)=>e.concat(t)),[]);for(;t.length<2*El.length;)t.push(!1);const n={};El.forEach(((e,r)=>{let o;o=t[2*r]?"required":t[2*r+1]?"supported":"unsupported",n[e]=o}));const r=t.slice(2*El.length);return n.extra_bits={start_bit:2*El.length,bits:r,has_required:r.reduce(((e,t,n)=>n%2!=0?e||!1:e||t),!1)},n}};function Pl(e){return t=>({tagCode:parseInt(e),words:gl.encode("unknown",t,Number.MAX_SAFE_INTEGER)})}function Tl(e){return e.reverse().reduce(((e,t,n)=>e+t*Math.pow(32,n)),0)}function Ll(e,t){let n,r;if(e.slice(-1).match(/^[munp]$/))n=e.slice(-1),r=e.slice(0,-1);else{if(e.slice(-1).match(/^[^munp0-9]$/))throw new Error("Not a valid multiplier for the amount");r=e}if(!r.match(/^\d+$/))throw new Error("Not a valid human readable amount");const o=BigInt(r),i=n?o*Al/kl[n]:o*Al;if("p"===n&&o%BigInt(10)!==BigInt(0)||i>Sl)throw new Error("Amount is outside of valid range");return t?i.toString():i}var Bl={decode:function(e,t){if("string"!=typeof e)throw new Error("Lightning Payment Request must be string");if("ln"!==e.slice(0,2).toLowerCase())throw new Error("Not a proper lightning payment request");const n=[],r=gl.decode(e,Number.MAX_SAFE_INTEGER);e=e.toLowerCase();const o=r.prefix;let i=r.words,s=e.slice(o.length+1),a=i.slice(-104);i=i.slice(0,-104);let c=o.match(/^ln(\S+?)(\d*)([a-zA-Z]?)$/);if(c&&!c[2]&&(c=o.match(/^ln(\S+)$/)),!c)throw new Error("Not a proper lightning payment request");n.push({name:"lightning_network",letters:"ln"});const u=c[1];let l;if(t){if(void 0===t.bech32||void 0===t.pubKeyHash||void 0===t.scriptHash||!Array.isArray(t.validWitnessVersions))throw new Error("Invalid network");l=t}else switch(u){case vl.bech32:l=vl;break;case ml.bech32:l=ml;break;case _l.bech32:l=_l;break;case xl.bech32:l=xl}if(!l||l.bech32!==u)throw new Error("Unknown coin bech32 prefix");n.push({name:"coin_network",letters:u,value:l});const f=c[2];let h;if(f){h=Ll(f+c[3],!0),n.push({name:"amount",letters:c[2]+c[3],value:h})}else h=null;n.push({name:"separator",letters:"1"});const d=Tl(i.slice(0,7));let p,y,g,b;for(i=i.slice(7),n.push({name:"timestamp",letters:s.slice(0,7),value:d}),s=s.slice(7);i.length>0;){const e=i[0].toString();p=Cl[e]||"unknown_tag",y=Il[e]||Pl(e),i=i.slice(1),g=Tl(i.slice(0,2)),i=i.slice(2),b=i.slice(0,g),i=i.slice(g),n.push({name:p,tag:s[0],letters:s.slice(0,3+g),value:y(b)}),s=s.slice(3+g)}n.push({name:"signature",letters:s.slice(0,104),value:bl.encode(gl.fromWordsUnsafe(a))}),s=s.slice(104),n.push({name:"checksum",letters:s});let w={paymentRequest:e,sections:n,get expiry(){let e=n.find((e=>"expiry"===e.name));if(e)return v("timestamp")+e.value},get route_hints(){return n.filter((e=>"route_hint"===e.name)).map((e=>e.value))}};for(let e in Ol)"route_hint"!==e&&Object.defineProperty(w,e,{get:()=>v(e)});return w;function v(e){let t=n.find((t=>t.name===e));return t?t.value:void 0}},hrpToMillisat:Ll};var Rl=class extends na{ndk;zappedEvent;zappedUser;constructor(e){super(),this.ndk=e.ndk,this.zappedEvent=e.zappedEvent,this.zappedUser=e.zappedUser||this.ndk.getUser({hexpubkey:this.zappedEvent.pubkey})}async getZapEndpoint(){let e,t,n,r;if(this.zappedEvent){const n=(await this.zappedEvent.getMatchingTags("zap"))[0];if(n)switch(n[2]){case"lud06":e=n[1];break;case"lud16":t=n[1];break;default:throw new Error(`Unknown zap tag ${n}`)}}if(!this.zappedUser||e||t||(this.zappedUser.profile||await this.zappedUser.fetchProfile(),e=(this.zappedUser.profile||{}).lud06,t=(this.zappedUser.profile||{}).lud16),t){const[e,r]=t.split("@");n=`https://${r}/.well-known/lnurlp/${e}`}else if(e){const{words:t}=Ln.decode(e,1e3),r=Ln.fromWords(t);n=new TextDecoder("utf-8").decode(r)}if(!n)throw new Error("No zap endpoint found");const o=await fetch(n),i=await o.json();return i?.allowsNostr&&(i?.nostrPubkey||i?.nostrPubKey)&&(r=i.callback),r}async createZapRequest(e,t,n){const r=await this.getZapEndpoint();if(!r)throw new Error("No zap endpoint found");if(!this.zappedEvent)throw new Error("No zapped event found");const o=Qi.makeZapRequest({profile:this.zappedUser.hexpubkey(),event:null,amount:e,comment:t||"",relays:["wss://nos.lol","wss://relay.nostr.band","wss://relay.f7z.io","wss://relay.damus.io","wss://nostr.mom","wss://no.str.cr"]});if(this.zappedEvent){const e=this.zappedEvent.tagReference();e&&o.tags.push(e)}o.tags.push(["lnurl",r]);const i=new Dl(this.ndk,o);n&&(i.tags=i.tags.concat(n)),await i.sign();const s=await i.toNostrEvent(),a=await fetch(`${r}?`+new URLSearchParams({amount:e.toString(),nostr:JSON.stringify(s)}));return(await a.json()).pr}};function $l(){if(void 0===this.kind)throw new Error("Kind not set");return this.kind>=1e4&&this.kind<2e4}function jl(){if(void 0===this.kind)throw new Error("Kind not set");return this.kind>=3e4&&this.kind<4e4}async function Ul(){if(!this.ndk)throw new Error("NDK not set");const e=await this.ndk.fetchEvents({kinds:[3],authors:[this.hexpubkey()]});if(e){const t=new Set;return e.forEach((e=>{e.tags.forEach((e=>{if("p"===e[0])try{const n=ni.npubEncode(e[1]);t.add(n)}catch(e){}}))})),[...t].reduce(((e,t)=>{const n=new Nl({npub:t});return n.ndk=this.ndk,e.add(n),e}),new Set)}return new Set}var Nl=class{ndk;profile;npub="";relayUrls=[];constructor(e){e.npub&&(this.npub=e.npub),e.hexpubkey&&(this.npub=ni.npubEncode(e.hexpubkey)),e.relayUrls&&(this.relayUrls=e.relayUrls)}static async fromNip05(e){const t=await mi.queryProfile(e);if(t)return new Nl({hexpubkey:t.pubkey,relayUrls:t.relays})}hexpubkey(){return ni.decode(this.npub).data}async fetchProfile(e){if(!this.ndk)throw new Error("NDK not set");this.profile||(this.profile={});const t=await this.ndk.fetchEvents({kinds:[0],authors:[this.hexpubkey()]},e);if(t){Array.from(t).sort(((e,t)=>e.created_at-t.created_at)).forEach((e=>{try{this.profile=function(e,t){const n=JSON.parse(e.content);return Object.keys(n).forEach((e=>{switch(e){case"name":t.name=n.name;break;case"display_name":case"displayName":t.displayName=n.displayName||n.display_name;break;case"image":case"picture":t.image=n.image||n.picture;break;case"banner":t.banner=n.banner;break;case"bio":t.bio=n.bio;break;case"nip05":t.nip05=n.nip05;break;case"lud06":t.lud06=n.lud06;break;case"lud16":t.lud16=n.lud16;break;case"about":t.about=n.about;break;case"zapService":t.zapService=n.zapService;break;case"website":t.website=n.website;break;default:t[e]=n[e]}})),t}(e,this.profile)}catch(e){}}))}return t}follows=Ul.bind(this);async relayList(){if(!this.ndk)throw new Error("NDK not set");const e=await this.ndk.fetchEvents({kinds:[10002],authors:[this.hexpubkey()]});return e||new Set}tagReference(){return["p",this.hexpubkey()]}};async function Hl(e,t){if(!t){if(!this.ndk)throw new Error("No signer available");await this.ndk.assertSigner(),t=this.ndk.signer}if(!e){const t=this.getMatchingTags("p");if(1!==t.length)throw new Error("No recipient could be determined and no explicit recipient was provided");(e=new Nl({hexpubkey:t[0][1]})).ndk=this.ndk}this.content=await t.encrypt(e,this.content)}async function zl(e,t){if(!t){if(!this.ndk)throw new Error("No signer available");await this.ndk.assertSigner(),t=this.ndk.signer}e||(e=this.author),this.content=await t.decrypt(e,this.content)}function Ml(){return this.isParamReplaceable()?ni.naddrEncode({kind:this.kind,pubkey:this.pubkey,identifier:this.replaceableDTag()}):ni.noteEncode(this.tagId())}async function ql(e=!0,t){if(!t){if(!this.ndk)throw new Error("No NDK instance found");this.ndk.assertSigner(),t=this.ndk.signer}if(!t)throw new Error("No signer available");const n=await t.user(),r=new Dl(this.ndk,{kind:Fl(this),content:"",pubkey:n.hexpubkey()});return r.tag(this),16===r.kind&&r.tags.push(["k",`${this.kind}`]),await r.sign(t),e&&await r.publish(),r}function Fl(e){return 1===e.kind?6:16}var Dl=class extends na{ndk;created_at;content="";tags=[];kind;id="";sig;pubkey="";relay;constructor(e,t){super(),this.ndk=e,this.created_at=t?.created_at,this.content=t?.content||"",this.tags=t?.tags||[],this.id=t?.id||"",this.sig=t?.sig,this.pubkey=t?.pubkey||"",this.kind=t?.kind}rawEvent(){return{created_at:this.created_at,content:this.content,tags:this.tags,kind:this.kind,pubkey:this.pubkey,id:this.id,sig:this.sig}}set author(e){this.pubkey=e.hexpubkey()}get author(){const e=new Nl({hexpubkey:this.pubkey});return e.ndk=this.ndk,e}tag(e,t){const n=e.tagReference();if(t&&n.push(t),this.tags.push(n),e instanceof Dl){const t=e.author;t&&this.pubkey!==t.hexpubkey()&&this.tag(t);for(const t of e.getMatchingTags("p"))t[1]!==this.pubkey&&(this.tags.find((e=>"p"===e[0]&&e[1]===t[1]))||this.tags.push(["p",t[1]]))}}async toNostrEvent(e){if(!e&&""===this.pubkey){const e=await(this.ndk?.signer?.user());this.pubkey=e?.hexpubkey()||""}this.created_at||(this.created_at=Math.floor(Date.now()/1e3));const t=this.rawEvent(),{content:n,tags:r}=this.generateTags();t.content=n||"",t.tags=r;try{this.id=Mo(t)}catch(e){}return this.id&&(t.id=this.id),this.sig&&(t.sig=this.sig),t}isReplaceable=$l.bind(this);isParamReplaceable=jl.bind(this);encode=Ml.bind(this);encrypt=Hl.bind(this);decrypt=zl.bind(this);getMatchingTags(e){return this.tags.filter((t=>t[0]===e))}tagValue(e){const t=this.getMatchingTags(e);if(0!==t.length)return t[0][1]}removeTag(e){this.tags=this.tags.filter((t=>t[0]!==e))}async sign(e){e||this.ndk?.assertSigner(),await this.generateTags(),this.isReplaceable()&&(this.created_at=Math.floor(Date.now()/1e3));const t=await this.toNostrEvent(),n=e||this.ndk?.signer;this.sig=await n.sign(t)}async publish(e){return this.sig||await this.sign(),this.ndk?.publish(this,e)}generateTags(){let e=[];const t=function(e,t=[]){return{content:e=e.replace(/(@|nostr:)(npub|nprofile|note|nevent)[a-zA-Z0-9]+/g,(e=>{try{const n=e.split(/(@|nostr:)/)[2],{type:r,data:o}=ni.decode(n);let i;switch(r){case"npub":i=["p",o];break;case"nprofile":i=["p",o.pubkey];break;case"nevent":i=["e",o.id];break;case"note":i=["e",o];break;default:return e}return t.find((e=>e[0]===i[0]&&e[1]===i[1]))||t.push(i),`nostr:${n}`}catch(t){return e}})),tags:t}}(this.content,this.tags),n=t.content;if(e=t.tags,this.kind&&this.kind>=3e4&&this.kind<=4e4){if(!this.getMatchingTags("d")[0]){const t=[...Array(16)].map((()=>Math.random().toString(36)[2])).join("");e.push(["d",t])}}return{content:n||"",tags:e}}replaceableDTag(){if(this.kind&&this.kind>=3e4&&this.kind<=4e4){const e=this.getMatchingTags("d")[0];return e?e[1]:""}throw new Error("Event is not a parameterized replaceable event")}tagId(){if(this.kind&&this.kind>=3e4&&this.kind<=4e4){const e=this.replaceableDTag();return`${this.kind}:${this.pubkey}:${e}`}return this.id}tagReference(){return this.isParamReplaceable()?["a",this.tagId()]:["e",this.tagId()]}filter(){return this.isParamReplaceable()?{"#a":[this.tagId()]}:{"#e":[this.tagId()]}}async zap(e,t,n){if(!this.ndk)throw new Error("No NDK instance found");this.ndk.assertSigner();const r=new Rl({ndk:this.ndk,zappedEvent:this});return await r.createZapRequest(e,t,n)}async delete(e){if(!this.ndk)throw new Error("No NDK instance found");this.ndk.assertSigner();const t=new Dl(this.ndk,{kind:5,content:e||""});return t.tag(this),await t.publish(),t}repost=ql.bind(this)},Kl=class extends na{url;scores;relay;_status;connectedAt;_connectionStats={attempts:0,success:0,durations:[]};complaining=!1;debug;activeSubscriptions=new Set;constructor(e){super(),this.url=e,this.relay=ti(e),this.scores=new Map,this._status=3,this.debug=ea(`ndk:relay:${e}`),this.relay.on("connect",(()=>{this.updateConnectionStats.connected(),this.emit("connect"),this._status=1})),this.relay.on("disconnect",(()=>{this.updateConnectionStats.disconnected(),this.emit("disconnect"),1===this._status&&(this._status=3,this.handleReconnection())})),this.relay.on("notice",(e=>this.handleNotice(e)))}isFlapping(){const e=this._connectionStats.durations;if(e.length<10)return!1;const t=e.reduce(((e,t)=>e+t),0)/e.length,n=e.map((e=>Math.pow(e-t,2))).reduce(((e,t)=>e+t),0)/e.length;return Math.sqrt(n)<1e3}handleReconnection(){this.isFlapping()&&(this.emit("flapping",this,this._connectionStats),this._status=5),this.connectedAt&&Date.now()-this.connectedAt<5e3?setTimeout((()=>this.connect()),6e4):this.connect()}get status(){return this._status}async connect(){try{this.updateConnectionStats.attempt(),this._status=0,await this.relay.connect()}catch(e){throw this.debug("Failed to connect",e),this._status=3,e}}disconnect(){this._status=2,this.relay.close()}async handleNotice(e){(e.includes("oo many")||e.includes("aximum"))&&(this.disconnect(),setTimeout((()=>this.connect()),2e3),console.log(this.relay.url,"Relay complaining?",e)),this.emit("notice",this,e)}subscribe(e){const{filter:t}=e,n=this.relay.sub([t],{id:e.subId});this.debug(`Subscribed to ${JSON.stringify(t)}`),n.on("event",(t=>{const n=new Dl(void 0,t);n.relay=this,e.eventReceived(n,this)})),n.on("eose",(()=>{e.eoseReceived(this)}));const r=n.unsub;return n.unsub=()=>{this.debug(`Unsubscribing from ${JSON.stringify(t)}`),this.activeSubscriptions.delete(e),r()},this.activeSubscriptions.add(e),e.on("close",(()=>{this.activeSubscriptions.delete(e)})),n}async publish(e){const t=await e.toNostrEvent(),n=this.relay.publish(t);n.on("failed",(t=>{this.debug("Publish failed",t,e.rawEvent())})),n.on("ok",(()=>{this.debug("Publish ok",e.rawEvent())})),this.debug(`Published event ${e.id}`,e.rawEvent())}scoreSlowerEvent(e){}updateConnectionStats={connected:()=>{this._connectionStats.success++,this._connectionStats.connectedAt=Date.now()},disconnected:()=>{this._connectionStats.connectedAt&&(this._connectionStats.durations.push(Date.now()-this._connectionStats.connectedAt),this._connectionStats.durations.length>100&&this._connectionStats.durations.shift()),this._connectionStats.connectedAt=void 0},attempt:()=>{this._connectionStats.attempts++}};get connectionStats(){return this._connectionStats}},Gl=class extends na{relays=new Map;debug;constructor(e=[],t){super(),this.debug=t.debug.extend("pool");for(const t of e){const e=new Kl(t);e.on("notice",((e,t)=>this.emit("notice",e,t))),e.on("connect",(()=>this.handleRelayConnect(t))),e.on("disconnect",(()=>this.emit("relay:disconnect",e))),e.on("flapping",(()=>this.handleFlapping(e))),this.relays.set(t,e)}}handleRelayConnect(e){this.debug(`Relay ${e} connected`),this.emit("relay:connect",this.relays.get(e)),this.stats().connected===this.relays.size&&this.emit("connect")}async connect(e){const t=[];this.debug(`Connecting to ${this.relays.size} relays${e?`, timeout ${e}...`:""}`);for(const n of this.relays.values())if(e){const r=new Promise(((t,n)=>{setTimeout((()=>n(`Timed out after ${e}ms`)),e)}));t.push(Promise.race([n.connect(),r]).catch((e=>{this.debug(`Failed to connect to relay ${n.url}: ${e}`)})))}else t.push(n.connect());await Promise.all(t)}handleFlapping(e){this.debug(`Relay ${e.url} is flapping`),this.relays.delete(e.url),this.emit("flapping",e)}size(){return this.relays.size}stats(){const e={total:0,connected:0,disconnected:0,connecting:0};for(const t of this.relays.values())e.total++,1===t.status?e.connected++:3===t.status?e.disconnected++:0===t.status&&e.connecting++;return e}};var Wl={closeOnEose:!0,cacheUsage:"CACHE_FIRST",groupable:!0,groupableDelay:100},Vl=class extends na{subId;filter;opts;relaySet;ndk;relaySubscriptions;debug;eventFirstSeen=new Map;eosesSeen=new Set;eventsPerRelay=new Map;constructor(e,t,n,r,o){if(super(),this.ndk=e,this.opts={...Wl,...n||{}},this.subId=o||n?.subId||function(e){const t=Object.keys(e)||[],n=[];for(const r of t)if("kinds"===r){const t=[r,e.kinds.join(",")];n.push(t.join(":"))}else n.push(r);return n.push(Math.floor(999999999*Math.random()).toString()),n.join("-")}(t),this.filter=t,this.relaySet=r,this.relaySubscriptions=new Map,this.debug=e.debug.extend(`subscription:${this.subId}`),"ONLY_CACHE"===this.opts.cacheUsage&&!this.opts.closeOnEose)throw new Error("Cannot use cache-only options with a persistent subscription")}groupableId(){if(!this.opts?.groupable)return null;const e=(this.filter.kinds?.length||0)>0,t=!this.filter.since&&!this.filter.until,n=!this.filter.limit;if(e&&t&&n){let e=this.filter.kinds.join(",");return e+=`-${Object.keys(this.filter||{}).sort().join("-")}`,e}return null}shouldQueryCache(){return"ONLY_RELAY"!==this.opts?.cacheUsage}shouldQueryRelays(){return"ONLY_CACHE"!==this.opts?.cacheUsage}shouldWaitForCache(){return this.opts.closeOnEose&&!!this.ndk.cacheAdapter?.locking&&this.shouldQueryRelays()&&"PARALLEL"!==this.opts.cacheUsage}async start(){let e;if(this.shouldQueryCache()&&(e=this.startWithCache(),this.shouldWaitForCache()&&(await e,(t=this).filter.ids&&function(e){const t=e.filter.ids;return!!t&&t.length===e.eventFirstSeen.size}(t))))return this.debug("cache hit, fully filled: skipping relay query"),void this.emit("eose",this);var t;this.shouldQueryRelays()&&this.startWithRelaySet()}stop(){this.relaySubscriptions.forEach((e=>e.unsub())),this.relaySubscriptions.clear(),this.emit("close",this)}async startWithCache(){if(this.ndk.cacheAdapter?.query){const e=this.ndk.cacheAdapter.query(this);this.ndk.cacheAdapter.locking&&await e}}startWithRelaySet(){this.relaySet||(this.relaySet=function(e,t){const n=new Set;return e.pool?.relays.forEach((t=>{t.complaining?e.debug(`Relay ${t.url} is complaining, not adding to set`):n.add(t)})),new Zl(n,e)}(this.ndk,this.filter)),this.relaySet&&this.relaySet.subscribe(this)}eventReceived(e,t,n=!1){if(!n&&t){let n=this.eventsPerRelay.get(t);n||(n=new Set,this.eventsPerRelay.set(t,n)),n.add(e.id);if(this.eventFirstSeen.has(e.id)){const n=Date.now()-(this.eventFirstSeen.get(e.id)||0);return t.scoreSlowerEvent(n),void this.emit("event:dup",e,t,n,this)}this.ndk.cacheAdapter&&this.ndk.cacheAdapter.setEvent(e,this.filter),this.eventFirstSeen.set(`${e.id}`,Date.now())}else this.eventFirstSeen.set(`${e.id}`,0);this.emit("event",e,t,this)}eoseTimeout;eoseReceived(e){this.opts?.closeOnEose&&(this.relaySubscriptions.get(e)?.unsub(),this.relaySubscriptions.delete(e),0===this.relaySubscriptions.size&&this.emit("close",this)),this.eosesSeen.add(e);this.eosesSeen.size===this.relaySet?.size()?this.emit("eose"):(this.eoseTimeout&&clearTimeout(this.eoseTimeout),this.eoseTimeout=setTimeout((()=>{this.emit("eose")}),500))}},Yl=class extends Vl{subscriptions;constructor(e,t){const n=e.debug.extend("subscription-group");super(e,function(e){const t={};return e.forEach((e=>{Object.entries(e).forEach((([e,n])=>{Array.isArray(n)?void 0===t[e]?t[e]=[...n]:t[e]=Array.from(new Set([...t[e],...n])):t[e]=n}))})),t}(t.map((e=>e.filter))),t[0].opts,t[0].relaySet),this.subscriptions=t,n("merged filters",{count:t.length,mergedFilters:this.filter}),this.on("event",this.forwardEvent),this.on("event:dup",this.forwardEventDup),this.on("eose",this.forwardEose),this.on("close",this.forwardClose)}isEventForSubscription(e,t){const{filter:n}=t;return!!n&&Wo(n,e.rawEvent())}forwardEvent(e,t){for(const n of this.subscriptions)this.isEventForSubscription(e,n)&&n.emit("event",e,t,n)}forwardEventDup(e,t,n){for(const r of this.subscriptions)this.isEventForSubscription(e,r)&&r.emit("event:dup",e,t,n,r)}forwardEose(){for(const e of this.subscriptions)e.emit("eose",e)}forwardClose(){for(const e of this.subscriptions)e.emit("close",e)}};var Zl=class{relays;debug;ndk;constructor(e,t){this.relays=e,this.ndk=t,this.debug=t.debug.extend("relayset")}static fromRelayUrls(e,t){const n=new Set;for(const r of e){const e=t.pool.relays.get(r);e&&n.add(e)}return new Zl(new Set(n),t)}subscribeOnRelay(e,t){const n=e.subscribe(t);t.relaySubscriptions.set(e,n)}getId(){const e=Array.from(this.relays).map((e=>e.url)).sort().join(",");return function(e){if(!tl(e))throw new Error("Uint8Array expected");let t="";for(let n=0;n{this.executeDelayedSubscription(n)}),e.opts.groupableDelay),this.ndk.delayedSubscriptions.set(n,[e])),e}executeDelayedSubscription(e){const t=this.ndk.delayedSubscriptions.get(e);this.ndk.delayedSubscriptions.delete(e),t&&(t.length>1?this.executeSubscriptions(t):this.executeSubscription(t[0]))}executeSubscriptions(e){const t=e[0].ndk,n=new Yl(t,e);this.executeSubscription(n)}executeSubscription(e){this.debug("subscribing",{filter:e.filter});for(const t of this.relays)if(1===t.status)this.subscribeOnRelay(t,e);else{const n=()=>{this.debug("new relay coming online for active subscription",{relay:t.url,filter:e.filter}),this.subscribeOnRelay(t,e)};t.once("connect",n),e.once("close",(()=>{t.removeListener("connect",n)}))}return e}async publish(e){this.relays.forEach((async t=>{try{await t.publish(e)}catch(e){}}))}size(){return this.relays.size}};var Jl=class extends na{pool;signer;cacheAdapter;debug;devWriteRelaySet;delayedSubscriptions;constructor(e={}){super(),this.debug=e.debug||ea("ndk"),this.pool=new Gl(e.explicitRelayUrls||[],this),this.signer=e.signer,this.cacheAdapter=e.cacheAdapter,this.delayedSubscriptions=new Map,e.devWriteRelayUrls&&(this.devWriteRelaySet=Zl.fromRelayUrls(e.devWriteRelayUrls,this))}async connect(e){return this.debug("Connecting to relays",{timeoutMs:e}),this.pool.connect(e)}getUser(e){const t=new Nl(e);return t.ndk=this,t}subscribe(e,t,n,r=!0){const o=new Vl(this,e,t,n);return r&&o.start(),o}async publish(e,t){return t||(t=this.devWriteRelaySet||function(e,t){const n=new Set;return e.pool?.relays.forEach((e=>n.add(e))),new Zl(n,e)}(this)),t.publish(e)}async fetchEvent(e,t={},n){let r;if(r="string"==typeof e?function(e){let t;try{switch(t=ni.decode(e),t.type){case"nevent":return{ids:[t.data.id]};case"note":return{ids:[t.data]};case"naddr":return{authors:[t.data.pubkey],"#d":[t.data.identifier],kinds:[t.data.kind]}}}catch(e){}return{ids:[e]}}(e):e,!r)throw new Error(`Invalid filter: ${JSON.stringify(e)}`);return new Promise((e=>{const o=this.subscribe(r,{...t,closeOnEose:!0},n,!1);o.on("event",(t=>{t.ndk=this,e(t)})),o.on("eose",(()=>{e(null)})),o.start()}))}async fetchEvents(e,t={},n){return new Promise((r=>{const o=new Map,i=this.subscribe(e,{...t,closeOnEose:!0},n,!1);i.on("event",(e=>{const t=o.get(e.tagId());var n,r;t&&(r=e,e=(n=t).created_at>r.created_at?n:r),e.ndk=this,o.set(e.tagId(),e)})),i.on("eose",(()=>{r(new Set(o.values()))})),i.start()}))}async assertSigner(){if(!this.signer)throw this.emit("signerRequired"),new Error("Signer required")}};new ea("nostr:adapter");const Ql=new ea("nostr:adapter:profiles"),Xl=new ea("nostr:adapter:write");class ef{relayStatus={};#e=null;#t={};#n=new ds;#r={};tags;referenceTags;type;#o;chatId;relayUrls=[];#i=[];#s=[];#a;#c={};#u={};constructor(e,{tags:t,referenceTags:n,type:r="DM",chatId:o,websiteOwnerPubkey:i,relays:s}={}){this.pubkey=e,this.#o=i,this.relayUrls=s,r&&this.setChatConfiguration(r,t,n,o)}setChatConfiguration(e,t,n,r){this.type=e,this.tags=t,this.chatId=r,this.referenceTags=n,this.#e&&this.#l();let o=[];switch(this.type){case"DM":o.push({kinds:[4],"#p":[this.pubkey,this.#o],authors:[this.pubkey,this.#o]});break;case"GROUP":this.chatId&&o.push({kinds:[41,42],"#e":[this.chatId],limit:200});case"GLOBAL":this.tags&&this.tags.length>0&&o.push({kinds:[1],"#t":this.tags,limit:20}),this.referenceTags&&this.referenceTags.length>0&&o.push({kinds:[1],"#r":this.referenceTags,limit:20})}o&&o.length>0&&(this.#f(),this.subscribe(o,(e=>{this.#h(e)})))}async getPubKey(){return this.pubkey}on(e,t){this.#n.on(e,t)}async send(e,{tagPubKeys:t,tags:n}={}){let r;n||(n=[]),r="DM"===this.type?await this.sendKind4(e,{tagPubKeys:t,tags:n}):"GROUP"===this.type?await this.sendKind42(e,{tagPubKeys:t,tags:n,chatId:this.chatId}):await this.sendKind1(e,{tagPubKeys:t,tags:n}),r.id=Mo(r);const o=await this.signEvent(r);return this.#d(o),r.id}async sendKind4(e,{tagPubKeys:t,tags:n}={}){let r=await this.encrypt(this.#o,e);return{kind:4,pubkey:this.pubkey,created_at:Math.floor(Date.now()/1e3),content:r,tags:[["p",this.#o],...n]}}async sendKind42(e,{tagPubKeys:t,tags:n,chatId:r}={}){n||(n=[]),this.tags&&this.tags.forEach((e=>n.push(["t",e])));const o=!!n.find((e=>"e"===e[0]));o||n.push(["e",r,"wss://nos.lol",o?"reply":"root"]),this.referenceTags&&this.referenceTags.forEach((e=>n.push(["r",e])));let i={kind:42,created_at:Math.floor(Date.now()/1e3),tags:n,content:e,pubkey:this.pubkey};if(t)for(let e of t)e&&i.tags.push(["p",e]);return i.id=Mo(i),this.subscribeToEventAndResponses(i.id),i}async sendKind1(e,{tagPubKeys:t,tags:n}={}){n||(n=[]),this.tags&&this.tags.forEach((e=>n.push(["t",e]))),this.referenceTags&&this.referenceTags.forEach((e=>n.push(["r",e])));let r={kind:1,created_at:Math.floor(Date.now()/1e3),tags:n,content:e,pubkey:this.pubkey};if(t)for(let e of t)e&&r.tags.push(["p",e]);return r.id=Mo(r),this.subscribeToEventAndResponses(r.id),r}async#d(e){Xl("publish",e),this.#e.send(["EVENT",e])}async onEvent(e,t){this.#p(e.pubkey),t(e)}async delayedSubscribe(e,t,n){this.#c[t]=this.#c[t]||[],this.#c[t].push(e),this.#u[t]||(this.#u[t]=setTimeout((()=>{delete this.#u[t];let e=this.#c[t];delete this.#c[t];let n=[];n=e.reduce(((e,t,n)=>(n%10==0&&e.push([]),e[e.length-1].push(t),e)),n),n.forEach((e=>{this.subscribe(e,(e=>{this.#h(e)}))}))}),n))}async subscribe(e,t=null){return t||(t=e=>{this.#h(e)}),this.#y(e,t)}async#y(e,t){const n=ks();return this.#r[n]=t,Array.isArray(e)||(e=[e]),this.#e.subscribe(n,e),this.#e.on("event",((e,t,n)=>{this.onEvent(n,this.#r[t])})),n}async#h(e){if(this.#t[e.id])return;this.#t[e.id]=!0,4===e.kind&&(e.content=await this.decrypt(this.#o,e.content));let t,n=[];if(5===e.kind&&(n=e.tags.filter((e=>"e"===e[0])).map((e=>e[1]))),9735===e.kind){t=function(e){const t=e.getMatchingTags("description")[0],n=e.getMatchingTags("bolt11")[0];let r,o;if(!t||!n||!n[1])return null;try{let e=t[1];if(e.startsWith("%")&&(e=decodeURIComponent(e)),""===e)return null;o=JSON.parse(e),r=Bl.decode(n[1])}catch(e){return null}const i=r.sections.find((e=>"amount"===e.name));if(!i)return null;const s=parseInt(i.value);if(!s)return null;const a=o.content,c=o.pubkey,u=e.getMatchingTags("p")[0][1];let l=e.getMatchingTags("e")[0];l||(l=e.getMatchingTags("a")[0]);const f=l?l[1]:void 0;return{id:e.id,zapper:e.pubkey,zappee:c,zapped:u,zappedEvent:f,amount:s,comment:a}}(new Dl(null,e)),console.log(`received a zap invoice: ${t}`,e)}switch(e.kind){case 1:case 42:case 4:this.#n.emit("message",e);break;case 41:this.#n.emit("channelMetadata",e);break;case 5:this.#n.emit("deleted",n);break;case 7:this.#n.emit("reaction",e);break;case 9735:this.#n.emit("zap",t);break;default:console.log("unknown event kind",e.kind,e)}}subscribeToEventAndResponses(e){this.subscribe([{ids:[e]},{"#e":[e]}],(e=>{this.#h(e)}))}subscribeToResponses(e){this.subscribe([{"#e":[e.id]}],(e=>{this.#h(e),this.subscribeToResponses(e)}))}#f(){this.relayUrls.forEach((e=>{this.relayStatus[e]="disconnected"})),this.#n.emit("connectivity",this.relayStatus),this.#e=new fs(this.relayUrls),this.#e.on("open",(e=>{this.relayStatus[e.url]="connected",this.#n.emit("connectivity",this.relayStatus)})),this.#e.on("error",((e,t,n)=>{this.relayStatus[e.url]="error",this.#n.emit("connectivity",this.relayStatus),console.log("error from relay",e.url,t,n)})),this.#e.on("close",((e,t)=>{this.relayStatus[e.url]="closed",this.#n.emit("connectivity",this.relayStatus),console.log("error from relay",e.url,t)})),this.#e.on("notice",((e,t)=>{console.log("notice",e.url,t)}))}#l(){this.relayUrls.forEach((e=>{this.relayStatus[e]="disconnected"})),this.#n.emit("connectivity",this.relayStatus),this.#e.close(),this.#e=null}reqProfile(e){this.#p(e)}#p(e,t=null){this.#i.includes(e)||this.#s.includes(e)||(this.#i.push(e),this.#s.push(e),this.#a||(this.#a=setTimeout((()=>{this.#a=null,this.#g()}),500)))}async#g(){if(this.#i.length>0){Ql("requesting profiles",this.#i);const e=await this.subscribe({kinds:[0],authors:this.#i},(e=>{this.#b(e)}));Ql("subscribed to request",{subId:e}),this.#i=[],setTimeout((()=>{Ql("unsubscribing from request",{subId:e}),this.#e.unsubscribe(e)}),5e3)}}#b(e){let t;Ql("received profile",e);try{t=JSON.parse(e.content)}catch(t){return void Ql("failed to parse profile",e)}this.#n.emit("profile",{pubkey:e.pubkey,profile:t})}}class tf extends ef{constructor(e,t={}){super(e,t)}async signEvent(e){return await window.nostr.signEvent(e)}async encrypt(e,t){return await window.nostr.nip04.encrypt(e,t)}async decrypt(e,t){return await window.nostr.nip04.decrypt(e,t)}}function nf(){nf=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,o){var i=t&&t.prototype instanceof h?t:h,s=Object.create(i.prototype),a=new S(o||[]);return r(s,"_invoke",{value:_(e,n,a)}),s}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f={};function h(){}function d(){}function p(){}var y={};c(y,i,(function(){return this}));var g=Object.getPrototypeOf,b=g&&g(g(A([])));b&&b!==t&&n.call(b,i)&&(y=b);var w=p.prototype=h.prototype=Object.create(y);function v(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){function o(r,i,s,a){var c=l(e[r],e,i);if("throw"!==c.type){var u=c.arg,f=u.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){o("next",e,s,a)}),(function(e){o("throw",e,s,a)})):t.resolve(f).then((function(e){u.value=e,s(u)}),(function(e){return o("throw",e,s,a)}))}a(c.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){o(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return O()}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var a=x(s,n);if(a){if(a===f)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=l(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}function x(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),f;var o=l(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,f;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function A(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var a=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(a&&c){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;k(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:A(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},e}function rf(e,t,n,r,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,o)}function of(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function s(e){rf(i,r,o,s,a,"next",e)}function a(e){rf(i,r,o,s,a,"throw",e)}s(void 0)}))}}function sf(){return sf=Object.assign?Object.assign.bind():function(e){for(var t=1;t(Ephemeral Keys)',A(i,"class","bg-purple-800 hover:bg-purple-700 w-full p-4 rounded-xl text-center font-regular text-gray-200 svelte-bz3ser"),A(a,"class","bg-purple-800 hover:bg-purple-700 w-full p-4 rounded-xl text-center font-regular text-gray-200 svelte-bz3ser"),A(n,"class","flex flex-col gap-1 svelte-bz3ser")},m(e,r){b(e,n,r),l&&l.m(n,null),g(n,o),g(n,i),g(n,s),g(n,a),c||(u=[k(i,"click",S(t[4])),k(a,"click",S(t[3]))],c=!0)},p(e,t){},d(e){e&&w(n),l&&l.d(),c=!1,r(u)}}}function Of(t){let n,o,i,s,a,c,u;return{c(){n=m("p"),n.textContent="Scan this with your Nostr Connect (click to copy to clipboard)",o=x(),i=m("div"),i.innerHTML="",s=x(),a=m("button"),a.textContent="Cancel",A(n,"class","text-gray-600 mb-3 svelte-bz3ser"),A(i,"class","bg-white w-full p-3 svelte-bz3ser"),A(a,"class","bg-purple-800 hover:bg-purple-700 w-full p-2 rounded-xl text-center font-regular text-white svelte-bz3ser")},m(e,r){b(e,n,r),b(e,o,r),b(e,i,r),b(e,s,r),b(e,a,r),c||(u=[k(i,"click",S(t[5])),k(a,"click",S(t[9]))],c=!0)},p:e,d(e){e&&(w(n),w(o),w(i),w(s),w(a)),c=!1,r(u)}}}function Cf(t){let n,r,i,s,a,c,u,l,f;function h(e,t){return e[1]?Of:Af}let d=h(t),p=d&&d(t);return{c(){n=m("div"),r=m("h3"),r.textContent="How whould you like to connect?",i=x(),s=m("button"),s.innerHTML='',a=x(),c=m("div"),u=x(),p&&p.c(),A(r,"class","m-0 text-lg svelte-bz3ser"),A(s,"id","close-popup"),A(s,"class","bg-transparent border-none text-white cursor-pointer svelte-bz3ser"),A(n,"class","flex justify-between items-center p-4 bg-purple-700 text-white md:rounded-t-md svelte-bz3ser"),A(c,"class","flex-1 p-4 overflow-y-auto svelte-bz3ser")},m(e,h){b(e,n,h),g(n,r),g(n,i),g(n,s),b(e,a,h),b(e,c,h),g(c,u),p&&p.m(c,null),l||(f=k(s,"click",(function(){o(t[0])&&t[0].apply(this,arguments)})),l=!0)},p(e,[n]){d===(d=h(t=e))&&p?p.p(t,n):(p&&p.d(1),p=d&&d(t),p&&(p.c(),p.m(c,null)))},i:e,o:e,d(e){e&&(w(n),w(a),w(c)),p&&p.d(),l=!1,f()}}}function If(e,t,n){let r,o,{websiteOwnerPubkey:i}=t,{chatConfiguration:s}=t,{relays:a}=t,{toggleChat:c}=t;function u(){window.nostr.getPublicKey().then((e=>{localStorage.setItem("nostrichat-type","nip07"),se.set(new tf(e,o))}))}async function l(){let e=localStorage.getItem("nostrichat-nostr-connect-key"),t=localStorage.getItem("nostrichat-nostr-connect-public-key");if(e)return void se.set(new kf(t,e,o));e=To();const i=new Ef({secretKey:e,relay:"wss://nostr.vulpem.com"});let s,a,c;i.events.on("connect",(o=>{localStorage.setItem("nostrichat-nostr-connect-key",e),localStorage.setItem("nostrichat-nostr-connect-public-key",o),localStorage.setItem("nostrichat-type","nip-46"),console.log("connected to nostr connect relay"),t=o,se.set(new kf(t,e)),n(1,r=null)})),i.events.on("disconnect",(()=>{console.log("disconnected from nostr connect relay")})),await i.init();try{s=window.document.title||"Nostrichat",a=new URL(window.location.href),c=a.hostname}catch(e){a=window.location.href,c=a}const u=new xf({target:Lo(e),relay:"wss://nostr.vulpem.com",metadata:{name:s,description:"🔉🔉🔉",url:a}});n(1,r=u.toString())}T((()=>{const e=localStorage.getItem("nostrichat-type");"nip07"===e?u():"nip-46"===e&&l(),o={type:s.chatType,tags:s.chatTags,referenceTags:s.chatReferenceTags,websiteOwnerPubkey:i,relays:a}}));return e.$$set=e=>{"websiteOwnerPubkey"in e&&n(6,i=e.websiteOwnerPubkey),"chatConfiguration"in e&&n(7,s=e.chatConfiguration),"relays"in e&&n(8,a=e.relays),"toggleChat"in e&&n(0,c=e.toggleChat)},[c,r,u,async function(){se.set(new Sf(o))},l,function(){navigator.clipboard.writeText(r)},i,s,a,()=>{n(1,r=null)}]}class Pf extends re{constructor(e){super(),ne(this,e,If,Cf,i,{websiteOwnerPubkey:6,chatConfiguration:7,relays:8,toggleChat:0})}}var Tf,Lf={},Bf={},Rf={},$f=Rn&&Rn.__extends||(Tf=function(e,t){return Tf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Tf(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Tf(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});function jf(e,t,n){if(Object.setPrototypeOf(e,n.prototype),t===n)if(e.name=t.name,Error.captureStackTrace)Error.captureStackTrace(e,n);else{var r=new Error(e.message).stack;r&&(e.stack=function(e,t){if(!e)return e;if(!t)return e;var n=new RegExp("\\s+at\\s".concat(t,"\\s")),r=e.split("\n");return r.filter((function(e){return!e.match(n)})).join("\n")}(r,"new ".concat(t.name)))}}Object.defineProperty(Rf,"__esModule",{value:!0}),Rf.InternalError=Rf.InvalidDataError=Rf.RoutingError=Rf.UnsupportedMethodError=Rf.ConnectionError=Rf.RejectionError=Rf.MissingProviderError=void 0;var Uf=function(e){function t(n){var r=this.constructor,o=e.call(this,n)||this;return jf(o,r,t),o}return $f(t,e),t}(Error);Rf.MissingProviderError=Uf;var Nf=function(e){function t(n){var r=this.constructor,o=e.call(this,n)||this;return jf(o,r,t),o}return $f(t,e),t}(Error);Rf.RejectionError=Nf;var Hf=function(e){function t(n){var r=this.constructor,o=e.call(this,n)||this;return jf(o,r,t),o}return $f(t,e),t}(Error);Rf.ConnectionError=Hf;var zf=function(e){function t(n){var r=this.constructor,o=e.call(this,n)||this;return jf(o,r,t),o}return $f(t,e),t}(Error);Rf.UnsupportedMethodError=zf;var Mf=function(e){function t(n){var r=this.constructor,o=e.call(this,n)||this;return jf(o,r,t),o}return $f(t,e),t}(Error);Rf.RoutingError=Mf;var qf=function(e){function t(n){var r=this.constructor,o=e.call(this,n)||this;return jf(o,r,t),o}return $f(t,e),t}(Error);Rf.InvalidDataError=qf;var Ff=function(e){function t(n){var r=this.constructor,o=e.call(this,n)||this;return jf(o,r,t),o}return $f(t,e),t}(Error);Rf.InternalError=Ff,Object.defineProperty(Bf,"__esModule",{value:!0}),Bf.requestProvider=void 0;var Df=Rf;Bf.requestProvider=function(e){return new Promise((function(e,t){if("undefined"==typeof window)return t(new Error("Must be called in a browser context"));var n=window.webln;if(!n)return t(new Df.MissingProviderError("Your browser has no WebLN provider"));n.enable().then((function(){return e(n)})).catch((function(e){return t(e)}))}))};var Kf,Gf,Wf,Vf={};function Yf(e){let t,n,r=(e[2]||e[1])+"";return{c(){t=m("span"),n=_(r),A(t,"class","text-base text-white flex flex-col items-center")},m(e,r){b(e,t,r),g(t,n)},p(e,t){6&t&&r!==(r=(e[2]||e[1])+"")&&O(n,r)},d(e){e&&w(t)}}}function Zf(e){let t,n;return{c(){t=m("span"),n=_(e[0]),A(t,"class","text-xl")},m(e,r){b(e,t,r),g(t,n)},p(e,t){1&t&&O(n,e[0])},d(e){e&&w(t)}}}function Jf(t){let n,o,i;function s(e,t){return e[3]?Yf:Zf}let a=s(t),c=a(t);return{c(){n=m("div"),c.c()},m(e,r){b(e,n,r),c.m(n,null),o||(i=[k(n,"mouseenter",t[7]),k(n,"mouseleave",t[8]),k(n,"click",S(t[4]))],o=!0)},p(e,[t]){a===(a=s(e))&&c?c.p(e,t):(c.d(1),c=a(e),c&&(c.c(),c.m(n,null)))},i:e,o:e,d(e){e&&w(n),c.d(),o=!1,r(i)}}}function Qf(e,t,n){let r;c(e,ue,(e=>n(9,r=e)));let{icon:o,amount:i,amountDisplay:s,event:a,mobilePR:l}=t,f=!1;return e.$$set=e=>{"icon"in e&&n(0,o=e.icon),"amount"in e&&n(1,i=e.amount),"amountDisplay"in e&&n(2,s=e.amountDisplay),"event"in e&&n(6,a=e.event),"mobilePR"in e&&n(5,l=e.mobilePR)},[o,i,s,f,async function(){const e=new class{_userPromise;nip04Queue=[];nip04Processing=!1;debug;constructor(){if(!window.nostr)throw new Error("NIP-07 extension not available");this.debug=ea("ndk:nip07")}async blockUntilReady(){const e=await(window.nostr?.getPublicKey());if(!e)throw new Error("User rejected access");return new Nl({hexpubkey:e})}async user(){return this._userPromise||(this._userPromise=this.blockUntilReady()),this._userPromise}async sign(e){if(!window.nostr)throw new Error("NIP-07 extension not available");return(await window.nostr.signEvent(e)).sig}async encrypt(e,t){if(!window.nostr)throw new Error("NIP-07 extension not available");const n=e.hexpubkey();return this.queueNip04("encrypt",n,t)}async decrypt(e,t){if(!window.nostr)throw new Error("NIP-07 extension not available");const n=e.hexpubkey();return this.queueNip04("decrypt",n,t)}async queueNip04(e,t,n){return new Promise(((r,o)=>{this.nip04Queue.push({type:e,counterpartyHexpubkey:t,value:n,resolve:r,reject:o}),this.nip04Processing||this.processNip04Queue()}))}async processNip04Queue(e,t=0){if(!e&&0===this.nip04Queue.length)return void(this.nip04Processing=!1);this.nip04Processing=!0;const{type:n,counterpartyHexpubkey:r,value:o,resolve:i,reject:s}=e||this.nip04Queue.shift();this.debug("Processing encryption queue item",{type:n,counterpartyHexpubkey:r,value:o});try{let e;e="encrypt"===n?await window.nostr.nip04.encrypt(r,o):await window.nostr.nip04.decrypt(r,o),i(e)}catch(i){if(i.message&&i.message.includes("call already executing")&&t<5)return this.debug("Retrying encryption queue item",{type:n,counterpartyHexpubkey:r,value:o,retries:t}),void setTimeout((()=>{this.processNip04Queue(e,t+1)}),50*t);s(i)}this.processNip04Queue()}},t=new Jl({explicitRelayUrls:["wss://nos.lol","wss://relay.nostr.band","wss://relay.damus.io","wss://nostr.mom","wss://no.str.cr"]});let o,s;t.signer=e,await t.connect();try{const e=new Dl(t,a);o=await e.zap(1e3*i)}catch(e){return void alert(e)}try{s=await Lf.requestProvider()}catch(e){return void n(5,l=o)}try{await s.sendPayment(o),u(ue,r=null,r)}catch(e){n(5,l=o)}},l,a,()=>n(3,f=!0),()=>n(3,f=!1)]}Object.defineProperty(Vf,"__esModule",{value:!0}),Kf=Lf,Gf=Rn&&Rn.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),Wf=Rn&&Rn.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||Gf(t,e,n)},Object.defineProperty(Kf,"__esModule",{value:!0}),Wf(Bf,Kf),Wf(Vf,Kf),Wf(Rf,Kf);class Xf extends re{constructor(e){super(),ne(this,e,Qf,Jf,i,{icon:0,amount:1,amountDisplay:2,event:6,mobilePR:5})}}function eh(e,t,n){const r=e.slice();return r[32]=t[n],r}function th(t){let n;return{c(){n=_("⚡️")},m(e,t){b(e,n,t)},p:e,d(e){e&&w(n)}}}function nh(e){let t,n,r,o,i=e[9]/1e3+"";return{c(){t=m("p"),n=_("⚡️\n "),r=m("span"),o=_(i),A(r,"class","text-orange-500 font-semibold svelte-bz3ser"),A(t,"class","flex flex-col items-center my-4 svelte-bz3ser")},m(e,i){b(e,t,i),g(t,n),g(t,r),g(r,o)},p(e,t){512&t[0]&&i!==(i=e[9]/1e3+"")&&O(o,i)},d(e){e&&w(t)}}}function rh(e){let t,n,r,o;const i=[ih,oh],s=[];function a(e,t){return e[8]?0:1}return t=a(e),n=s[t]=i[t](e),{c(){n.c(),r=E()},m(e,n){s[t].m(e,n),b(e,r,n),o=!0},p(e,o){let c=t;t=a(e),t===c?s[t].p(e,o):(G(),Y(s[c],1,1,(()=>{s[c]=null})),W(),n=s[t],n?n.p(e,o):(n=s[t]=i[t](e),n.c()),V(n,1),n.m(r.parentNode,r))},i(e){o||(V(n),o=!0)},o(e){Y(n),o=!1},d(e){e&&w(r),s[t].d(e)}}}function oh(e){let t,n,r,o,i,s,a,c,u,l,f,h,d,p,y,v,_,E,k,S,O,C,I,P,T;function L(t){e[20](t)}let R={icon:"👍",amount:500,event:e[0]};function $(t){e[21](t)}void 0!==e[8]&&(R.mobilePR=e[8]),r=new Xf({props:R}),B.push((()=>J(r,"mobilePR",L)));let j={icon:"🤙",amount:2500,amountDisplay:"2.5k",event:e[0]};function U(t){e[22](t)}void 0!==e[8]&&(j.mobilePR=e[8]),a=new Xf({props:j}),B.push((()=>J(a,"mobilePR",$)));let N={icon:"🙌",amount:5e3,amountDisplay:"5k",event:e[0]};function z(t){e[23](t)}void 0!==e[8]&&(N.mobilePR=e[8]),f=new Xf({props:N}),B.push((()=>J(f,"mobilePR",U)));let M={icon:"🧡",amount:1e4,amountDisplay:"10k",event:e[0]};function q(t){e[24](t)}void 0!==e[8]&&(M.mobilePR=e[8]),y=new Xf({props:M}),B.push((()=>J(y,"mobilePR",z)));let F={icon:"🤯",amount:1e5,amountDisplay:"100k",event:e[0]};function D(t){e[25](t)}void 0!==e[8]&&(F.mobilePR=e[8]),k=new Xf({props:F}),B.push((()=>J(k,"mobilePR",q)));let K={icon:"😎",amount:1e6,amountDisplay:"1M",event:e[0]};return void 0!==e[8]&&(K.mobilePR=e[8]),I=new Xf({props:K}),B.push((()=>J(I,"mobilePR",D))),{c(){t=m("div"),n=m("div"),Q(r.$$.fragment),i=x(),s=m("div"),Q(a.$$.fragment),u=x(),l=m("div"),Q(f.$$.fragment),d=x(),p=m("div"),Q(y.$$.fragment),_=x(),E=m("div"),Q(k.$$.fragment),O=x(),C=m("div"),Q(I.$$.fragment),A(n,"class","flex flex-col hover:bg-orange-500 text-white rounded-full w-12 h-12 items-center justify-center cursor-pointer svelte-bz3ser"),A(s,"class","flex flex-col hover:bg-orange-500 text-white rounded-full w-12 h-12 items-center justify-center cursor-pointer svelte-bz3ser"),A(l,"class","flex flex-col hover:bg-orange-500 text-white rounded-full w-12 h-12 items-center justify-center cursor-pointer svelte-bz3ser"),A(p,"class","flex flex-col hover:bg-orange-500 text-white rounded-full w-12 h-12 items-center justify-center cursor-pointer svelte-bz3ser"),A(E,"class","flex flex-col hover:bg-orange-500 text-white rounded-full w-12 h-12 items-center justify-center cursor-pointer svelte-bz3ser"),A(C,"class","flex flex-col hover:bg-orange-500 text-white rounded-full w-12 h-12 items-center justify-center cursor-pointer svelte-bz3ser"),A(t,"class","flex flex-row items-stretch justify-between w-full svelte-bz3ser")},m(e,o){b(e,t,o),g(t,n),X(r,n,null),g(t,i),g(t,s),X(a,s,null),g(t,u),g(t,l),X(f,l,null),g(t,d),g(t,p),X(y,p,null),g(t,_),g(t,E),X(k,E,null),g(t,O),g(t,C),X(I,C,null),T=!0},p(e,t){const n={};1&t[0]&&(n.event=e[0]),!o&&256&t[0]&&(o=!0,n.mobilePR=e[8],H((()=>o=!1))),r.$set(n);const i={};1&t[0]&&(i.event=e[0]),!c&&256&t[0]&&(c=!0,i.mobilePR=e[8],H((()=>c=!1))),a.$set(i);const s={};1&t[0]&&(s.event=e[0]),!h&&256&t[0]&&(h=!0,s.mobilePR=e[8],H((()=>h=!1))),f.$set(s);const u={};1&t[0]&&(u.event=e[0]),!v&&256&t[0]&&(v=!0,u.mobilePR=e[8],H((()=>v=!1))),y.$set(u);const l={};1&t[0]&&(l.event=e[0]),!S&&256&t[0]&&(S=!0,l.mobilePR=e[8],H((()=>S=!1))),k.$set(l);const d={};1&t[0]&&(d.event=e[0]),!P&&256&t[0]&&(P=!0,d.mobilePR=e[8],H((()=>P=!1))),I.$set(d)},i(e){T||(V(r.$$.fragment,e),V(a.$$.fragment,e),V(f.$$.fragment,e),V(y.$$.fragment,e),V(k.$$.fragment,e),V(I.$$.fragment,e),T=!0)},o(e){Y(r.$$.fragment,e),Y(a.$$.fragment,e),Y(f.$$.fragment,e),Y(y.$$.fragment,e),Y(k.$$.fragment,e),Y(I.$$.fragment,e),T=!1},d(e){e&&w(t),ee(r),ee(a),ee(f),ee(y),ee(k),ee(I)}}}function ih(t){let n,r,o,i,s,a,c,u;return{c(){n=m("div"),r=m("a"),o=_("Open in wallet"),s=x(),a=m("button"),a.textContent="Cancel",A(r,"href",i=`lightning:${t[8]}`),A(r,"class","text-center w-full p-3 bg-black text-white rounded-t-xl svelte-bz3ser"),A(a,"class","bg-white rounder-b-xl p-3 svelte-bz3ser"),A(n,"class","flex flex-col gap-3 w-full svelte-bz3ser")},m(e,i){b(e,n,i),g(n,r),g(r,o),g(n,s),g(n,a),c||(u=k(a,"click",t[19]),c=!0)},p(e,t){256&t[0]&&i!==(i=`lightning:${e[8]}`)&&A(r,"href",i)},i:e,o:e,d(e){e&&w(n),c=!1,u()}}}function sh(e){let t,n;return{c(){t=m("div"),n=_(e[10]),A(t,"class","text-xs text-gray-400 svelte-bz3ser")},m(e,r){b(e,t,r),g(t,n)},p(e,t){1024&t[0]&&O(n,e[10])},d(e){e&&w(t)}}}function ah(t){let n;return{c(){n=m("div"),n.textContent="Website owner",A(n,"class","text-purple-500 text-xs svelte-bz3ser")},m(e,t){b(e,n,t)},p:e,d(e){e&&w(n)}}}function ch(e){let t,n,r=Z(e[1][e[0].id]),o=[];for(let t=0;tY(o[e],1,1,(()=>{o[e]=null}));return{c(){t=m("div");for(let e=0;e0?nh:th}let Z=K(e),J=Z(e),Q=e[6]&&rh(e);let X=function(e,t){return e[13]?ah:sh}(e),ee=X(e),te=e[1][e[0].id].length>0&&ch(e);return{c(){t=m("div"),n=m("div"),o=m("div"),i=m("a"),s=m("img"),l=x(),f=m("button"),J.c(),d=x(),p=m("div"),Q&&Q.c(),v=x(),C=m("div"),I=m("div"),P=x(),T=m("div"),L=_(D),R=x(),$=m("div"),j=m("div"),U=m("span"),U.textContent=`${e[14].toLocaleString()}`,N=x(),ee.c(),H=x(),te&&te.c(),z=E(),a(s.src,c=e[4])||A(s,"src",c),A(s,"class","block w-8 h-8 rounded-full "+(e[13]?"ring-purple-700 ring-4":"")+" svelte-bz3ser"),A(s,"alt",""),A(i,"href",u=`nostr:${e[5]}`),A(i,"class","svelte-bz3ser"),A(f,"class",h="rounded-full "+(e[9]>0?"opacity-100 text-base":"bg-orange-500 opacity-10 text-xl")+" w-8 h-8 flex items-center justify-center hover:opacity-100 svelte-bz3ser"),A(p,"class",y=(e[6]?"w-full rounded-full bg-white drop-shadow-xl justify-between border-2 border-gray-200":" rounded-full w-8 h-8 justify-center")+" flex items-center absolute ml-5 mt-10 z-10 svelte-bz3ser"),A(o,"class","min-w-fit flex flex-col gap-2 svelte-bz3ser"),A(I,"class","flex flex-row justify-between text-center overflow-clip text-clip w-full svelte-bz3ser"),A(T,"class",B="max-h-64 text-base cursor-pointer border border-slate-200 "+(e[11]===e[0].id?"bg-purple-700 text-white":"bg-white text-gray-900 hover:bg-slate-100")+" p-4 py-2 overflow-auto rounded-2xl shadow-sm svelte-bz3ser"),A(U,"class","py-2 svelte-bz3ser"),A(j,"class","text-xs text-gray-400 text-ellipsis overflow-clip whitespace-nowrap svelte-bz3ser"),A($,"class","flex flex-row-reverse justify-between mt-1 overflow-clip items-center relative svelte-bz3ser"),A(C,"class","w-full overflow-hidden svelte-bz3ser"),A(n,"class","flex flex-row gap-3 svelte-bz3ser"),A(t,"class","flex flex-col gap-4 p-2-lg mb-3 text-wrap relative svelte-bz3ser")},m(r,a){b(r,t,a),g(t,n),g(n,o),g(o,i),g(i,s),g(o,l),g(o,f),J.m(f,null),g(o,d),g(o,p),Q&&Q.m(p,null),g(n,v),g(n,C),g(C,I),g(C,P),g(C,T),g(T,L),g(C,R),g(C,$),g($,j),g(j,U),g($,N),ee.m($,null),b(r,H,a),te&&te.m(r,a),b(r,z,a),M=!0,q||(F=[k(f,"click",S(e[18])),k(T,"click",S(e[26])),k(T,"keydown",S(e[27])),k(T,"keyup",S(e[28])),k(t,"mouseenter",e[29]),k(t,"mouseleave",e[30])],q=!0)},p(e,t){(!M||16&t[0]&&!a(s.src,c=e[4]))&&A(s,"src",c),(!M||32&t[0]&&u!==(u=`nostr:${e[5]}`))&&A(i,"href",u),Z===(Z=K(e))&&J?J.p(e,t):(J.d(1),J=Z(e),J&&(J.c(),J.m(f,null))),(!M||512&t[0]&&h!==(h="rounded-full "+(e[9]>0?"opacity-100 text-base":"bg-orange-500 opacity-10 text-xl")+" w-8 h-8 flex items-center justify-center hover:opacity-100 svelte-bz3ser"))&&A(f,"class",h),e[6]?Q?(Q.p(e,t),64&t[0]&&V(Q,1)):(Q=rh(e),Q.c(),V(Q,1),Q.m(p,null)):Q&&(G(),Y(Q,1,1,(()=>{Q=null})),W()),(!M||64&t[0]&&y!==(y=(e[6]?"w-full rounded-full bg-white drop-shadow-xl justify-between border-2 border-gray-200":" rounded-full w-8 h-8 justify-center")+" flex items-center absolute ml-5 mt-10 z-10 svelte-bz3ser"))&&A(p,"class",y),(!M||1&t[0])&&D!==(D=e[0].content+"")&&O(L,D),(!M||2049&t[0]&&B!==(B="max-h-64 text-base cursor-pointer border border-slate-200 "+(e[11]===e[0].id?"bg-purple-700 text-white":"bg-white text-gray-900 hover:bg-slate-100")+" p-4 py-2 overflow-auto rounded-2xl shadow-sm svelte-bz3ser"))&&A(T,"class",B),ee.p(e,t),e[1][e[0].id].length>0?te?(te.p(e,t),3&t[0]&&V(te,1)):(te=ch(e),te.c(),V(te,1),te.m(z.parentNode,z)):te&&(G(),Y(te,1,1,(()=>{te=null})),W())},i(e){M||(V(Q),V(te),M=!0)},o(e){Y(Q),Y(te),M=!1},d(e){e&&(w(t),w(H),w(z)),J.d(),Q&&Q.d(),ee.d(),te&&te.d(e),q=!1,r(F)}}}function fh(e,t,n){let r,o,i,s,a,l;c(e,le,(e=>n(16,o=e))),c(e,se,(e=>n(31,i=e))),c(e,ue,(e=>n(3,s=e))),c(e,ae,(e=>n(17,a=e))),c(e,ce,(e=>n(11,l=e)));let f,h,d,p,y,{event:g}=t,{responses:b}=t,{websiteOwnerPubkey:w}=t,v={},m=0;function _(){l===g.id?u(ce,l=null,l):u(ce,l=g.id,l)}T((()=>{i.delayedSubscribe({kinds:[1,42,9735],"#e":[g.id]},"responses",500)}));const x=!!w===g.pubkey;var E;i.on("zap",(()=>{n(9,m=o[g.id]?.reduce(((e,t)=>e+t.amount),0)||0)})),E=()=>{n(9,m=o[g.id]?.reduce(((e,t)=>e+t.amount),0)||0)},P().$$.after_update.push(E);let k=new Date(1e3*g.created_at);return e.$$set=e=>{"event"in e&&n(0,g=e.event),"responses"in e&&n(1,b=e.responses),"websiteOwnerPubkey"in e&&n(2,w=e.websiteOwnerPubkey)},e.$$.update=()=>{if(131072&e.$$.dirty[0]&&n(15,v=a.profiles),32769&e.$$.dirty[0]&&n(10,r=v[g.pubkey]&&v[g.pubkey].display_name||`[${g.pubkey.slice(0,6)}]`),9&e.$$.dirty[0]&&n(6,d=s===g.id),1&e.$$.dirty[0])try{n(5,h=ni.npubEncode(g.pubkey))}catch(e){n(5,h=g.pubkey)}65537&e.$$.dirty[0]&&n(9,m=o[g.id]?.reduce(((e,t)=>e+t.amount),0)||0),32769&e.$$.dirty[0]&&n(4,f=v[g.pubkey]&&v[g.pubkey].picture||`https://robohash.org/${g.pubkey.slice(0,1)}.png?set=set1`)},[g,b,w,s,f,h,d,p,y,m,r,l,_,x,k,v,o,a,()=>u(ue,s=s===g.id?null:g.id,s),()=>{u(ue,s=null,s)},function(e){y=e,n(8,y)},function(e){y=e,n(8,y)},function(e){y=e,n(8,y)},function(e){y=e,n(8,y)},function(e){y=e,n(8,y)},function(e){y=e,n(8,y)},()=>{_(g.id)},()=>{_(g.id)},()=>{_(g.id)},()=>n(7,p=!0),()=>n(7,p=!1)]}class hh extends re{constructor(e){super(),ne(this,e,fh,lh,i,{event:0,responses:1,websiteOwnerPubkey:2},null,[-1,-1])}}var dh={$:e=>"string"==typeof e?document.querySelector(e):e,extend:(...e)=>Object.assign(...e),cumulativeOffset(e){let t=0,n=0;do{t+=e.offsetTop||0,n+=e.offsetLeft||0,e=e.offsetParent}while(e);return{top:t,left:n}},directScroll:e=>e&&e!==document&&e!==document.body,scrollTop(e,t){let n=void 0!==t;return this.directScroll(e)?n?e.scrollTop=t:e.scrollTop:n?document.documentElement.scrollTop=document.body.scrollTop=t:window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},scrollLeft(e,t){let n=void 0!==t;return this.directScroll(e)?n?e.scrollLeft=t:e.scrollLeft:n?document.documentElement.scrollLeft=document.body.scrollLeft=t:window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0}};const ph={container:"body",duration:500,delay:0,offset:0,easing:function(e){return e<.5?4*e*e*e:.5*Math.pow(2*e-2,3)+1},onStart:e,onDone:e,onAborting:e,scrollX:!1,scrollY:!0},yh=e=>{let{offset:t,duration:n,delay:r,easing:o,x:i=0,y:s=0,scrollX:a,scrollY:c,onStart:u,onDone:l,container:y,onAborting:g,element:b}=e;"function"==typeof t&&(t=t());var w=dh.cumulativeOffset(y),v=b?dh.cumulativeOffset(b):{top:s,left:i},m=dh.scrollLeft(y),_=dh.scrollTop(y),x=v.left-w.left+t,E=v.top-w.top+t,k=x-m,S=E-_;let A=!0,O=!1,C=f()+r,I=C+n;function P(e){e||(O=!0,u(b,{x:i,y:s}))}function T(e){!function(e,t,n){a&&dh.scrollLeft(e,n),c&&dh.scrollTop(e,t)}(y,_+S*e,m+k*e)}function L(){A=!1}return function(e){let t;0===d.size&&h(p),new Promise((n=>{d.add(t={c:e,f:n})}))}((e=>{if(!O&&e>=C&&P(!1),O&&e>=I&&(T(1),L(),l(b,{x:i,y:s})),!A)return g(b,{x:i,y:s}),!1;if(O){T(0+1*o((e-C)/n))}return!0})),P(r),T(0),L},gh=e=>{if(e&&e!==document&&e!==document.body)return e.scrollHeight-e.offsetHeight;{let e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)}},bh=e=>(e=(e=>{let t=dh.extend({},ph,e);return t.container=dh.$(t.container),t.element=dh.$(t.element),t})(e),yh(dh.extend(e,{element:null,y:gh(e.container)})));function wh(e,t,n){const r=e.slice();return r[28]=t[n],r}function vh(e,t,n){const r=e.slice();return r[31]=t[n],r[33]=n,r}function mh(e){let t;return{c(){t=_(e[9])},m(e,n){b(e,t,n)},p(e,n){512&n[0]&&O(t,e[9])},d(e){e&&w(t)}}}function _h(e){let t,n;return{c(){t=m("span"),A(t,"class",n="inline-block rounded-full "+(e[7]>e[33]?"bg-green-500":"bg-gray-300")+" w-2 h-2 svelte-bz3ser")},m(e,n){b(e,t,n)},p(e,r){128&r[0]&&n!==(n="inline-block rounded-full "+(e[7]>e[33]?"bg-green-500":"bg-gray-300")+" w-2 h-2 svelte-bz3ser")&&A(t,"class",n)},d(e){e&&w(t)}}}function xh(e){let t,n,r,o,i,s,a=e[6].name+"",c=e[6].picture&&Eh(e),u=e[6].about&&kh(e);return{c(){t=m("div"),c&&c.c(),n=x(),r=m("div"),o=m("div"),i=_(a),s=x(),u&&u.c(),A(o,"class","font-extrabold text-xl svelte-bz3ser"),A(r,"class","flex flex-col svelte-bz3ser"),A(t,"class","flex items-center p-4 bg-zinc-300 svelte-bz3ser")},m(e,a){b(e,t,a),c&&c.m(t,null),g(t,n),g(t,r),g(r,o),g(o,i),g(r,s),u&&u.m(r,null)},p(e,o){e[6].picture?c?c.p(e,o):(c=Eh(e),c.c(),c.m(t,n)):c&&(c.d(1),c=null),64&o[0]&&a!==(a=e[6].name+"")&&O(i,a),e[6].about?u?u.p(e,o):(u=kh(e),u.c(),u.m(r,null)):u&&(u.d(1),u=null)},d(e){e&&w(t),c&&c.d(),u&&u.d()}}}function Eh(e){let t,n;return{c(){t=m("img"),a(t.src,n=e[6].picture)||A(t,"src",n),A(t,"class","w-12 h-12 rounded-full mr-2 svelte-bz3ser")},m(e,n){b(e,t,n)},p(e,r){64&r[0]&&!a(t.src,n=e[6].picture)&&A(t,"src",n)},d(e){e&&w(t)}}}function kh(e){let t,n,r=e[6].about+"";return{c(){t=m("div"),n=_(r),A(t,"class","text-sm truncate font-regular svelte-bz3ser")},m(e,r){b(e,t,r),g(t,n)},p(e,t){64&t[0]&&r!==(r=e[6].about+"")&&O(n,r)},d(e){e&&w(t)}}}function Sh(e){let t,n;function r(e,n){return 1024&n[0]&&(t=null),null==t&&(t=!e[11](e[10])),t?Oh:Ah}let o=r(e,[-1,-1]),i=o(e);return{c(){i.c(),n=E()},m(e,t){i.m(e,t),b(e,n,t)},p(e,t){o===(o=r(e,t))&&i?i.p(e,t):(i.d(1),i=o(e),i&&(i.c(),i.m(n.parentNode,n)))},d(e){e&&w(n),i.d(e)}}}function Ah(t){let n,r,o,i,s;return{c(){n=m("div"),r=m("div"),o=m("button"),o.innerHTML='',A(o,"class","svelte-bz3ser"),A(r,"class","flex flex-col ml-2 svelte-bz3ser"),A(n,"class","hidden md:flex flex-row px-2 py-4 mb-3 overflow-x-hidden svelte-bz3ser")},m(e,a){b(e,n,a),g(n,r),g(r,o),i||(s=k(o,"click",S(t[14])),i=!0)},p:e,d(e){e&&w(n),i=!1,s()}}}function Oh(e){let t,n,r;return{c(){t=m("h1"),n=_("Couldn't find event with ID "),r=_(e[10]),A(t,"class","svelte-bz3ser")},m(e,o){b(e,t,o),g(t,n),g(t,r)},p(e,t){1024&t[0]&&O(r,e[10])},d(e){e&&w(t)}}}function Ch(e){let t,n,r=Z(e[4]),o=[];for(let t=0;tY(o[e],1,1,(()=>{o[e]=null}));return{c(){for(let e=0;e',r=x(),Q(o.$$.fragment),A(n,"class"," svelte-bz3ser"),A(t,"class","md:hidden px-2 py-4 mb-3 svelte-bz3ser")},m(c,u){b(c,t,u),g(t,n),b(c,r,u),X(o,c,u),i=!0,s||(a=k(n,"click",S(e[14])),s=!0)},p(e,t){const n={};1024&t[0]&&(n.event=e[11](e[10])),32&t[0]&&(n.responses=e[5]),1&t[0]&&(n.websiteOwnerPubkey=e[0]),o.$set(n)},i(e){i||(V(o.$$.fragment,e),i=!0)},o(e){Y(o.$$.fragment,e),i=!1},d(e){e&&(w(t),w(r)),ee(o,e),s=!1,a()}}}function Ph(e){let t;return{c(){t=_("👆 deleted")},m(e,n){b(e,t,n)},d(e){e&&w(t)}}}function Th(e){let t,n,r,o;t=new hh({props:{event:e[28],responses:e[5],websiteOwnerPubkey:e[0]}});let i=e[28].deleted&&Ph();return{c(){Q(t.$$.fragment),n=x(),i&&i.c(),r=E()},m(e,s){X(t,e,s),b(e,n,s),i&&i.m(e,s),b(e,r,s),o=!0},p(e,n){const o={};16&n[0]&&(o.event=e[28]),32&n[0]&&(o.responses=e[5]),1&n[0]&&(o.websiteOwnerPubkey=e[0]),t.$set(o),e[28].deleted?i||(i=Ph(),i.c(),i.m(r.parentNode,r)):i&&(i.d(1),i=null)},i(e){o||(V(t.$$.fragment,e),o=!0)},o(e){Y(t.$$.fragment,e),o=!1},d(e){e&&(w(n),w(r)),ee(t,e),i&&i.d(e)}}}function Lh(e){let t,n;return{c(){t=m("b"),t.textContent="Public notes:",n=_("\n your followers see your messages on their timeline"),A(t,"class","font-bold svelte-bz3ser")},m(e,r){b(e,t,r),b(e,n,r)},d(e){e&&(w(t),w(n))}}}function Bh(e){let t,n;return{c(){t=m("b"),t.textContent="Public chat:",n=_("\n anyone can see these messages."),A(t,"class","font-bold svelte-bz3ser")},m(e,r){b(e,t,r),b(e,n,r)},d(e){e&&(w(t),w(n))}}}function Rh(e){let t,n;return{c(){t=m("b"),t.textContent="Encrypted chat:",n=_("\n only your chat partner can see these messages."),A(t,"class","font-bold svelte-bz3ser")},m(e,r){b(e,t,r),b(e,n,r)},d(e){e&&(w(t),w(n))}}}function $h(e){let t,n,i,s,a,c,u,l,f,h,d,p,y,E,C,I,P,T,L,B,R,$,j,U,N,H,z,M,q,F,D,K,J,Q=e[3]?.pubkey&&mh(e),X=Z(Array(e[8])),ee=[];for(let t=0;t',y=x(),te&&te.c(),E=x(),C=m("div"),ne&&ne.c(),I=x(),P=m("div"),T=m("div"),B.c(),R=x(),$=m("div"),j=m("div"),ce.c(),N=x(),H=m("div"),z=m("div"),M=m("input"),q=x(),F=m("button"),F.innerHTML='',A(n,"class","m-0 text-lg svelte-bz3ser"),A(a,"class","flex flex-row gap-1 overflow-clip svelte-bz3ser"),A(s,"class","text-xs flex mr-0 ml-auto flex-col items-end mt-2 text-gray-200 gap-1 svelte-bz3ser"),A(p,"id","close-popup"),A(p,"class","bg-transparent ml-4 border-none text-white cursor-pointer svelte-bz3ser"),A(t,"class","flex justify-between items-center p-4 bg-purple-700 text-white md:rounded-t-md svelte-bz3ser"),A(T,"id","messages-container-inner"),A(T,"class","flex flex-col gap-4 svelte-bz3ser"),A(P,"id","messages-container"),A(P,"class","overflow-auto overflow-x-hidden -mx-4 px-4 min-h-full h-full svelte-bz3ser"),A(j,"class","px-2 svelte-bz3ser"),A($,"id","chat-input-warn"),A($,"class",U="border-y "+(e[10]&&"hidden")+" border-y-slate-200 -mx-4 bg-slate-100 text-black text-sm px-4 py-2 sticky bottom-0 svelte-bz3ser"),A(C,"id","chat-messages"),A(C,"class","flex-1 px-4 min-h-[384px] block overflow-y-hidden md:overflow-y-auto overflow-x-hidden svelte-bz3ser"),A(M,"type","text"),A(M,"id","message-input"),A(M,"class","flex-1 border border-gray-300 min-h-[40px] max-h-[40px] rounded-md px-4 py-2 outline-none w-3/4 svelte-bz3ser"),A(M,"placeholder","Say hello"),A(F,"class","bg-purple-700 min-h-[40px] max-h-[40px] hover:bg-purple-600 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-offset-2 text-white rounded-md px-4 py-2 cursor-pointer svelte-bz3ser"),A(z,"class","flex space-x-4 items-center svelte-bz3ser"),A(H,"id","chat-input-container"),A(H,"class","p-4 svelte-bz3ser")},m(r,w){b(r,t,w),g(t,n),Q&&Q.m(n,null),g(t,i),g(t,s),g(s,a);for(let e=0;e{oe[o]=null})),W(),B=oe[L],B?B.p(e,r):(B=oe[L]=re[L](e),B.c()),V(B,1),B.m(T,null)),ae!==(ae=se(e))&&(ce.d(1),ce=ae(e),ce&&(ce.c(),ce.m(j,null))),(!D||1024&r[0]&&U!==(U="border-y "+(e[10]&&"hidden")+" border-y-slate-200 -mx-4 bg-slate-100 text-black text-sm px-4 py-2 sticky bottom-0 svelte-bz3ser"))&&A($,"class",U)},i(e){D||(V(B),D=!0)},o(e){Y(B),D=!1},d(e){e&&(w(t),w(y),w(E),w(C),w(N),w(H)),Q&&Q.d(),v(ee,e),te&&te.d(e),ne&&ne.d(),oe[L].d(),ce.d(),K=!1,r(J)}}}function jh(e,t,n){let r,o,i,s;c(e,se,(e=>n(3,r=e))),c(e,ce,(e=>n(10,o=e))),c(e,ae,(e=>n(19,i=e))),c(e,le,(e=>n(22,s=e)));let a,l,f=[],h=[],d={},p={},{websiteOwnerPubkey:y}=t,{chatConfiguration:g}=t,{toggleChat:b}=t;function w(e){let t=f.find((t=>t.id===e));return t=t||h.find((t=>t.id===e)),t}async function v(){const e=document.getElementById("message-input");if(""===e.value||" "===e.value);else{const t=e.value;e.value="";let n={tags:[],tagPubKeys:[]};!l&&y&&(n.tagPubKeys=[y]),o&&(n.tags.push(["e",o,"wss://nos.lol","root"]),n.tagPubKeys.push(w(o).pubkey));const i=await r.send(t,n);l||(l=i,localStorage.setItem("rootNoteId",l))}}function m(e){let t;if(e.tags.filter((e=>"e"===e[0])).pop(),"GLOBAL"===g.chatType)t=e.tags.filter((e=>"e"===e[0])).length>=1;else if("GROUP"===g.chatType)t=e.tags.filter((e=>"e"===e[0]&&e[1]!==g.chatId)).length>=1;else{const n=e.tags.filter((e=>"p"===e[0])).map((e=>e[1]));t=new Set(n).size>=2}if(d[e.id]||n(5,d[e.id]=[],d),t){const t=e.tags.filter((e=>"e"===e[0])).pop();t&&t[1]&&(d[t[1]]||n(5,d[t[1]]=[],d),d[t[1]].push(e)),h.push(e)}else{let t=0;for(;tt.id===e.zappedEvent));t&&(s[t.id]||u(le,s[t.id]=[],s),s[t.id].push(e))}function E(e){const t=f.find((t=>t.id===e.id));t&&(t.reactions=t.reactions||[],t.reactions.push(e),n(4,f),n(1,g),n(16,a),n(3,r))}let k={};T((()=>{r.on("message",m),r.on("connectivity",(e=>{n(17,O=e)})),r.on("reaction",E),r.on("zap",x),r.on("deleted",(e=>{e.forEach((e=>{const t=f.findIndex((t=>t.id===e));-1!==t&&(n(4,f[t].deleted=!0,f),n(4,f),n(1,g),n(16,a),n(3,r))}))})),r.on("profile",(({pubkey:e,profile:t})=>{let n=i.profiles;n[e]=t,ae.set({profiles:n,...i})})),r.on("channelMetadata",(e=>{n(6,k=JSON.parse(e.content))}))}));let S,A,O={},C=0,I=0;return e.$$set=e=>{"websiteOwnerPubkey"in e&&n(0,y=e.websiteOwnerPubkey),"chatConfiguration"in e&&n(1,g=e.chatConfiguration),"toggleChat"in e&&n(2,b=e.toggleChat)},e.$$.update=()=>{65546&e.$$.dirty[0]&&(g!==a&&r&&(r.setChatConfiguration(g.chatType,g.chatTags,g.chatReferenceTags,g.chatId),n(4,f=[]),n(5,d={}),l=null,localStorage.removeItem("rootNoteId")),n(16,a=g)),524288&e.$$.dirty[0]&&n(15,p=i.profiles),163848&e.$$.dirty[0]&&(n(7,C=Object.values(O).filter((e=>"connected"===e)).length),n(8,I=Object.values(O).length),r?.pubkey&&!p[r.pubkey]&&r.reqProfile(r.pubkey)),262152&e.$$.dirty[0]&&S!==r?.chatId&&(n(18,S=r?.chatId),n(6,k={})),8&e.$$.dirty[0]&&n(9,A=r?.pubkey?function(e){let t;if(p[r.pubkey]){let e=p[r.pubkey];t=e.display_name||e.displayName||e.name||e.nip05}return t||(t=`[${e.slice(0,6)}]`),t}(r.pubkey):"")},[y,g,b,r,f,d,k,C,I,A,o,w,v,async function(e){"Enter"===e.key&&(v(),e.preventDefault())},function(){if("GROUP"===g.chatType)u(ce,o=null,o);else{const e=w(o).tags.filter((e=>"e"===e[0])).pop(),t=e&&e[1];u(ce,o=t,o)}_()},p,a,O,S,i]}class Uh extends re{constructor(e){super(),ne(this,e,jh,$h,i,{websiteOwnerPubkey:0,chatConfiguration:1,toggleChat:2},null,[-1,-1])}}function Nh(e){let t,n;return t=new Uh({props:{toggleChat:e[4],websiteOwnerPubkey:e[1],chatConfiguration:e[2],relays:e[3]}}),{c(){Q(t.$$.fragment)},m(e,r){X(t,e,r),n=!0},p(e,n){const r={};16&n&&(r.toggleChat=e[4]),2&n&&(r.websiteOwnerPubkey=e[1]),4&n&&(r.chatConfiguration=e[2]),8&n&&(r.relays=e[3]),t.$set(r)},i(e){n||(V(t.$$.fragment,e),n=!0)},o(e){Y(t.$$.fragment,e),n=!1},d(e){ee(t,e)}}}function Hh(e){let t,n;return t=new Pf({props:{toggleChat:e[4],websiteOwnerPubkey:e[1],chatConfiguration:e[2],relays:e[3]}}),{c(){Q(t.$$.fragment)},m(e,r){X(t,e,r),n=!0},p(e,n){const r={};16&n&&(r.toggleChat=e[4]),2&n&&(r.websiteOwnerPubkey=e[1]),4&n&&(r.chatConfiguration=e[2]),8&n&&(r.relays=e[3]),t.$set(r)},i(e){n||(V(t.$$.fragment,e),n=!0)},o(e){Y(t.$$.fragment,e),n=!1},d(e){ee(t,e)}}}function zh(e){let t,n,r,o;const i=[Hh,Nh],s=[];function a(e,t){return e[0]?1:0}return t=a(e),n=s[t]=i[t](e),{c(){n.c(),r=E()},m(e,n){s[t].m(e,n),b(e,r,n),o=!0},p(e,[o]){let c=t;t=a(e),t===c?s[t].p(e,o):(G(),Y(s[c],1,1,(()=>{s[c]=null})),W(),n=s[t],n?n.p(e,o):(n=s[t]=i[t](e),n.c()),V(n,1),n.m(r.parentNode,r))},i(e){o||(V(n),o=!0)},o(e){Y(n),o=!1},d(e){e&&w(r),s[t].d(e)}}}function Mh(e,t,n){let r;c(e,se,(e=>n(5,r=e)));let{websiteOwnerPubkey:o}=t,{chatStarted:i}=t,{chatConfiguration:s}=t,{relays:a}=t,{toggleChat:u}=t;return e.$$set=e=>{"websiteOwnerPubkey"in e&&n(1,o=e.websiteOwnerPubkey),"chatStarted"in e&&n(0,i=e.chatStarted),"chatConfiguration"in e&&n(2,s=e.chatConfiguration),"relays"in e&&n(3,a=e.relays),"toggleChat"in e&&n(4,u=e.toggleChat)},e.$$.update=()=>{32&e.$$.dirty&&n(0,i=!!r)},[i,o,s,a,u,r]}class qh extends re{constructor(e){super(),ne(this,e,Mh,zh,i,{websiteOwnerPubkey:1,chatStarted:0,chatConfiguration:2,relays:3,toggleChat:4})}}function Fh(e){let t,n,r,o;return n=new qh({props:{websiteOwnerPubkey:e[0],chatConfiguration:{chatType:e[1],chatTags:e[2],chatId:e[5],chatReferenceTags:e[3]},relays:e[4],toggleChat:e[8]}}),{c(){t=m("div"),Q(n.$$.fragment),A(t,"id","_chat-popup"),A(t,"class",r="absolute bottom-20 right-0 w-96 bg-white rounded-md shadow-md flex flex-col transition-all text-sm "+(e[7]?"hidden":"")+" svelte-faqvv7")},m(e,r){b(e,t,r),X(n,t,null),o=!0},p(e,i){const s={};1&i&&(s.websiteOwnerPubkey=e[0]),46&i&&(s.chatConfiguration={chatType:e[1],chatTags:e[2],chatId:e[5],chatReferenceTags:e[3]}),16&i&&(s.relays=e[4]),n.$set(s),(!o||128&i&&r!==(r="absolute bottom-20 right-0 w-96 bg-white rounded-md shadow-md flex flex-col transition-all text-sm "+(e[7]?"hidden":"")+" svelte-faqvv7"))&&A(t,"class",r)},i(e){o||(V(n.$$.fragment,e),o=!0)},o(e){Y(n.$$.fragment,e),o=!1},d(e){e&&w(t),ee(n)}}}function Dh(e){let t,n,r,o,i,s,a=e[6]&&Fh(e);return{c(){t=m("div"),n=m("div"),n.innerHTML='NostriChat ',r=x(),a&&a.c(),A(n,"class","text-white cursor-pointer shadow-md bg-purple-900 hover:bg-purple-700 w-full p-4 rounded-full flex-shrink-1 text-center font-semibold flex flex-row items-center gap-4 svelte-faqvv7"),A(t,"id","_chat-widget-container"),A(t,"class","font-sans svelte-faqvv7")},m(c,u){b(c,t,u),g(t,n),g(t,r),a&&a.m(t,null),o=!0,i||(s=k(n,"click",S(e[8])),i=!0)},p(e,[n]){e[6]?a?(a.p(e,n),64&n&&V(a,1)):(a=Fh(e),a.c(),V(a,1),a.m(t,null)):a&&(G(),Y(a,1,1,(()=>{a=null})),W())},i(e){o||(V(a),o=!0)},o(e){Y(a),o=!1},d(e){e&&w(t),a&&a.d(),i=!1,s()}}}function Kh(e,t,n){let{websiteOwnerPubkey:r}=t,{chatType:o}=t,{chatTags:i}=t,{chatReferenceTags:s}=t,{relays:a}=t,{chatId:c}=t,u=!1,l=!1;return e.$$set=e=>{"websiteOwnerPubkey"in e&&n(0,r=e.websiteOwnerPubkey),"chatType"in e&&n(1,o=e.chatType),"chatTags"in e&&n(2,i=e.chatTags),"chatReferenceTags"in e&&n(3,s=e.chatReferenceTags),"relays"in e&&n(4,a=e.relays),"chatId"in e&&n(5,c=e.chatId)},[r,o,i,s,a,c,u,l,()=>{u?n(7,l=!l):n(6,u=!u)}]}var Gh=document.createElement("DIV"),Wh=document.currentScript;const Vh=Wh.getAttribute("data-website-owner-pubkey"),Yh=Wh.getAttribute("data-chat-type");let Zh=Wh.getAttribute("data-chat-tags"),Jh=Wh.getAttribute("data-chat-id"),Qh=Wh.getAttribute("data-chat-reference-tags"),Xh=Wh.getAttribute("data-relays");Wh.parentNode.insertBefore(Gh,Wh),Xh||(Xh="wss://relay.f7z.io,wss://nos.lol,wss://relay.nostr.info,wss://nostr-pub.wellorder.net,wss://relay.current.fyi,wss://relay.nostr.band"),Xh=Xh.split(","),Zh=Zh?Zh.split(","):[],Qh=Qh?Qh.split(","):[],new class extends re{constructor(e){super(),ne(this,e,Kh,Dh,i,{websiteOwnerPubkey:0,chatType:1,chatTags:2,chatReferenceTags:3,relays:4,chatId:5})}}({target:Gh,props:{websiteOwnerPubkey:Vh,chatType:Yh,chatTags:Zh,chatId:Jh,chatReferenceTags:Qh,relays:Xh}})}(); +Object.defineProperty(e,"__esModule",{value:!0}),e.bytes=e.stringToBytes=e.str=e.bytesToString=e.hex=e.utf8=e.bech32m=e.bech32=e.base58check=e.base58xmr=e.base58xrp=e.base58flickr=e.base58=e.base64url=e.base64=e.base32crockford=e.base32hex=e.base32=e.base16=e.utils=e.assertNumber=void 0,e.assertNumber=t;const c=(e,t)=>t?c(t,e%t):e,u=(e,t)=>e+(t-c(e,t));function l(e,n,r,o){if(!Array.isArray(e))throw new Error("convertRadix2: data should be array");if(n<=0||n>32)throw new Error(`convertRadix2: wrong from=${n}`);if(r<=0||r>32)throw new Error(`convertRadix2: wrong to=${r}`);if(u(n,r)>32)throw new Error(`convertRadix2: carry overflow from=${n} to=${r} carryBits=${u(n,r)}`);let i=0,s=0;const a=2**r-1,c=[];for(const o of e){if(t(o),o>=2**n)throw new Error(`convertRadix2: invalid data word=${o} from=${n}`);if(i=i<32)throw new Error(`convertRadix2: carry overflow pos=${s} from=${n}`);for(s+=n;s>=r;s-=r)c.push((i>>s-r&a)>>>0);i&=2**s-1}if(i=i<=n)throw new Error("Excess padding");if(!o&&i)throw new Error(`Non-zero padding: ${i}`);return o&&s>0&&c.push(i>>>0),c}function h(e){return t(e),{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return a(Array.from(t),256,e)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix.decode input should be array of strings");return Uint8Array.from(a(t,e,256))}}}function f(e,n=!1){if(t(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(u(8,e)>32||u(e,8)>32)throw new Error("radix2: carry overflow");return{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix2.encode input should be Uint8Array");return l(Array.from(t),8,e,!n)},decode:t=>{if(!Array.isArray(t)||t.length&&"number"!=typeof t[0])throw new Error("radix2.decode input should be array of strings");return Uint8Array.from(l(t,e,8,n))}}}function d(e){if("function"!=typeof e)throw new Error("unsafeWrapper fn should be function");return function(...t){try{return e.apply(null,t)}catch(e){}}}function p(e,n){if(t(e),"function"!=typeof n)throw new Error("checksum fn should be function");return{encode(t){if(!(t instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");const r=n(t).slice(0,e),o=new Uint8Array(t.length+e);return o.set(t),o.set(r,t.length),o},decode(t){if(!(t instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");const r=t.slice(0,-e),o=n(r).slice(0,e),i=t.slice(-e);for(let t=0;te.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1")))),e.base64=n(f(6),r("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),i(6),o("")),e.base64url=n(f(6),r("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),i(6),o(""));const y=e=>n(h(58),r(e),o(""));e.base58=y("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),e.base58flickr=y("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),e.base58xrp=y("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const g=[0,2,3,5,6,7,9,10,11];e.base58xmr={encode(t){let n="";for(let r=0;rn(p(4,(e=>t(t(e)))),e.base58);const b=n(r("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),o("")),w=[996825010,642813549,513874426,1027748829,705979059];function v(e){const t=e>>25;let n=(33554431&e)<<5;for(let e=0;e>e&1)&&(n^=w[e]);return n}function m(e,t,n=1){const r=e.length;let o=1;for(let t=0;t126)throw new Error(`Invalid prefix (${e})`);o=v(o)^n>>5}o=v(o);for(let t=0;tn)throw new TypeError(`Wrong string length: ${e.length} (${e}). Expected (8..${n})`);const r=e.toLowerCase();if(e!==r&&e!==e.toUpperCase())throw new Error("String must be lowercase or uppercase");const o=(e=r).lastIndexOf("1");if(0===o||-1===o)throw new Error('Letter "1" must be present between prefix and data only');const i=e.slice(0,o),s=e.slice(o+1);if(s.length<6)throw new Error("Data must be at least 6 characters long");const a=b.decode(s).slice(0,-6),c=m(i,a,t);if(!s.endsWith(c))throw new Error(`Invalid checksum in ${e}: expected "${c}"`);return{prefix:i,words:a}}return{encode:function(e,n,r=90){if("string"!=typeof e)throw new Error("bech32.encode prefix should be string, not "+typeof e);if(!Array.isArray(n)||n.length&&"number"!=typeof n[0])throw new Error("bech32.encode words should be array of numbers, not "+typeof n);const o=e.length+7+n.length;if(!1!==r&&o>r)throw new TypeError(`Length ${o} exceeds limit ${r}`);return`${e=e.toLowerCase()}1${b.encode(n)}${m(e,n,t)}`},decode:s,decodeToBytes:function(e){const{prefix:t,words:n}=s(e,!1);return{prefix:t,words:n,bytes:r(n)}},decodeUnsafe:d(s),fromWords:r,fromWordsUnsafe:i,toWords:o}}e.bech32=_("bech32"),e.bech32m=_("bech32m"),e.utf8={encode:e=>(new TextDecoder).decode(e),decode:e=>(new TextEncoder).encode(e)},e.hex=n(f(4),r("0123456789abcdef"),o(""),s((e=>{if("string"!=typeof e||e.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()})));const x={utf8:e.utf8,hex:e.hex,base16:e.base16,base32:e.base32,base64:e.base64,base64url:e.base64url,base58:e.base58,base58xmr:e.base58xmr},E=`Invalid encoding type. Available types: ${Object.keys(x).join(", ")}`;e.bytesToString=(e,t)=>{if("string"!=typeof e||!x.hasOwnProperty(e))throw new TypeError(E);if(!(t instanceof Uint8Array))throw new TypeError("bytesToString() expects Uint8Array");return x[e].encode(t)},e.str=e.bytesToString;e.stringToBytes=(e,t)=>{if(!x.hasOwnProperty(e))throw new TypeError(E);if("string"!=typeof t)throw new TypeError("stringToBytes() expects string");return x[e].decode(t)},e.bytes=e.stringToBytes}(zr),Object.defineProperty(tr,"__esModule",{value:!0});var Kr=tr.mnemonicToSeedSync=tr.mnemonicToSeed=ao=tr.validateMnemonic=tr.entropyToMnemonic=tr.mnemonicToEntropy=no=tr.generateMnemonic=void 0; +/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */const Gr=nr,Wr=lr,Vr=vr,Yr=Lr,Zr=fr,Jr=zr,Qr=e=>"あいこくしん"===e[0];function Xr(e){if("string"!=typeof e)throw new TypeError("Invalid mnemonic type: "+typeof e);return e.normalize("NFKD")}function eo(e){const t=Xr(e),n=t.split(" ");if(![12,15,18,21,24].includes(n.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:n}}function to(e){Gr.default.bytes(e,16,20,24,28,32)}var no=tr.generateMnemonic=function(e,t=128){if(Gr.default.number(t),t%32!=0||t>256)throw new TypeError("Invalid entropy");return so((0,Zr.randomBytes)(t/8),e)};const ro=e=>{const t=8-e.length/4;return new Uint8Array([(0,Vr.sha256)(e)[0]>>t<{if("string"!=typeof e)throw new Error(`Wordlist: non-string element: ${e}`)})),Jr.utils.chain(Jr.utils.checksum(1,ro),Jr.utils.radix2(11,!0),Jr.utils.alphabet(e))}function io(e,t){const{words:n}=eo(e),r=oo(t).decode(n);return to(r),r}function so(e,t){to(e);return oo(t).encode(e).join(Qr(t)?" ":" ")}tr.mnemonicToEntropy=io,tr.entropyToMnemonic=so;var ao=tr.validateMnemonic=function(e,t){try{io(e,t)}catch(e){return!1}return!0};const co=e=>Xr(`mnemonic${e}`);function uo(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function lo(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}`)}tr.mnemonicToSeed=function(e,t=""){return(0,Wr.pbkdf2Async)(Yr.sha512,eo(e).nfkd,co(t),{c:2048,dkLen:64})},Kr=tr.mnemonicToSeedSync=function(e,t=""){return(0,Wr.pbkdf2)(Yr.sha512,eo(e).nfkd,co(t),{c:2048,dkLen:64})};const ho={number:uo,bool:function(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)},bytes:lo,hash:function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");uo(e.outputLen),uo(e.blockLen)},exists:function(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")},output:function(e,t){lo(e);const n=t.outputLen;if(e.lengthe instanceof Uint8Array,po=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),yo=(e,t)=>e<<32-t|e>>>t; +/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */if(!(68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]))throw new Error("Non little-endian hardware is not supported");const go=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function bo(e){if(!fo(e))throw new Error("Uint8Array expected");let t="";for(let n=0;ne+t.length),0));let n=0;return e.forEach((e=>{if(!fo(e))throw new Error("Uint8Array expected");t.set(e,n),n+=e.length})),t}class _o{clone(){return this._cloneInto()}}function xo(e){const t=t=>e().update(vo(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}class Eo extends _o{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,ho.hash(e);const n=vo(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,o=new Uint8Array(r);o.set(n.length>r?e.create().update(n).digest():n);for(let e=0;enew Eo(e,t).update(n).digest();ko.create=(e,t)=>new Eo(e,t);class So extends _o{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=po(this.buffer)}update(e){ho.exists(this);const{view:t,buffer:n,blockLen:r}=this,o=(e=vo(e)).length;for(let i=0;ir-i&&(this.process(n,0),i=0);for(let e=i;e>o&i),a=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,s,r),e.setUint32(t+u,a,r)}(n,r-8,BigInt(8*this.length),o),this.process(n,0);const s=po(e),a=this.outputLen;if(a%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=a/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;et)),Co=Oo.map((e=>(9*e+5)%16));let Po=[Oo],Io=[Co];for(let e=0;e<4;e++)for(let t of[Po,Io])t.push(t[e].map((e=>Ao[e])));const Lo=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map((e=>new Uint8Array(e))),jo=Po.map(((e,t)=>e.map((e=>Lo[t][e])))),To=Io.map(((e,t)=>e.map((e=>Lo[t][e])))),Bo=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Ro=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),$o=(e,t)=>e<>>32-t;function Uo(e,t,n,r){return 0===e?t^n^r:1===e?t&n|~t&r:2===e?(t|~n)^r:3===e?t&r|n&~r:t^(n|~r)}const No=new Uint32Array(16);class Ho extends So{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:n,h3:r,h4:o}=this;return[e,t,n,r,o]}set(e,t,n,r,o){this.h0=0|e,this.h1=0|t,this.h2=0|n,this.h3=0|r,this.h4=0|o}process(e,t){for(let n=0;n<16;n++,t+=4)No[n]=e.getUint32(t,!0);let n=0|this.h0,r=n,o=0|this.h1,i=o,s=0|this.h2,a=s,c=0|this.h3,u=c,l=0|this.h4,h=l;for(let e=0;e<5;e++){const t=4-e,f=Bo[e],d=Ro[e],p=Po[e],y=Io[e],g=jo[e],b=To[e];for(let t=0;t<16;t++){const r=$o(n+Uo(e,o,s,c)+No[p[t]]+f,g[t])+l|0;n=l,l=c,c=0|$o(s,10),s=o,o=r}for(let e=0;e<16;e++){const n=$o(r+Uo(t,i,a,u)+No[y[e]]+d,b[e])+h|0;r=h,h=u,u=0|$o(a,10),a=i,i=n}}this.set(this.h1+s+u|0,this.h2+c+h|0,this.h3+l+r|0,this.h4+n+i|0,this.h0+o+a|0)}roundClean(){No.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const Mo=xo((()=>new Ho)),qo=(e,t,n)=>e&t^e&n^t&n,Fo=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]),Do=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),zo=new Uint32Array(64);class Ko extends So{constructor(){super(64,32,8,!1),this.A=0|Do[0],this.B=0|Do[1],this.C=0|Do[2],this.D=0|Do[3],this.E=0|Do[4],this.F=0|Do[5],this.G=0|Do[6],this.H=0|Do[7]}get(){const{A:e,B:t,C:n,D:r,E:o,F:i,G:s,H:a}=this;return[e,t,n,r,o,i,s,a]}set(e,t,n,r,o,i,s,a){this.A=0|e,this.B=0|t,this.C=0|n,this.D=0|r,this.E=0|o,this.F=0|i,this.G=0|s,this.H=0|a}process(e,t){for(let n=0;n<16;n++,t+=4)zo[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=zo[e-15],n=zo[e-2],r=yo(t,7)^yo(t,18)^t>>>3,o=yo(n,17)^yo(n,19)^n>>>10;zo[e]=o+zo[e-7]+r+zo[e-16]|0}let{A:n,B:r,C:o,D:i,E:s,F:a,G:c,H:u}=this;for(let e=0;e<64;e++){const t=u+(yo(s,6)^yo(s,11)^yo(s,25))+((l=s)&a^~l&c)+Fo[e]+zo[e]|0,h=(yo(n,2)^yo(n,13)^yo(n,22))+qo(n,r,o)|0;u=c,c=a,a=s,s=i+t|0,i=o,o=r,r=n,n=t+h|0}var l;n=n+this.A|0,r=r+this.B|0,o=o+this.C|0,i=i+this.D|0,s=s+this.E|0,a=a+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(n,r,o,i,s,a,c,u)}roundClean(){zo.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class Go extends Ko{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}const Wo=xo((()=>new Ko));xo((()=>new Go));const Vo=BigInt(2**32-1),Yo=BigInt(32);function Zo(e,t=!1){return t?{h:Number(e&Vo),l:Number(e>>Yo&Vo)}:{h:0|Number(e>>Yo&Vo),l:0|Number(e&Vo)}}const Jo={fromBig:Zo,split:function(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;oBigInt(e>>>0)<>>0),shrSH:(e,t,n)=>e>>>n,shrSL:(e,t,n)=>e<<32-n|t>>>n,rotrSH:(e,t,n)=>e>>>n|t<<32-n,rotrSL:(e,t,n)=>e<<32-n|t>>>n,rotrBH:(e,t,n)=>e<<64-n|t>>>n-32,rotrBL:(e,t,n)=>e>>>n-32|t<<64-n,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,n)=>e<>>32-n,rotlSL:(e,t,n)=>t<>>32-n,rotlBH:(e,t,n)=>t<>>64-n,rotlBL:(e,t,n)=>e<>>64-n,add:function(e,t,n,r){const o=(t>>>0)+(r>>>0);return{h:e+n+(o/2**32|0)|0,l:0|o}},add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,o)=>t+n+r+o+(e/2**32|0)|0,add5H:(e,t,n,r,o,i)=>t+n+r+o+i+(e/2**32|0)|0,add5L:(e,t,n,r,o)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(o>>>0)},[Qo,Xo]=Jo.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e=>BigInt(e)))),ei=new Uint32Array(80),ti=new Uint32Array(80);class ni extends So{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:n,Bl:r,Ch:o,Cl:i,Dh:s,Dl:a,Eh:c,El:u,Fh:l,Fl:h,Gh:f,Gl:d,Hh:p,Hl:y}=this;return[e,t,n,r,o,i,s,a,c,u,l,h,f,d,p,y]}set(e,t,n,r,o,i,s,a,c,u,l,h,f,d,p,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|n,this.Bl=0|r,this.Ch=0|o,this.Cl=0|i,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|u,this.Fh=0|l,this.Fl=0|h,this.Gh=0|f,this.Gl=0|d,this.Hh=0|p,this.Hl=0|y}process(e,t){for(let n=0;n<16;n++,t+=4)ei[n]=e.getUint32(t),ti[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|ei[e-15],n=0|ti[e-15],r=Jo.rotrSH(t,n,1)^Jo.rotrSH(t,n,8)^Jo.shrSH(t,n,7),o=Jo.rotrSL(t,n,1)^Jo.rotrSL(t,n,8)^Jo.shrSL(t,n,7),i=0|ei[e-2],s=0|ti[e-2],a=Jo.rotrSH(i,s,19)^Jo.rotrBH(i,s,61)^Jo.shrSH(i,s,6),c=Jo.rotrSL(i,s,19)^Jo.rotrBL(i,s,61)^Jo.shrSL(i,s,6),u=Jo.add4L(o,c,ti[e-7],ti[e-16]),l=Jo.add4H(u,r,a,ei[e-7],ei[e-16]);ei[e]=0|l,ti[e]=0|u}let{Ah:n,Al:r,Bh:o,Bl:i,Ch:s,Cl:a,Dh:c,Dl:u,Eh:l,El:h,Fh:f,Fl:d,Gh:p,Gl:y,Hh:g,Hl:b}=this;for(let e=0;e<80;e++){const t=Jo.rotrSH(l,h,14)^Jo.rotrSH(l,h,18)^Jo.rotrBH(l,h,41),w=Jo.rotrSL(l,h,14)^Jo.rotrSL(l,h,18)^Jo.rotrBL(l,h,41),v=l&f^~l&p,m=h&d^~h&y,_=Jo.add5L(b,w,m,Xo[e],ti[e]),x=Jo.add5H(_,g,t,v,Qo[e],ei[e]),E=0|_,k=Jo.rotrSH(n,r,28)^Jo.rotrBH(n,r,34)^Jo.rotrBH(n,r,39),S=Jo.rotrSL(n,r,28)^Jo.rotrBL(n,r,34)^Jo.rotrBL(n,r,39),A=n&o^n&s^o&s,O=r&i^r&a^i&a;g=0|p,b=0|y,p=0|f,y=0|d,f=0|l,d=0|h,({h:l,l:h}=Jo.add(0|c,0|u,0|x,0|E)),c=0|s,u=0|a,s=0|o,a=0|i,o=0|n,i=0|r;const C=Jo.add3L(E,S,O);n=Jo.add3H(C,x,k,A),r=0|C}({h:n,l:r}=Jo.add(0|this.Ah,0|this.Al,0|n,0|r)),({h:o,l:i}=Jo.add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:a}=Jo.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=Jo.add(0|this.Dh,0|this.Dl,0|c,0|u)),({h:l,l:h}=Jo.add(0|this.Eh,0|this.El,0|l,0|h)),({h:f,l:d}=Jo.add(0|this.Fh,0|this.Fl,0|f,0|d)),({h:p,l:y}=Jo.add(0|this.Gh,0|this.Gl,0|p,0|y)),({h:g,l:b}=Jo.add(0|this.Hh,0|this.Hl,0|g,0|b)),this.set(n,r,o,i,s,a,c,u,l,h,f,d,p,y,g,b)}roundClean(){ei.fill(0),ti.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class ri extends ni{constructor(){super(),this.Ah=-1942145080,this.Al=424955298,this.Bh=1944164710,this.Bl=-1982016298,this.Ch=502970286,this.Cl=855612546,this.Dh=1738396948,this.Dl=1479516111,this.Eh=258812777,this.El=2077511080,this.Fh=2011393907,this.Fl=79989058,this.Gh=1067287976,this.Gl=1780299464,this.Hh=286451373,this.Hl=-1848208735,this.outputLen=28}}class oi extends ni{constructor(){super(),this.Ah=573645204,this.Al=-64227540,this.Bh=-1621794909,this.Bl=-934517566,this.Ch=596883563,this.Cl=1867755857,this.Dh=-1774684391,this.Dl=1497426621,this.Eh=-1775747358,this.El=-1467023389,this.Fh=-1101128155,this.Fl=1401305490,this.Gh=721525244,this.Gl=746961066,this.Hh=246885852,this.Hl=-2117784414,this.outputLen=32}}class ii extends ni{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}}const si=xo((()=>new ni));xo((()=>new ri)),xo((()=>new oi)),xo((()=>new ii));const ai=Nt.ProjectivePoint,ci=(e=>Sn(function(e,t){if(kn(e),"function"!=typeof t)throw new Error("checksum fn should be function");return{encode(n){if(!(n instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");const r=t(n).slice(0,e),o=new Uint8Array(n.length+e);return o.set(n),o.set(r,n.length),o},decode(n){if(!(n instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");const r=n.slice(0,-e),o=t(r).slice(0,e),i=n.slice(-e);for(let t=0;te(e(t)))),qn))(Wo);function ui(e){return BigInt(`0x${bo(e)}`)}function li(e){return function(e){if("string"!=typeof e)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 t=0;t{if(!Number.isSafeInteger(e)||e<0||e>2**32-1)throw new Error(`Invalid number=${e}. Should be from 0 to 2 ** 32 - 1`);const t=new Uint8Array(4);return po(t).setUint32(0,e,!1),t};class yi{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return e=this.pubHash,po(e).getUint32(0,!1);var e}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){const e=this.privateKey;if(!e)throw new Error("No private key");return ci.encode(this.serialize(this.versions.private,mo(new Uint8Array([0]),e)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return ci.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(e,t=fi){if(lo(e),8*e.length<128||8*e.length>512)throw new Error(`HDKey: wrong seed length=${e.length}. Should be between 128 and 512 bits; 256 bits is advised)`);const n=ko(si,hi,e);return new yi({versions:t,chainCode:n.slice(32),privateKey:n.slice(0,32)})}static fromExtendedKey(e,t=fi){const n=ci.decode(e),r=po(n),o=r.getUint32(0,!1),i={versions:t,depth:n[4],parentFingerprint:r.getUint32(5,!1),index:r.getUint32(9,!1),chainCode:n.slice(13,45)},s=n.slice(45),a=0===s[0];if(o!==t[a?"private":"public"])throw new Error("Version mismatch");return new yi(a?{...i,privateKey:s.slice(1)}:{...i,publicKey:s})}static fromJSON(e){return yi.fromExtendedKey(e.xpriv)}constructor(e){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!e||"object"!=typeof e)throw new Error("HDKey.constructor must not be called directly");if(this.versions=e.versions||fi,this.depth=e.depth||0,this.chainCode=e.chainCode,this.index=e.index||0,this.parentFingerprint=e.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(e.publicKey&&e.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(e.privateKey){if(!Nt.utils.isValidPrivateKey(e.privateKey))throw new Error("Invalid private key");this.privKey="bigint"==typeof e.privateKey?e.privateKey:ui(e.privateKey),this.privKeyBytes=li(this.privKey),this.pubKey=Nt.getPublicKey(e.privateKey,!0)}else{if(!e.publicKey)throw new Error("HDKey: no public or private key provided");this.pubKey=ai.fromHex(e.publicKey).toRawBytes(!0)}var t;this.pubHash=(t=this.pubKey,Mo(Wo(t)))}derive(e){if(!/^[mM]'?/.test(e))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(e))return this;const t=e.replace(/^[mM]'?\//,"").split("/");let n=this;for(const e of t){const t=/^(\d+)('?)$/.exec(e);if(!t||3!==t.length)throw new Error(`Invalid child index: ${e}`);let r=+t[1];if(!Number.isSafeInteger(r)||r>=di)throw new Error("Invalid index");"'"===t[2]&&(r+=di),n=n.deriveChild(r)}return n}deriveChild(e){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let t=pi(e);if(e>=di){const e=this.privateKey;if(!e)throw new Error("Could not derive hardened child key");t=mo(new Uint8Array([0]),e,t)}else t=mo(this.pubKey,t);const n=ko(si,this.chainCode,t),r=ui(n.slice(0,32)),o=n.slice(32);if(!Nt.utils.isValidPrivateKey(r))throw new Error("Tweak bigger than curve order");const i={versions:this.versions,chainCode:o,depth:this.depth+1,parentFingerprint:this.fingerprint,index:e};try{if(this.privateKey){const e=at(this.privKey+r,Nt.CURVE.n);if(!Nt.utils.isValidPrivateKey(e))throw new Error("The tweak was out of range or the resulted private key is invalid");i.privateKey=e}else{const e=ai.fromHex(this.pubKey).add(ai.fromPrivateKey(r));if(e.equals(ai.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");i.publicKey=e.toRawBytes(!0)}return new yi(i)}catch(t){return this.deriveChild(e+1)}}sign(e){if(!this.privateKey)throw new Error("No privateKey set!");return lo(e,32),Nt.sign(e,this.privKey).toCompactRawBytes()}verify(e,t){if(lo(e,32),lo(t,64),!this.publicKey)throw new Error("No publicKey set!");let n;try{n=Nt.Signature.fromCompact(t)}catch(e){return!1}return Nt.verify(n,e,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(e,t){if(!this.chainCode)throw new Error("No chainCode set");return lo(t,33),mo(pi(e),new Uint8Array([this.depth]),pi(this.parentFingerprint),pi(this.index),this.chainCode,t)}}var gi=Object.defineProperty,bi=(e,t)=>{for(var n in t)gi(e,n,{get:t[n],enumerable:!0})};function wi(){return cn(en.utils.randomPrivateKey())}function vi(e){return cn(en.getPublicKey(e))}bi({},{MessageNode:()=>Si,MessageQueue:()=>Ai,insertEventIntoAscendingList:()=>ki,insertEventIntoDescendingList:()=>Ei,normalizeURL:()=>xi,utf8Decoder:()=>mi,utf8Encoder:()=>_i});var mi=new TextDecoder("utf-8"),_i=new TextEncoder;function xi(e){let t=new URL(e);return t.pathname=t.pathname.replace(/\/+/g,"/"),t.pathname.endsWith("/")&&(t.pathname=t.pathname.slice(0,-1)),("80"===t.port&&"ws:"===t.protocol||"443"===t.port&&"wss:"===t.protocol)&&(t.port=""),t.searchParams.sort(),t.hash="",t.toString()}function Ei(e,t){let n,r=0,o=e.length-1,i=r;if(o<0)i=0;else if(t.created_at=e[r].created_at)i=r;else for(;;){if(o<=r+1){i=o;break}if(n=Math.floor(r+(o-r)/2),e[n].created_at>t.created_at)r=n;else{if(!(e[n].created_ate[o].created_at)i=o+1;else if(t.created_at<=e[r].created_at)i=r;else for(;;){if(o<=r+1){i=o;break}if(n=Math.floor(r+(o-r)/2),e[n].created_att.created_at)){i=n;break}o=n}}return e[i]?.id!==t.id?[...e.slice(0,i),t,...e.slice(i)]:e}var Si=class{_value;_next;get value(){return this._value}set value(e){this._value=e}get next(){return this._next}set next(e){this._next=e}constructor(e){this._value=e,this._next=null}},Ai=class{_first;_last;get first(){return this._first}set first(e){this._first=e}get last(){return this._last}set last(e){this._last=e}_size;get size(){return this._size}set size(e){this._size=e}constructor(){this._first=null,this._last=null,this._size=0}enqueue(e){const t=new Si(e);return 0!==this._size&&this._last?(this._last.next=t,this._last=t):(this._first=t,this._last=t),this._size++,!0}dequeue(){if(0===this._size||!this._first)return null;let e=this._first;return this._first=e.next,e.next=null,this._size--,e.value}};function Oi(e,t){let n=e;return n.pubkey=vi(t),n.id=Ci(n),n.sig=Ti(n,t),n}function Ci(e){return cn(En(_i.encode(function(e){if(!Ii(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])}(e))))}var Pi=e=>e instanceof Object;function Ii(e){if(!Pi(e))return!1;if("number"!=typeof e.kind)return!1;if("string"!=typeof e.content)return!1;if("number"!=typeof e.created_at)return!1;if("string"!=typeof e.pubkey)return!1;if(!e.pubkey.match(/^[a-f0-9]{64}$/))return!1;if(!Array.isArray(e.tags))return!1;for(let t=0;tt.id.startsWith(e))))return!1;if(e.kinds&&-1===e.kinds.indexOf(t.kind))return!1;if(e.authors&&-1===e.authors.indexOf(t.pubkey)&&!e.authors.some((e=>t.pubkey.startsWith(e))))return!1;for(let n in e)if("#"===n[0]){let r=e[`#${n.slice(1)}`];if(r&&!t.tags.find((([e,t])=>e===n.slice(1)&&-1!==r.indexOf(t))))return!1}return!(e.since&&t.created_at=e.until)}function Ri(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 $i(e,t){let n=t.length,r=e.indexOf(`"${t}":`)+n+3,o=e.slice(r),i=Math.min(o.indexOf(","),o.indexOf("}"));return parseInt(o.slice(0,i),10)}function Ui(e){let t=e.slice(0,22).indexOf('"EVENT"');if(-1===t)return null;let n=e.slice(t+7+1).indexOf('"');if(-1===n)return null;let r=t+7+1+n,o=e.slice(r+1,80).indexOf('"');if(-1===o)return null;let i=r+1+o;return e.slice(r+1,i)}function Ni(e,t){return t===Ri(e,"id")}function Hi(e,t){return t===Ri(e,"pubkey")}function Mi(e,t){return t===$i(e,"kind")}bi({},{getHex64:()=>Ri,getInt:()=>$i,getSubscriptionId:()=>Ui,matchEventId:()=>Ni,matchEventKind:()=>Mi,matchEventPubkey:()=>Hi});var qi=()=>({connect:[],disconnect:[],error:[],notice:[],auth:[]});function Fi(e,t={}){let{listTimeout:n=3e3,getTimeout:r=3e3,countTimeout:o=3e3}=t;var i,s,a={},c=qi(),u={},l={};async function h(){return s||(s=new Promise(((t,n)=>{try{i=new WebSocket(e)}catch(e){n(e)}i.onopen=()=>{c.connect.forEach((e=>e())),t()},i.onerror=()=>{s=void 0,c.error.forEach((e=>e())),n()},i.onclose=async()=>{s=void 0,c.disconnect.forEach((e=>e()))};let r,o=new Ai;function h(){if(0===o.size)return clearInterval(r),void(r=null);var t=o.dequeue();if(!t)return;let n=Ui(t);if(n){let r=a[n];if(r&&r.alreadyHaveEvent&&r.alreadyHaveEvent(Ri(t,"id"),e))return}try{let e=JSON.parse(t);switch(e[0]){case"EVENT":{let t=e[1],n=e[2];return void(Ii(n)&&a[t]&&(a[t].skipVerification||Li(n))&&function(e,t){for(let n=0;ne(n)))))}case"COUNT":let t=e[1],n=e[2];return void(a[t]&&(u[t]?.count||[]).forEach((e=>e(n))));case"EOSE":{let t=e[1];return void(t in u&&(u[t].eose.forEach((e=>e())),u[t].eose=[]))}case"OK":{let t=e[1],n=e[2],r=e[3]||"";return void(t in l&&(n?l[t].ok.forEach((e=>e())):l[t].failed.forEach((e=>e(r))),l[t].ok=[],l[t].failed=[]))}case"NOTICE":let r=e[1];return void c.notice.forEach((e=>e(r)));case"AUTH":{let t=e[1];return void c.auth?.forEach((e=>e(t)))}}}catch(e){return}}i.onmessage=e=>{o.enqueue(e.data),r||(r=setInterval(h,0))}})),s)}function f(){return 1===i?.readyState}async function d(e){let t=JSON.stringify(e);if(f()||(await new Promise((e=>setTimeout(e,1e3))),f()))try{i.send(t)}catch(e){console.log(e)}}const p=(e,{verb:t="REQ",skipVerification:n=!1,alreadyHaveEvent:r=null,id:o=Math.random().toString().slice(2)}={})=>{let i=o;return a[i]={id:i,filters:e,skipVerification:n,alreadyHaveEvent:r},d([t,i,...e]),{sub:(t,o={})=>p(t||e,{skipVerification:o.skipVerification||n,alreadyHaveEvent:o.alreadyHaveEvent||r,id:i}),unsub:()=>{delete a[i],delete u[i],d(["CLOSE",i])},on:(e,t)=>{u[i]=u[i]||{event:[],count:[],eose:[]},u[i][e].push(t)},off:(e,t)=>{let n=u[i],r=n[e].indexOf(t);r>=0&&n[e].splice(r,1)}}};function y(e,t){if(!e.id)throw new Error(`event ${e} has no id`);let n=e.id;return d([t,e]),{on:(e,t)=>{l[n]=l[n]||{ok:[],failed:[]},l[n][e].push(t)},off:(e,t)=>{let r=l[n];if(!r)return;let o=r[e].indexOf(t);o>=0&&r[e].splice(o,1)}}}return{url:e,sub:p,on:(e,t)=>{c[e].push(t),"connect"===e&&1===i?.readyState&&t()},off:(e,t)=>{let n=c[e].indexOf(t);-1!==n&&c[e].splice(n,1)},list:(e,t)=>new Promise((r=>{let o=p(e,t),i=[],s=setTimeout((()=>{o.unsub(),r(i)}),n);o.on("eose",(()=>{o.unsub(),clearTimeout(s),r(i)})),o.on("event",(e=>{i.push(e)}))})),get:(e,t)=>new Promise((n=>{let o=p([e],t),i=setTimeout((()=>{o.unsub(),n(null)}),r);o.on("event",(e=>{o.unsub(),clearTimeout(i),n(e)}))})),count:e=>new Promise((t=>{let n=p(e,{...p,verb:"COUNT"}),r=setTimeout((()=>{n.unsub(),t(null)}),o);n.on("count",(e=>{n.unsub(),clearTimeout(r),t(e)}))})),publish:e=>y(e,"EVENT"),auth:e=>y(e,"AUTH"),connect:async function(){f()||await h()},close(){c=qi(),u={},l={},i.readyState===WebSocket.OPEN&&i?.close()},get status(){return i?.readyState??3}}}var Di={};bi(Di,{BECH32_REGEX:()=>Ki,decode:()=>Gi,naddrEncode:()=>es,neventEncode:()=>Xi,noteEncode:()=>Zi,nprofileEncode:()=>Qi,npubEncode:()=>Yi,nrelayEncode:()=>ts,nsecEncode:()=>Vi});var zi=5e3,Ki=/[\x21-\x7E]{1,83}1[023456789acdefghjklmnpqrstuvwxyz]{6,}/;function Gi(e){let{prefix:t,words:n}=Yn.decode(e,zi),r=new Uint8Array(Yn.fromWords(n));switch(t){case"nprofile":{let e=Wi(r);if(!e[0]?.[0])throw new Error("missing TLV 0 for nprofile");if(32!==e[0][0].length)throw new Error("TLV 0 should be 32 bytes");return{type:"nprofile",data:{pubkey:cn(e[0][0]),relays:e[1]?e[1].map((e=>mi.decode(e))):[]}}}case"nevent":{let e=Wi(r);if(!e[0]?.[0])throw new Error("missing TLV 0 for nevent");if(32!==e[0][0].length)throw new Error("TLV 0 should be 32 bytes");if(e[2]&&32!==e[2][0].length)throw new Error("TLV 2 should be 32 bytes");return{type:"nevent",data:{id:cn(e[0][0]),relays:e[1]?e[1].map((e=>mi.decode(e))):[],author:e[2]?.[0]?cn(e[2][0]):void 0}}}case"naddr":{let e=Wi(r);if(!e[0]?.[0])throw new Error("missing TLV 0 for naddr");if(!e[2]?.[0])throw new Error("missing TLV 2 for naddr");if(32!==e[2][0].length)throw new Error("TLV 2 should be 32 bytes");if(!e[3]?.[0])throw new Error("missing TLV 3 for naddr");if(4!==e[3][0].length)throw new Error("TLV 3 should be 4 bytes");return{type:"naddr",data:{identifier:mi.decode(e[0][0]),pubkey:cn(e[2][0]),kind:parseInt(cn(e[3][0]),16),relays:e[1]?e[1].map((e=>mi.decode(e))):[]}}}case"nrelay":{let e=Wi(r);if(!e[0]?.[0])throw new Error("missing TLV 0 for nrelay");return{type:"nrelay",data:mi.decode(e[0][0])}}case"nsec":case"npub":case"note":return{type:t,data:cn(r)};default:throw new Error(`unknown prefix ${t}`)}}function Wi(e){let t={},n=e;for(;n.length>0;){let e=n[0],r=n[1];if(!r)throw new Error(`malformed TLV ${e}`);let o=n.slice(2,2+r);if(n=n.slice(2+r),o.length_i.encode(e)))}),n=Yn.toWords(t);return Yn.encode("nprofile",n,zi)}function Xi(e){let t=ns({0:[un(e.id)],1:(e.relays||[]).map((e=>_i.encode(e))),2:e.author?[un(e.author)]:[]}),n=Yn.toWords(t);return Yn.encode("nevent",n,zi)}function es(e){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,e.kind,!1);let n=ns({0:[_i.encode(e.identifier)],1:(e.relays||[]).map((e=>_i.encode(e))),2:[un(e.pubkey)],3:[new Uint8Array(t)]}),r=Yn.toWords(n);return Yn.encode("naddr",r,zi)}function ts(e){let t=ns({0:[_i.encode(e)]}),n=Yn.toWords(t);return Yn.encode("nrelay",n,zi)}function ns(e){let t=[];return Object.entries(e).forEach((([e,n])=>{n.forEach((n=>{let r=new Uint8Array(n.length+2);r.set([parseInt(e)],0),r.set([n.length],1),r.set(n,2),t.push(r)}))})),function(...e){if(!e.every((e=>e instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),n=new Uint8Array(t);for(let t=0,r=0;tis,encrypt:()=>os}),"undefined"!=typeof crypto&&!crypto.subtle&&crypto.webcrypto&&(crypto.subtle=crypto.webcrypto.subtle);var as={};bi(as,{NIP05_REGEX:()=>us,queryProfile:()=>fs,searchDomain:()=>hs,useFetchImplementation:()=>ls});var cs,us=/^(?:([\w.+-]+)@)?([\w.-]+)$/;try{cs=fetch}catch{}function ls(e){cs=e}async function hs(e,t=""){try{return(await(await cs(`https://${e}/.well-known/nostr.json?name=${t}`)).json()).names}catch(e){return{}}}async function fs(e){const t=e.match(us);if(!t)return null;const[n,r="_",o]=t;try{const e=await cs(`https://${o}/.well-known/nostr.json?name=${r}`),{names:t,relays:n}=function(e){const t={names:{}};for(const[n,r]of Object.entries(e.names))"string"==typeof n&&"string"==typeof r&&(t.names[n]=r);if(e.relays){t.relays={};for(const[n,r]of Object.entries(e.relays))"string"==typeof n&&Array.isArray(r)&&(t.relays[n]=r.filter((e=>"string"==typeof e)))}return t}(await e.json()),i=t[r];return i?{pubkey:i,relays:n?.[i]}:null}catch(e){return null}}function ds(e,t){let n=yi.fromMasterSeed(Kr(e,t)).derive("m/44'/1237'/0'/0/0").privateKey;if(!n)throw new Error("could not derive private key");return cn(n)}function ps(){return no(er)}function ys(e){return ao(e,er)}bi({},{generateSeedWords:()=>ps,privateKeyFromSeedWords:()=>ds,validateWords:()=>ys});function gs(e){const t={reply:void 0,root:void 0,mentions:[],profiles:[]},n=[];for(const r of e.tags)"e"===r[0]&&r[1]&&n.push(r),"p"===r[0]&&r[1]&&t.profiles.push({pubkey:r[1],relays:r[2]?[r[2]]:[]});for(let e=0;egs});function bs(e){return function(e){let t,n,r;for(n=0,t=0;n>=1;)t++;return 7-t}bi({},{getPow:()=>bs});function vs(e,t,n,r){return Oi({kind:6,tags:[...e.tags??[],["e",t.id,n],["p",t.pubkey]],content:""===e.content?"":JSON.stringify(t),created_at:e.created_at},r)}function ms(e){if(6!==e.kind)return;let t,n;for(let r=e.tags.length-1;r>=0&&(void 0===t||void 0===n);r--){const o=e.tags[r];o.length>=2&&("e"===o[0]&&void 0===t?t=o:"p"===o[0]&&void 0===n&&(n=o))}return void 0!==t?{id:t[1],relays:[t[2],n?.[2]].filter((e=>"string"==typeof e)),author:n?.[1]}:void 0}function _s(e,{skipVerification:t}={}){const n=ms(e);if(void 0===n||""===e.content)return;let r;try{r=JSON.parse(e.content)}catch(e){return}return r.id===n.id&&(t||Li(r))?r:void 0}bi({},{finishRepostEvent:()=>vs,getRepostedEvent:()=>_s,getRepostedEventPointer:()=>ms});bi({},{NOSTR_URI_REGEX:()=>xs,parse:()=>ks,test:()=>Es});var xs=new RegExp(`nostr:(${Ki.source})`);function Es(e){return"string"==typeof e&&new RegExp(`^${xs.source}$`).test(e)}function ks(e){const t=e.match(new RegExp(`^${xs.source}$`));if(!t)throw new Error(`Invalid Nostr URI: ${e}`);return{uri:t[0],value:t[1],decoded:Gi(t[1])}}function Ss(e,t,n){const r=t.tags.filter((e=>e.length>=2&&("e"===e[0]||"p"===e[0])));return Oi({...e,kind:7,tags:[...e.tags??[],...r,["e",t.id],["p",t.pubkey]],content:e.content??"+"},n)}function As(e){if(7!==e.kind)return;let t,n;for(let r=e.tags.length-1;r>=0&&(void 0===t||void 0===n);r--){const o=e.tags[r];o.length>=2&&("e"===o[0]&&void 0===t?t=o:"p"===o[0]&&void 0===n&&(n=o))}return void 0!==t&&void 0!==n?{id:t[1],relays:[t[2],n[2]].filter((e=>void 0!==e)),author:n[1]}:void 0}bi({},{finishReactionEvent:()=>Ss,getReactedEventPointer:()=>As});function Os(e,t){let n=[];(t.kind||-1)>=0&&n.push(`kind=${t.kind}`),t.until&&n.push(`created_at<${t.until}`),t.since&&n.push(`created_at>${t.since}`);let r=n.join("&");if(""===r)throw new Error("refusing to create a delegation without any conditions");let o=En(_i.encode(`nostr:delegation:${t.pubkey}:${r}`)),i=cn(en.sign(o,e));return{from:vi(e),to:t.pubkey,cond:r,sig:i}}function Cs(e){let t=e.tags.find((e=>"delegation"===e[0]&&e.length>=4));if(!t)return null;let n=t[1],r=t[2],o=t[3],i=r.split("&");for(let t=0;t"===r&&e.created_at>parseInt(o)))return null}let s=En(_i.encode(`nostr:delegation:${e.pubkey}:${r}`));return en.verify(o,s,n)?n:null}bi({},{createDelegation:()=>Os,getDelegator:()=>Cs});bi({},{matchAll:()=>Is,regex:()=>Ps,replaceAll:()=>Ls});var Ps=()=>new RegExp(`\\b${xs.source}\\b`,"g");function*Is(e){const t=e.matchAll(Ps());for(const e of t)try{const[t,n]=e;yield{uri:t,value:n,decoded:Gi(n),start:e.index,end:e.index+t.length}}catch(e){}}function Ls(e,t){return e.replaceAll(Ps(),((e,n)=>t({uri:e,value:n,decoded:Gi(n)})))}var js;bi({},{useFetchImplementation:()=>Ts,validateGithub:()=>Bs});try{js=fetch}catch{}function Ts(e){js=e}async function Bs(e,t,n){try{return await(await js(`https://gist.github.com/${t}/${n}/raw`)).text()===`Verifying that I control the following Nostr public key: ${e}`}catch(e){return!1}}bi({},{authenticate:()=>Ns});var Rs,$s,Us,Ns=async({challenge:e,relay:t,sign:n})=>{const r={kind:22242,created_at:Math.floor(Date.now()/1e3),tags:[["relay",t.url],["challenge",e]],content:""},o=t.auth(await n(r));return new Promise(((e,t)=>{o.on("ok",(function t(){o.off("ok",t),e()})),o.on("failed",(function e(n){o.off("failed",e),t(n)}))}))},Hs={};bi(Hs,{getZapEndpoint:()=>qs,makeZapReceipt:()=>zs,makeZapRequest:()=>Fs,useFetchImplementation:()=>Ms,validateZapRequest:()=>Ds});try{Rs=fetch}catch{}function Ms(e){Rs=e}async function qs(e){try{let t="",{lud06:n,lud16:r}=JSON.parse(e.content);if(n){let{words:e}=Yn.decode(n,1e3),r=Yn.fromWords(e);t=mi.decode(r)}else{if(!r)return null;{let[e,n]=r.split("@");t=`https://${n}/.well-known/lnurlp/${e}`}}let o=await Rs(t),i=await o.json();if(i.allowsNostr&&i.nostrPubkey)return i.callback}catch(e){}return null}function Fs({profile:e,event:t,amount:n,relays:r,comment:o=""}){if(!n)throw new Error("amount not given");if(!e)throw new Error("profile not given");let i={kind:9734,created_at:Math.round(Date.now()/1e3),content:o,tags:[["p",e],["amount",n.toString()],["relays",...r]]};return t&&i.tags.push(["e",t]),i}function Ds(e){let t;try{t=JSON.parse(e)}catch(e){return"Invalid zap request JSON."}if(!Ii(t))return"Zap request is not a valid Nostr event.";if(!Li(t))return"Invalid signature on zap request.";let n=t.tags.find((([e,t])=>"p"===e&&t));if(!n)return"Zap request doesn't have a 'p' tag.";if(!n[1].match(/^[a-f0-9]{64}$/))return"Zap request 'p' tag is not valid hex.";let r=t.tags.find((([e,t])=>"e"===e&&t));return r&&!r[1].match(/^[a-f0-9]{64}$/)?"Zap request 'e' tag is not valid hex.":t.tags.find((([e,t])=>"relays"===e&&t))?null:"Zap request doesn't have a 'relays' tag."}function zs({zapRequest:e,preimage:t,bolt11:n,paidAt:r}){let o=JSON.parse(e).tags.filter((([e])=>"e"===e||"p"===e||"a"===e)),i={kind:9735,created_at:Math.round(r.getTime()/1e3),content:"",tags:[...o,["bolt11",n],["description",e]]};return t&&i.tags.push(["preimage",t]),i}const Ks="undefined"!=typeof WebSocket?WebSocket:Us?$s:(Us=1,$s=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")});function Gs(e,t={}){if(!(this instanceof Gs))return new Gs(e,t);this.url=e,this.opts=t,null==t.reconnect&&(t.reconnect=!0);const n=this;return n.onfn={},Ws(n).catch((e=>{n.onfn.error&&n.onfn.error(e)})),this}function Ws(e){return new Promise(((t,n)=>{const r=e.ws=new Ks(e.url);let o=!1;r.onmessage=t=>{!function(e,t){let n;try{n=JSON.parse(t.data)}catch(e){return void console.error("handle_nostr_message",e)}if(n.length>=2)switch(n[0]){case"EVENT":if(n.length<3)return;return e.onfn.event&&e.onfn.event(n[1],n[2]);case"EOSE":return e.onfn.eose&&e.onfn.eose(n[1]);case"NOTICE":return e.onfn.notice&&e.onfn.notice(...n.slice(1));case"OK":e.onfn.ok&&e.onfn.ok(...n.slice(1))}}(e,t),e.onfn.message&&e.onfn.message(t)},r.onclose=t=>{if(e.onfn.close&&e.onfn.close(t),e.reconnecting)return n(new Error("close during reconnect"));!e.manualClose&&e.opts.reconnect&&Ys(e)},r.onerror=t=>{if(e.onfn.error&&e.onfn.error(t),e.reconnecting)return n(new Error("error during reconnect"));e.opts.reconnect&&Ys(e)},r.onopen=n=>{e.onfn.open&&e.onfn.open(n),o||(o=!0,t(e))}}))}function Vs(e){return new Promise((t=>setTimeout(t,e)))}async function Ys(e){let t=100;try{e.reconnecting=!0,await Ws(e),e.reconnecting=!1}catch{await Vs(t),t*=1.5}}Gs.prototype.wait_connected=async function(e){let t=1e3;for(;;){if(1===this.ws.readyState)return;await Vs(t),t*=1.5}},Gs.prototype.on=function(e,t){return this.onfn[e]=t,this},Gs.prototype.close=function(){this.ws&&(this.manualClose=!0,this.ws.close())},Gs.prototype.subscribe=function(e,t){Array.isArray(t)?this.send(["REQ",e,...t]):this.send(["REQ",e,t])},Gs.prototype.unsubscribe=function(e){this.send(["CLOSE",e])},Gs.prototype.send=async function(e){await this.wait_connected(),this.ws.send(JSON.stringify(e))};const Zs=Gs;function Js(e,t){if(!(this instanceof Js))return new Js(e,t);this.onfn={},this.relays=[],this.opts=t;for(const t of e)this.add(t);return this}Js.prototype.close=function(){for(const e of this.relays)e.close()},Js.prototype.on=function(e,t){for(const n of this.relays)this.onfn[e]=t,n.onfn[e]=t.bind(null,n);return this},Js.prototype.has=function(e){for(const t of this.relays)if(t.url===e)return!0;return!1},Js.prototype.send=function(e,t){const n=t?this.find_relays(t):this.relays;for(const t of n)t.send(e)},Js.prototype.setupHandlers=function(){const e=Object.keys(this.onfn);for(const t of e)for(const e of this.relays)e.onfn[t]=this.onfn[t].bind(null,e)},Js.prototype.remove=function(e){let t=0;for(const n of this.relays){if(n.url===e)return n.ws&&n.ws.close(),this.relays=this.replays.splice(t,1),!0;t+=1}return!1},Js.prototype.subscribe=function(e,t,n){const r=n?this.find_relays(n):this.relays;for(const n of r)n.subscribe(e,t)},Js.prototype.unsubscribe=function(e,t){const n=t?this.find_relays(t):this.relays;for(const t of n)t.unsubscribe(e)},Js.prototype.add=function(e){if(e instanceof Zs)return!this.has(e.url)&&(this.relays.push(e),this.setupHandlers(),!0);if(this.has(e))return!1;const t=Zs(e,this.opts);return this.relays.push(t),this.setupHandlers(),!0},Js.prototype.find_relays=function(e){if(e instanceof Zs)return[e];if(0===e.length)return[];if(!e[0])throw new Error("what!?");return e[0]instanceof Zs?e:this.relays.reduce(((t,n)=>(e.some((e=>n.url===e))&&t.push(n),t)),[])};var Qs=Qn(Js);function Xs(){}function ea(){ea.init.call(this)}function ta(e){return void 0===e._maxListeners?ea.defaultMaxListeners:e._maxListeners}function na(e,t,n,r){var o,i,s,a;if("function"!=typeof n)throw new TypeError('"listener" argument must be a function');if((i=e._events)?(i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),s=i[t]):(i=e._events=new Xs,e._eventsCount=0),s){if("function"==typeof s?s=i[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),!s.warned&&(o=ta(e))&&o>0&&s.length>o){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+t+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,"function"==typeof console.warn?console.warn(a):console.log(a)}}else s=i[t]=n,++e._eventsCount;return e}function ra(e,t,n){var r=!1;function o(){e.removeListener(t,o),r||(r=!0,n.apply(e,arguments))}return o.listener=n,o}function oa(e){var t=this._events;if(t){var n=t[e];if("function"==typeof n)return 1;if(n)return n.length}return 0}function ia(e,t){for(var n=new Array(t);t--;)n[t]=e[t];return n}let sa;Xs.prototype=Object.create(null),ea.EventEmitter=ea,ea.usingDomains=!1,ea.prototype.domain=void 0,ea.prototype._events=void 0,ea.prototype._maxListeners=void 0,ea.defaultMaxListeners=10,ea.init=function(){this.domain=null,ea.usingDomains&&undefined.active,this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=new Xs,this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},ea.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw new TypeError('"n" argument must be a positive number');return this._maxListeners=e,this},ea.prototype.getMaxListeners=function(){return ta(this)},ea.prototype.emit=function(e){var t,n,r,o,i,s,a,c="error"===e;if(s=this._events)c=c&&null==s.error;else if(!c)return!1;if(a=this.domain,c){if(t=arguments[1],!a){if(t instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}return t||(t=new Error('Uncaught, unspecified "error" event')),t.domainEmitter=this,t.domain=a,t.domainThrown=!1,a.emit("error",t),!1}if(!(n=s[e]))return!1;var l="function"==typeof n;switch(r=arguments.length){case 1:!function(e,t,n){if(t)e.call(n);else for(var r=e.length,o=ia(e,r),i=0;i0;)if(n[i]===t||n[i].listener&&n[i].listener===t){s=n[i].listener,o=i;break}if(o<0)return this;if(1===n.length){if(n[0]=void 0,0==--this._eventsCount)return this._events=new Xs,this;delete r[e]}else!function(e,t){for(var n=t,r=n+1,o=e.length;r0?Reflect.ownKeys(this._events):[]};const aa=new Uint8Array(16);function ca(){if(!sa&&(sa="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!sa))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return sa(aa)}const ua=[];for(let e=0;e<256;++e)ua.push((e+256).toString(16).slice(1));var la={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ha(e,t,n){if(la.randomUUID&&!t&&!e)return la.randomUUID();const r=(e=e||{}).random||(e.rng||ca)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return function(e,t=0){return(ua[e[t+0]]+ua[e[t+1]]+ua[e[t+2]]+ua[e[t+3]]+"-"+ua[e[t+4]]+ua[e[t+5]]+"-"+ua[e[t+6]]+ua[e[t+7]]+"-"+ua[e[t+8]]+ua[e[t+9]]+"-"+ua[e[t+10]]+ua[e[t+11]]+ua[e[t+12]]+ua[e[t+13]]+ua[e[t+14]]+ua[e[t+15]]).toLowerCase()}(r)}function fa(){throw new Error("setTimeout has not been defined")}function da(){throw new Error("clearTimeout has not been defined")}var pa=fa,ya=da;function ga(e){if(pa===setTimeout)return setTimeout(e,0);if((pa===fa||!pa)&&setTimeout)return pa=setTimeout,setTimeout(e,0);try{return pa(e,0)}catch(t){try{return pa.call(null,e,0)}catch(t){return pa.call(this,e,0)}}}"function"==typeof g.setTimeout&&(pa=setTimeout),"function"==typeof g.clearTimeout&&(ya=clearTimeout);var ba,wa=[],va=!1,ma=-1;function _a(){va&&ba&&(va=!1,ba.length?wa=ba.concat(wa):ma=-1,wa.length&&xa())}function xa(){if(!va){var e=ga(_a);va=!0;for(var t=wa.length;t;){for(ba=wa,wa=[];++ma1)for(var n=1;n=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}return Ra=function(a,c){c=c||{};var u=typeof a;if("string"===u&&a.length>0)return function(s){if((s=String(s)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(s);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*i;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*r;case"hours":case"hour":case"hrs":case"hr":case"h":return c*n;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(a);if("number"===u&&isFinite(a))return c.long?function(o){var i=Math.abs(o);if(i>=r)return s(o,i,r,"day");if(i>=n)return s(o,i,n,"hour");if(i>=t)return s(o,i,t,"minute");if(i>=e)return s(o,i,e,"second");return o+" ms"}(a):function(o){var i=Math.abs(o);if(i>=r)return Math.round(o/r)+"d";if(i>=n)return Math.round(o/n)+"h";if(i>=t)return Math.round(o/t)+"m";if(i>=e)return Math.round(o/e)+"s";return o+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))}}var Ma=function(e){function t(e){let r,o,i,s=null;function a(...e){if(!a.enabled)return;const n=a,o=Number(new Date),i=o-(r||o);n.diff=i,n.prev=r,n.curr=o,r=o,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,o)=>{if("%%"===r)return"%";s++;const i=t.formatters[o];if("function"==typeof i){const t=e[s];r=i.call(n,t),e.splice(s,1),s--}return r})),t.formatArgs.call(n,e);(n.log||t.log).apply(n,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(o!==t.namespaces&&(o=t.namespaces,i=t.enabled(e)),i),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(r),...t.skips.map(r).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),o=r.length;for(n=0;n{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t{"%%"!==e&&(r++,"%c"===e&&(o=r))})),t.splice(o,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==Ua&&"env"in Ua&&(e=Ua.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=Ma(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(Na,Na.exports);var qa=Qn(Na.exports),Fa={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function o(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function i(e,t,r,i,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var a=new o(r,i||e,s),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function a(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),a.prototype.eventNames=function(){var e,r,o=[];if(0===this._eventsCount)return o;for(r in e=this._events)t.call(e,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(e)):o},a.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,s=new Array(i);o>18&63]+Ga[o>>12&63]+Ga[o>>6&63]+Ga[63&o]);return i.join("")}function Qa(e){var t;Ya||Za();for(var n=e.length,r=n%3,o="",i=[],s=16383,a=0,c=n-r;ac?c:a+s));return 1===r?(t=e[n-1],o+=Ga[t>>2],o+=Ga[t<<4&63],o+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],o+=Ga[t>>10],o+=Ga[t>>4&63],o+=Ga[t<<2&63],o+="="),i.push(o),i.join("")}function Xa(e,t,n,r,o){var i,s,a=8*o-r-1,c=(1<>1,l=-7,h=n?o-1:0,f=n?-1:1,d=e[t+h];for(h+=f,i=d&(1<<-l)-1,d>>=-l,l+=a;l>0;i=256*i+e[t+h],h+=f,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=r;l>0;s=256*s+e[t+h],h+=f,l-=8);if(0===i)i=1-u;else{if(i===c)return s?NaN:1/0*(d?-1:1);s+=Math.pow(2,r),i-=u}return(d?-1:1)*s*Math.pow(2,i-r)}function ec(e,t,n,r,o,i){var s,a,c,u=8*i-o-1,l=(1<>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:i-1,p=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),(t+=s+h>=1?f/c:f*Math.pow(2,1-h))*c>=2&&(s++,c/=2),s+h>=l?(a=0,s=l):s+h>=1?(a=(t*c-1)*Math.pow(2,o),s+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,o),s=0));o>=8;e[n+d]=255&a,d+=p,a/=256,o-=8);for(s=s<0;e[n+d]=255&s,d+=p,s/=256,u-=8);e[n+d-p]|=128*y}var tc={}.toString,nc=Array.isArray||function(e){return"[object Array]"==tc.call(e)};function rc(){return ic.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function oc(e,t){if(rc()=rc())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+rc().toString(16)+" bytes");return 0|e}function hc(e){return!(null==e||!e._isBuffer)}function fc(e,t){if(hc(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Hc(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Mc(e).length;default:if(r)return Hc(e).length;t=(""+t).toLowerCase(),r=!0}}function dc(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return Cc(this,t,n);case"utf8":case"utf-8":return kc(this,t,n);case"ascii":return Ac(this,t,n);case"latin1":case"binary":return Oc(this,t,n);case"base64":return Ec(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pc(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function pc(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function yc(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=ic.from(t,r)),hc(t))return 0===t.length?-1:gc(e,t,n,r,o);if("number"==typeof t)return t&=255,ic.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):gc(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function gc(e,t,n,r,o){var i,s=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;s=2,a/=2,c/=2,n/=2}function u(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var l=-1;for(i=n;ia&&(n=a-c),i=n;i>=0;i--){for(var h=!0,f=0;fo&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var s=0;s>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function Ec(e,t,n){return 0===t&&n===e.length?Qa(e):Qa(e.slice(t,n))}function kc(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:u>223?3:u>191?2:1;if(o+h<=n)switch(h){case 1:u<128&&(l=u);break;case 2:128==(192&(i=e[o+1]))&&(c=(31&u)<<6|63&i)>127&&(l=c);break;case 3:i=e[o+1],s=e[o+2],128==(192&i)&&128==(192&s)&&(c=(15&u)<<12|(63&i)<<6|63&s)>2047&&(c<55296||c>57343)&&(l=c);break;case 4:i=e[o+1],s=e[o+2],a=e[o+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(c=(15&u)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(l=c)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),o+=h}return function(e){var t=e.length;if(t<=Sc)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),""},ic.prototype.compare=function(e,t,n,r,o){if(!hc(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),a=Math.min(i,s),c=this.slice(r,o),u=e.slice(t,n),l=0;lo)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return bc(this,e,t,n);case"utf8":case"utf-8":return wc(this,e,t,n);case"ascii":return vc(this,e,t,n);case"latin1":case"binary":return mc(this,e,t,n);case"base64":return _c(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xc(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},ic.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Sc=4096;function Ac(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;or)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function Lc(e,t,n,r,o,i){if(!hc(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function jc(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function Tc(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function Bc(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Rc(e,t,n,r,o){return o||Bc(e,0,n,4),ec(e,t,n,r,23,4),n+4}function $c(e,t,n,r,o){return o||Bc(e,0,n,8),ec(e,t,n,r,52,8),n+8}ic.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},ic.prototype.readUInt8=function(e,t){return t||Ic(e,1,this.length),this[e]},ic.prototype.readUInt16LE=function(e,t){return t||Ic(e,2,this.length),this[e]|this[e+1]<<8},ic.prototype.readUInt16BE=function(e,t){return t||Ic(e,2,this.length),this[e]<<8|this[e+1]},ic.prototype.readUInt32LE=function(e,t){return t||Ic(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},ic.prototype.readUInt32BE=function(e,t){return t||Ic(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},ic.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||Ic(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},ic.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||Ic(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},ic.prototype.readInt8=function(e,t){return t||Ic(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},ic.prototype.readInt16LE=function(e,t){t||Ic(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},ic.prototype.readInt16BE=function(e,t){t||Ic(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},ic.prototype.readInt32LE=function(e,t){return t||Ic(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},ic.prototype.readInt32BE=function(e,t){return t||Ic(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},ic.prototype.readFloatLE=function(e,t){return t||Ic(e,4,this.length),Xa(this,e,!0,23,4)},ic.prototype.readFloatBE=function(e,t){return t||Ic(e,4,this.length),Xa(this,e,!1,23,4)},ic.prototype.readDoubleLE=function(e,t){return t||Ic(e,8,this.length),Xa(this,e,!0,52,8)},ic.prototype.readDoubleBE=function(e,t){return t||Ic(e,8,this.length),Xa(this,e,!1,52,8)},ic.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||Lc(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},ic.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||Lc(this,e,t,1,255,0),ic.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},ic.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||Lc(this,e,t,2,65535,0),ic.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):jc(this,e,t,!0),t+2},ic.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||Lc(this,e,t,2,65535,0),ic.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):jc(this,e,t,!1),t+2},ic.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||Lc(this,e,t,4,4294967295,0),ic.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Tc(this,e,t,!0),t+4},ic.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||Lc(this,e,t,4,4294967295,0),ic.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Tc(this,e,t,!1),t+4},ic.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);Lc(this,e,t,n,o-1,-o)}var i=0,s=1,a=0;for(this[t]=255&e;++i>0)-a&255;return t+n},ic.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);Lc(this,e,t,n,o-1,-o)}var i=n-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+n},ic.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||Lc(this,e,t,1,127,-128),ic.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},ic.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||Lc(this,e,t,2,32767,-32768),ic.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):jc(this,e,t,!0),t+2},ic.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||Lc(this,e,t,2,32767,-32768),ic.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):jc(this,e,t,!1),t+2},ic.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||Lc(this,e,t,4,2147483647,-2147483648),ic.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Tc(this,e,t,!0),t+4},ic.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||Lc(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),ic.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Tc(this,e,t,!1),t+4},ic.prototype.writeFloatLE=function(e,t,n){return Rc(this,e,t,!0,n)},ic.prototype.writeFloatBE=function(e,t,n){return Rc(this,e,t,!1,n)},ic.prototype.writeDoubleLE=function(e,t,n){return $c(this,e,t,!0,n)},ic.prototype.writeDoubleBE=function(e,t,n){return $c(this,e,t,!1,n)},ic.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!ic.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function Mc(e){return function(e){var t,n,r,o,i,s;Ya||Za();var a=e.length;if(a%4>0)throw new Error("Invalid string. Length must be a multiple of 4");i="="===e[a-2]?2:"="===e[a-1]?1:0,s=new Va(3*a/4-i),r=i>0?a-4:a;var c=0;for(t=0,n=0;t>16&255,s[c++]=o>>8&255,s[c++]=255&o;return 2===i?(o=Wa[e.charCodeAt(t)]<<2|Wa[e.charCodeAt(t+1)]>>4,s[c++]=255&o):1===i&&(o=Wa[e.charCodeAt(t)]<<10|Wa[e.charCodeAt(t+1)]<<4|Wa[e.charCodeAt(t+2)]>>2,s[c++]=o>>8&255,s[c++]=255&o),s}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(Uc,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function qc(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function Fc(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var Dc,zc,Kc={};var Gc,Wc,Vc,Yc,Zc={name:"websocket",description:"Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.",keywords:["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],author:"Brian McKelvey (https://github.com/theturtle32)",contributors:["Iñaki Baz Castillo (http://dev.sipdoc.net)"],version:"1.0.34",repository:{type:"git",url:"https://github.com/theturtle32/WebSocket-Node.git"},homepage:"https://github.com/theturtle32/WebSocket-Node",engines:{node:">=4.0.0"},dependencies:{bufferutil:"^4.0.1",debug:"^2.2.0","es5-ext":"^0.10.50","typedarray-to-buffer":"^3.1.5","utf-8-validate":"^5.0.2",yaeti:"^0.0.6"},devDependencies:{"buffer-equal":"^1.0.0",gulp:"^4.0.2","gulp-jshint":"^2.0.4","jshint-stylish":"^2.2.1",jshint:"^2.0.0",tape:"^4.9.1"},config:{verbose:!1},scripts:{test:"tape test/unit/*.js",gulp:"gulp"},main:"index",directories:{lib:"./lib"},browser:"lib/browser.js",license:"Apache-2.0"};function Jc(){if(Yc)return Vc;var e;if(Yc=1,"object"==typeof globalThis)e=globalThis;else try{e=function(){if(zc)return Dc;zc=1;var e=function(){if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;throw new Error("Unable to resolve global `this`")};return Dc=function(){if(this)return this;if("object"==typeof globalThis&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(t){return e()}try{return __global__||e()}finally{delete Object.prototype.__global__}}()}()}catch(e){}finally{if(e||"undefined"==typeof window||(e=window),!e)throw new Error("Could not determine global this")}var t=e.WebSocket||e.MozWebSocket,n=Wc?Gc:(Wc=1,Gc=Zc.version);function r(e,n){return n?new t(e,n):new t(e)}return t&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(e){Object.defineProperty(r,e,{get:function(){return t[e]}})})),Vc={w3cwebsocket:t?r:null,version:n}}var Qc,Xc,eu={},tu={},nu={},ru={},ou={},iu={};function su(){if(Xc)return ou;Xc=1;var e=Jn&&Jn.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(ou,"__esModule",{value:!0}),ou.Container=void 0;var t=function(){if(Qc)return iu;Qc=1,Object.defineProperty(iu,"__esModule",{value:!0}),iu.ForOfAdaptor=void 0;var e=function(){function e(e,t){this.it_=e,this.last_=t}return e.prototype.next=function(){if(this.it_.equals(this.last_))return{done:!0,value:void 0};var e=this.it_;return this.it_=this.it_.next(),{done:!1,value:e.value}},e.prototype[Symbol.iterator]=function(){return this},e}();return iu.ForOfAdaptor=e,iu}(),n=function(){function n(){}return n.prototype.empty=function(){return 0===this.size()},n.prototype.rbegin=function(){return this.end().reverse()},n.prototype.rend=function(){return this.begin().reverse()},n.prototype[Symbol.iterator]=function(){return new t.ForOfAdaptor(this.begin(),this.end())},n.prototype.toJSON=function(){var t,n,r=[];try{for(var o=e(this),i=o.next();!i.done;i=o.next()){var s=i.value;r.push(s)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return r},n}();return ou.Container=n,ou}var au,cu,uu={};function lu(){if(au)return uu;au=1;var e=Jn&&Jn.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};Object.defineProperty(uu,"__esModule",{value:!0}),uu.NativeArrayIterator=void 0;var t=function(){function t(e,t){this.data_=e,this.index_=t}return t.prototype.index=function(){return this.index_},Object.defineProperty(t.prototype,"value",{get:function(){return this.data_[this.index_]},enumerable:!1,configurable:!0}),t.prototype.prev=function(){return--this.index_,this},t.prototype.next=function(){return++this.index_,this},t.prototype.advance=function(e){return this.index_+=e,this},t.prototype.equals=function(e){return this.data_===e.data_&&this.index_===e.index_},t.prototype.swap=function(t){var n,r;n=e([t.data_,this.data_],2),this.data_=n[0],t.data_=n[1],r=e([t.index_,this.index_],2),this.index_=r[0],t.index_=r[1]},t}();return uu.NativeArrayIterator=t,uu}var hu,fu,du,pu={},yu={},gu={},bu={};function wu(){if(fu)return gu;fu=1;var e,t=Jn&&Jn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(gu,"__esModule",{value:!0}),gu.LogicError=void 0;var n=function(){if(hu)return bu;hu=1;var e,t=Jn&&Jn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(bu,"__esModule",{value:!0}),bu.Exception=void 0;var n=function(e){function n(t){var n=this.constructor,r=e.call(this,t)||this,o=n.prototype;return Object.setPrototypeOf?Object.setPrototypeOf(r,o):r.__proto__=o,r}return t(n,e),Object.defineProperty(n.prototype,"name",{get:function(){return this.constructor.name},enumerable:!1,configurable:!0}),n.prototype.what=function(){return this.message},n.prototype.toJSON=function(){return{name:this.name,message:this.message,stack:this.stack}},n}(Error);return bu.Exception=n,bu}(),r=function(e){function n(t){return e.call(this,t)||this}return t(n,e),n}(n.Exception);return gu.LogicError=r,gu}function vu(){if(du)return yu;du=1;var e,t=Jn&&Jn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(yu,"__esModule",{value:!0}),yu.InvalidArgument=void 0;var n=function(e){function n(t){return e.call(this,t)||this}return t(n,e),n}(wu().LogicError);return yu.InvalidArgument=n,yu}var mu,_u,xu,Eu={};function ku(){return _u||(_u=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ErrorGenerator=void 0;var t=vu(),n=function(){if(mu)return Eu;mu=1;var e,t=Jn&&Jn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(Eu,"__esModule",{value:!0}),Eu.OutOfRange=void 0;var n=function(e){function n(t){return e.call(this,t)||this}return t(n,e),n}(wu().LogicError);return Eu.OutOfRange=n,Eu}();!function(e){function r(e){if("string"==typeof e)return e;var t=e.constructor.name;return e.constructor.__MODULE&&(t="".concat(e.constructor.__MODULE,".").concat(t)),"std.".concat(t)}e.get_class_name=r,e.empty=function(e,t){return new n.OutOfRange("Error on ".concat(r(e),".").concat(t,"(): it's empty container."))},e.negative_index=function(e,t,o){return new n.OutOfRange("Error on ".concat(r(e),".").concat(t,"(): parametric index is negative -> (index = ").concat(o,")."))},e.excessive_index=function(e,t,o,i){return new n.OutOfRange("Error on ".concat(r(e),".").concat(t,"(): parametric index is equal or greater than size -> (index = ").concat(o,", size: ").concat(i,")."))},e.not_my_iterator=function(e,n){return new t.InvalidArgument("Error on ".concat(r(e),".").concat(n,"(): parametric iterator is not this container's own."))},e.erased_iterator=function(e,n){return new t.InvalidArgument("Error on ".concat(r(e),".").concat(n,"(): parametric iterator, it already has been erased."))},e.negative_iterator=function(e,t,o){return new n.OutOfRange("Error on ".concat(r(e),".").concat(t,"(): parametric iterator is directing negative position -> (index = ").concat(o,")."))},e.iterator_end_value=function(e,t){void 0===t&&(t="end");var o=r(e);return new n.OutOfRange("Error on ".concat(o,".Iterator.value: cannot access to the ").concat(o,".").concat(t,"().value."))},e.key_nout_found=function(e,t,o){throw new n.OutOfRange("Error on ".concat(r(e),".").concat(t,"(): unable to find the matched key -> ").concat(o))}}(e.ErrorGenerator||(e.ErrorGenerator={}))}(pu)),pu}function Su(){if(xu)return nu;xu=1;var e,t=Jn&&Jn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),n=Jn&&Jn.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},r=Jn&&Jn.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(ju,"__esModule",{value:!0}),ju.hash=void 0;var t=Ru();function n(e,t){return t^=e?1:0,t*=s}function r(e,t){return o(e.toString(),t)}function o(e,t){for(var n=0;n0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},n=Jn&&Jn.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},n=Jn&&Jn.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o=1&&i[0]instanceof Array?(r=function(){var r=i[0];e.push.apply(e,n([],t(r),!1))},o=i.slice(1)):i.length>=2&&i[0].next instanceof Function&&i[1].next instanceof Function?(r=function(){var t=i[0],n=i[1];e.assign(t,n)},o=i.slice(2)):(r=null,o=i),{ramda:r,tail:o}}}(e.IAssociativeContainer||(e.IAssociativeContainer={}))),Cu;var e,t,n}(),o=$u(),i=Mu();!function(e){e.construct=function(e,s,a){for(var c=[],u=3;u=1&&(h=p.tail[0]),p.tail.length>=2&&(f=p.tail[1])}a(h,f),null!==l&&l()}}(e.IHashContainer||(e.IHashContainer={}))}(Ou)),Ou}var Fu,Du={},zu={},Ku={};function Gu(){if(Fu)return Ku;Fu=1,Object.defineProperty(Ku,"__esModule",{value:!0}),Ku.ListIterator=void 0;var e=ku(),t=function(){function t(e,t,n){this.prev_=e,this.next_=t,this.value_=n}return t._Set_prev=function(e,t){e.prev_=t},t._Set_next=function(e,t){e.next_=t},t.prototype.prev=function(){return this.prev_},t.prototype.next=function(){return this.next_},Object.defineProperty(t.prototype,"value",{get:function(){return this._Try_value(),this.value_},enumerable:!1,configurable:!0}),t.prototype._Try_value=function(){if(void 0===this.value_&&!0===this.equals(this.source().end()))throw e.ErrorGenerator.iterator_end_value(this.source())},t.prototype.equals=function(e){return this===e},t}();return Ku.ListIterator=t,Ku}var Wu,Vu={};var Yu,Zu,Ju={};function Qu(){if(Yu)return Ju;Yu=1,Object.defineProperty(Ju,"__esModule",{value:!0}),Ju.next=Ju.prev=Ju.advance=Ju.distance=Ju.size=Ju.empty=void 0;var e=vu();function t(t,n){if(0===n)return t;if(t.advance instanceof Function)return t.advance(n);var r;if(n<0){if(!(t.prev instanceof Function))throw new e.InvalidArgument("Error on std.advance(): parametric iterator is not a bi-directional iterator, thus advancing to negative direction is not possible.");r=function(e){return e.prev()},n=-n}else r=function(e){return e.next()};for(;n-- >0;)t=r(t);return t}return Ju.empty=function(e){return e instanceof Array?0!==e.length:e.empty()},Ju.size=function(e){return e instanceof Array?e.length:e.size()},Ju.distance=function(e,t){if(e.index instanceof Function)return function(e,t){var n=e.index(),r=t.index();return e.base instanceof Function?n-r:r-n}(e,t);for(var n=0;!e.equals(t);e=e.next())++n;return n},Ju.advance=t,Ju.prev=function(e,n){return void 0===n&&(n=1),1===n?e.prev():t(e,-n)},Ju.next=function(e,n){return void 0===n&&(n=1),1===n?e.next():t(e,n)},Ju}function Xu(){if(Zu)return zu;Zu=1;var e,t=Jn&&Jn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),n=Jn&&Jn.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};Object.defineProperty(zu,"__esModule",{value:!0}),zu.ListContainer=void 0;var r=su(),o=Gu(),i=function(){if(Wu)return Vu;Wu=1,Object.defineProperty(Vu,"__esModule",{value:!0}),Vu.Repeater=void 0;var e=function(){function e(e,t){this.index_=e,this.value_=t}return e.prototype.index=function(){return this.index_},Object.defineProperty(e.prototype,"value",{get:function(){return this.value_},enumerable:!1,configurable:!0}),e.prototype.next=function(){return++this.index_,this},e.prototype.equals=function(e){return this.index_===e.index_},e}();return Vu.Repeater=e,Vu}(),s=lu(),a=Qu(),c=ku(),u=function(e){function r(){var t=e.call(this)||this;return t.end_=t._Create_iterator(null,null),t.clear(),t}return t(r,e),r.prototype.assign=function(e,t){this.clear(),this.insert(this.end(),e,t)},r.prototype.clear=function(){o.ListIterator._Set_prev(this.end_,this.end_),o.ListIterator._Set_next(this.end_,this.end_),this.begin_=this.end_,this.size_=0},r.prototype.resize=function(e){var t=e-this.size();t>0?this.insert(this.end(),t,void 0):t<0&&this.erase((0,a.advance)(this.end(),-t),this.end())},r.prototype.begin=function(){return this.begin_},r.prototype.end=function(){return this.end_},r.prototype.size=function(){return this.size_},r.prototype.push_front=function(e){this.insert(this.begin_,e)},r.prototype.push_back=function(e){this.insert(this.end_,e)},r.prototype.pop_front=function(){if(!0===this.empty())throw c.ErrorGenerator.empty(this.end_.source().constructor.name,"pop_front");this.erase(this.begin_)},r.prototype.pop_back=function(){if(!0===this.empty())throw c.ErrorGenerator.empty(this.end_.source().constructor.name,"pop_back");this.erase(this.end_.prev())},r.prototype.push=function(){for(var e=[],t=0;t=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(al,"__esModule",{value:!0}),al.HashBuckets=void 0;var t=function(){function t(e,t){this.fetcher_=e,this.hasher_=t,this.max_load_factor_=r,this.data_=[],this.size_=0,this.initialize()}return t.prototype.clear=function(){this.data_=[],this.size_=0,this.initialize()},t.prototype.rehash=function(t){var r,o,i,s;t=Math.max(t,n);for(var a=[],c=0;cthis.capacity()&&(e=Math.floor(e/this.max_load_factor_),this.rehash(e))},t.prototype.initialize=function(){for(var e=0;et&&this.reserve(2*t);var n=this.index(e);this.data_[n].push(e)},t.prototype.erase=function(e){for(var t=this.index(e),n=this.data_[t],r=0;r0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},o=Jn&&Jn.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};Object.defineProperty(e,"__esModule",{value:!0}),e.SetElementList=void 0;var o=Xu(),i=Gu(),s=rl(),a=function(e){function t(t){var n=e.call(this)||this;return n.associative_=t,n}return n(t,e),t.prototype._Create_iterator=function(e,n,r){return t.Iterator.create(this,e,n,r)},t._Swap_associative=function(e,t){var n;n=r([t.associative_,e.associative_],2),e.associative_=n[0],t.associative_=n[1]},t.prototype.associative=function(){return this.associative_},t}(o.ListContainer);e.SetElementList=a,function(e){var t=function(e){function t(t,n,r,o){var i=e.call(this,n,r,o)||this;return i.source_=t,i}return n(t,e),t.create=function(e,n,r,o){return new t(e,n,r,o)},t.prototype.reverse=function(){return new r(this)},t.prototype.source=function(){return this.source_.associative()},t}(i.ListIterator);e.Iterator=t;var r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype._Create_neighbor=function(e){return new t(e)},t}(s.ReverseIterator);e.ReverseIterator=r}(a=e.SetElementList||(e.SetElementList={})),e.SetElementList=a}(Du)),Du),c=function(){if(il)return sl;il=1;var e,t=Jn&&Jn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),n=Jn&&Jn.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},r=Jn&&Jn.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(sl,"__esModule",{value:!0}),sl.SetHashBuckets=void 0;var o=function(e){function o(t,n,r){var o=e.call(this,i,n)||this;return o.source_=t,o.key_eq_=r,o}return t(o,e),o._Swap_source=function(e,t){var r;r=n([t.source_,e.source_],2),e.source_=r[0],t.source_=r[1]},o.prototype.key_eq=function(){return this.key_eq_},o.prototype.find=function(e){var t,n,o=this.hash_function()(e)%this.length(),i=this.at(o);try{for(var s=r(i),a=s.next();!a.done;a=s.next()){var c=a.value;if(this.key_eq_(c.value,e))return c}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return this.source_.end()},o}(cl().HashBuckets);function i(e){return e.value}return sl.SetHashBuckets=o,sl}(),u=fl(),l=function(e){function t(){for(var n=[],i=0;i0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},r=Jn&&Jn.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},o=Jn&&Jn.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s};Object.defineProperty(e,"__esModule",{value:!0}),e.MapElementList=void 0;var o=Xu(),i=Gu(),s=rl(),a=function(e){function t(t){var n=e.call(this)||this;return n.associative_=t,n}return n(t,e),t.prototype._Create_iterator=function(e,n,r){return t.Iterator.create(this,e,n,r)},t._Swap_associative=function(e,t){var n;n=r([t.associative_,e.associative_],2),e.associative_=n[0],t.associative_=n[1]},t.prototype.associative=function(){return this.associative_},t}(o.ListContainer);e.MapElementList=a,function(e){var t=function(e){function t(t,n,r,o){var i=e.call(this,n,r,o)||this;return i.list_=t,i}return n(t,e),t.create=function(e,n,r,o){return new t(e,n,r,o)},t.prototype.reverse=function(){return new r(this)},t.prototype.source=function(){return this.list_.associative()},Object.defineProperty(t.prototype,"first",{get:function(){return this.value.first},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"second",{get:function(){return this.value.second},set:function(e){this.value.second=e},enumerable:!1,configurable:!0}),t}(i.ListIterator);e.Iterator=t;var r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype._Create_neighbor=function(e){return new t(e)},Object.defineProperty(t.prototype,"first",{get:function(){return this.base_.first},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"second",{get:function(){return this.base_.second},set:function(e){this.base_.second=e},enumerable:!1,configurable:!0}),t}(s.ReverseIterator);e.ReverseIterator=r}(a=e.MapElementList||(e.MapElementList={})),e.MapElementList=a}(_l)),_l),c=function(){if(xl)return El;xl=1;var e,t=Jn&&Jn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)},function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),n=Jn&&Jn.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s},r=Jn&&Jn.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(El,"__esModule",{value:!0}),El.MapHashBuckets=void 0;var o=function(e){function o(t,n,r){var o=e.call(this,i,n)||this;return o.source_=t,o.key_eq_=r,o}return t(o,e),o._Swap_source=function(e,t){var r;r=n([t.source_,e.source_],2),e.source_=r[0],t.source_=r[1]},o.prototype.key_eq=function(){return this.key_eq_},o.prototype.find=function(e){var t,n,o=this.hash_function()(e)%this.length(),i=this.at(o);try{for(var s=r(i),a=s.next();!a.done;a=s.next()){var c=a.value;if(this.key_eq_(c.first,e))return c}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return this.source_.end()},o}(cl().HashBuckets);function i(e){return e.first}return El.MapHashBuckets=o,El}(),u=function(){if(kl)return Ol;kl=1,Object.defineProperty(Ol,"__esModule",{value:!0}),Ol.Entry=void 0;var e=$u(),t=Mu(),n=function(){function n(e,t){this.first=e,this.second=t}return n.prototype.equals=function(e){return(0,t.equal_to)(this.first,e.first)},n.prototype.less=function(e){return(0,t.less)(this.first,e.first)},n.prototype.hashCode=function(){return(0,e.hash)(this.first)},n}();return Ol.Entry=n,Ol}(),l=fl(),h=function(e){function t(){for(var n=[],i=0;i=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}};Object.defineProperty(eu,"__esModule",{value:!0});var t=dl(),n=Cl(),r=function(){function r(){this.listeners_=new n.HashMap,this.created_at_=new Date}return r.prototype.dispatchEvent=function(t){var n,r,o=this.listeners_.find(t.type);if(!o.equals(this.listeners_.end())){t.target=this,t.timeStamp=(new Date).getTime()-this.created_at_.getTime();try{for(var i=e(o.second),s=i.next();!s.done;s=i.next())(0,s.value)(t)}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}},r.prototype.addEventListener=function(e,n){var r=this.listeners_.find(e);r.equals(this.listeners_.end())&&(r=this.listeners_.emplace(e,new t.HashSet).first),r.second.insert(n)},r.prototype.removeEventListener=function(e,t){var n=this.listeners_.find(e);n.equals(this.listeners_.end())||(n.second.erase(t),n.second.empty()&&this.listeners_.erase(n))},r}();return eu.EventTarget=r,eu}(),s=Ll(),a=function(){if(jl)return Tl;jl=1;var e,t=Jn&&Jn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)},function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(Tl,"__esModule",{value:!0});var n=function(e){function n(t,n){return e.call(this,t,n)||this}return t(n,e),n}(Ll().Event);return Tl.CloseEvent=n,Tl}(),c=function(){if(Bl)return Rl;Bl=1;var e,t=Jn&&Jn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)},function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(Rl,"__esModule",{value:!0});var n=function(e){function n(t,n){return e.call(this,t,n)||this}return t(n,e),n}(Ll().Event);return Rl.MessageEvent=n,Rl}(),u=function(){if($l)return Nl;$l=1;var e,t=Jn&&Jn.__extends||(e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)},function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)});Object.defineProperty(Nl,"__esModule",{value:!0});var n=function(e){function n(t,n){return e.call(this,t,n)||this}return t(n,e),n}(Ll().Event);return Nl.ErrorEvent=n,Nl}(),l=function(e){function t(n,r){var i=e.call(this)||this;return i.on_={},i.state_=t.CONNECTING,i.client_=new o.client,i.client_.on("connect",i._Handle_connect.bind(i)),i.client_.on("connectFailed",i._Handle_error.bind(i)),"string"==typeof r&&(r=[r]),i.client_.connect(n,r),i}return n(t,e),t.prototype.close=function(e,n){this.state_=t.CLOSING,void 0===e?this.connection_.sendCloseFrame():this.connection_.sendCloseFrame(e,n,!0)},t.prototype.send=function(e){if("string"==typeof e.valueOf())this.connection_.sendUTF(e);else{var t=void 0;t=e instanceof ic?e:e instanceof Blob?new ic(e,"blob"):e.buffer?new ic(e.buffer):new ic(e),this.connection_.sendBytes(t)}},Object.defineProperty(t.prototype,"url",{get:function(){return this.client_.url.href},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"protocol",{get:function(){return this.client_.protocols?this.client_.protocols[0]:""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"extensions",{get:function(){return this.connection_&&this.connection_.extensions?this.connection_.extensions[0].name:""},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"readyState",{get:function(){return this.state_},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bufferedAmount",{get:function(){return this.connection_.bytesWaitingToFlush},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"binaryType",{get:function(){return"arraybuffer"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onopen",{get:function(){return this.on_.open},set:function(e){this._Set_on("open",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onclose",{get:function(){return this.on_.close},set:function(e){this._Set_on("close",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onmessage",{get:function(){return this.on_.message},set:function(e){this._Set_on("message",e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"onerror",{get:function(){return this.on_.error},set:function(e){this._Set_on("error",e)},enumerable:!0,configurable:!0}),t.prototype._Set_on=function(e,t){this.on_[e]&&this.removeEventListener(e,this.on_[e]),this.addEventListener(e,t),this.on_[e]=t},t.prototype._Handle_connect=function(e){this.connection_=e,this.state_=t.OPEN,this.connection_.on("message",this._Handle_message.bind(this)),this.connection_.on("error",this._Handle_error.bind(this)),this.connection_.on("close",this._Handle_close.bind(this));var n=new s.Event("open",h);this.dispatchEvent(n)},t.prototype._Handle_close=function(e,n){var o=new a.CloseEvent("close",r({},h,{code:e,reason:n}));this.state_=t.CLOSED,this.dispatchEvent(o)},t.prototype._Handle_message=function(e){var t=new c.MessageEvent("message",r({},h,{data:e.binaryData?e.binaryData:e.utf8Data}));this.dispatchEvent(t)},t.prototype._Handle_error=function(e){var n=new u.ErrorEvent("error",r({},h,{error:e,message:e.message}));this.state_===t.CONNECTING&&(this.state_=t.CLOSED),this.dispatchEvent(n)},t}(i.EventTarget);e.WebSocket=l,function(e){e.CONNECTING=0,e.OPEN=1,e.CLOSING=2,e.CLOSED=3}(l=e.WebSocket||(e.WebSocket={})),e.WebSocket=l;var h={bubbles:!1,cancelable:!1}}(Kc)),Kc).WebSocket);const{bech32:Hl,hex:Ml,utf8:ql}=zr,Fl={bech32:"bc",pubKeyHash:0,scriptHash:5,validWitnessVersions:[0]},Dl={bech32:"tb",pubKeyHash:111,scriptHash:196,validWitnessVersions:[0]},zl={bech32:"bcrt",pubKeyHash:111,scriptHash:196,validWitnessVersions:[0]},Kl={bech32:"sb",pubKeyHash:63,scriptHash:123,validWitnessVersions:[0]},Gl=["option_data_loss_protect","initial_routing_sync","option_upfront_shutdown_script","gossip_queries","var_onion_optin","gossip_queries_ex","option_static_remotekey","payment_secret","basic_mpp","option_support_large_channel"],Wl={m:BigInt(1e3),u:BigInt(1e6),n:BigInt(1e9),p:BigInt(1e12)},Vl=BigInt("2100000000000000000"),Yl=BigInt(1e11),Zl={payment_hash:1,payment_secret:16,description:13,payee:19,description_hash:23,expiry:6,min_final_cltv_expiry:24,fallback_address:9,route_hint:3,feature_bits:5,metadata:27},Jl={};for(let e=0,t=Object.keys(Zl);eMl.encode(Hl.fromWordsUnsafe(e)),16:e=>Ml.encode(Hl.fromWordsUnsafe(e)),13:e=>ql.encode(Hl.fromWordsUnsafe(e)),19:e=>Ml.encode(Hl.fromWordsUnsafe(e)),23:e=>Ml.encode(Hl.fromWordsUnsafe(e)),27:e=>Ml.encode(Hl.fromWordsUnsafe(e)),6:eh,24:eh,3:function(e){const t=[];let n,r,o,i,s,a=Hl.fromWordsUnsafe(e);for(;a.length>0;)n=Ml.encode(a.slice(0,33)),r=Ml.encode(a.slice(33,41)),o=parseInt(Ml.encode(a.slice(41,45)),16),i=parseInt(Ml.encode(a.slice(45,49)),16),s=parseInt(Ml.encode(a.slice(49,51)),16),a=a.slice(51),t.push({pubkey:n,short_channel_id:r,fee_base_msat:o,fee_proportional_millionths:i,cltv_expiry_delta:s});return t},5:function(e){const t=e.slice().reverse().map((e=>[!!(1&e),!!(2&e),!!(4&e),!!(8&e),!!(16&e)])).reduce(((e,t)=>e.concat(t)),[]);for(;t.length<2*Gl.length;)t.push(!1);const n={};Gl.forEach(((e,r)=>{let o;o=t[2*r]?"required":t[2*r+1]?"supported":"unsupported",n[e]=o}));const r=t.slice(2*Gl.length);return n.extra_bits={start_bit:2*Gl.length,bits:r,has_required:r.reduce(((e,t,n)=>n%2!=0?e||!1:e||t),!1)},n}};function Xl(e){return t=>({tagCode:parseInt(e),words:Hl.encode("unknown",t,Number.MAX_SAFE_INTEGER)})}function eh(e){return e.reverse().reduce(((e,t,n)=>e+t*Math.pow(32,n)),0)}function th(e,t){let n,r;if(e.slice(-1).match(/^[munp]$/))n=e.slice(-1),r=e.slice(0,-1);else{if(e.slice(-1).match(/^[^munp0-9]$/))throw new Error("Not a valid multiplier for the amount");r=e}if(!r.match(/^\d+$/))throw new Error("Not a valid human readable amount");const o=BigInt(r),i=n?o*Yl/Wl[n]:o*Yl;if("p"===n&&o%BigInt(10)!==BigInt(0)||i>Vl)throw new Error("Amount is outside of valid range");return t?i.toString():i}var nh={decode:function(e,t){if("string"!=typeof e)throw new Error("Lightning Payment Request must be string");if("ln"!==e.slice(0,2).toLowerCase())throw new Error("Not a proper lightning payment request");const n=[],r=Hl.decode(e,Number.MAX_SAFE_INTEGER);e=e.toLowerCase();const o=r.prefix;let i=r.words,s=e.slice(o.length+1),a=i.slice(-104);i=i.slice(0,-104);let c=o.match(/^ln(\S+?)(\d*)([a-zA-Z]?)$/);if(c&&!c[2]&&(c=o.match(/^ln(\S+)$/)),!c)throw new Error("Not a proper lightning payment request");n.push({name:"lightning_network",letters:"ln"});const u=c[1];let l;if(t){if(void 0===t.bech32||void 0===t.pubKeyHash||void 0===t.scriptHash||!Array.isArray(t.validWitnessVersions))throw new Error("Invalid network");l=t}else switch(u){case Fl.bech32:l=Fl;break;case Dl.bech32:l=Dl;break;case zl.bech32:l=zl;break;case Kl.bech32:l=Kl}if(!l||l.bech32!==u)throw new Error("Unknown coin bech32 prefix");n.push({name:"coin_network",letters:u,value:l});const h=c[2];let f;if(h){f=th(h+c[3],!0),n.push({name:"amount",letters:c[2]+c[3],value:f})}else f=null;n.push({name:"separator",letters:"1"});const d=eh(i.slice(0,7));let p,y,g,b;for(i=i.slice(7),n.push({name:"timestamp",letters:s.slice(0,7),value:d}),s=s.slice(7);i.length>0;){const e=i[0].toString();p=Jl[e]||"unknown_tag",y=Ql[e]||Xl(e),i=i.slice(1),g=eh(i.slice(0,2)),i=i.slice(2),b=i.slice(0,g),i=i.slice(g),n.push({name:p,tag:s[0],letters:s.slice(0,3+g),value:y(b)}),s=s.slice(3+g)}n.push({name:"signature",letters:s.slice(0,104),value:Ml.encode(Hl.fromWordsUnsafe(a))}),s=s.slice(104),n.push({name:"checksum",letters:s});let w={paymentRequest:e,sections:n,get expiry(){let e=n.find((e=>"expiry"===e.name));if(e)return v("timestamp")+e.value},get route_hints(){return n.filter((e=>"route_hint"===e.name)).map((e=>e.value))}};for(let e in Zl)"route_hint"!==e&&Object.defineProperty(w,e,{get:()=>v(e)});return w;function v(e){let t=n.find((t=>t.name===e));return t?t.value:void 0}},hrpToMillisat:th};var rh=["wss://nos.lol","wss://relay.nostr.band","wss://relay.f7z.io","wss://relay.damus.io","wss://nostr.mom","wss://no.str.cr"],oh=class extends Da{ndk;zappedEvent;zappedUser;constructor(e){super(),this.ndk=e.ndk,this.zappedEvent=e.zappedEvent,this.zappedUser=e.zappedUser||this.ndk.getUser({hexpubkey:this.zappedEvent.pubkey})}async getZapEndpoint(){let e,t,n,r;if(this.zappedEvent){const n=(await this.zappedEvent.getMatchingTags("zap"))[0];if(n)switch(n[2]){case"lud06":e=n[1];break;case"lud16":t=n[1];break;default:throw new Error(`Unknown zap tag ${n}`)}}if(!this.zappedUser||e||t||(this.zappedUser.profile||await this.zappedUser.fetchProfile(),e=(this.zappedUser.profile||{}).lud06,t=(this.zappedUser.profile||{}).lud16),t){const[e,r]=t.split("@");n=`https://${r}/.well-known/lnurlp/${e}`}else if(e){const{words:t}=Yn.decode(e,1e3),r=Yn.fromWords(t);n=new TextDecoder("utf-8").decode(r)}if(!n)throw new Error("No zap endpoint found");const o=await fetch(n),i=await o.json();return i?.allowsNostr&&(i?.nostrPubkey||i?.nostrPubKey)&&(r=i.callback),r}async createZapRequest(e,t,n,r){const o=await this.getZapEndpoint();if(!o)throw new Error("No zap endpoint found");if(!this.zappedEvent)throw new Error("No zapped event found");const i=Hs.makeZapRequest({profile:this.zappedUser.hexpubkey(),event:null,amount:e,comment:t||"",relays:r??this.relays()});if(this.zappedEvent){const e=this.zappedEvent.tagReference();e&&i.tags.push(e)}i.tags.push(["lnurl",o]);const s=new ph(this.ndk,i);n&&(s.tags=s.tags.concat(n)),await s.sign();const a=await s.toNostrEvent(),c=await fetch(`${o}?`+new URLSearchParams({amount:e.toString(),nostr:JSON.stringify(a)}));return(await c.json()).pr}relays(){let e=[];return this.ndk?.pool?.relays&&(e=this.ndk.pool.urls()),e.length||(e=rh),e}};function ih(){if(void 0===this.kind)throw new Error("Kind not set");return this.kind>=1e4&&this.kind<2e4}function sh(){if(void 0===this.kind)throw new Error("Kind not set");return this.kind>=3e4&&this.kind<4e4}async function ah(){if(!this.ndk)throw new Error("NDK not set");const e=await this.ndk.fetchEvents({kinds:[3],authors:[this.hexpubkey()]});if(e){const t=new Set;return e.forEach((e=>{e.tags.forEach((e=>{if("p"===e[0])try{const n=Di.npubEncode(e[1]);t.add(n)}catch(e){}}))})),[...t].reduce(((e,t)=>{const n=new ch({npub:t});return n.ndk=this.ndk,e.add(n),e}),new Set)}return new Set}var ch=class{ndk;profile;npub="";relayUrls=[];constructor(e){e.npub&&(this.npub=e.npub),e.hexpubkey&&(this.npub=Di.npubEncode(e.hexpubkey)),e.relayUrls&&(this.relayUrls=e.relayUrls)}static async fromNip05(e){const t=await as.queryProfile(e);if(t)return new ch({hexpubkey:t.pubkey,relayUrls:t.relays})}hexpubkey(){return Di.decode(this.npub).data}async fetchProfile(e){if(!this.ndk)throw new Error("NDK not set");this.profile||(this.profile={});const t=await this.ndk.fetchEvents({kinds:[0],authors:[this.hexpubkey()]},e);if(t){Array.from(t).sort(((e,t)=>e.created_at-t.created_at)).forEach((e=>{try{this.profile=function(e,t){const n=JSON.parse(e.content);return Object.keys(n).forEach((e=>{switch(e){case"name":t.name=n.name;break;case"display_name":case"displayName":t.displayName=n.displayName||n.display_name;break;case"image":case"picture":t.image=n.image||n.picture;break;case"banner":t.banner=n.banner;break;case"bio":t.bio=n.bio;break;case"nip05":t.nip05=n.nip05;break;case"lud06":t.lud06=n.lud06;break;case"lud16":t.lud16=n.lud16;break;case"about":t.about=n.about;break;case"zapService":t.zapService=n.zapService;break;case"website":t.website=n.website;break;default:t[e]=n[e]}})),t}(e,this.profile)}catch(e){}}))}return t}follows=ah.bind(this);async relayList(){if(!this.ndk)throw new Error("NDK not set");const e=await this.ndk.fetchEvents({kinds:[10002],authors:[this.hexpubkey()]});return e||new Set}tagReference(){return["p",this.hexpubkey()]}async publish(){if(!this.ndk)throw new Error("No NDK instance found");this.ndk.assertSigner();const e=new ph(this.ndk,{kind:0,content:JSON.stringify(this.profile)});await e.publish()}async follow(e,t){if(!this.ndk)throw new Error("No NDK instance found");if(this.ndk.assertSigner(),t||(t=await this.follows()),t.has(e))return!1;t.add(e);const n=new ph(this.ndk,{kind:3});for(const e of t)n.tag(e);return await n.publish(),!0}};async function uh(e,t){if(!t){if(!this.ndk)throw new Error("No signer available");await this.ndk.assertSigner(),t=this.ndk.signer}if(!e){const t=this.getMatchingTags("p");if(1!==t.length)throw new Error("No recipient could be determined and no explicit recipient was provided");(e=new ch({hexpubkey:t[0][1]})).ndk=this.ndk}this.content=await t.encrypt(e,this.content)}async function lh(e,t){if(!t){if(!this.ndk)throw new Error("No signer available");await this.ndk.assertSigner(),t=this.ndk.signer}e||(e=this.author),this.content=await t.decrypt(e,this.content)}function hh(){return this.isParamReplaceable()?Di.naddrEncode({kind:this.kind,pubkey:this.pubkey,identifier:this.replaceableDTag()}):Di.noteEncode(this.tagId())}async function fh(e=!0,t){if(!t){if(!this.ndk)throw new Error("No NDK instance found");this.ndk.assertSigner(),t=this.ndk.signer}if(!t)throw new Error("No signer available");const n=await t.user(),r=new ph(this.ndk,{kind:dh(this),content:"",pubkey:n.hexpubkey()});return r.tag(this),16===r.kind&&r.tags.push(["k",`${this.kind}`]),await r.sign(t),e&&await r.publish(),r}function dh(e){return 1===e.kind?6:16}var ph=class extends Da{ndk;created_at;content="";tags=[];kind;id="";sig;pubkey="";relay;constructor(e,t){super(),this.created_at=t?.created_at,this.content=t?.content||"",this.tags=t?.tags||[],this.id=t?.id||"",this.sig=t?.sig,this.pubkey=t?.pubkey||"",this.kind=t?.kind}rawEvent(){return{created_at:this.created_at,content:this.content,tags:this.tags,kind:this.kind,pubkey:this.pubkey,id:this.id,sig:this.sig}}set author(e){this.pubkey=e.hexpubkey()}get author(){const e=new ch({hexpubkey:this.pubkey});return e.ndk=this.ndk,e}tag(e,t){const n=e.tagReference();if(t&&n.push(t),this.tags.push(n),e instanceof ph){const t=e.author;t&&this.pubkey!==t.hexpubkey()&&this.tag(t);for(const t of e.getMatchingTags("p"))t[1]!==this.pubkey&&(this.tags.find((e=>"p"===e[0]&&e[1]===t[1]))||this.tags.push(["p",t[1]]))}}async toNostrEvent(e){if(!e&&""===this.pubkey){const e=await(this.ndk?.signer?.user());this.pubkey=e?.hexpubkey()||""}this.created_at||(this.created_at=Math.floor(Date.now()/1e3));const t=this.rawEvent(),{content:n,tags:r}=this.generateTags();t.content=n||"",t.tags=r;try{this.id=Ci(t)}catch(e){}return this.id&&(t.id=this.id),this.sig&&(t.sig=this.sig),t}isReplaceable=ih.bind(this);isParamReplaceable=sh.bind(this);encode=hh.bind(this);encrypt=uh.bind(this);decrypt=lh.bind(this);getMatchingTags(e){return this.tags.filter((t=>t[0]===e))}tagValue(e){const t=this.getMatchingTags(e);if(0!==t.length)return t[0][1]}removeTag(e){this.tags=this.tags.filter((t=>t[0]!==e))}async sign(e){e||this.ndk?.assertSigner(),await this.generateTags(),this.isReplaceable()&&(this.created_at=Math.floor(Date.now()/1e3));const t=await this.toNostrEvent(),n=e||this.ndk?.signer;this.sig=await n.sign(t)}async publish(e){return this.sig||await this.sign(),this.ndk?.publish(this,e)}generateTags(){let e=[];const t=function(e,t=[]){return{content:e=e.replace(/(@|nostr:)(npub|nprofile|note|nevent)[a-zA-Z0-9]+/g,(e=>{try{const n=e.split(/(@|nostr:)/)[2],{type:r,data:o}=Di.decode(n);let i;switch(r){case"npub":i=["p",o];break;case"nprofile":i=["p",o.pubkey];break;case"nevent":i=["e",o.id];break;case"note":i=["e",o];break;default:return e}return t.find((e=>e[0]===i[0]&&e[1]===i[1]))||t.push(i),`nostr:${n}`}catch(t){return e}})),tags:t}}(this.content,this.tags),n=t.content;if(e=t.tags,this.kind&&this.kind>=3e4&&this.kind<=4e4){if(!this.getMatchingTags("d")[0]){const t=[...Array(16)].map((()=>Math.random().toString(36)[2])).join("");e.push(["d",t])}}return{content:n||"",tags:e}}replaceableDTag(){if(this.kind&&this.kind>=3e4&&this.kind<=4e4){const e=this.getMatchingTags("d")[0];return e?e[1]:""}throw new Error("Event is not a parameterized replaceable event")}tagId(){if(this.kind&&this.kind>=3e4&&this.kind<=4e4){const e=this.replaceableDTag();return`${this.kind}:${this.pubkey}:${e}`}return this.id}tagReference(){return this.isParamReplaceable()?["a",this.tagId()]:["e",this.tagId()]}filter(){return this.isParamReplaceable()?{"#a":[this.tagId()]}:{"#e":[this.tagId()]}}async zap(e,t,n){if(!this.ndk)throw new Error("No NDK instance found");this.ndk.assertSigner();const r=new oh({ndk:this.ndk,zappedEvent:this});return await r.createZapRequest(e,t,n)}async delete(e){if(!this.ndk)throw new Error("No NDK instance found");this.ndk.assertSigner();const t=new ph(this.ndk,{kind:5,content:e||""});return t.tag(this),await t.publish(),t}repost=fh.bind(this)},yh=class extends Da{url;scores;relay;_status;connectedAt;_connectionStats={attempts:0,success:0,durations:[]};complaining=!1;debug;activeSubscriptions=new Set;constructor(e){super(),this.url=e,this.relay=Fi(e),this.scores=new Map,this._status=3,this.debug=qa(`ndk:relay:${e}`),this.relay.on("connect",(()=>{this.updateConnectionStats.connected(),this.emit("connect"),this._status=1})),this.relay.on("disconnect",(()=>{this.updateConnectionStats.disconnected(),this.emit("disconnect"),1===this._status&&(this._status=3,this.handleReconnection())})),this.relay.on("notice",(e=>this.handleNotice(e)))}isFlapping(){const e=this._connectionStats.durations;if(e.length<10)return!1;const t=e.reduce(((e,t)=>e+t),0)/e.length,n=e.map((e=>Math.pow(e-t,2))).reduce(((e,t)=>e+t),0)/e.length;return Math.sqrt(n)<1e3}handleReconnection(){this.isFlapping()&&(this.emit("flapping",this,this._connectionStats),this._status=5),this.connectedAt&&Date.now()-this.connectedAt<5e3?setTimeout((()=>this.connect()),6e4):this.connect()}get status(){return this._status}async connect(){try{this.updateConnectionStats.attempt(),this._status=0,await this.relay.connect()}catch(e){throw this.debug("Failed to connect",e),this._status=3,e}}disconnect(){this._status=2,this.relay.close()}async handleNotice(e){(e.includes("oo many")||e.includes("aximum"))&&(this.disconnect(),setTimeout((()=>this.connect()),2e3),console.log(this.relay.url,"Relay complaining?",e)),this.emit("notice",this,e)}subscribe(e){const{filter:t}=e,n=this.relay.sub([t],{id:e.subId});this.debug(`Subscribed to ${JSON.stringify(t)}`),n.on("event",(t=>{const n=new ph(void 0,t);n.relay=this,e.eventReceived(n,this)})),n.on("eose",(()=>{e.eoseReceived(this)}));const r=n.unsub;return n.unsub=()=>{this.debug(`Unsubscribing from ${JSON.stringify(t)}`),this.activeSubscriptions.delete(e),r()},this.activeSubscriptions.add(e),e.on("close",(()=>{this.activeSubscriptions.delete(e)})),n}async publish(e){const t=await e.toNostrEvent(),n=this.relay.publish(t);n.on("failed",(t=>{this.debug("Publish failed",t,e.rawEvent())})),n.on("ok",(()=>{this.debug("Publish ok",e.rawEvent())})),this.debug(`Published event ${e.id}`,e.rawEvent())}scoreSlowerEvent(e){}updateConnectionStats={connected:()=>{this._connectionStats.success++,this._connectionStats.connectedAt=Date.now()},disconnected:()=>{this._connectionStats.connectedAt&&(this._connectionStats.durations.push(Date.now()-this._connectionStats.connectedAt),this._connectionStats.durations.length>100&&this._connectionStats.durations.shift()),this._connectionStats.connectedAt=void 0},attempt:()=>{this._connectionStats.attempts++}};get connectionStats(){return this._connectionStats}},gh=class extends Da{relays=new Map;debug;constructor(e=[],t){super(),this.debug=t.debug.extend("pool");for(const t of e){const e=new yh(t);e.on("notice",((e,t)=>this.emit("notice",e,t))),e.on("connect",(()=>this.handleRelayConnect(t))),e.on("disconnect",(()=>this.emit("relay:disconnect",e))),e.on("flapping",(()=>this.handleFlapping(e))),this.relays.set(t,e)}}handleRelayConnect(e){this.debug(`Relay ${e} connected`),this.emit("relay:connect",this.relays.get(e)),this.stats().connected===this.relays.size&&this.emit("connect")}async connect(e){const t=[];this.debug(`Connecting to ${this.relays.size} relays${e?`, timeout ${e}...`:""}`);for(const n of this.relays.values())if(e){const r=new Promise(((t,n)=>{setTimeout((()=>n(`Timed out after ${e}ms`)),e)}));t.push(Promise.race([n.connect(),r]).catch((e=>{this.debug(`Failed to connect to relay ${n.url}: ${e}`)})))}else t.push(n.connect());await Promise.all(t)}handleFlapping(e){this.debug(`Relay ${e.url} is flapping`),this.relays.delete(e.url),this.emit("flapping",e)}size(){return this.relays.size}stats(){const e={total:0,connected:0,disconnected:0,connecting:0};for(const t of this.relays.values())e.total++,1===t.status?e.connected++:3===t.status?e.disconnected++:0===t.status&&e.connecting++;return e}urls(){return Array.from(this.relays.keys())}};var bh={closeOnEose:!0,cacheUsage:"CACHE_FIRST",groupable:!0,groupableDelay:100},wh=class extends Da{subId;filter;opts;relaySet;ndk;relaySubscriptions;debug;eventFirstSeen=new Map;eosesSeen=new Set;eventsPerRelay=new Map;constructor(e,t,n,r,o){if(super(),this.ndk=e,this.opts={...bh,...n||{}},this.subId=o||n?.subId||function(e){const t=Object.keys(e)||[],n=[];for(const r of t)if("kinds"===r){const t=[r,e.kinds.join(",")];n.push(t.join(":"))}else n.push(r);return n.push(Math.floor(999999999*Math.random()).toString()),n.join("-")}(t),this.filter=t,this.relaySet=r,this.relaySubscriptions=new Map,this.debug=e.debug.extend(`subscription:${this.subId}`),"ONLY_CACHE"===this.opts.cacheUsage&&!this.opts.closeOnEose)throw new Error("Cannot use cache-only options with a persistent subscription")}groupableId(){if(!this.opts?.groupable)return null;const e=(this.filter.kinds?.length||0)>0,t=!this.filter.since&&!this.filter.until,n=!this.filter.limit;if(e&&t&&n){let e=this.filter.kinds.join(",");return e+=`-${Object.keys(this.filter||{}).sort().join("-")}`,e}return null}shouldQueryCache(){return"ONLY_RELAY"!==this.opts?.cacheUsage}shouldQueryRelays(){return"ONLY_CACHE"!==this.opts?.cacheUsage}shouldWaitForCache(){return this.opts.closeOnEose&&!!this.ndk.cacheAdapter?.locking&&this.shouldQueryRelays()&&"PARALLEL"!==this.opts.cacheUsage}async start(){let e;if(this.shouldQueryCache()&&(e=this.startWithCache(),this.shouldWaitForCache()&&(await e,(t=this).filter.ids&&function(e){const t=e.filter.ids;return!!t&&t.length===e.eventFirstSeen.size}(t))))return this.debug("cache hit, fully filled: skipping relay query"),void this.emit("eose",this);var t;this.shouldQueryRelays()&&this.startWithRelaySet()}stop(){this.relaySubscriptions.forEach((e=>e.unsub())),this.relaySubscriptions.clear(),this.emit("close",this)}async startWithCache(){if(this.ndk.cacheAdapter?.query){const e=this.ndk.cacheAdapter.query(this);this.ndk.cacheAdapter.locking&&await e}}startWithRelaySet(){this.relaySet||(this.relaySet=function(e,t){const n=new Set;return e.pool?.relays.forEach((t=>{t.complaining?e.debug(`Relay ${t.url} is complaining, not adding to set`):n.add(t)})),new mh(n,e)}(this.ndk,this.filter)),this.relaySet&&this.relaySet.subscribe(this)}eventReceived(e,t,n=!1){if(!n&&t){let n=this.eventsPerRelay.get(t);n||(n=new Set,this.eventsPerRelay.set(t,n)),n.add(e.id);if(this.eventFirstSeen.has(e.id)){const n=Date.now()-(this.eventFirstSeen.get(e.id)||0);return t.scoreSlowerEvent(n),void this.emit("event:dup",e,t,n,this)}this.ndk.cacheAdapter&&this.ndk.cacheAdapter.setEvent(e,this.filter),this.eventFirstSeen.set(`${e.id}`,Date.now())}else this.eventFirstSeen.set(`${e.id}`,0);this.emit("event",e,t,this)}eoseTimeout;eoseReceived(e){this.opts?.closeOnEose&&(this.relaySubscriptions.get(e)?.unsub(),this.relaySubscriptions.delete(e),0===this.relaySubscriptions.size&&this.emit("close",this)),this.eosesSeen.add(e);this.eosesSeen.size===this.relaySet?.size()?this.emit("eose"):(this.eoseTimeout&&clearTimeout(this.eoseTimeout),this.eoseTimeout=setTimeout((()=>{this.emit("eose")}),500))}},vh=class extends wh{subscriptions;constructor(e,t){const n=e.debug.extend("subscription-group");super(e,function(e){const t={};return e.forEach((e=>{Object.entries(e).forEach((([e,n])=>{Array.isArray(n)?void 0===t[e]?t[e]=[...n]:t[e]=Array.from(new Set([...t[e],...n])):t[e]=n}))})),t}(t.map((e=>e.filter))),t[0].opts,t[0].relaySet),this.subscriptions=t,n("merged filters",{count:t.length,mergedFilters:this.filter}),this.on("event",this.forwardEvent),this.on("event:dup",this.forwardEventDup),this.on("eose",this.forwardEose),this.on("close",this.forwardClose)}isEventForSubscription(e,t){const{filter:n}=t;return!!n&&Bi(n,e.rawEvent())}forwardEvent(e,t){for(const n of this.subscriptions)this.isEventForSubscription(e,n)&&n.emit("event",e,t,n)}forwardEventDup(e,t,n){for(const r of this.subscriptions)this.isEventForSubscription(e,r)&&r.emit("event:dup",e,t,n,r)}forwardEose(){for(const e of this.subscriptions)e.emit("eose",e)}forwardClose(){for(const e of this.subscriptions)e.emit("close",e)}};var mh=class{relays;debug;ndk;constructor(e,t){this.relays=e,this.ndk=t,this.debug=t.debug.extend("relayset")}static fromRelayUrls(e,t){const n=new Set;for(const r of e){const e=t.pool.relays.get(r);e&&n.add(e)}return new mh(new Set(n),t)}subscribeOnRelay(e,t){const n=e.subscribe(t);t.relaySubscriptions.set(e,n)}getId(){const e=Array.from(this.relays).map((e=>e.url)).sort().join(",");return bo(Wo(e))}subscribe(e){const t=e.groupableId(),n=`${this.getId()}:${t}`;if(!t)return this.executeSubscription(e),e;const r=this.ndk.delayedSubscriptions.get(n);return r?r.push(e):(setTimeout((()=>{this.executeDelayedSubscription(n)}),e.opts.groupableDelay),this.ndk.delayedSubscriptions.set(n,[e])),e}executeDelayedSubscription(e){const t=this.ndk.delayedSubscriptions.get(e);this.ndk.delayedSubscriptions.delete(e),t&&(t.length>1?this.executeSubscriptions(t):this.executeSubscription(t[0]))}executeSubscriptions(e){const t=e[0].ndk,n=new vh(t,e);this.executeSubscription(n)}executeSubscription(e){this.debug("subscribing",{filter:e.filter});for(const t of this.relays)if(1===t.status)this.subscribeOnRelay(t,e);else{const n=()=>{this.debug("new relay coming online for active subscription",{relay:t.url,filter:e.filter}),this.subscribeOnRelay(t,e)};t.once("connect",n),e.once("close",(()=>{t.removeListener("connect",n)}))}return e}async publish(e){this.relays.forEach((async t=>{try{await t.publish(e)}catch(e){}}))}size(){return this.relays.size}};var _h=class extends Da{pool;signer;cacheAdapter;debug;devWriteRelaySet;delayedSubscriptions;constructor(e={}){super(),this.debug=e.debug||qa("ndk"),this.pool=new gh(e.explicitRelayUrls||[],this),this.signer=e.signer,this.cacheAdapter=e.cacheAdapter,this.delayedSubscriptions=new Map,e.devWriteRelayUrls&&(this.devWriteRelaySet=mh.fromRelayUrls(e.devWriteRelayUrls,this))}toJSON(){return{relayCount:this.pool.relays.size}.toString()}async connect(e){return this.debug("Connecting to relays",{timeoutMs:e}),this.pool.connect(e)}getUser(e){const t=new ch(e);return t.ndk=this,t}subscribe(e,t,n,r=!0){const o=new wh(this,e,t,n);return r&&o.start(),o}async publish(e,t){return t||(t=this.devWriteRelaySet||function(e,t){const n=new Set;return e.pool?.relays.forEach((e=>n.add(e))),new mh(n,e)}(this)),t.publish(e)}async fetchEvent(e,t={},n){let r;if(r="string"==typeof e?function(e){let t;try{switch(t=Di.decode(e),t.type){case"nevent":return{ids:[t.data.id]};case"note":return{ids:[t.data]};case"naddr":return{authors:[t.data.pubkey],"#d":[t.data.identifier],kinds:[t.data.kind]}}}catch(e){}return{ids:[e]}}(e):e,!r)throw new Error(`Invalid filter: ${JSON.stringify(e)}`);return new Promise((e=>{const o=this.subscribe(r,{...t,closeOnEose:!0},n,!1);o.on("event",(t=>{t.ndk=this,e(t)})),o.on("eose",(()=>{e(null)})),o.start()}))}async fetchEvents(e,t={},n){return new Promise((r=>{const o=new Map,i=this.subscribe(e,{...t,closeOnEose:!0},n,!1);i.on("event",(e=>{const t=o.get(e.tagId());var n,r;t&&(r=e,e=(n=t).created_at>r.created_at?n:r),e.ndk=this,o.set(e.tagId(),e)})),i.on("eose",(()=>{r(new Set(o.values()))})),i.start()}))}async assertSigner(){if(!this.signer)throw this.emit("signerRequired"),new Error("Signer required")}};new qa("nostr:adapter");const xh=new qa("nostr:adapter:profiles"),Eh=new qa("nostr:adapter:write");class kh{relayStatus={};#e=null;#t={};#n=new ea;#r={};tags;referenceTags;type;#o;chatId;relayUrls=[];#i=[];#s=[];#a;#c={};#u={};constructor(e,{tags:t,referenceTags:n,type:r="DM",chatId:o,websiteOwnerPubkey:i,relays:s}={}){this.pubkey=e,this.#o=i,this.relayUrls=s,r&&this.setChatConfiguration(r,t,n,o)}setChatConfiguration(e,t,n,r){this.type=e,this.tags=t,this.chatId=r,this.referenceTags=n,this.#e&&this.#l();let o=[];switch(this.type){case"DM":o.push({kinds:[4],"#p":[this.pubkey,this.#o],authors:[this.pubkey,this.#o]});break;case"GROUP":this.chatId&&o.push({kinds:[41,42],"#e":[this.chatId],limit:200});case"GLOBAL":this.tags&&this.tags.length>0&&o.push({kinds:[1],"#t":this.tags,limit:20}),this.referenceTags&&this.referenceTags.length>0&&o.push({kinds:[1],"#r":this.referenceTags,limit:20})}o&&o.length>0&&(this.#h(),this.subscribe(o,(e=>{this.#f(e)})))}async getPubKey(){return this.pubkey}on(e,t){this.#n.on(e,t)}async send(e,{tagPubKeys:t,tags:n}={}){let r;n||(n=[]),r="DM"===this.type?await this.sendKind4(e,{tagPubKeys:t,tags:n}):"GROUP"===this.type?await this.sendKind42(e,{tagPubKeys:t,tags:n,chatId:this.chatId}):await this.sendKind1(e,{tagPubKeys:t,tags:n}),r.id=Ci(r);const o=await this.signEvent(r);return this.#d(o),r.id}async sendKind4(e,{tagPubKeys:t,tags:n}={}){let r=await this.encrypt(this.#o,e);return{kind:4,pubkey:this.pubkey,created_at:Math.floor(Date.now()/1e3),content:r,tags:[["p",this.#o],...n]}}async sendKind42(e,{tagPubKeys:t,tags:n,chatId:r}={}){n||(n=[]),this.tags&&this.tags.forEach((e=>n.push(["t",e])));const o=!!n.find((e=>"e"===e[0]));o||n.push(["e",r,"wss://nos.lol",o?"reply":"root"]),this.referenceTags&&this.referenceTags.forEach((e=>n.push(["r",e])));let i={kind:42,created_at:Math.floor(Date.now()/1e3),tags:n,content:e,pubkey:this.pubkey};if(t)for(let e of t)e&&i.tags.push(["p",e]);return i.id=Ci(i),this.subscribeToEventAndResponses(i.id),i}async sendKind1(e,{tagPubKeys:t,tags:n}={}){n||(n=[]),this.tags&&this.tags.forEach((e=>n.push(["t",e]))),this.referenceTags&&this.referenceTags.forEach((e=>n.push(["r",e])));let r={kind:1,created_at:Math.floor(Date.now()/1e3),tags:n,content:e,pubkey:this.pubkey};if(t)for(let e of t)e&&r.tags.push(["p",e]);return r.id=Ci(r),this.subscribeToEventAndResponses(r.id),r}async#d(e){Eh("publish",e),this.#e.send(["EVENT",e])}async onEvent(e,t){this.#p(e.pubkey),t(e)}async delayedSubscribe(e,t,n){this.#c[t]=this.#c[t]||[],this.#c[t].push(e),this.#u[t]||(this.#u[t]=setTimeout((()=>{delete this.#u[t];let e=this.#c[t];delete this.#c[t];let n=[];n=e.reduce(((e,t,n)=>(n%10==0&&e.push([]),e[e.length-1].push(t),e)),n),n.forEach((e=>{this.subscribe(e,(e=>{this.#f(e)}))}))}),n))}async subscribe(e,t=null){return t||(t=e=>{this.#f(e)}),this.#y(e,t)}async#y(e,t){const n=ha();return this.#r[n]=t,Array.isArray(e)||(e=[e]),this.#e.subscribe(n,e),this.#e.on("event",((e,t,n)=>{this.onEvent(n,this.#r[t])})),n}async#f(e){if(this.#t[e.id])return;this.#t[e.id]=!0,4===e.kind&&(e.content=await this.decrypt(this.#o,e.content));let t,n=[];if(5===e.kind&&(n=e.tags.filter((e=>"e"===e[0])).map((e=>e[1]))),9735===e.kind){t=function(e){const t=e.getMatchingTags("description")[0],n=e.getMatchingTags("bolt11")[0];let r,o;if(!t||!n||!n[1])return null;try{let e=t[1];if(e.startsWith("%")&&(e=decodeURIComponent(e)),""===e)return null;o=JSON.parse(e),r=nh.decode(n[1])}catch(e){return null}const i=r.sections.find((e=>"amount"===e.name));if(!i)return null;const s=parseInt(i.value);if(!s)return null;const a=o.content,c=o.pubkey,u=e.getMatchingTags("p")[0][1];let l=e.getMatchingTags("e")[0];l||(l=e.getMatchingTags("a")[0]);const h=l?l[1]:void 0;return{id:e.id,zapper:e.pubkey,zappee:c,zapped:u,zappedEvent:h,amount:s,comment:a}}(new ph(null,e)),console.log(`received a zap invoice: ${t}`,e)}switch(e.kind){case 1:case 42:case 4:this.#n.emit("message",e);break;case 41:this.#n.emit("channelMetadata",e);break;case 5:this.#n.emit("deleted",n);break;case 7:this.#n.emit("reaction",e);break;case 9735:this.#n.emit("zap",t);break;default:console.log("unknown event kind",e.kind,e)}}subscribeToEventAndResponses(e){this.subscribe([{ids:[e]},{"#e":[e]}],(e=>{this.#f(e)}))}subscribeToResponses(e){this.subscribe([{"#e":[e.id]}],(e=>{this.#f(e),this.subscribeToResponses(e)}))}#h(){this.relayUrls.forEach((e=>{this.relayStatus[e]="disconnected"})),this.#n.emit("connectivity",this.relayStatus),this.#e=new Qs(this.relayUrls),this.#e.on("open",(e=>{this.relayStatus[e.url]="connected",this.#n.emit("connectivity",this.relayStatus)})),this.#e.on("error",((e,t,n)=>{this.relayStatus[e.url]="error",this.#n.emit("connectivity",this.relayStatus),console.log("error from relay",e.url,t,n)})),this.#e.on("close",((e,t)=>{this.relayStatus[e.url]="closed",this.#n.emit("connectivity",this.relayStatus),console.log("error from relay",e.url,t)})),this.#e.on("notice",((e,t)=>{console.log("notice",e.url,t)}))}#l(){this.relayUrls.forEach((e=>{this.relayStatus[e]="disconnected"})),this.#n.emit("connectivity",this.relayStatus),this.#e.close(),this.#e=null}reqProfile(e){this.#p(e)}#p(e,t=null){this.#i.includes(e)||this.#s.includes(e)||(this.#i.push(e),this.#s.push(e),this.#a||(this.#a=setTimeout((()=>{this.#a=null,this.#g()}),500)))}async#g(){if(this.#i.length>0){xh("requesting profiles",this.#i);const e=await this.subscribe({kinds:[0],authors:this.#i},(e=>{this.#b(e)}));xh("subscribed to request",{subId:e}),this.#i=[],setTimeout((()=>{xh("unsubscribing from request",{subId:e}),this.#e.unsubscribe(e)}),5e3)}}#b(e){let t;xh("received profile",e);try{t=JSON.parse(e.content)}catch(t){return void xh("failed to parse profile",e)}this.#n.emit("profile",{pubkey:e.pubkey,profile:t})}}class Sh extends kh{constructor(e,t={}){super(e,t)}async signEvent(e){return await window.nostr.signEvent(e)}async encrypt(e,t){return await window.nostr.nip04.encrypt(e,t)}async decrypt(e,t){return await window.nostr.nip04.decrypt(e,t)}}function Ah(){Ah=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,o){var i=t&&t.prototype instanceof f?t:f,s=Object.create(i.prototype),a=new S(o||[]);return r(s,"_invoke",{value:_(e,n,a)}),s}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var h={};function f(){}function d(){}function p(){}var y={};c(y,i,(function(){return this}));var g=Object.getPrototypeOf,b=g&&g(g(A([])));b&&b!==t&&n.call(b,i)&&(y=b);var w=p.prototype=f.prototype=Object.create(y);function v(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){function o(r,i,s,a){var c=l(e[r],e,i);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==typeof h&&n.call(h,"__await")?t.resolve(h.__await).then((function(e){o("next",e,s,a)}),(function(e){o("throw",e,s,a)})):t.resolve(h).then((function(e){u.value=e,s(u)}),(function(e){return o("throw",e,s,a)}))}a(c.arg)}var i;r(this,"_invoke",{value:function(e,n){function r(){return new t((function(t,r){o(e,n,t,r)}))}return i=i?i.then(r,r):r()}})}function _(e,t,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return O()}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var a=x(s,n);if(a){if(a===h)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var c=l(e,t,n);if("normal"===c.type){if(r=n.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r="completed",n.method="throw",n.arg=c.arg)}}}function x(e,t){var n=t.method,r=e.iterator[n];if(void 0===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=void 0,x(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),h;var o=l(r,e.iterator,t.arg);if("throw"===o.type)return t.method="throw",t.arg=o.arg,t.delegate=null,h;var i=o.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function E(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function A(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var a=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(a&&c){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),k(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;k(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:A(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),h}},e}function Oh(e,t,n,r,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,o)}function Ch(e){return function(){var t=this,n=arguments;return new Promise((function(r,o){var i=e.apply(t,n);function s(e){Oh(i,r,o,s,a,"next",e)}function a(e){Oh(i,r,o,s,a,"throw",e)}s(void 0)}))}}function Ph(){return Ph=Object.assign?Object.assign.bind():function(e){for(var t=1;t(Ephemeral Keys)',c=k(),f&&f.c(),C(i,"class","bg-purple-800 hover:bg-purple-700 w-full p-4 rounded-xl text-center font-regular text-gray-200 svelte-cpjycc"),C(a,"class","bg-purple-800 hover:bg-purple-700 w-full p-4 rounded-xl text-center font-regular text-gray-200 svelte-cpjycc"),C(n,"class","flex flex-col gap-1 svelte-cpjycc")},m(e,r){w(e,n,r),h&&h.m(n,null),b(n,o),b(n,i),b(n,s),b(n,a),b(n,c),f&&f.m(n,null),u||(l=[A(i,"click",O(t[7])),A(a,"click",O(t[6]))],u=!0)},p(e,t){e[3]?f?f.p(e,t):(f=Jh(e),f.c(),f.m(n,null)):f&&(f.d(1),f=null)},d(e){e&&v(n),h&&h.d(),f&&f.d(),u=!1,r(l)}}}function Zh(t){let n,o,i,s,a,c,u;return{c(){n=_("p"),n.textContent="Scan this with your Nostr Connect (click to copy to clipboard)",o=k(),i=_("div"),i.innerHTML="",s=k(),a=_("button"),a.textContent="Cancel",C(n,"class","text-gray-600 mb-3 svelte-cpjycc"),C(i,"class","bg-white w-full p-3 svelte-cpjycc"),C(a,"class","bg-purple-800 hover:bg-purple-700 w-full p-2 rounded-xl text-center font-regular text-white svelte-cpjycc")},m(e,r){w(e,n,r),w(e,o,r),w(e,i,r),w(e,s,r),w(e,a,r),c||(u=[A(i,"click",O(t[8])),A(a,"click",O(t[15]))],c=!0)},p:e,d(e){e&&(v(n),v(o),v(i),v(s),v(a)),c=!1,r(u)}}}function Jh(e){let t,n,r,o,i,s=1==e[2]&&Qh(e);return{c(){t=_("button"),t.textContent="View Advanced",n=k(),s&&s.c(),r=S(),C(t,"class","text-purple-700 my-4 hover:underline text-xs svelte-cpjycc")},m(a,c){w(a,t,c),w(a,n,c),s&&s.m(a,c),w(a,r,c),o||(i=A(t,"click",e[16]),o=!0)},p(e,t){1==e[2]?s?s.p(e,t):(s=Qh(e),s.c(),s.m(r.parentNode,r)):s&&(s.d(1),s=null)},d(e){e&&(v(t),v(n),v(r)),s&&s.d(e),o=!1,i()}}}function Qh(t){let n,r,o;return{c(){n=_("button"),n.textContent="Reset Anonymous Keys",C(n,"class","bg-red-700 hover:bg-red-600 w-full p-4 rounded-xl text-center font-regular text-gray-200 svelte-cpjycc")},m(e,i){w(e,n,i),r||(o=A(n,"click",O(t[5])),r=!0)},p:e,d(e){e&&v(n),r=!1,o()}}}function Xh(t){let n,r,i,s,a,c,u,l,h;function f(e,t){return e[1]?Zh:Yh}let d=f(t),p=d&&d(t);return{c(){n=_("div"),r=_("h3"),r.textContent="How whould you like to connect?",i=k(),s=_("button"),s.innerHTML='',a=k(),c=_("div"),u=k(),p&&p.c(),C(r,"class","m-0 text-lg svelte-cpjycc"),C(s,"id","close-popup"),C(s,"class","bg-transparent border-none text-white cursor-pointer svelte-cpjycc"),C(n,"class","flex justify-between items-center p-4 bg-purple-700 text-white md:rounded-t-md svelte-cpjycc"),C(c,"class","flex-1 p-4 overflow-y-auto svelte-cpjycc")},m(e,f){w(e,n,f),b(n,r),b(n,i),b(n,s),w(e,a,f),w(e,c,f),b(c,u),p&&p.m(c,null),l||(h=A(s,"click",(function(){o(t[0])&&t[0].apply(this,arguments)})),l=!0)},p(e,[n]){d===(d=f(t=e))&&p?p.p(t,n):(p&&p.d(1),p=d&&d(t),p&&(p.c(),p.m(c,null)))},i:e,o:e,d(e){e&&(v(n),v(a),v(c)),p&&p.d(),l=!1,h()}}}function ef(e,t,n){let r,o,{firstStartupDone:i}=t,{managedLogin:s}=t,{startPage:a}=t,{websiteOwnerPubkey:c}=t,{chatConfiguration:u}=t,{relays:l}=t,{toggleChat:h}=t;function f(){window.nostr.getPublicKey().then((e=>{localStorage.setItem("nostrichat-type","nip07"),ce.set(new Sh(e,o))}))}T((()=>{const e=localStorage.getItem("nostrichat-type");"nip07"===e?f():"nip-46"===e&&y(),o={type:u.chatType,tags:u.chatTags,referenceTags:u.chatReferenceTags,websiteOwnerPubkey:c,relays:l},"chat"===a?(i(),ce.set(new Vh(o))):s()}));let d=!1,p=!1;async function y(){let e=localStorage.getItem("nostrichat-nostr-connect-key"),t=localStorage.getItem("nostrichat-nostr-connect-public-key");if(e)return void ce.set(new Wh(t,e,o));e=wi();const i=new Gh({secretKey:e,relay:"wss://nostr.vulpem.com"});let s,a,c;i.events.on("connect",(o=>{localStorage.setItem("nostrichat-nostr-connect-key",e),localStorage.setItem("nostrichat-nostr-connect-public-key",o),localStorage.setItem("nostrichat-type","nip-46"),console.log("connected to nostr connect relay"),t=o,ce.set(new Wh(t,e)),n(1,r=null)})),i.events.on("disconnect",(()=>{console.log("disconnected from nostr connect relay")})),await i.init();try{s=window.document.title||"Nostrichat",a=new URL(window.location.href),c=a.hostname}catch(e){a=window.location.href,c=a}const u=new Kh({target:vi(e),relay:"wss://nostr.vulpem.com",metadata:{name:s,description:"🔉🔉🔉",url:a}});n(1,r=u.toString())}(localStorage.getItem("nostrichat-discardable-key")||localStorage.getItem("nostrichat-discardable-public-key"))&&(p=!0);return e.$$set=e=>{"firstStartupDone"in e&&n(9,i=e.firstStartupDone),"managedLogin"in e&&n(10,s=e.managedLogin),"startPage"in e&&n(11,a=e.startPage),"websiteOwnerPubkey"in e&&n(12,c=e.websiteOwnerPubkey),"chatConfiguration"in e&&n(13,u=e.chatConfiguration),"relays"in e&&n(14,l=e.relays),"toggleChat"in e&&n(0,h=e.toggleChat)},[h,r,d,p,f,function(){localStorage.removeItem("nostrichat-discardable-key"),localStorage.removeItem("nostrichat-discardable-public-key"),n(3,p=!1)},async function(){ce.set(new Vh(o))},y,function(){navigator.clipboard.writeText(r)},i,s,a,c,u,l,()=>{n(1,r=null)},()=>n(2,d=!d)]}class tf extends ie{constructor(e){super(),oe(this,e,ef,Xh,i,{firstStartupDone:9,managedLogin:10,startPage:11,websiteOwnerPubkey:12,chatConfiguration:13,relays:14,toggleChat:0})}}var nf,rf={},of={},sf={},af=Jn&&Jn.__extends||(nf=function(e,t){return nf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},nf(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}nf(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});function cf(e,t,n){if(Object.setPrototypeOf(e,n.prototype),t===n)if(e.name=t.name,Error.captureStackTrace)Error.captureStackTrace(e,n);else{var r=new Error(e.message).stack;r&&(e.stack=function(e,t){if(!e)return e;if(!t)return e;var n=new RegExp("\\s+at\\s".concat(t,"\\s")),r=e.split("\n");return r.filter((function(e){return!e.match(n)})).join("\n")}(r,"new ".concat(t.name)))}}Object.defineProperty(sf,"__esModule",{value:!0}),sf.InternalError=sf.InvalidDataError=sf.RoutingError=sf.UnsupportedMethodError=sf.ConnectionError=sf.RejectionError=sf.MissingProviderError=void 0;var uf=function(e){function t(n){var r=this.constructor,o=e.call(this,n)||this;return cf(o,r,t),o}return af(t,e),t}(Error);sf.MissingProviderError=uf;var lf=function(e){function t(n){var r=this.constructor,o=e.call(this,n)||this;return cf(o,r,t),o}return af(t,e),t}(Error);sf.RejectionError=lf;var hf=function(e){function t(n){var r=this.constructor,o=e.call(this,n)||this;return cf(o,r,t),o}return af(t,e),t}(Error);sf.ConnectionError=hf;var ff=function(e){function t(n){var r=this.constructor,o=e.call(this,n)||this;return cf(o,r,t),o}return af(t,e),t}(Error);sf.UnsupportedMethodError=ff;var df=function(e){function t(n){var r=this.constructor,o=e.call(this,n)||this;return cf(o,r,t),o}return af(t,e),t}(Error);sf.RoutingError=df;var pf=function(e){function t(n){var r=this.constructor,o=e.call(this,n)||this;return cf(o,r,t),o}return af(t,e),t}(Error);sf.InvalidDataError=pf;var yf=function(e){function t(n){var r=this.constructor,o=e.call(this,n)||this;return cf(o,r,t),o}return af(t,e),t}(Error);sf.InternalError=yf,Object.defineProperty(of,"__esModule",{value:!0}),of.requestProvider=void 0;var gf=sf;of.requestProvider=function(e){return new Promise((function(e,t){if("undefined"==typeof window)return t(new Error("Must be called in a browser context"));var n=window.webln;if(!n)return t(new gf.MissingProviderError("Your browser has no WebLN provider"));n.enable().then((function(){return e(n)})).catch((function(e){return t(e)}))}))};var bf,wf,vf,mf={};function _f(e){let t,n,r=(e[2]||e[1])+"";return{c(){t=_("span"),n=E(r),C(t,"class","text-base text-white flex flex-col items-center")},m(e,r){w(e,t,r),b(t,n)},p(e,t){6&t&&r!==(r=(e[2]||e[1])+"")&&P(n,r)},d(e){e&&v(t)}}}function xf(e){let t,n;return{c(){t=_("span"),n=E(e[0]),C(t,"class","text-xl")},m(e,r){w(e,t,r),b(t,n)},p(e,t){1&t&&P(n,e[0])},d(e){e&&v(t)}}}function Ef(t){let n,o,i;function s(e,t){return e[3]?_f:xf}let a=s(t),c=a(t);return{c(){n=_("div"),c.c()},m(e,r){w(e,n,r),c.m(n,null),o||(i=[A(n,"mouseenter",t[7]),A(n,"mouseleave",t[8]),A(n,"click",O(t[4]))],o=!0)},p(e,[t]){a===(a=s(e))&&c?c.p(e,t):(c.d(1),c=a(e),c&&(c.c(),c.m(n,null)))},i:e,o:e,d(e){e&&v(n),c.d(),o=!1,r(i)}}}function kf(e,t,n){let r;c(e,he,(e=>n(9,r=e)));let{icon:o,amount:i,amountDisplay:s,event:a,mobilePR:u}=t,h=!1;return e.$$set=e=>{"icon"in e&&n(0,o=e.icon),"amount"in e&&n(1,i=e.amount),"amountDisplay"in e&&n(2,s=e.amountDisplay),"event"in e&&n(6,a=e.event),"mobilePR"in e&&n(5,u=e.mobilePR)},[o,i,s,h,async function(){const e=new class{_userPromise;nip04Queue=[];nip04Processing=!1;debug;constructor(){if(!window.nostr)throw new Error("NIP-07 extension not available");this.debug=qa("ndk:nip07")}async blockUntilReady(){const e=await(window.nostr?.getPublicKey());if(!e)throw new Error("User rejected access");return new ch({hexpubkey:e})}async user(){return this._userPromise||(this._userPromise=this.blockUntilReady()),this._userPromise}async sign(e){if(!window.nostr)throw new Error("NIP-07 extension not available");return(await window.nostr.signEvent(e)).sig}async encrypt(e,t){if(!window.nostr)throw new Error("NIP-07 extension not available");const n=e.hexpubkey();return this.queueNip04("encrypt",n,t)}async decrypt(e,t){if(!window.nostr)throw new Error("NIP-07 extension not available");const n=e.hexpubkey();return this.queueNip04("decrypt",n,t)}async queueNip04(e,t,n){return new Promise(((r,o)=>{this.nip04Queue.push({type:e,counterpartyHexpubkey:t,value:n,resolve:r,reject:o}),this.nip04Processing||this.processNip04Queue()}))}async processNip04Queue(e,t=0){if(!e&&0===this.nip04Queue.length)return void(this.nip04Processing=!1);this.nip04Processing=!0;const{type:n,counterpartyHexpubkey:r,value:o,resolve:i,reject:s}=e||this.nip04Queue.shift();this.debug("Processing encryption queue item",{type:n,counterpartyHexpubkey:r,value:o});try{let e;e="encrypt"===n?await window.nostr.nip04.encrypt(r,o):await window.nostr.nip04.decrypt(r,o),i(e)}catch(i){if(i.message&&i.message.includes("call already executing")&&t<5)return this.debug("Retrying encryption queue item",{type:n,counterpartyHexpubkey:r,value:o,retries:t}),void setTimeout((()=>{this.processNip04Queue(e,t+1)}),50*t);s(i)}this.processNip04Queue()}},t=new _h({explicitRelayUrls:["wss://nos.lol","wss://relay.nostr.band","wss://relay.damus.io","wss://nostr.mom","wss://no.str.cr"]});let o,s;t.signer=e,await t.connect();try{const e=new ph(t,a);o=await e.zap(1e3*i)}catch(e){return void alert(e)}try{s=await rf.requestProvider()}catch(e){return void n(5,u=o)}try{await s.sendPayment(o),l(he,r=null,r)}catch(e){n(5,u=o)}},u,a,()=>n(3,h=!0),()=>n(3,h=!1)]}Object.defineProperty(mf,"__esModule",{value:!0}),bf=rf,wf=Jn&&Jn.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),vf=Jn&&Jn.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||wf(t,e,n)},Object.defineProperty(bf,"__esModule",{value:!0}),vf(of,bf),vf(mf,bf),vf(sf,bf);class Sf extends ie{constructor(e){super(),oe(this,e,kf,Ef,i,{icon:0,amount:1,amountDisplay:2,event:6,mobilePR:5})}}function Af(e,t,n){const r=e.slice();return r[32]=t[n],r}function Of(t){let n;return{c(){n=E("⚡️")},m(e,t){w(e,n,t)},p:e,d(e){e&&v(n)}}}function Cf(e){let t,n,r,o,i=e[9]/1e3+"";return{c(){t=_("p"),n=E("⚡️\n "),r=_("span"),o=E(i),C(r,"class","text-orange-500 font-semibold svelte-cpjycc"),C(t,"class","flex flex-col items-center my-4 svelte-cpjycc")},m(e,i){w(e,t,i),b(t,n),b(t,r),b(r,o)},p(e,t){512&t[0]&&i!==(i=e[9]/1e3+"")&&P(o,i)},d(e){e&&v(t)}}}function Pf(e){let t,n,r,o;const i=[Lf,If],s=[];function a(e,t){return e[8]?0:1}return t=a(e),n=s[t]=i[t](e),{c(){n.c(),r=S()},m(e,n){s[t].m(e,n),w(e,r,n),o=!0},p(e,o){let c=t;t=a(e),t===c?s[t].p(e,o):(V(),J(s[c],1,1,(()=>{s[c]=null})),Y(),n=s[t],n?n.p(e,o):(n=s[t]=i[t](e),n.c()),Z(n,1),n.m(r.parentNode,r))},i(e){o||(Z(n),o=!0)},o(e){J(n),o=!1},d(e){e&&v(r),s[t].d(e)}}}function If(e){let t,n,r,o,i,s,a,c,u,l,h,f,d,p,y,g,m,x,E,S,A,O,P,I,L;function j(t){e[20](t)}let T={icon:"👍",amount:500,event:e[0]};function B(t){e[21](t)}void 0!==e[8]&&(T.mobilePR=e[8]),r=new Sf({props:T}),R.push((()=>X(r,"mobilePR",j)));let $={icon:"🤙",amount:2500,amountDisplay:"2.5k",event:e[0]};function U(t){e[22](t)}void 0!==e[8]&&($.mobilePR=e[8]),a=new Sf({props:$}),R.push((()=>X(a,"mobilePR",B)));let N={icon:"🙌",amount:5e3,amountDisplay:"5k",event:e[0]};function H(t){e[23](t)}void 0!==e[8]&&(N.mobilePR=e[8]),h=new Sf({props:N}),R.push((()=>X(h,"mobilePR",U)));let M={icon:"🧡",amount:1e4,amountDisplay:"10k",event:e[0]};function F(t){e[24](t)}void 0!==e[8]&&(M.mobilePR=e[8]),y=new Sf({props:M}),R.push((()=>X(y,"mobilePR",H)));let D={icon:"🤯",amount:1e5,amountDisplay:"100k",event:e[0]};function z(t){e[25](t)}void 0!==e[8]&&(D.mobilePR=e[8]),E=new Sf({props:D}),R.push((()=>X(E,"mobilePR",F)));let K={icon:"😎",amount:1e6,amountDisplay:"1M",event:e[0]};return void 0!==e[8]&&(K.mobilePR=e[8]),P=new Sf({props:K}),R.push((()=>X(P,"mobilePR",z))),{c(){t=_("div"),n=_("div"),ee(r.$$.fragment),i=k(),s=_("div"),ee(a.$$.fragment),u=k(),l=_("div"),ee(h.$$.fragment),d=k(),p=_("div"),ee(y.$$.fragment),m=k(),x=_("div"),ee(E.$$.fragment),A=k(),O=_("div"),ee(P.$$.fragment),C(n,"class","flex flex-col hover:bg-orange-500 text-white rounded-full w-12 h-12 items-center justify-center cursor-pointer svelte-cpjycc"),C(s,"class","flex flex-col hover:bg-orange-500 text-white rounded-full w-12 h-12 items-center justify-center cursor-pointer svelte-cpjycc"),C(l,"class","flex flex-col hover:bg-orange-500 text-white rounded-full w-12 h-12 items-center justify-center cursor-pointer svelte-cpjycc"),C(p,"class","flex flex-col hover:bg-orange-500 text-white rounded-full w-12 h-12 items-center justify-center cursor-pointer svelte-cpjycc"),C(x,"class","flex flex-col hover:bg-orange-500 text-white rounded-full w-12 h-12 items-center justify-center cursor-pointer svelte-cpjycc"),C(O,"class","flex flex-col hover:bg-orange-500 text-white rounded-full w-12 h-12 items-center justify-center cursor-pointer svelte-cpjycc"),C(t,"class","flex flex-row items-stretch justify-between w-full svelte-cpjycc")},m(e,o){w(e,t,o),b(t,n),te(r,n,null),b(t,i),b(t,s),te(a,s,null),b(t,u),b(t,l),te(h,l,null),b(t,d),b(t,p),te(y,p,null),b(t,m),b(t,x),te(E,x,null),b(t,A),b(t,O),te(P,O,null),L=!0},p(e,t){const n={};1&t[0]&&(n.event=e[0]),!o&&256&t[0]&&(o=!0,n.mobilePR=e[8],q((()=>o=!1))),r.$set(n);const i={};1&t[0]&&(i.event=e[0]),!c&&256&t[0]&&(c=!0,i.mobilePR=e[8],q((()=>c=!1))),a.$set(i);const s={};1&t[0]&&(s.event=e[0]),!f&&256&t[0]&&(f=!0,s.mobilePR=e[8],q((()=>f=!1))),h.$set(s);const u={};1&t[0]&&(u.event=e[0]),!g&&256&t[0]&&(g=!0,u.mobilePR=e[8],q((()=>g=!1))),y.$set(u);const l={};1&t[0]&&(l.event=e[0]),!S&&256&t[0]&&(S=!0,l.mobilePR=e[8],q((()=>S=!1))),E.$set(l);const d={};1&t[0]&&(d.event=e[0]),!I&&256&t[0]&&(I=!0,d.mobilePR=e[8],q((()=>I=!1))),P.$set(d)},i(e){L||(Z(r.$$.fragment,e),Z(a.$$.fragment,e),Z(h.$$.fragment,e),Z(y.$$.fragment,e),Z(E.$$.fragment,e),Z(P.$$.fragment,e),L=!0)},o(e){J(r.$$.fragment,e),J(a.$$.fragment,e),J(h.$$.fragment,e),J(y.$$.fragment,e),J(E.$$.fragment,e),J(P.$$.fragment,e),L=!1},d(e){e&&v(t),ne(r),ne(a),ne(h),ne(y),ne(E),ne(P)}}}function Lf(t){let n,r,o,i,s,a,c,u;return{c(){n=_("div"),r=_("a"),o=E("Open in wallet"),s=k(),a=_("button"),a.textContent="Cancel",C(r,"href",i=`lightning:${t[8]}`),C(r,"class","text-center w-full p-3 bg-black text-white rounded-t-xl svelte-cpjycc"),C(a,"class","bg-white rounder-b-xl p-3 svelte-cpjycc"),C(n,"class","flex flex-col gap-3 w-full svelte-cpjycc")},m(e,i){w(e,n,i),b(n,r),b(r,o),b(n,s),b(n,a),c||(u=A(a,"click",t[19]),c=!0)},p(e,t){256&t[0]&&i!==(i=`lightning:${e[8]}`)&&C(r,"href",i)},i:e,o:e,d(e){e&&v(n),c=!1,u()}}}function jf(e){let t,n;return{c(){t=_("div"),n=E(e[10]),C(t,"class","text-xs text-gray-400 svelte-cpjycc")},m(e,r){w(e,t,r),b(t,n)},p(e,t){1024&t[0]&&P(n,e[10])},d(e){e&&v(t)}}}function Tf(t){let n;return{c(){n=_("div"),n.textContent="Website owner",C(n,"class","text-purple-500 text-xs svelte-cpjycc")},m(e,t){w(e,n,t)},p:e,d(e){e&&v(n)}}}function Bf(e){let t,n,r=Q(e[1][e[0].id]),o=[];for(let t=0;tJ(o[e],1,1,(()=>{o[e]=null}));return{c(){t=_("div");for(let e=0;e0?Cf:Of}let G=K(e),W=G(e),Q=e[6]&&Pf(e);let X=function(e,t){return e[13]?Tf:jf}(e),ee=X(e),te=e[1][e[0].id].length>0&&Bf(e);return{c(){t=_("div"),n=_("div"),o=_("div"),i=_("a"),s=_("img"),l=k(),h=_("button"),W.c(),d=k(),p=_("div"),Q&&Q.c(),g=k(),m=_("div"),x=_("div"),I=k(),L=_("div"),j=E(z),B=k(),R=_("div"),$=_("div"),U=_("span"),U.textContent=`${e[14].toLocaleString()}`,N=k(),ee.c(),H=k(),te&&te.c(),M=S(),a(s.src,c=e[4])||C(s,"src",c),C(s,"class","block w-8 h-8 rounded-full "+(e[13]?"ring-purple-700 ring-4":"")+" svelte-cpjycc"),C(s,"alt",""),C(i,"href",u=`nostr:${e[5]}`),C(i,"class","svelte-cpjycc"),C(h,"class",f="rounded-full "+(e[9]>0?"opacity-100 text-base":"bg-orange-500 opacity-10 text-xl")+" w-8 h-8 flex items-center justify-center hover:opacity-100 svelte-cpjycc"),C(p,"class",y=(e[6]?"w-full rounded-full bg-white drop-shadow-xl justify-between border-2 border-gray-200":" rounded-full w-8 h-8 justify-center")+" flex items-center absolute ml-5 mt-10 z-10 svelte-cpjycc"),C(o,"class","min-w-fit flex flex-col gap-2 svelte-cpjycc"),C(x,"class","flex flex-row justify-between text-center overflow-clip text-clip w-full svelte-cpjycc"),C(L,"class",T="max-h-64 text-base cursor-pointer border border-slate-200 "+(e[11]===e[0].id?"bg-purple-700 text-white":"bg-white text-gray-900 hover:bg-slate-100")+" p-4 py-2 overflow-auto rounded-2xl shadow-sm svelte-cpjycc"),C(U,"class","py-2 svelte-cpjycc"),C($,"class","text-xs text-gray-400 text-ellipsis overflow-clip whitespace-nowrap svelte-cpjycc"),C(R,"class","flex flex-row-reverse justify-between mt-1 overflow-clip items-center relative svelte-cpjycc"),C(m,"class","w-full overflow-hidden svelte-cpjycc"),C(n,"class","flex flex-row gap-3 svelte-cpjycc"),C(t,"class","flex flex-col gap-4 p-2-lg mb-3 text-wrap relative svelte-cpjycc")},m(r,a){w(r,t,a),b(t,n),b(n,o),b(o,i),b(i,s),b(o,l),b(o,h),W.m(h,null),b(o,d),b(o,p),Q&&Q.m(p,null),b(n,g),b(n,m),b(m,x),b(m,I),b(m,L),b(L,j),b(m,B),b(m,R),b(R,$),b($,U),b(R,N),ee.m(R,null),w(r,H,a),te&&te.m(r,a),w(r,M,a),q=!0,F||(D=[A(h,"click",O(e[18])),A(L,"click",O(e[26])),A(L,"keydown",O(e[27])),A(L,"keyup",O(e[28])),A(t,"mouseenter",e[29]),A(t,"mouseleave",e[30])],F=!0)},p(e,t){(!q||16&t[0]&&!a(s.src,c=e[4]))&&C(s,"src",c),(!q||32&t[0]&&u!==(u=`nostr:${e[5]}`))&&C(i,"href",u),G===(G=K(e))&&W?W.p(e,t):(W.d(1),W=G(e),W&&(W.c(),W.m(h,null))),(!q||512&t[0]&&f!==(f="rounded-full "+(e[9]>0?"opacity-100 text-base":"bg-orange-500 opacity-10 text-xl")+" w-8 h-8 flex items-center justify-center hover:opacity-100 svelte-cpjycc"))&&C(h,"class",f),e[6]?Q?(Q.p(e,t),64&t[0]&&Z(Q,1)):(Q=Pf(e),Q.c(),Z(Q,1),Q.m(p,null)):Q&&(V(),J(Q,1,1,(()=>{Q=null})),Y()),(!q||64&t[0]&&y!==(y=(e[6]?"w-full rounded-full bg-white drop-shadow-xl justify-between border-2 border-gray-200":" rounded-full w-8 h-8 justify-center")+" flex items-center absolute ml-5 mt-10 z-10 svelte-cpjycc"))&&C(p,"class",y),(!q||1&t[0])&&z!==(z=e[0].content+"")&&P(j,z),(!q||2049&t[0]&&T!==(T="max-h-64 text-base cursor-pointer border border-slate-200 "+(e[11]===e[0].id?"bg-purple-700 text-white":"bg-white text-gray-900 hover:bg-slate-100")+" p-4 py-2 overflow-auto rounded-2xl shadow-sm svelte-cpjycc"))&&C(L,"class",T),ee.p(e,t),e[1][e[0].id].length>0?te?(te.p(e,t),3&t[0]&&Z(te,1)):(te=Bf(e),te.c(),Z(te,1),te.m(M.parentNode,M)):te&&(V(),J(te,1,1,(()=>{te=null})),Y())},i(e){q||(Z(Q),Z(te),q=!0)},o(e){J(Q),J(te),q=!1},d(e){e&&(v(t),v(H),v(M)),W.d(),Q&&Q.d(),ee.d(),te&&te.d(e),F=!1,r(D)}}}function Uf(e,t,n){let r,o,i,s,a,u;c(e,fe,(e=>n(16,o=e))),c(e,ce,(e=>n(31,i=e))),c(e,he,(e=>n(3,s=e))),c(e,ue,(e=>n(17,a=e))),c(e,le,(e=>n(11,u=e)));let h,f,d,p,y,{event:g}=t,{responses:b}=t,{websiteOwnerPubkey:w}=t,v={},m=0;function _(){u===g.id?l(le,u=null,u):l(le,u=g.id,u)}T((()=>{i.delayedSubscribe({kinds:[1,42,9735],"#e":[g.id]},"responses",500)}));const x=!!w===g.pubkey;var E;i.on("zap",(()=>{n(9,m=o[g.id]?.reduce(((e,t)=>e+t.amount),0)||0)})),E=()=>{n(9,m=o[g.id]?.reduce(((e,t)=>e+t.amount),0)||0)},j().$$.after_update.push(E);let k=new Date(1e3*g.created_at);return e.$$set=e=>{"event"in e&&n(0,g=e.event),"responses"in e&&n(1,b=e.responses),"websiteOwnerPubkey"in e&&n(2,w=e.websiteOwnerPubkey)},e.$$.update=()=>{if(131072&e.$$.dirty[0]&&n(15,v=a.profiles),32769&e.$$.dirty[0]&&n(10,r=v[g.pubkey]&&v[g.pubkey].display_name||`[${g.pubkey.slice(0,6)}]`),9&e.$$.dirty[0]&&n(6,d=s===g.id),1&e.$$.dirty[0])try{n(5,f=Di.npubEncode(g.pubkey))}catch(e){n(5,f=g.pubkey)}65537&e.$$.dirty[0]&&n(9,m=o[g.id]?.reduce(((e,t)=>e+t.amount),0)||0),32769&e.$$.dirty[0]&&n(4,h=v[g.pubkey]&&v[g.pubkey].picture||`https://robohash.org/${g.pubkey.slice(0,1)}.png?set=set1`)},[g,b,w,s,h,f,d,p,y,m,r,u,_,x,k,v,o,a,()=>l(he,s=s===g.id?null:g.id,s),()=>{l(he,s=null,s)},function(e){y=e,n(8,y)},function(e){y=e,n(8,y)},function(e){y=e,n(8,y)},function(e){y=e,n(8,y)},function(e){y=e,n(8,y)},function(e){y=e,n(8,y)},()=>{_(g.id)},()=>{_(g.id)},()=>{_(g.id)},()=>n(7,p=!0),()=>n(7,p=!1)]}class Nf extends ie{constructor(e){super(),oe(this,e,Uf,$f,i,{event:0,responses:1,websiteOwnerPubkey:2},null,[-1,-1])}}var Hf={$:e=>"string"==typeof e?document.querySelector(e):e,extend:(...e)=>Object.assign(...e),cumulativeOffset(e){let t=0,n=0;do{t+=e.offsetTop||0,n+=e.offsetLeft||0,e=e.offsetParent}while(e);return{top:t,left:n}},directScroll:e=>e&&e!==document&&e!==document.body,scrollTop(e,t){let n=void 0!==t;return this.directScroll(e)?n?e.scrollTop=t:e.scrollTop:n?document.documentElement.scrollTop=document.body.scrollTop=t:window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},scrollLeft(e,t){let n=void 0!==t;return this.directScroll(e)?n?e.scrollLeft=t:e.scrollLeft:n?document.documentElement.scrollLeft=document.body.scrollLeft=t:window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0}};const Mf={container:"body",duration:500,delay:0,offset:0,easing:function(e){return e<.5?4*e*e*e:.5*Math.pow(2*e-2,3)+1},onStart:e,onDone:e,onAborting:e,scrollX:!1,scrollY:!0},qf=e=>{let{offset:t,duration:n,delay:r,easing:o,x:i=0,y:s=0,scrollX:a,scrollY:c,onStart:u,onDone:l,container:h,onAborting:g,element:b}=e;"function"==typeof t&&(t=t());var w=Hf.cumulativeOffset(h),v=b?Hf.cumulativeOffset(b):{top:s,left:i},m=Hf.scrollLeft(h),_=Hf.scrollTop(h),x=v.left-w.left+t,E=v.top-w.top+t,k=x-m,S=E-_;let A=!0,O=!1,C=f()+r,P=C+n;function I(e){e||(O=!0,u(b,{x:i,y:s}))}function L(e){!function(e,t,n){a&&Hf.scrollLeft(e,n),c&&Hf.scrollTop(e,t)}(h,_+S*e,m+k*e)}function j(){A=!1}return function(e){let t;0===p.size&&d(y),new Promise((n=>{p.add(t={c:e,f:n})}))}((e=>{if(!O&&e>=C&&I(!1),O&&e>=P&&(L(1),j(),l(b,{x:i,y:s})),!A)return g(b,{x:i,y:s}),!1;if(O){L(0+1*o((e-C)/n))}return!0})),I(r),L(0),j},Ff=e=>{if(e&&e!==document&&e!==document.body)return e.scrollHeight-e.offsetHeight;{let e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)}},Df=e=>(e=(e=>{let t=Hf.extend({},Mf,e);return t.container=Hf.$(t.container),t.element=Hf.$(t.element),t})(e),qf(Hf.extend(e,{element:null,y:Ff(e.container)})));function zf(e,t,n){const r=e.slice();return r[30]=t[n],r}function Kf(e,t,n){const r=e.slice();return r[33]=t[n],r[35]=n,r}function Gf(e){let t;return{c(){t=E(e[10])},m(e,n){w(e,t,n)},p(e,n){1024&n[0]&&P(t,e[10])},d(e){e&&v(t)}}}function Wf(e){let t,n;return{c(){t=_("span"),C(t,"class",n="inline-block rounded-full "+(e[8]>e[35]?"bg-green-500":"bg-gray-300")+" w-2 h-2 svelte-cpjycc")},m(e,n){w(e,t,n)},p(e,r){256&r[0]&&n!==(n="inline-block rounded-full "+(e[8]>e[35]?"bg-green-500":"bg-gray-300")+" w-2 h-2 svelte-cpjycc")&&C(t,"class",n)},d(e){e&&v(t)}}}function Vf(e){let t,n,r,o,i,s,a=e[7].name+"",c=e[7].picture&&Yf(e),u=e[7].about&&Zf(e);return{c(){t=_("div"),c&&c.c(),n=k(),r=_("div"),o=_("div"),i=E(a),s=k(),u&&u.c(),C(o,"class","font-extrabold text-xl svelte-cpjycc"),C(r,"class","flex flex-col svelte-cpjycc"),C(t,"class","flex items-center p-4 bg-zinc-300 svelte-cpjycc")},m(e,a){w(e,t,a),c&&c.m(t,null),b(t,n),b(t,r),b(r,o),b(o,i),b(r,s),u&&u.m(r,null)},p(e,o){e[7].picture?c?c.p(e,o):(c=Yf(e),c.c(),c.m(t,n)):c&&(c.d(1),c=null),128&o[0]&&a!==(a=e[7].name+"")&&P(i,a),e[7].about?u?u.p(e,o):(u=Zf(e),u.c(),u.m(r,null)):u&&(u.d(1),u=null)},d(e){e&&v(t),c&&c.d(),u&&u.d()}}}function Yf(e){let t,n;return{c(){t=_("img"),a(t.src,n=e[7].picture)||C(t,"src",n),C(t,"class","w-12 h-12 rounded-full mr-2 svelte-cpjycc")},m(e,n){w(e,t,n)},p(e,r){128&r[0]&&!a(t.src,n=e[7].picture)&&C(t,"src",n)},d(e){e&&v(t)}}}function Zf(e){let t,n,r=e[7].about+"";return{c(){t=_("div"),n=E(r),C(t,"class","text-sm truncate font-regular svelte-cpjycc")},m(e,r){w(e,t,r),b(t,n)},p(e,t){128&t[0]&&r!==(r=e[7].about+"")&&P(n,r)},d(e){e&&v(t)}}}function Jf(e){let t,n;function r(e,n){return 2048&n[0]&&(t=null),null==t&&(t=!e[12](e[11])),t?Xf:Qf}let o=r(e,[-1,-1]),i=o(e);return{c(){i.c(),n=S()},m(e,t){i.m(e,t),w(e,n,t)},p(e,t){o===(o=r(e,t))&&i?i.p(e,t):(i.d(1),i=o(e),i&&(i.c(),i.m(n.parentNode,n)))},d(e){e&&v(n),i.d(e)}}}function Qf(t){let n,r,o,i,s;return{c(){n=_("div"),r=_("div"),o=_("button"),o.innerHTML='',C(o,"class","svelte-cpjycc"),C(r,"class","flex flex-col ml-2 svelte-cpjycc"),C(n,"class","hidden md:flex flex-row px-2 py-4 mb-3 overflow-x-hidden svelte-cpjycc")},m(e,a){w(e,n,a),b(n,r),b(r,o),i||(s=A(o,"click",O(t[15])),i=!0)},p:e,d(e){e&&v(n),i=!1,s()}}}function Xf(e){let t,n,r;return{c(){t=_("h1"),n=E("Couldn't find event with ID "),r=E(e[11]),C(t,"class","svelte-cpjycc")},m(e,o){w(e,t,o),b(t,n),b(t,r)},p(e,t){2048&t[0]&&P(r,e[11])},d(e){e&&v(t)}}}function ed(e){let t,n,r=Q(e[5]),o=[];for(let t=0;tJ(o[e],1,1,(()=>{o[e]=null}));return{c(){for(let e=0;e',r=k(),ee(o.$$.fragment),C(n,"class"," svelte-cpjycc"),C(t,"class","md:hidden px-2 py-4 mb-3 svelte-cpjycc")},m(c,u){w(c,t,u),b(t,n),w(c,r,u),te(o,c,u),i=!0,s||(a=A(n,"click",O(e[15])),s=!0)},p(e,t){const n={};2048&t[0]&&(n.event=e[12](e[11])),64&t[0]&&(n.responses=e[6]),2&t[0]&&(n.websiteOwnerPubkey=e[1]),o.$set(n)},i(e){i||(Z(o.$$.fragment,e),i=!0)},o(e){J(o.$$.fragment,e),i=!1},d(e){e&&(v(t),v(r)),ne(o,e),s=!1,a()}}}function nd(e){let t;return{c(){t=E("👆 deleted")},m(e,n){w(e,t,n)},d(e){e&&v(t)}}}function rd(e){let t,n,r,o;t=new Nf({props:{event:e[30],responses:e[6],websiteOwnerPubkey:e[1]}});let i=e[30].deleted&&nd();return{c(){ee(t.$$.fragment),n=k(),i&&i.c(),r=S()},m(e,s){te(t,e,s),w(e,n,s),i&&i.m(e,s),w(e,r,s),o=!0},p(e,n){const o={};32&n[0]&&(o.event=e[30]),64&n[0]&&(o.responses=e[6]),2&n[0]&&(o.websiteOwnerPubkey=e[1]),t.$set(o),e[30].deleted?i||(i=nd(),i.c(),i.m(r.parentNode,r)):i&&(i.d(1),i=null)},i(e){o||(Z(t.$$.fragment,e),o=!0)},o(e){J(t.$$.fragment,e),o=!1},d(e){e&&(v(n),v(r)),ne(t,e),i&&i.d(e)}}}function od(e){let t,n;return{c(){t=_("b"),t.textContent="Public notes:",n=E("\n your followers see your messages on their timeline"),C(t,"class","font-bold svelte-cpjycc")},m(e,r){w(e,t,r),w(e,n,r)},d(e){e&&(v(t),v(n))}}}function id(e){let t,n;return{c(){t=_("b"),t.textContent="Public chat:",n=E("\n anyone can see these messages."),C(t,"class","font-bold svelte-cpjycc")},m(e,r){w(e,t,r),w(e,n,r)},d(e){e&&(v(t),v(n))}}}function sd(e){let t,n;return{c(){t=_("b"),t.textContent="Encrypted chat:",n=E("\n only your chat partner can see these messages."),C(t,"class","font-bold svelte-cpjycc")},m(e,r){w(e,t,r),w(e,n,r)},d(e){e&&(v(t),v(n))}}}function ad(t){let n,r,o;return{c(){n=_("button"),n.innerHTML='\n >',C(n,"title","Login"),C(n,"class","bg-green-700 min-h-[40px] max-h-[40px] hover:bg-green-600 focus:outline-none focus:ring-2 focus:ring-green-500 focus:ring-offset-2 text-white rounded-md px-4 py-2 cursor-pointer svelte-cpjycc")},m(e,i){w(e,n,i),r||(o=A(n,"click",O(t[21])),r=!0)},p:e,d(e){e&&v(n),r=!1,o()}}}function cd(e){let t,n,i,s,a,c,u,l,h,f,d,p,y,g,x,S,I,L,j,T,B,R,$,U,N,H,M,q,F,D,z,K,G,W,X,ee=e[4]?.pubkey&&Gf(e),te=Q(Array(e[9])),ne=[];for(let t=0;t',y=k(),re&&re.c(),g=k(),x=_("div"),oe&&oe.c(),S=k(),I=_("div"),L=_("div"),T.c(),R=k(),$=_("div"),U=_("div"),le.c(),H=k(),M=_("div"),q=_("div"),he&&he.c(),F=k(),D=_("input"),z=k(),K=_("button"),K.innerHTML='',C(n,"class","m-0 text-lg svelte-cpjycc"),C(a,"class","flex flex-row gap-1 overflow-clip svelte-cpjycc"),C(s,"class","text-xs flex mr-0 ml-auto flex-col items-end mt-2 text-gray-200 gap-1 svelte-cpjycc"),C(p,"id","close-popup"),C(p,"class","bg-transparent ml-4 border-none text-white cursor-pointer svelte-cpjycc"),C(t,"class","flex justify-between items-center p-4 bg-purple-700 text-white md:rounded-t-md svelte-cpjycc"),C(L,"id","messages-container-inner"),C(L,"class",B="flex flex-col "+(!e[11]&&"mt-96")+" gap-4 svelte-cpjycc"),C(I,"id","messages-container"),C(I,"class","overflow-auto overflow-x-hidden -mx-4 px-4 min-h-full h-full svelte-cpjycc"),C(U,"class","px-2 svelte-cpjycc"),C($,"id","chat-input-warn"),C($,"class",N="border-y "+(e[11]&&"hidden")+" border-y-slate-200 -mx-4 bg-slate-100 text-black text-sm px-4 py-2 sticky bottom-0 svelte-cpjycc"),C(x,"id","chat-messages"),C(x,"class","flex-1 px-4 min-h-[192px] block overflow-y-hidden md:overflow-y-auto overflow-x-hidden svelte-cpjycc"),C(D,"type","text"),C(D,"id","message-input"),C(D,"class","flex-1 border border-gray-300 min-h-[40px] max-h-[40px] rounded-md px-4 py-2 outline-none w-3/4 svelte-cpjycc"),C(D,"placeholder","Say hello"),C(K,"class","bg-purple-700 min-h-[40px] max-h-[40px] hover:bg-purple-600 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:ring-offset-2 text-white rounded-md px-4 py-2 cursor-pointer svelte-cpjycc"),C(q,"class","flex space-x-4 items-center svelte-cpjycc"),C(M,"id","chat-input-container"),C(M,"class","p-4 svelte-cpjycc")},m(r,v){w(r,t,v),b(t,n),ee&&ee.m(n,null),b(t,i),b(t,s),b(s,a);for(let e=0;e{se[o]=null})),Y(),T=se[j],T?T.p(e,r):(T=se[j]=ie[j](e),T.c()),Z(T,1),T.m(L,null)),(!G||2048&r[0]&&B!==(B="flex flex-col "+(!e[11]&&"mt-96")+" gap-4 svelte-cpjycc"))&&C(L,"class",B),ue!==(ue=ce(e))&&(le.d(1),le=ue(e),le&&(le.c(),le.m(U,null))),(!G||2048&r[0]&&N!==(N="border-y "+(e[11]&&"hidden")+" border-y-slate-200 -mx-4 bg-slate-100 text-black text-sm px-4 py-2 sticky bottom-0 svelte-cpjycc"))&&C($,"class",N),"chat"==e[0]?he?he.p(e,r):(he=ad(e),he.c(),he.m(q,F)):he&&(he.d(1),he=null)},i(e){G||(Z(T),G=!0)},o(e){J(T),G=!1},d(e){e&&(v(t),v(y),v(g),v(x),v(H),v(M)),ee&&ee.d(),m(ne,e),re&&re.d(e),oe&&oe.d(),se[j].d(),le.d(),he&&he.d(),W=!1,r(X)}}}function ud(e,t,n){let r,o,i,s;c(e,ce,(e=>n(4,r=e))),c(e,le,(e=>n(11,o=e))),c(e,ue,(e=>n(20,i=e))),c(e,fe,(e=>n(24,s=e)));let a,u,h=[],f=[],d={},p={},{startPage:y}=t,{websiteOwnerPubkey:g}=t,{chatConfiguration:b}=t,{toggleChat:w}=t;function v(e){let t=h.find((t=>t.id===e));return t=t||f.find((t=>t.id===e)),t}async function m(){const e=document.getElementById("message-input");if(""===e.value||" "===e.value);else{const t=e.value;e.value="";let n={tags:[],tagPubKeys:[]};!u&&g&&(n.tagPubKeys=[g]),o&&(n.tags.push(["e",o,"wss://nos.lol","root"]),n.tagPubKeys.push(v(o).pubkey));const i=await r.send(t,n);u||(u=i,localStorage.setItem("rootNoteId",u))}}function _(e){let t;if(e.tags.filter((e=>"e"===e[0])).pop(),"GLOBAL"===b.chatType)t=e.tags.filter((e=>"e"===e[0])).length>=1;else if("GROUP"===b.chatType)t=e.tags.filter((e=>"e"===e[0]&&e[1]!==b.chatId)).length>=1;else{const n=e.tags.filter((e=>"p"===e[0])).map((e=>e[1]));t=new Set(n).size>=2}if(d[e.id]||n(6,d[e.id]=[],d),t){const t=e.tags.filter((e=>"e"===e[0])).pop();t&&t[1]&&(d[t[1]]||n(6,d[t[1]]=[],d),d[t[1]].push(e)),f.push(e)}else{let t=0;for(;tt.id===e.zappedEvent));t&&(s[t.id]||l(fe,s[t.id]=[],s),s[t.id].push(e))}function k(e){const t=h.find((t=>t.id===e.id));t&&(t.reactions=t.reactions||[],t.reactions.push(e),n(5,h),n(2,b),n(17,a),n(4,r))}let S={};T((()=>{r.on("message",_),r.on("connectivity",(e=>{n(18,C=e)})),r.on("reaction",k),r.on("zap",E),r.on("deleted",(e=>{e.forEach((e=>{const t=h.findIndex((t=>t.id===e));-1!==t&&(n(5,h[t].deleted=!0,h),n(5,h),n(2,b),n(17,a),n(4,r))}))})),r.on("profile",(({pubkey:e,profile:t})=>{let n=i.profiles;n[e]=t,ue.set({profiles:n,...i})})),r.on("channelMetadata",(e=>{n(7,S=JSON.parse(e.content))}))}));let A,O,C={},P=0,I=0;return e.$$set=e=>{"startPage"in e&&n(0,y=e.startPage),"websiteOwnerPubkey"in e&&n(1,g=e.websiteOwnerPubkey),"chatConfiguration"in e&&n(2,b=e.chatConfiguration),"toggleChat"in e&&n(3,w=e.toggleChat)},e.$$.update=()=>{131092&e.$$.dirty[0]&&(b!==a&&r&&(r.setChatConfiguration(b.chatType,b.chatTags,b.chatReferenceTags,b.chatId),n(5,h=[]),n(6,d={}),u=null,localStorage.removeItem("rootNoteId")),n(17,a=b)),1048576&e.$$.dirty[0]&&n(16,p=i.profiles),327696&e.$$.dirty[0]&&(n(8,P=Object.values(C).filter((e=>"connected"===e)).length),n(9,I=Object.values(C).length),r?.pubkey&&!p[r.pubkey]&&r.reqProfile(r.pubkey)),524304&e.$$.dirty[0]&&A!==r?.chatId&&(n(19,A=r?.chatId),n(7,S={})),16&e.$$.dirty[0]&&n(10,O=r?.pubkey?function(e){let t;if(p[r.pubkey]){let e=p[r.pubkey];t=e.display_name||e.displayName||e.name||e.nip05}return t||(t=`[${e.slice(0,6)}]`),t}(r.pubkey):"")},[y,g,b,w,r,h,d,S,P,I,O,o,v,m,async function(e){"Enter"===e.key&&(m(),e.preventDefault())},function(){if("GROUP"===b.chatType)l(le,o=null,o);else{const e=v(o).tags.filter((e=>"e"===e[0])).pop(),t=e&&e[1];l(le,o=t,o)}x()},p,a,C,A,i,()=>ce.set("")]}class ld extends ie{constructor(e){super(),oe(this,e,ud,cd,i,{startPage:0,websiteOwnerPubkey:1,chatConfiguration:2,toggleChat:3},null,[-1,-1])}}function hd(e){let t,n;return t=new ld({props:{startPage:e[6],toggleChat:e[4],websiteOwnerPubkey:e[1],chatConfiguration:e[2],relays:e[3]}}),{c(){ee(t.$$.fragment)},m(e,r){te(t,e,r),n=!0},p(e,n){const r={};64&n&&(r.startPage=e[6]),16&n&&(r.toggleChat=e[4]),2&n&&(r.websiteOwnerPubkey=e[1]),4&n&&(r.chatConfiguration=e[2]),8&n&&(r.relays=e[3]),t.$set(r)},i(e){n||(Z(t.$$.fragment,e),n=!0)},o(e){J(t.$$.fragment,e),n=!1},d(e){ne(t,e)}}}function fd(e){let t,n;return t=new tf({props:{firstStartupDone:e[7],managedLogin:e[8],startPage:e[5],toggleChat:e[4],websiteOwnerPubkey:e[1],chatConfiguration:e[2],relays:e[3]}}),{c(){ee(t.$$.fragment)},m(e,r){te(t,e,r),n=!0},p(e,n){const r={};32&n&&(r.startPage=e[5]),16&n&&(r.toggleChat=e[4]),2&n&&(r.websiteOwnerPubkey=e[1]),4&n&&(r.chatConfiguration=e[2]),8&n&&(r.relays=e[3]),t.$set(r)},i(e){n||(Z(t.$$.fragment,e),n=!0)},o(e){J(t.$$.fragment,e),n=!1},d(e){ne(t,e)}}}function dd(e){let t,n,r,o;const i=[fd,hd],s=[];function a(e,t){return e[0]?1:0}return t=a(e),n=s[t]=i[t](e),{c(){n.c(),r=S()},m(e,n){s[t].m(e,n),w(e,r,n),o=!0},p(e,[o]){let c=t;t=a(e),t===c?s[t].p(e,o):(V(),J(s[c],1,1,(()=>{s[c]=null})),Y(),n=s[t],n?n.p(e,o):(n=s[t]=i[t](e),n.c()),Z(n,1),n.m(r.parentNode,r))},i(e){o||(Z(n),o=!0)},o(e){J(n),o=!1},d(e){e&&v(r),s[t].d(e)}}}function pd(e,t,n){let r;c(e,ce,(e=>n(10,r=e)));let{startPage:o}=t,{websiteOwnerPubkey:i}=t,{chatStarted:s}=t,{chatConfiguration:a}=t,{relays:u}=t,{toggleChat:l}=t,h=o,f=o;return e.$$set=e=>{"startPage"in e&&n(9,o=e.startPage),"websiteOwnerPubkey"in e&&n(1,i=e.websiteOwnerPubkey),"chatStarted"in e&&n(0,s=e.chatStarted),"chatConfiguration"in e&&n(2,a=e.chatConfiguration),"relays"in e&&n(3,u=e.relays),"toggleChat"in e&&n(4,l=e.toggleChat)},e.$$.update=()=>{1024&e.$$.dirty&&n(0,s=!!r)},[s,i,a,u,l,h,f,function(){n(5,h="login")},function(){n(6,f="login")},o,r]}class yd extends ie{constructor(e){super(),oe(this,e,pd,dd,i,{startPage:9,websiteOwnerPubkey:1,chatStarted:0,chatConfiguration:2,relays:3,toggleChat:4})}}function gd(e){let t;return{c(){t=_("span"),t.textContent="Nostri",C(t,"class","text-white svelte-ika13l")},m(e,n){w(e,t,n)},d(e){e&&v(t)}}}function bd(e){let t,n,r,o;return{c(){t=x("svg"),n=x("g"),r=x("g"),o=x("path"),C(o,"d","M533.187,269.019c-1.432-1.746-2.219-3.876-1.252-5.993c1.868-4.08,0.611-7.658-0.931-11.465 c-0.877-2.167-0.796-4.716-1.15-7.095c-0.221-1.493-0.057-3.199-0.742-4.435c-1.775-3.199-3.812-6.275-5.949-9.245 c-2.681-3.717-5.564-7.291-8.38-10.914c-3.325-4.284-6.581-8.633-10.09-12.766c-0.706-0.833-2.604-1.42-3.607-1.085 c-2.411,0.808-4.732,2.052-6.874,3.452c-2.771,1.812-5.435,3.317-8.928,3.713c-3.953,0.453-8.062,1.403-11.604,3.154 c-5.189,2.562-9.747,6.401-14.924,9c-4.913,2.464-8.328,6.112-11.184,10.567c-0.783,1.22-1.705,2.371-2.685,3.444 c-3.252,3.574-5.549,7.629-7.051,12.248c-1.154,3.554-2.378,7.226-4.373,10.322c-1.963,3.044-3.256,6.194-4.162,9.601 c-0.285,1.065-0.44,2.167-0.656,3.251c-2.212-0.539-4.19-0.873-6.06-1.518c-1.709-0.592-3.684-1.15-4.879-2.375 c-2.979-3.052-6.528-5.059-10.388-6.577c-3.448-1.354-6.581-3.06-9.441-5.496c-1.514-1.29-3.771-1.738-5.721-2.489 c-1.419-0.547-3.043-0.714-4.3-1.501c-3.439-2.146-6.639-4.68-10.11-6.765c-2.256-1.359-4.737-2.542-7.271-3.166 c-1.722-0.424-2.293-0.865-2.216-2.599c0.241-5.227-0.832-10.175-3.235-14.872c-2.855-5.582-8.723-8.625-14.777-7.589 c-2.697,0.461-5.573,1.347-8.128,0.833c-3.329-0.669-6.516-2-10.028-1.861c-0.612,0.025-1.31-0.437-1.864-0.82 c-4.076-2.832-8.152-5.663-12.163-8.584c-1.489-1.085-2.782-1.154-4.442-0.322c-1.221,0.612-2.705,0.955-4.08,0.967 c-6.047,0.062-12.098-0.082-18.148-0.077c-5.173,0.004-10.498,1.815-15.377-1.399c-0.241-0.159-0.588-0.216-0.886-0.221 c-3.023-0.028-4.488-1.632-5.096-4.524c-0.171-0.82-1.436-1.971-2.236-2c-3.986-0.143-7.984-0.041-11.971,0.139 c-2.187,0.102-4.619,0.004-6.483,0.922c-3.941,1.942-7.556,4.533-11.355,6.773c-1.505,0.889-3.023,1.085-3.872-0.763 c0.979-1.261,2.337-2.272,2.627-3.525c0.771-3.37-3.705-7.181-6.969-6.059c-1.498,0.514-3.003,1.208-4.272,2.138 c-2.464,1.807-4.725,3.896-7.144,5.769c-3.011,2.33-6.055,4.655-10.449,4.737c0.983-3.753-1.718-5.104-4.108-6.597 c-1.094-0.686-2.293-1.281-3.525-1.652c-3.276-1-6.348-0.763-8.956,1.828c-2.158,2.142-3.488,2.179-6.014,0.367 c-3.081-2.208-3.986-2.175-7.128,0c-1.122,0.775-2.346,1.832-3.586,1.926c-4.268,0.318-6.646,3.052-8.931,6.132 c-1.632,2.203-3.244,4.472-5.173,6.405c-4.378,4.39-8.911,8.629-13.48,12.815c-0.608,0.559-1.95,0.873-2.709,0.608 c-3.378-1.191-5.582-3.823-6.899-7.001c-2.521-6.075-4.957-12.203-7.07-18.429c-0.816-2.399-1.11-5.165-0.865-7.687 c0.559-5.786,1.771-11.51,2.411-17.291c1.196-10.796,3.583-21.343,7.405-31.445c6.773-17.891,13.934-35.643,21.2-53.342 c4.619-11.249,7.817-22.852,10.167-34.75c1.644-8.319,2.477-16.63,1.901-25.137c-0.286-4.227,0.232-8.56,0.808-12.787 c1.669-12.232-2.46-19.547-13.843-24.068c-1.403-0.559-2.766-1.228-4.149-1.844c-2.15,0-4.3,0-6.455,0 c-2.909,0.91-5.871,1.681-8.715,2.762c-3.827,1.457-7.989,2.484-10.51,6.145c-1.701,2.472-4.088,3.5-6.916,4.06 c-3.9,0.771-7.797,1.62-11.62,2.705c-3.378,0.959-6.369,2.709-9.135,5.872c6.863,1.652,13.211,3.305,19.617,4.692 c7.629,1.652,14.558,4.729,20.518,9.763c2.954,2.493,5.667,5.447,6.165,9.425c0.51,4.084,0.608,8.271,0.392,12.383 c-0.563,10.694-4.137,20.661-7.976,30.515c-2.358,6.059-5.406,11.876-7.36,18.054c-4.321,13.656-8.486,27.348-14.19,40.522 c-3.309,7.646-6.83,15.251-8.307,23.534c-1.722,9.657-3.264,19.343-4.917,29.013c-0.845,4.958-0.877,10.049-2.864,14.819 c-0.873,2.093-1.269,4.406-1.693,6.654c-0.975,5.182-1.832,10.379-2.733,15.573c0,7.838,0,15.675,0,23.513 c0.632,3.905,1.363,7.801,1.877,11.722c1.481,11.232,4.773,21.955,8.825,32.489c0.816,2.121,1.322,4.378,1.783,6.613 c0.718,3.473,1.069,7.365,4.309,9.303c2.427,1.452,2.982,3.402,3.603,5.671c1.828,6.684,1.318,13.428,0.147,20.086 c-1.114,6.341-0.845,12.525,0.861,18.65c2.313,8.318,4.72,16.613,7.291,24.859c0.461,1.48,1.71,2.896,2.946,3.916 c5.3,4.382,10.735,8.605,16.108,12.897c0.355,0.281,0.645,0.656,0.914,1.028c2.652,3.672,6.373,5.879,10.677,6.638 c8.262,1.457,16.275,4.117,24.664,4.929c1.363,0.131,2.742,0.453,4.035,0.906c2.362,0.828,4.696,1.733,7.038,2.623 c1.257,0.824,2.391,1.832,3.415,3.064c-0.698,2.239-1.901,4.234-3.199,6.164c-3.529,5.239-8.344,8.948-14.007,11.633 c-5.818,2.754-11.975,4.442-18.242,5.744c-8.115,1.686-16.259,3.231-24.378,4.88c-6.789,1.379-13.248,3.79-19.633,6.414 c-8.25,3.39-16.463,6.879-24.77,10.13c-6.447,2.525-13.158,4.149-20.086,4.68c-2.077,0.159-4.178,0.017-6.267,0.065 c-0.604,0.017-1.326,0.045-1.783,0.367c-3.46,2.437-7.446,3.407-11.481,4.272c-1.607,0.347-3.203,0.742-4.802,1.117 c-4.423,1.049-7.703,3.672-10.237,7.36c-2.481,3.619-3.827,7.691-4.762,11.914c-1.26,5.708-1.685,11.521-1.921,17.344 c-0.306,7.405-0.526,14.814-0.828,22.22c-0.082,2.023-0.367,4.035-0.486,6.059c-0.033,0.592,0.012,1.302,0.314,1.779 c3.525,5.654,7.299,11.126,12.276,15.643c4.251,3.859,8.993,6.769,14.819,7.557c0.171,0.024,0.326,0.175,0.485,0.265 c1.775,0,3.55,0,5.32,0c1.032-0.253,2.085-0.444,3.097-0.767c2.216-0.702,4.415-1.461,6.663-2.212 c-0.196-1.881-0.971-3.166-2.317-3.962c-1.236-0.734-2.595-1.301-3.958-1.771c-1.73-0.596-3.55-0.942-5.275-1.554 c-1.114-0.396-2.208-0.968-3.174-1.648c-1.367-0.968-1.979-2.424-2.052-4.097c0.069-0.102,0.118-0.257,0.212-0.298 c4.643-1.885,7.16-5.879,9.694-9.837c0.298-0.461,0.294-1.195,0.241-1.787c-0.445-4.696-1.775-9.184-3.354-13.599 c-1.75-4.884-3.595-9.73-5.333-14.614c-0.551-1.547-0.836-3.183-1.326-4.749c-0.318-1.017,0.11-1.543,0.938-1.971 c1.64-0.841,3.423-0.832,5.189-0.886c2.464-0.073,4.945,0.041,7.393-0.188c1.408-0.131,2.925-0.515,4.121-1.236 c13.692-8.303,28.474-14.003,43.791-18.413c13.876-3.998,27.997-6.915,42.244-9.229c6.247-1.012,12.501-1.967,18.76-2.897 c0.918-0.134,1.665-0.428,2.371-1.027c4.227-3.595,9.217-5.586,14.635-6.259c5.773-0.715,11.608-0.951,17.393-1.563 c3.578-0.379,7.161-0.905,10.678-1.656c4.308-0.918,8.045-3.129,11.146-6.205c2.688-2.669,5.132-5.59,7.593-8.482 c3.28-3.855,6.414-7.834,9.727-11.661c1.02-1.179,2.432-2.012,3.631-3.039c0.792-0.674,1.501-0.653,2.391-0.11 c4.125,2.529,8.576,4.32,13.199,5.712c5.716,1.722,11.566,2.75,17.495,3.374c10.983,1.159,22,1.204,33.023,0.906 c3.166-0.086,6.333-0.09,9.503-0.184c0.93-0.029,1.718,0.171,2.473,0.729c3.309,2.444,6.646,4.852,9.963,7.291 c3.117,2.293,6.345,4.402,9.927,5.92c0.641,0.273,1.277,0.612,1.95,0.735c2.758,0.497,4.741,2.235,6.744,4.002 c5.908,5.214,11.343,10.894,16.161,17.111c6.324,8.156,12.468,16.455,18.617,24.745c6.152,8.295,12.342,16.557,19.396,24.125 c6.863,7.36,14.423,13.868,23.122,18.984c0.775,0.457,1.432,0.955,1.844,1.815c3.187,6.655,8.475,11.09,15.076,14.093 c6.81,3.097,14.006,4.256,21.444,4.142c10.33-0.159,20.062-2.53,28.906-8.014c5.264-3.264,9.572-7.471,12.347-13.097 c1.15-2.338,2.109-4.737,2.269-7.385c0.016-0.29,0.212-0.571,0.326-0.853c0-0.633,0-1.27,0-1.901 c-3.488-0.6-6.802,0.208-10.045,1.362c-3.101,1.102-6.124,2.416-9.25,3.443c-2.692,0.886-5.442,1.673-8.225,2.195 c-4.554,0.853-8.042-1.113-10.037-5.41c0.804-1.049,1.995-1.195,3.194-1.253c2.338-0.113,4.685-0.143,7.022-0.302 c0.799-0.053,1.664-0.249,2.338-0.648c0.6-0.359,1.121-1.024,1.411-1.673c0.498-1.126,0.311-1.44-0.869-2.085 c-3.402-1.856-6.993-3.264-10.714-4.324c-8.421-2.399-17.055-3.028-25.757-3.061c-1.836-0.008-3.677-0.004-5.513,0.082 c-0.963,0.045-1.66-0.249-2.366-0.906c-4.843-4.5-9.094-9.53-13.166-14.721c-6.613-8.429-12.48-17.389-18.47-26.259 c-2.836-4.198-5.786-8.319-8.769-12.411c-0.999-1.375-2.244-2.574-3.419-3.811c-0.384-0.404-0.885-0.727-1.383-0.991 c-1.358-0.727-2.269-0.408-2.905,1.003c-0.229,0.511-0.379,1.062-0.648,1.828c-0.633-0.465-1.179-0.841-1.697-1.253 c-5.03-4.019-8.866-9.058-11.905-14.655c-2.954-5.446-5.627-11.048-8.344-16.626c-2.607-5.353-5.092-10.767-8.438-15.712 c-1.521-2.248-3.317-4.312-4.9-6.523c-0.783-1.094-1.709-1.229-2.949-1.094c-5.324,0.579-10.625,0.494-15.843-0.894 c-2.591-0.689-5.035-1.718-7.1-3.488c-1.473-1.269-2.562-2.746-3.211-4.513c1.95-0.433,3.893-0.897,5.818-1.424 c6.459-1.767,12.926-2.469,19.552-2.081c7.964,0.466,15.92,1.159,23.892,1.437c2.853,0.098,5.966-0.172,8.557-1.244 c3.859-1.596,7.544-3.799,10.971-6.206c5.075-3.566,9.702-7.78,14.847-11.232c2.379-1.595,3.203-3.292,3.306-5.92 c0.134-3.509,1.9-4.781,5.3-4.149c0.6,0.114,1.203,0.253,1.787,0.44c3.852,1.229,7.633,1.028,11.489-0.163 c2.962-0.914,6.066-1.354,9.053-2.195c0.547-0.154,1.024-1.199,1.163-1.909c0.094-0.481-0.616-1.068-0.693-1.648 c-0.127-0.922-0.384-2.402,0.057-2.705c0.854-0.575,2.154-0.656,3.265-0.636c0.881,0.016,1.733,0.62,2.627,0.729 c2.064,0.258,3.995,0.021,5.247-1.986c1.232-1.971,1.277-3.864-0.163-5.757c-0.465-0.608-1.069-1.249-1.191-1.946 c-0.163-0.938-0.273-2.199,0.212-2.881c1.779-2.488,3.771-4.83,5.77-7.152c1.828-2.121,4.251-3.354,6.997-3.541 c0.967-0.065,2.158,0.742,2.966,1.465c0.633,0.562,0.686,1.729,1.261,2.407c0.674,0.795,1.628,1.347,2.465,2.007 c0.571-0.877,1.358-1.688,1.656-2.651c0.311-0.992-0.028-2.175,0.236-3.187c0.213-0.812,0.743-1.738,1.416-2.195 c3.591-2.439,7.442-4.524,10.861-7.177c2.574-1.991,4.508-4.786,6.944-6.98c4.182-3.771,9.526-5.097,14.789-6.472 c3.452-0.901,4.194-1.921,3.134-5.365c-0.514-1.673-1.228-3.309-2.052-4.854c-1.062-1.987-0.531-3.362,1.297-4.402 c0.727-0.412,1.498-0.751,2.252-1.114c2.387-1.139,4.08-2.701,4.688-5.521c0.612-2.827,1.75-5.549,2.741-8.286 c1.339-3.692,2.432-7.65,7.34-8.144c0.147-0.017,0.294-0.061,0.441-0.094c0-1.077,0-2.15,0-3.228 c-1.135-1.775-2.15-3.639-3.432-5.3C536.084,271.981,534.492,270.614,533.187,269.019z"),C(o,"class","svelte-ika13l"),C(r,"class","svelte-ika13l"),C(n,"class","svelte-ika13l"),C(t,"fill","#ffffff"),C(t,"version","1.1"),C(t,"id","Capa_1"),C(t,"xmlns","http://www.w3.org/2000/svg"),C(t,"xmlns:xlink","http://www.w3.org/1999/xlink"),C(t,"width","25px"),C(t,"height","25px"),C(t,"viewBox","0 0 571.004 571.004"),C(t,"xml:space","preserve"),C(t,"class","svelte-ika13l")},m(e,i){w(e,t,i),b(t,n),b(n,r),b(r,o)},d(e){e&&v(t)}}}function wd(e){let t,n,r,o;return n=new yd({props:{startPage:e[2],websiteOwnerPubkey:e[3],chatConfiguration:{chatType:e[4],chatTags:e[5],chatId:e[8],chatReferenceTags:e[6]},relays:e[7],toggleChat:e[11]}}),{c(){t=_("div"),ee(n.$$.fragment),C(t,"id","_chat-popup"),C(t,"class",r="absolute bottom-20 right-0 w-96 bg-white rounded-md shadow-md flex flex-col transition-all text-sm "+(e[10]?"hidden":"")+" svelte-ika13l")},m(e,r){w(e,t,r),te(n,t,null),o=!0},p(e,i){const s={};4&i&&(s.startPage=e[2]),8&i&&(s.websiteOwnerPubkey=e[3]),368&i&&(s.chatConfiguration={chatType:e[4],chatTags:e[5],chatId:e[8],chatReferenceTags:e[6]}),128&i&&(s.relays=e[7]),n.$set(s),(!o||1024&i&&r!==(r="absolute bottom-20 right-0 w-96 bg-white rounded-md shadow-md flex flex-col transition-all text-sm "+(e[10]?"hidden":"")+" svelte-ika13l"))&&C(t,"class",r)},i(e){o||(Z(n.$$.fragment,e),o=!0)},o(e){J(n.$$.fragment,e),o=!1},d(e){e&&v(t),ne(n)}}}function vd(e){let t,n,r,o,i,s,a,c,l,h,f,d,p="true"!==e[1]&&gd(),y="true"!==e[0]&&bd(),g=e[9]&&wd(e);return{c(){t=_("div"),n=_("div"),r=_("span"),p&&p.c(),o=k(),i=_("span"),s=E("Chat"),c=k(),y&&y.c(),l=k(),g&&g.c(),C(i,"class",a=u("true"!==e[1]?"text-purple-300":"text-white")+" svelte-ika13l"),C(r,"class","tracking-wider flex svelte-ika13l"),C(n,"class","text-white cursor-pointer shadow-md bg-purple-900 hover:bg-purple-700 w-full p-4 rounded-full flex-shrink-1 text-center font-semibold flex flex-row items-center gap-4 svelte-ika13l"),C(t,"id","_chat-widget-container"),C(t,"class","font-sans svelte-ika13l")},m(a,u){w(a,t,u),b(t,n),b(n,r),p&&p.m(r,null),b(r,o),b(r,i),b(i,s),b(n,c),y&&y.m(n,null),b(t,l),g&&g.m(t,null),h=!0,f||(d=A(n,"click",O(e[11])),f=!0)},p(e,[s]){"true"!==e[1]?p||(p=gd(),p.c(),p.m(r,o)):p&&(p.d(1),p=null),(!h||2&s&&a!==(a=u("true"!==e[1]?"text-purple-300":"text-white")+" svelte-ika13l"))&&C(i,"class",a),"true"!==e[0]?y||(y=bd(),y.c(),y.m(n,null)):y&&(y.d(1),y=null),e[9]?g?(g.p(e,s),512&s&&Z(g,1)):(g=wd(e),g.c(),Z(g,1),g.m(t,null)):g&&(V(),J(g,1,1,(()=>{g=null})),Y())},i(e){h||(Z(g),h=!0)},o(e){J(g),h=!1},d(e){e&&v(t),p&&p.d(),y&&y.d(),g&&g.d(),f=!1,d()}}}function md(e,t,n){let{accentColor:r}=t,{hideNostrIcon:o}=t,{simplifyNostrText:i}=t,{startPage:s}=t,{websiteOwnerPubkey:a}=t,{chatType:c}=t,{chatTags:u}=t,{chatReferenceTags:l}=t,{relays:h}=t,{chatId:f}=t;console.log("accentColor",r),0!==r.length&&(document.documentElement.style.setProperty("--nostri-chat-custom-accent-color-50",r[0]),document.documentElement.style.setProperty("--nostri-chat-custom-accent-color-100",r[1]),document.documentElement.style.setProperty("--nostri-chat-custom-accent-color-200",r[2]),document.documentElement.style.setProperty("--nostri-chat-custom-accent-color-300",r[3]),document.documentElement.style.setProperty("--nostri-chat-custom-accent-color-400",r[4]),document.documentElement.style.setProperty("--nostri-chat-custom-accent-color-500",r[5]),document.documentElement.style.setProperty("--nostri-chat-custom-accent-color-600",r[6]),document.documentElement.style.setProperty("--nostri-chat-custom-accent-color-700",r[7]),document.documentElement.style.setProperty("--nostri-chat-custom-accent-color-800",r[8]),document.documentElement.style.setProperty("--nostri-chat-custom-accent-color-900",r[9]),document.documentElement.style.setProperty("--nostri-chat-custom-accent-color-950",r[10]));let d=!1,p=!1;return e.$$set=e=>{"accentColor"in e&&n(12,r=e.accentColor),"hideNostrIcon"in e&&n(0,o=e.hideNostrIcon),"simplifyNostrText"in e&&n(1,i=e.simplifyNostrText),"startPage"in e&&n(2,s=e.startPage),"websiteOwnerPubkey"in e&&n(3,a=e.websiteOwnerPubkey),"chatType"in e&&n(4,c=e.chatType),"chatTags"in e&&n(5,u=e.chatTags),"chatReferenceTags"in e&&n(6,l=e.chatReferenceTags),"relays"in e&&n(7,h=e.relays),"chatId"in e&&n(8,f=e.chatId)},[o,i,s,a,c,u,l,h,f,d,p,()=>{d?n(10,p=!p):n(9,d=!d)},r]}var _d=document.createElement("DIV"),xd=document.currentScript;const Ed=xd.getAttribute("data-website-owner-pubkey"),kd=xd.getAttribute("data-chat-type");let Sd=xd.getAttribute("data-chat-tags"),Ad=xd.getAttribute("data-chat-id"),Od=xd.getAttribute("data-chat-reference-tags"),Cd=xd.getAttribute("data-relays"),Pd=xd.getAttribute("data-start-page"),Id=xd.getAttribute("data-hidenostricon"),Ld=xd.getAttribute("data-simplifynostrnext"),jd=xd.getAttribute("data-accentcolor");xd.parentNode.insertBefore(_d,xd),Cd||(Cd="wss://relay.f7z.io,wss://nos.lol,wss://relay.nostr.info,wss://nostr-pub.wellorder.net,wss://relay.current.fyi,wss://relay.nostr.band"),Cd=Cd.split(","),Sd=Sd?Sd.split(","):[],Od=Od?Od.split(","):[],jd=jd?jd.split(","):[],new class extends ie{constructor(e){super(),oe(this,e,md,vd,i,{accentColor:12,hideNostrIcon:0,simplifyNostrText:1,startPage:2,websiteOwnerPubkey:3,chatType:4,chatTags:5,chatReferenceTags:6,relays:7,chatId:8})}}({target:_d,props:{accentColor:jd,hideNostrIcon:Id,simplifyNostrText:Ld,startPage:Pd,websiteOwnerPubkey:Ed,chatType:kd,chatTags:Sd,chatId:Ad,chatReferenceTags:Od,relays:Cd}})}(); //# sourceMappingURL=bundle.js.map diff --git a/static/public/bundle.js.map b/static/public/bundle.js.map index fed3255..5d32210 100644 --- a/static/public/bundle.js.map +++ b/static/public/bundle.js.map @@ -1 +1 @@ -{"version":3,"file":"bundle.js","sources":["../../node_modules/svelte/src/runtime/internal/utils.js","../../node_modules/svelte/src/runtime/internal/environment.js","../../node_modules/svelte/src/runtime/internal/loop.js","../../node_modules/svelte/src/runtime/internal/dom.js","../../node_modules/svelte/src/runtime/internal/lifecycle.js","../../node_modules/svelte/src/runtime/internal/scheduler.js","../../node_modules/svelte/src/runtime/internal/transitions.js","../../node_modules/svelte/src/runtime/internal/each.js","../../node_modules/svelte/src/runtime/internal/Component.js","../../node_modules/svelte/src/runtime/internal/disclose-version/index.js","../../node_modules/svelte/src/shared/version.js","../../node_modules/svelte/src/runtime/store/index.js","../../src/lib/store.js","../../node_modules/@noble/hashes/esm/_assert.js","../../node_modules/@noble/hashes/esm/crypto.js","../../node_modules/@noble/hashes/esm/utils.js","../../node_modules/@noble/hashes/esm/_sha2.js","../../node_modules/@noble/hashes/esm/sha256.js","../../node_modules/@noble/curves/esm/abstract/utils.js","../../node_modules/@noble/curves/esm/abstract/modular.js","../../node_modules/@noble/curves/esm/abstract/curve.js","../../node_modules/@noble/curves/esm/abstract/weierstrass.js","../../node_modules/@noble/hashes/esm/hmac.js","../../node_modules/@noble/curves/esm/_shortw_utils.js","../../node_modules/@noble/curves/esm/secp256k1.js","../../node_modules/@noble/curves/esm/abstract/hash-to-curve.js","../../node_modules/@scure/base/lib/esm/index.js","../../node_modules/@scure/bip39/wordlists/english.js","../../node_modules/@noble/hashes/_assert.js","../../node_modules/@noble/hashes/crypto.js","../../node_modules/@noble/hashes/utils.js","../../node_modules/@noble/hashes/hmac.js","../../node_modules/@noble/hashes/pbkdf2.js","../../node_modules/@noble/hashes/_sha2.js","../../node_modules/@noble/hashes/sha256.js","../../node_modules/@noble/hashes/_u64.js","../../node_modules/@noble/hashes/sha512.js","../../node_modules/@scure/base/lib/index.js","../../node_modules/@scure/bip39/index.js","../../node_modules/@noble/hashes/esm/ripemd160.js","../../node_modules/@noble/hashes/esm/_u64.js","../../node_modules/@noble/hashes/esm/sha512.js","../../node_modules/@scure/bip32/lib/esm/index.js","../../node_modules/nostr-tools/lib/esm/nostr.mjs","../../node_modules/nostr/lib/relay.js","../../node_modules/ws/browser.js","../../node_modules/nostr/lib/relay-pool.js","../../node_modules/uuid/dist/esm-browser/rng.js","../../node_modules/uuid/dist/esm-browser/stringify.js","../../node_modules/uuid/dist/esm-browser/native.js","../../node_modules/uuid/dist/esm-browser/v4.js","../../node_modules/ms/index.js","../../node_modules/debug/src/common.js","../../node_modules/debug/src/browser.js","../../node_modules/eventemitter3/index.js","../../node_modules/tstl/utility/node.js","../../node_modules/websocket/lib/browser.js","../../node_modules/es5-ext/global.js","../../node_modules/websocket/lib/version.js","../../node_modules/tstl/base/container/Container.js","../../node_modules/tstl/internal/iterator/disposable/ForOfAdaptor.js","../../node_modules/tstl/internal/iterator/disposable/NativeArrayIterator.js","../../node_modules/tstl/exception/LogicError.js","../../node_modules/tstl/exception/Exception.js","../../node_modules/tstl/exception/InvalidArgument.js","../../node_modules/tstl/internal/exception/ErrorGenerator.js","../../node_modules/tstl/exception/OutOfRange.js","../../node_modules/tstl/base/container/UniqueSet.js","../../node_modules/tstl/base/container/SetContainer.js","../../node_modules/tstl/functional/uid.js","../../node_modules/tstl/internal/Global.js","../../node_modules/tstl/functional/hash.js","../../node_modules/tstl/functional/comparators.js","../../node_modules/tstl/internal/container/associative/IHashContainer.js","../../node_modules/tstl/internal/container/associative/IAssociativeContainer.js","../../node_modules/tstl/internal/iterator/ListIterator.js","../../node_modules/tstl/iterator/global.js","../../node_modules/tstl/internal/container/linear/ListContainer.js","../../node_modules/tstl/internal/iterator/disposable/Repeater.js","../../node_modules/tstl/internal/iterator/ReverseIterator.js","../../node_modules/tstl/internal/hash/HashBuckets.js","../../node_modules/tstl/utility/Pair.js","../../node_modules/tstl/container/HashSet.js","../../node_modules/tstl/internal/container/associative/SetElementList.js","../../node_modules/tstl/internal/hash/SetHashBuckets.js","../../node_modules/tstl/base/container/UniqueMap.js","../../node_modules/tstl/base/container/MapContainer.js","../../node_modules/tstl/container/HashMap.js","../../node_modules/tstl/internal/container/associative/MapElementList.js","../../node_modules/tstl/internal/hash/MapHashBuckets.js","../../node_modules/tstl/utility/Entry.js","../../node_modules/websocket-polyfill/lib/events/Event.js","../../node_modules/@nostr-dev-kit/ndk/node_modules/@noble/hashes/esm/_assert.js","../../node_modules/websocket-polyfill/lib/index.js","../../node_modules/websocket-polyfill/lib/WebSocket.js","../../node_modules/websocket-polyfill/lib/events/EventTarget.js","../../node_modules/websocket-polyfill/lib/events/CloseEvent.js","../../node_modules/websocket-polyfill/lib/events/MessageEvent.js","../../node_modules/websocket-polyfill/lib/events/ErrorEvent.js","../../node_modules/@nostr-dev-kit/ndk/node_modules/@noble/hashes/esm/utils.js","../../node_modules/@nostr-dev-kit/ndk/node_modules/@noble/hashes/esm/_sha2.js","../../node_modules/@nostr-dev-kit/ndk/node_modules/@noble/hashes/esm/sha256.js","../../node_modules/light-bolt11-decoder/bolt11.js","../../node_modules/@nostr-dev-kit/ndk/dist/index.mjs","../../src/lib/adapters/index.js","../../src/lib/adapters/nip07.js","../../node_modules/@nostr-connect/connect/dist/connect.esm.js","../../src/lib/adapters/nip46.js","../../src/lib/adapters/discardable-keys.js","../../src/KeyPrompt.svelte","../../node_modules/webln/lib/errors.js","../../node_modules/webln/lib/client.js","../../node_modules/webln/lib/index.js","../../src/ZapAmountButton.svelte","../../node_modules/webln/lib/provider.js","../../src/NostrNote.svelte","../../node_modules/svelte-scrollto/src/helper.js","../../node_modules/svelte-scrollto/src/index.js","../../node_modules/svelte/src/runtime/easing/index.js","../../src/ConnectedWidget.svelte","../../src/Container.svelte","../../src/Widget.svelte","../../src/widget.js"],"sourcesContent":["/** @returns {void} */\nexport function noop() {}\n\nexport const identity = (x) => x;\n\n/**\n * @template T\n * @template S\n * @param {T} tar\n * @param {S} src\n * @returns {T & S}\n */\nexport function assign(tar, src) {\n\t// @ts-ignore\n\tfor (const k in src) tar[k] = src[k];\n\treturn /** @type {T & S} */ (tar);\n}\n\n// Adapted from https://github.com/then/is-promise/blob/master/index.js\n// Distributed under MIT License https://github.com/then/is-promise/blob/master/LICENSE\n/**\n * @param {any} value\n * @returns {value is PromiseLike}\n */\nexport function is_promise(value) {\n\treturn (\n\t\t!!value &&\n\t\t(typeof value === 'object' || typeof value === 'function') &&\n\t\ttypeof (/** @type {any} */ (value).then) === 'function'\n\t);\n}\n\n/** @returns {void} */\nexport function add_location(element, file, line, column, char) {\n\telement.__svelte_meta = {\n\t\tloc: { file, line, column, char }\n\t};\n}\n\nexport function run(fn) {\n\treturn fn();\n}\n\nexport function blank_object() {\n\treturn Object.create(null);\n}\n\n/**\n * @param {Function[]} fns\n * @returns {void}\n */\nexport function run_all(fns) {\n\tfns.forEach(run);\n}\n\n/**\n * @param {any} thing\n * @returns {thing is Function}\n */\nexport function is_function(thing) {\n\treturn typeof thing === 'function';\n}\n\n/** @returns {boolean} */\nexport function safe_not_equal(a, b) {\n\treturn a != a ? b == b : a !== b || (a && typeof a === 'object') || typeof a === 'function';\n}\n\nlet src_url_equal_anchor;\n\n/** @returns {boolean} */\nexport function src_url_equal(element_src, url) {\n\tif (!src_url_equal_anchor) {\n\t\tsrc_url_equal_anchor = document.createElement('a');\n\t}\n\tsrc_url_equal_anchor.href = url;\n\treturn element_src === src_url_equal_anchor.href;\n}\n\n/** @returns {boolean} */\nexport function not_equal(a, b) {\n\treturn a != a ? b == b : a !== b;\n}\n\n/** @returns {boolean} */\nexport function is_empty(obj) {\n\treturn Object.keys(obj).length === 0;\n}\n\n/** @returns {void} */\nexport function validate_store(store, name) {\n\tif (store != null && typeof store.subscribe !== 'function') {\n\t\tthrow new Error(`'${name}' is not a store with a 'subscribe' method`);\n\t}\n}\n\nexport function subscribe(store, ...callbacks) {\n\tif (store == null) {\n\t\tfor (const callback of callbacks) {\n\t\t\tcallback(undefined);\n\t\t}\n\t\treturn noop;\n\t}\n\tconst unsub = store.subscribe(...callbacks);\n\treturn unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;\n}\n\n/**\n * Get the current value from a store by subscribing and immediately unsubscribing.\n *\n * https://svelte.dev/docs/svelte-store#get\n * @template T\n * @param {import('../store/public.js').Readable} store\n * @returns {T}\n */\nexport function get_store_value(store) {\n\tlet value;\n\tsubscribe(store, (_) => (value = _))();\n\treturn value;\n}\n\n/** @returns {void} */\nexport function component_subscribe(component, store, callback) {\n\tcomponent.$$.on_destroy.push(subscribe(store, callback));\n}\n\nexport function create_slot(definition, ctx, $$scope, fn) {\n\tif (definition) {\n\t\tconst slot_ctx = get_slot_context(definition, ctx, $$scope, fn);\n\t\treturn definition[0](slot_ctx);\n\t}\n}\n\nfunction get_slot_context(definition, ctx, $$scope, fn) {\n\treturn definition[1] && fn ? assign($$scope.ctx.slice(), definition[1](fn(ctx))) : $$scope.ctx;\n}\n\nexport function get_slot_changes(definition, $$scope, dirty, fn) {\n\tif (definition[2] && fn) {\n\t\tconst lets = definition[2](fn(dirty));\n\t\tif ($$scope.dirty === undefined) {\n\t\t\treturn lets;\n\t\t}\n\t\tif (typeof lets === 'object') {\n\t\t\tconst merged = [];\n\t\t\tconst len = Math.max($$scope.dirty.length, lets.length);\n\t\t\tfor (let i = 0; i < len; i += 1) {\n\t\t\t\tmerged[i] = $$scope.dirty[i] | lets[i];\n\t\t\t}\n\t\t\treturn merged;\n\t\t}\n\t\treturn $$scope.dirty | lets;\n\t}\n\treturn $$scope.dirty;\n}\n\n/** @returns {void} */\nexport function update_slot_base(\n\tslot,\n\tslot_definition,\n\tctx,\n\t$$scope,\n\tslot_changes,\n\tget_slot_context_fn\n) {\n\tif (slot_changes) {\n\t\tconst slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);\n\t\tslot.p(slot_context, slot_changes);\n\t}\n}\n\n/** @returns {void} */\nexport function update_slot(\n\tslot,\n\tslot_definition,\n\tctx,\n\t$$scope,\n\tdirty,\n\tget_slot_changes_fn,\n\tget_slot_context_fn\n) {\n\tconst slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn);\n\tupdate_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn);\n}\n\n/** @returns {any[] | -1} */\nexport function get_all_dirty_from_scope($$scope) {\n\tif ($$scope.ctx.length > 32) {\n\t\tconst dirty = [];\n\t\tconst length = $$scope.ctx.length / 32;\n\t\tfor (let i = 0; i < length; i++) {\n\t\t\tdirty[i] = -1;\n\t\t}\n\t\treturn dirty;\n\t}\n\treturn -1;\n}\n\n/** @returns {{}} */\nexport function exclude_internal_props(props) {\n\tconst result = {};\n\tfor (const k in props) if (k[0] !== '$') result[k] = props[k];\n\treturn result;\n}\n\n/** @returns {{}} */\nexport function compute_rest_props(props, keys) {\n\tconst rest = {};\n\tkeys = new Set(keys);\n\tfor (const k in props) if (!keys.has(k) && k[0] !== '$') rest[k] = props[k];\n\treturn rest;\n}\n\n/** @returns {{}} */\nexport function compute_slots(slots) {\n\tconst result = {};\n\tfor (const key in slots) {\n\t\tresult[key] = true;\n\t}\n\treturn result;\n}\n\n/** @returns {(this: any, ...args: any[]) => void} */\nexport function once(fn) {\n\tlet ran = false;\n\treturn function (...args) {\n\t\tif (ran) return;\n\t\tran = true;\n\t\tfn.call(this, ...args);\n\t};\n}\n\nexport function null_to_empty(value) {\n\treturn value == null ? '' : value;\n}\n\nexport function set_store_value(store, ret, value) {\n\tstore.set(value);\n\treturn ret;\n}\n\nexport const has_prop = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\n\nexport function action_destroyer(action_result) {\n\treturn action_result && is_function(action_result.destroy) ? action_result.destroy : noop;\n}\n\n/** @param {number | string} value\n * @returns {[number, string]}\n */\nexport function split_css_unit(value) {\n\tconst split = typeof value === 'string' && value.match(/^\\s*(-?[\\d.]+)([^\\s]*)\\s*$/);\n\treturn split ? [parseFloat(split[1]), split[2] || 'px'] : [/** @type {number} */ (value), 'px'];\n}\n\nexport const contenteditable_truthy_values = ['', true, 1, 'true', 'contenteditable'];\n","import { noop } from './utils.js';\n\nexport const is_client = typeof window !== 'undefined';\n\n/** @type {() => number} */\nexport let now = is_client ? () => window.performance.now() : () => Date.now();\n\nexport let raf = is_client ? (cb) => requestAnimationFrame(cb) : noop;\n\n// used internally for testing\n/** @returns {void} */\nexport function set_now(fn) {\n\tnow = fn;\n}\n\n/** @returns {void} */\nexport function set_raf(fn) {\n\traf = fn;\n}\n","import { raf } from './environment.js';\n\nconst tasks = new Set();\n\n/**\n * @param {number} now\n * @returns {void}\n */\nfunction run_tasks(now) {\n\ttasks.forEach((task) => {\n\t\tif (!task.c(now)) {\n\t\t\ttasks.delete(task);\n\t\t\ttask.f();\n\t\t}\n\t});\n\tif (tasks.size !== 0) raf(run_tasks);\n}\n\n/**\n * For testing purposes only!\n * @returns {void}\n */\nexport function clear_loops() {\n\ttasks.clear();\n}\n\n/**\n * Creates a new task that runs on each raf frame\n * until it returns a falsy value or is aborted\n * @param {import('./private.js').TaskCallback} callback\n * @returns {import('./private.js').Task}\n */\nexport function loop(callback) {\n\t/** @type {import('./private.js').TaskEntry} */\n\tlet task;\n\tif (tasks.size === 0) raf(run_tasks);\n\treturn {\n\t\tpromise: new Promise((fulfill) => {\n\t\t\ttasks.add((task = { c: callback, f: fulfill }));\n\t\t}),\n\t\tabort() {\n\t\t\ttasks.delete(task);\n\t\t}\n\t};\n}\n","import { ResizeObserverSingleton } from './ResizeObserverSingleton.js';\nimport { contenteditable_truthy_values, has_prop } from './utils.js';\n// Track which nodes are claimed during hydration. Unclaimed nodes can then be removed from the DOM\n// at the end of hydration without touching the remaining nodes.\nlet is_hydrating = false;\n\n/**\n * @returns {void}\n */\nexport function start_hydrating() {\n\tis_hydrating = true;\n}\n\n/**\n * @returns {void}\n */\nexport function end_hydrating() {\n\tis_hydrating = false;\n}\n\n/**\n * @param {number} low\n * @param {number} high\n * @param {(index: number) => number} key\n * @param {number} value\n * @returns {number}\n */\nfunction upper_bound(low, high, key, value) {\n\t// Return first index of value larger than input value in the range [low, high)\n\twhile (low < high) {\n\t\tconst mid = low + ((high - low) >> 1);\n\t\tif (key(mid) <= value) {\n\t\t\tlow = mid + 1;\n\t\t} else {\n\t\t\thigh = mid;\n\t\t}\n\t}\n\treturn low;\n}\n\n/**\n * @param {NodeEx} target\n * @returns {void}\n */\nfunction init_hydrate(target) {\n\tif (target.hydrate_init) return;\n\ttarget.hydrate_init = true;\n\t// We know that all children have claim_order values since the unclaimed have been detached if target is not \n\n\tlet children = /** @type {ArrayLike} */ (target.childNodes);\n\t// If target is , there may be children without claim_order\n\tif (target.nodeName === 'HEAD') {\n\t\tconst myChildren = [];\n\t\tfor (let i = 0; i < children.length; i++) {\n\t\t\tconst node = children[i];\n\t\t\tif (node.claim_order !== undefined) {\n\t\t\t\tmyChildren.push(node);\n\t\t\t}\n\t\t}\n\t\tchildren = myChildren;\n\t}\n\t/*\n\t * Reorder claimed children optimally.\n\t * We can reorder claimed children optimally by finding the longest subsequence of\n\t * nodes that are already claimed in order and only moving the rest. The longest\n\t * subsequence of nodes that are claimed in order can be found by\n\t * computing the longest increasing subsequence of .claim_order values.\n\t *\n\t * This algorithm is optimal in generating the least amount of reorder operations\n\t * possible.\n\t *\n\t * Proof:\n\t * We know that, given a set of reordering operations, the nodes that do not move\n\t * always form an increasing subsequence, since they do not move among each other\n\t * meaning that they must be already ordered among each other. Thus, the maximal\n\t * set of nodes that do not move form a longest increasing subsequence.\n\t */\n\t// Compute longest increasing subsequence\n\t// m: subsequence length j => index k of smallest value that ends an increasing subsequence of length j\n\tconst m = new Int32Array(children.length + 1);\n\t// Predecessor indices + 1\n\tconst p = new Int32Array(children.length);\n\tm[0] = -1;\n\tlet longest = 0;\n\tfor (let i = 0; i < children.length; i++) {\n\t\tconst current = children[i].claim_order;\n\t\t// Find the largest subsequence length such that it ends in a value less than our current value\n\t\t// upper_bound returns first greater value, so we subtract one\n\t\t// with fast path for when we are on the current longest subsequence\n\t\tconst seqLen =\n\t\t\t(longest > 0 && children[m[longest]].claim_order <= current\n\t\t\t\t? longest + 1\n\t\t\t\t: upper_bound(1, longest, (idx) => children[m[idx]].claim_order, current)) - 1;\n\t\tp[i] = m[seqLen] + 1;\n\t\tconst newLen = seqLen + 1;\n\t\t// We can guarantee that current is the smallest value. Otherwise, we would have generated a longer sequence.\n\t\tm[newLen] = i;\n\t\tlongest = Math.max(newLen, longest);\n\t}\n\t// The longest increasing subsequence of nodes (initially reversed)\n\n\t/**\n\t * @type {NodeEx2[]}\n\t */\n\tconst lis = [];\n\t// The rest of the nodes, nodes that will be moved\n\n\t/**\n\t * @type {NodeEx2[]}\n\t */\n\tconst toMove = [];\n\tlet last = children.length - 1;\n\tfor (let cur = m[longest] + 1; cur != 0; cur = p[cur - 1]) {\n\t\tlis.push(children[cur - 1]);\n\t\tfor (; last >= cur; last--) {\n\t\t\ttoMove.push(children[last]);\n\t\t}\n\t\tlast--;\n\t}\n\tfor (; last >= 0; last--) {\n\t\ttoMove.push(children[last]);\n\t}\n\tlis.reverse();\n\t// We sort the nodes being moved to guarantee that their insertion order matches the claim order\n\ttoMove.sort((a, b) => a.claim_order - b.claim_order);\n\t// Finally, we move the nodes\n\tfor (let i = 0, j = 0; i < toMove.length; i++) {\n\t\twhile (j < lis.length && toMove[i].claim_order >= lis[j].claim_order) {\n\t\t\tj++;\n\t\t}\n\t\tconst anchor = j < lis.length ? lis[j] : null;\n\t\ttarget.insertBefore(toMove[i], anchor);\n\t}\n}\n\n/**\n * @param {Node} target\n * @param {Node} node\n * @returns {void}\n */\nexport function append(target, node) {\n\ttarget.appendChild(node);\n}\n\n/**\n * @param {Node} target\n * @param {string} style_sheet_id\n * @param {string} styles\n * @returns {void}\n */\nexport function append_styles(target, style_sheet_id, styles) {\n\tconst append_styles_to = get_root_for_style(target);\n\tif (!append_styles_to.getElementById(style_sheet_id)) {\n\t\tconst style = element('style');\n\t\tstyle.id = style_sheet_id;\n\t\tstyle.textContent = styles;\n\t\tappend_stylesheet(append_styles_to, style);\n\t}\n}\n\n/**\n * @param {Node} node\n * @returns {ShadowRoot | Document}\n */\nexport function get_root_for_style(node) {\n\tif (!node) return document;\n\tconst root = node.getRootNode ? node.getRootNode() : node.ownerDocument;\n\tif (root && /** @type {ShadowRoot} */ (root).host) {\n\t\treturn /** @type {ShadowRoot} */ (root);\n\t}\n\treturn node.ownerDocument;\n}\n\n/**\n * @param {Node} node\n * @returns {CSSStyleSheet}\n */\nexport function append_empty_stylesheet(node) {\n\tconst style_element = element('style');\n\t// For transitions to work without 'style-src: unsafe-inline' Content Security Policy,\n\t// these empty tags need to be allowed with a hash as a workaround until we move to the Web Animations API.\n\t// Using the hash for the empty string (for an empty tag) works in all browsers except Safari.\n\t// So as a workaround for the workaround, when we append empty style tags we set their content to /* empty */.\n\t// The hash 'sha256-9OlNO0DNEeaVzHL4RZwCLsBHA8WBQ8toBp/4F5XV2nc=' will then work even in Safari.\n\tstyle_element.textContent = '/* empty */';\n\tappend_stylesheet(get_root_for_style(node), style_element);\n\treturn style_element.sheet;\n}\n\n/**\n * @param {ShadowRoot | Document} node\n * @param {HTMLStyleElement} style\n * @returns {CSSStyleSheet}\n */\nfunction append_stylesheet(node, style) {\n\tappend(/** @type {Document} */ (node).head || node, style);\n\treturn style.sheet;\n}\n\n/**\n * @param {NodeEx} target\n * @param {NodeEx} node\n * @returns {void}\n */\nexport function append_hydration(target, node) {\n\tif (is_hydrating) {\n\t\tinit_hydrate(target);\n\t\tif (\n\t\t\ttarget.actual_end_child === undefined ||\n\t\t\t(target.actual_end_child !== null && target.actual_end_child.parentNode !== target)\n\t\t) {\n\t\t\ttarget.actual_end_child = target.firstChild;\n\t\t}\n\t\t// Skip nodes of undefined ordering\n\t\twhile (target.actual_end_child !== null && target.actual_end_child.claim_order === undefined) {\n\t\t\ttarget.actual_end_child = target.actual_end_child.nextSibling;\n\t\t}\n\t\tif (node !== target.actual_end_child) {\n\t\t\t// We only insert if the ordering of this node should be modified or the parent node is not target\n\t\t\tif (node.claim_order !== undefined || node.parentNode !== target) {\n\t\t\t\ttarget.insertBefore(node, target.actual_end_child);\n\t\t\t}\n\t\t} else {\n\t\t\ttarget.actual_end_child = node.nextSibling;\n\t\t}\n\t} else if (node.parentNode !== target || node.nextSibling !== null) {\n\t\ttarget.appendChild(node);\n\t}\n}\n\n/**\n * @param {Node} target\n * @param {Node} node\n * @param {Node} [anchor]\n * @returns {void}\n */\nexport function insert(target, node, anchor) {\n\ttarget.insertBefore(node, anchor || null);\n}\n\n/**\n * @param {NodeEx} target\n * @param {NodeEx} node\n * @param {NodeEx} [anchor]\n * @returns {void}\n */\nexport function insert_hydration(target, node, anchor) {\n\tif (is_hydrating && !anchor) {\n\t\tappend_hydration(target, node);\n\t} else if (node.parentNode !== target || node.nextSibling != anchor) {\n\t\ttarget.insertBefore(node, anchor || null);\n\t}\n}\n\n/**\n * @param {Node} node\n * @returns {void}\n */\nexport function detach(node) {\n\tif (node.parentNode) {\n\t\tnode.parentNode.removeChild(node);\n\t}\n}\n\n/**\n * @returns {void} */\nexport function destroy_each(iterations, detaching) {\n\tfor (let i = 0; i < iterations.length; i += 1) {\n\t\tif (iterations[i]) iterations[i].d(detaching);\n\t}\n}\n\n/**\n * @template {keyof HTMLElementTagNameMap} K\n * @param {K} name\n * @returns {HTMLElementTagNameMap[K]}\n */\nexport function element(name) {\n\treturn document.createElement(name);\n}\n\n/**\n * @template {keyof HTMLElementTagNameMap} K\n * @param {K} name\n * @param {string} is\n * @returns {HTMLElementTagNameMap[K]}\n */\nexport function element_is(name, is) {\n\treturn document.createElement(name, { is });\n}\n\n/**\n * @template T\n * @template {keyof T} K\n * @param {T} obj\n * @param {K[]} exclude\n * @returns {Pick>}\n */\nexport function object_without_properties(obj, exclude) {\n\tconst target = /** @type {Pick>} */ ({});\n\tfor (const k in obj) {\n\t\tif (\n\t\t\thas_prop(obj, k) &&\n\t\t\t// @ts-ignore\n\t\t\texclude.indexOf(k) === -1\n\t\t) {\n\t\t\t// @ts-ignore\n\t\t\ttarget[k] = obj[k];\n\t\t}\n\t}\n\treturn target;\n}\n\n/**\n * @template {keyof SVGElementTagNameMap} K\n * @param {K} name\n * @returns {SVGElement}\n */\nexport function svg_element(name) {\n\treturn document.createElementNS('http://www.w3.org/2000/svg', name);\n}\n\n/**\n * @param {string} data\n * @returns {Text}\n */\nexport function text(data) {\n\treturn document.createTextNode(data);\n}\n\n/**\n * @returns {Text} */\nexport function space() {\n\treturn text(' ');\n}\n\n/**\n * @returns {Text} */\nexport function empty() {\n\treturn text('');\n}\n\n/**\n * @param {string} content\n * @returns {Comment}\n */\nexport function comment(content) {\n\treturn document.createComment(content);\n}\n\n/**\n * @param {EventTarget} node\n * @param {string} event\n * @param {EventListenerOrEventListenerObject} handler\n * @param {boolean | AddEventListenerOptions | EventListenerOptions} [options]\n * @returns {() => void}\n */\nexport function listen(node, event, handler, options) {\n\tnode.addEventListener(event, handler, options);\n\treturn () => node.removeEventListener(event, handler, options);\n}\n\n/**\n * @returns {(event: any) => any} */\nexport function prevent_default(fn) {\n\treturn function (event) {\n\t\tevent.preventDefault();\n\t\t// @ts-ignore\n\t\treturn fn.call(this, event);\n\t};\n}\n\n/**\n * @returns {(event: any) => any} */\nexport function stop_propagation(fn) {\n\treturn function (event) {\n\t\tevent.stopPropagation();\n\t\t// @ts-ignore\n\t\treturn fn.call(this, event);\n\t};\n}\n\n/**\n * @returns {(event: any) => any} */\nexport function stop_immediate_propagation(fn) {\n\treturn function (event) {\n\t\tevent.stopImmediatePropagation();\n\t\t// @ts-ignore\n\t\treturn fn.call(this, event);\n\t};\n}\n\n/**\n * @returns {(event: any) => void} */\nexport function self(fn) {\n\treturn function (event) {\n\t\t// @ts-ignore\n\t\tif (event.target === this) fn.call(this, event);\n\t};\n}\n\n/**\n * @returns {(event: any) => void} */\nexport function trusted(fn) {\n\treturn function (event) {\n\t\t// @ts-ignore\n\t\tif (event.isTrusted) fn.call(this, event);\n\t};\n}\n\n/**\n * @param {Element} node\n * @param {string} attribute\n * @param {string} [value]\n * @returns {void}\n */\nexport function attr(node, attribute, value) {\n\tif (value == null) node.removeAttribute(attribute);\n\telse if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value);\n}\n/**\n * List of attributes that should always be set through the attr method,\n * because updating them through the property setter doesn't work reliably.\n * In the example of `width`/`height`, the problem is that the setter only\n * accepts numeric values, but the attribute can also be set to a string like `50%`.\n * If this list becomes too big, rethink this approach.\n */\nconst always_set_through_set_attribute = ['width', 'height'];\n\n/**\n * @param {Element & ElementCSSInlineStyle} node\n * @param {{ [x: string]: string }} attributes\n * @returns {void}\n */\nexport function set_attributes(node, attributes) {\n\t// @ts-ignore\n\tconst descriptors = Object.getOwnPropertyDescriptors(node.__proto__);\n\tfor (const key in attributes) {\n\t\tif (attributes[key] == null) {\n\t\t\tnode.removeAttribute(key);\n\t\t} else if (key === 'style') {\n\t\t\tnode.style.cssText = attributes[key];\n\t\t} else if (key === '__value') {\n\t\t\t/** @type {any} */ (node).value = node[key] = attributes[key];\n\t\t} else if (\n\t\t\tdescriptors[key] &&\n\t\t\tdescriptors[key].set &&\n\t\t\talways_set_through_set_attribute.indexOf(key) === -1\n\t\t) {\n\t\t\tnode[key] = attributes[key];\n\t\t} else {\n\t\t\tattr(node, key, attributes[key]);\n\t\t}\n\t}\n}\n\n/**\n * @param {Element & ElementCSSInlineStyle} node\n * @param {{ [x: string]: string }} attributes\n * @returns {void}\n */\nexport function set_svg_attributes(node, attributes) {\n\tfor (const key in attributes) {\n\t\tattr(node, key, attributes[key]);\n\t}\n}\n\n/**\n * @param {Record} data_map\n * @returns {void}\n */\nexport function set_custom_element_data_map(node, data_map) {\n\tObject.keys(data_map).forEach((key) => {\n\t\tset_custom_element_data(node, key, data_map[key]);\n\t});\n}\n\n/**\n * @returns {void} */\nexport function set_custom_element_data(node, prop, value) {\n\tif (prop in node) {\n\t\tnode[prop] = typeof node[prop] === 'boolean' && value === '' ? true : value;\n\t} else {\n\t\tattr(node, prop, value);\n\t}\n}\n\n/**\n * @param {string} tag\n */\nexport function set_dynamic_element_data(tag) {\n\treturn /-/.test(tag) ? set_custom_element_data_map : set_attributes;\n}\n\n/**\n * @returns {void}\n */\nexport function xlink_attr(node, attribute, value) {\n\tnode.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\n\n/**\n * @param {HTMLElement} node\n * @returns {string}\n */\nexport function get_svelte_dataset(node) {\n\treturn node.dataset.svelteH;\n}\n\n/**\n * @returns {unknown[]} */\nexport function get_binding_group_value(group, __value, checked) {\n\tconst value = new Set();\n\tfor (let i = 0; i < group.length; i += 1) {\n\t\tif (group[i].checked) value.add(group[i].__value);\n\t}\n\tif (!checked) {\n\t\tvalue.delete(__value);\n\t}\n\treturn Array.from(value);\n}\n\n/**\n * @param {HTMLInputElement[]} group\n * @returns {{ p(...inputs: HTMLInputElement[]): void; r(): void; }}\n */\nexport function init_binding_group(group) {\n\t/**\n\t * @type {HTMLInputElement[]} */\n\tlet _inputs;\n\treturn {\n\t\t/* push */ p(...inputs) {\n\t\t\t_inputs = inputs;\n\t\t\t_inputs.forEach((input) => group.push(input));\n\t\t},\n\t\t/* remove */ r() {\n\t\t\t_inputs.forEach((input) => group.splice(group.indexOf(input), 1));\n\t\t}\n\t};\n}\n\n/**\n * @param {number[]} indexes\n * @returns {{ u(new_indexes: number[]): void; p(...inputs: HTMLInputElement[]): void; r: () => void; }}\n */\nexport function init_binding_group_dynamic(group, indexes) {\n\t/**\n\t * @type {HTMLInputElement[]} */\n\tlet _group = get_binding_group(group);\n\n\t/**\n\t * @type {HTMLInputElement[]} */\n\tlet _inputs;\n\n\tfunction get_binding_group(group) {\n\t\tfor (let i = 0; i < indexes.length; i++) {\n\t\t\tgroup = group[indexes[i]] = group[indexes[i]] || [];\n\t\t}\n\t\treturn group;\n\t}\n\n\t/**\n\t * @returns {void} */\n\tfunction push() {\n\t\t_inputs.forEach((input) => _group.push(input));\n\t}\n\n\t/**\n\t * @returns {void} */\n\tfunction remove() {\n\t\t_inputs.forEach((input) => _group.splice(_group.indexOf(input), 1));\n\t}\n\treturn {\n\t\t/* update */ u(new_indexes) {\n\t\t\tindexes = new_indexes;\n\t\t\tconst new_group = get_binding_group(group);\n\t\t\tif (new_group !== _group) {\n\t\t\t\tremove();\n\t\t\t\t_group = new_group;\n\t\t\t\tpush();\n\t\t\t}\n\t\t},\n\t\t/* push */ p(...inputs) {\n\t\t\t_inputs = inputs;\n\t\t\tpush();\n\t\t},\n\t\t/* remove */ r: remove\n\t};\n}\n\n/**\n * @returns {number} */\nexport function to_number(value) {\n\treturn value === '' ? null : +value;\n}\n\n/**\n * @returns {any[]} */\nexport function time_ranges_to_array(ranges) {\n\tconst array = [];\n\tfor (let i = 0; i < ranges.length; i += 1) {\n\t\tarray.push({ start: ranges.start(i), end: ranges.end(i) });\n\t}\n\treturn array;\n}\n\n/**\n * @param {Element} element\n * @returns {ChildNode[]}\n */\nexport function children(element) {\n\treturn Array.from(element.childNodes);\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @returns {void}\n */\nfunction init_claim_info(nodes) {\n\tif (nodes.claim_info === undefined) {\n\t\tnodes.claim_info = { last_index: 0, total_claimed: 0 };\n\t}\n}\n\n/**\n * @template {ChildNodeEx} R\n * @param {ChildNodeArray} nodes\n * @param {(node: ChildNodeEx) => node is R} predicate\n * @param {(node: ChildNodeEx) => ChildNodeEx | undefined} processNode\n * @param {() => R} createNode\n * @param {boolean} dontUpdateLastIndex\n * @returns {R}\n */\nfunction claim_node(nodes, predicate, processNode, createNode, dontUpdateLastIndex = false) {\n\t// Try to find nodes in an order such that we lengthen the longest increasing subsequence\n\tinit_claim_info(nodes);\n\tconst resultNode = (() => {\n\t\t// We first try to find an element after the previous one\n\t\tfor (let i = nodes.claim_info.last_index; i < nodes.length; i++) {\n\t\t\tconst node = nodes[i];\n\t\t\tif (predicate(node)) {\n\t\t\t\tconst replacement = processNode(node);\n\t\t\t\tif (replacement === undefined) {\n\t\t\t\t\tnodes.splice(i, 1);\n\t\t\t\t} else {\n\t\t\t\t\tnodes[i] = replacement;\n\t\t\t\t}\n\t\t\t\tif (!dontUpdateLastIndex) {\n\t\t\t\t\tnodes.claim_info.last_index = i;\n\t\t\t\t}\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t\t// Otherwise, we try to find one before\n\t\t// We iterate in reverse so that we don't go too far back\n\t\tfor (let i = nodes.claim_info.last_index - 1; i >= 0; i--) {\n\t\t\tconst node = nodes[i];\n\t\t\tif (predicate(node)) {\n\t\t\t\tconst replacement = processNode(node);\n\t\t\t\tif (replacement === undefined) {\n\t\t\t\t\tnodes.splice(i, 1);\n\t\t\t\t} else {\n\t\t\t\t\tnodes[i] = replacement;\n\t\t\t\t}\n\t\t\t\tif (!dontUpdateLastIndex) {\n\t\t\t\t\tnodes.claim_info.last_index = i;\n\t\t\t\t} else if (replacement === undefined) {\n\t\t\t\t\t// Since we spliced before the last_index, we decrease it\n\t\t\t\t\tnodes.claim_info.last_index--;\n\t\t\t\t}\n\t\t\t\treturn node;\n\t\t\t}\n\t\t}\n\t\t// If we can't find any matching node, we create a new one\n\t\treturn createNode();\n\t})();\n\tresultNode.claim_order = nodes.claim_info.total_claimed;\n\tnodes.claim_info.total_claimed += 1;\n\treturn resultNode;\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @param {string} name\n * @param {{ [key: string]: boolean }} attributes\n * @param {(name: string) => Element | SVGElement} create_element\n * @returns {Element | SVGElement}\n */\nfunction claim_element_base(nodes, name, attributes, create_element) {\n\treturn claim_node(\n\t\tnodes,\n\t\t/** @returns {node is Element | SVGElement} */\n\t\t(node) => node.nodeName === name,\n\t\t/** @param {Element} node */\n\t\t(node) => {\n\t\t\tconst remove = [];\n\t\t\tfor (let j = 0; j < node.attributes.length; j++) {\n\t\t\t\tconst attribute = node.attributes[j];\n\t\t\t\tif (!attributes[attribute.name]) {\n\t\t\t\t\tremove.push(attribute.name);\n\t\t\t\t}\n\t\t\t}\n\t\t\tremove.forEach((v) => node.removeAttribute(v));\n\t\t\treturn undefined;\n\t\t},\n\t\t() => create_element(name)\n\t);\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @param {string} name\n * @param {{ [key: string]: boolean }} attributes\n * @returns {Element | SVGElement}\n */\nexport function claim_element(nodes, name, attributes) {\n\treturn claim_element_base(nodes, name, attributes, element);\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @param {string} name\n * @param {{ [key: string]: boolean }} attributes\n * @returns {Element | SVGElement}\n */\nexport function claim_svg_element(nodes, name, attributes) {\n\treturn claim_element_base(nodes, name, attributes, svg_element);\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @returns {Text}\n */\nexport function claim_text(nodes, data) {\n\treturn claim_node(\n\t\tnodes,\n\t\t/** @returns {node is Text} */\n\t\t(node) => node.nodeType === 3,\n\t\t/** @param {Text} node */\n\t\t(node) => {\n\t\t\tconst dataStr = '' + data;\n\t\t\tif (node.data.startsWith(dataStr)) {\n\t\t\t\tif (node.data.length !== dataStr.length) {\n\t\t\t\t\treturn node.splitText(dataStr.length);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnode.data = dataStr;\n\t\t\t}\n\t\t},\n\t\t() => text(data),\n\t\ttrue // Text nodes should not update last index since it is likely not worth it to eliminate an increasing subsequence of actual elements\n\t);\n}\n\n/**\n * @returns {Text} */\nexport function claim_space(nodes) {\n\treturn claim_text(nodes, ' ');\n}\n\n/**\n * @param {ChildNodeArray} nodes\n * @returns {Comment}\n */\nexport function claim_comment(nodes, data) {\n\treturn claim_node(\n\t\tnodes,\n\t\t/** @returns {node is Comment} */\n\t\t(node) => node.nodeType === 8,\n\t\t/** @param {Comment} node */\n\t\t(node) => {\n\t\t\tnode.data = '' + data;\n\t\t\treturn undefined;\n\t\t},\n\t\t() => comment(data),\n\t\ttrue\n\t);\n}\n\nfunction find_comment(nodes, text, start) {\n\tfor (let i = start; i < nodes.length; i += 1) {\n\t\tconst node = nodes[i];\n\t\tif (node.nodeType === 8 /* comment node */ && node.textContent.trim() === text) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn nodes.length;\n}\n\n/**\n * @param {boolean} is_svg\n * @returns {HtmlTagHydration}\n */\nexport function claim_html_tag(nodes, is_svg) {\n\t// find html opening tag\n\tconst start_index = find_comment(nodes, 'HTML_TAG_START', 0);\n\tconst end_index = find_comment(nodes, 'HTML_TAG_END', start_index);\n\tif (start_index === end_index) {\n\t\treturn new HtmlTagHydration(undefined, is_svg);\n\t}\n\tinit_claim_info(nodes);\n\tconst html_tag_nodes = nodes.splice(start_index, end_index - start_index + 1);\n\tdetach(html_tag_nodes[0]);\n\tdetach(html_tag_nodes[html_tag_nodes.length - 1]);\n\tconst claimed_nodes = html_tag_nodes.slice(1, html_tag_nodes.length - 1);\n\tfor (const n of claimed_nodes) {\n\t\tn.claim_order = nodes.claim_info.total_claimed;\n\t\tnodes.claim_info.total_claimed += 1;\n\t}\n\treturn new HtmlTagHydration(claimed_nodes, is_svg);\n}\n\n/**\n * @param {Text} text\n * @param {unknown} data\n * @returns {void}\n */\nexport function set_data(text, data) {\n\tdata = '' + data;\n\tif (text.data === data) return;\n\ttext.data = /** @type {string} */ (data);\n}\n\n/**\n * @param {Text} text\n * @param {unknown} data\n * @returns {void}\n */\nexport function set_data_contenteditable(text, data) {\n\tdata = '' + data;\n\tif (text.wholeText === data) return;\n\ttext.data = /** @type {string} */ (data);\n}\n\n/**\n * @param {Text} text\n * @param {unknown} data\n * @param {string} attr_value\n * @returns {void}\n */\nexport function set_data_maybe_contenteditable(text, data, attr_value) {\n\tif (~contenteditable_truthy_values.indexOf(attr_value)) {\n\t\tset_data_contenteditable(text, data);\n\t} else {\n\t\tset_data(text, data);\n\t}\n}\n\n/**\n * @returns {void} */\nexport function set_input_value(input, value) {\n\tinput.value = value == null ? '' : value;\n}\n\n/**\n * @returns {void} */\nexport function set_input_type(input, type) {\n\ttry {\n\t\tinput.type = type;\n\t} catch (e) {\n\t\t// do nothing\n\t}\n}\n\n/**\n * @returns {void} */\nexport function set_style(node, key, value, important) {\n\tif (value == null) {\n\t\tnode.style.removeProperty(key);\n\t} else {\n\t\tnode.style.setProperty(key, value, important ? 'important' : '');\n\t}\n}\n\n/**\n * @returns {void} */\nexport function select_option(select, value, mounting) {\n\tfor (let i = 0; i < select.options.length; i += 1) {\n\t\tconst option = select.options[i];\n\t\tif (option.__value === value) {\n\t\t\toption.selected = true;\n\t\t\treturn;\n\t\t}\n\t}\n\tif (!mounting || value !== undefined) {\n\t\tselect.selectedIndex = -1; // no option should be selected\n\t}\n}\n\n/**\n * @returns {void} */\nexport function select_options(select, value) {\n\tfor (let i = 0; i < select.options.length; i += 1) {\n\t\tconst option = select.options[i];\n\t\toption.selected = ~value.indexOf(option.__value);\n\t}\n}\n\nexport function select_value(select) {\n\tconst selected_option = select.querySelector(':checked');\n\treturn selected_option && selected_option.__value;\n}\n\nexport function select_multiple_value(select) {\n\treturn [].map.call(select.querySelectorAll(':checked'), (option) => option.__value);\n}\n// unfortunately this can't be a constant as that wouldn't be tree-shakeable\n// so we cache the result instead\n\n/**\n * @type {boolean} */\nlet crossorigin;\n\n/**\n * @returns {boolean} */\nexport function is_crossorigin() {\n\tif (crossorigin === undefined) {\n\t\tcrossorigin = false;\n\t\ttry {\n\t\t\tif (typeof window !== 'undefined' && window.parent) {\n\t\t\t\tvoid window.parent.document;\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tcrossorigin = true;\n\t\t}\n\t}\n\treturn crossorigin;\n}\n\n/**\n * @param {HTMLElement} node\n * @param {() => void} fn\n * @returns {() => void}\n */\nexport function add_iframe_resize_listener(node, fn) {\n\tconst computed_style = getComputedStyle(node);\n\tif (computed_style.position === 'static') {\n\t\tnode.style.position = 'relative';\n\t}\n\tconst iframe = element('iframe');\n\tiframe.setAttribute(\n\t\t'style',\n\t\t'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +\n\t\t\t'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;'\n\t);\n\tiframe.setAttribute('aria-hidden', 'true');\n\tiframe.tabIndex = -1;\n\tconst crossorigin = is_crossorigin();\n\n\t/**\n\t * @type {() => void}\n\t */\n\tlet unsubscribe;\n\tif (crossorigin) {\n\t\tiframe.src = \"data:text/html,\";\n\t\tunsubscribe = listen(\n\t\t\twindow,\n\t\t\t'message',\n\t\t\t/** @param {MessageEvent} event */ (event) => {\n\t\t\t\tif (event.source === iframe.contentWindow) fn();\n\t\t\t}\n\t\t);\n\t} else {\n\t\tiframe.src = 'about:blank';\n\t\tiframe.onload = () => {\n\t\t\tunsubscribe = listen(iframe.contentWindow, 'resize', fn);\n\t\t\t// make sure an initial resize event is fired _after_ the iframe is loaded (which is asynchronous)\n\t\t\t// see https://github.com/sveltejs/svelte/issues/4233\n\t\t\tfn();\n\t\t};\n\t}\n\tappend(node, iframe);\n\treturn () => {\n\t\tif (crossorigin) {\n\t\t\tunsubscribe();\n\t\t} else if (unsubscribe && iframe.contentWindow) {\n\t\t\tunsubscribe();\n\t\t}\n\t\tdetach(iframe);\n\t};\n}\nexport const resize_observer_content_box = /* @__PURE__ */ new ResizeObserverSingleton({\n\tbox: 'content-box'\n});\nexport const resize_observer_border_box = /* @__PURE__ */ new ResizeObserverSingleton({\n\tbox: 'border-box'\n});\nexport const resize_observer_device_pixel_content_box = /* @__PURE__ */ new ResizeObserverSingleton(\n\t{ box: 'device-pixel-content-box' }\n);\nexport { ResizeObserverSingleton };\n\n/**\n * @returns {void} */\nexport function toggle_class(element, name, toggle) {\n\t// The `!!` is required because an `undefined` flag means flipping the current state.\n\telement.classList.toggle(name, !!toggle);\n}\n\n/**\n * @template T\n * @param {string} type\n * @param {T} [detail]\n * @param {{ bubbles?: boolean, cancelable?: boolean }} [options]\n * @returns {CustomEvent}\n */\nexport function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {\n\treturn new CustomEvent(type, { detail, bubbles, cancelable });\n}\n\n/**\n * @param {string} selector\n * @param {HTMLElement} parent\n * @returns {ChildNodeArray}\n */\nexport function query_selector_all(selector, parent = document.body) {\n\treturn Array.from(parent.querySelectorAll(selector));\n}\n\n/**\n * @param {string} nodeId\n * @param {HTMLElement} head\n * @returns {any[]}\n */\nexport function head_selector(nodeId, head) {\n\tconst result = [];\n\tlet started = 0;\n\tfor (const node of head.childNodes) {\n\t\tif (node.nodeType === 8 /* comment node */) {\n\t\t\tconst comment = node.textContent.trim();\n\t\t\tif (comment === `HEAD_${nodeId}_END`) {\n\t\t\t\tstarted -= 1;\n\t\t\t\tresult.push(node);\n\t\t\t} else if (comment === `HEAD_${nodeId}_START`) {\n\t\t\t\tstarted += 1;\n\t\t\t\tresult.push(node);\n\t\t\t}\n\t\t} else if (started > 0) {\n\t\t\tresult.push(node);\n\t\t}\n\t}\n\treturn result;\n}\n/** */\nexport class HtmlTag {\n\t/**\n\t * @private\n\t * @default false\n\t */\n\tis_svg = false;\n\t// parent for creating node\n\t/** */\n\te = undefined;\n\t// html tag nodes\n\t/** */\n\tn = undefined;\n\t// target\n\t/** */\n\tt = undefined;\n\t// anchor\n\t/** */\n\ta = undefined;\n\tconstructor(is_svg = false) {\n\t\tthis.is_svg = is_svg;\n\t\tthis.e = this.n = null;\n\t}\n\n\t/**\n\t * @param {string} html\n\t * @returns {void}\n\t */\n\tc(html) {\n\t\tthis.h(html);\n\t}\n\n\t/**\n\t * @param {string} html\n\t * @param {HTMLElement | SVGElement} target\n\t * @param {HTMLElement | SVGElement} anchor\n\t * @returns {void}\n\t */\n\tm(html, target, anchor = null) {\n\t\tif (!this.e) {\n\t\t\tif (this.is_svg)\n\t\t\t\tthis.e = svg_element(/** @type {keyof SVGElementTagNameMap} */ (target.nodeName));\n\t\t\t/** #7364 target for