Greasy Fork is available in English.

Experimental Flight Interface

Improve your plane with the interface that offers experimental features.

  1. // ==UserScript==
  2. // @name Experimental Flight Interface
  3. // @namespace https://github.com/Ferhatduran55/geofs-experimental-fi
  4. // @version 0.7.13
  5. // @description Improve your plane with the interface that offers experimental features.
  6. // @author Ferhatduran55
  7. // @match https://www.geo-fs.com/geofs.php?v=3.7
  8. // @grant GM_addStyle
  9. // @grant GM_setValue
  10. // @grant GM_getValue
  11. // @grant GM_deleteValue
  12. // @grant GM_listValues
  13. // @grant GM_info
  14. // @grant unsafeWindow
  15. // @license MIT
  16. // @homepage https://greatest.deepsurf.us/scripts/488227
  17. // @supportURL https://greatest.deepsurf.us/scripts/488227/feedback
  18. // @run-at document-end
  19. // ==/UserScript==
  20.  
  21. // dist/index.js
  22. (function () {
  23. 'use strict';
  24.  
  25. try{if(typeof document != 'undefined'){GM.addStyle("*, ::before, ::after {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}\n\n::backdrop {\n --tw-border-spacing-x: 0;\n --tw-border-spacing-y: 0;\n --tw-translate-x: 0;\n --tw-translate-y: 0;\n --tw-rotate: 0;\n --tw-skew-x: 0;\n --tw-skew-y: 0;\n --tw-scale-x: 1;\n --tw-scale-y: 1;\n --tw-pan-x: ;\n --tw-pan-y: ;\n --tw-pinch-zoom: ;\n --tw-scroll-snap-strictness: proximity;\n --tw-gradient-from-position: ;\n --tw-gradient-via-position: ;\n --tw-gradient-to-position: ;\n --tw-ordinal: ;\n --tw-slashed-zero: ;\n --tw-numeric-figure: ;\n --tw-numeric-spacing: ;\n --tw-numeric-fraction: ;\n --tw-ring-inset: ;\n --tw-ring-offset-width: 0px;\n --tw-ring-offset-color: #fff;\n --tw-ring-color: rgb(59 130 246 / 0.5);\n --tw-ring-offset-shadow: 0 0 #0000;\n --tw-ring-shadow: 0 0 #0000;\n --tw-shadow: 0 0 #0000;\n --tw-shadow-colored: 0 0 #0000;\n --tw-blur: ;\n --tw-brightness: ;\n --tw-contrast: ;\n --tw-grayscale: ;\n --tw-hue-rotate: ;\n --tw-invert: ;\n --tw-saturate: ;\n --tw-sepia: ;\n --tw-drop-shadow: ;\n --tw-backdrop-blur: ;\n --tw-backdrop-brightness: ;\n --tw-backdrop-contrast: ;\n --tw-backdrop-grayscale: ;\n --tw-backdrop-hue-rotate: ;\n --tw-backdrop-invert: ;\n --tw-backdrop-opacity: ;\n --tw-backdrop-saturate: ;\n --tw-backdrop-sepia: ;\n --tw-contain-size: ;\n --tw-contain-layout: ;\n --tw-contain-paint: ;\n --tw-contain-style: ;\n}/*\n! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com\n*//*\n1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)\n2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)\n*/\n\n*,\n::before,\n::after {\n box-sizing: border-box; /* 1 */\n border-width: 0; /* 2 */\n border-style: solid; /* 2 */\n border-color: #e5e7eb; /* 2 */\n}\n\n::before,\n::after {\n --tw-content: '';\n}\n\n/*\n1. Use a consistent sensible line-height in all browsers.\n2. Prevent adjustments of font size after orientation changes in iOS.\n3. Use a more readable tab size.\n4. Use the user's configured `sans` font-family by default.\n5. Use the user's configured `sans` font-feature-settings by default.\n6. Use the user's configured `sans` font-variation-settings by default.\n7. Disable tap highlights on iOS\n*/\n\nhtml,\n:host {\n line-height: 1.5; /* 1 */\n -webkit-text-size-adjust: 100%; /* 2 */\n -moz-tab-size: 4; /* 3 */\n -o-tab-size: 4;\n tab-size: 4; /* 3 */\n font-family: ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"; /* 4 */\n font-feature-settings: normal; /* 5 */\n font-variation-settings: normal; /* 6 */\n -webkit-tap-highlight-color: transparent; /* 7 */\n}\n\n/*\n1. Remove the margin in all browsers.\n2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.\n*/\n\nbody {\n margin: 0; /* 1 */\n line-height: inherit; /* 2 */\n}\n\n/*\n1. Add the correct height in Firefox.\n2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)\n3. Ensure horizontal rules are visible by default.\n*/\n\nhr {\n height: 0; /* 1 */\n color: inherit; /* 2 */\n border-top-width: 1px; /* 3 */\n}\n\n/*\nAdd the correct text decoration in Chrome, Edge, and Safari.\n*/\n\nabbr:where([title]) {\n -webkit-text-decoration: underline dotted;\n text-decoration: underline dotted;\n}\n\n/*\nRemove the default font size and weight for headings.\n*/\n\nh1,\nh2,\nh3,\nh4,\nh5,\nh6 {\n font-size: inherit;\n font-weight: inherit;\n}\n\n/*\nReset links to optimize for opt-in styling instead of opt-out.\n*/\n\na {\n color: inherit;\n text-decoration: inherit;\n}\n\n/*\nAdd the correct font weight in Edge and Safari.\n*/\n\nb,\nstrong {\n font-weight: bolder;\n}\n\n/*\n1. Use the user's configured `mono` font-family by default.\n2. Use the user's configured `mono` font-feature-settings by default.\n3. Use the user's configured `mono` font-variation-settings by default.\n4. Correct the odd `em` font sizing in all browsers.\n*/\n\ncode,\nkbd,\nsamp,\npre {\n font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace; /* 1 */\n font-feature-settings: normal; /* 2 */\n font-variation-settings: normal; /* 3 */\n font-size: 1em; /* 4 */\n}\n\n/*\nAdd the correct font size in all browsers.\n*/\n\nsmall {\n font-size: 80%;\n}\n\n/*\nPrevent `sub` and `sup` elements from affecting the line height in all browsers.\n*/\n\nsub,\nsup {\n font-size: 75%;\n line-height: 0;\n position: relative;\n vertical-align: baseline;\n}\n\nsub {\n bottom: -0.25em;\n}\n\nsup {\n top: -0.5em;\n}\n\n/*\n1. 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)\n2. 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)\n3. Remove gaps between table borders by default.\n*/\n\ntable {\n text-indent: 0; /* 1 */\n border-color: inherit; /* 2 */\n border-collapse: collapse; /* 3 */\n}\n\n/*\n1. Change the font styles in all browsers.\n2. Remove the margin in Firefox and Safari.\n3. Remove default padding in all browsers.\n*/\n\nbutton,\ninput,\noptgroup,\nselect,\ntextarea {\n font-family: inherit; /* 1 */\n font-feature-settings: inherit; /* 1 */\n font-variation-settings: inherit; /* 1 */\n font-size: 100%; /* 1 */\n font-weight: inherit; /* 1 */\n line-height: inherit; /* 1 */\n letter-spacing: inherit; /* 1 */\n color: inherit; /* 1 */\n margin: 0; /* 2 */\n padding: 0; /* 3 */\n}\n\n/*\nRemove the inheritance of text transform in Edge and Firefox.\n*/\n\nbutton,\nselect {\n text-transform: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Remove default button styles.\n*/\n\nbutton,\ninput:where([type='button']),\ninput:where([type='reset']),\ninput:where([type='submit']) {\n -webkit-appearance: button; /* 1 */\n background-color: transparent; /* 2 */\n background-image: none; /* 2 */\n}\n\n/*\nUse the modern Firefox focus style for all focusable elements.\n*/\n\n:-moz-focusring {\n outline: auto;\n}\n\n/*\nRemove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)\n*/\n\n:-moz-ui-invalid {\n box-shadow: none;\n}\n\n/*\nAdd the correct vertical alignment in Chrome and Firefox.\n*/\n\nprogress {\n vertical-align: baseline;\n}\n\n/*\nCorrect the cursor style of increment and decrement buttons in Safari.\n*/\n\n::-webkit-inner-spin-button,\n::-webkit-outer-spin-button {\n height: auto;\n}\n\n/*\n1. Correct the odd appearance in Chrome and Safari.\n2. Correct the outline style in Safari.\n*/\n\n[type='search'] {\n -webkit-appearance: textfield; /* 1 */\n outline-offset: -2px; /* 2 */\n}\n\n/*\nRemove the inner padding in Chrome and Safari on macOS.\n*/\n\n::-webkit-search-decoration {\n -webkit-appearance: none;\n}\n\n/*\n1. Correct the inability to style clickable types in iOS and Safari.\n2. Change font properties to `inherit` in Safari.\n*/\n\n::-webkit-file-upload-button {\n -webkit-appearance: button; /* 1 */\n font: inherit; /* 2 */\n}\n\n/*\nAdd the correct display in Chrome and Safari.\n*/\n\nsummary {\n display: list-item;\n}\n\n/*\nRemoves the default spacing and border for appropriate elements.\n*/\n\nblockquote,\ndl,\ndd,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nhr,\nfigure,\np,\npre {\n margin: 0;\n}\n\nfieldset {\n margin: 0;\n padding: 0;\n}\n\nlegend {\n padding: 0;\n}\n\nol,\nul,\nmenu {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n/*\nReset default styling for dialogs.\n*/\ndialog {\n padding: 0;\n}\n\n/*\nPrevent resizing textareas horizontally by default.\n*/\n\ntextarea {\n resize: vertical;\n}\n\n/*\n1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)\n2. Set the default placeholder color to the user's configured gray 400 color.\n*/\n\ninput::-moz-placeholder, textarea::-moz-placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\ninput::placeholder,\ntextarea::placeholder {\n opacity: 1; /* 1 */\n color: #9ca3af; /* 2 */\n}\n\n/*\nSet the default cursor for buttons.\n*/\n\nbutton,\n[role=\"button\"] {\n cursor: pointer;\n}\n\n/*\nMake sure disabled buttons don't get the pointer cursor.\n*/\n:disabled {\n cursor: default;\n}\n\n/*\n1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)\n2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)\n This can trigger a poorly considered lint error in some tools but is included by design.\n*/\n\nimg,\nsvg,\nvideo,\ncanvas,\naudio,\niframe,\nembed,\nobject {\n display: block; /* 1 */\n vertical-align: middle; /* 2 */\n}\n\n/*\nConstrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)\n*/\n\nimg,\nvideo {\n max-width: 100%;\n height: auto;\n}\n\n/* Make elements with the HTML hidden attribute stay hidden by default */\n[hidden]:where(:not([hidden=\"until-found\"])) {\n display: none;\n}\r\n.container {\n width: 100%;\n}\r\n@media (min-width: 640px) {\n\n .container {\n max-width: 640px;\n }\n}\r\n@media (min-width: 768px) {\n\n .container {\n max-width: 768px;\n }\n}\r\n@media (min-width: 1024px) {\n\n .container {\n max-width: 1024px;\n }\n}\r\n@media (min-width: 1280px) {\n\n .container {\n max-width: 1280px;\n }\n}\r\n@media (min-width: 1536px) {\n\n .container {\n max-width: 1536px;\n }\n}\r\n.static {\n position: static;\n}\r\n.m-2 {\n margin: 0.5rem;\n}\r\n.mt-4 {\n margin-top: 1rem;\n}\r\n.flex {\n display: flex;\n}\r\n.h-5 {\n height: 1.25rem;\n}\r\n.w-11\\/12 {\n width: 91.666667%;\n}\r\n.w-5 {\n width: 1.25rem;\n}\r\n.w-fit {\n width: -moz-fit-content;\n width: fit-content;\n}\r\n.w-max {\n width: -moz-max-content;\n width: max-content;\n}\r\n.flex-auto {\n flex: 1 1 auto;\n}\r\n.flex-none {\n flex: none;\n}\r\n.flex-col {\n flex-direction: column;\n}\r\n.items-center {\n align-items: center;\n}\r\n.justify-between {\n justify-content: space-between;\n}\r\n.gap-2 {\n gap: 0.5rem;\n}\r\n.gap-4 {\n gap: 1rem;\n}\r\n.rounded-md {\n border-radius: 0.375rem;\n}\r\n.border-0 {\n border-width: 0px;\n}\r\n.bg-sky-600 {\n --tw-bg-opacity: 1;\n background-color: rgb(2 132 199 / var(--tw-bg-opacity, 1));\n}\r\n.p-2 {\n padding: 0.5rem;\n}\r\n.px-3 {\n padding-left: 0.75rem;\n padding-right: 0.75rem;\n}\r\n.px-4 {\n padding-left: 1rem;\n padding-right: 1rem;\n}\r\n.pb-4 {\n padding-bottom: 1rem;\n}\r\n.pl-2 {\n padding-left: 0.5rem;\n}\r\n.text-sm {\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\r\n.font-medium {\n font-weight: 500;\n}\r\n.text-gray-500 {\n --tw-text-opacity: 1;\n color: rgb(107 114 128 / var(--tw-text-opacity, 1));\n}\r\n.text-slate-500 {\n --tw-text-opacity: 1;\n color: rgb(100 116 139 / var(--tw-text-opacity, 1));\n}\r\n.text-white {\n --tw-text-opacity: 1;\n color: rgb(255 255 255 / var(--tw-text-opacity, 1));\n}\r\n.shadow-md {\n --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);\n box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);\n}\r\n.transition {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\r\n.marker\\:content-none *::marker {\n --tw-content: none;\n content: var(--tw-content);\n}\r\n.marker\\:content-none::marker {\n --tw-content: none;\n content: var(--tw-content);\n}\r\n.hover\\:cursor-pointer:hover {\n cursor: pointer;\n}\r\n.hover\\:bg-sky-700:hover {\n --tw-bg-opacity: 1;\n background-color: rgb(3 105 161 / var(--tw-bg-opacity, 1));\n}html[dir=\"ltr\"],\r\n[data-sonner-toaster][dir=\"ltr\"] {\r\n --toast-icon-margin-start: -3px;\r\n --toast-icon-margin-end: 4px;\r\n --toast-svg-margin-start: -1px;\r\n --toast-svg-margin-end: 0px;\r\n --toast-button-margin-start: auto;\r\n --toast-button-margin-end: 0;\r\n --toast-close-button-start: 0;\r\n --toast-close-button-end: unset;\r\n --toast-close-button-transform: translate(-35%, -35%);\r\n}\r\nhtml[dir=\"rtl\"],\r\n[data-sonner-toaster][dir=\"rtl\"] {\r\n --toast-icon-margin-start: 4px;\r\n --toast-icon-margin-end: -3px;\r\n --toast-svg-margin-start: 0px;\r\n --toast-svg-margin-end: -1px;\r\n --toast-button-margin-start: 0;\r\n --toast-button-margin-end: auto;\r\n --toast-close-button-start: unset;\r\n --toast-close-button-end: 0;\r\n --toast-close-button-transform: translate(35%, -35%);\r\n}\r\n[data-sonner-toaster] {\r\n position: fixed;\r\n width: var(--width);\r\n font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,\r\n Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif,\r\n Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;\r\n --gray1: hsl(0, 0%, 99%);\r\n --gray2: hsl(0, 0%, 97.3%);\r\n --gray3: hsl(0, 0%, 95.1%);\r\n --gray4: hsl(0, 0%, 93%);\r\n --gray5: hsl(0, 0%, 90.9%);\r\n --gray6: hsl(0, 0%, 88.7%);\r\n --gray7: hsl(0, 0%, 85.8%);\r\n --gray8: hsl(0, 0%, 78%);\r\n --gray9: hsl(0, 0%, 56.1%);\r\n --gray10: hsl(0, 0%, 52.3%);\r\n --gray11: hsl(0, 0%, 43.5%);\r\n --gray12: hsl(0, 0%, 9%);\r\n --border-radius: 8px;\r\n box-sizing: border-box;\r\n padding: 0;\r\n margin: 0;\r\n list-style: none;\r\n outline: none;\r\n z-index: 999999999;\r\n}\r\n[data-sonner-toaster][data-x-position=\"right\"] {\r\n right: max(var(--offset), env(safe-area-inset-right));\r\n}\r\n[data-sonner-toaster][data-x-position=\"left\"] {\r\n left: max(var(--offset), env(safe-area-inset-left));\r\n}\r\n[data-sonner-toaster][data-x-position=\"center\"] {\r\n left: 50%;\r\n transform: translateX(-50%);\r\n}\r\n[data-sonner-toaster][data-y-position=\"top\"] {\r\n top: max(var(--offset), env(safe-area-inset-top));\r\n}\r\n[data-sonner-toaster][data-y-position=\"bottom\"] {\r\n bottom: max(var(--offset), env(safe-area-inset-bottom));\r\n}\r\n[data-sonner-toast] {\r\n --y: translateY(100%);\r\n --lift-amount: calc(var(--lift) * var(--gap));\r\n z-index: var(--z-index);\r\n position: absolute;\r\n opacity: 0;\r\n transform: var(--y);\r\n touch-action: none;\r\n will-change: transform, opacity, height;\r\n transition: transform 400ms, opacity 400ms, height 400ms, box-shadow 200ms;\r\n box-sizing: border-box;\r\n outline: none;\r\n overflow-wrap: anywhere;\r\n}\r\n[data-sonner-toast][data-styled=\"true\"] {\r\n padding: 16px;\r\n background: var(--normal-bg);\r\n border: 1px solid var(--normal-border);\r\n color: var(--normal-text);\r\n border-radius: var(--border-radius);\r\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);\r\n width: var(--width);\r\n font-size: 13px;\r\n display: flex;\r\n align-items: center;\r\n gap: 6px;\r\n}\r\n[data-sonner-toast]:focus-visible {\r\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(0, 0, 0, 0.2);\r\n}\r\n[data-sonner-toast][data-y-position=\"top\"] {\r\n top: 0;\r\n --y: translateY(-100%);\r\n --lift: 1;\r\n --lift-amount: calc(1 * var(--gap));\r\n}\r\n[data-sonner-toast][data-y-position=\"bottom\"] {\r\n bottom: 0;\r\n --y: translateY(100%);\r\n --lift: -1;\r\n --lift-amount: calc(var(--lift) * var(--gap));\r\n}\r\n[data-sonner-toast] [data-description] {\r\n font-weight: 400;\r\n line-height: 1.4;\r\n color: inherit;\r\n}\r\n[data-sonner-toast] [data-title] {\r\n font-weight: 500;\r\n line-height: 1.5;\r\n color: inherit;\r\n}\r\n[data-sonner-toast] [data-icon] {\r\n display: flex;\r\n height: 16px;\r\n width: 16px;\r\n position: relative;\r\n justify-content: flex-start;\r\n align-items: center;\r\n flex-shrink: 0;\r\n margin-left: var(--toast-icon-margin-start);\r\n margin-right: var(--toast-icon-margin-end);\r\n}\r\n[data-sonner-toast][data-promise=\"true\"] [data-icon] > svg {\r\n opacity: 0;\r\n transform: scale(0.8);\r\n transform-origin: center;\r\n animation: sonner-fade-in 300ms ease forwards;\r\n}\r\n[data-sonner-toast] [data-icon] > * {\r\n flex-shrink: 0;\r\n}\r\n[data-sonner-toast] [data-icon] svg {\r\n margin-left: var(--toast-svg-margin-start);\r\n margin-right: var(--toast-svg-margin-end);\r\n}\r\n[data-sonner-toast] [data-content] {\r\n display: flex;\r\n flex-direction: column;\r\n gap: 2px;\r\n}\r\n[data-sonner-toast] [data-button] {\r\n border-radius: 4px;\r\n padding-left: 8px;\r\n padding-right: 8px;\r\n height: 24px;\r\n font-size: 12px;\r\n color: var(--normal-bg);\r\n background: var(--normal-text);\r\n margin-left: var(--toast-button-margin-start);\r\n margin-right: var(--toast-button-margin-end);\r\n border: none;\r\n cursor: pointer;\r\n outline: none;\r\n display: flex;\r\n align-items: center;\r\n flex-shrink: 0;\r\n transition: opacity 400ms, box-shadow 200ms;\r\n}\r\n[data-sonner-toast] [data-button]:focus-visible {\r\n box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);\r\n}\r\n[data-sonner-toast] [data-button]:first-of-type {\r\n margin-left: var(--toast-button-margin-start);\r\n margin-right: var(--toast-button-margin-end);\r\n}\r\n[data-sonner-toast] [data-cancel] {\r\n color: var(--normal-text);\r\n background: rgba(0, 0, 0, 0.08);\r\n}\r\n[data-sonner-toast][data-theme=\"dark\"] [data-cancel] {\r\n background: rgba(255, 255, 255, 0.3);\r\n}\r\n[data-sonner-toast] [data-close-button] {\r\n position: absolute;\r\n left: var(--toast-close-button-start);\r\n right: var(--toast-close-button-end);\r\n top: 0;\r\n height: 20px;\r\n width: 20px;\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n padding: 0;\r\n background: var(--gray1);\r\n color: var(--gray12);\r\n border: 1px solid var(--gray4);\r\n transform: var(--toast-close-button-transform);\r\n border-radius: 50%;\r\n cursor: pointer;\r\n z-index: 1;\r\n transition: opacity 100ms, background 200ms, border-color 200ms;\r\n}\r\n[data-sonner-toast] [data-close-button]:focus-visible {\r\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(0, 0, 0, 0.2);\r\n}\r\n[data-sonner-toast] [data-disabled=\"true\"] {\r\n cursor: not-allowed;\r\n}\r\n[data-sonner-toast]:hover [data-close-button]:hover {\r\n background: var(--gray2);\r\n border-color: var(--gray5);\r\n}\r\n[data-sonner-toast][data-swiping=\"true\"]:before {\r\n content: \"\";\r\n position: absolute;\r\n left: 0;\r\n right: 0;\r\n height: 100%;\r\n z-index: -1;\r\n}\r\n[data-sonner-toast][data-y-position=\"top\"][data-swiping=\"true\"]:before {\r\n bottom: 50%;\r\n transform: scaleY(3) translateY(50%);\r\n}\r\n[data-sonner-toast][data-y-position=\"bottom\"][data-swiping=\"true\"]:before {\r\n top: 50%;\r\n transform: scaleY(3) translateY(-50%);\r\n}\r\n[data-sonner-toast][data-swiping=\"false\"][data-removed=\"true\"]:before {\r\n content: \"\";\r\n position: absolute;\r\n inset: 0;\r\n transform: scaleY(2);\r\n}\r\n[data-sonner-toast]:after {\r\n content: \"\";\r\n position: absolute;\r\n left: 0;\r\n height: calc(var(--gap) + 1px);\r\n bottom: 100%;\r\n width: 100%;\r\n}\r\n[data-sonner-toast][data-mounted=\"true\"] {\r\n --y: translateY(0);\r\n opacity: 1;\r\n}\r\n[data-sonner-toast][data-expanded=\"false\"][data-front=\"false\"] {\r\n --scale: var(--toasts-before) * 0.05 + 1;\r\n --y: translateY(calc(var(--lift-amount) * var(--toasts-before)))\r\n scale(calc(-1 * var(--scale)));\r\n height: var(--front-toast-height);\r\n}\r\n[data-sonner-toast] > * {\r\n transition: opacity 400ms;\r\n}\r\n[data-sonner-toast][data-expanded=\"false\"][data-front=\"false\"][data-styled=\"true\"]\r\n > * {\r\n opacity: 0;\r\n}\r\n[data-sonner-toast][data-visible=\"false\"] {\r\n opacity: 0;\r\n pointer-events: none;\r\n}\r\n[data-sonner-toast][data-mounted=\"true\"][data-expanded=\"true\"] {\r\n --y: translateY(calc(var(--lift) * var(--offset)));\r\n height: var(--initial-height);\r\n}\r\n[data-sonner-toast][data-removed=\"true\"][data-front=\"true\"][data-swipe-out=\"false\"] {\r\n --y: translateY(calc(var(--lift) * -100%));\r\n opacity: 0;\r\n}\r\n[data-sonner-toast][data-removed=\"true\"][data-front=\"false\"][data-swipe-out=\"false\"][data-expanded=\"true\"] {\r\n --y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));\r\n opacity: 0;\r\n}\r\n[data-sonner-toast][data-removed=\"true\"][data-front=\"false\"][data-swipe-out=\"false\"][data-expanded=\"false\"] {\r\n --y: translateY(40%);\r\n opacity: 0;\r\n transition: transform 500ms, opacity 200ms;\r\n}\r\n[data-sonner-toast][data-removed=\"true\"][data-front=\"false\"]:before {\r\n height: calc(var(--initial-height) + 20%);\r\n}\r\n[data-sonner-toast][data-swiping=\"true\"] {\r\n transform: var(--y) translateY(var(--swipe-amount, 0px));\r\n transition: none;\r\n}\r\n[data-sonner-toast][data-swipe-out=\"true\"][data-y-position=\"bottom\"],\r\n[data-sonner-toast][data-swipe-out=\"true\"][data-y-position=\"top\"] {\r\n animation: swipe-out 200ms ease-out forwards;\r\n}\r\n@keyframes swipe-out {\r\n from {\r\n transform: translateY(\r\n calc(var(--lift) * var(--offset) + var(--swipe-amount))\r\n );\r\n opacity: 1;\r\n }\r\n to {\r\n transform: translateY(\r\n calc(\r\n var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%\r\n )\r\n );\r\n opacity: 0;\r\n }\r\n}\r\n@media (max-width: 600px) {\r\n [data-sonner-toaster] {\r\n position: fixed;\r\n --mobile-offset: 16px;\r\n right: var(--mobile-offset);\r\n left: var(--mobile-offset);\r\n width: 100%;\r\n }\r\n [data-sonner-toaster] [data-sonner-toast] {\r\n left: 0;\r\n right: 0;\r\n width: calc(100% - 32px);\r\n }\r\n [data-sonner-toaster][data-x-position=\"left\"] {\r\n left: var(--mobile-offset);\r\n }\r\n [data-sonner-toaster][data-y-position=\"bottom\"] {\r\n bottom: 20px;\r\n }\r\n [data-sonner-toaster][data-y-position=\"top\"] {\r\n top: 20px;\r\n }\r\n [data-sonner-toaster][data-x-position=\"center\"] {\r\n left: var(--mobile-offset);\r\n right: var(--mobile-offset);\r\n transform: none;\r\n }\r\n}\r\n[data-sonner-toaster][data-theme=\"light\"] {\r\n --normal-bg: #fff;\r\n --normal-border: var(--gray4);\r\n --normal-text: var(--gray12);\r\n --success-bg: hsl(143, 85%, 96%);\r\n --success-border: hsl(145, 92%, 91%);\r\n --success-text: hsl(140, 100%, 27%);\r\n --info-bg: hsl(208, 100%, 97%);\r\n --info-border: hsl(221, 91%, 91%);\r\n --info-text: hsl(210, 92%, 45%);\r\n --warning-bg: hsl(49, 100%, 97%);\r\n --warning-border: hsl(49, 91%, 91%);\r\n --warning-text: hsl(31, 92%, 45%);\r\n --error-bg: hsl(359, 100%, 97%);\r\n --error-border: hsl(359, 100%, 94%);\r\n --error-text: hsl(360, 100%, 45%);\r\n}\r\n[data-sonner-toaster][data-theme=\"light\"]\r\n [data-sonner-toast][data-invert=\"true\"] {\r\n --normal-bg: #000;\r\n --normal-border: hsl(0, 0%, 20%);\r\n --normal-text: var(--gray1);\r\n}\r\n[data-sonner-toaster][data-theme=\"dark\"]\r\n [data-sonner-toast][data-invert=\"true\"] {\r\n --normal-bg: #fff;\r\n --normal-border: var(--gray3);\r\n --normal-text: var(--gray12);\r\n}\r\n[data-sonner-toaster][data-theme=\"dark\"] {\r\n --normal-bg: #000;\r\n --normal-border: hsl(0, 0%, 20%);\r\n --normal-text: var(--gray1);\r\n --success-bg: hsl(150, 100%, 6%);\r\n --success-border: hsl(147, 100%, 12%);\r\n --success-text: hsl(150, 86%, 65%);\r\n --info-bg: hsl(215, 100%, 6%);\r\n --info-border: hsl(223, 100%, 12%);\r\n --info-text: hsl(216, 87%, 65%);\r\n --warning-bg: hsl(64, 100%, 6%);\r\n --warning-border: hsl(60, 100%, 12%);\r\n --warning-text: hsl(46, 87%, 65%);\r\n --error-bg: hsl(358, 76%, 10%);\r\n --error-border: hsl(357, 89%, 16%);\r\n --error-text: hsl(358, 100%, 81%);\r\n}\r\n[data-rich-colors=\"true\"] [data-sonner-toast][data-type=\"success\"] {\r\n background: var(--success-bg);\r\n border-color: var(--success-border);\r\n color: var(--success-text);\r\n}\r\n[data-rich-colors=\"true\"]\r\n [data-sonner-toast][data-type=\"success\"]\r\n [data-close-button] {\r\n background: var(--success-bg);\r\n border-color: var(--success-border);\r\n color: var(--success-text);\r\n}\r\n[data-rich-colors=\"true\"] [data-sonner-toast][data-type=\"info\"] {\r\n background: var(--info-bg);\r\n border-color: var(--info-border);\r\n color: var(--info-text);\r\n}\r\n[data-rich-colors=\"true\"]\r\n [data-sonner-toast][data-type=\"info\"]\r\n [data-close-button] {\r\n background: var(--info-bg);\r\n border-color: var(--info-border);\r\n color: var(--info-text);\r\n}\r\n[data-rich-colors=\"true\"] [data-sonner-toast][data-type=\"warning\"] {\r\n background: var(--warning-bg);\r\n border-color: var(--warning-border);\r\n color: var(--warning-text);\r\n}\r\n[data-rich-colors=\"true\"]\r\n [data-sonner-toast][data-type=\"warning\"]\r\n [data-close-button] {\r\n background: var(--warning-bg);\r\n border-color: var(--warning-border);\r\n color: var(--warning-text);\r\n}\r\n[data-rich-colors=\"true\"] [data-sonner-toast][data-type=\"error\"] {\r\n background: var(--error-bg);\r\n border-color: var(--error-border);\r\n color: var(--error-text);\r\n}\r\n[data-rich-colors=\"true\"]\r\n [data-sonner-toast][data-type=\"error\"]\r\n [data-close-button] {\r\n background: var(--error-bg);\r\n border-color: var(--error-border);\r\n color: var(--error-text);\r\n}\r\n.sonner-loading-wrapper {\r\n --size: 16px;\r\n height: var(--size);\r\n width: var(--size);\r\n position: absolute;\r\n inset: 0;\r\n z-index: 10;\r\n}\r\n.sonner-loading-wrapper[data-visible=\"false\"] {\r\n transform-origin: center;\r\n animation: sonner-fade-out 0.2s ease forwards;\r\n}\r\n.sonner-spinner {\r\n position: relative;\r\n top: 50%;\r\n left: 50%;\r\n height: var(--size);\r\n width: var(--size);\r\n}\r\n.sonner-loading-bar {\r\n animation: sonner-spin 1.2s linear infinite;\r\n background: var(--gray11);\r\n border-radius: 6px;\r\n height: 8%;\r\n left: -10%;\r\n position: absolute;\r\n top: -3.9%;\r\n width: 24%;\r\n}\r\n.sonner-loading-bar:nth-child(1) {\r\n animation-delay: -1.2s;\r\n transform: rotate(0.0001deg) translate(146%);\r\n}\r\n.sonner-loading-bar:nth-child(2) {\r\n animation-delay: -1.1s;\r\n transform: rotate(30deg) translate(146%);\r\n}\r\n.sonner-loading-bar:nth-child(3) {\r\n animation-delay: -1s;\r\n transform: rotate(60deg) translate(146%);\r\n}\r\n.sonner-loading-bar:nth-child(4) {\r\n animation-delay: -0.9s;\r\n transform: rotate(90deg) translate(146%);\r\n}\r\n.sonner-loading-bar:nth-child(5) {\r\n animation-delay: -0.8s;\r\n transform: rotate(120deg) translate(146%);\r\n}\r\n.sonner-loading-bar:nth-child(6) {\r\n animation-delay: -0.7s;\r\n transform: rotate(150deg) translate(146%);\r\n}\r\n.sonner-loading-bar:nth-child(7) {\r\n animation-delay: -0.6s;\r\n transform: rotate(180deg) translate(146%);\r\n}\r\n.sonner-loading-bar:nth-child(8) {\r\n animation-delay: -0.5s;\r\n transform: rotate(210deg) translate(146%);\r\n}\r\n.sonner-loading-bar:nth-child(9) {\r\n animation-delay: -0.4s;\r\n transform: rotate(240deg) translate(146%);\r\n}\r\n.sonner-loading-bar:nth-child(10) {\r\n animation-delay: -0.3s;\r\n transform: rotate(270deg) translate(146%);\r\n}\r\n.sonner-loading-bar:nth-child(11) {\r\n animation-delay: -0.2s;\r\n transform: rotate(300deg) translate(146%);\r\n}\r\n.sonner-loading-bar:nth-child(12) {\r\n animation-delay: -0.1s;\r\n transform: rotate(330deg) translate(146%);\r\n}\r\n@keyframes sonner-fade-in {\r\n 0% {\r\n opacity: 0;\r\n transform: scale(0.8);\r\n }\r\n 100% {\r\n opacity: 1;\r\n transform: scale(1);\r\n }\r\n}\r\n@keyframes sonner-fade-out {\r\n 0% {\r\n opacity: 1;\r\n transform: scale(1);\r\n }\r\n 100% {\r\n opacity: 0;\r\n transform: scale(0.8);\r\n }\r\n}\r\n@keyframes sonner-spin {\r\n 0% {\r\n opacity: 1;\r\n }\r\n 100% {\r\n opacity: 0.15;\r\n }\r\n}\r\n@media (prefers-reduced-motion) {\r\n [data-sonner-toast],\r\n [data-sonner-toast] > *,\r\n .sonner-loading-bar {\r\n transition: none !important;\r\n animation: none !important;\r\n }\r\n}\r\n.sonner-loader {\r\n position: absolute;\r\n top: 50%;\r\n left: 50%;\r\n transform: translate(-50%, -50%);\r\n transform-origin: center;\r\n transition: opacity 200ms, transform 200ms;\r\n}\r\n.sonner-loader[data-visible=\"false\"] {\r\n opacity: 0;\r\n transform: scale(0.8) translate(-50%, -50%);\r\n}");}}catch(e){console.error('vite-plugin-css-injected-by-js', e);}
  26.  
  27. })();
  28. const sharedConfig = {
  29. context: undefined,
  30. registry: undefined,
  31. effects: undefined,
  32. done: false,
  33. getContextId() {
  34. return getContextId(this.context.count);
  35. },
  36. getNextContextId() {
  37. return getContextId(this.context.count++);
  38. }
  39. };
  40. function getContextId(count) {
  41. const num = String(count),
  42. len = num.length - 1;
  43. return sharedConfig.context.id + (len ? String.fromCharCode(96 + len) : "") + num;
  44. }
  45. function setHydrateContext(context) {
  46. sharedConfig.context = context;
  47. }
  48.  
  49. const IS_DEV = false;
  50. const equalFn = (a, b) => a === b;
  51. const $PROXY = Symbol("solid-proxy");
  52. const SUPPORTS_PROXY = typeof Proxy === "function";
  53. const $TRACK = Symbol("solid-track");
  54. const signalOptions = {
  55. equals: equalFn
  56. };
  57. let runEffects = runQueue;
  58. const STALE = 1;
  59. const PENDING = 2;
  60. const UNOWNED = {
  61. owned: null,
  62. cleanups: null,
  63. context: null,
  64. owner: null
  65. };
  66. const NO_INIT = {};
  67. var Owner = null;
  68. let Transition = null;
  69. let ExternalSourceConfig = null;
  70. let Listener = null;
  71. let Updates = null;
  72. let Effects = null;
  73. let ExecCount = 0;
  74. function createRoot(fn, detachedOwner) {
  75. const listener = Listener,
  76. owner = Owner,
  77. unowned = fn.length === 0,
  78. current = detachedOwner === undefined ? owner : detachedOwner,
  79. root = unowned
  80. ? UNOWNED
  81. : {
  82. owned: null,
  83. cleanups: null,
  84. context: current ? current.context : null,
  85. owner: current
  86. },
  87. updateFn = unowned ? fn : () => fn(() => untrack(() => cleanNode(root)));
  88. Owner = root;
  89. Listener = null;
  90. try {
  91. return runUpdates(updateFn, true);
  92. } finally {
  93. Listener = listener;
  94. Owner = owner;
  95. }
  96. }
  97. function createSignal(value, options) {
  98. options = options ? Object.assign({}, signalOptions, options) : signalOptions;
  99. const s = {
  100. value,
  101. observers: null,
  102. observerSlots: null,
  103. comparator: options.equals || undefined
  104. };
  105. const setter = value => {
  106. if (typeof value === "function") {
  107. value = value(s.value);
  108. }
  109. return writeSignal(s, value);
  110. };
  111. return [readSignal.bind(s), setter];
  112. }
  113. function createComputed(fn, value, options) {
  114. const c = createComputation(fn, value, true, STALE);
  115. updateComputation(c);
  116. }
  117. function createRenderEffect(fn, value, options) {
  118. const c = createComputation(fn, value, false, STALE);
  119. updateComputation(c);
  120. }
  121. function createEffect(fn, value, options) {
  122. runEffects = runUserEffects;
  123. const c = createComputation(fn, value, false, STALE),
  124. s = SuspenseContext && useContext(SuspenseContext);
  125. if (s) c.suspense = s;
  126. if (!options || !options.render) c.user = true;
  127. Effects ? Effects.push(c) : updateComputation(c);
  128. }
  129. function createMemo(fn, value, options) {
  130. options = options ? Object.assign({}, signalOptions, options) : signalOptions;
  131. const c = createComputation(fn, value, true, 0);
  132. c.observers = null;
  133. c.observerSlots = null;
  134. c.comparator = options.equals || undefined;
  135. updateComputation(c);
  136. return readSignal.bind(c);
  137. }
  138. function isPromise(v) {
  139. return v && typeof v === "object" && "then" in v;
  140. }
  141. function createResource(pSource, pFetcher, pOptions) {
  142. let source;
  143. let fetcher;
  144. let options;
  145. {
  146. source = true;
  147. fetcher = pSource;
  148. options = {};
  149. }
  150. let pr = null,
  151. initP = NO_INIT,
  152. id = null,
  153. scheduled = false,
  154. resolved = "initialValue" in options,
  155. dynamic = typeof source === "function" && createMemo(source);
  156. const contexts = new Set(),
  157. [value, setValue] = (options.storage || createSignal)(options.initialValue),
  158. [error, setError] = createSignal(undefined),
  159. [track, trigger] = createSignal(undefined, {
  160. equals: false
  161. }),
  162. [state, setState] = createSignal(resolved ? "ready" : "unresolved");
  163. if (sharedConfig.context) {
  164. id = sharedConfig.getNextContextId();
  165. if (options.ssrLoadFrom === "initial") initP = options.initialValue;
  166. else if (sharedConfig.load && sharedConfig.has(id)) initP = sharedConfig.load(id);
  167. }
  168. function loadEnd(p, v, error, key) {
  169. if (pr === p) {
  170. pr = null;
  171. key !== undefined && (resolved = true);
  172. if ((p === initP || v === initP) && options.onHydrated)
  173. queueMicrotask(() =>
  174. options.onHydrated(key, {
  175. value: v
  176. })
  177. );
  178. initP = NO_INIT;
  179. completeLoad(v, error);
  180. }
  181. return v;
  182. }
  183. function completeLoad(v, err) {
  184. runUpdates(() => {
  185. if (err === undefined) setValue(() => v);
  186. setState(err !== undefined ? "errored" : resolved ? "ready" : "unresolved");
  187. setError(err);
  188. for (const c of contexts.keys()) c.decrement();
  189. contexts.clear();
  190. }, false);
  191. }
  192. function read() {
  193. const c = SuspenseContext && useContext(SuspenseContext),
  194. v = value(),
  195. err = error();
  196. if (err !== undefined && !pr) throw err;
  197. if (Listener && !Listener.user && c) {
  198. createComputed(() => {
  199. track();
  200. if (pr) {
  201. if (c.resolved && Transition) ;
  202. else if (!contexts.has(c)) {
  203. c.increment();
  204. contexts.add(c);
  205. }
  206. }
  207. });
  208. }
  209. return v;
  210. }
  211. function load(refetching = true) {
  212. if (refetching !== false && scheduled) return;
  213. scheduled = false;
  214. const lookup = dynamic ? dynamic() : source;
  215. if (lookup == null || lookup === false) {
  216. loadEnd(pr, untrack(value));
  217. return;
  218. }
  219. const p =
  220. initP !== NO_INIT
  221. ? initP
  222. : untrack(() =>
  223. fetcher(lookup, {
  224. value: value(),
  225. refetching
  226. })
  227. );
  228. if (!isPromise(p)) {
  229. loadEnd(pr, p, undefined, lookup);
  230. return p;
  231. }
  232. pr = p;
  233. if ("value" in p) {
  234. if (p.status === "success") loadEnd(pr, p.value, undefined, lookup);
  235. else loadEnd(pr, undefined, castError(p.value), lookup);
  236. return p;
  237. }
  238. scheduled = true;
  239. queueMicrotask(() => (scheduled = false));
  240. runUpdates(() => {
  241. setState(resolved ? "refreshing" : "pending");
  242. trigger();
  243. }, false);
  244. return p.then(
  245. v => loadEnd(p, v, undefined, lookup),
  246. e => loadEnd(p, undefined, castError(e), lookup)
  247. );
  248. }
  249. Object.defineProperties(read, {
  250. state: {
  251. get: () => state()
  252. },
  253. error: {
  254. get: () => error()
  255. },
  256. loading: {
  257. get() {
  258. const s = state();
  259. return s === "pending" || s === "refreshing";
  260. }
  261. },
  262. latest: {
  263. get() {
  264. if (!resolved) return read();
  265. const err = error();
  266. if (err && !pr) throw err;
  267. return value();
  268. }
  269. }
  270. });
  271. if (dynamic) createComputed(() => load(false));
  272. else load(false);
  273. return [
  274. read,
  275. {
  276. refetch: load,
  277. mutate: setValue
  278. }
  279. ];
  280. }
  281. function batch(fn) {
  282. return runUpdates(fn, false);
  283. }
  284. function untrack(fn) {
  285. if (Listener === null) return fn();
  286. const listener = Listener;
  287. Listener = null;
  288. try {
  289. if (ExternalSourceConfig) ;
  290. return fn();
  291. } finally {
  292. Listener = listener;
  293. }
  294. }
  295. function on(deps, fn, options) {
  296. const isArray = Array.isArray(deps);
  297. let prevInput;
  298. return prevValue => {
  299. let input;
  300. if (isArray) {
  301. input = Array(deps.length);
  302. for (let i = 0; i < deps.length; i++) input[i] = deps[i]();
  303. } else input = deps();
  304. const result = untrack(() => fn(input, prevInput, prevValue));
  305. prevInput = input;
  306. return result;
  307. };
  308. }
  309. function onMount(fn) {
  310. createEffect(() => untrack(fn));
  311. }
  312. function onCleanup(fn) {
  313. if (Owner === null);
  314. else if (Owner.cleanups === null) Owner.cleanups = [fn];
  315. else Owner.cleanups.push(fn);
  316. return fn;
  317. }
  318. function getListener() {
  319. return Listener;
  320. }
  321. function getOwner() {
  322. return Owner;
  323. }
  324. function runWithOwner(o, fn) {
  325. const prev = Owner;
  326. const prevListener = Listener;
  327. Owner = o;
  328. Listener = null;
  329. try {
  330. return runUpdates(fn, true);
  331. } catch (err) {
  332. handleError(err);
  333. } finally {
  334. Owner = prev;
  335. Listener = prevListener;
  336. }
  337. }
  338. const [transPending, setTransPending] = /*@__PURE__*/ createSignal(false);
  339. function resumeEffects(e) {
  340. Effects.push.apply(Effects, e);
  341. e.length = 0;
  342. }
  343. function createContext(defaultValue, options) {
  344. const id = Symbol("context");
  345. return {
  346. id,
  347. Provider: createProvider(id),
  348. defaultValue
  349. };
  350. }
  351. function useContext(context) {
  352. let value;
  353. return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined
  354. ? value
  355. : context.defaultValue;
  356. }
  357. function children(fn) {
  358. const children = createMemo(fn);
  359. const memo = createMemo(() => resolveChildren(children()));
  360. memo.toArray = () => {
  361. const c = memo();
  362. return Array.isArray(c) ? c : c != null ? [c] : [];
  363. };
  364. return memo;
  365. }
  366. let SuspenseContext;
  367. function getSuspenseContext() {
  368. return SuspenseContext || (SuspenseContext = createContext());
  369. }
  370. function readSignal() {
  371. if (this.sources && (this.state)) {
  372. if ((this.state) === STALE) updateComputation(this);
  373. else {
  374. const updates = Updates;
  375. Updates = null;
  376. runUpdates(() => lookUpstream(this), false);
  377. Updates = updates;
  378. }
  379. }
  380. if (Listener) {
  381. const sSlot = this.observers ? this.observers.length : 0;
  382. if (!Listener.sources) {
  383. Listener.sources = [this];
  384. Listener.sourceSlots = [sSlot];
  385. } else {
  386. Listener.sources.push(this);
  387. Listener.sourceSlots.push(sSlot);
  388. }
  389. if (!this.observers) {
  390. this.observers = [Listener];
  391. this.observerSlots = [Listener.sources.length - 1];
  392. } else {
  393. this.observers.push(Listener);
  394. this.observerSlots.push(Listener.sources.length - 1);
  395. }
  396. }
  397. return this.value;
  398. }
  399. function writeSignal(node, value, isComp) {
  400. let current =
  401. node.value;
  402. if (!node.comparator || !node.comparator(current, value)) {
  403. node.value = value;
  404. if (node.observers && node.observers.length) {
  405. runUpdates(() => {
  406. for (let i = 0; i < node.observers.length; i += 1) {
  407. const o = node.observers[i];
  408. const TransitionRunning = Transition && Transition.running;
  409. if (TransitionRunning && Transition.disposed.has(o)) ;
  410. if (TransitionRunning ? !o.tState : !o.state) {
  411. if (o.pure) Updates.push(o);
  412. else Effects.push(o);
  413. if (o.observers) markDownstream(o);
  414. }
  415. if (!TransitionRunning) o.state = STALE;
  416. }
  417. if (Updates.length > 10e5) {
  418. Updates = [];
  419. if (IS_DEV);
  420. throw new Error();
  421. }
  422. }, false);
  423. }
  424. }
  425. return value;
  426. }
  427. function updateComputation(node) {
  428. if (!node.fn) return;
  429. cleanNode(node);
  430. const time = ExecCount;
  431. runComputation(
  432. node,
  433. node.value,
  434. time
  435. );
  436. }
  437. function runComputation(node, value, time) {
  438. let nextValue;
  439. const owner = Owner,
  440. listener = Listener;
  441. Listener = Owner = node;
  442. try {
  443. nextValue = node.fn(value);
  444. } catch (err) {
  445. if (node.pure) {
  446. {
  447. node.state = STALE;
  448. node.owned && node.owned.forEach(cleanNode);
  449. node.owned = null;
  450. }
  451. }
  452. node.updatedAt = time + 1;
  453. return handleError(err);
  454. } finally {
  455. Listener = listener;
  456. Owner = owner;
  457. }
  458. if (!node.updatedAt || node.updatedAt <= time) {
  459. if (node.updatedAt != null && "observers" in node) {
  460. writeSignal(node, nextValue);
  461. } else node.value = nextValue;
  462. node.updatedAt = time;
  463. }
  464. }
  465. function createComputation(fn, init, pure, state = STALE, options) {
  466. const c = {
  467. fn,
  468. state: state,
  469. updatedAt: null,
  470. owned: null,
  471. sources: null,
  472. sourceSlots: null,
  473. cleanups: null,
  474. value: init,
  475. owner: Owner,
  476. context: Owner ? Owner.context : null,
  477. pure
  478. };
  479. if (Owner === null);
  480. else if (Owner !== UNOWNED) {
  481. {
  482. if (!Owner.owned) Owner.owned = [c];
  483. else Owner.owned.push(c);
  484. }
  485. }
  486. return c;
  487. }
  488. function runTop(node) {
  489. if ((node.state) === 0) return;
  490. if ((node.state) === PENDING) return lookUpstream(node);
  491. if (node.suspense && untrack(node.suspense.inFallback)) return node.suspense.effects.push(node);
  492. const ancestors = [node];
  493. while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
  494. if (node.state) ancestors.push(node);
  495. }
  496. for (let i = ancestors.length - 1; i >= 0; i--) {
  497. node = ancestors[i];
  498. if ((node.state) === STALE) {
  499. updateComputation(node);
  500. } else if ((node.state) === PENDING) {
  501. const updates = Updates;
  502. Updates = null;
  503. runUpdates(() => lookUpstream(node, ancestors[0]), false);
  504. Updates = updates;
  505. }
  506. }
  507. }
  508. function runUpdates(fn, init) {
  509. if (Updates) return fn();
  510. let wait = false;
  511. if (!init) Updates = [];
  512. if (Effects) wait = true;
  513. else Effects = [];
  514. ExecCount++;
  515. try {
  516. const res = fn();
  517. completeUpdates(wait);
  518. return res;
  519. } catch (err) {
  520. if (!wait) Effects = null;
  521. Updates = null;
  522. handleError(err);
  523. }
  524. }
  525. function completeUpdates(wait) {
  526. if (Updates) {
  527. runQueue(Updates);
  528. Updates = null;
  529. }
  530. if (wait) return;
  531. const e = Effects;
  532. Effects = null;
  533. if (e.length) runUpdates(() => runEffects(e), false);
  534. }
  535. function runQueue(queue) {
  536. for (let i = 0; i < queue.length; i++) runTop(queue[i]);
  537. }
  538. function runUserEffects(queue) {
  539. let i,
  540. userLength = 0;
  541. for (i = 0; i < queue.length; i++) {
  542. const e = queue[i];
  543. if (!e.user) runTop(e);
  544. else queue[userLength++] = e;
  545. }
  546. if (sharedConfig.context) {
  547. if (sharedConfig.count) {
  548. sharedConfig.effects || (sharedConfig.effects = []);
  549. sharedConfig.effects.push(...queue.slice(0, userLength));
  550. return;
  551. }
  552. setHydrateContext();
  553. }
  554. if (sharedConfig.effects && (sharedConfig.done || !sharedConfig.count)) {
  555. queue = [...sharedConfig.effects, ...queue];
  556. userLength += sharedConfig.effects.length;
  557. delete sharedConfig.effects;
  558. }
  559. for (i = 0; i < userLength; i++) runTop(queue[i]);
  560. }
  561. function lookUpstream(node, ignore) {
  562. node.state = 0;
  563. for (let i = 0; i < node.sources.length; i += 1) {
  564. const source = node.sources[i];
  565. if (source.sources) {
  566. const state = source.state;
  567. if (state === STALE) {
  568. if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
  569. runTop(source);
  570. } else if (state === PENDING) lookUpstream(source, ignore);
  571. }
  572. }
  573. }
  574. function markDownstream(node) {
  575. for (let i = 0; i < node.observers.length; i += 1) {
  576. const o = node.observers[i];
  577. if (!o.state) {
  578. o.state = PENDING;
  579. if (o.pure) Updates.push(o);
  580. else Effects.push(o);
  581. o.observers && markDownstream(o);
  582. }
  583. }
  584. }
  585. function cleanNode(node) {
  586. let i;
  587. if (node.sources) {
  588. while (node.sources.length) {
  589. const source = node.sources.pop(),
  590. index = node.sourceSlots.pop(),
  591. obs = source.observers;
  592. if (obs && obs.length) {
  593. const n = obs.pop(),
  594. s = source.observerSlots.pop();
  595. if (index < obs.length) {
  596. n.sourceSlots[s] = index;
  597. obs[index] = n;
  598. source.observerSlots[index] = s;
  599. }
  600. }
  601. }
  602. }
  603. if (node.tOwned) {
  604. for (i = node.tOwned.length - 1; i >= 0; i--) cleanNode(node.tOwned[i]);
  605. delete node.tOwned;
  606. }
  607. if (node.owned) {
  608. for (i = node.owned.length - 1; i >= 0; i--) cleanNode(node.owned[i]);
  609. node.owned = null;
  610. }
  611. if (node.cleanups) {
  612. for (i = node.cleanups.length - 1; i >= 0; i--) node.cleanups[i]();
  613. node.cleanups = null;
  614. }
  615. node.state = 0;
  616. }
  617. function castError(err) {
  618. if (err instanceof Error) return err;
  619. return new Error(typeof err === "string" ? err : "Unknown error", {
  620. cause: err
  621. });
  622. }
  623. function handleError(err, owner = Owner) {
  624. const error = castError(err);
  625. throw error;
  626. }
  627. function resolveChildren(children) {
  628. if (typeof children === "function" && !children.length) return resolveChildren(children());
  629. if (Array.isArray(children)) {
  630. const results = [];
  631. for (let i = 0; i < children.length; i++) {
  632. const result = resolveChildren(children[i]);
  633. Array.isArray(result) ? results.push.apply(results, result) : results.push(result);
  634. }
  635. return results;
  636. }
  637. return children;
  638. }
  639. function createProvider(id, options) {
  640. return function provider(props) {
  641. let res;
  642. createRenderEffect(
  643. () =>
  644. (res = untrack(() => {
  645. Owner.context = {
  646. ...Owner.context,
  647. [id]: props.value
  648. };
  649. return children(() => props.children);
  650. })),
  651. undefined
  652. );
  653. return res;
  654. };
  655. }
  656.  
  657. const FALLBACK = Symbol("fallback");
  658. function dispose(d) {
  659. for (let i = 0; i < d.length; i++) d[i]();
  660. }
  661. function mapArray(list, mapFn, options = {}) {
  662. let items = [],
  663. mapped = [],
  664. disposers = [],
  665. len = 0,
  666. indexes = mapFn.length > 1 ? [] : null;
  667. onCleanup(() => dispose(disposers));
  668. return () => {
  669. let newItems = list() || [],
  670. newLen = newItems.length,
  671. i,
  672. j;
  673. newItems[$TRACK];
  674. return untrack(() => {
  675. let newIndices, newIndicesNext, temp, tempdisposers, tempIndexes, start, end, newEnd, item;
  676. if (newLen === 0) {
  677. if (len !== 0) {
  678. dispose(disposers);
  679. disposers = [];
  680. items = [];
  681. mapped = [];
  682. len = 0;
  683. indexes && (indexes = []);
  684. }
  685. if (options.fallback) {
  686. items = [FALLBACK];
  687. mapped[0] = createRoot(disposer => {
  688. disposers[0] = disposer;
  689. return options.fallback();
  690. });
  691. len = 1;
  692. }
  693. } else if (len === 0) {
  694. mapped = new Array(newLen);
  695. for (j = 0; j < newLen; j++) {
  696. items[j] = newItems[j];
  697. mapped[j] = createRoot(mapper);
  698. }
  699. len = newLen;
  700. } else {
  701. temp = new Array(newLen);
  702. tempdisposers = new Array(newLen);
  703. indexes && (tempIndexes = new Array(newLen));
  704. for (
  705. start = 0, end = Math.min(len, newLen);
  706. start < end && items[start] === newItems[start];
  707. start++
  708. );
  709. for (
  710. end = len - 1, newEnd = newLen - 1;
  711. end >= start && newEnd >= start && items[end] === newItems[newEnd];
  712. end--, newEnd--
  713. ) {
  714. temp[newEnd] = mapped[end];
  715. tempdisposers[newEnd] = disposers[end];
  716. indexes && (tempIndexes[newEnd] = indexes[end]);
  717. }
  718. newIndices = new Map();
  719. newIndicesNext = new Array(newEnd + 1);
  720. for (j = newEnd; j >= start; j--) {
  721. item = newItems[j];
  722. i = newIndices.get(item);
  723. newIndicesNext[j] = i === undefined ? -1 : i;
  724. newIndices.set(item, j);
  725. }
  726. for (i = start; i <= end; i++) {
  727. item = items[i];
  728. j = newIndices.get(item);
  729. if (j !== undefined && j !== -1) {
  730. temp[j] = mapped[i];
  731. tempdisposers[j] = disposers[i];
  732. indexes && (tempIndexes[j] = indexes[i]);
  733. j = newIndicesNext[j];
  734. newIndices.set(item, j);
  735. } else disposers[i]();
  736. }
  737. for (j = start; j < newLen; j++) {
  738. if (j in temp) {
  739. mapped[j] = temp[j];
  740. disposers[j] = tempdisposers[j];
  741. if (indexes) {
  742. indexes[j] = tempIndexes[j];
  743. indexes[j](j);
  744. }
  745. } else mapped[j] = createRoot(mapper);
  746. }
  747. mapped = mapped.slice(0, (len = newLen));
  748. items = newItems.slice(0);
  749. }
  750. return mapped;
  751. });
  752. function mapper(disposer) {
  753. disposers[j] = disposer;
  754. if (indexes) {
  755. const [s, set] = createSignal(j);
  756. indexes[j] = set;
  757. return mapFn(newItems[j], s);
  758. }
  759. return mapFn(newItems[j]);
  760. }
  761. };
  762. }
  763. function createComponent(Comp, props) {
  764. return untrack(() => Comp(props || {}));
  765. }
  766. function trueFn() {
  767. return true;
  768. }
  769. const propTraps = {
  770. get(_, property, receiver) {
  771. if (property === $PROXY) return receiver;
  772. return _.get(property);
  773. },
  774. has(_, property) {
  775. if (property === $PROXY) return true;
  776. return _.has(property);
  777. },
  778. set: trueFn,
  779. deleteProperty: trueFn,
  780. getOwnPropertyDescriptor(_, property) {
  781. return {
  782. configurable: true,
  783. enumerable: true,
  784. get() {
  785. return _.get(property);
  786. },
  787. set: trueFn,
  788. deleteProperty: trueFn
  789. };
  790. },
  791. ownKeys(_) {
  792. return _.keys();
  793. }
  794. };
  795. function resolveSource(s) {
  796. return !(s = typeof s === "function" ? s() : s) ? {} : s;
  797. }
  798. function resolveSources() {
  799. for (let i = 0, length = this.length; i < length; ++i) {
  800. const v = this[i]();
  801. if (v !== undefined) return v;
  802. }
  803. }
  804. function mergeProps(...sources) {
  805. let proxy = false;
  806. for (let i = 0; i < sources.length; i++) {
  807. const s = sources[i];
  808. proxy = proxy || (!!s && $PROXY in s);
  809. sources[i] = typeof s === "function" ? ((proxy = true), createMemo(s)) : s;
  810. }
  811. if (SUPPORTS_PROXY && proxy) {
  812. return new Proxy(
  813. {
  814. get(property) {
  815. for (let i = sources.length - 1; i >= 0; i--) {
  816. const v = resolveSource(sources[i])[property];
  817. if (v !== undefined) return v;
  818. }
  819. },
  820. has(property) {
  821. for (let i = sources.length - 1; i >= 0; i--) {
  822. if (property in resolveSource(sources[i])) return true;
  823. }
  824. return false;
  825. },
  826. keys() {
  827. const keys = [];
  828. for (let i = 0; i < sources.length; i++)
  829. keys.push(...Object.keys(resolveSource(sources[i])));
  830. return [...new Set(keys)];
  831. }
  832. },
  833. propTraps
  834. );
  835. }
  836. const sourcesMap = {};
  837. const defined = Object.create(null);
  838. for (let i = sources.length - 1; i >= 0; i--) {
  839. const source = sources[i];
  840. if (!source) continue;
  841. const sourceKeys = Object.getOwnPropertyNames(source);
  842. for (let i = sourceKeys.length - 1; i >= 0; i--) {
  843. const key = sourceKeys[i];
  844. if (key === "__proto__" || key === "constructor") continue;
  845. const desc = Object.getOwnPropertyDescriptor(source, key);
  846. if (!defined[key]) {
  847. defined[key] = desc.get
  848. ? {
  849. enumerable: true,
  850. configurable: true,
  851. get: resolveSources.bind((sourcesMap[key] = [desc.get.bind(source)]))
  852. }
  853. : desc.value !== undefined
  854. ? desc
  855. : undefined;
  856. } else {
  857. const sources = sourcesMap[key];
  858. if (sources) {
  859. if (desc.get) sources.push(desc.get.bind(source));
  860. else if (desc.value !== undefined) sources.push(() => desc.value);
  861. }
  862. }
  863. }
  864. }
  865. const target = {};
  866. const definedKeys = Object.keys(defined);
  867. for (let i = definedKeys.length - 1; i >= 0; i--) {
  868. const key = definedKeys[i],
  869. desc = defined[key];
  870. if (desc && desc.get) Object.defineProperty(target, key, desc);
  871. else target[key] = desc ? desc.value : undefined;
  872. }
  873. return target;
  874. }
  875.  
  876. const narrowedError = name => `Stale read from <${name}>.`;
  877. function For(props) {
  878. const fallback = "fallback" in props && {
  879. fallback: () => props.fallback
  880. };
  881. return createMemo(mapArray(() => props.each, props.children, fallback || undefined));
  882. }
  883. function Show(props) {
  884. const keyed = props.keyed;
  885. const conditionValue = createMemo(() => props.when, undefined, undefined);
  886. const condition = keyed
  887. ? conditionValue
  888. : createMemo(conditionValue, undefined, {
  889. equals: (a, b) => !a === !b
  890. });
  891. return createMemo(
  892. () => {
  893. const c = condition();
  894. if (c) {
  895. const child = props.children;
  896. const fn = typeof child === "function" && child.length > 0;
  897. return fn
  898. ? untrack(() =>
  899. child(
  900. keyed
  901. ? c
  902. : () => {
  903. if (!untrack(condition)) throw narrowedError("Show");
  904. return conditionValue();
  905. }
  906. )
  907. )
  908. : child;
  909. }
  910. return props.fallback;
  911. },
  912. undefined,
  913. undefined
  914. );
  915. }
  916. function Switch(props) {
  917. const chs = children(() => props.children);
  918. const switchFunc = createMemo(() => {
  919. const ch = chs();
  920. const mps = Array.isArray(ch) ? ch : [ch];
  921. let func = () => undefined;
  922. for (let i = 0; i < mps.length; i++) {
  923. const index = i;
  924. const mp = mps[i];
  925. const prevFunc = func;
  926. const conditionValue = createMemo(
  927. () => (prevFunc() ? undefined : mp.when),
  928. undefined,
  929. undefined
  930. );
  931. const condition = mp.keyed
  932. ? conditionValue
  933. : createMemo(conditionValue, undefined, {
  934. equals: (a, b) => !a === !b
  935. });
  936. func = () => prevFunc() || (condition() ? [index, conditionValue, mp] : undefined);
  937. }
  938. return func;
  939. });
  940. return createMemo(
  941. () => {
  942. const sel = switchFunc()();
  943. if (!sel) return props.fallback;
  944. const [index, conditionValue, mp] = sel;
  945. const child = mp.children;
  946. const fn = typeof child === "function" && child.length > 0;
  947. return fn
  948. ? untrack(() =>
  949. child(
  950. mp.keyed
  951. ? conditionValue()
  952. : () => {
  953. if (untrack(switchFunc)()?.[0] !== index) throw narrowedError("Match");
  954. return conditionValue();
  955. }
  956. )
  957. )
  958. : child;
  959. },
  960. undefined,
  961. undefined
  962. );
  963. }
  964. function Match(props) {
  965. return props;
  966. }
  967. const SuspenseListContext = /* #__PURE__ */ createContext();
  968. function Suspense(props) {
  969. let counter = 0,
  970. show,
  971. ctx,
  972. p,
  973. flicker,
  974. error;
  975. const [inFallback, setFallback] = createSignal(false),
  976. SuspenseContext = getSuspenseContext(),
  977. store = {
  978. increment: () => {
  979. if (++counter === 1) setFallback(true);
  980. },
  981. decrement: () => {
  982. if (--counter === 0) setFallback(false);
  983. },
  984. inFallback,
  985. effects: [],
  986. resolved: false
  987. },
  988. owner = getOwner();
  989. if (sharedConfig.context && sharedConfig.load) {
  990. const key = sharedConfig.getContextId();
  991. let ref = sharedConfig.load(key);
  992. if (ref) {
  993. if (typeof ref !== "object" || ref.status !== "success") p = ref;
  994. else sharedConfig.gather(key);
  995. }
  996. if (p && p !== "$$f") {
  997. const [s, set] = createSignal(undefined, {
  998. equals: false
  999. });
  1000. flicker = s;
  1001. p.then(
  1002. () => {
  1003. if (sharedConfig.done) return set();
  1004. sharedConfig.gather(key);
  1005. setHydrateContext(ctx);
  1006. set();
  1007. setHydrateContext();
  1008. },
  1009. err => {
  1010. error = err;
  1011. set();
  1012. }
  1013. );
  1014. }
  1015. }
  1016. const listContext = useContext(SuspenseListContext);
  1017. if (listContext) show = listContext.register(store.inFallback);
  1018. let dispose;
  1019. onCleanup(() => dispose && dispose());
  1020. return createComponent(SuspenseContext.Provider, {
  1021. value: store,
  1022. get children() {
  1023. return createMemo(() => {
  1024. if (error) throw error;
  1025. ctx = sharedConfig.context;
  1026. if (flicker) {
  1027. flicker();
  1028. return (flicker = undefined);
  1029. }
  1030. if (ctx && p === "$$f") setHydrateContext();
  1031. const rendered = createMemo(() => props.children);
  1032. return createMemo(prev => {
  1033. const inFallback = store.inFallback(),
  1034. { showContent = true, showFallback = true } = show ? show() : {};
  1035. if ((!inFallback || (p && p !== "$$f")) && showContent) {
  1036. store.resolved = true;
  1037. dispose && dispose();
  1038. dispose = ctx = p = undefined;
  1039. resumeEffects(store.effects);
  1040. return rendered();
  1041. }
  1042. if (!showFallback) return;
  1043. if (dispose) return prev;
  1044. return createRoot(disposer => {
  1045. dispose = disposer;
  1046. if (ctx) {
  1047. setHydrateContext({
  1048. id: ctx.id + "F",
  1049. count: 0
  1050. });
  1051. ctx = undefined;
  1052. }
  1053. return props.fallback;
  1054. }, owner);
  1055. });
  1056. });
  1057. }
  1058. });
  1059. }
  1060.  
  1061. const booleans = [
  1062. "allowfullscreen",
  1063. "async",
  1064. "autofocus",
  1065. "autoplay",
  1066. "checked",
  1067. "controls",
  1068. "default",
  1069. "disabled",
  1070. "formnovalidate",
  1071. "hidden",
  1072. "indeterminate",
  1073. "inert",
  1074. "ismap",
  1075. "loop",
  1076. "multiple",
  1077. "muted",
  1078. "nomodule",
  1079. "novalidate",
  1080. "open",
  1081. "playsinline",
  1082. "readonly",
  1083. "required",
  1084. "reversed",
  1085. "seamless",
  1086. "selected"
  1087. ];
  1088. const Properties = /*#__PURE__*/ new Set([
  1089. "className",
  1090. "value",
  1091. "readOnly",
  1092. "formNoValidate",
  1093. "isMap",
  1094. "noModule",
  1095. "playsInline",
  1096. ...booleans
  1097. ]);
  1098. const ChildProperties = /*#__PURE__*/ new Set([
  1099. "innerHTML",
  1100. "textContent",
  1101. "innerText",
  1102. "children"
  1103. ]);
  1104. const Aliases = /*#__PURE__*/ Object.assign(Object.create(null), {
  1105. className: "class",
  1106. htmlFor: "for"
  1107. });
  1108. const PropAliases = /*#__PURE__*/ Object.assign(Object.create(null), {
  1109. class: "className",
  1110. formnovalidate: {
  1111. $: "formNoValidate",
  1112. BUTTON: 1,
  1113. INPUT: 1
  1114. },
  1115. ismap: {
  1116. $: "isMap",
  1117. IMG: 1
  1118. },
  1119. nomodule: {
  1120. $: "noModule",
  1121. SCRIPT: 1
  1122. },
  1123. playsinline: {
  1124. $: "playsInline",
  1125. VIDEO: 1
  1126. },
  1127. readonly: {
  1128. $: "readOnly",
  1129. INPUT: 1,
  1130. TEXTAREA: 1
  1131. }
  1132. });
  1133. function getPropAlias(prop, tagName) {
  1134. const a = PropAliases[prop];
  1135. return typeof a === "object" ? (a[tagName] ? a["$"] : undefined) : a;
  1136. }
  1137. const DelegatedEvents = /*#__PURE__*/ new Set([
  1138. "beforeinput",
  1139. "click",
  1140. "dblclick",
  1141. "contextmenu",
  1142. "focusin",
  1143. "focusout",
  1144. "input",
  1145. "keydown",
  1146. "keyup",
  1147. "mousedown",
  1148. "mousemove",
  1149. "mouseout",
  1150. "mouseover",
  1151. "mouseup",
  1152. "pointerdown",
  1153. "pointermove",
  1154. "pointerout",
  1155. "pointerover",
  1156. "pointerup",
  1157. "touchend",
  1158. "touchmove",
  1159. "touchstart"
  1160. ]);
  1161.  
  1162. function reconcileArrays(parentNode, a, b) {
  1163. let bLength = b.length,
  1164. aEnd = a.length,
  1165. bEnd = bLength,
  1166. aStart = 0,
  1167. bStart = 0,
  1168. after = a[aEnd - 1].nextSibling,
  1169. map = null;
  1170. while (aStart < aEnd || bStart < bEnd) {
  1171. if (a[aStart] === b[bStart]) {
  1172. aStart++;
  1173. bStart++;
  1174. continue;
  1175. }
  1176. while (a[aEnd - 1] === b[bEnd - 1]) {
  1177. aEnd--;
  1178. bEnd--;
  1179. }
  1180. if (aEnd === aStart) {
  1181. const node = bEnd < bLength ? (bStart ? b[bStart - 1].nextSibling : b[bEnd - bStart]) : after;
  1182. while (bStart < bEnd) parentNode.insertBefore(b[bStart++], node);
  1183. } else if (bEnd === bStart) {
  1184. while (aStart < aEnd) {
  1185. if (!map || !map.has(a[aStart])) a[aStart].remove();
  1186. aStart++;
  1187. }
  1188. } else if (a[aStart] === b[bEnd - 1] && b[bStart] === a[aEnd - 1]) {
  1189. const node = a[--aEnd].nextSibling;
  1190. parentNode.insertBefore(b[bStart++], a[aStart++].nextSibling);
  1191. parentNode.insertBefore(b[--bEnd], node);
  1192. a[aEnd] = b[bEnd];
  1193. } else {
  1194. if (!map) {
  1195. map = new Map();
  1196. let i = bStart;
  1197. while (i < bEnd) map.set(b[i], i++);
  1198. }
  1199. const index = map.get(a[aStart]);
  1200. if (index != null) {
  1201. if (bStart < index && index < bEnd) {
  1202. let i = aStart,
  1203. sequence = 1,
  1204. t;
  1205. while (++i < aEnd && i < bEnd) {
  1206. if ((t = map.get(a[i])) == null || t !== index + sequence) break;
  1207. sequence++;
  1208. }
  1209. if (sequence > index - bStart) {
  1210. const node = a[aStart];
  1211. while (bStart < index) parentNode.insertBefore(b[bStart++], node);
  1212. } else parentNode.replaceChild(b[bStart++], a[aStart++]);
  1213. } else aStart++;
  1214. } else a[aStart++].remove();
  1215. }
  1216. }
  1217. }
  1218.  
  1219. const $$EVENTS = "_$DX_DELEGATE";
  1220. function render(code, element, init, options = {}) {
  1221. let disposer;
  1222. createRoot(dispose => {
  1223. disposer = dispose;
  1224. element === document
  1225. ? code()
  1226. : insert(element, code(), element.firstChild ? null : undefined, init);
  1227. }, options.owner);
  1228. return () => {
  1229. disposer();
  1230. element.textContent = "";
  1231. };
  1232. }
  1233. function template(html, isImportNode, isSVG, isMathML) {
  1234. let node;
  1235. const create = () => {
  1236. const t = document.createElement("template");
  1237. t.innerHTML = html;
  1238. return t.content.firstChild;
  1239. };
  1240. const fn = () => (node || (node = create())).cloneNode(true);
  1241. fn.cloneNode = fn;
  1242. return fn;
  1243. }
  1244. function delegateEvents(eventNames, document = window.document) {
  1245. const e = document[$$EVENTS] || (document[$$EVENTS] = new Set());
  1246. for (let i = 0, l = eventNames.length; i < l; i++) {
  1247. const name = eventNames[i];
  1248. if (!e.has(name)) {
  1249. e.add(name);
  1250. document.addEventListener(name, eventHandler);
  1251. }
  1252. }
  1253. }
  1254. function setAttribute(node, name, value) {
  1255. if (isHydrating(node)) return;
  1256. if (value == null) node.removeAttribute(name);
  1257. else node.setAttribute(name, value);
  1258. }
  1259. function setBoolAttribute(node, name, value) {
  1260. if (isHydrating(node)) return;
  1261. value ? node.setAttribute(name, "") : node.removeAttribute(name);
  1262. }
  1263. function className(node, value) {
  1264. if (isHydrating(node)) return;
  1265. if (value == null) node.removeAttribute("class");
  1266. else node.className = value;
  1267. }
  1268. function addEventListener(node, name, handler, delegate) {
  1269. if (delegate) {
  1270. if (Array.isArray(handler)) {
  1271. node[`$$${name}`] = handler[0];
  1272. node[`$$${name}Data`] = handler[1];
  1273. } else node[`$$${name}`] = handler;
  1274. } else if (Array.isArray(handler)) {
  1275. const handlerFn = handler[0];
  1276. node.addEventListener(name, (handler[0] = e => handlerFn.call(node, handler[1], e)));
  1277. } else node.addEventListener(name, handler, typeof handler !== "function" && handler);
  1278. }
  1279. function classList(node, value, prev = {}) {
  1280. const classKeys = Object.keys(value || {}),
  1281. prevKeys = Object.keys(prev);
  1282. let i, len;
  1283. for (i = 0, len = prevKeys.length; i < len; i++) {
  1284. const key = prevKeys[i];
  1285. if (!key || key === "undefined" || value[key]) continue;
  1286. toggleClassKey(node, key, false);
  1287. delete prev[key];
  1288. }
  1289. for (i = 0, len = classKeys.length; i < len; i++) {
  1290. const key = classKeys[i],
  1291. classValue = !!value[key];
  1292. if (!key || key === "undefined" || prev[key] === classValue || !classValue) continue;
  1293. toggleClassKey(node, key, true);
  1294. prev[key] = classValue;
  1295. }
  1296. return prev;
  1297. }
  1298. function style(node, value, prev) {
  1299. if (!value) return prev ? setAttribute(node, "style") : value;
  1300. const nodeStyle = node.style;
  1301. if (typeof value === "string") return (nodeStyle.cssText = value);
  1302. typeof prev === "string" && (nodeStyle.cssText = prev = undefined);
  1303. prev || (prev = {});
  1304. value || (value = {});
  1305. let v, s;
  1306. for (s in prev) {
  1307. value[s] == null && nodeStyle.removeProperty(s);
  1308. delete prev[s];
  1309. }
  1310. for (s in value) {
  1311. v = value[s];
  1312. if (v !== prev[s]) {
  1313. nodeStyle.setProperty(s, v);
  1314. prev[s] = v;
  1315. }
  1316. }
  1317. return prev;
  1318. }
  1319. function spread(node, props = {}, isSVG, skipChildren) {
  1320. const prevProps = {};
  1321. {
  1322. createRenderEffect(
  1323. () => (prevProps.children = insertExpression(node, props.children, prevProps.children))
  1324. );
  1325. }
  1326. createRenderEffect(() => typeof props.ref === "function" && use(props.ref, node));
  1327. createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
  1328. return prevProps;
  1329. }
  1330. function use(fn, element, arg) {
  1331. return untrack(() => fn(element, arg));
  1332. }
  1333. function insert(parent, accessor, marker, initial) {
  1334. if (marker !== undefined && !initial) initial = [];
  1335. if (typeof accessor !== "function") return insertExpression(parent, accessor, initial, marker);
  1336. createRenderEffect(current => insertExpression(parent, accessor(), current, marker), initial);
  1337. }
  1338. function assign(node, props, isSVG, skipChildren, prevProps = {}, skipRef = false) {
  1339. props || (props = {});
  1340. for (const prop in prevProps) {
  1341. if (!(prop in props)) {
  1342. if (prop === "children") continue;
  1343. prevProps[prop] = assignProp(node, prop, null, prevProps[prop], isSVG, skipRef, props);
  1344. }
  1345. }
  1346. for (const prop in props) {
  1347. if (prop === "children") {
  1348. continue;
  1349. }
  1350. const value = props[prop];
  1351. prevProps[prop] = assignProp(node, prop, value, prevProps[prop], isSVG, skipRef, props);
  1352. }
  1353. }
  1354. function isHydrating(node) {
  1355. return !!sharedConfig.context && !sharedConfig.done && (!node || node.isConnected);
  1356. }
  1357. function toPropertyName(name) {
  1358. return name.toLowerCase().replace(/-([a-z])/g, (_, w) => w.toUpperCase());
  1359. }
  1360. function toggleClassKey(node, key, value) {
  1361. const classNames = key.trim().split(/\s+/);
  1362. for (let i = 0, nameLen = classNames.length; i < nameLen; i++)
  1363. node.classList.toggle(classNames[i], value);
  1364. }
  1365. function assignProp(node, prop, value, prev, isSVG, skipRef, props) {
  1366. let isCE, isProp, isChildProp, propAlias, forceProp;
  1367. if (prop === "style") return style(node, value, prev);
  1368. if (prop === "classList") return classList(node, value, prev);
  1369. if (value === prev) return prev;
  1370. if (prop === "ref") {
  1371. if (!skipRef) value(node);
  1372. } else if (prop.slice(0, 3) === "on:") {
  1373. const e = prop.slice(3);
  1374. prev && node.removeEventListener(e, prev, typeof prev !== "function" && prev);
  1375. value && node.addEventListener(e, value, typeof value !== "function" && value);
  1376. } else if (prop.slice(0, 10) === "oncapture:") {
  1377. const e = prop.slice(10);
  1378. prev && node.removeEventListener(e, prev, true);
  1379. value && node.addEventListener(e, value, true);
  1380. } else if (prop.slice(0, 2) === "on") {
  1381. const name = prop.slice(2).toLowerCase();
  1382. const delegate = DelegatedEvents.has(name);
  1383. if (!delegate && prev) {
  1384. const h = Array.isArray(prev) ? prev[0] : prev;
  1385. node.removeEventListener(name, h);
  1386. }
  1387. if (delegate || value) {
  1388. addEventListener(node, name, value, delegate);
  1389. delegate && delegateEvents([name]);
  1390. }
  1391. } else if (prop.slice(0, 5) === "attr:") {
  1392. setAttribute(node, prop.slice(5), value);
  1393. } else if (prop.slice(0, 5) === "bool:") {
  1394. setBoolAttribute(node, prop.slice(5), value);
  1395. } else if (
  1396. (forceProp = prop.slice(0, 5) === "prop:") ||
  1397. (isChildProp = ChildProperties.has(prop)) ||
  1398. (((propAlias = getPropAlias(prop, node.tagName)) || (isProp = Properties.has(prop)))) ||
  1399. (isCE = node.nodeName.includes("-") || "is" in props)
  1400. ) {
  1401. if (forceProp) {
  1402. prop = prop.slice(5);
  1403. isProp = true;
  1404. } else if (isHydrating(node)) return value;
  1405. if (prop === "class" || prop === "className") className(node, value);
  1406. else if (isCE && !isProp && !isChildProp) node[toPropertyName(prop)] = value;
  1407. else node[propAlias || prop] = value;
  1408. } else {
  1409. setAttribute(node, Aliases[prop] || prop, value);
  1410. }
  1411. return value;
  1412. }
  1413. function eventHandler(e) {
  1414. if (sharedConfig.registry && sharedConfig.events) {
  1415. if (sharedConfig.events.find(([el, ev]) => ev === e)) return;
  1416. }
  1417. let node = e.target;
  1418. const key = `$$${e.type}`;
  1419. const oriTarget = e.target;
  1420. const oriCurrentTarget = e.currentTarget;
  1421. const retarget = value =>
  1422. Object.defineProperty(e, "target", {
  1423. configurable: true,
  1424. value
  1425. });
  1426. const handleNode = () => {
  1427. const handler = node[key];
  1428. if (handler && !node.disabled) {
  1429. const data = node[`${key}Data`];
  1430. data !== undefined ? handler.call(node, data, e) : handler.call(node, e);
  1431. if (e.cancelBubble) return;
  1432. }
  1433. node.host &&
  1434. typeof node.host !== "string" &&
  1435. !node.host._$host &&
  1436. node.contains(e.target) &&
  1437. retarget(node.host);
  1438. return true;
  1439. };
  1440. const walkUpTree = () => {
  1441. while (handleNode() && (node = node._$host || node.parentNode || node.host));
  1442. };
  1443. Object.defineProperty(e, "currentTarget", {
  1444. configurable: true,
  1445. get() {
  1446. return node || document;
  1447. }
  1448. });
  1449. if (sharedConfig.registry && !sharedConfig.done) sharedConfig.done = _$HY.done = true;
  1450. if (e.composedPath) {
  1451. const path = e.composedPath();
  1452. retarget(path[0]);
  1453. for (let i = 0; i < path.length - 2; i++) {
  1454. node = path[i];
  1455. if (!handleNode()) break;
  1456. if (node._$host) {
  1457. node = node._$host;
  1458. walkUpTree();
  1459. break;
  1460. }
  1461. if (node.parentNode === oriCurrentTarget) {
  1462. break;
  1463. }
  1464. }
  1465. } else walkUpTree();
  1466. retarget(oriTarget);
  1467. }
  1468. function insertExpression(parent, value, current, marker, unwrapArray) {
  1469. const hydrating = isHydrating(parent);
  1470. if (hydrating) {
  1471. !current && (current = [...parent.childNodes]);
  1472. let cleaned = [];
  1473. for (let i = 0; i < current.length; i++) {
  1474. const node = current[i];
  1475. if (node.nodeType === 8 && node.data.slice(0, 2) === "!$") node.remove();
  1476. else cleaned.push(node);
  1477. }
  1478. current = cleaned;
  1479. }
  1480. while (typeof current === "function") current = current();
  1481. if (value === current) return current;
  1482. const t = typeof value,
  1483. multi = marker !== undefined;
  1484. parent = (multi && current[0] && current[0].parentNode) || parent;
  1485. if (t === "string" || t === "number") {
  1486. if (hydrating) return current;
  1487. if (t === "number") {
  1488. value = value.toString();
  1489. if (value === current) return current;
  1490. }
  1491. if (multi) {
  1492. let node = current[0];
  1493. if (node && node.nodeType === 3) {
  1494. node.data !== value && (node.data = value);
  1495. } else node = document.createTextNode(value);
  1496. current = cleanChildren(parent, current, marker, node);
  1497. } else {
  1498. if (current !== "" && typeof current === "string") {
  1499. current = parent.firstChild.data = value;
  1500. } else current = parent.textContent = value;
  1501. }
  1502. } else if (value == null || t === "boolean") {
  1503. if (hydrating) return current;
  1504. current = cleanChildren(parent, current, marker);
  1505. } else if (t === "function") {
  1506. createRenderEffect(() => {
  1507. let v = value();
  1508. while (typeof v === "function") v = v();
  1509. current = insertExpression(parent, v, current, marker);
  1510. });
  1511. return () => current;
  1512. } else if (Array.isArray(value)) {
  1513. const array = [];
  1514. const currentArray = current && Array.isArray(current);
  1515. if (normalizeIncomingArray(array, value, current, unwrapArray)) {
  1516. createRenderEffect(() => (current = insertExpression(parent, array, current, marker, true)));
  1517. return () => current;
  1518. }
  1519. if (hydrating) {
  1520. if (!array.length) return current;
  1521. if (marker === undefined) return (current = [...parent.childNodes]);
  1522. let node = array[0];
  1523. if (node.parentNode !== parent) return current;
  1524. const nodes = [node];
  1525. while ((node = node.nextSibling) !== marker) nodes.push(node);
  1526. return (current = nodes);
  1527. }
  1528. if (array.length === 0) {
  1529. current = cleanChildren(parent, current, marker);
  1530. if (multi) return current;
  1531. } else if (currentArray) {
  1532. if (current.length === 0) {
  1533. appendNodes(parent, array, marker);
  1534. } else reconcileArrays(parent, current, array);
  1535. } else {
  1536. current && cleanChildren(parent);
  1537. appendNodes(parent, array);
  1538. }
  1539. current = array;
  1540. } else if (value.nodeType) {
  1541. if (hydrating && value.parentNode) return (current = multi ? [value] : value);
  1542. if (Array.isArray(current)) {
  1543. if (multi) return (current = cleanChildren(parent, current, marker, value));
  1544. cleanChildren(parent, current, null, value);
  1545. } else if (current == null || current === "" || !parent.firstChild) {
  1546. parent.appendChild(value);
  1547. } else parent.replaceChild(value, parent.firstChild);
  1548. current = value;
  1549. } else;
  1550. return current;
  1551. }
  1552. function normalizeIncomingArray(normalized, array, current, unwrap) {
  1553. let dynamic = false;
  1554. for (let i = 0, len = array.length; i < len; i++) {
  1555. let item = array[i],
  1556. prev = current && current[normalized.length],
  1557. t;
  1558. if (item == null || item === true || item === false);
  1559. else if ((t = typeof item) === "object" && item.nodeType) {
  1560. normalized.push(item);
  1561. } else if (Array.isArray(item)) {
  1562. dynamic = normalizeIncomingArray(normalized, item, prev) || dynamic;
  1563. } else if (t === "function") {
  1564. if (unwrap) {
  1565. while (typeof item === "function") item = item();
  1566. dynamic =
  1567. normalizeIncomingArray(
  1568. normalized,
  1569. Array.isArray(item) ? item : [item],
  1570. Array.isArray(prev) ? prev : [prev]
  1571. ) || dynamic;
  1572. } else {
  1573. normalized.push(item);
  1574. dynamic = true;
  1575. }
  1576. } else {
  1577. const value = String(item);
  1578. if (prev && prev.nodeType === 3 && prev.data === value) normalized.push(prev);
  1579. else normalized.push(document.createTextNode(value));
  1580. }
  1581. }
  1582. return dynamic;
  1583. }
  1584. function appendNodes(parent, array, marker = null) {
  1585. for (let i = 0, len = array.length; i < len; i++) parent.insertBefore(array[i], marker);
  1586. }
  1587. function cleanChildren(parent, current, marker, replacement) {
  1588. if (marker === undefined) return (parent.textContent = "");
  1589. const node = replacement || document.createTextNode("");
  1590. if (current.length) {
  1591. let inserted = false;
  1592. for (let i = current.length - 1; i >= 0; i--) {
  1593. const el = current[i];
  1594. if (node !== el) {
  1595. const isParent = el.parentNode === parent;
  1596. if (!inserted && !i)
  1597. isParent ? parent.replaceChild(node, el) : parent.insertBefore(node, marker);
  1598. else isParent && el.remove();
  1599. } else inserted = true;
  1600. }
  1601. } else parent.insertBefore(node, marker);
  1602. return [node];
  1603. }
  1604. const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
  1605. function createElement(tagName, isSVG = false) {
  1606. return isSVG ? document.createElementNS(SVG_NAMESPACE, tagName) : document.createElement(tagName);
  1607. }
  1608. function Portal(props) {
  1609. const { useShadow } = props,
  1610. marker = document.createTextNode(""),
  1611. mount = () => props.mount || document.body,
  1612. owner = getOwner();
  1613. let content;
  1614. let hydrating = !!sharedConfig.context;
  1615. createEffect(
  1616. () => {
  1617. if (hydrating) getOwner().user = hydrating = false;
  1618. content || (content = runWithOwner(owner, () => createMemo(() => props.children)));
  1619. const el = mount();
  1620. if (el instanceof HTMLHeadElement) {
  1621. const [clean, setClean] = createSignal(false);
  1622. const cleanup = () => setClean(true);
  1623. createRoot(dispose => insert(el, () => (!clean() ? content() : dispose()), null));
  1624. onCleanup(cleanup);
  1625. } else {
  1626. const container = createElement(props.isSVG ? "g" : "div", props.isSVG),
  1627. renderRoot =
  1628. useShadow && container.attachShadow
  1629. ? container.attachShadow({
  1630. mode: "open"
  1631. })
  1632. : container;
  1633. Object.defineProperty(container, "_$host", {
  1634. get() {
  1635. return marker.parentNode;
  1636. },
  1637. configurable: true
  1638. });
  1639. insert(renderRoot, content);
  1640. el.appendChild(container);
  1641. props.ref && props.ref(container);
  1642. onCleanup(() => el.removeChild(container));
  1643. }
  1644. },
  1645. undefined,
  1646. {
  1647. render: !hydrating
  1648. }
  1649. );
  1650. return marker;
  1651. }
  1652.  
  1653. const $RAW = Symbol("store-raw"),
  1654. $NODE = Symbol("store-node"),
  1655. $HAS = Symbol("store-has"),
  1656. $SELF = Symbol("store-self");
  1657. function wrap$1(value) {
  1658. let p = value[$PROXY];
  1659. if (!p) {
  1660. Object.defineProperty(value, $PROXY, {
  1661. value: (p = new Proxy(value, proxyTraps$1))
  1662. });
  1663. if (!Array.isArray(value)) {
  1664. const keys = Object.keys(value),
  1665. desc = Object.getOwnPropertyDescriptors(value);
  1666. for (let i = 0, l = keys.length; i < l; i++) {
  1667. const prop = keys[i];
  1668. if (desc[prop].get) {
  1669. Object.defineProperty(value, prop, {
  1670. enumerable: desc[prop].enumerable,
  1671. get: desc[prop].get.bind(p)
  1672. });
  1673. }
  1674. }
  1675. }
  1676. }
  1677. return p;
  1678. }
  1679. function isWrappable(obj) {
  1680. let proto;
  1681. return (
  1682. obj != null &&
  1683. typeof obj === "object" &&
  1684. (obj[$PROXY] ||
  1685. !(proto = Object.getPrototypeOf(obj)) ||
  1686. proto === Object.prototype ||
  1687. Array.isArray(obj))
  1688. );
  1689. }
  1690. function unwrap(item, set = new Set()) {
  1691. let result, unwrapped, v, prop;
  1692. if ((result = item != null && item[$RAW])) return result;
  1693. if (!isWrappable(item) || set.has(item)) return item;
  1694. if (Array.isArray(item)) {
  1695. if (Object.isFrozen(item)) item = item.slice(0);
  1696. else set.add(item);
  1697. for (let i = 0, l = item.length; i < l; i++) {
  1698. v = item[i];
  1699. if ((unwrapped = unwrap(v, set)) !== v) item[i] = unwrapped;
  1700. }
  1701. } else {
  1702. if (Object.isFrozen(item)) item = Object.assign({}, item);
  1703. else set.add(item);
  1704. const keys = Object.keys(item),
  1705. desc = Object.getOwnPropertyDescriptors(item);
  1706. for (let i = 0, l = keys.length; i < l; i++) {
  1707. prop = keys[i];
  1708. if (desc[prop].get) continue;
  1709. v = item[prop];
  1710. if ((unwrapped = unwrap(v, set)) !== v) item[prop] = unwrapped;
  1711. }
  1712. }
  1713. return item;
  1714. }
  1715. function getNodes(target, symbol) {
  1716. let nodes = target[symbol];
  1717. if (!nodes)
  1718. Object.defineProperty(target, symbol, {
  1719. value: (nodes = Object.create(null))
  1720. });
  1721. return nodes;
  1722. }
  1723. function getNode(nodes, property, value) {
  1724. if (nodes[property]) return nodes[property];
  1725. const [s, set] = createSignal(value, {
  1726. equals: false,
  1727. internal: true
  1728. });
  1729. s.$ = set;
  1730. return (nodes[property] = s);
  1731. }
  1732. function proxyDescriptor$1(target, property) {
  1733. const desc = Reflect.getOwnPropertyDescriptor(target, property);
  1734. if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE)
  1735. return desc;
  1736. delete desc.value;
  1737. delete desc.writable;
  1738. desc.get = () => target[$PROXY][property];
  1739. return desc;
  1740. }
  1741. function trackSelf(target) {
  1742. getListener() && getNode(getNodes(target, $NODE), $SELF)();
  1743. }
  1744. function ownKeys(target) {
  1745. trackSelf(target);
  1746. return Reflect.ownKeys(target);
  1747. }
  1748. const proxyTraps$1 = {
  1749. get(target, property, receiver) {
  1750. if (property === $RAW) return target;
  1751. if (property === $PROXY) return receiver;
  1752. if (property === $TRACK) {
  1753. trackSelf(target);
  1754. return receiver;
  1755. }
  1756. const nodes = getNodes(target, $NODE);
  1757. const tracked = nodes[property];
  1758. let value = tracked ? tracked() : target[property];
  1759. if (property === $NODE || property === $HAS || property === "__proto__") return value;
  1760. if (!tracked) {
  1761. const desc = Object.getOwnPropertyDescriptor(target, property);
  1762. if (
  1763. getListener() &&
  1764. (typeof value !== "function" || target.hasOwnProperty(property)) &&
  1765. !(desc && desc.get)
  1766. )
  1767. value = getNode(nodes, property, value)();
  1768. }
  1769. return isWrappable(value) ? wrap$1(value) : value;
  1770. },
  1771. has(target, property) {
  1772. if (
  1773. property === $RAW ||
  1774. property === $PROXY ||
  1775. property === $TRACK ||
  1776. property === $NODE ||
  1777. property === $HAS ||
  1778. property === "__proto__"
  1779. )
  1780. return true;
  1781. getListener() && getNode(getNodes(target, $HAS), property)();
  1782. return property in target;
  1783. },
  1784. set() {
  1785. return true;
  1786. },
  1787. deleteProperty() {
  1788. return true;
  1789. },
  1790. ownKeys: ownKeys,
  1791. getOwnPropertyDescriptor: proxyDescriptor$1
  1792. };
  1793. function setProperty(state, property, value, deleting = false) {
  1794. if (!deleting && state[property] === value) return;
  1795. const prev = state[property],
  1796. len = state.length;
  1797. if (value === undefined) {
  1798. delete state[property];
  1799. if (state[$HAS] && state[$HAS][property] && prev !== undefined) state[$HAS][property].$();
  1800. } else {
  1801. state[property] = value;
  1802. if (state[$HAS] && state[$HAS][property] && prev === undefined) state[$HAS][property].$();
  1803. }
  1804. let nodes = getNodes(state, $NODE),
  1805. node;
  1806. if ((node = getNode(nodes, property, prev))) node.$(() => value);
  1807. if (Array.isArray(state) && state.length !== len) {
  1808. for (let i = state.length; i < len; i++) (node = nodes[i]) && node.$();
  1809. (node = getNode(nodes, "length", len)) && node.$(state.length);
  1810. }
  1811. (node = nodes[$SELF]) && node.$();
  1812. }
  1813. function mergeStoreNode(state, value) {
  1814. const keys = Object.keys(value);
  1815. for (let i = 0; i < keys.length; i += 1) {
  1816. const key = keys[i];
  1817. setProperty(state, key, value[key]);
  1818. }
  1819. }
  1820. function updateArray(current, next) {
  1821. if (typeof next === "function") next = next(current);
  1822. next = unwrap(next);
  1823. if (Array.isArray(next)) {
  1824. if (current === next) return;
  1825. let i = 0,
  1826. len = next.length;
  1827. for (; i < len; i++) {
  1828. const value = next[i];
  1829. if (current[i] !== value) setProperty(current, i, value);
  1830. }
  1831. setProperty(current, "length", len);
  1832. } else mergeStoreNode(current, next);
  1833. }
  1834. function updatePath(current, path, traversed = []) {
  1835. let part,
  1836. prev = current;
  1837. if (path.length > 1) {
  1838. part = path.shift();
  1839. const partType = typeof part,
  1840. isArray = Array.isArray(current);
  1841. if (Array.isArray(part)) {
  1842. for (let i = 0; i < part.length; i++) {
  1843. updatePath(current, [part[i]].concat(path), traversed);
  1844. }
  1845. return;
  1846. } else if (isArray && partType === "function") {
  1847. for (let i = 0; i < current.length; i++) {
  1848. if (part(current[i], i)) updatePath(current, [i].concat(path), traversed);
  1849. }
  1850. return;
  1851. } else if (isArray && partType === "object") {
  1852. const { from = 0, to = current.length - 1, by = 1 } = part;
  1853. for (let i = from; i <= to; i += by) {
  1854. updatePath(current, [i].concat(path), traversed);
  1855. }
  1856. return;
  1857. } else if (path.length > 1) {
  1858. updatePath(current[part], path, [part].concat(traversed));
  1859. return;
  1860. }
  1861. prev = current[part];
  1862. traversed = [part].concat(traversed);
  1863. }
  1864. let value = path[0];
  1865. if (typeof value === "function") {
  1866. value = value(prev, traversed);
  1867. if (value === prev) return;
  1868. }
  1869. if (part === undefined && value == undefined) return;
  1870. value = unwrap(value);
  1871. if (part === undefined || (isWrappable(prev) && isWrappable(value) && !Array.isArray(value))) {
  1872. mergeStoreNode(prev, value);
  1873. } else setProperty(current, part, value);
  1874. }
  1875. function createStore(...[store, options]) {
  1876. const unwrappedStore = unwrap(store || {});
  1877. const isArray = Array.isArray(unwrappedStore);
  1878. const wrappedStore = wrap$1(unwrappedStore);
  1879. function setStore(...args) {
  1880. batch(() => {
  1881. isArray && args.length === 1
  1882. ? updateArray(unwrappedStore, args[0])
  1883. : updatePath(unwrappedStore, args);
  1884. });
  1885. }
  1886. return [wrappedStore, setStore];
  1887. }
  1888.  
  1889. const $ROOT = Symbol("store-root");
  1890. function applyState(target, parent, property, merge, key) {
  1891. const previous = parent[property];
  1892. if (target === previous) return;
  1893. const isArray = Array.isArray(target);
  1894. if (
  1895. property !== $ROOT &&
  1896. (!isWrappable(target) ||
  1897. !isWrappable(previous) ||
  1898. isArray !== Array.isArray(previous) ||
  1899. (key && target[key] !== previous[key]))
  1900. ) {
  1901. setProperty(parent, property, target);
  1902. return;
  1903. }
  1904. if (isArray) {
  1905. if (
  1906. target.length &&
  1907. previous.length &&
  1908. (!merge || (key && target[0] && target[0][key] != null))
  1909. ) {
  1910. let i, j, start, end, newEnd, item, newIndicesNext, keyVal;
  1911. for (
  1912. start = 0, end = Math.min(previous.length, target.length);
  1913. start < end &&
  1914. (previous[start] === target[start] ||
  1915. (key && previous[start] && target[start] && previous[start][key] === target[start][key]));
  1916. start++
  1917. ) {
  1918. applyState(target[start], previous, start, merge, key);
  1919. }
  1920. const temp = new Array(target.length),
  1921. newIndices = new Map();
  1922. for (
  1923. end = previous.length - 1, newEnd = target.length - 1;
  1924. end >= start &&
  1925. newEnd >= start &&
  1926. (previous[end] === target[newEnd] ||
  1927. (key && previous[end] && target[newEnd] && previous[end][key] === target[newEnd][key]));
  1928. end--, newEnd--
  1929. ) {
  1930. temp[newEnd] = previous[end];
  1931. }
  1932. if (start > newEnd || start > end) {
  1933. for (j = start; j <= newEnd; j++) setProperty(previous, j, target[j]);
  1934. for (; j < target.length; j++) {
  1935. setProperty(previous, j, temp[j]);
  1936. applyState(target[j], previous, j, merge, key);
  1937. }
  1938. if (previous.length > target.length) setProperty(previous, "length", target.length);
  1939. return;
  1940. }
  1941. newIndicesNext = new Array(newEnd + 1);
  1942. for (j = newEnd; j >= start; j--) {
  1943. item = target[j];
  1944. keyVal = key && item ? item[key] : item;
  1945. i = newIndices.get(keyVal);
  1946. newIndicesNext[j] = i === undefined ? -1 : i;
  1947. newIndices.set(keyVal, j);
  1948. }
  1949. for (i = start; i <= end; i++) {
  1950. item = previous[i];
  1951. keyVal = key && item ? item[key] : item;
  1952. j = newIndices.get(keyVal);
  1953. if (j !== undefined && j !== -1) {
  1954. temp[j] = previous[i];
  1955. j = newIndicesNext[j];
  1956. newIndices.set(keyVal, j);
  1957. }
  1958. }
  1959. for (j = start; j < target.length; j++) {
  1960. if (j in temp) {
  1961. setProperty(previous, j, temp[j]);
  1962. applyState(target[j], previous, j, merge, key);
  1963. } else setProperty(previous, j, target[j]);
  1964. }
  1965. } else {
  1966. for (let i = 0, len = target.length; i < len; i++) {
  1967. applyState(target[i], previous, i, merge, key);
  1968. }
  1969. }
  1970. if (previous.length > target.length) setProperty(previous, "length", target.length);
  1971. return;
  1972. }
  1973. const targetKeys = Object.keys(target);
  1974. for (let i = 0, len = targetKeys.length; i < len; i++) {
  1975. applyState(target[targetKeys[i]], previous, targetKeys[i], merge, key);
  1976. }
  1977. const previousKeys = Object.keys(previous);
  1978. for (let i = 0, len = previousKeys.length; i < len; i++) {
  1979. if (target[previousKeys[i]] === undefined) setProperty(previous, previousKeys[i], undefined);
  1980. }
  1981. }
  1982. function reconcile(value, options = {}) {
  1983. const { merge, key = "id" } = options,
  1984. v = unwrap(value);
  1985. return state => {
  1986. if (!isWrappable(state) || !isWrappable(v)) return v;
  1987. const res = applyState(
  1988. v,
  1989. {
  1990. [$ROOT]: state
  1991. },
  1992. $ROOT,
  1993. merge,
  1994. key
  1995. );
  1996. return res === undefined ? state : res;
  1997. };
  1998. }
  1999. const producers = new WeakMap();
  2000. const setterTraps = {
  2001. get(target, property) {
  2002. if (property === $RAW) return target;
  2003. const value = target[property];
  2004. let proxy;
  2005. return isWrappable(value)
  2006. ? producers.get(value) ||
  2007. (producers.set(value, (proxy = new Proxy(value, setterTraps))), proxy)
  2008. : value;
  2009. },
  2010. set(target, property, value) {
  2011. setProperty(target, property, unwrap(value));
  2012. return true;
  2013. },
  2014. deleteProperty(target, property) {
  2015. setProperty(target, property, undefined, true);
  2016. return true;
  2017. }
  2018. };
  2019. function produce(fn) {
  2020. return state => {
  2021. if (isWrappable(state)) {
  2022. let proxy;
  2023. if (!(proxy = producers.get(state))) {
  2024. producers.set(state, (proxy = new Proxy(state, setterTraps)));
  2025. }
  2026. fn(proxy);
  2027. }
  2028. return state;
  2029. };
  2030. }
  2031.  
  2032. var _tmpl$$5 = /* @__PURE__ */ template(`<div class=sonner-loading-wrapper><div class=sonner-spinner>`), _tmpl$2$4 = /* @__PURE__ */ template(`<div class=sonner-loading-bar>`), _tmpl$3$2 = /* @__PURE__ */ template(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 20 20"fill=currentColor height=20 width=20><path fill-rule=evenodd d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z"clip-rule=evenodd>`), _tmpl$4$2 = /* @__PURE__ */ template(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor height=20 width=20><path fill-rule=evenodd d="M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z"clip-rule=evenodd>`), _tmpl$5$1 = /* @__PURE__ */ template(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 20 20"fill=currentColor height=20 width=20><path fill-rule=evenodd d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z"clip-rule=evenodd>`), _tmpl$6$1 = /* @__PURE__ */ template(`<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 20 20"fill=currentColor height=20 width=20><path fill-rule=evenodd d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z"clip-rule=evenodd>`), _tmpl$7 = /* @__PURE__ */ template(`<div class=sonner-loader>`), _tmpl$8 = /* @__PURE__ */ template(`<button aria-label="Close toast"data-close-button><svg xmlns=http://www.w3.org/2000/svg width=12 height=12 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round><line x1=18 y1=6 x2=6 y2=18></line><line x1=6 y1=6 x2=18 y2=18>`), _tmpl$9 = /* @__PURE__ */ template(`<li aria-atomic=true role=status tabindex=0 data-sonner-toast>`), _tmpl$10 = /* @__PURE__ */ template(`<div data-icon>`), _tmpl$11 = /* @__PURE__ */ template(`<div data-description>`), _tmpl$12 = /* @__PURE__ */ template(`<div data-content><div data-title>`), _tmpl$13 = /* @__PURE__ */ template(`<button data-button data-cancel>`), _tmpl$14 = /* @__PURE__ */ template(`<button data-button>`), _tmpl$15 = /* @__PURE__ */ template(`<section tabindex=-1>`), _tmpl$16 = /* @__PURE__ */ template(`<ol tabindex=-1 data-sonner-toaster>`);
  2033. function styleInject(css, {
  2034. insertAt
  2035. } = {}) {
  2036. if (typeof document === "undefined") return;
  2037. const head = document.head || document.getElementsByTagName("head")[0];
  2038. const style = document.createElement("style");
  2039. style.type = "text/css";
  2040. if (insertAt === "top") {
  2041. if (head.firstChild) {
  2042. head.insertBefore(style, head.firstChild);
  2043. } else {
  2044. head.appendChild(style);
  2045. }
  2046. } else {
  2047. head.appendChild(style);
  2048. }
  2049. if (style.styleSheet) {
  2050. style.styleSheet.cssText = css;
  2051. } else {
  2052. style.appendChild(document.createTextNode(css));
  2053. }
  2054. }
  2055. styleInject(':where(html[dir=ltr]),\n:where([data-sonner-toaster][dir=ltr]) {\n --toast-icon-margin-start: -3px;\n --toast-icon-margin-end: 4px;\n --toast-svg-margin-start: -1px;\n --toast-svg-margin-end: 0px;\n --toast-button-margin-start: auto;\n --toast-button-margin-end: 0;\n --toast-close-button-start: 0;\n --toast-close-button-end: unset;\n --toast-close-button-transform: translate(-35%, -35%);\n}\n:where(html[dir=rtl]),\n:where([data-sonner-toaster][dir=rtl]) {\n --toast-icon-margin-start: 4px;\n --toast-icon-margin-end: -3px;\n --toast-svg-margin-start: 0px;\n --toast-svg-margin-end: -1px;\n --toast-button-margin-start: 0;\n --toast-button-margin-end: auto;\n --toast-close-button-start: unset;\n --toast-close-button-end: 0;\n --toast-close-button-transform: translate(35%, -35%);\n}\n:where([data-sonner-toaster]) {\n position: fixed;\n width: var(--width);\n font-family:\n ui-sans-serif,\n system-ui,\n -apple-system,\n BlinkMacSystemFont,\n Segoe UI,\n Roboto,\n Helvetica Neue,\n Arial,\n Noto Sans,\n sans-serif,\n Apple Color Emoji,\n Segoe UI Emoji,\n Segoe UI Symbol,\n Noto Color Emoji;\n --gray1: hsl(0, 0%, 99%);\n --gray2: hsl(0, 0%, 97.3%);\n --gray3: hsl(0, 0%, 95.1%);\n --gray4: hsl(0, 0%, 93%);\n --gray5: hsl(0, 0%, 90.9%);\n --gray6: hsl(0, 0%, 88.7%);\n --gray7: hsl(0, 0%, 85.8%);\n --gray8: hsl(0, 0%, 78%);\n --gray9: hsl(0, 0%, 56.1%);\n --gray10: hsl(0, 0%, 52.3%);\n --gray11: hsl(0, 0%, 43.5%);\n --gray12: hsl(0, 0%, 9%);\n --border-radius: 8px;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n list-style: none;\n outline: none;\n z-index: 999999999;\n}\n:where([data-sonner-toaster][data-x-position=right]) {\n right: max(var(--offset), env(safe-area-inset-right));\n}\n:where([data-sonner-toaster][data-x-position=left]) {\n left: max(var(--offset), env(safe-area-inset-left));\n}\n:where([data-sonner-toaster][data-x-position=center]) {\n left: 50%;\n transform: translateX(-50%);\n}\n:where([data-sonner-toaster][data-y-position=top]) {\n top: max(var(--offset), env(safe-area-inset-top));\n}\n:where([data-sonner-toaster][data-y-position=bottom]) {\n bottom: max(var(--offset), env(safe-area-inset-bottom));\n}\n:where([data-sonner-toast]) {\n --y: translateY(100%);\n --lift-amount: calc(var(--lift) * var(--gap));\n z-index: var(--z-index);\n position: absolute;\n opacity: 0;\n transform: var(--y);\n filter: blur(0);\n touch-action: none;\n transition:\n transform 400ms,\n opacity 400ms,\n height 400ms,\n box-shadow 200ms;\n box-sizing: border-box;\n outline: none;\n overflow-wrap: anywhere;\n}\n:where([data-sonner-toast][data-styled=true]) {\n padding: 16px;\n background: var(--normal-bg);\n border: 1px solid var(--normal-border);\n color: var(--normal-text);\n border-radius: var(--border-radius);\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);\n width: var(--width);\n font-size: 13px;\n display: flex;\n align-items: center;\n gap: 6px;\n}\n:where([data-sonner-toast]:focus-visible) {\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(0, 0, 0, 0.2);\n}\n:where([data-sonner-toast][data-y-position=top]) {\n top: 0;\n --y: translateY(-100%);\n --lift: 1;\n --lift-amount: calc(1 * var(--gap));\n}\n:where([data-sonner-toast][data-y-position=bottom]) {\n bottom: 0;\n --y: translateY(100%);\n --lift: -1;\n --lift-amount: calc(var(--lift) * var(--gap));\n}\n:where([data-sonner-toast]) :where([data-description]) {\n font-weight: 400;\n line-height: 1.4;\n color: inherit;\n}\n:where([data-sonner-toast]) :where([data-title]) {\n font-weight: 500;\n line-height: 1.5;\n color: inherit;\n}\n:where([data-sonner-toast]) :where([data-icon]) {\n display: flex;\n height: 16px;\n width: 16px;\n position: relative;\n justify-content: flex-start;\n align-items: center;\n flex-shrink: 0;\n margin-left: var(--toast-icon-margin-start);\n margin-right: var(--toast-icon-margin-end);\n}\n:where([data-sonner-toast][data-promise=true]) :where([data-icon]) > svg {\n opacity: 0;\n transform: scale(0.8);\n transform-origin: center;\n animation: sonner-fade-in 300ms ease forwards;\n}\n:where([data-sonner-toast]) :where([data-icon]) > * {\n flex-shrink: 0;\n}\n:where([data-sonner-toast]) :where([data-icon]) svg {\n margin-left: var(--toast-svg-margin-start);\n margin-right: var(--toast-svg-margin-end);\n}\n:where([data-sonner-toast]) :where([data-content]) {\n display: flex;\n flex-direction: column;\n gap: 2px;\n}\n[data-sonner-toast][data-styled=true] [data-button] {\n border-radius: 4px;\n padding-left: 8px;\n padding-right: 8px;\n height: 24px;\n font-size: 12px;\n color: var(--normal-bg);\n background: var(--normal-text);\n margin-left: var(--toast-button-margin-start);\n margin-right: var(--toast-button-margin-end);\n border: none;\n cursor: pointer;\n outline: none;\n display: flex;\n align-items: center;\n flex-shrink: 0;\n transition: opacity 400ms, box-shadow 200ms;\n}\n:where([data-sonner-toast]) :where([data-button]):focus-visible {\n box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);\n}\n:where([data-sonner-toast]) :where([data-button]):first-of-type {\n margin-left: var(--toast-button-margin-start);\n margin-right: var(--toast-button-margin-end);\n}\n:where([data-sonner-toast]) :where([data-cancel]) {\n color: var(--normal-text);\n background: rgba(0, 0, 0, 0.08);\n}\n:where([data-sonner-toast][data-theme=dark]) :where([data-cancel]) {\n background: rgba(255, 255, 255, 0.3);\n}\n:where([data-sonner-toast]) :where([data-close-button]) {\n position: absolute;\n left: var(--toast-close-button-start);\n right: var(--toast-close-button-end);\n top: 0;\n height: 20px;\n width: 20px;\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 0;\n background: var(--gray1);\n color: var(--gray12);\n border: 1px solid var(--gray4);\n transform: var(--toast-close-button-transform);\n border-radius: 50%;\n cursor: pointer;\n z-index: 1;\n transition:\n opacity 100ms,\n background 200ms,\n border-color 200ms;\n}\n:where([data-sonner-toast]) :where([data-close-button]):focus-visible {\n box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1), 0 0 0 2px rgba(0, 0, 0, 0.2);\n}\n:where([data-sonner-toast]) :where([data-disabled=true]) {\n cursor: not-allowed;\n}\n:where([data-sonner-toast]):hover :where([data-close-button]):hover {\n background: var(--gray2);\n border-color: var(--gray5);\n}\n:where([data-sonner-toast][data-swiping=true])::before {\n content: "";\n position: absolute;\n left: 0;\n right: 0;\n height: 100%;\n z-index: -1;\n}\n:where([data-sonner-toast][data-y-position=top][data-swiping=true])::before {\n bottom: 50%;\n transform: scaleY(3) translateY(50%);\n}\n:where([data-sonner-toast][data-y-position=bottom][data-swiping=true])::before {\n top: 50%;\n transform: scaleY(3) translateY(-50%);\n}\n:where([data-sonner-toast][data-swiping=false][data-removed=true])::before {\n content: "";\n position: absolute;\n inset: 0;\n transform: scaleY(2);\n}\n:where([data-sonner-toast])::after {\n content: "";\n position: absolute;\n left: 0;\n height: calc(var(--gap) + 1px);\n bottom: 100%;\n width: 100%;\n}\n:where([data-sonner-toast][data-mounted=true]) {\n --y: translateY(0);\n opacity: 1;\n}\n:where([data-sonner-toast][data-expanded=false][data-front=false]) {\n --scale: var(--toasts-before) * 0.05 + 1;\n --y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));\n height: var(--front-toast-height);\n}\n:where([data-sonner-toast]) > * {\n transition: opacity 400ms;\n}\n:where([data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]) > * {\n opacity: 0;\n}\n:where([data-sonner-toast][data-visible=false]) {\n opacity: 0;\n pointer-events: none;\n}\n:where([data-sonner-toast][data-mounted=true][data-expanded=true]) {\n --y: translateY(calc(var(--lift) * var(--offset)));\n height: var(--initial-height);\n}\n:where([data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]) {\n --y: translateY(calc(var(--lift) * -100%));\n opacity: 0;\n}\n:where([data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]) {\n --y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));\n opacity: 0;\n}\n:where([data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]) {\n --y: translateY(40%);\n opacity: 0;\n transition: transform 500ms, opacity 200ms;\n}\n:where([data-sonner-toast][data-removed=true][data-front=false])::before {\n height: calc(var(--initial-height) + 20%);\n}\n[data-sonner-toast][data-swiping=true] {\n transform: var(--y) translateY(var(--swipe-amount, 0px));\n transition: none;\n}\n[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],\n[data-sonner-toast][data-swipe-out=true][data-y-position=top] {\n animation: swipe-out 200ms ease-out forwards;\n}\n@keyframes swipe-out {\n from {\n transform: translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));\n opacity: 1;\n }\n to {\n transform: translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));\n opacity: 0;\n }\n}\n@media (max-width: 600px) {\n [data-sonner-toaster] {\n position: fixed;\n --mobile-offset: 16px;\n right: var(--mobile-offset);\n left: var(--mobile-offset);\n width: 100%;\n }\n [data-sonner-toaster] [data-sonner-toast] {\n left: 0;\n right: 0;\n width: calc(100% - var(--mobile-offset) * 2);\n }\n [data-sonner-toaster][data-x-position=left] {\n left: var(--mobile-offset);\n }\n [data-sonner-toaster][data-y-position=bottom] {\n bottom: 20px;\n }\n [data-sonner-toaster][data-y-position=top] {\n top: 20px;\n }\n [data-sonner-toaster][data-x-position=center] {\n left: var(--mobile-offset);\n right: var(--mobile-offset);\n transform: none;\n }\n}\n[data-sonner-toaster][data-theme=light] {\n --normal-bg: #fff;\n --normal-border: var(--gray4);\n --normal-text: var(--gray12);\n --success-bg: hsl(143, 85%, 96%);\n --success-border: hsl(145, 92%, 91%);\n --success-text: hsl(140, 100%, 27%);\n --info-bg: hsl(208, 100%, 97%);\n --info-border: hsl(221, 91%, 91%);\n --info-text: hsl(210, 92%, 45%);\n --warning-bg: hsl(49, 100%, 97%);\n --warning-border: hsl(49, 91%, 91%);\n --warning-text: hsl(31, 92%, 45%);\n --error-bg: hsl(359, 100%, 97%);\n --error-border: hsl(359, 100%, 94%);\n --error-text: hsl(360, 100%, 45%);\n}\n[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true] {\n --normal-bg: #000;\n --normal-border: hsl(0, 0%, 20%);\n --normal-text: var(--gray1);\n}\n[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true] {\n --normal-bg: #fff;\n --normal-border: var(--gray3);\n --normal-text: var(--gray12);\n}\n[data-sonner-toaster][data-theme=dark] {\n --normal-bg: #000;\n --normal-border: hsl(0, 0%, 20%);\n --normal-text: var(--gray1);\n --success-bg: hsl(150, 100%, 6%);\n --success-border: hsl(147, 100%, 12%);\n --success-text: hsl(150, 86%, 65%);\n --info-bg: hsl(215, 100%, 6%);\n --info-border: hsl(223, 100%, 12%);\n --info-text: hsl(216, 87%, 65%);\n --warning-bg: hsl(64, 100%, 6%);\n --warning-border: hsl(60, 100%, 12%);\n --warning-text: hsl(46, 87%, 65%);\n --error-bg: hsl(358, 76%, 10%);\n --error-border: hsl(357, 89%, 16%);\n --error-text: hsl(358, 100%, 81%);\n}\n[data-rich-colors=true] [data-sonner-toast][data-type=success] {\n background: var(--success-bg);\n border-color: var(--success-border);\n color: var(--success-text);\n}\n[data-rich-colors=true] [data-sonner-toast][data-type=success] [data-close-button] {\n background: var(--success-bg);\n border-color: var(--success-border);\n color: var(--success-text);\n}\n[data-rich-colors=true] [data-sonner-toast][data-type=info] {\n background: var(--info-bg);\n border-color: var(--info-border);\n color: var(--info-text);\n}\n[data-rich-colors=true] [data-sonner-toast][data-type=info] [data-close-button] {\n background: var(--info-bg);\n border-color: var(--info-border);\n color: var(--info-text);\n}\n[data-rich-colors=true] [data-sonner-toast][data-type=warning] {\n background: var(--warning-bg);\n border-color: var(--warning-border);\n color: var(--warning-text);\n}\n[data-rich-colors=true] [data-sonner-toast][data-type=warning] [data-close-button] {\n background: var(--warning-bg);\n border-color: var(--warning-border);\n color: var(--warning-text);\n}\n[data-rich-colors=true] [data-sonner-toast][data-type=error] {\n background: var(--error-bg);\n border-color: var(--error-border);\n color: var(--error-text);\n}\n[data-rich-colors=true] [data-sonner-toast][data-type=error] [data-close-button] {\n background: var(--error-bg);\n border-color: var(--error-border);\n color: var(--error-text);\n}\n.sonner-loading-wrapper {\n --size: 16px;\n height: var(--size);\n width: var(--size);\n position: absolute;\n inset: 0;\n z-index: 10;\n}\n.sonner-loading-wrapper[data-visible=false] {\n transform-origin: center;\n animation: sonner-fade-out 0.2s ease forwards;\n}\n.sonner-spinner {\n position: relative;\n top: 50%;\n left: 50%;\n height: var(--size);\n width: var(--size);\n}\n.sonner-loading-bar {\n animation: sonner-spin 1.2s linear infinite;\n background: var(--gray11);\n border-radius: 6px;\n height: 8%;\n left: -10%;\n position: absolute;\n top: -3.9%;\n width: 24%;\n}\n.sonner-loading-bar:nth-child(1) {\n animation-delay: -1.2s;\n transform: rotate(0.0001deg) translate(146%);\n}\n.sonner-loading-bar:nth-child(2) {\n animation-delay: -1.1s;\n transform: rotate(30deg) translate(146%);\n}\n.sonner-loading-bar:nth-child(3) {\n animation-delay: -1s;\n transform: rotate(60deg) translate(146%);\n}\n.sonner-loading-bar:nth-child(4) {\n animation-delay: -0.9s;\n transform: rotate(90deg) translate(146%);\n}\n.sonner-loading-bar:nth-child(5) {\n animation-delay: -0.8s;\n transform: rotate(120deg) translate(146%);\n}\n.sonner-loading-bar:nth-child(6) {\n animation-delay: -0.7s;\n transform: rotate(150deg) translate(146%);\n}\n.sonner-loading-bar:nth-child(7) {\n animation-delay: -0.6s;\n transform: rotate(180deg) translate(146%);\n}\n.sonner-loading-bar:nth-child(8) {\n animation-delay: -0.5s;\n transform: rotate(210deg) translate(146%);\n}\n.sonner-loading-bar:nth-child(9) {\n animation-delay: -0.4s;\n transform: rotate(240deg) translate(146%);\n}\n.sonner-loading-bar:nth-child(10) {\n animation-delay: -0.3s;\n transform: rotate(270deg) translate(146%);\n}\n.sonner-loading-bar:nth-child(11) {\n animation-delay: -0.2s;\n transform: rotate(300deg) translate(146%);\n}\n.sonner-loading-bar:nth-child(12) {\n animation-delay: -0.1s;\n transform: rotate(330deg) translate(146%);\n}\n@keyframes sonner-fade-in {\n 0% {\n opacity: 0;\n transform: scale(0.8);\n }\n 100% {\n opacity: 1;\n transform: scale(1);\n }\n}\n@keyframes sonner-fade-out {\n 0% {\n opacity: 1;\n transform: scale(1);\n }\n 100% {\n opacity: 0;\n transform: scale(0.8);\n }\n}\n@keyframes sonner-spin {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0.15;\n }\n}\n@media (prefers-reduced-motion) {\n [data-sonner-toast],\n [data-sonner-toast] > *,\n .sonner-loading-bar {\n transition: none !important;\n animation: none !important;\n }\n}\n.sonner-loader {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n transform-origin: center;\n transition: opacity 200ms, transform 200ms;\n}\n.sonner-loader[data-visible=false] {\n opacity: 0;\n transform: scale(0.8) translate(-50%, -50%);\n}\n');
  2056. var bars = Array(12).fill(0);
  2057. function Loader(props) {
  2058. return (() => {
  2059. var _el$ = _tmpl$$5(), _el$2 = _el$.firstChild;
  2060. insert(_el$2, createComponent(For, {
  2061. each: bars,
  2062. children: () => _tmpl$2$4()
  2063. }));
  2064. createRenderEffect(() => setAttribute(_el$, "data-visible", props.visible));
  2065. return _el$;
  2066. })();
  2067. }
  2068. function SuccessIcon() {
  2069. return _tmpl$3$2();
  2070. }
  2071. function WarningIcon() {
  2072. return _tmpl$4$2();
  2073. }
  2074. function InfoIcon() {
  2075. return _tmpl$5$1();
  2076. }
  2077. function ErrorIcon() {
  2078. return _tmpl$6$1();
  2079. }
  2080. function getAsset(type) {
  2081. switch (type) {
  2082. case "success":
  2083. return SuccessIcon;
  2084. case "info":
  2085. return InfoIcon;
  2086. case "warning":
  2087. return WarningIcon;
  2088. case "error":
  2089. return ErrorIcon;
  2090. default:
  2091. return null;
  2092. }
  2093. }
  2094. var toastsCounter = 0;
  2095. var Observer = class {
  2096. subscribers;
  2097. toasts;
  2098. constructor() {
  2099. this.subscribers = [];
  2100. this.toasts = [];
  2101. }
  2102. // We use arrow functions to maintain the correct `this` reference
  2103. subscribe = (subscriber) => {
  2104. this.subscribers.push(subscriber);
  2105. return () => {
  2106. const index = this.subscribers.indexOf(subscriber);
  2107. this.subscribers.splice(index, 1);
  2108. };
  2109. };
  2110. publish = (data) => {
  2111. this.subscribers.forEach((subscriber) => subscriber(data));
  2112. };
  2113. addToast = (data) => {
  2114. this.publish(data);
  2115. this.toasts = [...this.toasts, data];
  2116. };
  2117. create = (data) => {
  2118. const {
  2119. message,
  2120. ...rest
  2121. } = data;
  2122. const id = typeof data?.id === "number" || data.id && data.id?.length > 0 ? data.id : toastsCounter++;
  2123. const alreadyExists = this.toasts.find((toast2) => {
  2124. return toast2.id === id;
  2125. });
  2126. if (alreadyExists) {
  2127. this.toasts = this.toasts.map((toast2) => {
  2128. if (toast2.id === id) {
  2129. this.publish({
  2130. ...toast2,
  2131. ...data,
  2132. id,
  2133. title: message
  2134. });
  2135. return {
  2136. ...toast2,
  2137. ...data,
  2138. id,
  2139. title: message
  2140. };
  2141. }
  2142. return toast2;
  2143. });
  2144. } else {
  2145. this.addToast({
  2146. title: message,
  2147. ...rest,
  2148. id
  2149. });
  2150. }
  2151. return id;
  2152. };
  2153. dismiss = (id) => {
  2154. if (!id) {
  2155. this.toasts.forEach((toast2) => {
  2156. this.subscribers.forEach((subscriber) => subscriber({
  2157. id: toast2.id,
  2158. dismiss: true
  2159. }));
  2160. });
  2161. }
  2162. this.subscribers.forEach((subscriber) => subscriber({
  2163. id,
  2164. dismiss: true
  2165. }));
  2166. return id;
  2167. };
  2168. message = (message, data) => {
  2169. return this.create({
  2170. ...data,
  2171. message
  2172. });
  2173. };
  2174. error = (message, data) => {
  2175. return this.create({
  2176. ...data,
  2177. message,
  2178. type: "error"
  2179. });
  2180. };
  2181. success = (message, data) => {
  2182. return this.create({
  2183. ...data,
  2184. type: "success",
  2185. message
  2186. });
  2187. };
  2188. info = (message, data) => {
  2189. return this.create({
  2190. ...data,
  2191. type: "info",
  2192. message
  2193. });
  2194. };
  2195. warning = (message, data) => {
  2196. return this.create({
  2197. ...data,
  2198. type: "warning",
  2199. message
  2200. });
  2201. };
  2202. promise = (promise, data) => {
  2203. if (!data) {
  2204. return;
  2205. }
  2206. let id;
  2207. if (data.loading !== void 0) {
  2208. id = this.create({
  2209. ...data,
  2210. promise,
  2211. type: "loading",
  2212. message: data.loading
  2213. });
  2214. }
  2215. const p = promise instanceof Promise ? promise : promise();
  2216. let shouldDismiss = id !== void 0;
  2217. p.then((response) => {
  2218. if (response && typeof response.ok === "boolean" && !response.ok) {
  2219. shouldDismiss = false;
  2220. const message = typeof data.error === "function" ? data.error(`HTTP error! status: ${response.status}`) : data.error;
  2221. this.create({
  2222. id,
  2223. type: "error",
  2224. message
  2225. });
  2226. } else if (data.success !== void 0) {
  2227. shouldDismiss = false;
  2228. const message = typeof data.success === "function" ? data.success(response) : data.success;
  2229. this.create({
  2230. id,
  2231. type: "success",
  2232. message
  2233. });
  2234. }
  2235. }).catch((error) => {
  2236. if (data.error !== void 0) {
  2237. shouldDismiss = false;
  2238. const message = typeof data.error === "function" ? data.error(error) : data.error;
  2239. this.create({
  2240. id,
  2241. type: "error",
  2242. message
  2243. });
  2244. }
  2245. }).finally(() => {
  2246. if (shouldDismiss) {
  2247. this.dismiss(id);
  2248. id = void 0;
  2249. }
  2250. data.finally?.();
  2251. });
  2252. return id;
  2253. };
  2254. loading = (message, data) => {
  2255. return this.create({
  2256. ...data,
  2257. type: "loading",
  2258. message
  2259. });
  2260. };
  2261. // We can't provide the toast we just created as a prop as we didn't create it yet, so we can create a default toast object, I just don't know how to use function in argument when calling()?
  2262. custom = (jsx, data) => {
  2263. const id = data?.id || toastsCounter++;
  2264. this.publish({
  2265. jsx: jsx(id),
  2266. id,
  2267. ...data
  2268. });
  2269. return id;
  2270. };
  2271. };
  2272. var ToastState = new Observer();
  2273. function toastFunction(message, data) {
  2274. const id = data?.id || toastsCounter++;
  2275. ToastState.addToast({
  2276. title: message,
  2277. ...data,
  2278. id
  2279. });
  2280. return id;
  2281. }
  2282. var basicToast = toastFunction;
  2283. var toast = Object.assign(basicToast, {
  2284. success: ToastState.success,
  2285. info: ToastState.info,
  2286. warning: ToastState.warning,
  2287. error: ToastState.error,
  2288. custom: ToastState.custom,
  2289. message: ToastState.message,
  2290. promise: ToastState.promise,
  2291. dismiss: ToastState.dismiss,
  2292. loading: ToastState.loading
  2293. });
  2294. function useIsDocumentHidden() {
  2295. const [isDocumentHidden, setIsDocumentHidden] = createSignal(false);
  2296. onMount(() => {
  2297. const callback = () => {
  2298. setIsDocumentHidden(document.hidden);
  2299. };
  2300. document.addEventListener("visibilitychange", callback);
  2301. onCleanup(() => {
  2302. window.removeEventListener("visibilitychange", callback);
  2303. });
  2304. });
  2305. return isDocumentHidden;
  2306. }
  2307. var VISIBLE_TOASTS_AMOUNT = 3;
  2308. var VIEWPORT_OFFSET = "32px";
  2309. var TOAST_LIFETIME = 4e3;
  2310. var TOAST_WIDTH = 356;
  2311. var GAP = 14;
  2312. var SWIPE_TRESHOLD = 20;
  2313. var TIME_BEFORE_UNMOUNT = 200;
  2314. function _cn(...classes) {
  2315. return classes.filter(Boolean).join(" ");
  2316. }
  2317. var Toast = (props) => {
  2318. const [mounted, setMounted] = createSignal(false);
  2319. const [removed, setRemoved] = createSignal(false);
  2320. const [swiping, setSwiping] = createSignal(false);
  2321. const [swipeOut, setSwipeOut] = createSignal(false);
  2322. const [offsetBeforeRemove, setOffsetBeforeRemove] = createSignal(0);
  2323. const [initialHeight, setInitialHeight] = createSignal(0);
  2324. let toastRef;
  2325. const isFront = () => props.index === 0;
  2326. const isVisible = () => props.index + 1 <= props.visibleToasts;
  2327. const toastType = () => props.toast.type;
  2328. const toastClassname = () => props.toast.class || "";
  2329. const toastDescriptionClassname = () => props.toast.descriptionClass || "";
  2330. const propsWithDefaults = mergeProps({
  2331. gap: GAP
  2332. }, props);
  2333. const heightIndex = () => props.heights.findIndex((height) => height.toastId === props.toast.id) || 0;
  2334. const duration = () => props.toast.duration || props.duration || TOAST_LIFETIME;
  2335. let closeTimerStartTimeRef = 0;
  2336. let lastCloseTimerStartTimeRef = 0;
  2337. const [pointerStartRef, setPointerStartRef] = createSignal(null);
  2338. const coords = () => props.position.split("-");
  2339. const toastsHeightBefore = () => {
  2340. return props.heights.reduce((prev, curr, reducerIndex) => {
  2341. if (reducerIndex >= heightIndex()) return prev;
  2342. return prev + curr.height;
  2343. }, 0);
  2344. };
  2345. const isDocumentHidden = useIsDocumentHidden();
  2346. const invert = () => props.toast.invert || props.invert;
  2347. const disabled = () => toastType() === "loading";
  2348. const offset = () => heightIndex() * propsWithDefaults.gap + toastsHeightBefore();
  2349. function getLoadingIcon() {
  2350. if (props.icons?.loading) {
  2351. return (() => {
  2352. var _el$8 = _tmpl$7();
  2353. insert(_el$8, () => props.icons.loading);
  2354. createRenderEffect(() => setAttribute(_el$8, "data-visible", toastType() === "loading"));
  2355. return _el$8;
  2356. })();
  2357. }
  2358. return createComponent(Loader, {
  2359. get visible() {
  2360. return toastType() === "loading";
  2361. }
  2362. });
  2363. }
  2364. onMount(() => {
  2365. setMounted(true);
  2366. });
  2367. onMount(() => {
  2368. const toastNode = toastRef;
  2369. const originalHeight = toastNode.style.height;
  2370. toastNode.style.height = "auto";
  2371. const newHeight = toastNode.getBoundingClientRect().height;
  2372. toastNode.style.height = originalHeight;
  2373. setInitialHeight(newHeight);
  2374. createEffect(() => {
  2375. props.setHeights((heights) => {
  2376. const alreadyExists = heights.find((height) => height.toastId === props.toast.id);
  2377. if (!alreadyExists) return [{
  2378. toastId: props.toast.id,
  2379. height: newHeight,
  2380. position: props.toast.position
  2381. }, ...heights];
  2382. else return heights.map((height) => height.toastId === props.toast.id ? {
  2383. ...height,
  2384. height: newHeight
  2385. } : height);
  2386. });
  2387. });
  2388. });
  2389. const deleteToast = () => {
  2390. setRemoved(true);
  2391. setOffsetBeforeRemove(offset());
  2392. props.setHeights((h) => h.filter((height) => height.toastId !== props.toast.id));
  2393. setTimeout(() => {
  2394. props.removeToast(props.toast);
  2395. }, TIME_BEFORE_UNMOUNT);
  2396. };
  2397. let remainingTime = duration();
  2398. createEffect(on(() => [props.expanded, props.interacting, props.toast, duration(), props.toast.promise, toastType(), props.pauseWhenPageIsHidden, isDocumentHidden()], ([expanded, interacting, toast2, duration2, promise, toastType2, pauseWhenPageIsHidden, isDocumentHidden2]) => {
  2399. if (promise && toastType2 === "loading" || duration2 === Number.POSITIVE_INFINITY) return;
  2400. let timeoutId;
  2401. const pauseTimer = () => {
  2402. if (lastCloseTimerStartTimeRef < closeTimerStartTimeRef) {
  2403. const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - closeTimerStartTimeRef;
  2404. remainingTime = remainingTime - elapsedTime;
  2405. }
  2406. lastCloseTimerStartTimeRef = (/* @__PURE__ */ new Date()).getTime();
  2407. };
  2408. const startTimer = () => {
  2409. closeTimerStartTimeRef = (/* @__PURE__ */ new Date()).getTime();
  2410. timeoutId = setTimeout(() => {
  2411. toast2.onAutoClose?.(toast2);
  2412. deleteToast();
  2413. }, remainingTime);
  2414. };
  2415. if (expanded || interacting || pauseWhenPageIsHidden && isDocumentHidden2) pauseTimer();
  2416. else startTimer();
  2417. onCleanup(() => {
  2418. clearTimeout(timeoutId);
  2419. });
  2420. }));
  2421. createEffect(on(() => props.toast.id, (toastId) => {
  2422. const toastNode = toastRef;
  2423. if (toastNode) {
  2424. const height = toastNode.getBoundingClientRect().height;
  2425. setInitialHeight(height);
  2426. props.setHeights((h) => [{
  2427. toastId,
  2428. height,
  2429. position: props.toast.position
  2430. }, ...h]);
  2431. onCleanup(() => {
  2432. props.setHeights((h) => h.filter((height2) => height2.toastId !== toastId));
  2433. });
  2434. }
  2435. }));
  2436. createEffect(on(() => props.toast.delete, (d) => {
  2437. if (d) deleteToast();
  2438. }));
  2439. return (() => {
  2440. var _el$9 = _tmpl$9();
  2441. _el$9.$$pointermove = (event) => {
  2442. if (!pointerStartRef()) return;
  2443. const yPosition = event.clientY - pointerStartRef().y;
  2444. const xPosition = event.clientX - pointerStartRef().x;
  2445. const clamp = coords()[0] === "top" ? Math.min : Math.max;
  2446. const clampedY = clamp(0, yPosition);
  2447. const swipeStartThreshold = event.pointerType === "touch" ? 10 : 2;
  2448. const isAllowedToSwipe = Math.abs(clampedY) > swipeStartThreshold;
  2449. if (isAllowedToSwipe) {
  2450. toastRef?.style.setProperty("--swipe-amount", `${yPosition}px`);
  2451. } else if (Math.abs(xPosition) > swipeStartThreshold) {
  2452. setPointerStartRef(null);
  2453. }
  2454. };
  2455. _el$9.$$pointerup = () => {
  2456. if (swipeOut()) return;
  2457. setPointerStartRef(null);
  2458. const swipeAmount = Number(toastRef?.style.getPropertyValue("--swipe-amount").replace("px", "") || 0);
  2459. if (Math.abs(swipeAmount) >= SWIPE_TRESHOLD) {
  2460. setOffsetBeforeRemove(offset());
  2461. props.toast.onDismiss?.(props.toast);
  2462. deleteToast();
  2463. setSwipeOut(true);
  2464. return;
  2465. }
  2466. toastRef?.style.setProperty("--swipe-amount", "0px");
  2467. setSwiping(false);
  2468. };
  2469. _el$9.$$pointerdown = (event) => {
  2470. if (disabled()) return;
  2471. setOffsetBeforeRemove(offset());
  2472. event.target.setPointerCapture(event.pointerId);
  2473. if (event.target.tagName === "BUTTON") return;
  2474. setSwiping(true);
  2475. setPointerStartRef({
  2476. x: event.clientX,
  2477. y: event.clientY
  2478. });
  2479. };
  2480. var _ref$ = toastRef;
  2481. typeof _ref$ === "function" ? use(_ref$, _el$9) : toastRef = _el$9;
  2482. insert(_el$9, createComponent(Show, {
  2483. get when() {
  2484. return props.closeButton && !props.toast.jsx;
  2485. },
  2486. get children() {
  2487. var _el$10 = _tmpl$8();
  2488. addEventListener(_el$10, "click", disabled() ? void 0 : () => {
  2489. deleteToast();
  2490. props.toast.onDismiss?.(props.toast);
  2491. }, true);
  2492. createRenderEffect((_p$) => {
  2493. var _v$ = disabled(), _v$2 = _cn(props.classes?.closeButton, props.toast?.classes?.closeButton);
  2494. _v$ !== _p$.e && setAttribute(_el$10, "data-disabled", _p$.e = _v$);
  2495. _v$2 !== _p$.t && className(_el$10, _p$.t = _v$2);
  2496. return _p$;
  2497. }, {
  2498. e: void 0,
  2499. t: void 0
  2500. });
  2501. return _el$10;
  2502. }
  2503. }), null);
  2504. insert(_el$9, createComponent(Show, {
  2505. get when() {
  2506. return props.toast.jsx || props.toast.title instanceof Element;
  2507. },
  2508. get fallback() {
  2509. return [createComponent(Show, {
  2510. get when() {
  2511. return toastType() || props.toast.icon || props.toast.promise;
  2512. },
  2513. get children() {
  2514. var _el$11 = _tmpl$10();
  2515. insert(_el$11, (() => {
  2516. var _c$ = createMemo(() => !!(props.toast.promise || props.toast.type === "loading" && !props.toast.icon));
  2517. return () => _c$() ? props.toast.icon || getLoadingIcon() : null;
  2518. })(), null);
  2519. insert(_el$11, (() => {
  2520. var _c$2 = createMemo(() => props.toast.type !== "loading");
  2521. return () => _c$2() ? props.toast.icon || props.icons?.[toastType()] || getAsset(toastType())() : null;
  2522. })(), null);
  2523. return _el$11;
  2524. }
  2525. }), (() => {
  2526. var _el$12 = _tmpl$12(), _el$13 = _el$12.firstChild;
  2527. insert(_el$13, () => props.toast.title);
  2528. insert(_el$12, createComponent(Show, {
  2529. get when() {
  2530. return props.toast.description;
  2531. },
  2532. get children() {
  2533. var _el$14 = _tmpl$11();
  2534. insert(_el$14, () => props.toast.description);
  2535. createRenderEffect(() => className(_el$14, _cn(props.descriptionClass, toastDescriptionClassname(), props.classes?.description, props.toast?.classes?.description)));
  2536. return _el$14;
  2537. }
  2538. }), null);
  2539. createRenderEffect(() => className(_el$13, _cn(props.classes?.title, props.toast?.classes?.title)));
  2540. return _el$12;
  2541. })(), createComponent(Show, {
  2542. get when() {
  2543. return props.toast.cancel;
  2544. },
  2545. get children() {
  2546. var _el$15 = _tmpl$13();
  2547. _el$15.$$click = () => {
  2548. deleteToast();
  2549. if (props.toast.cancel?.onClick) props.toast.cancel.onClick();
  2550. };
  2551. insert(_el$15, () => props.toast.cancel.label);
  2552. createRenderEffect((_p$) => {
  2553. var _v$20 = props.toast.cancelButtonStyle || props.cancelButtonStyle, _v$21 = _cn(props.classes?.cancelButton, props.toast?.classes?.cancelButton);
  2554. _p$.e = style(_el$15, _v$20, _p$.e);
  2555. _v$21 !== _p$.t && className(_el$15, _p$.t = _v$21);
  2556. return _p$;
  2557. }, {
  2558. e: void 0,
  2559. t: void 0
  2560. });
  2561. return _el$15;
  2562. }
  2563. }), createComponent(Show, {
  2564. get when() {
  2565. return props.toast.action;
  2566. },
  2567. get children() {
  2568. var _el$16 = _tmpl$14();
  2569. _el$16.$$click = (event) => {
  2570. props.toast.action?.onClick(event);
  2571. if (event.defaultPrevented) return;
  2572. deleteToast();
  2573. };
  2574. insert(_el$16, () => props.toast.action.label);
  2575. createRenderEffect((_p$) => {
  2576. var _v$22 = props.toast.actionButtonStyle || props.actionButtonStyle, _v$23 = _cn(props.classes?.actionButton, props.toast?.classes?.actionButton);
  2577. _p$.e = style(_el$16, _v$22, _p$.e);
  2578. _v$23 !== _p$.t && className(_el$16, _p$.t = _v$23);
  2579. return _p$;
  2580. }, {
  2581. e: void 0,
  2582. t: void 0
  2583. });
  2584. return _el$16;
  2585. }
  2586. })];
  2587. },
  2588. get children() {
  2589. return props.toast.jsx || props.toast.title;
  2590. }
  2591. }), null);
  2592. createRenderEffect((_p$) => {
  2593. var _v$3 = props.toast.important ? "assertive" : "polite", _v$4 = _cn(props.class, toastClassname(), props.classes?.toast, props.toast?.classes?.toast, props.classes?.default, props.classes?.[toastType()], props.toast?.classes?.[toastType()]), _v$5 = !(props.toast.jsx || props.toast.unstyled || props.unstyled), _v$6 = mounted(), _v$7 = Boolean(props.toast.promise), _v$8 = removed(), _v$9 = isVisible(), _v$10 = coords()[0], _v$11 = coords()[1], _v$12 = props.index, _v$13 = isFront(), _v$14 = swiping(), _v$15 = toastType(), _v$16 = invert(), _v$17 = swipeOut(), _v$18 = Boolean(props.expanded || props.expandByDefault && mounted()), _v$19 = {
  2594. "--index": props.index,
  2595. "--toasts-before": props.index,
  2596. "--z-index": props.toasts.length - props.index,
  2597. "--offset": `${removed() ? offsetBeforeRemove() : offset()}px`,
  2598. "--initial-height": props.expandByDefault ? "auto" : `${initialHeight()}px`,
  2599. ...props.style,
  2600. ...props.toast.style
  2601. };
  2602. _v$3 !== _p$.e && setAttribute(_el$9, "aria-live", _p$.e = _v$3);
  2603. _v$4 !== _p$.t && className(_el$9, _p$.t = _v$4);
  2604. _v$5 !== _p$.a && setAttribute(_el$9, "data-styled", _p$.a = _v$5);
  2605. _v$6 !== _p$.o && setAttribute(_el$9, "data-mounted", _p$.o = _v$6);
  2606. _v$7 !== _p$.i && setAttribute(_el$9, "data-promise", _p$.i = _v$7);
  2607. _v$8 !== _p$.n && setAttribute(_el$9, "data-removed", _p$.n = _v$8);
  2608. _v$9 !== _p$.s && setAttribute(_el$9, "data-visible", _p$.s = _v$9);
  2609. _v$10 !== _p$.h && setAttribute(_el$9, "data-y-position", _p$.h = _v$10);
  2610. _v$11 !== _p$.r && setAttribute(_el$9, "data-x-position", _p$.r = _v$11);
  2611. _v$12 !== _p$.d && setAttribute(_el$9, "data-index", _p$.d = _v$12);
  2612. _v$13 !== _p$.l && setAttribute(_el$9, "data-front", _p$.l = _v$13);
  2613. _v$14 !== _p$.u && setAttribute(_el$9, "data-swiping", _p$.u = _v$14);
  2614. _v$15 !== _p$.c && setAttribute(_el$9, "data-type", _p$.c = _v$15);
  2615. _v$16 !== _p$.w && setAttribute(_el$9, "data-invert", _p$.w = _v$16);
  2616. _v$17 !== _p$.m && setAttribute(_el$9, "data-swipe-out", _p$.m = _v$17);
  2617. _v$18 !== _p$.f && setAttribute(_el$9, "data-expanded", _p$.f = _v$18);
  2618. _p$.y = style(_el$9, _v$19, _p$.y);
  2619. return _p$;
  2620. }, {
  2621. e: void 0,
  2622. t: void 0,
  2623. a: void 0,
  2624. o: void 0,
  2625. i: void 0,
  2626. n: void 0,
  2627. s: void 0,
  2628. h: void 0,
  2629. r: void 0,
  2630. d: void 0,
  2631. l: void 0,
  2632. u: void 0,
  2633. c: void 0,
  2634. w: void 0,
  2635. m: void 0,
  2636. f: void 0,
  2637. y: void 0
  2638. });
  2639. return _el$9;
  2640. })();
  2641. };
  2642. function getDocumentDirection() {
  2643. if (typeof window === "undefined") return "ltr";
  2644. if (typeof document === "undefined") return "ltr";
  2645. const dirAttribute = document.documentElement.getAttribute("dir");
  2646. if (dirAttribute === "auto" || !dirAttribute) return window.getComputedStyle(document.documentElement).direction;
  2647. return dirAttribute;
  2648. }
  2649. var Toaster$1 = (props) => {
  2650. const propsWithDefaults = mergeProps({
  2651. position: "bottom-right",
  2652. hotkey: ["altKey", "KeyT"],
  2653. theme: "light",
  2654. visibleToasts: VISIBLE_TOASTS_AMOUNT,
  2655. dir: getDocumentDirection()
  2656. }, props);
  2657. const [toastsStore, setToastsStore] = createStore({
  2658. toasts: []
  2659. });
  2660. const possiblePositions = () => {
  2661. return Array.from(new Set([propsWithDefaults.position].concat(toastsStore.toasts.filter((toast2) => toast2.position).map((toast2) => toast2.position))));
  2662. };
  2663. const [heights, setHeights] = createSignal([]);
  2664. const [expanded, setExpanded] = createSignal(false);
  2665. const [interacting, setInteracting] = createSignal(false);
  2666. let listRef;
  2667. const hotkeyLabel = () => propsWithDefaults.hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
  2668. const [lastFocusedElementRef, setLastFocusedElementRef] = createSignal(null);
  2669. const [isFocusedWithinRef, setIsFocusedWithinRef] = createSignal(false);
  2670. const [actualTheme, setActualTheme] = createSignal(propsWithDefaults.theme !== "system" ? propsWithDefaults.theme : typeof window !== "undefined" ? window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : "light");
  2671. const removeToast = (toast2) => setToastsStore("toasts", (toasts) => toasts.filter(({
  2672. id
  2673. }) => id !== toast2.id));
  2674. onMount(() => {
  2675. const unsub = ToastState.subscribe((toast2) => {
  2676. if (toast2.dismiss) {
  2677. setToastsStore("toasts", produce((_toasts) => {
  2678. _toasts.forEach((t) => {
  2679. if (t.id === toast2.id) t.delete = true;
  2680. });
  2681. }));
  2682. return;
  2683. }
  2684. const changedIndex = toastsStore.toasts.findIndex((t) => t.id === toast2.id);
  2685. if (changedIndex !== -1) {
  2686. setToastsStore("toasts", [changedIndex], reconcile(toast2));
  2687. return;
  2688. }
  2689. setToastsStore("toasts", produce((_toasts) => {
  2690. _toasts.unshift(toast2);
  2691. }));
  2692. });
  2693. onCleanup(() => {
  2694. unsub();
  2695. });
  2696. });
  2697. createEffect(on(() => propsWithDefaults.theme, (theme) => {
  2698. if (theme !== "system") {
  2699. setActualTheme(theme);
  2700. return;
  2701. }
  2702. if (typeof window === "undefined") return;
  2703. window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", ({
  2704. matches
  2705. }) => {
  2706. if (matches) setActualTheme("dark");
  2707. else setActualTheme("light");
  2708. });
  2709. }));
  2710. createEffect(() => {
  2711. if (toastsStore.toasts.length <= 1) setExpanded(false);
  2712. });
  2713. onMount(() => {
  2714. const handleKeyDown = (event) => {
  2715. const isHotkeyPressed = propsWithDefaults.hotkey.every((key) => event[key] || event.code === key);
  2716. if (isHotkeyPressed) {
  2717. setExpanded(true);
  2718. listRef?.focus();
  2719. }
  2720. if (event.code === "Escape" && (document.activeElement === listRef || listRef?.contains(document.activeElement))) setExpanded(false);
  2721. };
  2722. document.addEventListener("keydown", handleKeyDown);
  2723. onCleanup(() => {
  2724. document.removeEventListener("keydown", handleKeyDown);
  2725. });
  2726. });
  2727. createEffect(on(() => listRef, (ref) => {
  2728. if (ref) {
  2729. onCleanup(() => {
  2730. if (lastFocusedElementRef()) {
  2731. lastFocusedElementRef()?.focus({
  2732. preventScroll: true
  2733. });
  2734. setLastFocusedElementRef(null);
  2735. setIsFocusedWithinRef(false);
  2736. }
  2737. });
  2738. }
  2739. }));
  2740. return createComponent(Show, {
  2741. get when() {
  2742. return toastsStore.toasts.length > 0;
  2743. },
  2744. get children() {
  2745. var _el$17 = _tmpl$15();
  2746. insert(_el$17, createComponent(For, {
  2747. get each() {
  2748. return possiblePositions();
  2749. },
  2750. children: (position, index) => {
  2751. const [y, x] = position.split("-");
  2752. return (() => {
  2753. var _el$18 = _tmpl$16();
  2754. _el$18.$$pointerup = () => setInteracting(false);
  2755. _el$18.$$pointerdown = () => {
  2756. setInteracting(true);
  2757. };
  2758. _el$18.addEventListener("mouseleave", () => {
  2759. if (!interacting()) setExpanded(false);
  2760. });
  2761. _el$18.$$mousemove = () => setExpanded(true);
  2762. _el$18.addEventListener("mouseenter", () => setExpanded(true));
  2763. _el$18.addEventListener("focus", (event) => {
  2764. if (!isFocusedWithinRef()) {
  2765. setIsFocusedWithinRef(true);
  2766. setLastFocusedElementRef(event.relatedTarget);
  2767. }
  2768. });
  2769. _el$18.addEventListener("blur", (event) => {
  2770. if (isFocusedWithinRef() && !event.currentTarget.contains(event.relatedTarget)) {
  2771. setIsFocusedWithinRef(false);
  2772. if (lastFocusedElementRef()) {
  2773. lastFocusedElementRef()?.focus({
  2774. preventScroll: true
  2775. });
  2776. setLastFocusedElementRef(null);
  2777. }
  2778. }
  2779. });
  2780. var _ref$2 = listRef;
  2781. typeof _ref$2 === "function" ? use(_ref$2, _el$18) : listRef = _el$18;
  2782. setAttribute(_el$18, "data-y-position", y);
  2783. setAttribute(_el$18, "data-x-position", x);
  2784. insert(_el$18, createComponent(For, {
  2785. get each() {
  2786. return toastsStore.toasts.filter((toast2) => !toast2.position && index() === 0 || toast2.position === position);
  2787. },
  2788. children: (toast2, index2) => createComponent(Toast, {
  2789. get index() {
  2790. return index2();
  2791. },
  2792. get icons() {
  2793. return propsWithDefaults.icons;
  2794. },
  2795. toast: toast2,
  2796. get duration() {
  2797. return propsWithDefaults.toastOptions?.duration ?? props.duration;
  2798. },
  2799. get ["class"]() {
  2800. return propsWithDefaults.toastOptions?.class;
  2801. },
  2802. get classes() {
  2803. return propsWithDefaults.toastOptions?.classes;
  2804. },
  2805. get cancelButtonStyle() {
  2806. return propsWithDefaults.toastOptions?.cancelButtonStyle;
  2807. },
  2808. get actionButtonStyle() {
  2809. return propsWithDefaults.toastOptions?.actionButtonStyle;
  2810. },
  2811. get descriptionClass() {
  2812. return propsWithDefaults.toastOptions?.descriptionClass;
  2813. },
  2814. get invert() {
  2815. return Boolean(propsWithDefaults.invert);
  2816. },
  2817. get visibleToasts() {
  2818. return propsWithDefaults.visibleToasts;
  2819. },
  2820. get closeButton() {
  2821. return Boolean(propsWithDefaults.closeButton);
  2822. },
  2823. get interacting() {
  2824. return interacting();
  2825. },
  2826. get position() {
  2827. return propsWithDefaults.position;
  2828. },
  2829. get style() {
  2830. return propsWithDefaults.toastOptions?.style;
  2831. },
  2832. get unstyled() {
  2833. return propsWithDefaults.toastOptions?.unstyled;
  2834. },
  2835. removeToast,
  2836. get toasts() {
  2837. return toastsStore.toasts;
  2838. },
  2839. get heights() {
  2840. return heights();
  2841. },
  2842. setHeights,
  2843. get expandByDefault() {
  2844. return Boolean(propsWithDefaults.expand);
  2845. },
  2846. get gap() {
  2847. return propsWithDefaults.gap;
  2848. },
  2849. get expanded() {
  2850. return expanded();
  2851. },
  2852. get pauseWhenPageIsHidden() {
  2853. return propsWithDefaults.pauseWhenPageIsHidden;
  2854. }
  2855. })
  2856. }));
  2857. createRenderEffect((_p$) => {
  2858. var _v$24 = propsWithDefaults.dir === "auto" ? getDocumentDirection() : propsWithDefaults.dir, _v$25 = propsWithDefaults.class, _v$26 = actualTheme(), _v$27 = propsWithDefaults.richColors, _v$28 = {
  2859. "--front-toast-height": `${heights()[0]?.height}px`,
  2860. "--offset": typeof propsWithDefaults.offset === "number" ? `${propsWithDefaults.offset}px` : propsWithDefaults.offset || VIEWPORT_OFFSET,
  2861. "--width": `${TOAST_WIDTH}px`,
  2862. "--gap": `${GAP}px`,
  2863. ...propsWithDefaults.style
  2864. };
  2865. _v$24 !== _p$.e && setAttribute(_el$18, "dir", _p$.e = _v$24);
  2866. _v$25 !== _p$.t && className(_el$18, _p$.t = _v$25);
  2867. _v$26 !== _p$.a && setAttribute(_el$18, "data-theme", _p$.a = _v$26);
  2868. _v$27 !== _p$.o && setAttribute(_el$18, "data-rich-colors", _p$.o = _v$27);
  2869. _p$.i = style(_el$18, _v$28, _p$.i);
  2870. return _p$;
  2871. }, {
  2872. e: void 0,
  2873. t: void 0,
  2874. a: void 0,
  2875. o: void 0,
  2876. i: void 0
  2877. });
  2878. return _el$18;
  2879. })();
  2880. }
  2881. }));
  2882. createRenderEffect(() => setAttribute(_el$17, "aria-label", `Notifications ${hotkeyLabel()}`));
  2883. return _el$17;
  2884. }
  2885. });
  2886. };
  2887. /*!
  2888. * Original code by Emil Kowalski
  2889. * MIT Licensed, Copyright 2023 Emil Kowalski, see https://github.com/emilkowalski/sonner/blob/main/LICENSE.md for details
  2890. *
  2891. * Credits:
  2892. * https://github.com/emilkowalski/sonner/blob/main/src/index.tsx
  2893. */
  2894. delegateEvents(["pointerdown", "pointerup", "pointermove", "click", "mousemove"]);
  2895.  
  2896. const propsData = [{
  2897. name: "Definition",
  2898. options: {
  2899. source: {
  2900. target: "geofs.aircraft.instance",
  2901. prop: "definition"
  2902. },
  2903. reactive: true,
  2904. reset: true,
  2905. allowed: [{
  2906. name: "airbrakesTravelTime",
  2907. type: "float"
  2908. }, {
  2909. name: "accessoriesTravelTime",
  2910. type: "float"
  2911. }, {
  2912. name: "flapsTravelTime",
  2913. type: "float"
  2914. }, {
  2915. name: "flapsSteps",
  2916. type: "int"
  2917. }, {
  2918. name: "gearTravelTime",
  2919. type: "float"
  2920. }, {
  2921. name: "zeroThrustAltitude",
  2922. type: "int"
  2923. }, {
  2924. name: "zeroRPMAltitude",
  2925. type: "int"
  2926. }, {
  2927. name: "mass",
  2928. type: "int"
  2929. }, {
  2930. name: "minRPM",
  2931. type: "int",
  2932. comment: "not recommended"
  2933. }, {
  2934. name: "maxRPM",
  2935. type: "int",
  2936. comment: "not recommended"
  2937. }],
  2938. ignored: ["object", "function", "undefined", "null", "boolean", "symbol", "array"]
  2939. }
  2940. }, {
  2941. name: "Engines",
  2942. options: {
  2943. source: {
  2944. target: "geofs.aircraft.instance",
  2945. prop: "engines"
  2946. },
  2947. reactive: true,
  2948. allowed: [{
  2949. name: "thrust",
  2950. type: "int"
  2951. }, {
  2952. name: "afterBurnerThrust",
  2953. type: "int"
  2954. }, {
  2955. name: "reverseThrust",
  2956. type: "int"
  2957. }],
  2958. ignored: ["object", "function", "undefined", "null", "boolean", "symbol", "array"]
  2959. }
  2960. }, {
  2961. name: "id",
  2962. options: {
  2963. source: {
  2964. target: "geofs.aircraft.instance",
  2965. prop: "id"
  2966. },
  2967. reactive: true
  2968. }
  2969. }];
  2970.  
  2971. function getObjectFromPath(path) {
  2972. const parts = path.split(".");
  2973. let obj = unsafeWindow;
  2974. for (let part of parts) {
  2975. obj = obj[part];
  2976. if (obj === void 0) {
  2977. throw new Error(`Path ${path} does not exist`);
  2978. }
  2979. }
  2980. return obj;
  2981. }
  2982.  
  2983. class Reactive {
  2984. static _options = {
  2985. cloneAfterCreation: false,
  2986. temp: null
  2987. };
  2988. static _cache = {};
  2989. static set cache(value) {
  2990. this._cache = value;
  2991. }
  2992. static get cache() {
  2993. return this._cache;
  2994. }
  2995. static set options(value) {
  2996. this._options = value;
  2997. }
  2998. static get options() {
  2999. return this._options;
  3000. }
  3001. static parse(obj, propName, options = {}) {
  3002. let target = obj;
  3003. try {
  3004. if (typeof obj === "string") {
  3005. target = getObjectFromPath(obj);
  3006. } else if (typeof obj === "object") {
  3007. target = obj;
  3008. } else {
  3009. throw new Error("The first argument to parse must be an object or string path.", obj);
  3010. }
  3011. if (typeof propName !== "string") {
  3012. throw new Error("The second argument to parse must be a string.", propName);
  3013. }
  3014. if (target === void 0) {
  3015. throw new Error("Invalid target.", target);
  3016. }
  3017. if (propName === void 0) {
  3018. throw new Error("Invalid property.", propName);
  3019. }
  3020. let value = target[propName];
  3021. if (value === void 0) {
  3022. throw new Error("Invalid value.", value);
  3023. }
  3024. const [prop, setProp] = createSignal(value);
  3025. const cloneAfterCreation = (() => options?.cloneAfterCreation !== void 0 ? options?.cloneAfterCreation : this._options?.cloneAfterCreation)();
  3026. if (prop === void 0 || setProp === void 0) {
  3027. throw new Error("Signal not created.");
  3028. }
  3029. Object.defineProperty(target, propName, {
  3030. get: function() {
  3031. return prop();
  3032. },
  3033. set: function(newValue) {
  3034. value = newValue;
  3035. setProp(newValue);
  3036. }
  3037. });
  3038. if (Object.getOwnPropertyDescriptor(target, propName) === void 0) {
  3039. throw new Error("Reactive property not created.");
  3040. }
  3041. if (cloneAfterCreation) {
  3042. if (this._options.temp === null) {
  3043. throw new Error("Temporary object not defined.");
  3044. }
  3045. if (this._cache[propName] !== void 0) {
  3046. throw new Error("Property already exists in cache.", propName);
  3047. }
  3048. const [reactiveProp, setReactiveProp] = [prop, setProp];
  3049. if (reactiveProp === void 0 || setReactiveProp === void 0) {
  3050. throw new Error("Reactive property not cloned.");
  3051. }
  3052. this._cache[propName] = true;
  3053. Object.defineProperty(this._options.temp, propName, {
  3054. get: function() {
  3055. return reactiveProp();
  3056. },
  3057. set: function(newValue) {
  3058. setReactiveProp(newValue);
  3059. }
  3060. });
  3061. if (Object.getOwnPropertyDescriptor(this._options.temp, propName) === void 0) {
  3062. throw new Error("Reactive property clone not defined.", propName);
  3063. }
  3064. }
  3065. return [prop, setProp];
  3066. } catch (e) {
  3067. console.error(e);
  3068. }
  3069. }
  3070. }
  3071.  
  3072. class Props {
  3073. static _reactive = Reactive;
  3074. static _data = {};
  3075. static get reactive() {
  3076. return this._reactive;
  3077. }
  3078. static set reactive(value) {
  3079. this._reactive = value;
  3080. }
  3081. static async load(...arr) {
  3082. return await new Promise((resolve, reject) => {
  3083. try {
  3084. if (!arr.length) {
  3085. throw new Error("No props to load");
  3086. }
  3087. if (!Array.isArray(arr)) {
  3088. throw new Error("Props must be an array");
  3089. }
  3090. for (const item of arr[0]) {
  3091. const {
  3092. name,
  3093. options
  3094. } = item;
  3095. const {
  3096. source
  3097. } = options;
  3098. if (options.reactive) {
  3099. if (!options.source) {
  3100. throw new Error("Reactive props require a source");
  3101. }
  3102. if (!options.source.target || !options.source.prop) {
  3103. throw new Error("Reactive props require a target and prop");
  3104. }
  3105. this._reactive.parse(source.target, source.prop, options.source?.options);
  3106. }
  3107. Object.defineProperty(this, name, {
  3108. get: function() {
  3109. return this._data[name];
  3110. },
  3111. set: function(newValue) {
  3112. this._data[name] = newValue;
  3113. }
  3114. });
  3115. this[name] = {
  3116. allowed: options.allowed || [],
  3117. ignored: options.ignored || [],
  3118. reset: options.reset || false
  3119. };
  3120. }
  3121. resolve(true);
  3122. } catch (e) {
  3123. reject(e);
  3124. }
  3125. });
  3126. }
  3127. }
  3128.  
  3129. const toastOptions = {
  3130. duration: 2e3,
  3131. closeButton: true
  3132. };
  3133.  
  3134. var _tmpl$$4 = /* @__PURE__ */ template(`<li class="flex gap-2"><label class="flex-none w-fit">:</label><input>`), _tmpl$2$3 = /* @__PURE__ */ template(`<br>`), _tmpl$3$1 = /* @__PURE__ */ template(`<span class="text-sm text-slate-500">`), _tmpl$4$1 = /* @__PURE__ */ template(`<li class="flex gap-2"><button class="w-fit m-2 border-0 rounded-md px-3 bg-sky-600 text-white shadow-md hover:bg-sky-700 hover:cursor-pointer">Reset</button><button class="w-fit m-2 border-0 rounded-md px-3 bg-sky-600 text-white shadow-md hover:bg-sky-700 hover:cursor-pointer">Save</button><button class="w-fit m-2 border-0 rounded-md px-3 bg-sky-600 text-white shadow-md hover:bg-sky-700 hover:cursor-pointer">Load`);
  3135. const getDefinitions = async () => {
  3136. return await new Promise((resolve, reject) => {
  3137. try {
  3138. const {
  3139. allowed,
  3140. ignored,
  3141. reset
  3142. } = Props.Definition;
  3143. const definition = flightAssistant.instance.definition;
  3144. if (!definition) throw new Error("No definition found.");
  3145. const response = [];
  3146. for (const item of Object.entries(definition)) {
  3147. const [propName, prop] = item;
  3148. const propType = typeof prop;
  3149. if (ignored.includes(propType)) continue;
  3150. const isAllowed = allowed.some((p) => p.name === propName);
  3151. if (!isAllowed) continue;
  3152. const syncType = allowed.find((p) => p.name === propName).type;
  3153. if (!syncType) continue;
  3154. const hasComment = allowed.find((p) => p.name === propName).comment;
  3155. const isNum = ["int", "float", "number"].includes(syncType) || propType === "number";
  3156. const isInt = syncType === "int";
  3157. const isFloat = syncType === "float";
  3158. const isText = syncType === "string";
  3159. let props = {};
  3160. if (isText) {
  3161. props.placeholder = "Text";
  3162. } else if (isNum) {
  3163. props.min = isInt ? "0" : isFloat ? "0.0" : null;
  3164. props.max = isInt ? parseInt(prop * 2) : isFloat ? parseFloat(prop * 2) : null;
  3165. props.step = isInt ? "1" : isFloat ? "0.2" : null;
  3166. props.placeholder = `Between ${props.min} and ${props.max}`;
  3167. }
  3168. if (reset) props["data-definitions-default"] = prop;
  3169. props["data-definitions-propname"] = propName;
  3170. props["data-definitions-type"] = syncType;
  3171. response.push((() => {
  3172. var _el$ = _tmpl$$4(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$2.nextSibling;
  3173. setAttribute(_el$2, "for", `set${propName}`);
  3174. insert(_el$2, propName, _el$3);
  3175. insert(_el$2, hasComment ? [_tmpl$2$3(), (() => {
  3176. var _el$6 = _tmpl$3$1();
  3177. insert(_el$6, hasComment);
  3178. return _el$6;
  3179. })()] : null, null);
  3180. setAttribute(_el$4, "id", `set${propName}`);
  3181. setAttribute(_el$4, "type", isNum ? "number" : isText ? "text" : null);
  3182. spread(_el$4, mergeProps(props, {
  3183. "class": "flex-auto w-max m-2 border-0 rounded-md p-2 shadow-md",
  3184. "oninput": async (e) => {
  3185. let that = e.target;
  3186. let [min, max, value] = ["min", "max", "value"].map((e2) => isNum ? parseFloat(that[e2]) : that[e2]);
  3187. let type = that.type;
  3188. await new Promise((resolve2, reject2) => {
  3189. if (type == "number" && value > min && value <= max) {
  3190. let newMax = value * 2 * 100;
  3191. e.target.max = newMax < 1 ? 10 : newMax;
  3192. flightAssistant.instance.definition[propName] = value;
  3193. that.placeholder = `Between ${min} and ${max}`;
  3194. resolve2(`${propName} set to ${value}`);
  3195. } else if (type == "text" && !value) {
  3196. flightAssistant.instance.definition[propName] = value;
  3197. resolve2(`${propName} set to ${value}`);
  3198. } else {
  3199. reject2(isNum ? `Value must be between ${min} and ${max}` : isText ? `Value must be text` : `Invalid value`);
  3200. }
  3201. }).then((msg) => toast.success(msg, toastOptions)).catch((msg) => toast.error(msg, toastOptions));
  3202. }
  3203. }), false, false);
  3204. return _el$;
  3205. })());
  3206. }
  3207. if (reset) {
  3208. response.unshift((() => {
  3209. var _el$7 = _tmpl$4$1(), _el$8 = _el$7.firstChild, _el$9 = _el$8.nextSibling, _el$10 = _el$9.nextSibling;
  3210. _el$8.$$click = () => {
  3211. const inputs = document.querySelectorAll("input[data-definitions-default]");
  3212. inputs.forEach((input) => {
  3213. let prefix = "data-definitions-";
  3214. let value = input.getAttribute(`${prefix}default`);
  3215. let propName = input.getAttribute(`${prefix}propname`);
  3216. let type = input.getAttribute(`${prefix}type`);
  3217. if (type === "int") value = parseInt(value);
  3218. if (type === "float") value = parseFloat(value);
  3219. input.value = value;
  3220. flightAssistant.instance.definition[propName] = value;
  3221. });
  3222. if (inputs.length) toast.success("Definitions reset", toastOptions);
  3223. else toast.error("No definitions to reset", toastOptions);
  3224. };
  3225. _el$9.$$click = () => {
  3226. toast.info("Coming soon..", toastOptions);
  3227. };
  3228. _el$10.$$click = () => {
  3229. toast.info("Coming soon..", toastOptions);
  3230. };
  3231. return _el$7;
  3232. })());
  3233. }
  3234. resolve(response);
  3235. } catch (e) {
  3236. reject(e);
  3237. }
  3238. });
  3239. };
  3240. delegateEvents(["click"]);
  3241.  
  3242. var _tmpl$$3 = /* @__PURE__ */ template(`<svg xmlns=http://www.w3.org/2000/svg width=16 height=16 viewBox="0 0 16 16"><path fill-rule=evenodd d="M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z">`);
  3243. const GroupRotation = (props) => {
  3244. return (() => {
  3245. var _el$ = _tmpl$$3();
  3246. createRenderEffect((_p$) => {
  3247. var _v$ = `w-5 h-5 text-gray-500 transition group-open/${props["group-open"]}:rotate-90`, _v$2 = props.fill || "currentColor";
  3248. _v$ !== _p$.e && setAttribute(_el$, "class", _p$.e = _v$);
  3249. _v$2 !== _p$.t && setAttribute(_el$, "fill", _p$.t = _v$2);
  3250. return _p$;
  3251. }, {
  3252. e: void 0,
  3253. t: void 0
  3254. });
  3255. return _el$;
  3256. })();
  3257. };
  3258.  
  3259. var _tmpl$$2 = /* @__PURE__ */ template(`<details><summary class="flex items-center justify-between gap-2 p-2 font-medium marker:content-none hover:cursor-pointer"><span class="flex gap-2"></span></summary><article class="px-4 pb-4"><ul class="flex flex-col gap-4 pl-2 mt-4">`), _tmpl$2$2 = /* @__PURE__ */ template(`<li class="flex gap-2"><label>:</label><input>`);
  3260. const getEngines = async () => {
  3261. return await new Promise((resolve, reject) => {
  3262. try {
  3263. const {
  3264. allowed,
  3265. ignored
  3266. } = Props.Engines;
  3267. const engines = flightAssistant.instance.engines;
  3268. if (!engines) throw new Error("No engines found.");
  3269. const response = [];
  3270. for (let i = 0; i < engines.length; i++) {
  3271. response.push((() => {
  3272. var _el$ = _tmpl$$2(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$2.nextSibling, _el$5 = _el$4.firstChild;
  3273. className(_el$, "group/engine" + i);
  3274. insert(_el$3, createComponent(Switch, {
  3275. get children() {
  3276. return [createComponent(Match, {
  3277. get when() {
  3278. return engines[i].name;
  3279. },
  3280. get children() {
  3281. return engines[i].name;
  3282. }
  3283. }), createComponent(Match, {
  3284. get when() {
  3285. return !engines[i].name;
  3286. },
  3287. get children() {
  3288. return ["Engine ", i + 1];
  3289. }
  3290. })];
  3291. }
  3292. }));
  3293. insert(_el$2, createComponent(GroupRotation, {
  3294. "group-open": `engine${i}`
  3295. }), null);
  3296. insert(_el$5, createComponent(For, {
  3297. get each() {
  3298. return Object.entries(engines[i]);
  3299. },
  3300. children: (item) => {
  3301. const [propName, prop] = item;
  3302. const propType = typeof prop;
  3303. if (ignored.includes(propType)) return null;
  3304. const isAllowed = allowed.some((p) => p.name === propName);
  3305. if (!isAllowed) return null;
  3306. const syncType = allowed.find((p) => p.name === propName).type;
  3307. if (!syncType) return null;
  3308. const isNum = ["int", "float", "number"].includes(syncType) || propType === "number";
  3309. const isInt = syncType === "int";
  3310. const isFloat = syncType === "float";
  3311. const isText = syncType === "string";
  3312. let props = {};
  3313. if (isText) {
  3314. props.placeholder = "Text";
  3315. } else if (isNum) {
  3316. props.min = isInt ? "0" : isFloat ? "0.0" : null;
  3317. props.max = isInt ? parseInt(prop * 2) : isFloat ? parseFloat(prop * 2) : null;
  3318. props.step = isInt ? "1" : isFloat ? "0.2" : null;
  3319. props.placeholder = `Between ${props.min} and ${props.max}`;
  3320. }
  3321. return (() => {
  3322. var _el$6 = _tmpl$2$2(), _el$7 = _el$6.firstChild, _el$8 = _el$7.firstChild, _el$9 = _el$7.nextSibling;
  3323. insert(_el$7, propName, _el$8);
  3324. setAttribute(_el$9, "type", isNum ? "number" : isText ? "text" : null);
  3325. spread(_el$9, mergeProps({
  3326. get id() {
  3327. return `set${engines[i].name}${propName}`;
  3328. }
  3329. }, props, {
  3330. "class": "w-11/12 m-2 border-0 rounded-md p-2 shadow-md",
  3331. "oninput": async (e) => {
  3332. let that = e.target;
  3333. let [min, max, value] = ["min", "max", "value"].map((e2) => isNum ? parseFloat(that[e2]) : that[e2]);
  3334. let type = that.type;
  3335. await new Promise((resolve2, reject2) => {
  3336. if (type == "number" && value > min && value <= max) {
  3337. let newMax = value * 2 * 100;
  3338. e.target.max = newMax < 1 ? 10 : newMax;
  3339. flightAssistant.instance.engines[i][propName] = value;
  3340. that.placeholder = `Between ${min} and ${max}`;
  3341. resolve2(`${engines[i].name}${propName} set to ${value}`);
  3342. } else if (type == "text" && !value) {
  3343. flightAssistant.instance.engines[i][propName] = value;
  3344. resolve2(`${engines[i].name}${propName} set to ${value}`);
  3345. } else {
  3346. reject2(isNum ? `Value must be between ${min} and ${max}` : isText ? `Value must be text` : `Invalid value`);
  3347. }
  3348. }).then((msg) => toast.success(msg, toastOptions)).catch((msg) => toast.error(msg, toastOptions));
  3349. }
  3350. }), false, false);
  3351. createRenderEffect(() => setAttribute(_el$7, "for", `set${engines[i].name}${propName}`));
  3352. return _el$6;
  3353. })();
  3354. }
  3355. }));
  3356. return _el$;
  3357. })());
  3358. }
  3359. resolve(response);
  3360. } catch (e) {
  3361. reject(e);
  3362. }
  3363. });
  3364. };
  3365.  
  3366. const Groups = () => [{
  3367. name: "definitions",
  3368. title: "Definitions",
  3369. icon: true,
  3370. resource: createResource(getDefinitions),
  3371. reference: null
  3372. }, {
  3373. name: "engines",
  3374. title: "Engines",
  3375. icon: true,
  3376. resource: createResource(getEngines),
  3377. reference: null
  3378. }];
  3379.  
  3380. var _tmpl$$1 = /* @__PURE__ */ template(`<summary class="flex items-center justify-between gap-2 p-2 font-medium marker:content-none hover:cursor-pointer"><span class="flex gap-2">`), _tmpl$2$1 = /* @__PURE__ */ template(`<span>Loading...`), _tmpl$3 = /* @__PURE__ */ template(`<span>Error: `), _tmpl$4 = /* @__PURE__ */ template(`<article class="px-4 pb-4"><ul class="flex flex-col gap-4 pl-2 mt-4">`), _tmpl$5 = /* @__PURE__ */ template(`<div> Loading...`), _tmpl$6 = /* @__PURE__ */ template(`<details>`);
  3381. const Summary = (props) => {
  3382. return (() => {
  3383. var _el$ = _tmpl$$1(), _el$2 = _el$.firstChild;
  3384. insert(_el$2, () => props.title);
  3385. insert(_el$, createComponent(GroupRotation, {
  3386. get ["group-open"]() {
  3387. return props.name;
  3388. }
  3389. }), null);
  3390. return _el$;
  3391. })();
  3392. };
  3393. const Article = (props) => {
  3394. return (() => {
  3395. var _el$3 = _tmpl$4(), _el$4 = _el$3.firstChild;
  3396. var _ref$ = props.reference;
  3397. typeof _ref$ === "function" ? use(_ref$, _el$4) : props.reference = _el$4;
  3398. insert(_el$4, createComponent(Suspense, {
  3399. get fallback() {
  3400. return (() => {
  3401. var _el$8 = _tmpl$5(), _el$9 = _el$8.firstChild;
  3402. insert(_el$8, () => props.title, _el$9);
  3403. return _el$8;
  3404. })();
  3405. },
  3406. get children() {
  3407. return createComponent(Switch, {
  3408. get children() {
  3409. return [createComponent(Match, {
  3410. get when() {
  3411. return props.resource?.loading;
  3412. },
  3413. get children() {
  3414. return _tmpl$2$1();
  3415. }
  3416. }), createComponent(Match, {
  3417. get when() {
  3418. return props.resource?.error;
  3419. },
  3420. get children() {
  3421. var _el$6 = _tmpl$3(); _el$6.firstChild;
  3422. insert(_el$6, () => props.resource.error, null);
  3423. return _el$6;
  3424. }
  3425. }), createComponent(Match, {
  3426. get when() {
  3427. return props.resource();
  3428. },
  3429. get children() {
  3430. return createComponent(For, {
  3431. get each() {
  3432. return props.resource();
  3433. },
  3434. children: (i) => {
  3435. return i;
  3436. }
  3437. });
  3438. }
  3439. })];
  3440. }
  3441. });
  3442. }
  3443. }));
  3444. return _el$3;
  3445. })();
  3446. };
  3447. const Details = (props) => {
  3448. return (() => {
  3449. var _el$10 = _tmpl$6();
  3450. insert(_el$10, createComponent(Summary, props), null);
  3451. insert(_el$10, createComponent(Article, props), null);
  3452. createRenderEffect(() => className(_el$10, "group/" + props.name));
  3453. return _el$10;
  3454. })();
  3455. };
  3456. const Group = (props) => {
  3457. try {
  3458. if (!props.name || !props.resource) {
  3459. throw new Error("Group component requires a name and resource prop.");
  3460. }
  3461. if (typeof props.resource !== "function") {
  3462. throw new Error("Group component resource prop must be an function.");
  3463. }
  3464. let {
  3465. name,
  3466. resource
  3467. } = props;
  3468. let icon = props.icon || true;
  3469. let title = props.title || name;
  3470. let reference = props.reference || null;
  3471. return createComponent(Details, {
  3472. name,
  3473. title,
  3474. resource,
  3475. icon,
  3476. reference
  3477. });
  3478. } catch (e) {
  3479. console.error(e);
  3480. return null;
  3481. }
  3482. };
  3483.  
  3484. const ui = {
  3485. left: document.querySelector(".geofs-ui-left"),
  3486. bottom: document.querySelector(".geofs-ui-bottom")
  3487. };
  3488.  
  3489. var _tmpl$ = /* @__PURE__ */ template(`<ul class="geofs-list geofs-toggle-panel geofs-efi-list"data-noblur=true data-onshow={geofs.initializePreferencesPanel()} data-onhide={geofs.savePreferencesPanel()}>`), _tmpl$2 = /* @__PURE__ */ template(`<button class="mdl-button mdl-js-button geofs-f-standard-ui"id=geofs-efi-button tabindex=0 data-upgraded=,MaterialButton data-toggle-panel=.geofs-efi-list data-tooltip-classname=mdl-tooltip--top title="Experimental Flight Interface">CONFIG`);
  3490. const MenuComponent = () => {
  3491. const groups = Groups();
  3492. const [currentAircraftId, setCurrentAircraftId] = createSignal();
  3493. setCurrentAircraftId(flightAssistant.instance.id);
  3494. const sameAircraftId = createMemo(() => flightAssistant.instance.id === currentAircraftId());
  3495. createEffect(() => {
  3496. if (!sameAircraftId()) {
  3497. setCurrentAircraftId(flightAssistant.instance.id);
  3498. setTimeout(() => {
  3499. for (let i = 0; i < groups.length; i++) {
  3500. groups[i].resource[1].refetch();
  3501. }
  3502. }, 1e3);
  3503. }
  3504. });
  3505. onMount(() => {
  3506. for (let i = 0; i < groups.length; i++) {
  3507. let {
  3508. name,
  3509. reference
  3510. } = groups[i];
  3511. flightAssistant.refs[name] = reference;
  3512. }
  3513. });
  3514. return createComponent(For, {
  3515. each: groups,
  3516. children: (group) => {
  3517. return createComponent(Group, {
  3518. get name() {
  3519. return group.name;
  3520. },
  3521. get title() {
  3522. return group.title;
  3523. },
  3524. get icon() {
  3525. return group.icon;
  3526. },
  3527. get resource() {
  3528. return group.resource[0];
  3529. },
  3530. get reference() {
  3531. return group.reference;
  3532. }
  3533. });
  3534. }
  3535. });
  3536. };
  3537. const ContainerComponent = () => {
  3538. let ref;
  3539. onMount(() => {
  3540. flightAssistant.refs.container = ref;
  3541. });
  3542. onCleanup(() => {
  3543. flightAssistant.refs.container = null;
  3544. });
  3545. return (() => {
  3546. var _el$ = _tmpl$();
  3547. var _ref$ = ref;
  3548. typeof _ref$ === "function" ? use(_ref$, _el$) : ref = _el$;
  3549. insert(_el$, createComponent(MenuComponent, {}));
  3550. return _el$;
  3551. })();
  3552. };
  3553. const ButtonComponent = () => {
  3554. let ref;
  3555. onMount(() => {
  3556. flightAssistant.refs.button = ref;
  3557. });
  3558. onCleanup(() => {
  3559. flightAssistant.refs.button = null;
  3560. });
  3561. return (() => {
  3562. var _el$2 = _tmpl$2();
  3563. var _ref$2 = ref;
  3564. typeof _ref$2 === "function" ? use(_ref$2, _el$2) : ref = _el$2;
  3565. return _el$2;
  3566. })();
  3567. };
  3568. const Container = () => render(() => createComponent(ContainerComponent, {}), ui.left);
  3569. const Button = () => render(() => createComponent(ButtonComponent, {}), ui.bottom);
  3570.  
  3571. const Toaster = () => {
  3572. return createComponent(Portal, {
  3573. get mount() {
  3574. return document.body;
  3575. },
  3576. get children() {
  3577. return createComponent(Toaster$1, {
  3578. position: "top-right",
  3579. gap: 8,
  3580. expand: false,
  3581. richColors: true
  3582. });
  3583. }
  3584. });
  3585. };
  3586.  
  3587. const App = () => {
  3588. const flightAssistant = {
  3589. version: GM.info.script.version,
  3590. refs: {},
  3591. instance: {}
  3592. };
  3593. Props.reactive.options = {
  3594. cloneAfterCreation: true,
  3595. temp: flightAssistant.instance
  3596. };
  3597. unsafeWindow.executeOnEventDone("geofsStarted", function() {
  3598. const starter = new Promise((resolve, reject) => {
  3599. setTimeout(() => {
  3600. try {
  3601. Props.load(propsData);
  3602. Container();
  3603. Button();
  3604. resolve("Assistant Started.");
  3605. } catch (e) {
  3606. reject(e);
  3607. }
  3608. }, 5e3);
  3609. });
  3610. toast.promise(starter, {
  3611. loading: "Assistant is starting..",
  3612. success: (data) => data,
  3613. error: (err) => `Error: ${err.message}`
  3614. });
  3615. });
  3616. unsafeWindow.flightAssistant = flightAssistant;
  3617. return createComponent(Toaster, {});
  3618. };
  3619.  
  3620. const root = document.body;
  3621. render(() => createComponent(App, {}), root);