From 92fde0584710f9e82bf898d48629b594e0c37ccd Mon Sep 17 00:00:00 2001 From: legop3 Date: Sun, 26 Apr 2026 23:23:52 -0400 Subject: [PATCH] vip tab restyling --- server/public/assets/index-CkmtWYSn.css | 1 - server/public/assets/index-DVTOmRBl.css | 1 + .../{index-BH5wEcCw.js => index-DnfihTn0.js} | 2 +- server/public/index.html | 4 +- webui/src/components/VipPanel.jsx | 21 +- .../src/components/vip/VipAudioUploadCard.jsx | 233 +++++++++--------- 6 files changed, 129 insertions(+), 133 deletions(-) delete mode 100644 server/public/assets/index-CkmtWYSn.css create mode 100644 server/public/assets/index-DVTOmRBl.css rename server/public/assets/{index-BH5wEcCw.js => index-DnfihTn0.js} (93%) diff --git a/server/public/assets/index-CkmtWYSn.css b/server/public/assets/index-CkmtWYSn.css deleted file mode 100644 index 680a8fe5..00000000 --- a/server/public/assets/index-CkmtWYSn.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.panel{border-radius:.375rem;--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity));padding:0;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.panel-section{border-radius:.375rem;--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity));padding:0;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.panel-muted{border-radius:.375rem;font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.surface{border-radius:.375rem;--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity));padding:.125rem;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.surface-muted{border-radius:.375rem;--tw-bg-opacity: 1;background-color:rgb(64 64 64 / var(--tw-bg-opacity));padding:.125rem;--tw-text-opacity: 1;color:rgb(245 245 245 / var(--tw-text-opacity))}.field-input{border-radius:.375rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(82 82 82 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(64 64 64 / var(--tw-bg-opacity));padding:.125rem;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.field-input::-moz-placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.field-input::placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.field-input:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity: 1;--tw-ring-color: rgb(14 165 233 / var(--tw-ring-opacity))}.button-dark{border-radius:.375rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(125 211 252 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(2 132 199 / var(--tw-bg-opacity));padding:.125rem;font-size:.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.button-dark:hover{--tw-border-opacity: 1;border-color:rgb(14 165 233 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity))}.button-danger{border-radius:.375rem;--tw-bg-opacity: 1;background-color:rgb(225 29 72 / var(--tw-bg-opacity));padding:.125rem;font-size:.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.button-danger:hover{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity))}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.\!visible{visibility:visible!important}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.inset-x-0{left:0;right:0}.bottom-0{bottom:0}.bottom-0\.5{bottom:.125rem}.bottom-1{bottom:.25rem}.bottom-2{bottom:.5rem}.left-0{left:0}.left-0\.5{left:.125rem}.left-1{left:.25rem}.left-1\/2{left:50%}.left-2{left:.5rem}.right-0{right:0}.right-0\.5{right:.125rem}.right-1{right:.25rem}.right-2{right:.5rem}.top-0{top:0}.top-0\.5{top:.125rem}.top-1{top:.25rem}.top-1\/2{top:50%}.top-10{top:2.5rem}.top-6{top:1.5rem}.z-10{z-index:10}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[120\]{z-index:120}.order-1{order:1}.order-2{order:2}.col-span-full{grid-column:1 / -1}.m-0{margin:0}.mx-auto{margin-left:auto;margin-right:auto}.-mt-0\.5{margin-top:-.125rem}.mr-0{margin-right:0}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-auto{margin-top:auto}.\!block{display:block!important}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.aspect-\[4\/3\]{aspect-ratio:4/3}.aspect-square{aspect-ratio:1 / 1}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-28{height:7rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-64{height:16rem}.h-\[14rem\]{height:14rem}.h-\[2px\]{height:2px}.h-\[3\.5rem\]{height:3.5rem}.h-\[70\%\]{height:70%}.h-\[7rem\]{height:7rem}.h-\[min\(100svh\,32rem\)\]{height:min(100svh,32rem)}.h-\[min\(60svh\,24rem\)\]{height:min(60svh,24rem)}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-40{max-height:10rem}.max-h-52{max-height:13rem}.max-h-72{max-height:18rem}.max-h-80{max-height:20rem}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-\[1\.5rem\]{min-height:1.5rem}.min-h-\[14rem\]{min-height:14rem}.min-h-\[16rem\]{min-height:16rem}.min-h-\[3\.5rem\]{min-height:3.5rem}.min-h-\[5rem\]{min-height:5rem}.min-h-screen{min-height:100vh}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-7{width:1.75rem}.w-\[12\.5rem\]{width:12.5rem}.w-\[12rem\]{width:12rem}.w-\[20rem\]{width:20rem}.w-\[2px\]{width:2px}.w-\[9rem\]{width:9rem}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-screen{width:100vw}.min-w-0{min-width:0px}.min-w-\[0\]{min-width:0}.min-w-\[10rem\]{min-width:10rem}.min-w-\[12rem\]{min-width:12rem}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-\[70vw\]{max-width:70vw}.max-w-\[80vw\]{max-width:80vw}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.flex-1{flex:1 1 0%}.flex-\[1\.1\]{flex:1.1}.flex-\[1\.22\]{flex:1.22}.flex-\[1_1_12rem\]{flex:1 1 12rem}.shrink-0{flex-shrink:0}.basis-full{flex-basis:100%}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize{resize:both}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-\[minmax\(0\,0\.7fr\)_minmax\(0\,2\.1fr\)_minmax\(0\,0\.7fr\)\]{grid-template-columns:minmax(0,.7fr) minmax(0,2.1fr) minmax(0,.7fr)}.grid-cols-\[minmax\(0\,1\.2fr\)_repeat\(4\,minmax\(0\,1fr\)\)\]{grid-template-columns:minmax(0,1.2fr) repeat(4,minmax(0,1fr))}.grid-cols-\[minmax\(0\,1\.35fr\)_minmax\(0\,0\.95fr\)\]{grid-template-columns:minmax(0,1.35fr) minmax(0,.95fr)}.grid-cols-\[minmax\(0\,1\.3fr\)_minmax\(0\,0\.22fr\)\]{grid-template-columns:minmax(0,1.3fr) minmax(0,.22fr)}.grid-cols-\[minmax\(0\,1fr\)_auto\]{grid-template-columns:minmax(0,1fr) auto}.grid-cols-\[minmax\(0\,1fr\)_minmax\(0\,0\.7fr\)_minmax\(0\,1\.9fr\)_minmax\(0\,0\.7fr\)\]{grid-template-columns:minmax(0,1fr) minmax(0,.7fr) minmax(0,1.9fr) minmax(0,.7fr)}.grid-cols-\[minmax\(0\,1fr\)_minmax\(0\,0\.9fr\)_minmax\(0\,0\.75fr\)\]{grid-template-columns:minmax(0,1fr) minmax(0,.9fr) minmax(0,.75fr)}.grid-cols-\[minmax\(0\,1fr\)_minmax\(0\,1\.4fr\)\]{grid-template-columns:minmax(0,1fr) minmax(0,1.4fr)}.grid-rows-2{grid-template-rows:repeat(2,minmax(0,1fr))}.grid-rows-\[auto_1fr\]{grid-template-rows:auto 1fr}.grid-rows-\[auto_auto_1fr\]{grid-template-rows:auto auto 1fr}.grid-rows-\[auto_auto_1fr_auto\]{grid-template-rows:auto auto 1fr auto}.grid-rows-\[minmax\(0\,1fr\)_auto\]{grid-template-rows:minmax(0,1fr) auto}.grid-rows-\[minmax\(0\,1fr\)_minmax\(0\,1fr\)_minmax\(0\,1fr\)\]{grid-template-rows:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.content-center{align-content:center}.content-start{align-content:flex-start}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.self-start{align-self:flex-start}.self-center{align-self:center}.self-stretch{align-self:stretch}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-none{border-radius:0}.rounded-sm{border-radius:.125rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity))}.border-amber-200\/30{border-color:#fde68a4d}.border-amber-200\/70{border-color:#fde68ab3}.border-amber-300\/70{border-color:#fcd34db3}.border-amber-300\/80{border-color:#fcd34dcc}.border-amber-400\/30{border-color:#fbbf244d}.border-amber-400\/60{border-color:#fbbf2499}.border-amber-600\/60{border-color:#d9770699}.border-amber-700\/60{border-color:#b4530999}.border-blue-600{--tw-border-opacity: 1;border-color:rgb(37 99 235 / var(--tw-border-opacity))}.border-cyan-200\/50{border-color:#a5f3fc80}.border-cyan-300{--tw-border-opacity: 1;border-color:rgb(103 232 249 / var(--tw-border-opacity))}.border-cyan-300\/70{border-color:#67e8f9b3}.border-cyan-500\/40{border-color:#06b6d466}.border-emerald-200{--tw-border-opacity: 1;border-color:rgb(167 243 208 / var(--tw-border-opacity))}.border-emerald-200\/70{border-color:#a7f3d0b3}.border-emerald-300\/70{border-color:#6ee7b7b3}.border-emerald-400\/60{border-color:#34d39999}.border-emerald-500\/40{border-color:#10b98166}.border-emerald-700{--tw-border-opacity: 1;border-color:rgb(4 120 87 / var(--tw-border-opacity))}.border-emerald-700\/60{border-color:#04785799}.border-fuchsia-300\/70{border-color:#f0abfcb3}.border-indigo-200\/70{border-color:#c7d2feb3}.border-indigo-300\/70{border-color:#a5b4fcb3}.border-indigo-400\/30{border-color:#818cf84d}.border-indigo-700{--tw-border-opacity: 1;border-color:rgb(67 56 202 / var(--tw-border-opacity))}.border-indigo-700\/60{border-color:#4338ca99}.border-pink-200{--tw-border-opacity: 1;border-color:rgb(251 207 232 / var(--tw-border-opacity))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity))}.border-red-400\/60{border-color:#f8717199}.border-rose-800{--tw-border-opacity: 1;border-color:rgb(159 18 57 / var(--tw-border-opacity))}.border-sky-400\/50{border-color:#38bdf880}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity))}.border-slate-200\/30{border-color:#e2e8f04d}.border-slate-400\/60{border-color:#94a3b899}.border-slate-600{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity))}.border-slate-600\/40{border-color:#47556966}.border-slate-600\/60{border-color:#47556999}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity))}.border-slate-700\/60{border-color:#33415599}.border-slate-700\/70{border-color:#334155b3}.border-slate-700\/80{border-color:#334155cc}.border-slate-800{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity))}.border-slate-800\/60{border-color:#1e293b99}.border-transparent{border-color:transparent}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity))}.border-white\/40{border-color:#fff6}.border-white\/60{border-color:#fff9}.bg-amber-100\/95{background-color:#fef3c7f2}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity))}.bg-amber-400\/80{background-color:#fbbf24cc}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity))}.bg-amber-500\/30{background-color:#f59e0b4d}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity))}.bg-amber-600\/70{background-color:#d97706b3}.bg-amber-700\/20{background-color:#b4530933}.bg-amber-700\/30{background-color:#b453094d}.bg-amber-700\/35{background-color:#b4530959}.bg-amber-900{--tw-bg-opacity: 1;background-color:rgb(120 53 15 / var(--tw-bg-opacity))}.bg-amber-900\/40{background-color:#78350f66}.bg-amber-900\/60{background-color:#78350f99}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-black\/20{background-color:#0003}.bg-black\/30{background-color:#0000004d}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/55{background-color:#0000008c}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/75{background-color:#000000bf}.bg-black\/80{background-color:#000c}.bg-black\/85{background-color:#000000d9}.bg-cyan-300\/80{background-color:#67e8f9cc}.bg-cyan-400\/10{background-color:#22d3ee1a}.bg-cyan-500{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity))}.bg-cyan-500\/80{background-color:#06b6d4cc}.bg-cyan-900{--tw-bg-opacity: 1;background-color:rgb(22 78 99 / var(--tw-bg-opacity))}.bg-cyan-900\/45{background-color:#164e6373}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity))}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity))}.bg-emerald-500\/45{background-color:#10b98173}.bg-emerald-500\/80{background-color:#10b981cc}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity))}.bg-emerald-600\/70{background-color:#059669b3}.bg-emerald-700\/20{background-color:#04785733}.bg-emerald-700\/60{background-color:#04785799}.bg-emerald-800{--tw-bg-opacity: 1;background-color:rgb(6 95 70 / var(--tw-bg-opacity))}.bg-emerald-900{--tw-bg-opacity: 1;background-color:rgb(6 78 59 / var(--tw-bg-opacity))}.bg-emerald-900\/15{background-color:#064e3b26}.bg-emerald-900\/60{background-color:#064e3b99}.bg-emerald-900\/80{background-color:#064e3bcc}.bg-fuchsia-200{--tw-bg-opacity: 1;background-color:rgb(245 208 254 / var(--tw-bg-opacity))}.bg-fuchsia-600{--tw-bg-opacity: 1;background-color:rgb(192 38 211 / var(--tw-bg-opacity))}.bg-fuchsia-700{--tw-bg-opacity: 1;background-color:rgb(162 28 175 / var(--tw-bg-opacity))}.bg-fuchsia-800{--tw-bg-opacity: 1;background-color:rgb(134 25 143 / var(--tw-bg-opacity))}.bg-fuchsia-900\/45{background-color:#701a7573}.bg-indigo-600{--tw-bg-opacity: 1;background-color:rgb(79 70 229 / var(--tw-bg-opacity))}.bg-indigo-600\/70{background-color:#4f46e5b3}.bg-indigo-900{--tw-bg-opacity: 1;background-color:rgb(49 46 129 / var(--tw-bg-opacity))}.bg-indigo-900\/20{background-color:#312e8133}.bg-indigo-900\/60{background-color:#312e8199}.bg-indigo-950\/90{background-color:#1e1b4be6}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.bg-red-500\/45{background-color:#ef444473}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.bg-red-600\/70{background-color:#dc2626b3}.bg-red-700\/20{background-color:#b91c1c33}.bg-red-700\/60{background-color:#b91c1c99}.bg-red-900\/35{background-color:#7f1d1d59}.bg-red-900\/40{background-color:#7f1d1d66}.bg-red-900\/45{background-color:#7f1d1d73}.bg-red-900\/50{background-color:#7f1d1d80}.bg-rose-600{--tw-bg-opacity: 1;background-color:rgb(225 29 72 / var(--tw-bg-opacity))}.bg-rose-900\/80{background-color:#881337cc}.bg-sky-600{--tw-bg-opacity: 1;background-color:rgb(2 132 199 / var(--tw-bg-opacity))}.bg-sky-700\/20{background-color:#0369a133}.bg-slate-500{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity))}.bg-slate-600{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.bg-slate-700\/30{background-color:#3341554d}.bg-slate-700\/60{background-color:#33415599}.bg-slate-700\/70{background-color:#334155b3}.bg-slate-700\/80{background-color:#334155cc}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity))}.bg-slate-800\/70{background-color:#1e293bb3}.bg-slate-800\/80{background-color:#1e293bcc}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity))}.bg-slate-900\/35{background-color:#0f172a59}.bg-slate-900\/40{background-color:#0f172a66}.bg-slate-900\/70{background-color:#0f172ab3}.bg-slate-950\/90{background-color:#020617e6}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-white\/10{background-color:#ffffff1a}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity))}.bg-zinc-900{--tw-bg-opacity: 1;background-color:rgb(24 24 27 / var(--tw-bg-opacity))}.bg-zinc-900\/90{background-color:#18181be6}.bg-zinc-950{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity))}.bg-zinc-950\/95{background-color:#09090bf2}.bg-cover{background-size:cover}.fill-slate-200{fill:#e2e8f0}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-4{padding:1rem}.px-0{padding-left:0;padding-right:0}.px-0\.5{padding-left:.125rem;padding-right:.125rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-\[1px\]{padding-top:1px;padding-bottom:1px}.py-\[2px\]{padding-top:2px;padding-bottom:2px}.pb-0{padding-bottom:0}.pb-1{padding-bottom:.25rem}.pr-0{padding-right:0}.pt-0\.5{padding-top:.125rem}.pt-1{padding-top:.25rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-\[0\.45rem\]{font-size:.45rem}.text-\[0\.55em\]{font-size:.55em}.text-\[0\.55rem\]{font-size:.55rem}.text-\[0\.5rem\]{font-size:.5rem}.text-\[0\.65rem\]{font-size:.65rem}.text-\[0\.6rem\]{font-size:.6rem}.text-\[0\.72rem\]{font-size:.72rem}.text-\[0\.75rem\]{font-size:.75rem}.text-\[0\.7rem\]{font-size:.7rem}.text-\[0\.85rem\]{font-size:.85rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[1\.1rem\]{font-size:1.1rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.lowercase{text-transform:lowercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-none{line-height:1}.leading-normal{line-height:1.5}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.text-amber-100{--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity))}.text-amber-200{--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity))}.text-amber-200\/80{color:#fde68acc}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity))}.text-amber-50{--tw-text-opacity: 1;color:rgb(255 251 235 / var(--tw-text-opacity))}.text-amber-50\/90{color:#fffbebe6}.text-amber-950{--tw-text-opacity: 1;color:rgb(69 26 3 / var(--tw-text-opacity))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity))}.text-cyan-100{--tw-text-opacity: 1;color:rgb(207 250 254 / var(--tw-text-opacity))}.text-cyan-300{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity))}.text-cyan-50{--tw-text-opacity: 1;color:rgb(236 254 255 / var(--tw-text-opacity))}.text-emerald-100{--tw-text-opacity: 1;color:rgb(209 250 229 / var(--tw-text-opacity))}.text-emerald-200{--tw-text-opacity: 1;color:rgb(167 243 208 / var(--tw-text-opacity))}.text-emerald-300{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity))}.text-emerald-50{--tw-text-opacity: 1;color:rgb(236 253 245 / var(--tw-text-opacity))}.text-emerald-50\/90{color:#ecfdf5e6}.text-emerald-950{--tw-text-opacity: 1;color:rgb(2 44 34 / var(--tw-text-opacity))}.text-fuchsia-50{--tw-text-opacity: 1;color:rgb(253 244 255 / var(--tw-text-opacity))}.text-fuchsia-900{--tw-text-opacity: 1;color:rgb(112 26 117 / var(--tw-text-opacity))}.text-indigo-100\/80{color:#e0e7ffcc}.text-indigo-200{--tw-text-opacity: 1;color:rgb(199 210 254 / var(--tw-text-opacity))}.text-indigo-50{--tw-text-opacity: 1;color:rgb(238 242 255 / var(--tw-text-opacity))}.text-indigo-50\/90{color:#eef2ffe6}.text-lime-200{--tw-text-opacity: 1;color:rgb(217 249 157 / var(--tw-text-opacity))}.text-lime-300{--tw-text-opacity: 1;color:rgb(190 242 100 / var(--tw-text-opacity))}.text-lime-400{--tw-text-opacity: 1;color:rgb(163 230 53 / var(--tw-text-opacity))}.text-red-100\/90{color:#fee2e2e6}.text-red-200{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity))}.text-rose-50{--tw-text-opacity: 1;color:rgb(255 241 242 / var(--tw-text-opacity))}.text-sky-200{--tw-text-opacity: 1;color:rgb(186 230 253 / var(--tw-text-opacity))}.text-sky-300{--tw-text-opacity: 1;color:rgb(125 211 252 / var(--tw-text-opacity))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.text-slate-400\/60{color:#94a3b899}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity))}.text-slate-900{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.text-teal-400{--tw-text-opacity: 1;color:rgb(45 212 191 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.text-white\/90{color:#ffffffe6}.underline{text-decoration-line:underline}.accent-cyan-400{accent-color:#22d3ee}.accent-cyan-500{accent-color:#06b6d4}.accent-emerald-400{accent-color:#34d399}.accent-emerald-500{accent-color:#10b981}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black\/30{--tw-shadow-color: rgb(0 0 0 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/40{--tw-shadow-color: rgb(0 0 0 / .4);--tw-shadow: var(--tw-shadow-colored)}.outline{outline-style:solid}.outline-2{outline-width:2px}.outline-cyan-400\/60{outline-color:#22d3ee99}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-amber-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(252 211 77 / var(--tw-ring-opacity))}.ring-emerald-300\/70{--tw-ring-color: rgb(110 231 183 / .7)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.invert{--tw-invert: invert(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\,height\]{transition-property:width,height;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}@keyframes batteryTickWarn{0%,49%{background-color:#fffffff2}50%,to{background-color:#ef4444f2}}.battery-tick-warn{animation:batteryTickWarn .4s steps(2,end) infinite}@keyframes batteryUrgentFlash{0%,49%{opacity:1}50%,to{opacity:.25}}.battery-urgent-flash{animation:batteryUrgentFlash .4s steps(2,end) infinite}.no-touch-select{-moz-user-select:none;user-select:none;-webkit-user-select:none;-ms-user-select:none;-webkit-touch-callout:none}.\[clip-path\:circle\(50\%\)\]{clip-path:circle(50%)}.\[writing-mode\:vertical-rl\]{writing-mode:vertical-rl}:root{font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity))}body{margin:0;min-height:100vh;--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity))}*{scrollbar-width:thin;scrollbar-color:#3b82f6 rgba(255,255,255,.08)}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}*::-webkit-scrollbar{width:1px;height:1px}*::-webkit-scrollbar-track{background:#ffffff14}*::-webkit-scrollbar-thumb{background-color:#3b82f6;border-radius:9999px}.ha-hue-slider{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:100%;height:.45rem;border-radius:9999px;background:linear-gradient(90deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red);cursor:pointer}.ha-hue-slider:disabled{opacity:.6;cursor:not-allowed}.ha-hue-slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:.75rem;height:.75rem;border-radius:9999px;border:1px solid rgba(255,255,255,.7);background:#fff}.ha-hue-slider::-webkit-slider-runnable-track{height:.45rem;border-radius:9999px;background:linear-gradient(90deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.ha-hue-slider::-moz-range-thumb{width:.75rem;height:.75rem;border-radius:9999px;border:1px solid rgba(255,255,255,.7);background:#fff}.ha-hue-slider::-moz-range-track{height:.45rem;border-radius:9999px;background:linear-gradient(90deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.placeholder\:text-slate-400::-moz-placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.placeholder\:text-slate-400::placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.hover\:-translate-y-0\.5:hover{--tw-translate-y: -.125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:bg-amber-400:hover{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity))}.hover\:bg-amber-800:hover{--tw-bg-opacity: 1;background-color:rgb(146 64 14 / var(--tw-bg-opacity))}.hover\:bg-cyan-400:hover{--tw-bg-opacity: 1;background-color:rgb(34 211 238 / var(--tw-bg-opacity))}.hover\:bg-cyan-800:hover{--tw-bg-opacity: 1;background-color:rgb(21 94 117 / var(--tw-bg-opacity))}.hover\:bg-emerald-400:hover{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity))}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity))}.hover\:bg-emerald-700:hover{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity))}.hover\:bg-emerald-800:hover{--tw-bg-opacity: 1;background-color:rgb(6 95 70 / var(--tw-bg-opacity))}.hover\:bg-fuchsia-500:hover{--tw-bg-opacity: 1;background-color:rgb(217 70 239 / var(--tw-bg-opacity))}.hover\:bg-indigo-500:hover{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity))}.hover\:bg-indigo-800:hover{--tw-bg-opacity: 1;background-color:rgb(55 48 163 / var(--tw-bg-opacity))}.hover\:bg-pink-400:hover{--tw-bg-opacity: 1;background-color:rgb(244 114 182 / var(--tw-bg-opacity))}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.hover\:bg-rose-800:hover{--tw-bg-opacity: 1;background-color:rgb(159 18 57 / var(--tw-bg-opacity))}.hover\:bg-sky-500:hover{--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity))}.hover\:bg-slate-100:hover{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.hover\:bg-slate-600:hover{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity))}.hover\:bg-slate-800\/80:hover{background-color:#1e293bcc}.hover\:text-blue-500:hover{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.hover\:shadow-xl:hover{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:brightness-110:hover{--tw-brightness: brightness(1.1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-emerald-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(16 185 129 / var(--tw-ring-opacity))}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:outline:focus-visible{outline-style:solid}.focus-visible\:outline-1:focus-visible{outline-width:1px}.focus-visible\:outline-offset-1:focus-visible{outline-offset:1px}.focus-visible\:outline-slate-500:focus-visible{outline-color:#64748b}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-amber-300:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(252 211 77 / var(--tw-ring-opacity))}.focus-visible\:ring-emerald-300:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(110 231 183 / var(--tw-ring-opacity))}.focus-visible\:ring-indigo-300:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(165 180 252 / var(--tw-ring-opacity))}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:scale-\[0\.99\]:active{--tw-scale-x: .99;--tw-scale-y: .99;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:brightness-125:active{--tw-brightness: brightness(1.25);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.disabled\:hover\:bg-inherit:hover:disabled{background-color:inherit}@media(min-width:640px){.sm\:block{display:block}.sm\:min-h-\[18rem\]{min-height:18rem}.sm\:basis-auto{flex-basis:auto}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:items-center{align-items:center}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}}@media(min-width:768px){.md\:h-full{height:100%}.md\:h-screen{height:100vh}.md\:min-h-0{min-height:0px}.md\:min-h-\[18rem\]{min-height:18rem}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-\[minmax\(0\,1\.1fr\)_minmax\(0\,1fr\)\]{grid-template-columns:minmax(0,1.1fr) minmax(0,1fr)}.md\:grid-cols-\[minmax\(0\,1\.4fr\)_minmax\(0\,1fr\)\]{grid-template-columns:minmax(0,1.4fr) minmax(0,1fr)}.md\:grid-cols-\[minmax\(0\,1fr\)_18rem\]{grid-template-columns:minmax(0,1fr) 18rem}.md\:overflow-hidden{overflow:hidden}.md\:overflow-y-auto{overflow-y:auto}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}}@media(min-width:1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:grid-cols-\[minmax\(0\,1\.25fr\)_minmax\(0\,0\.9fr\)\]{grid-template-columns:minmax(0,1.25fr) minmax(0,.9fr)}.lg\:grid-cols-\[minmax\(0\,1fr\)_20rem\]{grid-template-columns:minmax(0,1fr) 20rem}} diff --git a/server/public/assets/index-DVTOmRBl.css b/server/public/assets/index-DVTOmRBl.css new file mode 100644 index 00000000..6b8dc714 --- /dev/null +++ b/server/public/assets/index-DVTOmRBl.css @@ -0,0 +1 @@ +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.panel{border-radius:.375rem;--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity));padding:0;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.panel-section{border-radius:.375rem;--tw-bg-opacity: 1;background-color:rgb(23 23 23 / var(--tw-bg-opacity));padding:0;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.panel-muted{border-radius:.375rem;font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.surface{border-radius:.375rem;--tw-bg-opacity: 1;background-color:rgb(38 38 38 / var(--tw-bg-opacity));padding:.125rem;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.surface-muted{border-radius:.375rem;--tw-bg-opacity: 1;background-color:rgb(64 64 64 / var(--tw-bg-opacity));padding:.125rem;--tw-text-opacity: 1;color:rgb(245 245 245 / var(--tw-text-opacity))}.field-input{border-radius:.375rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(82 82 82 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(64 64 64 / var(--tw-bg-opacity));padding:.125rem;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.field-input::-moz-placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.field-input::placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.field-input:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000);--tw-ring-opacity: 1;--tw-ring-color: rgb(14 165 233 / var(--tw-ring-opacity))}.button-dark{border-radius:.375rem;border-width:1px;--tw-border-opacity: 1;border-color:rgb(125 211 252 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(2 132 199 / var(--tw-bg-opacity));padding:.125rem;font-size:.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.button-dark:hover{--tw-border-opacity: 1;border-color:rgb(14 165 233 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity))}.button-danger{border-radius:.375rem;--tw-bg-opacity: 1;background-color:rgb(225 29 72 / var(--tw-bg-opacity));padding:.125rem;font-size:.875rem;line-height:1.25rem;font-weight:500;--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.button-danger:hover{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity))}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.\!visible{visibility:visible!important}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.inset-x-0{left:0;right:0}.bottom-0{bottom:0}.bottom-0\.5{bottom:.125rem}.bottom-1{bottom:.25rem}.bottom-2{bottom:.5rem}.left-0{left:0}.left-0\.5{left:.125rem}.left-1{left:.25rem}.left-1\/2{left:50%}.left-2{left:.5rem}.right-0{right:0}.right-0\.5{right:.125rem}.right-1{right:.25rem}.right-2{right:.5rem}.top-0{top:0}.top-0\.5{top:.125rem}.top-1{top:.25rem}.top-1\/2{top:50%}.top-10{top:2.5rem}.top-6{top:1.5rem}.z-10{z-index:10}.z-30{z-index:30}.z-40{z-index:40}.z-50{z-index:50}.z-\[120\]{z-index:120}.order-1{order:1}.order-2{order:2}.col-span-full{grid-column:1 / -1}.m-0{margin:0}.mx-auto{margin-left:auto;margin-right:auto}.-mt-0\.5{margin-top:-.125rem}.mr-0{margin-right:0}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-auto{margin-top:auto}.\!block{display:block!important}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.aspect-\[4\/3\]{aspect-ratio:4/3}.aspect-square{aspect-ratio:1 / 1}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-28{height:7rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-64{height:16rem}.h-\[14rem\]{height:14rem}.h-\[2px\]{height:2px}.h-\[3\.5rem\]{height:3.5rem}.h-\[70\%\]{height:70%}.h-\[7rem\]{height:7rem}.h-\[min\(100svh\,32rem\)\]{height:min(100svh,32rem)}.h-\[min\(60svh\,24rem\)\]{height:min(60svh,24rem)}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-40{max-height:10rem}.max-h-52{max-height:13rem}.max-h-72{max-height:18rem}.max-h-80{max-height:20rem}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-\[1\.5rem\]{min-height:1.5rem}.min-h-\[14rem\]{min-height:14rem}.min-h-\[16rem\]{min-height:16rem}.min-h-\[3\.5rem\]{min-height:3.5rem}.min-h-\[5rem\]{min-height:5rem}.min-h-screen{min-height:100vh}.w-1\.5{width:.375rem}.w-1\/2{width:50%}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-7{width:1.75rem}.w-\[12\.5rem\]{width:12.5rem}.w-\[12rem\]{width:12rem}.w-\[20rem\]{width:20rem}.w-\[2px\]{width:2px}.w-\[9rem\]{width:9rem}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-screen{width:100vw}.min-w-0{min-width:0px}.min-w-\[0\]{min-width:0}.min-w-\[10rem\]{min-width:10rem}.min-w-\[12rem\]{min-width:12rem}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-\[70vw\]{max-width:70vw}.max-w-\[80vw\]{max-width:80vw}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.max-w-xl{max-width:36rem}.flex-1{flex:1 1 0%}.flex-\[1\.1\]{flex:1.1}.flex-\[1\.22\]{flex:1.22}.flex-\[1_1_12rem\]{flex:1 1 12rem}.shrink-0{flex-shrink:0}.basis-full{flex-basis:100%}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize{resize:both}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-\[minmax\(0\,0\.7fr\)_minmax\(0\,2\.1fr\)_minmax\(0\,0\.7fr\)\]{grid-template-columns:minmax(0,.7fr) minmax(0,2.1fr) minmax(0,.7fr)}.grid-cols-\[minmax\(0\,1\.2fr\)_repeat\(4\,minmax\(0\,1fr\)\)\]{grid-template-columns:minmax(0,1.2fr) repeat(4,minmax(0,1fr))}.grid-cols-\[minmax\(0\,1\.35fr\)_minmax\(0\,0\.95fr\)\]{grid-template-columns:minmax(0,1.35fr) minmax(0,.95fr)}.grid-cols-\[minmax\(0\,1\.3fr\)_minmax\(0\,0\.22fr\)\]{grid-template-columns:minmax(0,1.3fr) minmax(0,.22fr)}.grid-cols-\[minmax\(0\,1fr\)_auto\]{grid-template-columns:minmax(0,1fr) auto}.grid-cols-\[minmax\(0\,1fr\)_minmax\(0\,0\.7fr\)_minmax\(0\,1\.9fr\)_minmax\(0\,0\.7fr\)\]{grid-template-columns:minmax(0,1fr) minmax(0,.7fr) minmax(0,1.9fr) minmax(0,.7fr)}.grid-cols-\[minmax\(0\,1fr\)_minmax\(0\,0\.9fr\)_minmax\(0\,0\.75fr\)\]{grid-template-columns:minmax(0,1fr) minmax(0,.9fr) minmax(0,.75fr)}.grid-cols-\[minmax\(0\,1fr\)_minmax\(0\,1\.4fr\)\]{grid-template-columns:minmax(0,1fr) minmax(0,1.4fr)}.grid-rows-2{grid-template-rows:repeat(2,minmax(0,1fr))}.grid-rows-\[auto_1fr\]{grid-template-rows:auto 1fr}.grid-rows-\[auto_auto_1fr\]{grid-template-rows:auto auto 1fr}.grid-rows-\[auto_auto_1fr_auto\]{grid-template-rows:auto auto 1fr auto}.grid-rows-\[minmax\(0\,1fr\)_auto\]{grid-template-rows:minmax(0,1fr) auto}.grid-rows-\[minmax\(0\,1fr\)_minmax\(0\,1fr\)_minmax\(0\,1fr\)\]{grid-template-rows:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr)}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.content-center{align-content:center}.content-start{align-content:flex-start}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-x-3{-moz-column-gap:.75rem;column-gap:.75rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.self-start{align-self:flex-start}.self-center{align-self:center}.self-stretch{align-self:stretch}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-none{border-radius:0}.rounded-sm{border-radius:.125rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity))}.border-amber-200\/30{border-color:#fde68a4d}.border-amber-200\/70{border-color:#fde68ab3}.border-amber-300\/70{border-color:#fcd34db3}.border-amber-300\/80{border-color:#fcd34dcc}.border-amber-400\/30{border-color:#fbbf244d}.border-amber-400\/60{border-color:#fbbf2499}.border-amber-600\/60{border-color:#d9770699}.border-amber-700\/60{border-color:#b4530999}.border-blue-600{--tw-border-opacity: 1;border-color:rgb(37 99 235 / var(--tw-border-opacity))}.border-cyan-200\/50{border-color:#a5f3fc80}.border-cyan-300{--tw-border-opacity: 1;border-color:rgb(103 232 249 / var(--tw-border-opacity))}.border-cyan-300\/70{border-color:#67e8f9b3}.border-cyan-500\/40{border-color:#06b6d466}.border-emerald-200{--tw-border-opacity: 1;border-color:rgb(167 243 208 / var(--tw-border-opacity))}.border-emerald-200\/70{border-color:#a7f3d0b3}.border-emerald-300\/70{border-color:#6ee7b7b3}.border-emerald-400\/60{border-color:#34d39999}.border-emerald-500\/40{border-color:#10b98166}.border-emerald-700{--tw-border-opacity: 1;border-color:rgb(4 120 87 / var(--tw-border-opacity))}.border-emerald-700\/60{border-color:#04785799}.border-fuchsia-300\/70{border-color:#f0abfcb3}.border-indigo-200\/70{border-color:#c7d2feb3}.border-indigo-300\/70{border-color:#a5b4fcb3}.border-indigo-400\/30{border-color:#818cf84d}.border-indigo-700{--tw-border-opacity: 1;border-color:rgb(67 56 202 / var(--tw-border-opacity))}.border-indigo-700\/60{border-color:#4338ca99}.border-pink-200{--tw-border-opacity: 1;border-color:rgb(251 207 232 / var(--tw-border-opacity))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity))}.border-red-400\/60{border-color:#f8717199}.border-rose-800{--tw-border-opacity: 1;border-color:rgb(159 18 57 / var(--tw-border-opacity))}.border-sky-400\/50{border-color:#38bdf880}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity))}.border-slate-200\/30{border-color:#e2e8f04d}.border-slate-400\/60{border-color:#94a3b899}.border-slate-600{--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity))}.border-slate-600\/40{border-color:#47556966}.border-slate-600\/60{border-color:#47556999}.border-slate-700{--tw-border-opacity: 1;border-color:rgb(51 65 85 / var(--tw-border-opacity))}.border-slate-700\/60{border-color:#33415599}.border-slate-700\/70{border-color:#334155b3}.border-slate-700\/80{border-color:#334155cc}.border-slate-800{--tw-border-opacity: 1;border-color:rgb(30 41 59 / var(--tw-border-opacity))}.border-slate-800\/60{border-color:#1e293b99}.border-transparent{border-color:transparent}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity))}.border-white\/40{border-color:#fff6}.border-white\/60{border-color:#fff9}.bg-amber-100\/95{background-color:#fef3c7f2}.bg-amber-400{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity))}.bg-amber-400\/80{background-color:#fbbf24cc}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity))}.bg-amber-500\/30{background-color:#f59e0b4d}.bg-amber-600{--tw-bg-opacity: 1;background-color:rgb(217 119 6 / var(--tw-bg-opacity))}.bg-amber-600\/70{background-color:#d97706b3}.bg-amber-700\/20{background-color:#b4530933}.bg-amber-700\/30{background-color:#b453094d}.bg-amber-700\/35{background-color:#b4530959}.bg-amber-900{--tw-bg-opacity: 1;background-color:rgb(120 53 15 / var(--tw-bg-opacity))}.bg-amber-900\/40{background-color:#78350f66}.bg-amber-900\/60{background-color:#78350f99}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-black\/20{background-color:#0003}.bg-black\/30{background-color:#0000004d}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/55{background-color:#0000008c}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-black\/75{background-color:#000000bf}.bg-black\/80{background-color:#000c}.bg-black\/85{background-color:#000000d9}.bg-cyan-300\/80{background-color:#67e8f9cc}.bg-cyan-400\/10{background-color:#22d3ee1a}.bg-cyan-500{--tw-bg-opacity: 1;background-color:rgb(6 182 212 / var(--tw-bg-opacity))}.bg-cyan-500\/80{background-color:#06b6d4cc}.bg-cyan-900{--tw-bg-opacity: 1;background-color:rgb(22 78 99 / var(--tw-bg-opacity))}.bg-cyan-900\/45{background-color:#164e6373}.bg-emerald-400{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity))}.bg-emerald-500{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity))}.bg-emerald-500\/45{background-color:#10b98173}.bg-emerald-500\/80{background-color:#10b981cc}.bg-emerald-600{--tw-bg-opacity: 1;background-color:rgb(5 150 105 / var(--tw-bg-opacity))}.bg-emerald-600\/70{background-color:#059669b3}.bg-emerald-700\/20{background-color:#04785733}.bg-emerald-700\/60{background-color:#04785799}.bg-emerald-800{--tw-bg-opacity: 1;background-color:rgb(6 95 70 / var(--tw-bg-opacity))}.bg-emerald-900{--tw-bg-opacity: 1;background-color:rgb(6 78 59 / var(--tw-bg-opacity))}.bg-emerald-900\/15{background-color:#064e3b26}.bg-emerald-900\/60{background-color:#064e3b99}.bg-emerald-900\/80{background-color:#064e3bcc}.bg-fuchsia-200{--tw-bg-opacity: 1;background-color:rgb(245 208 254 / var(--tw-bg-opacity))}.bg-fuchsia-600{--tw-bg-opacity: 1;background-color:rgb(192 38 211 / var(--tw-bg-opacity))}.bg-fuchsia-700{--tw-bg-opacity: 1;background-color:rgb(162 28 175 / var(--tw-bg-opacity))}.bg-fuchsia-800{--tw-bg-opacity: 1;background-color:rgb(134 25 143 / var(--tw-bg-opacity))}.bg-fuchsia-900\/45{background-color:#701a7573}.bg-indigo-600{--tw-bg-opacity: 1;background-color:rgb(79 70 229 / var(--tw-bg-opacity))}.bg-indigo-600\/70{background-color:#4f46e5b3}.bg-indigo-900{--tw-bg-opacity: 1;background-color:rgb(49 46 129 / var(--tw-bg-opacity))}.bg-indigo-900\/20{background-color:#312e8133}.bg-indigo-900\/60{background-color:#312e8199}.bg-indigo-950\/90{background-color:#1e1b4be6}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.bg-red-500\/45{background-color:#ef444473}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.bg-red-600\/70{background-color:#dc2626b3}.bg-red-700\/20{background-color:#b91c1c33}.bg-red-700\/60{background-color:#b91c1c99}.bg-red-900\/35{background-color:#7f1d1d59}.bg-red-900\/40{background-color:#7f1d1d66}.bg-red-900\/45{background-color:#7f1d1d73}.bg-red-900\/50{background-color:#7f1d1d80}.bg-rose-600{--tw-bg-opacity: 1;background-color:rgb(225 29 72 / var(--tw-bg-opacity))}.bg-rose-900\/80{background-color:#881337cc}.bg-sky-600{--tw-bg-opacity: 1;background-color:rgb(2 132 199 / var(--tw-bg-opacity))}.bg-sky-700\/20{background-color:#0369a133}.bg-slate-500{--tw-bg-opacity: 1;background-color:rgb(100 116 139 / var(--tw-bg-opacity))}.bg-slate-600{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}.bg-slate-700\/30{background-color:#3341554d}.bg-slate-700\/60{background-color:#33415599}.bg-slate-700\/70{background-color:#334155b3}.bg-slate-700\/80{background-color:#334155cc}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity))}.bg-slate-800\/70{background-color:#1e293bb3}.bg-slate-800\/80{background-color:#1e293bcc}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity))}.bg-slate-900\/35{background-color:#0f172a59}.bg-slate-900\/40{background-color:#0f172a66}.bg-slate-900\/70{background-color:#0f172ab3}.bg-slate-950\/90{background-color:#020617e6}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-white\/10{background-color:#ffffff1a}.bg-yellow-100{--tw-bg-opacity: 1;background-color:rgb(254 249 195 / var(--tw-bg-opacity))}.bg-zinc-900{--tw-bg-opacity: 1;background-color:rgb(24 24 27 / var(--tw-bg-opacity))}.bg-zinc-900\/90{background-color:#18181be6}.bg-zinc-950{--tw-bg-opacity: 1;background-color:rgb(9 9 11 / var(--tw-bg-opacity))}.bg-zinc-950\/95{background-color:#09090bf2}.bg-cover{background-size:cover}.fill-slate-200{fill:#e2e8f0}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-4{padding:1rem}.px-0{padding-left:0;padding-right:0}.px-0\.5{padding-left:.125rem;padding-right:.125rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-\[1px\]{padding-top:1px;padding-bottom:1px}.py-\[2px\]{padding-top:2px;padding-bottom:2px}.pb-0{padding-bottom:0}.pb-1{padding-bottom:.25rem}.pr-0{padding-right:0}.pt-0\.5{padding-top:.125rem}.pt-1{padding-top:.25rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-top{vertical-align:top}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-\[0\.45rem\]{font-size:.45rem}.text-\[0\.55em\]{font-size:.55em}.text-\[0\.55rem\]{font-size:.55rem}.text-\[0\.5rem\]{font-size:.5rem}.text-\[0\.65rem\]{font-size:.65rem}.text-\[0\.6rem\]{font-size:.6rem}.text-\[0\.72rem\]{font-size:.72rem}.text-\[0\.75rem\]{font-size:.75rem}.text-\[0\.7rem\]{font-size:.7rem}.text-\[0\.85rem\]{font-size:.85rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[1\.1rem\]{font-size:1.1rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.lowercase{text-transform:lowercase}.capitalize{text-transform:capitalize}.italic{font-style:italic}.leading-none{line-height:1}.leading-normal{line-height:1.5}.leading-snug{line-height:1.375}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.text-amber-100{--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity))}.text-amber-200{--tw-text-opacity: 1;color:rgb(253 230 138 / var(--tw-text-opacity))}.text-amber-200\/80{color:#fde68acc}.text-amber-300{--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity))}.text-amber-50{--tw-text-opacity: 1;color:rgb(255 251 235 / var(--tw-text-opacity))}.text-amber-50\/90{color:#fffbebe6}.text-amber-950{--tw-text-opacity: 1;color:rgb(69 26 3 / var(--tw-text-opacity))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity))}.text-cyan-100{--tw-text-opacity: 1;color:rgb(207 250 254 / var(--tw-text-opacity))}.text-cyan-300{--tw-text-opacity: 1;color:rgb(103 232 249 / var(--tw-text-opacity))}.text-cyan-50{--tw-text-opacity: 1;color:rgb(236 254 255 / var(--tw-text-opacity))}.text-emerald-100{--tw-text-opacity: 1;color:rgb(209 250 229 / var(--tw-text-opacity))}.text-emerald-200{--tw-text-opacity: 1;color:rgb(167 243 208 / var(--tw-text-opacity))}.text-emerald-300{--tw-text-opacity: 1;color:rgb(110 231 183 / var(--tw-text-opacity))}.text-emerald-400{--tw-text-opacity: 1;color:rgb(52 211 153 / var(--tw-text-opacity))}.text-emerald-50{--tw-text-opacity: 1;color:rgb(236 253 245 / var(--tw-text-opacity))}.text-emerald-50\/90{color:#ecfdf5e6}.text-emerald-950{--tw-text-opacity: 1;color:rgb(2 44 34 / var(--tw-text-opacity))}.text-fuchsia-50{--tw-text-opacity: 1;color:rgb(253 244 255 / var(--tw-text-opacity))}.text-fuchsia-900{--tw-text-opacity: 1;color:rgb(112 26 117 / var(--tw-text-opacity))}.text-indigo-100\/80{color:#e0e7ffcc}.text-indigo-200{--tw-text-opacity: 1;color:rgb(199 210 254 / var(--tw-text-opacity))}.text-indigo-50{--tw-text-opacity: 1;color:rgb(238 242 255 / var(--tw-text-opacity))}.text-indigo-50\/90{color:#eef2ffe6}.text-lime-200{--tw-text-opacity: 1;color:rgb(217 249 157 / var(--tw-text-opacity))}.text-lime-300{--tw-text-opacity: 1;color:rgb(190 242 100 / var(--tw-text-opacity))}.text-lime-400{--tw-text-opacity: 1;color:rgb(163 230 53 / var(--tw-text-opacity))}.text-red-100\/90{color:#fee2e2e6}.text-red-200{--tw-text-opacity: 1;color:rgb(254 202 202 / var(--tw-text-opacity))}.text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity))}.text-rose-50{--tw-text-opacity: 1;color:rgb(255 241 242 / var(--tw-text-opacity))}.text-sky-200{--tw-text-opacity: 1;color:rgb(186 230 253 / var(--tw-text-opacity))}.text-sky-300{--tw-text-opacity: 1;color:rgb(125 211 252 / var(--tw-text-opacity))}.text-slate-100{--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity))}.text-slate-200{--tw-text-opacity: 1;color:rgb(226 232 240 / var(--tw-text-opacity))}.text-slate-300{--tw-text-opacity: 1;color:rgb(203 213 225 / var(--tw-text-opacity))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.text-slate-400\/60{color:#94a3b899}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity))}.text-slate-900{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.text-teal-400{--tw-text-opacity: 1;color:rgb(45 212 191 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.text-white\/90{color:#ffffffe6}.underline{text-decoration-line:underline}.accent-cyan-400{accent-color:#22d3ee}.accent-cyan-500{accent-color:#06b6d4}.accent-emerald-400{accent-color:#34d399}.accent-emerald-500{accent-color:#10b981}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black\/30{--tw-shadow-color: rgb(0 0 0 / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-black\/40{--tw-shadow-color: rgb(0 0 0 / .4);--tw-shadow: var(--tw-shadow-colored)}.outline{outline-style:solid}.outline-2{outline-width:2px}.outline-cyan-400\/60{outline-color:#22d3ee99}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-amber-300{--tw-ring-opacity: 1;--tw-ring-color: rgb(252 211 77 / var(--tw-ring-opacity))}.ring-emerald-300\/70{--tw-ring-color: rgb(110 231 183 / .7)}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.invert{--tw-invert: invert(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\,height\]{transition-property:width,height;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}@keyframes batteryTickWarn{0%,49%{background-color:#fffffff2}50%,to{background-color:#ef4444f2}}.battery-tick-warn{animation:batteryTickWarn .4s steps(2,end) infinite}@keyframes batteryUrgentFlash{0%,49%{opacity:1}50%,to{opacity:.25}}.battery-urgent-flash{animation:batteryUrgentFlash .4s steps(2,end) infinite}.no-touch-select{-moz-user-select:none;user-select:none;-webkit-user-select:none;-ms-user-select:none;-webkit-touch-callout:none}.\[clip-path\:circle\(50\%\)\]{clip-path:circle(50%)}.\[writing-mode\:vertical-rl\]{writing-mode:vertical-rl}:root{font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity))}body{margin:0;min-height:100vh;--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(241 245 249 / var(--tw-text-opacity))}*{scrollbar-width:thin;scrollbar-color:#3b82f6 rgba(255,255,255,.08)}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}*::-webkit-scrollbar{width:1px;height:1px}*::-webkit-scrollbar-track{background:#ffffff14}*::-webkit-scrollbar-thumb{background-color:#3b82f6;border-radius:9999px}.ha-hue-slider{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:100%;height:.45rem;border-radius:9999px;background:linear-gradient(90deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red);cursor:pointer}.ha-hue-slider:disabled{opacity:.6;cursor:not-allowed}.ha-hue-slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:.75rem;height:.75rem;border-radius:9999px;border:1px solid rgba(255,255,255,.7);background:#fff}.ha-hue-slider::-webkit-slider-runnable-track{height:.45rem;border-radius:9999px;background:linear-gradient(90deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.ha-hue-slider::-moz-range-thumb{width:.75rem;height:.75rem;border-radius:9999px;border:1px solid rgba(255,255,255,.7);background:#fff}.ha-hue-slider::-moz-range-track{height:.45rem;border-radius:9999px;background:linear-gradient(90deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.placeholder\:text-slate-400::-moz-placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.placeholder\:text-slate-400::placeholder{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.hover\:-translate-y-0\.5:hover{--tw-translate-y: -.125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:bg-amber-400:hover{--tw-bg-opacity: 1;background-color:rgb(251 191 36 / var(--tw-bg-opacity))}.hover\:bg-amber-800:hover{--tw-bg-opacity: 1;background-color:rgb(146 64 14 / var(--tw-bg-opacity))}.hover\:bg-cyan-400:hover{--tw-bg-opacity: 1;background-color:rgb(34 211 238 / var(--tw-bg-opacity))}.hover\:bg-cyan-800:hover{--tw-bg-opacity: 1;background-color:rgb(21 94 117 / var(--tw-bg-opacity))}.hover\:bg-emerald-400:hover{--tw-bg-opacity: 1;background-color:rgb(52 211 153 / var(--tw-bg-opacity))}.hover\:bg-emerald-500:hover{--tw-bg-opacity: 1;background-color:rgb(16 185 129 / var(--tw-bg-opacity))}.hover\:bg-emerald-700:hover{--tw-bg-opacity: 1;background-color:rgb(4 120 87 / var(--tw-bg-opacity))}.hover\:bg-emerald-800:hover{--tw-bg-opacity: 1;background-color:rgb(6 95 70 / var(--tw-bg-opacity))}.hover\:bg-fuchsia-500:hover{--tw-bg-opacity: 1;background-color:rgb(217 70 239 / var(--tw-bg-opacity))}.hover\:bg-indigo-500:hover{--tw-bg-opacity: 1;background-color:rgb(99 102 241 / var(--tw-bg-opacity))}.hover\:bg-indigo-800:hover{--tw-bg-opacity: 1;background-color:rgb(55 48 163 / var(--tw-bg-opacity))}.hover\:bg-pink-400:hover{--tw-bg-opacity: 1;background-color:rgb(244 114 182 / var(--tw-bg-opacity))}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity))}.hover\:bg-rose-800:hover{--tw-bg-opacity: 1;background-color:rgb(159 18 57 / var(--tw-bg-opacity))}.hover\:bg-sky-500:hover{--tw-bg-opacity: 1;background-color:rgb(14 165 233 / var(--tw-bg-opacity))}.hover\:bg-slate-100:hover{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.hover\:bg-slate-600:hover{--tw-bg-opacity: 1;background-color:rgb(71 85 105 / var(--tw-bg-opacity))}.hover\:bg-slate-800\/80:hover{background-color:#1e293bcc}.hover\:text-blue-500:hover{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.hover\:shadow-xl:hover{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:brightness-110:hover{--tw-brightness: brightness(1.1);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-emerald-500:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(16 185 129 / var(--tw-ring-opacity))}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:outline:focus-visible{outline-style:solid}.focus-visible\:outline-1:focus-visible{outline-width:1px}.focus-visible\:outline-offset-1:focus-visible{outline-offset:1px}.focus-visible\:outline-slate-500:focus-visible{outline-color:#64748b}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-amber-300:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(252 211 77 / var(--tw-ring-opacity))}.focus-visible\:ring-emerald-300:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(110 231 183 / var(--tw-ring-opacity))}.focus-visible\:ring-indigo-300:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(165 180 252 / var(--tw-ring-opacity))}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:scale-\[0\.99\]:active{--tw-scale-x: .99;--tw-scale-y: .99;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.active\:brightness-125:active{--tw-brightness: brightness(1.25);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.disabled\:hover\:bg-inherit:hover:disabled{background-color:inherit}@media(min-width:640px){.sm\:block{display:block}.sm\:min-h-\[18rem\]{min-height:18rem}.sm\:basis-auto{flex-basis:auto}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:items-center{align-items:center}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}}@media(min-width:768px){.md\:h-full{height:100%}.md\:h-screen{height:100vh}.md\:min-h-0{min-height:0px}.md\:min-h-\[18rem\]{min-height:18rem}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-\[minmax\(0\,1\.1fr\)_minmax\(0\,1fr\)\]{grid-template-columns:minmax(0,1.1fr) minmax(0,1fr)}.md\:grid-cols-\[minmax\(0\,1\.4fr\)_minmax\(0\,1fr\)\]{grid-template-columns:minmax(0,1.4fr) minmax(0,1fr)}.md\:grid-cols-\[minmax\(0\,1fr\)_18rem\]{grid-template-columns:minmax(0,1fr) 18rem}.md\:overflow-hidden{overflow:hidden}.md\:overflow-y-auto{overflow-y:auto}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}}@media(min-width:1024px){.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.lg\:grid-cols-\[minmax\(0\,1\.25fr\)_minmax\(0\,0\.9fr\)\]{grid-template-columns:minmax(0,1.25fr) minmax(0,.9fr)}.lg\:grid-cols-\[minmax\(0\,1fr\)_20rem\]{grid-template-columns:minmax(0,1fr) 20rem}} diff --git a/server/public/assets/index-BH5wEcCw.js b/server/public/assets/index-DnfihTn0.js similarity index 93% rename from server/public/assets/index-BH5wEcCw.js rename to server/public/assets/index-DnfihTn0.js index 49957a8e..79d28b34 100644 --- a/server/public/assets/index-BH5wEcCw.js +++ b/server/public/assets/index-DnfihTn0.js @@ -15,7 +15,7 @@ Please change the parent to i&&i>o){const f=Ni/100,d=1-f;if(n<=o)return 0;if(n<=i){const p=(n-o)/(i-o);return Math.round(Math.max(0,Math.min(1,p))*Ni)}if(n>=s)return 100;const h=(n-i)/(s-i);return Math.round((f+Math.max(0,Math.min(1,h))*d)*100)}return null}const ZA=1600,IA=800;function Sn(...n){return n.filter(Boolean).join(" ")}function Hf({visual:n,orientation:s="horizontal",variant:i="inline",compact:o=!1,showLabel:f,className:d=""}){const h=i==="background",p=s==="vertical",x=f??!h;if(!n?.available){if(h){const W=Ni,ce=Sn("absolute z-10",p?"left-0 right-0 h-[2px]":"top-0 bottom-0 w-[2px]","bg-black/70",E&&!S&&"battery-tick-warn"),oe=p?{bottom:`${W}%`}:{left:`${W}%`},$=Sn("absolute inset-0 pointer-events-none",d);return r.jsxs("div",{className:$,children:[r.jsx("div",{className:"absolute inset-0 bg-slate-900/35"}),r.jsx("div",{className:ce,style:oe})]})}return p?null:r.jsx("p",{className:"text-xs text-slate-500",children:"Battery telemetry unavailable"})}const g=n.percentDisplay??0,v=Math.max(0,Math.min(100,g)),y=n.warnDisplayPercent??Ni,S=!!n.urgentActive,E=!!n.warnActive,C=S?`${IA}ms`:E?`${ZA}ms`:void 0,w=h?S||E?"bg-red-500/45":"bg-emerald-500/45":S||E?"bg-red-500":"bg-emerald-500",j=S||E?"bg-red-900/35":"bg-slate-900/35",N=S||E?"bg-red-900/45":"bg-slate-900/35",q=Sn(h?"absolute inset-0 pointer-events-none":"relative pointer-events-auto",p&&!h?"flex flex-col items-center justify-center":"w-full",d);if(h){const W=p?{height:`${v}%`}:{width:`${v}%`},ce=Sn("absolute",p?"bottom-0 left-0 right-0":"left-0 top-0 bottom-0",w,"transition-[width,height]",S&&"battery-urgent-flash"),oe=Sn("absolute z-10",p?"left-0 right-0 h-[2px]":"top-0 bottom-0 w-[2px]","bg-black/70",E&&!S&&"battery-tick-warn"),$=p?{bottom:`${y}%`}:{left:`${y}%`};return r.jsxs("div",{className:q,children:[r.jsx("div",{className:Sn("absolute inset-0",j,S&&"battery-urgent-flash")}),r.jsx("div",{className:ce,style:{...W,animationDuration:C}}),r.jsx("div",{className:oe,style:$})]})}const M=Sn("relative overflow-hidden rounded-sm border border-slate-800",S||E?N:"bg-zinc-900/90",S&&"battery-urgent-flash",p?"w-full flex-1":o?"h-4":"h-5"),O=p?{height:`${v}%`}:{width:`${v}%`},K=Sn("absolute",p?"bottom-0 left-0 right-0":"left-0 top-0 bottom-0",w,"transition-[width,height]",S&&"battery-urgent-flash"),_=Sn("absolute z-10",p?"left-0 right-0 h-[2px]":"top-0 bottom-0 w-[2px]","bg-black/70",E&&!S&&"battery-tick-warn"),H=p?{bottom:`${y}%`}:{left:`${y}%`},z=`Battery ${g}%`,V=Sn("pointer-events-none absolute inset-0 flex items-center justify-center text-center font-semibold",p?o?"text-[0.55rem]":"text-[0.65rem]":"text-xs"),U=Sn("rounded px-1.5 py-0.5",h?"bg-black/30 text-slate-100":"bg-black/50 text-slate-100");return r.jsxs("div",{className:q,children:[r.jsxs("div",{className:M,children:[r.jsx("div",{className:K,style:{...O,animationDuration:C}}),r.jsx("div",{className:_,style:H})]}),x&&!p?r.jsx("div",{className:V,children:r.jsx("span",{className:U,children:z})}):null,x&&p?r.jsx("div",{className:"mt-0.5 text-[0.65rem] font-semibold text-slate-100",children:r.jsxs("span",{className:U,children:[g,"%"]})}):null]})}const rx=2e3,JA=3e3,PA=3e3,WA=40,eN=1e3;function wi({sessionInfo:n,audioSessionInfo:s,videoMode:i="whep",snapshotFeed:o=null,qualityNotice:f=null,label:d,roverColor:h=null,forceMute:p=!1,telemetryFrame:x,batteryConfig:g,layoutFormat:v="desktop",hudVariant:y="default",driverLabel:S=null,hudForceMap:E=!1,hudMapPosition:C="top-center",hudLabelScale:k=1,fitParent:w=!1,overcurrentLimiter:j=null,showTurnCue:N=!1,turnTimerText:q=null,turnSeconds:M=null,isActiveDriver:O=!1,idleSkipSeconds:K=null}){const _=ft(ye=>ye.session),H=m.useRef(null),z=m.useRef(null),V=m.useRef(null),U=m.useRef(null),W=m.useRef(null),ce=m.useRef(null),oe=m.useRef(null),$=m.useRef(null),[T,Y]=m.useState("idle"),[I,ie]=m.useState(null),[de,R]=m.useState("idle"),[G,te]=m.useState(null),[ae,pe]=m.useState(0),[re,ue]=m.useState(0),[ve,be]=m.useState(!0),xe=!!s?.url,Be=i==="snapshot",ze=x?.sensors,{value:Ae}=He("audio",ct),tt=Number.isFinite(Ae?.masterVolume)?Ae.masterVolume:ct.masterVolume,Je=Number.isFinite(Ae?.roverVolume)?Ae.roverVolume:ct.roverVolume,vt=typeof Ae?.mainBrushDuckEnabled=="boolean"?Ae.mainBrushDuckEnabled:typeof Ae?.autoLevelEnabled=="boolean"?Ae.autoLevelEnabled:ct.mainBrushDuckEnabled,le=Number.isFinite(Ae?.mainBrushDuckAmount)?Math.max(0,Math.min(1,Ae.mainBrushDuckAmount)):ct.mainBrushDuckAmount,me=Math.max(0,Math.min(1,tt*Je)),se=ze?.batteryChargeMah??null,P=v==="desktop",fe=!P,Ne=fe?"top-right":C,[pt]=zg(),Ve=E||fe?!0:pt,st=Ug({charge:se,config:g}),lt=ze?.wheelOvercurrents||null,Ot=lt==null?[]:Object.entries(lt).filter(([,ye])=>!!ye).map(([ye])=>ye),it=j?.caps||null,ms=j?.overcurrent?.groups||null,Yt=typeof window<"u"&&new URLSearchParams(window.location.search).has("debugAudio"),La=typeof window<"u"&&new URLSearchParams(window.location.search).has("debugHud"),Bo=m.useMemo(()=>{if(!it)return null;const ye=Number.isFinite(it?.drive?.cap)?it.drive.cap:1,Fe=Number.isFinite(it?.aux?.cap)?it.aux.cap:1;return Math.max(0,Math.min(1,1-Math.min(ye,Fe)))},[it]),Bn=!!j?.isActive,Nt=Ot.length?Ot:Bn?["limiter"]:[],Ft=Bo??(Ot.length?1:0),Mt=!!Nt.length,fa=!!((Number(ze?.mainBrushCurrentMa)||0)>WA||ze?.wheelOvercurrents?.mainBrush),Oo=vt&&fa?1-le:1,hs=Math.max(0,Math.min(1,me*Oo)),ps=vt&&fa&&le>0?`Volume decreased ${Math.round(le*1e3)/10}%`:null,za=m.useRef({hasDedicatedAudio:!1,audioUrl:null,mainBrushDuckEnabled:!1,mainBrushDuckAmount:0,mainBrushActive:!1,baseRoverGain:0,effectiveRoverGain:0});m.useEffect(()=>{za.current={hasDedicatedAudio:xe,audioUrl:s?.url||null,mainBrushDuckEnabled:vt,mainBrushDuckAmount:le,mainBrushActive:fa,baseRoverGain:me,effectiveRoverGain:hs}},[xe,s?.url,vt,le,fa,me,hs]);const Pe=m.useCallback((ye,Fe={})=>{if(!Yt)return;const Ze=z.current,ke=za.current,$e={event:ye,ts:Date.now(),roverLabel:d||null,hasDedicatedAudio:ke.hasDedicatedAudio,audioUrl:ke.audioUrl,mainBrushDuckEnabled:ke.mainBrushDuckEnabled,mainBrushDuckAmount:ke.mainBrushDuckAmount,mainBrushActive:ke.mainBrushActive,baseRoverGain:ke.baseRoverGain,effectiveRoverGain:ke.effectiveRoverGain,element:Ze?{muted:Ze.muted,volume:Ze.volume,paused:Ze.paused,ended:Ze.ended,readyState:Ze.readyState,networkState:Ze.networkState}:null,...Fe};try{console.log(`[AudioDebug] ${ye} ${JSON.stringify($e)}`)}catch{console.log("[AudioDebug]",ye,$e)}},[Yt,d]),On=_?.socials?.find(ye=>String(ye?.id||ye?.label||"").toLowerCase()==="discord")?.url||_?.discord?.invite||null;m.useEffect(()=>{La&&console.log("[OvercurrentHUD]",{overlayVisible:Mt,overlayMotors:Nt,overlayFill:Ft,limiterActive:Bn,limiterCaps:it,limiterGroups:ms,wheelOvercurrents:lt})},[La,Ft,Nt,Mt,Bn,it,ms,lt]),m.useEffect(()=>{Pe("settings/update")},[Pe]);const Cn=m.useCallback(()=>{clearTimeout(V.current),V.current=setTimeout(()=>pe(Date.now()),rx)},[]),Ln=m.useCallback(()=>{clearTimeout(U.current),U.current=setTimeout(()=>ue(Date.now()),rx)},[]),xs=m.useCallback(async()=>{const ye=H.current;if(ye)try{ye.muted=!0,await ye.play()}catch{}},[]),hl=m.useCallback((ye=0)=>{if(p||xe)return;clearTimeout(ce.current);const Fe=()=>{clearTimeout(ce.current),ce.current=setTimeout(()=>{p||Ze()},JA)},Ze=async()=>{const ke=H.current;if(ke)try{await xs(),ke.muted=!1,await ke.play(),be(!1)}catch{ke.muted=!0,be(!0),Fe()}};ce.current=setTimeout(Ze,ye)},[xs,p,xe]);m.useEffect(()=>()=>{clearTimeout(V.current),clearTimeout(U.current),clearTimeout(ce.current),clearInterval(W.current),oe.current&&(cancelAnimationFrame(oe.current),oe.current=null)},[]),m.useEffect(()=>{T==="playing"&&hl(0)},[T,hl]),m.useEffect(()=>{Be&&(Y("snapshot"),ie(null))},[Be]),m.useEffect(()=>{if(Be||!n?.url||!H.current)return;let ye=!0,Fe;const Ze=setTimeout(()=>be(!0),0),ke=($e,rt)=>{ye&&(Pe("video/status",{nextStatus:$e,info:rt||null}),Y($e),ie(rt||null),$e==="playing"&&xs(),["error","failed","disconnected","closed"].includes($e)&&Cn())};return Fe=new lx({url:n.url,token:n.token,video:H.current,receiveAudio:!xe,onStatus:ke}),Fe.start().catch($e=>{ye&&(Y("error"),ie($e.message),Cn())}),()=>{ye=!1,clearTimeout(Ze),Fe?.stop()}},[Be,n?.url,n?.token,ae,Cn,xs,xe,Pe]),m.useEffect(()=>{T==="stopped"&&n?.url&&Cn()},[T,n?.url,Cn]),m.useEffect(()=>{const ye=z.current;if(!ye||!s?.url){Pe("route/no-audio-url"),$.current=null;return}const Fe=Math.max(0,Math.min(1,hs)),Ze=$.current==null?Math.max(0,Math.min(1,ye.volume)):$.current;if(oe.current&&(cancelAnimationFrame(oe.current),oe.current=null),Fe>Ze){const ke=performance.now(),$e=Ze,rt=Fe-$e,ot=wt=>{const nt=Math.min(1,(wt-ke)/eN),zn=$e+rt*nt;ye.volume=zn,$.current=zn,nt<1?oe.current=requestAnimationFrame(ot):oe.current=null};oe.current=requestAnimationFrame(ot)}else ye.volume=Fe,$.current=Fe;Pe("route/direct",{elementVolume:Fe,duckEnabled:vt,mainBrushActive:fa,duckAmount:le})},[s?.url,hs,vt,fa,le,Pe]),m.useEffect(()=>{if(!s?.url||!z.current)return;let ye=!0,Fe;const Ze=(ke,$e)=>{ye&&(Pe("audio/status",{nextStatus:ke,info:$e||null}),te($e||(ke==="connected"?"connected":null)),R(rt=>ke==="connected"&&(rt==="playing"||rt==="connecting")||ke==="new"?rt:ke),["error","failed"].includes(ke)&&Ln())};return Fe=new lx({url:s.url,token:s.token,video:z.current,audioOnly:!0,onStatus:Ze}),Fe.start().catch(ke=>{ye&&(R("error"),te(ke.message),Ln())}),()=>{ye=!1,Fe?.stop()}},[s?.url,s?.token,re,Ln,Pe]),m.useEffect(()=>{const ye=z.current;if(!s?.url||!ye){clearInterval(W.current);return}if(!["connecting","connected","playing","paused"].includes(de)){clearInterval(W.current);return}const Ze=async()=>{const ke=z.current;ke&&(ke.muted=!1,!(!ke.paused&&!ke.ended)&&(Pe("retry/play-attempt"),ke.play().then(()=>{Pe("retry/play-ok"),R($e=>$e==="connected"?"playing":$e),te($e=>$e==="paused"?null:$e)}).catch($e=>{Pe("retry/play-fail",{error:$e?.message}),te(rt=>rt||$e?.message||"autoplay blocked")})))};return Ze(),W.current=setInterval(Ze,PA),()=>clearInterval(W.current)},[s?.url,de,Pe]),m.useEffect(()=>{const ye=z.current;if(!ye)return;const Fe=()=>{Pe("element/play"),R(nt=>nt==="error"?nt:"playing"),te(null)},Ze=()=>{Pe("element/pause"),R(nt=>["error","failed","disconnected","closed","stopped"].includes(nt)?nt:"paused"),te(nt=>nt||"paused")},ke=()=>{Pe("element/ended"),R(nt=>nt==="error"?nt:"stopped"),te(nt=>nt||"ended")},$e=()=>{const{error:nt}=ye,zn=nt?.message||"audio error";Pe("element/error",{error:zn}),R("error"),te(zn)},rt=()=>Pe("element/waiting"),ot=()=>Pe("element/canplay"),wt=()=>Pe("element/stalled");return ye.addEventListener("play",Fe),ye.addEventListener("pause",Ze),ye.addEventListener("ended",ke),ye.addEventListener("error",$e),ye.addEventListener("waiting",rt),ye.addEventListener("canplay",ot),ye.addEventListener("stalled",wt),()=>{ye.removeEventListener("play",Fe),ye.removeEventListener("pause",Ze),ye.removeEventListener("ended",ke),ye.removeEventListener("error",$e),ye.removeEventListener("waiting",rt),ye.removeEventListener("canplay",ot),ye.removeEventListener("stalled",wt)}},[s?.url,Pe]);const pl=o?.error?`Error: ${o.error}`:o?.objectUrl?"snapshot":o?.status||"waiting",Ua=Be?pl:n?.url?T==="error"?`Error: ${I||"unknown"}`:I?`${T} (${I})`:T:"waiting",Lo=s?.error?`Error: ${s.error}`:s?.url?de==="error"?`Error: ${G||"unknown"}`:G?`${de} (${G})`:de:null,xl=y==="spectator",an=y==="none";return r.jsxs("div",{className:`flex flex-col gap-0.5 ${w?"h-full":""}`,children:[r.jsxs("div",{className:`relative w-full overflow-hidden bg-black ${w?"h-full flex-1":"aspect-[4/3]"}`,children:[Be?o?.objectUrl?r.jsx("img",{src:o.objectUrl,alt:d,className:"h-full w-full object-contain",draggable:!1}):r.jsx("div",{className:"flex h-full w-full items-center justify-center text-sm text-slate-300",children:"Waiting for frame…"}):r.jsx("video",{ref:H,muted:p||ve||xe,playsInline:!0,autoPlay:!0,controls:!1,className:"h-full w-full object-contain"}),r.jsx("audio",{ref:z,autoPlay:!0,hidden:!0}),!an&&N?r.jsx(aN,{mobileHud:fe,turnSeconds:M,isActiveDriver:O,idleSkipSeconds:K}):null,an?null:r.jsx(nN,{frame:x,sensors:ze,label:d,roverColor:h,status:Ua,audioStatus:Lo,levelStatus:ps,desktopLayout:P,layoutFormat:v,variant:y,driverLabel:S,battery:st,showTopDown:Ve,mobileHud:fe,mapPosition:Ne,turnTimerText:q,labelScale:k}),an?null:r.jsx(rN,{compact:fe}),!an&&La?r.jsx("div",{className:"pointer-events-none absolute left-1 top-1 z-40 rounded bg-black/80 px-1 py-0.5 text-[0.6rem] text-lime-200",children:`OC vis:${Mt?1:0} motors:${Nt.length} fill:${Math.round(Ft*100)}%`}):null,an?null:r.jsx(lN,{motors:Nt,fill:Ft,compact:fe}),an?null:r.jsx(iN,{battery:st,compact:fe}),!an&&xl&&st.available?r.jsx("div",{className:"pointer-events-none absolute right-1 top-1/2 flex h-[70%] -translate-y-1/2 flex-col items-center justify-center rounded bg-black/60 px-0.5 pb-1 pt-1",children:r.jsx(Hf,{visual:st,orientation:"vertical",variant:"inline",compact:fe,className:"h-full w-4"})}):null,!an&&f?r.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-1/2 -translate-y-1/2",children:r.jsxs("div",{className:`mx-auto w-fit rounded border border-amber-300/80 bg-black/75 text-amber-200 ${fe?"px-2 py-1 text-[0.6rem]":"px-3 py-1.5 text-sm"}`,children:[r.jsx("div",{className:"text-center",children:f}),r.jsx("div",{className:"pointer-events-auto mt-0",children:r.jsx(pd,{id:"discord",label:"Join our Discord server while you wait!",url:On})})]})}):null]}),!an&&!xl&&r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(tN,{sensors:ze}),r.jsx("div",{className:"panel-section space-y-0.5 text-sm",children:r.jsx(Hf,{visual:st,compact:fe})})]})]})}function tN({sensors:n}){const s=[n?.lightBumpLeftSignal,n?.lightBumpFrontLeftSignal,n?.lightBumpCenterLeftSignal,n?.lightBumpCenterRightSignal,n?.lightBumpFrontRightSignal,n?.lightBumpRightSignal],i=s.filter(p=>p!=null).reduce((p,x)=>Math.max(p,x),1200),o=p=>Math.pow(Math.max(0,Math.min(1,(p??0)/i)),.35),f=p=>p==null||p<=0?"hsl(200 60% 18%)":`hsl(${(200+o(p)*360)%360} 100% 60%)`,d=6,h=12;return r.jsx("div",{className:"flex w-full items-center justify-center gap-0.5",children:s.map((p,x)=>{const g=o(p),v=xr.jsxs("span",{className:"flex items-center justify-between gap-0.5",children:[r.jsx("span",{className:"text-slate-400",children:re}),r.jsx("span",{className:"font-semibold text-white",children:ue})]},re))]})}),r.jsx("div",{className:`absolute ${U} left-1/2`,style:W,children:r.jsxs("div",{className:`flex items-center gap-0.5 bg-black/80 text-slate-100 ${O} ${K}`,children:[r.jsx("span",{className:"font-semibold text-white rounded px-1 py-[1px] border border-transparent",style:ca(o,.18),children:i||"Unnamed Rover"}),v?r.jsxs("span",{className:"text-slate-300",children:["• ",v]}):null]})})]}),S?r.jsx("div",{className:"pointer-events-none absolute rounded",style:{...T},children:r.jsx(Uf,{sensors:s,size:240,overlay:!0})}):null]})}return r.jsxs("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:[r.jsx("div",{className:`absolute ${_} font-medium text-slate-100 ${q}`,children:r.jsxs("div",{className:"flex flex-col gap-0.5 leading-none",children:[r.jsxs("span",{children:["Status: ",f]}),d?r.jsxs("span",{children:["Audio: ",d]}):null,h?r.jsx("span",{className:"text-cyan-300",children:h}):null]})}),k?r.jsx("div",{className:`absolute left-1/2 top-0.5 -translate-x-1/2 rounded bg-black/70 text-slate-100 ${z} ${H}`,children:k}):null,r.jsx("div",{className:`absolute ${U} left-1/2`,style:W,children:r.jsx("div",{className:`flex gap-0.5 bg-black/80 text-slate-100 ${O} ${K}`,children:r.jsxs("span",{children:["Rover:"," ",r.jsxs("span",{className:"rounded px-1 py-[1px] border border-transparent",style:ca(o,.18),children:['"',i||"Unnamed Rover",'"']})]})})}),S&&g!=="spectator"?r.jsx("div",{className:"pointer-events-none absolute rounded",style:{...T},children:r.jsx(Uf,{sensors:s,size:240,overlay:!0})}):null]})}function aN({mobileHud:n=!1,turnSeconds:s=null,isActiveDriver:i=!1,idleSkipSeconds:o=null}){const f=n?"text-3xl":"text-5xl",d=n?"text-xs":"text-sm",h=n?"text-[0.55rem]":"text-[0.75rem]",p=n?"px-4 py-3":"px-6 py-4",x=i&&typeof o=="number";return r.jsx("div",{className:"pointer-events-none absolute inset-0 z-30 flex items-center justify-center bg-black/55",children:r.jsxs("div",{className:`flex flex-col items-center gap-0.5 rounded border border-amber-300/80 bg-black/70 ${p}`,children:[r.jsx("div",{className:`font-semibold text-amber-200 ${f}`,children:"IT IS YOUR TURN!"}),r.jsx("div",{className:`text-amber-200/80 ${d}`,children:"Start driving!"}),x?r.jsxs("div",{className:`text-red-100/90 ${h}`,children:["Idle skip in ",o,"s"]}):null]})})}const sN={leftWheel:"Left wheel",rightWheel:"Right wheel",mainBrush:"Main brush",sideBrush:"Side brush",limiter:"Overcurrent limit"};function lN({motors:n,fill:s=0,compact:i=!1}){if(!n?.length)return null;const o=n.map(v=>sN[v]||v),f=i?"w-[12rem] h-[3.5rem]":"w-[20rem] h-[7rem]",d=i?"px-2 py-1":"px-4 py-2",h=i?"text-lg":"text-4xl",p=i?"text-xs":"text-xl",x=Math.max(0,Math.min(1,s)),g=`${Math.round(x*100)}%`;return r.jsx("div",{className:`pointer-events-none absolute flex items-center justify-center bg-red-900/50 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 ${f}`,children:r.jsxs("div",{className:"relative h-full w-full",children:[r.jsx("div",{className:"absolute inset-0 overflow-hidden",children:r.jsx("div",{className:"h-full bg-red-700/60",style:{width:g}})}),r.jsxs("div",{className:`relative z-10 flex h-full w-full flex-col items-center justify-center text-center font-semibold text-white animate-pulse ${h} ${d}`,children:[r.jsx("div",{children:"OVERCURRENT"}),r.jsx("div",{className:`mt-0 font-medium text-white ${p}`,children:o.join(", ")})]})]})})}function iN({battery:n,compact:s=!1}){if(!n?.available||!n.warnActive&&!n.urgentActive)return null;const i=n.urgentActive?"BATTERY VERY LOW, DOCK THE ROVER AND CHARGE IMMEDIATELY!!":"Battery low! please dock and charge the rover soon.",o=s?"p-2 top-6":"p-4 top-10",f=s?"text-sm":"text-2xl";return r.jsx("div",{className:`pointer-events-none absolute flex items-center justify-center bg-amber-900/60 left-1/2 -translate-x-1/2 ${o}`,children:r.jsx("div",{className:`text-center font-semibold text-white animate-pulse ${f}`,children:r.jsx("div",{children:i})})})}function rN({compact:n=!1}){const s=ft(_=>_.session),{sendMessage:i,onInputFocus:o,onInputBlur:f,blurChat:d,registerInputRef:h,setTypingActive:p}=od(),{value:x}=He("tts",{engine:"flite",voice:"rms",pitch:50}),[g,v]=m.useState(""),[y,S]=m.useState(!1),E=s?.role!=="spectator",C=s?.role==="spectator",k=s?.assignment?.roverId||null,j=!!m.useMemo(()=>s?.roster?.find(_=>String(_.id)===String(k))||null,[k,s?.roster])?.audio?.ttsEnabled,N=m.useMemo(()=>{if(!j)return null;const _=x?.engine==="espeak"?"espeak":"flite";if(_==="espeak"){let z=Number.isFinite(x?.pitch)?Math.round(x.pitch):void 0;return typeof z=="number"&&(z=Math.max(0,Math.min(99,z))),{speak:!0,engine:_,pitch:z}}const H=typeof x?.voice=="string"?x.voice:void 0;return{speak:!0,engine:_,voice:H}},[x?.engine,x?.pitch,x?.voice,j]),q=n?"pointer-events-auto absolute bottom-0.5 right-0.5 flex w-[9rem] max-w-[70vw] items-center gap-0.5 rounded bg-black/70 px-0.4 py-0.2":"pointer-events-auto absolute bottom-1 right-1 flex w-[12rem] max-w-[70vw] items-center gap-0.5 rounded bg-black/70 px-0.5 py-0.25",M=n?"min-w-0 flex-1 bg-transparent text-[0.55rem] text-slate-100 placeholder:text-slate-400 focus:outline-none":"min-w-0 flex-1 bg-transparent text-[0.7rem] text-slate-100 placeholder:text-slate-400 focus:outline-none",O=n?"rounded bg-cyan-500/80 px-0.35 py-0.2 text-[0.55rem] font-semibold text-black disabled:opacity-50":"rounded bg-cyan-500/80 px-0.5 py-0.25 text-[0.7rem] font-semibold text-black disabled:opacity-50";async function K(_){if(_.preventDefault(),!E)return;const H=g.trim();if(H){S(!0);try{await i(H,N),v(""),d(),p(!1)}catch(z){alert(z.message)}finally{S(!1)}}}return C?null:r.jsxs("form",{onSubmit:K,className:q,children:[r.jsx("input",{className:M,value:g,onChange:_=>{const H=_.target.value;v(H),p(!!H.trim())},onFocus:_=>{o(_),p(!!g.trim())},onBlur:_=>{f(_),p(!1)},onKeyDown:_=>{_.key==="Enter"&&!g.trim()&&(_.preventDefault(),d(),p(!1))},ref:_=>h(_,{target:"hud"}),placeholder:E?"Chat (TTS)":"Spectator",disabled:!E}),r.jsx("button",{type:"submit",disabled:!E||y,className:O,children:"Speak"})]})}function xd({layoutFormat:n="desktop"}){const s=ft(ae=>ae.session),{state:{song:i,lastControlIntentAt:o},overcurrentLimiter:f}=_t(),[d,h]=m.useState(()=>Date.now()),[p,x]=m.useState(!1),[g,v]=m.useState(null),y=m.useRef({active:!1,roverId:null});m.useEffect(()=>{if(s?.mode!=="turns")return;const ae=setInterval(()=>h(Date.now()),250);return()=>clearInterval(ae)},[s?.mode]);const S=s?.assignment?.roverId,C=!!(S&&s?.roster?s.roster.find(ae=>String(ae.id)===String(S)):null)?.media?.audioPublishUrl,k=S?s?.turnQueues?.[S]:null,w=s?.socketId||null,j=S?s?.activeDrivers?.[S]:null,N=!!(w&&j===w),q=m.useMemo(()=>{const ae=k?.queue||[];if(!ae.length||!k?.current||ae.length<=1)return null;const pe=ae.findIndex(re=>re===k.current);return pe===-1?ae[0]||null:ae[(pe+1)%ae.length]||null},[k?.queue,k?.current]),M=!!(w&&q===w),O=k?.deadline||null,K=k?.idleDeadline||null,_=O?O-d:null,H=K?K-d:null,z=s?.mode==="turns"&&M&&_!=null&&_<=5e3&&_>0,V=s?.mode!=="turns"||N||z,U=_!=null&&Number.isFinite(_)?Math.max(0,Math.ceil(_/1e3)):null,W=H!=null&&Number.isFinite(H)?Math.max(0,Math.ceil(H/1e3)):null,ce=N?U!=null?`${U}s left`:null:M&&U!=null?`Your turn in ${U}s`:null,oe=S?[...V?[{type:"rover",id:S,key:S}]:[],...C?[{type:"rover",id:`${S}-audio`,key:`${S}-audio`}]:[]]:[],$=Ai(oe),T=S&&V?$[S]:null,Y=S&&C?$[`${S}-audio`]:null,I=md(S?[S]:[],{enabled:!!S,version:s?.mode}),ie=S&&I[S]||null,de=ml(S),R=S&&s?.roster?s.roster.find(ae=>String(ae.id)===String(S)):null,G=R?.battery??null,te=R?.name||(S?`Rover ${S}`:"");return m.useEffect(()=>{if(s?.mode!=="turns"){x(!1),v(null),y.current={active:!1,roverId:null};return}const ae=y.current,pe=N&&!ae.active,re=N&&S&&S!==ae.roverId;pe||re?(x(!0),v(Date.now())):!N&&ae.active&&(x(!1),v(null)),y.current={active:N,roverId:S}},[N,S,s?.mode]),m.useEffect(()=>{!p||!g||o>g&&x(!1)},[o,g,p]),r.jsx("section",{className:"panel",children:S?r.jsx(wi,{sessionInfo:T,videoMode:V?"whep":"snapshot",snapshotFeed:ie,audioSessionInfo:Y,label:te,roverColor:R?.color||null,telemetryFrame:de,batteryConfig:G,layoutFormat:n,overcurrentLimiter:f,songNote:i?.note,qualityNotice:V?null:"Preview feed (low FPS) until your turn.",showTurnCue:p,turnTimerText:ce,turnSeconds:U,isActiveDriver:N,idleSkipSeconds:W}):r.jsxs("div",{className:"panel-muted content-center text-center text-sm text-slate-400 aspect-[4/3]",children:[r.jsx("p",{children:"You are not assigned to a rover."}),r.jsx("p",{className:"mt-0",children:r.jsx("a",{href:"/spectate",className:"text-blue-400 underline hover:text-blue-500",children:"Click here to visit the spectator page."})})]})})}function yo({label:n,tone:s="muted"}){const i=s==="success"?"bg-emerald-900 text-emerald-100":s==="warn"?"bg-amber-900 text-amber-100":"bg-slate-800 text-slate-200";return r.jsx("span",{className:`rounded px-1 py-0.5 text-xs font-semibold leading-none ${i}`,children:n})}function Mo(n){if(!Number.isFinite(n))return 0;const s=n%360;return s<0?s+360:s}function oN(n){if(!Array.isArray(n)||n.length<3)return 0;const[s,i,o]=n,f=Math.max(0,Math.min(255,Number(s)))/255,d=Math.max(0,Math.min(255,Number(i)))/255,h=Math.max(0,Math.min(255,Number(o)))/255,p=Math.max(f,d,h),x=Math.min(f,d,h),g=p-x;if(g===0)return 0;let v=0;return p===f?v=(d-h)/g%6:p===d?v=(h-f)/g+2:v=(f-d)/g+4,Mo(Math.round(v*60))}function ox(n){const s=Mo(n),i=1,o=1-Math.abs(s/60%2-1);let f=0,d=0,h=0;return s<60?(f=i,d=o):s<120?(f=o,d=i):s<180?(d=i,h=o):s<240?(d=o,h=i):s<300?(f=o,h=i):(f=i,h=o),[Math.round(f*255),Math.round(d*255),Math.round(h*255)]}function cx(n){return n?Array.isArray(n.hsColor)?Mo(Number(n.hsColor[0])):Array.isArray(n.rgbColor)?oN(n.rgbColor):0:0}function cN({entity:n,connected:s,controlsLocked:i,onToggle:o,onSetColor:f,onSetWhite:d}){const h=n.state==="unavailable"||!n.available,p=n.state==="on",x=n.type==="light"&&n.supportsColor,g=h?"warn":p?"success":"muted",v=h?"Unavailable":p?"On":"Off",y=i||!s||h,S=y||!x,[E,C]=m.useState(()=>cx(n)),k=m.useRef(E),w=m.useRef(!1),j=h?"border-slate-800 bg-slate-900 text-slate-400 cursor-not-allowed":i?"border-slate-800 bg-slate-900 text-slate-300 cursor-not-allowed":p?"border-emerald-700 bg-emerald-900/80 text-emerald-50 hover:bg-emerald-800":"border-rose-800 bg-rose-900/80 text-rose-50 hover:bg-rose-800";m.useEffect(()=>{if(!x||w.current)return;const H=cx(n);k.current=H,C(H)},[n.rgbColor,n.hsColor,x]);const N=H=>{const z=Mo(Number(H.target.value));k.current=z,C(z)},q=()=>{S||!f||f(n.id,ox(k.current))},M=H=>{H.stopPropagation()},O=H=>{M(H),!(S||!d)&&d(n.id)},_=`rgb(${(x?ox(k.current):[255,255,255]).join(",")})`;return r.jsxs("button",{type:"button",onClick:()=>o(n.id),disabled:y,className:`relative flex min-w-[12rem] flex-[1_1_12rem] items-start justify-between gap-0.5 rounded px-1 py-0.5 text-left transition-colors ${j} disabled:opacity-60 disabled:hover:bg-inherit`,children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-0.5 text-sm leading-normal",children:[r.jsx("span",{className:"truncate font-semibold text-white",children:n.name||n.id}),x&&r.jsxs(r.Fragment,{children:[r.jsx(yo,{label:v,tone:g}),!s&&r.jsx("span",{className:"text-xs text-amber-200",children:"Offline"})]})]}),x?r.jsx("div",{className:"-mt-0.5 w-full",onClick:M,onPointerDown:H=>{M(H),w.current=!0},onPointerUp:H=>{M(H),w.current=!1,q()},onPointerCancel:H=>{M(H),w.current=!1,q()},onKeyUp:H=>{M(H),q()},onBlur:q,children:r.jsx("div",{className:"relative w-full",children:r.jsx("input",{type:"range",min:"0",max:"360",step:"1",value:E,onChange:N,disabled:S,"aria-label":`Set color for ${n.name||n.id}`,className:"ha-hue-slider w-full"})})}):r.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-slate-400",children:[r.jsx(yo,{label:v,tone:g}),!s&&r.jsx("span",{className:"text-amber-200",children:" · Offline"})]})]}),x&&r.jsxs("div",{className:"absolute right-1 top-1 flex items-center gap-0.5",children:[r.jsx("span",{role:"button",tabIndex:S?-1:0,onClick:O,onPointerDown:M,onKeyDown:H=>{S||(H.key==="Enter"||H.key===" ")&&(H.preventDefault(),O(H))},title:"Set white color temperature","aria-label":`Set ${n.name||n.id} to white`,"aria-disabled":S,className:`inline-flex items-center justify-center rounded border border-slate-200 bg-white px-1 py-0.5 text-xs font-semibold leading-none text-slate-900 ${S?"cursor-not-allowed opacity-60":"cursor-pointer hover:bg-slate-100"}`,children:"white"}),r.jsx("span",{className:"pointer-events-none h-2.5 w-2.5 rounded-full border border-white/60",style:{backgroundColor:_}})]}),!x&&r.jsx("div",{className:"self-center text-xs font-semibold text-white/90",children:p?"Turn off":"Turn on"})]})}function Hg(){const{state:{keymap:n}}=_t(),s=ft(E=>E.session),{homeAssistantToggle:i,homeAssistantSetLightColor:o,homeAssistantSetLightWhite:f}=wn(),d=s?.homeAssistant,h=m.useMemo(()=>d?.entities||[],[d?.entities]),p=d?.lightPolicy||null,x=!!(p?.locked||p?.lockedOn),g=p?.lockState||(p?.lockedOn?"on":null),v=An(n?.homeAssistantOn?.[0]),y=An(n?.homeAssistantOff?.[0]);if(!d?.enabled)return r.jsxs("section",{className:"panel-section space-y-0.5 text-sm text-slate-400",children:[r.jsx("p",{className:"text-slate-300",children:"Room Controls"}),r.jsx("p",{className:"text-slate-500",children:"Not configured on the server."})]});if(h.length===0)return r.jsxs("section",{className:"panel-section space-y-0.5 text-sm text-slate-400",children:[r.jsx("p",{className:"text-slate-300",children:"Room Controls"}),r.jsx("p",{className:"text-slate-500",children:"No lights or switches configured."})]});const S=!!d?.connected;return r.jsxs("section",{className:"panel-section space-y-0.5 text-base",children:[r.jsxs("header",{className:"flex items-center justify-between gap-0.5 text-sm text-slate-400",children:[r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx("p",{children:"Room Controls"}),r.jsx("span",{className:"text-xs text-slate-500",children:h.length}),x?r.jsx(yo,{label:g==="off"?"Locked Off":"Locked On",tone:"warn"}):null,r.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-slate-300 background-black",children:[r.jsxs("span",{className:"flex items-center gap-0.5",children:[r.jsx("span",{children:"On"}),v?r.jsx(ux,{label:v}):null]}),r.jsxs("span",{className:"flex items-center gap-0.5",children:[r.jsx("span",{children:"Off"}),y?r.jsx(ux,{label:y}):null]})]})]}),r.jsx(yo,{label:S?"Connected":"Offline",tone:S?"success":"warn"})]}),x?r.jsx("p",{className:"rounded border border-amber-600/60 bg-amber-900/40 px-1 py-0.5 text-xs text-amber-100",children:g==="off"?"Lights are locked off. Room controls are disabled.":"Lights are locked on. Room controls are disabled."}):null,r.jsx("div",{className:"flex flex-wrap gap-0.5",children:h.map(E=>r.jsx(cN,{entity:E,connected:S,controlsLocked:x,onToggle:i,onSetColor:o,onSetWhite:f},E.id))})]})}function ux({label:n}){return n?r.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:n}):null}function Vg(){const{login:n,setRole:s}=wn(),[i,o]=m.useState(""),[f,d]=m.useState(""),[h,p]=m.useState(!1);async function x(g){g.preventDefault(),p(!0);try{await n(i,f),o(""),d("")}catch(v){alert(v.message)}finally{p(!1)}}return r.jsxs("div",{className:"panel-section space-y-0.5 text-base",children:[r.jsx("p",{className:"text-sm text-slate-400",children:"Admin login"}),r.jsxs("form",{className:"flex flex-col gap-0.5",onSubmit:x,children:[r.jsx("input",{className:"field-input",placeholder:"Username",value:i,onChange:g=>o(g.target.value)}),r.jsx("input",{className:"field-input",placeholder:"Password",type:"password",value:f,onChange:g=>d(g.target.value)}),r.jsx("button",{type:"submit",disabled:h,className:"button-dark w-full disabled:opacity-50",children:h?"Logging in…":"Login"})]})]})}function fx(...n){return n.filter(Boolean).join(" ")}function uN(n){const s=n?.batteryState?.percentDisplay;return s==null?"--":`${s}%`}function fN(n){return n?.batteryState?n.batteryState.urgentActive?"text-red-400":n.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function dN({title:n,roster:s=[],emptyText:i="No roster data.",renderActions:o=null}){return r.jsxs("div",{className:"space-y-0.5 text-sm",children:[n&&r.jsx("p",{className:"text-sm text-slate-400",children:n}),s.length===0?r.jsx("p",{className:"text-sm text-slate-500",children:i}):r.jsx("ul",{className:"space-y-0.5 text-sm",children:s.map(f=>{const d=!!(f?.private?.enabled&&f?.private?.open),h=!!f?.locked;return r.jsxs("li",{className:fx("surface flex flex-wrap items-center justify-between gap-0.5",h?"bg-red-900/40":d?"bg-amber-700/35 border border-amber-200/30":null),children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-slate-200",children:r.jsx("span",{className:"rounded px-1 py-[1px] border border-transparent",style:ca(f.color,.16),children:f.name})}),r.jsxs("p",{className:"text-xs text-slate-500 flex flex-wrap items-center gap-0.5",children:[r.jsx("span",{children:f.locked?"locked":"free"}),f.lockReason&&r.jsx("span",{className:"rounded bg-black/30 px-1",children:f.lockReason}),r.jsxs("span",{className:fx("font-semibold",fN(f)),children:["Battery ",uN(f)]})]})]}),o?o(f):null]},f.id)})})]})}const mN=[{key:"open",label:"Open"},{key:"turns",label:"Turns"},{key:"admin",label:"Admin"},{key:"lockdown",label:"Lockdown"}];function hN(){const{session:n,lockRover:s,setMode:i,requestControl:o,setCommunityGoal:f,setAdminReason:d,rebootRover:h,rebootServer:p,setAudioLevels:x,setPrivateSafety:g,llmControl:v,adminLogs:y,llmCommentaryState:S}=nn(),E=m.useMemo(()=>n?.roster??[],[n?.roster]),[C,k]=m.useState({}),[w,j]=m.useState({}),[N,q]=m.useState(!1),[M,O]=m.useState(!1),K=n?.health||null,_=n?.communityGoal?.text||"",H=n?.communityGoal?.updatedAt||null,[z,V]=m.useState(_),U=n?.adminReason?.text||"",W=n?.adminReason?.updatedAt||null,[ce,oe]=m.useState(U),$=n?.audioLevels||{},[T,Y]=m.useState({hornGain:Number.isFinite($.hornGain)?$.hornGain:1,ttsGain:Number.isFinite($.ttsGain)?$.ttsGain:1,forwardGain:Number.isFinite($.forwardGain)?$.forwardGain:1}),[I,ie]=m.useState({}),de=n?.role==="admin"||n?.role==="lockdown"||n?.role==="lockdown-admin",R=n?.role==="lockdown"||n?.role==="lockdown-admin",G=n?.mode??"open",te=async(se,P)=>{try{await s(se,P),k(fe=>({...fe,[se]:P}))}catch(fe){alert(fe.message)}},ae=async se=>{const P=se.target.value;try{await i(P)}catch(fe){alert(fe.message)}},pe=async se=>{try{await o(se,{force:!0})}catch(P){alert(P.message)}},re=async se=>{if(!(!se?.id||!window.confirm(`Reboot rover "${se.name||se.id}" now?`))){j(fe=>({...fe,[se.id]:!0}));try{await h(se.id)}catch(fe){alert(fe.message)}finally{j(fe=>({...fe,[se.id]:!1}))}}},ue=async()=>{if(window.confirm("Reboot the server host now? This will disconnect all users.")){q(!0);try{await p()}catch(P){alert(P.message),q(!1)}}},ve=async()=>{if(window.confirm("Clear LLM commentary history now? This resets chat context, bot memory, and rover activity metrics for narration.")){O(!0);try{await v("clearHistory")}catch(P){alert(P.message)}finally{O(!1)}}},be=async()=>{try{await f(z)}catch(se){alert(se.message)}},xe=async()=>{try{await f(null)}catch(se){alert(se.message)}},Be=async()=>{try{await d(ce)}catch(se){alert(se.message)}},ze=async()=>{try{await d(null)}catch(se){alert(se.message)}},Ae=se=>P=>{const fe=Number(P.target.value);Y(Ne=>({...Ne||{},[se]:Number.isFinite(fe)?fe:1}))},tt=async()=>{try{await x(T)}catch(se){alert(se.message)}},Je=async()=>{window.dispatchEvent(new CustomEvent("buttonBox:rewardRunLocalTest",{detail:{rewardName:"Admin Mode",count:1e3,goal:1e3}}))};m.useEffect(()=>{V(_)},[_]),m.useEffect(()=>{oe(U)},[U]),m.useEffect(()=>{Y({hornGain:Number.isFinite($.hornGain)?$.hornGain:1,ttsGain:Number.isFinite($.ttsGain)?$.ttsGain:1,forwardGain:Number.isFinite($.forwardGain)?$.forwardGain:1})},[$.forwardGain,$.hornGain,$.ttsGain]),m.useEffect(()=>{const se={};(E||[]).forEach(P=>{P?.private?.enabled&&(se[P.id]={speedLimitEnabled:!!P?.private?.safety?.speedLimitEnabled,speedLimitMaxWheelSpeed:Number.isFinite(P?.private?.safety?.speedLimitMaxWheelSpeed)?P.private.safety.speedLimitMaxWheelSpeed:250,hardOvercurrentEnabled:!!P?.private?.safety?.hardOvercurrentEnabled,overcurrentStopMs:Number.isFinite(P?.private?.safety?.overcurrentStopMs)?P.private.safety.overcurrentStopMs:300,hardBumpEnabled:!!P?.private?.safety?.hardBumpEnabled,bumpBackoffSpeed:Number.isFinite(P?.private?.safety?.bumpBackoffSpeed)?P.private.safety.bumpBackoffSpeed:250,bumpBackoffMs:Number.isFinite(P?.private?.safety?.bumpBackoffMs)?P.private.safety.bumpBackoffMs:350,cliffEnabled:!!P?.private?.safety?.cliffEnabled,cliffBackoffSpeed:Number.isFinite(P?.private?.safety?.cliffBackoffSpeed)?P.private.safety.cliffBackoffSpeed:250,cliffBackoffMs:Number.isFinite(P?.private?.safety?.cliffBackoffMs)?P.private.safety.cliffBackoffMs:500,triggerCooldownMs:Number.isFinite(P?.private?.safety?.triggerCooldownMs)?P.private.safety.triggerCooldownMs:800})}),ie(se)},[E]);const vt=m.useMemo(()=>{const se={};return E.forEach(P=>{se[P.id]=C[P.id]??P.locked}),se},[E,C]),le=(se,P={})=>{ie(fe=>({...fe||{},[se]:{...fe?.[se]||{},...P||{}}}))},me=async se=>{try{const P=I?.[se];if(!P)return;await g(se,P)}catch(P){alert(P.message)}};return de?r.jsxs("section",{className:"panel-section space-y-0.5 text-base",children:[r.jsxs("div",{className:"flex items-center justify-between gap-0.5 text-sm",children:[r.jsx("span",{children:"Admin controls"}),r.jsx("select",{value:G,onChange:ae,className:"field-input text-sm",children:mN.map(se=>r.jsx("option",{value:se.key,children:se.label},se.key))})]}),r.jsxs("div",{className:"flex gap-0.5 text-xs",children:[r.jsx("button",{type:"button",onClick:ue,disabled:N,className:"button-danger disabled:cursor-not-allowed disabled:opacity-60",children:N?"Server rebooting...":"Reboot Server"}),r.jsx("button",{type:"button",onClick:Je,className:"button-dark",children:"Test Reward Popup"})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[r.jsx("span",{children:"Global audio levels"}),n?.audioLevels?.updatedAt?r.jsxs("span",{children:["Updated ",new Date(n.audioLevels.updatedAt).toLocaleString()]}):null]}),r.jsxs("label",{className:"grid gap-0.5 text-xs text-slate-200",children:[r.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[r.jsx("span",{children:"Horn gain"}),r.jsxs("span",{children:[T.hornGain.toFixed(2),"x"]})]}),r.jsx("input",{type:"range",min:"0",max:"4",step:"0.01",value:T.hornGain,onChange:Ae("hornGain"),className:"w-full accent-emerald-500"})]}),r.jsxs("label",{className:"grid gap-0.5 text-xs text-slate-200",children:[r.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[r.jsx("span",{children:"TTS gain"}),r.jsxs("span",{children:[T.ttsGain.toFixed(2),"x"]})]}),r.jsx("input",{type:"range",min:"0",max:"4",step:"0.01",value:T.ttsGain,onChange:Ae("ttsGain"),className:"w-full accent-emerald-500"})]}),r.jsxs("label",{className:"grid gap-0.5 text-xs text-slate-200",children:[r.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[r.jsx("span",{children:"Forward gain"}),r.jsxs("span",{children:[T.forwardGain.toFixed(2),"x"]})]}),r.jsx("input",{type:"range",min:"0",max:"4",step:"0.01",value:T.forwardGain,onChange:Ae("forwardGain"),className:"w-full accent-emerald-500"})]}),r.jsx("div",{className:"flex gap-0.5 text-xs",children:r.jsx("button",{type:"button",onClick:tt,className:"button-dark",children:"Apply audio levels"})})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[r.jsx("span",{children:"Community goal"}),H?r.jsxs("span",{children:["Updated ",new Date(H).toLocaleString()]}):null]}),r.jsx("input",{type:"text",value:z,onChange:se=>V(se.target.value),placeholder:"Set a community goal",className:"field-input text-sm"}),r.jsxs("div",{className:"flex gap-0.5 text-xs",children:[r.jsx("button",{type:"button",onClick:be,className:"button-dark",children:"Set goal"}),r.jsx("button",{type:"button",onClick:xe,className:"button-danger",children:"Clear"})]})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[r.jsx("span",{children:"Admin mode reason"}),W?r.jsxs("span",{children:["Updated ",new Date(W).toLocaleString()]}):null]}),r.jsx("textarea",{value:ce,onChange:se=>oe(se.target.value),placeholder:"Set an admin mode reason",className:"field-input text-sm min-h-[3.5rem]"}),r.jsxs("div",{className:"flex gap-0.5 text-xs",children:[r.jsx("button",{type:"button",onClick:Be,className:"button-dark",children:"Set reason"}),r.jsx("button",{type:"button",onClick:ze,className:"button-danger",children:"Clear"})]})]}),r.jsx(dN,{roster:E,renderActions:se=>r.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 text-xs",children:[r.jsx("button",{type:"button",onClick:()=>te(se.id,!vt[se.id]),className:"button-dark",children:vt[se.id]?"Unlock":"Lock"}),r.jsx("button",{type:"button",onClick:()=>pe(se.id),className:"button-dark",children:"Force"}),r.jsx("button",{type:"button",onClick:()=>re(se),disabled:!!w[se.id],className:"button-danger disabled:cursor-not-allowed disabled:opacity-60",children:w[se.id]?"Rebooting...":"Reboot"}),se?.private?.enabled?r.jsxs("div",{className:"w-full rounded border border-slate-700/70 p-0.5 space-y-0.5 text-[0.7rem]",children:[r.jsx("div",{className:"text-slate-300",children:"Private safety"}),r.jsxs("label",{className:"flex items-center gap-0.5",children:[r.jsx("input",{type:"checkbox",checked:!!I?.[se.id]?.speedLimitEnabled,disabled:!R,onChange:P=>le(se.id,{speedLimitEnabled:!!P.target.checked})}),r.jsx("span",{children:"Speed limit"})]}),r.jsx("input",{type:"number",min:"1",max:"500",className:"field-input text-xs w-20",disabled:!R,value:I?.[se.id]?.speedLimitMaxWheelSpeed??250,onChange:P=>le(se.id,{speedLimitMaxWheelSpeed:Number(P.target.value)||250})}),r.jsxs("label",{className:"flex items-center gap-0.5",children:[r.jsx("input",{type:"checkbox",checked:!!I?.[se.id]?.hardOvercurrentEnabled,disabled:!R,onChange:P=>le(se.id,{hardOvercurrentEnabled:!!P.target.checked})}),r.jsx("span",{children:"Hard overcurrent"})]}),r.jsxs("label",{className:"flex items-center gap-0.5",children:[r.jsx("input",{type:"checkbox",checked:!!I?.[se.id]?.hardBumpEnabled,disabled:!R,onChange:P=>le(se.id,{hardBumpEnabled:!!P.target.checked})}),r.jsx("span",{children:"Hard bump"})]}),r.jsxs("label",{className:"flex items-center gap-0.5",children:[r.jsx("input",{type:"checkbox",checked:!!I?.[se.id]?.cliffEnabled,disabled:!R,onChange:P=>le(se.id,{cliffEnabled:!!P.target.checked})}),r.jsx("span",{children:"Cliff safety"})]}),r.jsx("button",{type:"button",disabled:!R,onClick:()=>me(se.id),className:"button-dark disabled:opacity-50",children:"Apply Safety"})]}):null]})}),r.jsx(vN,{health:K,roster:E}),r.jsx(pN,{state:S,onClearHistory:ve,clearingHistory:M}),r.jsx(bN,{entries:y})]}):null}function pN({state:n,onClearHistory:s,clearingHistory:i}){const[o,f]=m.useState(null);if(!n)return r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("div",{className:"panel-muted text-xs uppercase",children:"LLM Commentary"}),r.jsx("div",{className:"surface text-xs text-slate-300",children:"No status received yet."})]});const d=n.runtime||{},h=n.counters||{},p=n.timings||{},x=n.input||{},g=n.output||{},v=n.errors||{},y=Array.isArray(n.history)?n.history:[],S=y.find(w=>w.runId===o)||(y.length?y[y.length-1]:null),E=xN(n),C=gN(x.modelMessages,g.raw),k=[{label:"running",value:d.running?"yes":"no"},{label:"in flight",value:d.inFlight?"yes":"no"},{label:"phase",value:d.phase||"--"},{label:"run id",value:d.currentRunId??"--"},{label:"tick count",value:d.tickCount??0},{label:"last tick",value:d.lastTickAt?new Date(d.lastTickAt).toLocaleString():"never"},{label:"next run",value:d.nextRunAt?new Date(d.nextRunAt).toLocaleString():"n/a"},{label:"outcome",value:d.outcome||"--"},{label:"reason",value:d.reason||"--"},{label:"skip streak",value:h.skipStreak??0},{label:"clear count",value:h.clearCount??0},{label:"last gen",value:p.lastGenerationMs!=null?`${p.lastGenerationMs} ms`:"--"},{label:"avg gen",value:p.avgGenerationMs!=null?`${p.avgGenerationMs} ms`:"--"},{label:"gen count",value:p.generationCount??0},{label:"prompt chars",value:h.promptChars??0},{label:"active drivers",value:h.snapshotSummary?.activeDrivers??0},{label:"snapshot rovers",value:h.snapshotSummary?.rovers??0},{label:"snapshot chat",value:h.snapshotSummary?.chatMessages??0}];return r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("div",{className:"panel-muted text-xs uppercase",children:"LLM Commentary"}),r.jsx("div",{className:"flex gap-0.5 text-xs",children:r.jsx("button",{type:"button",onClick:s,disabled:!!i,className:"button-danger disabled:cursor-not-allowed disabled:opacity-60",children:i?"Clearing...":"Clear LLM History"})}),r.jsxs("div",{className:`surface border text-center ${E.className}`,children:[r.jsx("div",{className:"text-[1.1rem] font-bold tracking-wide",children:E.label}),r.jsx("div",{className:"text-xs text-slate-200",children:E.detail})]}),r.jsx("div",{className:"surface flex flex-wrap gap-0.5 text-xs",children:k.map(w=>r.jsxs("span",{className:"rounded border border-slate-600/60 bg-slate-800/70 px-0.5 py-0.25 text-[0.72rem] leading-tight text-slate-200",children:[w.label,": ",w.value]},w.label))}),v.message?r.jsxs("div",{className:"surface text-xs text-red-300 break-words",children:["Error: ",v.message]}):null,v.details?r.jsxs("details",{className:"surface text-xs text-red-200",children:[r.jsx("summary",{className:"cursor-pointer select-none text-red-300",children:"Failure details"}),r.jsx("pre",{className:"mt-0.5 whitespace-pre-wrap break-words text-[0.72rem] text-red-200",children:JSON.stringify(v.details,null,2)})]}):null,g.generated?r.jsxs("div",{className:"surface text-xs text-slate-200 break-words",children:["Generated: ",g.generated]}):null,g.posted?r.jsxs("div",{className:"surface text-xs text-emerald-200 break-words",children:["Posted: ",g.posted]}):null,r.jsxs("div",{className:"grid gap-0.5 md:grid-cols-2",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("div",{className:"panel-muted text-xs uppercase",children:"Live Input Conversation"}),r.jsx("div",{className:"surface max-h-72 space-y-0.5 overflow-y-auto",children:C.length?C.map(w=>r.jsx(ld,{message:w.message},w.id)):r.jsx("div",{className:"text-xs text-slate-300",children:"No model conversation captured yet."})})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("div",{className:"panel-muted text-xs uppercase",children:"Output + Error"}),r.jsxs("div",{className:"surface space-y-0.5 text-xs text-slate-200",children:[r.jsxs("div",{children:["Raw output: ",g.raw?.trim()?g.raw:""]}),r.jsxs("div",{children:["Posted: ",g.posted||""]}),r.jsxs("div",{children:["Output at:"," ",g.modelOutputAt?new Date(g.modelOutputAt).toLocaleString():"n/a"]}),r.jsxs("div",{children:["Failed at: ",v.failedAt?new Date(v.failedAt).toLocaleString():"n/a"]})]})]})]}),r.jsxs("details",{className:"surface text-xs text-slate-200",children:[r.jsx("summary",{className:"cursor-pointer select-none text-slate-300",children:"Full Monitor Payload"}),r.jsx("pre",{className:"mt-0.5 whitespace-pre-wrap break-words text-[0.72rem] text-slate-200",children:JSON.stringify(n,null,2)})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("div",{className:"panel-muted text-xs uppercase",children:"Recent Runs"}),r.jsx("div",{className:"surface max-h-52 space-y-0.5 overflow-y-auto text-xs",children:y.length?y.slice().reverse().map(w=>r.jsxs("button",{type:"button",onClick:()=>f(w.runId),className:`w-full text-left surface ${S?.runId===w.runId?"border border-sky-400/50":""}`,children:[r.jsxs("span",{className:"text-slate-300",children:["#",w.runId]})," ",r.jsx("span",{className:"text-slate-200",children:w.outcome||w.phase||"--"})," ",r.jsx("span",{className:"text-slate-400",children:w.durationMs!=null?`${w.durationMs}ms`:"--"})," ",r.jsx("span",{className:"text-slate-500",children:w.reason||""})]},w.runId)):r.jsx("div",{className:"text-slate-300",children:"No runs recorded yet."})})]}),S?r.jsxs("details",{className:"surface text-xs text-slate-200",open:!0,children:[r.jsxs("summary",{className:"cursor-pointer select-none text-slate-300",children:["Run #",S.runId," details"]}),r.jsx("pre",{className:"mt-0.5 whitespace-pre-wrap break-words text-[0.72rem] text-slate-200",children:JSON.stringify(S,null,2)})]}):null]})}function xN(n){const s=n?.runtime||{},i=n?.output||{},o=n?.errors||{};return s.inFlight?{label:"IN FLIGHT",detail:s.reason||"Generating commentary now",className:"border-amber-400/60 bg-amber-700/20 text-amber-200"}:s.outcome==="posted"?{label:"POSTED",detail:i.posted?`Last: ${i.posted}`:"Commentary posted",className:"border-emerald-400/60 bg-emerald-700/20 text-emerald-200"}:s.outcome==="skipped"?{label:"SKIPPED",detail:s.reason||"Model chose to skip",className:"border-slate-400/60 bg-slate-700/30 text-slate-200"}:s.outcome==="failed"?{label:"FAILED",detail:o.message||s.reason||"Tick failed",className:"border-red-400/60 bg-red-700/20 text-red-200"}:{label:s.running?"IDLE":"STOPPED",detail:s.reason||"Waiting for next tick",className:"border-sky-400/50 bg-sky-700/20 text-sky-200"}}function gN(n,s){const i=Date.now(),f=(Array.isArray(n)?n:[]).map((d,h)=>{const p=String(d?.role||"").toLowerCase(),x=typeof d?.content=="string"?d.content:JSON.stringify(d?.content??null,null,2),g=p==="system"?"LLM System":p==="assistant"?"LLM Context":p==="user"?"LLM Input":"LLM Message";return{id:`llm-msg-${h}`,message:{ts:i+h,nickname:g,text:x,role:"spectator",system:p==="system"}}});if(s!=null){const d=String(s);f.push({id:"llm-output",message:{ts:i+f.length+1,nickname:"LLM Output",text:d.trim()?d:"",role:"spectator",system:!0}})}return f}function vN({health:n,roster:s=[]}){if(!n)return null;const i=n.replay||{sources:[],readyCount:0,totalCount:0},o=n.snapshots||{rovers:[],rooms:[]},f=x=>s.find(g=>String(g.id)===String(x))?.color||null,d=`${i.readyCount}/${i.totalCount} sources ready`,h=o.rovers.filter(x=>x.stale).length,p=o.rooms.filter(x=>x.stale).length;return r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("div",{className:"panel-muted text-xs uppercase",children:"Health"}),r.jsxs("div",{className:"surface space-y-0.5 text-xs text-slate-200",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Replay segments"}),r.jsx("span",{className:"text-slate-400",children:d})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Rover snapshots"}),r.jsxs("span",{className:h?"text-amber-300":"text-emerald-300",children:[o.rovers.length-h,"/",o.rovers.length," ok"]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:"Room cameras"}),r.jsxs("span",{className:p?"text-amber-300":"text-emerald-300",children:[o.rooms.length-p,"/",o.rooms.length," ok"]})]})]}),r.jsx("div",{className:"space-y-0.5 text-xs text-slate-300",children:i.sources.map(x=>r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:`${x.type==="rover"?"rounded px-1 py-[1px] border border-transparent":""}`,style:x.type==="rover"?ca(f(x.id),.16):void 0,children:x.label}),r.jsxs("span",{className:x.ready?"text-emerald-300":"text-amber-300",children:[x.recentCount,"/",x.neededCount]})]},`${x.type}:${x.id}`))}),r.jsx("div",{className:"space-y-0.5 text-xs text-slate-300",children:o.rovers.map(x=>r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"rounded px-1 py-[1px] border border-transparent",style:ca(f(x.id),.16),children:x.name}),r.jsx("span",{className:x.stale?"text-amber-300":"text-emerald-300",children:x.stale?"stale":"ok"})]},`rover:${x.id}`))}),r.jsx("div",{className:"space-y-0.5 text-xs text-slate-300",children:o.rooms.map(x=>r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{children:x.name}),r.jsx("span",{className:x.stale?"text-amber-300":"text-emerald-300",children:x.error?"error":x.stale?"stale":"ok"})]},`room:${x.id}`))})]})}function bN({entries:n}){const s=n||[];return r.jsxs("div",{className:"panel-section space-y-0.5 text-base",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-400",children:[r.jsx("span",{children:"Admin IP log"}),r.jsx("span",{children:s.length})]}),r.jsx("div",{className:"surface h-64 overflow-y-auto font-mono text-xs",children:s.length===0?r.jsx("p",{children:"No admin log entries yet."}):s.slice().reverse().map(i=>r.jsxs("div",{className:"surface",children:[r.jsx("span",{className:"text-amber-400",children:i.ts?new Date(i.ts).toLocaleTimeString():"--"})," ",i.label&&r.jsxs("span",{className:"text-teal-400",children:["[",i.label,"]"]})," ",r.jsx("span",{className:"text-slate-200",children:i.message})," ",i.ip&&r.jsx("span",{className:"text-cyan-300",children:i.ip})," ",i.meta&&r.jsx("span",{className:"text-slate-500",children:JSON.stringify(i.meta)})]},i.id))}),r.jsx("p",{className:"text-xs text-slate-500",children:"Admin-only log stream; IPs never appear in user data."})]})}const yN=[{id:"driveForward",label:"Drive Forward",group:"Driving"},{id:"driveBackward",label:"Drive Backward",group:"Driving"},{id:"driveLeft",label:"Turn Left",group:"Driving"},{id:"driveRight",label:"Turn Right",group:"Driving"},{id:"boostModifier",label:"Boost Modifier",group:"Driving"},{id:"slowModifier",label:"Slow Modifier",group:"Driving"},{id:"auxMainForward",label:"Main Brush Forward",group:"Aux Motors"},{id:"auxMainReverse",label:"Main Brush Reverse",group:"Aux Motors"},{id:"auxSideForward",label:"Side Brush Forward",group:"Aux Motors"},{id:"auxSideReverse",label:"Side Brush Reverse",group:"Aux Motors"},{id:"auxVacuumFast",label:"Vacuum Max",group:"Aux Motors"},{id:"auxVacuumSlow",label:"Vacuum Low",group:"Aux Motors"},{id:"auxAllForward",label:"All Aux Forward",group:"Aux Motors"},{id:"cameraUp",label:"Camera Up",group:"Camera"},{id:"cameraDown",label:"Camera Down",group:"Camera"},{id:"nightVisionToggle",label:"Toggle Night Vision",group:"Camera"},{id:"hornHonk",label:"Horn (Hold)",group:"Audio"},{id:"micPtt",label:"Mic Push To Talk",group:"Audio"},{id:"driveMacro",label:"Drive Macro",group:"Macros"},{id:"dockMacro",label:"Dock Macro",group:"Macros"},{id:"chatFocus",label:"Toggle Chat",group:"Chat"},{id:"songNoteUp",label:"Song Note Up",group:"Audio"},{id:"songNoteDown",label:"Song Note Down",group:"Audio"},{id:"homeAssistantOn",label:"Room Controls On (Cycle)",group:"Room Controls"},{id:"homeAssistantOff",label:"Room Controls Off (Cycle)",group:"Room Controls"}];function SN(n){return n.reduce((s,i)=>((s[i.group]||(s[i.group]=[])).push(i),s),{})}function jN(n,s){const i=Number(n);return Number.isFinite(i)?Math.max(0,Math.min(500,i)):s}const gd=5,Ci=500,Ei=1,vd=100;function AN(n,s){const i=Number(n);return Number.isFinite(i)?Math.max(gd,Math.min(Ci,i)):s}function fo(n,s){const i=Number(n);return Number.isFinite(i)?Math.max(Ei,Math.min(vd,i)):s}function NN(n){const i=(fo(n,n)-Ei)/(vd-Ei),o=Ci-i*(Ci-gd);return Math.round(o)}function wN(n){const s=AN(n,n),i=(Ci-s)/(Ci-gd),o=Ei+i*(vd-Ei);return Math.round(o)}function CN(n){const[s,i]=m.useState(null),o=m.useCallback(h=>{lf(!0),i(h)},[]),f=m.useCallback(()=>{lf(!1),i(null)},[]),d=m.useCallback((h,p)=>{if(p.preventDefault(),p.stopPropagation(),p.key==="Escape"){f();return}const x=Di(p.key??"");x&&(n(h,x,p),f())},[f,n]);return m.useEffect(()=>()=>lf(!1),[]),{active:s,startCapture:o,cancel:f,captureFromEvent:d}}function eo({label:n,description:s,value:i,onChange:o,min:f=0,max:d=500,step:h=5}){return r.jsxs("label",{className:"surface-muted block p-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-300",children:[r.jsx("span",{className:"font-semibold text-slate-100",children:n}),r.jsx("input",{type:"number",min:f,max:d,value:i,onChange:p=>o(p.target.value),className:"w-16 rounded border border-slate-700 bg-slate-900 px-1 py-[2px] text-right text-[0.75rem] font-mono text-slate-100"})]}),s&&r.jsx("p",{className:"text-[0.65rem] text-slate-500",children:s}),r.jsxs("div",{className:"mt-0 flex items-center gap-0.5",children:[r.jsx("input",{type:"range",min:f,max:d,step:h,value:i,onChange:p=>o(p.target.value),className:"h-2 flex-1 accent-emerald-400"}),r.jsx("span",{className:"w-12 text-right text-[0.75rem] font-mono text-slate-400",children:i})]})]})}function EN(){const{state:{keymap:n},actions:{updateKeyBinding:s,resetKeyBindings:i}}=_t(),{value:o,save:f}=He("inputs",qn),d={...qn.keyboard,...o.keyboard??{}},h=m.useMemo(()=>typeof d.tiltSpeed=="number"?fo(d.tiltSpeed,qn.keyboard.tiltSpeed):typeof d.tiltIntervalMs=="number"?fo(wN(d.tiltIntervalMs),qn.keyboard.tiltSpeed):qn.keyboard.tiltSpeed,[d.tiltIntervalMs,d.tiltSpeed]),p=m.useMemo(()=>SN(yN),[]),{active:x,startCapture:g,cancel:v,captureFromEvent:y}=CN((k,w)=>{s(k,w)}),S=m.useCallback(k=>n?.[k]?.[0]||gi[k]?.[0]||"",[n]),E=m.useCallback((k,w)=>{const j=qn.keyboard,N=jN(w,j[k]);f(q=>({...q??{},keyboard:{...q?.keyboard??j,[k]:N}}))},[f]),C=m.useCallback(k=>{const w=qn.keyboard,j=fo(k,w.tiltSpeed),N=NN(j);f(q=>({...q??{},keyboard:{...q?.keyboard??w,tiltSpeed:j,tiltIntervalMs:N}}))},[f]);return r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-slate-400",children:"Keyboard layout"}),r.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Per-browser · click to change a binding"})]}),r.jsx("button",{type:"button",onClick:()=>i(),className:"button-dark text-xs",children:"Reset defaults"})]}),r.jsxs("div",{className:"space-y-0.5 surface",children:[r.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Keyboard speeds"}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(eo,{label:"Base speed",description:"Normal driving speed",value:d.baseSpeed,onChange:k=>E("baseSpeed",k)}),r.jsx(eo,{label:"Turbo speed",description:"Used when holding the boost modifier",value:d.turboSpeed,onChange:k=>E("turboSpeed",k)}),r.jsx(eo,{label:"Precision speed",description:"Used when holding the precision modifier",value:d.precisionSpeed,onChange:k=>E("precisionSpeed",k)})]})]}),r.jsxs("div",{className:"space-y-0.5 surface",children:[r.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Camera tilt"}),r.jsx(eo,{label:"Tilt speed",description:"Higher = faster when holding tilt keys",value:h,onChange:C,min:1,max:100,step:1})]}),r.jsx("div",{className:"space-y-0.5",children:Object.entries(p).map(([k,w])=>r.jsxs("div",{className:"space-y-0.5 surface",children:[r.jsx("p",{className:"text-[0.75rem] text-slate-400",children:k}),r.jsx("div",{className:"space-y-0.5",children:w.map(j=>{const N=S(j.id),q=x===j.id;return r.jsxs("div",{className:"surface-muted flex items-center justify-between text-xs",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-slate-100",children:j.label}),r.jsx("p",{className:"text-[0.65rem] text-slate-400",children:An(N)})]}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[q&&r.jsx("button",{type:"button",onClick:()=>v(),className:"button-danger text-[0.7rem]",children:"Cancel"}),r.jsx("button",{type:"button",onClick:()=>g(j.id),onKeyDown:q?M=>y(j.id,M):void 0,autoFocus:q,className:`${q?"px-0.5 py-0.5 bg-emerald-500 text-emerald-950 hover:bg-emerald-400":"button-dark"} text-[0.7rem] font-medium transition-colors`,children:q?"Press a key…":"Change"})]})]},j.id)})})]},k))})]})}const la=new Intl.NumberFormat(void 0,{maximumFractionDigits:2}),kN=[{id:"drive",label:"Drive stick",kind:"axisPair",section:"Driving",invertDefaults:{invertX:!1,invertY:!0}},{id:"cameraTilt",label:"Camera tilt",kind:"axis",section:"Camera",invertDefaults:{invert:!0}},{id:"mainBrush",label:"Main brush",kind:"axis",section:"Brushes",invertDefaults:{invert:!1}},{id:"sideBrush",label:"Side brush",kind:"axis",section:"Brushes",invertDefaults:{invert:!1}},{id:"vacuum",label:"Vacuum",kind:"button",section:"Aux buttons"},{id:"allAux",label:"All aux",kind:"button",section:"Aux buttons"},{id:"mainReverse",label:"Main reverse toggle",kind:"button",section:"Brush toggles"},{id:"sideReverse",label:"Side reverse toggle",kind:"button",section:"Brush toggles"},{id:"driveMacro",label:"Drive macro",kind:"button",section:"Mode macros"},{id:"dockMacro",label:"Dock macro",kind:"button",section:"Mode macros"},{id:"nightVisionToggle",label:"Night vision toggle",kind:"button",section:"Camera"}],dx=.45,MN=.6;function mi({label:n,description:s,min:i,max:o,step:f,value:d,onChange:h}){return r.jsxs("label",{className:"surface-muted block p-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-300",children:[r.jsx("span",{className:"font-semibold text-slate-100",children:n}),r.jsx("span",{className:"font-mono text-slate-400",children:la.format(d)})]}),s&&r.jsx("p",{className:"text-[0.65rem] text-slate-500",children:s}),r.jsx("input",{type:"range",min:i,max:o,step:f,value:d,onChange:p=>h(Number(p.target.value)),className:"mt-0 w-full accent-emerald-400"})]})}function RN(n){if(!n)return"Unassigned";if(n.kind==="axisPair"){const s=`${n.invertX?"X inv ":""}${n.invertY?"Y inv":""}`.trim();return`Axes ${n.x}/${n.y}${s?` (${s})`:""}`}if(n.kind==="axis")return`Axis ${n.index}${n.invert?" (inv)":""}`;if(n.kind==="button")return`Button ${n.index}`;if(n.kind==="buttonAxis")return`Button ${n.index} (analog)`;if(n.kind==="axisButton"){const s=n.direction<0?"<":">";return`Axis ${n.index} ${s} ${la.format(n.threshold??.6)}`}return"Unassigned"}function qN(n){return n.reduce((s,i)=>((s[i.section]||(s[i.section]=[])).push(i),s),{})}function TN(n,s){if(!n||n.length===0)return null;if(s){const i=n.find(o=>o.signature===s);if(i)return i}return n[0]}function DN(n){return{axes:Array.from(n.axes??[]),buttons:(n.buttons??[]).map(s=>({pressed:!!s?.pressed,value:typeof s?.value=="number"?s.value:s?.pressed?1:0}))}}function _N(n,s,i){const o=(n.axes??[]).map((d,h)=>({index:h,delta:Math.abs((d??0)-(s.axes?.[h]??0)),value:d}));if(o.sort((d,h)=>h.delta-d.delta),i.kind==="axisPair"){const d=o.filter(h=>h.delta>dx).slice(0,2);return d.length<2?null:{kind:"axisPair",x:d[0].index,y:d[1].index,...i.invertDefaults??{}}}const f=o.find(d=>d.delta>dx);return f?{kind:"axis",index:f.index,...i.invertDefaults??{}}:null}function BN(n,s,i){const o=n.buttons??[];for(let d=0;dMN)return i.kind==="axis"?{kind:"buttonAxis",index:d}:{kind:"button",index:d}}const f=n.axes??[];for(let d=0;d.7&&p>.5)return i.kind==="axis"?{kind:"axis",index:d,...i.invertDefaults??{}}:{kind:"axisButton",index:d,direction:h>=0?1:-1,threshold:.6}}return null}function ON(n,s,i){if(!n)return null;if(i.kind==="axis"||i.kind==="axisPair"){const o=_N(n,s,i);if(o)return o}return BN(n,s,i)}function LN(){const n=dA(),{value:s,save:i}=He("gamepad",Ba),[o,f]=m.useState(null),d=m.useRef(null),h=m.useMemo(()=>qN(kN),[]),p=m.useMemo(()=>TN(n.pads,s.activeSignature),[n.pads,s.activeSignature]),x=p?.signature??null,g=m.useMemo(()=>x?s?.profiles?.[x]??s?.defaults?.profile??ia:s?.defaults?.profile??ia,[x,s?.defaults?.profile,s?.profiles]);m.useEffect(()=>{!p||!x||s?.profiles?.[x]||i(w=>{const j=w??Ba;if(j.profiles?.[x])return j;const N=j?.defaults?.profile??ia,q=wg(p,N);return{...j,profiles:{...j.profiles??{},[x]:q}}})},[p,x,s?.profiles,i]),m.useEffect(()=>{d.current=null},[o,x]),m.useEffect(()=>{if(!o||!p)return;if(!d.current){d.current=DN(p);return}const w=ON(p,d.current,o);w&&(i(j=>{const N=j??Ba,q=N.profiles?.[x]??N?.defaults?.profile??ia,M={...q,bindings:{...q.bindings??{},[o.id]:{...q.bindings?.[o.id]??{},kind:o.kind,sources:[w]}}};return{...N,profiles:{...N.profiles??{},[x]:M}}}),f(null))},[p,x,o,i]);const v=m.useCallback(w=>{i(j=>({...j??Ba,activeSignature:w||null}))},[i]),y=m.useCallback(w=>{i(j=>{const N=j??Ba,q=(x&&N.profiles?.[x])??N?.defaults?.profile??ia,M={...q,calibration:{...q.calibration??{},...w}};return x?{...N,profiles:{...N.profiles??{},[x]:M}}:{...N,defaults:{...N.defaults??{},profile:M}}})},[x,i]),S=m.useCallback((w,j)=>{i(N=>{const q=N??Ba,M=(x&&q.profiles?.[x])??q?.defaults?.profile??ia,O=j(M.bindings?.[w]??{}),K={...M,bindings:{...M.bindings??{},[w]:O}};return x?{...q,profiles:{...q.profiles??{},[x]:K}}:{...q,defaults:{...q.defaults??{},profile:K}}})},[x,i]),E=m.useCallback(w=>{S(w.id,j=>({...j,sources:[]}))},[S]),C=m.useCallback((w,j)=>{S(w.id,N=>{const q=Array.isArray(N.sources)?[...N.sources]:[];if(!q[0])return N;const M={...q[0]};return j==="invertX"?M.invertX=!M.invertX:j==="invertY"?M.invertY=!M.invertY:M.invert=!M.invert,q[0]=M,{...N,sources:q}})},[S]),k=m.useMemo(()=>p?{outputs:Cg(p,g)}:null,[p,g]);return r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-xs text-slate-400",children:"Controller"}),r.jsx("p",{className:"text-[0.65rem] text-slate-500",children:p?"Move sticks or press buttons to bind":"Connect a controller to configure."}),o&&r.jsxs("p",{className:"mt-0 text-[0.7rem] text-emerald-400",children:["Capturing ",o.label,"…"]})]})}),r.jsxs("div",{className:"space-y-0.5 surface",children:[r.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Connected controller"}),n.pads.length===0?r.jsx("p",{className:"text-[0.7rem] text-slate-400",children:"No controller detected."}):r.jsxs("div",{className:"flex items-center justify-between gap-0.5 text-xs",children:[r.jsx("select",{value:x??"",onChange:w=>v(w.target.value),className:"flex-1 rounded border border-slate-700 bg-slate-900 px-1 py-[2px] text-[0.75rem] text-slate-100",children:n.pads.map(w=>r.jsx("option",{value:w.signature,children:w.id||"Unknown controller"},w.signature))}),r.jsx("span",{className:"text-[0.7rem] text-slate-400",children:p?.mapping??"unknown"})]})]}),r.jsxs("div",{className:"space-y-0.5 surface",children:[r.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Calibration"}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(mi,{label:"Drive deadzone",description:"Ignore small drive stick drift",min:0,max:.6,step:.01,value:g.calibration?.driveDeadzone??.18,onChange:w=>y({driveDeadzone:w})}),r.jsx(mi,{label:"Camera deadzone",description:"Ignore small camera tilt drift",min:0,max:.4,step:.01,value:g.calibration?.cameraDeadzone??.08,onChange:w=>y({cameraDeadzone:w})}),r.jsx(mi,{label:"Aux deadzone",description:"Ignore small trigger noise",min:0,max:.4,step:.01,value:g.calibration?.auxDeadzone??.05,onChange:w=>y({auxDeadzone:w})}),r.jsx(mi,{label:"Side brush scale",description:"Scale side brush output",min:.3,max:1,step:.05,value:g.calibration?.auxSideScale??.55,onChange:w=>y({auxSideScale:w})}),r.jsxs("label",{className:"surface-muted block p-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-300",children:[r.jsx("span",{className:"font-semibold text-slate-100",children:"Camera mode"}),r.jsxs("select",{value:g.calibration?.cameraMode??"absolute",onChange:w=>y({cameraMode:w.target.value}),className:"rounded border border-slate-700 bg-slate-900 px-1 py-[2px] text-[0.75rem] text-slate-100",children:[r.jsx("option",{value:"absolute",children:"Absolute"}),r.jsx("option",{value:"velocity",children:"Velocity"})]})]}),r.jsx("p",{className:"text-[0.65rem] text-slate-500",children:"Absolute maps stick to angle; velocity moves over time."})]}),r.jsx(mi,{label:"Camera sensitivity",description:"Velocity mode degrees per second",min:10,max:180,step:5,value:g.calibration?.cameraSensitivity??60,onChange:w=>y({cameraSensitivity:w})})]})]}),r.jsx("div",{className:"space-y-0.5",children:Object.entries(h).map(([w,j])=>r.jsxs("div",{className:"space-y-0.5 surface",children:[r.jsx("p",{className:"text-[0.7rem] text-slate-500",children:w}),r.jsx("div",{className:"space-y-0.5",children:j.map(N=>{const M=g.bindings?.[N.id]?.sources?.[0]??null;return r.jsxs("div",{className:"surface-muted flex items-center justify-between text-xs",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-slate-100",children:N.label}),r.jsx("p",{className:"text-[0.65rem] text-slate-400",children:RN(M)})]}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[N.kind==="axisPair"&&r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button",disabled:!M,onClick:()=>C(N,"invertX"),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert X"}),r.jsx("button",{type:"button",disabled:!M,onClick:()=>C(N,"invertY"),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert Y"})]}),N.kind==="axis"&&r.jsx("button",{type:"button",disabled:!M,onClick:()=>C(N),className:"button-dark text-[0.7rem] font-medium disabled:opacity-50",children:"Invert"}),r.jsx("button",{type:"button",onClick:()=>E(N),className:"button-dark text-[0.7rem]",children:"Clear"}),r.jsx("button",{type:"button",onClick:()=>f(N),className:`${o?.id===N.id?"px-0.5 py-0.5 bg-emerald-500 text-emerald-950 hover:bg-emerald-400":"button-dark"} text-[0.7rem] font-medium`,children:o?.id===N.id?"Waiting…":"Capture"})]})]},N.id)})})]},w))}),r.jsxs("div",{className:"space-y-0.5 surface",children:[r.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"Diagnostics"}),p?r.jsxs("div",{className:"space-y-0.5 text-[0.7rem] text-slate-300",children:[r.jsx("p",{className:"text-slate-400",children:"Raw axes"}),r.jsx("div",{className:"grid grid-cols-2 gap-0.5",children:p.axes.map((w,j)=>r.jsxs("span",{className:"font-mono text-slate-300",children:["A",j,": ",la.format(w)]},`axis-${j}`))}),r.jsx("p",{className:"text-slate-400",children:"Raw buttons"}),r.jsx("div",{className:"grid grid-cols-2 gap-0.5",children:p.buttons.map((w,j)=>r.jsxs("span",{className:"font-mono text-slate-300",children:["B",j,": ",la.format(w.value)," ",w.pressed?"●":""]},`btn-${j}`))}),k?.outputs&&r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-slate-400",children:"Mapped outputs"}),r.jsxs("div",{className:"grid grid-cols-2 gap-0.5",children:[r.jsxs("span",{className:"font-mono text-slate-300",children:["Drive: ",la.format(k.outputs.driveVector.x),","," ",la.format(k.outputs.driveVector.y)]}),r.jsxs("span",{className:"font-mono text-slate-300",children:["Camera: ",la.format(k.outputs.cameraAxis)]}),r.jsxs("span",{className:"font-mono text-slate-300",children:["Main: ",la.format(k.outputs.auxAxis.main)]}),r.jsxs("span",{className:"font-mono text-slate-300",children:["Side: ",la.format(k.outputs.auxAxis.side)]})]})]})]}):r.jsx("p",{className:"text-[0.7rem] text-slate-400",children:"No controller detected."})]})]})}const zN={drive:"Drive wheels",aux:"Aux motors"};function mx(n){return Number.isFinite(n)?`${Math.round(n*100)}%`:"--"}function UN({value:n,color:s="bg-emerald-500"}){const i=`${Math.round(Math.max(0,Math.min(1,n))*100)}%`;return r.jsx("div",{className:"h-2 w-full overflow-hidden rounded bg-slate-800",children:r.jsx("div",{className:`h-full ${s}`,style:{width:i}})})}function HN(){const{state:{roverId:n},overcurrentLimiter:s}=_t(),i=m.useMemo(()=>os.map(o=>o.key),[]);return r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[r.jsx("span",{children:"Overcurrent limiter"}),r.jsx("span",{children:s?.adminImmune?"Admin immune":"Active"})]}),n?r.jsxs("div",{className:"space-y-0.5",children:[i.map(o=>{const f=s?.caps?.[o]?.cap??0,d=s?.overcurrent?.groups?.[o]??!1,h=s?.scales?.perGroup?.[o]??1;return r.jsxs("div",{className:"surface space-y-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs",children:[r.jsx("span",{className:"text-slate-200",children:zN[o]||o}),r.jsx("span",{className:d?"text-red-300":"text-slate-400",children:d?"overcurrent":"ok"})]}),r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-[0.7rem] text-slate-400",children:[r.jsx("span",{children:"Cap"}),r.jsx("span",{children:mx(f)})]}),r.jsx(UN,{value:f,color:"bg-amber-500"}),r.jsxs("div",{className:"flex items-center justify-between text-[0.7rem] text-slate-400",children:[r.jsx("span",{children:"Scale"}),r.jsx("span",{children:mx(h)})]})]})]},o)}),r.jsxs("div",{className:"surface text-[0.7rem] text-slate-400",children:[r.jsx("div",{children:`Down rate ${s?.config?.downRatePerSec}/s · Up rate ${s?.config?.upRatePerSec}/s`}),r.jsx("div",{children:`Release delay ${s?.config?.releaseDelaySec}s`}),r.jsx("div",{children:`Output rate ${s?.config?.outputRateMs}ms`})]})]}):r.jsx("p",{className:"text-xs text-slate-500",children:"Assign a rover to view limiter status."})]})}const $g=m.createContext(null);function Gg(){const n=m.useContext($g);if(!n)throw new Error("Tabs components must be used within a provider.");return n}const hx={primary:{base:"flex-1 px-0.5 py-0.5 text-sm font-medium focus-visible:outline focus-visible:outline-1 focus-visible:outline-offset-1 focus-visible:outline-slate-500 rounded-md border border-slate-800",active:"bg-sky-600 text-white border-white",inactive:"bg-zinc-900 text-slate-300 hover:bg-sky-500 hover:text-white"}},px={none:"",pink:"bg-pink-500 text-white border-pink-200 hover:bg-pink-400",green:"bg-emerald-500 text-white border-emerald-200 hover:bg-emerald-400"},Yg="primary";function bd(...n){return n.filter(Boolean).join(" ")}function yd({children:n,defaultTab:s,currentTab:i,onTabChange:o,variant:f=Yg}){const[d,h]=m.useState(s??null),[p,x]=m.useState([]),g=m.useCallback(E=>E?(x(C=>C.includes(E)?C:[...C,E]),()=>x(C=>C.includes(E)?C.filter(k=>k!==E):C)):()=>{},[]),v=i??d??p[0]??null;m.useEffect(()=>{s&&i===void 0&&h(s)},[s,i]);const y=m.useCallback(E=>{E&&(i===void 0&&h(E),o&&o(E))},[i,o]),S=m.useMemo(()=>({activeTab:v,setActiveTab:y,registerTab:g,variant:f}),[v,y,g,f]);return r.jsx($g.Provider,{value:S,children:n})}function Sd({children:n,className:s=""}){return r.jsx("div",{className:bd("flex gap-0.5",s),children:n})}function Wt({id:n,children:s,className:i="",disabled:o=!1,highlight:f="none"}){const{activeTab:d,setActiveTab:h,registerTab:p,variant:x}=Gg();m.useEffect(()=>p(n),[n,p]);const g=hx[x]??hx[Yg],v=d===n,y=px[f]||px.none,S=bd(g.base,y||(v?g.active:g.inactive),o?"cursor-not-allowed opacity-50":"",i);return r.jsx("button",{type:"button",className:S,onClick:()=>!o&&h(n),"aria-pressed":v,"aria-disabled":o,children:s})}function jd({children:n,className:s=""}){return r.jsx("div",{className:bd("mt-0 space-y-0.5",s),children:n})}function en({id:n,children:s,keepMounted:i=!1}){const{activeTab:o}=Gg(),f=o===n;return!f&&!i?null:!f&&i?r.jsx("div",{hidden:!0,"aria-hidden":"true",children:s}):r.jsx(r.Fragment,{children:s})}function VN(){const{session:n}=nn(),s=m.useMemo(()=>JSON.stringify(n??{},null,2),[n]);return r.jsxs("div",{className:"panel-section flex min-h-0 flex-col gap-0.5 text-xs",children:[r.jsx("p",{className:"text-sm text-slate-400",children:"Session snapshot"}),r.jsx("pre",{className:"surface min-h-0 flex-1 overflow-y-auto font-mono text-[0.7rem] text-lime-300",children:s})]})}const xx=300,gx=240;function $N(n,s){if(n===void 0)return"undefined";if(n===null)return"null";if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);if(typeof n=="function")return"[Function]";if(n instanceof Error)return`${n.name}: ${n.message}`;if(n instanceof Date)return n.toISOString();if(s||(s=new WeakSet),typeof n=="object"){if(s.has(n))return"[Circular]";s.add(n)}try{return JSON.stringify(n,(i,o)=>typeof o=="function"?"[Function]":o instanceof Error?`${o.name}: ${o.message}`:o,0)}catch{return String(n)}}function GN(n){const i=n.map(o=>$N(o)).join(" ");return i.length>gx?`${i.slice(0,gx)}…`:i}function YN(){const n=tn(),[s,i]=m.useState([]),o=m.useMemo(()=>s.reduce((f,d)=>(d.direction==="in"&&(f.in+=1),d.direction==="out"&&(f.out+=1),f),{in:0,out:0}),[s]);return m.useEffect(()=>{const f=(x,g,v)=>{i(y=>{const S=[...y,{id:`${Date.now()}-${Math.random().toString(16).slice(2)}`,direction:x,event:g,payload:GN(v),timestamp:new Date().toLocaleTimeString()}];return S.length>xx?S.slice(-xx):S})},d=(x,...g)=>f("in",x,g),h=(x,...g)=>f("out",x,g);n.onAny(d);let p=null;if(typeof n.onAnyOutgoing=="function")n.onAnyOutgoing(h),p=()=>n.offAnyOutgoing(h);else{const x=n.emit.bind(n);n.emit=(g,...v)=>(h(g,...v),x(g,...v)),p=()=>{n.emit=x}}return()=>{n.offAny(d),p&&p()}},[n]),r.jsxs("section",{className:"panel-section space-y-0.5 text-base",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-400",children:[r.jsx("span",{children:"Socket activity"}),r.jsxs("div",{className:"flex items-center gap-0.5 text-xs text-slate-400",children:[r.jsxs("span",{className:"surface-muted",children:["in ",o.in]}),r.jsxs("span",{className:"surface-muted",children:["out ",o.out]}),r.jsx("button",{type:"button",className:"button-dark text-xs",onClick:()=>i([]),children:"Clear"})]})]}),r.jsx("div",{className:"surface h-64 overflow-y-auto font-mono text-xs",children:s.length===0?r.jsx("p",{children:"No socket activity yet."}):s.slice().reverse().map(f=>r.jsxs("div",{className:"surface",children:[r.jsx("span",{className:"text-slate-400",children:f.timestamp})," ",r.jsxs("span",{className:f.direction==="in"?"text-emerald-400":"text-amber-400",children:["[",f.direction.toUpperCase(),"]"]})," ",r.jsx("span",{className:"text-cyan-300",children:f.event})," ",r.jsx("span",{className:"text-slate-200",children:f.payload})]},f.id))}),r.jsx("p",{className:"text-xs text-slate-500",children:"Logs are collected only while this panel is open."})]})}const FN=[{key:"start",label:"Start OI"},{key:"safe",label:"Safe"},{key:"full",label:"Full"},{key:"passive",label:"Passive"},{key:"dock",label:"Dock"}];function Fg(){const{state:{roverId:n},actions:{sendOiCommand:s,setSensorStream:i}}=_t(),o=!!n,[f,d]=zg(),h=tn(),{value:p,save:x}=He("page",{hudMapDesktop:!1,connectionTransport:"websocket",swapMobileControlColumns:!1,driveMacroBackoffEnabled:!0}),{value:g,save:v}=He("audio",ct),y=p?.connectionTransport||"websocket",S=!!p?.swapMobileControlColumns,E=typeof p?.driveMacroBackoffEnabled=="boolean"?p.driveMacroBackoffEnabled:!0,C=Number.isFinite(g?.masterVolume)?g.masterVolume:ct.masterVolume,k=Number.isFinite(g?.alertVolume)?g.alertVolume:ct.alertVolume,w=Number.isFinite(g?.roverVolume)?g.roverVolume:ct.roverVolume,j=typeof g?.mainBrushDuckEnabled=="boolean"?g.mainBrushDuckEnabled:typeof g?.autoLevelEnabled=="boolean"?g.autoLevelEnabled:ct.mainBrushDuckEnabled,N=Number.isFinite(g?.mainBrushDuckAmount)?Math.max(0,Math.min(1,g.mainBrushDuckAmount)):ct.mainBrushDuckAmount,q=m.useMemo(()=>[{key:"start",label:"Enable stream",enable:!0},{key:"stop",label:"Disable stream",enable:!1}],[]),M=V=>{n&&i(V)},O=V=>{const U=V.target.value;x(W=>({...W??{},connectionTransport:U})),h?.io?.opts&&(h.io.opts.transports=U==="polling"?["polling"]:["websocket","polling"],h.disconnect(),h.connect())},K=V=>U=>{const W=Number(U.target.value),ce=Number.isFinite(W)?Math.max(0,Math.min(1,W)):0;v(oe=>({...oe??{},[V]:ce}))},_=V=>{const U=!!V.target.checked;v(W=>({...W??{},mainBrushDuckEnabled:U}))},H=V=>{const U=!!V.target.checked;x(W=>({...W??{},swapMobileControlColumns:U}))},z=V=>{const U=!!V.target.checked;x(W=>({...W??{},driveMacroBackoffEnabled:U}))};return r.jsxs(yd,{defaultTab:"keybindings",children:[r.jsxs(Sd,{children:[r.jsx(Wt,{id:"keybindings",children:"Keybindings"}),r.jsx(Wt,{id:"controller",children:"Controller"}),r.jsx(Wt,{id:"page",children:"Page settings"}),r.jsx(Wt,{id:"admin",children:"Admin"})]}),r.jsxs(jd,{children:[r.jsx(en,{id:"keybindings",children:r.jsx("div",{className:"space-y-0.5",children:r.jsx(EN,{})})}),r.jsx(en,{id:"controller",children:r.jsx("div",{className:"space-y-0.5",children:r.jsx(LN,{})})}),r.jsx(en,{id:"page",children:r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsx("p",{className:"text-slate-400",children:"HUD"}),r.jsxs("label",{className:"flex items-center gap-0.5 text-slate-200",children:[r.jsx("input",{type:"checkbox",className:"accent-emerald-500",checked:f,onChange:V=>d(V.target.checked)}),r.jsx("span",{children:"Show top-down map in HUD (desktop)"})]}),r.jsx("p",{className:"text-xs text-slate-500",children:"Mobile HUD keeps the map on by default."})]}),r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsx("p",{className:"text-slate-400",children:"Mobile controls"}),r.jsxs("label",{className:"flex items-center gap-0.5 text-slate-200",children:[r.jsx("input",{type:"checkbox",className:"accent-emerald-500",checked:S,onChange:H}),r.jsx("span",{children:"Swap control columns (put joystick on the left)"})]})]}),r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsx("p",{className:"text-slate-400",children:"Macros"}),r.jsxs("label",{className:"flex items-center gap-0.5 text-slate-200",children:[r.jsx("input",{type:"checkbox",className:"accent-emerald-500",checked:E,onChange:z}),r.jsx("span",{children:"Enable backward bump in drive macro"})]})]}),r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsx("p",{className:"text-slate-400",children:"Audio"}),r.jsxs("label",{className:"grid gap-0.5 text-slate-200",children:[r.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[r.jsx("span",{children:"Master volume"}),r.jsxs("span",{className:"text-xs text-slate-400",children:[Math.round(C*100),"%"]})]}),r.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:C,onChange:K("masterVolume"),className:"w-full accent-emerald-500"})]}),r.jsxs("label",{className:"grid gap-0.5 text-slate-200",children:[r.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[r.jsx("span",{children:"Alert/page sounds"}),r.jsxs("span",{className:"text-xs text-slate-400",children:[Math.round(k*100),"%"]})]}),r.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:k,onChange:K("alertVolume"),className:"w-full accent-emerald-500"})]}),r.jsxs("label",{className:"grid gap-0.5 text-slate-200",children:[r.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[r.jsx("span",{children:"Rover audio"}),r.jsxs("span",{className:"text-xs text-slate-400",children:[Math.round(w*100),"%"]})]}),r.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:w,onChange:K("roverVolume"),className:"w-full accent-emerald-500"})]}),r.jsxs("label",{className:"flex items-center justify-between gap-0.5 text-slate-200",children:[r.jsx("span",{children:"Main brush ducking"}),r.jsx("input",{type:"checkbox",className:"accent-emerald-500",checked:j,onChange:_})]}),r.jsxs("label",{className:"grid gap-0.5 text-slate-200",children:[r.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[r.jsx("span",{children:"Main brush duck amount"}),r.jsxs("span",{className:"text-xs text-slate-400",children:[Math.round(N*100),"%"]})]}),r.jsx("input",{type:"range",min:"0",max:"1",step:"0.01",value:N,onChange:K("mainBrushDuckAmount"),className:"w-full accent-emerald-500",disabled:!j})]}),r.jsx("p",{className:"text-xs text-slate-500",children:"Lowers rover audio only while the main brush is running."})]}),r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsx("p",{className:"text-slate-400",children:"Connection"}),r.jsxs("label",{className:"flex items-center justify-between gap-0.5 text-slate-200",children:[r.jsx("span",{children:"Transport"}),r.jsxs("select",{value:y,onChange:O,className:"field-input text-sm",children:[r.jsx("option",{value:"websocket",children:"WebSocket"}),r.jsx("option",{value:"polling",children:"Polling"})]})]}),r.jsx("p",{className:"text-xs text-slate-500",children:"Switching reconnects your session."})]})]})}),r.jsx(en,{id:"admin",children:r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsx("p",{className:"text-slate-400",children:"Manual OI commands"}),r.jsx("div",{className:"surface flex flex-wrap gap-0.5",children:FN.map(V=>r.jsx("button",{type:"button",onClick:()=>s(V.key),disabled:!o,className:"button-dark text-xs disabled:opacity-30",children:V.label},V.key))})]}),r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsx("p",{className:"text-slate-400",children:"Sensor stream"}),r.jsx("div",{className:"surface flex gap-0.5",children:q.map(V=>r.jsx("button",{type:"button",onClick:()=>M(V.enable),disabled:!o,className:"flex-1 button-dark text-xs disabled:opacity-30",children:V.label},V.key))}),!o&&r.jsx("p",{className:"text-xs text-slate-500",children:"Assign a rover to toggle streams."})]}),r.jsx(Vg,{}),r.jsx(HN,{}),r.jsx(hN,{}),r.jsx(VN,{}),r.jsx(YN,{})]})})]})]})}const vx={desktop:{main:[{type:"list",title:"Chat and nicknames",items:["Set a nickname in the user list panel, on the bottom left of the page below the rover video.",{segments:["Toggle chat focus with ",{action:"chatFocus"},". Press ",{action:"chatFocus"}," again to send."]}]},{type:"list",title:"Driving the rover",items:[{segments:['Press the "Start Driving" button onscreen, or press ',{action:"driveMacro"}," on your keyboard to put the rover into driving mode."]},"Refer to the controls for the controls for the rover."]},{type:"list",title:"Docking the rover",items:["Line up the rover to the dock, about a foot away, then:",{segments:['Press the "Dock and Charge" button onscreen, or press ',{action:"dockMacro"}," on your keyboard to start docking."]},"Wait for the rover to confirm it is docked and charging before leaving it unattended."]}],aside:[{type:"keyboard",title:"Keyboard controls",footnote:"Per-browser; adjust bindings and speeds in Settings → Keybindings.",groups:[{id:"movement",title:"Movement",items:[{action:"driveForward",label:"Forward"},{action:"driveBackward",label:"Backward"},{action:"driveLeft",label:"Turn left"},{action:"driveRight",label:"Turn right"},{action:"boostModifier",label:"Boost speed"},{action:"slowModifier",label:"Precision speed"}]},{id:"macros",title:"Rover modes & chat",items:[{action:"driveMacro",label:"Drive macro"},{action:"dockMacro",label:"Dock macro"},{action:"chatFocus",label:"Chat focus"}]},{id:"camera",title:"Camera",items:[{action:"cameraUp",label:"Tilt up"},{action:"cameraDown",label:"Tilt down"},{action:"nightVisionToggle",label:"Toggle night vision"}]},{id:"motors",title:"Rover Aux Motors",items:[{action:"auxMainForward",label:"Main brush forward"},{action:"auxMainReverse",label:"Main brush reverse"},{action:"auxSideForward",label:"Side brush forward"},{action:"auxSideReverse",label:"Side brush reverse"},{action:"auxVacuumFast",label:"Vacuum max"},{action:"auxVacuumSlow",label:"Vacuum low"},{action:"auxAllForward",label:"All motors forward"}]},{id:"audio",title:"Audio / Song",items:[{action:"songNoteUp",label:"Song note up"},{action:"songNoteDown",label:"Song note down"}]},{id:"room-controls",title:"Room Controls",items:[{action:"homeAssistantOn",label:"Next room control on"},{action:"homeAssistantOff",label:"Next room control off (reverse)"}]}]},{type:"gamepad",title:"Gamepad / joystick",items:["Gamepad controls are fully configurable to handle inconsistent browser mappings.","Use Settings → Controller to bind inputs, calibrate deadzones, and view diagnostics.","If inputs behave oddly, the diagnostics panel will show raw axis/button values."]}]},"mobile-portrait":{main:[{type:"list",title:"Chat and nicknames",items:["Set a nickname in the user list panel below.","Tap in the chat box to send messages in the chat."]},{type:"list",title:"Driving the rover",items:[{segments:['Press the "Start Driving" button onscreen to put the rover into driving mode.']},"Look below the rover video. Use the joystick column to move the rover, and hold the aux buttons in the other control column."]},{type:"list",title:"Docking the rover",items:["Line up the rover to the dock, about a foot away, then:",{segments:['Press the "Dock and Charge" button onscreen to start docking.']},"Wait for the rover to confirm it is docked and charging before leaving it unattended."]}]},"mobile-landscape":{main:[{type:"list",title:"Chat and nicknames",items:["Scroll down to see more of the page.","Set a nickname in the user list panel below.","Tap in the chat box to send messages in the chat."]},{type:"list",title:"Driving the rover",items:[{segments:['Press the "Start Driving" button, or the "Drive" button to put the rover into driving mode.']},"Use the joystick column beside the video feed to move the rover, and hold the aux buttons in the other control column."]},{type:"list",title:"Docking the rover",items:["Line up the rover to the dock, about a foot away, then:",{segments:['Press the "Dock and Charge" or the "Dock" button onscreen to start docking.']},"Wait for the rover to confirm it is docked and charging before leaving it unattended."]}]}};function XN(n){return vx[n]||vx.desktop}function Xg({actionId:n,keymap:s}){const i=s?.[n]?.[0]??"";return r.jsx("span",{className:"rounded border border-slate-600 bg-slate-900/40 px-1 text-[0.7rem] text-slate-200",children:An(i)})}function bx(n,s){return n.map((i,o)=>typeof i=="string"?r.jsx("span",{children:i},`text-${o}`):i?.action?r.jsx(Xg,{actionId:i.action,keymap:s},`pill-${i.action}-${o}`):i?.text?r.jsx("span",{children:i.text},`span-${o}`):null)}function Ro(n,s,i){if(typeof n=="string")return n;if(Array.isArray(n?.segments))return bx(n.segments,s);if(n&&typeof n=="object"){if(typeof n.text=="string")return n.text;if(Array.isArray(n))return bx(n,s)}return String(n??"")}function QN({hero:n,keymap:s}){return n?r.jsxs("div",{className:"surface space-y-0.5 px-0.5 py-0.5",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-0.5",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-semibold text-white",children:n.title}),n.subtitle&&r.jsx("p",{className:"text-xs text-slate-300",children:n.subtitle})]}),n.chips&&r.jsx("div",{className:"flex flex-wrap gap-0.5 text-[0.7rem] text-slate-200",children:n.chips.map(i=>r.jsx("span",{className:"rounded border border-slate-700 px-1 py-[2px]",children:i},i))})]}),n.bullets&&r.jsx("ul",{className:"space-y-0.5 text-[0.85rem] text-slate-200",children:n.bullets.map((i,o)=>{const f=Array.isArray(i?.segments)?`hero-${o}`:`hero-${o}`;return r.jsx("li",{className:"surface-muted px-0.5 py-0.25",children:Ro(i,s)},f)})})]}):null}function KN({block:n,keymap:s}){return r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-xs font-semibold text-slate-200",children:n.title}),r.jsx("ul",{className:"space-y-0.5 text-[0.8rem] text-slate-300",children:n.items.map((i,o)=>{const f=`item-${o}`;return r.jsx("li",{className:"surface-muted flex flex-wrap items-center gap-0.5 px-0.5 py-0.25",children:Ro(i,s)},f)})})]})}function ZN({block:n}){const s=n.tone==="info"?"border-cyan-500/40":"border-slate-700";return r.jsxs("div",{className:`surface space-y-0.5 border ${s} px-0.5 py-0.5`,children:[r.jsx("p",{className:"text-xs font-semibold text-slate-100",children:n.title}),n.body&&r.jsx("ul",{className:"space-y-0.5 text-[0.8rem] text-slate-300",children:n.body.map((i,o)=>r.jsx("li",{className:"surface-muted px-0.5 py-0.25",children:Ro(i,{})},`callout-${o}`))})]})}function IN({group:n,keymap:s}){return r.jsxs("div",{className:"space-y-0.5 surface",children:[r.jsx("p",{className:"px-0.5 py-0.25 text-[0.75rem] font-semibold text-slate-200",children:n.title}),r.jsx("div",{className:"space-y-0.5 px-0.5 pb-0.25",children:n.items.map(i=>r.jsxs("div",{className:"surface-muted flex items-center justify-between gap-0.5 px-0.5 py-0.25 text-[0.8rem]",children:[r.jsx("span",{className:"text-slate-200",children:i.label}),r.jsx(Xg,{actionId:i.action,keymap:s})]},i.action))})]})}function JN({block:n,keymap:s}){return n?r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-200",children:[r.jsx("span",{className:"font-semibold",children:n.title}),n.footnote&&r.jsx("span",{className:"text-[0.7rem] text-slate-400",children:n.footnote})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-0.5",children:n.groups?.map(i=>r.jsx(IN,{group:i,keymap:s},i.id))})]}):null}function PN({block:n}){return n?r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-xs font-semibold text-slate-200",children:n.title}),r.jsx("ul",{className:"space-y-0.5 text-[0.8rem] text-slate-300",children:n.items?.map((s,i)=>r.jsx("li",{className:"surface-muted px-0.5 py-0.25",children:Ro(s,{})},`gamepad-${i}`))})]}):null}function yx({block:n,keymap:s}){if(!n)return null;switch(n.type){case"list":return r.jsx(KN,{block:n,keymap:s});case"callout":return r.jsx(ZN,{block:n});case"keyboard":return r.jsx(JN,{block:n,keymap:s});case"gamepad":return r.jsx(PN,{block:n});default:return null}}function Qg({layout:n,keymap:s}){const i=m.useMemo(()=>XN(n),[n]),o=s||{},f=i.main||[],d=i.aside||[];return r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(QN,{hero:i.hero,keymap:o}),r.jsxs("div",{className:"grid gap-0.5",style:{gridTemplateColumns:"repeat(auto-fit, minmax(360px, 1fr))"},children:[r.jsx("div",{className:"space-y-0.5",children:f.map((h,p)=>r.jsx(yx,{block:h,keymap:o},h.title||p))}),r.jsx("div",{className:"space-y-0.5",children:d.map((h,p)=>r.jsx(yx,{block:h,keymap:o},h.title||p))})]})]})}function Kg({layout:n,onOpenOverlay:s}){const{state:i}=_t();return r.jsxs("section",{className:"panel-section space-y-0.5 text-sm",children:[r.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-400",children:[r.jsx("span",{children:"Help"}),r.jsx("button",{type:"button",onClick:s,className:"button-dark px-1 py-0.25 text-[0.75rem]",children:"Open full help"})]}),r.jsx(Qg,{layout:n,keymap:i?.keymap||{}})]})}const WN=["kal","rms","slt","ksp","bdl"],ew=Array.from({length:10},(n,s)=>s*10);function qo({hideInput:n=!1,hideSpectatorNotice:s=!1,fillHeight:i=!1,allowSpectatorInput:o=!1}){const f=ft(R=>R.session),{messages:d,typing:h,sendMessage:p,registerInputRef:x,onInputFocus:g,onInputBlur:v,blurChat:y,setTypingActive:S}=od(),{value:E,save:C}=He("tts",{engine:"flite",voice:"rms",pitch:50}),[k,w]=m.useState(""),[j,N]=m.useState(!1),[q,M]=m.useState(!1),[O,K]=m.useState(()=>E?.engine||"flite"),[_,H]=m.useState(()=>E?.voice||"rms"),[z,V]=m.useState(()=>Number.isFinite(E?.pitch)?E.pitch:50),U=f?.role!=="spectator"||o,W=m.useRef(null),ce=f?.assignment?.roverId||null,$=!!m.useMemo(()=>f?.roster?.find(R=>String(R.id)===String(ce))||null,[ce,f?.roster])?.audio?.ttsEnabled,T=m.useMemo(()=>d.slice(-200),[d]),Y=m.useMemo(()=>h||[],[h]);m.useEffect(()=>{W.current&&(W.current.scrollTop=W.current.scrollHeight)},[T,Y]),m.useEffect(()=>{const R=E?.engine||"flite",G=E?.voice||"rms",te=Number.isFinite(E?.pitch)?E.pitch:50;O!==R&&K(R),_!==G&&H(G),z!==te&&V(te)},[O,z,E?.engine,E?.pitch,E?.voice,_]),m.useEffect(()=>{M(!!$)},[$]);const I=m.useMemo(()=>!$||!q?null:O==="espeak"?{speak:!0,engine:O,pitch:z}:{speak:!0,engine:O,voice:_},[O,z,q,$,_]);async function ie(R){if(R.preventDefault(),!U||n)return;const te=k.replace(/\\n/g,` -`).trim();if(te){N(!0);try{await p(te,I),w(""),y(),S(!1)}catch(ae){alert(ae.message)}finally{N(!1)}}}const de=i?"flex-1 min-h-0 overflow-y-auto":"h-48 overflow-y-auto";return r.jsxs("section",{className:`panel-section space-y-0.5 text-base ${i?"flex h-full flex-col overflow-hidden":""}`,children:[r.jsxs("div",{className:`surface overflow-y-auto space-y-0.5 px-0 ${de}`,ref:W,children:[T.length===0&&Y.length===0?r.jsx("p",{className:"text-sm text-slate-500",children:"No messages yet."}):T.map(R=>r.jsx(ld,{message:R},R.id)),Y.map(R=>r.jsx(pg,{message:R},`typing-${R.typingId||R.id}`))]}),!n&&r.jsxs("form",{className:"flex flex-wrap items-stretch gap-0.5",onSubmit:ie,children:[r.jsx("input",{className:"field-input flex-1 min-w-[10rem]",value:k,onChange:R=>{const G=R.target.value;w(G),S(!!G.trim())},onFocus:R=>{g(R),S(!!k.trim())},onBlur:R=>{v(R),S(!1)},onKeyDown:R=>{R.key==="Enter"&&!k.trim()&&(R.preventDefault(),y(),S(!1))},ref:R=>x(R,{target:"panel"}),placeholder:U?"Type a message…":s?"":"Spectators cannot chat",disabled:!U}),$&&r.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 basis-full sm:basis-auto",children:[r.jsxs("label",{className:"flex items-center gap-0.5 text-xs text-slate-300",children:[r.jsx("input",{type:"checkbox",checked:q,onChange:R=>M(R.target.checked),className:"accent-cyan-500"}),r.jsx("span",{children:"Speak"})]}),r.jsxs("select",{value:O,onChange:R=>{const G=R.target.value;K(G),C(te=>({...te||{},engine:G}))},className:"field-input text-xs",children:[r.jsx("option",{value:"flite",children:"flite"}),r.jsx("option",{value:"espeak",children:"espeak"})]}),O==="flite"?r.jsx("select",{value:_,onChange:R=>{const G=R.target.value;H(G),C(te=>({...te||{},voice:G}))},className:"field-input text-xs",children:WN.map(R=>r.jsx("option",{value:R,children:R},R))}):r.jsx("select",{value:z,onChange:R=>{const G=Number(R.target.value);V(G),C(te=>({...te||{},pitch:G}))},className:"field-input text-xs",children:ew.map(R=>r.jsxs("option",{value:R,children:["pitch ",R]},R))})]}),r.jsx("button",{type:"submit",disabled:!U||j,className:"button-dark h-full disabled:opacity-50 self-stretch",children:j?"...":"Send"})]})]})}function To({compact:n=!1}){const{session:s,setNickname:i}=nn(),{value:o,save:f}=He("profile",{nickname:""}),[d,h]=m.useState(o.nickname||""),[p,x]=m.useState(!1),g=s?.role!=="spectator";m.useEffect(()=>{h(o.nickname||"")},[o.nickname]);async function v(y){if(y.preventDefault(),!g)return;const S=(d||"").trim().slice(0,32);if(S){x(!0);try{await i(S),f({nickname:S})}catch(E){alert(E.message)}finally{x(!1)}}}return r.jsxs("form",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-stretch gap-0.5",onSubmit:v,children:[r.jsx("input",{className:"field-input flex-1 min-w-0",value:d,onChange:y=>h(y.target.value),maxLength:32,placeholder:"Enter a nickname",disabled:!g}),r.jsx("button",{type:"submit",disabled:!g||p,className:"button-dark h-full shrink-0 whitespace-nowrap px-0.5 py-0 disabled:opacity-50",children:p?"Saving…":n?"Set":"Save"})]})}function tw(n){const s=Array.isArray(n?.socials)?n.socials:null;if(s&&s.length)return s;const i=[];return n?.discord?.invite&&i.push({id:"discord",label:"Discord",url:n.discord.invite}),n?.kofi?.link&&i.push({id:"kofi",label:"Ko-fi",url:n.kofi.link}),i}function nw(n){if(!n||typeof n!="object")return null;const s=n.id||n.service||n.key||n.name||null,i=n.label||n.title||n.name||s||"Link",o=n.url||n.link||n.href||null;return o?{id:s,label:i,url:o}:null}function Zg({className:n=""}){const{session:s}=nn(),i=tw(s).map(nw).filter(Boolean).slice(0,4);return i.length?r.jsx("div",{className:`grid grid-cols-2 grid-rows-2 gap-0.5 ${n}`,children:i.map(o=>r.jsx(pd,{...o},`${o.id||o.label}-${o.url}`))}):null}function aw({compact:n=!1}){return r.jsx("section",{className:"panel-section flex h-full min-h-0 flex-col gap-0.5 text-base",children:r.jsx("div",{className:"surface flex w-full items-center px-0 py-0",children:r.jsx(To,{compact:n})})})}function sw(){return r.jsx("section",{className:"panel-section flex h-full min-h-0 flex-col gap-0.5 text-base",children:r.jsx(Zg,{className:"flex-1 min-h-0"})})}function yf(...n){return n.filter(Boolean).join(" ")}function lw(n){const s=n?.batteryState?.percentDisplay;return s==null?"--":`${s}%`}function iw(n){return n?.batteryState?n.batteryState.urgentActive?"text-red-400":n.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function rw(n){switch(n){case"admin":case"lockdown":case"lockdown-admin":return"text-amber-300";case"spectator":return"text-slate-400";default:return"text-sky-300"}}function ow(n,s){if(!n)return"";const i=n.nickname||n.socketId?.slice(0,6)||"unknown";return n.socketId&&n.socketId===s?`${i} (you)`:i}function Do({title:n="Rovers"}){const s=ft(j=>j.session),{requestControl:i}=wn(),[o,f]=m.useState({}),[d,h]=m.useState(()=>Date.now()),p=m.useMemo(()=>s?.role&&s.role!=="spectator",[s?.role]),x=m.useMemo(()=>s?.role==="admin"||s?.role==="lockdown"||s?.role==="lockdown-admin",[s?.role]),g=s?.roster??[],v=s?.turnQueues??{},y=s?.users??[],S=s?.socketId||null,E=m.useMemo(()=>Object.values(v||{}).some(j=>j?.deadline||j?.idleDeadline),[v]);m.useEffect(()=>{if(!E)return;const j=setInterval(()=>{h(Date.now())},1e3);return()=>clearInterval(j)},[E]);const C=m.useMemo(()=>{const j=new Set(g.map(q=>String(q.id))),N=Object.keys(v||{}).filter(q=>!j.has(String(q))).map(q=>({id:q,name:q,locked:!1,batteryState:null}));return[...g,...N]},[g,v]);async function k(j){if(j){f(N=>({...N,[j]:!0}));try{await i(j)}catch(N){alert(N.message)}finally{f(N=>({...N,[j]:!1}))}}}const w=j=>y.find(N=>N.socketId===j)||{socketId:j,nickname:null,role:null};return r.jsxs("div",{className:"space-y-0.5 text-sm",children:[n&&r.jsx("p",{className:"text-sm text-slate-400",children:n}),C.length===0?r.jsx("p",{className:"text-sm text-slate-500",children:"No rovers registered."}):r.jsx("ul",{className:"space-y-0.5 text-sm",children:C.map(j=>{const N=String(j.id),q=v?.[N]||null,M=q?.queue||[],O=q?.idleDeadline||q?.deadline||null,K=O&&O>d?Math.ceil((O-d)/1e3):O?0:null,_=q?.current||null,H=_?M.findIndex(ie=>ie===_):-1,z=M.length>1?H>=0?M[(H+1)%M.length]:M[0]:null,V=!!(S&&_&&_===S),U=!!(S&&z&&z===S),W=K!=null&&(V||U),ce=!!j.locked,oe=ce&&!x,$=!!(j?.private?.enabled&&j?.private?.open),T=j.lockReason?`locked: ${j.lockReason}`:"locked",Y=ce?T:o[N]?"...":"request",I=p&&!oe&&!o[N];return r.jsxs("li",{className:yf("surface flex flex-wrap items-start justify-between gap-0.5",I&&"cursor-pointer",ce?"bg-red-900/40":$?"bg-amber-700/35 border border-amber-200/30":null),onClick:()=>{I&&k(j.id)},children:[r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx("p",{className:"text-slate-200",children:r.jsx("span",{className:"rounded px-1 py-[1px] border border-transparent",style:ca(j.color,.16),children:j.name})}),W?r.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem] text-slate-200",children:V?`${K}s left`:`Your turn in ${K}s`}):null]}),r.jsx("span",{className:yf("text-[0.75rem] font-semibold",iw(j)),children:lw(j)})]}),M.length===0?r.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"No queue."}):r.jsx("div",{className:"flex flex-wrap items-center gap-0.5",children:M.map((ie,de)=>{const R=w(ie),G=ie===_,te=!!(z&&ie===z&&!G),ae=G?"bg-sky-600 text-white ring-2 ring-amber-300":te?"bg-emerald-700/60 text-emerald-100 ring-1 ring-emerald-300/70":"bg-slate-800 text-slate-200";return r.jsxs("span",{className:`flex items-center gap-0.5 rounded px-1 text-[0.7rem] ${ae}`,children:[r.jsx("span",{className:`${rw(R.role)} font-semibold`,children:ow(R,S)}),G&&r.jsx("span",{className:"text-[0.65rem] text-slate-200",children:"now"}),te&&r.jsx("span",{className:"text-[0.65rem] text-emerald-100",children:"next"})]},`${N}-${ie}-${de}`)})})]}),p?r.jsx("button",{type:"button",onClick:ie=>{ie.stopPropagation(),k(j.id)},disabled:o[N]||oe,className:yf("button-dark disabled:opacity-40",ce&&"bg-red-600/70 text-white hover:bg-red-600"),children:Y}):null]},j.id)})})]})}function cw(n){switch(n){case"admin":case"lockdown":case"lockdown-admin":return"text-amber-300";case"spectator":return"text-slate-400";default:return"text-sky-300"}}function uw(n,s){if(!n)return"";const i=n.nickname||n.socketId?.slice(0,6)||"unknown";return n.socketId&&n.socketId===s?`${i} (you)`:i}function So({hideNicknameForm:n=!1,hideHeader:s=!1,className:i="",fillHeight:o=!1,compact:f=!1}){const{session:d}=nn(),h=d?.role!=="spectator",p=d?.users??[],x=d?.socketId||null,g=m.useMemo(()=>[...p].sort((y,S)=>y.socketId===x?-1:S.socketId===x?1:(y.nickname||"").localeCompare(S.nickname||"")),[x,p]),v=o?"flex-1 min-h-0 overflow-y-auto":f?"h-28 overflow-y-auto":"h-48 overflow-y-auto";return r.jsxs("section",{className:`panel-section space-y-0.5 text-base ${o?"flex h-full min-h-0 flex-col overflow-hidden":""} ${i}`,children:[!n&&r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"grid gap-0.5 md:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)]",children:[r.jsx("div",{className:"min-w-0",children:r.jsx("div",{className:"surface flex w-full items-center px-0 py-0",children:r.jsx(To,{compact:f})})}),r.jsx(Zg,{})]}),!h&&r.jsx("p",{className:"text-xs text-slate-500",children:"Spectators cannot set nicknames."})]}),r.jsxs("div",{className:`space-y-0.5 ${o?"flex flex-1 min-h-0 flex-col":""}`,children:[!s&&r.jsxs("div",{className:`flex items-center justify-between text-sm text-slate-400 ${f?"text-xs":""}`,children:[r.jsx("span",{children:"Users"}),r.jsx("span",{className:"text-xs text-slate-500",children:g.length})]}),r.jsx("div",{className:`surface flex flex-wrap content-start items-start gap-0.5 px-0 pb-0 ${v} ${f?"text-[0.8rem]":""}`,children:g.length===0?r.jsx("p",{className:"text-sm text-slate-500",children:"Waiting for users…"}):g.map(y=>r.jsx("span",{className:`rounded bg-slate-800/80 px-1 py-0.25 text-[0.7rem] ${cw(y.role)}`,children:uw(y,x)},y.socketId))})]})]})}const fw=/^cu_[a-f0-9]{32}$/,ki="field-input w-full max-w-sm text-left focus:ring-emerald-500",_o="mx-auto w-full max-w-xl flex justify-center",bi="mx-auto flex w-full max-w-md flex-col items-center space-y-0.5 text-center";function dw(n){const s=String(n||"").trim();return s?s.length<=10?`${s.slice(0,2)}***${s.slice(-2)}`:`${s.slice(0,6)}...${s.slice(-6)}`:""}const Sx=8*1024*1024,is=16e3,mw={iceServers:[{urls:"stun:stun.l.google.com:19302"}],bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"};function jx(n){let s="";for(let o=0;o{if(!n||n.iceGatheringState==="complete"){i();return}const o=setTimeout(()=>{n.removeEventListener("icegatheringstatechange",f),i()},s);function f(){n.iceGatheringState==="complete"&&(clearTimeout(o),n.removeEventListener("icegatheringstatechange",f),i())}n.addEventListener("icegatheringstatechange",f)})}function Ax(n){if(!n)return!1;const s=n.connectionState,i=n.iceConnectionState;return s==="connected"||i==="connected"||i==="completed"}function gw(n,s=1e4){return new Promise((i,o)=>{if(!n){o(new Error("Peer connection missing"));return}if(Ax(n)){i();return}const f=setTimeout(()=>{h(),o(new Error("Peer connection timeout"))},s),d=()=>{Ax(n)?(h(),i()):(n.connectionState==="failed"||n.connectionState==="closed"||n.iceConnectionState==="failed")&&(h(),o(new Error(`Peer connection ${n.connectionState||n.iceConnectionState}`)))};function h(){clearTimeout(f),n.removeEventListener("connectionstatechange",d),n.removeEventListener("iceconnectionstatechange",d)}n.addEventListener("connectionstatechange",d),n.addEventListener("iceconnectionstatechange",d)})}async function vw(n){if(!n?.getParameters||!n?.setParameters)return;const s=n.getParameters()||{},i=s.encodings&&s.encodings[0]||{};s.encodings=[{...i,maxBitrate:64e3,dtx:"disabled"}];try{await n.setParameters(s)}catch{}}function bw(n,s=6e3){return new Promise((i,o)=>{if(!n){o(new Error("Peer connection missing"));return}const f=Date.now();let d=-1;const h=setInterval(async()=>{if(Date.now()-f>s){clearInterval(h),o(new Error("WHIP connected but no outbound audio flow"));return}try{const p=n.getSenders().filter(x=>x.track?.kind==="audio");for(const x of p){const g=await x.getStats();for(const v of g.values()){if(v.type!=="outbound-rtp"||v.kind!=="audio")continue;const y=Number(v.bytesSent||0),S=Number(v.packetsSent||0);if(d<0)d=y;else if(y>d+200||S>5){clearInterval(h),i();return}}}}catch{}},250)})}function xn({label:n,active:s,detail:i=""}){return r.jsxs("div",{className:`rounded-md px-0.5 py-0.5 text-xs text-slate-100 ${s?"bg-emerald-500":"bg-slate-700"}`,children:[r.jsx("div",{className:"text-center font-medium",children:n}),r.jsx("div",{className:"text-center text-[0.72rem] opacity-90",children:i||(s?"active":"idle")})]})}function Nx({label:n}){return n?r.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:n}):null}function yw(n){const s=n.reduce((f,d)=>f+d.length,0),i=new Float32Array(s);let o=0;for(const f of n)i.set(f,o),o+=f.length;return i}function Sw(n){const s=new Int16Array(n.length);for(let i=0;i{for(let v=0;vv&&s?.[v]||null,[s,v]),te=!!(G&&G.state!=="offline"&&!G.error),ae=G?.source==="upload"&&G?.state==="playing",pe=G?.source==="mic-whip"&&(G?.state==="starting"||G?.state==="playing"),re=!!(!j&&z.current&&(k||R)),ue=!j&&(N==="live"||N==="starting"),ve=j&&M==="recording",be=j&&M==="sending",xe=An(p?.keymap?.micPtt?.[0])||"M",Be=m.useCallback(P=>{const fe=P==="clip"?"clip":"live";g(Ne=>({...Ne||{},pttMode:fe}))},[g]),ze=async()=>{if(!v){_("Take control of your rover first.");return}if(!y){_("Select an audio file first.");return}if(y.size>Sx){_(`File too large (max ${Sx} bytes).`);return}C(!0),_("");try{const P=await y.arrayBuffer(),fe=jx(new Uint8Array(P));await i?.({roverId:v,name:y.name,mime:y.type||"",dataBase64:fe}),_("Upload playback started.")}catch(P){_(P?.message||"Failed to play upload.")}finally{C(!1)}},Ae=async()=>{if(!v){_("Take control of your rover first.");return}C(!0),_("");try{await o?.(v),_("Upload playback stopped.")}catch(P){_(P?.message||"Failed to stop upload.")}finally{C(!1)}},tt=m.useCallback(async P=>{const fe=String(P||W.current||"").trim();if(U.current=!1,q("idle"),V.current){try{V.current.getSenders().forEach(Ne=>Ne.track?.stop())}catch{}try{V.current.close()}catch{}}if(V.current=null,H.current)try{H.current.getTracks().forEach(Ne=>Ne.stop())}catch{}if(H.current=null,z.current=null,fe)try{await h?.(fe)}catch{}W.current=""},[h]),Je=m.useCallback(async P=>{const fe=await f?.(P),Ne=String(fe?.whipUrl||"").trim(),pt=String(fe?.token||"").trim();if(!Ne||!pt)throw new Error("WHIP endpoint unavailable");const Ve=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:is,echoCancellation:!1,noiseSuppression:!1,autoGainControl:!1}});H.current=Ve;const st=Ve.getAudioTracks()?.[0];if(z.current=st||null,st&&(st.enabled=!!(k||R)),st?.applyConstraints)try{await st.applyConstraints({channelCount:1,sampleRate:is,echoCancellation:!1,noiseSuppression:!1,autoGainControl:!1})}catch{}const lt=new RTCPeerConnection(mw);V.current=lt,lt.onconnectionstatechange=()=>{if(!U.current)return;const Yt=lt.connectionState;if(Yt==="connected"){q("live");return}(Yt==="failed"||Yt==="disconnected"||Yt==="closed")&&(q("error"),_(`WHIP transport ${Yt}.`))},Ve.getAudioTracks().forEach(Yt=>{const La=lt.addTrack(Yt,Ve);vw(La)});const Ot=await lt.createOffer({offerToReceiveAudio:!1,offerToReceiveVideo:!1});await lt.setLocalDescription(Ot),await xw(lt,1800);const it=await fetch(Ne,{method:"POST",headers:{"Content-Type":"application/sdp",...pw(pt)},body:lt.localDescription?.sdp||Ot.sdp});if(!it.ok)throw new Error(`WHIP request failed: ${it.status}`);const ms=await it.text();await lt.setRemoteDescription({type:"answer",sdp:ms}),await gw(lt,1e4),await bw(lt,6e3),await d?.(P)},[k,R,d,f]),vt=m.useCallback(async()=>{if(ie.current=!1,T.current){try{T.current.disconnect()}catch{}T.current.onaudioprocess=null}if($.current)try{$.current.disconnect()}catch{}if(Y.current)try{Y.current.disconnect()}catch{}if(ce.current)try{ce.current.getTracks().forEach(P=>P.stop())}catch{}if(oe.current)try{await oe.current.close()}catch{}I.current=[],T.current=null,$.current=null,Y.current=null,ce.current=null,oe.current=null,de.current=is},[]),le=m.useCallback(async()=>{if(ce.current&&oe.current&&T.current)return;O(st=>st==="recording"?st:"arming");const P=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:is,echoCancellation:!1,noiseSuppression:!1,autoGainControl:!1}}),fe=new AudioContext({latencyHint:"interactive"}),Ne=fe.createMediaStreamSource(P),pt=fe.createScriptProcessor(1024,1,1),Ve=fe.createGain();Ve.gain.value=0,pt.onaudioprocess=st=>{if(!ie.current)return;const lt=st.inputBuffer.getChannelData(0);I.current.push(new Float32Array(lt))},Ne.connect(pt),pt.connect(Ve),Ve.connect(fe.destination),ce.current=P,oe.current=fe,$.current=Ne,T.current=pt,Y.current=Ve,de.current=fe.sampleRate||is},[]),me=m.useCallback(async({send:P})=>{const fe=ie.current;if(ie.current=!1,!fe){P||O("idle");return}const Ne=I.current;if(I.current=[],!P){O("idle");return}if(!v){O("idle");return}if(!Ne.length){O("idle");return}O("sending");try{const pt=yw(Ne),Ve=jw(pt,de.current||is),st=jx(Ve);await i?.({roverId:v,name:`ptt-${Date.now()}.wav`,mime:"audio/wav",dataBase64:st}),O("idle")}catch(pt){O("error"),_(pt?.message||"Failed to send PTT clip.")}},[i,v]),se=m.useCallback(async()=>{if(!v){_("Take control of your rover first.");return}await le(),I.current=[],ie.current=!0,O("recording")},[le,v]);return m.useEffect(()=>{let P=!1;async function fe(){if(j){await tt(W.current||v);return}if(!v){await tt(W.current);return}if(!(U.current&&W.current===v)&&!(!k&&!R))try{q("starting"),_(""),U.current=!0,W.current=v,await Je(v),P||q("live")}catch(Ne){P||(q("error"),_(Ne?.message||"Failed to start mic forwarding.")),await tt(v)}}return fe(),()=>{P=!0}},[j,k,R,v,Je,tt]),m.useEffect(()=>{const P=z.current;P&&(P.enabled=!!(!j&&(k||R)))},[j,k,R]),m.useEffect(()=>{let P=!1;async function fe(){if(!j||!v){ie.current&&await me({send:!1}),O("idle");return}try{await le(),!P&&!ie.current&&O("idle")}catch(Ne){P||(O("error"),_(Ne?.message||"Microphone access failed for clip mode."))}}return fe(),()=>{P=!0}},[j,le,me,v]),m.useEffect(()=>{let P=!1;async function fe(){if(j){if(!v){ie.current&&await me({send:!1});return}if(R){if(!ie.current)try{_(""),await se()}catch(Ne){P||(O("error"),_(Ne?.message||"Failed to start clip recording."))}}else ie.current&&await me({send:!0})}}return fe(),()=>{P=!0}},[j,me,R,v,se]),m.useEffect(()=>()=>{tt(W.current||v),vt()},[v,tt,vt]),r.jsxs("div",{className:"grid gap-0.5",children:[r.jsx("section",{className:"surface",children:r.jsxs("div",{className:"flex items-center justify-center gap-0.5 py-0.25 text-xs text-slate-300",children:[r.jsx("span",{children:"Push-to-Talk Key"}),r.jsx(Nx,{label:xe})]})}),r.jsxs("div",{className:"grid gap-0.5 grid-cols-1 lg:grid-cols-2",children:[r.jsx("section",{className:"surface h-full",children:r.jsxs("div",{className:"grid h-full gap-0.5 grid-rows-[auto_auto_1fr]",children:[r.jsx("p",{className:"text-sm text-slate-200 text-center",children:"PTT Mode"}),r.jsx("p",{className:"text-xs text-slate-400 text-center",children:"Choose how holding your PTT key behaves: live mic stream, or record-and-send clip. If the live stream doesn't work, switch to clip mode."}),r.jsxs("div",{className:"grid grid-cols-2 gap-0.5",children:[r.jsx("button",{type:"button",className:`button-dark w-full text-sm ${j?"":"bg-emerald-500 text-white hover:bg-emerald-500"}`,onClick:()=>Be("live"),children:"Live Mic (WHIP)"}),r.jsx("button",{type:"button",className:`button-dark w-full text-sm ${j?"bg-emerald-500 text-white hover:bg-emerald-500":""}`,onClick:()=>Be("clip"),children:"Record Clip"})]})]})}),r.jsx("section",{className:"surface h-full",children:r.jsxs("div",{className:"grid h-full gap-0.5 grid-rows-[auto_1fr]",children:[r.jsx("p",{className:"text-sm text-slate-200 text-center",children:"PTT Clip Status"}),r.jsxs("div",{className:"grid gap-0.5 content-start",children:[r.jsx(xn,{label:"Mode",active:j,detail:j?"record clip":"live mic"}),r.jsx(xn,{label:"PTT hold",active:R,detail:R?"held":"released"}),r.jsx(xn,{label:"Recording",active:ve,detail:ve?"capturing":"idle"}),r.jsx(xn,{label:"Playback",active:j&&ae,detail:j&&ae?"playing":"idle"})]})]})})]}),r.jsxs("div",{className:"grid gap-0.5 grid-cols-1 lg:grid-cols-2",children:[r.jsx("section",{className:"surface h-full",children:r.jsxs("div",{className:"grid h-full gap-0.5 grid-rows-[auto_auto_1fr_auto]",children:[r.jsx("p",{className:"text-sm text-slate-200 text-center",children:"Audio Upload"}),r.jsxs("label",{className:"mx-auto grid w-full max-w-sm gap-0.5 text-xs text-slate-300 text-center",children:[r.jsx("span",{children:"Audio file (mp3 / wav / ogg)"}),r.jsx("input",{className:`${ki} text-center`,type:"file",accept:".mp3,.wav,.ogg,audio/mpeg,audio/wav,audio/ogg",disabled:E||!v,onChange:P=>S(P.target.files?.[0]||null)})]}),r.jsx("div",{className:"mx-auto w-full max-w-sm text-center",children:y?r.jsxs("div",{className:"surface-muted text-xs text-slate-300",children:[y.name," (",y.size," bytes)"]}):r.jsx("div",{className:"surface-muted text-xs text-slate-500",children:"No file selected"})}),r.jsxs("div",{className:"flex justify-center gap-0.5",children:[r.jsx("button",{type:"button",className:"button-dark text-sm",disabled:E||!v,onClick:ze,children:E?"Working...":"Play Upload"}),r.jsx("button",{type:"button",className:"button-dark text-sm",disabled:E||!v,onClick:Ae,children:"Stop"})]})]})}),r.jsx("section",{className:"surface h-full",children:r.jsxs("div",{className:"grid h-full gap-0.5 grid-rows-[auto_auto_1fr]",children:[r.jsx("p",{className:"text-sm text-slate-200 text-center",children:"Live Microphone"}),r.jsxs("label",{className:"surface-muted mx-auto flex w-full max-w-sm items-center justify-center gap-0.5 px-0.5 py-0.5 text-xs text-slate-300",children:[r.jsx("input",{type:"checkbox",checked:k,disabled:!v||j,onChange:P=>g(fe=>({...fe||{},openMicEnabled:!!P.target.checked}))}),r.jsx("span",{children:j?"Open mic (live mode only)":"Open mic"})]}),r.jsxs("div",{className:"grid gap-0.5 content-start",children:[r.jsx(xn,{label:"WHIP link",active:ue,detail:N}),r.jsx(xn,{label:"Mic hot",active:re,detail:re?"transmitting":"muted"}),r.jsxs("div",{className:"surface-muted text-center text-xs text-slate-400",children:["Hold ",r.jsx(Nx,{label:xe})," to talk"]})]})]})})]}),r.jsx("section",{className:"surface",children:r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-sm text-slate-200 text-center",children:"Audio Status"}),r.jsxs("div",{className:"grid gap-0.5 grid-cols-1 sm:grid-cols-2 lg:grid-cols-6",children:[r.jsx(xn,{label:"Forward pipe",active:te,detail:te?"connected":"offline"}),r.jsx(xn,{label:"Upload playback",active:ae,detail:ae?"playing":"idle"}),r.jsx(xn,{label:"Mic relay",active:pe,detail:pe?"active":"idle"}),r.jsx(xn,{label:"WHIP transport",active:ue,detail:N}),r.jsx(xn,{label:"Clip recording",active:ve,detail:ve?"recording":"idle"}),r.jsx(xn,{label:"Clip sending",active:be,detail:be?"sending":"idle"})]}),K?r.jsx("div",{className:"text-xs text-slate-400 text-center",children:K}):null]})})]})}function Nw({pendingRequestId:n,currentStoredKey:s,nickname:i,requestVerification:o,applyIdentityKey:f,onMessage:d,fullWidth:h=!1}){const[p,x]=m.useState(0),[g,v]=m.useState(""),[y,S]=m.useState(!1),[E,C]=m.useState(!1),k=()=>{x(1),v(s),S(!1),d?.("")},w=()=>{x(0),S(!1)},j=async q=>{if(q.preventDefault(),!y){d?.("Please confirm your nickname agreement before sending.");return}if(p<3){d?.("Complete all request steps before sending.");return}C(!0),d?.("");try{const M=await f(g);await o?.(),v(M),x(0),S(!1),d?.("Verification request sent to lockdown admins.")}catch(M){d?.(M.message||"Failed to submit request.")}finally{C(!1)}},N=h?"w-full":_o;return n?r.jsx("section",{className:`surface text-sm text-slate-300 ${N}`,children:r.jsxs("div",{className:bi,children:["Verification request pending: ",n]})}):p===0?r.jsx("section",{className:`surface ${N}`,children:r.jsxs("div",{className:bi,children:[r.jsx("p",{className:"text-sm text-slate-300",children:"Verification"}),r.jsx("button",{type:"button",className:"button-dark text-sm",onClick:k,disabled:E,children:"Request Verification"})]})}):r.jsx("form",{className:`surface ${N}`,onSubmit:j,children:r.jsxs("div",{className:bi,children:[r.jsx("p",{className:"text-sm text-slate-300",children:"Request verification"}),r.jsxs("p",{className:"text-xs text-slate-500",children:["Step ",p," of 3"]}),p===1?r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-xs text-slate-400",children:"Confirm your nickname, which is used as part of the verification process. You can edit it here before requesting."}),r.jsx("div",{className:"mx-auto w-full max-w-sm",children:r.jsx(To,{compact:!0})}),r.jsxs("div",{className:"surface-muted mx-auto w-full max-w-sm text-xs text-slate-300 text-center",children:["Current nickname: ",r.jsx("span",{className:"font-semibold",children:i||"(not set)"})]}),r.jsxs("label",{className:"flex items-center justify-center gap-0.5 text-xs text-slate-300 text-center",children:[r.jsx("input",{type:"checkbox",className:"accent-emerald-500",checked:y,onChange:q=>S(q.target.checked)}),r.jsx("span",{children:"I understand this nickname is tied to my verification."})]}),r.jsxs("div",{className:"flex justify-center gap-0.5",children:[r.jsx("button",{type:"button",className:"button-dark text-sm",disabled:!i||!y,onClick:()=>x(2),children:"Continue"}),r.jsx("button",{type:"button",className:"button-dark text-sm",onClick:w,children:"Cancel"})]})]}):null,p===2?r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-xs text-slate-400",children:"Save your identity key in a safe place. You can use it to restore your identity in another browser."}),r.jsx("input",{className:ki,type:"password",name:"identity_key_request",autoComplete:"current-password",maxLength:35,value:g,onChange:q=>v(q.target.value.toLowerCase()),placeholder:"Identity key for this request"}),r.jsxs("div",{className:"flex justify-center gap-0.5",children:[r.jsx("button",{type:"button",className:"button-dark text-sm",disabled:!g,onClick:()=>navigator.clipboard?.writeText(g),children:"Copy Key"}),r.jsx("button",{type:"button",className:"button-dark text-sm",disabled:!g,onClick:()=>x(3),children:"Continue"}),r.jsx("button",{type:"button",className:"button-dark text-sm",onClick:()=>x(1),children:"Back"})]})]}):null,p===3?r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-xs text-slate-400",children:"Final step: confirm and send your verification request."}),r.jsx("input",{className:ki,type:"password",name:"identity_key_request_final",autoComplete:"current-password",maxLength:35,value:g,onChange:q=>v(q.target.value.toLowerCase()),placeholder:"Identity key for this request"}),r.jsxs("div",{className:"flex justify-center gap-0.5",children:[r.jsx("button",{type:"submit",className:"button-dark text-sm",disabled:E||!g,children:"Confirm Request"}),r.jsx("button",{type:"button",className:"button-dark text-sm",onClick:()=>x(2),children:"Back"})]})]}):null]})})}function ww({currentStoredKey:n,applyIdentityKey:s,onMessage:i,fullWidth:o=!1}){const[f,d]=m.useState(0),[h,p]=m.useState(""),[x,g]=m.useState(!1),v=()=>{d(1),p(""),i?.("")},y=()=>{d(0),p("")},S=async C=>{if(C.preventDefault(),!(f<2)){g(!0),i?.("");try{await s(h),d(0),p(""),i?.("Identity key restored.")}catch(k){i?.(k.message||"Failed to restore key.")}finally{g(!1)}}},E=o?"w-full":_o;return r.jsx("section",{className:`surface ${E}`,children:r.jsxs("div",{className:bi,children:[r.jsx("p",{className:"text-sm text-slate-300",children:"Identity key"}),r.jsxs("p",{className:"text-xs text-slate-500",children:["Current: ",dw(n)||"not set yet"]}),r.jsx("input",{className:ki,type:"password",name:"identity_key_current",autoComplete:"current-password",maxLength:35,value:n,readOnly:!0,placeholder:"Identity key"}),f===0?r.jsxs("div",{className:"flex justify-center gap-0.5",children:[r.jsx("button",{type:"button",className:"button-dark text-sm",disabled:!n,onClick:()=>navigator.clipboard?.writeText(n),children:"Copy Key"}),r.jsx("button",{type:"button",className:"button-dark text-sm",onClick:v,disabled:x,children:"Restore Key"})]}):null,f===1?r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-xs text-slate-400",children:"Restoring your key should only be done when needed. Use this to move your identity to another browser."}),r.jsxs("div",{className:"flex justify-center gap-0.5",children:[r.jsx("button",{type:"button",className:"button-dark text-sm",onClick:()=>d(2),children:"Continue"}),r.jsx("button",{type:"button",className:"button-dark text-sm",onClick:y,children:"Cancel"})]})]}):null,f===2?r.jsxs("form",{className:"space-y-0.5",onSubmit:S,children:[r.jsx("input",{className:ki,type:"password",name:"identity_key_restore",autoComplete:"current-password",maxLength:35,value:h,onChange:C=>p(C.target.value.toLowerCase()),placeholder:"Paste key to restore"}),r.jsxs("div",{className:"flex justify-center gap-0.5",children:[r.jsx("button",{type:"submit",className:"button-dark text-sm",disabled:x||!h,children:"Confirm Restore"}),r.jsx("button",{type:"button",className:"button-dark text-sm",onClick:()=>d(1),children:"Back"})]})]}):null]})})}function Cw({requestableRovers:n=[],pendingRequests:s=[],requestPrivateRoverAccess:i,onMessage:o,fullWidth:f=!1}){const[d,h]=m.useState({}),p=m.useMemo(()=>{const v=new Map;return(s||[]).forEach(y=>{y?.roverId&&v.set(String(y.roverId),y)}),v},[s]),x=f?"w-full":_o,g=async v=>{if(v){h(y=>({...y,[v]:!0})),o?.("");try{(await i?.(v))?.existing?o?.("You already have a pending request for that rover."):o?.("Private rover access request sent to lockdown admins.")}catch(y){o?.(y.message||"Failed to send request.")}finally{h(y=>({...y,[v]:!1}))}}};return r.jsx("section",{className:`surface text-sm text-slate-300 ${x}`,children:r.jsxs("div",{className:bi,children:[r.jsx("p",{className:"text-sm text-slate-300",children:"Private rover access requests"}),n.length===0?r.jsx("p",{className:"text-xs text-slate-500",children:"No closed private rovers are available to request right now."}):r.jsx("div",{className:"w-full space-y-0.5",children:n.map(v=>{const y=String(v.id),S=!!d[y],E=p.get(y);return r.jsxs("div",{className:"surface-muted flex items-center justify-between gap-0.5 px-1 py-0.5",children:[r.jsxs("div",{className:"min-w-0 text-left",children:[r.jsx("p",{className:"truncate text-xs font-semibold text-slate-100",children:v.name||y}),r.jsx("p",{className:"truncate text-[0.7rem] text-slate-500",children:y})]}),E?r.jsx("span",{className:"rounded bg-amber-700/30 px-1 py-0.5 text-[0.7rem] text-amber-200",children:"Pending"}):r.jsx("button",{type:"button",onClick:()=>g(y),disabled:S,className:"button-dark text-xs disabled:opacity-50",children:S?"Sending...":"Request"})]},y)})})]})})}function Vf(n){return String(n||"").trim()}function Ew(n){const s=Vf(n);return s?s.includes("DOCKINGRUNNING")?"Returning":s.includes("PAUSED")?"Paused":s.includes("HOUSECLEANINGRUNNING")?"Cleaning":s.includes("SPOTCLEANINGRUNNING")?"Spot cleaning":s.includes("STATE_START")?"Starting":s.includes("STATE_IDLE")||s.includes("STATE_STANDBY")?"Idle":s:"--"}function Ig(n){return n==="good"?"bg-emerald-600 text-white":n==="warn"?"bg-amber-500 text-slate-900":n==="danger"?"bg-rose-600 text-white":n==="info"?"bg-sky-600 text-white":"bg-slate-700 text-slate-100"}function rs({label:n,value:s,tone:i="muted",valueClass:o=""}){return r.jsxs("div",{className:`rounded-md px-1 py-0.75 text-center ${Ig(i)}`,children:[r.jsx("div",{className:"text-[0.72rem] opacity-90",children:n}),r.jsx("div",{className:`text-sm font-semibold ${o}`,title:String(s||""),children:s})]})}function kw({neato:n,onStart:s,onSendHome:i,onLocate:o,onClearErrors:f,fullWidth:d=!1}){const[h,p]=m.useState(""),x=d?"w-full":"w-full max-w-xl",g=!!n?.configured,v=!!(n?.enabled&&n?.connected),y=!!n?.telemetry?.extPowerPresent,S=!!n?.telemetry?.chargingActive,E=Ew(n?.telemetry?.uiState),C=n?.telemetry?.batteryPercent,k=Number.isFinite(C)?`${C}%`:"--",w=n?.telemetry?.batteryVoltage,j=Number.isFinite(w)?`${w.toFixed(2)} V`:"--",N=Vf(n?.telemetry?.robotError)||"--",q=Vf(n?.telemetry?.robotAlert)||"--",M=N!=="--"&&!/^no errors$/i.test(N)&&!/^200/.test(N),O=q!=="--"&&!/^200/.test(q),K=n?.controls||{},_=!!K?.start?.available,H=!!K?.sendHome?.available,z=!!K?.locate?.available,V=!!K?.clearErrors?.available,U=m.useMemo(()=>y?{key:"start",label:"Start cleaning",pending:"Starting...",toneClass:"bg-emerald-600 hover:bg-emerald-500 text-white",canRun:_,fn:s}:{key:"home",label:"Send to dock",pending:"Sending...",toneClass:"bg-sky-600 hover:bg-sky-500 text-white",canRun:H,fn:i},[y,_,s,H,i]),W=g&&v&&U.canRun,ce=g&&v&&z,oe=g&&v&&V,$=async(de,R)=>{if(R){p(de);try{await R()}catch{}finally{p("")}}},T=g?v?"Online":"Offline":"Not configured",Y=g?v?"good":"danger":"warn",I=C==null?"muted":C>=60?"good":C>=25?"warn":"danger",ie=y?"Docked":E!=="--"?E:"Away from dock";return r.jsx("section",{className:`surface text-sm text-slate-200 ${x}`,children:r.jsxs("div",{className:"grid gap-0.5",children:[r.jsxs("div",{className:"relative flex items-center justify-center min-h-[1.5rem]",children:[r.jsx("p",{className:"text-sm text-slate-100 text-center",children:"Neato Controls"}),r.jsx("span",{className:`absolute right-0 inline-flex w-auto rounded px-1 py-0.25 text-xs font-semibold ${Ig(Y)}`,children:T})]}),r.jsx("section",{className:"surface-muted px-0.5 py-0.5",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-0.5",children:[r.jsxs("div",{className:"grid gap-0.5",children:[r.jsxs("div",{className:"rounded-md bg-slate-800 px-1 py-0.75 text-center",children:[r.jsx("div",{className:"text-xs text-slate-300",children:"State"}),r.jsx("div",{className:"text-base font-semibold text-slate-100",children:ie})]}),r.jsx("button",{type:"button",disabled:!W||!!h,onClick:()=>$(U.key,U.fn),className:`rounded-md px-1 py-1 text-base font-semibold transition disabled:opacity-50 ${U.toneClass}`,children:h===U.key?U.pending:U.label})]}),r.jsx("button",{type:"button",disabled:!ce||!!h,onClick:()=>$("locate",o),className:"rounded-md bg-fuchsia-600 px-1 py-0.75 text-sm font-semibold text-white transition hover:bg-fuchsia-500 disabled:opacity-50",children:h==="locate"?"Playing...":"Play sound"}),r.jsx("button",{type:"button",disabled:!oe||!!h,onClick:()=>$("clearErrors",f),className:"rounded-md bg-amber-500 px-1 py-0.75 text-sm font-semibold text-slate-900 transition hover:bg-amber-400 disabled:opacity-50",children:h==="clearErrors"?"Clearing...":"Clear errors"})]})}),r.jsx("section",{className:"surface-muted px-0.5 py-0.5",children:r.jsxs("div",{className:"grid gap-0.5 grid-cols-2 sm:grid-cols-3 lg:grid-cols-7",children:[r.jsx(rs,{label:"Battery",value:k,tone:I}),r.jsx(rs,{label:"Voltage",value:j,tone:w==null?"muted":"info"}),r.jsx(rs,{label:"Docked",value:y?"Yes":"No",tone:y?"info":"muted"}),r.jsx(rs,{label:"Charging",value:S?"Yes":"No",tone:S?"info":"muted"}),r.jsx(rs,{label:"UI state",value:E,tone:"muted",valueClass:"truncate"}),r.jsx(rs,{label:"Robot error",value:N,tone:M?"danger":"muted",valueClass:"truncate"}),r.jsx(rs,{label:"Robot alert",value:q,tone:O?"warn":"muted",valueClass:"truncate"})]})}),!g||!v||!U.canRun||!z||!V?r.jsx("p",{className:"text-xs text-slate-400 text-center",children:g?v?"Waiting for required Neato entities in Home Assistant.":"Home Assistant is offline.":"Set homeAssistant.neato.device in server config to enable Neato controls."}):null]})})}function Jg(){const{session:n,identifySession:s,requestVerification:i,requestPrivateRoverAccess:o,playUploadedAudio:f,stopUploadedAudio:d,startMicWhip:h,readyMicWhip:p,stopMicWhip:x,neatoStart:g,neatoSendHome:v,neatoLocate:y,neatoClearErrors:S}=nn(),{value:E,save:C}=He("identity",{cookieUserId:""}),{value:k}=He("profile",{nickname:""}),w=m.useMemo(()=>(E?.cookieUserId||"").trim(),[E?.cookieUserId]),j=(k?.nickname||"").trim(),N=!!n?.isVerified,q=n?.verification?.pendingRequestId||null,M=n?.privateRoverAccess?.requestableRovers||[],O=n?.privateRoverAccess?.pendingRequests||[],K=String(n?.assignment?.roverId||"").trim(),[_,H]=m.useState(""),z=async V=>{const U=String(V||"").trim().toLowerCase();if(!U)throw new Error("Identity key required.");if(!fw.test(U))throw new Error("Identity key must match format: cu_ + 32 lowercase hex chars.");return C(W=>({...W||{},cookieUserId:U})),await s({cookieUserId:U,nickname:j}),U};return r.jsxs("section",{className:"panel-section space-y-0.5 text-base",children:[r.jsxs("div",{className:"grid gap-0.5 grid-cols-1 lg:grid-cols-[minmax(0,1.25fr)_minmax(0,0.9fr)]",children:[r.jsx("div",{className:"lg:col-span-2",children:N?r.jsx("section",{className:"surface w-full",children:r.jsxs("div",{className:"mx-auto flex w-full max-w-md flex-col items-center space-y-0.5 text-center",children:[r.jsx("p",{className:"text-sm text-emerald-300",children:"Verification complete"}),r.jsx("p",{className:"text-xs text-slate-400",children:"VIP controls are unlocked for your assigned rover."})]})}):r.jsx(Nw,{pendingRequestId:q,currentStoredKey:w,nickname:j,requestVerification:i,applyIdentityKey:z,onMessage:H,fullWidth:!0})}),r.jsx("div",{className:"lg:col-span-2",children:N?r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(kw,{neato:n?.neato||null,onStart:g,onSendHome:v,onLocate:y,onClearErrors:S,fullWidth:!0}),r.jsx(Aw,{ownRoverId:K,audioForwardByRover:n?.audioForward||{},playUploadedAudio:f,stopUploadedAudio:d,startMicWhip:h,readyMicWhip:p,stopMicWhip:x})]}):r.jsx("section",{className:"surface h-full",children:r.jsx("div",{className:"flex h-full flex-col items-center justify-center text-center text-xs text-slate-400",children:"Verify your account to unlock VIP controls."})})}),r.jsx("div",{className:"lg:col-span-2",children:r.jsx(Cw,{requestableRovers:M,pendingRequests:O,requestPrivateRoverAccess:o,onMessage:H,fullWidth:!0})}),r.jsx("div",{className:"lg:col-span-2",children:r.jsx(ww,{currentStoredKey:w,applyIdentityKey:z,onMessage:H,fullWidth:!0})})]}),_?r.jsx("div",{className:_o,children:r.jsx("p",{className:"text-xs text-slate-400 text-center",children:_})}):null]})}const Mw=420,Rw=1200,qw={1:262,2:330,3:392,4:523};function jo(){const{session:n}=nn(),s=tn(),{value:i}=He("audio",ct),o=Number.isFinite(i?.masterVolume)?i.masterVolume:ct.masterVolume,f=Number.isFinite(i?.alertVolume)?i.alertVolume:ct.alertVolume,d=Math.max(0,Math.min(1,o*f)),h=m.useMemo(()=>{const k=Array.isArray(n?.buttonBox?.buttons)?n.buttonBox.buttons:[];return k.length===4?k:[1,2,3,4].map(w=>k.find(j=>Number(j?.id)===w)||{id:w,count:0,goal:0,rewardName:null,rewardId:null,rewardNumber:null,lastRewardAt:null})},[n?.buttonBox?.buttons]),[p,x]=m.useState({}),[g,v]=m.useState({}),y=m.useRef(new Map),S=m.useRef(new Map),E=m.useRef({}),C=m.useRef(null);return m.useEffect(()=>{const k={};h.forEach(j=>{k[j.id]=Number(j.lastRewardAt||0)});const w=E.current||{};h.forEach(j=>{const N=Number(j.id),q=k[N]||0,M=Number(w[N]||0);if(q>0&&q!==M){v(_=>({..._,[N]:!0}));const O=S.current.get(N);O&&clearTimeout(O);const K=setTimeout(()=>{v(_=>({..._,[N]:!1})),S.current.delete(N)},Rw);S.current.set(N,K)}}),E.current=k},[h]),m.useEffect(()=>{function k(j){const N=qw[j];if(!N||d<=0)return;let q=C.current;if(!q){const _=window.AudioContext||window.webkitAudioContext;if(!_)return;q=new _,C.current=q}const M=q.createOscillator(),O=q.createGain();M.type="square",M.frequency.value=N;const K=.14*d;O.gain.setValueAtTime(1e-4,q.currentTime),O.gain.exponentialRampToValueAtTime(Math.max(1e-4,K),q.currentTime+.01),O.gain.exponentialRampToValueAtTime(1e-4,q.currentTime+.2),M.connect(O),O.connect(q.destination),M.start(),M.stop(q.currentTime+.21)}function w(j={}){const N=Number(j.buttonId);if(!Number.isFinite(N)||N<1||N>4)return;x(O=>({...O,[N]:!0}));const q=y.current.get(N);q&&clearTimeout(q);const M=setTimeout(()=>{x(O=>({...O,[N]:!1})),y.current.delete(N)},Mw);y.current.set(N,M),k(N)}return s.on("buttonBox:increment",w),()=>{s.off("buttonBox:increment",w)}},[d,s]),r.jsxs("section",{className:"panel-section space-y-0.5 text-base",children:[r.jsx("header",{className:"panel-muted text-center text-sm",children:r.jsx("p",{children:"Button Box"})}),r.jsx("div",{className:"grid grid-cols-4 gap-0.5",children:h.map(k=>{const w=Number(k.id),j=Number.isFinite(k.count)?k.count:0,N=Number.isFinite(k.goal)?k.goal:0,q=typeof k.rewardName=="string"&&k.rewardName.trim()?k.rewardName.trim():"Unassigned",M=Number.isFinite(k.rewardNumber)?k.rewardNumber:"?",O=!!p[w],K=!!g[w];return r.jsx(xg,{buttonId:w,count:j,goal:N,rewardNumber:M,rewardName:q,className:[O?"bg-cyan-900/45":"",K?"bg-fuchsia-900/45":""].filter(Boolean).join(" ")},w)})})]})}function Tw(){const{state:{roverId:n}}=_t(),i=ml(n)?.sensors||{};return r.jsx("section",{className:"panel-section",children:r.jsx("div",{className:"aspect-square w-full",children:r.jsx(Uf,{sensors:i})})})}function Dw(){const{state:{roverId:n,keymap:s,camera:i,horn:o},pipeline:f,actions:{setServoAngle:d,setNightVision:h,startHorn:p,stopHorn:x}}=_t(),g=qg(n),v=g.docked&&!g.driving,y=i?.config,S=!!(n&&i?.enabled&&y),E=!!(n&&f?.nightVision),C=f?.nightVisionState,k=!!(n&&f?.horn),w=o?.overheated,j=typeof y?.minAngle=="number"?y.minAngle:-30,N=typeof y?.maxAngle=="number"?y.maxAngle:30,q=typeof i?.angle=="number"?i.angle:typeof y?.homeAngle=="number"?y.homeAngle:(j+N)/2,M=An(s?.nightVisionToggle?.[0]),O=An(s?.hornHonk?.[0]),K=An(s?.cameraUp?.[0]),_=An(s?.cameraDown?.[0]);return r.jsxs("section",{className:"panel-section grid h-full min-h-0 grid-rows-[minmax(0,1fr)_auto] gap-0.5",children:[r.jsx(Tg,{layout:"desktop",expand:!0,driveDockState:g}),v?null:r.jsxs("div",{className:"surface space-y-0.5 p-0 text-sm text-slate-200",children:[E&&r.jsx(Dg,{nightVisionOn:C?.nightVisionOn,disabled:!n,onToggle:h,keyLabel:M}),k&&r.jsx(_g,{disabled:!n||w,onStart:p,onStop:x,keyLabel:O,active:o?.active,heat:o?.heat}),S&&r.jsx(Bg,{value:q,min:j,max:N,onChange:d,keyDownLabel:_,keyUpLabel:K,className:"space-y-0.5 px-1 py-1",labelRowClass:"text-xs text-slate-300",labelClass:"",valueClass:"font-mono text-slate-100",sliderClass:"w-full",accentClass:"accent-emerald-400",endpointClass:"text-[0.7rem] text-slate-400"})]})]})}function _w({layout:n,onOpenHelpOverlay:s}){const i=ft(E=>E.session),{state:o}=_t(),{value:f}=He("vipAudio",{openMicEnabled:!1,pttMode:"live"}),d=i?.isVerified?"bg-emerald-400":"bg-red-600",h=String(i?.assignment?.roverId||"").trim(),p=h?i?.audioForward?.[h]:null,x=!!o?.mic?.pttActive,g=!!f?.openMicEnabled,v=f?.pttMode==="clip"?"clip":"live",y=!!(h&&i?.isVerified&&(v==="clip"?x:g||x)),S=!!(h&&i?.isVerified&&v==="clip"&&p?.source==="upload"&&p?.state==="playing");return r.jsx("section",{className:"panel text-base",children:r.jsxs(yd,{defaultTab:"telemetry",children:[r.jsxs(Sd,{children:[r.jsx(Wt,{id:"telemetry",children:"Controls"}),r.jsx(Wt,{id:"vip",highlight:S?"green":y?"pink":"none",children:r.jsxs("span",{className:"inline-flex items-center gap-2",children:[r.jsx("span",{children:"VIP"}),r.jsx("span",{className:`inline-block h-3 w-3 rounded-full ${d}`,"aria-hidden":"true",title:i?.isVerified?"Verified":"Not verified"})]})}),r.jsx(Wt,{id:"help",children:"Help"}),r.jsx(Wt,{id:"settings",children:"Settings"})]}),r.jsxs(jd,{children:[r.jsx(en,{id:"telemetry",children:r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"grid items-stretch gap-0.5 grid-cols-[minmax(0,1.35fr)_minmax(0,0.95fr)]",children:[r.jsx(Tw,{}),r.jsx(Dw,{})]}),r.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,0.9fr)_minmax(0,0.75fr)]",children:[r.jsx(Do,{}),r.jsx(ad,{panelId:"replay-sources-desktop",fillHeight:!0}),r.jsx(sw,{})]}),r.jsxs("div",{className:"grid items-stretch gap-0.5 grid-cols-[minmax(0,1.3fr)_minmax(0,0.22fr)] h-[14rem]",children:[r.jsx(qo,{fillHeight:!0}),r.jsxs("div",{className:"grid min-h-0 gap-0.5 grid-rows-[minmax(0,1fr)_auto]",children:[r.jsx(So,{compact:!0,hideNicknameForm:!0,fillHeight:!0}),r.jsx(aw,{compact:!0})]})]}),r.jsx(Hg,{}),r.jsx(jo,{}),r.jsx(fd,{defaultOrientation:"horizontal",panelId:"rightpane-telemetry"})]})}),r.jsx(en,{id:"vip",keepMounted:!0,children:r.jsx(Jg,{})}),r.jsx(en,{id:"help",children:r.jsx(Kg,{layout:n,onOpenOverlay:s})}),r.jsx(en,{id:"settings",children:r.jsx(Fg,{})})]})]})})}const Bw=new Set(["admin","lockdown","lockdown-admin"]),Ow=new Set(["lockdown","lockdown-admin"]),Lw=new Set(["admin","lockdown"]);function zw(n="admin"){return n==="lockdown"?{title:"Lockdown mode active",description:"Only the server owners can access the interface at this time."}:{title:"Admin mode active"}}function Uw(){const n=ft(S=>S.session),s=n?.mode,i=n?.role,o=n?.adminReason?.text||"";n?.adminReason?.updatedAt;const f=n?.timezone||"UTC",d=n?.socials?.find(S=>String(S?.id||S?.label||"").toLowerCase()==="discord")?.url||n?.discord?.invite||null,h=Lw.has(s),p=s==="lockdown"?Ow.has(i):Bw.has(i),[x,g]=m.useState(()=>new Date),v=m.useMemo(()=>{try{return new Intl.DateTimeFormat("en-US",{timeZone:f,hour:"numeric",minute:"2-digit",second:"2-digit"}).format(x)}catch{return x.toLocaleTimeString()}},[x,f]);if(m.useEffect(()=>{const S=setInterval(()=>g(new Date),1e3);return()=>clearInterval(S)},[]),!h||p)return null;const y=zw(s);return r.jsx("div",{className:"pointer-events-auto fixed inset-0 z-50 flex items-center justify-center bg-black/85 px-0.5 py-0.5",children:r.jsxs("div",{className:"surface w-full max-w-md space-y-0.5 text-slate-100 shadow-2xl",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-lg font-semibold",children:y.title}),r.jsx("p",{className:"text-sm text-slate-300",children:y.description})]}),r.jsxs("div",{className:"surface-muted space-y-0.5",children:[r.jsx("p",{className:"text-[0.7rem] tracking-wide text-slate-400",children:"Reason for locking:"}),r.jsx("p",{className:"text-lg font-semibold text-slate-100",children:o||"No reason set."}),r.jsxs("p",{className:"text-center text-sm text-slate-300",children:["Server time: ",v]})]}),r.jsx("div",{className:"surface-muted",children:r.jsx(Vg,{})}),r.jsx("div",{className:"w-full justify-center items-center",children:r.jsx(pd,{id:"discord",label:"Join our Discord server for updates!",url:d})}),"You can still use the chat while the server is locked:",r.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[r.jsx(qo,{}),r.jsx(To,{})]})]})})}const Hw="/assets/turn_alert-DVO8EZJa.mp3";function Vw(n,s=1){const i=m.useRef(null);return m.useEffect(()=>{i.current=new Audio(n),i.current.volume=s,i.current.load()},[n,s]),()=>{i.current&&(i.current.volume=s,i.current.currentTime=0,i.current.play().catch(()=>{}))}}function $w(){const n=ft(v=>v.session),{pushAlert:s}=wn(),{value:i}=He("audio",ct),o=Number.isFinite(i?.masterVolume)?i.masterVolume:ct.masterVolume,f=Number.isFinite(i?.alertVolume)?i.alertVolume:ct.alertVolume,d=Math.max(0,Math.min(1,o*f)),h=Vw(Hw,d),p=m.useRef(new Set),x=m.useMemo(()=>n?.turnQueues||{},[n?.turnQueues]),g=n?.socketId||null;return m.useEffect(()=>{if(!g)return;const v=[];Object.entries(x).forEach(([y,S])=>{!S||!S.current||S.current!==g||p.current.has(y)||(v.push(y),p.current.add(y))}),Object.keys(x).forEach(y=>{(!x[y]||x[y].current!==g)&&p.current.delete(y)}),v.length!==0&&(v.forEach(y=>{const S=n?.roster?.find(E=>String(E.id)===String(y))?.name||y;s({title:"Your turn!",message:`You now control ${S}.`,color:"#ff5722"})}),h())},[x,h,s,n?.roster,g]),null}function Gw({visible:n,mode:s,onEnterFullscreen:i,onDismiss:o}){if(!n)return null;const f=s==="pwa-hint";return r.jsx("div",{className:"fixed inset-0 z-40 flex items-end justify-center p-2 pointer-events-none sm:items-center",children:r.jsx("div",{className:"pointer-events-auto w-full max-w-sm rounded-lg border border-cyan-500/40 bg-zinc-950/95 shadow-xl",children:r.jsxs("div",{className:"space-y-0.5 p-4 text-sm text-slate-100",children:[r.jsx("h2",{className:"text-base font-semibold text-white",children:"Better in fullscreen"}),f?r.jsxs("p",{className:"text-slate-300",children:["For fullscreen on iOS, open Safari's share menu and pick ",r.jsx("strong",{children:"Add to Home Screen"}),". Launching from the home screen removes the browser chrome."]}):r.jsx("p",{className:"text-slate-300",children:"Enable fullscreen to free up more space for the video feed and controls. You can exit fullscreen at any time via the system back or home gesture."}),r.jsxs("div",{className:"flex justify-end gap-0.5 pt-1 text-sm",children:[r.jsx("button",{type:"button",className:"rounded border border-slate-600 px-3 py-1 text-slate-200",onClick:o,children:f?"Got it":"Not now"}),!f&&r.jsx("button",{type:"button",className:"rounded bg-cyan-500 px-3 py-1 font-semibold text-black hover:bg-cyan-400",onClick:i,children:"Enter fullscreen"})]})]})})})}function Yw({side:n="right",onClick:s}){const i=n==="left"?"left-2":"right-2";return r.jsx("button",{type:"button",onClick:s,className:`fixed bottom-2 ${i} z-30 flex h-10 w-10 items-center justify-center rounded-full border border-cyan-200/50 bg-slate-900/70 text-cyan-100 shadow-lg backdrop-blur-sm transition hover:bg-slate-800/80 active:scale-95`,"aria-label":"Enter fullscreen",title:"Enter fullscreen",children:r.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",className:"pointer-events-none",children:r.jsx("path",{d:"M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}const Pg="fullscreenPromptDismissed",Fw=new Set(["mobile-portrait","mobile-landscape"]),Wg=()=>{if(typeof window>"u")return null;try{return window.sessionStorage}catch{return null}},Xw=()=>{const n=Wg();if(!n)return!1;try{return n.getItem(Pg)==="1"}catch{return!1}},wx=()=>{const n=Wg();if(n)try{n.setItem(Pg,"1")}catch{}},Qw=()=>{if(typeof navigator>"u")return!1;const n=navigator.userAgent||navigator.platform||"";return/iphone|ipad|ipod/i.test(n)},Cx=()=>{if(typeof document>"u")return!1;const n=document;return!!(n.fullscreenEnabled||n.webkitFullscreenEnabled||n.mozFullScreenEnabled||n.msFullscreenEnabled)};function Kw(n){const s=Fw.has(n),[i,o]=m.useState(!1),[f,d]=m.useState("native"),[h,p]=m.useState(!1),x=m.useMemo(()=>Qw(),[]),g=m.useMemo(()=>Cx(),[]),v=m.useCallback(()=>{if(!s){o(!1),p(!1);return}if(!h&&Xw()){o(!1);return}if(x){d("pwa-hint"),o(!0);return}if(!Cx()){o(!1);return}if(typeof document<"u"&&document.fullscreenElement){o(!1);return}d("native"),o(!0)},[h,x,s]);m.useEffect(()=>{v()},[v]),m.useEffect(()=>{if(typeof document>"u")return;const C=()=>{if(document.fullscreenElement){p(!1),o(!1);return}v()};return document.addEventListener("fullscreenchange",C),document.addEventListener("webkitfullscreenchange",C),()=>{document.removeEventListener("fullscreenchange",C),document.removeEventListener("webkitfullscreenchange",C)}},[v]);const y=m.useCallback(()=>{wx(),p(!1),o(!1)},[]),S=m.useCallback(async()=>{if(!s||x||typeof document>"u")return!1;if(document.fullscreenElement)return!0;const C=document.documentElement;if(!C)return!1;const k=C.requestFullscreen||C.webkitRequestFullscreen||C.mozRequestFullScreen||C.msRequestFullscreen;if(!k)return!1;try{const w=k.call(C);return w&&typeof w.then=="function"&&await w,wx(),p(!1),o(!1),!0}catch(w){return console.warn("Failed to enter fullscreen",w),!1}},[x,s]),E=m.useCallback(()=>{s&&(p(!0),d(x?"pwa-hint":"native"),o(!0))},[x,s]);return m.useEffect(()=>{s||(p(!1),o(!1))},[s]),{visible:i,mode:f,isIOS:x,nativeSupported:g,enterFullscreen:S,dismiss:y,showPrompt:E}}function Zw({visible:n,layout:s,onClose:i,showOnLoad:o,onToggleShowOnLoad:f}){if(!n)return null;const{state:d}=_t(),h=p=>{const x=!p.target.checked;f?.(x)};return r.jsx("div",{className:"fixed inset-0 z-30 flex items-center justify-center bg-black/80 px-0.5 py-0.5",children:r.jsxs("div",{className:"pointer-events-auto surface w-full max-w-4xl max-h-[90vh] overflow-hidden shadow-2xl",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-slate-700 px-0.5 py-0.25 text-sm text-slate-200",children:[r.jsx("span",{className:"font-semibold",children:"Help & controls"}),r.jsxs("div",{className:"flex items-center gap-0.5 text-[0.8rem] text-slate-300",children:[r.jsxs("label",{className:"flex items-center gap-0.5",children:[r.jsx("input",{type:"checkbox",checked:!o,onChange:h,className:"accent-cyan-500"}),r.jsx("span",{children:"Don't show again"})]}),r.jsx("button",{type:"button",onClick:i,className:"button-dark px-2 py-0.25 text-[0.8rem]",children:"Close"})]})]}),r.jsx("div",{className:"max-h-[85vh] overflow-y-auto p-0.5",children:r.jsx(Qg,{layout:s,keymap:d?.keymap||{}})})]})})}const Iw=`aroma +`).trim();if(te){N(!0);try{await p(te,I),w(""),y(),S(!1)}catch(ae){alert(ae.message)}finally{N(!1)}}}const de=i?"flex-1 min-h-0 overflow-y-auto":"h-48 overflow-y-auto";return r.jsxs("section",{className:`panel-section space-y-0.5 text-base ${i?"flex h-full flex-col overflow-hidden":""}`,children:[r.jsxs("div",{className:`surface overflow-y-auto space-y-0.5 px-0 ${de}`,ref:W,children:[T.length===0&&Y.length===0?r.jsx("p",{className:"text-sm text-slate-500",children:"No messages yet."}):T.map(R=>r.jsx(ld,{message:R},R.id)),Y.map(R=>r.jsx(pg,{message:R},`typing-${R.typingId||R.id}`))]}),!n&&r.jsxs("form",{className:"flex flex-wrap items-stretch gap-0.5",onSubmit:ie,children:[r.jsx("input",{className:"field-input flex-1 min-w-[10rem]",value:k,onChange:R=>{const G=R.target.value;w(G),S(!!G.trim())},onFocus:R=>{g(R),S(!!k.trim())},onBlur:R=>{v(R),S(!1)},onKeyDown:R=>{R.key==="Enter"&&!k.trim()&&(R.preventDefault(),y(),S(!1))},ref:R=>x(R,{target:"panel"}),placeholder:U?"Type a message…":s?"":"Spectators cannot chat",disabled:!U}),$&&r.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 basis-full sm:basis-auto",children:[r.jsxs("label",{className:"flex items-center gap-0.5 text-xs text-slate-300",children:[r.jsx("input",{type:"checkbox",checked:q,onChange:R=>M(R.target.checked),className:"accent-cyan-500"}),r.jsx("span",{children:"Speak"})]}),r.jsxs("select",{value:O,onChange:R=>{const G=R.target.value;K(G),C(te=>({...te||{},engine:G}))},className:"field-input text-xs",children:[r.jsx("option",{value:"flite",children:"flite"}),r.jsx("option",{value:"espeak",children:"espeak"})]}),O==="flite"?r.jsx("select",{value:_,onChange:R=>{const G=R.target.value;H(G),C(te=>({...te||{},voice:G}))},className:"field-input text-xs",children:WN.map(R=>r.jsx("option",{value:R,children:R},R))}):r.jsx("select",{value:z,onChange:R=>{const G=Number(R.target.value);V(G),C(te=>({...te||{},pitch:G}))},className:"field-input text-xs",children:ew.map(R=>r.jsxs("option",{value:R,children:["pitch ",R]},R))})]}),r.jsx("button",{type:"submit",disabled:!U||j,className:"button-dark h-full disabled:opacity-50 self-stretch",children:j?"...":"Send"})]})]})}function To({compact:n=!1}){const{session:s,setNickname:i}=nn(),{value:o,save:f}=He("profile",{nickname:""}),[d,h]=m.useState(o.nickname||""),[p,x]=m.useState(!1),g=s?.role!=="spectator";m.useEffect(()=>{h(o.nickname||"")},[o.nickname]);async function v(y){if(y.preventDefault(),!g)return;const S=(d||"").trim().slice(0,32);if(S){x(!0);try{await i(S),f({nickname:S})}catch(E){alert(E.message)}finally{x(!1)}}}return r.jsxs("form",{className:"grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-stretch gap-0.5",onSubmit:v,children:[r.jsx("input",{className:"field-input flex-1 min-w-0",value:d,onChange:y=>h(y.target.value),maxLength:32,placeholder:"Enter a nickname",disabled:!g}),r.jsx("button",{type:"submit",disabled:!g||p,className:"button-dark h-full shrink-0 whitespace-nowrap px-0.5 py-0 disabled:opacity-50",children:p?"Saving…":n?"Set":"Save"})]})}function tw(n){const s=Array.isArray(n?.socials)?n.socials:null;if(s&&s.length)return s;const i=[];return n?.discord?.invite&&i.push({id:"discord",label:"Discord",url:n.discord.invite}),n?.kofi?.link&&i.push({id:"kofi",label:"Ko-fi",url:n.kofi.link}),i}function nw(n){if(!n||typeof n!="object")return null;const s=n.id||n.service||n.key||n.name||null,i=n.label||n.title||n.name||s||"Link",o=n.url||n.link||n.href||null;return o?{id:s,label:i,url:o}:null}function Zg({className:n=""}){const{session:s}=nn(),i=tw(s).map(nw).filter(Boolean).slice(0,4);return i.length?r.jsx("div",{className:`grid grid-cols-2 grid-rows-2 gap-0.5 ${n}`,children:i.map(o=>r.jsx(pd,{...o},`${o.id||o.label}-${o.url}`))}):null}function aw({compact:n=!1}){return r.jsx("section",{className:"panel-section flex h-full min-h-0 flex-col gap-0.5 text-base",children:r.jsx("div",{className:"surface flex w-full items-center px-0 py-0",children:r.jsx(To,{compact:n})})})}function sw(){return r.jsx("section",{className:"panel-section flex h-full min-h-0 flex-col gap-0.5 text-base",children:r.jsx(Zg,{className:"flex-1 min-h-0"})})}function yf(...n){return n.filter(Boolean).join(" ")}function lw(n){const s=n?.batteryState?.percentDisplay;return s==null?"--":`${s}%`}function iw(n){return n?.batteryState?n.batteryState.urgentActive?"text-red-400":n.batteryState.warnActive?"text-amber-300":"text-emerald-300":"text-slate-400"}function rw(n){switch(n){case"admin":case"lockdown":case"lockdown-admin":return"text-amber-300";case"spectator":return"text-slate-400";default:return"text-sky-300"}}function ow(n,s){if(!n)return"";const i=n.nickname||n.socketId?.slice(0,6)||"unknown";return n.socketId&&n.socketId===s?`${i} (you)`:i}function Do({title:n="Rovers"}){const s=ft(j=>j.session),{requestControl:i}=wn(),[o,f]=m.useState({}),[d,h]=m.useState(()=>Date.now()),p=m.useMemo(()=>s?.role&&s.role!=="spectator",[s?.role]),x=m.useMemo(()=>s?.role==="admin"||s?.role==="lockdown"||s?.role==="lockdown-admin",[s?.role]),g=s?.roster??[],v=s?.turnQueues??{},y=s?.users??[],S=s?.socketId||null,E=m.useMemo(()=>Object.values(v||{}).some(j=>j?.deadline||j?.idleDeadline),[v]);m.useEffect(()=>{if(!E)return;const j=setInterval(()=>{h(Date.now())},1e3);return()=>clearInterval(j)},[E]);const C=m.useMemo(()=>{const j=new Set(g.map(q=>String(q.id))),N=Object.keys(v||{}).filter(q=>!j.has(String(q))).map(q=>({id:q,name:q,locked:!1,batteryState:null}));return[...g,...N]},[g,v]);async function k(j){if(j){f(N=>({...N,[j]:!0}));try{await i(j)}catch(N){alert(N.message)}finally{f(N=>({...N,[j]:!1}))}}}const w=j=>y.find(N=>N.socketId===j)||{socketId:j,nickname:null,role:null};return r.jsxs("div",{className:"space-y-0.5 text-sm",children:[n&&r.jsx("p",{className:"text-sm text-slate-400",children:n}),C.length===0?r.jsx("p",{className:"text-sm text-slate-500",children:"No rovers registered."}):r.jsx("ul",{className:"space-y-0.5 text-sm",children:C.map(j=>{const N=String(j.id),q=v?.[N]||null,M=q?.queue||[],O=q?.idleDeadline||q?.deadline||null,K=O&&O>d?Math.ceil((O-d)/1e3):O?0:null,_=q?.current||null,H=_?M.findIndex(ie=>ie===_):-1,z=M.length>1?H>=0?M[(H+1)%M.length]:M[0]:null,V=!!(S&&_&&_===S),U=!!(S&&z&&z===S),W=K!=null&&(V||U),ce=!!j.locked,oe=ce&&!x,$=!!(j?.private?.enabled&&j?.private?.open),T=j.lockReason?`locked: ${j.lockReason}`:"locked",Y=ce?T:o[N]?"...":"request",I=p&&!oe&&!o[N];return r.jsxs("li",{className:yf("surface flex flex-wrap items-start justify-between gap-0.5",I&&"cursor-pointer",ce?"bg-red-900/40":$?"bg-amber-700/35 border border-amber-200/30":null),onClick:()=>{I&&k(j.id)},children:[r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[r.jsxs("div",{className:"flex items-center justify-between gap-0.5",children:[r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx("p",{className:"text-slate-200",children:r.jsx("span",{className:"rounded px-1 py-[1px] border border-transparent",style:ca(j.color,.16),children:j.name})}),W?r.jsx("span",{className:"rounded bg-slate-800 px-1 text-[0.7rem] text-slate-200",children:V?`${K}s left`:`Your turn in ${K}s`}):null]}),r.jsx("span",{className:yf("text-[0.75rem] font-semibold",iw(j)),children:lw(j)})]}),M.length===0?r.jsx("p",{className:"text-[0.7rem] text-slate-500",children:"No queue."}):r.jsx("div",{className:"flex flex-wrap items-center gap-0.5",children:M.map((ie,de)=>{const R=w(ie),G=ie===_,te=!!(z&&ie===z&&!G),ae=G?"bg-sky-600 text-white ring-2 ring-amber-300":te?"bg-emerald-700/60 text-emerald-100 ring-1 ring-emerald-300/70":"bg-slate-800 text-slate-200";return r.jsxs("span",{className:`flex items-center gap-0.5 rounded px-1 text-[0.7rem] ${ae}`,children:[r.jsx("span",{className:`${rw(R.role)} font-semibold`,children:ow(R,S)}),G&&r.jsx("span",{className:"text-[0.65rem] text-slate-200",children:"now"}),te&&r.jsx("span",{className:"text-[0.65rem] text-emerald-100",children:"next"})]},`${N}-${ie}-${de}`)})})]}),p?r.jsx("button",{type:"button",onClick:ie=>{ie.stopPropagation(),k(j.id)},disabled:o[N]||oe,className:yf("button-dark disabled:opacity-40",ce&&"bg-red-600/70 text-white hover:bg-red-600"),children:Y}):null]},j.id)})})]})}function cw(n){switch(n){case"admin":case"lockdown":case"lockdown-admin":return"text-amber-300";case"spectator":return"text-slate-400";default:return"text-sky-300"}}function uw(n,s){if(!n)return"";const i=n.nickname||n.socketId?.slice(0,6)||"unknown";return n.socketId&&n.socketId===s?`${i} (you)`:i}function So({hideNicknameForm:n=!1,hideHeader:s=!1,className:i="",fillHeight:o=!1,compact:f=!1}){const{session:d}=nn(),h=d?.role!=="spectator",p=d?.users??[],x=d?.socketId||null,g=m.useMemo(()=>[...p].sort((y,S)=>y.socketId===x?-1:S.socketId===x?1:(y.nickname||"").localeCompare(S.nickname||"")),[x,p]),v=o?"flex-1 min-h-0 overflow-y-auto":f?"h-28 overflow-y-auto":"h-48 overflow-y-auto";return r.jsxs("section",{className:`panel-section space-y-0.5 text-base ${o?"flex h-full min-h-0 flex-col overflow-hidden":""} ${i}`,children:[!n&&r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"grid gap-0.5 md:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)]",children:[r.jsx("div",{className:"min-w-0",children:r.jsx("div",{className:"surface flex w-full items-center px-0 py-0",children:r.jsx(To,{compact:f})})}),r.jsx(Zg,{})]}),!h&&r.jsx("p",{className:"text-xs text-slate-500",children:"Spectators cannot set nicknames."})]}),r.jsxs("div",{className:`space-y-0.5 ${o?"flex flex-1 min-h-0 flex-col":""}`,children:[!s&&r.jsxs("div",{className:`flex items-center justify-between text-sm text-slate-400 ${f?"text-xs":""}`,children:[r.jsx("span",{children:"Users"}),r.jsx("span",{className:"text-xs text-slate-500",children:g.length})]}),r.jsx("div",{className:`surface flex flex-wrap content-start items-start gap-0.5 px-0 pb-0 ${v} ${f?"text-[0.8rem]":""}`,children:g.length===0?r.jsx("p",{className:"text-sm text-slate-500",children:"Waiting for users…"}):g.map(y=>r.jsx("span",{className:`rounded bg-slate-800/80 px-1 py-0.25 text-[0.7rem] ${cw(y.role)}`,children:uw(y,x)},y.socketId))})]})]})}const fw=/^cu_[a-f0-9]{32}$/,ki="field-input w-full max-w-sm text-left focus:ring-emerald-500",_o="mx-auto w-full max-w-xl flex justify-center",bi="mx-auto flex w-full max-w-md flex-col items-center space-y-0.5 text-center";function dw(n){const s=String(n||"").trim();return s?s.length<=10?`${s.slice(0,2)}***${s.slice(-2)}`:`${s.slice(0,6)}...${s.slice(-6)}`:""}const Sx=8*1024*1024,is=16e3,mw={iceServers:[{urls:"stun:stun.l.google.com:19302"}],bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"};function jx(n){let s="";for(let o=0;o{if(!n||n.iceGatheringState==="complete"){i();return}const o=setTimeout(()=>{n.removeEventListener("icegatheringstatechange",f),i()},s);function f(){n.iceGatheringState==="complete"&&(clearTimeout(o),n.removeEventListener("icegatheringstatechange",f),i())}n.addEventListener("icegatheringstatechange",f)})}function Ax(n){if(!n)return!1;const s=n.connectionState,i=n.iceConnectionState;return s==="connected"||i==="connected"||i==="completed"}function gw(n,s=1e4){return new Promise((i,o)=>{if(!n){o(new Error("Peer connection missing"));return}if(Ax(n)){i();return}const f=setTimeout(()=>{h(),o(new Error("Peer connection timeout"))},s),d=()=>{Ax(n)?(h(),i()):(n.connectionState==="failed"||n.connectionState==="closed"||n.iceConnectionState==="failed")&&(h(),o(new Error(`Peer connection ${n.connectionState||n.iceConnectionState}`)))};function h(){clearTimeout(f),n.removeEventListener("connectionstatechange",d),n.removeEventListener("iceconnectionstatechange",d)}n.addEventListener("connectionstatechange",d),n.addEventListener("iceconnectionstatechange",d)})}async function vw(n){if(!n?.getParameters||!n?.setParameters)return;const s=n.getParameters()||{},i=s.encodings&&s.encodings[0]||{};s.encodings=[{...i,maxBitrate:64e3,dtx:"disabled"}];try{await n.setParameters(s)}catch{}}function bw(n,s=6e3){return new Promise((i,o)=>{if(!n){o(new Error("Peer connection missing"));return}const f=Date.now();let d=-1;const h=setInterval(async()=>{if(Date.now()-f>s){clearInterval(h),o(new Error("WHIP connected but no outbound audio flow"));return}try{const p=n.getSenders().filter(x=>x.track?.kind==="audio");for(const x of p){const g=await x.getStats();for(const v of g.values()){if(v.type!=="outbound-rtp"||v.kind!=="audio")continue;const y=Number(v.bytesSent||0),S=Number(v.packetsSent||0);if(d<0)d=y;else if(y>d+200||S>5){clearInterval(h),i();return}}}}catch{}},250)})}function xn({label:n,active:s,detail:i=""}){return r.jsxs("div",{className:`rounded-md px-0.5 py-0.5 text-xs text-slate-100 ${s?"bg-emerald-500":"bg-slate-700"}`,children:[r.jsx("div",{className:"text-center font-medium",children:n}),r.jsx("div",{className:"text-center text-[0.72rem] opacity-90",children:i||(s?"active":"idle")})]})}function Nx({label:n}){return n?r.jsx("span",{className:"rounded border border-white/40 px-1 text-[0.7rem] text-white",children:n}):null}function yw(n){const s=n.reduce((f,d)=>f+d.length,0),i=new Float32Array(s);let o=0;for(const f of n)i.set(f,o),o+=f.length;return i}function Sw(n){const s=new Int16Array(n.length);for(let i=0;i{for(let v=0;vv&&s?.[v]||null,[s,v]),te=!!(G&&G.state!=="offline"&&!G.error),ae=G?.source==="upload"&&G?.state==="playing",pe=G?.source==="mic-whip"&&(G?.state==="starting"||G?.state==="playing"),re=!!(!j&&z.current&&(k||R)),ue=!j&&(N==="live"||N==="starting"),ve=j&&M==="recording",be=j&&M==="sending",xe=An(p?.keymap?.micPtt?.[0])||"M",Be=m.useCallback(P=>{const fe=P==="clip"?"clip":"live";g(Ne=>({...Ne||{},pttMode:fe}))},[g]),ze=async()=>{if(!v){_("Take control of your rover first.");return}if(!y){_("Select an audio file first.");return}if(y.size>Sx){_(`File too large (max ${Sx} bytes).`);return}C(!0),_("");try{const P=await y.arrayBuffer(),fe=jx(new Uint8Array(P));await i?.({roverId:v,name:y.name,mime:y.type||"",dataBase64:fe}),_("Upload playback started.")}catch(P){_(P?.message||"Failed to play upload.")}finally{C(!1)}},Ae=async()=>{if(!v){_("Take control of your rover first.");return}C(!0),_("");try{await o?.(v),_("Upload playback stopped.")}catch(P){_(P?.message||"Failed to stop upload.")}finally{C(!1)}},tt=m.useCallback(async P=>{const fe=String(P||W.current||"").trim();if(U.current=!1,q("idle"),V.current){try{V.current.getSenders().forEach(Ne=>Ne.track?.stop())}catch{}try{V.current.close()}catch{}}if(V.current=null,H.current)try{H.current.getTracks().forEach(Ne=>Ne.stop())}catch{}if(H.current=null,z.current=null,fe)try{await h?.(fe)}catch{}W.current=""},[h]),Je=m.useCallback(async P=>{const fe=await f?.(P),Ne=String(fe?.whipUrl||"").trim(),pt=String(fe?.token||"").trim();if(!Ne||!pt)throw new Error("WHIP endpoint unavailable");const Ve=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:is,echoCancellation:!1,noiseSuppression:!1,autoGainControl:!1}});H.current=Ve;const st=Ve.getAudioTracks()?.[0];if(z.current=st||null,st&&(st.enabled=!!(k||R)),st?.applyConstraints)try{await st.applyConstraints({channelCount:1,sampleRate:is,echoCancellation:!1,noiseSuppression:!1,autoGainControl:!1})}catch{}const lt=new RTCPeerConnection(mw);V.current=lt,lt.onconnectionstatechange=()=>{if(!U.current)return;const Yt=lt.connectionState;if(Yt==="connected"){q("live");return}(Yt==="failed"||Yt==="disconnected"||Yt==="closed")&&(q("error"),_(`WHIP transport ${Yt}.`))},Ve.getAudioTracks().forEach(Yt=>{const La=lt.addTrack(Yt,Ve);vw(La)});const Ot=await lt.createOffer({offerToReceiveAudio:!1,offerToReceiveVideo:!1});await lt.setLocalDescription(Ot),await xw(lt,1800);const it=await fetch(Ne,{method:"POST",headers:{"Content-Type":"application/sdp",...pw(pt)},body:lt.localDescription?.sdp||Ot.sdp});if(!it.ok)throw new Error(`WHIP request failed: ${it.status}`);const ms=await it.text();await lt.setRemoteDescription({type:"answer",sdp:ms}),await gw(lt,1e4),await bw(lt,6e3),await d?.(P)},[k,R,d,f]),vt=m.useCallback(async()=>{if(ie.current=!1,T.current){try{T.current.disconnect()}catch{}T.current.onaudioprocess=null}if($.current)try{$.current.disconnect()}catch{}if(Y.current)try{Y.current.disconnect()}catch{}if(ce.current)try{ce.current.getTracks().forEach(P=>P.stop())}catch{}if(oe.current)try{await oe.current.close()}catch{}I.current=[],T.current=null,$.current=null,Y.current=null,ce.current=null,oe.current=null,de.current=is},[]),le=m.useCallback(async()=>{if(ce.current&&oe.current&&T.current)return;O(st=>st==="recording"?st:"arming");const P=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,sampleRate:is,echoCancellation:!1,noiseSuppression:!1,autoGainControl:!1}}),fe=new AudioContext({latencyHint:"interactive"}),Ne=fe.createMediaStreamSource(P),pt=fe.createScriptProcessor(1024,1,1),Ve=fe.createGain();Ve.gain.value=0,pt.onaudioprocess=st=>{if(!ie.current)return;const lt=st.inputBuffer.getChannelData(0);I.current.push(new Float32Array(lt))},Ne.connect(pt),pt.connect(Ve),Ve.connect(fe.destination),ce.current=P,oe.current=fe,$.current=Ne,T.current=pt,Y.current=Ve,de.current=fe.sampleRate||is},[]),me=m.useCallback(async({send:P})=>{const fe=ie.current;if(ie.current=!1,!fe){P||O("idle");return}const Ne=I.current;if(I.current=[],!P){O("idle");return}if(!v){O("idle");return}if(!Ne.length){O("idle");return}O("sending");try{const pt=yw(Ne),Ve=jw(pt,de.current||is),st=jx(Ve);await i?.({roverId:v,name:`ptt-${Date.now()}.wav`,mime:"audio/wav",dataBase64:st}),O("idle")}catch(pt){O("error"),_(pt?.message||"Failed to send PTT clip.")}},[i,v]),se=m.useCallback(async()=>{if(!v){_("Take control of your rover first.");return}await le(),I.current=[],ie.current=!0,O("recording")},[le,v]);return m.useEffect(()=>{let P=!1;async function fe(){if(j){await tt(W.current||v);return}if(!v){await tt(W.current);return}if(!(U.current&&W.current===v)&&!(!k&&!R))try{q("starting"),_(""),U.current=!0,W.current=v,await Je(v),P||q("live")}catch(Ne){P||(q("error"),_(Ne?.message||"Failed to start mic forwarding.")),await tt(v)}}return fe(),()=>{P=!0}},[j,k,R,v,Je,tt]),m.useEffect(()=>{const P=z.current;P&&(P.enabled=!!(!j&&(k||R)))},[j,k,R]),m.useEffect(()=>{let P=!1;async function fe(){if(!j||!v){ie.current&&await me({send:!1}),O("idle");return}try{await le(),!P&&!ie.current&&O("idle")}catch(Ne){P||(O("error"),_(Ne?.message||"Microphone access failed for clip mode."))}}return fe(),()=>{P=!0}},[j,le,me,v]),m.useEffect(()=>{let P=!1;async function fe(){if(j){if(!v){ie.current&&await me({send:!1});return}if(R){if(!ie.current)try{_(""),await se()}catch(Ne){P||(O("error"),_(Ne?.message||"Failed to start clip recording."))}}else ie.current&&await me({send:!0})}}return fe(),()=>{P=!0}},[j,me,R,v,se]),m.useEffect(()=>()=>{tt(W.current||v),vt()},[v,tt,vt]),r.jsx("section",{className:"surface",children:r.jsxs("div",{className:"grid gap-1",children:[r.jsx("p",{className:"text-sm text-slate-100 text-center",children:"Audio Controls"}),r.jsx("section",{className:"surface",children:r.jsxs("div",{className:"flex items-center justify-center gap-0.5 py-0.25 text-xs text-slate-300",children:[r.jsx("span",{children:"Push-to-Talk Key"}),r.jsx(Nx,{label:xe})]})}),r.jsxs("div",{className:"grid gap-0.5 grid-cols-1 lg:grid-cols-2",children:[r.jsx("section",{className:"surface h-full",children:r.jsxs("div",{className:"grid h-full gap-0.5 grid-rows-[auto_auto_1fr]",children:[r.jsx("p",{className:"text-sm text-slate-200 text-center",children:"PTT Mode"}),r.jsx("p",{className:"text-xs text-slate-400 text-center",children:"Choose how holding your PTT key behaves: live mic stream, or record-and-send clip. If the live stream doesn't work, switch to clip mode."}),r.jsxs("div",{className:"grid grid-cols-2 gap-0.5",children:[r.jsx("button",{type:"button",className:`button-dark w-full text-sm ${j?"":"bg-emerald-500 text-white hover:bg-emerald-500"}`,onClick:()=>Be("live"),children:"Live Mic (WHIP)"}),r.jsx("button",{type:"button",className:`button-dark w-full text-sm ${j?"bg-emerald-500 text-white hover:bg-emerald-500":""}`,onClick:()=>Be("clip"),children:"Record Clip"})]})]})}),r.jsx("section",{className:"surface h-full",children:r.jsxs("div",{className:"grid h-full gap-0.5 grid-rows-[auto_1fr]",children:[r.jsx("p",{className:"text-sm text-slate-200 text-center",children:"PTT Clip Status"}),r.jsxs("div",{className:"grid gap-0.5 content-start",children:[r.jsx(xn,{label:"Mode",active:j,detail:j?"record clip":"live mic"}),r.jsx(xn,{label:"PTT hold",active:R,detail:R?"held":"released"}),r.jsx(xn,{label:"Recording",active:ve,detail:ve?"capturing":"idle"}),r.jsx(xn,{label:"Playback",active:j&&ae,detail:j&&ae?"playing":"idle"})]})]})})]}),r.jsxs("div",{className:"grid gap-0.5 grid-cols-1 lg:grid-cols-2",children:[r.jsx("section",{className:"surface h-full",children:r.jsxs("div",{className:"grid h-full gap-0.5 grid-rows-[auto_auto_1fr_auto]",children:[r.jsx("p",{className:"text-sm text-slate-200 text-center",children:"Audio Upload"}),r.jsxs("label",{className:"mx-auto grid w-full max-w-sm gap-0.5 text-xs text-slate-300 text-center",children:[r.jsx("span",{children:"Audio file (mp3 / wav / ogg)"}),r.jsx("input",{className:`${ki} text-center`,type:"file",accept:".mp3,.wav,.ogg,audio/mpeg,audio/wav,audio/ogg",disabled:E||!v,onChange:P=>S(P.target.files?.[0]||null)})]}),r.jsx("div",{className:"mx-auto w-full max-w-sm text-center",children:y?r.jsxs("div",{className:"surface-muted text-xs text-slate-300",children:[y.name," (",y.size," bytes)"]}):r.jsx("div",{className:"surface-muted text-xs text-slate-500",children:"No file selected"})}),r.jsxs("div",{className:"flex justify-center gap-0.5",children:[r.jsx("button",{type:"button",className:"button-dark text-sm",disabled:E||!v,onClick:ze,children:E?"Working...":"Play Upload"}),r.jsx("button",{type:"button",className:"button-dark text-sm",disabled:E||!v,onClick:Ae,children:"Stop"})]})]})}),r.jsx("section",{className:"surface h-full",children:r.jsxs("div",{className:"grid h-full gap-0.5 grid-rows-[auto_auto_1fr]",children:[r.jsx("p",{className:"text-sm text-slate-200 text-center",children:"Live Microphone"}),r.jsxs("label",{className:"surface-muted mx-auto flex w-full max-w-sm items-center justify-center gap-0.5 px-0.5 py-0.5 text-xs text-slate-300",children:[r.jsx("input",{type:"checkbox",checked:k,disabled:!v||j,onChange:P=>g(fe=>({...fe||{},openMicEnabled:!!P.target.checked}))}),r.jsx("span",{children:j?"Open mic (live mode only)":"Open mic"})]}),r.jsxs("div",{className:"grid gap-0.5 content-start",children:[r.jsx(xn,{label:"WHIP link",active:ue,detail:N}),r.jsx(xn,{label:"Mic hot",active:re,detail:re?"transmitting":"muted"}),r.jsxs("div",{className:"surface-muted text-center text-xs text-slate-400",children:["Hold ",r.jsx(Nx,{label:xe})," to talk"]})]})]})})]}),r.jsx("section",{className:"surface",children:r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-sm text-slate-200 text-center",children:"Audio Status"}),r.jsxs("div",{className:"grid gap-0.5 grid-cols-1 sm:grid-cols-2 lg:grid-cols-6",children:[r.jsx(xn,{label:"Forward pipe",active:te,detail:te?"connected":"offline"}),r.jsx(xn,{label:"Upload playback",active:ae,detail:ae?"playing":"idle"}),r.jsx(xn,{label:"Mic relay",active:pe,detail:pe?"active":"idle"}),r.jsx(xn,{label:"WHIP transport",active:ue,detail:N}),r.jsx(xn,{label:"Clip recording",active:ve,detail:ve?"recording":"idle"}),r.jsx(xn,{label:"Clip sending",active:be,detail:be?"sending":"idle"})]}),K?r.jsx("div",{className:"text-xs text-slate-400 text-center",children:K}):null]})})]})})}function Nw({pendingRequestId:n,currentStoredKey:s,nickname:i,requestVerification:o,applyIdentityKey:f,onMessage:d,fullWidth:h=!1}){const[p,x]=m.useState(0),[g,v]=m.useState(""),[y,S]=m.useState(!1),[E,C]=m.useState(!1),k=()=>{x(1),v(s),S(!1),d?.("")},w=()=>{x(0),S(!1)},j=async q=>{if(q.preventDefault(),!y){d?.("Please confirm your nickname agreement before sending.");return}if(p<3){d?.("Complete all request steps before sending.");return}C(!0),d?.("");try{const M=await f(g);await o?.(),v(M),x(0),S(!1),d?.("Verification request sent to lockdown admins.")}catch(M){d?.(M.message||"Failed to submit request.")}finally{C(!1)}},N=h?"w-full":_o;return n?r.jsx("section",{className:`surface text-sm text-slate-300 ${N}`,children:r.jsxs("div",{className:bi,children:["Verification request pending: ",n]})}):p===0?r.jsx("section",{className:`surface ${N}`,children:r.jsxs("div",{className:bi,children:[r.jsx("p",{className:"text-sm text-slate-300",children:"Verification"}),r.jsx("button",{type:"button",className:"button-dark text-sm",onClick:k,disabled:E,children:"Request Verification"})]})}):r.jsx("form",{className:`surface ${N}`,onSubmit:j,children:r.jsxs("div",{className:bi,children:[r.jsx("p",{className:"text-sm text-slate-300",children:"Request verification"}),r.jsxs("p",{className:"text-xs text-slate-500",children:["Step ",p," of 3"]}),p===1?r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-xs text-slate-400",children:"Confirm your nickname, which is used as part of the verification process. You can edit it here before requesting."}),r.jsx("div",{className:"mx-auto w-full max-w-sm",children:r.jsx(To,{compact:!0})}),r.jsxs("div",{className:"surface-muted mx-auto w-full max-w-sm text-xs text-slate-300 text-center",children:["Current nickname: ",r.jsx("span",{className:"font-semibold",children:i||"(not set)"})]}),r.jsxs("label",{className:"flex items-center justify-center gap-0.5 text-xs text-slate-300 text-center",children:[r.jsx("input",{type:"checkbox",className:"accent-emerald-500",checked:y,onChange:q=>S(q.target.checked)}),r.jsx("span",{children:"I understand this nickname is tied to my verification."})]}),r.jsxs("div",{className:"flex justify-center gap-0.5",children:[r.jsx("button",{type:"button",className:"button-dark text-sm",disabled:!i||!y,onClick:()=>x(2),children:"Continue"}),r.jsx("button",{type:"button",className:"button-dark text-sm",onClick:w,children:"Cancel"})]})]}):null,p===2?r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-xs text-slate-400",children:"Save your identity key in a safe place. You can use it to restore your identity in another browser."}),r.jsx("input",{className:ki,type:"password",name:"identity_key_request",autoComplete:"current-password",maxLength:35,value:g,onChange:q=>v(q.target.value.toLowerCase()),placeholder:"Identity key for this request"}),r.jsxs("div",{className:"flex justify-center gap-0.5",children:[r.jsx("button",{type:"button",className:"button-dark text-sm",disabled:!g,onClick:()=>navigator.clipboard?.writeText(g),children:"Copy Key"}),r.jsx("button",{type:"button",className:"button-dark text-sm",disabled:!g,onClick:()=>x(3),children:"Continue"}),r.jsx("button",{type:"button",className:"button-dark text-sm",onClick:()=>x(1),children:"Back"})]})]}):null,p===3?r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-xs text-slate-400",children:"Final step: confirm and send your verification request."}),r.jsx("input",{className:ki,type:"password",name:"identity_key_request_final",autoComplete:"current-password",maxLength:35,value:g,onChange:q=>v(q.target.value.toLowerCase()),placeholder:"Identity key for this request"}),r.jsxs("div",{className:"flex justify-center gap-0.5",children:[r.jsx("button",{type:"submit",className:"button-dark text-sm",disabled:E||!g,children:"Confirm Request"}),r.jsx("button",{type:"button",className:"button-dark text-sm",onClick:()=>x(2),children:"Back"})]})]}):null]})})}function ww({currentStoredKey:n,applyIdentityKey:s,onMessage:i,fullWidth:o=!1}){const[f,d]=m.useState(0),[h,p]=m.useState(""),[x,g]=m.useState(!1),v=()=>{d(1),p(""),i?.("")},y=()=>{d(0),p("")},S=async C=>{if(C.preventDefault(),!(f<2)){g(!0),i?.("");try{await s(h),d(0),p(""),i?.("Identity key restored.")}catch(k){i?.(k.message||"Failed to restore key.")}finally{g(!1)}}},E=o?"w-full":_o;return r.jsx("section",{className:`surface ${E}`,children:r.jsxs("div",{className:bi,children:[r.jsx("p",{className:"text-sm text-slate-300",children:"Identity key"}),r.jsxs("p",{className:"text-xs text-slate-500",children:["Current: ",dw(n)||"not set yet"]}),r.jsx("input",{className:ki,type:"password",name:"identity_key_current",autoComplete:"current-password",maxLength:35,value:n,readOnly:!0,placeholder:"Identity key"}),f===0?r.jsxs("div",{className:"flex justify-center gap-0.5",children:[r.jsx("button",{type:"button",className:"button-dark text-sm",disabled:!n,onClick:()=>navigator.clipboard?.writeText(n),children:"Copy Key"}),r.jsx("button",{type:"button",className:"button-dark text-sm",onClick:v,disabled:x,children:"Restore Key"})]}):null,f===1?r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-xs text-slate-400",children:"Restoring your key should only be done when needed. Use this to move your identity to another browser."}),r.jsxs("div",{className:"flex justify-center gap-0.5",children:[r.jsx("button",{type:"button",className:"button-dark text-sm",onClick:()=>d(2),children:"Continue"}),r.jsx("button",{type:"button",className:"button-dark text-sm",onClick:y,children:"Cancel"})]})]}):null,f===2?r.jsxs("form",{className:"space-y-0.5",onSubmit:S,children:[r.jsx("input",{className:ki,type:"password",name:"identity_key_restore",autoComplete:"current-password",maxLength:35,value:h,onChange:C=>p(C.target.value.toLowerCase()),placeholder:"Paste key to restore"}),r.jsxs("div",{className:"flex justify-center gap-0.5",children:[r.jsx("button",{type:"submit",className:"button-dark text-sm",disabled:x||!h,children:"Confirm Restore"}),r.jsx("button",{type:"button",className:"button-dark text-sm",onClick:()=>d(1),children:"Back"})]})]}):null]})})}function Cw({requestableRovers:n=[],pendingRequests:s=[],requestPrivateRoverAccess:i,onMessage:o,fullWidth:f=!1}){const[d,h]=m.useState({}),p=m.useMemo(()=>{const v=new Map;return(s||[]).forEach(y=>{y?.roverId&&v.set(String(y.roverId),y)}),v},[s]),x=f?"w-full":_o,g=async v=>{if(v){h(y=>({...y,[v]:!0})),o?.("");try{(await i?.(v))?.existing?o?.("You already have a pending request for that rover."):o?.("Private rover access request sent to lockdown admins.")}catch(y){o?.(y.message||"Failed to send request.")}finally{h(y=>({...y,[v]:!1}))}}};return r.jsx("section",{className:`surface text-sm text-slate-300 ${x}`,children:r.jsxs("div",{className:bi,children:[r.jsx("p",{className:"text-sm text-slate-300",children:"Private rover access requests"}),n.length===0?r.jsx("p",{className:"text-xs text-slate-500",children:"No closed private rovers are available to request right now."}):r.jsx("div",{className:"w-full space-y-0.5",children:n.map(v=>{const y=String(v.id),S=!!d[y],E=p.get(y);return r.jsxs("div",{className:"surface-muted flex items-center justify-between gap-0.5 px-1 py-0.5",children:[r.jsxs("div",{className:"min-w-0 text-left",children:[r.jsx("p",{className:"truncate text-xs font-semibold text-slate-100",children:v.name||y}),r.jsx("p",{className:"truncate text-[0.7rem] text-slate-500",children:y})]}),E?r.jsx("span",{className:"rounded bg-amber-700/30 px-1 py-0.5 text-[0.7rem] text-amber-200",children:"Pending"}):r.jsx("button",{type:"button",onClick:()=>g(y),disabled:S,className:"button-dark text-xs disabled:opacity-50",children:S?"Sending...":"Request"})]},y)})})]})})}function Vf(n){return String(n||"").trim()}function Ew(n){const s=Vf(n);return s?s.includes("DOCKINGRUNNING")?"Returning":s.includes("PAUSED")?"Paused":s.includes("HOUSECLEANINGRUNNING")?"Cleaning":s.includes("SPOTCLEANINGRUNNING")?"Spot cleaning":s.includes("STATE_START")?"Starting":s.includes("STATE_IDLE")||s.includes("STATE_STANDBY")?"Idle":s:"--"}function Ig(n){return n==="good"?"bg-emerald-600 text-white":n==="warn"?"bg-amber-500 text-slate-900":n==="danger"?"bg-rose-600 text-white":n==="info"?"bg-sky-600 text-white":"bg-slate-700 text-slate-100"}function rs({label:n,value:s,tone:i="muted",valueClass:o=""}){return r.jsxs("div",{className:`rounded-md px-1 py-0.75 text-center ${Ig(i)}`,children:[r.jsx("div",{className:"text-[0.72rem] opacity-90",children:n}),r.jsx("div",{className:`text-sm font-semibold ${o}`,title:String(s||""),children:s})]})}function kw({neato:n,onStart:s,onSendHome:i,onLocate:o,onClearErrors:f,fullWidth:d=!1}){const[h,p]=m.useState(""),x=d?"w-full":"w-full max-w-xl",g=!!n?.configured,v=!!(n?.enabled&&n?.connected),y=!!n?.telemetry?.extPowerPresent,S=!!n?.telemetry?.chargingActive,E=Ew(n?.telemetry?.uiState),C=n?.telemetry?.batteryPercent,k=Number.isFinite(C)?`${C}%`:"--",w=n?.telemetry?.batteryVoltage,j=Number.isFinite(w)?`${w.toFixed(2)} V`:"--",N=Vf(n?.telemetry?.robotError)||"--",q=Vf(n?.telemetry?.robotAlert)||"--",M=N!=="--"&&!/^no errors$/i.test(N)&&!/^200/.test(N),O=q!=="--"&&!/^200/.test(q),K=n?.controls||{},_=!!K?.start?.available,H=!!K?.sendHome?.available,z=!!K?.locate?.available,V=!!K?.clearErrors?.available,U=m.useMemo(()=>y?{key:"start",label:"Start cleaning",pending:"Starting...",toneClass:"bg-emerald-600 hover:bg-emerald-500 text-white",canRun:_,fn:s}:{key:"home",label:"Send to dock",pending:"Sending...",toneClass:"bg-sky-600 hover:bg-sky-500 text-white",canRun:H,fn:i},[y,_,s,H,i]),W=g&&v&&U.canRun,ce=g&&v&&z,oe=g&&v&&V,$=async(de,R)=>{if(R){p(de);try{await R()}catch{}finally{p("")}}},T=g?v?"Online":"Offline":"Not configured",Y=g?v?"good":"danger":"warn",I=C==null?"muted":C>=60?"good":C>=25?"warn":"danger",ie=y?"Docked":E!=="--"?E:"Away from dock";return r.jsx("section",{className:`surface text-sm text-slate-200 ${x}`,children:r.jsxs("div",{className:"grid gap-0.5",children:[r.jsxs("div",{className:"relative flex items-center justify-center min-h-[1.5rem]",children:[r.jsx("p",{className:"text-sm text-slate-100 text-center",children:"Neato Controls"}),r.jsx("span",{className:`absolute right-0 inline-flex w-auto rounded px-1 py-0.25 text-xs font-semibold ${Ig(Y)}`,children:T})]}),r.jsx("section",{className:"surface-muted px-0.5 py-0.5",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-0.5",children:[r.jsxs("div",{className:"grid gap-0.5",children:[r.jsxs("div",{className:"rounded-md bg-slate-800 px-1 py-0.75 text-center",children:[r.jsx("div",{className:"text-xs text-slate-300",children:"State"}),r.jsx("div",{className:"text-base font-semibold text-slate-100",children:ie})]}),r.jsx("button",{type:"button",disabled:!W||!!h,onClick:()=>$(U.key,U.fn),className:`rounded-md px-1 py-1 text-base font-semibold transition disabled:opacity-50 ${U.toneClass}`,children:h===U.key?U.pending:U.label})]}),r.jsx("button",{type:"button",disabled:!ce||!!h,onClick:()=>$("locate",o),className:"rounded-md bg-fuchsia-600 px-1 py-0.75 text-sm font-semibold text-white transition hover:bg-fuchsia-500 disabled:opacity-50",children:h==="locate"?"Playing...":"Play sound"}),r.jsx("button",{type:"button",disabled:!oe||!!h,onClick:()=>$("clearErrors",f),className:"rounded-md bg-amber-500 px-1 py-0.75 text-sm font-semibold text-slate-900 transition hover:bg-amber-400 disabled:opacity-50",children:h==="clearErrors"?"Clearing...":"Clear errors"})]})}),r.jsx("section",{className:"surface-muted px-0.5 py-0.5",children:r.jsxs("div",{className:"grid gap-0.5 grid-cols-2 sm:grid-cols-3 lg:grid-cols-7",children:[r.jsx(rs,{label:"Battery",value:k,tone:I}),r.jsx(rs,{label:"Voltage",value:j,tone:w==null?"muted":"info"}),r.jsx(rs,{label:"Docked",value:y?"Yes":"No",tone:y?"info":"muted"}),r.jsx(rs,{label:"Charging",value:S?"Yes":"No",tone:S?"info":"muted"}),r.jsx(rs,{label:"UI state",value:E,tone:"muted",valueClass:"truncate"}),r.jsx(rs,{label:"Robot error",value:N,tone:M?"danger":"muted",valueClass:"truncate"}),r.jsx(rs,{label:"Robot alert",value:q,tone:O?"warn":"muted",valueClass:"truncate"})]})}),!g||!v||!U.canRun||!z||!V?r.jsx("p",{className:"text-xs text-slate-400 text-center",children:g?v?"Waiting for required Neato entities in Home Assistant.":"Home Assistant is offline.":"Set homeAssistant.neato.device in server config to enable Neato controls."}):null]})})}function Jg(){const{session:n,identifySession:s,requestVerification:i,requestPrivateRoverAccess:o,playUploadedAudio:f,stopUploadedAudio:d,startMicWhip:h,readyMicWhip:p,stopMicWhip:x,neatoStart:g,neatoSendHome:v,neatoLocate:y,neatoClearErrors:S}=nn(),{value:E,save:C}=He("identity",{cookieUserId:""}),{value:k}=He("profile",{nickname:""}),w=m.useMemo(()=>(E?.cookieUserId||"").trim(),[E?.cookieUserId]),j=(k?.nickname||"").trim(),N=!!n?.isVerified,q=n?.verification?.pendingRequestId||null,M=n?.privateRoverAccess?.requestableRovers||[],O=n?.privateRoverAccess?.pendingRequests||[],K=String(n?.assignment?.roverId||"").trim(),[_,H]=m.useState(""),z=async V=>{const U=String(V||"").trim().toLowerCase();if(!U)throw new Error("Identity key required.");if(!fw.test(U))throw new Error("Identity key must match format: cu_ + 32 lowercase hex chars.");return C(W=>({...W||{},cookieUserId:U})),await s({cookieUserId:U,nickname:j}),U};return r.jsxs("section",{className:"space-y-2 text-base",children:[r.jsxs("div",{className:"grid gap-2 grid-cols-1 lg:grid-cols-[minmax(0,1.25fr)_minmax(0,0.9fr)]",children:[N?null:r.jsx("div",{className:"lg:col-span-2",children:r.jsx(Nw,{pendingRequestId:q,currentStoredKey:w,nickname:j,requestVerification:i,applyIdentityKey:z,onMessage:H,fullWidth:!0})}),r.jsx("div",{className:"lg:col-span-2",children:N?r.jsxs("div",{className:"space-y-2",children:[r.jsx(kw,{neato:n?.neato||null,onStart:g,onSendHome:v,onLocate:y,onClearErrors:S,fullWidth:!0}),r.jsx(Aw,{ownRoverId:K,audioForwardByRover:n?.audioForward||{},playUploadedAudio:f,stopUploadedAudio:d,startMicWhip:h,readyMicWhip:p,stopMicWhip:x})]}):r.jsx("section",{className:"surface h-full",children:r.jsx("div",{className:"flex h-full flex-col items-center justify-center text-center text-xs text-slate-400",children:"Verify your account to unlock VIP controls."})})}),r.jsx("div",{className:"lg:col-span-2",children:r.jsx(Cw,{requestableRovers:M,pendingRequests:O,requestPrivateRoverAccess:o,onMessage:H,fullWidth:!0})}),r.jsx("div",{className:"lg:col-span-2",children:r.jsx(ww,{currentStoredKey:w,applyIdentityKey:z,onMessage:H,fullWidth:!0})})]}),_?r.jsx("div",{className:_o,children:r.jsx("p",{className:"text-xs text-slate-400 text-center",children:_})}):null]})}const Mw=420,Rw=1200,qw={1:262,2:330,3:392,4:523};function jo(){const{session:n}=nn(),s=tn(),{value:i}=He("audio",ct),o=Number.isFinite(i?.masterVolume)?i.masterVolume:ct.masterVolume,f=Number.isFinite(i?.alertVolume)?i.alertVolume:ct.alertVolume,d=Math.max(0,Math.min(1,o*f)),h=m.useMemo(()=>{const k=Array.isArray(n?.buttonBox?.buttons)?n.buttonBox.buttons:[];return k.length===4?k:[1,2,3,4].map(w=>k.find(j=>Number(j?.id)===w)||{id:w,count:0,goal:0,rewardName:null,rewardId:null,rewardNumber:null,lastRewardAt:null})},[n?.buttonBox?.buttons]),[p,x]=m.useState({}),[g,v]=m.useState({}),y=m.useRef(new Map),S=m.useRef(new Map),E=m.useRef({}),C=m.useRef(null);return m.useEffect(()=>{const k={};h.forEach(j=>{k[j.id]=Number(j.lastRewardAt||0)});const w=E.current||{};h.forEach(j=>{const N=Number(j.id),q=k[N]||0,M=Number(w[N]||0);if(q>0&&q!==M){v(_=>({..._,[N]:!0}));const O=S.current.get(N);O&&clearTimeout(O);const K=setTimeout(()=>{v(_=>({..._,[N]:!1})),S.current.delete(N)},Rw);S.current.set(N,K)}}),E.current=k},[h]),m.useEffect(()=>{function k(j){const N=qw[j];if(!N||d<=0)return;let q=C.current;if(!q){const _=window.AudioContext||window.webkitAudioContext;if(!_)return;q=new _,C.current=q}const M=q.createOscillator(),O=q.createGain();M.type="square",M.frequency.value=N;const K=.14*d;O.gain.setValueAtTime(1e-4,q.currentTime),O.gain.exponentialRampToValueAtTime(Math.max(1e-4,K),q.currentTime+.01),O.gain.exponentialRampToValueAtTime(1e-4,q.currentTime+.2),M.connect(O),O.connect(q.destination),M.start(),M.stop(q.currentTime+.21)}function w(j={}){const N=Number(j.buttonId);if(!Number.isFinite(N)||N<1||N>4)return;x(O=>({...O,[N]:!0}));const q=y.current.get(N);q&&clearTimeout(q);const M=setTimeout(()=>{x(O=>({...O,[N]:!1})),y.current.delete(N)},Mw);y.current.set(N,M),k(N)}return s.on("buttonBox:increment",w),()=>{s.off("buttonBox:increment",w)}},[d,s]),r.jsxs("section",{className:"panel-section space-y-0.5 text-base",children:[r.jsx("header",{className:"panel-muted text-center text-sm",children:r.jsx("p",{children:"Button Box"})}),r.jsx("div",{className:"grid grid-cols-4 gap-0.5",children:h.map(k=>{const w=Number(k.id),j=Number.isFinite(k.count)?k.count:0,N=Number.isFinite(k.goal)?k.goal:0,q=typeof k.rewardName=="string"&&k.rewardName.trim()?k.rewardName.trim():"Unassigned",M=Number.isFinite(k.rewardNumber)?k.rewardNumber:"?",O=!!p[w],K=!!g[w];return r.jsx(xg,{buttonId:w,count:j,goal:N,rewardNumber:M,rewardName:q,className:[O?"bg-cyan-900/45":"",K?"bg-fuchsia-900/45":""].filter(Boolean).join(" ")},w)})})]})}function Tw(){const{state:{roverId:n}}=_t(),i=ml(n)?.sensors||{};return r.jsx("section",{className:"panel-section",children:r.jsx("div",{className:"aspect-square w-full",children:r.jsx(Uf,{sensors:i})})})}function Dw(){const{state:{roverId:n,keymap:s,camera:i,horn:o},pipeline:f,actions:{setServoAngle:d,setNightVision:h,startHorn:p,stopHorn:x}}=_t(),g=qg(n),v=g.docked&&!g.driving,y=i?.config,S=!!(n&&i?.enabled&&y),E=!!(n&&f?.nightVision),C=f?.nightVisionState,k=!!(n&&f?.horn),w=o?.overheated,j=typeof y?.minAngle=="number"?y.minAngle:-30,N=typeof y?.maxAngle=="number"?y.maxAngle:30,q=typeof i?.angle=="number"?i.angle:typeof y?.homeAngle=="number"?y.homeAngle:(j+N)/2,M=An(s?.nightVisionToggle?.[0]),O=An(s?.hornHonk?.[0]),K=An(s?.cameraUp?.[0]),_=An(s?.cameraDown?.[0]);return r.jsxs("section",{className:"panel-section grid h-full min-h-0 grid-rows-[minmax(0,1fr)_auto] gap-0.5",children:[r.jsx(Tg,{layout:"desktop",expand:!0,driveDockState:g}),v?null:r.jsxs("div",{className:"surface space-y-0.5 p-0 text-sm text-slate-200",children:[E&&r.jsx(Dg,{nightVisionOn:C?.nightVisionOn,disabled:!n,onToggle:h,keyLabel:M}),k&&r.jsx(_g,{disabled:!n||w,onStart:p,onStop:x,keyLabel:O,active:o?.active,heat:o?.heat}),S&&r.jsx(Bg,{value:q,min:j,max:N,onChange:d,keyDownLabel:_,keyUpLabel:K,className:"space-y-0.5 px-1 py-1",labelRowClass:"text-xs text-slate-300",labelClass:"",valueClass:"font-mono text-slate-100",sliderClass:"w-full",accentClass:"accent-emerald-400",endpointClass:"text-[0.7rem] text-slate-400"})]})]})}function _w({layout:n,onOpenHelpOverlay:s}){const i=ft(E=>E.session),{state:o}=_t(),{value:f}=He("vipAudio",{openMicEnabled:!1,pttMode:"live"}),d=i?.isVerified?"bg-emerald-400":"bg-red-600",h=String(i?.assignment?.roverId||"").trim(),p=h?i?.audioForward?.[h]:null,x=!!o?.mic?.pttActive,g=!!f?.openMicEnabled,v=f?.pttMode==="clip"?"clip":"live",y=!!(h&&i?.isVerified&&(v==="clip"?x:g||x)),S=!!(h&&i?.isVerified&&v==="clip"&&p?.source==="upload"&&p?.state==="playing");return r.jsx("section",{className:"panel text-base",children:r.jsxs(yd,{defaultTab:"telemetry",children:[r.jsxs(Sd,{children:[r.jsx(Wt,{id:"telemetry",children:"Controls"}),r.jsx(Wt,{id:"vip",highlight:S?"green":y?"pink":"none",children:r.jsxs("span",{className:"inline-flex items-center gap-2",children:[r.jsx("span",{children:"VIP"}),r.jsx("span",{className:`inline-block h-3 w-3 rounded-full ${d}`,"aria-hidden":"true",title:i?.isVerified?"Verified":"Not verified"})]})}),r.jsx(Wt,{id:"help",children:"Help"}),r.jsx(Wt,{id:"settings",children:"Settings"})]}),r.jsxs(jd,{children:[r.jsx(en,{id:"telemetry",children:r.jsxs("div",{className:"space-y-0.5",children:[r.jsxs("div",{className:"grid items-stretch gap-0.5 grid-cols-[minmax(0,1.35fr)_minmax(0,0.95fr)]",children:[r.jsx(Tw,{}),r.jsx(Dw,{})]}),r.jsxs("div",{className:"grid gap-0.5 grid-cols-[minmax(0,1fr)_minmax(0,0.9fr)_minmax(0,0.75fr)]",children:[r.jsx(Do,{}),r.jsx(ad,{panelId:"replay-sources-desktop",fillHeight:!0}),r.jsx(sw,{})]}),r.jsxs("div",{className:"grid items-stretch gap-0.5 grid-cols-[minmax(0,1.3fr)_minmax(0,0.22fr)] h-[14rem]",children:[r.jsx(qo,{fillHeight:!0}),r.jsxs("div",{className:"grid min-h-0 gap-0.5 grid-rows-[minmax(0,1fr)_auto]",children:[r.jsx(So,{compact:!0,hideNicknameForm:!0,fillHeight:!0}),r.jsx(aw,{compact:!0})]})]}),r.jsx(Hg,{}),r.jsx(jo,{}),r.jsx(fd,{defaultOrientation:"horizontal",panelId:"rightpane-telemetry"})]})}),r.jsx(en,{id:"vip",keepMounted:!0,children:r.jsx(Jg,{})}),r.jsx(en,{id:"help",children:r.jsx(Kg,{layout:n,onOpenOverlay:s})}),r.jsx(en,{id:"settings",children:r.jsx(Fg,{})})]})]})})}const Bw=new Set(["admin","lockdown","lockdown-admin"]),Ow=new Set(["lockdown","lockdown-admin"]),Lw=new Set(["admin","lockdown"]);function zw(n="admin"){return n==="lockdown"?{title:"Lockdown mode active",description:"Only the server owners can access the interface at this time."}:{title:"Admin mode active"}}function Uw(){const n=ft(S=>S.session),s=n?.mode,i=n?.role,o=n?.adminReason?.text||"";n?.adminReason?.updatedAt;const f=n?.timezone||"UTC",d=n?.socials?.find(S=>String(S?.id||S?.label||"").toLowerCase()==="discord")?.url||n?.discord?.invite||null,h=Lw.has(s),p=s==="lockdown"?Ow.has(i):Bw.has(i),[x,g]=m.useState(()=>new Date),v=m.useMemo(()=>{try{return new Intl.DateTimeFormat("en-US",{timeZone:f,hour:"numeric",minute:"2-digit",second:"2-digit"}).format(x)}catch{return x.toLocaleTimeString()}},[x,f]);if(m.useEffect(()=>{const S=setInterval(()=>g(new Date),1e3);return()=>clearInterval(S)},[]),!h||p)return null;const y=zw(s);return r.jsx("div",{className:"pointer-events-auto fixed inset-0 z-50 flex items-center justify-center bg-black/85 px-0.5 py-0.5",children:r.jsxs("div",{className:"surface w-full max-w-md space-y-0.5 text-slate-100 shadow-2xl",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx("p",{className:"text-lg font-semibold",children:y.title}),r.jsx("p",{className:"text-sm text-slate-300",children:y.description})]}),r.jsxs("div",{className:"surface-muted space-y-0.5",children:[r.jsx("p",{className:"text-[0.7rem] tracking-wide text-slate-400",children:"Reason for locking:"}),r.jsx("p",{className:"text-lg font-semibold text-slate-100",children:o||"No reason set."}),r.jsxs("p",{className:"text-center text-sm text-slate-300",children:["Server time: ",v]})]}),r.jsx("div",{className:"surface-muted",children:r.jsx(Vg,{})}),r.jsx("div",{className:"w-full justify-center items-center",children:r.jsx(pd,{id:"discord",label:"Join our Discord server for updates!",url:d})}),"You can still use the chat while the server is locked:",r.jsxs("div",{className:"max-h-80 overflow-y-auto",children:[r.jsx(qo,{}),r.jsx(To,{})]})]})})}const Hw="/assets/turn_alert-DVO8EZJa.mp3";function Vw(n,s=1){const i=m.useRef(null);return m.useEffect(()=>{i.current=new Audio(n),i.current.volume=s,i.current.load()},[n,s]),()=>{i.current&&(i.current.volume=s,i.current.currentTime=0,i.current.play().catch(()=>{}))}}function $w(){const n=ft(v=>v.session),{pushAlert:s}=wn(),{value:i}=He("audio",ct),o=Number.isFinite(i?.masterVolume)?i.masterVolume:ct.masterVolume,f=Number.isFinite(i?.alertVolume)?i.alertVolume:ct.alertVolume,d=Math.max(0,Math.min(1,o*f)),h=Vw(Hw,d),p=m.useRef(new Set),x=m.useMemo(()=>n?.turnQueues||{},[n?.turnQueues]),g=n?.socketId||null;return m.useEffect(()=>{if(!g)return;const v=[];Object.entries(x).forEach(([y,S])=>{!S||!S.current||S.current!==g||p.current.has(y)||(v.push(y),p.current.add(y))}),Object.keys(x).forEach(y=>{(!x[y]||x[y].current!==g)&&p.current.delete(y)}),v.length!==0&&(v.forEach(y=>{const S=n?.roster?.find(E=>String(E.id)===String(y))?.name||y;s({title:"Your turn!",message:`You now control ${S}.`,color:"#ff5722"})}),h())},[x,h,s,n?.roster,g]),null}function Gw({visible:n,mode:s,onEnterFullscreen:i,onDismiss:o}){if(!n)return null;const f=s==="pwa-hint";return r.jsx("div",{className:"fixed inset-0 z-40 flex items-end justify-center p-2 pointer-events-none sm:items-center",children:r.jsx("div",{className:"pointer-events-auto w-full max-w-sm rounded-lg border border-cyan-500/40 bg-zinc-950/95 shadow-xl",children:r.jsxs("div",{className:"space-y-0.5 p-4 text-sm text-slate-100",children:[r.jsx("h2",{className:"text-base font-semibold text-white",children:"Better in fullscreen"}),f?r.jsxs("p",{className:"text-slate-300",children:["For fullscreen on iOS, open Safari's share menu and pick ",r.jsx("strong",{children:"Add to Home Screen"}),". Launching from the home screen removes the browser chrome."]}):r.jsx("p",{className:"text-slate-300",children:"Enable fullscreen to free up more space for the video feed and controls. You can exit fullscreen at any time via the system back or home gesture."}),r.jsxs("div",{className:"flex justify-end gap-0.5 pt-1 text-sm",children:[r.jsx("button",{type:"button",className:"rounded border border-slate-600 px-3 py-1 text-slate-200",onClick:o,children:f?"Got it":"Not now"}),!f&&r.jsx("button",{type:"button",className:"rounded bg-cyan-500 px-3 py-1 font-semibold text-black hover:bg-cyan-400",onClick:i,children:"Enter fullscreen"})]})]})})})}function Yw({side:n="right",onClick:s}){const i=n==="left"?"left-2":"right-2";return r.jsx("button",{type:"button",onClick:s,className:`fixed bottom-2 ${i} z-30 flex h-10 w-10 items-center justify-center rounded-full border border-cyan-200/50 bg-slate-900/70 text-cyan-100 shadow-lg backdrop-blur-sm transition hover:bg-slate-800/80 active:scale-95`,"aria-label":"Enter fullscreen",title:"Enter fullscreen",children:r.jsx("svg",{viewBox:"0 0 24 24",width:"18",height:"18","aria-hidden":"true",className:"pointer-events-none",children:r.jsx("path",{d:"M4 9V4h5M15 4h5v5M20 15v5h-5M9 20H4v-5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}const Pg="fullscreenPromptDismissed",Fw=new Set(["mobile-portrait","mobile-landscape"]),Wg=()=>{if(typeof window>"u")return null;try{return window.sessionStorage}catch{return null}},Xw=()=>{const n=Wg();if(!n)return!1;try{return n.getItem(Pg)==="1"}catch{return!1}},wx=()=>{const n=Wg();if(n)try{n.setItem(Pg,"1")}catch{}},Qw=()=>{if(typeof navigator>"u")return!1;const n=navigator.userAgent||navigator.platform||"";return/iphone|ipad|ipod/i.test(n)},Cx=()=>{if(typeof document>"u")return!1;const n=document;return!!(n.fullscreenEnabled||n.webkitFullscreenEnabled||n.mozFullScreenEnabled||n.msFullscreenEnabled)};function Kw(n){const s=Fw.has(n),[i,o]=m.useState(!1),[f,d]=m.useState("native"),[h,p]=m.useState(!1),x=m.useMemo(()=>Qw(),[]),g=m.useMemo(()=>Cx(),[]),v=m.useCallback(()=>{if(!s){o(!1),p(!1);return}if(!h&&Xw()){o(!1);return}if(x){d("pwa-hint"),o(!0);return}if(!Cx()){o(!1);return}if(typeof document<"u"&&document.fullscreenElement){o(!1);return}d("native"),o(!0)},[h,x,s]);m.useEffect(()=>{v()},[v]),m.useEffect(()=>{if(typeof document>"u")return;const C=()=>{if(document.fullscreenElement){p(!1),o(!1);return}v()};return document.addEventListener("fullscreenchange",C),document.addEventListener("webkitfullscreenchange",C),()=>{document.removeEventListener("fullscreenchange",C),document.removeEventListener("webkitfullscreenchange",C)}},[v]);const y=m.useCallback(()=>{wx(),p(!1),o(!1)},[]),S=m.useCallback(async()=>{if(!s||x||typeof document>"u")return!1;if(document.fullscreenElement)return!0;const C=document.documentElement;if(!C)return!1;const k=C.requestFullscreen||C.webkitRequestFullscreen||C.mozRequestFullScreen||C.msRequestFullscreen;if(!k)return!1;try{const w=k.call(C);return w&&typeof w.then=="function"&&await w,wx(),p(!1),o(!1),!0}catch(w){return console.warn("Failed to enter fullscreen",w),!1}},[x,s]),E=m.useCallback(()=>{s&&(p(!0),d(x?"pwa-hint":"native"),o(!0))},[x,s]);return m.useEffect(()=>{s||(p(!1),o(!1))},[s]),{visible:i,mode:f,isIOS:x,nativeSupported:g,enterFullscreen:S,dismiss:y,showPrompt:E}}function Zw({visible:n,layout:s,onClose:i,showOnLoad:o,onToggleShowOnLoad:f}){if(!n)return null;const{state:d}=_t(),h=p=>{const x=!p.target.checked;f?.(x)};return r.jsx("div",{className:"fixed inset-0 z-30 flex items-center justify-center bg-black/80 px-0.5 py-0.5",children:r.jsxs("div",{className:"pointer-events-auto surface w-full max-w-4xl max-h-[90vh] overflow-hidden shadow-2xl",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-slate-700 px-0.5 py-0.25 text-sm text-slate-200",children:[r.jsx("span",{className:"font-semibold",children:"Help & controls"}),r.jsxs("div",{className:"flex items-center gap-0.5 text-[0.8rem] text-slate-300",children:[r.jsxs("label",{className:"flex items-center gap-0.5",children:[r.jsx("input",{type:"checkbox",checked:!o,onChange:h,className:"accent-cyan-500"}),r.jsx("span",{children:"Don't show again"})]}),r.jsx("button",{type:"button",onClick:i,className:"button-dark px-2 py-0.25 text-[0.8rem]",children:"Close"})]})]}),r.jsx("div",{className:"max-h-[85vh] overflow-y-auto p-0.5",children:r.jsx(Qg,{layout:s,keymap:d?.keymap||{}})})]})})}const Iw=`aroma bagel batter beans diff --git a/server/public/index.html b/server/public/index.html index 8b812927..613b42a8 100644 --- a/server/public/index.html +++ b/server/public/index.html @@ -11,8 +11,8 @@ Multi Roomba Rover - - + +
diff --git a/webui/src/components/VipPanel.jsx b/webui/src/components/VipPanel.jsx index e3dae188..0c760cc4 100644 --- a/webui/src/components/VipPanel.jsx +++ b/webui/src/components/VipPanel.jsx @@ -50,17 +50,10 @@ export default function VipPanel() { }; return ( -
-
-
- {isVerified ? ( -
-
-

Verification complete

-

VIP controls are unlocked for your assigned rover.

-
-
- ) : ( +
+
+ {!isVerified ? ( +
- )} -
+
+ ) : null}
{isVerified ? ( -
+
-
-
- Push-to-Talk Key - -
-
- -
-
-
-

PTT Mode

-

- Choose how holding your PTT key behaves: live mic stream, or record-and-send clip. If the live stream doesn't work, switch to clip mode. -

-
- - -
+
+
+

Audio Controls

+
+
+ Push-to-Talk Key +
-
-
-

PTT Clip Status

-
- - - - +
+
+
+

PTT Mode

+

+ Choose how holding your PTT key behaves: live mic stream, or record-and-send clip. If the live stream doesn't work, switch to clip mode. +

+
+ + +
+
+ +
+
+

PTT Clip Status

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

Audio Upload

+ + + +
+ {selectedUpload ? ( +
+ {selectedUpload.name} ({selectedUpload.size} bytes) +
+ ) : ( +
No file selected
+ )} +
+ +
+ + +
+
+
+ +
+
+

Live Microphone

+ +
+ + +
Hold to talk
+
+
+
+
+ +
+
+

Audio Status

+
+ + + + + + +
+ {message ?
{message}
: null}
- -
-
-
-

Audio Upload

- - - -
- {selectedUpload ? ( -
- {selectedUpload.name} ({selectedUpload.size} bytes) -
- ) : ( -
No file selected
- )} -
- -
- - -
-
-
- -
-
-

Live Microphone

- -
- - -
Hold to talk
-
-
-
-
- -
-
-

Audio Status

-
- - - - - - -
- {message ?
{message}
: null} -
-
-
+
); }