From ea1aeed1da838125619982c3b79dac7048add25e Mon Sep 17 00:00:00 2001 From: oliver Date: Wed, 4 Nov 2026 14:30:51 -0300 Subject: [PATCH] Prioritize external transcription endpoint over browser Web Speech API Previously the on-device Web Speech API (Chrome/Edge/Safari) was always preferred, and the configured external transcription endpoint was only used as a fallback when the browser had no speech API at all (Firefox). Flip the priority in Composer.tsx: if a transcription endpoint is configured in Settings, use it for dictation regardless of browser support, since it's generally far more accurate. Fall back to the browser's on-device SpeechRecognition only when no endpoint is set. Update the Settings hint text and README to describe the new behavior. Rebuilt and redeployed to the repo root. --- README.md | 7 +++++-- app/src/components/Composer.tsx | 18 +++++++++++------- app/src/components/SettingsPanel.tsx | 5 +++-- .../{index-Cbj_LrNG.js => index-SBr79e_P.js} | 16 ++++++++-------- index.html | 2 +- sw.js | 2 +- 6 files changed, 29 insertions(+), 21 deletions(-) rename assets/{index-Cbj_LrNG.js => index-SBr79e_P.js} (88%) diff --git a/README.md b/README.md index 6895a61..c45c2bb 100644 --- a/README.md +++ b/README.md @@ -176,8 +176,11 @@ git push # or however the server pulls the repo ## Notes & limitations - **Voice is client-side.** The API server has no `/transcribe` or `/tts` - endpoint, so dictation uses the browser's `SpeechRecognition` and replies use - `speechSynthesis`. Support varies by browser (best on Chrome/Edge/Safari). + endpoint. If a transcription endpoint is configured in Settings (any + OpenAI-compatible `/v1/audio/transcriptions` server), it's used for + dictation; otherwise dictation falls back to the browser's on-device + `SpeechRecognition`. Spoken replies always use `speechSynthesis`. Support + varies by browser (best on Chrome/Edge/Safari). - **Profiles.** The API server routes profiles via a `/p//…` prefix, and each profile has its own `API_SERVER_KEY`. Add one connection per profile to see them all; the sidebar switches between connections. diff --git a/app/src/components/Composer.tsx b/app/src/components/Composer.tsx index 96adafb..4c4cd06 100644 --- a/app/src/components/Composer.tsx +++ b/app/src/components/Composer.tsx @@ -45,8 +45,10 @@ export function Composer() { const speech = useSpeechRecognition(); const recorder = useRecorder(); - const serverDictation = !speech.supported && !!transcribeUrl.trim(); - const dictationAvailable = speech.supported || serverDictation; + // Prefer an explicitly-configured external transcription endpoint (usually + // far more accurate) over the browser's on-device Web Speech API. + const serverDictation = !!transcribeUrl.trim(); + const dictationAvailable = serverDictation || speech.supported; const active = speech.listening || recorder.recording; useEffect(() => { @@ -129,6 +131,13 @@ export function Composer() { await stopDictation(); return; } + // External transcription endpoint (if configured) takes priority over the + // browser's on-device Web Speech API, which tends to be lower quality. + if (serverDictation) { + const ok = await recorder.start(); + if (!ok) setToast("Could not access the microphone."); + return; + } if (speech.supported) { if (!window.isSecureContext) { setToast("Dictation needs a secure context (HTTPS or localhost)."); @@ -137,11 +146,6 @@ export function Composer() { speech.start(append); return; } - if (serverDictation) { - const ok = await recorder.start(); - if (!ok) setToast("Could not access the microphone."); - return; - } setToast( "Dictation isn't available in this browser. Use Chrome, Edge, or Safari — or set a transcription endpoint in Settings.", ); diff --git a/app/src/components/SettingsPanel.tsx b/app/src/components/SettingsPanel.tsx index b6d1b14..258e523 100644 --- a/app/src/components/SettingsPanel.tsx +++ b/app/src/components/SettingsPanel.tsx @@ -130,8 +130,9 @@ export function SettingsPanel() {

Dictation

