diff --git a/app/.prettierignore b/app/.prettierignore new file mode 100644 index 0000000..7773828 --- /dev/null +++ b/app/.prettierignore @@ -0,0 +1 @@ +dist/ \ No newline at end of file diff --git a/app/dist/assets/index-BvL2gZwe.css b/app/dist/assets/index-BvL2gZwe.css index afd0e21..5a6c227 100644 --- a/app/dist/assets/index-BvL2gZwe.css +++ b/app/dist/assets/index-BvL2gZwe.css @@ -1,1307 +1 @@ -/* -! tailwindcss v3.4.3 | MIT License | https://tailwindcss.com -*/ - -/* -1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4) -2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116) -*/ - -*, -::before, -::after { - box-sizing: border-box; - /* 1 */ - border-width: 0; - /* 2 */ - border-style: solid; - /* 2 */ - border-color: #e5e7eb; - /* 2 */ -} - -::before, -::after { - --tw-content: ''; -} - -/* -1. Use a consistent sensible line-height in all browsers. -2. Prevent adjustments of font size after orientation changes in iOS. -3. Use a more readable tab size. -4. Use the user's configured `sans` font-family by default. -5. Use the user's configured `sans` font-feature-settings by default. -6. Use the user's configured `sans` font-variation-settings by default. -7. Disable tap highlights on iOS -*/ - -html, -:host { - line-height: 1.5; - /* 1 */ - -webkit-text-size-adjust: 100%; - /* 2 */ - -moz-tab-size: 4; - /* 3 */ - -o-tab-size: 4; - tab-size: 4; - /* 3 */ - font-family: ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', - 'Segoe UI Symbol', 'Noto Color Emoji'; - /* 4 */ - font-feature-settings: normal; - /* 5 */ - font-variation-settings: normal; - /* 6 */ - -webkit-tap-highlight-color: transparent; - /* 7 */ -} - -/* -1. Remove the margin in all browsers. -2. Inherit line-height from `html` so users can set them as a class directly on the `html` element. -*/ - -body { - margin: 0; - /* 1 */ - line-height: inherit; - /* 2 */ -} - -/* -1. Add the correct height in Firefox. -2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655) -3. Ensure horizontal rules are visible by default. -*/ - -hr { - height: 0; - /* 1 */ - color: inherit; - /* 2 */ - border-top-width: 1px; - /* 3 */ -} - -/* -Add the correct text decoration in Chrome, Edge, and Safari. -*/ - -abbr:where([title]) { - -webkit-text-decoration: underline dotted; - text-decoration: underline dotted; -} - -/* -Remove the default font size and weight for headings. -*/ - -h1, -h2, -h3, -h4, -h5, -h6 { - font-size: inherit; - font-weight: inherit; -} - -/* -Reset links to optimize for opt-in styling instead of opt-out. -*/ - -a { - color: inherit; - text-decoration: inherit; -} - -/* -Add the correct font weight in Edge and Safari. -*/ - -b, -strong { - font-weight: bolder; -} - -/* -1. Use the user's configured `mono` font-family by default. -2. Use the user's configured `mono` font-feature-settings by default. -3. Use the user's configured `mono` font-variation-settings by default. -4. Correct the odd `em` font sizing in all browsers. -*/ - -code, -kbd, -samp, -pre { - font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', - 'Courier New', monospace; - /* 1 */ - font-feature-settings: normal; - /* 2 */ - font-variation-settings: normal; - /* 3 */ - font-size: 1em; - /* 4 */ -} - -/* -Add the correct font size in all browsers. -*/ - -small { - font-size: 80%; -} - -/* -Prevent `sub` and `sup` elements from affecting the line height in all browsers. -*/ - -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sub { - bottom: -0.25em; -} - -sup { - top: -0.5em; -} - -/* -1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297) -2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) -3. Remove gaps between table borders by default. -*/ - -table { - text-indent: 0; - /* 1 */ - border-color: inherit; - /* 2 */ - border-collapse: collapse; - /* 3 */ -} - -/* -1. Change the font styles in all browsers. -2. Remove the margin in Firefox and Safari. -3. Remove default padding in all browsers. -*/ - -button, -input, -optgroup, -select, -textarea { - font-family: inherit; - /* 1 */ - font-feature-settings: inherit; - /* 1 */ - font-variation-settings: inherit; - /* 1 */ - font-size: 100%; - /* 1 */ - font-weight: inherit; - /* 1 */ - line-height: inherit; - /* 1 */ - letter-spacing: inherit; - /* 1 */ - color: inherit; - /* 1 */ - margin: 0; - /* 2 */ - padding: 0; - /* 3 */ -} - -/* -Remove the inheritance of text transform in Edge and Firefox. -*/ - -button, -select { - text-transform: none; -} - -/* -1. Correct the inability to style clickable types in iOS and Safari. -2. Remove default button styles. -*/ - -button, -input:where([type='button']), -input:where([type='reset']), -input:where([type='submit']) { - -webkit-appearance: button; - /* 1 */ - background-color: transparent; - /* 2 */ - background-image: none; - /* 2 */ -} - -/* -Use the modern Firefox focus style for all focusable elements. -*/ - -:-moz-focusring { - outline: auto; -} - -/* -Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737) -*/ - -:-moz-ui-invalid { - box-shadow: none; -} - -/* -Add the correct vertical alignment in Chrome and Firefox. -*/ - -progress { - vertical-align: baseline; -} - -/* -Correct the cursor style of increment and decrement buttons in Safari. -*/ - -::-webkit-inner-spin-button, -::-webkit-outer-spin-button { - height: auto; -} - -/* -1. Correct the odd appearance in Chrome and Safari. -2. Correct the outline style in Safari. -*/ - -[type='search'] { - -webkit-appearance: textfield; - /* 1 */ - outline-offset: -2px; - /* 2 */ -} - -/* -Remove the inner padding in Chrome and Safari on macOS. -*/ - -::-webkit-search-decoration { - -webkit-appearance: none; -} - -/* -1. Correct the inability to style clickable types in iOS and Safari. -2. Change font properties to `inherit` in Safari. -*/ - -::-webkit-file-upload-button { - -webkit-appearance: button; - /* 1 */ - font: inherit; - /* 2 */ -} - -/* -Add the correct display in Chrome and Safari. -*/ - -summary { - display: list-item; -} - -/* -Removes the default spacing and border for appropriate elements. -*/ - -blockquote, -dl, -dd, -h1, -h2, -h3, -h4, -h5, -h6, -hr, -figure, -p, -pre { - margin: 0; -} - -fieldset { - margin: 0; - padding: 0; -} - -legend { - padding: 0; -} - -ol, -ul, -menu { - list-style: none; - margin: 0; - padding: 0; -} - -/* -Reset default styling for dialogs. -*/ - -dialog { - padding: 0; -} - -/* -Prevent resizing textareas horizontally by default. -*/ - -textarea { - resize: vertical; -} - -/* -1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300) -2. Set the default placeholder color to the user's configured gray 400 color. -*/ - -input::-moz-placeholder, -textarea::-moz-placeholder { - opacity: 1; - /* 1 */ - color: #9ca3af; - /* 2 */ -} - -input::placeholder, -textarea::placeholder { - opacity: 1; - /* 1 */ - color: #9ca3af; - /* 2 */ -} - -/* -Set the default cursor for buttons. -*/ - -button, -[role='button'] { - cursor: pointer; -} - -/* -Make sure disabled buttons don't get the pointer cursor. -*/ - -:disabled { - cursor: default; -} - -/* -1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14) -2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210) - This can trigger a poorly considered lint error in some tools but is included by design. -*/ - -img, -svg, -video, -canvas, -audio, -iframe, -embed, -object { - display: block; - /* 1 */ - vertical-align: middle; - /* 2 */ -} - -/* -Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14) -*/ - -img, -video { - max-width: 100%; - height: auto; -} - -/* Make elements with the HTML hidden attribute stay hidden by default */ - -[hidden] { - display: none; -} - -*, -::before, -::after { - --tw-border-spacing-x: 0; - --tw-border-spacing-y: 0; - --tw-translate-x: 0; - --tw-translate-y: 0; - --tw-rotate: 0; - --tw-skew-x: 0; - --tw-skew-y: 0; - --tw-scale-x: 1; - --tw-scale-y: 1; - --tw-pan-x: ; - --tw-pan-y: ; - --tw-pinch-zoom: ; - --tw-scroll-snap-strictness: proximity; - --tw-gradient-from-position: ; - --tw-gradient-via-position: ; - --tw-gradient-to-position: ; - --tw-ordinal: ; - --tw-slashed-zero: ; - --tw-numeric-figure: ; - --tw-numeric-spacing: ; - --tw-numeric-fraction: ; - --tw-ring-inset: ; - --tw-ring-offset-width: 0px; - --tw-ring-offset-color: #fff; - --tw-ring-color: rgb(59 130 246 / 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: ; - --tw-contain-size: ; - --tw-contain-layout: ; - --tw-contain-paint: ; - --tw-contain-style: ; -} - -::backdrop { - --tw-border-spacing-x: 0; - --tw-border-spacing-y: 0; - --tw-translate-x: 0; - --tw-translate-y: 0; - --tw-rotate: 0; - --tw-skew-x: 0; - --tw-skew-y: 0; - --tw-scale-x: 1; - --tw-scale-y: 1; - --tw-pan-x: ; - --tw-pan-y: ; - --tw-pinch-zoom: ; - --tw-scroll-snap-strictness: proximity; - --tw-gradient-from-position: ; - --tw-gradient-via-position: ; - --tw-gradient-to-position: ; - --tw-ordinal: ; - --tw-slashed-zero: ; - --tw-numeric-figure: ; - --tw-numeric-spacing: ; - --tw-numeric-fraction: ; - --tw-ring-inset: ; - --tw-ring-offset-width: 0px; - --tw-ring-offset-color: #fff; - --tw-ring-color: rgb(59 130 246 / 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: ; - --tw-contain-size: ; - --tw-contain-layout: ; - --tw-contain-paint: ; - --tw-contain-style: ; -} - -.container { - width: 100%; -} - -@media (min-width: 640px) { - .container { - max-width: 640px; - } -} - -@media (min-width: 768px) { - .container { - max-width: 768px; - } -} - -@media (min-width: 1024px) { - .container { - max-width: 1024px; - } -} - -@media (min-width: 1280px) { - .container { - max-width: 1280px; - } -} - -@media (min-width: 1536px) { - .container { - max-width: 1536px; - } -} - -.fixed { - position: fixed; -} - -.absolute { - position: absolute; -} - -.relative { - position: relative; -} - -.bottom-0 { - bottom: 0px; -} - -.left-0 { - left: 0px; -} - -.left-1\/4 { - left: 25%; -} - -.left-\[13\%\] { - left: 13%; -} - -.left-\[5\%\] { - left: 5%; -} - -.right-2 { - right: 0.5rem; -} - -.right-3 { - right: 0.75rem; -} - -.top-0 { - top: 0px; -} - -.top-1\/4 { - top: 25%; -} - -.top-2 { - top: 0.5rem; -} - -.top-3 { - top: 0.75rem; -} - -.top-\[13\%\] { - top: 13%; -} - -.top-\[5\%\] { - top: 5%; -} - -.top-\[72px\] { - top: 72px; -} - -.z-10 { - z-index: 10; -} - -.z-20 { - z-index: 20; -} - -.col-span-3 { - grid-column: span 3 / span 3; -} - -.float-left { - float: left; -} - -.m-1 { - margin: 0.25rem; -} - -.m-2 { - margin: 0.5rem; -} - -.m-3 { - margin: 0.75rem; -} - -.m-5 { - margin: 1.25rem; -} - -.mx-1 { - margin-left: 0.25rem; - margin-right: 0.25rem; -} - -.mx-auto { - margin-left: auto; - margin-right: auto; -} - -.my-1 { - margin-top: 0.25rem; - margin-bottom: 0.25rem; -} - -.my-2 { - margin-top: 0.5rem; - margin-bottom: 0.5rem; -} - -.my-3 { - margin-top: 0.75rem; - margin-bottom: 0.75rem; -} - -.mb-1 { - margin-bottom: 0.25rem; -} - -.mb-2 { - margin-bottom: 0.5rem; -} - -.mb-4 { - margin-bottom: 1rem; -} - -.mb-5 { - margin-bottom: 1.25rem; -} - -.ml-2 { - margin-left: 0.5rem; -} - -.ml-9 { - margin-left: 2.25rem; -} - -.ml-auto { - margin-left: auto; -} - -.mr-2 { - margin-right: 0.5rem; -} - -.mt-1 { - margin-top: 0.25rem; -} - -.mt-16 { - margin-top: 4rem; -} - -.mt-5 { - margin-top: 1.25rem; -} - -.flex { - display: flex; -} - -.grid { - display: grid; -} - -.contents { - display: contents; -} - -.aspect-square { - aspect-ratio: 1 / 1; -} - -.h-1\/4 { - height: 25%; -} - -.h-1\/6 { - height: 16.666667%; -} - -.h-10 { - height: 2.5rem; -} - -.h-16 { - height: 4rem; -} - -.h-3\/4 { - height: 75%; -} - -.h-5 { - height: 1.25rem; -} - -.h-6 { - height: 1.5rem; -} - -.h-7 { - height: 1.75rem; -} - -.h-\[28px\] { - height: 28px; -} - -.h-\[90\%\] { - height: 90%; -} - -.h-full { - height: 100%; -} - -.h-screen { - height: 100vh; -} - -.w-1\/2 { - width: 50%; -} - -.w-1\/6 { - width: 16.666667%; -} - -.w-10 { - width: 2.5rem; -} - -.w-20 { - width: 5rem; -} - -.w-24 { - width: 6rem; -} - -.w-3\/4 { - width: 75%; -} - -.w-48 { - width: 12rem; -} - -.w-5 { - width: 1.25rem; -} - -.w-52 { - width: 13rem; -} - -.w-6 { - width: 1.5rem; -} - -.w-7 { - width: 1.75rem; -} - -.w-8 { - width: 2rem; -} - -.w-\[105\%\] { - width: 105%; -} - -.w-\[90\%\] { - width: 90%; -} - -.w-\[95\%\] { - width: 95%; -} - -.w-\[min\(144px\2c _25\%\)\] { - width: min(144px, 25%); -} - -.w-\[min\(180px\2c _50\%\)\] { - width: min(180px, 50%); -} - -.w-\[min\(280px\2c _45\%\)\] { - width: min(280px, 45%); -} - -.w-auto { - width: auto; -} - -.w-full { - width: 100%; -} - -.w-screen { - width: 100vw; -} - -.grow { - flex-grow: 1; -} - -@keyframes spin { - to { - transform: rotate(360deg); - } -} - -.animate-spin { - animation: spin 1s linear infinite; -} - -.cursor-pointer { - cursor: pointer; -} - -.list-inside { - list-style-position: inside; -} - -.list-disc { - list-style-type: disc; -} - -.grid-flow-col { - grid-auto-flow: column; -} - -.grid-cols-3 { - grid-template-columns: repeat(3, minmax(0, 1fr)); -} - -.grid-cols-4 { - grid-template-columns: repeat(4, minmax(0, 1fr)); -} - -.flex-col { - flex-direction: column; -} - -.overflow-hidden { - overflow: hidden; -} - -.overflow-y-auto { - overflow-y: auto; -} - -.rounded { - border-radius: 0.25rem; -} - -.rounded-3xl { - border-radius: 1.5rem; -} - -.rounded-full { - border-radius: 9999px; -} - -.rounded-lg { - border-radius: 0.5rem; -} - -.border-2 { - border-width: 2px; -} - -.border-b-2 { - border-bottom-width: 2px; -} - -.border-r-2 { - border-right-width: 2px; -} - -.border-t-2 { - border-top-width: 2px; -} - -.border-black { - --tw-border-opacity: 1; - border-color: rgb(0 0 0 / var(--tw-border-opacity)); -} - -.border-blue-500 { - --tw-border-opacity: 1; - border-color: rgb(59 130 246 / var(--tw-border-opacity)); -} - -.border-inherit { - border-color: inherit; -} - -.border-slate-300 { - --tw-border-opacity: 1; - border-color: rgb(203 213 225 / var(--tw-border-opacity)); -} - -.border-t-slate-300 { - --tw-border-opacity: 1; - border-top-color: rgb(203 213 225 / var(--tw-border-opacity)); -} - -.bg-black { - --tw-bg-opacity: 1; - background-color: rgb(0 0 0 / var(--tw-bg-opacity)); -} - -.bg-blue-500 { - --tw-bg-opacity: 1; - background-color: rgb(59 130 246 / var(--tw-bg-opacity)); -} - -.bg-emerald-500 { - --tw-bg-opacity: 1; - background-color: rgb(16 185 129 / var(--tw-bg-opacity)); -} - -.bg-inherit { - background-color: inherit; -} - -.bg-pink-500 { - --tw-bg-opacity: 1; - background-color: rgb(236 72 153 / var(--tw-bg-opacity)); -} - -.bg-rose-500 { - --tw-bg-opacity: 1; - background-color: rgb(244 63 94 / var(--tw-bg-opacity)); -} - -.bg-slate-100 { - --tw-bg-opacity: 1; - background-color: rgb(241 245 249 / var(--tw-bg-opacity)); -} - -.bg-violet-500 { - --tw-bg-opacity: 1; - background-color: rgb(139 92 246 / var(--tw-bg-opacity)); -} - -.bg-gradient-to-br { - background-image: linear-gradient(to bottom right, var(--tw-gradient-stops)); -} - -.from-rose-500 { - --tw-gradient-from: #f43f5e var(--tw-gradient-from-position); - --tw-gradient-to: rgb(244 63 94 / 0) var(--tw-gradient-to-position); - --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to); -} - -.to-violet-500 { - --tw-gradient-to: #8b5cf6 var(--tw-gradient-to-position); -} - -.p-1 { - padding: 0.25rem; -} - -.p-2 { - padding: 0.5rem; -} - -.p-3 { - padding: 0.75rem; -} - -.p-5 { - padding: 1.25rem; -} - -.p-\[2px\] { - padding: 2px; -} - -.p-\[3px\] { - padding: 3px; -} - -.py-5 { - padding-top: 1.25rem; - padding-bottom: 1.25rem; -} - -.pb-4 { - padding-bottom: 1rem; -} - -.pb-5 { - padding-bottom: 1.25rem; -} - -.pl-5 { - padding-left: 1.25rem; -} - -.pt-1 { - padding-top: 0.25rem; -} - -.pt-10 { - padding-top: 2.5rem; -} - -.pt-2 { - padding-top: 0.5rem; -} - -.pt-5 { - padding-top: 1.25rem; -} - -.text-center { - text-align: center; -} - -.text-\[20px\] { - font-size: 20px; -} - -.text-sm { - font-size: 0.875rem; - line-height: 1.25rem; -} - -.text-xl { - font-size: 1.25rem; - line-height: 1.75rem; -} - -.font-bold { - font-weight: 700; -} - -.italic { - font-style: italic; -} - -.text-black { - --tw-text-opacity: 1; - color: rgb(0 0 0 / var(--tw-text-opacity)); -} - -.text-inherit { - color: inherit; -} - -.text-rose-500 { - --tw-text-opacity: 1; - color: rgb(244 63 94 / var(--tw-text-opacity)); -} - -.text-slate-900 { - --tw-text-opacity: 1; - color: rgb(15 23 42 / var(--tw-text-opacity)); -} - -.text-slate-950 { - --tw-text-opacity: 1; - color: rgb(2 6 23 / var(--tw-text-opacity)); -} - -.opacity-25 { - opacity: 0.25; -} - -.opacity-75 { - opacity: 0.75; -} - -.shadow { - --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-lg { - --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); - --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), - 0 4px 6px -4px var(--tw-shadow-color); - box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), - var(--tw-shadow); -} - -.backdrop-blur-sm { - --tw-backdrop-blur: blur(4px); - -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); -} - -.backdrop-filter { - -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); -} - -.duration-200 { - transition-duration: 200ms; -} - -.marker\:text-blue-500 *::marker { - color: rgb(59 130 246); -} - -.marker\:text-blue-500::marker { - color: rgb(59 130 246); -} - -.hover\:rotate-45:hover { - --tw-rotate: 45deg; - 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)); -} - -.hover\:rotate-90:hover { - --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)); -} - -.hover\:opacity-75:hover { - opacity: 0.75; -} - -.enabled\:bg-blue-500:enabled { - --tw-bg-opacity: 1; - background-color: rgb(59 130 246 / var(--tw-bg-opacity)); -} - -.enabled\:bg-rose-500:enabled { - --tw-bg-opacity: 1; - background-color: rgb(244 63 94 / var(--tw-bg-opacity)); -} - -.enabled\:hover\:opacity-75:hover:enabled { - opacity: 0.75; -} - -.disabled\:border-gray-500:disabled { - --tw-border-opacity: 1; - border-color: rgb(107 114 128 / var(--tw-border-opacity)); -} - -.disabled\:bg-gray-500:disabled { - --tw-bg-opacity: 1; - background-color: rgb(107 114 128 / var(--tw-bg-opacity)); -} - -.dark\:border-slate-700:where(.dark, .dark *) { - --tw-border-opacity: 1; - border-color: rgb(51 65 85 / var(--tw-border-opacity)); -} - -.dark\:border-slate-800:where(.dark, .dark *) { - --tw-border-opacity: 1; - border-color: rgb(30 41 59 / var(--tw-border-opacity)); -} - -.dark\:border-t-slate-800:where(.dark, .dark *) { - --tw-border-opacity: 1; - border-top-color: rgb(30 41 59 / var(--tw-border-opacity)); -} - -.dark\:bg-slate-900:where(.dark, .dark *) { - --tw-bg-opacity: 1; - background-color: rgb(15 23 42 / var(--tw-bg-opacity)); -} - -.dark\:text-slate-50:where(.dark, .dark *) { - --tw-text-opacity: 1; - color: rgb(248 250 252 / var(--tw-text-opacity)); -} - -.dark\:text-white:where(.dark, .dark *) { - --tw-text-opacity: 1; - color: rgb(255 255 255 / var(--tw-text-opacity)); -} +*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.bottom-0{bottom:0}.left-0{left:0}.left-1\/4{left:25%}.left-\[13\%\]{left:13%}.left-\[5\%\]{left:5%}.right-2{right:.5rem}.right-3{right:.75rem}.top-0{top:0}.top-1\/4{top:25%}.top-2{top:.5rem}.top-3{top:.75rem}.top-\[13\%\]{top:13%}.top-\[5\%\]{top:5%}.top-\[72px\]{top:72px}.z-10{z-index:10}.z-20{z-index:20}.col-span-3{grid-column:span 3 / span 3}.float-left{float:left}.m-1{margin:.25rem}.m-2{margin:.5rem}.m-3{margin:.75rem}.m-5{margin:1.25rem}.mx-1{margin-left:.25rem;margin-right:.25rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-3{margin-top:.75rem;margin-bottom:.75rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.ml-2{margin-left:.5rem}.ml-9{margin-left:2.25rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.mt-16{margin-top:4rem}.mt-5{margin-top:1.25rem}.flex{display:flex}.grid{display:grid}.contents{display:contents}.aspect-square{aspect-ratio:1 / 1}.h-1\/4{height:25%}.h-1\/6{height:16.666667%}.h-10{height:2.5rem}.h-16{height:4rem}.h-3\/4{height:75%}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-\[28px\]{height:28px}.h-\[90\%\]{height:90%}.h-full{height:100%}.h-screen{height:100vh}.w-1\/2{width:50%}.w-1\/6{width:16.666667%}.w-10{width:2.5rem}.w-20{width:5rem}.w-24{width:6rem}.w-3\/4{width:75%}.w-48{width:12rem}.w-5{width:1.25rem}.w-52{width:13rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-\[105\%\]{width:105%}.w-\[90\%\]{width:90%}.w-\[95\%\]{width:95%}.w-\[min\(144px\,_25\%\)\]{width:min(144px,25%)}.w-\[min\(180px\,_50\%\)\]{width:min(180px,50%)}.w-\[min\(280px\,_45\%\)\]{width:min(280px,45%)}.w-auto{width:auto}.w-full{width:100%}.w-screen{width:100vw}.grow{flex-grow:1}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.list-inside{list-style-position:inside}.list-disc{list-style-type:disc}.grid-flow-col{grid-auto-flow:column}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.flex-col{flex-direction:column}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-3xl{border-radius:1.5rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.border-2{border-width:2px}.border-b-2{border-bottom-width:2px}.border-r-2{border-right-width:2px}.border-t-2{border-top-width:2px}.border-black{--tw-border-opacity: 1;border-color:rgb(0 0 0 / var(--tw-border-opacity))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity))}.border-inherit{border-color:inherit}.border-slate-300{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity))}.border-t-slate-300{--tw-border-opacity: 1;border-top-color:rgb(203 213 225 / var(--tw-border-opacity))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity))}.bg-inherit{background-color:inherit}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity))}.bg-rose-500{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity))}.bg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.bg-violet-500{--tw-bg-opacity: 1;background-color:rgb(139 92 246 / var(--tw-bg-opacity))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.from-rose-500{--tw-gradient-from: #f43f5e var(--tw-gradient-from-position);--tw-gradient-to: rgb(244 63 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-violet-500{--tw-gradient-to: #8b5cf6 var(--tw-gradient-to-position)}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-5{padding:1.25rem}.p-\[2px\]{padding:2px}.p-\[3px\]{padding:3px}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.pb-4{padding-bottom:1rem}.pb-5{padding-bottom:1.25rem}.pl-5{padding-left:1.25rem}.pt-1{padding-top:.25rem}.pt-10{padding-top:2.5rem}.pt-2{padding-top:.5rem}.pt-5{padding-top:1.25rem}.text-center{text-align:center}.text-\[20px\]{font-size:20px}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-bold{font-weight:700}.italic{font-style:italic}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.text-inherit{color:inherit}.text-rose-500{--tw-text-opacity: 1;color:rgb(244 63 94 / var(--tw-text-opacity))}.text-slate-900{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.text-slate-950{--tw-text-opacity: 1;color:rgb(2 6 23 / var(--tw-text-opacity))}.opacity-25{opacity:.25}.opacity-75{opacity:.75}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(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-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-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)}.backdrop-filter{-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)}.duration-200{transition-duration:.2s}.marker\:text-blue-500 *::marker{color:#3b82f6}.marker\:text-blue-500::marker{color:#3b82f6}.hover\:rotate-45:hover{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:rotate-90:hover{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:opacity-75:hover{opacity:.75}.enabled\:bg-blue-500:enabled{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.enabled\:bg-rose-500:enabled{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity))}.enabled\:hover\:opacity-75:hover:enabled{opacity:.75}.disabled\:border-gray-500:disabled{--tw-border-opacity: 1;border-color:rgb(107 114 128 / var(--tw-border-opacity))}.disabled\:bg-gray-500:disabled{--tw-bg-opacity: 1;background-color:rgb(107 114 128 / var(--tw-bg-opacity))}.dark\:border-slate-700:where(.dark,.dark *){--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity))}.dark\:border-slate-800:where(.dark,.dark *){--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity))}.dark\:border-t-slate-800:where(.dark,.dark *){--tw-border-opacity: 1;border-top-color:rgb(30 41 59 / var(--tw-border-opacity))}.dark\:bg-slate-900:where(.dark,.dark *){--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity))}.dark\:text-slate-50:where(.dark,.dark *){--tw-text-opacity: 1;color:rgb(248 250 252 / var(--tw-text-opacity))}.dark\:text-white:where(.dark,.dark *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))} diff --git a/app/dist/assets/index-DkxkOwo9.js b/app/dist/assets/index-DkxkOwo9.js index dc3a64d..f9cdf19 100644 --- a/app/dist/assets/index-DkxkOwo9.js +++ b/app/dist/assets/index-DkxkOwo9.js @@ -1,6454 +1,11 @@ -var __defProp = Object.defineProperty; -var __defNormalProp = (obj, key, value) => - key in obj - ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) - : (obj[key] = value); -var __publicField = (obj, key, value) => { - __defNormalProp(obj, typeof key !== 'symbol' ? key + '' : key, value); - return value; -}; -(function polyfill() { - const relList = document.createElement('link').relList; - if (relList && relList.supports && relList.supports('modulepreload')) { - return; - } - for (const link of document.querySelectorAll('link[rel="modulepreload"]')) { - processPreload(link); - } - new MutationObserver((mutations) => { - for (const mutation of mutations) { - if (mutation.type !== 'childList') { - continue; - } - for (const node of mutation.addedNodes) { - if (node.tagName === 'LINK' && node.rel === 'modulepreload') processPreload(node); - } - } - }).observe(document, { childList: true, subtree: true }); - function getFetchOpts(link) { - const fetchOpts = {}; - if (link.integrity) fetchOpts.integrity = link.integrity; - if (link.referrerPolicy) fetchOpts.referrerPolicy = link.referrerPolicy; - if (link.crossOrigin === 'use-credentials') fetchOpts.credentials = 'include'; - else if (link.crossOrigin === 'anonymous') fetchOpts.credentials = 'omit'; - else fetchOpts.credentials = 'same-origin'; - return fetchOpts; - } - function processPreload(link) { - if (link.ep) return; - link.ep = true; - const fetchOpts = getFetchOpts(link); - fetch(link.href, fetchOpts); - } -})(); -function noop() {} -function is_promise(value) { - return ( - !!value && - (typeof value === 'object' || typeof value === 'function') && - typeof (/** @type {any} */ value.then) === 'function' - ); -} -function run(fn) { - return fn(); -} -function blank_object() { - return /* @__PURE__ */ Object.create(null); -} -function run_all(fns) { - fns.forEach(run); -} -function is_function(thing) { - return typeof thing === 'function'; -} -function safe_not_equal(a, b) { - return a != a ? b == b : a !== b || (a && typeof a === 'object') || typeof a === 'function'; -} -let src_url_equal_anchor; -function src_url_equal(element_src, url) { - if (element_src === url) return true; - if (!src_url_equal_anchor) { - src_url_equal_anchor = document.createElement('a'); - } - src_url_equal_anchor.href = url; - return element_src === src_url_equal_anchor.href; -} -function is_empty(obj) { - return Object.keys(obj).length === 0; -} -function subscribe(store, ...callbacks) { - if (store == null) { - for (const callback of callbacks) { - callback(void 0); - } - return noop; - } - const unsub = store.subscribe(...callbacks); - return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub; -} -function get_store_value(store) { - let value; - subscribe(store, (_) => (value = _))(); - return value; -} -function component_subscribe(component, store, callback) { - component.$$.on_destroy.push(subscribe(store, callback)); -} -function set_store_value(store, ret, value) { - store.set(value); - return ret; -} -function append(target, node) { - target.appendChild(node); -} -function insert(target, node, anchor) { - target.insertBefore(node, anchor || null); -} -function detach(node) { - if (node.parentNode) { - node.parentNode.removeChild(node); - } -} -function destroy_each(iterations, detaching) { - for (let i = 0; i < iterations.length; i += 1) { - if (iterations[i]) iterations[i].d(detaching); - } -} -function element(name) { - return document.createElement(name); -} -function text(data) { - return document.createTextNode(data); -} -function space() { - return text(' '); -} -function empty() { - return text(''); -} -function listen(node, event, handler, options) { - node.addEventListener(event, handler, options); - return () => node.removeEventListener(event, handler, options); -} -function attr(node, attribute, value) { - if (value == null) node.removeAttribute(attribute); - else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value); -} -function children(element2) { - return Array.from(element2.childNodes); -} -function set_data(text2, data) { - data = '' + data; - if (text2.data === data) return; - text2.data = /** @type {string} */ data; -} -function set_input_value(input, value) { - input.value = value == null ? '' : value; -} -function select_option(select, value, mounting) { - for (let i = 0; i < select.options.length; i += 1) { - const option = select.options[i]; - if (option.__value === value) { - option.selected = true; - return; - } - } - if (!mounting || value !== void 0) { - select.selectedIndex = -1; - } -} -function select_value(select) { - const selected_option = select.querySelector(':checked'); - return selected_option && selected_option.__value; -} -function custom_event(type, detail, { bubbles = false, cancelable = false } = {}) { - return new CustomEvent(type, { detail, bubbles, cancelable }); -} -let current_component; -function set_current_component(component) { - current_component = component; -} -function get_current_component() { - if (!current_component) throw new Error('Function called outside component initialization'); - return current_component; -} -function onMount(fn) { - get_current_component().$$.on_mount.push(fn); -} -function afterUpdate(fn) { - get_current_component().$$.after_update.push(fn); -} -function onDestroy(fn) { - get_current_component().$$.on_destroy.push(fn); -} -function createEventDispatcher() { - const component = get_current_component(); - return (type, detail, { cancelable = false } = {}) => { - const callbacks = component.$$.callbacks[type]; - if (callbacks) { - const event = custom_event( - /** @type {string} */ - type, - detail, - { cancelable } - ); - callbacks.slice().forEach((fn) => { - fn.call(component, event); - }); - return !event.defaultPrevented; - } - return true; - }; -} -const dirty_components = []; -const binding_callbacks = []; -let render_callbacks = []; -const flush_callbacks = []; -const resolved_promise = /* @__PURE__ */ Promise.resolve(); -let update_scheduled = false; -function schedule_update() { - if (!update_scheduled) { - update_scheduled = true; - resolved_promise.then(flush); - } -} -function add_render_callback(fn) { - render_callbacks.push(fn); -} -function add_flush_callback(fn) { - flush_callbacks.push(fn); -} -const seen_callbacks = /* @__PURE__ */ new Set(); -let flushidx = 0; -function flush() { - if (flushidx !== 0) { - return; - } - const saved_component = current_component; - do { - try { - while (flushidx < dirty_components.length) { - const component = dirty_components[flushidx]; - flushidx++; - set_current_component(component); - update(component.$$); - } - } catch (e) { - dirty_components.length = 0; - flushidx = 0; - throw e; - } - set_current_component(null); - dirty_components.length = 0; - flushidx = 0; - while (binding_callbacks.length) binding_callbacks.pop()(); - for (let i = 0; i < render_callbacks.length; i += 1) { - const callback = render_callbacks[i]; - if (!seen_callbacks.has(callback)) { - seen_callbacks.add(callback); - callback(); - } - } - render_callbacks.length = 0; - } while (dirty_components.length); - while (flush_callbacks.length) { - flush_callbacks.pop()(); - } - update_scheduled = false; - seen_callbacks.clear(); - set_current_component(saved_component); -} -function update($$) { - if ($$.fragment !== null) { - $$.update(); - run_all($$.before_update); - const dirty = $$.dirty; - $$.dirty = [-1]; - $$.fragment && $$.fragment.p($$.ctx, dirty); - $$.after_update.forEach(add_render_callback); - } -} -function flush_render_callbacks(fns) { - const filtered = []; - const targets = []; - render_callbacks.forEach((c) => (fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c))); - targets.forEach((c) => c()); - render_callbacks = filtered; -} -const outroing = /* @__PURE__ */ new Set(); -let outros; -function group_outros() { - outros = { - r: 0, - c: [], - p: outros - // parent group - }; -} -function check_outros() { - if (!outros.r) { - run_all(outros.c); - } - outros = outros.p; -} -function transition_in(block, local) { - if (block && block.i) { - outroing.delete(block); - block.i(local); - } -} -function transition_out(block, local, detach2, callback) { - if (block && block.o) { - if (outroing.has(block)) return; - outroing.add(block); - outros.c.push(() => { - outroing.delete(block); - if (callback) { - if (detach2) block.d(1); - callback(); - } - }); - block.o(local); - } else if (callback) { - callback(); - } -} -function handle_promise(promise, info) { - const token = (info.token = {}); - function update2(type, index, key, value) { - if (info.token !== token) return; - info.resolved = value; - let child_ctx = info.ctx; - if (key !== void 0) { - child_ctx = child_ctx.slice(); - child_ctx[key] = value; - } - const block = type && (info.current = type)(child_ctx); - let needs_flush = false; - if (info.block) { - if (info.blocks) { - info.blocks.forEach((block2, i) => { - if (i !== index && block2) { - group_outros(); - transition_out(block2, 1, 1, () => { - if (info.blocks[i] === block2) { - info.blocks[i] = null; - } - }); - check_outros(); - } - }); - } else { - info.block.d(1); - } - block.c(); - transition_in(block, 1); - block.m(info.mount(), info.anchor); - needs_flush = true; - } - info.block = block; - if (info.blocks) info.blocks[index] = block; - if (needs_flush) { - flush(); - } - } - if (is_promise(promise)) { - const current_component2 = get_current_component(); - promise.then( - (value) => { - set_current_component(current_component2); - update2(info.then, 1, info.value, value); - set_current_component(null); - }, - (error) => { - set_current_component(current_component2); - update2(info.catch, 2, info.error, error); - set_current_component(null); - if (!info.hasCatch) { - throw error; - } - } - ); - if (info.current !== info.pending) { - update2(info.pending, 0); - return true; - } - } else { - if (info.current !== info.then) { - update2(info.then, 1, info.value, promise); - return true; - } - info.resolved = /** @type {T} */ promise; - } -} -function update_await_block_branch(info, ctx, dirty) { - const child_ctx = ctx.slice(); - const { resolved } = info; - if (info.current === info.then) { - child_ctx[info.value] = resolved; - } - if (info.current === info.catch) { - child_ctx[info.error] = resolved; - } - info.block.p(child_ctx, dirty); -} -function ensure_array_like(array_like_or_iterator) { - return (array_like_or_iterator == null ? void 0 : array_like_or_iterator.length) !== void 0 - ? array_like_or_iterator - : Array.from(array_like_or_iterator); -} -function bind(component, name, callback) { - const index = component.$$.props[name]; - if (index !== void 0) { - component.$$.bound[index] = callback; - callback(component.$$.ctx[index]); - } -} -function create_component(block) { - block && block.c(); -} -function mount_component(component, target, anchor) { - const { fragment, after_update } = component.$$; - fragment && fragment.m(target, anchor); - add_render_callback(() => { - const new_on_destroy = component.$$.on_mount.map(run).filter(is_function); - if (component.$$.on_destroy) { - component.$$.on_destroy.push(...new_on_destroy); - } else { - run_all(new_on_destroy); - } - component.$$.on_mount = []; - }); - after_update.forEach(add_render_callback); -} -function destroy_component(component, detaching) { - const $$ = component.$$; - if ($$.fragment !== null) { - flush_render_callbacks($$.after_update); - run_all($$.on_destroy); - $$.fragment && $$.fragment.d(detaching); - $$.on_destroy = $$.fragment = null; - $$.ctx = []; - } -} -function make_dirty(component, i) { - if (component.$$.dirty[0] === -1) { - dirty_components.push(component); - schedule_update(); - component.$$.dirty.fill(0); - } - component.$$.dirty[(i / 31) | 0] |= 1 << i % 31; -} -function init( - component, - options, - instance2, - create_fragment2, - not_equal, - props, - append_styles = null, - dirty = [-1] -) { - const parent_component = current_component; - set_current_component(component); - const $$ = (component.$$ = { - fragment: null, - ctx: [], - // state - props, - update: noop, - not_equal, - bound: blank_object(), - // lifecycle - on_mount: [], - on_destroy: [], - on_disconnect: [], - before_update: [], - after_update: [], - context: new Map(options.context || (parent_component ? parent_component.$$.context : [])), - // everything else - callbacks: blank_object(), - dirty, - skip_bound: false, - root: options.target || parent_component.$$.root - }); - append_styles && append_styles($$.root); - let ready = false; - $$.ctx = instance2 - ? instance2(component, options.props || {}, (i, ret, ...rest) => { - const value = rest.length ? rest[0] : ret; - if ($$.ctx && not_equal($$.ctx[i], ($$.ctx[i] = value))) { - if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value); - if (ready) make_dirty(component, i); - } - return ret; - }) - : []; - $$.update(); - ready = true; - run_all($$.before_update); - $$.fragment = create_fragment2 ? create_fragment2($$.ctx) : false; - if (options.target) { - if (options.hydrate) { - const nodes = children(options.target); - $$.fragment && $$.fragment.l(nodes); - nodes.forEach(detach); - } else { - $$.fragment && $$.fragment.c(); - } - if (options.intro) transition_in(component.$$.fragment); - mount_component(component, options.target, options.anchor); - flush(); - } - set_current_component(parent_component); -} -class SvelteComponent { - constructor() { - /** - * ### PRIVATE API - * - * Do not use, may change at any time - * - * @type {any} - */ - __publicField(this, '$$'); - /** - * ### PRIVATE API - * - * Do not use, may change at any time - * - * @type {any} - */ - __publicField(this, '$$set'); - } - /** @returns {void} */ - $destroy() { - destroy_component(this, 1); - this.$destroy = noop; - } - /** - * @template {Extract} K - * @param {K} type - * @param {((e: Events[K]) => void) | null | undefined} callback - * @returns {() => void} - */ - $on(type, callback) { - if (!is_function(callback)) { - return noop; - } - const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []); - callbacks.push(callback); - return () => { - const index = callbacks.indexOf(callback); - if (index !== -1) callbacks.splice(index, 1); - }; - } - /** - * @param {Partial} props - * @returns {void} - */ - $set(props) { - if (this.$$set && !is_empty(props)) { - this.$$.skip_bound = true; - this.$$set(props); - this.$$.skip_bound = false; - } - } -} -const PUBLIC_VERSION = '4'; -if (typeof window !== 'undefined') - (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(PUBLIC_VERSION); -const subscriber_queue = []; -function readable(value, start2) { - return { - subscribe: writable(value, start2).subscribe - }; -} -function writable(value, start2 = noop) { - let stop; - const subscribers = /* @__PURE__ */ new Set(); - function set(new_value) { - if (safe_not_equal(value, new_value)) { - value = new_value; - if (stop) { - const run_queue = !subscriber_queue.length; - for (const subscriber of subscribers) { - subscriber[1](); - subscriber_queue.push(subscriber, value); - } - if (run_queue) { - for (let i = 0; i < subscriber_queue.length; i += 2) { - subscriber_queue[i][0](subscriber_queue[i + 1]); - } - subscriber_queue.length = 0; - } - } - } - } - function update2(fn) { - set(fn(value)); - } - function subscribe2(run2, invalidate = noop) { - const subscriber = [run2, invalidate]; - subscribers.add(subscriber); - if (subscribers.size === 1) { - stop = start2(set, update2) || noop; - } - run2(value); - return () => { - subscribers.delete(subscriber); - if (subscribers.size === 0 && stop) { - stop(); - stop = null; - } - }; - } - return { set, update: update2, subscribe: subscribe2 }; -} -function unwrap(result) { - if (result.ok) { - return result.value; - } else { - throw result.error; - } -} -var Game = /* @__PURE__ */ ((Game2) => { - Game2[(Game2['rs3'] = 0)] = 'rs3'; - Game2[(Game2['osrs'] = 1)] = 'osrs'; - return Game2; -})(Game || {}); -var Client = /* @__PURE__ */ ((Client2) => { - Client2[(Client2['runeLite'] = 0)] = 'runeLite'; - Client2[(Client2['hdos'] = 1)] = 'hdos'; - Client2[(Client2['rs3'] = 2)] = 'rs3'; - return Client2; -})(Client || {}); -const configDefaults = { - use_dark_theme: true, - flatpak_rich_presence: false, - rs_config_uri: '', - runelite_custom_jar: '', - runelite_use_custom_jar: false, - selected_account: '', - selected_characters: /* @__PURE__ */ new Map(), - selected_game_accounts: /* @__PURE__ */ new Map(), - selected_game_index: 1, - selected_client_index: 1 -}; -const internalUrl = readable('https://bolt-internal'); -const productionClientId = readable('1fddee4e-b100-4f4e-b2b0-097f9088f9d2'); -const bolt = writable(); -const platform = writable(''); -const config = writable({ ...configDefaults }); -const credentials = writable(/* @__PURE__ */ new Map()); -const hasBoltPlugins = writable(false); -const pluginList = writable(); -const clientListPromise = writable(); -const messageList = writable([]); -const pendingOauth = writable({}); -const pendingGameAuth = writable([]); -const rs3InstalledHash = writable(''); -const runeLiteInstalledId = writable(''); -const hdosInstalledVersion = writable(''); -const isConfigDirty = writable(false); -const accountList = writable(/* @__PURE__ */ new Map()); -const selectedPlay = writable({ - game: Game.osrs, - client: Client.runeLite -}); -const showDisclaimer = writable(false); -function loadTheme() { - if (configSub.use_dark_theme == false) { - document.documentElement.classList.remove('dark'); - } -} -function removePendingGameAuth(pending, closeWindow) { - if (closeWindow) { - pending.win.close(); - } - pendingGameAuth.update((data) => { - data.splice(pendingGameAuthSub.indexOf(pending), 1); - return data; - }); -} -function loginClicked() { - if (pendingOauthSub && pendingOauthSub.win && !pendingOauthSub.win.closed) { - pendingOauthSub.win.focus(); - } else if ( - (pendingOauthSub && pendingOauthSub.win && pendingOauthSub.win.closed) || - pendingOauthSub - ) { - const state = makeRandomState(); - const verifier = makeRandomVerifier(); - makeLoginUrl({ - origin: atob(boltSub.origin), - redirect: atob(boltSub.redirect), - authMethod: '', - loginType: '', - clientid: atob(boltSub.clientid), - flow: 'launcher', - pkceState: state, - pkceCodeVerifier: verifier - }).then((url) => { - const win = window.open(url, '', 'width=480,height=720'); - pendingOauth.set({ state, verifier, win }); - }); - } -} -function urlSearchParams() { - const query = new URLSearchParams(window.location.search); - platform.set(query.get('platform')); - query.get('flathub') === '1'; - rs3InstalledHash.set(query.get('rs3_linux_installed_hash')); - runeLiteInstalledId.set(query.get('runelite_installed_id')); - hdosInstalledVersion.set(query.get('hdos_installed_version')); - const queryPlugins = query.get('plugins'); - if (queryPlugins !== null) { - hasBoltPlugins.set(true); - pluginList.set(JSON.parse(queryPlugins)); - } else { - hasBoltPlugins.set(false); - } - const creds = query.get('credentials'); - if (creds) { - try { - const credsList = JSON.parse(creds); - credsList.forEach((value) => { - credentials.update((data) => { - data.set(value.sub, value); - return data; - }); - }); - } catch (error) { - err(`Couldn't parse credentials file: ${error}`, false); - } - } - const conf = query.get('config'); - if (conf) { - try { - const parsedConf = JSON.parse(conf); - config.set(parsedConf); - config.update((data) => { - if (data.selected_game_accounts) { - data.selected_characters = new Map(Object.entries(data.selected_game_accounts)); - delete data.selected_game_accounts; - } else if (data.selected_characters) { - data.selected_characters = new Map(Object.entries(data.selected_characters)); - } - return data; - }); - } catch (error) { - err(`Couldn't parse config file: ${error}`, false); - } - } -} -async function checkRenewCreds(creds, url, clientId) { - return new Promise((resolve) => { - if (creds.expiry - Date.now() < 3e4) { - const postData = new URLSearchParams({ - grant_type: 'refresh_token', - client_id: clientId, - refresh_token: creds.refresh_token - }); - const xml = new XMLHttpRequest(); - xml.onreadystatechange = () => { - if (xml.readyState == 4) { - if (xml.status == 200) { - const result = parseCredentials(xml.response); - const resultCreds = unwrap(result); - if (resultCreds) { - creds.access_token = resultCreds.access_token; - creds.expiry = resultCreds.expiry; - creds.id_token = resultCreds.id_token; - creds.login_provider = resultCreds.login_provider; - creds.refresh_token = resultCreds.refresh_token; - if (resultCreds.session_id) creds.session_id = resultCreds.session_id; - creds.sub = resultCreds.sub; - resolve(null); - } else { - resolve(0); - } - } else { - resolve(xml.status); - } - } - }; - xml.onerror = () => { - resolve(0); - }; - xml.open('POST', url, true); - xml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - xml.setRequestHeader('Accept', 'application/json'); - xml.send(postData); - } else { - resolve(null); - } - }); -} -function parseCredentials(str) { - const oauthCreds = JSON.parse(str); - const sections = oauthCreds.id_token.split('.'); - if (sections.length !== 3) { - const errMsg = `Malformed id_token: ${sections.length} sections, expected 3`; - err(errMsg, false); - return { ok: false, error: new Error(errMsg) }; - } - const header = JSON.parse(atob(sections[0])); - if (header.typ !== 'JWT') { - const errMsg = `Bad id_token header: typ ${header.typ}, expected JWT`; - err(errMsg, false); - return { ok: false, error: new Error(errMsg) }; - } - const payload = JSON.parse(atob(sections[1])); - return { - ok: true, - value: { - access_token: oauthCreds.access_token, - id_token: oauthCreds.id_token, - refresh_token: oauthCreds.refresh_token, - sub: payload.sub, - login_provider: payload.login_provider || null, - expiry: Date.now() + oauthCreds.expires_in * 1e3, - session_id: oauthCreds.session_id - } - }; -} -async function makeLoginUrl(url) { - const verifierData = new TextEncoder().encode(url.pkceCodeVerifier); - const digested = await crypto.subtle.digest('SHA-256', verifierData); - let raw = ''; - const bytes = new Uint8Array(digested); - for (let i = 0; i < bytes.byteLength; i++) { - raw += String.fromCharCode(bytes[i]); - } - const codeChallenge = btoa(raw).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, ''); - return url.origin.concat('/oauth2/auth?').concat( - new URLSearchParams({ - auth_method: url.authMethod, - login_type: url.loginType, - flow: url.flow, - response_type: 'code', - client_id: url.clientid, - redirect_uri: url.redirect, - code_challenge: codeChallenge, - code_challenge_method: 'S256', - prompt: 'login', - scope: 'openid offline gamesso.token.create user.profile.read', - state: url.pkceState - }).toString() - ); -} -function makeRandomVerifier() { - const t = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~'; - const n = new Uint32Array(43); - crypto.getRandomValues(n); - return Array.from(n, function (e) { - return t[e % t.length]; - }).join(''); -} -function makeRandomState() { - const t = 0; - const r = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; - const n = r.length - 1; - const o = crypto.getRandomValues(new Uint8Array(12)); - return Array.from(o) - .map((e) => { - return Math.round((e * (n - t)) / 255 + t); - }) - .map((e) => { - return r[e]; - }) - .join(''); -} -async function handleNewSessionId(creds, accountsUrl, accountsInfoPromise) { - return new Promise((resolve) => { - const xml = new XMLHttpRequest(); - xml.onreadystatechange = () => { - if (xml.readyState == 4) { - if (xml.status == 200) { - accountsInfoPromise.then((accountInfo) => { - if (typeof accountInfo !== 'number') { - const account = { - id: accountInfo.id, - userId: accountInfo.userId, - displayName: accountInfo.displayName, - suffix: accountInfo.suffix, - characters: /* @__PURE__ */ new Map() - }; - msg(`Successfully added login for ${account.displayName}`); - JSON.parse(xml.response).forEach((acc) => { - account.characters.set(acc.accountId, { - accountId: acc.accountId, - displayName: acc.displayName, - userHash: acc.userHash - }); - }); - addNewAccount(account); - resolve(true); - } else { - err(`Error getting account info: ${accountInfo}`, false); - resolve(false); - } - }); - } else { - err(`Error: from ${accountsUrl}: ${xml.status}: ${xml.response}`, false); - resolve(false); - } - } - }; - xml.open('GET', accountsUrl, true); - xml.setRequestHeader('Accept', 'application/json'); - xml.setRequestHeader('Authorization', 'Bearer '.concat(creds.session_id)); - xml.send(); - }); -} -async function handleLogin(win, creds) { - return await handleStandardLogin(win, creds); -} -async function handleStandardLogin(win, creds) { - const state = makeRandomState(); - const nonce = crypto.randomUUID(); - const location = atob(boltSub.origin) - .concat('/oauth2/auth?') - .concat( - new URLSearchParams({ - id_token_hint: creds.id_token, - nonce: btoa(nonce), - prompt: 'consent', - redirect_uri: 'http://localhost', - response_type: 'id_token code', - state, - client_id: get_store_value(productionClientId), - scope: 'openid offline' - }).toString() - ); - const accountInfoPromise = getStandardAccountInfo(creds); - if (win) { - win.location.href = location; - pendingGameAuth.update((data) => { - data.push({ - state, - nonce, - creds, - win, - account_info_promise: accountInfoPromise - }); - return data; - }); - return false; - } else { - if (!creds.session_id) { - err('Rejecting stored credentials with missing session_id', false); - return false; - } - return await handleNewSessionId( - creds, - atob(boltSub.auth_api).concat('/accounts'), - accountInfoPromise - ); - } -} -function getStandardAccountInfo(creds) { - return new Promise((resolve) => { - const url = `${atob(boltSub.api)}/users/${creds.sub}/displayName`; - const xml = new XMLHttpRequest(); - xml.onreadystatechange = () => { - if (xml.readyState == 4) { - if (xml.status == 200) { - resolve(JSON.parse(xml.response)); - } else { - resolve(xml.status); - } - } - }; - xml.open('GET', url, true); - xml.setRequestHeader('Authorization', 'Bearer '.concat(creds.access_token)); - xml.send(); - }); -} -function addNewAccount(account) { - const updateSelectedPlay = () => { - selectedPlay.update((data) => { - data.account = account; - const [firstKey] = account.characters.keys(); - data.character = account.characters.get(firstKey); - if (credentialsSub.size > 0) data.credentials = credentialsSub.get(account.userId); - return data; - }); - }; - accountList.update((data) => { - data.set(account.userId, account); - return data; - }); - if (selectedPlaySub.account && configSub.selected_account) { - if (account.userId == configSub.selected_account) { - updateSelectedPlay(); - } - } else if (!selectedPlaySub.account) { - updateSelectedPlay(); - } - pendingOauth.set({}); -} -function revokeOauthCreds(accessToken, revokeUrl, clientId) { - return new Promise((resolve) => { - const xml = new XMLHttpRequest(); - xml.open('POST', revokeUrl, true); - xml.onreadystatechange = () => { - if (xml.readyState == 4) { - resolve(xml.status); - } - }; - xml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - xml.send(new URLSearchParams({ token: accessToken, client_id: clientId })); - }); -} -async function saveAllCreds() { - const xml = new XMLHttpRequest(); - xml.open('POST', '/save-credentials', true); - xml.setRequestHeader('Content-Type', 'application/json'); - xml.onreadystatechange = () => { - if (xml.readyState == 4) { - msg(`Save-credentials status: ${xml.responseText.trim()}`); - } - }; - selectedPlay.update((data) => { - var _a; - data.credentials = credentialsSub.get( - (_a = selectedPlaySub.account) == null ? void 0 : _a.userId - ); - return data; - }); - const credsList = []; - credentialsSub.forEach((value) => { - credsList.push(value); - }); - xml.send(JSON.stringify(credsList)); -} -function launchRS3Linux(jx_session_id, jx_character_id, jx_display_name) { - saveConfig(); - const launch = (hash, deb) => { - const xml2 = new XMLHttpRequest(); - const params = {}; - if (hash) params.hash = hash; - if (jx_session_id) params.jx_session_id = jx_session_id; - if (jx_character_id) params.jx_character_id = jx_character_id; - if (jx_display_name) params.jx_display_name = jx_display_name; - if (configSub.rs_plugin_loader) params.plugin_loader = '1'; - if (configSub.rs_config_uri) { - params.config_uri = configSub.rs_config_uri; - } else { - params.config_uri = atob(boltSub.default_config_uri); - } - xml2.open('POST', '/launch-rs3-deb?'.concat(new URLSearchParams(params).toString()), true); - xml2.onreadystatechange = () => { - if (xml2.readyState == 4) { - msg(`Game launch status: '${xml2.responseText.trim()}'`); - if (xml2.status == 200 && hash) { - rs3InstalledHash.set(hash); - } - } - }; - xml2.send(deb); - }; - const xml = new XMLHttpRequest(); - const contentUrl = atob(boltSub.content_url); - const url = contentUrl.concat('dists/trusty/non-free/binary-amd64/Packages'); - xml.open('GET', url, true); - xml.onreadystatechange = () => { - if (xml.readyState == 4 && xml.status == 200) { - const lines = Object.fromEntries( - xml.response.split('\n').map((x) => { - return x.split(': '); - }) - ); - if (!lines.Filename || !lines.Size) { - err(`Could not parse package data from URL: ${url}`, false); - launch(); - return; - } - if (lines.SHA256 !== get_store_value(rs3InstalledHash)) { - msg('Downloading RS3 client...'); - const exeXml = new XMLHttpRequest(); - exeXml.open('GET', contentUrl.concat(lines.Filename), true); - exeXml.responseType = 'arraybuffer'; - exeXml.onprogress = (e) => { - if (e.loaded) { - messageList.update((data) => { - data[0].text = `Downloading RS3 client... ${(Math.round((1e3 * e.loaded) / e.total) / 10).toFixed(1)}%`; - return data; - }); - } - }; - exeXml.onreadystatechange = () => { - if (exeXml.readyState == 4 && exeXml.status == 200) { - launch(lines.SHA256, exeXml.response); - } - }; - exeXml.onerror = () => { - err(`Error downloading game client: from ${url}: non-http error`, false); - launch(); - }; - exeXml.send(); - } else { - msg('Latest client is already installed'); - launch(); - } - } - }; - xml.onerror = () => { - err(`Error: from ${url}: non-http error`, false); - launch(); - }; - xml.send(); -} -function launchRuneLiteInner(jx_session_id, jx_character_id, jx_display_name, configure) { - saveConfig(); - const launchPath = configure ? '/launch-runelite-jar-configure?' : '/launch-runelite-jar?'; - const launch = (id, jar, jarPath) => { - const xml2 = new XMLHttpRequest(); - const params = {}; - if (id) params.id = id; - if (jarPath) params.jar_path = jarPath; - if (jx_session_id) params.jx_session_id = jx_session_id; - if (jx_character_id) params.jx_character_id = jx_character_id; - if (jx_display_name) params.jx_display_name = jx_display_name; - if (configSub.flatpak_rich_presence) params.flatpak_rich_presence = ''; - xml2.open( - jar ? 'POST' : 'GET', - launchPath.concat(new URLSearchParams(params).toString()), - true - ); - xml2.onreadystatechange = () => { - if (xml2.readyState == 4) { - msg(`Game launch status: '${xml2.responseText.trim()}'`); - if (xml2.status == 200 && id) { - runeLiteInstalledId.set(id); - } - } - }; - xml2.send(jar); - }; - if (configSub.runelite_use_custom_jar) { - launch(null, null, configSub.runelite_custom_jar); - return; - } - const xml = new XMLHttpRequest(); - const url = 'https://api.github.com/repos/runelite/launcher/releases'; - xml.open('GET', url, true); - xml.onreadystatechange = () => { - if (xml.readyState == 4) { - if (xml.status == 200) { - const runelite = JSON.parse(xml.responseText) - .map((x) => x.assets) - .flat() - .find((x) => x.name.toLowerCase() == 'runelite.jar'); - if (runelite.id != get_store_value(runeLiteInstalledId)) { - msg('Downloading RuneLite...'); - const xmlRl = new XMLHttpRequest(); - xmlRl.open('GET', runelite.browser_download_url, true); - xmlRl.responseType = 'arraybuffer'; - xmlRl.onreadystatechange = () => { - if (xmlRl.readyState == 4) { - if (xmlRl.status == 200) { - launch(runelite.id, xmlRl.response); - } else { - err( - `Error downloading from ${runelite.url}: ${xmlRl.status}: ${xmlRl.responseText}`, - false - ); - } - } - }; - xmlRl.onprogress = (e) => { - if (e.loaded && e.lengthComputable) { - messageList.update((data) => { - data[0].text = `Downloading RuneLite... ${(Math.round((1e3 * e.loaded) / e.total) / 10).toFixed(1)}%`; - return data; - }); - } - }; - xmlRl.send(); - } else { - msg('Latest JAR is already installed'); - launch(); - } - } else { - err(`Error from ${url}: ${xml.status}: ${xml.responseText}`, false); - } - } - }; - xml.send(); -} -function launchRuneLite(jx_session_id, jx_character_id, jx_display_name) { - return launchRuneLiteInner(jx_session_id, jx_character_id, jx_display_name, false); -} -function launchRuneLiteConfigure(jx_session_id, jx_character_id, jx_display_name) { - return launchRuneLiteInner(jx_session_id, jx_character_id, jx_display_name, true); -} -function launchHdos(jx_session_id, jx_character_id, jx_display_name) { - saveConfig(); - const launch = (version, jar) => { - const xml2 = new XMLHttpRequest(); - const params = {}; - if (version) params.version = version; - if (jx_session_id) params.jx_session_id = jx_session_id; - if (jx_character_id) params.jx_character_id = jx_character_id; - if (jx_display_name) params.jx_display_name = jx_display_name; - xml2.open('POST', '/launch-hdos-jar?'.concat(new URLSearchParams(params).toString()), true); - xml2.onreadystatechange = () => { - if (xml2.readyState == 4) { - msg(`Game launch status: '${xml2.responseText.trim()}'`); - if (xml2.status == 200 && version) { - hdosInstalledVersion.set(version); - } - } - }; - xml2.send(jar); - }; - const xml = new XMLHttpRequest(); - const url = 'https://cdn.hdos.dev/client/getdown.txt'; - xml.open('GET', url, true); - xml.onreadystatechange = () => { - if (xml.readyState == 4) { - if (xml.status == 200) { - const versionRegex = xml.responseText.match(/^launcher\.version *= *(.*?)$/m); - if (versionRegex && versionRegex.length >= 2) { - const latestVersion = versionRegex[1]; - if (latestVersion !== get_store_value(hdosInstalledVersion)) { - const jarUrl = `https://cdn.hdos.dev/launcher/v${latestVersion}/hdos-launcher.jar`; - msg('Downloading HDOS...'); - const xmlHdos = new XMLHttpRequest(); - xmlHdos.open('GET', jarUrl, true); - xmlHdos.responseType = 'arraybuffer'; - xmlHdos.onreadystatechange = () => { - if (xmlHdos.readyState == 4) { - if (xmlHdos.status == 200) { - launch(latestVersion, xmlHdos.response); - } else { - const runelite = JSON.parse(xml.responseText) - .map((x) => x.assets) - .flat() - .find((x) => x.name.toLowerCase() == 'runelite.jar'); - err( - `Error downloading from ${runelite.url}: ${xmlHdos.status}: ${xmlHdos.responseText}`, - false - ); - } - } - }; - xmlHdos.onprogress = (e) => { - if (e.loaded && e.lengthComputable) { - messageList.update((data) => { - data[0].text = `Downloading HDOS... ${(Math.round((1e3 * e.loaded) / e.total) / 10).toFixed(1)}%`; - return data; - }); - } - }; - xmlHdos.send(); - } else { - msg('Latest JAR is already installed'); - launch(); - } - } else { - msg("Couldn't parse latest launcher version"); - launch(); - } - } else { - err(`Error from ${url}: ${xml.status}: ${xml.responseText}`, false); - } - } - }; - xml.send(); -} -let saveConfigInProgress = false; -function saveConfig() { - var _a; - if (get_store_value(isConfigDirty) && !saveConfigInProgress) { - saveConfigInProgress = true; - const xml = new XMLHttpRequest(); - xml.open('POST', '/save-config', true); - xml.onreadystatechange = () => { - if (xml.readyState == 4) { - msg(`Save config status: '${xml.responseText.trim()}'`); - if (xml.status == 200) { - isConfigDirty.set(false); - } - saveConfigInProgress = false; - } - }; - xml.setRequestHeader('Content-Type', 'application/json'); - const characters = {}; - (_a = configSub.selected_characters) == null - ? void 0 - : _a.forEach((value, key) => { - characters[key] = value; - }); - const object = {}; - Object.assign(object, configSub); - object.selected_characters = characters; - const json = JSON.stringify(object, null, 4); - xml.send(json); - } -} -function getNewClientListPromise() { - return new Promise((resolve, reject) => { - const xml = new XMLHttpRequest(); - const url = get_store_value(internalUrl).concat('/list-game-clients'); - xml.open('GET', url, true); - xml.onreadystatechange = () => { - if (xml.readyState == 4) { - if ( - xml.status == 200 && - xml.getResponseHeader('content-type') === 'application/json' - ) { - const dict = JSON.parse(xml.responseText); - resolve( - Object.keys(dict).map((uid) => ({ - uid, - identity: dict[uid].identity || null - })) - ); - } else { - reject(`error (${xml.responseText})`); - } - } - }; - xml.send(); - }); -} -function savePluginConfig() { - const xml = new XMLHttpRequest(); - xml.open('POST', '/save-plugin-config', true); - xml.setRequestHeader('Content-Type', 'application/json'); - xml.onreadystatechange = () => { - if (xml.readyState == 4) { - msg(`Save-plugin-config status: ${xml.responseText.trim()}`); - } - }; - xml.send(JSON.stringify(get_store_value(pluginList))); -} -function get_each_context$3(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[22] = list[i]; - return child_ctx; -} -function create_each_block$3(ctx) { - let option; - let t_value = - /*account*/ - ctx[22][1].displayName + ''; - let t; - let option_data_id_value; - let option_value_value; - return { - c() { - option = element('option'); - t = text(t_value); - attr(option, 'data-id', (option_data_id_value = /*account*/ ctx[22][1].userId)); - attr(option, 'class', 'dark:bg-slate-900'); - option.__value = option_value_value = /*account*/ ctx[22][1].displayName; - set_input_value(option, option.__value); - }, - m(target, anchor) { - insert(target, option, anchor); - append(option, t); - }, - p(ctx2, dirty) { - if ( - dirty /*$accountList*/ & 4 && - t_value !== (t_value = /*account*/ ctx2[22][1].displayName + '') - ) - set_data(t, t_value); - if ( - dirty /*$accountList*/ & 4 && - option_data_id_value !== (option_data_id_value = /*account*/ ctx2[22][1].userId) - ) { - attr(option, 'data-id', option_data_id_value); - } - if ( - dirty /*$accountList*/ & 4 && - option_value_value !== (option_value_value = /*account*/ ctx2[22][1].displayName) - ) { - option.__value = option_value_value; - set_input_value(option, option.__value); - } - }, - d(detaching) { - if (detaching) { - detach(option); - } - } - }; -} -function create_fragment$c(ctx) { - let div1; - let select; - let t0; - let div0; - let button0; - let t2; - let button1; - let mounted; - let dispose; - let each_value = ensure_array_like( - /*$accountList*/ - ctx[2] - ); - let each_blocks = []; - for (let i = 0; i < each_value.length; i += 1) { - each_blocks[i] = create_each_block$3(get_each_context$3(ctx, each_value, i)); - } - return { - c() { - div1 = element('div'); - select = element('select'); - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - t0 = space(); - div0 = element('div'); - button0 = element('button'); - button0.textContent = 'Log In'; - t2 = space(); - button1 = element('button'); - button1.textContent = 'Log Out'; - attr(select, 'name', 'account_select'); - attr(select, 'id', 'account_select'); - attr( - select, - 'class', - 'w-full cursor-pointer rounded-lg border-2 border-inherit bg-inherit p-2 text-center' - ); - attr( - button0, - 'class', - 'mx-auto mr-2 rounded-lg bg-blue-500 p-2 font-bold text-black duration-200 hover:opacity-75' - ); - attr( - button1, - 'class', - 'mx-auto rounded-lg border-2 border-blue-500 p-2 font-bold duration-200 hover:opacity-75' - ); - attr(div0, 'class', 'mt-5 flex'); - attr( - div1, - 'class', - 'z-10 w-48 rounded-lg border-2 border-slate-300 bg-slate-100 p-3 shadow dark:border-slate-800 dark:bg-slate-900' - ); - attr(div1, 'role', 'none'); - }, - m(target, anchor) { - insert(target, div1, anchor); - append(div1, select); - for (let i = 0; i < each_blocks.length; i += 1) { - if (each_blocks[i]) { - each_blocks[i].m(select, null); - } - } - ctx[7](select); - append(div1, t0); - append(div1, div0); - append(div0, button0); - append(div0, t2); - append(div0, button1); - if (!mounted) { - dispose = [ - listen( - select, - 'change', - /*change_handler*/ - ctx[8] - ), - listen( - button0, - 'click', - /*click_handler*/ - ctx[9] - ), - listen( - button1, - 'click', - /*click_handler_1*/ - ctx[10] - ), - listen( - div1, - 'mouseenter', - /*mouseenter_handler*/ - ctx[11] - ), - listen( - div1, - 'mouseleave', - /*mouseleave_handler*/ - ctx[12] - ) - ]; - mounted = true; - } - }, - p(ctx2, [dirty]) { - if (dirty /*$accountList*/ & 4) { - each_value = ensure_array_like( - /*$accountList*/ - ctx2[2] - ); - let i; - for (i = 0; i < each_value.length; i += 1) { - const child_ctx = get_each_context$3(ctx2, each_value, i); - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); - } else { - each_blocks[i] = create_each_block$3(child_ctx); - each_blocks[i].c(); - each_blocks[i].m(select, null); - } - } - for (; i < each_blocks.length; i += 1) { - each_blocks[i].d(1); - } - each_blocks.length = each_value.length; - } - }, - i: noop, - o: noop, - d(detaching) { - if (detaching) { - detach(div1); - } - destroy_each(each_blocks, detaching); - ctx[7](null); - mounted = false; - run_all(dispose); - } - }; -} -function instance$b($$self, $$props, $$invalidate) { - let $selectedPlay; - let $credentials; - let $accountList; - let $config; - component_subscribe($$self, selectedPlay, ($$value) => - $$invalidate(13, ($selectedPlay = $$value)) - ); - component_subscribe($$self, credentials, ($$value) => - $$invalidate(14, ($credentials = $$value)) - ); - component_subscribe($$self, accountList, ($$value) => - $$invalidate(2, ($accountList = $$value)) - ); - component_subscribe($$self, config, ($$value) => $$invalidate(15, ($config = $$value))); - let { showAccountDropdown } = $$props; - let { hoverAccountButton } = $$props; - const sOrigin = atob(boltSub.origin); - const clientId = atob(boltSub.clientid); - const exchangeUrl = sOrigin.concat('/oauth2/token'); - const revokeUrl = sOrigin.concat('/oauth2/revoke'); - let mousedOver = false; - let accountSelect; - function checkClickOutside(evt) { - if (hoverAccountButton) return; - if (evt.button === 0 && showAccountDropdown && !mousedOver) { - $$invalidate(5, (showAccountDropdown = false)); - } - } - function logoutClicked() { - var _a; - if (accountSelect.options.length == 0) { - msg('Logout unsuccessful: no account selected'); - return; - } - let creds = $selectedPlay.credentials; - if ($selectedPlay.account) { - $accountList.delete((_a = $selectedPlay.account) == null ? void 0 : _a.userId); - accountList.set($accountList); - } - const index = accountSelect.selectedIndex; - if (index > 0) $$invalidate(1, (accountSelect.selectedIndex = index - 1), accountSelect); - else if (index == 0 && $accountList.size > 0) { - $$invalidate(1, (accountSelect.selectedIndex = index + 1), accountSelect); - } else { - delete $selectedPlay.account; - delete $selectedPlay.character; - delete $selectedPlay.credentials; - } - accountChanged(); - if (!creds) return; - checkRenewCreds(creds, exchangeUrl, clientId).then((x) => { - if (x === null) { - revokeOauthCreds(creds.access_token, revokeUrl, clientId).then((res) => { - if (res === 200) { - msg('Successful logout'); - removeLogin(creds); - } else { - err(`Logout unsuccessful: status ${res}`, false); - } - }); - } else if (x === 400 || x === 401) { - msg('Logout unsuccessful: credentials are invalid, so discarding them anyway'); - if (creds) removeLogin(creds); - } else { - err( - 'Logout unsuccessful: unable to verify credentials due to a network error', - false - ); - } - }); - } - function removeLogin(creds) { - $credentials.delete(creds.sub); - saveAllCreds(); - } - function accountChanged() { - var _a; - isConfigDirty.set(true); - const key = accountSelect[accountSelect.selectedIndex].getAttribute('data-id'); - set_store_value( - selectedPlay, - ($selectedPlay.account = $accountList.get(key)), - $selectedPlay - ); - set_store_value(config, ($config.selected_account = key), $config); - set_store_value( - selectedPlay, - ($selectedPlay.credentials = $credentials.get( - (_a = $selectedPlay.account) == null ? void 0 : _a.userId - )), - $selectedPlay - ); - if ($selectedPlay.account && $selectedPlay.account.characters) { - const char_select = document.getElementById('character_select'); - char_select.selectedIndex = 0; - const [first_key] = $selectedPlay.account.characters.keys(); - set_store_value( - selectedPlay, - ($selectedPlay.character = $selectedPlay.account.characters.get(first_key)), - $selectedPlay - ); - } - } - addEventListener('mousedown', checkClickOutside); - onMount(() => { - var _a; - let index = 0; - $accountList.forEach((value, _key) => { - var _a2; - if ( - value.displayName == - ((_a2 = $selectedPlay.account) == null ? void 0 : _a2.displayName) - ) { - $$invalidate(1, (accountSelect.selectedIndex = index), accountSelect); - } - index++; - }); - set_store_value( - selectedPlay, - ($selectedPlay.credentials = $credentials.get( - (_a = $selectedPlay.account) == null ? void 0 : _a.userId - )), - $selectedPlay - ); - }); - onDestroy(() => { - removeEventListener('mousedown', checkClickOutside); - }); - function select_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - accountSelect = $$value; - $$invalidate(1, accountSelect); - }); - } - const change_handler = () => { - accountChanged(); - }; - const click_handler = () => { - loginClicked(); - }; - const click_handler_1 = () => { - logoutClicked(); - }; - const mouseenter_handler = () => { - $$invalidate(0, (mousedOver = true)); - }; - const mouseleave_handler = () => { - $$invalidate(0, (mousedOver = false)); - }; - $$self.$$set = ($$props2) => { - if ('showAccountDropdown' in $$props2) - $$invalidate(5, (showAccountDropdown = $$props2.showAccountDropdown)); - if ('hoverAccountButton' in $$props2) - $$invalidate(6, (hoverAccountButton = $$props2.hoverAccountButton)); - }; - return [ - mousedOver, - accountSelect, - $accountList, - logoutClicked, - accountChanged, - showAccountDropdown, - hoverAccountButton, - select_binding, - change_handler, - click_handler, - click_handler_1, - mouseenter_handler, - mouseleave_handler - ]; -} -class Account extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance$b, create_fragment$c, safe_not_equal, { - showAccountDropdown: 5, - hoverAccountButton: 6 - }); - } -} -function create_else_block$4(ctx) { - let t; - return { - c() { - t = text('Log In'); - }, - m(target, anchor) { - insert(target, t, anchor); - }, - p: noop, - d(detaching) { - if (detaching) { - detach(t); - } - } - }; -} -function create_if_block_1$4(ctx) { - var _a; - let t_value = - /*$selectedPlay*/ - ((_a = ctx[6].account) == null ? void 0 : _a.displayName) + ''; - let t; - return { - c() { - t = text(t_value); - }, - m(target, anchor) { - insert(target, t, anchor); - }, - p(ctx2, dirty) { - var _a2; - if ( - dirty /*$selectedPlay*/ & 64 && - t_value !== - (t_value = - /*$selectedPlay*/ - ((_a2 = ctx2[6].account) == null ? void 0 : _a2.displayName) + '') - ) - set_data(t, t_value); - }, - d(detaching) { - if (detaching) { - detach(t); - } - } - }; -} -function create_if_block$6(ctx) { - let div; - let account; - let updating_showAccountDropdown; - let current; - function account_showAccountDropdown_binding(value) { - ctx[20](value); - } - let account_props = { - hoverAccountButton: - /*hoverAccountButton*/ - ctx[2] - }; - if ( - /*showAccountDropdown*/ - ctx[1] !== void 0 - ) { - account_props.showAccountDropdown = /*showAccountDropdown*/ ctx[1]; - } - account = new Account({ props: account_props }); - binding_callbacks.push(() => - bind(account, 'showAccountDropdown', account_showAccountDropdown_binding) - ); - return { - c() { - div = element('div'); - create_component(account.$$.fragment); - attr(div, 'class', 'absolute right-2 top-[72px]'); - }, - m(target, anchor) { - insert(target, div, anchor); - mount_component(account, div, null); - current = true; - }, - p(ctx2, dirty) { - const account_changes = {}; - if (dirty /*hoverAccountButton*/ & 4) - account_changes.hoverAccountButton = /*hoverAccountButton*/ ctx2[2]; - if (!updating_showAccountDropdown && dirty /*showAccountDropdown*/ & 2) { - updating_showAccountDropdown = true; - account_changes.showAccountDropdown = /*showAccountDropdown*/ ctx2[1]; - add_flush_callback(() => (updating_showAccountDropdown = false)); - } - account.$set(account_changes); - }, - i(local) { - if (current) return; - transition_in(account.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(account.$$.fragment, local); - current = false; - }, - d(detaching) { - if (detaching) { - detach(div); - } - destroy_component(account); - } - }; -} -function create_fragment$b(ctx) { - let div2; - let div0; - let button0; - let t1; - let button1; - let t3; - let div1; - let button2; - let t4; - let button3; - let t5; - let button4; - let t6; - let current; - let mounted; - let dispose; - function select_block_type(ctx2, dirty) { - if ( - /*$selectedPlay*/ - ctx2[6].account - ) - return create_if_block_1$4; - return create_else_block$4; - } - let current_block_type = select_block_type(ctx); - let if_block0 = current_block_type(ctx); - let if_block1 = - /*showAccountDropdown*/ - ctx[1] && create_if_block$6(ctx); - return { - c() { - div2 = element('div'); - div0 = element('div'); - button0 = element('button'); - button0.textContent = 'RS3'; - t1 = space(); - button1 = element('button'); - button1.textContent = 'OSRS'; - t3 = space(); - div1 = element('div'); - button2 = element('button'); - button2.innerHTML = `Change Theme`; - t4 = space(); - button3 = element('button'); - button3.innerHTML = `Settings`; - t5 = space(); - button4 = element('button'); - if_block0.c(); - t6 = space(); - if (if_block1) if_block1.c(); - attr( - button0, - 'class', - 'mx-1 w-20 rounded-lg border-2 border-blue-500 p-2 duration-200 hover:opacity-75' - ); - attr( - button1, - 'class', - 'mx-1 w-20 rounded-lg border-2 border-blue-500 bg-blue-500 p-2 text-black duration-200 hover:opacity-75' - ); - attr(div0, 'class', 'm-3 ml-9 font-bold'); - attr( - button2, - 'class', - 'my-3 h-10 w-10 rounded-full bg-blue-500 p-2 duration-200 hover:rotate-45 hover:opacity-75' - ); - attr( - button3, - 'class', - 'm-3 h-10 w-10 rounded-full bg-blue-500 p-2 duration-200 hover:rotate-45 hover:opacity-75' - ); - attr( - button4, - 'class', - 'm-2 w-48 rounded-lg border-2 border-slate-300 bg-inherit p-2 text-center font-bold text-black duration-200 hover:opacity-75 dark:border-slate-800 dark:text-slate-50' - ); - attr(div1, 'class', 'ml-auto flex'); - attr( - div2, - 'class', - 'fixed top-0 flex h-16 w-screen border-b-2 border-slate-300 bg-slate-100 duration-200 dark:border-slate-800 dark:bg-slate-900' - ); - }, - m(target, anchor) { - insert(target, div2, anchor); - append(div2, div0); - append(div0, button0); - ctx[10](button0); - append(div0, t1); - append(div0, button1); - ctx[12](button1); - append(div2, t3); - append(div2, div1); - append(div1, button2); - append(div1, t4); - append(div1, button3); - append(div1, t5); - append(div1, button4); - if_block0.m(button4, null); - ctx[16](button4); - append(div2, t6); - if (if_block1) if_block1.m(div2, null); - current = true; - if (!mounted) { - dispose = [ - listen( - button0, - 'click', - /*click_handler*/ - ctx[11] - ), - listen( - button1, - 'click', - /*click_handler_1*/ - ctx[13] - ), - listen( - button2, - 'click', - /*click_handler_2*/ - ctx[14] - ), - listen( - button3, - 'click', - /*click_handler_3*/ - ctx[15] - ), - listen( - button4, - 'mouseenter', - /*mouseenter_handler*/ - ctx[17] - ), - listen( - button4, - 'mouseleave', - /*mouseleave_handler*/ - ctx[18] - ), - listen( - button4, - 'click', - /*click_handler_4*/ - ctx[19] - ) - ]; - mounted = true; - } - }, - p(ctx2, [dirty]) { - if ( - current_block_type === (current_block_type = select_block_type(ctx2)) && - if_block0 - ) { - if_block0.p(ctx2, dirty); - } else { - if_block0.d(1); - if_block0 = current_block_type(ctx2); - if (if_block0) { - if_block0.c(); - if_block0.m(button4, null); - } - } - if ( - /*showAccountDropdown*/ - ctx2[1] - ) { - if (if_block1) { - if_block1.p(ctx2, dirty); - if (dirty /*showAccountDropdown*/ & 2) { - transition_in(if_block1, 1); - } - } else { - if_block1 = create_if_block$6(ctx2); - if_block1.c(); - transition_in(if_block1, 1); - if_block1.m(div2, null); - } - } else if (if_block1) { - group_outros(); - transition_out(if_block1, 1, 1, () => { - if_block1 = null; - }); - check_outros(); - } - }, - i(local) { - if (current) return; - transition_in(if_block1); - current = true; - }, - o(local) { - transition_out(if_block1); - current = false; - }, - d(detaching) { - if (detaching) { - detach(div2); - } - ctx[10](null); - ctx[12](null); - if_block0.d(); - ctx[16](null); - if (if_block1) if_block1.d(); - mounted = false; - run_all(dispose); - } - }; -} -function instance$a($$self, $$props, $$invalidate) { - let $config; - let $isConfigDirty; - let $selectedPlay; - component_subscribe($$self, config, ($$value) => $$invalidate(21, ($config = $$value))); - component_subscribe($$self, isConfigDirty, ($$value) => - $$invalidate(22, ($isConfigDirty = $$value)) - ); - component_subscribe($$self, selectedPlay, ($$value) => - $$invalidate(6, ($selectedPlay = $$value)) - ); - let { showSettings } = $$props; - let showAccountDropdown = false; - let hoverAccountButton = false; - let rs3Button; - let osrsButton; - let accountButton; - function change_theme() { - let html = document.documentElement; - if (html.classList.contains('dark')) html.classList.remove('dark'); - else html.classList.add('dark'); - set_store_value(config, ($config.use_dark_theme = !$config.use_dark_theme), $config); - set_store_value(isConfigDirty, ($isConfigDirty = true), $isConfigDirty); - } - function toggle_game(game) { - switch (game) { - case Game.osrs: - set_store_value(selectedPlay, ($selectedPlay.game = Game.osrs), $selectedPlay); - set_store_value( - selectedPlay, - ($selectedPlay.client = $config.selected_client_index), - $selectedPlay - ); - set_store_value(config, ($config.selected_game_index = Game.osrs), $config); - set_store_value(isConfigDirty, ($isConfigDirty = true), $isConfigDirty); - osrsButton.classList.add('bg-blue-500', 'text-black'); - rs3Button.classList.remove('bg-blue-500', 'text-black'); - break; - case Game.rs3: - set_store_value(selectedPlay, ($selectedPlay.game = Game.rs3), $selectedPlay); - set_store_value(config, ($config.selected_game_index = Game.rs3), $config); - set_store_value(isConfigDirty, ($isConfigDirty = true), $isConfigDirty); - osrsButton.classList.remove('bg-blue-500', 'text-black'); - rs3Button.classList.add('bg-blue-500', 'text-black'); - break; - } - } - function toggle_account() { - if (accountButton.innerHTML == 'Log In') { - loginClicked(); - return; - } - $$invalidate(1, (showAccountDropdown = !showAccountDropdown)); - } - onMount(() => { - toggle_game($config.selected_game_index); - }); - function button0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - rs3Button = $$value; - $$invalidate(3, rs3Button); - }); - } - const click_handler = () => { - toggle_game(Game.rs3); - }; - function button1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - osrsButton = $$value; - $$invalidate(4, osrsButton); - }); - } - const click_handler_1 = () => { - toggle_game(Game.osrs); - }; - const click_handler_2 = () => change_theme(); - const click_handler_3 = () => { - $$invalidate(0, (showSettings = true)); - }; - function button4_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - accountButton = $$value; - $$invalidate(5, accountButton); - }); - } - const mouseenter_handler = () => { - $$invalidate(2, (hoverAccountButton = true)); - }; - const mouseleave_handler = () => { - $$invalidate(2, (hoverAccountButton = false)); - }; - const click_handler_4 = () => toggle_account(); - function account_showAccountDropdown_binding(value) { - showAccountDropdown = value; - $$invalidate(1, showAccountDropdown); - } - $$self.$$set = ($$props2) => { - if ('showSettings' in $$props2) $$invalidate(0, (showSettings = $$props2.showSettings)); - }; - return [ - showSettings, - showAccountDropdown, - hoverAccountButton, - rs3Button, - osrsButton, - accountButton, - $selectedPlay, - change_theme, - toggle_game, - toggle_account, - button0_binding, - click_handler, - button1_binding, - click_handler_1, - click_handler_2, - click_handler_3, - button4_binding, - mouseenter_handler, - mouseleave_handler, - click_handler_4, - account_showAccountDropdown_binding - ]; -} -class TopBar extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance$a, create_fragment$b, safe_not_equal, { showSettings: 0 }); - } -} -function create_fragment$a(ctx) { - let div2; - let div0; - let t; - let div1; - let mounted; - let dispose; - return { - c() { - div2 = element('div'); - div0 = element('div'); - div0.innerHTML = ``; - t = space(); - div1 = element('div'); - div1.innerHTML = ``; - attr( - div0, - 'class', - 'absolute left-0 top-0 z-10 h-screen w-screen backdrop-blur-sm backdrop-filter' - ); - attr(div1, 'class', 'absolute left-0 top-0 z-10 h-screen w-screen bg-black opacity-75'); - attr(div1, 'role', 'none'); - }, - m(target, anchor) { - insert(target, div2, anchor); - append(div2, div0); - append(div2, t); - append(div2, div1); - if (!mounted) { - dispose = listen( - div1, - 'click', - /*click_handler*/ - ctx[1] - ); - mounted = true; - } - }, - p: noop, - i: noop, - o: noop, - d(detaching) { - if (detaching) { - detach(div2); - } - mounted = false; - dispose(); - } - }; -} -function instance$9($$self) { - const dispatch = createEventDispatcher(); - const click_handler = () => { - dispatch('click'); - }; - return [dispatch, click_handler]; -} -class Backdrop extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance$9, create_fragment$a, safe_not_equal, {}); - } -} -function create_fragment$9(ctx) { - let div1; - let backdrop; - let t0; - let div0; - let p0; - let t2; - let p1; - let t4; - let button; - let current; - let mounted; - let dispose; - backdrop = new Backdrop({}); - return { - c() { - div1 = element('div'); - create_component(backdrop.$$.fragment); - t0 = space(); - div0 = element('div'); - p0 = element('p'); - p0.textContent = `${/*firstText*/ ctx[1]}`; - t2 = space(); - p1 = element('p'); - p1.textContent = `${/*secondText*/ ctx[2]}`; - t4 = space(); - button = element('button'); - button.textContent = 'I Understand'; - attr(p0, 'class', 'p-2'); - attr(p1, 'class', 'p-2'); - attr( - button, - 'class', - 'm-5 rounded-lg border-2 border-blue-500 p-2 duration-200 hover:opacity-75' - ); - attr( - div0, - 'class', - 'absolute left-1/4 top-1/4 z-20 w-1/2 rounded-lg bg-slate-100 p-5 text-center shadow-lg dark:bg-slate-900' - ); - attr(div1, 'id', 'disclaimer'); - }, - m(target, anchor) { - insert(target, div1, anchor); - mount_component(backdrop, div1, null); - append(div1, t0); - append(div1, div0); - append(div0, p0); - append(div0, t2); - append(div0, p1); - append(div0, t4); - append(div0, button); - current = true; - if (!mounted) { - dispose = listen( - button, - 'click', - /*click_handler*/ - ctx[3] - ); - mounted = true; - } - }, - p: noop, - i(local) { - if (current) return; - transition_in(backdrop.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(backdrop.$$.fragment, local); - current = false; - }, - d(detaching) { - if (detaching) { - detach(div1); - } - destroy_component(backdrop); - mounted = false; - dispose(); - } - }; -} -function instance$8($$self, $$props, $$invalidate) { - let $showDisclaimer; - component_subscribe($$self, showDisclaimer, ($$value) => - $$invalidate(0, ($showDisclaimer = $$value)) - ); - const firstText = atob( - 'Qm9sdCBpcyBhbiB1bm9mZmljaWFsIHRoaXJkLXBhcnR5IGxhdW5jaGVyLiBJdCdzIGZyZWUgYW5kIG9wZW4tc291cmNlIHNvZnR3YXJlIGxpY2Vuc2VkIHVuZGVyIEFHUEwgMy4wLg==' - ); - const secondText = atob( - 'SmFnZXggaXMgbm90IHJlc3BvbnNpYmxlIGZvciBhbnkgcHJvYmxlbXMgb3IgZGFtYWdlIGNhdXNlZCBieSB1c2luZyB0aGlzIHByb2R1Y3Qu' - ); - const click_handler = () => { - set_store_value(showDisclaimer, ($showDisclaimer = false), $showDisclaimer); - }; - return [$showDisclaimer, firstText, secondText, click_handler]; -} -class Disclaimer extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance$8, create_fragment$9, safe_not_equal, {}); - } -} -function create_fragment$8(ctx) { - let div1; - let button; - let mounted; - let dispose; - return { - c() { - div1 = element('div'); - button = element('button'); - button.innerHTML = `
Browse app data - Browse App Data
`; - attr(button, 'id', 'data_dir_button'); - attr(button, 'class', 'p-2 hover:opacity-75'); - attr(div1, 'id', 'general_options'); - attr(div1, 'class', 'col-span-3 p-5 pt-10'); - }, - m(target, anchor) { - insert(target, div1, anchor); - append(div1, button); - if (!mounted) { - dispose = listen( - button, - 'click', - /*click_handler*/ - ctx[1] - ); - mounted = true; - } - }, - p: noop, - i: noop, - o: noop, - d(detaching) { - if (detaching) { - detach(div1); - } - mounted = false; - dispose(); - } - }; -} -function instance$7($$self) { - function openDataDir() { - var xml = new XMLHttpRequest(); - xml.open('GET', '/browse-data'); - xml.onreadystatechange = () => { - if (xml.readyState == 4) { - msg(`Browse status: '${xml.responseText.trim()}'`); - } - }; - xml.send(); - } - const click_handler = () => { - openDataDir(); - }; - return [openDataDir, click_handler]; -} -class General extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance$7, create_fragment$8, safe_not_equal, {}); - } -} -function create_fragment$7(ctx) { - let div4; - let button0; - let t1; - let div1; - let label0; - let t3; - let input0; - let t4; - let div2; - let label1; - let t6; - let input1; - let t7; - let div3; - let textarea; - let t8; - let br; - let t9; - let button1; - let mounted; - let dispose; - return { - c() { - div4 = element('div'); - button0 = element('button'); - button0.innerHTML = `
Configure RuneLite - Configure RuneLite
`; - t1 = space(); - div1 = element('div'); - label0 = element('label'); - label0.textContent = 'Expose rich presence to Flatpak Discord:'; - t3 = space(); - input0 = element('input'); - t4 = space(); - div2 = element('div'); - label1 = element('label'); - label1.textContent = 'Use custom RuneLite JAR:'; - t6 = space(); - input1 = element('input'); - t7 = space(); - div3 = element('div'); - textarea = element('textarea'); - t8 = space(); - br = element('br'); - t9 = space(); - button1 = element('button'); - button1.textContent = 'Select File'; - attr(button0, 'id', 'rl_configure'); - attr(button0, 'class', 'p-2 pb-5 hover:opacity-75'); - attr(label0, 'for', 'flatpak_rich_presence'); - attr(input0, 'type', 'checkbox'); - attr(input0, 'name', 'flatpak_rich_presence'); - attr(input0, 'id', 'flatpak_rich_presence'); - attr(input0, 'class', 'ml-2'); - attr(div1, 'id', 'flatpak_div'); - attr( - div1, - 'class', - 'mx-auto border-t-2 border-slate-300 p-2 py-5 dark:border-slate-800' - ); - attr(label1, 'for', 'use_custom_jar'); - attr(input1, 'type', 'checkbox'); - attr(input1, 'name', 'use_custom_jar'); - attr(input1, 'id', 'use_custom_jar'); - attr(input1, 'class', 'ml-2'); - attr( - div2, - 'class', - 'mx-auto border-t-2 border-slate-300 p-2 pt-5 dark:border-slate-800' - ); - textarea.disabled = true; - attr(textarea, 'name', 'custom_jar_file'); - attr(textarea, 'id', 'custom_jar_file'); - attr( - textarea, - 'class', - 'h-10 rounded border-2 border-slate-300 bg-slate-100 text-slate-950 dark:border-slate-800 dark:bg-slate-900 dark:text-slate-50' - ); - button1.disabled = true; - attr(button1, 'id', 'custom_jar_file_button'); - attr( - button1, - 'class', - 'mt-1 rounded-lg border-2 border-blue-500 p-1 duration-200 hover:opacity-75' - ); - attr(div3, 'id', 'custom_jar_div'); - attr(div3, 'class', 'mx-auto p-2 opacity-25'); - attr(div4, 'id', 'osrs_options'); - attr(div4, 'class', 'col-span-3 p-5 pt-10'); - }, - m(target, anchor) { - insert(target, div4, anchor); - append(div4, button0); - append(div4, t1); - append(div4, div1); - append(div1, label0); - append(div1, t3); - append(div1, input0); - ctx[12](input0); - ctx[14](div1); - append(div4, t4); - append(div4, div2); - append(div2, label1); - append(div2, t6); - append(div2, input1); - ctx[15](input1); - append(div4, t7); - append(div4, div3); - append(div3, textarea); - ctx[17](textarea); - append(div3, t8); - append(div3, br); - append(div3, t9); - append(div3, button1); - ctx[19](button1); - ctx[21](div3); - if (!mounted) { - dispose = [ - listen( - button0, - 'click', - /*click_handler*/ - ctx[11] - ), - listen( - input0, - 'change', - /*change_handler*/ - ctx[13] - ), - listen( - input1, - 'change', - /*change_handler_1*/ - ctx[16] - ), - listen( - textarea, - 'change', - /*change_handler_2*/ - ctx[18] - ), - listen( - button1, - 'click', - /*click_handler_1*/ - ctx[20] - ) - ]; - mounted = true; - } - }, - p: noop, - i: noop, - o: noop, - d(detaching) { - if (detaching) { - detach(div4); - } - ctx[12](null); - ctx[14](null); - ctx[15](null); - ctx[17](null); - ctx[19](null); - ctx[21](null); - mounted = false; - run_all(dispose); - } - }; -} -function instance$6($$self, $$props, $$invalidate) { - let $platform; - let $config; - let $selectedPlay; - let $isConfigDirty; - component_subscribe($$self, platform, ($$value) => $$invalidate(22, ($platform = $$value))); - component_subscribe($$self, config, ($$value) => $$invalidate(23, ($config = $$value))); - component_subscribe($$self, selectedPlay, ($$value) => - $$invalidate(24, ($selectedPlay = $$value)) - ); - component_subscribe($$self, isConfigDirty, ($$value) => - $$invalidate(25, ($isConfigDirty = $$value)) - ); - let customJarDiv; - let customJarFile; - let customJarFileButton; - let useJar; - let flatpakPresence; - let flatpakDiv; - function toggleJarDiv() { - customJarDiv.classList.toggle('opacity-25'); - $$invalidate(1, (customJarFile.disabled = !customJarFile.disabled), customJarFile); - $$invalidate( - 2, - (customJarFileButton.disabled = !customJarFileButton.disabled), - customJarFileButton - ); - set_store_value(config, ($config.runelite_use_custom_jar = useJar.checked), $config); - if ($config.runelite_use_custom_jar) { - if (customJarFile.value) - set_store_value( - config, - ($config.runelite_custom_jar = customJarFile.value), - $config - ); - } else { - $$invalidate(1, (customJarFile.value = ''), customJarFile); - set_store_value(config, ($config.runelite_custom_jar = ''), $config); - set_store_value(config, ($config.runelite_use_custom_jar = false), $config); - } - set_store_value(isConfigDirty, ($isConfigDirty = true), $isConfigDirty); - } - function toggleRichPresence() { - set_store_value(config, ($config.flatpak_rich_presence = flatpakPresence.checked), $config); - set_store_value(isConfigDirty, ($isConfigDirty = true), $isConfigDirty); - } - function textChanged() { - set_store_value(config, ($config.runelite_custom_jar = customJarFile.value), $config); - set_store_value(isConfigDirty, ($isConfigDirty = true), $isConfigDirty); - } - function selectFile() { - $$invalidate(3, (useJar.disabled = true), useJar); - $$invalidate(2, (customJarFileButton.disabled = true), customJarFileButton); - var xml = new XMLHttpRequest(); - xml.onreadystatechange = () => { - if (xml.readyState == 4) { - if (xml.status == 200) { - $$invalidate(1, (customJarFile.value = xml.responseText), customJarFile); - set_store_value( - config, - ($config.runelite_custom_jar = xml.responseText), - $config - ); - set_store_value(isConfigDirty, ($isConfigDirty = true), $isConfigDirty); - } - $$invalidate(2, (customJarFileButton.disabled = false), customJarFileButton); - $$invalidate(3, (useJar.disabled = false), useJar); - } - }; - xml.open('GET', '/jar-file-picker', true); - xml.send(); - } - function launchConfigure() { - var _a, _b, _c; - if (!$selectedPlay.account || !$selectedPlay.character) { - msg('Please log in to configure RuneLite'); - return; - } - launchRuneLiteConfigure( - (_a = $selectedPlay.credentials) == null ? void 0 : _a.session_id, - (_b = $selectedPlay.character) == null ? void 0 : _b.accountId, - (_c = $selectedPlay.character) == null ? void 0 : _c.displayName - ); - } - onMount(() => { - $$invalidate(4, (flatpakPresence.checked = $config.flatpak_rich_presence), flatpakPresence); - $$invalidate(3, (useJar.checked = $config.runelite_use_custom_jar), useJar); - if (useJar.checked && $config.runelite_custom_jar) { - customJarDiv.classList.remove('opacity-25'); - $$invalidate(1, (customJarFile.disabled = false), customJarFile); - $$invalidate(2, (customJarFileButton.disabled = false), customJarFileButton); - $$invalidate(1, (customJarFile.value = $config.runelite_custom_jar), customJarFile); - } else { - $$invalidate(3, (useJar.checked = false), useJar); - set_store_value(config, ($config.runelite_use_custom_jar = false), $config); - } - if ($platform !== 'linux') { - flatpakDiv.remove(); - } - }); - const click_handler = () => launchConfigure(); - function input0_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - flatpakPresence = $$value; - $$invalidate(4, flatpakPresence); - }); - } - const change_handler = () => { - toggleRichPresence(); - }; - function div1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - flatpakDiv = $$value; - $$invalidate(5, flatpakDiv); - }); - } - function input1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - useJar = $$value; - $$invalidate(3, useJar); - }); - } - const change_handler_1 = () => { - toggleJarDiv(); - }; - function textarea_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - customJarFile = $$value; - $$invalidate(1, customJarFile); - }); - } - const change_handler_2 = () => { - textChanged(); - }; - function button1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - customJarFileButton = $$value; - $$invalidate(2, customJarFileButton); - }); - } - const click_handler_1 = () => { - selectFile(); - }; - function div3_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - customJarDiv = $$value; - $$invalidate(0, customJarDiv); - }); - } - return [ - customJarDiv, - customJarFile, - customJarFileButton, - useJar, - flatpakPresence, - flatpakDiv, - toggleJarDiv, - toggleRichPresence, - textChanged, - selectFile, - launchConfigure, - click_handler, - input0_binding, - change_handler, - div1_binding, - input1_binding, - change_handler_1, - textarea_binding, - change_handler_2, - button1_binding, - click_handler_1, - div3_binding - ]; -} -class Osrs extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance$6, create_fragment$7, safe_not_equal, {}); - } -} -function create_if_block$5(ctx) { - let div; - let label; - let t1; - let input; - let mounted; - let dispose; - return { - c() { - div = element('div'); - label = element('label'); - label.textContent = 'Enable Bolt plugin loader:'; - t1 = space(); - input = element('input'); - attr(label, 'for', 'enable_plugins'); - attr(input, 'type', 'checkbox'); - attr(input, 'name', 'enable_plugins'); - attr(input, 'id', 'enable_plugins'); - attr(input, 'class', 'ml-2'); - attr(div, 'class', 'mx-auto p-2'); - }, - m(target, anchor) { - insert(target, div, anchor); - append(div, label); - append(div, t1); - append(div, input); - input.checked = /*$config*/ ctx[3].rs_plugin_loader; - if (!mounted) { - dispose = [ - listen( - input, - 'change', - /*input_change_handler*/ - ctx[6] - ), - listen( - input, - 'change', - /*change_handler*/ - ctx[7] - ) - ]; - mounted = true; - } - }, - p(ctx2, dirty) { - if (dirty /*$config*/ & 8) { - input.checked = /*$config*/ ctx2[3].rs_plugin_loader; - } - }, - d(detaching) { - if (detaching) { - detach(div); - } - mounted = false; - run_all(dispose); - } - }; -} -function create_fragment$6(ctx) { - let div2; - let t0; - let div0; - let label; - let t2; - let input; - let t3; - let div1; - let textarea; - let mounted; - let dispose; - let if_block = hasBoltPlugins && create_if_block$5(ctx); - return { - c() { - div2 = element('div'); - if (if_block) if_block.c(); - t0 = space(); - div0 = element('div'); - label = element('label'); - label.textContent = 'Use custom config URI:'; - t2 = space(); - input = element('input'); - t3 = space(); - div1 = element('div'); - textarea = element('textarea'); - attr(label, 'for', 'use_custom_uri'); - attr(input, 'type', 'checkbox'); - attr(input, 'name', 'use_custom_uri'); - attr(input, 'id', 'use_custom_uri'); - attr(input, 'class', 'ml-2'); - attr(div0, 'class', 'mx-auto p-2'); - textarea.disabled = true; - attr(textarea, 'name', 'config_uri_address'); - attr(textarea, 'id', 'config_uri_address'); - attr(textarea, 'rows', '4'); - attr( - textarea, - 'class', - 'rounded border-2 border-slate-300 bg-slate-100 text-slate-950 dark:border-slate-800 dark:bg-slate-900 dark:text-slate-50' - ); - textarea.value = ' '; - attr(div1, 'id', 'config_uri_div'); - attr(div1, 'class', 'mx-auto p-2 opacity-25'); - attr(div2, 'id', 'rs3_options'); - attr(div2, 'class', 'col-span-3 p-5 pt-10'); - }, - m(target, anchor) { - insert(target, div2, anchor); - if (if_block) if_block.m(div2, null); - append(div2, t0); - append(div2, div0); - append(div0, label); - append(div0, t2); - append(div0, input); - ctx[8](input); - append(div2, t3); - append(div2, div1); - append(div1, textarea); - ctx[11](textarea); - ctx[12](div1); - if (!mounted) { - dispose = [ - listen( - input, - 'change', - /*change_handler_1*/ - ctx[9] - ), - listen( - textarea, - 'change', - /*change_handler_2*/ - ctx[10] - ) - ]; - mounted = true; - } - }, - p(ctx2, [dirty]) { - if (hasBoltPlugins) if_block.p(ctx2, dirty); - }, - i: noop, - o: noop, - d(detaching) { - if (detaching) { - detach(div2); - } - if (if_block) if_block.d(); - ctx[8](null); - ctx[11](null); - ctx[12](null); - mounted = false; - run_all(dispose); - } - }; -} -function instance$5($$self, $$props, $$invalidate) { - let $bolt; - let $config; - let $isConfigDirty; - component_subscribe($$self, bolt, ($$value) => $$invalidate(13, ($bolt = $$value))); - component_subscribe($$self, config, ($$value) => $$invalidate(3, ($config = $$value))); - component_subscribe($$self, isConfigDirty, ($$value) => - $$invalidate(14, ($isConfigDirty = $$value)) - ); - let configUriDiv; - let configUriAddress; - let useUri; - function toggleUriDiv() { - configUriDiv.classList.toggle('opacity-25'); - $$invalidate(1, (configUriAddress.disabled = !configUriAddress.disabled), configUriAddress); - set_store_value(isConfigDirty, ($isConfigDirty = true), $isConfigDirty); - if (!useUri.checked) { - $$invalidate( - 1, - (configUriAddress.value = atob($bolt.default_config_uri)), - configUriAddress - ); - set_store_value(config, ($config.rs_config_uri = ''), $config); - } - } - function uriAddressChanged() { - set_store_value(config, ($config.rs_config_uri = configUriAddress.value), $config); - set_store_value(isConfigDirty, ($isConfigDirty = true), $isConfigDirty); - } - onMount(() => { - if ($config.rs_config_uri) { - $$invalidate(1, (configUriAddress.value = $config.rs_config_uri), configUriAddress); - $$invalidate(2, (useUri.checked = true), useUri); - toggleUriDiv(); - } else { - $$invalidate( - 1, - (configUriAddress.value = atob($bolt.default_config_uri)), - configUriAddress - ); - } - }); - function input_change_handler() { - $config.rs_plugin_loader = this.checked; - config.set($config); - } - const change_handler = () => isConfigDirty.set(true); - function input_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - useUri = $$value; - $$invalidate(2, useUri); - }); - } - const change_handler_1 = () => { - toggleUriDiv(); - }; - const change_handler_2 = () => { - uriAddressChanged(); - }; - function textarea_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - configUriAddress = $$value; - $$invalidate(1, configUriAddress); - }); - } - function div1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - configUriDiv = $$value; - $$invalidate(0, configUriDiv); - }); - } - return [ - configUriDiv, - configUriAddress, - useUri, - $config, - toggleUriDiv, - uriAddressChanged, - input_change_handler, - change_handler, - input_binding, - change_handler_1, - change_handler_2, - textarea_binding, - div1_binding - ]; -} -class Rs3 extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance$5, create_fragment$6, safe_not_equal, {}); - } -} -function create_if_block_2$3(ctx) { - let rs3; - let current; - rs3 = new Rs3({}); - return { - c() { - create_component(rs3.$$.fragment); - }, - m(target, anchor) { - mount_component(rs3, target, anchor); - current = true; - }, - i(local) { - if (current) return; - transition_in(rs3.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(rs3.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(rs3, detaching); - } - }; -} -function create_if_block_1$3(ctx) { - let osrs; - let current; - osrs = new Osrs({}); - return { - c() { - create_component(osrs.$$.fragment); - }, - m(target, anchor) { - mount_component(osrs, target, anchor); - current = true; - }, - i(local) { - if (current) return; - transition_in(osrs.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(osrs.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(osrs, detaching); - } - }; -} -function create_if_block$4(ctx) { - let general; - let current; - general = new General({}); - return { - c() { - create_component(general.$$.fragment); - }, - m(target, anchor) { - mount_component(general, target, anchor); - current = true; - }, - i(local) { - if (current) return; - transition_in(general.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(general.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(general, detaching); - } - }; -} -function create_fragment$5(ctx) { - let div3; - let backdrop; - let t0; - let div2; - let button0; - let t1; - let div1; - let div0; - let button1; - let t2; - let br0; - let t3; - let button2; - let t4; - let br1; - let t5; - let button3; - let t6; - let t7; - let current_block_type_index; - let if_block; - let current; - let mounted; - let dispose; - backdrop = new Backdrop({}); - backdrop.$on( - 'click', - /*click_handler*/ - ctx[7] - ); - const if_block_creators = [create_if_block$4, create_if_block_1$3, create_if_block_2$3]; - const if_blocks = []; - function select_block_type(ctx2, dirty) { - if ( - /*showOption*/ - ctx2[1] /*Options*/ == ctx2[5].general - ) - return 0; - if ( - /*showOption*/ - ctx2[1] /*Options*/ == ctx2[5].osrs - ) - return 1; - if ( - /*showOption*/ - ctx2[1] /*Options*/ == ctx2[5].rs3 - ) - return 2; - return -1; - } - if (~(current_block_type_index = select_block_type(ctx))) { - if_block = if_blocks[current_block_type_index] = - if_block_creators[current_block_type_index](ctx); - } - return { - c() { - div3 = element('div'); - create_component(backdrop.$$.fragment); - t0 = space(); - div2 = element('div'); - button0 = element('button'); - button0.innerHTML = `Close`; - t1 = space(); - div1 = element('div'); - div0 = element('div'); - button1 = element('button'); - t2 = text('General'); - br0 = element('br'); - t3 = space(); - button2 = element('button'); - t4 = text('OSRS'); - br1 = element('br'); - t5 = space(); - button3 = element('button'); - t6 = text('RS3'); - t7 = space(); - if (if_block) if_block.c(); - attr( - button0, - 'class', - 'absolute right-3 top-3 rounded-full bg-rose-500 p-[2px] shadow-lg duration-200 hover:rotate-90 hover:opacity-75' - ); - attr(button1, 'id', 'general_button'); - attr(button1, 'class', inactiveClass); - attr(button2, 'id', 'osrs_button'); - attr(button2, 'class', activeClass); - attr(button3, 'id', 'rs3_button'); - attr(button3, 'class', inactiveClass); - attr( - div0, - 'class', - 'relative h-full border-r-2 border-slate-300 pt-10 dark:border-slate-800' - ); - attr(div1, 'class', 'grid h-full grid-cols-4'); - attr( - div2, - 'class', - 'absolute left-[13%] top-[13%] z-20 h-3/4 w-3/4 rounded-lg bg-slate-100 text-center shadow-lg dark:bg-slate-900' - ); - attr(div3, 'id', 'settings'); - }, - m(target, anchor) { - insert(target, div3, anchor); - mount_component(backdrop, div3, null); - append(div3, t0); - append(div3, div2); - append(div2, button0); - append(div2, t1); - append(div2, div1); - append(div1, div0); - append(div0, button1); - append(button1, t2); - ctx[9](button1); - append(div0, br0); - append(div0, t3); - append(div0, button2); - append(button2, t4); - ctx[11](button2); - append(div0, br1); - append(div0, t5); - append(div0, button3); - append(button3, t6); - ctx[13](button3); - append(div1, t7); - if (~current_block_type_index) { - if_blocks[current_block_type_index].m(div1, null); - } - current = true; - if (!mounted) { - dispose = [ - listen( - button0, - 'click', - /*click_handler_1*/ - ctx[8] - ), - listen( - button1, - 'click', - /*click_handler_2*/ - ctx[10] - ), - listen( - button2, - 'click', - /*click_handler_3*/ - ctx[12] - ), - listen( - button3, - 'click', - /*click_handler_4*/ - ctx[14] - ) - ]; - mounted = true; - } - }, - p(ctx2, [dirty]) { - let previous_block_index = current_block_type_index; - current_block_type_index = select_block_type(ctx2); - if (current_block_type_index !== previous_block_index) { - if (if_block) { - group_outros(); - transition_out(if_blocks[previous_block_index], 1, 1, () => { - if_blocks[previous_block_index] = null; - }); - check_outros(); - } - if (~current_block_type_index) { - if_block = if_blocks[current_block_type_index]; - if (!if_block) { - if_block = if_blocks[current_block_type_index] = - if_block_creators[current_block_type_index](ctx2); - if_block.c(); - } - transition_in(if_block, 1); - if_block.m(div1, null); - } else { - if_block = null; - } - } - }, - i(local) { - if (current) return; - transition_in(backdrop.$$.fragment, local); - transition_in(if_block); - current = true; - }, - o(local) { - transition_out(backdrop.$$.fragment, local); - transition_out(if_block); - current = false; - }, - d(detaching) { - if (detaching) { - detach(div3); - } - destroy_component(backdrop); - ctx[9](null); - ctx[11](null); - ctx[13](null); - if (~current_block_type_index) { - if_blocks[current_block_type_index].d(); - } - mounted = false; - run_all(dispose); - } - }; -} -let activeClass = - 'border-2 border-blue-500 bg-blue-500 hover:opacity-75 font-bold text-black duration-200 rounded-lg p-1 mx-auto my-1 w-3/4'; -let inactiveClass = - 'border-2 border-blue-500 hover:opacity-75 duration-200 rounded-lg p-1 mx-auto my-1 w-3/4'; -function instance$4($$self, $$props, $$invalidate) { - let { showSettings } = $$props; - var Options = /* @__PURE__ */ ((Options2) => { - Options2[(Options2['general'] = 0)] = 'general'; - Options2[(Options2['osrs'] = 1)] = 'osrs'; - Options2[(Options2['rs3'] = 2)] = 'rs3'; - return Options2; - })(Options || {}); - let showOption = 1; - let generalButton; - let osrsButton; - let rs3Button; - function toggleOptions(option) { - switch (option) { - case 0: - $$invalidate(1, (showOption = 0)); - $$invalidate( - /* general */ - 2, - (generalButton.classList.value = activeClass), - generalButton - ); - $$invalidate(3, (osrsButton.classList.value = inactiveClass), osrsButton); - $$invalidate(4, (rs3Button.classList.value = inactiveClass), rs3Button); - break; - case 1: - $$invalidate(1, (showOption = 1)); - $$invalidate( - /* osrs */ - 2, - (generalButton.classList.value = inactiveClass), - generalButton - ); - $$invalidate(3, (osrsButton.classList.value = activeClass), osrsButton); - $$invalidate(4, (rs3Button.classList.value = inactiveClass), rs3Button); - break; - case 2: - $$invalidate(1, (showOption = 2)); - $$invalidate( - /* rs3 */ - 2, - (generalButton.classList.value = inactiveClass), - generalButton - ); - $$invalidate(3, (osrsButton.classList.value = inactiveClass), osrsButton); - $$invalidate(4, (rs3Button.classList.value = activeClass), rs3Button); - break; - } - } - function escapeKeyPressed(evt) { - if (evt.key === 'Escape') { - $$invalidate(0, (showSettings = false)); - } - } - addEventListener('keydown', escapeKeyPressed); - onDestroy(() => { - removeEventListener('keydown', escapeKeyPressed); - }); - const click_handler = () => { - $$invalidate(0, (showSettings = false)); - }; - const click_handler_1 = () => { - $$invalidate(0, (showSettings = false)); - }; - function button1_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - generalButton = $$value; - $$invalidate(2, generalButton); - }); - } - const click_handler_2 = () => { - toggleOptions(Options.general); - }; - function button2_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - osrsButton = $$value; - $$invalidate(3, osrsButton); - }); - } - const click_handler_3 = () => { - toggleOptions(Options.osrs); - }; - function button3_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - rs3Button = $$value; - $$invalidate(4, rs3Button); - }); - } - const click_handler_4 = () => { - toggleOptions(Options.rs3); - }; - $$self.$$set = ($$props2) => { - if ('showSettings' in $$props2) $$invalidate(0, (showSettings = $$props2.showSettings)); - }; - return [ - showSettings, - showOption, - generalButton, - osrsButton, - rs3Button, - Options, - toggleOptions, - click_handler, - click_handler_1, - button1_binding, - click_handler_2, - button2_binding, - click_handler_3, - button3_binding, - click_handler_4 - ]; -} -class Settings extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance$4, create_fragment$5, safe_not_equal, { showSettings: 0 }); - } -} -function get_each_context$2(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[1] = list[i]; - return child_ctx; -} -function create_else_block$3(ctx) { - var _a; - let li; - let t0_value = - /*message*/ - ((_a = ctx[1].time) == null ? void 0 : _a.toLocaleTimeString()) + ''; - let t0; - let t1; - let t2_value = - /*message*/ - ctx[1].text + ''; - let t2; - let t3; - return { - c() { - li = element('li'); - t0 = text(t0_value); - t1 = text('\n - '); - t2 = text(t2_value); - t3 = space(); - }, - m(target, anchor) { - insert(target, li, anchor); - append(li, t0); - append(li, t1); - append(li, t2); - append(li, t3); - }, - p(ctx2, dirty) { - var _a2; - if ( - dirty /*$messageList*/ & 1 && - t0_value !== - (t0_value = - /*message*/ - ((_a2 = ctx2[1].time) == null ? void 0 : _a2.toLocaleTimeString()) + '') - ) - set_data(t0, t0_value); - if ( - dirty /*$messageList*/ & 1 && - t2_value !== (t2_value = /*message*/ ctx2[1].text + '') - ) - set_data(t2, t2_value); - }, - d(detaching) { - if (detaching) { - detach(li); - } - } - }; -} -function create_if_block$3(ctx) { - var _a; - let li; - let t0_value = - /*message*/ - ((_a = ctx[1].time) == null ? void 0 : _a.toLocaleTimeString()) + ''; - let t0; - let t1; - let t2_value = - /*message*/ - ctx[1].text + ''; - let t2; - let t3; - return { - c() { - li = element('li'); - t0 = text(t0_value); - t1 = text('\n - '); - t2 = text(t2_value); - t3 = space(); - attr(li, 'class', 'text-rose-500'); - }, - m(target, anchor) { - insert(target, li, anchor); - append(li, t0); - append(li, t1); - append(li, t2); - append(li, t3); - }, - p(ctx2, dirty) { - var _a2; - if ( - dirty /*$messageList*/ & 1 && - t0_value !== - (t0_value = - /*message*/ - ((_a2 = ctx2[1].time) == null ? void 0 : _a2.toLocaleTimeString()) + '') - ) - set_data(t0, t0_value); - if ( - dirty /*$messageList*/ & 1 && - t2_value !== (t2_value = /*message*/ ctx2[1].text + '') - ) - set_data(t2, t2_value); - }, - d(detaching) { - if (detaching) { - detach(li); - } - } - }; -} -function create_each_block$2(ctx) { - let if_block_anchor; - function select_block_type(ctx2, dirty) { - if ( - /*message*/ - ctx2[1].isError - ) - return create_if_block$3; - return create_else_block$3; - } - let current_block_type = select_block_type(ctx); - let if_block = current_block_type(ctx); - return { - c() { - if_block.c(); - if_block_anchor = empty(); - }, - m(target, anchor) { - if_block.m(target, anchor); - insert(target, if_block_anchor, anchor); - }, - p(ctx2, dirty) { - if (current_block_type === (current_block_type = select_block_type(ctx2)) && if_block) { - if_block.p(ctx2, dirty); - } else { - if_block.d(1); - if_block = current_block_type(ctx2); - if (if_block) { - if_block.c(); - if_block.m(if_block_anchor.parentNode, if_block_anchor); - } - } - }, - d(detaching) { - if (detaching) { - detach(if_block_anchor); - } - if_block.d(detaching); - } - }; -} -function create_fragment$4(ctx) { - let div1; - let div0; - let t; - let ol; - let each_value = ensure_array_like( - /*$messageList*/ - ctx[0] - ); - let each_blocks = []; - for (let i = 0; i < each_value.length; i += 1) { - each_blocks[i] = create_each_block$2(get_each_context$2(ctx, each_value, i)); - } - return { - c() { - div1 = element('div'); - div0 = element('div'); - div0.innerHTML = `Message list icon`; - t = space(); - ol = element('ol'); - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - attr(div0, 'class', 'absolute right-2 top-2'); - attr(ol, 'id', 'message_list'); - attr( - ol, - 'class', - 'h-full w-[105%] list-inside list-disc overflow-y-auto pl-5 pt-1 marker:text-blue-500' - ); - attr( - div1, - 'class', - 'fixed bottom-0 h-1/4 w-screen border-t-2 border-t-slate-300 bg-slate-100 duration-200 dark:border-t-slate-800 dark:bg-slate-900' - ); - }, - m(target, anchor) { - insert(target, div1, anchor); - append(div1, div0); - append(div1, t); - append(div1, ol); - for (let i = 0; i < each_blocks.length; i += 1) { - if (each_blocks[i]) { - each_blocks[i].m(ol, null); - } - } - }, - p(ctx2, [dirty]) { - if (dirty /*$messageList*/ & 1) { - each_value = ensure_array_like( - /*$messageList*/ - ctx2[0] - ); - let i; - for (i = 0; i < each_value.length; i += 1) { - const child_ctx = get_each_context$2(ctx2, each_value, i); - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); - } else { - each_blocks[i] = create_each_block$2(child_ctx); - each_blocks[i].c(); - each_blocks[i].m(ol, null); - } - } - for (; i < each_blocks.length; i += 1) { - each_blocks[i].d(1); - } - each_blocks.length = each_value.length; - } - }, - i: noop, - o: noop, - d(detaching) { - if (detaching) { - detach(div1); - } - destroy_each(each_blocks, detaching); - } - }; -} -function instance$3($$self, $$props, $$invalidate) { - let $messageList; - component_subscribe($$self, messageList, ($$value) => - $$invalidate(0, ($messageList = $$value)) - ); - return [$messageList]; -} -class Messages extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance$3, create_fragment$4, safe_not_equal, {}); - } -} -function get_each_context$1(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[13] = list[i]; - return child_ctx; -} -function create_if_block_3$2(ctx) { - let button; - let mounted; - let dispose; - return { - c() { - button = element('button'); - button.textContent = 'Plugin menu'; - button.disabled = !get_store_value(hasBoltPlugins); - attr( - button, - 'class', - 'mx-auto mb-2 w-52 rounded-lg p-2 font-bold text-black duration-200 enabled:bg-blue-500 enabled:hover:opacity-75 disabled:bg-gray-500' - ); - }, - m(target, anchor) { - insert(target, button, anchor); - if (!mounted) { - dispose = listen( - button, - 'click', - /*click_handler*/ - ctx[8] - ); - mounted = true; - } - }, - p: noop, - d(detaching) { - if (detaching) { - detach(button); - } - mounted = false; - dispose(); - } - }; -} -function create_if_block_2$2(ctx) { - let label; - let t1; - let br; - let t2; - let select; - let option0; - let option1; - let mounted; - let dispose; - return { - c() { - label = element('label'); - label.textContent = 'Game Client'; - t1 = space(); - br = element('br'); - t2 = space(); - select = element('select'); - option0 = element('option'); - option0.textContent = 'RuneLite'; - option1 = element('option'); - option1.textContent = 'HDOS'; - attr(label, 'for', 'game_client_select'); - attr(label, 'class', 'text-sm'); - attr(option0, 'data-id', Client.runeLite); - attr(option0, 'class', 'dark:bg-slate-900'); - option0.__value = 'RuneLite'; - set_input_value(option0, option0.__value); - attr(option1, 'data-id', Client.hdos); - attr(option1, 'class', 'dark:bg-slate-900'); - option1.__value = 'HDOS'; - set_input_value(option1, option1.__value); - attr(select, 'id', 'game_client_select'); - attr( - select, - 'class', - 'mx-auto w-52 cursor-pointer rounded-lg border-2 border-slate-300 bg-inherit p-2 text-inherit duration-200 hover:opacity-75 dark:border-slate-800' - ); - }, - m(target, anchor) { - insert(target, label, anchor); - insert(target, t1, anchor); - insert(target, br, anchor); - insert(target, t2, anchor); - insert(target, select, anchor); - append(select, option0); - append(select, option1); - ctx[7](select); - if (!mounted) { - dispose = listen( - select, - 'change', - /*clientChanged*/ - ctx[5] - ); - mounted = true; - } - }, - p: noop, - d(detaching) { - if (detaching) { - detach(label); - detach(t1); - detach(br); - detach(t2); - detach(select); - } - ctx[7](null); - mounted = false; - dispose(); - } - }; -} -function create_if_block$2(ctx) { - let each_1_anchor; - let each_value = ensure_array_like( - /*$selectedPlay*/ - ctx[4].account.characters - ); - let each_blocks = []; - for (let i = 0; i < each_value.length; i += 1) { - each_blocks[i] = create_each_block$1(get_each_context$1(ctx, each_value, i)); - } - return { - c() { - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - each_1_anchor = empty(); - }, - m(target, anchor) { - for (let i = 0; i < each_blocks.length; i += 1) { - if (each_blocks[i]) { - each_blocks[i].m(target, anchor); - } - } - insert(target, each_1_anchor, anchor); - }, - p(ctx2, dirty) { - if (dirty /*$selectedPlay*/ & 16) { - each_value = ensure_array_like( - /*$selectedPlay*/ - ctx2[4].account.characters - ); - let i; - for (i = 0; i < each_value.length; i += 1) { - const child_ctx = get_each_context$1(ctx2, each_value, i); - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); - } else { - each_blocks[i] = create_each_block$1(child_ctx); - each_blocks[i].c(); - each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); - } - } - for (; i < each_blocks.length; i += 1) { - each_blocks[i].d(1); - } - each_blocks.length = each_value.length; - } - }, - d(detaching) { - if (detaching) { - detach(each_1_anchor); - } - destroy_each(each_blocks, detaching); - } - }; -} -function create_else_block$2(ctx) { - let t; - return { - c() { - t = text('New Character'); - }, - m(target, anchor) { - insert(target, t, anchor); - }, - p: noop, - d(detaching) { - if (detaching) { - detach(t); - } - } - }; -} -function create_if_block_1$2(ctx) { - let t_value = - /*character*/ - ctx[13][1].displayName + ''; - let t; - return { - c() { - t = text(t_value); - }, - m(target, anchor) { - insert(target, t, anchor); - }, - p(ctx2, dirty) { - if ( - dirty /*$selectedPlay*/ & 16 && - t_value !== (t_value = /*character*/ ctx2[13][1].displayName + '') - ) - set_data(t, t_value); - }, - d(detaching) { - if (detaching) { - detach(t); - } - } - }; -} -function create_each_block$1(ctx) { - let option; - let t; - let option_data_id_value; - let option_value_value; - function select_block_type_1(ctx2, dirty) { - if ( - /*character*/ - ctx2[13][1].displayName - ) - return create_if_block_1$2; - return create_else_block$2; - } - let current_block_type = select_block_type_1(ctx); - let if_block = current_block_type(ctx); - return { - c() { - option = element('option'); - if_block.c(); - t = space(); - attr(option, 'data-id', (option_data_id_value = /*character*/ ctx[13][1].accountId)); - attr(option, 'class', 'dark:bg-slate-900'); - option.__value = option_value_value = - '\n ' /*character*/ + ctx[13][1].displayName + '\n '; - set_input_value(option, option.__value); - }, - m(target, anchor) { - insert(target, option, anchor); - if_block.m(option, null); - append(option, t); - }, - p(ctx2, dirty) { - if ( - current_block_type === (current_block_type = select_block_type_1(ctx2)) && - if_block - ) { - if_block.p(ctx2, dirty); - } else { - if_block.d(1); - if_block = current_block_type(ctx2); - if (if_block) { - if_block.c(); - if_block.m(option, t); - } - } - if ( - dirty /*$selectedPlay*/ & 16 && - option_data_id_value !== - (option_data_id_value = /*character*/ ctx2[13][1].accountId) - ) { - attr(option, 'data-id', option_data_id_value); - } - if ( - dirty /*$selectedPlay*/ & 16 && - option_value_value !== - (option_value_value = '\n ' /*character*/ + ctx2[13][1].displayName + '\n ') - ) { - option.__value = option_value_value; - set_input_value(option, option.__value); - } - }, - d(detaching) { - if (detaching) { - detach(option); - } - if_block.d(); - } - }; -} -function create_fragment$3(ctx) { - let div2; - let img; - let img_src_value; - let t0; - let button; - let t2; - let div0; - let t3; - let div1; - let label; - let t5; - let br; - let t6; - let select; - let mounted; - let dispose; - function select_block_type(ctx2, dirty) { - if ( - /*$selectedPlay*/ - ctx2[4].game == Game.osrs - ) - return create_if_block_2$2; - if ( - /*$selectedPlay*/ - ctx2[4].game == Game.rs3 - ) - return create_if_block_3$2; - } - let current_block_type = select_block_type(ctx); - let if_block0 = current_block_type && current_block_type(ctx); - let if_block1 = - /*$selectedPlay*/ - ctx[4].account && create_if_block$2(ctx); - return { - c() { - div2 = element('div'); - img = element('img'); - t0 = space(); - button = element('button'); - button.textContent = 'Play'; - t2 = space(); - div0 = element('div'); - if (if_block0) if_block0.c(); - t3 = space(); - div1 = element('div'); - label = element('label'); - label.textContent = 'Character'; - t5 = space(); - br = element('br'); - t6 = space(); - select = element('select'); - if (if_block1) if_block1.c(); - if (!src_url_equal(img.src, (img_src_value = 'svgs/rocket-solid.svg'))) - attr(img, 'src', img_src_value); - attr(img, 'alt', 'Launch icon'); - attr( - img, - 'class', - 'mx-auto mb-5 w-24 rounded-3xl bg-gradient-to-br from-rose-500 to-violet-500 p-5' - ); - attr( - button, - 'class', - 'mx-auto mb-2 w-52 rounded-lg bg-emerald-500 p-2 font-bold text-black duration-200 hover:opacity-75' - ); - attr(div0, 'class', 'mx-auto my-2'); - attr(label, 'for', 'character_select'); - attr(label, 'class', 'text-sm'); - attr(select, 'id', 'character_select'); - attr( - select, - 'class', - 'mx-auto w-52 cursor-pointer rounded-lg border-2 border-slate-300 bg-inherit p-2 text-inherit duration-200 hover:opacity-75 dark:border-slate-800' - ); - attr(div1, 'class', 'mx-auto my-2'); - attr( - div2, - 'class', - 'bg-grad flex h-full flex-col border-slate-300 p-5 duration-200 dark:border-slate-800' - ); - }, - m(target, anchor) { - insert(target, div2, anchor); - append(div2, img); - append(div2, t0); - append(div2, button); - append(div2, t2); - append(div2, div0); - if (if_block0) if_block0.m(div0, null); - append(div2, t3); - append(div2, div1); - append(div1, label); - append(div1, t5); - append(div1, br); - append(div1, t6); - append(div1, select); - if (if_block1) if_block1.m(select, null); - ctx[9](select); - if (!mounted) { - dispose = [ - listen( - button, - 'click', - /*play_clicked*/ - ctx[6] - ), - listen( - select, - 'change', - /*change_handler*/ - ctx[10] - ) - ]; - mounted = true; - } - }, - p(ctx2, [dirty]) { - if ( - current_block_type === (current_block_type = select_block_type(ctx2)) && - if_block0 - ) { - if_block0.p(ctx2, dirty); - } else { - if (if_block0) if_block0.d(1); - if_block0 = current_block_type && current_block_type(ctx2); - if (if_block0) { - if_block0.c(); - if_block0.m(div0, null); - } - } - if ( - /*$selectedPlay*/ - ctx2[4].account - ) { - if (if_block1) { - if_block1.p(ctx2, dirty); - } else { - if_block1 = create_if_block$2(ctx2); - if_block1.c(); - if_block1.m(select, null); - } - } else if (if_block1) { - if_block1.d(1); - if_block1 = null; - } - }, - i: noop, - o: noop, - d(detaching) { - if (detaching) { - detach(div2); - } - if (if_block0) { - if_block0.d(); - } - if (if_block1) if_block1.d(); - ctx[9](null); - mounted = false; - run_all(dispose); - } - }; -} -function instance$2($$self, $$props, $$invalidate) { - let $selectedPlay; - let $config; - let $isConfigDirty; - component_subscribe($$self, selectedPlay, ($$value) => - $$invalidate(4, ($selectedPlay = $$value)) - ); - component_subscribe($$self, config, ($$value) => $$invalidate(11, ($config = $$value))); - component_subscribe($$self, isConfigDirty, ($$value) => - $$invalidate(12, ($isConfigDirty = $$value)) - ); - let { showPluginMenu = false } = $$props; - let characterSelect; - let clientSelect; - function characterChanged() { - var _a, _b; - if (!$selectedPlay.account) return; - const key = characterSelect[characterSelect.selectedIndex].getAttribute('data-id'); - set_store_value( - selectedPlay, - ($selectedPlay.character = $selectedPlay.account.characters.get(key)), - $selectedPlay - ); - if ($selectedPlay.character) { - (_b = $config.selected_characters) == null - ? void 0 - : _b.set( - $selectedPlay.account.userId, - (_a = $selectedPlay.character) == null ? void 0 : _a.accountId - ); - } - set_store_value(isConfigDirty, ($isConfigDirty = true), $isConfigDirty); - } - function clientChanged() { - if (clientSelect.value == 'RuneLite') { - set_store_value(selectedPlay, ($selectedPlay.client = Client.runeLite), $selectedPlay); - set_store_value(config, ($config.selected_client_index = Client.runeLite), $config); - } else if (clientSelect.value == 'HDOS') { - set_store_value(selectedPlay, ($selectedPlay.client = Client.hdos), $selectedPlay); - set_store_value(config, ($config.selected_client_index = Client.hdos), $config); - } - set_store_value(isConfigDirty, ($isConfigDirty = true), $isConfigDirty); - } - function play_clicked() { - var _a, _b, _c, _d, _e, _f, _g, _h, _i; - if (!$selectedPlay.account || !$selectedPlay.character) { - msg('Please log in to launch a client'); - return; - } - switch ($selectedPlay.game) { - case Game.osrs: - if ($selectedPlay.client == Client.runeLite) { - launchRuneLite( - (_a = $selectedPlay.credentials) == null ? void 0 : _a.session_id, - (_b = $selectedPlay.character) == null ? void 0 : _b.accountId, - (_c = $selectedPlay.character) == null ? void 0 : _c.displayName - ); - } else if ($selectedPlay.client == Client.hdos) { - launchHdos( - (_d = $selectedPlay.credentials) == null ? void 0 : _d.session_id, - (_e = $selectedPlay.character) == null ? void 0 : _e.accountId, - (_f = $selectedPlay.character) == null ? void 0 : _f.displayName - ); - } - break; - case Game.rs3: - launchRS3Linux( - (_g = $selectedPlay.credentials) == null ? void 0 : _g.session_id, - (_h = $selectedPlay.character) == null ? void 0 : _h.accountId, - (_i = $selectedPlay.character) == null ? void 0 : _i.displayName - ); - break; - } - } - afterUpdate(() => { - var _a; - if ($selectedPlay.game == Game.osrs && $selectedPlay.client) { - $$invalidate(3, (clientSelect.selectedIndex = $selectedPlay.client), clientSelect); - } - if ( - $selectedPlay.account && - ((_a = $config.selected_characters) == null - ? void 0 - : _a.has($selectedPlay.account.userId)) - ) { - for (let i = 0; i < characterSelect.options.length; i++) { - if ( - characterSelect[i].getAttribute('data-id') == - $config.selected_characters.get($selectedPlay.account.userId) - ) { - $$invalidate(2, (characterSelect.selectedIndex = i), characterSelect); - const key = - characterSelect[characterSelect.selectedIndex].getAttribute('data-id'); - set_store_value( - selectedPlay, - ($selectedPlay.character = $selectedPlay.account.characters.get(key)), - $selectedPlay - ); - } - } - } - }); - onMount(() => { - if ($config.selected_game_index == Game.osrs) { - $$invalidate( - 3, - (clientSelect.selectedIndex = $config.selected_client_index), - clientSelect - ); - set_store_value( - selectedPlay, - ($selectedPlay.client = clientSelect.selectedIndex), - $selectedPlay - ); - } - }); - function select_binding($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - clientSelect = $$value; - $$invalidate(3, clientSelect); - }); - } - const click_handler = () => { - $$invalidate(0, (showPluginMenu = get_store_value(hasBoltPlugins) ?? false)); - }; - function select_binding_1($$value) { - binding_callbacks[$$value ? 'unshift' : 'push'](() => { - characterSelect = $$value; - $$invalidate(2, characterSelect); - }); - } - const change_handler = () => characterChanged(); - $$self.$$set = ($$props2) => { - if ('showPluginMenu' in $$props2) - $$invalidate(0, (showPluginMenu = $$props2.showPluginMenu)); - }; - return [ - showPluginMenu, - characterChanged, - characterSelect, - clientSelect, - $selectedPlay, - clientChanged, - play_clicked, - select_binding, - click_handler, - select_binding_1, - change_handler - ]; -} -class Launch extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance$2, create_fragment$3, safe_not_equal, { - showPluginMenu: 0, - characterChanged: 1 - }); - } - get characterChanged() { - return this.$$.ctx[1]; - } -} -function create_fragment$2(ctx) { - let div; - return { - c() { - div = element('div'); - div.innerHTML = ``; - attr( - div, - 'class', - 'container mx-auto bg-slate-100 p-5 text-center text-slate-900 dark:bg-slate-900 dark:text-slate-50' - ); - }, - m(target, anchor) { - insert(target, div, anchor); - }, - p: noop, - i: noop, - o: noop, - d(detaching) { - if (detaching) { - detach(div); - } - } - }; -} -class Auth extends SvelteComponent { - constructor(options) { - super(); - init(this, options, null, create_fragment$2, safe_not_equal, {}); - } -} -function get_each_context(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[23] = list[i][0]; - child_ctx[22] = list[i][1]; - return child_ctx; -} -function get_each_context_1(ctx, list, i) { - const child_ctx = ctx.slice(); - child_ctx[27] = list[i]; - return child_ctx; -} -function create_catch_block_2(ctx) { - let p; - return { - c() { - p = element('p'); - p.textContent = 'error'; - }, - m(target, anchor) { - insert(target, p, anchor); - }, - p: noop, - d(detaching) { - if (detaching) { - detach(p); - } - } - }; -} -function create_then_block_2(ctx) { - let if_block_anchor; - function select_block_type(ctx2, dirty) { - if ( - /*clients*/ - ctx2[26].length == 0 - ) - return create_if_block_6; - return create_else_block_5; - } - let current_block_type = select_block_type(ctx); - let if_block = current_block_type(ctx); - return { - c() { - if_block.c(); - if_block_anchor = empty(); - }, - m(target, anchor) { - if_block.m(target, anchor); - insert(target, if_block_anchor, anchor); - }, - p(ctx2, dirty) { - if (current_block_type === (current_block_type = select_block_type(ctx2)) && if_block) { - if_block.p(ctx2, dirty); - } else { - if_block.d(1); - if_block = current_block_type(ctx2); - if (if_block) { - if_block.c(); - if_block.m(if_block_anchor.parentNode, if_block_anchor); - } - } - }, - d(detaching) { - if (detaching) { - detach(if_block_anchor); - } - if_block.d(detaching); - } - }; -} -function create_else_block_5(ctx) { - let each_1_anchor; - let each_value_1 = ensure_array_like( - /*clients*/ - ctx[26] - ); - let each_blocks = []; - for (let i = 0; i < each_value_1.length; i += 1) { - each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i)); - } - return { - c() { - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - each_1_anchor = empty(); - }, - m(target, anchor) { - for (let i = 0; i < each_blocks.length; i += 1) { - if (each_blocks[i]) { - each_blocks[i].m(target, anchor); - } - } - insert(target, each_1_anchor, anchor); - }, - p(ctx2, dirty) { - if ( - dirty /*isClientSelected, selectedClientId, $clientListPromise, unnamedClientName*/ & - 22 - ) { - each_value_1 = ensure_array_like( - /*clients*/ - ctx2[26] - ); - let i; - for (i = 0; i < each_value_1.length; i += 1) { - const child_ctx = get_each_context_1(ctx2, each_value_1, i); - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); - } else { - each_blocks[i] = create_each_block_1(child_ctx); - each_blocks[i].c(); - each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor); - } - } - for (; i < each_blocks.length; i += 1) { - each_blocks[i].d(1); - } - each_blocks.length = each_value_1.length; - } - }, - d(detaching) { - if (detaching) { - detach(each_1_anchor); - } - destroy_each(each_blocks, detaching); - } - }; -} -function create_if_block_6(ctx) { - let p; - return { - c() { - p = element('p'); - p.textContent = - '(start an RS3 game client with plugins enabled and it will be listed here.)'; - }, - m(target, anchor) { - insert(target, p, anchor); - }, - p: noop, - d(detaching) { - if (detaching) { - detach(p); - } - } - }; -} -function create_each_block_1(ctx) { - let button; - let t0_value = - /*client*/ - (ctx[27].identity || unnamedClientName) + ''; - let t0; - let button_class_value; - let t1; - let br; - let mounted; - let dispose; - function click_handler_1() { - return ( - /*click_handler_1*/ - ctx[14]( - /*client*/ - ctx[27] - ) - ); - } - return { - c() { - button = element('button'); - t0 = text(t0_value); - t1 = space(); - br = element('br'); - attr( - button, - 'class', - (button_class_value = - 'm-1 h-[28px] w-[95%] rounded-lg border-2 ' /*isClientSelected*/ + - (ctx[4] /*selectedClientId*/ && ctx[1] /*client*/ === ctx[27].uid - ? 'border-black bg-blue-500 text-black' - : 'border-blue-500 text-black dark:text-white') + - ' hover:opacity-75') - ); - }, - m(target, anchor) { - insert(target, button, anchor); - append(button, t0); - insert(target, t1, anchor); - insert(target, br, anchor); - if (!mounted) { - dispose = listen(button, 'click', click_handler_1); - mounted = true; - } - }, - p(new_ctx, dirty) { - ctx = new_ctx; - if ( - dirty /*$clientListPromise*/ & 4 && - t0_value !== (t0_value = /*client*/ (ctx[27].identity || unnamedClientName) + '') - ) - set_data(t0, t0_value); - if ( - dirty /*isClientSelected, selectedClientId, $clientListPromise*/ & 22 && - button_class_value !== - (button_class_value = - 'm-1 h-[28px] w-[95%] rounded-lg border-2 ' /*isClientSelected*/ + - (ctx[4] /*selectedClientId*/ && ctx[1] /*client*/ === ctx[27].uid - ? 'border-black bg-blue-500 text-black' - : 'border-blue-500 text-black dark:text-white') + - ' hover:opacity-75') - ) { - attr(button, 'class', button_class_value); - } - }, - d(detaching) { - if (detaching) { - detach(button); - detach(t1); - detach(br); - } - mounted = false; - dispose(); - } - }; -} -function create_pending_block_2(ctx) { - let p; - return { - c() { - p = element('p'); - p.textContent = 'loading...'; - }, - m(target, anchor) { - insert(target, p, anchor); - }, - p: noop, - d(detaching) { - if (detaching) { - detach(p); - } - } - }; -} -function create_else_block_4(ctx) { - let p; - return { - c() { - p = element('p'); - p.textContent = 'error'; - }, - m(target, anchor) { - insert(target, p, anchor); - }, - p: noop, - d(detaching) { - if (detaching) { - detach(p); - } - } - }; -} -function create_if_block$1(ctx) { - let select; - let t; - let if_block_anchor; - let mounted; - let dispose; - let each_value = ensure_array_like( - Object.entries( - /*$pluginList*/ - ctx[7] - ) - ); - let each_blocks = []; - for (let i = 0; i < each_value.length; i += 1) { - each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); - } - function select_block_type_2(ctx2, dirty) { - if (!(/*isClientSelected*/ ctx2[4])) return create_if_block_1$1; - return create_else_block_1; - } - let current_block_type = select_block_type_2(ctx); - let if_block = current_block_type(ctx); - return { - c() { - select = element('select'); - for (let i = 0; i < each_blocks.length; i += 1) { - each_blocks[i].c(); - } - t = space(); - if_block.c(); - if_block_anchor = empty(); - attr( - select, - 'class', - 'mx-auto mb-4 w-[min(280px,_45%)] cursor-pointer rounded-lg border-2 border-slate-300 bg-inherit p-2 text-inherit duration-200 hover:opacity-75 dark:border-slate-800' - ); - if ( - /*selectedPlugin*/ - ctx[0] === void 0 - ) - add_render_callback(() => - /*select_change_handler*/ - ctx[15].call(select) - ); - }, - m(target, anchor) { - insert(target, select, anchor); - for (let i = 0; i < each_blocks.length; i += 1) { - if (each_blocks[i]) { - each_blocks[i].m(select, null); - } - } - select_option( - select, - /*selectedPlugin*/ - ctx[0], - true - ); - insert(target, t, anchor); - if_block.m(target, anchor); - insert(target, if_block_anchor, anchor); - if (!mounted) { - dispose = listen( - select, - 'change', - /*select_change_handler*/ - ctx[15] - ); - mounted = true; - } - }, - p(ctx2, dirty) { - if (dirty /*Object, $pluginList, unnamedPluginName*/ & 128) { - each_value = ensure_array_like( - Object.entries( - /*$pluginList*/ - ctx2[7] - ) - ); - let i; - for (i = 0; i < each_value.length; i += 1) { - const child_ctx = get_each_context(ctx2, each_value, i); - if (each_blocks[i]) { - each_blocks[i].p(child_ctx, dirty); - } else { - each_blocks[i] = create_each_block(child_ctx); - each_blocks[i].c(); - each_blocks[i].m(select, null); - } - } - for (; i < each_blocks.length; i += 1) { - each_blocks[i].d(1); - } - each_blocks.length = each_value.length; - } - if (dirty /*selectedPlugin, Object, $pluginList*/ & 129) { - select_option( - select, - /*selectedPlugin*/ - ctx2[0] - ); - } - if ( - current_block_type === (current_block_type = select_block_type_2(ctx2)) && - if_block - ) { - if_block.p(ctx2, dirty); - } else { - if_block.d(1); - if_block = current_block_type(ctx2); - if (if_block) { - if_block.c(); - if_block.m(if_block_anchor.parentNode, if_block_anchor); - } - } - }, - d(detaching) { - if (detaching) { - detach(select); - detach(t); - detach(if_block_anchor); - } - destroy_each(each_blocks, detaching); - if_block.d(detaching); - mounted = false; - dispose(); - } - }; -} -function create_each_block(ctx) { - let option; - let t_value = - /*plugin*/ - (ctx[22].name ?? unnamedPluginName) + ''; - let t; - let option_value_value; - return { - c() { - option = element('option'); - t = text(t_value); - attr(option, 'class', 'dark:bg-slate-900'); - option.__value = option_value_value = /*id*/ ctx[23]; - set_input_value(option, option.__value); - }, - m(target, anchor) { - insert(target, option, anchor); - append(option, t); - }, - p(ctx2, dirty) { - if ( - dirty /*$pluginList*/ & 128 && - t_value !== (t_value = /*plugin*/ (ctx2[22].name ?? unnamedPluginName) + '') - ) - set_data(t, t_value); - if ( - dirty /*$pluginList*/ & 128 && - option_value_value !== (option_value_value = /*id*/ ctx2[23]) - ) { - option.__value = option_value_value; - set_input_value(option, option.__value); - } - }, - d(detaching) { - if (detaching) { - detach(option); - } - } - }; -} -function create_else_block_1(ctx) { - let br; - let t; - let await_block_anchor; - let promise; - let info = { - ctx, - current: null, - token: null, - hasCatch: true, - pending: create_pending_block_1, - then: create_then_block_1, - catch: create_catch_block_1, - value: 22 - }; - handle_promise((promise = /*managementPluginPromise*/ ctx[6]), info); - return { - c() { - br = element('br'); - t = space(); - await_block_anchor = empty(); - info.block.c(); - }, - m(target, anchor) { - insert(target, br, anchor); - insert(target, t, anchor); - insert(target, await_block_anchor, anchor); - info.block.m(target, (info.anchor = anchor)); - info.mount = () => await_block_anchor.parentNode; - info.anchor = await_block_anchor; - }, - p(new_ctx, dirty) { - ctx = new_ctx; - info.ctx = ctx; - if ( - dirty /*managementPluginPromise*/ & 64 && - promise !== (promise = /*managementPluginPromise*/ ctx[6]) && - handle_promise(promise, info) - ); - else { - update_await_block_branch(info, ctx, dirty); - } - }, - d(detaching) { - if (detaching) { - detach(br); - detach(t); - detach(await_block_anchor); - } - info.block.d(detaching); - info.token = null; - info = null; - } - }; -} -function create_if_block_1$1(ctx) { - let button; - let t0; - let t1; - let br; - let t2; - let show_if; - let if_block_anchor; - let mounted; - let dispose; - function select_block_type_3(ctx2, dirty) { - if (dirty /*$pluginList*/ & 128) show_if = null; - if (show_if == null) - show_if = !!( - Object.entries( - /*$pluginList*/ - ctx2[7] - ).length !== 0 - ); - if (show_if) return create_if_block_2$1; - return create_else_block$1; - } - let current_block_type = select_block_type_3(ctx, -1); - let if_block = current_block_type(ctx); - return { - c() { - button = element('button'); - t0 = text('+'); - t1 = space(); - br = element('br'); - t2 = space(); - if_block.c(); - if_block_anchor = empty(); - attr( - button, - 'class', - 'aspect-square w-8 rounded-lg border-2 border-blue-500 text-[20px] font-bold duration-200 enabled:hover:opacity-75 disabled:border-gray-500' - ); - button.disabled = /*disableButtons*/ ctx[3]; - }, - m(target, anchor) { - insert(target, button, anchor); - append(button, t0); - insert(target, t1, anchor); - insert(target, br, anchor); - insert(target, t2, anchor); - if_block.m(target, anchor); - insert(target, if_block_anchor, anchor); - if (!mounted) { - dispose = listen( - button, - 'click', - /*jsonFilePicker*/ - ctx[9] - ); - mounted = true; - } - }, - p(ctx2, dirty) { - if (dirty /*disableButtons*/ & 8) { - button.disabled = /*disableButtons*/ ctx2[3]; - } - if ( - current_block_type === (current_block_type = select_block_type_3(ctx2, dirty)) && - if_block - ) { - if_block.p(ctx2, dirty); - } else { - if_block.d(1); - if_block = current_block_type(ctx2); - if (if_block) { - if_block.c(); - if_block.m(if_block_anchor.parentNode, if_block_anchor); - } - } - }, - d(detaching) { - if (detaching) { - detach(button); - detach(t1); - detach(br); - detach(t2); - detach(if_block_anchor); - } - if_block.d(detaching); - mounted = false; - dispose(); - } - }; -} -function create_catch_block_1(ctx) { - let p; - return { - c() { - p = element('p'); - p.textContent = 'error'; - }, - m(target, anchor) { - insert(target, p, anchor); - }, - p: noop, - d(detaching) { - if (detaching) { - detach(p); - } - } - }; -} -function create_then_block_1(ctx) { - let show_if; - let if_block_anchor; - function select_block_type_4(ctx2, dirty) { - if (dirty /*managementPluginPromise, $pluginList, selectedPlugin*/ & 193) show_if = null; - if (show_if == null) - show_if = !!( - /*plugin*/ - ( - ctx2[22] /*plugin*/ && - ctx2[22].main && - Object.keys( - /*$pluginList*/ - ctx2[7] - ).includes( - /*selectedPlugin*/ - ctx2[0] - ) - ) - ); - if (show_if) return create_if_block_4; - return create_else_block_3; - } - let current_block_type = select_block_type_4(ctx, -1); - let if_block = current_block_type(ctx); - return { - c() { - if_block.c(); - if_block_anchor = empty(); - }, - m(target, anchor) { - if_block.m(target, anchor); - insert(target, if_block_anchor, anchor); - }, - p(ctx2, dirty) { - if ( - current_block_type === (current_block_type = select_block_type_4(ctx2, dirty)) && - if_block - ) { - if_block.p(ctx2, dirty); - } else { - if_block.d(1); - if_block = current_block_type(ctx2); - if (if_block) { - if_block.c(); - if_block.m(if_block_anchor.parentNode, if_block_anchor); - } - } - }, - d(detaching) { - if (detaching) { - detach(if_block_anchor); - } - if_block.d(detaching); - } - }; -} -function create_else_block_3(ctx) { - let p; - return { - c() { - p = element('p'); - p.textContent = "can't start plugin: does not appear to be configured"; - }, - m(target, anchor) { - insert(target, p, anchor); - }, - p: noop, - d(detaching) { - if (detaching) { - detach(p); - } - } - }; -} -function create_if_block_4(ctx) { - let if_block_anchor; - function select_block_type_5(ctx2, dirty) { - if ( - /*$pluginList*/ - ctx2[7][ - /*selectedPlugin*/ - ctx2[0] - ].path - ) - return create_if_block_5; - return create_else_block_2; - } - let current_block_type = select_block_type_5(ctx); - let if_block = current_block_type(ctx); - return { - c() { - if_block.c(); - if_block_anchor = empty(); - }, - m(target, anchor) { - if_block.m(target, anchor); - insert(target, if_block_anchor, anchor); - }, - p(ctx2, dirty) { - if ( - current_block_type === (current_block_type = select_block_type_5(ctx2)) && - if_block - ) { - if_block.p(ctx2, dirty); - } else { - if_block.d(1); - if_block = current_block_type(ctx2); - if (if_block) { - if_block.c(); - if_block.m(if_block_anchor.parentNode, if_block_anchor); - } - } - }, - d(detaching) { - if (detaching) { - detach(if_block_anchor); - } - if_block.d(detaching); - } - }; -} -function create_else_block_2(ctx) { - let p; - return { - c() { - p = element('p'); - p.textContent = "can't start plugin: no path is configured"; - }, - m(target, anchor) { - insert(target, p, anchor); - }, - p: noop, - d(detaching) { - if (detaching) { - detach(p); - } - } - }; -} -function create_if_block_5(ctx) { - let button; - let t0; - let t1_value = - /*plugin*/ - ctx[22].name + ''; - let t1; - let mounted; - let dispose; - function click_handler_4() { - return ( - /*click_handler_4*/ - ctx[18]( - /*plugin*/ - ctx[22] - ) - ); - } - return { - c() { - button = element('button'); - t0 = text('Start '); - t1 = text(t1_value); - attr( - button, - 'class', - 'mx-auto mb-1 w-auto rounded-lg bg-emerald-500 p-2 font-bold text-black duration-200 hover:opacity-75' - ); - }, - m(target, anchor) { - insert(target, button, anchor); - append(button, t0); - append(button, t1); - if (!mounted) { - dispose = listen(button, 'click', click_handler_4); - mounted = true; - } - }, - p(new_ctx, dirty) { - ctx = new_ctx; - if ( - dirty /*managementPluginPromise*/ & 64 && - t1_value !== (t1_value = /*plugin*/ ctx[22].name + '') - ) - set_data(t1, t1_value); - }, - d(detaching) { - if (detaching) { - detach(button); - } - mounted = false; - dispose(); - } - }; -} -function create_pending_block_1(ctx) { - let p; - return { - c() { - p = element('p'); - p.textContent = 'loading...'; - }, - m(target, anchor) { - insert(target, p, anchor); - }, - p: noop, - d(detaching) { - if (detaching) { - detach(p); - } - } - }; -} -function create_else_block$1(ctx) { - let p; - return { - c() { - p = element('p'); - p.textContent = - "You have no plugins installed. Click the + button and select a plugin's\n bolt.json file to add it."; - }, - m(target, anchor) { - insert(target, p, anchor); - }, - p: noop, - d(detaching) { - if (detaching) { - detach(p); - } - } - }; -} -function create_if_block_2$1(ctx) { - let show_if = - Object.keys(get_store_value(pluginList)).includes( - /*selectedPlugin*/ - ctx[0] - ) /*managementPluginPromise*/ && ctx[6] !== null; - let if_block_anchor; - let if_block = show_if && create_if_block_3$1(ctx); - return { - c() { - if (if_block) if_block.c(); - if_block_anchor = empty(); - }, - m(target, anchor) { - if (if_block) if_block.m(target, anchor); - insert(target, if_block_anchor, anchor); - }, - p(ctx2, dirty) { - if (dirty /*selectedPlugin, managementPluginPromise*/ & 65) - show_if = - Object.keys(get_store_value(pluginList)).includes( - /*selectedPlugin*/ - ctx2[0] - ) /*managementPluginPromise*/ && ctx2[6] !== null; - if (show_if) { - if (if_block) { - if_block.p(ctx2, dirty); - } else { - if_block = create_if_block_3$1(ctx2); - if_block.c(); - if_block.m(if_block_anchor.parentNode, if_block_anchor); - } - } else if (if_block) { - if_block.d(1); - if_block = null; - } - }, - d(detaching) { - if (detaching) { - detach(if_block_anchor); - } - if (if_block) if_block.d(detaching); - } - }; -} -function create_if_block_3$1(ctx) { - let promise; - let t0; - let button0; - let t2; - let button1; - let mounted; - let dispose; - let info = { - ctx, - current: null, - token: null, - hasCatch: true, - pending: create_pending_block, - then: create_then_block, - catch: create_catch_block, - value: 22 - }; - handle_promise((promise = /*managementPluginPromise*/ ctx[6]), info); - return { - c() { - info.block.c(); - t0 = space(); - button0 = element('button'); - button0.textContent = 'Remove'; - t2 = space(); - button1 = element('button'); - button1.textContent = 'Reload'; - attr( - button0, - 'class', - 'mx-auto mb-1 w-[min(144px,_25%)] rounded-lg p-2 font-bold text-black duration-200 enabled:bg-rose-500 enabled:hover:opacity-75 disabled:bg-gray-500' - ); - attr( - button1, - 'class', - 'mx-auto mb-1 w-[min(144px,_25%)] rounded-lg p-2 font-bold text-black duration-200 enabled:bg-blue-500 enabled:hover:opacity-75 disabled:bg-gray-500' - ); - }, - m(target, anchor) { - info.block.m(target, (info.anchor = anchor)); - info.mount = () => t0.parentNode; - info.anchor = t0; - insert(target, t0, anchor); - insert(target, button0, anchor); - insert(target, t2, anchor); - insert(target, button1, anchor); - if (!mounted) { - dispose = [ - listen( - button0, - 'click', - /*click_handler_2*/ - ctx[16] - ), - listen( - button1, - 'click', - /*click_handler_3*/ - ctx[17] - ) - ]; - mounted = true; - } - }, - p(new_ctx, dirty) { - ctx = new_ctx; - info.ctx = ctx; - if ( - dirty /*managementPluginPromise*/ & 64 && - promise !== (promise = /*managementPluginPromise*/ ctx[6]) && - handle_promise(promise, info) - ); - else { - update_await_block_branch(info, ctx, dirty); - } - }, - d(detaching) { - if (detaching) { - detach(t0); - detach(button0); - detach(t2); - detach(button1); - } - info.block.d(detaching); - info.token = null; - info = null; - mounted = false; - run_all(dispose); - } - }; -} -function create_catch_block(ctx) { - let p; - let t1; - let br; - return { - c() { - p = element('p'); - p.textContent = 'error'; - t1 = space(); - br = element('br'); - }, - m(target, anchor) { - insert(target, p, anchor); - insert(target, t1, anchor); - insert(target, br, anchor); - }, - p: noop, - d(detaching) { - if (detaching) { - detach(p); - detach(t1); - detach(br); - } - } - }; -} -function create_then_block(ctx) { - let p0; - let t0_value = - /*plugin*/ - (ctx[22].name ?? unnamedPluginName) + ''; - let t0; - let t1; - let p1; - let t2_value = - /*plugin*/ - (ctx[22].description ?? 'no description') + ''; - let t2; - let p1_class_value; - let t3; - let br; - return { - c() { - p0 = element('p'); - t0 = text(t0_value); - t1 = space(); - p1 = element('p'); - t2 = text(t2_value); - t3 = space(); - br = element('br'); - attr(p0, 'class', 'pb-4 text-xl font-bold'); - attr(p1, 'class', (p1_class_value = /*plugin*/ ctx[22].description ? null : 'italic')); - }, - m(target, anchor) { - insert(target, p0, anchor); - append(p0, t0); - insert(target, t1, anchor); - insert(target, p1, anchor); - append(p1, t2); - insert(target, t3, anchor); - insert(target, br, anchor); - }, - p(ctx2, dirty) { - if ( - dirty /*managementPluginPromise*/ & 64 && - t0_value !== (t0_value = /*plugin*/ (ctx2[22].name ?? unnamedPluginName) + '') - ) - set_data(t0, t0_value); - if ( - dirty /*managementPluginPromise*/ & 64 && - t2_value !== (t2_value = /*plugin*/ (ctx2[22].description ?? 'no description') + '') - ) - set_data(t2, t2_value); - if ( - dirty /*managementPluginPromise*/ & 64 && - p1_class_value !== - (p1_class_value = /*plugin*/ ctx2[22].description ? null : 'italic') - ) { - attr(p1, 'class', p1_class_value); - } - }, - d(detaching) { - if (detaching) { - detach(p0); - detach(t1); - detach(p1); - detach(t3); - detach(br); - } - } - }; -} -function create_pending_block(ctx) { - let p; - return { - c() { - p = element('p'); - p.textContent = 'loading...'; - }, - m(target, anchor) { - insert(target, p, anchor); - }, - p: noop, - d(detaching) { - if (detaching) { - detach(p); - } - } - }; -} -function create_fragment$1(ctx) { - let div3; - let backdrop; - let t0; - let div2; - let button0; - let t1; - let div0; - let button1; - let t2; - let button1_class_value; - let t3; - let hr; - let t4; - let promise; - let t5; - let div1; - let current; - let mounted; - let dispose; - backdrop = new Backdrop({}); - backdrop.$on( - 'click', - /*tryExit*/ - ctx[11] - ); - let info = { - ctx, - current: null, - token: null, - hasCatch: true, - pending: create_pending_block_2, - then: create_then_block_2, - catch: create_catch_block_2, - value: 26 - }; - handle_promise((promise = /*$clientListPromise*/ ctx[2]), info); - function select_block_type_1(ctx2, dirty) { - if (hasBoltPlugins) return create_if_block$1; - return create_else_block_4; - } - let current_block_type = select_block_type_1(); - let if_block = current_block_type(ctx); - return { - c() { - div3 = element('div'); - create_component(backdrop.$$.fragment); - t0 = space(); - div2 = element('div'); - button0 = element('button'); - button0.innerHTML = `Close`; - t1 = space(); - div0 = element('div'); - button1 = element('button'); - t2 = text('Manage Plugins'); - t3 = space(); - hr = element('hr'); - t4 = space(); - info.block.c(); - t5 = space(); - div1 = element('div'); - if_block.c(); - attr( - button0, - 'class', - 'absolute right-3 top-3 rounded-full bg-rose-500 p-[2px] shadow-lg duration-200 hover:rotate-90 hover:opacity-75' - ); - attr( - button1, - 'class', - (button1_class_value = - 'mx-auto mb-2 w-[95%] rounded-lg border-2 ' /*isClientSelected*/ + - (ctx[4] - ? 'border-blue-500 text-black dark:text-white' - : 'border-black bg-blue-500 text-black') + - ' p-2 font-bold hover:opacity-75') - ); - attr(hr, 'class', 'p-1 dark:border-slate-700'); - attr( - div0, - 'class', - 'left-0 float-left h-full w-[min(180px,_50%)] overflow-hidden border-r-2 border-slate-300 pt-2 dark:border-slate-800' - ); - attr(div1, 'class', 'h-full pt-10'); - attr( - div2, - 'class', - 'absolute left-[5%] top-[5%] z-20 h-[90%] w-[90%] rounded-lg bg-slate-100 text-center shadow-lg dark:bg-slate-900' - ); - }, - m(target, anchor) { - insert(target, div3, anchor); - mount_component(backdrop, div3, null); - append(div3, t0); - append(div3, div2); - append(div2, button0); - append(div2, t1); - append(div2, div0); - append(div0, button1); - append(button1, t2); - append(div0, t3); - append(div0, hr); - append(div0, t4); - info.block.m(div0, (info.anchor = null)); - info.mount = () => div0; - info.anchor = null; - append(div2, t5); - append(div2, div1); - if_block.m(div1, null); - current = true; - if (!mounted) { - dispose = [ - listen( - button0, - 'click', - /*tryExit*/ - ctx[11] - ), - listen( - button1, - 'click', - /*click_handler*/ - ctx[13] - ) - ]; - mounted = true; - } - }, - p(new_ctx, [dirty]) { - ctx = new_ctx; - if ( - !current || - (dirty /*isClientSelected*/ & 16 && - button1_class_value !== - (button1_class_value = - 'mx-auto mb-2 w-[95%] rounded-lg border-2 ' /*isClientSelected*/ + - (ctx[4] - ? 'border-blue-500 text-black dark:text-white' - : 'border-black bg-blue-500 text-black') + - ' p-2 font-bold hover:opacity-75')) - ) { - attr(button1, 'class', button1_class_value); - } - info.ctx = ctx; - if ( - dirty /*$clientListPromise*/ & 4 && - promise !== (promise = /*$clientListPromise*/ ctx[2]) && - handle_promise(promise, info) - ); - else { - update_await_block_branch(info, ctx, dirty); - } - if_block.p(ctx, dirty); - }, - i(local) { - if (current) return; - transition_in(backdrop.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(backdrop.$$.fragment, local); - current = false; - }, - d(detaching) { - if (detaching) { - detach(div3); - } - destroy_component(backdrop); - info.block.d(); - info.token = null; - info = null; - if_block.d(); - mounted = false; - run_all(dispose); - } - }; -} -const unnamedPluginName = '(unnamed)'; -const unnamedClientName = '(new character)'; -function instance$1($$self, $$props, $$invalidate) { - let managementPluginPromise; - let $clientListPromise; - let $pluginList; - component_subscribe($$self, clientListPromise, ($$value) => - $$invalidate(2, ($clientListPromise = $$value)) - ); - component_subscribe($$self, pluginList, ($$value) => $$invalidate(7, ($pluginList = $$value))); - let { showPluginMenu } = $$props; - const getPluginConfigPromise = (dirpath) => { - return new Promise((resolve, reject) => { - const path = dirpath.concat(dirpath.endsWith('/') ? 'bolt.json' : '/bolt.json'); - var xml = new XMLHttpRequest(); - xml.onreadystatechange = () => { - if (xml.readyState == 4) { - if (xml.status == 200) { - resolve(JSON.parse(xml.responseText)); - } else { - reject(xml.responseText); - } - } - }; - xml.open( - 'GET', - '/read-json-file?'.concat(new URLSearchParams({ path }).toString()), - true - ); - xml.send(); - }); - }; - const getPluginConfigPromiseFromID = (id) => { - const list = get_store_value(pluginList); - const meta = list[id]; - if (!meta) return null; - const path = meta.path; - return path ? getPluginConfigPromise(path) : null; - }; - const handleNewPlugin = (folderPath, configPath) => { - getPluginConfigPromise(folderPath) - .then((plugin) => { - do { - $$invalidate(0, (selectedPlugin = crypto.randomUUID())); - } while (Object.keys(get_store_value(pluginList)).includes(selectedPlugin)); - set_store_value( - pluginList, - ($pluginList[selectedPlugin] = { - name: plugin.name ?? unnamedPluginName, - path: folderPath - }), - $pluginList - ); - $$invalidate(5, (pluginConfigDirty = true)); - }) - .catch((reason) => { - console.error(`Config file '${configPath}' couldn't be fetched, reason: ${reason}`); - }); - }; - let disableButtons = false; - const jsonFilePicker = () => { - $$invalidate(3, (disableButtons = true)); - var xml = new XMLHttpRequest(); - xml.onreadystatechange = () => { - if (xml.readyState == 4) { - $$invalidate(3, (disableButtons = false)); - if (xml.status == 200) { - const path = - get_store_value(platform) === 'windows' - ? xml.responseText.replaceAll('\\', '/') - : xml.responseText; - if (path.endsWith('/bolt.json')) { - const subpath = path.substring(0, path.length - 9); - handleNewPlugin(subpath, path); - } else { - console.log(`Selection '${path}' is not named bolt.json; ignored`); - } - } - } - }; - xml.open('GET', '/json-file-picker', true); - xml.send(); - }; - clientListPromise.set(getNewClientListPromise()); - const startPlugin = (client, id, path, main) => { - var xml = new XMLHttpRequest(); - xml.onreadystatechange = () => { - if (xml.readyState == 4) { - msg(`Start-plugin status: ${xml.statusText.trim()}`); - } - }; - xml.open( - 'GET', - '/start-plugin?'.concat(new URLSearchParams({ client, id, path, main }).toString()), - true - ); - xml.send(); - }; - const tryExit = () => { - if (!disableButtons) { - $$invalidate(12, (showPluginMenu = false)); - } - }; - function keyPressed(evt) { - if (evt.key === 'Escape') { - tryExit(); - } - } - addEventListener('keydown', keyPressed); - var selectedPlugin; - var isClientSelected = false; - var selectedClientId; - let pluginConfigDirty = false; - onDestroy(() => { - if (pluginConfigDirty) savePluginConfig(); - removeEventListener('keydown', keyPressed); - }); - const click_handler = () => $$invalidate(4, (isClientSelected = false)); - const click_handler_1 = (client) => { - $$invalidate(1, (selectedClientId = client.uid)); - $$invalidate(4, (isClientSelected = true)); - }; - function select_change_handler() { - selectedPlugin = select_value(this); - $$invalidate(0, selectedPlugin); - } - const click_handler_2 = () => { - $$invalidate(6, (managementPluginPromise = null)); - $$invalidate(5, (pluginConfigDirty = true)); - let list = get_store_value(pluginList); - delete list[selectedPlugin]; - pluginList.set(list); - }; - const click_handler_3 = () => - $$invalidate(6, (managementPluginPromise = getPluginConfigPromiseFromID(selectedPlugin))); - const click_handler_4 = (plugin) => - startPlugin( - selectedClientId, - selectedPlugin, - $pluginList[selectedPlugin].path ?? '', - plugin.main ?? '' - ); - $$self.$$set = ($$props2) => { - if ('showPluginMenu' in $$props2) - $$invalidate(12, (showPluginMenu = $$props2.showPluginMenu)); - }; - $$self.$$.update = () => { - if ($$self.$$.dirty /*$clientListPromise, selectedClientId*/ & 6) { - $clientListPromise.then((x) => { - if (!x.some((x2) => x2.uid === selectedClientId)) { - $$invalidate(4, (isClientSelected = false)); - } - }); - } - if ($$self.$$.dirty /*selectedPlugin*/ & 1) { - $$invalidate( - 6, - (managementPluginPromise = getPluginConfigPromiseFromID(selectedPlugin)) - ); - } - }; - return [ - selectedPlugin, - selectedClientId, - $clientListPromise, - disableButtons, - isClientSelected, - pluginConfigDirty, - managementPluginPromise, - $pluginList, - getPluginConfigPromiseFromID, - jsonFilePicker, - startPlugin, - tryExit, - showPluginMenu, - click_handler, - click_handler_1, - select_change_handler, - click_handler_2, - click_handler_3, - click_handler_4 - ]; -} -class PluginMenu extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance$1, create_fragment$1, safe_not_equal, { showPluginMenu: 12 }); - } -} -function create_else_block(ctx) { - let t0; - let t1; - let t2; - let topbar; - let updating_showSettings; - let t3; - let div2; - let div0; - let t4; - let launch; - let updating_showPluginMenu; - let t5; - let div1; - let t6; - let messages; - let current; - let if_block0 = - /*showPluginMenu*/ - ctx[1] && create_if_block_3(ctx); - let if_block1 = - /*showSettings*/ - ctx[0] && create_if_block_2(ctx); - let if_block2 = - /*$showDisclaimer*/ - ctx[3] && create_if_block_1(); - function topbar_showSettings_binding(value) { - ctx[6](value); - } - let topbar_props = {}; - if ( - /*showSettings*/ - ctx[0] !== void 0 - ) { - topbar_props.showSettings = /*showSettings*/ ctx[0]; - } - topbar = new TopBar({ props: topbar_props }); - binding_callbacks.push(() => bind(topbar, 'showSettings', topbar_showSettings_binding)); - function launch_showPluginMenu_binding(value) { - ctx[7](value); - } - let launch_props = {}; - if ( - /*showPluginMenu*/ - ctx[1] !== void 0 - ) { - launch_props.showPluginMenu = /*showPluginMenu*/ ctx[1]; - } - launch = new Launch({ props: launch_props }); - binding_callbacks.push(() => bind(launch, 'showPluginMenu', launch_showPluginMenu_binding)); - messages = new Messages({}); - return { - c() { - if (if_block0) if_block0.c(); - t0 = space(); - if (if_block1) if_block1.c(); - t1 = space(); - if (if_block2) if_block2.c(); - t2 = space(); - create_component(topbar.$$.fragment); - t3 = space(); - div2 = element('div'); - div0 = element('div'); - t4 = space(); - create_component(launch.$$.fragment); - t5 = space(); - div1 = element('div'); - t6 = space(); - create_component(messages.$$.fragment); - attr(div2, 'class', 'mt-16 grid h-full grid-flow-col grid-cols-3'); - }, - m(target, anchor) { - if (if_block0) if_block0.m(target, anchor); - insert(target, t0, anchor); - if (if_block1) if_block1.m(target, anchor); - insert(target, t1, anchor); - if (if_block2) if_block2.m(target, anchor); - insert(target, t2, anchor); - mount_component(topbar, target, anchor); - insert(target, t3, anchor); - insert(target, div2, anchor); - append(div2, div0); - append(div2, t4); - mount_component(launch, div2, null); - append(div2, t5); - append(div2, div1); - insert(target, t6, anchor); - mount_component(messages, target, anchor); - current = true; - }, - p(ctx2, dirty) { - if ( - /*showPluginMenu*/ - ctx2[1] - ) { - if (if_block0) { - if_block0.p(ctx2, dirty); - if (dirty /*showPluginMenu*/ & 2) { - transition_in(if_block0, 1); - } - } else { - if_block0 = create_if_block_3(ctx2); - if_block0.c(); - transition_in(if_block0, 1); - if_block0.m(t0.parentNode, t0); - } - } else if (if_block0) { - group_outros(); - transition_out(if_block0, 1, 1, () => { - if_block0 = null; - }); - check_outros(); - } - if ( - /*showSettings*/ - ctx2[0] - ) { - if (if_block1) { - if_block1.p(ctx2, dirty); - if (dirty /*showSettings*/ & 1) { - transition_in(if_block1, 1); - } - } else { - if_block1 = create_if_block_2(ctx2); - if_block1.c(); - transition_in(if_block1, 1); - if_block1.m(t1.parentNode, t1); - } - } else if (if_block1) { - group_outros(); - transition_out(if_block1, 1, 1, () => { - if_block1 = null; - }); - check_outros(); - } - if ( - /*$showDisclaimer*/ - ctx2[3] - ) { - if (if_block2) { - if (dirty /*$showDisclaimer*/ & 8) { - transition_in(if_block2, 1); - } - } else { - if_block2 = create_if_block_1(); - if_block2.c(); - transition_in(if_block2, 1); - if_block2.m(t2.parentNode, t2); - } - } else if (if_block2) { - group_outros(); - transition_out(if_block2, 1, 1, () => { - if_block2 = null; - }); - check_outros(); - } - const topbar_changes = {}; - if (!updating_showSettings && dirty /*showSettings*/ & 1) { - updating_showSettings = true; - topbar_changes.showSettings = /*showSettings*/ ctx2[0]; - add_flush_callback(() => (updating_showSettings = false)); - } - topbar.$set(topbar_changes); - const launch_changes = {}; - if (!updating_showPluginMenu && dirty /*showPluginMenu*/ & 2) { - updating_showPluginMenu = true; - launch_changes.showPluginMenu = /*showPluginMenu*/ ctx2[1]; - add_flush_callback(() => (updating_showPluginMenu = false)); - } - launch.$set(launch_changes); - }, - i(local) { - if (current) return; - transition_in(if_block0); - transition_in(if_block1); - transition_in(if_block2); - transition_in(topbar.$$.fragment, local); - transition_in(launch.$$.fragment, local); - transition_in(messages.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(if_block0); - transition_out(if_block1); - transition_out(if_block2); - transition_out(topbar.$$.fragment, local); - transition_out(launch.$$.fragment, local); - transition_out(messages.$$.fragment, local); - current = false; - }, - d(detaching) { - if (detaching) { - detach(t0); - detach(t1); - detach(t2); - detach(t3); - detach(div2); - detach(t6); - } - if (if_block0) if_block0.d(detaching); - if (if_block1) if_block1.d(detaching); - if (if_block2) if_block2.d(detaching); - destroy_component(topbar, detaching); - destroy_component(launch); - destroy_component(messages, detaching); - } - }; -} -function create_if_block(ctx) { - let auth; - let current; - auth = new Auth({}); - return { - c() { - create_component(auth.$$.fragment); - }, - m(target, anchor) { - mount_component(auth, target, anchor); - current = true; - }, - p: noop, - i(local) { - if (current) return; - transition_in(auth.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(auth.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(auth, detaching); - } - }; -} -function create_if_block_3(ctx) { - let pluginmenu; - let updating_showPluginMenu; - let current; - function pluginmenu_showPluginMenu_binding(value) { - ctx[4](value); - } - let pluginmenu_props = {}; - if ( - /*showPluginMenu*/ - ctx[1] !== void 0 - ) { - pluginmenu_props.showPluginMenu = /*showPluginMenu*/ ctx[1]; - } - pluginmenu = new PluginMenu({ props: pluginmenu_props }); - binding_callbacks.push(() => - bind(pluginmenu, 'showPluginMenu', pluginmenu_showPluginMenu_binding) - ); - return { - c() { - create_component(pluginmenu.$$.fragment); - }, - m(target, anchor) { - mount_component(pluginmenu, target, anchor); - current = true; - }, - p(ctx2, dirty) { - const pluginmenu_changes = {}; - if (!updating_showPluginMenu && dirty /*showPluginMenu*/ & 2) { - updating_showPluginMenu = true; - pluginmenu_changes.showPluginMenu = /*showPluginMenu*/ ctx2[1]; - add_flush_callback(() => (updating_showPluginMenu = false)); - } - pluginmenu.$set(pluginmenu_changes); - }, - i(local) { - if (current) return; - transition_in(pluginmenu.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(pluginmenu.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(pluginmenu, detaching); - } - }; -} -function create_if_block_2(ctx) { - let settings; - let updating_showSettings; - let current; - function settings_showSettings_binding(value) { - ctx[5](value); - } - let settings_props = {}; - if ( - /*showSettings*/ - ctx[0] !== void 0 - ) { - settings_props.showSettings = /*showSettings*/ ctx[0]; - } - settings = new Settings({ props: settings_props }); - binding_callbacks.push(() => bind(settings, 'showSettings', settings_showSettings_binding)); - return { - c() { - create_component(settings.$$.fragment); - }, - m(target, anchor) { - mount_component(settings, target, anchor); - current = true; - }, - p(ctx2, dirty) { - const settings_changes = {}; - if (!updating_showSettings && dirty /*showSettings*/ & 1) { - updating_showSettings = true; - settings_changes.showSettings = /*showSettings*/ ctx2[0]; - add_flush_callback(() => (updating_showSettings = false)); - } - settings.$set(settings_changes); - }, - i(local) { - if (current) return; - transition_in(settings.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(settings.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(settings, detaching); - } - }; -} -function create_if_block_1(ctx) { - let disclaimer; - let current; - disclaimer = new Disclaimer({}); - return { - c() { - create_component(disclaimer.$$.fragment); - }, - m(target, anchor) { - mount_component(disclaimer, target, anchor); - current = true; - }, - i(local) { - if (current) return; - transition_in(disclaimer.$$.fragment, local); - current = true; - }, - o(local) { - transition_out(disclaimer.$$.fragment, local); - current = false; - }, - d(detaching) { - destroy_component(disclaimer, detaching); - } - }; -} -function create_fragment(ctx) { - let main; - let current_block_type_index; - let if_block; - let current; - const if_block_creators = [create_if_block, create_else_block]; - const if_blocks = []; - function select_block_type(ctx2, dirty) { - if ( - /*authorizing*/ - ctx2[2] - ) - return 0; - return 1; - } - current_block_type_index = select_block_type(ctx); - if_block = if_blocks[current_block_type_index] = - if_block_creators[current_block_type_index](ctx); - return { - c() { - main = element('main'); - if_block.c(); - attr(main, 'class', 'h-full'); - }, - m(target, anchor) { - insert(target, main, anchor); - if_blocks[current_block_type_index].m(main, null); - current = true; - }, - p(ctx2, [dirty]) { - let previous_block_index = current_block_type_index; - current_block_type_index = select_block_type(ctx2); - if (current_block_type_index === previous_block_index) { - if_blocks[current_block_type_index].p(ctx2, dirty); - } else { - group_outros(); - transition_out(if_blocks[previous_block_index], 1, 1, () => { - if_blocks[previous_block_index] = null; - }); - check_outros(); - if_block = if_blocks[current_block_type_index]; - if (!if_block) { - if_block = if_blocks[current_block_type_index] = - if_block_creators[current_block_type_index](ctx2); - if_block.c(); - } else { - if_block.p(ctx2, dirty); - } - transition_in(if_block, 1); - if_block.m(main, null); - } - }, - i(local) { - if (current) return; - transition_in(if_block); - current = true; - }, - o(local) { - transition_out(if_block); - current = false; - }, - d(detaching) { - if (detaching) { - detach(main); - } - if_blocks[current_block_type_index].d(); - } - }; -} -function instance($$self, $$props, $$invalidate) { - let $showDisclaimer; - component_subscribe($$self, showDisclaimer, ($$value) => - $$invalidate(3, ($showDisclaimer = $$value)) - ); - let showSettings = false; - let showPluginMenu = false; - let authorizing = false; - urlSearchParams(); - const parentWindow = window.opener || window.parent; - if (parentWindow) { - const searchParams = new URLSearchParams(window.location.search); - if (searchParams.get('id_token')) { - authorizing = true; - parentWindow.postMessage( - { - type: 'gameSessionServerAuth', - code: searchParams.get('code'), - id_token: searchParams.get('id_token'), - state: searchParams.get('state') - }, - '*' - ); - } else if (searchParams.get('code')) { - authorizing = true; - parentWindow.postMessage( - { - type: 'authCode', - code: searchParams.get('code'), - state: searchParams.get('state') - }, - '*' - ); - } - } - function pluginmenu_showPluginMenu_binding(value) { - showPluginMenu = value; - $$invalidate(1, showPluginMenu); - } - function settings_showSettings_binding(value) { - showSettings = value; - $$invalidate(0, showSettings); - } - function topbar_showSettings_binding(value) { - showSettings = value; - $$invalidate(0, showSettings); - } - function launch_showPluginMenu_binding(value) { - showPluginMenu = value; - $$invalidate(1, showPluginMenu); - } - return [ - showSettings, - showPluginMenu, - authorizing, - $showDisclaimer, - pluginmenu_showPluginMenu_binding, - settings_showSettings_binding, - topbar_showSettings_binding, - launch_showPluginMenu_binding - ]; -} -class App extends SvelteComponent { - constructor(options) { - super(); - init(this, options, instance, create_fragment, safe_not_equal, {}); - } -} -new App({ - target: document.getElementById('app') -}); -const unsubscribers = []; -const internalUrlSub = get_store_value(internalUrl); -let boltSub; -unsubscribers.push(bolt.subscribe((data) => (boltSub = data))); -let configSub; -unsubscribers.push(config.subscribe((data) => (configSub = data))); -unsubscribers.push(platform.subscribe((data) => data)); -let credentialsSub; -unsubscribers.push(credentials.subscribe((data) => (credentialsSub = data))); -unsubscribers.push(hasBoltPlugins.subscribe((data) => data ?? false)); -let pendingOauthSub; -unsubscribers.push(pendingOauth.subscribe((data) => (pendingOauthSub = data))); -let pendingGameAuthSub; -unsubscribers.push(pendingGameAuth.subscribe((data) => (pendingGameAuthSub = data))); -unsubscribers.push(messageList.subscribe((data) => data)); -unsubscribers.push(accountList.subscribe((data) => data)); -let selectedPlaySub; -unsubscribers.push(selectedPlay.subscribe((data) => (selectedPlaySub = data))); -function start() { - var _a; - const sOrigin = atob(boltSub.origin); - const clientId = atob(boltSub.clientid); - const exchangeUrl = sOrigin.concat('/oauth2/token'); - if (credentialsSub.size == 0) { - showDisclaimer.set(true); - } - loadTheme(); - if ( - configSub.selected_game_accounts && - ((_a = configSub.selected_game_accounts) == null ? void 0 : _a.size) > 0 - ) { - config.update((data) => { - var _a2; - data.selected_characters = data.selected_game_accounts; - (_a2 = data.selected_game_accounts) == null ? void 0 : _a2.clear(); - return data; - }); - } - const allowedOrigins = [internalUrlSub, sOrigin, atob(boltSub.origin_2fa)]; - window.addEventListener('message', (event) => { - if (!allowedOrigins.includes(event.origin)) { - msg(`discarding window message from origin ${event.origin}`); - return; - } - let pending = pendingOauthSub; - const xml = new XMLHttpRequest(); - switch (event.data.type) { - case 'authCode': - if (pending) { - pendingOauth.set({}); - const post_data = new URLSearchParams({ - grant_type: 'authorization_code', - client_id: atob(boltSub.clientid), - code: event.data.code, - code_verifier: pending.verifier, - redirect_uri: atob(boltSub.redirect) - }); - xml.onreadystatechange = () => { - if (xml.readyState == 4) { - if (xml.status == 200) { - const result = parseCredentials(xml.response); - const creds = unwrap(result); - if (creds) { - handleLogin(pending == null ? void 0 : pending.win, creds).then( - (x) => { - if (x) { - credentials.update((data) => { - data.set(creds.sub, creds); - return data; - }); - saveAllCreds(); - } - } - ); - } else { - err(`Error: invalid credentials received`, false); - pending.win.close(); - } - } else { - err( - `Error: from ${exchangeUrl}: ${xml.status}: ${xml.response}`, - false - ); - pending.win.close(); - } - } - }; - xml.open('POST', exchangeUrl, true); - xml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - xml.setRequestHeader('Accept', 'application/json'); - xml.send(post_data); - } - break; - case 'externalUrl': - xml.onreadystatechange = () => { - if (xml.readyState == 4) { - msg(`External URL status: '${xml.responseText.trim()}'`); - } - }; - xml.open('POST', '/open-external-url', true); - xml.send(event.data.url); - break; - case 'gameSessionServerAuth': - pending = pendingGameAuthSub.find((x) => { - return event.data.state == x.state; - }); - if (pending) { - removePendingGameAuth(pending, true); - const sections = event.data.id_token.split('.'); - if (sections.length !== 3) { - err(`Malformed id_token: ${sections.length} sections, expected 3`, false); - break; - } - const header = JSON.parse(atob(sections[0])); - if (header.typ !== 'JWT') { - err(`Bad id_token header: typ ${header.typ}, expected JWT`, false); - break; - } - const payload = JSON.parse(atob(sections[1])); - if (atob(payload.nonce) !== pending.nonce) { - err('Incorrect nonce in id_token', false); - break; - } - const sessionsUrl = atob(boltSub.auth_api).concat('/sessions'); - xml.onreadystatechange = () => { - if (xml.readyState == 4) { - if (xml.status == 200) { - const accountsUrl = atob(boltSub.auth_api).concat('/accounts'); - pending.creds.session_id = JSON.parse(xml.response).sessionId; - handleNewSessionId( - pending.creds, - accountsUrl, - pending.account_info_promise - ).then((x) => { - if (x) { - credentials.update((data) => { - var _a2; - data.set( - (_a2 = pending == null ? void 0 : pending.creds) == - null - ? void 0 - : _a2.sub, - pending.creds - ); - return data; - }); - saveAllCreds(); - } - }); - } else { - err( - `Error: from ${sessionsUrl}: ${xml.status}: ${xml.response}`, - false - ); - } - } - }; - xml.open('POST', sessionsUrl, true); - xml.setRequestHeader('Content-Type', 'application/json'); - xml.setRequestHeader('Accept', 'application/json'); - xml.send(`{"idToken": "${event.data.id_token}"}`); - } - break; - case 'gameClientListUpdate': - clientListPromise.set(getNewClientListPromise()); - break; - default: - msg('Unknown message type: '.concat(event.data.type)); - break; - } - }); - (async () => { - if (credentialsSub.size > 0) { - credentialsSub.forEach(async (value) => { - const result = await checkRenewCreds(value, exchangeUrl, clientId); - if (result !== null && result !== 0) { - err(`Discarding expired login for #${value.sub}`, false); - credentials.update((data) => { - data.delete(value.sub); - return data; - }); - saveAllCreds(); - } - let checkedCred; - if (result === null && (await handleLogin(null, value))) { - checkedCred = { creds: value, valid: true }; - } else { - checkedCred = { creds: value, valid: result === 0 }; - } - if (checkedCred.valid) { - const creds = value; - credentials.update((data) => { - data.set(creds.sub, creds); - return data; - }); - saveAllCreds(); - } - }); - } - isConfigDirty.set(false); - })(); -} -function msg(str) { - console.log(str); - const message = { - isError: false, - text: str, - time: new Date(Date.now()) - }; - messageList.update((list) => { - list.unshift(message); - return list; - }); -} -function err(str, doThrow) { - const message = { - isError: true, - text: str, - time: new Date(Date.now()) - }; - messageList.update((list) => { - list.unshift(message); - return list; - }); - if (!doThrow) { - console.error(str); - } else { - throw new Error(str); - } -} -bolt.set(s()); -onload = () => start(); -onunload = () => { - for (const i in unsubscribers) { - delete unsubscribers[i]; - } - saveConfig(); -}; +var zt=Object.defineProperty;var Ft=(t,e,n)=>e in t?zt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Ze=(t,e,n)=>(Ft(t,typeof e!="symbol"?e+"":e,n),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}})();function I(){}function Vt(t){return!!t&&(typeof t=="object"||typeof t=="function")&&typeof t.then=="function"}function Nt(t){return t()}function ft(){return Object.create(null)}function re(t){t.forEach(Nt)}function It(t){return typeof t=="function"}function oe(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}let qe;function Wt(t,e){return t===e?!0:(qe||(qe=document.createElement("a")),qe.href=e,t===qe.href)}function Zt(t){return Object.keys(t).length===0}function jt(t,...e){if(t==null){for(const r of e)r(void 0);return I}const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function Q(t){let e;return jt(t,n=>e=n)(),e}function V(t,e,n){t.$$.on_destroy.push(jt(e,n))}function j(t,e,n){return t.set(n),e}function h(t,e){t.appendChild(e)}function v(t,e,n){t.insertBefore(e,n||null)}function y(t){t.parentNode&&t.parentNode.removeChild(t)}function Oe(t,e){for(let n=0;nt.removeEventListener(e,n,r)}function _(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function Yt(t){return Array.from(t.childNodes)}function ie(t,e){e=""+e,t.data!==e&&(t.data=e)}function me(t,e){t.value=e??""}function pt(t,e,n){for(let r=0;r{const o=t.$$.callbacks[e];if(o){const l=Kt(e,n,{cancelable:r});return o.slice().forEach(c=>{c.call(t,l)}),!l.defaultPrevented}return!0}}const Re=[],J=[];let Te=[];const Ke=[],tn=Promise.resolve();let Qe=!1;function nn(){Qe||(Qe=!0,tn.then(ot))}function Je(t){Te.push(t)}function Ie(t){Ke.push(t)}const Ye=new Set;let xe=0;function ot(){if(xe!==0)return;const t=Ne;do{try{for(;xet.indexOf(r)===-1?e.push(r):n.push(r)),n.forEach(r=>r()),Te=e}const Ue=new Set;let we;function ve(){we={r:0,c:[],p:we}}function Se(){we.r||re(we.c),we=we.p}function D(t,e){t&&t.i&&(Ue.delete(t),t.i(e))}function U(t,e,n,r){if(t&&t.o){if(Ue.has(t))return;Ue.add(t),we.c.push(()=>{Ue.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}else r&&r()}function Me(t,e){const n=e.token={};function r(o,l,c,i){if(e.token!==n)return;e.resolved=i;let a=e.ctx;c!==void 0&&(a=a.slice(),a[c]=i);const u=o&&(e.current=o)(a);let d=!1;e.block&&(e.blocks?e.blocks.forEach((f,p)=>{p!==l&&f&&(ve(),U(f,1,1,()=>{e.blocks[p]===f&&(e.blocks[p]=null)}),Se())}):e.block.d(1),u.c(),D(u,1),u.m(e.mount(),e.anchor),d=!0),e.block=u,e.blocks&&(e.blocks[l]=u),d&&ot()}if(Vt(t)){const o=Ae();if(t.then(l=>{he(o),r(e.then,1,e.value,l),he(null)},l=>{if(he(o),r(e.catch,2,e.error,l),he(null),!e.hasCatch)throw l}),e.current!==e.pending)return r(e.pending,0),!0}else{if(e.current!==e.then)return r(e.then,1,e.value,t),!0;e.resolved=t}}function lt(t,e,n){const r=e.slice(),{resolved:o}=t;t.current===t.then&&(r[t.value]=o),t.current===t.catch&&(r[t.error]=o),t.block.p(r,n)}function pe(t){return(t==null?void 0:t.length)!==void 0?t:Array.from(t)}function je(t,e,n){const r=t.$$.props[e];r!==void 0&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function ne(t){t&&t.c()}function ee(t,e,n){const{fragment:r,after_update:o}=t.$$;r&&r.m(e,n),Je(()=>{const l=t.$$.on_mount.map(Nt).filter(It);t.$$.on_destroy?t.$$.on_destroy.push(...l):re(l),t.$$.on_mount=[]}),o.forEach(Je)}function te(t,e){const n=t.$$;n.fragment!==null&&(rn(n.after_update),re(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function on(t,e){t.$$.dirty[0]===-1&&(Re.push(t),nn(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const g=m.length?m[0]:p;return u.ctx&&o(u.ctx[f],u.ctx[f]=g)&&(!u.skip_bound&&u.bound[f]&&u.bound[f](g),d&&on(t,f)),p}):[],u.update(),d=!0,re(u.before_update),u.fragment=r?r(u.ctx):!1,e.target){if(e.hydrate){const f=Yt(e.target);u.fragment&&u.fragment.l(f),f.forEach(y)}else u.fragment&&u.fragment.c();e.intro&&D(t.$$.fragment),ee(t,e.target,e.anchor),ot()}he(a)}class ce{constructor(){Ze(this,"$$");Ze(this,"$$set")}$destroy(){te(this,1),this.$destroy=I}$on(e,n){if(!It(n))return I;const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const o=r.indexOf(n);o!==-1&&r.splice(o,1)}}$set(e){this.$$set&&!Zt(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const ln="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(ln);const Pe=[];function Ht(t,e){return{subscribe:$(t,e).subscribe}}function $(t,e=I){let n;const r=new Set;function o(i){if(oe(t,i)&&(t=i,n)){const a=!Pe.length;for(const u of r)u[1](),Pe.push(u,t);if(a){for(let u=0;u{r.delete(u),r.size===0&&n&&(n(),n=null)}}return{set:o,update:l,subscribe:c}}function Ot(t){if(t.ok)return t.value;throw t.error}var K=(t=>(t[t.rs3=0]="rs3",t[t.osrs=1]="osrs",t))(K||{}),de=(t=>(t[t.runeLite=0]="runeLite",t[t.hdos=1]="hdos",t[t.rs3=2]="rs3",t))(de||{});const cn={use_dark_theme:!0,flatpak_rich_presence:!1,rs_config_uri:"",runelite_custom_jar:"",runelite_use_custom_jar:!1,selected_account:"",selected_characters:new Map,selected_game_accounts:new Map,selected_game_index:1,selected_client_index:1},At=Ht("https://bolt-internal"),an=Ht("1fddee4e-b100-4f4e-b2b0-097f9088f9d2"),ct=$(),Fe=$(""),B=$({...cn}),ye=$(new Map),ke=$(!1),fe=$(),et=$(),Le=$([]),Ve=$({}),it=$([]),tt=$(""),nt=$(""),st=$(""),W=$(!1),Ge=$(new Map),Z=$({game:K.osrs,client:de.runeLite}),Xe=$(!1);function un(){se.use_dark_theme==!1&&document.documentElement.classList.remove("dark")}function dn(t,e){e&&t.win.close(),it.update(n=>(n.splice(ut.indexOf(t),1),n))}function Dt(){if(ue&&ue.win&&!ue.win.closed)ue.win.focus();else if(ue&&ue.win&&ue.win.closed||ue){const t=Bt(),e=_n();pn({origin:atob(Y.origin),redirect:atob(Y.redirect),authMethod:"",loginType:"",clientid:atob(Y.clientid),flow:"launcher",pkceState:t,pkceCodeVerifier:e}).then(n=>{const r=window.open(n,"","width=480,height=720");Ve.set({state:t,verifier:e,win:r})})}}function fn(){const t=new URLSearchParams(window.location.search);Fe.set(t.get("platform")),t.get("flathub"),tt.set(t.get("rs3_linux_installed_hash")),nt.set(t.get("runelite_installed_id")),st.set(t.get("hdos_installed_version"));const e=t.get("plugins");e!==null?(ke.set(!0),fe.set(JSON.parse(e))):ke.set(!1);const n=t.get("credentials");if(n)try{JSON.parse(n).forEach(l=>{ye.update(c=>(c.set(l.sub,l),c))})}catch(o){F(`Couldn't parse credentials file: ${o}`,!1)}const r=t.get("config");if(r)try{const o=JSON.parse(r);B.set(o),B.update(l=>(l.selected_game_accounts?(l.selected_characters=new Map(Object.entries(l.selected_game_accounts)),delete l.selected_game_accounts):l.selected_characters&&(l.selected_characters=new Map(Object.entries(l.selected_characters))),l))}catch(o){F(`Couldn't parse config file: ${o}`,!1)}}async function qt(t,e,n){return new Promise(r=>{if(t.expiry-Date.now()<3e4){const o=new URLSearchParams({grant_type:"refresh_token",client_id:n,refresh_token:t.refresh_token}),l=new XMLHttpRequest;l.onreadystatechange=()=>{if(l.readyState==4)if(l.status==200){const c=Ut(l.response),i=Ot(c);i?(t.access_token=i.access_token,t.expiry=i.expiry,t.id_token=i.id_token,t.login_provider=i.login_provider,t.refresh_token=i.refresh_token,i.session_id&&(t.session_id=i.session_id),t.sub=i.sub,r(null)):r(0)}else r(l.status)},l.onerror=()=>{r(0)},l.open("POST",e,!0),l.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),l.setRequestHeader("Accept","application/json"),l.send(o)}else r(null)})}function Ut(t){const e=JSON.parse(t),n=e.id_token.split(".");if(n.length!==3){const l=`Malformed id_token: ${n.length} sections, expected 3`;return F(l,!1),{ok:!1,error:new Error(l)}}const r=JSON.parse(atob(n[0]));if(r.typ!=="JWT"){const l=`Bad id_token header: typ ${r.typ}, expected JWT`;return F(l,!1),{ok:!1,error:new Error(l)}}const o=JSON.parse(atob(n[1]));return{ok:!0,value:{access_token:e.access_token,id_token:e.id_token,refresh_token:e.refresh_token,sub:o.sub,login_provider:o.login_provider||null,expiry:Date.now()+e.expires_in*1e3,session_id:e.session_id}}}async function pn(t){const e=new TextEncoder().encode(t.pkceCodeVerifier),n=await crypto.subtle.digest("SHA-256",e);let r="";const o=new Uint8Array(n);for(let c=0;cMath.round(o*(n-0)/255+0)).map(o=>e[o]).join("")}async function Jt(t,e,n){return new Promise(r=>{const o=new XMLHttpRequest;o.onreadystatechange=()=>{o.readyState==4&&(o.status==200?n.then(l=>{if(typeof l!="number"){const c={id:l.id,userId:l.userId,displayName:l.displayName,suffix:l.suffix,characters:new Map};X(`Successfully added login for ${c.displayName}`),JSON.parse(o.response).forEach(i=>{c.characters.set(i.accountId,{accountId:i.accountId,displayName:i.displayName,userHash:i.userHash})}),gn(c),r(!0)}else F(`Error getting account info: ${l}`,!1),r(!1)}):(F(`Error: from ${e}: ${o.status}: ${o.response}`,!1),r(!1)))},o.open("GET",e,!0),o.setRequestHeader("Accept","application/json"),o.setRequestHeader("Authorization","Bearer ".concat(t.session_id)),o.send()})}async function _t(t,e){return await hn(t,e)}async function hn(t,e){const n=Bt(),r=crypto.randomUUID(),o=atob(Y.origin).concat("/oauth2/auth?").concat(new URLSearchParams({id_token_hint:e.id_token,nonce:btoa(r),prompt:"consent",redirect_uri:"http://localhost",response_type:"id_token code",state:n,client_id:Q(an),scope:"openid offline"}).toString()),l=bn(e);return t?(t.location.href=o,it.update(c=>(c.push({state:n,nonce:r,creds:e,win:t,account_info_promise:l}),c)),!1):e.session_id?await Jt(e,atob(Y.auth_api).concat("/accounts"),l):(F("Rejecting stored credentials with missing session_id",!1),!1)}function bn(t){return new Promise(e=>{const n=`${atob(Y.api)}/users/${t.sub}/displayName`,r=new XMLHttpRequest;r.onreadystatechange=()=>{r.readyState==4&&(r.status==200?e(JSON.parse(r.response)):e(r.status))},r.open("GET",n,!0),r.setRequestHeader("Authorization","Bearer ".concat(t.access_token)),r.send()})}function gn(t){const e=()=>{Z.update(n=>{n.account=t;const[r]=t.characters.keys();return n.character=t.characters.get(r),ge.size>0&&(n.credentials=ge.get(t.userId)),n})};Ge.update(n=>(n.set(t.userId,t),n)),ze.account&&se.selected_account?t.userId==se.selected_account&&e():ze.account||e(),Ve.set({})}function mn(t,e,n){return new Promise(r=>{const o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=()=>{o.readyState==4&&r(o.status)},o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.send(new URLSearchParams({token:t,client_id:n}))})}async function Ee(){const t=new XMLHttpRequest;t.open("POST","/save-credentials",!0),t.setRequestHeader("Content-Type","application/json"),t.onreadystatechange=()=>{t.readyState==4&&X(`Save-credentials status: ${t.responseText.trim()}`)},Z.update(n=>{var r;return n.credentials=ge.get((r=ze.account)==null?void 0:r.userId),n});const e=[];ge.forEach(n=>{e.push(n)}),t.send(JSON.stringify(e))}function kn(t,e,n){We();const r=(i,a)=>{const u=new XMLHttpRequest,d={};i&&(d.hash=i),t&&(d.jx_session_id=t),e&&(d.jx_character_id=e),n&&(d.jx_display_name=n),se.rs_plugin_loader&&(d.plugin_loader="1"),se.rs_config_uri?d.config_uri=se.rs_config_uri:d.config_uri=atob(Y.default_config_uri),u.open("POST","/launch-rs3-deb?".concat(new URLSearchParams(d).toString()),!0),u.onreadystatechange=()=>{u.readyState==4&&(X(`Game launch status: '${u.responseText.trim()}'`),u.status==200&&i&&tt.set(i))},u.send(a)},o=new XMLHttpRequest,l=atob(Y.content_url),c=l.concat("dists/trusty/non-free/binary-amd64/Packages");o.open("GET",c,!0),o.onreadystatechange=()=>{if(o.readyState==4&&o.status==200){const i=Object.fromEntries(o.response.split(` +`).map(a=>a.split(": ")));if(!i.Filename||!i.Size){F(`Could not parse package data from URL: ${c}`,!1),r();return}if(i.SHA256!==Q(tt)){X("Downloading RS3 client...");const a=new XMLHttpRequest;a.open("GET",l.concat(i.Filename),!0),a.responseType="arraybuffer",a.onprogress=u=>{u.loaded&&Le.update(d=>(d[0].text=`Downloading RS3 client... ${(Math.round(1e3*u.loaded/u.total)/10).toFixed(1)}%`,d))},a.onreadystatechange=()=>{a.readyState==4&&a.status==200&&r(i.SHA256,a.response)},a.onerror=()=>{F(`Error downloading game client: from ${c}: non-http error`,!1),r()},a.send()}else X("Latest client is already installed"),r()}},o.onerror=()=>{F(`Error: from ${c}: non-http error`,!1),r()},o.send()}function Gt(t,e,n,r){We();const o=r?"/launch-runelite-jar-configure?":"/launch-runelite-jar?",l=(a,u,d)=>{const f=new XMLHttpRequest,p={};a&&(p.id=a),d&&(p.jar_path=d),t&&(p.jx_session_id=t),e&&(p.jx_character_id=e),n&&(p.jx_display_name=n),se.flatpak_rich_presence&&(p.flatpak_rich_presence=""),f.open(u?"POST":"GET",o.concat(new URLSearchParams(p).toString()),!0),f.onreadystatechange=()=>{f.readyState==4&&(X(`Game launch status: '${f.responseText.trim()}'`),f.status==200&&a&&nt.set(a))},f.send(u)};if(se.runelite_use_custom_jar){l(null,null,se.runelite_custom_jar);return}const c=new XMLHttpRequest,i="https://api.github.com/repos/runelite/launcher/releases";c.open("GET",i,!0),c.onreadystatechange=()=>{if(c.readyState==4)if(c.status==200){const a=JSON.parse(c.responseText).map(u=>u.assets).flat().find(u=>u.name.toLowerCase()=="runelite.jar");if(a.id!=Q(nt)){X("Downloading RuneLite...");const u=new XMLHttpRequest;u.open("GET",a.browser_download_url,!0),u.responseType="arraybuffer",u.onreadystatechange=()=>{u.readyState==4&&(u.status==200?l(a.id,u.response):F(`Error downloading from ${a.url}: ${u.status}: ${u.responseText}`,!1))},u.onprogress=d=>{d.loaded&&d.lengthComputable&&Le.update(f=>(f[0].text=`Downloading RuneLite... ${(Math.round(1e3*d.loaded/d.total)/10).toFixed(1)}%`,f))},u.send()}else X("Latest JAR is already installed"),l()}else F(`Error from ${i}: ${c.status}: ${c.responseText}`,!1)},c.send()}function wn(t,e,n){return Gt(t,e,n,!1)}function yn(t,e,n){return Gt(t,e,n,!0)}function vn(t,e,n){We();const r=(c,i)=>{const a=new XMLHttpRequest,u={};c&&(u.version=c),t&&(u.jx_session_id=t),e&&(u.jx_character_id=e),n&&(u.jx_display_name=n),a.open("POST","/launch-hdos-jar?".concat(new URLSearchParams(u).toString()),!0),a.onreadystatechange=()=>{a.readyState==4&&(X(`Game launch status: '${a.responseText.trim()}'`),a.status==200&&c&&st.set(c))},a.send(i)},o=new XMLHttpRequest,l="https://cdn.hdos.dev/client/getdown.txt";o.open("GET",l,!0),o.onreadystatechange=()=>{if(o.readyState==4)if(o.status==200){const c=o.responseText.match(/^launcher\.version *= *(.*?)$/m);if(c&&c.length>=2){const i=c[1];if(i!==Q(st)){const a=`https://cdn.hdos.dev/launcher/v${i}/hdos-launcher.jar`;X("Downloading HDOS...");const u=new XMLHttpRequest;u.open("GET",a,!0),u.responseType="arraybuffer",u.onreadystatechange=()=>{if(u.readyState==4)if(u.status==200)r(i,u.response);else{const d=JSON.parse(o.responseText).map(f=>f.assets).flat().find(f=>f.name.toLowerCase()=="runelite.jar");F(`Error downloading from ${d.url}: ${u.status}: ${u.responseText}`,!1)}},u.onprogress=d=>{d.loaded&&d.lengthComputable&&Le.update(f=>(f[0].text=`Downloading HDOS... ${(Math.round(1e3*d.loaded/d.total)/10).toFixed(1)}%`,f))},u.send()}else X("Latest JAR is already installed"),r()}else X("Couldn't parse latest launcher version"),r()}else F(`Error from ${l}: ${o.status}: ${o.responseText}`,!1)},o.send()}let $e=!1;function We(){var t;if(Q(W)&&!$e){$e=!0;const e=new XMLHttpRequest;e.open("POST","/save-config",!0),e.onreadystatechange=()=>{e.readyState==4&&(X(`Save config status: '${e.responseText.trim()}'`),e.status==200&&W.set(!1),$e=!1)},e.setRequestHeader("Content-Type","application/json");const n={};(t=se.selected_characters)==null||t.forEach((l,c)=>{n[c]=l});const r={};Object.assign(r,se),r.selected_characters=n;const o=JSON.stringify(r,null,4);e.send(o)}}function Xt(){return new Promise((t,e)=>{const n=new XMLHttpRequest,r=Q(At).concat("/list-game-clients");n.open("GET",r,!0),n.onreadystatechange=()=>{if(n.readyState==4)if(n.status==200&&n.getResponseHeader("content-type")==="application/json"){const o=JSON.parse(n.responseText);t(Object.keys(o).map(l=>({uid:l,identity:o[l].identity||null})))}else e(`error (${n.responseText})`)},n.send()})}function Sn(){const t=new XMLHttpRequest;t.open("POST","/save-plugin-config",!0),t.setRequestHeader("Content-Type","application/json"),t.onreadystatechange=()=>{t.readyState==4&&X(`Save-plugin-config status: ${t.responseText.trim()}`)},t.send(JSON.stringify(Q(fe)))}function ht(t,e,n){const r=t.slice();return r[22]=e[n],r}function bt(t){let e,n=t[22][1].displayName+"",r,o,l;return{c(){e=b("option"),r=z(n),_(e,"data-id",o=t[22][1].userId),_(e,"class","dark:bg-slate-900"),e.__value=l=t[22][1].displayName,me(e,e.__value)},m(c,i){v(c,e,i),h(e,r)},p(c,i){i&4&&n!==(n=c[22][1].displayName+"")&&ie(r,n),i&4&&o!==(o=c[22][1].userId)&&_(e,"data-id",o),i&4&&l!==(l=c[22][1].displayName)&&(e.__value=l,me(e,e.__value))},d(c){c&&y(e)}}}function Ln(t){let e,n,r,o,l,c,i,a,u,d=pe(t[2]),f=[];for(let p=0;pn(13,r=k)),V(t,ye,k=>n(14,o=k)),V(t,Ge,k=>n(2,l=k)),V(t,B,k=>n(15,c=k));let{showAccountDropdown:i}=e,{hoverAccountButton:a}=e;const u=atob(Y.origin),d=atob(Y.clientid),f=u.concat("/oauth2/token"),p=u.concat("/oauth2/revoke");let m=!1,g;function R(k){a||k.button===0&&i&&!m&&n(5,i=!1)}function T(){var q;if(g.options.length==0){X("Logout unsuccessful: no account selected");return}let k=r.credentials;r.account&&(l.delete((q=r.account)==null?void 0:q.userId),Ge.set(l));const P=g.selectedIndex;P>0?n(1,g.selectedIndex=P-1,g):P==0&&l.size>0?n(1,g.selectedIndex=P+1,g):(delete r.account,delete r.character,delete r.credentials),S(),k&&qt(k,f,d).then(A=>{A===null?mn(k.access_token,p,d).then(E=>{E===200?(X("Successful logout"),C(k)):F(`Logout unsuccessful: status ${E}`,!1)}):A===400||A===401?(X("Logout unsuccessful: credentials are invalid, so discarding them anyway"),k&&C(k)):F("Logout unsuccessful: unable to verify credentials due to a network error",!1)})}function C(k){o.delete(k.sub),Ee()}function S(){var P;W.set(!0);const k=g[g.selectedIndex].getAttribute("data-id");if(j(Z,r.account=l.get(k),r),j(B,c.selected_account=k,c),j(Z,r.credentials=o.get((P=r.account)==null?void 0:P.userId),r),r.account&&r.account.characters){const q=document.getElementById("character_select");q.selectedIndex=0;const[A]=r.account.characters.keys();j(Z,r.character=r.account.characters.get(A),r)}}addEventListener("mousedown",R),De(()=>{var P;let k=0;l.forEach((q,A)=>{var E;q.displayName==((E=r.account)==null?void 0:E.displayName)&&n(1,g.selectedIndex=k,g),k++}),j(Z,r.credentials=o.get((P=r.account)==null?void 0:P.userId),r)}),rt(()=>{removeEventListener("mousedown",R)});function w(k){J[k?"unshift":"push"](()=>{g=k,n(1,g)})}const L=()=>{S()},M=()=>{Dt()},O=()=>{T()},G=()=>{n(0,m=!0)},x=()=>{n(0,m=!1)};return t.$$set=k=>{"showAccountDropdown"in k&&n(5,i=k.showAccountDropdown),"hoverAccountButton"in k&&n(6,a=k.hoverAccountButton)},[m,g,l,T,S,i,a,w,L,M,O,G,x]}class xn extends ce{constructor(e){super(),le(this,e,Cn,Ln,oe,{showAccountDropdown:5,hoverAccountButton:6})}}function Pn(t){let e;return{c(){e=z("Log In")},m(n,r){v(n,e,r)},p:I,d(n){n&&y(e)}}}function Rn(t){var r;let e=((r=t[6].account)==null?void 0:r.displayName)+"",n;return{c(){n=z(e)},m(o,l){v(o,n,l)},p(o,l){var c;l&64&&e!==(e=((c=o[6].account)==null?void 0:c.displayName)+"")&&ie(n,e)},d(o){o&&y(n)}}}function gt(t){let e,n,r,o;function l(i){t[20](i)}let c={hoverAccountButton:t[2]};return t[1]!==void 0&&(c.showAccountDropdown=t[1]),n=new xn({props:c}),J.push(()=>je(n,"showAccountDropdown",l)),{c(){e=b("div"),ne(n.$$.fragment),_(e,"class","absolute right-2 top-[72px]")},m(i,a){v(i,e,a),ee(n,e,null),o=!0},p(i,a){const u={};a&4&&(u.hoverAccountButton=i[2]),!r&&a&2&&(r=!0,u.showAccountDropdown=i[1],Ie(()=>r=!1)),n.$set(u)},i(i){o||(D(n.$$.fragment,i),o=!0)},o(i){U(n.$$.fragment,i),o=!1},d(i){i&&y(e),te(n)}}}function Tn(t){let e,n,r,o,l,c,i,a,u,d,f,p,m,g,R,T;function C(M,O){return M[6].account?Rn:Pn}let S=C(t),w=S(t),L=t[1]&>(t);return{c(){e=b("div"),n=b("div"),r=b("button"),r.textContent="RS3",o=N(),l=b("button"),l.textContent="OSRS",c=N(),i=b("div"),a=b("button"),a.innerHTML='Change Theme',u=N(),d=b("button"),d.innerHTML='Settings',f=N(),p=b("button"),w.c(),m=N(),L&&L.c(),_(r,"class","mx-1 w-20 rounded-lg border-2 border-blue-500 p-2 duration-200 hover:opacity-75"),_(l,"class","mx-1 w-20 rounded-lg border-2 border-blue-500 bg-blue-500 p-2 text-black duration-200 hover:opacity-75"),_(n,"class","m-3 ml-9 font-bold"),_(a,"class","my-3 h-10 w-10 rounded-full bg-blue-500 p-2 duration-200 hover:rotate-45 hover:opacity-75"),_(d,"class","m-3 h-10 w-10 rounded-full bg-blue-500 p-2 duration-200 hover:rotate-45 hover:opacity-75"),_(p,"class","m-2 w-48 rounded-lg border-2 border-slate-300 bg-inherit p-2 text-center font-bold text-black duration-200 hover:opacity-75 dark:border-slate-800 dark:text-slate-50"),_(i,"class","ml-auto flex"),_(e,"class","fixed top-0 flex h-16 w-screen border-b-2 border-slate-300 bg-slate-100 duration-200 dark:border-slate-800 dark:bg-slate-900")},m(M,O){v(M,e,O),h(e,n),h(n,r),t[10](r),h(n,o),h(n,l),t[12](l),h(e,c),h(e,i),h(i,a),h(i,u),h(i,d),h(i,f),h(i,p),w.m(p,null),t[16](p),h(e,m),L&&L.m(e,null),g=!0,R||(T=[H(r,"click",t[11]),H(l,"click",t[13]),H(a,"click",t[14]),H(d,"click",t[15]),H(p,"mouseenter",t[17]),H(p,"mouseleave",t[18]),H(p,"click",t[19])],R=!0)},p(M,[O]){S===(S=C(M))&&w?w.p(M,O):(w.d(1),w=S(M),w&&(w.c(),w.m(p,null))),M[1]?L?(L.p(M,O),O&2&&D(L,1)):(L=gt(M),L.c(),D(L,1),L.m(e,null)):L&&(ve(),U(L,1,1,()=>{L=null}),Se())},i(M){g||(D(L),g=!0)},o(M){U(L),g=!1},d(M){M&&y(e),t[10](null),t[12](null),w.d(),t[16](null),L&&L.d(),R=!1,re(T)}}}function Mn(t,e,n){let r,o,l;V(t,B,P=>n(21,r=P)),V(t,W,P=>n(22,o=P)),V(t,Z,P=>n(6,l=P));let{showSettings:c}=e,i=!1,a=!1,u,d,f;function p(){let P=document.documentElement;P.classList.contains("dark")?P.classList.remove("dark"):P.classList.add("dark"),j(B,r.use_dark_theme=!r.use_dark_theme,r),j(W,o=!0,o)}function m(P){switch(P){case K.osrs:j(Z,l.game=K.osrs,l),j(Z,l.client=r.selected_client_index,l),j(B,r.selected_game_index=K.osrs,r),j(W,o=!0,o),d.classList.add("bg-blue-500","text-black"),u.classList.remove("bg-blue-500","text-black");break;case K.rs3:j(Z,l.game=K.rs3,l),j(B,r.selected_game_index=K.rs3,r),j(W,o=!0,o),d.classList.remove("bg-blue-500","text-black"),u.classList.add("bg-blue-500","text-black");break}}function g(){if(f.innerHTML=="Log In"){Dt();return}n(1,i=!i)}De(()=>{m(r.selected_game_index)});function R(P){J[P?"unshift":"push"](()=>{u=P,n(3,u)})}const T=()=>{m(K.rs3)};function C(P){J[P?"unshift":"push"](()=>{d=P,n(4,d)})}const S=()=>{m(K.osrs)},w=()=>p(),L=()=>{n(0,c=!0)};function M(P){J[P?"unshift":"push"](()=>{f=P,n(5,f)})}const O=()=>{n(2,a=!0)},G=()=>{n(2,a=!1)},x=()=>g();function k(P){i=P,n(1,i)}return t.$$set=P=>{"showSettings"in P&&n(0,c=P.showSettings)},[c,i,a,u,d,f,l,p,m,g,R,T,C,S,w,L,M,O,G,x,k]}class En extends ce{constructor(e){super(),le(this,e,Mn,Tn,oe,{showSettings:0})}}function Nn(t){let e,n,r,o,l,c;return{c(){e=b("div"),n=b("div"),n.innerHTML="",r=N(),o=b("div"),o.innerHTML="",_(n,"class","absolute left-0 top-0 z-10 h-screen w-screen backdrop-blur-sm backdrop-filter"),_(o,"class","absolute left-0 top-0 z-10 h-screen w-screen bg-black opacity-75"),_(o,"role","none")},m(i,a){v(i,e,a),h(e,n),h(e,r),h(e,o),l||(c=H(o,"click",t[1]),l=!0)},p:I,i:I,o:I,d(i){i&&y(e),l=!1,c()}}}function In(t){const e=en();return[e,()=>{e("click")}]}class at extends ce{constructor(e){super(),le(this,e,In,Nn,oe,{})}}function jn(t){let e,n,r,o,l,c,i,a,u,d,f,p;return n=new at({}),{c(){e=b("div"),ne(n.$$.fragment),r=N(),o=b("div"),l=b("p"),l.textContent=`${t[1]}`,c=N(),i=b("p"),i.textContent=`${t[2]}`,a=N(),u=b("button"),u.textContent="I Understand",_(l,"class","p-2"),_(i,"class","p-2"),_(u,"class","m-5 rounded-lg border-2 border-blue-500 p-2 duration-200 hover:opacity-75"),_(o,"class","absolute left-1/4 top-1/4 z-20 w-1/2 rounded-lg bg-slate-100 p-5 text-center shadow-lg dark:bg-slate-900"),_(e,"id","disclaimer")},m(m,g){v(m,e,g),ee(n,e,null),h(e,r),h(e,o),h(o,l),h(o,c),h(o,i),h(o,a),h(o,u),d=!0,f||(p=H(u,"click",t[3]),f=!0)},p:I,i(m){d||(D(n.$$.fragment,m),d=!0)},o(m){U(n.$$.fragment,m),d=!1},d(m){m&&y(e),te(n),f=!1,p()}}}function Hn(t,e,n){let r;V(t,Xe,i=>n(0,r=i));const o=atob("Qm9sdCBpcyBhbiB1bm9mZmljaWFsIHRoaXJkLXBhcnR5IGxhdW5jaGVyLiBJdCdzIGZyZWUgYW5kIG9wZW4tc291cmNlIHNvZnR3YXJlIGxpY2Vuc2VkIHVuZGVyIEFHUEwgMy4wLg=="),l=atob("SmFnZXggaXMgbm90IHJlc3BvbnNpYmxlIGZvciBhbnkgcHJvYmxlbXMgb3IgZGFtYWdlIGNhdXNlZCBieSB1c2luZyB0aGlzIHByb2R1Y3Qu");return[r,o,l,()=>{j(Xe,r=!1,r)}]}class On extends ce{constructor(e){super(),le(this,e,Hn,jn,oe,{})}}function An(t){let e,n,r,o;return{c(){e=b("div"),n=b("button"),n.innerHTML=`
Browse app data + Browse App Data
`,_(n,"id","data_dir_button"),_(n,"class","p-2 hover:opacity-75"),_(e,"id","general_options"),_(e,"class","col-span-3 p-5 pt-10")},m(l,c){v(l,e,c),h(e,n),r||(o=H(n,"click",t[1]),r=!0)},p:I,i:I,o:I,d(l){l&&y(e),r=!1,o()}}}function Dn(t){function e(){var r=new XMLHttpRequest;r.open("GET","/browse-data"),r.onreadystatechange=()=>{r.readyState==4&&X(`Browse status: '${r.responseText.trim()}'`)},r.send()}return[e,()=>{e()}]}class qn extends ce{constructor(e){super(),le(this,e,Dn,An,oe,{})}}function Un(t){let e,n,r,o,l,c,i,a,u,d,f,p,m,g,R,T,C,S,w,L,M;return{c(){e=b("div"),n=b("button"),n.innerHTML=`
Configure RuneLite + Configure RuneLite
`,r=N(),o=b("div"),l=b("label"),l.textContent="Expose rich presence to Flatpak Discord:",c=N(),i=b("input"),a=N(),u=b("div"),d=b("label"),d.textContent="Use custom RuneLite JAR:",f=N(),p=b("input"),m=N(),g=b("div"),R=b("textarea"),T=N(),C=b("br"),S=N(),w=b("button"),w.textContent="Select File",_(n,"id","rl_configure"),_(n,"class","p-2 pb-5 hover:opacity-75"),_(l,"for","flatpak_rich_presence"),_(i,"type","checkbox"),_(i,"name","flatpak_rich_presence"),_(i,"id","flatpak_rich_presence"),_(i,"class","ml-2"),_(o,"id","flatpak_div"),_(o,"class","mx-auto border-t-2 border-slate-300 p-2 py-5 dark:border-slate-800"),_(d,"for","use_custom_jar"),_(p,"type","checkbox"),_(p,"name","use_custom_jar"),_(p,"id","use_custom_jar"),_(p,"class","ml-2"),_(u,"class","mx-auto border-t-2 border-slate-300 p-2 pt-5 dark:border-slate-800"),R.disabled=!0,_(R,"name","custom_jar_file"),_(R,"id","custom_jar_file"),_(R,"class","h-10 rounded border-2 border-slate-300 bg-slate-100 text-slate-950 dark:border-slate-800 dark:bg-slate-900 dark:text-slate-50"),w.disabled=!0,_(w,"id","custom_jar_file_button"),_(w,"class","mt-1 rounded-lg border-2 border-blue-500 p-1 duration-200 hover:opacity-75"),_(g,"id","custom_jar_div"),_(g,"class","mx-auto p-2 opacity-25"),_(e,"id","osrs_options"),_(e,"class","col-span-3 p-5 pt-10")},m(O,G){v(O,e,G),h(e,n),h(e,r),h(e,o),h(o,l),h(o,c),h(o,i),t[12](i),t[14](o),h(e,a),h(e,u),h(u,d),h(u,f),h(u,p),t[15](p),h(e,m),h(e,g),h(g,R),t[17](R),h(g,T),h(g,C),h(g,S),h(g,w),t[19](w),t[21](g),L||(M=[H(n,"click",t[11]),H(i,"change",t[13]),H(p,"change",t[16]),H(R,"change",t[18]),H(w,"click",t[20])],L=!0)},p:I,i:I,o:I,d(O){O&&y(e),t[12](null),t[14](null),t[15](null),t[17](null),t[19](null),t[21](null),L=!1,re(M)}}}function Bn(t,e,n){let r,o,l,c;V(t,Fe,E=>n(22,r=E)),V(t,B,E=>n(23,o=E)),V(t,Z,E=>n(24,l=E)),V(t,W,E=>n(25,c=E));let i,a,u,d,f,p;function m(){i.classList.toggle("opacity-25"),n(1,a.disabled=!a.disabled,a),n(2,u.disabled=!u.disabled,u),j(B,o.runelite_use_custom_jar=d.checked,o),o.runelite_use_custom_jar?a.value&&j(B,o.runelite_custom_jar=a.value,o):(n(1,a.value="",a),j(B,o.runelite_custom_jar="",o),j(B,o.runelite_use_custom_jar=!1,o)),j(W,c=!0,c)}function g(){j(B,o.flatpak_rich_presence=f.checked,o),j(W,c=!0,c)}function R(){j(B,o.runelite_custom_jar=a.value,o),j(W,c=!0,c)}function T(){n(3,d.disabled=!0,d),n(2,u.disabled=!0,u);var E=new XMLHttpRequest;E.onreadystatechange=()=>{E.readyState==4&&(E.status==200&&(n(1,a.value=E.responseText,a),j(B,o.runelite_custom_jar=E.responseText,o),j(W,c=!0,c)),n(2,u.disabled=!1,u),n(3,d.disabled=!1,d))},E.open("GET","/jar-file-picker",!0),E.send()}function C(){var E,Ce,dt;if(!l.account||!l.character){X("Please log in to configure RuneLite");return}yn((E=l.credentials)==null?void 0:E.session_id,(Ce=l.character)==null?void 0:Ce.accountId,(dt=l.character)==null?void 0:dt.displayName)}De(()=>{n(4,f.checked=o.flatpak_rich_presence,f),n(3,d.checked=o.runelite_use_custom_jar,d),d.checked&&o.runelite_custom_jar?(i.classList.remove("opacity-25"),n(1,a.disabled=!1,a),n(2,u.disabled=!1,u),n(1,a.value=o.runelite_custom_jar,a)):(n(3,d.checked=!1,d),j(B,o.runelite_use_custom_jar=!1,o)),r!=="linux"&&p.remove()});const S=()=>C();function w(E){J[E?"unshift":"push"](()=>{f=E,n(4,f)})}const L=()=>{g()};function M(E){J[E?"unshift":"push"](()=>{p=E,n(5,p)})}function O(E){J[E?"unshift":"push"](()=>{d=E,n(3,d)})}const G=()=>{m()};function x(E){J[E?"unshift":"push"](()=>{a=E,n(1,a)})}const k=()=>{R()};function P(E){J[E?"unshift":"push"](()=>{u=E,n(2,u)})}const q=()=>{T()};function A(E){J[E?"unshift":"push"](()=>{i=E,n(0,i)})}return[i,a,u,d,f,p,m,g,R,T,C,S,w,L,M,O,G,x,k,P,q,A]}class Jn extends ce{constructor(e){super(),le(this,e,Bn,Un,oe,{})}}function Gn(t){let e,n,r,o,l,c;return{c(){e=b("div"),n=b("label"),n.textContent="Enable Bolt plugin loader:",r=N(),o=b("input"),_(n,"for","enable_plugins"),_(o,"type","checkbox"),_(o,"name","enable_plugins"),_(o,"id","enable_plugins"),_(o,"class","ml-2"),_(e,"class","mx-auto p-2")},m(i,a){v(i,e,a),h(e,n),h(e,r),h(e,o),o.checked=t[3].rs_plugin_loader,l||(c=[H(o,"change",t[6]),H(o,"change",t[7])],l=!0)},p(i,a){a&8&&(o.checked=i[3].rs_plugin_loader)},d(i){i&&y(e),l=!1,re(c)}}}function Xn(t){let e,n,r,o,l,c,i,a,u,d,f,p=ke&&Gn(t);return{c(){e=b("div"),p&&p.c(),n=N(),r=b("div"),o=b("label"),o.textContent="Use custom config URI:",l=N(),c=b("input"),i=N(),a=b("div"),u=b("textarea"),_(o,"for","use_custom_uri"),_(c,"type","checkbox"),_(c,"name","use_custom_uri"),_(c,"id","use_custom_uri"),_(c,"class","ml-2"),_(r,"class","mx-auto p-2"),u.disabled=!0,_(u,"name","config_uri_address"),_(u,"id","config_uri_address"),_(u,"rows","4"),_(u,"class","rounded border-2 border-slate-300 bg-slate-100 text-slate-950 dark:border-slate-800 dark:bg-slate-900 dark:text-slate-50"),u.value=" ",_(a,"id","config_uri_div"),_(a,"class","mx-auto p-2 opacity-25"),_(e,"id","rs3_options"),_(e,"class","col-span-3 p-5 pt-10")},m(m,g){v(m,e,g),p&&p.m(e,null),h(e,n),h(e,r),h(r,o),h(r,l),h(r,c),t[8](c),h(e,i),h(e,a),h(a,u),t[11](u),t[12](a),d||(f=[H(c,"change",t[9]),H(u,"change",t[10])],d=!0)},p(m,[g]){ke&&p.p(m,g)},i:I,o:I,d(m){m&&y(e),p&&p.d(),t[8](null),t[11](null),t[12](null),d=!1,re(f)}}}function zn(t,e,n){let r,o,l;V(t,ct,S=>n(13,r=S)),V(t,B,S=>n(3,o=S)),V(t,W,S=>n(14,l=S));let c,i,a;function u(){c.classList.toggle("opacity-25"),n(1,i.disabled=!i.disabled,i),j(W,l=!0,l),a.checked||(n(1,i.value=atob(r.default_config_uri),i),j(B,o.rs_config_uri="",o))}function d(){j(B,o.rs_config_uri=i.value,o),j(W,l=!0,l)}De(()=>{o.rs_config_uri?(n(1,i.value=o.rs_config_uri,i),n(2,a.checked=!0,a),u()):n(1,i.value=atob(r.default_config_uri),i)});function f(){o.rs_plugin_loader=this.checked,B.set(o)}const p=()=>W.set(!0);function m(S){J[S?"unshift":"push"](()=>{a=S,n(2,a)})}const g=()=>{u()},R=()=>{d()};function T(S){J[S?"unshift":"push"](()=>{i=S,n(1,i)})}function C(S){J[S?"unshift":"push"](()=>{c=S,n(0,c)})}return[c,i,a,o,u,d,f,p,m,g,R,T,C]}class Fn extends ce{constructor(e){super(),le(this,e,zn,Xn,oe,{})}}function Vn(t){let e,n;return e=new Fn({}),{c(){ne(e.$$.fragment)},m(r,o){ee(e,r,o),n=!0},i(r){n||(D(e.$$.fragment,r),n=!0)},o(r){U(e.$$.fragment,r),n=!1},d(r){te(e,r)}}}function Wn(t){let e,n;return e=new Jn({}),{c(){ne(e.$$.fragment)},m(r,o){ee(e,r,o),n=!0},i(r){n||(D(e.$$.fragment,r),n=!0)},o(r){U(e.$$.fragment,r),n=!1},d(r){te(e,r)}}}function Zn(t){let e,n;return e=new qn({}),{c(){ne(e.$$.fragment)},m(r,o){ee(e,r,o),n=!0},i(r){n||(D(e.$$.fragment,r),n=!0)},o(r){U(e.$$.fragment,r),n=!1},d(r){te(e,r)}}}function Yn(t){let e,n,r,o,l,c,i,a,u,d,f,p,m,g,R,T,C,S,w,L,M,O,G,x;n=new at({}),n.$on("click",t[7]);const k=[Zn,Wn,Vn],P=[];function q(A,E){return A[1]==A[5].general?0:A[1]==A[5].osrs?1:A[1]==A[5].rs3?2:-1}return~(L=q(t))&&(M=P[L]=k[L](t)),{c(){e=b("div"),ne(n.$$.fragment),r=N(),o=b("div"),l=b("button"),l.innerHTML='Close',c=N(),i=b("div"),a=b("div"),u=b("button"),d=z("General"),f=b("br"),p=N(),m=b("button"),g=z("OSRS"),R=b("br"),T=N(),C=b("button"),S=z("RS3"),w=N(),M&&M.c(),_(l,"class","absolute right-3 top-3 rounded-full bg-rose-500 p-[2px] shadow-lg duration-200 hover:rotate-90 hover:opacity-75"),_(u,"id","general_button"),_(u,"class",be),_(m,"id","osrs_button"),_(m,"class",Be),_(C,"id","rs3_button"),_(C,"class",be),_(a,"class","relative h-full border-r-2 border-slate-300 pt-10 dark:border-slate-800"),_(i,"class","grid h-full grid-cols-4"),_(o,"class","absolute left-[13%] top-[13%] z-20 h-3/4 w-3/4 rounded-lg bg-slate-100 text-center shadow-lg dark:bg-slate-900"),_(e,"id","settings")},m(A,E){v(A,e,E),ee(n,e,null),h(e,r),h(e,o),h(o,l),h(o,c),h(o,i),h(i,a),h(a,u),h(u,d),t[9](u),h(a,f),h(a,p),h(a,m),h(m,g),t[11](m),h(a,R),h(a,T),h(a,C),h(C,S),t[13](C),h(i,w),~L&&P[L].m(i,null),O=!0,G||(x=[H(l,"click",t[8]),H(u,"click",t[10]),H(m,"click",t[12]),H(C,"click",t[14])],G=!0)},p(A,[E]){let Ce=L;L=q(A),L!==Ce&&(M&&(ve(),U(P[Ce],1,1,()=>{P[Ce]=null}),Se()),~L?(M=P[L],M||(M=P[L]=k[L](A),M.c()),D(M,1),M.m(i,null)):M=null)},i(A){O||(D(n.$$.fragment,A),D(M),O=!0)},o(A){U(n.$$.fragment,A),U(M),O=!1},d(A){A&&y(e),te(n),t[9](null),t[11](null),t[13](null),~L&&P[L].d(),G=!1,re(x)}}}let Be="border-2 border-blue-500 bg-blue-500 hover:opacity-75 font-bold text-black duration-200 rounded-lg p-1 mx-auto my-1 w-3/4",be="border-2 border-blue-500 hover:opacity-75 duration-200 rounded-lg p-1 mx-auto my-1 w-3/4";function $n(t,e,n){let{showSettings:r}=e;var o=(w=>(w[w.general=0]="general",w[w.osrs=1]="osrs",w[w.rs3=2]="rs3",w))(o||{});let l=1,c,i,a;function u(w){switch(w){case 0:n(1,l=0),n(2,c.classList.value=Be,c),n(3,i.classList.value=be,i),n(4,a.classList.value=be,a);break;case 1:n(1,l=1),n(2,c.classList.value=be,c),n(3,i.classList.value=Be,i),n(4,a.classList.value=be,a);break;case 2:n(1,l=2),n(2,c.classList.value=be,c),n(3,i.classList.value=be,i),n(4,a.classList.value=Be,a);break}}function d(w){w.key==="Escape"&&n(0,r=!1)}addEventListener("keydown",d),rt(()=>{removeEventListener("keydown",d)});const f=()=>{n(0,r=!1)},p=()=>{n(0,r=!1)};function m(w){J[w?"unshift":"push"](()=>{c=w,n(2,c)})}const g=()=>{u(o.general)};function R(w){J[w?"unshift":"push"](()=>{i=w,n(3,i)})}const T=()=>{u(o.osrs)};function C(w){J[w?"unshift":"push"](()=>{a=w,n(4,a)})}const S=()=>{u(o.rs3)};return t.$$set=w=>{"showSettings"in w&&n(0,r=w.showSettings)},[r,l,c,i,a,o,u,f,p,m,g,R,T,C,S]}class Kn extends ce{constructor(e){super(),le(this,e,$n,Yn,oe,{showSettings:0})}}function mt(t,e,n){const r=t.slice();return r[1]=e[n],r}function Qn(t){var a;let e,n=((a=t[1].time)==null?void 0:a.toLocaleTimeString())+"",r,o,l=t[1].text+"",c,i;return{c(){e=b("li"),r=z(n),o=z(` + - `),c=z(l),i=N()},m(u,d){v(u,e,d),h(e,r),h(e,o),h(e,c),h(e,i)},p(u,d){var f;d&1&&n!==(n=((f=u[1].time)==null?void 0:f.toLocaleTimeString())+"")&&ie(r,n),d&1&&l!==(l=u[1].text+"")&&ie(c,l)},d(u){u&&y(e)}}}function es(t){var a;let e,n=((a=t[1].time)==null?void 0:a.toLocaleTimeString())+"",r,o,l=t[1].text+"",c,i;return{c(){e=b("li"),r=z(n),o=z(` + - `),c=z(l),i=N(),_(e,"class","text-rose-500")},m(u,d){v(u,e,d),h(e,r),h(e,o),h(e,c),h(e,i)},p(u,d){var f;d&1&&n!==(n=((f=u[1].time)==null?void 0:f.toLocaleTimeString())+"")&&ie(r,n),d&1&&l!==(l=u[1].text+"")&&ie(c,l)},d(u){u&&y(e)}}}function kt(t){let e;function n(l,c){return l[1].isError?es:Qn}let r=n(t),o=r(t);return{c(){o.c(),e=_e()},m(l,c){o.m(l,c),v(l,e,c)},p(l,c){r===(r=n(l))&&o?o.p(l,c):(o.d(1),o=r(l),o&&(o.c(),o.m(e.parentNode,e)))},d(l){l&&y(e),o.d(l)}}}function ts(t){let e,n,r,o,l=pe(t[0]),c=[];for(let i=0;i',r=N(),o=b("ol");for(let i=0;in(0,r=o)),[r]}class ss extends ce{constructor(e){super(),le(this,e,ns,ts,oe,{})}}function wt(t,e,n){const r=t.slice();return r[13]=e[n],r}function rs(t){let e,n,r;return{c(){e=b("button"),e.textContent="Plugin menu",e.disabled=!Q(ke),_(e,"class","mx-auto mb-2 w-52 rounded-lg p-2 font-bold text-black duration-200 enabled:bg-blue-500 enabled:hover:opacity-75 disabled:bg-gray-500")},m(o,l){v(o,e,l),n||(r=H(e,"click",t[8]),n=!0)},p:I,d(o){o&&y(e),n=!1,r()}}}function os(t){let e,n,r,o,l,c,i,a,u;return{c(){e=b("label"),e.textContent="Game Client",n=N(),r=b("br"),o=N(),l=b("select"),c=b("option"),c.textContent="RuneLite",i=b("option"),i.textContent="HDOS",_(e,"for","game_client_select"),_(e,"class","text-sm"),_(c,"data-id",de.runeLite),_(c,"class","dark:bg-slate-900"),c.__value="RuneLite",me(c,c.__value),_(i,"data-id",de.hdos),_(i,"class","dark:bg-slate-900"),i.__value="HDOS",me(i,i.__value),_(l,"id","game_client_select"),_(l,"class","mx-auto w-52 cursor-pointer rounded-lg border-2 border-slate-300 bg-inherit p-2 text-inherit duration-200 hover:opacity-75 dark:border-slate-800")},m(d,f){v(d,e,f),v(d,n,f),v(d,r,f),v(d,o,f),v(d,l,f),h(l,c),h(l,i),t[7](l),a||(u=H(l,"change",t[5]),a=!0)},p:I,d(d){d&&(y(e),y(n),y(r),y(o),y(l)),t[7](null),a=!1,u()}}}function yt(t){let e,n=pe(t[4].account.characters),r=[];for(let o=0;on(4,r=T)),V(t,B,T=>n(11,o=T)),V(t,W,T=>n(12,l=T));let{showPluginMenu:c=!1}=e,i,a;function u(){var C,S;if(!r.account)return;const T=i[i.selectedIndex].getAttribute("data-id");j(Z,r.character=r.account.characters.get(T),r),r.character&&((S=o.selected_characters)==null||S.set(r.account.userId,(C=r.character)==null?void 0:C.accountId)),j(W,l=!0,l)}function d(){a.value=="RuneLite"?(j(Z,r.client=de.runeLite,r),j(B,o.selected_client_index=de.runeLite,o)):a.value=="HDOS"&&(j(Z,r.client=de.hdos,r),j(B,o.selected_client_index=de.hdos,o)),j(W,l=!0,l)}function f(){var T,C,S,w,L,M,O,G,x;if(!r.account||!r.character){X("Please log in to launch a client");return}switch(r.game){case K.osrs:r.client==de.runeLite?wn((T=r.credentials)==null?void 0:T.session_id,(C=r.character)==null?void 0:C.accountId,(S=r.character)==null?void 0:S.displayName):r.client==de.hdos&&vn((w=r.credentials)==null?void 0:w.session_id,(L=r.character)==null?void 0:L.accountId,(M=r.character)==null?void 0:M.displayName);break;case K.rs3:kn((O=r.credentials)==null?void 0:O.session_id,(G=r.character)==null?void 0:G.accountId,(x=r.character)==null?void 0:x.displayName);break}}Qt(()=>{var T;if(r.game==K.osrs&&r.client&&n(3,a.selectedIndex=r.client,a),r.account&&((T=o.selected_characters)!=null&&T.has(r.account.userId))){for(let C=0;C{o.selected_game_index==K.osrs&&(n(3,a.selectedIndex=o.selected_client_index,a),j(Z,r.client=a.selectedIndex,r))});function p(T){J[T?"unshift":"push"](()=>{a=T,n(3,a)})}const m=()=>{n(0,c=Q(ke)??!1)};function g(T){J[T?"unshift":"push"](()=>{i=T,n(2,i)})}const R=()=>u();return t.$$set=T=>{"showPluginMenu"in T&&n(0,c=T.showPluginMenu)},[c,u,i,a,r,d,f,p,m,g,R]}class us extends ce{constructor(e){super(),le(this,e,as,is,oe,{showPluginMenu:0,characterChanged:1})}get characterChanged(){return this.$$.ctx[1]}}function ds(t){let e;return{c(){e=b("div"),e.innerHTML='',_(e,"class","container mx-auto bg-slate-100 p-5 text-center text-slate-900 dark:bg-slate-900 dark:text-slate-50")},m(n,r){v(n,e,r)},p:I,i:I,o:I,d(n){n&&y(e)}}}class fs extends ce{constructor(e){super(),le(this,e,null,ds,oe,{})}}function St(t,e,n){const r=t.slice();return r[23]=e[n][0],r[22]=e[n][1],r}function Lt(t,e,n){const r=t.slice();return r[27]=e[n],r}function ps(t){let e;return{c(){e=b("p"),e.textContent="error"},m(n,r){v(n,e,r)},p:I,d(n){n&&y(e)}}}function _s(t){let e;function n(l,c){return l[26].length==0?bs:hs}let r=n(t),o=r(t);return{c(){o.c(),e=_e()},m(l,c){o.m(l,c),v(l,e,c)},p(l,c){r===(r=n(l))&&o?o.p(l,c):(o.d(1),o=r(l),o&&(o.c(),o.m(e.parentNode,e)))},d(l){l&&y(e),o.d(l)}}}function hs(t){let e,n=pe(t[26]),r=[];for(let o=0;ot[15].call(e))},m(f,p){v(f,e,p);for(let m=0;mr.parentNode,l.anchor=r},p(c,i){t=c,l.ctx=t,i&64&&o!==(o=t[6])&&Me(o,l)||lt(l,t,i)},d(c){c&&(y(e),y(n),y(r)),l.block.d(c),l.token=null,l=null}}}function ys(t){let e,n,r,o,l,c,i,a,u;function d(m,g){return g&128&&(c=null),c==null&&(c=Object.entries(m[7]).length!==0),c?Ms:Ts}let f=d(t,-1),p=f(t);return{c(){e=b("button"),n=z("+"),r=N(),o=b("br"),l=N(),p.c(),i=_e(),_(e,"class","aspect-square w-8 rounded-lg border-2 border-blue-500 text-[20px] font-bold duration-200 enabled:hover:opacity-75 disabled:border-gray-500"),e.disabled=t[3]},m(m,g){v(m,e,g),h(e,n),v(m,r,g),v(m,o,g),v(m,l,g),p.m(m,g),v(m,i,g),a||(u=H(e,"click",t[9]),a=!0)},p(m,g){g&8&&(e.disabled=m[3]),f===(f=d(m,g))&&p?p.p(m,g):(p.d(1),p=f(m),p&&(p.c(),p.m(i.parentNode,i)))},d(m){m&&(y(e),y(r),y(o),y(l),y(i)),p.d(m),a=!1,u()}}}function vs(t){let e;return{c(){e=b("p"),e.textContent="error"},m(n,r){v(n,e,r)},p:I,d(n){n&&y(e)}}}function Ss(t){let e,n;function r(c,i){return i&193&&(e=null),e==null&&(e=!!(c[22]&&c[22].main&&Object.keys(c[7]).includes(c[0]))),e?Cs:Ls}let o=r(t,-1),l=o(t);return{c(){l.c(),n=_e()},m(c,i){l.m(c,i),v(c,n,i)},p(c,i){o===(o=r(c,i))&&l?l.p(c,i):(l.d(1),l=o(c),l&&(l.c(),l.m(n.parentNode,n)))},d(c){c&&y(n),l.d(c)}}}function Ls(t){let e;return{c(){e=b("p"),e.textContent="can't start plugin: does not appear to be configured"},m(n,r){v(n,e,r)},p:I,d(n){n&&y(e)}}}function Cs(t){let e;function n(l,c){return l[7][l[0]].path?Ps:xs}let r=n(t),o=r(t);return{c(){o.c(),e=_e()},m(l,c){o.m(l,c),v(l,e,c)},p(l,c){r===(r=n(l))&&o?o.p(l,c):(o.d(1),o=r(l),o&&(o.c(),o.m(e.parentNode,e)))},d(l){l&&y(e),o.d(l)}}}function xs(t){let e;return{c(){e=b("p"),e.textContent="can't start plugin: no path is configured"},m(n,r){v(n,e,r)},p:I,d(n){n&&y(e)}}}function Ps(t){let e,n,r=t[22].name+"",o,l,c;function i(){return t[18](t[22])}return{c(){e=b("button"),n=z("Start "),o=z(r),_(e,"class","mx-auto mb-1 w-auto rounded-lg bg-emerald-500 p-2 font-bold text-black duration-200 hover:opacity-75")},m(a,u){v(a,e,u),h(e,n),h(e,o),l||(c=H(e,"click",i),l=!0)},p(a,u){t=a,u&64&&r!==(r=t[22].name+"")&&ie(o,r)},d(a){a&&y(e),l=!1,c()}}}function Rs(t){let e;return{c(){e=b("p"),e.textContent="loading..."},m(n,r){v(n,e,r)},p:I,d(n){n&&y(e)}}}function Ts(t){let e;return{c(){e=b("p"),e.textContent=`You have no plugins installed. Click the + button and select a plugin's + bolt.json file to add it.`},m(n,r){v(n,e,r)},p:I,d(n){n&&y(e)}}}function Ms(t){let e=Object.keys(Q(fe)).includes(t[0])&&t[6]!==null,n,r=e&&Pt(t);return{c(){r&&r.c(),n=_e()},m(o,l){r&&r.m(o,l),v(o,n,l)},p(o,l){l&65&&(e=Object.keys(Q(fe)).includes(o[0])&&o[6]!==null),e?r?r.p(o,l):(r=Pt(o),r.c(),r.m(n.parentNode,n)):r&&(r.d(1),r=null)},d(o){o&&y(n),r&&r.d(o)}}}function Pt(t){let e,n,r,o,l,c,i,a={ctx:t,current:null,token:null,hasCatch:!0,pending:Is,then:Ns,catch:Es,value:22};return Me(e=t[6],a),{c(){a.block.c(),n=N(),r=b("button"),r.textContent="Remove",o=N(),l=b("button"),l.textContent="Reload",_(r,"class","mx-auto mb-1 w-[min(144px,_25%)] rounded-lg p-2 font-bold text-black duration-200 enabled:bg-rose-500 enabled:hover:opacity-75 disabled:bg-gray-500"),_(l,"class","mx-auto mb-1 w-[min(144px,_25%)] rounded-lg p-2 font-bold text-black duration-200 enabled:bg-blue-500 enabled:hover:opacity-75 disabled:bg-gray-500")},m(u,d){a.block.m(u,a.anchor=d),a.mount=()=>n.parentNode,a.anchor=n,v(u,n,d),v(u,r,d),v(u,o,d),v(u,l,d),c||(i=[H(r,"click",t[16]),H(l,"click",t[17])],c=!0)},p(u,d){t=u,a.ctx=t,d&64&&e!==(e=t[6])&&Me(e,a)||lt(a,t,d)},d(u){u&&(y(n),y(r),y(o),y(l)),a.block.d(u),a.token=null,a=null,c=!1,re(i)}}}function Es(t){let e,n,r;return{c(){e=b("p"),e.textContent="error",n=N(),r=b("br")},m(o,l){v(o,e,l),v(o,n,l),v(o,r,l)},p:I,d(o){o&&(y(e),y(n),y(r))}}}function Ns(t){let e,n=(t[22].name??He)+"",r,o,l,c=(t[22].description??"no description")+"",i,a,u,d;return{c(){e=b("p"),r=z(n),o=N(),l=b("p"),i=z(c),u=N(),d=b("br"),_(e,"class","pb-4 text-xl font-bold"),_(l,"class",a=t[22].description?null:"italic")},m(f,p){v(f,e,p),h(e,r),v(f,o,p),v(f,l,p),h(l,i),v(f,u,p),v(f,d,p)},p(f,p){p&64&&n!==(n=(f[22].name??He)+"")&&ie(r,n),p&64&&c!==(c=(f[22].description??"no description")+"")&&ie(i,c),p&64&&a!==(a=f[22].description?null:"italic")&&_(l,"class",a)},d(f){f&&(y(e),y(o),y(l),y(u),y(d))}}}function Is(t){let e;return{c(){e=b("p"),e.textContent="loading..."},m(n,r){v(n,e,r)},p:I,d(n){n&&y(e)}}}function js(t){let e,n,r,o,l,c,i,a,u,d,f,p,m,g,R,T,C,S,w;n=new at({}),n.$on("click",t[11]);let L={ctx:t,current:null,token:null,hasCatch:!0,pending:gs,then:_s,catch:ps,value:26};Me(g=t[2],L);function M(x,k){return ke?ks:ms}let G=M()(t);return{c(){e=b("div"),ne(n.$$.fragment),r=N(),o=b("div"),l=b("button"),l.innerHTML='Close',c=N(),i=b("div"),a=b("button"),u=z("Manage Plugins"),f=N(),p=b("hr"),m=N(),L.block.c(),R=N(),T=b("div"),G.c(),_(l,"class","absolute right-3 top-3 rounded-full bg-rose-500 p-[2px] shadow-lg duration-200 hover:rotate-90 hover:opacity-75"),_(a,"class",d="mx-auto mb-2 w-[95%] rounded-lg border-2 "+(t[4]?"border-blue-500 text-black dark:text-white":"border-black bg-blue-500 text-black")+" p-2 font-bold hover:opacity-75"),_(p,"class","p-1 dark:border-slate-700"),_(i,"class","left-0 float-left h-full w-[min(180px,_50%)] overflow-hidden border-r-2 border-slate-300 pt-2 dark:border-slate-800"),_(T,"class","h-full pt-10"),_(o,"class","absolute left-[5%] top-[5%] z-20 h-[90%] w-[90%] rounded-lg bg-slate-100 text-center shadow-lg dark:bg-slate-900")},m(x,k){v(x,e,k),ee(n,e,null),h(e,r),h(e,o),h(o,l),h(o,c),h(o,i),h(i,a),h(a,u),h(i,f),h(i,p),h(i,m),L.block.m(i,L.anchor=null),L.mount=()=>i,L.anchor=null,h(o,R),h(o,T),G.m(T,null),C=!0,S||(w=[H(l,"click",t[11]),H(a,"click",t[13])],S=!0)},p(x,[k]){t=x,(!C||k&16&&d!==(d="mx-auto mb-2 w-[95%] rounded-lg border-2 "+(t[4]?"border-blue-500 text-black dark:text-white":"border-black bg-blue-500 text-black")+" p-2 font-bold hover:opacity-75"))&&_(a,"class",d),L.ctx=t,k&4&&g!==(g=t[2])&&Me(g,L)||lt(L,t,k),G.p(t,k)},i(x){C||(D(n.$$.fragment,x),C=!0)},o(x){U(n.$$.fragment,x),C=!1},d(x){x&&y(e),te(n),L.block.d(),L.token=null,L=null,G.d(),S=!1,re(w)}}}const He="(unnamed)",Rt="(new character)";function Hs(t,e,n){let r,o,l;V(t,et,k=>n(2,o=k)),V(t,fe,k=>n(7,l=k));let{showPluginMenu:c}=e;const i=k=>new Promise((P,q)=>{const A=k.concat(k.endsWith("/")?"bolt.json":"/bolt.json");var E=new XMLHttpRequest;E.onreadystatechange=()=>{E.readyState==4&&(E.status==200?P(JSON.parse(E.responseText)):q(E.responseText))},E.open("GET","/read-json-file?".concat(new URLSearchParams({path:A}).toString()),!0),E.send()}),a=k=>{const q=Q(fe)[k];if(!q)return null;const A=q.path;return A?i(A):null},u=(k,P)=>{i(k).then(q=>{do n(0,R=crypto.randomUUID());while(Object.keys(Q(fe)).includes(R));j(fe,l[R]={name:q.name??He,path:k},l),n(5,S=!0)}).catch(q=>{console.error(`Config file '${P}' couldn't be fetched, reason: ${q}`)})};let d=!1;const f=()=>{n(3,d=!0);var k=new XMLHttpRequest;k.onreadystatechange=()=>{if(k.readyState==4&&(n(3,d=!1),k.status==200)){const P=Q(Fe)==="windows"?k.responseText.replaceAll("\\","/"):k.responseText;if(P.endsWith("/bolt.json")){const q=P.substring(0,P.length-9);u(q,P)}else console.log(`Selection '${P}' is not named bolt.json; ignored`)}},k.open("GET","/json-file-picker",!0),k.send()};et.set(Xt());const p=(k,P,q,A)=>{var E=new XMLHttpRequest;E.onreadystatechange=()=>{E.readyState==4&&X(`Start-plugin status: ${E.statusText.trim()}`)},E.open("GET","/start-plugin?".concat(new URLSearchParams({client:k,id:P,path:q,main:A}).toString()),!0),E.send()},m=()=>{d||n(12,c=!1)};function g(k){k.key==="Escape"&&m()}addEventListener("keydown",g);var R,T=!1,C;let S=!1;rt(()=>{S&&Sn(),removeEventListener("keydown",g)});const w=()=>n(4,T=!1),L=k=>{n(1,C=k.uid),n(4,T=!0)};function M(){R=$t(this),n(0,R)}const O=()=>{n(6,r=null),n(5,S=!0);let k=Q(fe);delete k[R],fe.set(k)},G=()=>n(6,r=a(R)),x=k=>p(C,R,l[R].path??"",k.main??"");return t.$$set=k=>{"showPluginMenu"in k&&n(12,c=k.showPluginMenu)},t.$$.update=()=>{t.$$.dirty&6&&o.then(k=>{k.some(P=>P.uid===C)||n(4,T=!1)}),t.$$.dirty&1&&n(6,r=a(R))},[R,C,o,d,T,S,r,l,a,f,p,m,c,w,L,M,O,G,x]}class Os extends ce{constructor(e){super(),le(this,e,Hs,js,oe,{showPluginMenu:12})}}function As(t){let e,n,r,o,l,c,i,a,u,d,f,p,m,g,R,T,C=t[1]&&Tt(t),S=t[0]&&Mt(t),w=t[3]&&Et();function L(x){t[6](x)}let M={};t[0]!==void 0&&(M.showSettings=t[0]),o=new En({props:M}),J.push(()=>je(o,"showSettings",L));function O(x){t[7](x)}let G={};return t[1]!==void 0&&(G.showPluginMenu=t[1]),d=new us({props:G}),J.push(()=>je(d,"showPluginMenu",O)),R=new ss({}),{c(){C&&C.c(),e=N(),S&&S.c(),n=N(),w&&w.c(),r=N(),ne(o.$$.fragment),c=N(),i=b("div"),a=b("div"),u=N(),ne(d.$$.fragment),p=N(),m=b("div"),g=N(),ne(R.$$.fragment),_(i,"class","mt-16 grid h-full grid-flow-col grid-cols-3")},m(x,k){C&&C.m(x,k),v(x,e,k),S&&S.m(x,k),v(x,n,k),w&&w.m(x,k),v(x,r,k),ee(o,x,k),v(x,c,k),v(x,i,k),h(i,a),h(i,u),ee(d,i,null),h(i,p),h(i,m),v(x,g,k),ee(R,x,k),T=!0},p(x,k){x[1]?C?(C.p(x,k),k&2&&D(C,1)):(C=Tt(x),C.c(),D(C,1),C.m(e.parentNode,e)):C&&(ve(),U(C,1,1,()=>{C=null}),Se()),x[0]?S?(S.p(x,k),k&1&&D(S,1)):(S=Mt(x),S.c(),D(S,1),S.m(n.parentNode,n)):S&&(ve(),U(S,1,1,()=>{S=null}),Se()),x[3]?w?k&8&&D(w,1):(w=Et(),w.c(),D(w,1),w.m(r.parentNode,r)):w&&(ve(),U(w,1,1,()=>{w=null}),Se());const P={};!l&&k&1&&(l=!0,P.showSettings=x[0],Ie(()=>l=!1)),o.$set(P);const q={};!f&&k&2&&(f=!0,q.showPluginMenu=x[1],Ie(()=>f=!1)),d.$set(q)},i(x){T||(D(C),D(S),D(w),D(o.$$.fragment,x),D(d.$$.fragment,x),D(R.$$.fragment,x),T=!0)},o(x){U(C),U(S),U(w),U(o.$$.fragment,x),U(d.$$.fragment,x),U(R.$$.fragment,x),T=!1},d(x){x&&(y(e),y(n),y(r),y(c),y(i),y(g)),C&&C.d(x),S&&S.d(x),w&&w.d(x),te(o,x),te(d),te(R,x)}}}function Ds(t){let e,n;return e=new fs({}),{c(){ne(e.$$.fragment)},m(r,o){ee(e,r,o),n=!0},p:I,i(r){n||(D(e.$$.fragment,r),n=!0)},o(r){U(e.$$.fragment,r),n=!1},d(r){te(e,r)}}}function Tt(t){let e,n,r;function o(c){t[4](c)}let l={};return t[1]!==void 0&&(l.showPluginMenu=t[1]),e=new Os({props:l}),J.push(()=>je(e,"showPluginMenu",o)),{c(){ne(e.$$.fragment)},m(c,i){ee(e,c,i),r=!0},p(c,i){const a={};!n&&i&2&&(n=!0,a.showPluginMenu=c[1],Ie(()=>n=!1)),e.$set(a)},i(c){r||(D(e.$$.fragment,c),r=!0)},o(c){U(e.$$.fragment,c),r=!1},d(c){te(e,c)}}}function Mt(t){let e,n,r;function o(c){t[5](c)}let l={};return t[0]!==void 0&&(l.showSettings=t[0]),e=new Kn({props:l}),J.push(()=>je(e,"showSettings",o)),{c(){ne(e.$$.fragment)},m(c,i){ee(e,c,i),r=!0},p(c,i){const a={};!n&&i&1&&(n=!0,a.showSettings=c[0],Ie(()=>n=!1)),e.$set(a)},i(c){r||(D(e.$$.fragment,c),r=!0)},o(c){U(e.$$.fragment,c),r=!1},d(c){te(e,c)}}}function Et(t){let e,n;return e=new On({}),{c(){ne(e.$$.fragment)},m(r,o){ee(e,r,o),n=!0},i(r){n||(D(e.$$.fragment,r),n=!0)},o(r){U(e.$$.fragment,r),n=!1},d(r){te(e,r)}}}function qs(t){let e,n,r,o;const l=[Ds,As],c=[];function i(a,u){return a[2]?0:1}return n=i(t),r=c[n]=l[n](t),{c(){e=b("main"),r.c(),_(e,"class","h-full")},m(a,u){v(a,e,u),c[n].m(e,null),o=!0},p(a,[u]){let d=n;n=i(a),n===d?c[n].p(a,u):(ve(),U(c[d],1,1,()=>{c[d]=null}),Se(),r=c[n],r?r.p(a,u):(r=c[n]=l[n](a),r.c()),D(r,1),r.m(e,null))},i(a){o||(D(r),o=!0)},o(a){U(r),o=!1},d(a){a&&y(e),c[n].d()}}}function Us(t,e,n){let r;V(t,Xe,p=>n(3,r=p));let o=!1,l=!1,c=!1;fn();const i=window.opener||window.parent;if(i){const p=new URLSearchParams(window.location.search);p.get("id_token")?(c=!0,i.postMessage({type:"gameSessionServerAuth",code:p.get("code"),id_token:p.get("id_token"),state:p.get("state")},"*")):p.get("code")&&(c=!0,i.postMessage({type:"authCode",code:p.get("code"),state:p.get("state")},"*"))}function a(p){l=p,n(1,l)}function u(p){o=p,n(0,o)}function d(p){o=p,n(0,o)}function f(p){l=p,n(1,l)}return[o,l,c,r,a,u,d,f]}class Bs extends ce{constructor(e){super(),le(this,e,Us,qs,oe,{})}}new Bs({target:document.getElementById("app")});const ae=[],Js=Q(At);let Y;ae.push(ct.subscribe(t=>Y=t));let se;ae.push(B.subscribe(t=>se=t));ae.push(Fe.subscribe(t=>t));let ge;ae.push(ye.subscribe(t=>ge=t));ae.push(ke.subscribe(t=>t??!1));let ue;ae.push(Ve.subscribe(t=>ue=t));let ut;ae.push(it.subscribe(t=>ut=t));ae.push(Le.subscribe(t=>t));ae.push(Ge.subscribe(t=>t));let ze;ae.push(Z.subscribe(t=>ze=t));function Gs(){var o;const t=atob(Y.origin),e=atob(Y.clientid),n=t.concat("/oauth2/token");ge.size==0&&Xe.set(!0),un(),se.selected_game_accounts&&((o=se.selected_game_accounts)==null?void 0:o.size)>0&&B.update(l=>{var c;return l.selected_characters=l.selected_game_accounts,(c=l.selected_game_accounts)==null||c.clear(),l});const r=[Js,t,atob(Y.origin_2fa)];window.addEventListener("message",l=>{if(!r.includes(l.origin)){X(`discarding window message from origin ${l.origin}`);return}let c=ue;const i=new XMLHttpRequest;switch(l.data.type){case"authCode":if(c){Ve.set({});const a=new URLSearchParams({grant_type:"authorization_code",client_id:atob(Y.clientid),code:l.data.code,code_verifier:c.verifier,redirect_uri:atob(Y.redirect)});i.onreadystatechange=()=>{if(i.readyState==4)if(i.status==200){const u=Ut(i.response),d=Ot(u);d?_t(c==null?void 0:c.win,d).then(f=>{f&&(ye.update(p=>(p.set(d.sub,d),p)),Ee())}):(F("Error: invalid credentials received",!1),c.win.close())}else F(`Error: from ${n}: ${i.status}: ${i.response}`,!1),c.win.close()},i.open("POST",n,!0),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),i.setRequestHeader("Accept","application/json"),i.send(a)}break;case"externalUrl":i.onreadystatechange=()=>{i.readyState==4&&X(`External URL status: '${i.responseText.trim()}'`)},i.open("POST","/open-external-url",!0),i.send(l.data.url);break;case"gameSessionServerAuth":if(c=ut.find(a=>l.data.state==a.state),c){dn(c,!0);const a=l.data.id_token.split(".");if(a.length!==3){F(`Malformed id_token: ${a.length} sections, expected 3`,!1);break}const u=JSON.parse(atob(a[0]));if(u.typ!=="JWT"){F(`Bad id_token header: typ ${u.typ}, expected JWT`,!1);break}const d=JSON.parse(atob(a[1]));if(atob(d.nonce)!==c.nonce){F("Incorrect nonce in id_token",!1);break}const f=atob(Y.auth_api).concat("/sessions");i.onreadystatechange=()=>{if(i.readyState==4)if(i.status==200){const p=atob(Y.auth_api).concat("/accounts");c.creds.session_id=JSON.parse(i.response).sessionId,Jt(c.creds,p,c.account_info_promise).then(m=>{m&&(ye.update(g=>{var R;return g.set((R=c==null?void 0:c.creds)==null?void 0:R.sub,c.creds),g}),Ee())})}else F(`Error: from ${f}: ${i.status}: ${i.response}`,!1)},i.open("POST",f,!0),i.setRequestHeader("Content-Type","application/json"),i.setRequestHeader("Accept","application/json"),i.send(`{"idToken": "${l.data.id_token}"}`)}break;case"gameClientListUpdate":et.set(Xt());break;default:X("Unknown message type: ".concat(l.data.type));break}}),(async()=>(ge.size>0&&ge.forEach(async l=>{const c=await qt(l,n,e);c!==null&&c!==0&&(F(`Discarding expired login for #${l.sub}`,!1),ye.update(a=>(a.delete(l.sub),a)),Ee());let i;if(c===null&&await _t(null,l)?i={creds:l,valid:!0}:i={creds:l,valid:c===0},i.valid){const a=l;ye.update(u=>(u.set(a.sub,a),u)),Ee()}}),W.set(!1)))()}function X(t){console.log(t);const e={isError:!1,text:t,time:new Date(Date.now())};Le.update(n=>(n.unshift(e),n))}function F(t,e){const n={isError:!0,text:t,time:new Date(Date.now())};if(Le.update(r=>(r.unshift(n),r)),!e)console.error(t);else throw new Error(t)}ct.set(s());onload=()=>Gs();onunload=()=>{for(const t in ae)delete ae[t];We()};