- Chrome, Edge, and Safari dictate on-device via the Web Speech API. Firefox has no speech - API, so set an OpenAI-compatible transcription endpoint below to dictate there. + If a transcription endpoint is set below, it's used for dictation (usually far more + accurate). Otherwise Chrome, Edge, and Safari fall back to on-device dictation via the + Web Speech API — Firefox has no speech API, so it needs an endpoint set here.
diff --git a/assets/index-Cbj_LrNG.js b/assets/index-SBr79e_P.js similarity index 88% rename from assets/index-Cbj_LrNG.js rename to assets/index-SBr79e_P.js index 7f3ecad..6106beb 100644 --- a/assets/index-Cbj_LrNG.js +++ b/assets/index-SBr79e_P.js @@ -14,7 +14,7 @@ var tf=Object.defineProperty;var nf=(e,t,n)=>t in e?tf(e,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var xf=R,Sf=Symbol.for("react.element"),kf=Symbol.for("react.fragment"),jf=Object.prototype.hasOwnProperty,Cf=xf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ef={key:!0,ref:!0,__self:!0,__source:!0};function Au(e,t,n){var r,l={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)jf.call(t,r)&&!Ef.hasOwnProperty(r)&&(l[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)l[r]===void 0&&(l[r]=t[r]);return{$$typeof:Sf,type:e,key:i,ref:o,props:l,_owner:Cf.current}}yl.Fragment=kf;yl.jsx=Au;yl.jsxs=Au;Tu.exports=yl;var u=Tu.exports,Fu={exports:{}},Ce={},Vu={exports:{}},Hu={};/** + */var xf=R,Sf=Symbol.for("react.element"),kf=Symbol.for("react.fragment"),jf=Object.prototype.hasOwnProperty,Cf=xf.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Ef={key:!0,ref:!0,__self:!0,__source:!0};function Fu(e,t,n){var r,l={},i=null,o=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)jf.call(t,r)&&!Ef.hasOwnProperty(r)&&(l[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)l[r]===void 0&&(l[r]=t[r]);return{$$typeof:Sf,type:e,key:i,ref:o,props:l,_owner:Cf.current}}yl.Fragment=kf;yl.jsx=Fu;yl.jsxs=Fu;Tu.exports=yl;var u=Tu.exports,Au={exports:{}},Ce={},Vu={exports:{}},Hu={};/** * @license React * scheduler.production.min.js * @@ -22,7 +22,7 @@ var tf=Object.defineProperty;var nf=(e,t,n)=>t in e?tf(e,t,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(e){function t(E,L){var I=E.length;E.push(L);e:for(;0>>1,ee=E[G];if(0>>1;Gl(Dl,I))Ntl(mr,Dl)?(E[G]=mr,E[Nt]=I,G=Nt):(E[G]=Dl,E[Et]=I,G=Et);else if(Ntl(mr,I))E[G]=mr,E[Nt]=I,G=Nt;else break e}}return L}function l(E,L){var I=E.sortIndex-L.sortIndex;return I!==0?I:E.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var a=[],c=[],p=1,h=null,d=3,y=!1,g=!1,x=!1,z=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(E){for(var L=n(c);L!==null;){if(L.callback===null)r(c);else if(L.startTime<=E)r(c),L.sortIndex=L.expirationTime,t(a,L);else break;L=n(c)}}function w(E){if(x=!1,v(E),!g)if(n(a)!==null)g=!0,U(C);else{var L=n(c);L!==null&&Ae(w,L.startTime-E)}}function C(E,L){g=!1,x&&(x=!1,m(T),T=-1),y=!0;var I=d;try{for(v(L),h=n(a);h!==null&&(!(h.expirationTime>L)||E&&!we());){var G=h.callback;if(typeof G=="function"){h.callback=null,d=h.priorityLevel;var ee=G(h.expirationTime<=L);L=e.unstable_now(),typeof ee=="function"?h.callback=ee:h===n(a)&&r(a),v(L)}else r(a);h=n(a)}if(h!==null)var hr=!0;else{var Et=n(c);Et!==null&&Ae(w,Et.startTime-L),hr=!1}return hr}finally{h=null,d=I,y=!1}}var _=!1,P=null,T=-1,H=5,M=-1;function we(){return!(e.unstable_now()-ME||125G?(E.sortIndex=I,t(c,E),n(a)===null&&E===n(c)&&(x?(m(T),T=-1):x=!0,Ae(w,I-G))):(E.sortIndex=ee,t(a,E),g||y||(g=!0,U(C))),E},e.unstable_shouldYield=we,e.unstable_wrapCallback=function(E){var L=d;return function(){var I=d;d=L;try{return E.apply(this,arguments)}finally{d=I}}}})(Hu);Vu.exports=Hu;var Nf=Vu.exports;/** + */(function(e){function t(E,L){var I=E.length;E.push(L);e:for(;0>>1,ee=E[G];if(0>>1;Gl(Dl,I))Ntl(mr,Dl)?(E[G]=mr,E[Nt]=I,G=Nt):(E[G]=Dl,E[Et]=I,G=Et);else if(Ntl(mr,I))E[G]=mr,E[Nt]=I,G=Nt;else break e}}return L}function l(E,L){var I=E.sortIndex-L.sortIndex;return I!==0?I:E.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var a=[],c=[],p=1,h=null,d=3,y=!1,g=!1,x=!1,z=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,f=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function v(E){for(var L=n(c);L!==null;){if(L.callback===null)r(c);else if(L.startTime<=E)r(c),L.sortIndex=L.expirationTime,t(a,L);else break;L=n(c)}}function w(E){if(x=!1,v(E),!g)if(n(a)!==null)g=!0,U(C);else{var L=n(c);L!==null&&Fe(w,L.startTime-E)}}function C(E,L){g=!1,x&&(x=!1,m(T),T=-1),y=!0;var I=d;try{for(v(L),h=n(a);h!==null&&(!(h.expirationTime>L)||E&&!we());){var G=h.callback;if(typeof G=="function"){h.callback=null,d=h.priorityLevel;var ee=G(h.expirationTime<=L);L=e.unstable_now(),typeof ee=="function"?h.callback=ee:h===n(a)&&r(a),v(L)}else r(a);h=n(a)}if(h!==null)var hr=!0;else{var Et=n(c);Et!==null&&Fe(w,Et.startTime-L),hr=!1}return hr}finally{h=null,d=I,y=!1}}var _=!1,P=null,T=-1,H=5,M=-1;function we(){return!(e.unstable_now()-ME||125G?(E.sortIndex=I,t(c,E),n(a)===null&&E===n(c)&&(x?(m(T),T=-1):x=!0,Fe(w,I-G))):(E.sortIndex=ee,t(a,E),g||y||(g=!0,U(C))),E},e.unstable_shouldYield=we,e.unstable_wrapCallback=function(E){var L=d;return function(){var I=d;d=L;try{return E.apply(this,arguments)}finally{d=I}}}})(Hu);Vu.exports=Hu;var Nf=Vu.exports;/** * @license React * react-dom.production.min.js * @@ -31,13 +31,13 @@ var tf=Object.defineProperty;var nf=(e,t,n)=>t in e?tf(e,t,{enumerable:!0,config * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var _f=R,je=Nf;function S(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),pi=Object.prototype.hasOwnProperty,Pf=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,as={},cs={};function Tf(e){return pi.call(cs,e)?!0:pi.call(as,e)?!1:Pf.test(e)?cs[e]=!0:(as[e]=!0,!1)}function Rf(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Lf(e,t,n,r){if(t===null||typeof t>"u"||Rf(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function pe(e,t,n,r,l,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var ie={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ie[e]=new pe(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ie[t]=new pe(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ie[e]=new pe(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ie[e]=new pe(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ie[e]=new pe(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ie[e]=new pe(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ie[e]=new pe(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ie[e]=new pe(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ie[e]=new pe(e,5,!1,e.toLowerCase(),null,!1,!1)});var co=/[\-:]([a-z])/g;function fo(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(co,fo);ie[t]=new pe(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(co,fo);ie[t]=new pe(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(co,fo);ie[t]=new pe(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ie[e]=new pe(e,1,!1,e.toLowerCase(),null,!1,!1)});ie.xlinkHref=new pe("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ie[e]=new pe(e,1,!1,e.toLowerCase(),null,!0,!0)});function po(e,t,n,r){var l=ie.hasOwnProperty(t)?ie[t]:null;(l!==null?l.type!==0:r||!(2s||l[o]!==i[s]){var a=` -`+l[o].replace(" at new "," at ");return e.displayName&&a.includes("")&&(a=a.replace("",e.displayName)),a}while(1<=o&&0<=s);break}}}finally{Al=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ln(e):""}function zf(e){switch(e.tag){case 5:return Ln(e.type);case 16:return Ln("Lazy");case 13:return Ln("Suspense");case 19:return Ln("SuspenseList");case 0:case 2:case 15:return e=Fl(e.type,!1),e;case 11:return e=Fl(e.type.render,!1),e;case 1:return e=Fl(e.type,!0),e;default:return""}}function gi(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Qt:return"Fragment";case Wt:return"Portal";case hi:return"Profiler";case ho:return"StrictMode";case mi:return"Suspense";case vi:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Qu:return(e.displayName||"Context")+".Consumer";case Wu:return(e._context.displayName||"Context")+".Provider";case mo:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case vo:return t=e.displayName||null,t!==null?t:gi(e.type)||"Memo";case lt:t=e._payload,e=e._init;try{return gi(e(t))}catch{}}return null}function If(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return gi(t);case 8:return t===ho?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function yt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Yu(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Mf(e){var t=Yu(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function yr(e){e._valueTracker||(e._valueTracker=Mf(e))}function Gu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Yu(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Yr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function yi(e,t){var n=t.checked;return K({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ds(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=yt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Xu(e,t){t=t.checked,t!=null&&po(e,"checked",t,!1)}function wi(e,t){Xu(e,t);var n=yt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?xi(e,t.type,n):t.hasOwnProperty("defaultValue")&&xi(e,t.type,yt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ps(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function xi(e,t,n){(t!=="number"||Yr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var zn=Array.isArray;function nn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=wr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Yn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var On={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Of=["Webkit","ms","Moz","O"];Object.keys(On).forEach(function(e){Of.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),On[t]=On[e]})});function bu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||On.hasOwnProperty(e)&&On[e]?(""+t).trim():t+"px"}function ea(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=bu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Df=K({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ji(e,t){if(t){if(Df[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(S(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(S(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(S(61))}if(t.style!=null&&typeof t.style!="object")throw Error(S(62))}}function Ci(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ei=null;function go(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ni=null,rn=null,ln=null;function vs(e){if(e=dr(e)){if(typeof Ni!="function")throw Error(S(280));var t=e.stateNode;t&&(t=jl(t),Ni(e.stateNode,e.type,t))}}function ta(e){rn?ln?ln.push(e):ln=[e]:rn=e}function na(){if(rn){var e=rn,t=ln;if(ln=rn=null,vs(e),t)for(e=0;e>>=0,e===0?32:31-(Yf(e)/Gf|0)|0}var xr=64,Sr=4194304;function In(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Jr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~l;s!==0?r=In(s):(i&=o,i!==0&&(r=In(i)))}else o=n&~l,o!==0?r=In(o):i!==0&&(r=In(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function cr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-De(t),e[t]=n}function qf(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=$n),Es=" ",Ns=!1;function ka(e,t){switch(e){case"keyup":return Nd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ja(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Kt=!1;function Pd(e,t){switch(e){case"compositionend":return ja(t);case"keypress":return t.which!==32?null:(Ns=!0,Es);case"textInput":return e=t.data,e===Es&&Ns?null:e;default:return null}}function Td(e,t){if(Kt)return e==="compositionend"||!Eo&&ka(e,t)?(e=xa(),Ur=ko=ut=null,Kt=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Rs(n)}}function _a(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_a(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Pa(){for(var e=window,t=Yr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Yr(e.document)}return t}function No(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Ud(e){var t=Pa(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&_a(n.ownerDocument.documentElement,n)){if(r!==null&&No(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=Ls(n,i);var o=Ls(n,r);l&&o&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Yt=null,zi=null,An=null,Ii=!1;function zs(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ii||Yt==null||Yt!==Yr(r)||(r=Yt,"selectionStart"in r&&No(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),An&&bn(An,r)||(An=r,r=el(zi,"onSelect"),0Zt||(e.current=Ai[Zt],Ai[Zt]=null,Zt--)}function A(e,t){Zt++,Ai[Zt]=e.current,e.current=t}var wt={},ae=St(wt),ve=St(!1),Dt=wt;function cn(e,t){var n=e.type.contextTypes;if(!n)return wt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function ge(e){return e=e.childContextTypes,e!=null}function nl(){V(ve),V(ae)}function As(e,t,n){if(ae.current!==wt)throw Error(S(168));A(ae,t),A(ve,n)}function $a(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(S(108,If(e)||"Unknown",l));return K({},n,r)}function rl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||wt,Dt=ae.current,A(ae,e),A(ve,ve.current),!0}function Fs(e,t,n){var r=e.stateNode;if(!r)throw Error(S(169));n?(e=$a(e,t,Dt),r.__reactInternalMemoizedMergedChildContext=e,V(ve),V(ae),A(ae,e)):V(ve),A(ve,n)}var Ye=null,Cl=!1,ei=!1;function Ua(e){Ye===null?Ye=[e]:Ye.push(e)}function Zd(e){Cl=!0,Ua(e)}function kt(){if(!ei&&Ye!==null){ei=!0;var e=0,t=$;try{var n=Ye;for($=1;e>=o,l-=o,Ge=1<<32-De(t)+l|n<T?(H=P,P=null):H=P.sibling;var M=d(m,P,v[T],w);if(M===null){P===null&&(P=H);break}e&&P&&M.alternate===null&&t(m,P),f=i(M,f,T),_===null?C=M:_.sibling=M,_=M,P=H}if(T===v.length)return n(m,P),B&&Pt(m,T),C;if(P===null){for(;TT?(H=P,P=null):H=P.sibling;var we=d(m,P,M.value,w);if(we===null){P===null&&(P=H);break}e&&P&&we.alternate===null&&t(m,P),f=i(we,f,T),_===null?C=we:_.sibling=we,_=we,P=H}if(M.done)return n(m,P),B&&Pt(m,T),C;if(P===null){for(;!M.done;T++,M=v.next())M=h(m,M.value,w),M!==null&&(f=i(M,f,T),_===null?C=M:_.sibling=M,_=M);return B&&Pt(m,T),C}for(P=r(m,P);!M.done;T++,M=v.next())M=y(P,m,T,M.value,w),M!==null&&(e&&M.alternate!==null&&P.delete(M.key===null?T:M.key),f=i(M,f,T),_===null?C=M:_.sibling=M,_=M);return e&&P.forEach(function(jt){return t(m,jt)}),B&&Pt(m,T),C}function z(m,f,v,w){if(typeof v=="object"&&v!==null&&v.type===Qt&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case gr:e:{for(var C=v.key,_=f;_!==null;){if(_.key===C){if(C=v.type,C===Qt){if(_.tag===7){n(m,_.sibling),f=l(_,v.props.children),f.return=m,m=f;break e}}else if(_.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===lt&&Bs(C)===_.type){n(m,_.sibling),f=l(_,v.props),f.ref=_n(m,_,v),f.return=m,m=f;break e}n(m,_);break}else t(m,_);_=_.sibling}v.type===Qt?(f=Ot(v.props.children,m.mode,w,v.key),f.return=m,m=f):(w=Kr(v.type,v.key,v.props,null,m.mode,w),w.ref=_n(m,f,v),w.return=m,m=w)}return o(m);case Wt:e:{for(_=v.key;f!==null;){if(f.key===_)if(f.tag===4&&f.stateNode.containerInfo===v.containerInfo&&f.stateNode.implementation===v.implementation){n(m,f.sibling),f=l(f,v.children||[]),f.return=m,m=f;break e}else{n(m,f);break}else t(m,f);f=f.sibling}f=ui(v,m.mode,w),f.return=m,m=f}return o(m);case lt:return _=v._init,z(m,f,_(v._payload),w)}if(zn(v))return g(m,f,v,w);if(kn(v))return x(m,f,v,w);Pr(m,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,f!==null&&f.tag===6?(n(m,f.sibling),f=l(f,v),f.return=m,m=f):(n(m,f),f=si(v,m.mode,w),f.return=m,m=f),o(m)):n(m,f)}return z}var dn=Ha(!0),Ba=Ha(!1),ol=St(null),sl=null,bt=null,Ro=null;function Lo(){Ro=bt=sl=null}function zo(e){var t=ol.current;V(ol),e._currentValue=t}function Hi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function sn(e,t){sl=e,Ro=bt=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(me=!0),e.firstContext=null)}function Re(e){var t=e._currentValue;if(Ro!==e)if(e={context:e,memoizedValue:t,next:null},bt===null){if(sl===null)throw Error(S(308));bt=e,sl.dependencies={lanes:0,firstContext:e}}else bt=bt.next=e;return t}var zt=null;function Io(e){zt===null?zt=[e]:zt.push(e)}function Wa(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Io(t)):(n.next=l.next,l.next=n),t.interleaved=n,be(e,r)}function be(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var it=!1;function Mo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Qa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ze(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ht(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,D&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,be(e,n)}return l=r.interleaved,l===null?(t.next=t,Io(r)):(t.next=l.next,l.next=t),r.interleaved=t,be(e,n)}function Fr(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,wo(e,n)}}function Ws(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function ul(e,t,n,r){var l=e.updateQueue;it=!1;var i=l.firstBaseUpdate,o=l.lastBaseUpdate,s=l.shared.pending;if(s!==null){l.shared.pending=null;var a=s,c=a.next;a.next=null,o===null?i=c:o.next=c,o=a;var p=e.alternate;p!==null&&(p=p.updateQueue,s=p.lastBaseUpdate,s!==o&&(s===null?p.firstBaseUpdate=c:s.next=c,p.lastBaseUpdate=a))}if(i!==null){var h=l.baseState;o=0,p=c=a=null,s=i;do{var d=s.lane,y=s.eventTime;if((r&d)===d){p!==null&&(p=p.next={eventTime:y,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var g=e,x=s;switch(d=t,y=n,x.tag){case 1:if(g=x.payload,typeof g=="function"){h=g.call(y,h,d);break e}h=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=x.payload,d=typeof g=="function"?g.call(y,h,d):g,d==null)break e;h=K({},h,d);break e;case 2:it=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,d=l.effects,d===null?l.effects=[s]:d.push(s))}else y={eventTime:y,lane:d,tag:s.tag,payload:s.payload,callback:s.callback,next:null},p===null?(c=p=y,a=h):p=p.next=y,o|=d;if(s=s.next,s===null){if(s=l.shared.pending,s===null)break;d=s,s=d.next,d.next=null,l.lastBaseUpdate=d,l.shared.pending=null}}while(!0);if(p===null&&(a=h),l.baseState=a,l.firstBaseUpdate=c,l.lastBaseUpdate=p,t=l.shared.interleaved,t!==null){l=t;do o|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);At|=o,e.lanes=o,e.memoizedState=h}}function Qs(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=ni.transition;ni.transition={};try{e(!1),t()}finally{$=n,ni.transition=r}}function uc(){return Le().memoizedState}function ep(e,t,n){var r=vt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ac(e))cc(t,n);else if(n=Wa(e,t,n,r),n!==null){var l=fe();$e(n,e,r,l),fc(n,t,r)}}function tp(e,t,n){var r=vt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ac(e))cc(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,s=i(o,n);if(l.hasEagerState=!0,l.eagerState=s,Ue(s,o)){var a=t.interleaved;a===null?(l.next=l,Io(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=Wa(e,t,l,r),n!==null&&(l=fe(),$e(n,e,r,l),fc(n,t,r))}}function ac(e){var t=e.alternate;return e===Q||t!==null&&t===Q}function cc(e,t){Fn=cl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function fc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,wo(e,n)}}var fl={readContext:Re,useCallback:oe,useContext:oe,useEffect:oe,useImperativeHandle:oe,useInsertionEffect:oe,useLayoutEffect:oe,useMemo:oe,useReducer:oe,useRef:oe,useState:oe,useDebugValue:oe,useDeferredValue:oe,useTransition:oe,useMutableSource:oe,useSyncExternalStore:oe,useId:oe,unstable_isNewReconciler:!1},np={readContext:Re,useCallback:function(e,t){return He().memoizedState=[e,t===void 0?null:t],e},useContext:Re,useEffect:Ys,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Hr(4194308,4,rc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Hr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Hr(4,2,e,t)},useMemo:function(e,t){var n=He();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=He();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ep.bind(null,Q,e),[r.memoizedState,e]},useRef:function(e){var t=He();return e={current:e},t.memoizedState=e},useState:Ks,useDebugValue:Ho,useDeferredValue:function(e){return He().memoizedState=e},useTransition:function(){var e=Ks(!1),t=e[0];return e=bd.bind(null,e[1]),He().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Q,l=He();if(B){if(n===void 0)throw Error(S(407));n=n()}else{if(n=t(),ne===null)throw Error(S(349));Ut&30||Xa(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Ys(Ja.bind(null,r,i,e),[e]),r.flags|=2048,sr(9,Za.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=He(),t=ne.identifierPrefix;if(B){var n=Xe,r=Ge;n=(r&~(1<<32-De(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ir++,0")&&(a=a.replace("",e.displayName)),a}while(1<=o&&0<=s);break}}}finally{Fl=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ln(e):""}function zf(e){switch(e.tag){case 5:return Ln(e.type);case 16:return Ln("Lazy");case 13:return Ln("Suspense");case 19:return Ln("SuspenseList");case 0:case 2:case 15:return e=Al(e.type,!1),e;case 11:return e=Al(e.type.render,!1),e;case 1:return e=Al(e.type,!0),e;default:return""}}function gi(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Qt:return"Fragment";case Wt:return"Portal";case hi:return"Profiler";case ho:return"StrictMode";case mi:return"Suspense";case vi:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Qu:return(e.displayName||"Context")+".Consumer";case Wu:return(e._context.displayName||"Context")+".Provider";case mo:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case vo:return t=e.displayName||null,t!==null?t:gi(e.type)||"Memo";case lt:t=e._payload,e=e._init;try{return gi(e(t))}catch{}}return null}function If(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return gi(t);case 8:return t===ho?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function yt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Yu(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Mf(e){var t=Yu(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function yr(e){e._valueTracker||(e._valueTracker=Mf(e))}function Gu(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Yu(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Yr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function yi(e,t){var n=t.checked;return K({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ds(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=yt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Xu(e,t){t=t.checked,t!=null&&po(e,"checked",t,!1)}function wi(e,t){Xu(e,t);var n=yt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?xi(e,t.type,n):t.hasOwnProperty("defaultValue")&&xi(e,t.type,yt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ps(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function xi(e,t,n){(t!=="number"||Yr(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var zn=Array.isArray;function nn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=wr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Yn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var On={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Of=["Webkit","ms","Moz","O"];Object.keys(On).forEach(function(e){Of.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),On[t]=On[e]})});function bu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||On.hasOwnProperty(e)&&On[e]?(""+t).trim():t+"px"}function ea(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=bu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Df=K({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ji(e,t){if(t){if(Df[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(S(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(S(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(S(61))}if(t.style!=null&&typeof t.style!="object")throw Error(S(62))}}function Ci(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Ei=null;function go(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ni=null,rn=null,ln=null;function vs(e){if(e=dr(e)){if(typeof Ni!="function")throw Error(S(280));var t=e.stateNode;t&&(t=jl(t),Ni(e.stateNode,e.type,t))}}function ta(e){rn?ln?ln.push(e):ln=[e]:rn=e}function na(){if(rn){var e=rn,t=ln;if(ln=rn=null,vs(e),t)for(e=0;e>>=0,e===0?32:31-(Yf(e)/Gf|0)|0}var xr=64,Sr=4194304;function In(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Jr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~l;s!==0?r=In(s):(i&=o,i!==0&&(r=In(i)))}else o=n&~l,o!==0?r=In(o):i!==0&&(r=In(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&l)&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function cr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-De(t),e[t]=n}function qf(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=$n),Es=" ",Ns=!1;function ka(e,t){switch(e){case"keyup":return Nd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ja(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Kt=!1;function Pd(e,t){switch(e){case"compositionend":return ja(t);case"keypress":return t.which!==32?null:(Ns=!0,Es);case"textInput":return e=t.data,e===Es&&Ns?null:e;default:return null}}function Td(e,t){if(Kt)return e==="compositionend"||!Eo&&ka(e,t)?(e=xa(),Ur=ko=ut=null,Kt=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Rs(n)}}function _a(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?_a(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Pa(){for(var e=window,t=Yr();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Yr(e.document)}return t}function No(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Ud(e){var t=Pa(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&_a(n.ownerDocument.documentElement,n)){if(r!==null&&No(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var l=n.textContent.length,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=Ls(n,i);var o=Ls(n,r);l&&o&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Yt=null,zi=null,Fn=null,Ii=!1;function zs(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Ii||Yt==null||Yt!==Yr(r)||(r=Yt,"selectionStart"in r&&No(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Fn&&bn(Fn,r)||(Fn=r,r=el(zi,"onSelect"),0Zt||(e.current=Fi[Zt],Fi[Zt]=null,Zt--)}function F(e,t){Zt++,Fi[Zt]=e.current,e.current=t}var wt={},ae=St(wt),ve=St(!1),Dt=wt;function cn(e,t){var n=e.type.contextTypes;if(!n)return wt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function ge(e){return e=e.childContextTypes,e!=null}function nl(){V(ve),V(ae)}function Fs(e,t,n){if(ae.current!==wt)throw Error(S(168));F(ae,t),F(ve,n)}function $a(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(S(108,If(e)||"Unknown",l));return K({},n,r)}function rl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||wt,Dt=ae.current,F(ae,e),F(ve,ve.current),!0}function As(e,t,n){var r=e.stateNode;if(!r)throw Error(S(169));n?(e=$a(e,t,Dt),r.__reactInternalMemoizedMergedChildContext=e,V(ve),V(ae),F(ae,e)):V(ve),F(ve,n)}var Ye=null,Cl=!1,ei=!1;function Ua(e){Ye===null?Ye=[e]:Ye.push(e)}function Zd(e){Cl=!0,Ua(e)}function kt(){if(!ei&&Ye!==null){ei=!0;var e=0,t=$;try{var n=Ye;for($=1;e>=o,l-=o,Ge=1<<32-De(t)+l|n<T?(H=P,P=null):H=P.sibling;var M=d(m,P,v[T],w);if(M===null){P===null&&(P=H);break}e&&P&&M.alternate===null&&t(m,P),f=i(M,f,T),_===null?C=M:_.sibling=M,_=M,P=H}if(T===v.length)return n(m,P),B&&Pt(m,T),C;if(P===null){for(;TT?(H=P,P=null):H=P.sibling;var we=d(m,P,M.value,w);if(we===null){P===null&&(P=H);break}e&&P&&we.alternate===null&&t(m,P),f=i(we,f,T),_===null?C=we:_.sibling=we,_=we,P=H}if(M.done)return n(m,P),B&&Pt(m,T),C;if(P===null){for(;!M.done;T++,M=v.next())M=h(m,M.value,w),M!==null&&(f=i(M,f,T),_===null?C=M:_.sibling=M,_=M);return B&&Pt(m,T),C}for(P=r(m,P);!M.done;T++,M=v.next())M=y(P,m,T,M.value,w),M!==null&&(e&&M.alternate!==null&&P.delete(M.key===null?T:M.key),f=i(M,f,T),_===null?C=M:_.sibling=M,_=M);return e&&P.forEach(function(jt){return t(m,jt)}),B&&Pt(m,T),C}function z(m,f,v,w){if(typeof v=="object"&&v!==null&&v.type===Qt&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case gr:e:{for(var C=v.key,_=f;_!==null;){if(_.key===C){if(C=v.type,C===Qt){if(_.tag===7){n(m,_.sibling),f=l(_,v.props.children),f.return=m,m=f;break e}}else if(_.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===lt&&Bs(C)===_.type){n(m,_.sibling),f=l(_,v.props),f.ref=_n(m,_,v),f.return=m,m=f;break e}n(m,_);break}else t(m,_);_=_.sibling}v.type===Qt?(f=Ot(v.props.children,m.mode,w,v.key),f.return=m,m=f):(w=Kr(v.type,v.key,v.props,null,m.mode,w),w.ref=_n(m,f,v),w.return=m,m=w)}return o(m);case Wt:e:{for(_=v.key;f!==null;){if(f.key===_)if(f.tag===4&&f.stateNode.containerInfo===v.containerInfo&&f.stateNode.implementation===v.implementation){n(m,f.sibling),f=l(f,v.children||[]),f.return=m,m=f;break e}else{n(m,f);break}else t(m,f);f=f.sibling}f=ui(v,m.mode,w),f.return=m,m=f}return o(m);case lt:return _=v._init,z(m,f,_(v._payload),w)}if(zn(v))return g(m,f,v,w);if(kn(v))return x(m,f,v,w);Pr(m,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,f!==null&&f.tag===6?(n(m,f.sibling),f=l(f,v),f.return=m,m=f):(n(m,f),f=si(v,m.mode,w),f.return=m,m=f),o(m)):n(m,f)}return z}var dn=Ha(!0),Ba=Ha(!1),ol=St(null),sl=null,bt=null,Ro=null;function Lo(){Ro=bt=sl=null}function zo(e){var t=ol.current;V(ol),e._currentValue=t}function Hi(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function sn(e,t){sl=e,Ro=bt=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(me=!0),e.firstContext=null)}function Re(e){var t=e._currentValue;if(Ro!==e)if(e={context:e,memoizedValue:t,next:null},bt===null){if(sl===null)throw Error(S(308));bt=e,sl.dependencies={lanes:0,firstContext:e}}else bt=bt.next=e;return t}var zt=null;function Io(e){zt===null?zt=[e]:zt.push(e)}function Wa(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,Io(t)):(n.next=l.next,l.next=n),t.interleaved=n,be(e,r)}function be(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var it=!1;function Mo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Qa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Ze(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ht(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,D&2){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,be(e,n)}return l=r.interleaved,l===null?(t.next=t,Io(r)):(t.next=l.next,l.next=t),r.interleaved=t,be(e,n)}function Ar(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,wo(e,n)}}function Ws(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?l=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function ul(e,t,n,r){var l=e.updateQueue;it=!1;var i=l.firstBaseUpdate,o=l.lastBaseUpdate,s=l.shared.pending;if(s!==null){l.shared.pending=null;var a=s,c=a.next;a.next=null,o===null?i=c:o.next=c,o=a;var p=e.alternate;p!==null&&(p=p.updateQueue,s=p.lastBaseUpdate,s!==o&&(s===null?p.firstBaseUpdate=c:s.next=c,p.lastBaseUpdate=a))}if(i!==null){var h=l.baseState;o=0,p=c=a=null,s=i;do{var d=s.lane,y=s.eventTime;if((r&d)===d){p!==null&&(p=p.next={eventTime:y,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});e:{var g=e,x=s;switch(d=t,y=n,x.tag){case 1:if(g=x.payload,typeof g=="function"){h=g.call(y,h,d);break e}h=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=x.payload,d=typeof g=="function"?g.call(y,h,d):g,d==null)break e;h=K({},h,d);break e;case 2:it=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,d=l.effects,d===null?l.effects=[s]:d.push(s))}else y={eventTime:y,lane:d,tag:s.tag,payload:s.payload,callback:s.callback,next:null},p===null?(c=p=y,a=h):p=p.next=y,o|=d;if(s=s.next,s===null){if(s=l.shared.pending,s===null)break;d=s,s=d.next,d.next=null,l.lastBaseUpdate=d,l.shared.pending=null}}while(!0);if(p===null&&(a=h),l.baseState=a,l.firstBaseUpdate=c,l.lastBaseUpdate=p,t=l.shared.interleaved,t!==null){l=t;do o|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);Ft|=o,e.lanes=o,e.memoizedState=h}}function Qs(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=ni.transition;ni.transition={};try{e(!1),t()}finally{$=n,ni.transition=r}}function uc(){return Le().memoizedState}function ep(e,t,n){var r=vt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ac(e))cc(t,n);else if(n=Wa(e,t,n,r),n!==null){var l=fe();$e(n,e,r,l),fc(n,t,r)}}function tp(e,t,n){var r=vt(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ac(e))cc(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,s=i(o,n);if(l.hasEagerState=!0,l.eagerState=s,Ue(s,o)){var a=t.interleaved;a===null?(l.next=l,Io(t)):(l.next=a.next,a.next=l),t.interleaved=l;return}}catch{}finally{}n=Wa(e,t,l,r),n!==null&&(l=fe(),$e(n,e,r,l),fc(n,t,r))}}function ac(e){var t=e.alternate;return e===Q||t!==null&&t===Q}function cc(e,t){An=cl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function fc(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,wo(e,n)}}var fl={readContext:Re,useCallback:oe,useContext:oe,useEffect:oe,useImperativeHandle:oe,useInsertionEffect:oe,useLayoutEffect:oe,useMemo:oe,useReducer:oe,useRef:oe,useState:oe,useDebugValue:oe,useDeferredValue:oe,useTransition:oe,useMutableSource:oe,useSyncExternalStore:oe,useId:oe,unstable_isNewReconciler:!1},np={readContext:Re,useCallback:function(e,t){return He().memoizedState=[e,t===void 0?null:t],e},useContext:Re,useEffect:Ys,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Hr(4194308,4,rc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Hr(4194308,4,e,t)},useInsertionEffect:function(e,t){return Hr(4,2,e,t)},useMemo:function(e,t){var n=He();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=He();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ep.bind(null,Q,e),[r.memoizedState,e]},useRef:function(e){var t=He();return e={current:e},t.memoizedState=e},useState:Ks,useDebugValue:Ho,useDeferredValue:function(e){return He().memoizedState=e},useTransition:function(){var e=Ks(!1),t=e[0];return e=bd.bind(null,e[1]),He().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Q,l=He();if(B){if(n===void 0)throw Error(S(407));n=n()}else{if(n=t(),ne===null)throw Error(S(349));Ut&30||Xa(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,Ys(Ja.bind(null,r,i,e),[e]),r.flags|=2048,sr(9,Za.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=He(),t=ne.identifierPrefix;if(B){var n=Xe,r=Ge;n=(r&~(1<<32-De(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ir++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Be]=t,e[nr]=r,Sc(e,t,!1,!1),t.stateNode=e;e:{switch(o=Ci(n,r),n){case"dialog":F("cancel",e),F("close",e),l=r;break;case"iframe":case"object":case"embed":F("load",e),l=r;break;case"video":case"audio":for(l=0;lmn&&(t.flags|=128,r=!0,Pn(i,!1),t.lanes=4194304)}else{if(!r)if(e=al(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Pn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!B)return se(t),null}else 2*X()-i.renderingStartTime>mn&&n!==1073741824&&(t.flags|=128,r=!0,Pn(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=X(),t.sibling=null,n=W.current,A(W,r?n&1|2:n&1),t):(se(t),null);case 22:case 23:return Go(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?xe&1073741824&&(se(t),t.subtreeFlags&6&&(t.flags|=8192)):se(t),null;case 24:return null;case 25:return null}throw Error(S(156,t.tag))}function cp(e,t){switch(Po(t),t.tag){case 1:return ge(t.type)&&nl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return pn(),V(ve),V(ae),$o(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Do(t),null;case 13:if(V(W),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(S(340));fn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(W),null;case 4:return pn(),null;case 10:return zo(t.type._context),null;case 22:case 23:return Go(),null;case 24:return null;default:return null}}var Rr=!1,ue=!1,fp=typeof WeakSet=="function"?WeakSet:Set,N=null;function en(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Y(e,t,r)}else n.current=null}function Ji(e,t,n){try{n()}catch(r){Y(e,t,r)}}var lu=!1;function dp(e,t){if(Mi=qr,e=Pa(),No(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,s=-1,a=-1,c=0,p=0,h=e,d=null;t:for(;;){for(var y;h!==n||l!==0&&h.nodeType!==3||(s=o+l),h!==i||r!==0&&h.nodeType!==3||(a=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(y=h.firstChild)!==null;)d=h,h=y;for(;;){if(h===e)break t;if(d===n&&++c===l&&(s=o),d===i&&++p===r&&(a=o),(y=h.nextSibling)!==null)break;h=d,d=h.parentNode}h=y}n=s===-1||a===-1?null:{start:s,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Oi={focusedElem:e,selectionRange:n},qr=!1,N=t;N!==null;)if(t=N,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,N=e;else for(;N!==null;){t=N;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var x=g.memoizedProps,z=g.memoizedState,m=t.stateNode,f=m.getSnapshotBeforeUpdate(t.elementType===t.type?x:Ie(t.type,x),z);m.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(S(163))}}catch(w){Y(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,N=e;break}N=t.return}return g=lu,lu=!1,g}function Vn(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&Ji(t,n,i)}l=l.next}while(l!==r)}}function _l(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function qi(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Cc(e){var t=e.alternate;t!==null&&(e.alternate=null,Cc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Be],delete t[nr],delete t[Ui],delete t[Gd],delete t[Xd])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ec(e){return e.tag===5||e.tag===3||e.tag===4}function iu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ec(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function bi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=tl));else if(r!==4&&(e=e.child,e!==null))for(bi(e,t,n),e=e.sibling;e!==null;)bi(e,t,n),e=e.sibling}function eo(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(eo(e,t,n),e=e.sibling;e!==null;)eo(e,t,n),e=e.sibling}var re=null,Me=!1;function nt(e,t,n){for(n=n.child;n!==null;)Nc(e,t,n),n=n.sibling}function Nc(e,t,n){if(We&&typeof We.onCommitFiberUnmount=="function")try{We.onCommitFiberUnmount(wl,n)}catch{}switch(n.tag){case 5:ue||en(n,t);case 6:var r=re,l=Me;re=null,nt(e,t,n),re=r,Me=l,re!==null&&(Me?(e=re,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):re.removeChild(n.stateNode));break;case 18:re!==null&&(Me?(e=re,n=n.stateNode,e.nodeType===8?bl(e.parentNode,n):e.nodeType===1&&bl(e,n),Jn(e)):bl(re,n.stateNode));break;case 4:r=re,l=Me,re=n.stateNode.containerInfo,Me=!0,nt(e,t,n),re=r,Me=l;break;case 0:case 11:case 14:case 15:if(!ue&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Ji(n,t,o),l=l.next}while(l!==r)}nt(e,t,n);break;case 1:if(!ue&&(en(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){Y(n,t,s)}nt(e,t,n);break;case 21:nt(e,t,n);break;case 22:n.mode&1?(ue=(r=ue)||n.memoizedState!==null,nt(e,t,n),ue=r):nt(e,t,n);break;default:nt(e,t,n)}}function ou(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new fp),t.forEach(function(r){var l=Sp.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function ze(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=o),r&=~i}if(r=l,r=X()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*hp(r/1960))-r,10e?16:e,at===null)var r=!1;else{if(e=at,at=null,hl=0,D&6)throw Error(S(331));var l=D;for(D|=4,N=e.current;N!==null;){var i=N,o=i.child;if(N.flags&16){var s=i.deletions;if(s!==null){for(var a=0;aX()-Ko?Mt(e,0):Qo|=n),ye(e,t)}function Mc(e,t){t===0&&(e.mode&1?(t=Sr,Sr<<=1,!(Sr&130023424)&&(Sr=4194304)):t=1);var n=fe();e=be(e,t),e!==null&&(cr(e,t,n),ye(e,n))}function xp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Mc(e,n)}function Sp(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(S(314))}r!==null&&r.delete(t),Mc(e,n)}var Oc;Oc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ve.current)me=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return me=!1,up(e,t,n);me=!!(e.flags&131072)}else me=!1,B&&t.flags&1048576&&Aa(t,il,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Br(e,t),e=t.pendingProps;var l=cn(t,ae.current);sn(t,n),l=Ao(null,t,r,e,l,n);var i=Fo();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ge(r)?(i=!0,rl(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Mo(t),l.updater=Nl,t.stateNode=l,l._reactInternals=t,Wi(t,r,e,n),t=Yi(null,t,r,!0,i,n)):(t.tag=0,B&&i&&_o(t),ce(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Br(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=jp(r),e=Ie(r,e),l){case 0:t=Ki(null,t,r,e,n);break e;case 1:t=tu(null,t,r,e,n);break e;case 11:t=bs(null,t,r,e,n);break e;case 14:t=eu(null,t,r,Ie(r.type,e),n);break e}throw Error(S(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ie(r,l),Ki(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ie(r,l),tu(e,t,r,l,n);case 3:e:{if(yc(t),e===null)throw Error(S(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Qa(e,t),ul(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=hn(Error(S(423)),t),t=nu(e,t,r,n,l);break e}else if(r!==l){l=hn(Error(S(424)),t),t=nu(e,t,r,n,l);break e}else for(Se=pt(t.stateNode.containerInfo.firstChild),ke=t,B=!0,Oe=null,n=Ba(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(fn(),r===l){t=et(e,t,n);break e}ce(e,t,r,n)}t=t.child}return t;case 5:return Ka(t),e===null&&Vi(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,o=l.children,Di(r,l)?o=null:i!==null&&Di(r,i)&&(t.flags|=32),gc(e,t),ce(e,t,o,n),t.child;case 6:return e===null&&Vi(t),null;case 13:return wc(e,t,n);case 4:return Oo(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=dn(t,null,r,n):ce(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ie(r,l),bs(e,t,r,l,n);case 7:return ce(e,t,t.pendingProps,n),t.child;case 8:return ce(e,t,t.pendingProps.children,n),t.child;case 12:return ce(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,o=l.value,A(ol,r._currentValue),r._currentValue=o,i!==null)if(Ue(i.value,o)){if(i.children===l.children&&!ve.current){t=et(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var s=i.dependencies;if(s!==null){o=i.child;for(var a=s.firstContext;a!==null;){if(a.context===r){if(i.tag===1){a=Ze(-1,n&-n),a.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var p=c.pending;p===null?a.next=a:(a.next=p.next,p.next=a),c.pending=a}}i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Hi(i.return,n,t),s.lanes|=n;break}a=a.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(S(341));o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),Hi(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}ce(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,sn(t,n),l=Re(l),r=r(l),t.flags|=1,ce(e,t,r,n),t.child;case 14:return r=t.type,l=Ie(r,t.pendingProps),l=Ie(r.type,l),eu(e,t,r,l,n);case 15:return mc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ie(r,l),Br(e,t),t.tag=1,ge(r)?(e=!0,rl(t)):e=!1,sn(t,n),dc(t,r,l),Wi(t,r,l,n),Yi(null,t,r,!0,e,n);case 19:return xc(e,t,n);case 22:return vc(e,t,n)}throw Error(S(156,t.tag))};function Dc(e,t){return aa(e,t)}function kp(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pe(e,t,n,r){return new kp(e,t,n,r)}function Zo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function jp(e){if(typeof e=="function")return Zo(e)?1:0;if(e!=null){if(e=e.$$typeof,e===mo)return 11;if(e===vo)return 14}return 2}function gt(e,t){var n=e.alternate;return n===null?(n=Pe(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Kr(e,t,n,r,l,i){var o=2;if(r=e,typeof e=="function")Zo(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Qt:return Ot(n.children,l,i,t);case ho:o=8,l|=8;break;case hi:return e=Pe(12,n,t,l|2),e.elementType=hi,e.lanes=i,e;case mi:return e=Pe(13,n,t,l),e.elementType=mi,e.lanes=i,e;case vi:return e=Pe(19,n,t,l),e.elementType=vi,e.lanes=i,e;case Ku:return Tl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Wu:o=10;break e;case Qu:o=9;break e;case mo:o=11;break e;case vo:o=14;break e;case lt:o=16,r=null;break e}throw Error(S(130,e==null?e:typeof e,""))}return t=Pe(o,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function Ot(e,t,n,r){return e=Pe(7,e,r,t),e.lanes=n,e}function Tl(e,t,n,r){return e=Pe(22,e,r,t),e.elementType=Ku,e.lanes=n,e.stateNode={isHidden:!1},e}function si(e,t,n){return e=Pe(6,e,null,t),e.lanes=n,e}function ui(e,t,n){return t=Pe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Cp(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Hl(0),this.expirationTimes=Hl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Jo(e,t,n,r,l,i,o,s,a){return e=new Cp(e,t,n,s,a),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Pe(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Mo(i),e}function Ep(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Fc)}catch(e){console.error(e)}}Fc(),Fu.exports=Ce;var Rp=Fu.exports,Vc,hu=Rp;Vc=hu.createRoot,hu.hydrateRoot;const Lp="modulepreload",zp=function(e){return"/"+e},mu={},Ip=function(t,n,r){let l=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),s=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));l=Promise.allSettled(n.map(a=>{if(a=zp(a),a in mu)return;mu[a]=!0;const c=a.endsWith(".css"),p=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${a}"]${p}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":Lp,c||(h.as="script"),h.crossOrigin="",h.href=a,s&&h.setAttribute("nonce",s),document.head.appendChild(h),c)return new Promise((d,y)=>{h.addEventListener("load",d),h.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${a}`)))})}))}function i(o){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o}return l.then(o=>{for(const s of o||[])s.status==="rejected"&&i(s.reason);return t().catch(i)})};function Mp(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:l,onRegisteredSW:i,onRegisterError:o}=e;let s,a;const c=async(h=!0)=>{await a};async function p(){if("serviceWorker"in navigator){if(s=await Ip(async()=>{const{Workbox:h}=await import("./workbox-window.prod.es5-BqEJf4Xk.js");return{Workbox:h}},[]).then(({Workbox:h})=>new h("/sw.js",{scope:"/",type:"classic"})).catch(h=>{o==null||o(h)}),!s)return;s.addEventListener("activated",h=>{(h.isUpdate||h.isExternal)&&window.location.reload()}),s.addEventListener("installed",h=>{h.isUpdate||r==null||r()}),s.register({immediate:t}).then(h=>{i?i("/sw.js",h):l==null||l(h)}).catch(h=>{o==null||o(h)})}}return a=p(),c}const Op={},vu=e=>{let t;const n=new Set,r=(p,h)=>{const d=typeof p=="function"?p(t):p;if(!Object.is(d,t)){const y=t;t=h??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(g=>g(t,y))}},l=()=>t,a={setState:r,getState:l,getInitialState:()=>c,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(Op?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(r,l,a);return a},Dp=e=>e?vu(e):vu;var Hc={exports:{}},Bc={},Wc={exports:{}},Qc={};/** +`+i.stack}return{value:e,source:t,stack:l,digest:null}}function ii(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Qi(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var ip=typeof WeakMap=="function"?WeakMap:Map;function pc(e,t,n){n=Ze(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){pl||(pl=!0,to=r),Qi(e,t)},n}function hc(e,t,n){n=Ze(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){Qi(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Qi(e,t),typeof r!="function"&&(mt===null?mt=new Set([this]):mt.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function Zs(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new ip;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=wp.bind(null,e,t,n),t.then(e,e))}function Js(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function qs(e,t,n,r,l){return e.mode&1?(e.flags|=65536,e.lanes=l,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Ze(-1,1),t.tag=2,ht(n,t,1))),n.lanes|=1),e)}var op=tt.ReactCurrentOwner,me=!1;function ce(e,t,n,r){t.child=e===null?Ba(t,null,n,r):dn(t,e.child,n,r)}function bs(e,t,n,r,l){n=n.render;var i=t.ref;return sn(t,l),r=Fo(e,t,n,r,i,l),n=Ao(),e!==null&&!me?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,et(e,t,l)):(B&&n&&_o(t),t.flags|=1,ce(e,t,r,l),t.child)}function eu(e,t,n,r,l){if(e===null){var i=n.type;return typeof i=="function"&&!Zo(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,mc(e,t,i,r,l)):(e=Kr(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&l)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:bn,n(o,r)&&e.ref===t.ref)return et(e,t,l)}return t.flags|=1,e=gt(i,r),e.ref=t.ref,e.return=t,t.child=e}function mc(e,t,n,r,l){if(e!==null){var i=e.memoizedProps;if(bn(i,r)&&e.ref===t.ref)if(me=!1,t.pendingProps=r=i,(e.lanes&l)!==0)e.flags&131072&&(me=!0);else return t.lanes=e.lanes,et(e,t,l)}return Ki(e,t,n,r,l)}function vc(e,t,n){var r=t.pendingProps,l=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},F(tn,xe),xe|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,F(tn,xe),xe|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,F(tn,xe),xe|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,F(tn,xe),xe|=r;return ce(e,t,l,n),t.child}function gc(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ki(e,t,n,r,l){var i=ge(n)?Dt:ae.current;return i=cn(t,i),sn(t,l),n=Fo(e,t,n,r,i,l),r=Ao(),e!==null&&!me?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,et(e,t,l)):(B&&r&&_o(t),t.flags|=1,ce(e,t,n,l),t.child)}function tu(e,t,n,r,l){if(ge(n)){var i=!0;rl(t)}else i=!1;if(sn(t,l),t.stateNode===null)Br(e,t),dc(t,n,r),Wi(t,n,r,l),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var a=o.context,c=n.contextType;typeof c=="object"&&c!==null?c=Re(c):(c=ge(n)?Dt:ae.current,c=cn(t,c));var p=n.getDerivedStateFromProps,h=typeof p=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(s!==r||a!==c)&&Xs(t,o,r,c),it=!1;var d=t.memoizedState;o.state=d,ul(t,r,o,l),a=t.memoizedState,s!==r||d!==a||ve.current||it?(typeof p=="function"&&(Bi(t,n,p,r),a=t.memoizedState),(s=it||Gs(t,n,s,r,d,a,c))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=a),o.props=r,o.state=a,o.context=c,r=s):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Qa(e,t),s=t.memoizedProps,c=t.type===t.elementType?s:Ie(t.type,s),o.props=c,h=t.pendingProps,d=o.context,a=n.contextType,typeof a=="object"&&a!==null?a=Re(a):(a=ge(n)?Dt:ae.current,a=cn(t,a));var y=n.getDerivedStateFromProps;(p=typeof y=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(s!==h||d!==a)&&Xs(t,o,r,a),it=!1,d=t.memoizedState,o.state=d,ul(t,r,o,l);var g=t.memoizedState;s!==h||d!==g||ve.current||it?(typeof y=="function"&&(Bi(t,n,y,r),g=t.memoizedState),(c=it||Gs(t,n,c,r,d,g,a)||!1)?(p||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,g,a),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,g,a)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),o.props=r,o.state=g,o.context=a,r=c):(typeof o.componentDidUpdate!="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||s===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),r=!1)}return Yi(e,t,n,r,i,l)}function Yi(e,t,n,r,l,i){gc(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return l&&As(t,n,!1),et(e,t,i);r=t.stateNode,op.current=t;var s=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=dn(t,e.child,null,i),t.child=dn(t,null,s,i)):ce(e,t,s,i),t.memoizedState=r.state,l&&As(t,n,!0),t.child}function yc(e){var t=e.stateNode;t.pendingContext?Fs(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Fs(e,t.context,!1),Oo(e,t.containerInfo)}function nu(e,t,n,r,l){return fn(),To(l),t.flags|=256,ce(e,t,n,r),t.child}var Gi={dehydrated:null,treeContext:null,retryLane:0};function Xi(e){return{baseLanes:e,cachePool:null,transitions:null}}function wc(e,t,n){var r=t.pendingProps,l=W.current,i=!1,o=(t.flags&128)!==0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(l&2)!==0),s?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),F(W,l&1),e===null)return Vi(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,i?(r=t.mode,i=t.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=Tl(o,r,0,null),e=Ot(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Xi(n),t.memoizedState=Gi,e):Bo(t,o));if(l=e.memoizedState,l!==null&&(s=l.dehydrated,s!==null))return sp(e,t,o,r,s,l,n);if(i){i=r.fallback,o=t.mode,l=e.child,s=l.sibling;var a={mode:"hidden",children:r.children};return!(o&1)&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=a,t.deletions=null):(r=gt(l,a),r.subtreeFlags=l.subtreeFlags&14680064),s!==null?i=gt(s,i):(i=Ot(i,o,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,o=e.child.memoizedState,o=o===null?Xi(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=e.childLanes&~n,t.memoizedState=Gi,r}return i=e.child,e=i.sibling,r=gt(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Bo(e,t){return t=Tl({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Tr(e,t,n,r){return r!==null&&To(r),dn(t,e.child,null,n),e=Bo(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function sp(e,t,n,r,l,i,o){if(n)return t.flags&256?(t.flags&=-257,r=ii(Error(S(422))),Tr(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,l=t.mode,r=Tl({mode:"visible",children:r.children},l,0,null),i=Ot(i,l,o,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&dn(t,e.child,null,o),t.child.memoizedState=Xi(o),t.memoizedState=Gi,i);if(!(t.mode&1))return Tr(e,t,o,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var s=r.dgst;return r=s,i=Error(S(419)),r=ii(i,r,void 0),Tr(e,t,o,r)}if(s=(o&e.childLanes)!==0,me||s){if(r=ne,r!==null){switch(o&-o){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=l&(r.suspendedLanes|o)?0:l,l!==0&&l!==i.retryLane&&(i.retryLane=l,be(e,l),$e(r,e,l,-1))}return Xo(),r=ii(Error(S(421))),Tr(e,t,o,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=xp.bind(null,e),l._reactRetry=t,null):(e=i.treeContext,Se=pt(l.nextSibling),ke=t,B=!0,Oe=null,e!==null&&(Ne[_e++]=Ge,Ne[_e++]=Xe,Ne[_e++]=$t,Ge=e.id,Xe=e.overflow,$t=t),t=Bo(t,r.children),t.flags|=4096,t)}function ru(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Hi(e.return,t,n)}function oi(e,t,n,r,l){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=l)}function xc(e,t,n){var r=t.pendingProps,l=r.revealOrder,i=r.tail;if(ce(e,t,r.children,n),r=W.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&ru(e,n,t);else if(e.tag===19)ru(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(F(W,r),!(t.mode&1))t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&al(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),oi(t,!1,l,n,i);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&al(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}oi(t,!0,n,null,i);break;case"together":oi(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Br(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function et(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ft|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(S(153));if(t.child!==null){for(e=t.child,n=gt(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=gt(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function up(e,t,n){switch(t.tag){case 3:yc(t),fn();break;case 5:Ka(t);break;case 1:ge(t.type)&&rl(t);break;case 4:Oo(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;F(ol,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(F(W,W.current&1),t.flags|=128,null):n&t.child.childLanes?wc(e,t,n):(F(W,W.current&1),e=et(e,t,n),e!==null?e.sibling:null);F(W,W.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return xc(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),F(W,W.current),r)break;return null;case 22:case 23:return t.lanes=0,vc(e,t,n)}return et(e,t,n)}var Sc,Zi,kc,jc;Sc=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Zi=function(){};kc=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,It(Qe.current);var i=null;switch(n){case"input":l=yi(e,l),r=yi(e,r),i=[];break;case"select":l=K({},l,{value:void 0}),r=K({},r,{value:void 0}),i=[];break;case"textarea":l=Si(e,l),r=Si(e,r),i=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=tl)}ji(n,r);var o;n=null;for(c in l)if(!r.hasOwnProperty(c)&&l.hasOwnProperty(c)&&l[c]!=null)if(c==="style"){var s=l[c];for(o in s)s.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(Kn.hasOwnProperty(c)?i||(i=[]):(i=i||[]).push(c,null));for(c in r){var a=r[c];if(s=l!=null?l[c]:void 0,r.hasOwnProperty(c)&&a!==s&&(a!=null||s!=null))if(c==="style")if(s){for(o in s)!s.hasOwnProperty(o)||a&&a.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in a)a.hasOwnProperty(o)&&s[o]!==a[o]&&(n||(n={}),n[o]=a[o])}else n||(i||(i=[]),i.push(c,n)),n=a;else c==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,s=s?s.__html:void 0,a!=null&&s!==a&&(i=i||[]).push(c,a)):c==="children"?typeof a!="string"&&typeof a!="number"||(i=i||[]).push(c,""+a):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(Kn.hasOwnProperty(c)?(a!=null&&c==="onScroll"&&A("scroll",e),i||s===a||(i=[])):(i=i||[]).push(c,a))}n&&(i=i||[]).push("style",n);var c=i;(t.updateQueue=c)&&(t.flags|=4)}};jc=function(e,t,n,r){n!==r&&(t.flags|=4)};function Pn(e,t){if(!B)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function se(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags&14680064,r|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function ap(e,t,n){var r=t.pendingProps;switch(Po(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return se(t),null;case 1:return ge(t.type)&&nl(),se(t),null;case 3:return r=t.stateNode,pn(),V(ve),V(ae),$o(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(_r(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Oe!==null&&(lo(Oe),Oe=null))),Zi(e,t),se(t),null;case 5:Do(t);var l=It(lr.current);if(n=t.type,e!==null&&t.stateNode!=null)kc(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(S(166));return se(t),null}if(e=It(Qe.current),_r(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Be]=t,r[nr]=i,e=(t.mode&1)!==0,n){case"dialog":A("cancel",r),A("close",r);break;case"iframe":case"object":case"embed":A("load",r);break;case"video":case"audio":for(l=0;l<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[Be]=t,e[nr]=r,Sc(e,t,!1,!1),t.stateNode=e;e:{switch(o=Ci(n,r),n){case"dialog":A("cancel",e),A("close",e),l=r;break;case"iframe":case"object":case"embed":A("load",e),l=r;break;case"video":case"audio":for(l=0;lmn&&(t.flags|=128,r=!0,Pn(i,!1),t.lanes=4194304)}else{if(!r)if(e=al(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Pn(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!B)return se(t),null}else 2*X()-i.renderingStartTime>mn&&n!==1073741824&&(t.flags|=128,r=!0,Pn(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=X(),t.sibling=null,n=W.current,F(W,r?n&1|2:n&1),t):(se(t),null);case 22:case 23:return Go(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?xe&1073741824&&(se(t),t.subtreeFlags&6&&(t.flags|=8192)):se(t),null;case 24:return null;case 25:return null}throw Error(S(156,t.tag))}function cp(e,t){switch(Po(t),t.tag){case 1:return ge(t.type)&&nl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return pn(),V(ve),V(ae),$o(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Do(t),null;case 13:if(V(W),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(S(340));fn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(W),null;case 4:return pn(),null;case 10:return zo(t.type._context),null;case 22:case 23:return Go(),null;case 24:return null;default:return null}}var Rr=!1,ue=!1,fp=typeof WeakSet=="function"?WeakSet:Set,N=null;function en(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Y(e,t,r)}else n.current=null}function Ji(e,t,n){try{n()}catch(r){Y(e,t,r)}}var lu=!1;function dp(e,t){if(Mi=qr,e=Pa(),No(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,s=-1,a=-1,c=0,p=0,h=e,d=null;t:for(;;){for(var y;h!==n||l!==0&&h.nodeType!==3||(s=o+l),h!==i||r!==0&&h.nodeType!==3||(a=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(y=h.firstChild)!==null;)d=h,h=y;for(;;){if(h===e)break t;if(d===n&&++c===l&&(s=o),d===i&&++p===r&&(a=o),(y=h.nextSibling)!==null)break;h=d,d=h.parentNode}h=y}n=s===-1||a===-1?null:{start:s,end:a}}else n=null}n=n||{start:0,end:0}}else n=null;for(Oi={focusedElem:e,selectionRange:n},qr=!1,N=t;N!==null;)if(t=N,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,N=e;else for(;N!==null;){t=N;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var x=g.memoizedProps,z=g.memoizedState,m=t.stateNode,f=m.getSnapshotBeforeUpdate(t.elementType===t.type?x:Ie(t.type,x),z);m.__reactInternalSnapshotBeforeUpdate=f}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(S(163))}}catch(w){Y(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,N=e;break}N=t.return}return g=lu,lu=!1,g}function Vn(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&Ji(t,n,i)}l=l.next}while(l!==r)}}function _l(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function qi(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Cc(e){var t=e.alternate;t!==null&&(e.alternate=null,Cc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Be],delete t[nr],delete t[Ui],delete t[Gd],delete t[Xd])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ec(e){return e.tag===5||e.tag===3||e.tag===4}function iu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ec(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function bi(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=tl));else if(r!==4&&(e=e.child,e!==null))for(bi(e,t,n),e=e.sibling;e!==null;)bi(e,t,n),e=e.sibling}function eo(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(eo(e,t,n),e=e.sibling;e!==null;)eo(e,t,n),e=e.sibling}var re=null,Me=!1;function nt(e,t,n){for(n=n.child;n!==null;)Nc(e,t,n),n=n.sibling}function Nc(e,t,n){if(We&&typeof We.onCommitFiberUnmount=="function")try{We.onCommitFiberUnmount(wl,n)}catch{}switch(n.tag){case 5:ue||en(n,t);case 6:var r=re,l=Me;re=null,nt(e,t,n),re=r,Me=l,re!==null&&(Me?(e=re,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):re.removeChild(n.stateNode));break;case 18:re!==null&&(Me?(e=re,n=n.stateNode,e.nodeType===8?bl(e.parentNode,n):e.nodeType===1&&bl(e,n),Jn(e)):bl(re,n.stateNode));break;case 4:r=re,l=Me,re=n.stateNode.containerInfo,Me=!0,nt(e,t,n),re=r,Me=l;break;case 0:case 11:case 14:case 15:if(!ue&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Ji(n,t,o),l=l.next}while(l!==r)}nt(e,t,n);break;case 1:if(!ue&&(en(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){Y(n,t,s)}nt(e,t,n);break;case 21:nt(e,t,n);break;case 22:n.mode&1?(ue=(r=ue)||n.memoizedState!==null,nt(e,t,n),ue=r):nt(e,t,n);break;default:nt(e,t,n)}}function ou(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new fp),t.forEach(function(r){var l=Sp.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function ze(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=o),r&=~i}if(r=l,r=X()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*hp(r/1960))-r,10e?16:e,at===null)var r=!1;else{if(e=at,at=null,hl=0,D&6)throw Error(S(331));var l=D;for(D|=4,N=e.current;N!==null;){var i=N,o=i.child;if(N.flags&16){var s=i.deletions;if(s!==null){for(var a=0;aX()-Ko?Mt(e,0):Qo|=n),ye(e,t)}function Mc(e,t){t===0&&(e.mode&1?(t=Sr,Sr<<=1,!(Sr&130023424)&&(Sr=4194304)):t=1);var n=fe();e=be(e,t),e!==null&&(cr(e,t,n),ye(e,n))}function xp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Mc(e,n)}function Sp(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(S(314))}r!==null&&r.delete(t),Mc(e,n)}var Oc;Oc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ve.current)me=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return me=!1,up(e,t,n);me=!!(e.flags&131072)}else me=!1,B&&t.flags&1048576&&Fa(t,il,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Br(e,t),e=t.pendingProps;var l=cn(t,ae.current);sn(t,n),l=Fo(null,t,r,e,l,n);var i=Ao();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ge(r)?(i=!0,rl(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,Mo(t),l.updater=Nl,t.stateNode=l,l._reactInternals=t,Wi(t,r,e,n),t=Yi(null,t,r,!0,i,n)):(t.tag=0,B&&i&&_o(t),ce(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Br(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=jp(r),e=Ie(r,e),l){case 0:t=Ki(null,t,r,e,n);break e;case 1:t=tu(null,t,r,e,n);break e;case 11:t=bs(null,t,r,e,n);break e;case 14:t=eu(null,t,r,Ie(r.type,e),n);break e}throw Error(S(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ie(r,l),Ki(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ie(r,l),tu(e,t,r,l,n);case 3:e:{if(yc(t),e===null)throw Error(S(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Qa(e,t),ul(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){l=hn(Error(S(423)),t),t=nu(e,t,r,n,l);break e}else if(r!==l){l=hn(Error(S(424)),t),t=nu(e,t,r,n,l);break e}else for(Se=pt(t.stateNode.containerInfo.firstChild),ke=t,B=!0,Oe=null,n=Ba(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(fn(),r===l){t=et(e,t,n);break e}ce(e,t,r,n)}t=t.child}return t;case 5:return Ka(t),e===null&&Vi(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,o=l.children,Di(r,l)?o=null:i!==null&&Di(r,i)&&(t.flags|=32),gc(e,t),ce(e,t,o,n),t.child;case 6:return e===null&&Vi(t),null;case 13:return wc(e,t,n);case 4:return Oo(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=dn(t,null,r,n):ce(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ie(r,l),bs(e,t,r,l,n);case 7:return ce(e,t,t.pendingProps,n),t.child;case 8:return ce(e,t,t.pendingProps.children,n),t.child;case 12:return ce(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,o=l.value,F(ol,r._currentValue),r._currentValue=o,i!==null)if(Ue(i.value,o)){if(i.children===l.children&&!ve.current){t=et(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var s=i.dependencies;if(s!==null){o=i.child;for(var a=s.firstContext;a!==null;){if(a.context===r){if(i.tag===1){a=Ze(-1,n&-n),a.tag=2;var c=i.updateQueue;if(c!==null){c=c.shared;var p=c.pending;p===null?a.next=a:(a.next=p.next,p.next=a),c.pending=a}}i.lanes|=n,a=i.alternate,a!==null&&(a.lanes|=n),Hi(i.return,n,t),s.lanes|=n;break}a=a.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(S(341));o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),Hi(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}ce(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,sn(t,n),l=Re(l),r=r(l),t.flags|=1,ce(e,t,r,n),t.child;case 14:return r=t.type,l=Ie(r,t.pendingProps),l=Ie(r.type,l),eu(e,t,r,l,n);case 15:return mc(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ie(r,l),Br(e,t),t.tag=1,ge(r)?(e=!0,rl(t)):e=!1,sn(t,n),dc(t,r,l),Wi(t,r,l,n),Yi(null,t,r,!0,e,n);case 19:return xc(e,t,n);case 22:return vc(e,t,n)}throw Error(S(156,t.tag))};function Dc(e,t){return aa(e,t)}function kp(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pe(e,t,n,r){return new kp(e,t,n,r)}function Zo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function jp(e){if(typeof e=="function")return Zo(e)?1:0;if(e!=null){if(e=e.$$typeof,e===mo)return 11;if(e===vo)return 14}return 2}function gt(e,t){var n=e.alternate;return n===null?(n=Pe(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Kr(e,t,n,r,l,i){var o=2;if(r=e,typeof e=="function")Zo(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case Qt:return Ot(n.children,l,i,t);case ho:o=8,l|=8;break;case hi:return e=Pe(12,n,t,l|2),e.elementType=hi,e.lanes=i,e;case mi:return e=Pe(13,n,t,l),e.elementType=mi,e.lanes=i,e;case vi:return e=Pe(19,n,t,l),e.elementType=vi,e.lanes=i,e;case Ku:return Tl(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Wu:o=10;break e;case Qu:o=9;break e;case mo:o=11;break e;case vo:o=14;break e;case lt:o=16,r=null;break e}throw Error(S(130,e==null?e:typeof e,""))}return t=Pe(o,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function Ot(e,t,n,r){return e=Pe(7,e,r,t),e.lanes=n,e}function Tl(e,t,n,r){return e=Pe(22,e,r,t),e.elementType=Ku,e.lanes=n,e.stateNode={isHidden:!1},e}function si(e,t,n){return e=Pe(6,e,null,t),e.lanes=n,e}function ui(e,t,n){return t=Pe(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Cp(e,t,n,r,l){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Hl(0),this.expirationTimes=Hl(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hl(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Jo(e,t,n,r,l,i,o,s,a){return e=new Cp(e,t,n,s,a),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Pe(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Mo(i),e}function Ep(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Ac)}catch(e){console.error(e)}}Ac(),Au.exports=Ce;var Rp=Au.exports,Vc,hu=Rp;Vc=hu.createRoot,hu.hydrateRoot;const Lp="modulepreload",zp=function(e){return"/"+e},mu={},Ip=function(t,n,r){let l=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),s=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));l=Promise.allSettled(n.map(a=>{if(a=zp(a),a in mu)return;mu[a]=!0;const c=a.endsWith(".css"),p=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${a}"]${p}`))return;const h=document.createElement("link");if(h.rel=c?"stylesheet":Lp,c||(h.as="script"),h.crossOrigin="",h.href=a,s&&h.setAttribute("nonce",s),document.head.appendChild(h),c)return new Promise((d,y)=>{h.addEventListener("load",d),h.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${a}`)))})}))}function i(o){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o}return l.then(o=>{for(const s of o||[])s.status==="rejected"&&i(s.reason);return t().catch(i)})};function Mp(e={}){const{immediate:t=!1,onNeedRefresh:n,onOfflineReady:r,onRegistered:l,onRegisteredSW:i,onRegisterError:o}=e;let s,a;const c=async(h=!0)=>{await a};async function p(){if("serviceWorker"in navigator){if(s=await Ip(async()=>{const{Workbox:h}=await import("./workbox-window.prod.es5-BqEJf4Xk.js");return{Workbox:h}},[]).then(({Workbox:h})=>new h("/sw.js",{scope:"/",type:"classic"})).catch(h=>{o==null||o(h)}),!s)return;s.addEventListener("activated",h=>{(h.isUpdate||h.isExternal)&&window.location.reload()}),s.addEventListener("installed",h=>{h.isUpdate||r==null||r()}),s.register({immediate:t}).then(h=>{i?i("/sw.js",h):l==null||l(h)}).catch(h=>{o==null||o(h)})}}return a=p(),c}const Op={},vu=e=>{let t;const n=new Set,r=(p,h)=>{const d=typeof p=="function"?p(t):p;if(!Object.is(d,t)){const y=t;t=h??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(g=>g(t,y))}},l=()=>t,a={setState:r,getState:l,getInitialState:()=>c,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(Op?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},c=t=e(r,l,a);return a},Dp=e=>e?vu(e):vu;var Hc={exports:{}},Bc={},Wc={exports:{}},Qc={};/** * @license React * use-sync-external-store-shim.production.js * @@ -45,7 +45,7 @@ Error generating stack: `+i.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var vn=R;function $p(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Up=typeof Object.is=="function"?Object.is:$p,Ap=vn.useState,Fp=vn.useEffect,Vp=vn.useLayoutEffect,Hp=vn.useDebugValue;function Bp(e,t){var n=t(),r=Ap({inst:{value:n,getSnapshot:t}}),l=r[0].inst,i=r[1];return Vp(function(){l.value=n,l.getSnapshot=t,ai(l)&&i({inst:l})},[e,n,t]),Fp(function(){return ai(l)&&i({inst:l}),e(function(){ai(l)&&i({inst:l})})},[e]),Hp(n),n}function ai(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Up(e,n)}catch{return!0}}function Wp(e,t){return t()}var Qp=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Wp:Bp;Qc.useSyncExternalStore=vn.useSyncExternalStore!==void 0?vn.useSyncExternalStore:Qp;Wc.exports=Qc;var Kp=Wc.exports;/** + */var vn=R;function $p(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Up=typeof Object.is=="function"?Object.is:$p,Fp=vn.useState,Ap=vn.useEffect,Vp=vn.useLayoutEffect,Hp=vn.useDebugValue;function Bp(e,t){var n=t(),r=Fp({inst:{value:n,getSnapshot:t}}),l=r[0].inst,i=r[1];return Vp(function(){l.value=n,l.getSnapshot=t,ai(l)&&i({inst:l})},[e,n,t]),Ap(function(){return ai(l)&&i({inst:l}),e(function(){ai(l)&&i({inst:l})})},[e]),Hp(n),n}function ai(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Up(e,n)}catch{return!0}}function Wp(e,t){return t()}var Qp=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Wp:Bp;Qc.useSyncExternalStore=vn.useSyncExternalStore!==void 0?vn.useSyncExternalStore:Qp;Wc.exports=Qc;var Kp=Wc.exports;/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -57,4 +57,4 @@ Error generating stack: `+i.message+` `)){if(!z||z.startsWith(":"))continue;const m=z.indexOf(":"),f=m===-1?z:z.slice(0,m);let v=m===-1?"":z.slice(m+1);v.startsWith(" ")&&(v=v.slice(1)),f==="event"?d=v:f==="data"&&y.push(v)}if(!y.length)return;const g=y.join(` `);if(g==="[DONE]"){n("done",{});return}let x=g;try{x=JSON.parse(g)}catch{}n(d,x)};try{for(;;){const{done:h,value:d}=await o.read();if(h)break;a+=s.decode(d,{stream:!0});let y;for(;(y=a.indexOf(` -`))!==-1;){const g=a.slice(0,y);a=a.slice(y+2),c(g)}}a.trim()&&c(a)}finally{(p=o.releaseLock)==null||p.call(o)}}}const io=2,Rt={connections:[],activeConnectionId:null,speakReplies:!1,ttsVoice:"",showToolCalls:!1,showReasoning:!1,showSystem:!0,transcribeUrl:"",transcribeKey:"",transcribeModel:"whisper-1",mediaBaseUrl:"",mediaPathPrefix:"",prefsVersion:io},Xc="hermes.config.v2";function dh(){try{const e=localStorage.getItem(Xc);if(!e)return{...Rt};const t=JSON.parse(e),n={...Rt,...t,connections:Array.isArray(t.connections)?t.connections:[]};return(t.prefsVersion??1)t.id===e.activeConnectionId)??e.connections[0]??null:null}function ph(e){const t=Qn(e);return!!t&&(t.sameOrigin===!0||t.baseUrl.trim().length>0)}function hh(){return`conn-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`}let Rn=null;function mh(e){return new Gc({baseUrl:e.baseUrl,apiKey:e.apiKey,profile:e.profile,sameOrigin:e.sameOrigin,customHeaders:e.customHeaders})}function Ve(e){return e instanceof Wn||e instanceof Error?e.message:String(e)}function rt(e,t,n){return e.map(r=>r.id===t?n(r):r)}const j=uh()((e,t)=>({config:{...Rt},client:null,ready:!1,connectionError:null,capabilities:null,models:[],sessions:[],sessionsLoading:!1,searchQuery:"",activeSessionId:null,session:null,messages:[],sessionLoading:!1,streaming:!1,runId:null,streamError:null,steerLeftover:null,sidebarOpen:!1,showSettings:!1,toast:null,async bootstrap(){const n=dh();e({config:n,ready:!0}),Qn(n)&&await t().connect()},async saveConnection(n){const r=t().config,i=r.connections.some(s=>s.id===n.id)?r.connections.map(s=>s.id===n.id?n:s):[...r.connections,n],o={...r,connections:i,activeConnectionId:n.id};Mr(o),e({config:o}),await t().connect()},async removeConnection(n){var s;const r=t().config,l=r.connections.filter(a=>a.id!==n),i=r.activeConnectionId===n?((s=l[0])==null?void 0:s.id)??null:r.activeConnectionId,o={...r,connections:l,activeConnectionId:i};Mr(o),e({config:o,sessions:[],session:null,messages:[],activeSessionId:null}),Qn(o)&&await t().connect()},async setActiveConnection(n){const r={...t().config,activeConnectionId:n};Mr(r),e({config:r,sessions:[],session:null,messages:[],activeSessionId:null}),await t().connect()},updatePrefs(n){const r={...t().config,...n};Mr(r),e({config:r})},async connect(){const n=Qn(t().config);if(!n||!n.sameOrigin&&!n.baseUrl.trim())return;const r=mh(n);e({client:r,connectionError:null,capabilities:null});try{const l=await r.capabilities();e({capabilities:l}),r.models().then(i=>e({models:i})).catch(()=>{}),await t().loadSessions()}catch(l){e({connectionError:Ve(l),capabilities:null})}},async loadSessions(){const{client:n,searchQuery:r}=t();if(n){e({sessionsLoading:!0});try{const l=await n.listSessions({limit:200}),i=r.trim().toLowerCase(),o=i?l.filter(s=>s.title.toLowerCase().includes(i)):l;e({sessions:o,sessionsLoading:!1})}catch(l){e({sessionsLoading:!1,toast:Ve(l)})}}},setSearch(n){e({searchQuery:n}),t().loadSessions()},async openSession(n){const{client:r}=t();if(r){e({activeSessionId:n,sessionLoading:!0,session:null,messages:[],sidebarOpen:!1,streamError:null});try{const[l,i]=await Promise.all([r.getSession(n).catch(()=>null),r.getMessages(n,{limit:500,order:"oldest"})]);e({session:l??{id:n,title:"Untitled"},messages:i,sessionLoading:!1})}catch(l){e({sessionLoading:!1,toast:Ve(l)})}}},async newSession(){const{client:n}=t();if(n)try{const r=await n.createSession();e({session:r,messages:[],activeSessionId:r.id,sidebarOpen:!1,streamError:null}),await t().loadSessions()}catch(r){e({toast:Ve(r)})}},async renameSession(n,r){var i;const{client:l}=t();if(l)try{await l.updateSession(n,{title:r}),e({sessions:t().sessions.map(o=>o.id===n?{...o,title:r}:o),session:((i=t().session)==null?void 0:i.id)===n?{...t().session,title:r}:t().session})}catch(o){e({toast:Ve(o)})}},async deleteSession(n){const{client:r}=t();if(r)try{await r.deleteSession(n);const l=t().activeSessionId===n;e({sessions:t().sessions.filter(i=>i.id!==n),...l?{activeSessionId:null,session:null,messages:[]}:{}})}catch(l){e({toast:Ve(l)})}},async forkSession(n){const{client:r}=t();if(r)try{const l=await r.forkSession(n);await t().loadSessions(),await t().openSession(l.id)}catch(l){e({toast:Ve(l)})}},async send(n,r){const{client:l,activeSessionId:i,messages:o}=t();if(!l||!i)return;const s=n.trim();if(!s&&!(r!=null&&r.length)||t().streaming)return;const a={id:`local-user-${Date.now()}`,role:"user",content:s,attachments:r,timestamp:Date.now()},c=`local-assistant-${Date.now()}`,p={id:c,role:"assistant",content:"",timestamp:Date.now(),streaming:!0,toolCalls:[]};e({messages:[...o,a,p],streaming:!0,streamError:null,runId:null});let h=s;if(r!=null&&r.length){const d=[];s&&d.push({type:"text",text:s});for(const y of r)d.push({type:"image_url",image_url:{url:y.dataUrl}});h=d}try{Rn=new AbortController,await l.chatStream(i,{input:h},(d,y)=>vh(e,t,d,y,c),Rn.signal)}catch(d){if((d==null?void 0:d.name)!=="AbortError"){const y=d instanceof Wn&&d.status===409?"This session is owned by another surface (CLI, dashboard, or messaging) and can't be continued from the API server. Start a new chat to talk to the agent here.":Ve(d);e({streamError:y})}}finally{e({streaming:!1,runId:null}),e({messages:rt(t().messages,c,d=>({...d,streaming:!1}))}),t().loadSessions()}},async cancel(){const{client:n,runId:r}=t();if(Rn==null||Rn.abort(),n&&r)try{await n.stopRun(r)}catch(l){e({toast:Ve(l)})}e({streaming:!1})},async steer(n){const{client:r,runId:l}=t();if(!(!r||!l||!n.trim()))try{await r.steerRun(l,n.trim())}catch(i){e({toast:Ve(i)})}},clearSteerLeftover(){e({steerLeftover:null})},setSidebarOpen(n){e({sidebarOpen:n})},setShowSettings(n){e({showSettings:n})},setToast(n){e({toast:n})}}));function ci(e){for(const t of["text","delta","content","output_text"]){const n=e[t];if(typeof n=="string")return n}return""}function xu(e){return String(e.id??e.tool_call_id??e.tool_use_id??e.tool??e.name??Math.random())}function vh(e,t,n,r,l){const i=r??{};switch(typeof i.run_id=="string"&&i.run_id!==t().runId&&e({runId:i.run_id}),n){case"assistant.delta":case"message.delta":{const o=ci(i);if(!o)break;e({messages:rt(t().messages,l,s=>({...s,content:s.content+o}))});break}case"assistant.commentary":case"message.interim":{if(i.already_streamed)break;const o=ci(i);if(!o)break;e({messages:rt(t().messages,l,s=>({...s,content:o}))});break}case"assistant.completed":case"message.complete":{const o=ci(i);e({messages:rt(t().messages,l,s=>({...s,content:o||s.content,streaming:!1}))});break}case"tool.started":{const o={id:xu(i),name:String(i.tool??i.name??"tool"),preview:typeof i.preview=="string"?i.preview:void 0,status:"running"};e({messages:rt(t().messages,l,s=>{const a=s.toolCalls??[],c=a.some(p=>p.id===o.id);return{...s,toolCalls:c?a.map(p=>p.id===o.id?{...p,...o}:p):[...a,o]}})});break}case"tool.completed":case"tool.failed":{const o=n==="tool.failed"||i.error===!0||typeof i.error=="string",s={id:xu(i),name:String(i.tool??i.name??"tool"),preview:typeof i.preview=="string"?i.preview:void 0,status:o?"error":"done",duration:typeof i.duration=="number"?i.duration:void 0};e({messages:rt(t().messages,l,a=>{const c=a.toolCalls??[],p=c.some(h=>h.id===s.id);return{...a,toolCalls:p?c.map(h=>h.id===s.id?{...h,...s}:h):[...c,s]}})});break}case"run.completed":{const o=typeof i.output=="string"?i.output:"";e({messages:rt(t().messages,l,s=>({...s,content:o||s.content,streaming:!1}))}),typeof i.pending_steer=="string"&&i.pending_steer&&e({steerLeftover:i.pending_steer});break}case"run.failed":case"run.cancelled":{const o=typeof i.output=="string"?i.output:"",s=typeof i.error=="string"?i.error:void 0;e({messages:rt(t().messages,l,a=>({...a,content:o||a.content,streaming:!1,error:n==="run.failed"})),...s?{streamError:s}:{}});break}case"error":{e({streamError:String(i.error??i.message??"The turn failed."),streaming:!1});break}}}function Zc(){const e=j(l=>l.config.ttsVoice),t=R.useRef(null),n=R.useCallback(()=>{typeof speechSynthesis<"u"&&speechSynthesis.cancel(),t.current=null},[]);return{speak:R.useCallback(l=>{const i=l.trim();if(!i||typeof speechSynthesis>"u")return;speechSynthesis.cancel();const o=new SpeechSynthesisUtterance(i);if(e){const s=speechSynthesis.getVoices().find(a=>a.name===e);s&&(o.voice=s)}t.current=o,speechSynthesis.speak(o)},[e]),stop:n}}const J=e=>({width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",...e}),xn=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M12 5v14M5 12h14"})}),gh=e=>u.jsxs("svg",{...J(e),children:[u.jsx("circle",{cx:"11",cy:"11",r:"7"}),u.jsx("path",{d:"m20 20-3.5-3.5"})]}),yh=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M4 12 20 4l-6 16-3-7-7-1Z"})}),wh=e=>u.jsxs("svg",{...J(e),children:[u.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3"}),u.jsx("path",{d:"M5 11a7 7 0 0 0 14 0M12 18v3"})]}),Su=e=>u.jsxs("svg",{...J(e),children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),u.jsx("circle",{cx:"8.5",cy:"9.5",r:"1.5"}),u.jsx("path",{d:"m21 16-5-5L5 20"})]}),xh=e=>u.jsx("svg",{...J(e),children:u.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2",fill:"currentColor",stroke:"none"})}),Sh=e=>u.jsxs("svg",{...J(e),children:[u.jsx("circle",{cx:"12",cy:"12",r:"3"}),u.jsx("path",{d:"M19.4 15a1.7 1.7 0 0 0 .3 1.9l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-2.9 1.2 2 2 0 1 1-4 0 1.7 1.7 0 0 0-2.9-1.2l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1A1.7 1.7 0 0 0 4.6 15a2 2 0 1 1 0-4 1.7 1.7 0 0 0 1.2-2.9l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1A1.7 1.7 0 0 0 11.5 4a2 2 0 1 1 4 0 1.7 1.7 0 0 0 2.9 1.2l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1A1.7 1.7 0 0 0 19.4 11a2 2 0 1 1 0 4Z"})]}),kh=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})}),ts=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M6 6l12 12M18 6 6 18"})}),ns=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2M6 7l1 13a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1l1-13"})}),jh=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"m6 9 6 6 6-6"})}),Ch=e=>u.jsxs("svg",{...J(e),children:[u.jsx("path",{d:"M4 9v6h4l5 4V5L8 9H4Z"}),u.jsx("path",{d:"M16.5 8.5a5 5 0 0 1 0 7"})]}),Eh=e=>u.jsxs("svg",{...J(e),children:[u.jsx("circle",{cx:"12",cy:"8",r:"4"}),u.jsx("path",{d:"M4 20a8 8 0 0 1 16 0"})]}),rs=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"m5 13 4 4L19 7"})}),Nh=e=>u.jsxs("svg",{...J(e),children:[u.jsx("path",{d:"M21 12a9 9 0 1 1-3-6.7L21 8"}),u.jsx("path",{d:"M21 3v5h-5"})]}),ls=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})}),_h=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M9 4a3 3 0 0 0-3 3 3 3 0 0 0-1 5.8V15a3 3 0 0 0 4 2.8V20h2V4H9ZM15 4a3 3 0 0 1 3 3 3 3 0 0 1 1 5.8V15a3 3 0 0 1-4 2.8V20h-2V4h2Z"})}),Jc=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M12 3v12M7 11l5 5 5-5M5 21h14"})}),Ph=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M3 5h18l-7 8v6l-4-2v-4L3 5Z"})}),Ol=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M14.7 6.3a4 4 0 0 0-5.4 5.4L4 17v3h3l5.3-5.3a4 4 0 0 0 5.4-5.4l-2.3 2.3-2-2 2.3-2.3Z"})});function Th(){return{id:hh(),name:"My Hermes",baseUrl:"",apiKey:"",profile:"",customHeaders:[]}}function gl({initial:e,onSave:t,onCancel:n,saveLabel:r="Save & connect"}){const[l,i]=R.useState(e??Th()),[o,s]=R.useState(!1),[a,c]=R.useState(null),p=d=>i(y=>({...y,...d})),h=async()=>{s(!0),c(null);try{const d=new Gc({baseUrl:l.baseUrl,apiKey:l.apiKey,profile:l.profile,sameOrigin:l.sameOrigin,customHeaders:l.customHeaders}),y=await d.health(),g=await d.capabilities(),x=g.features?Object.keys(g.features).length:0;c({ok:!0,msg:`Connected to ${y.platform??"hermes-agent"} ${y.version??""} — API key accepted (${x} features).`})}catch(d){c({ok:!1,msg:d instanceof Error?d.message:String(d)})}finally{s(!1)}};return u.jsxs("div",{children:[a&&u.jsx("div",{className:`alert ${a.ok?"ok":"error"}`,children:a.msg}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"Name"}),u.jsx("input",{value:l.name,onChange:d=>p({name:d.target.value}),placeholder:"My Hermes"})]}),u.jsxs("div",{className:"field",children:[u.jsxs("label",{className:"toggle",style:{marginBottom:8},children:[u.jsx("input",{type:"checkbox",checked:!!l.sameOrigin,onChange:d=>p({sameOrigin:d.target.checked})}),"Same origin (behind the bundled proxy)"]}),l.sameOrigin?u.jsxs("div",{className:"hint",style:{marginTop:0},children:["Requests go to this app's own origin, which the proxy forwards to your API server — no CORS needed. Run the proxy with ",u.jsx("code",{children:"HERMES_TARGET"})," (no key required)."]}):u.jsxs(u.Fragment,{children:[u.jsx("input",{value:l.baseUrl,onChange:d=>p({baseUrl:d.target.value}),placeholder:"https://api.example.com",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,inputMode:"url"}),u.jsxs("div",{className:"hint",children:["The API server origin (default port ",u.jsx("code",{children:"8642"}),"), e.g."," ",u.jsx("code",{children:"https://api.beaver.derez.ai"}),". Needs ",u.jsx("code",{children:"API_SERVER_CORS_ORIGINS"})," to allow this app's origin."]})]})]}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"API key (API_SERVER_KEY)"}),u.jsx("input",{type:"password",value:l.apiKey,onChange:d=>p({apiKey:d.target.value}),placeholder:"Bearer token",autoCapitalize:"none"}),u.jsxs("div",{className:"hint",children:["Stored only on this device. Sent as ",u.jsx("code",{children:"Authorization: Bearer …"}),"."]})]}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"Profile (optional)"}),u.jsx("input",{value:l.profile??"",onChange:d=>p({profile:d.target.value}),placeholder:"default",autoCapitalize:"none"}),u.jsxs("div",{className:"hint",children:["Multi-profile gateways route to ",u.jsx("code",{children:"/p//…"}),". Each profile needs its own key — add one connection per profile to see them all."]})]}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"Custom headers (optional)"}),(l.customHeaders??[]).map((d,y)=>u.jsxs("div",{className:"header-row",children:[u.jsx("input",{value:d.name,placeholder:"Header name",onChange:g=>{const x=[...l.customHeaders??[]];x[y]={...x[y],name:g.target.value},p({customHeaders:x})}}),u.jsx("input",{value:d.value,placeholder:"Value",onChange:g=>{const x=[...l.customHeaders??[]];x[y]={...x[y],value:g.target.value},p({customHeaders:x})}}),u.jsx("button",{className:"icon-btn",title:"Remove",onClick:()=>p({customHeaders:(l.customHeaders??[]).filter((g,x)=>x!==y)}),children:u.jsx(ts,{width:16,height:16})})]},y)),u.jsxs("button",{className:"btn",style:{marginTop:8},onClick:()=>p({customHeaders:[...l.customHeaders??[],{name:"",value:""}]}),children:[u.jsx(xn,{width:15,height:15,style:{verticalAlign:"-2px",marginRight:6}}),"Add header"]})]}),u.jsxs("div",{className:"actions",children:[n&&u.jsx("button",{className:"btn",onClick:n,children:"Cancel"}),u.jsx("button",{className:"btn",onClick:h,disabled:o||!l.sameOrigin&&!l.baseUrl.trim(),children:o?"Testing…":"Test"}),u.jsx("button",{className:"btn primary",onClick:()=>t({...l,name:l.name.trim()||"Hermes"}),disabled:!l.sameOrigin&&!l.baseUrl.trim(),children:r})]})]})}function qc({height:e=26,withText:t=!0}){const n=R.useId().replace(/:/g,""),r=t?e*132/34:e;return u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:e,viewBox:t?"0 0 132 34":"0 0 34 34",role:"img","aria-label":"derez.ai",children:[u.jsx("defs",{children:u.jsxs("linearGradient",{id:`box-bg-${n}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[u.jsx("stop",{offset:"0%",stopColor:"#003545"}),u.jsx("stop",{offset:"100%",stopColor:"#00202e"})]})}),u.jsx("rect",{x:"0",y:"0",width:"34",height:"34",rx:"10",fill:`url(#box-bg-${n})`,stroke:"#005570",strokeWidth:"1.2"}),u.jsx("rect",{x:"6",y:"11",width:"22",height:"15",rx:"2.5",fill:"none",stroke:"#00f5ff",strokeWidth:"1.8"}),u.jsx("path",{d:"M17 11V7",stroke:"#00f5ff",strokeWidth:"1.8",strokeLinecap:"round"}),u.jsx("circle",{cx:"17",cy:"5.5",r:"1.5",fill:"#00f5ff"}),u.jsx("circle",{cx:"10",cy:"15.5",r:"1",fill:"#00f5ff"}),u.jsx("circle",{cx:"14",cy:"15.5",r:"1",fill:"#00f5ff"}),u.jsx("path",{d:"M10 20h14",stroke:"#00f5ff",strokeWidth:"1.5",strokeLinecap:"round"}),t&&u.jsx("text",{x:"46",y:"23",fill:"#00f5ff",fontFamily:"'Courier New', Courier, monospace",fontSize:"17",fontWeight:"700",letterSpacing:"-0.5",children:"derez.ai"})]})}function is({height:e=26}){return u.jsx("a",{className:"brand-link",href:"https://derez.ai/",target:"_blank",rel:"noopener noreferrer",title:"derez.ai — AI Agent Hosting",children:u.jsx(qc,{height:e})})}function Rh(){const e=j(o=>o.config),t=j(o=>o.saveConnection),n=j(o=>o.removeConnection),r=j(o=>o.setActiveConnection),[l,i]=R.useState(null);return u.jsx("div",{className:"screen",children:u.jsxs("div",{className:"card",children:[u.jsx("div",{style:{marginBottom:18},children:u.jsx(is,{height:30})}),u.jsx("h1",{children:"Connect to your Hermes"}),u.jsxs("p",{className:"lead",children:["Point this app at your Hermes ",u.jsx("strong",{children:"API Server"})," (the OpenAI-compatible endpoint), not the dashboard. It authenticates with your ",u.jsx("code",{children:"API_SERVER_KEY"}),"."]}),u.jsx(gl,{onSave:t}),e.connections.length>0&&u.jsxs("div",{className:"section",style:{marginTop:24,marginBottom:0},children:[u.jsx("h3",{children:"Saved connections"}),e.connections.map(o=>u.jsxs("div",{children:[u.jsxs("div",{className:"kv",children:[u.jsxs("span",{className:"link-btn",style:{cursor:"pointer"},onClick:()=>r(o.id),children:[o.name,o.profile?` · ${o.profile}`:""]}),u.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[o.sameOrigin?"same origin":o.baseUrl,u.jsx("button",{className:`icon-btn ${l===o.id?"active":""}`,title:"Edit",onClick:()=>i(l===o.id?null:o.id),children:u.jsx(ls,{width:15,height:15})}),u.jsx("button",{className:"icon-btn",title:"Remove",onClick:()=>n(o.id),children:u.jsx(ns,{width:15,height:15})})]})]}),l===o.id&&u.jsx("div",{style:{margin:"10px 0 18px"},children:u.jsx(gl,{initial:o,onSave:async s=>{await t(s),i(null)},onCancel:()=>i(null),saveLabel:"Save changes"})})]},o.id))]})]})})}function Lh(e){if(!e)return"";const t=e>1e12?e:e*1e3,n=Date.now()-t,r=Math.round(n/1e3);if(r<60)return"just now";const l=Math.round(r/60);if(l<60)return`${l}m ago`;const i=Math.round(l/60);if(i<24)return`${i}h ago`;const o=Math.round(i/24);return o<7?`${o}d ago`:new Date(t).toLocaleDateString()}function zh(e){return e==null||e===0?"":e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function Ih(e){return e?e.length>14?`${e.slice(0,13)}…`:e:""}function Mh({s:e}){const t=j(c=>c.activeSessionId),n=j(c=>c.openSession),r=j(c=>c.deleteSession),l=j(c=>c.renameSession),i=j(c=>c.forkSession),o=t===e.id,s=()=>{const c=window.prompt("Rename session",e.title);c&&c.trim()&&l(e.id,c.trim())},a=()=>{window.confirm(`Delete "${e.title}"? This cannot be undone.`)&&r(e.id)};return u.jsxs("div",{className:`session-item ${o?"active":""}`,onClick:()=>n(e.id),title:e.preview||void 0,children:[u.jsxs("div",{className:"body",children:[u.jsx("div",{className:"title",children:e.title}),u.jsxs("div",{className:"meta",children:[u.jsx("span",{children:Lh(e.updatedAt)}),typeof e.messageCount=="number"&&e.messageCount>0&&u.jsxs("span",{children:[e.messageCount," msg"]}),e.source&&u.jsx("span",{children:Ih(e.source)}),e.costUsd?u.jsx("span",{children:zh(e.costUsd)}):null]})]}),u.jsxs("div",{className:"actions",onClick:c=>c.stopPropagation(),children:[u.jsx("button",{className:"icon-btn",title:"Rename",onClick:s,children:u.jsx(ls,{width:15,height:15})}),u.jsx("button",{className:"icon-btn",title:"Fork",onClick:()=>i(e.id),children:u.jsx(xn,{width:15,height:15})}),u.jsx("button",{className:"icon-btn",title:"Delete",onClick:a,children:u.jsx(ns,{width:15,height:15})})]})]})}function Oh(){const e=j(a=>a.config.connections),t=j(a=>a.config.activeConnectionId),n=j(a=>a.setActiveConnection),r=j(a=>a.setShowSettings),[l,i]=R.useState(!1),o=R.useRef(null);R.useEffect(()=>{const a=c=>{o.current&&!o.current.contains(c.target)&&i(!1)};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[]);const s=e.find(a=>a.id===t)??e[0];return u.jsxs("div",{className:"profile-switch",ref:o,children:[u.jsxs("button",{className:"profile-btn",onClick:()=>i(a=>!a),children:[u.jsx("span",{className:"dot"}),u.jsx("span",{className:"name",children:(s==null?void 0:s.name)??"No connection"}),(s==null?void 0:s.profile)&&u.jsx("span",{className:"sub",children:s.profile}),u.jsx(jh,{width:15,height:15,style:{marginLeft:6,color:"var(--text-faint)"}})]}),l&&u.jsxs("div",{className:"menu",children:[e.map(a=>u.jsxs("button",{className:"menu-item",onClick:()=>{i(!1),a.id!==t&&n(a.id)},children:[u.jsx("span",{children:a.name}),a.profile&&u.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:a.profile}),a.id===t&&u.jsx(rs,{width:15,height:15,className:"check"})]},a.id)),u.jsxs("button",{className:"menu-item",onClick:()=>{i(!1),r(!0)},children:[u.jsx(xn,{width:15,height:15}),u.jsx("span",{children:"Add connection…"})]})]})]})}function Dh(){const e=j(c=>c.sessions),t=j(c=>c.sessionsLoading),n=j(c=>c.searchQuery),r=j(c=>c.setSearch),l=j(c=>c.newSession),i=j(c=>c.loadSessions),o=j(c=>c.setShowSettings),s=j(c=>c.sidebarOpen),a=j(c=>c.setSidebarOpen);return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:`scrim ${s?"show":""}`,onClick:()=>a(!1)}),u.jsxs("aside",{className:`sidebar ${s?"open":""}`,children:[u.jsxs("div",{className:"sidebar-head",children:[u.jsxs("div",{className:"brand",children:[u.jsx(is,{height:26}),u.jsxs("div",{className:"brand-actions",children:[u.jsx("button",{className:"icon-btn",title:"Refresh",onClick:()=>i(),children:u.jsx(Nh,{width:17,height:17})}),u.jsx("button",{className:"icon-btn",title:"Settings",onClick:()=>o(!0),children:u.jsx(Sh,{width:17,height:17})})]})]}),u.jsx(Oh,{}),u.jsxs("button",{className:"new-chat",onClick:()=>l(),children:[u.jsx(xn,{width:17,height:17}),"New chat"]}),u.jsxs("div",{className:"search-wrap",children:[u.jsx(gh,{width:16,height:16}),u.jsx("input",{value:n,onChange:c=>r(c.target.value),placeholder:"Filter sessions…"})]})]}),u.jsx("div",{className:"sidebar-tools",children:u.jsxs("span",{children:[e.length," sessions"]})}),u.jsxs("div",{className:"session-list",children:[t&&e.length===0&&u.jsx("div",{className:"empty",children:"Loading sessions…"}),!t&&e.length===0&&u.jsxs("div",{className:"empty",children:["No sessions yet.",u.jsx("br",{}),"Start a new chat to begin."]}),e.map(c=>u.jsx(Mh,{s:c},c.id))]})]})]})}function $h(e,t){const n=(t||"image").trim().replace(/[^\w.-]+/g,"_").replace(/^_+|_+$/g,"").slice(0,48)||"image";let r="";const l=/^data:image\/([a-zA-Z0-9.+-]+)/.exec(e);if(l)r=l[1].toLowerCase();else try{const i=new URL(e,location.href).pathname,o=/\.([a-zA-Z0-9]{2,5})$/.exec(i);o&&(r=o[1].toLowerCase())}catch{}return r==="jpeg"&&(r="jpg"),r||(r="png"),`${n}.${r}`}function bc(e,t){const n=document.createElement("a");n.href=e,n.download=$h(e,t),n.rel="noopener",document.body.appendChild(n),n.click(),n.remove()}function Uh(e,t,n){const r=t.trim();if(!r)return null;let l=e.trim();const i=n.trim();return i&&l.startsWith(i)&&(l=l.slice(i.length)),l.startsWith("/")||(l=`/${l}`),r.replace(/\/+$/,"")+l}function Ah(e){const t=e.trim().replace(/[/\\]+$/,""),n=t.split(/[/\\]/);return n[n.length-1]||t}const ku=/(`[^`]+`)|(!\[[^\]]*\]\([^)]*\))|(\[[^\]]*\]\([^)]*\))|(\*\*[^*]+\*\*)|(\*[^*\n]+\*)|(https?:\/\/[^\s<)]+)|(data:image\/[^\s)]+)|(MEDIA:\S+)/g;function ju(e){const t=e.indexOf("](");return t===-1?{label:e,url:""}:{label:e.slice(0,t),url:e.slice(t+2)}}function Fh(e){return e.startsWith("data:")?e.replace(/\s+/g,""):e}function Vh({path:e}){const t=j(s=>s.config.mediaBaseUrl),n=j(s=>s.config.mediaPathPrefix),[r,l]=R.useState(!1),i=Uh(e,t,n),o=Ah(e);return i&&!r?u.jsxs("span",{className:"md-figure",children:[u.jsx("img",{src:i,alt:o,onError:()=>l(!0)}),u.jsxs("button",{type:"button",className:"md-download",onClick:()=>bc(i,o),children:[u.jsx(Jc,{width:15,height:15}),"Download"]})]}):u.jsxs("span",{className:"media-ref",title:e,children:[u.jsx(Ol,{width:15,height:15}),u.jsx("span",{className:"nm",children:o}),u.jsx("span",{className:"path",children:e})]})}function Cu({url:e,alt:t}){const n=Fh(e);return u.jsxs("span",{className:"md-figure",children:[u.jsx("img",{src:n,alt:t}),u.jsxs("button",{type:"button",className:"md-download",onClick:()=>bc(n,t),children:[u.jsx(Jc,{width:15,height:15}),"Download"]})]})}function Eu(e,t){const n=[];let r=0,l=0,i;for(ku.lastIndex=0;(i=ku.exec(e))!==null;){i.index>r&&n.push(e.slice(r,i.index));const o=i[0],s=`${t}-${l++}`;if(i[1])n.push(u.jsx("code",{children:o.slice(1,-1)},s));else if(i[2]){const{label:a,url:c}=ju(o.slice(2,-1));n.push(u.jsx(Cu,{url:c,alt:a},s))}else if(i[3]){const{label:a,url:c}=ju(o.slice(1,-1));n.push(u.jsx("a",{href:c,target:"_blank",rel:"noreferrer noopener",children:a},s))}else i[4]?n.push(u.jsx("strong",{children:o.slice(2,-2)},s)):i[5]?n.push(u.jsx("em",{children:o.slice(1,-1)},s)):i[6]?n.push(u.jsx("a",{href:o,target:"_blank",rel:"noreferrer noopener",children:o},s)):i[7]?n.push(u.jsx(Cu,{url:o,alt:"image"},s)):i[8]&&n.push(u.jsx(Vh,{path:o.slice(6)},s));r=i.index+o.length}return rr&&t.push(u.jsx("span",{children:Eu(e.slice(r,l.index),`t${i}`)},`t${i}`)),t.push(u.jsx("pre",{children:u.jsx("code",{children:l[2].replace(/\n$/,"")})},`c${i}`)),r=l.index+l[0].length,i++;return r{const r=/^image\//.test(t.mime)||t.dataUrl.startsWith("data:image");return u.jsxs("div",{className:"attachment",children:[r?u.jsx("img",{src:t.dataUrl,alt:t.name}):u.jsx(Ol,{width:16,height:16}),u.jsx("span",{className:"nm",children:t.name})]},n)})}):null}function Bh({call:e}){const[t,n]=R.useState(!1),r=e.status==="error"?"error":e.status==="done"?"done":"running…";return u.jsxs("div",{className:"tool-card",children:[u.jsxs("div",{className:"head",onClick:()=>n(l=>!l),style:{cursor:e.preview?"pointer":"default"},children:[u.jsx(Ol,{width:15,height:15,style:{color:"var(--text-dim)"}}),u.jsx("span",{className:"name",children:e.name}),u.jsx("span",{className:`status ${e.status==="error"?"err":e.status==="done"?"ok":""}`,children:r})]}),e.preview&&t&&u.jsx("div",{className:"preview",children:e.preview})]})}function Wh({message:e}){const[t,n]=R.useState(!1);return u.jsxs("div",{className:"tool-card",children:[u.jsxs("div",{className:"head",onClick:()=>n(r=>!r),style:{cursor:"pointer"},children:[u.jsx(Ol,{width:15,height:15,style:{color:"var(--text-dim)"}}),u.jsx("span",{className:"name",children:e.toolName??"tool result"}),u.jsx("span",{className:"status ok",children:"result"})]}),t&&u.jsx("div",{className:"preview",children:ef(e.content)})]})}function Qh({message:e}){return u.jsx("div",{style:{fontSize:12.5,color:"var(--text-faint)",padding:"2px 0 2px 41px",whiteSpace:"pre-wrap"},children:e.content})}function Kh({message:e}){const{speak:t}=Zc(),[n,r]=R.useState(!1),l=j(g=>g.config.showToolCalls),i=j(g=>g.config.showReasoning),o=j(g=>g.config.showSystem);if(e.role==="tool")return l?u.jsx(Wh,{message:e}):null;if(e.role==="system")return o?u.jsx(Qh,{message:e}):null;const s=e.role==="user",a=e.content,c=e.toolCalls??[],p=e.attachments??[],h=!!e.streaming;if(!(!!a||i&&!!e.reasoning||l&&c.length>0||p.length>0||h))return null;const y=async()=>{try{await navigator.clipboard.writeText(a),r(!0),setTimeout(()=>r(!1),1400)}catch{}};return u.jsxs("div",{className:`msg ${s?"user":"assistant"}`,children:[u.jsx("div",{className:`avatar ${s?"user":"brand"}`,children:s?u.jsx(Eh,{width:16,height:16}):u.jsx(qc,{height:30,withText:!1})}),u.jsxs("div",{className:"content",children:[u.jsx("div",{className:"who",children:s?"You":"Hermes"}),e.reasoning&&i&&u.jsxs("details",{className:"reasoning",children:[u.jsxs("summary",{children:[u.jsx(_h,{width:14,height:14}),"Reasoning"]}),u.jsx("div",{className:"body",children:e.reasoning})]}),l&&c.map(g=>u.jsx(Bh,{call:g},g.id)),a?u.jsx("div",{className:"bubble",children:s?a:ef(a)}):h?u.jsxs("div",{className:"typing",children:[u.jsx("span",{}),u.jsx("span",{}),u.jsx("span",{})]}):null,u.jsx(Hh,{items:p}),!s&&a&&!h&&u.jsxs("div",{className:"msg-actions",children:[u.jsx("button",{className:"icon-btn",title:"Copy",onClick:y,children:n?u.jsx(rs,{width:15,height:15}):u.jsx("span",{style:{fontSize:13},children:"⧉"})}),u.jsx("button",{className:"icon-btn",title:"Speak",onClick:()=>t(a),children:u.jsx(Ch,{width:15,height:15})})]})]})]})}function Nu(){const e=window;return e.SpeechRecognition??e.webkitSpeechRecognition??null}function Yh(){const[e,t]=R.useState(!1),[n,r]=R.useState(""),[l,i]=R.useState(null),o=R.useRef(null),s=R.useRef(""),a=typeof window<"u"&&!!Nu(),c=R.useCallback(()=>{var h;(h=o.current)==null||h.stop(),t(!1)},[]),p=R.useCallback(h=>{const d=Nu();if(!d){i("Speech recognition isn't supported in this browser.");return}i(null),r(""),s.current="";const y=new d;y.lang=navigator.language||"en-US",y.continuous=!0,y.interimResults=!0,y.onresult=g=>{let x="";for(let z=g.resultIndex;z{i(g.error==="not-allowed"?"Microphone permission denied.":"Speech recognition error."),t(!1)},y.onend=()=>{t(!1),r("");const g=s.current.trim();g&&h(g)},o.current=y,y.start(),t(!0)},[]);return{supported:a,listening:e,interim:n,error:l,start:p,stop:c}}function Gh(){const[e,t]=R.useState(!1),[n,r]=R.useState(null),l=R.useRef(null),i=R.useRef([]),o=R.useRef(null),s=R.useCallback(async()=>{var c;if(r(null),!((c=navigator.mediaDevices)!=null&&c.getUserMedia))return r("Microphone capture is not supported in this browser."),!1;try{const p=await navigator.mediaDevices.getUserMedia({audio:!0}),h=new MediaRecorder(p);return i.current=[],h.ondataavailable=d=>{d.data.size>0&&i.current.push(d.data)},h.onstop=()=>{var y;p.getTracks().forEach(g=>g.stop());const d=new Blob(i.current,{type:h.mimeType||"audio/webm"});(y=o.current)==null||y.call(o,d.size>0?d:null),o.current=null},l.current=h,h.start(),t(!0),!0}catch(p){return r(p instanceof Error?p.message:"Could not access the microphone."),!1}},[]),a=R.useCallback(()=>new Promise(c=>{const p=l.current;if(!p||p.state==="inactive"){t(!1),c(null);return}o.current=c,p.stop(),t(!1)}),[]);return{recording:e,error:n,start:s,stop:a}}async function Xh(e,t){const n=new FormData,r=e.type.includes("ogg")?"ogg":e.type.includes("mp4")?"mp4":"webm";n.append("file",e,`recording.${r}`),t.model&&n.append("model",t.model);const l={};t.key&&(l.Authorization=`Bearer ${t.key}`);let i;try{i=await fetch(t.url,{method:"POST",headers:l,body:n})}catch{throw new Error(`Could not reach the transcription endpoint (${t.url}).`)}const o=await i.text();let s;try{s=o?JSON.parse(o):void 0}catch{s=o}if(!i.ok){const a=s&&typeof s=="object"?s.error:void 0,c=typeof a=="string"?a:a==null?void 0:a.message;throw new Error(c||`Transcription failed (HTTP ${i.status}).`)}if(s&&typeof s=="object"){const a=s;if(typeof a.text=="string")return a.text;if(typeof a.transcript=="string")return a.transcript}return typeof s=="string"?s:""}function Zh(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t({name:e.name,mime:e.type||"application/octet-stream",dataUrl:String(r.result),size:e.size}),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}const Jh=()=>{var e;return typeof window<"u"&&((e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)};function qh(){const e=j(k=>k.streaming),t=j(k=>k.send),n=j(k=>k.steer),r=j(k=>k.cancel),l=j(k=>k.steerLeftover),i=j(k=>k.clearSteerLeftover),o=j(k=>k.setToast),s=j(k=>k.config.transcribeUrl),a=j(k=>k.config.transcribeKey),c=j(k=>k.config.transcribeModel),[p,h]=R.useState(""),[d,y]=R.useState([]),[g,x]=R.useState(!1),z=R.useRef(null),m=R.useRef(null),f=Yh(),v=Gh(),w=!f.supported&&!!s.trim(),C=f.supported||w,_=f.listening||v.recording;R.useEffect(()=>{l&&(h(k=>k||l),i())},[l,i]),R.useEffect(()=>{f.error&&o(f.error)},[f.error,o]),R.useEffect(()=>{v.error&&o(v.error)},[v.error,o]),R.useEffect(()=>{const k=z.current;k&&(k.style.height="auto",k.style.height=`${Math.min(k.scrollHeight,200)}px`)},[p]);const P=async k=>{for(const U of k)try{const Ae=await Zh(U);y(E=>[...E,Ae])}catch{o(`Could not attach ${U.name}`)}},T=()=>{const k=p.trim();if(!(!k&&!d.length)){if(e){n(k),h("");return}t(k,d),h(""),y([])}},H=k=>{const U=k.trim();U&&h(Ae=>Ae?`${Ae} ${U}`:U)},M=async()=>{if(f.listening){f.stop();return}if(v.recording){const k=await v.stop();if(!k)return;x(!0);try{const U=await Xh(k,{url:s.trim(),key:a.trim()||void 0,model:c.trim()||void 0});H(U)}catch(U){o(U instanceof Error?U.message:"Transcription failed.")}finally{x(!1)}}},we=async()=>{if(_){await M();return}if(f.supported){if(!window.isSecureContext){o("Dictation needs a secure context (HTTPS or localhost).");return}f.start(H);return}if(w){await v.start()||o("Could not access the microphone.");return}o("Dictation isn't available in this browser. Use Chrome, Edge, or Safari — or set a transcription endpoint in Settings.")},jt=k=>{k.key==="Enter"&&!k.shiftKey&&!Jh()&&(k.preventDefault(),T())},Ct=p.trim().length>0||d.length>0,Sn=g?"Transcribing…":f.listening?f.interim||"Listening…":v.recording?"Recording… tap the mic to stop":"";return u.jsx("div",{className:"composer-wrap",children:u.jsxs("div",{className:"composer",onDragOver:k=>k.preventDefault(),onDrop:k=>{var U;k.preventDefault(),(U=k.dataTransfer.files)!=null&&U.length&&P(Array.from(k.dataTransfer.files))},children:[d.length>0&&u.jsx("div",{className:"attach-chips",children:d.map(k=>u.jsxs("div",{className:"chip",children:[/^image\//.test(k.mime)?u.jsx("img",{src:k.dataUrl,alt:k.name}):u.jsx(Su,{width:15,height:15}),u.jsx("span",{className:"nm",children:k.name}),u.jsx("button",{title:"Remove",onClick:()=>y(U=>U.filter(Ae=>Ae!==k)),children:u.jsx(ts,{width:14,height:14})})]},k.name+k.size))}),Sn&&u.jsxs("div",{className:"recording-pill",style:{padding:"2px 4px"},children:[!g&&u.jsx("span",{className:"pulse"}),u.jsx("span",{style:{color:"var(--text-dim)"},children:Sn})]}),u.jsx("textarea",{ref:z,rows:1,value:p,onChange:k=>h(k.target.value),onKeyDown:jt,onPaste:k=>{const U=Array.from(k.clipboardData.files);U.length&&(k.preventDefault(),P(U))},placeholder:e?"Steer the running turn…":"Message Hermes…"}),u.jsxs("div",{className:"composer-row",children:[u.jsx("input",{ref:m,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:k=>{var U;(U=k.target.files)!=null&&U.length&&P(Array.from(k.target.files)),k.target.value=""}}),u.jsx("button",{className:"icon-btn",title:"Attach image",onClick:()=>{var k;return(k=m.current)==null?void 0:k.click()},children:u.jsx(Su,{width:19,height:19})}),u.jsx("button",{className:`icon-btn ${_?"active":""}`,title:_?"Stop dictation":C?"Dictate (speak your prompt)":"Dictation unavailable — see Settings",onClick:we,disabled:g,children:u.jsx(wh,{width:19,height:19})}),u.jsx("div",{className:"spacer"}),e?u.jsx("button",{className:"send-btn stop",title:"Stop",onClick:()=>r(),children:u.jsx(xh,{width:18,height:18})}):u.jsx("button",{className:"send-btn",title:"Send",disabled:!Ct,onClick:T,children:u.jsx(yh,{width:18,height:18})})]})]})})}function bh(){const e=j(a=>a.config.showToolCalls),t=j(a=>a.config.showReasoning),n=j(a=>a.config.showSystem),r=j(a=>a.updatePrefs),[l,i]=R.useState(!1),o=R.useRef(null);R.useEffect(()=>{const a=c=>{o.current&&!o.current.contains(c.target)&&i(!1)};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[]);const s=[["Tool calls & results",e,a=>r({showToolCalls:a})],["Reasoning",t,a=>r({showReasoning:a})],["System messages",n,a=>r({showSystem:a})]];return u.jsxs("div",{className:"profile-switch",ref:o,style:{width:"auto"},children:[u.jsx("button",{className:`icon-btn ${l?"active":""}`,title:"Filter messages",onClick:()=>i(a=>!a),children:u.jsx(Ph,{width:19,height:19})}),l&&u.jsx("div",{className:"menu",style:{left:"auto",right:0,width:230},children:s.map(([a,c,p])=>u.jsxs("label",{className:"menu-item toggle",children:[u.jsx("input",{type:"checkbox",checked:c,onChange:h=>p(h.target.checked)}),a]},a))})]})}function em(){const e=j(p=>p.session),t=j(p=>p.messages),n=j(p=>p.sessionLoading),r=j(p=>p.streamError),l=j(p=>p.setSidebarOpen),i=j(p=>p.newSession),o=R.useRef(null),s=R.useRef(!0),a=()=>{const p=o.current;p&&(s.current=p.scrollHeight-p.scrollTop-p.clientHeight<120)};R.useEffect(()=>{const p=o.current;p&&s.current&&(p.scrollTop=p.scrollHeight)},[t]);const c=u.jsxs("div",{className:"chat-head",children:[u.jsx("button",{className:"icon-btn menu-btn",onClick:()=>l(!0),children:u.jsx(kh,{width:20,height:20})}),u.jsxs("div",{className:"titles",children:[u.jsx("div",{className:"t",children:(e==null?void 0:e.title)??"Hermes"}),u.jsxs("div",{className:"s",children:[(e==null?void 0:e.model)&&u.jsx("span",{className:"pill",children:e.model}),(e==null?void 0:e.source)&&u.jsx("span",{children:e.source})]})]}),u.jsx(bh,{}),u.jsx("button",{className:"icon-btn",title:"New chat",onClick:()=>i(),children:u.jsx(xn,{width:19,height:19})})]});return!e&&!n?u.jsxs("div",{className:"main",children:[c,u.jsx("div",{className:"center-fill",children:u.jsxs("div",{children:[u.jsx("div",{style:{fontSize:40,marginBottom:12},children:"💬"}),u.jsx("div",{style:{color:"var(--text)",fontWeight:600,marginBottom:6},children:"No conversation open"}),u.jsx("div",{children:"Pick a session from the sidebar, or start a new chat."}),u.jsx("button",{className:"btn primary",style:{marginTop:18},onClick:()=>i(),children:"New chat"})]})})]}):u.jsxs("div",{className:"main",children:[c,u.jsx("div",{className:"messages",ref:o,onScroll:a,children:u.jsxs("div",{className:"messages-inner",children:[n&&u.jsx("div",{className:"center-fill",children:u.jsx("div",{className:"spinner"})}),t.map(p=>u.jsx(Kh,{message:p},p.id)),r&&u.jsx("div",{className:"alert error",children:r})]})}),u.jsx(qh,{})]})}function fi(){const e=j(g=>g.config),t=j(g=>g.capabilities),n=j(g=>g.models),r=j(g=>g.saveConnection),l=j(g=>g.removeConnection),i=j(g=>g.setActiveConnection),o=j(g=>g.updatePrefs),s=j(g=>g.setShowSettings),[a,c]=R.useState(!1),[p,h]=R.useState(null),d=Qn(e),y=t!=null&&t.features?Object.entries(t.features):[];return u.jsx("div",{className:"panel",onClick:()=>s(!1),children:u.jsxs("div",{className:"panel-inner",onClick:g=>g.stopPropagation(),children:[u.jsxs("div",{className:"panel-head",children:[u.jsx("h2",{children:"Settings"}),u.jsx("button",{className:"icon-btn",onClick:()=>s(!1),children:u.jsx(ts,{width:20,height:20})})]}),u.jsxs("div",{className:"section",children:[u.jsx("h3",{children:"Connections"}),e.connections.map(g=>u.jsxs("div",{children:[u.jsxs("div",{className:"kv",children:[u.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[u.jsxs("button",{className:"link-btn",style:{cursor:"pointer"},onClick:()=>i(g.id),children:[g.name,g.profile?` · ${g.profile}`:""]}),g.id===e.activeConnectionId&&u.jsx(rs,{width:14,height:14,style:{color:"var(--accent)"}})]}),u.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[g.sameOrigin?"same origin":g.baseUrl,u.jsx("button",{className:`icon-btn ${p===g.id?"active":""}`,title:"Edit",onClick:()=>{c(!1),h(p===g.id?null:g.id)},children:u.jsx(ls,{width:15,height:15})}),u.jsx("button",{className:"icon-btn",title:"Remove",onClick:()=>l(g.id),children:u.jsx(ns,{width:15,height:15})})]})]}),p===g.id&&u.jsx("div",{style:{margin:"10px 0 18px"},children:u.jsx(gl,{initial:g,onSave:async x=>{await r(x),h(null)},onCancel:()=>h(null),saveLabel:"Save changes"})})]},g.id)),a?u.jsx("div",{style:{marginTop:12},children:u.jsx(gl,{onSave:async g=>{await r(g),c(!1)},onCancel:()=>c(!1),saveLabel:"Add"})}):u.jsxs("button",{className:"btn",style:{marginTop:12},onClick:()=>{h(null),c(!0)},children:[u.jsx(xn,{width:15,height:15,style:{verticalAlign:"-2px",marginRight:6}}),"Add connection"]})]}),u.jsxs("div",{className:"section",children:[u.jsx("h3",{children:"Voice"}),u.jsxs("label",{className:"toggle",style:{marginBottom:12},children:[u.jsx("input",{type:"checkbox",checked:e.speakReplies,onChange:g=>o({speakReplies:g.target.checked})}),"Speak replies automatically"]}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"Voice (browser)"}),u.jsx("input",{value:e.ttsVoice,onChange:g=>o({ttsVoice:g.target.value}),placeholder:"System default"})]})]}),u.jsxs("div",{className:"section",children:[u.jsx("h3",{children:"Dictation"}),u.jsx("div",{className:"hint",style:{marginTop:0,marginBottom:10},children:"Chrome, Edge, and Safari dictate on-device via the Web Speech API. Firefox has no speech API, so set an OpenAI-compatible transcription endpoint below to dictate there."}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"Transcription endpoint"}),u.jsx("input",{value:e.transcribeUrl,onChange:g=>o({transcribeUrl:g.target.value}),placeholder:"https://api.openai.com/v1/audio/transcriptions",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,inputMode:"url"}),u.jsxs("div",{className:"hint",children:["Any OpenAI-compatible ",u.jsx("code",{children:"/v1/audio/transcriptions"})," — OpenAI, Groq, or a local whisper.cpp server. Leave empty to disable."]})]}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"API key"}),u.jsx("input",{type:"password",value:e.transcribeKey,onChange:g=>o({transcribeKey:g.target.value}),placeholder:"sk-…",autoCapitalize:"none"})]}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"Model"}),u.jsx("input",{value:e.transcribeModel,onChange:g=>o({transcribeModel:g.target.value}),placeholder:"whisper-1",autoCapitalize:"none"})]})]}),u.jsxs("div",{className:"section",children:[u.jsx("h3",{children:"Media"}),u.jsxs("div",{className:"hint",style:{marginTop:0,marginBottom:10},children:["Your agent emits ",u.jsx("code",{children:"MEDIA:/path/to/file.png"})," for generated files. The Hermes API server can't serve those, so point this at a URL where the agent's workspace is reachable to render them as images."]}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"Media base URL"}),u.jsx("input",{value:e.mediaBaseUrl,onChange:g=>o({mediaBaseUrl:g.target.value}),placeholder:"https://files.example.com",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,inputMode:"url"})]}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"Strip path prefix"}),u.jsx("input",{value:e.mediaPathPrefix,onChange:g=>o({mediaPathPrefix:g.target.value}),placeholder:"/root/workspace",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1}),u.jsxs("div",{className:"hint",children:["Removed from the start of the path before appending. E.g. base"," ",u.jsx("code",{children:"https://files.example.com"})," + prefix ",u.jsx("code",{children:"/root/workspace"})," turns"," ",u.jsx("code",{children:"MEDIA:/root/workspace/a.png"})," into"," ",u.jsx("code",{children:"https://files.example.com/a.png"}),"."]})]})]}),u.jsxs("div",{className:"section",children:[u.jsx("h3",{children:"Server"}),u.jsxs("div",{className:"kv",children:[u.jsx("span",{children:"Connection"}),u.jsx("span",{children:(d==null?void 0:d.name)??"—"})]}),u.jsxs("div",{className:"kv",children:[u.jsx("span",{children:"Platform"}),u.jsx("span",{children:(t==null?void 0:t.platform)??"—"})]}),u.jsxs("div",{className:"kv",children:[u.jsx("span",{children:"Model"}),u.jsx("span",{children:(t==null?void 0:t.model)??"—"})]}),u.jsxs("div",{className:"kv",children:[u.jsx("span",{children:"Models available"}),u.jsx("span",{children:n.length||"—"})]}),y.length>0&&u.jsxs("div",{style:{marginTop:10},children:[u.jsx("div",{className:"hint",style:{marginBottom:6},children:"Features"}),u.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:y.filter(([,g])=>g===!0).map(([g])=>u.jsx("span",{style:{fontSize:11,padding:"2px 8px",borderRadius:20,background:"var(--bg-elev2)",border:"1px solid var(--border)",color:"var(--text-dim)"},children:g},g))})]})]})]})})}function di(){const e=j(n=>n.toast),t=j(n=>n.setToast);return R.useEffect(()=>{if(!e)return;const n=setTimeout(()=>t(null),5e3);return()=>clearTimeout(n)},[e,t]),e?u.jsx("div",{className:"toast",onClick:()=>t(null),children:e}):null}function tm(){const e=j(i=>i.messages),t=j(i=>i.streaming),n=j(i=>i.config.speakReplies),{speak:r}=Zc(),l=R.useRef(null);return R.useEffect(()=>{if(!n||t)return;const i=e[e.length-1];!i||i.role!=="assistant"||!i.id||i.id===l.current||i.content.trim()&&(l.current=i.id,r(i.content))},[e,t,n,r]),null}function nm(){const e=j(o=>o.ready),t=j(o=>o.config),n=j(o=>o.connectionError),r=j(o=>o.showSettings),l=j(o=>o.bootstrap),i=j(o=>o.connect);return R.useEffect(()=>{l()},[l]),e?ph(t)?n?u.jsxs("div",{className:"screen",children:[u.jsxs("div",{className:"card",children:[u.jsx("div",{style:{marginBottom:18},children:u.jsx(is,{height:30})}),u.jsx("h1",{children:"Can’t reach Hermes"}),u.jsx("p",{className:"lead",children:n}),u.jsxs("div",{className:"actions",children:[u.jsx("button",{className:"btn",onClick:()=>j.getState().setShowSettings(!0),children:"Settings"}),u.jsx("button",{className:"btn primary",onClick:()=>i(),children:"Retry"})]})]}),r&&u.jsx(fi,{}),u.jsx(di,{})]}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"app",children:[u.jsx(Dh,{}),u.jsx(em,{})]}),u.jsx(tm,{}),r&&u.jsx(fi,{}),u.jsx(di,{})]}):u.jsxs(u.Fragment,{children:[u.jsx(Rh,{}),r&&u.jsx(fi,{}),u.jsx(di,{})]}):u.jsx("div",{className:"screen",children:u.jsx("div",{className:"spinner"})})}Mp({immediate:!0});const _u=document.getElementById("root");_u&&Vc(_u).render(u.jsx(R.StrictMode,{children:u.jsx(nm,{})})); +`))!==-1;){const g=a.slice(0,y);a=a.slice(y+2),c(g)}}a.trim()&&c(a)}finally{(p=o.releaseLock)==null||p.call(o)}}}const io=2,Rt={connections:[],activeConnectionId:null,speakReplies:!1,ttsVoice:"",showToolCalls:!1,showReasoning:!1,showSystem:!0,transcribeUrl:"",transcribeKey:"",transcribeModel:"whisper-1",mediaBaseUrl:"",mediaPathPrefix:"",prefsVersion:io},Xc="hermes.config.v2";function dh(){try{const e=localStorage.getItem(Xc);if(!e)return{...Rt};const t=JSON.parse(e),n={...Rt,...t,connections:Array.isArray(t.connections)?t.connections:[]};return(t.prefsVersion??1)t.id===e.activeConnectionId)??e.connections[0]??null:null}function ph(e){const t=Qn(e);return!!t&&(t.sameOrigin===!0||t.baseUrl.trim().length>0)}function hh(){return`conn-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`}let Rn=null;function mh(e){return new Gc({baseUrl:e.baseUrl,apiKey:e.apiKey,profile:e.profile,sameOrigin:e.sameOrigin,customHeaders:e.customHeaders})}function Ve(e){return e instanceof Wn||e instanceof Error?e.message:String(e)}function rt(e,t,n){return e.map(r=>r.id===t?n(r):r)}const j=uh()((e,t)=>({config:{...Rt},client:null,ready:!1,connectionError:null,capabilities:null,models:[],sessions:[],sessionsLoading:!1,searchQuery:"",activeSessionId:null,session:null,messages:[],sessionLoading:!1,streaming:!1,runId:null,streamError:null,steerLeftover:null,sidebarOpen:!1,showSettings:!1,toast:null,async bootstrap(){const n=dh();e({config:n,ready:!0}),Qn(n)&&await t().connect()},async saveConnection(n){const r=t().config,i=r.connections.some(s=>s.id===n.id)?r.connections.map(s=>s.id===n.id?n:s):[...r.connections,n],o={...r,connections:i,activeConnectionId:n.id};Mr(o),e({config:o}),await t().connect()},async removeConnection(n){var s;const r=t().config,l=r.connections.filter(a=>a.id!==n),i=r.activeConnectionId===n?((s=l[0])==null?void 0:s.id)??null:r.activeConnectionId,o={...r,connections:l,activeConnectionId:i};Mr(o),e({config:o,sessions:[],session:null,messages:[],activeSessionId:null}),Qn(o)&&await t().connect()},async setActiveConnection(n){const r={...t().config,activeConnectionId:n};Mr(r),e({config:r,sessions:[],session:null,messages:[],activeSessionId:null}),await t().connect()},updatePrefs(n){const r={...t().config,...n};Mr(r),e({config:r})},async connect(){const n=Qn(t().config);if(!n||!n.sameOrigin&&!n.baseUrl.trim())return;const r=mh(n);e({client:r,connectionError:null,capabilities:null});try{const l=await r.capabilities();e({capabilities:l}),r.models().then(i=>e({models:i})).catch(()=>{}),await t().loadSessions()}catch(l){e({connectionError:Ve(l),capabilities:null})}},async loadSessions(){const{client:n,searchQuery:r}=t();if(n){e({sessionsLoading:!0});try{const l=await n.listSessions({limit:200}),i=r.trim().toLowerCase(),o=i?l.filter(s=>s.title.toLowerCase().includes(i)):l;e({sessions:o,sessionsLoading:!1})}catch(l){e({sessionsLoading:!1,toast:Ve(l)})}}},setSearch(n){e({searchQuery:n}),t().loadSessions()},async openSession(n){const{client:r}=t();if(r){e({activeSessionId:n,sessionLoading:!0,session:null,messages:[],sidebarOpen:!1,streamError:null});try{const[l,i]=await Promise.all([r.getSession(n).catch(()=>null),r.getMessages(n,{limit:500,order:"oldest"})]);e({session:l??{id:n,title:"Untitled"},messages:i,sessionLoading:!1})}catch(l){e({sessionLoading:!1,toast:Ve(l)})}}},async newSession(){const{client:n}=t();if(n)try{const r=await n.createSession();e({session:r,messages:[],activeSessionId:r.id,sidebarOpen:!1,streamError:null}),await t().loadSessions()}catch(r){e({toast:Ve(r)})}},async renameSession(n,r){var i;const{client:l}=t();if(l)try{await l.updateSession(n,{title:r}),e({sessions:t().sessions.map(o=>o.id===n?{...o,title:r}:o),session:((i=t().session)==null?void 0:i.id)===n?{...t().session,title:r}:t().session})}catch(o){e({toast:Ve(o)})}},async deleteSession(n){const{client:r}=t();if(r)try{await r.deleteSession(n);const l=t().activeSessionId===n;e({sessions:t().sessions.filter(i=>i.id!==n),...l?{activeSessionId:null,session:null,messages:[]}:{}})}catch(l){e({toast:Ve(l)})}},async forkSession(n){const{client:r}=t();if(r)try{const l=await r.forkSession(n);await t().loadSessions(),await t().openSession(l.id)}catch(l){e({toast:Ve(l)})}},async send(n,r){const{client:l,activeSessionId:i,messages:o}=t();if(!l||!i)return;const s=n.trim();if(!s&&!(r!=null&&r.length)||t().streaming)return;const a={id:`local-user-${Date.now()}`,role:"user",content:s,attachments:r,timestamp:Date.now()},c=`local-assistant-${Date.now()}`,p={id:c,role:"assistant",content:"",timestamp:Date.now(),streaming:!0,toolCalls:[]};e({messages:[...o,a,p],streaming:!0,streamError:null,runId:null});let h=s;if(r!=null&&r.length){const d=[];s&&d.push({type:"text",text:s});for(const y of r)d.push({type:"image_url",image_url:{url:y.dataUrl}});h=d}try{Rn=new AbortController,await l.chatStream(i,{input:h},(d,y)=>vh(e,t,d,y,c),Rn.signal)}catch(d){if((d==null?void 0:d.name)!=="AbortError"){const y=d instanceof Wn&&d.status===409?"This session is owned by another surface (CLI, dashboard, or messaging) and can't be continued from the API server. Start a new chat to talk to the agent here.":Ve(d);e({streamError:y})}}finally{e({streaming:!1,runId:null}),e({messages:rt(t().messages,c,d=>({...d,streaming:!1}))}),t().loadSessions()}},async cancel(){const{client:n,runId:r}=t();if(Rn==null||Rn.abort(),n&&r)try{await n.stopRun(r)}catch(l){e({toast:Ve(l)})}e({streaming:!1})},async steer(n){const{client:r,runId:l}=t();if(!(!r||!l||!n.trim()))try{await r.steerRun(l,n.trim())}catch(i){e({toast:Ve(i)})}},clearSteerLeftover(){e({steerLeftover:null})},setSidebarOpen(n){e({sidebarOpen:n})},setShowSettings(n){e({showSettings:n})},setToast(n){e({toast:n})}}));function ci(e){for(const t of["text","delta","content","output_text"]){const n=e[t];if(typeof n=="string")return n}return""}function xu(e){return String(e.id??e.tool_call_id??e.tool_use_id??e.tool??e.name??Math.random())}function vh(e,t,n,r,l){const i=r??{};switch(typeof i.run_id=="string"&&i.run_id!==t().runId&&e({runId:i.run_id}),n){case"assistant.delta":case"message.delta":{const o=ci(i);if(!o)break;e({messages:rt(t().messages,l,s=>({...s,content:s.content+o}))});break}case"assistant.commentary":case"message.interim":{if(i.already_streamed)break;const o=ci(i);if(!o)break;e({messages:rt(t().messages,l,s=>({...s,content:o}))});break}case"assistant.completed":case"message.complete":{const o=ci(i);e({messages:rt(t().messages,l,s=>({...s,content:o||s.content,streaming:!1}))});break}case"tool.started":{const o={id:xu(i),name:String(i.tool??i.name??"tool"),preview:typeof i.preview=="string"?i.preview:void 0,status:"running"};e({messages:rt(t().messages,l,s=>{const a=s.toolCalls??[],c=a.some(p=>p.id===o.id);return{...s,toolCalls:c?a.map(p=>p.id===o.id?{...p,...o}:p):[...a,o]}})});break}case"tool.completed":case"tool.failed":{const o=n==="tool.failed"||i.error===!0||typeof i.error=="string",s={id:xu(i),name:String(i.tool??i.name??"tool"),preview:typeof i.preview=="string"?i.preview:void 0,status:o?"error":"done",duration:typeof i.duration=="number"?i.duration:void 0};e({messages:rt(t().messages,l,a=>{const c=a.toolCalls??[],p=c.some(h=>h.id===s.id);return{...a,toolCalls:p?c.map(h=>h.id===s.id?{...h,...s}:h):[...c,s]}})});break}case"run.completed":{const o=typeof i.output=="string"?i.output:"";e({messages:rt(t().messages,l,s=>({...s,content:o||s.content,streaming:!1}))}),typeof i.pending_steer=="string"&&i.pending_steer&&e({steerLeftover:i.pending_steer});break}case"run.failed":case"run.cancelled":{const o=typeof i.output=="string"?i.output:"",s=typeof i.error=="string"?i.error:void 0;e({messages:rt(t().messages,l,a=>({...a,content:o||a.content,streaming:!1,error:n==="run.failed"})),...s?{streamError:s}:{}});break}case"error":{e({streamError:String(i.error??i.message??"The turn failed."),streaming:!1});break}}}function Zc(){const e=j(l=>l.config.ttsVoice),t=R.useRef(null),n=R.useCallback(()=>{typeof speechSynthesis<"u"&&speechSynthesis.cancel(),t.current=null},[]);return{speak:R.useCallback(l=>{const i=l.trim();if(!i||typeof speechSynthesis>"u")return;speechSynthesis.cancel();const o=new SpeechSynthesisUtterance(i);if(e){const s=speechSynthesis.getVoices().find(a=>a.name===e);s&&(o.voice=s)}t.current=o,speechSynthesis.speak(o)},[e]),stop:n}}const J=e=>({width:20,height:20,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinecap:"round",strokeLinejoin:"round",...e}),xn=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M12 5v14M5 12h14"})}),gh=e=>u.jsxs("svg",{...J(e),children:[u.jsx("circle",{cx:"11",cy:"11",r:"7"}),u.jsx("path",{d:"m20 20-3.5-3.5"})]}),yh=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M4 12 20 4l-6 16-3-7-7-1Z"})}),wh=e=>u.jsxs("svg",{...J(e),children:[u.jsx("rect",{x:"9",y:"3",width:"6",height:"11",rx:"3"}),u.jsx("path",{d:"M5 11a7 7 0 0 0 14 0M12 18v3"})]}),Su=e=>u.jsxs("svg",{...J(e),children:[u.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),u.jsx("circle",{cx:"8.5",cy:"9.5",r:"1.5"}),u.jsx("path",{d:"m21 16-5-5L5 20"})]}),xh=e=>u.jsx("svg",{...J(e),children:u.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2",fill:"currentColor",stroke:"none"})}),Sh=e=>u.jsxs("svg",{...J(e),children:[u.jsx("circle",{cx:"12",cy:"12",r:"3"}),u.jsx("path",{d:"M19.4 15a1.7 1.7 0 0 0 .3 1.9l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-2.9 1.2 2 2 0 1 1-4 0 1.7 1.7 0 0 0-2.9-1.2l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1A1.7 1.7 0 0 0 4.6 15a2 2 0 1 1 0-4 1.7 1.7 0 0 0 1.2-2.9l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1A1.7 1.7 0 0 0 11.5 4a2 2 0 1 1 4 0 1.7 1.7 0 0 0 2.9 1.2l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1A1.7 1.7 0 0 0 19.4 11a2 2 0 1 1 0 4Z"})]}),kh=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})}),ts=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M6 6l12 12M18 6 6 18"})}),ns=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2M6 7l1 13a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1l1-13"})}),jh=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"m6 9 6 6 6-6"})}),Ch=e=>u.jsxs("svg",{...J(e),children:[u.jsx("path",{d:"M4 9v6h4l5 4V5L8 9H4Z"}),u.jsx("path",{d:"M16.5 8.5a5 5 0 0 1 0 7"})]}),Eh=e=>u.jsxs("svg",{...J(e),children:[u.jsx("circle",{cx:"12",cy:"8",r:"4"}),u.jsx("path",{d:"M4 20a8 8 0 0 1 16 0"})]}),rs=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"m5 13 4 4L19 7"})}),Nh=e=>u.jsxs("svg",{...J(e),children:[u.jsx("path",{d:"M21 12a9 9 0 1 1-3-6.7L21 8"}),u.jsx("path",{d:"M21 3v5h-5"})]}),ls=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z"})}),_h=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M9 4a3 3 0 0 0-3 3 3 3 0 0 0-1 5.8V15a3 3 0 0 0 4 2.8V20h2V4H9ZM15 4a3 3 0 0 1 3 3 3 3 0 0 1 1 5.8V15a3 3 0 0 1-4 2.8V20h-2V4h2Z"})}),Jc=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M12 3v12M7 11l5 5 5-5M5 21h14"})}),Ph=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M3 5h18l-7 8v6l-4-2v-4L3 5Z"})}),Ol=e=>u.jsx("svg",{...J(e),children:u.jsx("path",{d:"M14.7 6.3a4 4 0 0 0-5.4 5.4L4 17v3h3l5.3-5.3a4 4 0 0 0 5.4-5.4l-2.3 2.3-2-2 2.3-2.3Z"})});function Th(){return{id:hh(),name:"My Hermes",baseUrl:"",apiKey:"",profile:"",customHeaders:[]}}function gl({initial:e,onSave:t,onCancel:n,saveLabel:r="Save & connect"}){const[l,i]=R.useState(e??Th()),[o,s]=R.useState(!1),[a,c]=R.useState(null),p=d=>i(y=>({...y,...d})),h=async()=>{s(!0),c(null);try{const d=new Gc({baseUrl:l.baseUrl,apiKey:l.apiKey,profile:l.profile,sameOrigin:l.sameOrigin,customHeaders:l.customHeaders}),y=await d.health(),g=await d.capabilities(),x=g.features?Object.keys(g.features).length:0;c({ok:!0,msg:`Connected to ${y.platform??"hermes-agent"} ${y.version??""} — API key accepted (${x} features).`})}catch(d){c({ok:!1,msg:d instanceof Error?d.message:String(d)})}finally{s(!1)}};return u.jsxs("div",{children:[a&&u.jsx("div",{className:`alert ${a.ok?"ok":"error"}`,children:a.msg}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"Name"}),u.jsx("input",{value:l.name,onChange:d=>p({name:d.target.value}),placeholder:"My Hermes"})]}),u.jsxs("div",{className:"field",children:[u.jsxs("label",{className:"toggle",style:{marginBottom:8},children:[u.jsx("input",{type:"checkbox",checked:!!l.sameOrigin,onChange:d=>p({sameOrigin:d.target.checked})}),"Same origin (behind the bundled proxy)"]}),l.sameOrigin?u.jsxs("div",{className:"hint",style:{marginTop:0},children:["Requests go to this app's own origin, which the proxy forwards to your API server — no CORS needed. Run the proxy with ",u.jsx("code",{children:"HERMES_TARGET"})," (no key required)."]}):u.jsxs(u.Fragment,{children:[u.jsx("input",{value:l.baseUrl,onChange:d=>p({baseUrl:d.target.value}),placeholder:"https://api.example.com",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,inputMode:"url"}),u.jsxs("div",{className:"hint",children:["The API server origin (default port ",u.jsx("code",{children:"8642"}),"), e.g."," ",u.jsx("code",{children:"https://api.beaver.derez.ai"}),". Needs ",u.jsx("code",{children:"API_SERVER_CORS_ORIGINS"})," to allow this app's origin."]})]})]}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"API key (API_SERVER_KEY)"}),u.jsx("input",{type:"password",value:l.apiKey,onChange:d=>p({apiKey:d.target.value}),placeholder:"Bearer token",autoCapitalize:"none"}),u.jsxs("div",{className:"hint",children:["Stored only on this device. Sent as ",u.jsx("code",{children:"Authorization: Bearer …"}),"."]})]}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"Profile (optional)"}),u.jsx("input",{value:l.profile??"",onChange:d=>p({profile:d.target.value}),placeholder:"default",autoCapitalize:"none"}),u.jsxs("div",{className:"hint",children:["Multi-profile gateways route to ",u.jsx("code",{children:"/p//…"}),". Each profile needs its own key — add one connection per profile to see them all."]})]}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"Custom headers (optional)"}),(l.customHeaders??[]).map((d,y)=>u.jsxs("div",{className:"header-row",children:[u.jsx("input",{value:d.name,placeholder:"Header name",onChange:g=>{const x=[...l.customHeaders??[]];x[y]={...x[y],name:g.target.value},p({customHeaders:x})}}),u.jsx("input",{value:d.value,placeholder:"Value",onChange:g=>{const x=[...l.customHeaders??[]];x[y]={...x[y],value:g.target.value},p({customHeaders:x})}}),u.jsx("button",{className:"icon-btn",title:"Remove",onClick:()=>p({customHeaders:(l.customHeaders??[]).filter((g,x)=>x!==y)}),children:u.jsx(ts,{width:16,height:16})})]},y)),u.jsxs("button",{className:"btn",style:{marginTop:8},onClick:()=>p({customHeaders:[...l.customHeaders??[],{name:"",value:""}]}),children:[u.jsx(xn,{width:15,height:15,style:{verticalAlign:"-2px",marginRight:6}}),"Add header"]})]}),u.jsxs("div",{className:"actions",children:[n&&u.jsx("button",{className:"btn",onClick:n,children:"Cancel"}),u.jsx("button",{className:"btn",onClick:h,disabled:o||!l.sameOrigin&&!l.baseUrl.trim(),children:o?"Testing…":"Test"}),u.jsx("button",{className:"btn primary",onClick:()=>t({...l,name:l.name.trim()||"Hermes"}),disabled:!l.sameOrigin&&!l.baseUrl.trim(),children:r})]})]})}function qc({height:e=26,withText:t=!0}){const n=R.useId().replace(/:/g,""),r=t?e*132/34:e;return u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:r,height:e,viewBox:t?"0 0 132 34":"0 0 34 34",role:"img","aria-label":"derez.ai",children:[u.jsx("defs",{children:u.jsxs("linearGradient",{id:`box-bg-${n}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[u.jsx("stop",{offset:"0%",stopColor:"#003545"}),u.jsx("stop",{offset:"100%",stopColor:"#00202e"})]})}),u.jsx("rect",{x:"0",y:"0",width:"34",height:"34",rx:"10",fill:`url(#box-bg-${n})`,stroke:"#005570",strokeWidth:"1.2"}),u.jsx("rect",{x:"6",y:"11",width:"22",height:"15",rx:"2.5",fill:"none",stroke:"#00f5ff",strokeWidth:"1.8"}),u.jsx("path",{d:"M17 11V7",stroke:"#00f5ff",strokeWidth:"1.8",strokeLinecap:"round"}),u.jsx("circle",{cx:"17",cy:"5.5",r:"1.5",fill:"#00f5ff"}),u.jsx("circle",{cx:"10",cy:"15.5",r:"1",fill:"#00f5ff"}),u.jsx("circle",{cx:"14",cy:"15.5",r:"1",fill:"#00f5ff"}),u.jsx("path",{d:"M10 20h14",stroke:"#00f5ff",strokeWidth:"1.5",strokeLinecap:"round"}),t&&u.jsx("text",{x:"46",y:"23",fill:"#00f5ff",fontFamily:"'Courier New', Courier, monospace",fontSize:"17",fontWeight:"700",letterSpacing:"-0.5",children:"derez.ai"})]})}function is({height:e=26}){return u.jsx("a",{className:"brand-link",href:"https://derez.ai/",target:"_blank",rel:"noopener noreferrer",title:"derez.ai — AI Agent Hosting",children:u.jsx(qc,{height:e})})}function Rh(){const e=j(o=>o.config),t=j(o=>o.saveConnection),n=j(o=>o.removeConnection),r=j(o=>o.setActiveConnection),[l,i]=R.useState(null);return u.jsx("div",{className:"screen",children:u.jsxs("div",{className:"card",children:[u.jsx("div",{style:{marginBottom:18},children:u.jsx(is,{height:30})}),u.jsx("h1",{children:"Connect to your Hermes"}),u.jsxs("p",{className:"lead",children:["Point this app at your Hermes ",u.jsx("strong",{children:"API Server"})," (the OpenAI-compatible endpoint), not the dashboard. It authenticates with your ",u.jsx("code",{children:"API_SERVER_KEY"}),"."]}),u.jsx(gl,{onSave:t}),e.connections.length>0&&u.jsxs("div",{className:"section",style:{marginTop:24,marginBottom:0},children:[u.jsx("h3",{children:"Saved connections"}),e.connections.map(o=>u.jsxs("div",{children:[u.jsxs("div",{className:"kv",children:[u.jsxs("span",{className:"link-btn",style:{cursor:"pointer"},onClick:()=>r(o.id),children:[o.name,o.profile?` · ${o.profile}`:""]}),u.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[o.sameOrigin?"same origin":o.baseUrl,u.jsx("button",{className:`icon-btn ${l===o.id?"active":""}`,title:"Edit",onClick:()=>i(l===o.id?null:o.id),children:u.jsx(ls,{width:15,height:15})}),u.jsx("button",{className:"icon-btn",title:"Remove",onClick:()=>n(o.id),children:u.jsx(ns,{width:15,height:15})})]})]}),l===o.id&&u.jsx("div",{style:{margin:"10px 0 18px"},children:u.jsx(gl,{initial:o,onSave:async s=>{await t(s),i(null)},onCancel:()=>i(null),saveLabel:"Save changes"})})]},o.id))]})]})})}function Lh(e){if(!e)return"";const t=e>1e12?e:e*1e3,n=Date.now()-t,r=Math.round(n/1e3);if(r<60)return"just now";const l=Math.round(r/60);if(l<60)return`${l}m ago`;const i=Math.round(l/60);if(i<24)return`${i}h ago`;const o=Math.round(i/24);return o<7?`${o}d ago`:new Date(t).toLocaleDateString()}function zh(e){return e==null||e===0?"":e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`}function Ih(e){return e?e.length>14?`${e.slice(0,13)}…`:e:""}function Mh({s:e}){const t=j(c=>c.activeSessionId),n=j(c=>c.openSession),r=j(c=>c.deleteSession),l=j(c=>c.renameSession),i=j(c=>c.forkSession),o=t===e.id,s=()=>{const c=window.prompt("Rename session",e.title);c&&c.trim()&&l(e.id,c.trim())},a=()=>{window.confirm(`Delete "${e.title}"? This cannot be undone.`)&&r(e.id)};return u.jsxs("div",{className:`session-item ${o?"active":""}`,onClick:()=>n(e.id),title:e.preview||void 0,children:[u.jsxs("div",{className:"body",children:[u.jsx("div",{className:"title",children:e.title}),u.jsxs("div",{className:"meta",children:[u.jsx("span",{children:Lh(e.updatedAt)}),typeof e.messageCount=="number"&&e.messageCount>0&&u.jsxs("span",{children:[e.messageCount," msg"]}),e.source&&u.jsx("span",{children:Ih(e.source)}),e.costUsd?u.jsx("span",{children:zh(e.costUsd)}):null]})]}),u.jsxs("div",{className:"actions",onClick:c=>c.stopPropagation(),children:[u.jsx("button",{className:"icon-btn",title:"Rename",onClick:s,children:u.jsx(ls,{width:15,height:15})}),u.jsx("button",{className:"icon-btn",title:"Fork",onClick:()=>i(e.id),children:u.jsx(xn,{width:15,height:15})}),u.jsx("button",{className:"icon-btn",title:"Delete",onClick:a,children:u.jsx(ns,{width:15,height:15})})]})]})}function Oh(){const e=j(a=>a.config.connections),t=j(a=>a.config.activeConnectionId),n=j(a=>a.setActiveConnection),r=j(a=>a.setShowSettings),[l,i]=R.useState(!1),o=R.useRef(null);R.useEffect(()=>{const a=c=>{o.current&&!o.current.contains(c.target)&&i(!1)};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[]);const s=e.find(a=>a.id===t)??e[0];return u.jsxs("div",{className:"profile-switch",ref:o,children:[u.jsxs("button",{className:"profile-btn",onClick:()=>i(a=>!a),children:[u.jsx("span",{className:"dot"}),u.jsx("span",{className:"name",children:(s==null?void 0:s.name)??"No connection"}),(s==null?void 0:s.profile)&&u.jsx("span",{className:"sub",children:s.profile}),u.jsx(jh,{width:15,height:15,style:{marginLeft:6,color:"var(--text-faint)"}})]}),l&&u.jsxs("div",{className:"menu",children:[e.map(a=>u.jsxs("button",{className:"menu-item",onClick:()=>{i(!1),a.id!==t&&n(a.id)},children:[u.jsx("span",{children:a.name}),a.profile&&u.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:a.profile}),a.id===t&&u.jsx(rs,{width:15,height:15,className:"check"})]},a.id)),u.jsxs("button",{className:"menu-item",onClick:()=>{i(!1),r(!0)},children:[u.jsx(xn,{width:15,height:15}),u.jsx("span",{children:"Add connection…"})]})]})]})}function Dh(){const e=j(c=>c.sessions),t=j(c=>c.sessionsLoading),n=j(c=>c.searchQuery),r=j(c=>c.setSearch),l=j(c=>c.newSession),i=j(c=>c.loadSessions),o=j(c=>c.setShowSettings),s=j(c=>c.sidebarOpen),a=j(c=>c.setSidebarOpen);return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:`scrim ${s?"show":""}`,onClick:()=>a(!1)}),u.jsxs("aside",{className:`sidebar ${s?"open":""}`,children:[u.jsxs("div",{className:"sidebar-head",children:[u.jsxs("div",{className:"brand",children:[u.jsx(is,{height:26}),u.jsxs("div",{className:"brand-actions",children:[u.jsx("button",{className:"icon-btn",title:"Refresh",onClick:()=>i(),children:u.jsx(Nh,{width:17,height:17})}),u.jsx("button",{className:"icon-btn",title:"Settings",onClick:()=>o(!0),children:u.jsx(Sh,{width:17,height:17})})]})]}),u.jsx(Oh,{}),u.jsxs("button",{className:"new-chat",onClick:()=>l(),children:[u.jsx(xn,{width:17,height:17}),"New chat"]}),u.jsxs("div",{className:"search-wrap",children:[u.jsx(gh,{width:16,height:16}),u.jsx("input",{value:n,onChange:c=>r(c.target.value),placeholder:"Filter sessions…"})]})]}),u.jsx("div",{className:"sidebar-tools",children:u.jsxs("span",{children:[e.length," sessions"]})}),u.jsxs("div",{className:"session-list",children:[t&&e.length===0&&u.jsx("div",{className:"empty",children:"Loading sessions…"}),!t&&e.length===0&&u.jsxs("div",{className:"empty",children:["No sessions yet.",u.jsx("br",{}),"Start a new chat to begin."]}),e.map(c=>u.jsx(Mh,{s:c},c.id))]})]})]})}function $h(e,t){const n=(t||"image").trim().replace(/[^\w.-]+/g,"_").replace(/^_+|_+$/g,"").slice(0,48)||"image";let r="";const l=/^data:image\/([a-zA-Z0-9.+-]+)/.exec(e);if(l)r=l[1].toLowerCase();else try{const i=new URL(e,location.href).pathname,o=/\.([a-zA-Z0-9]{2,5})$/.exec(i);o&&(r=o[1].toLowerCase())}catch{}return r==="jpeg"&&(r="jpg"),r||(r="png"),`${n}.${r}`}function bc(e,t){const n=document.createElement("a");n.href=e,n.download=$h(e,t),n.rel="noopener",document.body.appendChild(n),n.click(),n.remove()}function Uh(e,t,n){const r=t.trim();if(!r)return null;let l=e.trim();const i=n.trim();return i&&l.startsWith(i)&&(l=l.slice(i.length)),l.startsWith("/")||(l=`/${l}`),r.replace(/\/+$/,"")+l}function Fh(e){const t=e.trim().replace(/[/\\]+$/,""),n=t.split(/[/\\]/);return n[n.length-1]||t}const ku=/(`[^`]+`)|(!\[[^\]]*\]\([^)]*\))|(\[[^\]]*\]\([^)]*\))|(\*\*[^*]+\*\*)|(\*[^*\n]+\*)|(https?:\/\/[^\s<)]+)|(data:image\/[^\s)]+)|(MEDIA:\S+)/g;function ju(e){const t=e.indexOf("](");return t===-1?{label:e,url:""}:{label:e.slice(0,t),url:e.slice(t+2)}}function Ah(e){return e.startsWith("data:")?e.replace(/\s+/g,""):e}function Vh({path:e}){const t=j(s=>s.config.mediaBaseUrl),n=j(s=>s.config.mediaPathPrefix),[r,l]=R.useState(!1),i=Uh(e,t,n),o=Fh(e);return i&&!r?u.jsxs("span",{className:"md-figure",children:[u.jsx("img",{src:i,alt:o,onError:()=>l(!0)}),u.jsxs("button",{type:"button",className:"md-download",onClick:()=>bc(i,o),children:[u.jsx(Jc,{width:15,height:15}),"Download"]})]}):u.jsxs("span",{className:"media-ref",title:e,children:[u.jsx(Ol,{width:15,height:15}),u.jsx("span",{className:"nm",children:o}),u.jsx("span",{className:"path",children:e})]})}function Cu({url:e,alt:t}){const n=Ah(e);return u.jsxs("span",{className:"md-figure",children:[u.jsx("img",{src:n,alt:t}),u.jsxs("button",{type:"button",className:"md-download",onClick:()=>bc(n,t),children:[u.jsx(Jc,{width:15,height:15}),"Download"]})]})}function Eu(e,t){const n=[];let r=0,l=0,i;for(ku.lastIndex=0;(i=ku.exec(e))!==null;){i.index>r&&n.push(e.slice(r,i.index));const o=i[0],s=`${t}-${l++}`;if(i[1])n.push(u.jsx("code",{children:o.slice(1,-1)},s));else if(i[2]){const{label:a,url:c}=ju(o.slice(2,-1));n.push(u.jsx(Cu,{url:c,alt:a},s))}else if(i[3]){const{label:a,url:c}=ju(o.slice(1,-1));n.push(u.jsx("a",{href:c,target:"_blank",rel:"noreferrer noopener",children:a},s))}else i[4]?n.push(u.jsx("strong",{children:o.slice(2,-2)},s)):i[5]?n.push(u.jsx("em",{children:o.slice(1,-1)},s)):i[6]?n.push(u.jsx("a",{href:o,target:"_blank",rel:"noreferrer noopener",children:o},s)):i[7]?n.push(u.jsx(Cu,{url:o,alt:"image"},s)):i[8]&&n.push(u.jsx(Vh,{path:o.slice(6)},s));r=i.index+o.length}return rr&&t.push(u.jsx("span",{children:Eu(e.slice(r,l.index),`t${i}`)},`t${i}`)),t.push(u.jsx("pre",{children:u.jsx("code",{children:l[2].replace(/\n$/,"")})},`c${i}`)),r=l.index+l[0].length,i++;return r{const r=/^image\//.test(t.mime)||t.dataUrl.startsWith("data:image");return u.jsxs("div",{className:"attachment",children:[r?u.jsx("img",{src:t.dataUrl,alt:t.name}):u.jsx(Ol,{width:16,height:16}),u.jsx("span",{className:"nm",children:t.name})]},n)})}):null}function Bh({call:e}){const[t,n]=R.useState(!1),r=e.status==="error"?"error":e.status==="done"?"done":"running…";return u.jsxs("div",{className:"tool-card",children:[u.jsxs("div",{className:"head",onClick:()=>n(l=>!l),style:{cursor:e.preview?"pointer":"default"},children:[u.jsx(Ol,{width:15,height:15,style:{color:"var(--text-dim)"}}),u.jsx("span",{className:"name",children:e.name}),u.jsx("span",{className:`status ${e.status==="error"?"err":e.status==="done"?"ok":""}`,children:r})]}),e.preview&&t&&u.jsx("div",{className:"preview",children:e.preview})]})}function Wh({message:e}){const[t,n]=R.useState(!1);return u.jsxs("div",{className:"tool-card",children:[u.jsxs("div",{className:"head",onClick:()=>n(r=>!r),style:{cursor:"pointer"},children:[u.jsx(Ol,{width:15,height:15,style:{color:"var(--text-dim)"}}),u.jsx("span",{className:"name",children:e.toolName??"tool result"}),u.jsx("span",{className:"status ok",children:"result"})]}),t&&u.jsx("div",{className:"preview",children:ef(e.content)})]})}function Qh({message:e}){return u.jsx("div",{style:{fontSize:12.5,color:"var(--text-faint)",padding:"2px 0 2px 41px",whiteSpace:"pre-wrap"},children:e.content})}function Kh({message:e}){const{speak:t}=Zc(),[n,r]=R.useState(!1),l=j(g=>g.config.showToolCalls),i=j(g=>g.config.showReasoning),o=j(g=>g.config.showSystem);if(e.role==="tool")return l?u.jsx(Wh,{message:e}):null;if(e.role==="system")return o?u.jsx(Qh,{message:e}):null;const s=e.role==="user",a=e.content,c=e.toolCalls??[],p=e.attachments??[],h=!!e.streaming;if(!(!!a||i&&!!e.reasoning||l&&c.length>0||p.length>0||h))return null;const y=async()=>{try{await navigator.clipboard.writeText(a),r(!0),setTimeout(()=>r(!1),1400)}catch{}};return u.jsxs("div",{className:`msg ${s?"user":"assistant"}`,children:[u.jsx("div",{className:`avatar ${s?"user":"brand"}`,children:s?u.jsx(Eh,{width:16,height:16}):u.jsx(qc,{height:30,withText:!1})}),u.jsxs("div",{className:"content",children:[u.jsx("div",{className:"who",children:s?"You":"Hermes"}),e.reasoning&&i&&u.jsxs("details",{className:"reasoning",children:[u.jsxs("summary",{children:[u.jsx(_h,{width:14,height:14}),"Reasoning"]}),u.jsx("div",{className:"body",children:e.reasoning})]}),l&&c.map(g=>u.jsx(Bh,{call:g},g.id)),a?u.jsx("div",{className:"bubble",children:s?a:ef(a)}):h?u.jsxs("div",{className:"typing",children:[u.jsx("span",{}),u.jsx("span",{}),u.jsx("span",{})]}):null,u.jsx(Hh,{items:p}),!s&&a&&!h&&u.jsxs("div",{className:"msg-actions",children:[u.jsx("button",{className:"icon-btn",title:"Copy",onClick:y,children:n?u.jsx(rs,{width:15,height:15}):u.jsx("span",{style:{fontSize:13},children:"⧉"})}),u.jsx("button",{className:"icon-btn",title:"Speak",onClick:()=>t(a),children:u.jsx(Ch,{width:15,height:15})})]})]})]})}function Nu(){const e=window;return e.SpeechRecognition??e.webkitSpeechRecognition??null}function Yh(){const[e,t]=R.useState(!1),[n,r]=R.useState(""),[l,i]=R.useState(null),o=R.useRef(null),s=R.useRef(""),a=typeof window<"u"&&!!Nu(),c=R.useCallback(()=>{var h;(h=o.current)==null||h.stop(),t(!1)},[]),p=R.useCallback(h=>{const d=Nu();if(!d){i("Speech recognition isn't supported in this browser.");return}i(null),r(""),s.current="";const y=new d;y.lang=navigator.language||"en-US",y.continuous=!0,y.interimResults=!0,y.onresult=g=>{let x="";for(let z=g.resultIndex;z{i(g.error==="not-allowed"?"Microphone permission denied.":"Speech recognition error."),t(!1)},y.onend=()=>{t(!1),r("");const g=s.current.trim();g&&h(g)},o.current=y,y.start(),t(!0)},[]);return{supported:a,listening:e,interim:n,error:l,start:p,stop:c}}function Gh(){const[e,t]=R.useState(!1),[n,r]=R.useState(null),l=R.useRef(null),i=R.useRef([]),o=R.useRef(null),s=R.useCallback(async()=>{var c;if(r(null),!((c=navigator.mediaDevices)!=null&&c.getUserMedia))return r("Microphone capture is not supported in this browser."),!1;try{const p=await navigator.mediaDevices.getUserMedia({audio:!0}),h=new MediaRecorder(p);return i.current=[],h.ondataavailable=d=>{d.data.size>0&&i.current.push(d.data)},h.onstop=()=>{var y;p.getTracks().forEach(g=>g.stop());const d=new Blob(i.current,{type:h.mimeType||"audio/webm"});(y=o.current)==null||y.call(o,d.size>0?d:null),o.current=null},l.current=h,h.start(),t(!0),!0}catch(p){return r(p instanceof Error?p.message:"Could not access the microphone."),!1}},[]),a=R.useCallback(()=>new Promise(c=>{const p=l.current;if(!p||p.state==="inactive"){t(!1),c(null);return}o.current=c,p.stop(),t(!1)}),[]);return{recording:e,error:n,start:s,stop:a}}async function Xh(e,t){const n=new FormData,r=e.type.includes("ogg")?"ogg":e.type.includes("mp4")?"mp4":"webm";n.append("file",e,`recording.${r}`),t.model&&n.append("model",t.model);const l={};t.key&&(l.Authorization=`Bearer ${t.key}`);let i;try{i=await fetch(t.url,{method:"POST",headers:l,body:n})}catch{throw new Error(`Could not reach the transcription endpoint (${t.url}).`)}const o=await i.text();let s;try{s=o?JSON.parse(o):void 0}catch{s=o}if(!i.ok){const a=s&&typeof s=="object"?s.error:void 0,c=typeof a=="string"?a:a==null?void 0:a.message;throw new Error(c||`Transcription failed (HTTP ${i.status}).`)}if(s&&typeof s=="object"){const a=s;if(typeof a.text=="string")return a.text;if(typeof a.transcript=="string")return a.transcript}return typeof s=="string"?s:""}function Zh(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t({name:e.name,mime:e.type||"application/octet-stream",dataUrl:String(r.result),size:e.size}),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}const Jh=()=>{var e;return typeof window<"u"&&((e=window.matchMedia)==null?void 0:e.call(window,"(pointer: coarse)").matches)};function qh(){const e=j(k=>k.streaming),t=j(k=>k.send),n=j(k=>k.steer),r=j(k=>k.cancel),l=j(k=>k.steerLeftover),i=j(k=>k.clearSteerLeftover),o=j(k=>k.setToast),s=j(k=>k.config.transcribeUrl),a=j(k=>k.config.transcribeKey),c=j(k=>k.config.transcribeModel),[p,h]=R.useState(""),[d,y]=R.useState([]),[g,x]=R.useState(!1),z=R.useRef(null),m=R.useRef(null),f=Yh(),v=Gh(),w=!!s.trim(),C=w||f.supported,_=f.listening||v.recording;R.useEffect(()=>{l&&(h(k=>k||l),i())},[l,i]),R.useEffect(()=>{f.error&&o(f.error)},[f.error,o]),R.useEffect(()=>{v.error&&o(v.error)},[v.error,o]),R.useEffect(()=>{const k=z.current;k&&(k.style.height="auto",k.style.height=`${Math.min(k.scrollHeight,200)}px`)},[p]);const P=async k=>{for(const U of k)try{const Fe=await Zh(U);y(E=>[...E,Fe])}catch{o(`Could not attach ${U.name}`)}},T=()=>{const k=p.trim();if(!(!k&&!d.length)){if(e){n(k),h("");return}t(k,d),h(""),y([])}},H=k=>{const U=k.trim();U&&h(Fe=>Fe?`${Fe} ${U}`:U)},M=async()=>{if(f.listening){f.stop();return}if(v.recording){const k=await v.stop();if(!k)return;x(!0);try{const U=await Xh(k,{url:s.trim(),key:a.trim()||void 0,model:c.trim()||void 0});H(U)}catch(U){o(U instanceof Error?U.message:"Transcription failed.")}finally{x(!1)}}},we=async()=>{if(_){await M();return}if(w){await v.start()||o("Could not access the microphone.");return}if(f.supported){if(!window.isSecureContext){o("Dictation needs a secure context (HTTPS or localhost).");return}f.start(H);return}o("Dictation isn't available in this browser. Use Chrome, Edge, or Safari — or set a transcription endpoint in Settings.")},jt=k=>{k.key==="Enter"&&!k.shiftKey&&!Jh()&&(k.preventDefault(),T())},Ct=p.trim().length>0||d.length>0,Sn=g?"Transcribing…":f.listening?f.interim||"Listening…":v.recording?"Recording… tap the mic to stop":"";return u.jsx("div",{className:"composer-wrap",children:u.jsxs("div",{className:"composer",onDragOver:k=>k.preventDefault(),onDrop:k=>{var U;k.preventDefault(),(U=k.dataTransfer.files)!=null&&U.length&&P(Array.from(k.dataTransfer.files))},children:[d.length>0&&u.jsx("div",{className:"attach-chips",children:d.map(k=>u.jsxs("div",{className:"chip",children:[/^image\//.test(k.mime)?u.jsx("img",{src:k.dataUrl,alt:k.name}):u.jsx(Su,{width:15,height:15}),u.jsx("span",{className:"nm",children:k.name}),u.jsx("button",{title:"Remove",onClick:()=>y(U=>U.filter(Fe=>Fe!==k)),children:u.jsx(ts,{width:14,height:14})})]},k.name+k.size))}),Sn&&u.jsxs("div",{className:"recording-pill",style:{padding:"2px 4px"},children:[!g&&u.jsx("span",{className:"pulse"}),u.jsx("span",{style:{color:"var(--text-dim)"},children:Sn})]}),u.jsx("textarea",{ref:z,rows:1,value:p,onChange:k=>h(k.target.value),onKeyDown:jt,onPaste:k=>{const U=Array.from(k.clipboardData.files);U.length&&(k.preventDefault(),P(U))},placeholder:e?"Steer the running turn…":"Message Hermes…"}),u.jsxs("div",{className:"composer-row",children:[u.jsx("input",{ref:m,type:"file",accept:"image/*",multiple:!0,hidden:!0,onChange:k=>{var U;(U=k.target.files)!=null&&U.length&&P(Array.from(k.target.files)),k.target.value=""}}),u.jsx("button",{className:"icon-btn",title:"Attach image",onClick:()=>{var k;return(k=m.current)==null?void 0:k.click()},children:u.jsx(Su,{width:19,height:19})}),u.jsx("button",{className:`icon-btn ${_?"active":""}`,title:_?"Stop dictation":C?"Dictate (speak your prompt)":"Dictation unavailable — see Settings",onClick:we,disabled:g,children:u.jsx(wh,{width:19,height:19})}),u.jsx("div",{className:"spacer"}),e?u.jsx("button",{className:"send-btn stop",title:"Stop",onClick:()=>r(),children:u.jsx(xh,{width:18,height:18})}):u.jsx("button",{className:"send-btn",title:"Send",disabled:!Ct,onClick:T,children:u.jsx(yh,{width:18,height:18})})]})]})})}function bh(){const e=j(a=>a.config.showToolCalls),t=j(a=>a.config.showReasoning),n=j(a=>a.config.showSystem),r=j(a=>a.updatePrefs),[l,i]=R.useState(!1),o=R.useRef(null);R.useEffect(()=>{const a=c=>{o.current&&!o.current.contains(c.target)&&i(!1)};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[]);const s=[["Tool calls & results",e,a=>r({showToolCalls:a})],["Reasoning",t,a=>r({showReasoning:a})],["System messages",n,a=>r({showSystem:a})]];return u.jsxs("div",{className:"profile-switch",ref:o,style:{width:"auto"},children:[u.jsx("button",{className:`icon-btn ${l?"active":""}`,title:"Filter messages",onClick:()=>i(a=>!a),children:u.jsx(Ph,{width:19,height:19})}),l&&u.jsx("div",{className:"menu",style:{left:"auto",right:0,width:230},children:s.map(([a,c,p])=>u.jsxs("label",{className:"menu-item toggle",children:[u.jsx("input",{type:"checkbox",checked:c,onChange:h=>p(h.target.checked)}),a]},a))})]})}function em(){const e=j(p=>p.session),t=j(p=>p.messages),n=j(p=>p.sessionLoading),r=j(p=>p.streamError),l=j(p=>p.setSidebarOpen),i=j(p=>p.newSession),o=R.useRef(null),s=R.useRef(!0),a=()=>{const p=o.current;p&&(s.current=p.scrollHeight-p.scrollTop-p.clientHeight<120)};R.useEffect(()=>{const p=o.current;p&&s.current&&(p.scrollTop=p.scrollHeight)},[t]);const c=u.jsxs("div",{className:"chat-head",children:[u.jsx("button",{className:"icon-btn menu-btn",onClick:()=>l(!0),children:u.jsx(kh,{width:20,height:20})}),u.jsxs("div",{className:"titles",children:[u.jsx("div",{className:"t",children:(e==null?void 0:e.title)??"Hermes"}),u.jsxs("div",{className:"s",children:[(e==null?void 0:e.model)&&u.jsx("span",{className:"pill",children:e.model}),(e==null?void 0:e.source)&&u.jsx("span",{children:e.source})]})]}),u.jsx(bh,{}),u.jsx("button",{className:"icon-btn",title:"New chat",onClick:()=>i(),children:u.jsx(xn,{width:19,height:19})})]});return!e&&!n?u.jsxs("div",{className:"main",children:[c,u.jsx("div",{className:"center-fill",children:u.jsxs("div",{children:[u.jsx("div",{style:{fontSize:40,marginBottom:12},children:"💬"}),u.jsx("div",{style:{color:"var(--text)",fontWeight:600,marginBottom:6},children:"No conversation open"}),u.jsx("div",{children:"Pick a session from the sidebar, or start a new chat."}),u.jsx("button",{className:"btn primary",style:{marginTop:18},onClick:()=>i(),children:"New chat"})]})})]}):u.jsxs("div",{className:"main",children:[c,u.jsx("div",{className:"messages",ref:o,onScroll:a,children:u.jsxs("div",{className:"messages-inner",children:[n&&u.jsx("div",{className:"center-fill",children:u.jsx("div",{className:"spinner"})}),t.map(p=>u.jsx(Kh,{message:p},p.id)),r&&u.jsx("div",{className:"alert error",children:r})]})}),u.jsx(qh,{})]})}function fi(){const e=j(g=>g.config),t=j(g=>g.capabilities),n=j(g=>g.models),r=j(g=>g.saveConnection),l=j(g=>g.removeConnection),i=j(g=>g.setActiveConnection),o=j(g=>g.updatePrefs),s=j(g=>g.setShowSettings),[a,c]=R.useState(!1),[p,h]=R.useState(null),d=Qn(e),y=t!=null&&t.features?Object.entries(t.features):[];return u.jsx("div",{className:"panel",onClick:()=>s(!1),children:u.jsxs("div",{className:"panel-inner",onClick:g=>g.stopPropagation(),children:[u.jsxs("div",{className:"panel-head",children:[u.jsx("h2",{children:"Settings"}),u.jsx("button",{className:"icon-btn",onClick:()=>s(!1),children:u.jsx(ts,{width:20,height:20})})]}),u.jsxs("div",{className:"section",children:[u.jsx("h3",{children:"Connections"}),e.connections.map(g=>u.jsxs("div",{children:[u.jsxs("div",{className:"kv",children:[u.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[u.jsxs("button",{className:"link-btn",style:{cursor:"pointer"},onClick:()=>i(g.id),children:[g.name,g.profile?` · ${g.profile}`:""]}),g.id===e.activeConnectionId&&u.jsx(rs,{width:14,height:14,style:{color:"var(--accent)"}})]}),u.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[g.sameOrigin?"same origin":g.baseUrl,u.jsx("button",{className:`icon-btn ${p===g.id?"active":""}`,title:"Edit",onClick:()=>{c(!1),h(p===g.id?null:g.id)},children:u.jsx(ls,{width:15,height:15})}),u.jsx("button",{className:"icon-btn",title:"Remove",onClick:()=>l(g.id),children:u.jsx(ns,{width:15,height:15})})]})]}),p===g.id&&u.jsx("div",{style:{margin:"10px 0 18px"},children:u.jsx(gl,{initial:g,onSave:async x=>{await r(x),h(null)},onCancel:()=>h(null),saveLabel:"Save changes"})})]},g.id)),a?u.jsx("div",{style:{marginTop:12},children:u.jsx(gl,{onSave:async g=>{await r(g),c(!1)},onCancel:()=>c(!1),saveLabel:"Add"})}):u.jsxs("button",{className:"btn",style:{marginTop:12},onClick:()=>{h(null),c(!0)},children:[u.jsx(xn,{width:15,height:15,style:{verticalAlign:"-2px",marginRight:6}}),"Add connection"]})]}),u.jsxs("div",{className:"section",children:[u.jsx("h3",{children:"Voice"}),u.jsxs("label",{className:"toggle",style:{marginBottom:12},children:[u.jsx("input",{type:"checkbox",checked:e.speakReplies,onChange:g=>o({speakReplies:g.target.checked})}),"Speak replies automatically"]}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"Voice (browser)"}),u.jsx("input",{value:e.ttsVoice,onChange:g=>o({ttsVoice:g.target.value}),placeholder:"System default"})]})]}),u.jsxs("div",{className:"section",children:[u.jsx("h3",{children:"Dictation"}),u.jsx("div",{className:"hint",style:{marginTop:0,marginBottom:10},children:"If a transcription endpoint is set below, it's used for dictation (usually far more accurate). Otherwise Chrome, Edge, and Safari fall back to on-device dictation via the Web Speech API — Firefox has no speech API, so it needs an endpoint set here."}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"Transcription endpoint"}),u.jsx("input",{value:e.transcribeUrl,onChange:g=>o({transcribeUrl:g.target.value}),placeholder:"https://api.openai.com/v1/audio/transcriptions",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,inputMode:"url"}),u.jsxs("div",{className:"hint",children:["Any OpenAI-compatible ",u.jsx("code",{children:"/v1/audio/transcriptions"})," — OpenAI, Groq, or a local whisper.cpp server. Leave empty to disable."]})]}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"API key"}),u.jsx("input",{type:"password",value:e.transcribeKey,onChange:g=>o({transcribeKey:g.target.value}),placeholder:"sk-…",autoCapitalize:"none"})]}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"Model"}),u.jsx("input",{value:e.transcribeModel,onChange:g=>o({transcribeModel:g.target.value}),placeholder:"whisper-1",autoCapitalize:"none"})]})]}),u.jsxs("div",{className:"section",children:[u.jsx("h3",{children:"Media"}),u.jsxs("div",{className:"hint",style:{marginTop:0,marginBottom:10},children:["Your agent emits ",u.jsx("code",{children:"MEDIA:/path/to/file.png"})," for generated files. The Hermes API server can't serve those, so point this at a URL where the agent's workspace is reachable to render them as images."]}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"Media base URL"}),u.jsx("input",{value:e.mediaBaseUrl,onChange:g=>o({mediaBaseUrl:g.target.value}),placeholder:"https://files.example.com",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1,inputMode:"url"})]}),u.jsxs("div",{className:"field",children:[u.jsx("label",{children:"Strip path prefix"}),u.jsx("input",{value:e.mediaPathPrefix,onChange:g=>o({mediaPathPrefix:g.target.value}),placeholder:"/root/workspace",autoCapitalize:"none",autoCorrect:"off",spellCheck:!1}),u.jsxs("div",{className:"hint",children:["Removed from the start of the path before appending. E.g. base"," ",u.jsx("code",{children:"https://files.example.com"})," + prefix ",u.jsx("code",{children:"/root/workspace"})," turns"," ",u.jsx("code",{children:"MEDIA:/root/workspace/a.png"})," into"," ",u.jsx("code",{children:"https://files.example.com/a.png"}),"."]})]})]}),u.jsxs("div",{className:"section",children:[u.jsx("h3",{children:"Server"}),u.jsxs("div",{className:"kv",children:[u.jsx("span",{children:"Connection"}),u.jsx("span",{children:(d==null?void 0:d.name)??"—"})]}),u.jsxs("div",{className:"kv",children:[u.jsx("span",{children:"Platform"}),u.jsx("span",{children:(t==null?void 0:t.platform)??"—"})]}),u.jsxs("div",{className:"kv",children:[u.jsx("span",{children:"Model"}),u.jsx("span",{children:(t==null?void 0:t.model)??"—"})]}),u.jsxs("div",{className:"kv",children:[u.jsx("span",{children:"Models available"}),u.jsx("span",{children:n.length||"—"})]}),y.length>0&&u.jsxs("div",{style:{marginTop:10},children:[u.jsx("div",{className:"hint",style:{marginBottom:6},children:"Features"}),u.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:y.filter(([,g])=>g===!0).map(([g])=>u.jsx("span",{style:{fontSize:11,padding:"2px 8px",borderRadius:20,background:"var(--bg-elev2)",border:"1px solid var(--border)",color:"var(--text-dim)"},children:g},g))})]})]})]})})}function di(){const e=j(n=>n.toast),t=j(n=>n.setToast);return R.useEffect(()=>{if(!e)return;const n=setTimeout(()=>t(null),5e3);return()=>clearTimeout(n)},[e,t]),e?u.jsx("div",{className:"toast",onClick:()=>t(null),children:e}):null}function tm(){const e=j(i=>i.messages),t=j(i=>i.streaming),n=j(i=>i.config.speakReplies),{speak:r}=Zc(),l=R.useRef(null);return R.useEffect(()=>{if(!n||t)return;const i=e[e.length-1];!i||i.role!=="assistant"||!i.id||i.id===l.current||i.content.trim()&&(l.current=i.id,r(i.content))},[e,t,n,r]),null}function nm(){const e=j(o=>o.ready),t=j(o=>o.config),n=j(o=>o.connectionError),r=j(o=>o.showSettings),l=j(o=>o.bootstrap),i=j(o=>o.connect);return R.useEffect(()=>{l()},[l]),e?ph(t)?n?u.jsxs("div",{className:"screen",children:[u.jsxs("div",{className:"card",children:[u.jsx("div",{style:{marginBottom:18},children:u.jsx(is,{height:30})}),u.jsx("h1",{children:"Can’t reach Hermes"}),u.jsx("p",{className:"lead",children:n}),u.jsxs("div",{className:"actions",children:[u.jsx("button",{className:"btn",onClick:()=>j.getState().setShowSettings(!0),children:"Settings"}),u.jsx("button",{className:"btn primary",onClick:()=>i(),children:"Retry"})]})]}),r&&u.jsx(fi,{}),u.jsx(di,{})]}):u.jsxs(u.Fragment,{children:[u.jsxs("div",{className:"app",children:[u.jsx(Dh,{}),u.jsx(em,{})]}),u.jsx(tm,{}),r&&u.jsx(fi,{}),u.jsx(di,{})]}):u.jsxs(u.Fragment,{children:[u.jsx(Rh,{}),r&&u.jsx(fi,{}),u.jsx(di,{})]}):u.jsx("div",{className:"screen",children:u.jsx("div",{className:"spinner"})})}Mp({immediate:!0});const _u=document.getElementById("root");_u&&Vc(_u).render(u.jsx(R.StrictMode,{children:u.jsx(nm,{})})); diff --git a/index.html b/index.html index 726e5c9..7f49efd 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,7 @@ Hermes - + diff --git a/sw.js b/sw.js index aff3535..9b17d07 100644 --- a/sw.js +++ b/sw.js @@ -1 +1 @@ -if(!self.define){let e,i={};const n=(n,s)=>(n=new URL(n+".js",s).href,i[n]||new Promise(i=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=i,document.head.appendChild(e)}else e=n,importScripts(n),i()}).then(()=>{let e=i[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e}));self.define=(s,o)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(i[r])return;let c={};const l=e=>n(e,r),t={module:{uri:r},exports:c,require:l};i[r]=Promise.all(s.map(e=>t[e]||l(e))).then(e=>(o(...e),c))}}define(["./workbox-abeb32eb"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"index.html",revision:"17d0b1d684770cbbfe6ee21d3f1198ac"},{url:"assets/workbox-window.prod.es5-BqEJf4Xk.js",revision:null},{url:"assets/index-Cbj_LrNG.js",revision:null},{url:"assets/index-CWSassUi.css",revision:null},{url:"favicon.svg",revision:"a3baf2b041a9ed1fcc08d8a3634b535b"},{url:"icons/apple-touch-icon.png",revision:"ed81749f391ac07000b948263124e943"},{url:"icons/icon-192.png",revision:"8b2374bbaec1e3d1db8a07af64a6ef77"},{url:"icons/icon-512.png",revision:"c44a8f2da9095157b9b9aff7ec8e1aeb"},{url:"icons/maskable-512.png",revision:"beb4196443dc6daafcaab4497038613d"},{url:"manifest.webmanifest",revision:"d1afe01b7c52b0c511fd7e5f11079c23"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html"),{denylist:[/^\/api\//]})),e.registerRoute(({url:e})=>e.pathname.startsWith("/api/"),new e.NetworkOnly,"GET")}); +if(!self.define){let e,i={};const n=(n,s)=>(n=new URL(n+".js",s).href,i[n]||new Promise(i=>{if("document"in self){const e=document.createElement("script");e.src=n,e.onload=i,document.head.appendChild(e)}else e=n,importScripts(n),i()}).then(()=>{let e=i[n];if(!e)throw new Error(`Module ${n} didn’t register its module`);return e}));self.define=(s,o)=>{const r=e||("document"in self?document.currentScript.src:"")||location.href;if(i[r])return;let c={};const l=e=>n(e,r),t={module:{uri:r},exports:c,require:l};i[r]=Promise.all(s.map(e=>t[e]||l(e))).then(e=>(o(...e),c))}}define(["./workbox-abeb32eb"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"index.html",revision:"84ac5ebbe2382c8ec70814e7f406d21e"},{url:"assets/workbox-window.prod.es5-BqEJf4Xk.js",revision:null},{url:"assets/index-SBr79e_P.js",revision:null},{url:"assets/index-CWSassUi.css",revision:null},{url:"favicon.svg",revision:"a3baf2b041a9ed1fcc08d8a3634b535b"},{url:"icons/apple-touch-icon.png",revision:"ed81749f391ac07000b948263124e943"},{url:"icons/icon-192.png",revision:"8b2374bbaec1e3d1db8a07af64a6ef77"},{url:"icons/icon-512.png",revision:"c44a8f2da9095157b9b9aff7ec8e1aeb"},{url:"icons/maskable-512.png",revision:"beb4196443dc6daafcaab4497038613d"},{url:"manifest.webmanifest",revision:"d1afe01b7c52b0c511fd7e5f11079c23"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html"),{denylist:[/^\/api\//]})),e.registerRoute(({url:e})=>e.pathname.startsWith("/api/"),new e.NetworkOnly,"GET")});