@amd-gaia/agent-ui 0.25.1 → 0.25.2-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AdvancedSettings-D7jNZncZ.js → AdvancedSettings-DlNYuBwr.js} +1 -1
- package/dist/assets/{ConnectorsPane-CtDroHfp.js → ConnectorsPane-BMuJwbQS.js} +1 -1
- package/dist/assets/{DocumentLibrary-gE-tZarr.js → DocumentLibrary-BBkaVGFa.js} +2 -2
- package/dist/assets/{FileBrowser-CUJCMcVf.js → FileBrowser-B3rdG7Th.js} +1 -1
- package/dist/assets/{MemoryDashboard-Cxr_1R_c.js → MemoryDashboard-CI0XsMok.js} +1 -1
- package/dist/assets/{MobileAccessModal-CUqaV_OH.js → MobileAccessModal-Bt5XREFP.js} +1 -1
- package/dist/assets/{ScheduleManager-DgFrZse_.js → ScheduleManager-ia8OmdHV.js} +1 -1
- package/dist/assets/index-CfiDLYYM.js +79 -0
- package/dist/index.html +1 -1
- package/main.cjs +6 -19
- package/package.json +2 -2
- package/preload.cjs +7 -3
- package/services/window-frame.cjs +41 -0
- package/dist/assets/index-D-noqAc3.js +0 -79
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ConnectorsPane-CtDroHfp.js","./rolldown-runtime-XKyaHtl9.js","./apiBase-BmPG2Rib.js","./ConnectorsPane-Dzu2DRTc.css","./AdvancedSettings-D7jNZncZ.js","./AdvancedSettings-D5VKpkPY.css","./MemoryDashboard-Cxr_1R_c.js","./eye-CwjwlxR5.js","./message-square-DuVoNniw.js","./MemoryDashboard-Mo721-BI.css","./ScheduleManager-DgFrZse_.js","./ScheduleManager-DotJl5JW.css","./DocumentLibrary-gE-tZarr.js","./DocumentLibrary-CIKp6qld.css","./FileBrowser-CUJCMcVf.js","./FileBrowser-D04I8Pvv.css","./MobileAccessModal-CUqaV_OH.js","./MobileAccessModal-DuVy9F1u.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e,r as t,t as n}from"./rolldown-runtime-XKyaHtl9.js";import{a as r,c as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d,u as f}from"./apiBase-BmPG2Rib.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var p=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),m=n(((e,t)=>{t.exports=p()})),h=n((e=>{var t=f();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=u(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=u(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.1`})),g=n(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=h()})),_=n((e=>{var t=m(),n=f(),r=g();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function p(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&p(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function h(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function _(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function v(e){var t=[null,null],n=h(e);return n===null||y(t,e,n.child,{foundSelf:!1}),t}function y(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&y(e,t,n.child,r))return!0;n=n.sibling}return!1}function b(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var x=null,S=null;function C(e,t,n){return e===n||e===t&&(x=e,!0)}function w(e,t,n){return e===n?(S=e,!1):e===t&&(S!==null&&(x=e),!0)}function T(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function E(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var D=Object.assign,O=Symbol.for(`react.element`),k=Symbol.for(`react.transitional.element`),A=Symbol.for(`react.portal`),j=Symbol.for(`react.fragment`),M=Symbol.for(`react.strict_mode`),ee=Symbol.for(`react.profiler`),te=Symbol.for(`react.consumer`),N=Symbol.for(`react.context`),ne=Symbol.for(`react.forward_ref`),re=Symbol.for(`react.suspense`),ie=Symbol.for(`react.suspense_list`),ae=Symbol.for(`react.memo`),oe=Symbol.for(`react.lazy`),se=Symbol.for(`react.activity`),ce=Symbol.for(`react.legacy_hidden`),le=Symbol.for(`react.memo_cache_sentinel`),ue=Symbol.for(`react.view_transition`),de=Symbol.for(`react.recoverable`),fe=Symbol.iterator;function pe(e){return typeof e!=`object`||!e?null:(e=fe&&e[fe]||e[`@@iterator`],typeof e==`function`?e:null)}var me=Symbol.for(`react.client.reference`);function he(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===me?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case j:return`Fragment`;case ee:return`Profiler`;case M:return`StrictMode`;case re:return`Suspense`;case ie:return`SuspenseList`;case se:return`Activity`;case ue:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case A:return`Portal`;case N:return e.displayName||`Context`;case te:return(e._context.displayName||`Context`)+`.Consumer`;case ne:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ae:return t=e.displayName||null,t===null?he(e.type)||`Memo`:t;case oe:t=e._payload,e=e._init;try{return he(e(t))}catch{}}return null}var ge=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},_e=[],ve=-1;function ye(e){return{current:e}}function be(e){0>ve||(e.current=_e[ve],_e[ve]=null,ve--)}function xe(e,t){ve++,_e[ve]=e.current,e.current=t}var Se=ye(null),Ce=ye(null),we=ye(null),Te=ye(null);function Ee(e,t){switch(xe(we,t),xe(Ce,e),xe(Se,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}be(Se),xe(Se,e)}function De(){be(Se),be(Ce),be(we)}function Oe(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,xe(Te,e)),t=Se.current;var n=dp(t,e.type);t!==n&&(xe(Ce,e),xe(Se,n))}function ke(e){Ce.current===e&&(be(Se),be(Ce)),Te.current===e&&(be(Te),sh._currentValue=I)}var Ae,je;function Me(e){if(Ae===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Ae=t&&t[1]||``,je=-1<e.stack.indexOf(`
|
|
3
|
-
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
-
`+Ae+e+je}var Ne=!1;function Pe(e,t){if(!e||Ne)return``;Ne=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
|
-
`),l=s.split(`
|
|
6
|
-
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
7
|
-
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Ne=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?Me(n):``}function Fe(e,t){switch(e.tag){case 26:case 27:case 5:return Me(e.type);case 16:return Me(`Lazy`);case 13:return e.child!==t&&t!==null?Me(`Suspense Fallback`):Me(`Suspense`);case 19:return Me(`SuspenseList`);case 0:case 15:return Pe(e.type,!1);case 11:return Pe(e.type.render,!1);case 1:return Pe(e.type,!0);case 31:return Me(`Activity`);case 30:return Me(`ViewTransition`);default:return``}}function Ie(e){try{var t=``,n=null;do t+=Fe(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
-
Error generating stack: `+e.message+`
|
|
9
|
-
`+e.stack}}var Le=Object.prototype.hasOwnProperty,Re=t.unstable_scheduleCallback,ze=t.unstable_cancelCallback,Be=t.unstable_shouldYield,Ve=t.unstable_requestPaint,He=t.unstable_now,Ue=t.unstable_getCurrentPriorityLevel,We=t.unstable_ImmediatePriority,Ge=t.unstable_UserBlockingPriority,Ke=t.unstable_NormalPriority,qe=t.unstable_LowPriority,Je=t.unstable_IdlePriority,Ye=t.log,Xe=t.unstable_setDisableYieldValue,Ze=null,Qe=null;function $e(e){if(typeof Ye==`function`&&Xe(e),Qe&&typeof Qe.setStrictMode==`function`)try{Qe.setStrictMode(Ze,e)}catch{}}var et=Math.clz32?Math.clz32:rt,tt=Math.log,nt=Math.LN2;function rt(e){return e>>>=0,e===0?32:31-(tt(e)/nt|0)|0}var it=256,at=262144,ot=4194304;function st(e){var t=e&42;if(t!==0)return t;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ct(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=st(n))):i=st(o):i=st(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=st(n))):i=st(o)):i=st(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function lt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function ut(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-et(n),i=1<<r;t|=e[r],n&=~i}return t}function dt(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ft(){var e=ot;return ot<<=1,!(ot&62914560)&&(ot=4194304),e}function pt(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function mt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ht(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-et(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&>(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function gt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-et(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function _t(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-et(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function vt(e,t){var n=t&-t;return n=n&42?1:yt(n),(n&(e.suspendedLanes|t))===0?n:0}function yt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function bt(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function xt(){var e=F.p;return e===0?(e=window.event,e===void 0?32:Ch(e.type)):e}function St(e,t){var n=F.p;try{return F.p=e,t()}finally{F.p=n}}var Ct=Math.random().toString(36).slice(2),wt=`__reactFiber$`+Ct,Tt=`__reactProps$`+Ct,Et=`__reactContainer$`+Ct,L=`__reactEvents$`+Ct,Dt=`__reactListeners$`+Ct,Ot=`__reactHandles$`+Ct,kt=`__reactResources$`+Ct,At=`__reactMarker$`+Ct,jt=`__reactLoad$`+Ct;function Mt(e){delete e[wt],delete e[Tt],delete e[Dt],delete e[Ot]}function Nt(e){var t;if(t=e[wt])return t;for(var n=e.parentNode;n;){if(t=n[Et]||n[wt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=fm(e);e!==null;){if(n=e[wt])return n;e=fm(e)}return t}e=n,n=e.parentNode}return null}function Pt(e){if(e=e[wt]||e[Et]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Ft(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function It(e){var t=e[kt];return t||=e[kt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Lt(e){e[At]=!0}function Rt(e){e[jt]=void 0}var zt=new Set,Bt={};function Vt(e,t){Ht(e,t),Ht(e+`Capture`,t)}function Ht(e,t){for(Bt[e]=t,e=0;e<t.length;e++)zt.add(t[e])}var Ut=RegExp(`^[: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]*$`),Wt={},Gt={};function Kt(e){return Le.call(Gt,e)?!0:Le.call(Wt,e)?!1:Ut.test(e)?Gt[e]=!0:(Wt[e]=!0,!1)}var qt=!1;function Jt(){var e=qt;return qt=!1,e}function Yt(e,t,n){if(Kt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function Xt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function Zt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function Qt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function $t(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function en(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function tn(e){if(!e._valueTracker){var t=$t(e)?`checked`:`value`;e._valueTracker=en(e,t,``+e[t])}}function nn(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=$t(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var rn=/[\n"\\]/g;function an(e){return e.replace(rn,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function on(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Qt(t)):e.value!==``+Qt(t)&&(e.value=``+Qt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):cn(e,Qt(n)):o===`number`&&e.value==t?cn(e,Qt(e.value)):cn(e,Qt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Qt(s):e.removeAttribute(`name`)}function sn(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){tn(e);return}n=n==null?``:``+Qt(n),t=t==null?n:``+Qt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),tn(e)}function cn(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function ln(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Qt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function un(e,t,n){t!=null&&(t=``+Qt(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+Qt(n)}function dn(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ge(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Qt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),tn(e)}function fn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var pn=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function mn(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||pn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function hn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,qt=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(mn(e,a,r),qt=!0)}else for(var o in t)t.hasOwnProperty(o)&&mn(e,o,t[o])}function gn(e){if(e.indexOf(`-`)===-1)return!1;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 _n=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`maskType`,`mask-type`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),vn=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function yn(e){return vn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function bn(){}var xn=null;function Sn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Cn=null,wn=null;function Tn(e){var t=Pt(e);if(t&&(e=t.stateNode)){var n=e[Tt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(on(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+an(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[Tt]||null;if(!a)throw Error(i(90));on(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&nn(r)}break a;case`textarea`:un(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&ln(e,!!n.multiple,t,!1)}}}var En=!1;function Dn(e,t,n){if(En)return e(t,n);En=!0;try{return e(t)}finally{if(En=!1,(Cn!==null||wn!==null)&&(Ld(),Cn&&(t=Cn,e=wn,wn=Cn=null,Tn(t),e)))for(t=0;t<e.length;t++)Tn(e[t])}}function On(e,t){var n=e.stateNode;if(n===null)return null;var r=n[Tt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var kn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,An=!1;if(kn)try{var jn={};Object.defineProperty(jn,"passive",{get:function(){An=!0}}),window.addEventListener(`test`,jn,jn),window.removeEventListener(`test`,jn,jn)}catch{An=!1}var Mn=null,Nn=null,Pn=null;function Fn(){if(Pn)return Pn;var e,t=Nn,n=t.length,r,i=`value`in Mn?Mn.value:Mn.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return Pn=i.slice(e,1<r?1-r:void 0)}function In(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Ln(){return!0}function R(){return!1}function Rn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Ln:R,this.isPropagationStopped=R,this}return D(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Ln)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Ln)},persist:function(){},isPersistent:Ln}),t}var zn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bn=Rn(zn),Vn=D({},zn,{view:0,detail:0}),Hn=Rn(Vn),Un,Wn,Gn,Kn=D({},Vn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:rr,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Gn&&(Gn&&e.type===`mousemove`?(Un=e.screenX-Gn.screenX,Wn=e.screenY-Gn.screenY):Wn=Un=0,Gn=e),Un)},movementY:function(e){return`movementY`in e?e.movementY:Wn}}),qn=Rn(Kn),Jn=Rn(D({},Kn,{dataTransfer:0})),Yn=Rn(D({},Vn,{relatedTarget:0})),Xn=Rn(D({},zn,{animationName:0,elapsedTime:0,pseudoElement:0})),Zn=Rn(D({},zn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Qn=Rn(D({},zn,{data:0})),$n={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},er={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},tr={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function nr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=tr[e])?!!t[e]:!1}function rr(){return nr}var ir=Rn(D({},Vn,{key:function(e){if(e.key){var t=$n[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=In(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?er[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:rr,charCode:function(e){return e.type===`keypress`?In(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?In(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),ar=Rn(D({},Kn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),or=Rn(D({},zn,{submitter:0})),sr=Rn(D({},Vn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:rr})),cr=Rn(D({},zn,{propertyName:0,elapsedTime:0,pseudoElement:0})),lr=Rn(D({},Kn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),ur=Rn(D({},zn,{newState:0,oldState:0,source:0})),dr=[9,13,27,32],fr=kn&&`CompositionEvent`in window,pr=null;kn&&`documentMode`in document&&(pr=document.documentMode);var mr=kn&&`TextEvent`in window&&!pr,hr=kn&&(!fr||pr&&8<pr&&11>=pr),gr=` `,_r=!1;function vr(e,t){switch(e){case`keyup`:return dr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function yr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var br=!1;function xr(e,t){switch(e){case`compositionend`:return yr(t);case`keypress`:return t.which===32?(_r=!0,gr):null;case`textInput`:return e=t.data,e===gr&&_r?null:e;default:return null}}function Sr(e,t){if(br)return e===`compositionend`||!fr&&vr(e,t)?(e=Fn(),Pn=Nn=Mn=null,br=!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.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return hr&&t.locale!==`ko`?null:t.data;default:return null}}var Cr={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function wr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Cr[e.type]:t===`textarea`}function Tr(e,t,n,r){Cn?wn?wn.push(r):wn=[r]:Cn=r,t=qf(t,`onChange`),0<t.length&&(n=new Bn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Er=null,Dr=null;function Or(e){Bf(e,0)}function kr(e){if(nn(Ft(e)))return e}function Ar(e,t){if(e===`change`)return t}var jr=!1;if(kn){var Mr;if(kn){var Nr=`oninput`in document;if(!Nr){var Pr=document.createElement(`div`);Pr.setAttribute(`oninput`,`return;`),Nr=typeof Pr.oninput==`function`}Mr=Nr}else Mr=!1;jr=Mr&&(!document.documentMode||9<document.documentMode)}function Fr(){Er&&(Er.detachEvent(`onpropertychange`,Ir),Dr=Er=null)}function Ir(e){if(e.propertyName===`value`&&kr(Dr)){var t=[];Tr(t,Dr,e,Sn(e)),Dn(Or,t)}}function Lr(e,t,n){e===`focusin`?(Fr(),Er=t,Dr=n,Er.attachEvent(`onpropertychange`,Ir)):e===`focusout`&&Fr()}function Rr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return kr(Dr)}function zr(e,t){if(e===`click`)return kr(t)}function Br(e,t){if(e===`input`||e===`change`)return kr(t)}function Vr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Hr=typeof Object.is==`function`?Object.is:Vr;function z(e,t){if(Hr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Le.call(t,i)||!Hr(e[i],t[i]))return!1}return!0}function B(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Ur(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Wr(e,t){var n=Ur(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Ur(n)}}function Gr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Gr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Kr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=B(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=B(e.document)}return t}function qr(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`)}var Jr=kn&&`documentMode`in document&&11>=document.documentMode,Yr=null,Xr=null,Zr=null,Qr=!1;function $r(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Qr||Yr==null||Yr!==B(r)||(r=Yr,`selectionStart`in r&&qr(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}),Zr&&z(Zr,r)||(Zr=r,r=qf(Xr,`onSelect`),0<r.length&&(t=new Bn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Yr)))}function ei(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var ti={animationend:ei(`Animation`,`AnimationEnd`),animationiteration:ei(`Animation`,`AnimationIteration`),animationstart:ei(`Animation`,`AnimationStart`),transitionrun:ei(`Transition`,`TransitionRun`),transitionstart:ei(`Transition`,`TransitionStart`),transitioncancel:ei(`Transition`,`TransitionCancel`),transitionend:ei(`Transition`,`TransitionEnd`)},ni={},ri={};kn&&(ri=document.createElement(`div`).style,`AnimationEvent`in window||(delete ti.animationend.animation,delete ti.animationiteration.animation,delete ti.animationstart.animation),`TransitionEvent`in window||delete ti.transitionend.transition);function ii(e){if(ni[e])return ni[e];if(!ti[e])return e;var t=ti[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ri)return ni[e]=t[n];return e}var ai=ii(`animationend`),oi=ii(`animationiteration`),si=ii(`animationstart`),ci=ii(`transitionrun`),li=ii(`transitionstart`),ui=ii(`transitioncancel`),di=ii(`transitionend`),fi=new Map,pi=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);pi.push(`scrollEnd`);function mi(e,t){fi.set(e,t),Vt(t,[e])}var hi=0;function gi(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=vd.identifierPrefix;var n=hi++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function _i(e){if(e==null||typeof e==`string`)return e;var t=null,n=Ed;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function vi(e,t){return e=_i(e),t=_i(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var yi=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},bi=[],xi=0,Si=0;function Ci(){for(var e=xi,t=Si=xi=0;t<e;){var n=bi[t];bi[t++]=null;var r=bi[t];bi[t++]=null;var i=bi[t];bi[t++]=null;var a=bi[t];if(bi[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Di(n,i,a)}}function wi(e,t,n,r){bi[xi++]=e,bi[xi++]=t,bi[xi++]=n,bi[xi++]=r,Si|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Ti(e,t,n,r){return wi(e,t,n,r),Oi(e)}function Ei(e,t){return wi(e,null,null,t),Oi(e)}function Di(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-et(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Oi(e){if(50<Dd)throw Dd=0,Od=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ki={};function Ai(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.refCleanup=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 V(e,t,n,r){return new Ai(e,t,n,r)}function ji(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Mi(e,t){var n=e.alternate;return n===null?(n=V(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&1206910976,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.refCleanup=e.refCleanup,n}function Ni(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Pi(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)ji(r)&&(s=1);else if(typeof r==`string`)s=qm(e,n,Se.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case se:return e=V(31,n,t,a),e.elementType=se,e.lanes=o,e;case j:return Fi(n.children,a,o,t);case M:s=8,a|=24;break;case ee:return e=V(12,n,t,a|2),e.elementType=ee,e.lanes=o,e;case re:return e=V(13,n,t,a),e.elementType=re,e.lanes=o,e;case ie:return e=V(19,n,t,a),e.elementType=ie,e.lanes=o,e;case ce:case ue:return e=a|32,e=V(30,n,t,e),e.elementType=ue,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case N:s=10;break a;case te:s=9;break a;case ne:s=11;break a;case ae:s=14;break a;case oe:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=V(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Fi(e,t,n,r){return e=V(7,e,r,t),e.lanes=n,e}function Ii(e,t,n){return e=V(6,e,null,t),e.lanes=n,e}function Li(e){var t=V(18,null,null,0);return t.stateNode=e,t}function Ri(e,t,n){return t=V(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var zi=new WeakMap;function Bi(e,t){if(typeof e==`object`&&e){var n=zi.get(e);return n===void 0?(t={value:e,source:t,stack:Ie(t)},zi.set(e,t),t):n}return{value:e,source:t,stack:Ie(t)}}var Vi=[],Hi=0,Ui=null,Wi=0,Gi=[],Ki=0,qi=null,Ji=1,Yi=``;function Xi(e,t){Vi[Hi++]=Wi,Vi[Hi++]=Ui,Ui=e,Wi=t}function Zi(e,t,n){Gi[Ki++]=Ji,Gi[Ki++]=Yi,Gi[Ki++]=qi,qi=e;var r=Ji;e=Yi;var i=32-et(r)-1;r&=~(1<<i),n+=1;var a=32-et(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ji=1<<32-et(t)+i|n<<i|r,Yi=a+e}else Ji=1<<a|n<<i|r,Yi=e}function Qi(e){e.return!==null&&(Xi(e,1),Zi(e,1,0))}function $i(e){for(;e===Ui;)Ui=Vi[--Hi],Vi[Hi]=null,Wi=Vi[--Hi],Vi[Hi]=null;for(;e===qi;)qi=Gi[--Ki],Gi[Ki]=null,Yi=Gi[--Ki],Gi[Ki]=null,Ji=Gi[--Ki],Gi[Ki]=null}function ea(e,t){Gi[Ki++]=Ji,Gi[Ki++]=Yi,Gi[Ki++]=qi,Ji=t.id,Yi=t.overflow,qi=e}var ta=null,na=null,H=!1,ra=null,ia=!1,aa=Error(i(519));function oa(e){throw fa(Bi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),aa}function sa(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[wt]=e,t[Tt]=r,n){case`dialog`:$(`cancel`,t),$(`close`,t);break;case`iframe`:case`object`:case`embed`:$(`load`,t);break;case`video`:case`audio`:for(n=0;n<Rf.length;n++)$(Rf[n],t);break;case`source`:$(`error`,t);break;case`img`:case`image`:case`link`:$(`error`,t),$(`load`,t);break;case`details`:$(`toggle`,t);break;case`input`:$(`invalid`,t),sn(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:$(`invalid`,t);break;case`textarea`:$(`invalid`,t),dn(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||$f(t.textContent,n)?(r.popover!=null&&($(`beforetoggle`,t),$(`toggle`,t)),r.onScroll!=null&&$(`scroll`,t),r.onScrollEnd!=null&&$(`scrollend`,t),r.onClick!=null&&(t.onclick=bn),t=!0):t=!1,t||oa(e,!0)}function ca(e){for(ta=e.return;ta;)switch(ta.tag){case 5:case 31:case 13:ia=!1;return;case 27:case 3:ia=!0;return;default:ta=ta.return}}function la(e){if(e!==ta)return!1;if(!H)return ca(e),H=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||pp(e.type,e.memoizedProps)),n=!n),n&&na&&oa(e),ca(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));na=dm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));na=dm(e)}else t===27?(t=na,Sp(e.type)?(e=um,um=null,na=e):na=t):na=ta?lm(e.stateNode.nextSibling):null;return!0}function ua(){na=ta=null,H=!1}function da(){var e=ra;return e!==null&&(ud===null?ud=e:ud.push.apply(ud,e),ra=null),e}function fa(e){ra===null?ra=[e]:ra.push(e)}var pa=ye(null),ma=null,ha=null;function ga(e,t,n){xe(pa,t._currentValue),t._currentValue=n}function _a(e){e._currentValue=pa.current,be(pa)}function va(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function ya(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),va(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),va(s,n,e),s=null}else a.tag===13&&a.memoizedState!==null&&a.memoizedState.dehydrated===null?(a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),va(a.return,n,e),s=a.child,s=s===null?null:s.sibling):s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function ba(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Hr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===Te.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[sh]:e.push(sh))}a=a.return}return e!==null&&ya(t,e,n,r),t.flags|=262144,e!==null}function xa(e){for(e=e.firstContext;e!==null;){if(!Hr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Sa(e){ma=e,ha=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ca(e){return Ta(ma,e)}function wa(e,t){return ma===null&&Sa(e),Ta(e,t)}function Ta(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ha===null){if(e===null)throw Error(i(308));ha=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ha=ha.next=t;return n}var Ea=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Da=t.unstable_scheduleCallback,Oa=t.unstable_NormalPriority,ka={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Aa(){return{controller:new Ea,data:new Map,refCount:0}}function ja(e){e.refCount--,e.refCount===0&&Da(Oa,function(){e.controller.abort()})}function Ma(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Na=null;function Pa(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Fa=null,Ia=0,La=0,Ra=null;function za(e,t){if(Fa===null){var n=Fa=[];Ia=0,La=Nf(),Ra={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Ia++,t.then(Ba,Ba),t}function Ba(){if(--Ia===0&&(Na=null,Fa!==null)){Ra!==null&&(Ra.status=`fulfilled`);var e=Fa;Fa=null,La=0,Ra=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Va(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Ha=P.S;P.S=function(e,t){if(pd=He(),typeof t==`object`&&t&&typeof t.then==`function`&&za(e,t),Na!==null)for(var n=yf;n!==null;)Ma(n,Na),n=n.next;if(n=e.types,n!==null){for(var r=yf;r!==null;)Ma(r,n),r=r.next;if(La!==0){r=Na,r===null&&(r=Na=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Ha!==null&&Ha(e,t)};var Ua=ye(null);function Wa(){var e=Ua.current;return e===null?Xu.pooledCache:e}function Ga(e,t){t===null?xe(Ua,Ua.current):xe(Ua,t.pool)}function Ka(){var e=Wa();return e===null?null:{parent:ka._currentValue,pool:e}}var qa=Error(i(460)),Ja=Error(i(474)),Ya=Error(i(542)),Xa={then:function(){}};function Za(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Qa(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(bn,bn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,no(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(bn,bn);else{if(e=Xu,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,no(e),e}throw eo=t,qa}}function $a(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(eo=e,qa):e}}var eo=null;function to(){if(eo===null)throw Error(i(459));var e=eo;return eo=null,e}function no(e){if(e===qa||e===Ya)throw Error(i(483))}var ro=null,io=0;function ao(e){var t=io;return io+=1,ro===null&&(ro=[]),Qa(ro,e,t)}function oo(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function so(e,t){throw t.$$typeof===O?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function co(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=Mi(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Ii(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===j?(e=d(e,t,n.props.children,r,n.key),oo(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===oe&&$a(i)===t.type)?(t=a(t,n.props),oo(t,n),t.return=e,t):(t=Pi(n.type,n.key,n.props,null,e.mode,r),oo(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=Ri(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=Fi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Ii(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case k:return n=Pi(t.type,t.key,t.props,null,e.mode,n),oo(n,t),n.return=e,n;case A:return t=Ri(t,e.mode,n),t.return=e,t;case oe:return t=$a(t),f(e,t,n)}if(ge(t)||pe(t))return t=Fi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,ao(t),n);if(t.$$typeof===N)return f(e,wa(e,t),n);so(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case k:return n.key===i?l(e,t,n,r):null;case A:return n.key===i?u(e,t,n,r):null;case oe:return n=$a(n),p(e,t,n,r)}if(ge(n)||pe(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,ao(n),r);if(n.$$typeof===N)return p(e,t,wa(e,n),r);so(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case k:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case A:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case oe:return r=$a(r),m(e,t,n,r,i)}if(ge(r)||pe(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,ao(r),i);if(r.$$typeof===N)return m(e,t,n,wa(t,r),i);so(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),H&&Xi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return H&&Xi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),H&&Xi(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),H&&Xi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return H&&Xi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),H&&Xi(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===j&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case k:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===j){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),oo(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===oe&&$a(l)===r.type){n(e,r.sibling),c=a(r,o.props),oo(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===j?(c=Fi(o.props.children,e.mode,c,o.key),oo(c,o),c.return=e,e=c):(c=Pi(o.type,o.key,o.props,null,e.mode,c),oo(c,o),c.return=e,e=c)}return s(e);case A:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=Ri(o,e.mode,c),c.return=e,e=c}return s(e);case oe:return o=$a(o),_(e,r,o,c)}if(ge(o))return h(e,r,o,c);if(pe(o)){if(l=pe(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,ao(o),c);if(o.$$typeof===N)return _(e,r,wa(e,o),c);so(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Ii(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{io=0;var i=_(e,t,n,r);return ro=null,i}catch(t){if(t===qa||t===Ya)throw t;var a=V(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var lo=co(!0),uo=co(!1),fo=!1;function po(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function mo(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ho(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function go(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Yu&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Oi(e),Di(e,null,n),t}return wi(e,r,t,n),Oi(e)}function _o(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,_t(e,n)}}function vo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n}else e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var yo=!1;function bo(){if(yo){var e=Ra;if(e!==null)throw e}}function xo(e,t,n,r){yo=!1;var i=e.updateQueue;fo=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(Q&f)===f:(r&f)===f){f!==0&&f===La&&(yo=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=D({},d,f);break a;case 2:fo=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),id|=o,e.lanes=o,e.memoizedState=d}}function So(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Co(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)So(n[e],t)}var wo=ye(null),To=ye(0);function Eo(e,t){e=nd,xe(To,e),xe(wo,t),nd=e|t.baseLanes}function Do(){xe(To,nd),xe(wo,wo.current)}function Oo(){nd=To.current,be(wo),be(To)}var ko=ye(null),Ao=null;function jo(e){var t=e.alternate;xe(Io,Io.current&1),xe(ko,e),Ao===null&&(t===null||wo.current!==null||t.memoizedState!==null)&&(Ao=e)}function Mo(e){xe(Io,Io.current),xe(ko,e),Ao===null&&(Ao=e)}function No(e){e.tag===22?(xe(Io,Io.current),xe(ko,e),Ao===null&&(Ao=e)):Po()}function Po(){xe(Io,Io.current),xe(ko,ko.current)}function Fo(e){be(ko),Ao===e&&(Ao=null),be(Io)}var Io=ye(0);function Lo(e,t){xe(ko,ko.current),xe(Io,t)}function Ro(e){be(Io),be(ko),Ao===e&&(Ao=null)}function zo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||om(n)||sm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Bo=0,U=null,Vo=null,Ho=null,Uo=!1,Wo=!1,Go=!1,Ko=0,qo=0,Jo=null,Yo=0;function Xo(){throw Error(i(321))}function Zo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Hr(e[n],t[n]))return!1;return!0}function Qo(e,t,n,r,i,a){return Bo=a,U=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,P.H=e===null||e.memoizedState===null?hc:gc,Go=!1,a=n(r,i),Go=!1,Wo&&(a=es(t,n,r,i)),$o(e),a}function $o(e){P.H=mc;var t=Vo!==null&&Vo.next!==null;if(Bo=0,Ho=Vo=U=null,Uo=!1,qo=0,Jo=null,t)throw Error(i(300));e===null||G||(e=e.dependencies,e!==null&&xa(e)&&(G=!0))}function es(e,t,n,r){U=e;var a=0;do{if(Wo&&(Jo=null),qo=0,Wo=!1,25<=a)throw Error(i(301));if(a+=1,Ho=Vo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}P.H=_c,o=t(n,r)}while(Wo);return o}function ts(){var e=P.H,t=e.useState()[0];return t=typeof t.then==`function`?cs(t):t,e=e.useState()[0],(Vo===null?null:Vo.memoizedState)!==e&&(U.flags|=1024),t}function ns(){var e=Ko!==0;return Ko=0,e}function rs(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function is(e){if(Uo){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Uo=!1}Bo=0,Ho=Vo=U=null,Wo=!1,qo=Ko=0,Jo=null}function as(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ho===null?U.memoizedState=Ho=e:Ho=Ho.next=e,Ho}function os(){if(Vo===null){var e=U.alternate;e=e===null?null:e.memoizedState}else e=Vo.next;var t=Ho===null?U.memoizedState:Ho.next;if(t!==null)Ho=t,Vo=e;else{if(e===null)throw U.alternate===null?Error(i(467)):Error(i(310));Vo=e,e={memoizedState:Vo.memoizedState,baseState:Vo.baseState,baseQueue:Vo.baseQueue,queue:Vo.queue,next:null},Ho===null?U.memoizedState=Ho=e:Ho=Ho.next=e}return Ho}function ss(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function cs(e){var t=qo;return qo+=1,Jo===null&&(Jo=[]),e=Qa(Jo,e,t),t=U,(Ho===null?t.memoizedState:Ho.next)===null&&(t=t.alternate,P.H=t===null||t.memoizedState===null?hc:gc),e}function ls(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return cs(e);if(e.$$typeof===de)return;if(e.$$typeof===N)return Ca(e)}throw Error(i(438,String(e)))}function us(e){var t=null,n=U.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=U.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=ss(),U.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=le;return t.index++,n}function ds(e,t){return typeof t==`function`?t(e):t}function fs(e){return ps(os(),Vo,e)}function ps(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Bo&f)===f:(Q&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===La&&(d=!0);else if((Bo&p)===p){u=u.next,p===La&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,U.lanes|=p,id|=p;f=u.action,Go&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,U.lanes|=f,id|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Hr(o,e.memoizedState)&&(G=!0,d&&(n=Ra,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function ms(e){var t=os(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Hr(o,t.memoizedState)||(G=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function hs(e,t,n){var r=U,a=os(),o=H;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Hr((Vo||a).memoizedState,n);if(s&&(a.memoizedState=n,G=!0),a=a.queue,Bs(vs.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||Ho!==null&&!!(Ho.memoizedState.tag&1),Fs(e?9:8,{destroy:void 0},_s.bind(null,r,a,n,t),null),e){if(r.flags|=2048,Xu===null)throw Error(i(349));o||Bo&127||gs(r,t,n)}return n}function gs(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=U.updateQueue,t===null?(t=ss(),U.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function _s(e,t,n,r){t.value=n,t.getSnapshot=r,ys(t)&&bs(e)}function vs(e,t,n){return n(function(){ys(t)&&bs(e)})}function ys(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Hr(e,n)}catch{return!0}}function bs(e){var t=Ei(e,2);t!==null&&Md(t,e,2)}function xs(e){var t=as();if(typeof e==`function`){var n=e;if(e=n(),Go){$e(!0);try{n()}finally{$e(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ds,lastRenderedState:e},t}function Ss(e,t,n,r){return e.baseState=n,ps(e,Vo,typeof r==`function`?r:ds)}function Cs(e,t,n,r,a){if(dc(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};P.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,ws(t,o)):(o.next=n.next,t.pending=n.next=o)}}function ws(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=P.T,o={};o.types=a===null?null:a.types,P.T=o;try{var s=n(i,r),c=P.S;c!==null&&c(o,s),Ts(e,t,s)}catch(n){Ds(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),P.T=a}}else try{a=n(i,r),Ts(e,t,a)}catch(n){Ds(e,t,n)}}function Ts(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Es(e,t,n)},function(n){return Ds(e,t,n)}):Es(e,t,n)}function Es(e,t,n){t.status=`fulfilled`,t.value=n,Os(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,ws(e,n)))}function Ds(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Os(t),t=t.next;while(t!==r)}e.action=null}function Os(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ks(e,t){return t}function As(e,t){if(H){var n=Xu.formState;if(n!==null){a:{var r=U;if(H){if(na){b:{for(var i=na,a=ia;i.nodeType!==8;)if(!a||(i=lm(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){na=lm(i.nextSibling),r=i.data===`F!`;break a}}oa(r)}r=!1}r&&(t=n[0])}}return n=as(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ks,lastRenderedState:t},n.queue=r,n=cc.bind(null,U,r),r.dispatch=n,r=xs(!1),a=uc.bind(null,U,!1,r.queue),r=as(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Cs.bind(null,U,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function js(e){return Ms(os(),Vo,e)}function Ms(e,t,n){if(t=ps(e,t,ks)[0],e=fs(ds)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=cs(t)}catch(e){throw e===qa?Ya:e}else r=t;t=os();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(U.flags|=2048,Fs(9,{destroy:void 0},Ns.bind(null,i,n),null)),[r,a,e]}function Ns(e,t){e.action=t}function Ps(e){var t=os(),n=Vo;if(n!==null)return Ms(t,n,e);os(),t=t.memoizedState,n=os();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Fs(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=U.updateQueue,t===null&&(t=ss(),U.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Is(){return os().memoizedState}function Ls(e,t,n,r){var i=as();U.flags|=e,i.memoizedState=Fs(1|t,{destroy:void 0},n,r===void 0?null:r)}function Rs(e,t,n,r){var i=os();r=r===void 0?null:r;var a=i.memoizedState.inst;Vo!==null&&r!==null&&Zo(r,Vo.memoizedState.deps)?i.memoizedState=Fs(t,a,n,r):(U.flags|=e,i.memoizedState=Fs(1|t,a,n,r))}function zs(e,t){Ls(8390656,8,e,t)}function Bs(e,t){Rs(2048,8,e,t)}function Vs(e){U.flags|=4;var t=U.updateQueue;if(t===null)t=ss(),U.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Hs(e){var t=os().memoizedState;return Vs({ref:t,nextImpl:e}),function(){if(Yu&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Us(e,t){return Rs(4,2,e,t)}function Ws(e,t){return Rs(4,4,e,t)}function Gs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Ks(e,t,n){n=n==null?null:n.concat([e]),Rs(4,4,Gs.bind(null,t,e),n)}function qs(){}function Js(e,t){var n=os();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Zo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Ys(e,t){var n=os();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Zo(t,r[1]))return r[0];if(r=e(),Go){$e(!0);try{e()}finally{$e(!1)}}return n.memoizedState=[r,t],r}function Xs(e,t,n){return n===void 0||Bo&1073741824&&!(Q&261930)?e.memoizedState=t:(e.memoizedState=n,e=Ad(),U.lanes|=e,id|=e,n)}function Zs(e,t,n,r){return Hr(n,t)?n:wo.current===null?!(Bo&106)||Bo&1073741824&&!(Q&261930)?(G=!0,e.memoizedState=n):(e=Ad(),U.lanes|=e,id|=e,t):(e=Xs(e,n,r),Hr(e,t)||(G=!0),e)}function Qs(e,t,n,r,i){var a=F.p;F.p=a!==0&&8>a?a:8;var o=P.T,s={};s.types=o===null?null:o.types,P.T=s,uc(e,!1,t,n);try{var c=i(),l=P.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?lc(e,t,Va(c,r),kd(e)):lc(e,t,r,kd(e))}catch(n){lc(e,t,{then:function(){},status:`rejected`,reason:n},kd())}finally{F.p=a,o!==null&&s.types!==null&&(o.types=s.types),P.T=o}}function $s(){}function ec(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=tc(e).queue;Qs(e,a,t,I,n===null?$s:function(){return nc(e),n(r)})}function tc(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ds,lastRenderedState:I},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ds,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function nc(e){var t=tc(e);t.next===null&&(t=e.alternate.memoizedState),lc(e,t.next.queue,{},kd())}function rc(){return Ca(sh)}function ic(){return os().memoizedState}function ac(){return os().memoizedState}function oc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=kd();e=ho(n);var r=go(t,e,n);r!==null&&(Md(r,t,n),_o(r,t,n)),t={cache:Aa()},e.payload=t;return}t=t.return}}function sc(e,t,n){var r=kd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},dc(e)?fc(t,n):(n=Ti(e,t,n,r),n!==null&&(Md(n,e,r),pc(n,t,r)))}function cc(e,t,n){lc(e,t,n,kd())}function lc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(dc(e))fc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Hr(s,o))return wi(e,t,i,0),Xu===null&&Ci(),!1}catch{}if(n=Ti(e,t,i,r),n!==null)return Md(n,e,r),pc(n,t,r),!0}return!1}function uc(e,t,n,r){if(r={lane:2,revertLane:Nf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},dc(e)){if(t)throw Error(i(479))}else t=Ti(e,n,r,2),t!==null&&Md(t,e,2)}function dc(e){var t=e.alternate;return e===U||t!==null&&t===U}function fc(e,t){Wo=Uo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function pc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,_t(e,n)}}var mc={readContext:Ca,use:ls,useCallback:Xo,useContext:Xo,useEffect:Xo,useImperativeHandle:Xo,useLayoutEffect:Xo,useInsertionEffect:Xo,useMemo:Xo,useReducer:Xo,useRef:Xo,useState:Xo,useDebugValue:Xo,useDeferredValue:Xo,useTransition:Xo,useSyncExternalStore:Xo,useId:Xo,useHostTransitionStatus:Xo,useFormState:Xo,useActionState:Xo,useOptimistic:Xo,useMemoCache:Xo,useCacheRefresh:Xo,useEffectEvent:Xo},hc={readContext:Ca,use:ls,useCallback:function(e,t){return as().memoizedState=[e,t===void 0?null:t],e},useContext:Ca,useEffect:zs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Ls(4194308,4,Gs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ls(4194308,4,e,t)},useInsertionEffect:function(e,t){Ls(4,2,e,t)},useMemo:function(e,t){var n=as();t=t===void 0?null:t;var r=e();if(Go){$e(!0);try{e()}finally{$e(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=as();if(n!==void 0){var i=n(t);if(Go){$e(!0);try{n(t)}finally{$e(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=sc.bind(null,U,e),[r.memoizedState,e]},useRef:function(e){var t=as();return e={current:e},t.memoizedState=e},useState:function(e){e=xs(e);var t=e.queue,n=cc.bind(null,U,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:qs,useDeferredValue:function(e,t){return Xs(as(),e,t)},useTransition:function(){var e=xs(!1);return e=Qs.bind(null,U,e.queue,!0,!1),as().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=U,a=as();if(H){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Xu===null)throw Error(i(349));Q&127||gs(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,zs(vs.bind(null,r,o,e),[e]),r.flags|=2048,Fs(9,{destroy:void 0},_s.bind(null,r,o,n,t),null),n},useId:function(){var e=as(),t=Xu.identifierPrefix;if(H){var n=Yi,r=Ji;n=(r&~(1<<32-et(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Ko++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Yo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:rc,useFormState:As,useActionState:As,useOptimistic:function(e){var t=as();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=uc.bind(null,U,!0,n),n.dispatch=t,[e,t]},useMemoCache:us,useCacheRefresh:function(){return as().memoizedState=oc.bind(null,U)},useEffectEvent:function(e){var t=as(),n={impl:e};return t.memoizedState=n,function(){if(Yu&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},gc={readContext:Ca,use:ls,useCallback:Js,useContext:Ca,useEffect:Bs,useImperativeHandle:Ks,useInsertionEffect:Us,useLayoutEffect:Ws,useMemo:Ys,useReducer:fs,useRef:Is,useState:function(){return fs(ds)},useDebugValue:qs,useDeferredValue:function(e,t){return Zs(os(),Vo.memoizedState,e,t)},useTransition:function(){var e=fs(ds)[0],t=os().memoizedState;return[typeof e==`boolean`?e:cs(e),t]},useSyncExternalStore:hs,useId:ic,useHostTransitionStatus:rc,useFormState:js,useActionState:js,useOptimistic:function(e,t){return Ss(os(),Vo,e,t)},useMemoCache:us,useCacheRefresh:ac,useEffectEvent:Hs},_c={readContext:Ca,use:ls,useCallback:Js,useContext:Ca,useEffect:Bs,useImperativeHandle:Ks,useInsertionEffect:Us,useLayoutEffect:Ws,useMemo:Ys,useReducer:ms,useRef:Is,useState:function(){return ms(ds)},useDebugValue:qs,useDeferredValue:function(e,t){var n=os();return Vo===null?Xs(n,e,t):Zs(n,Vo.memoizedState,e,t)},useTransition:function(){var e=ms(ds)[0],t=os().memoizedState;return[typeof e==`boolean`?e:cs(e),t]},useSyncExternalStore:hs,useId:ic,useHostTransitionStatus:rc,useFormState:Ps,useActionState:Ps,useOptimistic:function(e,t){var n=os();return Vo===null?(n.baseState=e,[e,n.queue.dispatch]):Ss(n,Vo,e,t)},useMemoCache:us,useCacheRefresh:ac,useEffectEvent:Hs};function vc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:D({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var yc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=kd(),i=ho(r);i.payload=t,n!=null&&(i.callback=n),t=go(e,i,r),t!==null&&(Md(t,e,r),_o(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=kd(),i=ho(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=go(e,i,r),t!==null&&(Md(t,e,r),_o(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=kd(),r=ho(n);r.tag=2,t!=null&&(r.callback=t),t=go(e,r,n),t!==null&&(Md(t,e,n),_o(t,e,n))}};function bc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!z(n,r)||!z(i,a):!0}function xc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&yc.enqueueReplaceState(t,t.state,null)}function Sc(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=D({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Cc(e){yi(e)}function wc(e){console.error(e)}function Tc(e){yi(e)}function Ec(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Dc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Oc(e,t,n){return n=ho(n),n.tag=3,n.payload={element:null},n.callback=function(){Ec(e,t)},n}function kc(e){return e=ho(e),e.tag=3,e}function W(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Dc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Dc(t,n,r),typeof i!=`function`&&(gd===null?gd=new Set([this]):gd.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Ac(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&ba(t,n,a,!0),n=ko.current,n!==null){switch(n.tag){case 31:case 13:case 19:return Ao===null?Wd():n.alternate===null&&rd===0&&(rd=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Xa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),pf(e,r,a)),!1;case 22:return n.flags|=65536,r===Xa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),pf(e,r,a)),!1}throw Error(i(435,n.tag))}return pf(e,r,a),Wd(),!1}if(H)return t=ko.current,t===null?(r!==aa&&(t=Error(i(423),{cause:r}),fa(Bi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Bi(r,n),a=Oc(e.stateNode,r,a),vo(e,a),rd!==4&&(rd=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==aa&&(e=Error(i(422),{cause:r}),fa(Bi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Bi(o,n),ld===null?ld=[o]:ld.push(o),rd!==4&&(rd=2),t===null)return!0;r=Bi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Oc(n.stateNode,r,e),vo(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(gd===null||!gd.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=kc(a),W(a,e,n,r),vo(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var jc=Error(i(461)),G=!1;function K(e,t,n,r){t.child=e===null?uo(t,null,n,r):lo(t,e.child,n,r)}function Mc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Sa(t),r=Qo(e,t,n,o,a,i),s=ns(),e!==null&&!G?(rs(e,t,i),ol(e,t,i)):(H&&s&&Qi(t),t.flags|=1,K(e,t,r,i),t.child)}function Nc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ji(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Pc(e,t,a,r,i)):(e=Pi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!sl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?z:n,n(o,r)&&e.ref===t.ref)return ol(e,t,i)}return t.flags|=1,e=Mi(a,r),e.ref=t.ref,e.return=t,t.child=e}function Pc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(z(a,r)&&e.ref===t.ref){if(G=!1,t.pendingProps=r=a,sl(e,i))e.flags&131072&&(G=!0);else return t.lanes=e.lanes,ol(e,t,i)}}return Hc(e,t,n,r,i)}function Fc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Lc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ga(t,a===null?null:a.cachePool),a===null?Do():Eo(t,a),No(t);else return r=t.lanes=536870912,Lc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ga(t,null),Do(),Po()):(Ga(t,a.cachePool),Eo(t,a),Po(),t.memoizedState=null);return K(e,t,i,n),t.child}function Ic(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Lc(e,t,n,r,i){var a=Wa();return a=a===null?null:{parent:ka._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ga(t,null),Do(),No(t),e!==null&&ba(e,t,r,!0),t.childLanes=i,null}function Rc(e,t){return t=Zc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function zc(e,t,n){return lo(t,e.child,null,n),e=Rc(t,t.pendingProps),e.flags|=2,Fo(t),t.memoizedState=null,e}function Bc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(H){if(r.mode===`hidden`)return e=Rc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Ic(null,e);if(Mo(t),(e=na)?(e=am(e,ia),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:qi===null?null:{id:Ji,overflow:Yi},retryLane:536870912,hydrationErrors:null},n=Li(e),n.return=t,t.child=n,ta=t,na=null)):e=null,e===null)throw oa(t);return t.lanes=536870912,null}return Rc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Mo(t),a){if(t.flags&256)t.flags&=-257,t=zc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(G||ba(e,t,n,!1),a=(n&e.childLanes)!==0,G||a){if(wo.current===null){if(r=Xu,r!==null&&(s=vt(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Ei(e,s),Md(r,e,s),jc;Wd()}t=zc(e,t,n)}else e=o.treeContext,na=lm(s.nextSibling),ta=t,H=!0,ra=null,ia=!1,e!==null&&ea(t,e),t=Rc(t,r),t.flags|=134221824;return t}return e=Mi(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Vc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function Hc(e,t,n,r,i){return Sa(t),n=Qo(e,t,n,r,void 0,i),r=ns(),e!==null&&!G?(rs(e,t,i),ol(e,t,i)):(H&&r&&Qi(t),t.flags|=1,K(e,t,n,i),t.child)}function Uc(e,t,n,r,i,a){return Sa(t),t.updateQueue=null,n=es(t,r,n,i),$o(e),r=ns(),e!==null&&!G?(rs(e,t,a),ol(e,t,a)):(H&&r&&Qi(t),t.flags|=1,K(e,t,n,a),t.child)}function Wc(e,t,n,r,i){if(Sa(t),t.stateNode===null){var a=ki,o=n.contextType;typeof o==`object`&&o&&(a=Ca(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=yc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},po(t),o=n.contextType,a.context=typeof o==`object`&&o?Ca(o):ki,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(vc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&yc.enqueueReplaceState(a,a.state,null),xo(t,r,a,i),bo(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Sc(n,s);a.props=c;var l=a.context,u=n.contextType;o=ki,typeof u==`object`&&u&&(o=Ca(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&xc(t,a,r,o),fo=!1;var f=t.memoizedState;a.state=f,xo(t,r,a,i),bo(),l=t.memoizedState,s||f!==l||fo?(typeof d==`function`&&(vc(t,n,d,r),l=t.memoizedState),(c=fo||bc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,mo(e,t),o=t.memoizedProps,u=Sc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ki,typeof l==`object`&&l&&(c=Ca(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&xc(t,a,r,c),fo=!1,f=t.memoizedState,a.state=f,xo(t,r,a,i),bo();var p=t.memoizedState;o!==d||f!==p||fo||e!==null&&e.dependencies!==null&&xa(e.dependencies)?(typeof s==`function`&&(vc(t,n,s,r),p=t.memoizedState),(u=fo||bc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&xa(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,Vc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=lo(t,e.child,null,i),t.child=lo(t,null,n,i)):K(e,t,n,i),t.memoizedState=a.state,e=t.child):e=ol(e,t,i),e}function Gc(e,t,n,r){return ua(),t.flags|=256,K(e,t,n,r),t.child}var Kc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function qc(e){return{baseLanes:e,cachePool:Ka()}}function Jc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=sd),e}function Yc(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Io.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(H){if(i?jo(t):Po(),(e=na)?(e=am(e,ia),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:qi===null?null:{id:Ji,overflow:Yi},retryLane:536870912,hydrationErrors:null},n=Li(e),n.return=t,t.child=n,ta=t,na=null)):e=null,e===null)throw oa(t);return t.lanes=sm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Po(),i=t.mode,a=Zc({mode:`hidden`,children:a},i),r=Fi(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=qc(n),r.childLanes=Jc(e,o,n),t.memoizedState=Kc,Ic(null,r)):(jo(t),Xc(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return $c(e,t,a,o,r,c,s,n)}return i?(Po(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Mi(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=Fi(i,a,n,null),i.flags|=2):i=Mi(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Ic(null,r),r=t.child,i=e.child.memoizedState,i===null?i=qc(n):(a=i.cachePool,a===null?a=Ka():(s=ka._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=Jc(e,o,n),t.memoizedState=Kc,Ic(e.child,r)):(jo(t),n=e.child,e=n.sibling,n=Mi(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function Xc(e,t){return t=Zc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Zc(e,t){return e=V(22,e,null,t),e.lanes=0,e}function Qc(e,t,n){return lo(t,e.child,null,n),e=Xc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function $c(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(jo(t),t.flags&=-257,Qc(e,t,c)):t.memoizedState===null?(Po(),o=a.fallback,s=t.mode,a=Zc({mode:`visible`,children:a.children},s),o=Fi(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,lo(t,e.child,null,c),a=t.child,a.memoizedState=qc(c),a.childLanes=Jc(e,r,c),t.memoizedState=Kc,Ic(null,a)):(Po(),t.child=e.child,t.flags|=128,null);if(jo(t),sm(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(a=Error(i(419)),a.stack=``,a.digest=r,fa({value:a,source:null,stack:null})),Qc(e,t,c)}if(G||ba(e,t,c,!1),r=(c&e.childLanes)!==0,G||r){if(wo.current!==null)return Qc(e,t,c);if(r=Xu,r!==null&&(a=vt(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,Ei(e,a),Md(r,e,a),jc;return om(o)||Wd(),Qc(e,t,c)}return om(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,na=lm(o.nextSibling),ta=t,H=!0,ra=null,ia=!1,e!==null&&ea(t,e),t=Xc(t,a.children),t.flags|=134221824,t)}function el(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),va(e.return,t,n)}function tl(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&zo(n)===null&&(t=e),e=e.sibling}return t}function nl(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function rl(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function il(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Io.current;if(t.flags&128)return Lo(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,Lo(t,o),i===`backwards`&&e!==null?(rl(e),K(e,t,r,n),rl(e)):K(e,t,r,n),r=H?Wi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&el(e,n,t);else if(e.tag===19)el(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=tl(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,rl(t)),nl(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&zo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}nl(t,!0,n,null,a,r);break;case`together`:nl(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=tl(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),nl(t,!1,i,n,a,r)}return t.child}function al(e,t,n){var r=t.pendingProps;return ga(t,t.type,r.value),K(e,t,r.children,n),t.child}function ol(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),id|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(ba(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=Mi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Mi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function sl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&xa(e)))}function cl(e,t,n){switch(t.tag){case 3:Ee(t,t.stateNode.containerInfo),ga(t,ka,e.memoizedState.cache),ua();break;case 27:case 5:Oe(t);break;case 4:Ee(t,t.stateNode.containerInfo);break;case 10:ga(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Mo(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return jo(t),t.flags|=128,null;r=ba(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?Yc(e,t,n):(jo(t),e=ol(e,t,n),e===null?null:e.sibling)}jo(t);break;case 19:if(t.flags&128)return il(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(ba(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return il(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Lo(t,Io.current),r)break;return null;case 22:return t.lanes=0,Fc(e,t,n,t.pendingProps);case 24:ga(t,ka,e.memoizedState.cache)}return ol(e,t,n)}function ll(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)G=!0;else{if(!sl(e,n)&&!(t.flags&128))return G=!1,cl(e,t,n);G=!!(e.flags&131072)}}else G=!1,H&&t.flags&1048576&&Zi(t,Wi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=$a(t.elementType),t.type=e,typeof e==`function`)ji(e)?(r=Sc(e,r),t.tag=1,t=Wc(null,t,e,r,n)):(t.tag=0,t=Hc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===ne){t.tag=11,t=Mc(null,t,e,r,n);break a}if(a===ae){t.tag=14,t=Nc(null,t,e,r,n);break a}if(a===N){t.tag=10,t.type=e,t=al(null,t,n);break a}}throw t=he(e)||e,Error(i(306,t,``))}}return t;case 0:return Hc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Sc(r,t.pendingProps),Wc(e,t,r,a,n);case 3:a:{if(Ee(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,mo(e,t),xo(t,r,null,n);var s=t.memoizedState;if(r=s.cache,ga(t,ka,r),r!==o.cache&&ya(t,[ka],n,!0),bo(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Gc(e,t,r,n);break a}if(r!==a){a=Bi(Error(i(424)),t),fa(a),t=Gc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(na=lm(e.firstChild),ta=t,H=!0,ra=null,ia=!0,n=uo(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(ua(),r===a){t=ol(e,t,n);break a}K(e,t,r,n)}t=t.child}return t;case 26:return Vc(e,t),e===null?(n=Nm(t.type,null,t.pendingProps,null))?t.memoizedState=n:H||(t.stateNode=fp(t.type,t.pendingProps,we.current,t)):t.memoizedState=Nm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Oe(t),e===null&&H&&(r=t.stateNode=hm(t.type,t.pendingProps,we.current),ta=t,ia=!0,a=na,Sp(t.type)?(um=a,na=lm(r.firstChild)):na=a),K(e,t,t.pendingProps.children,n),Vc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&H&&((a=r=na)&&(r=rm(r,t.type,t.pendingProps,ia),r===null?a=!1:(t.stateNode=r,ta=t,na=lm(r.firstChild),ia=!1,a=!0)),a||oa(t)),Oe(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,pp(a,o)?r=null:s!==null&&pp(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=Qo(e,t,ts,null,null,n),sh._currentValue=a),Vc(e,t),K(e,t,r,n),t.child;case 6:return e===null&&H&&((e=n=na)&&(n=im(n,t.pendingProps,ia),n===null?e=!1:(t.stateNode=n,ta=t,na=null,e=!0)),e||oa(t)),null;case 13:return Yc(e,t,n);case 4:return Ee(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=lo(t,null,r,n):K(e,t,r,n),t.child;case 11:return Mc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Vc(e,t),K(e,t,r,n),t.child;case 8:return K(e,t,t.pendingProps.children,n),t.child;case 12:return K(e,t,t.pendingProps.children,n),t.child;case 10:return al(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,Sa(t),a=Ca(a),r=r(a),t.flags|=1,K(e,t,r,n),t.child;case 14:return Nc(e,t,t.type,t.pendingProps,n);case 15:return Pc(e,t,t.type,t.pendingProps,n);case 19:return il(e,t,n);case 31:return Bc(e,t,n);case 22:return Fc(e,t,n,t.pendingProps);case 24:return Sa(t),r=Ca(ka),e===null?(a=Wa(),a===null&&(a=Xu,o=Aa(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},po(t),ga(t,ka,a)):((e.lanes&n)!==0&&(mo(e,t),xo(t,null,null,n),bo()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,ga(t,ka,r),r!==a.cache&&ya(t,[ka],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),ga(t,ka,r))),K(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:H&&Qi(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Vc(e,t),K(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function ul(e){e.flags|=4}function dl(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?Jm(t,r):Jm(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Vd())e.flags|=8192;else throw eo=Xa,Ja}}else e.flags&=-16777217}function fl(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Ym(t)){if(Vd())e.flags|=8192;else throw eo=Xa,Ja}}function pl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:ft(),e.lanes|=t,cd|=t)}function ml(e,t){if(!H)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,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;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function q(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function hl(e,t,n){var r=t.pendingProps;switch($i(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return q(t),null;case 1:return q(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),_a(ka),De(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(la(t)?ul(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,da())),q(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(ul(t),o===null?(q(t),dl(t,a,null,r,n)):(q(t),fl(t,o))):o?o===e.memoizedState?(q(t),t.flags&=-16777217):(ul(t),q(t),fl(t,o)):(e=e.memoizedProps,e!==r&&ul(t),q(t),dl(t,a,e,r,n)),null;case 27:if(ke(t),n=we.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ul(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return q(t),t.subtreeFlags&=-33554433,null}e=Se.current,la(t)?sa(t,e):(e=hm(a,r,n),t.stateNode=e,ul(t))}return q(t),t.subtreeFlags&=-33554433,null;case 5:if(ke(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&ul(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return q(t),t.subtreeFlags&=-33554433,null}if(o=Se.current,la(t))sa(t,o);else{var s=lp(we.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[wt]=t,o[Tt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(np(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&ul(t)}}return q(t),t.subtreeFlags&=-33554433,dl(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&ul(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=we.current,la(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=ta,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[wt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||$f(e.nodeValue,n)),e||oa(t,!0)}else e=lp(e).createTextNode(r),e[wt]=t,t.stateNode=e}return q(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=la(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[wt]=t}else ua(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;q(t),e=!1}else n=da(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Fo(t),t):(Fo(t),null);if(t.flags&128)throw Error(i(558))}return q(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=la(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[wt]=t}else ua(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;q(t),a=!1}else a=da(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Fo(t),t):(Fo(t),null)}return Fo(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),pl(t,t.updateQueue),q(t),null);case 4:return De(),e===null&&Uf(t.stateNode.containerInfo),t.flags|=67108864,q(t),null;case 10:return _a(t.type),q(t),null;case 19:if(Ro(t),r=t.memoizedState,r===null)return q(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)ml(r,!1);else{if(rd!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=zo(e),o!==null){for(t.flags|=128,ml(r,!1),e=o.updateQueue,t.updateQueue=e,pl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Ni(n,e),n=n.sibling;return Lo(t,Io.current&1|2),H&&Xi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&He()>md&&(t.flags|=128,a=!0,ml(r,!1),t.lanes=4194304)}}else{if(!a){if(e=zo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,pl(t,e),ml(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!H)return q(t),null}else 2*He()-r.renderingStartTime>md&&n!==536870912&&(t.flags|=128,a=!0,ml(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=He(),e.sibling=null,o=Io.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||H?Lo(t,o):(n=o,xe(ko,t),xe(Io,n),Ao===null&&(Ao=t)),H&&Xi(t,r.treeForkCount),e}return q(t),null;case 22:case 23:return Fo(t),Oo(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(q(t),t.subtreeFlags&6&&(t.flags|=8192)):q(t),n=t.updateQueue,n!==null&&pl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&be(Ua),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),_a(ka),q(t),null;case 25:return null;case 30:return t.flags|=33554432,q(t),null}throw Error(i(156,t.tag))}function gl(e,t){switch($i(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return _a(ka),De(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ke(t),null;case 31:if(t.memoizedState!==null){if(Fo(t),t.alternate===null)throw Error(i(340));ua()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Fo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));ua()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ro(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return De(),null;case 10:return _a(t.type),null;case 22:case 23:return Fo(t),Oo(),e!==null&&be(Ua),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return _a(ka),null;case 25:return null;default:return null}}function _l(e,t){switch($i(t),t.tag){case 3:_a(ka),De();break;case 26:case 27:case 5:ke(t);break;case 4:De();break;case 31:t.memoizedState!==null&&Fo(t);break;case 13:Fo(t);break;case 19:Ro(t);break;case 10:_a(t.type);break;case 22:case 23:Fo(t),Oo(),e!==null&&be(Ua);break;case 24:_a(ka)}}function vl(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){ff(t,t.return,e)}}function yl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){ff(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){ff(t,t.return,e)}}function bl(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Co(t,n)}catch(t){ff(e,e.return,t)}}}function xl(e,t,n){n.props=Sc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){ff(e,t,n)}}function Sl(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=gi(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Pp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Fp(e);p(e.child,!1,Qp,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){ff(e,t,n)}}function Cl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){ff(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){ff(e,t,n)}else n.current=null}}function wl(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)em(e.stateNode,t[n])}function Tl(e){for(var t=e.return;t!==null&&(Ol(t)&&em(e.stateNode,t.stateNode),!Dl(t));)t=t.return}function El(e){for(var t=e.return;t!==null&&(Ol(t)&&tm(e.stateNode,t.stateNode),!Dl(t));)t=t.return}function Dl(e){return e.tag===5||e.tag===3||e.tag===27}function Ol(e){return e&&e.tag===7&&e.stateNode!==null}function kl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){ff(e,e.return,t)}}function Al(e,t,n){try{var r=e.stateNode;ip(r,e.type,n,t),r[Tt]=t}catch(t){ff(e,e.return,t)}}function jl(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Sp(e.type)||e.tag===4}function Ml(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||jl(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.tag===27&&Sp(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Nl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=bn)),wl(e,r),qt=!0;else if(i!==4&&(i===27&&(wl(e,r),r=null,Sp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(Nl(e,t,n,r),e=e.sibling;e!==null;)Nl(e,t,n,r),e=e.sibling}function Pl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),wl(e,r),qt=!0;else if(i!==4&&(i===27&&(wl(e,r),r=null,Sp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Pl(e,t,n,r),e=e.sibling;e!==null;)Pl(e,t,n,r),e=e.sibling}function Fl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);np(t,r,n),t[wt]=e,t[Tt]=n}catch(t){ff(e,e.return,t)}}var Il=!1,Ll=null;function Rl(e){(e.tag===30||e.subtreeFlags&33554432)&&(Il=!0)}var zl=null;function Bl(){var e=zl;return zl=null,e}var Vl=0;function Hl(e,t,n,r,i){return Vl=0,Ul(e.child,t,n,r,i)}function Ul(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=Op(o);r.push(s),s.view&&(a=!0)}else a||Op(o).view&&(a=!0);Il=!0,Tp(o,Vl===0?t:t+`_`+Vl,n),Vl++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&i||Ul(e.child,t,n,r,i)&&(a=!0));e=e.sibling}return a}function Wl(e,t){for(;e!==null;)e.tag===5?Ep(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Wl(e.child,t)),e=e.sibling}function Gl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Gl(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(i(544));var n=t.name;t=vi(t.default,t.share),t!==`none`&&(Hl(e,n,t,null,!1)||Wl(e.child,!1))}e=e.sibling}}function Kl(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=gi(r,n),a=vi(r.default,n.paired?r.share:r.enter);a===`none`?Gl(e):Hl(e,i,a,null,!1)?(Gl(e),n.paired||t||jd(e,r.onEnter)):Wl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Kl(e,t),e=e.sibling;else Gl(e)}function ql(e){if(Ll!==null&&Ll.size!==0){var t=Ll;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=vi(n.default,n.share);if(a!==`none`&&(Hl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,jd(e,n.onShare)):Wl(e.child,!1)),t.delete(r),t.size===0)break}}}ql(e)}e=e.sibling}}}function Jl(e){if(e.tag===30){var t=e.memoizedProps,n=gi(t,e.stateNode),r=Ll===null?void 0:Ll.get(n),i=vi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Hl(e,n,i,null,!1)?r===void 0?jd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Ll.delete(n),jd(e,t.onShare)):Wl(e.child,!1)),Ll!==null&&ql(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Jl(e),e=e.sibling;else Ll!==null&&ql(e)}function Yl(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=gi(t,e.stateNode);t=vi(t.default,t.update),e.flags&=-5,t!==`none`&&Hl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&Yl(e);e=e.sibling}}function Xl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,Wl(e.child,!1))}Xl(e)}e=e.sibling}}function Zl(e){if(e.tag===30)e.stateNode.paired=null,Wl(e.child,!1),Xl(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Zl(e),e=e.sibling;else Xl(e)}function Ql(e){for(e=e.child;e!==null;)e.tag===30?Wl(e.child,!1):e.subtreeFlags&33554432&&Ql(e),e=e.sibling}function $l(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&Vl<a.length){var l=a[Vl],u=Op(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Tp(c,Vl===0?n:n+`_`+Vl,i),s&&e.flags&4||(zl===null&&(zl=[]),zl.push(c,Vl===0?r:r+`_`+Vl,t.memoizedProps)),Vl++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:$l(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function eu(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=gi(n,r),a=vi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(kp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;Vl=0,i=$l(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||jd(e,n.onUpdate))}else e.subtreeFlags&33554432&&eu(e,t);e=e.sibling}}var tu=!1,nu=!1,ru=!1,iu=!1,au=typeof WeakSet==`function`?WeakSet:Set,ou=null,su=!1,cu=!1,lu=!1,uu=!1;function du(e,t,n){if(e=e.containerInfo,sp=gh,e=Kr(e),qr(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(cp={focusedElem:e,selectionRange:r},gh=!1,n=(n&335544064)===n,ou=t,t=n?9270:1024;ou!==null;){if(e=ou,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&Jl(r[a]);if(e.alternate===null&&e.flags&2)n&&Rl(e),fu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&Jl(r),fu(n);continue}if(r!==null&&r.memoizedState!==null){n&&Rl(e),fu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,ou=r):(n&&Yl(e),fu(n))}}Ll=null}function fu(e){for(;ou!==null;){var t=ou,n=e,r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(a&1024&&r!==null){n=void 0,a=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=Sc(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){ff(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)nm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:nm(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=gi(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=vi(a.default,a.update),a!==`none`&&Hl(r,n,a,r.memoizedState=[],!0));break;default:if(a&1024)throw Error(i(163))}if(r=t.sibling,r!==null){r.return=t.return,ou=r;break}ou=t.return}}function J(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Au(e,n),r&4&&vl(5,n);break;case 1:if(Au(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){ff(n,n.return,e)}else{var i=Sc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){ff(n,n.return,e)}}}r&64&&bl(n),r&512&&Sl(n,n.return);break;case 3:if(Au(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Co(e,t)}catch(e){ff(n,n.return,e)}}break;case 27:t===null&&r&4&&Fl(n);case 26:case 5:Au(e,n),t===null&&r&4&&kl(n),r&512&&Sl(n,n.return);break;case 12:Au(e,n);break;case 31:Au(e,n),r&4&&yu(e,n);break;case 13:Au(e,n),r&4&&bu(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=gf.bind(null,n),cm(e,n))));break;case 22:if(r=n.memoizedState!==null||tu,!r){var a=t!==null&&t.memoizedState!==null||nu;t=tu,i=nu,tu=r,(nu=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Mu(e,n,r)):Au(e,n),tu=t,nu=i}break;case 30:Au(e,n),r&512&&Sl(n,n.return);break;case 7:r&512&&Sl(n,n.return);default:Au(e,n)}}function pu(e,t){for(e=e.child;e!==null;)Y(e,t),e=e.sibling}function Y(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){ff(e,e.return,t)}mu(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,qt=!0}catch(t){ff(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?wp(s,!0):wp(e.stateNode,!1)}catch(t){ff(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&pu(e,t);break;default:pu(e,t)}}function mu(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:Y(n,r);break a;case 22:n.memoizedState===null&&mu(n,r);break a;default:mu(n,r)}}e=e.sibling}}function hu(e){var t=e.alternate;t!==null&&(e.alternate=null,hu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Mt(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var gu=null,_u=!1;function X(e,t,n){for(n=n.child;n!==null;)vu(e,t,n),n=n.sibling}function vu(e,t,n){if(Qe&&typeof Qe.onCommitFiberUnmount==`function`)try{Qe.onCommitFiberUnmount(Ze,n)}catch{}switch(n.tag){case 26:nu||Cl(n,t),X(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!nu&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:nu||Cl(n,t),El(n);var r=gu,i=_u;Sp(n.type)&&(gu=n.stateNode,_u=!1),X(e,t,n),gm(n.stateNode,n.type,n.memoizedProps),gu=r,_u=i;break;case 5:nu||Cl(n,t),El(n);case 6:if(n.tag===6&&El(n),r=gu,i=_u,gu=null,X(e,t,n),gu=r,_u=i,gu!==null){if(_u)try{(gu.nodeType===9?gu.body:gu.nodeName===`HTML`?gu.ownerDocument.body:gu).removeChild(n.stateNode),qt=!0}catch(e){ff(n,t,e)}else try{gu.removeChild(n.stateNode),qt=!0}catch(e){ff(n,t,e)}}break;case 18:gu!==null&&(_u?(e=gu,Cp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Hh(e)):Cp(gu,n.stateNode));break;case 4:r=gu,i=_u,gu=n.stateNode.containerInfo,_u=!0,X(e,t,n),gu=r,_u=i;break;case 0:case 11:case 14:case 15:yl(2,n,t),nu||yl(4,n,t),X(e,t,n);break;case 1:nu||(Cl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&xl(n,t,r)),X(e,t,n);break;case 21:X(e,t,n);break;case 22:nu=(r=nu)||n.memoizedState!==null,X(e,t,n),nu=r;break;case 30:Cl(n,t),X(e,t,n);break;case 7:nu||Cl(n,t),X(e,t,n);break;default:X(e,t,n)}}function yu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Hh(e)}catch(e){ff(t,t.return,e)}}}function bu(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Hh(e)}catch(e){ff(t,t.return,e)}}function xu(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new au),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new au),t;default:throw Error(i(435,e.tag))}}function Su(e,t){var n=xu(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=_f.bind(null,e,t);t.then(r,r)}})}function Cu(e,t,n){var r=t.deletions;if(r!==null)for(var a=0;a<r.length;a++){var o=r[a],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Sp(l.type)){gu=l.stateNode,_u=!1;break a}break;case 5:gu=l.stateNode,_u=!1;break a;case 3:case 4:gu=l.stateNode.containerInfo,_u=!0;break a}l=l.return}if(gu===null)throw Error(i(160));vu(s,c,o),gu=null,_u=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Tu(t,e,n),t=t.sibling}var wu=null;function Tu(e,t,n){var r=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(a&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}Cu(t,e,n),Eu(e),a&4&&(yl(3,e,e.return),vl(3,e),yl(5,e,e.return));break;case 1:Cu(t,e,n),Eu(e),a&512&&(nu||r===null||Cl(r,r.return)),a&64&&tu&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=wu,Cu(t,e,n),Eu(e),a&512&&(nu||r===null||Cl(r,r.return)),a&4){if(a=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(tu)e.stateNode=fp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,a=o.ownerDocument||o;b:switch(t){case`title`:r=a.getElementsByTagName(`title`)[0],(!r||r[At]||r[wt]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),np(r,t,n),r[wt]=e,Lt(r),t=r;break a;case`link`:if(o=Gm(`link`,`href`,a).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break b}}r=a.createElement(t),np(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=Gm(`meta`,`content`,a).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(s,1);break b}}r=a.createElement(t),np(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[wt]=e,Lt(r),t=r}e.stateNode=t}}else tu||Km(o,e.type,e.stateNode)}else e.stateNode=Bm(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&Al(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||nu||t.parentNode.removeChild(t)):a.count--,n===null?tu||Km(o,e.type,e.stateNode):Bm(o,n,e.memoizedProps))}break;case 27:Cu(t,e,n),Eu(e),a&512&&(nu||r===null||Cl(r,r.return)),r!==null&&a&4&&Al(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=ru,ru=!1,Cu(t,e,n),ru=o,Eu(e),a&512&&(nu||r===null||Cl(r,r.return)),e.flags&32){t=e.stateNode;try{fn(t,``),qt=!0}catch(t){ff(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,Al(e,t,r===null?t:r.memoizedProps)),a&1024&&(iu=!0);break;case 6:if(Cu(t,e,n),Eu(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,qt=!0}catch(t){ff(e,e.return,t)}}break;case 3:if(qt=!1,Wm=null,o=wu,wu=bm(t.containerInfo),Cu(t,e,n),wu=o,Eu(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Hh(t.containerInfo)}catch(t){ff(e,e.return,t)}iu&&(iu=!1,Du(e)),qt=!1;break;case 4:a=ru,ru=tu,r=Jt(),o=wu,wu=bm(e.stateNode.containerInfo),Cu(t,e,n),Eu(e),wu=o,qt&&cu&&(lu=!0),qt=r,ru=a;break;case 12:Cu(t,e,n),Eu(e);break;case 31:Cu(t,e,n),Eu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Su(e,t)));break;case 13:Cu(t,e,n),Eu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(fd=He()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Su(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=tu,l=nu,u=ru;tu=c||o,ru=u||o,nu=l||s,Cu(t,e,n),nu=l,ru=u,tu=c,Eu(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||tu||nu||(t=s||nu,n=tu,r=nu,tu=o||tu,nu=t,ju(e,2),tu=n,nu=r),!o&&ru||pu(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Su(e,n))));break;case 19:Cu(t,e,n),Eu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Su(e,t)));break;case 30:a&512&&(nu||r===null||Cl(r,r.return)),a=Jt(),o=cu,s=(n&335544064)===n,c=e.memoizedProps,cu=s&&vi(c.default,c.update)!==`none`,Cu(t,e,n),Eu(e),s&&r!==null&&qt&&(e.flags|=4),cu=o,qt=a;break;case 21:break;case 7:a&512&&(nu||r===null||Cl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Cu(t,e,n),Eu(e)}}function Eu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(jl(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(Ol(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(Dl(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;Pl(e,Ml(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(fn(l,``),n.flags&=-33),Pl(e,Ml(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;Nl(e,Ml(e),u,s);break;default:throw Error(i(161))}}catch(t){ff(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Du(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Du(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,gh=!0,t.reset(),gh=!1),e=e.sibling}}function Ou(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)ku(t,e),t=t.sibling;else eu(t,!1)}function ku(e,t){var n=e.alternate;if(n===null)Kl(e,!1);else switch(e.tag){case 3:if(uu=su=!1,Bl(),Ou(t,e),!su&&!lu){if(e=zl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Ep(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),uu=!0}zl=null;break;case 5:Ou(t,e);break;case 4:r=su,su=!1,Ou(t,e),su&&(lu=!0),su=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Ou(t,e):Kl(e,!1));break;case 30:r=su,i=Bl(),su=!1,Ou(t,e),su&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=gi(a,o),o=gi(n.memoizedProps,o);var s=vi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,Vl=0,t=$l(e,n,t,o,s,a,!0),Vl!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(jd(e,e.memoizedProps.onUpdate),zl=i):i!==null&&(i.push.apply(i,zl),zl=i),su=e.flags&32?!0:r;break;default:Ou(t,e)}}function Au(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)J(e,t.alternate,t),t=t.sibling}function ju(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:yl(4,n,n.return),ju(n,r);break;case 1:Cl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&xl(n,n.return,i),ju(n,r);break;case 27:r&2&&gm(n.stateNode,n.type,n.memoizedProps);case 5:Cl(n,n.return),n.tag!==5&&n.tag!==27||El(n),ju(n,r);break;case 6:El(n);break;case 26:Cl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||nu||i.parentNode.removeChild(i),ju(n,r);break;case 22:n.memoizedState===null&&ju(n,r);break;case 30:Cl(n,n.return),ju(n,r);break;case 7:Cl(n,n.return);default:ju(n,r)}e=e.sibling}}function Mu(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:Mu(i,a,n),vl(4,a);break;case 1:if(Mu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){ff(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)So(l[i],c)}catch(e){ff(r,r.return,e)}}s&&o&64&&bl(a),Sl(a,a.return);break;case 27:n&2&&Fl(a);case 5:a.tag!==5&&a.tag!==27||Tl(a),Mu(i,a,n),s&&r===null&&o&4&&kl(a),Sl(a,a.return);break;case 6:Tl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||tu||Km(bm(c.ownerDocument),a.type,c),Mu(i,a,n),s&&r===null&&o&4&&kl(a),Sl(a,a.return);break;case 12:Mu(i,a,n);break;case 31:Mu(i,a,n),s&&o&4&&yu(i,a);break;case 13:Mu(i,a,n),s&&o&4&&bu(i,a);break;case 22:a.memoizedState===null&&Mu(i,a,n),Sl(a,a.return);break;case 30:Mu(i,a,n),Sl(a,a.return);break;case 7:Sl(a,a.return);default:Mu(i,a,n)}t=t.sibling}}function Nu(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ja(n))}function Pu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ja(e))}function Fu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Iu(e,t,n,r),t=t.sibling;else i&&Ql(t)}function Iu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&Zl(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Fu(e,t,n,r),a&2048&&vl(9,t);break;case 1:Fu(e,t,n,r);break;case 3:Fu(e,t,n,r),i&&uu&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&ja(a)));break;case 12:if(a&2048){Fu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){ff(t,t.return,e)}}else Fu(e,t,n,r);break;case 31:Fu(e,t,n,r);break;case 13:Fu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&Zl(t),o._visibility&2?Fu(e,t,n,r):(o._visibility|=2,Lu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&Zl(s),o._visibility&2?Fu(e,t,n,r):Ru(e,t)),a&2048&&Nu(s,t);break;case 24:Fu(e,t,n,r),a&2048&&Pu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Wl(a.child,!0),Wl(t.child,!0))),Fu(e,t,n,r);break;default:Fu(e,t,n,r)}}function Lu(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Lu(a,o,s,c,i),vl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Lu(a,o,s,c,i)):u._visibility&2?Lu(a,o,s,c,i):Ru(a,o),i&&l&2048&&Nu(o.alternate,o);break;case 24:Lu(a,o,s,c,i),i&&l&2048&&Pu(o.alternate,o);break;default:Lu(a,o,s,c,i)}t=t.sibling}}function Ru(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Ru(n,r),i&2048&&Nu(r.alternate,r);break;case 24:Ru(n,r),i&2048&&Pu(r.alternate,r);break;default:Ru(n,r)}t=t.sibling}}var zu=8192;function Bu(e,t,n){if(e.subtreeFlags&zu)for(e=e.child;e!==null;)Vu(e,t,n),e=e.sibling}function Vu(e,t,n){switch(e.tag){case 26:Bu(e,t,n),e.flags&zu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&Zm(n,e)):Qm(n,wu,e.memoizedState,e.memoizedProps));break;case 5:Bu(e,t,n),e.flags&zu&&(e=e.stateNode,(t&335544128)===t&&Zm(n,e));break;case 3:case 4:var r=wu;wu=bm(e.stateNode.containerInfo),Bu(e,t,n),wu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=zu,zu=16777216,Bu(e,t,n),zu=r):Bu(e,t,n));break;case 30:if((e.flags&zu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Ll===null&&(Ll=new Map),Ll.set(r,i)}Bu(e,t,n);break;default:Bu(e,t,n)}}function Hu(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Uu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ou=r,Ku(r,e)}Hu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Wu(e),e=e.sibling}function Wu(e){switch(e.tag){case 0:case 11:case 15:Uu(e),e.flags&2048&&yl(9,e,e.return);break;case 3:Uu(e);break;case 12:Uu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Gu(e)):Uu(e);break;default:Uu(e)}}function Gu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];ou=r,Ku(r,e)}Hu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:yl(8,t,t.return),Gu(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Gu(t));break;default:Gu(t)}e=e.sibling}}function Ku(e,t){for(;ou!==null;){var n=ou;switch(n.tag){case 0:case 11:case 15:yl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:ja(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,ou=r;else a:for(n=e;ou!==null;){r=ou;var i=r.sibling,a=r.return;if(hu(r),r===n){ou=null;break a}if(i!==null){i.return=a,ou=i;break a}ou=a}}}var qu={getCacheForType:function(e){var t=Ca(ka),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ca(ka).controller.signal}},Ju=typeof WeakMap==`function`?WeakMap:Map,Yu=0,Xu=null,Z=null,Q=0,Zu=0,Qu=null,$u=!1,ed=!1,td=!1,nd=0,rd=0,id=0,ad=0,od=0,sd=0,cd=0,ld=null,ud=null,dd=!1,fd=0,pd=0,md=1/0,hd=null,gd=null,_d=0,vd=null,yd=null,bd=0,xd=0,Sd=null,Cd=null,wd=null,Td=null,Ed=null,Dd=0,Od=null;function kd(){return Yu&2&&Q!==0?Q&-Q:P.T===null?xt():Nf()}function Ad(){if(sd===0){if(!(Q&536870912)||H){var e=at;at<<=1,!(at&3932160)&&(at=262144),sd=e}else sd=536870912}return e=ko.current,e!==null&&(e.flags|=32),sd}function jd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Pp(gi(e.memoizedProps,n))),Td===null&&(Td=[]),Td.push(t.bind(null,r))}}function Md(e,t,n){(e===Xu&&(Zu===2||Zu===9)||e.cancelPendingCommit!==null)&&(zd(e,0),Id(e,Q,sd,!1)),mt(e,n),(!(Yu&2)||e!==Xu)&&(e===Xu&&(!(Yu&2)&&(ad|=n),rd===4&&Id(e,Q,sd,!1)),Tf(e))}function Nd(e,t,n){if(Yu&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||lt(e,t),a=r?qd(e,t):Gd(e,t,!0),o=r;do{if(a===0){ed&&!r&&Id(e,t,0,!1);break}if(n=e.current.alternate,o&&!Fd(n))a=Gd(e,t,!1),o=!1;else{if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=ld;var l=c.current.memoizedState.isDehydrated;if(l&&(zd(c,s).flags|=256),s=Gd(c,s,!1),s!==2&&s!==6){if(td&&!l){c.errorRecoveryDisabledLanes|=o,ad|=o,a=4;break a}o=ud,ud=a,o!==null&&(ud===null?ud=o:ud.push.apply(ud,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){zd(e,0),Id(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Id(r,t,sd,!$u);break a;case 2:ud=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=fd+300-He(),10<a)){if(Id(r,t,sd,!$u),ct(r,0,!0)!==0)break a;bd=t,r.timeoutHandle=gp(Pd.bind(null,r,n,ud,hd,dd,t,sd,ad,cd,$u,o,`Throttled`,-0,0),a);break a}Pd(r,n,ud,hd,dd,t,sd,ad,cd,$u,o,null,-0,0)}break}}while(1);Tf(e)}function Pd(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:bn},Ll=null,Vu(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=nh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?fd-He():(a&4194048)===a?pd-He():0,m=eh(d,m),m!==null)?(bd=a,e.cancelPendingCommit=m(ef.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Id(e,a,o,!l)):ef(e,t,a,n,r,i,o,s,c,l,u,d)}function Fd(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Hr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Id(e,t,n,r){t=ut(e,t),t&=~od,t&=~ad,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-et(i),o=1<<a;r[a]=-1,i&=~o}n!==0&>(e,n,t)}function Ld(){return Yu&6?!0:(Ef(0,!1),!1)}function Rd(){if(Z!==null){if(Zu===0)var e=Z.return;else e=Z,ha=ma=null,is(e),ro=null,io=0,e=Z;for(;e!==null;)_l(e.alternate,e),e=e.return;Z=null}}function zd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,_p(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),bd=0,Rd(),Xu=e,Z=n=Mi(e.current,null),Q=t,Zu=0,Qu=null,$u=!1,ed=lt(e,t),td=!1,cd=sd=od=ad=id=rd=0,ud=ld=null,dd=!1,nd=ut(e,t),Ci(),n}function Bd(e,t){U=null,P.H=mc,t===qa||t===Ya?(t=to(),Zu=3):t===Ja?(t=to(),Zu=4):Zu=t===jc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Qu=t,Z===null&&(rd=1,Ec(e,Bi(t,e.current)))}function Vd(){var e=ko.current;return e===null?!0:(Q&4194048)===Q?Ao===null:(Q&62914560)===Q||Q&536870912?e===Ao:!1}function Hd(){var e=P.H;return P.H=mc,e===null?mc:e}function Ud(){var e=P.A;return P.A=qu,e}function Wd(){rd=4,$u||(Q&4194048)!==Q&&ko.current!==null||(ed=!0),!(id&134217727)&&!(ad&134217727)||Xu===null||Id(Xu,Q,sd,!1)}function Gd(e,t,n){var r=Yu;Yu|=2;var i=Hd(),a=Ud();(Xu!==e||Q!==t)&&(hd=null,zd(e,t)),t=!1;var o=rd;a:do try{if(Zu!==0&&Z!==null){var s=Z,c=Qu;switch(Zu){case 8:Rd(),o=6;break a;case 3:case 2:case 9:case 6:ko.current===null&&(t=!0);var l=Zu;if(Zu=0,Qu=null,Zd(e,s,c,l),n&&ed){o=0;break a}break;default:l=Zu,Zu=0,Qu=null,Zd(e,s,c,l)}}Kd(),o=rd;break}catch(t){Bd(e,t)}while(1);return t&&e.shellSuspendCounter++,ha=ma=null,Yu=r,P.H=i,P.A=a,Z===null&&(Xu=null,Q=0,Ci()),o}function Kd(){for(;Z!==null;)Yd(Z)}function qd(e,t){var n=Yu;Yu|=2;var r=Hd(),a=Ud();Xu!==e||Q!==t?(hd=null,md=He()+500,zd(e,t)):ed=lt(e,t);a:do try{if(Zu!==0&&Z!==null){t=Z;var o=Qu;b:switch(Zu){case 1:Zu=0,Qu=null,Zd(e,t,o,1);break;case 2:case 9:if(Za(o)){Zu=0,Qu=null,Xd(t);break}t=function(){Zu!==2&&Zu!==9||Xu!==e||(Zu=7),Tf(e)},o.then(t,t);break a;case 3:Zu=7;break a;case 4:Zu=5;break a;case 7:Za(o)?(Zu=0,Qu=null,Xd(t)):(Zu=0,Qu=null,Zd(e,t,o,7));break;case 5:var s=null;switch(Z.tag){case 26:s=Z.memoizedState;case 5:case 27:var c=Z;if(s?Ym(s):c.stateNode.complete){Zu=0,Qu=null;var l=c.sibling;if(l!==null)Z=l;else{var u=c.return;u===null?Z=null:(Z=u,Qd(u))}break b}}Zu=0,Qu=null,Zd(e,t,o,5);break;case 6:Zu=0,Qu=null,Zd(e,t,o,6);break;case 8:Rd(),rd=6;break a;default:throw Error(i(462))}}Jd();break}catch(t){Bd(e,t)}while(1);return ha=ma=null,P.H=r,P.A=a,Yu=n,Z===null?(Xu=null,Q=0,Ci(),rd):0}function Jd(){for(;Z!==null&&!Be();)Yd(Z)}function Yd(e){var t=ll(e.alternate,e,nd);e.memoizedProps=e.pendingProps,t===null?Qd(e):Z=t}function Xd(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Uc(n,t,t.pendingProps,t.type,void 0,Q);break;case 11:t=Uc(n,t,t.pendingProps,t.type.render,t.ref,Q);break;case 5:is(t);var r=t;r===ta&&(H?(ca(r),r.tag===5&&r.stateNode!=null&&(na=r.stateNode)):(ca(r),H=!0));default:_l(n,t),t=Z=Ni(t,nd),t=ll(n,t,nd)}e.memoizedProps=e.pendingProps,t===null?Qd(e):Z=t}function Zd(e,t,n,r){ha=ma=null,is(t),ro=null,io=0;var i=t.return;try{if(Ac(e,i,t,n,Q)){rd=1,Ec(e,Bi(n,e.current)),Z=null;return}}catch(t){if(i!==null)throw Z=i,t;rd=1,Ec(e,Bi(n,e.current)),Z=null;return}t.flags&32768?(H||r===1?e=!0:ed||Q&536870912?e=!1:($u=e=!0,(r===2||r===9||r===3||r===6)&&(r=ko.current,r!==null&&r.tag===13&&(r.flags|=16384))),$d(t,e)):Qd(t)}function Qd(e){var t=e;do{if(t.flags&32768){$d(t,$u);return}e=t.return;var n=hl(t.alternate,t,nd);if(n!==null){Z=n;return}if(t=t.sibling,t!==null){Z=t;return}Z=t=e}while(t!==null);rd===0&&(rd=5)}function $d(e,t){do{var n=gl(e.alternate,e);if(n!==null){n.flags&=32767,Z=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Z=e;return}Z=e=n}while(e!==null);rd=6,Z=null}function ef(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do lf();while(_d!==0);if(Yu&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===Xu&&(Z=Xu=null,Q=0),yd=t,vd=e,bd=n,Sd=a,Cd=r,tf(e,t,n,s,c,l,f)}}function tf(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(xd=s,s|=Si,ht(e,n,s,r,i,a),Td=null,(n&335544064)===n?(Ed=Pa(e),r=10262):(Ed=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,vf(Ke,function(){return uf(),null})):(e.callbackNode=null,e.callbackPriority=0),Il=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=P.T,P.T=null,i=F.p,F.p=2,a=Yu,Yu|=4;try{du(e,t,n)}finally{Yu=a,F.p=i,P.T=r}}_d=1,Il?wd=Mp(o,e.containerInfo,Ed,af,of,rf,sf,uf,nf,null,null):(af(),of(),sf())}function nf(e){if(_d!==0){var t=vd.onRecoverableError;t(e,{componentStack:null})}}function rf(){_d===3&&(_d=0,ku(yd,vd),_d=4)}function af(){if(_d===1){_d=0;var e=vd,t=yd,n=bd,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=P.T,P.T=null;var i=F.p;F.p=2;var a=Yu;Yu|=4;try{cu=lu=!1,Tu(t,e,n),n=cp;var o=Kr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Gr(s.ownerDocument.documentElement,s)){if(c!==null&&qr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Wr(s,h),v=Wr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}gh=!!sp,cp=sp=null}finally{Yu=a,F.p=i,P.T=r}}e.current=t,_d=2}}function of(){if(_d===2){_d=0;var e=vd,t=yd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=P.T,P.T=null;var r=F.p;F.p=2;var i=Yu;Yu|=4;try{J(e,t.alternate,t)}finally{Yu=i,F.p=r,P.T=n}}_d=3}}function sf(){if(_d===4||_d===3){_d=0;var e=wd;wd=null,Ve();var t=vd,n=yd,r=bd,i=Cd,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?_d=5:(_d=0,yd=vd=null,cf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(gd=null),bt(r),n=n.stateNode,Qe&&typeof Qe.onCommitFiberRoot==`function`)try{Qe.onCommitFiberRoot(Ze,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=P.T,a=F.p,F.p=2,P.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{P.T=n,F.p=a}}if(i=Td,o=Ed,Ed=null,i!==null&&(Td=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);bd&3&&lf(),Tf(t),a=t.pendingLanes,r&261930&&a&42?t===Od?Dd++:(Dd=0,Od=t):(Dd=0,Od=null),Ef(0,!1)}}function cf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ja(t)))}function lf(){return wd!==null&&(wd.skipTransition(),wd=null),af(),of(),sf(),uf()}function uf(){if(_d!==5)return!1;var e=vd,t=xd;xd=0;var n=bt(bd),r=P.T,a=F.p;try{F.p=32>n?32:n,P.T=null,n=Sd,Sd=null;var o=vd,s=bd;if(_d=0,yd=vd=null,bd=0,Yu&6)throw Error(i(331));var c=Yu;if(Yu|=4,Wu(o.current),Iu(o,o.current,s,n),Yu=c,Ef(0,!1),Qe&&typeof Qe.onPostCommitFiberRoot==`function`)try{Qe.onPostCommitFiberRoot(Ze,o)}catch{}return!0}finally{F.p=a,P.T=r,cf(e,t)}}function df(e,t,n){t=Bi(n,t),t=Oc(e.stateNode,t,2),e=go(e,t,2),e!==null&&(mt(e,2),Tf(e))}function ff(e,t,n){if(e.tag===3)df(e,e,n);else for(;t!==null;){if(t.tag===3){df(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(gd===null||!gd.has(r))){e=Bi(n,e),n=kc(2),r=go(t,n,2),r!==null&&(W(n,r,t,e),mt(r,2),Tf(r));break}}t=t.return}}function pf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ju;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(td=!0,i.add(n),e=mf.bind(null,e,t,n),t.then(e,e))}function mf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Xu===e&&(Q&n)===n&&(rd===4||rd===3&&(Q&62914560)===Q&&300>He()-fd?Yu&2?od|=n:zd(e,0):od|=n,cd===Q&&(cd=0)),Tf(e)}function hf(e,t){t===0&&(t=ft()),e=Ei(e,t),e!==null&&(mt(e,t),Tf(e))}function gf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),hf(e,n)}function _f(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),hf(e,n)}function vf(e,t){return Re(e,t)}var yf=null,bf=null,xf=!1,Sf=!1,Cf=!1,wf=0;function Tf(e){e!==bf&&e.next===null&&(bf===null?yf=bf=e:bf=bf.next=e),Sf=!0,xf||(xf=!0,Mf())}function Ef(e,t){if(!Cf&&Sf){Cf=!0;do for(var n=!1,r=yf;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-et(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,jf(r,a))}else a=Q,a=ct(r,r===Xu?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||lt(r,a)||(n=!0,jf(r,a))}r=r.next}while(n);Cf=!1}}function Df(){Of()}function Of(){Sf=xf=!1;var e=0;wf!==0&&hp()&&(e=wf);for(var t=He(),n=null,r=yf;r!==null;){var i=r.next,a=kf(r,t);a===0?(r.next=null,n===null?yf=i:n.next=i,i===null&&(bf=n)):(n=r,(e!==0||a&3)&&(Sf=!0)),r=i}_d!==0&&_d!==5||Ef(e,!1),wf!==0&&(wf=0)}function kf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-et(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=dt(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Xu,n=Q,n=ct(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Zu===2||Zu===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&ze(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||lt(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&ze(r),bt(n)){case 2:case 8:n=Ge;break;case 32:n=Ke;break;case 268435456:n=Je;break;default:n=Ke}return r=Af.bind(null,e),n=Re(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&ze(r),e.callbackPriority=2,e.callbackNode=null,2}function Af(e,t){if(_d!==0&&_d!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(lf()&&e.callbackNode!==n)return null;var r=Q;return r=ct(e,e===Xu?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Nd(e,r,t),kf(e,He()),e.callbackNode!=null&&e.callbackNode===n?Af.bind(null,e):null)}function jf(e,t){if(lf())return null;Nd(e,t,!0)}function Mf(){bp(function(){Yu&6?Re(We,Df):Of()})}function Nf(){if(wf===0){var e=La;e===0&&(e=it,it<<=1,!(it&261888)&&(it=256)),wf=e}return wf}function Pf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:yn(e)}function Ff(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Pf((i[Tt]||null).action),o=r.submitter;o&&(t=(t=o[Tt]||null)?Pf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Bn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(wf!==0){var e=new FormData(i,o);ec(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),ec(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var If=0;If<pi.length;If++){var Lf=pi[If];mi(Lf.toLowerCase(),`on`+(Lf[0].toUpperCase()+Lf.slice(1)))}mi(ai,`onAnimationEnd`),mi(oi,`onAnimationIteration`),mi(si,`onAnimationStart`),mi(`dblclick`,`onDoubleClick`),mi(`focusin`,`onFocus`),mi(`focusout`,`onBlur`),mi(ci,`onTransitionRun`),mi(li,`onTransitionStart`),mi(ui,`onTransitionCancel`),mi(di,`onTransitionEnd`),Ht(`onMouseEnter`,[`mouseout`,`mouseover`]),Ht(`onMouseLeave`,[`mouseout`,`mouseover`]),Ht(`onPointerEnter`,[`pointerout`,`pointerover`]),Ht(`onPointerLeave`,[`pointerout`,`pointerover`]),Vt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),Vt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),Vt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),Vt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),Vt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),Vt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Rf=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),zf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Rf));function Bf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){yi(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){yi(e)}i.currentTarget=null,a=c}}}}function $(e,t){var n=t[L];n===void 0&&(n=t[L]=new Set);var r=e+`__bubble`;n.has(r)||(Wf(t,e,2,!1),n.add(r))}function Vf(e,t,n){var r=0;t&&(r|=4),Wf(n,e,r,t)}var Hf=`_reactListening`+Math.random().toString(36).slice(2);function Uf(e){if(!e[Hf]){e[Hf]=!0,zt.forEach(function(t){t!==`selectionchange`&&(zf.has(t)||Vf(t,!1,e),Vf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Hf]||(t[Hf]=!0,Vf(`selectionchange`,!1,t))}}function Wf(e,t,n,r){switch(Ch(t)){case 2:var i=_h;break;case 8:i=vh;break;default:i=yh}n=i.bind(null,t,n,e),i=void 0,!An||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Gf(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=Nt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}Dn(function(){var r=a,i=Sn(n),s=[];a:{var c=fi.get(e);if(c!==void 0){var l=Bn,u=e;switch(e){case`keypress`:if(In(n)===0)break a;case`keydown`:case`keyup`:l=ir;break;case`focusin`:u=`focus`,l=Yn;break;case`focusout`:u=`blur`,l=Yn;break;case`beforeblur`:case`afterblur`:l=Yn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=qn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Jn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=sr;break;case ai:case oi:case si:l=Xn;break;case di:l=cr;break;case`scroll`:case`scrollend`:l=Hn;break;case`wheel`:l=lr;break;case`copy`:case`cut`:case`paste`:l=Zn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=ar;break;case`submit`:l=or;break;case`toggle`:case`beforetoggle`:l=ur}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=On(m,p),g!=null&&d.push(Kf(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==xn&&(u=n.relatedTarget||n.fromElement)&&(Nt(u)||u[Et]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?Nt(l):null,l!==null&&(f=o(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=qn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=ar,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:Ft(c),h=l==null?u:Ft(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,Nt(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?E(c,l,Jf):null,c!==null&&Yf(s,u,c,d,!1),l!==null&&f!==null&&Yf(s,f,l,d,!0)))}a:{if(c=r?Ft(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=Ar;else if(wr(c)){if(jr)_=Br;else{_=Rr;var v=Lr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&gn(r.elementType)&&(_=Ar):_=zr;if(_&&=_(e,r)){Tr(s,_,n,i);break a}v&&v(e,c,r)}switch(v=r?Ft(r):window,e){case`focusin`:(wr(v)||v.contentEditable===`true`)&&(Yr=v,Xr=r,Zr=null);break;case`focusout`:Zr=Xr=Yr=null;break;case`mousedown`:Qr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Qr=!1,$r(s,n,i);break;case`selectionchange`:if(Jr)break;case`keydown`:case`keyup`:$r(s,n,i)}var y;if(fr)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else br?vr(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(hr&&n.locale!==`ko`&&(br||b!==`onCompositionStart`?b===`onCompositionEnd`&&br&&(y=Fn()):(Mn=i,Nn=`value`in Mn?Mn.value:Mn.textContent,br=!0)),v=qf(r,b),0<v.length&&(b=new Qn(b,e,null,n,i),s.push({event:b,listeners:v}),y?b.data=y:(y=yr(n),y!==null&&(b.data=y)))),(y=mr?xr(e,n):Sr(e,n))&&(b=qf(r,`onBeforeInput`),0<b.length&&(v=new Qn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:v,listeners:b}),v.data=y)),Ff(s,e,r,n,i)}Bf(s,t)})}function Kf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function qf(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=On(e,n),i!=null&&r.unshift(Kf(e,i,a)),i=On(e,t),i!=null&&r.push(Kf(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Jf(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Yf(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=On(n,a),l!=null&&o.unshift(Kf(n,l,c))):i||(l=On(n,a),l!=null&&o.push(Kf(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Xf=/\r\n?/g,Zf=/\u0000|\uFFFD/g;function Qf(e){return(typeof e==`string`?e:``+e).replace(Xf,`
|
|
10
|
-
`).replace(Zf,``)}function $f(e,t){return t=Qf(t),Qf(e)===t}function ep(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||fn(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&fn(e,``+r);else return;break;case`className`:Xt(e,`class`,r);break;case`tabIndex`:Xt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Xt(e,n,r);break;case`style`:hn(e,r,o);return;case`data`:if(t!==`object`){Xt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)||r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=yn(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&ep(e,t,`name`,a.name,a,null),ep(e,t,`formEncType`,a.formEncType,a,null),ep(e,t,`formMethod`,a.formMethod,a,null),ep(e,t,`formTarget`,a.formTarget,a,null)):(ep(e,t,`encType`,a.encType,a,null),ep(e,t,`method`,a.method,a,null),ep(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=yn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=bn);return;case`onScroll`:r!=null&&$(`scroll`,e);return;case`onScrollEnd`:r!=null&&$(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=yn(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:$(`beforetoggle`,e),$(`toggle`,e),Yt(e,`popover`,r);break;case`xlinkActuate`:Zt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Zt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Zt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Zt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Zt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Zt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Zt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Zt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Zt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Yt(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=_n.get(n)||n,Yt(e,n,r);else return}qt=!0}function tp(e,t,n,r,a,o){switch(n){case`style`:hn(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)fn(e,r);else if(typeof r==`number`||typeof r==`bigint`)fn(e,``+r);else return;break;case`onScroll`:r!=null&&$(`scroll`,e);return;case`onScrollEnd`:r!=null&&$(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=bn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Bt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[Tt]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}qt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Yt(e,n,r)}return}qt=!0}function np(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:$(`error`,e),$(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:ep(e,t,o,s,n,null)}}a&&ep(e,t,`srcSet`,n.srcSet,n,null),r&&ep(e,t,`src`,n.src,n,null);return;case`input`:$(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:ep(e,t,r,d,n,null)}}sn(e,o,c,l,u,s,a,!1);return;case`select`:for(a in $(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:ep(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&ln(e,!!r,n,!0):ln(e,!!r,t,!1);return;case`textarea`:for(s in $(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:ep(e,t,s,c,n,null)}dn(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:ep(e,t,l,r,n,null)}return;case`dialog`:$(`beforetoggle`,e),$(`toggle`,e),$(`cancel`,e),$(`close`,e);break;case`iframe`:case`object`:$(`load`,e);break;case`video`:case`audio`:for(r=0;r<Rf.length;r++)$(Rf[r],e);break;case`image`:$(`error`,e),$(`load`,e);break;case`details`:$(`toggle`,e);break;case`embed`:case`source`:case`link`:$(`error`,e),$(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:ep(e,t,u,r,n,null)}return;default:if(gn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&tp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&ep(e,t,c,r,n,null))}var rp={};function ip(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||ep(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(qt=!0),o=m;break;case`name`:m!==f&&(qt=!0),a=m;break;case`checked`:m!==f&&(qt=!0),u=m;break;case`defaultChecked`:m!==f&&(qt=!0),d=m;break;case`value`:m!==f&&(qt=!0),s=m;break;case`defaultValue`:m!==f&&(qt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&ep(e,t,p,m,r,f)}}on(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||ep(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(qt=!0),p=o;break;case`defaultValue`:o!==l&&(qt=!0),c=o;break;case`multiple`:o!==l&&(qt=!0),s=o;default:o!==l&&ep(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?ln(e,!!n,n?[]:``,!1):ln(e,!!n,t,!0)):ln(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:ep(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(qt=!0),p=a;break;case`defaultValue`:a!==o&&(qt=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&ep(e,t,s,a,r,o)}un(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:ep(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(qt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:ep(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&ep(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:ep(e,t,u,p,r,m)}return;default:if(gn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&tp(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||tp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&ep(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||ep(e,t,f,p,r,m)}function ap(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function op(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&ap(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&ap(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var sp=null,cp=null;function lp(e){return e.nodeType===9?e:e.ownerDocument}function up(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function dp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function fp(e,t,n,r){return n=lp(n).createElement(e),n[wt]=r,n[Tt]=t,np(n,e,t),Lt(n),n}function pp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var mp=null;function hp(){var e=window.event;return e&&e.type===`popstate`?e!==mp&&(mp=e,!0):(mp=null,!1)}var gp=typeof setTimeout==`function`?setTimeout:void 0,_p=typeof clearTimeout==`function`?clearTimeout:void 0,vp=typeof Promise==`function`?Promise:void 0,yp=typeof requestAnimationFrame==`function`?requestAnimationFrame:gp,bp=typeof queueMicrotask==`function`?queueMicrotask:vp===void 0?gp:function(e){return vp.resolve(null).then(e).catch(xp)};function xp(e){setTimeout(function(){throw e})}function Sp(e){return e===`head`}function Cp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Hh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_m(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_m(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[At]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_m(e.ownerDocument.body)}n=i}while(n);Hh(t)}function wp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Tp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Ep(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Dp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Op(e){return Dp(e.getBoundingClientRect(),getComputedStyle(e),e)}function kp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Dp(t,n,e)}function Ap(e){return e.documentElement.clientHeight}function jp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Mp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Ap(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=Xm(f),u>$m){s.length=o;break}f=new Promise(jp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Np(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Np.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:D({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Np.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Np.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Pp(e){return{name:e,group:new Np(`group`,e),imagePair:new Np(`image-pair`,e),old:new Np(`old`,e),new:new Np(`new`,e)}}function Fp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Fp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Bp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Rp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),p(this._fragmentFiber.child,!1,Ip,e,s,r)}this._eventListeners=a}};function Ip(e,t,n,r){return b(e).addEventListener(t,n,r),!1}Fp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Bp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Rp(i.optionsOrUseCapture),p(this._fragmentFiber.child,!1,Lp,e,n,i),r.splice(t,1),a!==null&&a()}};function Lp(e,t,n,r){return b(e).removeEventListener(t,n,r),!1}function Rp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function zp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Bp(e,t,n,r){if(e.length===0)return-1;r=zp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&zp(a.optionsOrUseCapture)===r)return i}return-1}Fp.prototype.dispatchEvent=function(e){var t=h(this._fragmentFiber);if(t===null)return!0;t=b(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Rp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Fp.prototype.focus=function(e){p(this._fragmentFiber.child,!0,Vp,e,void 0,void 0)};function Vp(e,t){return e.tag!==6&&(e=b(e),pm(e,t))}Fp.prototype.focusLast=function(e){var t=[];p(this._fragmentFiber.child,!0,Hp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Vp(t[n],e);n--);};function Hp(e,t){return t.push(e),!1}Fp.prototype.blur=function(){var e=h(this._fragmentFiber);e!==null&&(e=b(e),e=lp(e).activeElement,e!==null&&p(this._fragmentFiber.child,!1,Up,e,void 0,void 0))};function Up(e,t){return e.tag!==6&&(e=b(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Fp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),p(this._fragmentFiber.child,!1,Wp,e,void 0,void 0)};function Wp(e,t){return e.tag===6||(e=b(e),t.observe(e)),!1}Fp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),p(this._fragmentFiber.child,!1,Gp,e,void 0,void 0);for(var n=t=0;n<Kp.length;n++){var r=Kp[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):Kp[t++]=r}Kp.length=t}};function Gp(e,t){return e.tag===6||(e=b(e),t.unobserve(e)),!1}var Kp=[],qp=!1;function Jp(e,t,n){Kp.push({fragmentInstance:e,observer:t,instance:n}),qp||(qp=!0,mm(function(){qp=!1;var e=Kp;Kp=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Fp.prototype.getClientRects=function(){var e=[];return p(this._fragmentFiber.child,!1,Yp,e,void 0,void 0),e};function Yp(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=b(e),t.push.apply(t,e.getClientRects());return!1}Fp.prototype.getRootNode=function(e){var t=h(this._fragmentFiber);return t===null?this:b(t).getRootNode(e)},Fp.prototype.compareDocumentPosition=function(e){var t=h(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];p(this._fragmentFiber.child,!1,Hp,n,void 0,void 0);var r=b(t);if(n.length===0){if(n=r,_(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=v(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=b(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=b(n[0]),i=b(n[n.length-1]);var a=_(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Xp(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Xp(e,t,n,r,i){var a=Nt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=h(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=E(n,a,T),t===null?t=!1:(p(t,!0,C,a,n),a=x,x=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=E(r,a,T),t===null?t=!1:(p(t,!0,w,a,r),a=x,S=x=null,t=a!==null)),t):!1}function Zp(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Fp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];p(this._fragmentFiber.child,!1,Hp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=v(this._fragmentFiber);if(r=n?r[1]||r[0]||h(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=b(r),Zp(e,n);return}if(r=b(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=b(a),Zp(a,n)):b(a).scrollIntoView(e),r+=n?-1:1}};function Qp(e,t){return e=b(e),$p(e,t),!1}function $p(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function em(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<Kp.length;i++){var a=Kp[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(Kp[r++]=a)}Kp.length=r,n.observe(e)}),$p(e,t))}function tm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Rp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?Jp(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function nm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:nm(n),Mt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function rm(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[At])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=lm(e.nextSibling),e===null)break}return null}function im(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=lm(e.nextSibling),e===null))return null;return e}function am(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=lm(e.nextSibling),e===null))return null;return e}function om(e){return e.data===`$?`||e.data===`$~`}function sm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function cm(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function lm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var um=null;function dm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return lm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function fm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function pm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function mm(e){yp(function(){yp(function(t){return e(t)})})}function hm(e,t,n){switch(t=lp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function gm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&ep(e,t,r,null,rp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===bn&&(e.onclick=null),Mt(e)}function _m(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Mt(e)}var vm=new Map,ym=new Set;function bm(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var xm=F.d;F.d={f:Sm,r:Cm,D:Em,C:Dm,L:Om,m:km,X:jm,S:Am,M:Mm};function Sm(){var e=xm.f(),t=Ld();return e||t}function Cm(e){var t=Pt(e);t!==null&&t.tag===5&&t.type===`form`?nc(t):xm.r(e)}var wm=typeof document>`u`?null:document;function Tm(e,t,n){var r=wm;if(r&&typeof t==`string`&&t){var i=an(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),ym.has(i)||(ym.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),np(t,`link`,e),Lt(t),r.head.appendChild(t)))}}function Em(e){xm.D(e),Tm(`dns-prefetch`,e,null)}function Dm(e,t){xm.C(e,t),Tm(`preconnect`,e,t)}function Om(e,t,n){xm.L(e,t,n);var r=wm;if(r&&e&&t){var i=`link[rel="preload"][as="`+an(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+an(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+an(n.imageSizes)+`"]`)):i+=`[href="`+an(e)+`"]`;var a=i;switch(t){case`style`:a=Pm(e);break;case`script`:a=Rm(e)}if(!(vm.has(a)||(e=D({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Fm(a))||t===`script`&&r.querySelector(zm(a))))){var o=r.createElement(`link`);np(o,`link`,e),t===`style`&&(o[jt]=!0,o.onload=o.onerror=function(){Rt(o)}),Lt(o),r.head.appendChild(o)}}}function km(e,t){xm.m(e,t);var n=wm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+an(r)+`"][href="`+an(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rm(e)}if(!vm.has(a)&&(e=D({rel:`modulepreload`,href:e},t),vm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zm(a)))return}r=n.createElement(`link`),np(r,`link`,e),Lt(r),n.head.appendChild(r)}}}function Am(e,t,n){xm.S(e,t,n);var r=wm;if(r&&e){var i=It(r).hoistableStyles,a=Pm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Fm(a)))s.loading=5;else{e=D({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vm.get(a))&&Hm(e,n);var c=o=r.createElement(`link`);Lt(c),np(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jm(e,t){xm.X(e,t);var n=wm;if(n&&e){var r=It(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=D({src:e,async:!0},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Lt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mm(e,t){xm.M(e,t);var n=wm;if(n&&e){var r=It(n).hoistableScripts,i=Rm(e),a=r.get(i);a||(a=n.querySelector(zm(i)),a||(e=D({src:e,async:!0,type:`module`},t),(t=vm.get(i))&&Um(e,t),a=n.createElement(`script`),Lt(a),np(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nm(e,t,n,r){var a=(a=we.current)?bm(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Pm(n.href),t=It(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pm(n.href);var o=It(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Fm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=vm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vm.set(e,o)),Lm(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=Rm(n),t=It(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Pm(e){return`href="`+an(e)+`"`}function Fm(e){return`link[rel="stylesheet"][`+e+`]`}function Im(e){return D({},e,{"data-precedence":e.precedence,precedence:null})}function Lm(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[jt]){r.loading=1;return}}else t=e.createElement(`link`),t[jt]=!0,t.onload=t.onerror=Rt.bind(null,t),np(t,`link`,n),Lt(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function Rm(e){return`[src="`+an(e)+`"]`}function zm(e){return`script[async]`+e}function Bm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+an(n.href)+`"]`);if(r)return t.instance=r,Lt(r),r;var a=D({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Lt(r),np(r,`style`,a),Vm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Pm(n.href);var o=e.querySelector(Fm(a));if(o)return t.state.loading|=4,t.instance=o,Lt(o),o;r=Im(n),(a=vm.get(a))&&Hm(r,a),o=(e.ownerDocument||e).createElement(`link`),Lt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),np(o,`link`,r),t.state.loading|=4,Vm(o,n.precedence,e),t.instance=o;case`script`:return o=Rm(n.src),(a=e.querySelector(zm(o)))?(t.instance=a,Lt(a),a):(r=n,(a=vm.get(o))&&(r=D({},n),Um(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Lt(a),np(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vm(r,n.precedence,e));return t.instance}function Vm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Um(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wm=null;function Gm(e,t,n){if(Wm===null){var r=new Map,i=Wm=new Map;i.set(n,r)}else i=Wm,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[At]||a[wt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Km(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qm(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jm(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function Ym(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Xm(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function Zm(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=Xm(t),e.suspenseyImages.push(t)),e=rh.bind(e),t.decode().then(e,e))}function Qm(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pm(r.href),a=t.querySelector(Fm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=nh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Lt(a);return}a=t.ownerDocument||t,r=Im(r),(i=vm.get(i))&&Hm(r,i),a=a.createElement(`link`),Lt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),np(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=nh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var $m=0;function eh(e,t){return e.stylesheets&&e.count===0&&ah(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&$m===0&&($m=62500*op());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ah(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>$m?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function th(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)ah(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function nh(){this.count--,th(this)}function rh(){this.imgCount--,th(this)}var ih=null;function ah(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ih=new Map,t.forEach(oh,e),ih=null,nh.call(e))}function oh(e,t){if(!(t.state.loading&4)){var n=ih.get(e);if(n)var r=n.get(null);else{n=new Map,ih.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=nh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var sh={$$typeof:N,Provider:null,Consumer:null,_currentValue:I,_currentValue2:I,_threadCount:0};function ch(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=pt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=pt(0),this.hiddenUpdates=pt(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function lh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new ch(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=V(3,null,null,t),e.current=a,a.stateNode=e,t=Aa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},po(a),e}function uh(e){return e?(e=ki,e):ki}function dh(e,t,n,r,i,a){i=uh(i),r.context===null?r.context=i:r.pendingContext=i,r=ho(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=go(e,r,t),n!==null&&(Md(n,e,t),_o(n,e,t))}function fh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ph(e,t){fh(e,t),(e=e.alternate)&&fh(e,t)}function mh(e){if(e.tag===13||e.tag===31){var t=Ei(e,67108864);t!==null&&Md(t,e,67108864),ph(e,67108864)}}function hh(e){if(e.tag===13||e.tag===31){var t=kd();t=yt(t);var n=Ei(e,t);n!==null&&Md(n,e,t),ph(e,t)}}var gh=!0;function _h(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=2,yh(e,t,n,r)}finally{F.p=a,P.T=i}}function vh(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=8,yh(e,t,n,r)}finally{F.p=a,P.T=i}}function yh(e,t,n,r){if(gh){var i=bh(r);if(i===null)Gf(e,t,r,xh,n),Mh(e,r);else if(Ph(i,e,t,n,r))r.stopPropagation();else if(Mh(e,r),t&4&&-1<jh.indexOf(e)){for(;i!==null;){var a=Pt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=st(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-et(o);s.entanglements[1]|=c,o&=~c}Tf(a),!(Yu&6)&&(md=He()+500,Ef(0,!1))}}break;case 31:case 13:s=Ei(a,2),s!==null&&Md(s,a,2),Ld(),ph(a,2)}if(a=bh(r),a===null&&Gf(e,t,r,xh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Gf(e,t,r,null,n)}}function bh(e){return e=Sn(e),Sh(e)}var xh=null;function Sh(e){if(xh=null,e=Nt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return xh=e,null}function Ch(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`fullscreenerror`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Ue()){case We:return 2;case Ge:return 8;case Ke:case qe:return 32;case Je:return 268435456;default:return 32}default:return 32}}var wh=!1,Th=null,Eh=null,Dh=null,Oh=new Map,kh=new Map,Ah=[],jh=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Mh(e,t){switch(e){case`focusin`:case`focusout`:Th=null;break;case`dragenter`:case`dragleave`:Eh=null;break;case`mouseover`:case`mouseout`:Dh=null;break;case`pointerover`:case`pointerout`:Oh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:kh.delete(t.pointerId)}}function Nh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Pt(t),t!==null&&mh(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Ph(e,t,n,r,i){switch(t){case`focusin`:return Th=Nh(Th,e,t,n,r,i),!0;case`dragenter`:return Eh=Nh(Eh,e,t,n,r,i),!0;case`mouseover`:return Dh=Nh(Dh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Oh.set(a,Nh(Oh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,kh.set(a,Nh(kh.get(a)||null,e,t,n,r,i)),!0}return!1}function Fh(e){var t=Nt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,St(e.priority,function(){hh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,St(e.priority,function(){hh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ih(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=bh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);xn=r,n.target.dispatchEvent(r),xn=null}else return t=Pt(n),t!==null&&mh(t),e.blockedOn=n,!1;t.shift()}return!0}function Lh(e,t,n){Ih(e)&&n.delete(t)}function Rh(){wh=!1,Th!==null&&Ih(Th)&&(Th=null),Eh!==null&&Ih(Eh)&&(Eh=null),Dh!==null&&Ih(Dh)&&(Dh=null),Oh.forEach(Lh),kh.forEach(Lh)}function zh(e,n){e.blockedOn===n&&(e.blockedOn=null,wh||(wh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Rh)))}var Bh=null;function Vh(e){Bh!==e&&(Bh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Bh===e&&(Bh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(Sh(r||n)===null)continue;break}var a=Pt(n);a!==null&&(e.splice(t,3),t-=3,ec(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Hh(e){function t(t){return zh(t,e)}Th!==null&&zh(Th,e),Eh!==null&&zh(Eh,e),Dh!==null&&zh(Dh,e),Oh.forEach(t),kh.forEach(t);for(var n=0;n<Ah.length;n++){var r=Ah[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Ah.length&&(n=Ah[0],n.blockedOn===null);)Fh(n),n.blockedOn===null&&Ah.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[Tt]||null;if(typeof a==`function`)o||Vh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[Tt]||null)s=o.formAction;else if(Sh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Vh(n)}}}function Uh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Wh(e){this._internalRoot=e}Gh.prototype.render=Wh.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;dh(n,kd(),e,t,null,null)},Gh.prototype.unmount=Wh.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;dh(e.current,2,null,e,null,null),Ld(),t[Et]=null}};function Gh(e){this._internalRoot=e}Gh.prototype.unstable_scheduleHydration=function(e){if(e){var t=xt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ah.length&&t!==0&&t<Ah[n].priority;n++);Ah.splice(n,0,e),n===0&&Fh(e)}};var Kh=n.version;if(Kh!==`19.3.1`)throw Error(i(527,Kh,`19.3.1`));F.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var qh={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:P,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Jh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jh.isDisabled&&Jh.supportsFiber)try{Ze=Jh.inject(qh),Qe=Jh}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Cc,s=wc,c=Tc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=lh(e,1,!1,null,null,n,r,null,o,s,c,Uh),e[Et]=t.current,Uf(e),new Wh(t)}})),v=n(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=_()})),y={name:`archive`,size:24,node:[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]};y.node;var b=o(y),x={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};x.node;var S=o(x),C={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};C.node;var w=o(C),T={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};T.node;var E=o(T),D={name:`bell`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]};D.node;var O=o(D),k={name:`book-open`,size:24,node:[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]};k.node;var A=o(k),j={name:`brain`,size:24,node:[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]};j.node;var M=o(j),ee={name:`bug`,size:24,node:[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]};ee.node;var te=o(ee),N={name:`calendar-clock`,size:24,node:[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338`,key:`7hb8p4`}],[`path`,{d:`M3 9h5.859`,key:`numkqi`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]};N.node;var ne=o(N),re={name:`chart-column`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]],aliases:[`bar-chart-3`]};re.node;var ie=o(re),ae={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};ae.node;var oe=o(ae),se={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};se.node;var ce=o(se),le={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};le.node;var ue=o(le),de={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};de.node;var fe=o(de),pe={name:`circle-alert`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`]};pe.node;var me=o(pe),he={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};he.node;var ge=o(he),P={name:`circle-check-big`,size:24,node:[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]],aliases:[`check-circle`]};P.node;var F=o(P),I={name:`circle-question-mark`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`help-circle`,`circle-help`]};I.node;var _e=o(I),ve={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};ve.node;var ye=o(ve),be={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};be.node;var xe=o(be),Se={name:`cloud`,size:24,node:[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]};Se.node;var Ce=o(Se),we={name:`code-xml`,size:24,node:[[`path`,{d:`m18 16 4-4-4-4`,key:`1inbqp`}],[`path`,{d:`m6 8-4 4 4 4`,key:`15zrgr`}],[`path`,{d:`m14.5 4-5 16`,key:`e7oirm`}]],aliases:[`code-2`]};we.node;var Te=o(we),Ee={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};Ee.node;var De=o(Ee),Oe={name:`corner-down-right`,size:24,node:[[`path`,{d:`m15 10 5 5-5 5`,key:`qqa56n`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]};Oe.node;var ke=o(Oe),Ae={name:`cpu`,size:24,node:[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]};Ae.node;var je=o(Ae),Me={name:`database`,size:24,node:[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]};Me.node;var Ne=o(Me),Pe={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};Pe.node;var Fe=o(Pe),Ie={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};Ie.node;var Le=o(Ie),Re={name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};Re.node;var ze=o(Re),Be={name:`file-diff`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]};Be.node;var Ve=o(Be),He={name:`file-output`,size:24,node:[[`path`,{d:`M4.226 20.925A2 2 0 0 0 6 22h12a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v3.127`,key:`wfxp4w`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 11-3 3`,key:`1dgrs4`}],[`path`,{d:`m5 17-3-3h10`,key:`1mvvaf`}]]};He.node;var Ue=o(He),We={name:`file-pen`,size:24,node:[[`path`,{d:`M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34`,key:`o6klzx`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z`,key:`zhnas1`}]],aliases:[`file-edit`]};We.node;var Ge=o(We),Ke={name:`file-text`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]};Ke.node;var qe=o(Ke),Je={name:`file`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]};Je.node;var Ye=o(Je),Xe={name:`folder-open`,size:24,node:[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]};Xe.node;var Ze=o(Xe),Qe={name:`folder-plus`,size:24,node:[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};Qe.node;var $e=o(Qe),et={name:`folder-search`,size:24,node:[[`path`,{d:`M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]};et.node;var tt=o(et),nt={name:`folder`,size:24,node:[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]};nt.node;var rt=o(nt),it={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};it.node;var at=o(it),ot={name:`git-commit-horizontal`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]],aliases:[`git-commit`]};ot.node;var st=o(ot),ct={name:`git-pull-request`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]};ct.node;var lt=o(ct),ut={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};ut.node;var dt=o(ut),ft={name:`image`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]};ft.node;var pt=o(ft),mt={name:`inbox`,size:24,node:[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]};mt.node;var ht=o(mt),gt={name:`info`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]};gt.node;var _t=o(gt),vt={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};vt.node;var yt=o(vt),bt={name:`layers`,size:24,node:[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]],aliases:[`layers-3`]};bt.node;var xt=o(bt),St={name:`library`,size:24,node:[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]};St.node;var Ct=o(St),wt={name:`list-checks`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]};wt.node;var Tt=o(wt),Et={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};Et.node;var L=o(Et),Dt={name:`mail`,size:24,node:[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]};Dt.node;var Ot=o(Dt),kt={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};kt.node;var At=o(kt),jt={name:`message-circle-question-mark`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`message-circle-question`]};jt.node;var Mt=o(jt),Nt={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};Nt.node;var Pt=o(Nt),Ft={name:`panel-left-close`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]],aliases:[`sidebar-close`]};Ft.node;var It=o(Ft),Lt={name:`panel-left-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]],aliases:[`sidebar-open`]};Lt.node;var Rt=o(Lt),zt={name:`panel-right-close`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]};zt.node;var Bt=o(zt),Vt={name:`panel-right-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]};Vt.node;var Ht=o(Vt),Ut={name:`pen-line`,size:24,node:[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]],aliases:[`edit-3`]};Ut.node;var Wt=o(Ut),Gt={name:`pin-off`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]};Gt.node;var Kt=o(Gt),qt={name:`pin`,size:24,node:[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z`,key:`1nkz8b`}]]};qt.node;var Jt=o(qt),Yt={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Yt.node;var Xt=o(Yt),Zt={name:`refresh-cw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]};Zt.node;var Qt=o(Zt),$t={name:`rotate-cw`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]};$t.node;var en=o($t),tn={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};tn.node;var nn=o(tn),rn={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};rn.node;var an=o(rn),on={name:`shield-alert`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]};on.node;var sn=o(on),cn={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};cn.node;var ln=o(cn),un={name:`shield-question-mark`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`shield-question`]};un.node;var dn=o(un),fn={name:`shuffle`,size:24,node:[[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22`,key:`1ailkh`}],[`path`,{d:`M2 6h1.972a4 4 0 0 1 3.6 2.2`,key:`km57vx`}],[`path`,{d:`M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45`,key:`os18l9`}]]};fn.node;var pn=o(fn),mn={name:`smartphone`,size:24,node:[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]};mn.node;var hn=o(mn),gn={name:`square-pen`,size:24,node:[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]],aliases:[`pen-box`,`edit`,`pen-square`]};gn.node;var _n=o(gn),vn={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};vn.node;var yn=o(vn),bn={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};bn.node;var xn=o(bn),Sn={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};Sn.node;var Cn=o(Sn),wn={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};wn.node;var Tn=o(wn),En={name:`undo-2`,size:24,node:[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]};En.node;var Dn=o(En),On={name:`upload`,size:24,node:[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]};On.node;var kn=o(On),An={name:`wifi-off`,size:24,node:[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};An.node;var jn=o(An),Mn={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};Mn.node;var Nn=o(Mn),Pn={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};Pn.node;var Fn=o(Pn),In={name:`zap`,size:24,node:[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]};In.node;var Ln=o(In),R=t(f(),1),Rn=t(v(),1),zn=e=>Symbol.iterator in e,Bn=e=>`entries`in e,Vn=(e,t)=>{let n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(let[e,t]of n)if(!r.has(e)||!Object.is(t,r.get(e)))return!1;return!0},Hn=(e,t)=>{let n=e[Symbol.iterator](),r=t[Symbol.iterator](),i=n.next(),a=r.next();for(;!i.done&&!a.done;){if(!Object.is(i.value,a.value))return!1;i=n.next(),a=r.next()}return!!i.done&&!!a.done};function Un(e,t){return Object.is(e,t)?!0:typeof e!=`object`||!e||typeof t!=`object`||!t||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:zn(e)&&zn(t)?Bn(e)&&Bn(t)?Vn(e,t):Hn(e,t):Vn({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function Wn(e){let t=R.useRef(void 0);return n=>{let r=e(n);return Un(t.current,r)?t.current:t.current=r}}var Gn=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},Kn=(e=>e?Gn(e):Gn),qn=e=>e;function Jn(e,t=qn){let n=R.useSyncExternalStore(e.subscribe,R.useCallback(()=>t(e.getState()),[e,t]),R.useCallback(()=>t(e.getInitialState()),[e,t]));return R.useDebugValue(n),n}var Yn=e=>{let t=Kn(e),n=e=>Jn(t,e);return Object.assign(n,t),n},Xn=(e=>e?Yn(e):Yn);function Zn(){return typeof window>`u`||typeof window.matchMedia!=`function`?`dark`:window.matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`}function Qn(e){return e===`system`?Zn():e}var $n={light:`#FAF9F7`,dark:`#1A1917`};function er(e){document.documentElement.setAttribute(`data-theme`,e);let t=document.querySelector(`meta[name="theme-color"]`);t?t.setAttribute(`content`,$n[e]):console.error(`applyTheme: index.html declares no <meta name="theme-color">, so the browser frame keeps its default colour instead of the app canvas. Restore the tag in src/gaia/apps/webui/index.html.`)}function tr(){let e=document.documentElement,t=getComputedStyle(e),n=t.getPropertyValue(`--bg-primary`).trim(),r=t.getPropertyValue(`--text-primary`).trim();window.gaiaWindow&&n&&r&&window.gaiaWindow.setColors({color:n,symbolColor:r}).catch(e=>{console.error(`syncTitleBar: the desktop window controls did not take the colors`,e)}),e.dataset.palette&&n&&document.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,n)}var nr=[{id:`default`,name:`Warm gray`,swatch:[`#FAF9F7`,`#B08D57`,`#D4B47E`]},{id:`stone`,name:`Stone and ink`,swatch:[`#FAFAF9`,`#2B2B29`,`#E4E4E0`]},{id:`marble`,name:`Blue marble`,swatch:[`#F8FAFC`,`#1F5FA8`,`#5B9BE6`]},{id:`glacier`,name:`Glacier`,swatch:[`#F7FAFA`,`#2C6E78`,`#5FB4BF`]},{id:`forest`,name:`Forest floor`,swatch:[`#F8F9F7`,`#3A6B48`,`#7DBA8C`]},{id:`sage`,name:`Sage and mist`,swatch:[`#F9F9F7`,`#5E7A63`,`#9BB5A0`]},{id:`basalt`,name:`Basalt and lichen`,swatch:[`#F8F8F6`,`#6B7A2E`,`#B4C36A`]},{id:`gold`,name:`Graphite and gold`,swatch:[`#F7F7F8`,`#D9A300`,`#F2C230`]},{id:`dusk`,name:`Dusk`,swatch:[`#F9F9FB`,`#4F5A9C`,`#97A1E0`]}],rr=new Set([...nr.map(e=>e.id),`custom`]),ir={accent:`#1F5FA8`,base:`#6B7A8C`},ar=/^#[0-9a-fA-F]{6}$/,or=e=>typeof e==`string`&&ar.test(e),sr=e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)),cr=e=>`#`+e.map(e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,`0`)).join(``).toUpperCase(),lr=(e,t,n)=>{let r=sr(e),i=sr(t);return cr([0,1,2].map(e=>r[e]+(i[e]-r[e])*n))},ur=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4},dr=e=>{let[t,n,r]=sr(e).map(ur);return .2126*t+.7152*n+.0722*r};function fr(e,t){let[n,r]=[dr(e),dr(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)}function pr(e,t,n,r){let i=e;for(let a=.02;Math.min(...t.map(e=>fr(i,e)))<n&&a<=1;a+=.02)i=lr(e,r,a);return i}var mr=(e,t)=>{let[n,r,i]=sr(e);return`rgba(${n}, ${r}, ${i}, ${t})`};function hr(e,t){let n=t===`dark`,r=n?`#FFFFFF`:`#000000`,i=n?lr(`#151515`,e.base,.1):lr(`#FAFAFA`,e.base,.06),a=lr(n?`#111111`:`#F1F1F1`,e.base,.1),o=n?lr(`#ECECEC`,e.base,.06):lr(`#1B1B1B`,e.base,.12),s=n?lr(i,o,.06):`#FFFFFF`,c=lr(i,o,n?.09:.06),l=lr(i,o,n?.14:.1),u=lr(i,o,n?.11:.07),d=lr(i,a,.5),f=n?lr(i,`#000000`,.15):lr(i,a,.8),p=[i,a,s,c,d,u,f,l],m=pr(n?lr(`#A3A3A3`,e.base,.12):lr(`#5E5E5E`,e.base,.18),p,4.6,r),h=pr(lr(i,o,n?.24:.26),[i,s,a],1.6,r),g=pr(e.accent,[i],3,r),_=pr(g,[i,s,a],4.6,r),v=lr(s,g,n?.22:.14),y=lr(s,g,n?.3:.22);return{"--bg-primary":i,"--bg-secondary":d,"--bg-tertiary":u,"--bg-sidebar":a,"--bg-input":s,"--bg-card":s,"--bg-hover":c,"--bg-active":l,"--bg-user-msg":s,"--bg-recessed":f,"--text-primary":o,"--text-secondary":m,"--text-muted":m,"--border":h,"--border-light":h,"--border-recessed":h,"--accent":_,"--accent-light":lr(g,`#FFFFFF`,.18),"--accent-solid":g,"--accent-dim":mr(g,.16),"--accent-dim2":mr(g,.08),"--accent-selection":mr(g,.26),"--accent-ring":mr(g,.38),"--accent-fill":v,"--accent-fill-text":pr(_,[v,y],4.6,r),"--accent-fill-hover":y,"--tint-subtle":mr(o,.03),"--tint-hover":mr(o,n?.06:.05),...n?{"--text-inverse":i,"--switch-knob":o}:{}}}var gr=Object.keys(hr(ir,`dark`));function _r(e,t,n){let r=document.documentElement;for(let e of gr)r.style.removeProperty(e);if(e==="default"?delete r.dataset.palette:r.dataset.palette=e,e===`custom`)for(let[e,i]of Object.entries(hr(t,n)))r.style.setProperty(e,i);tr()}var vr=[`sending`,`delivered`,`queued`,`starting`,`failed`],yr=1;function br(e,t){return{id:yr++,text:e,state:t}}function xr(e,t,n){return[...e,br(t,n)]}function Sr(e,t,n,r){return e.map(e=>e.id===t&&e.state===n?{...e,state:r,error:void 0}:e)}function Cr(e,t){return e.filter(e=>e.id!==t)}function wr(e,t,n){return e.some(e=>e.id===t&&e.state===`starting`)?e.map(e=>e.id===t?n===void 0?{...e,state:`queued`,error:void 0}:{...e,state:`failed`,error:n}:e):e}var Tr=e=>e.state===`delivered`||e.state===`sending`;function Er(e,t){let n=e.findIndex(e=>Tr(e)&&e.text===t);return n===-1?e:[...e.slice(0,n),...e.slice(n+1)]}function Dr(e,t){let n=[...t];return e.map(e=>{let t=Tr(e)?n.indexOf(e.text):-1;return t===-1?e:(n.splice(t,1),{...e,state:`queued`})})}function Or(e){return e.some(e=>e.state===`delivered`)}var kr=`GAIA could not confirm it read this message.`;function Ar(e,t){let n=[...t.returned],r=[...t.taken],i=[];for(let t of e){if(t.state!==`delivered`){i.push(t);continue}let e=n.indexOf(t.text);if(e!==-1){n.splice(e,1),i.push({...t,state:`queued`});continue}let a=r.indexOf(t.text);a===-1?i.push({...t,state:`failed`,error:kr}):r.splice(a,1)}return i}function jr(e,t){return e.map(e=>e.state===`delivered`?{...e,state:`failed`,error:t}:e)}function Mr(e){if(e.some(e=>Tr(e)||e.state===`starting`))return;let t=e.find(e=>e.state===`queued`||e.state===`failed`);return t?.state===`queued`?t:void 0}var Nr=`GAIA closed while this was being sent, so it may not have gone out. Check the chat above before sending it again.`;function Pr(e){if(!e||typeof e!=`object`)return{};let t={};for(let[n,r]of Object.entries(e)){if(!Array.isArray(r))continue;let e=r.filter(e=>!!e&&typeof e==`object`&&typeof e.id==`number`&&typeof e.text==`string`&&vr.includes(e.state)).map(e=>e.state===`sending`?{...e,state:`delivered`}:e.state===`starting`?{...e,state:`failed`,error:Nr}:e);for(let t of e)yr=Math.max(yr,t.id+1);e.length&&(t[n]=e)}return t}function Fr(e,t){return e.length===t.length&&e.every(e=>t.includes(e))}function Ir(e,t){if(typeof window>`u`)return t;try{return localStorage.getItem(e)||t}catch(n){return u.system.warn(`Preference "${e}" unreadable, using "${t}". localStorage is blocked -- check private-browsing or site-data settings.`,n),t}}function Lr(){let e=Ir(`gaia-chat-theme`,`system`);return e===`light`||e===`dark`?e:`system`}function Rr(){let e=Ir(`gaia-chat-palette`,`default`);return rr.has(e)?e:`default`}function zr(){try{let e=JSON.parse(Ir(`gaia-chat-custom-colors`,`null`));if(e&&or(e.accent)&&or(e.base))return{accent:e.accent,base:e.base}}catch(e){u.system.warn(`Saved custom colors unreadable; starting from the default pair.`,e)}return ir}function Br(e,t){try{localStorage.setItem(e,t)}catch(t){u.system.warn(`Preference "${e}" not saved -- it will reset on reload. localStorage is blocked -- check private-browsing or site-data settings.`,t)}}var Vr=`gaia-chat-message-queues`;function Hr(){try{return Pr(JSON.parse(Ir(Vr,`{}`)))}catch(e){return u.system.warn(`Saved queued messages unreadable; starting with none.`,e),{}}}var z=Xn((e,t)=>({agents:[],setAgents:t=>e({agents:t}),sessions:[],currentSessionId:null,pendingDeleteIds:[],runningSessionIds:[],setRunningSessions:t=>e(e=>Fr(e.runningSessionIds,t)?e:{runningSessionIds:t}),queuedSessionIds:[],awaitingBySession:{},activeRunsAt:0,setActiveRuns:(t,n)=>e(e=>{let r={activeRunsAt:n};return Fr(e.runningSessionIds,t.session_ids)||(r.runningSessionIds=t.session_ids),e.queuedSessionIds.join()!==t.queued.join()&&(r.queuedSessionIds=t.queued),JSON.stringify(e.awaitingBySession)!==JSON.stringify(t.awaiting_user)&&(r.awaitingBySession=t.awaiting_user),r}),messageQueues:Hr(),updateQueue:(t,n)=>e(e=>{let r=e.messageQueues[t]??[],i=n(r);if(i.length===r.length&&i.every((e,t)=>e===r[t]))return e;let a={...e.messageQueues};return i.length?a[t]=i:delete a[t],Br(Vr,JSON.stringify(a)),{messageQueues:a}}),queueHolds:{},setQueueHold:(t,n)=>e(e=>{if(!!e.queueHolds[t]===n)return e;let r={...e.queueHolds};return n?r[t]=!0:delete r[t],{queueHolds:r}}),setSessions:t=>e(e=>({sessions:t.filter(t=>!e.pendingDeleteIds.includes(t.id))})),setCurrentSession:t=>e(t?{currentSessionId:t,showMemoryDashboard:!1,showSchedules:!1}:{currentSessionId:t}),addSession:t=>e(e=>({sessions:[t,...e.sessions]})),removeSession:t=>e(e=>{let n={sessions:e.sessions.filter(e=>e.id!==t),currentSessionId:e.currentSessionId===t?null:e.currentSessionId,messages:e.currentSessionId===t?[]:e.messages};if(e.messageQueues[t]){let r={...e.messageQueues};delete r[t],Br(Vr,JSON.stringify(r)),n.messageQueues=r}if(e.queueHolds[t]){let r={...e.queueHolds};delete r[t],n.queueHolds=r}return n}),updateSessionInList:(t,n)=>e(e=>({sessions:e.sessions.map(e=>e.id===t?{...e,...n}:e)})),addPendingDelete:t=>e(e=>({pendingDeleteIds:[...e.pendingDeleteIds,t]})),removePendingDelete:t=>e(e=>({pendingDeleteIds:e.pendingDeleteIds.filter(e=>e!==t)})),messages:[],setMessages:t=>e({messages:t}),addMessage:t=>e(e=>({messages:[...e.messages,t]})),removeMessage:t=>e(e=>({messages:e.messages.filter(e=>e.id!==t)})),removeMessagesFrom:t=>e(e=>{let n=e.messages.findIndex(e=>e.id===t);return n===-1?e:{messages:e.messages.slice(0,n)}}),isStreaming:!1,streamingContent:``,setStreaming:t=>e({isStreaming:t}),setStreamContent:t=>e({streamingContent:t}),clearStreamContent:()=>e({streamingContent:``}),resetStreaming:()=>e({isStreaming:!1,streamingContent:``,agentSteps:[],cards:[],liveStatus:null,livePhase:null,awaitingUser:!1}),agentSteps:[],addAgentStep:t=>e(e=>({agentSteps:[...e.agentSteps.map(e=>e.active&&e.type===`tool`&&t.type!==`tool`&&e.success==null&&!e.result?e:{...e,active:!1}),t]})),updateLastAgentStep:t=>e(e=>{if(e.agentSteps.length===0)return e;let n=[...e.agentSteps];return n[n.length-1]={...n[n.length-1],...t},{agentSteps:n}}),appendThinkingContent:t=>e(e=>{if(e.agentSteps.length===0)return e;let n=[...e.agentSteps],r=n[n.length-1];return r.type===`thinking`?(n[n.length-1]={...r,detail:(r.detail?r.detail+`
|
|
11
|
-
`:``)+t,active:!0},{agentSteps:n}):e}),updateLastToolStep:t=>e(e=>{if(e.agentSteps.length===0)return e;let n=[...e.agentSteps];for(let e=n.length-1;e>=0;e--)if(n[e].type===`tool`)return n[e]={...n[e],...t},{agentSteps:n};return e}),clearAgentSteps:()=>e({agentSteps:[],liveStatus:null,livePhase:null,awaitingUser:!1}),liveStatus:null,livePhase:null,setLiveStatus:(t,n=null)=>e({liveStatus:t,livePhase:n}),awaitingUser:!1,setAwaitingUser:t=>e({awaitingUser:t}),liveQuestions:{},openQuestion:(t,n,r)=>e(e=>({liveQuestions:{...e.liveQuestions,[t]:{sessionId:n,expiresAt:r!=null&&r>0?Date.now()+r*1e3:null}}})),closeQuestion:t=>e(e=>{if(!(t in e.liveQuestions))return e;let{[t]:n,...r}=e.liveQuestions;return{liveQuestions:r}}),closeSessionQuestions:t=>e(e=>{let n=Object.fromEntries(Object.entries(e.liveQuestions).filter(([,e])=>e.sessionId!==t));return Object.keys(n).length===Object.keys(e.liveQuestions).length?e:{liveQuestions:n}}),cards:[],appendCard:t=>e(e=>({cards:[...e.cards,t]})),clearCards:()=>e({cards:[]}),documents:[],setDocuments:t=>e({documents:t}),systemStatus:null,backendConnected:!0,setSystemStatus:t=>e({systemStatus:t}),setBackendConnected:t=>e({backendConnected:t}),themePreference:Lr(),theme:Qn(Lr()),showDocLibrary:!1,showFileBrowser:!1,settingsSection:null,showMemoryDashboard:!1,showSchedules:!1,draftPermissionMode:`ask`,draftPermissionModeChosen:!1,defaultPermissionMode:`ask`,defaultPermissionModeKnown:!1,draftDocumentIds:[],draftPrivate:!1,setThemePreference:n=>{Br(`gaia-chat-theme`,n);let r=Qn(n);er(r),_r(t().palette,t().customColors,r),e({themePreference:n,theme:r})},syncSystemTheme:()=>{if(t().themePreference!==`system`)return;let n=Qn(`system`);er(n),_r(t().palette,t().customColors,n),e({theme:n})},palette:Rr(),customColors:zr(),setPalette:n=>{Br(`gaia-chat-palette`,n),_r(n,t().customColors,t().theme),e({palette:n})},setCustomColors:n=>{Br(`gaia-chat-custom-colors`,JSON.stringify(n)),_r(`custom`,n,t().theme),Br(`gaia-chat-palette`,`custom`),e({customColors:n,palette:`custom`})},sidebarOpen:typeof window<`u`?window.innerWidth>768:!0,sidebarCollapsed:Ir(`gaia-chat-sidebar-collapsed`,`false`)===`true`,isLoadingMessages:!1,pendingPrompt:null,setShowDocLibrary:t=>e({showDocLibrary:t}),setShowFileBrowser:t=>e({showFileBrowser:t}),openSettings:(t=`general`)=>e({settingsSection:t}),closeSettings:()=>e({settingsSection:null}),setShowMemoryDashboard:t=>e(t?{showMemoryDashboard:!0,showSchedules:!1}:{showMemoryDashboard:!1}),setShowSchedules:t=>e(t?{showSchedules:!0,showMemoryDashboard:!1}:{showSchedules:!1}),setDraftPermissionMode:t=>e({draftPermissionMode:t,draftPermissionModeChosen:!0}),setDefaultPermissionMode:t=>e(e=>({defaultPermissionMode:t,defaultPermissionModeKnown:!0,draftPermissionMode:!e.draftPermissionModeChosen&&e.draftPermissionMode===e.defaultPermissionMode?t:e.draftPermissionMode})),resetDraftPermissionMode:()=>e(e=>({draftPermissionMode:e.defaultPermissionMode,draftPermissionModeChosen:!1})),setDraftPrivate:t=>e({draftPrivate:t}),addDraftDocuments:t=>e(e=>{let n=t.filter(t=>!e.draftDocumentIds.includes(t));return n.length?{draftDocumentIds:[...e.draftDocumentIds,...n]}:e}),removeDraftDocument:t=>e(e=>({draftDocumentIds:e.draftDocumentIds.filter(e=>e!==t)})),clearDraftDocuments:()=>e({draftDocumentIds:[]}),setSidebarOpen:t=>e({sidebarOpen:t}),toggleSidebarCollapsed:()=>e(e=>{let t=!e.sidebarCollapsed;return Br(`gaia-chat-sidebar-collapsed`,String(t)),{sidebarCollapsed:t}}),setSidebarCollapsed:t=>{Br(`gaia-chat-sidebar-collapsed`,String(t)),e({sidebarCollapsed:t})},setLoadingMessages:t=>e({isLoadingMessages:t}),setPendingPrompt:t=>e({pendingPrompt:t})})),B=s(),Ur=14;function Wr({open:e,onClose:t,anchor:n,label:i,placement:a=`above`,align:o=`start`,children:s}){let c=(0,R.useRef)(null),[l,u]=(0,R.useState)(a),[d,f]=(0,R.useState)(null);return(0,R.useLayoutEffect)(()=>{if(!e)return;let t=()=>{let e=n.current?.getBoundingClientRect(),t=c.current;if(!e||!t)return;let r=e.top-Ur,i=window.innerHeight-e.bottom-Ur,o=a===`above`?r:i,s=a===`above`?i:r,l=t.scrollHeight>o&&s>o;u(l?a===`above`?`below`:`above`:a),f(Math.max(0,Math.floor(l?s:o)))};t();let r=new MutationObserver(t);return c.current&&r.observe(c.current,{childList:!0,subtree:!0}),window.addEventListener(`resize`,t),()=>{r.disconnect(),window.removeEventListener(`resize`,t)}},[e,a,n]),r(e),(0,R.useEffect)(()=>{if(!e)return;(c.current?.querySelector(`button:not(:disabled), input, [tabindex="0"]`))?.focus();let r=e=>{let r=e.target;c.current?.contains(r)||n.current?.contains(r)||t()},i=e=>{e.key===`Escape`&&(e.stopPropagation(),e.preventDefault(),t(),n.current?.focus())};return document.addEventListener(`mousedown`,r),document.addEventListener(`keydown`,i,!0),()=>{document.removeEventListener(`mousedown`,r),document.removeEventListener(`keydown`,i,!0)}},[e,t,n]),e?(0,B.jsx)(`div`,{ref:c,className:`popover popover-${l} popover-${o}`,style:d===null?void 0:{"--popover-room":`${d}px`},role:`dialog`,"aria-label":i,children:s}):null}async function Gr(){return V(`GET`,`/connectors`)}async function Kr(e){return V(`GET`,`/connectors/${e}`)}async function qr(e,t,n=[]){return V(`POST`,`/connectors/${e}/authorize`,{scopes:t,grant_agents:n},Oi)}async function Jr(e,t,n=[]){return V(`POST`,`/connectors/${e}/authorize-device`,{scopes:t,grant_agents:n},Oi)}async function Yr(e,t){return V(`POST`,`/connectors/${e}/configure`,{config:t},Oi)}async function Xr(e){await V(`DELETE`,`/connectors/${e}`,void 0,Oi)}async function Zr(e){return V(`POST`,`/connectors/${e}/enable`,{},Oi)}async function Qr(e){return V(`POST`,`/connectors/${e}/disable`,{},Oi)}async function $r(){return V(`GET`,`/connectors/agent-mcps`)}async function ei(e){return V(`GET`,`/connectors/${e}/grants`)}async function ti(e,t,n){await V(`PUT`,`/connectors/${e}/grants/${encodeURIComponent(t)}`,{scopes:n},Oi)}async function ni(e,t){await V(`DELETE`,`/connectors/${e}/grants/${encodeURIComponent(t)}`,void 0,Oi)}async function ri(e){return V(`GET`,`/connectors/${e}/activations`)}async function ii(e,t,n){return V(`PUT`,`/connectors/${e}/activations/${encodeURIComponent(t)}`,n?{scopes:n}:{},Oi)}async function ai(e,t){await V(`DELETE`,`/connectors/${e}/activations/${encodeURIComponent(t)}`,void 0,Oi)}async function oi(e){return V(`POST`,`/chat/cancel`,{session_id:e})}async function si(e,t){return V(`POST`,`/chat/followup`,{session_id:e,text:t})}async function ci(e){return V(`GET`,`/chat/followup/${encodeURIComponent(e)}`)}async function li(e){return V(`GET`,`/chat/context/${encodeURIComponent(e)}`)}async function ui(e){return V(`GET`,`/chat/performance/${encodeURIComponent(e)}`)}async function di(e,t,n){return V(`POST`,`/chat/retry-with`,{session_id:e,message_id:t,model:n})}async function fi(e,t,n){return V(`POST`,`/chat/retry-with/choose`,{session_id:e,message_id:t,keep:n})}async function pi(){return V(`GET`,`/chat/active`)}async function mi(e,t,n={}){return V(`POST`,`/chat/confirm-tool`,{session_id:e,approved:t,always:n.always??!1,...n.confirmId?{confirm_id:n.confirmId}:{}})}async function hi(e,t,n){return V(`POST`,`/chat/user-input`,{session_id:e,request_id:t,value:n})}async function gi(e){return V(`GET`,`/chat/permissions/${encodeURIComponent(e)}`)}async function _i(){return V(`GET`,`/chat/permissions`)}async function vi(e,t){return V(`PUT`,`/chat/permissions/${encodeURIComponent(e)}`,{mode:t})}async function yi(e,t){let n=t?`?key=${encodeURIComponent(t)}`:``;return V(`DELETE`,`/chat/permissions/${encodeURIComponent(e)}/grants${n}`)}var bi=d();function xi(e){try{let t=JSON.parse(e).detail;return Array.isArray(t)?t.map(e=>e?.msg??JSON.stringify(e)).join(`; `)||e:t&&typeof t==`object`&&typeof t.message==`string`?t.message:t&&typeof t!=`string`?JSON.stringify(t):t||e}catch{return e}}function Si(e){try{let t=JSON.parse(e).detail?.status;return typeof t==`string`?t:null}catch{return null}}function Ci(e){try{let t=JSON.parse(e).detail;return Array.isArray(t)?t.map(e=>Array.isArray(e?.loc)?e.loc[e.loc.length-1]:void 0).filter(e=>typeof e==`string`):[]}catch{return[]}}var wi=class extends Error{httpStatus;detail;reason;fields;constructor(e,t,n,r,i=[]){super(e),this.name=`ApiError`,this.httpStatus=t,this.detail=n,this.reason=r,this.fields=i}};function Ti(e){return e.trim().toLowerCase()===`internal server error`}function Ei(e){let t=e.trim();return t!==``&&!Ti(t)&&!/^[<{[]/.test(t)}function Di(e,t){switch(e){case 403:return t||`Access denied.`;case 404:return t||`The requested item was not found.`;case 413:return t||`File too large to process.`;case 500:return Ei(t)?t:`Server error. Please try again.`;case 502:return`Service unavailable. Is the backend running?`;case 503:return t||`Service unavailable.`;default:return t||`Request failed (HTTP ${e})`}}var Oi={"x-gaia-ui":`1`,"x-gaia-client":`agent-ui`},ki=/key|token|secret|password/i;function Ai(e){return!e||typeof e!=`object`||Array.isArray(e)?e:Object.fromEntries(Object.entries(e).map(([e,t])=>[e,ki.test(e)&&typeof t==`string`&&t?`***`:t]))}async function V(e,t,n,r,i){let a=`${bi}${t}`,o=u.api.time();u.api.info(`${e} ${a}`,n===void 0?``:{body:Ai(n)});let s=n===void 0?{}:{"Content-Type":`application/json`},c={method:e,headers:{...Oi,...r,...s},body:n===void 0?void 0:JSON.stringify(n),signal:i},l;try{l=await fetch(a,c)}catch(t){throw u.api.error(`${e} ${a} - network error`,t),t}if(!l.ok){let t=await l.text().catch(()=>``);u.api.error(`${e} ${a} - HTTP ${l.status}`,{errorText:t});let n=xi(t);throw new wi(Di(l.status,n),l.status,n,Si(t),Ci(t))}let d=l.headers.get(`content-type`)||``;if(!d.includes(`application/json`)){let n=await l.text().catch(()=>``);if(l.status===204||n.trim()===``){u.api.timed(`${e} ${a} -> ${l.status} (no body)`,o);return}throw u.api.error(`${e} ${a} -> ${l.status} (non-JSON body)`,{contentType:d,preview:n.slice(0,200)}),Error(`${e} ${t}: expected JSON, got ${d||`no Content-Type`} (HTTP ${l.status}: ${n.slice(0,120)})`)}let f=await l.json();return u.api.timed(`${e} ${a} -> ${l.status}`,o,f),f}async function ji(e){return V(`GET`,`/system/status`,void 0,void 0,e)}async function Mi(){return V(`POST`,`/system/warm-up`)}async function Ni(){return V(`GET`,`/system/warm-up`)}async function Pi(){return V(`GET`,`/system/model-server`)}async function Fi(e){return V(`PUT`,`/system/model-server/backend`,{backend:e})}async function Ii(){return V(`GET`,`/settings`)}async function Li(e){return V(`PUT`,`/settings`,e)}async function Ri(e,t,n=!1){return V(`POST`,`/system/load-model`,{model_name:e,ctx_size:t,force:n})}async function zi(e,t,n=e=>window.confirm(e)){try{return await Ri(e,t),!0}catch(r){if(!(r instanceof wi)||r.httpStatus!==409)throw r;return n(`${r.detail}
|
|
12
|
-
|
|
13
|
-
Load ${e} anyway?`)?(await Ri(e,t,!0),!0):!1}}async function Bi(e,t=!1){return V(`POST`,`/system/download-model`,{model_name:e,force:t})}async function Vi(){return V(`GET`,`/agents`)}async function Hi(e){return V(`POST`,`/agents/install`,{id:e})}async function Ui(e){return V(`GET`,`/agents/${encodeURIComponent(e)}/install-status`)}async function Wi(){return V(`GET`,`/onboarding/preflight`)}async function Gi(e=!1){return V(`GET`,`/setup/check?skip_chat_model=${e}`)}async function Ki(e,t=!1){return V(`POST`,`/setup/run`,{skip_chat_model:e,gaia_lemonade:t})}async function qi(){return V(`GET`,`/setup/status`)}async function Ji(){return V(`GET`,`/setup/plan`)}async function Yi(e){return V(`POST`,`/setup/chat-model`,{model_id:e})}async function Xi(){return V(`GET`,`/onboarding/start`)}async function Zi(){return V(`GET`,`/lemonade/target`)}async function Qi(){return V(`GET`,`/lemonade/detect`)}async function $i(e){try{return await V(`POST`,`/lemonade/target`,e)}catch(e){throw e instanceof wi&&e.httpStatus===502&&e.detail?new wi(e.detail,e.httpStatus,e.detail,e.reason,e.fields):e}}async function ea(){return V(`GET`,`/providers`)}async function ta(){return V(`GET`,`/providers/active`)}async function na(e,t){return V(`POST`,`/providers/${encodeURIComponent(e)}/connect`,t)}var H=2e3;async function ra(e,t,n,r=()=>!1){for(;;)try{return await na(e,t)}catch(e){if(!(e instanceof wi)||e.httpStatus!==409||r())throw e;n(e.detail),await new Promise(e=>setTimeout(e,H))}}async function ia(e){return V(`DELETE`,`/providers/${encodeURIComponent(e)}/key`)}async function aa(e){return V(`GET`,`/providers/${encodeURIComponent(e)}/models`)}async function oa(e){return V(`GET`,`/providers/local/context?model=${encodeURIComponent(e)}`)}async function sa(e,t){return V(`PUT`,`/providers/local/context`,{model:e,ctx_size:t})}async function ca(){return V(`GET`,`/providers/local/status`)}async function la(e=!1){return V(`POST`,`/providers/local/restart`,{confirm:e})}async function ua(e){return V(`POST`,`/providers/select`,{model:e})}async function da(e){return V(`GET`,`/spending/prices/${encodeURIComponent(e)}`)}async function fa(){return V(`GET`,`/spending`)}async function pa(e){return V(`PUT`,`/spending/limit`,{limit_usd:e})}async function ma(){return V(`POST`,`/spending/allow-month`)}async function ha(){return V(`GET`,`/skills`)}async function ga(){let e=new Map,t=0;for(let n=0;;n+=200){let r=await V(`GET`,`/sessions?limit=200&offset=${n}`);t=r.total;for(let t of r.sessions)e.has(t.id)||e.set(t.id,t);if(r.sessions.length<200||n+200>=t)break}return{sessions:[...e.values()],total:t}}async function _a(e={}){return V(`POST`,`/sessions`,e)}async function va(e,t){return V(`PUT`,`/sessions/${e}`,t)}async function ya(e){return V(`DELETE`,`/sessions/${e}`)}async function ba(e){return V(`GET`,`/sessions/${e}`)}async function xa(e,t){return V(`PUT`,`/sessions/${e}/pin`,{pinned:t})}async function Sa(e){return V(`POST`,`/sessions/${e}/read`)}async function Ca(e){return V(`PATCH`,`/sessions/${e}/private`)}async function wa(e){let{total:t}=await V(`GET`,`/sessions/${e}/messages?limit=1&offset=0`);return t}async function Ta(e){let t=`/sessions/${e}/messages`,n=await V(`GET`,`${t}?limit=100&offset=0`),r=[...n.messages],i=n.total;for(;r.length<i;){let e=await V(`GET`,`${t}?limit=${Math.min(100,i-r.length)}&offset=${r.length}`);if(e.messages.length===0)throw Error(`Incomplete transcript received. Please reload the conversation.`);r.push(...e.messages)}return{messages:r,total:i}}async function Ea(e){return V(`GET`,`/sessions/${e}/export?format=markdown`)}async function Da(e,t){return V(`DELETE`,`/sessions/${e}/messages/${t}`)}async function Oa(e,t){return V(`DELETE`,`/sessions/${e}/messages/${t}/and-below`)}var ka=new Set([`status`,`step`,`thinking`,`plan`,`tool_start`,`tool_end`,`tool_result`,`tool_args`,`tool_confirm`,`agent_error`,`permission_request`,`needs_confirmation`,`needs_input`,`policy_alert`,`followup_taken`,`followup_returned`,`context_usage`]);function Aa(e,t,n,r,i,a,o){let s;s=typeof n==`function`?{onChunk:n,onAgentEvent:()=>{},onDone:r||(()=>{}),onError:i||(e=>{u.stream.error(`Unhandled stream error`,e)})}:n;let c=new AbortController,l=u.stream.time();u.stream.info(`Starting SSE stream for session=${e}`,{messageLength:t.length});let d=Ba(c,s,Na,Pa);return fetch(`${bi}/chat/send`,{method:`POST`,headers:{...Oi,"Content-Type":`application/json`},body:JSON.stringify({session_id:e,message:t,stream:!0,...a?{agent_type:a}:{},...o?{device:o}:{}}),signal:c.signal}).then(e=>(d.received(),d.connected(),Ha(e,s,l,{silentCloseIsError:!0}))).catch(e=>{d.received(),d.timedOut()?(u.stream.error(`No answer to /chat/send within ${Na/1e3}s`),s.onError(new za(`send`,Na))):e.name===`AbortError`?u.stream.warn(`Stream aborted by user`):(u.stream.error(`Stream fetch error`,e),s.onError(e))}),c}var ja=3e4,Ma=6e5,Na=9e4,Pa=3e3,Fa=`Waiting for GAIA to start this answer…`,Ia=3e4,La=class extends Error{idleMs;constructor(e){super(`The connection to GAIA went silent for ${Math.round(e/1e3)} s.`),this.idleMs=e,this.name=`StreamStalledError`}},Ra=class extends Error{cause;constructor(e){super(`The connection to GAIA was cut: ${e instanceof Error?e.message:String(e)}`),this.cause=e,this.name=`StreamDroppedError`}},za=class extends Error{endpoint;timeoutMs;constructor(e,t){super(`GAIA did not start answering within ${Math.round(t/1e3)} s.`),this.endpoint=e,this.timeoutMs=t,this.name=`StreamTimeoutError`}};function Ba(e,t,n,r){let i=!1,a=r===void 0?void 0:setTimeout(()=>{t.onAgentEvent({type:`status`,status:`working`,phase:`waiting`,message:Fa})},r),o=setTimeout(()=>{i=!0,e.abort()},n),s=!1;return{received:()=>{clearTimeout(a),clearTimeout(o)},connected:()=>{s||(s=!0,t.onConnected?.())},timedOut:()=>i}}async function Va(e,t){let n,r=new Promise((e,r)=>{n=setTimeout(()=>r(new La(t)),t)});try{return await Promise.race([e.read(),r])}finally{clearTimeout(n)}}async function Ha(e,t,n,{silentCloseIsError:r=!1}={}){if(u.stream.info(`SSE connection opened -> HTTP ${e.status}`),!e.ok){let n=await e.text().catch(()=>``);u.stream.error(`SSE connection failed: HTTP ${e.status}`,n);let r=xi(n),i=r&&!Ti(r)?r:Di(e.status,r);t.onError(new wi(i,e.status,r,Si(n)));return}let i=e.body?.getReader();if(!i){u.stream.error(`No response body reader available`),t.onError(Error(`No response body`));return}let a=new TextDecoder,o=``,s=!1,c=0,l=0,d=0,f=!1,p=!1,m=!1;try{for(;;){let e;try{e=await Va(i,f?Ma:ja)}catch(e){if(e?.name===`AbortError`)throw e;if(!(e instanceof La)){if(u.stream.error(`SSE connection cut mid-stream`,e),s||p)return;if(m)break;throw new Ra(e)}if(u.stream.error(`SSE stream silent for ${e.idleMs/1e3}s; dropping the connection`),await i.cancel().catch(e=>u.stream.warn(`Could not cancel the stalled stream`,e)),s||p)return;if(m)break;throw e}let{done:r,value:h}=e;if(r){u.stream.debug(`SSE reader done (stream ended)`);break}o+=a.decode(h,{stream:!0});let g=o.split(`
|
|
14
|
-
`);o=g.pop()||``;for(let e of g)if(e.startsWith(`data: `)){let r=e.slice(6).trim();if(!r)continue;try{let e=JSON.parse(r);if(f=e.type===`status`&&e.phase===`queued`,e.type===`chunk`)c++,l+=(e.content||``).length,(c<=3||c%50==0)&&u.stream.debug(`Chunk #${c} (+${(e.content||``).length} chars)`),t.onChunk(e);else if(e.type===`answer`)t.onChunk(e);else if(e.type===`done`)s=!0,u.stream.timed(`Stream complete: ${c} chunks, ${l} chars, ${d} agent events`,n),t.onDone(e);else if(e.type===`error`)u.stream.error(`Stream error event:`,e.content),p=!0,t.onError(Error(e.content||`Unknown error`));else if(e.type===`agent_created`)u.stream.info(`Agent created: ${e.agent_id}`),t.onAgentCreated?.(e);else if(e.type===`mcp_status`){let t=e.servers??[];u.stream.debug(`MCP status: ${t.length} server(s)`,t);for(let e of t)e.connected||u.stream.warn(`MCP server "${e.name}" is not connected: ${e.error??`no error reported`}`)}else ka.has(e.type)?(d++,e.type===`agent_error`&&!e.recoverable&&(m=!0),u.stream.debug(`Agent event: ${e.type}`,e),t.onAgentEvent(e)):u.stream.warn(`Unknown SSE event type: ${e.type}`,e)}catch{u.stream.warn(`Malformed SSE data, skipping`,{raw:r.slice(0,100)})}}}}finally{i.releaseLock()}if(!s){if(u.stream.timed(`SSE connection closed without done event: ${c} chunks, ${d} agent events`,n),r&&c===0&&d===0&&!p){t.onError(Error(`GAIA closed the connection before any answer arrived. Send the message again; if it keeps happening, check the GAIA server log.`));return}t.onDone({type:`done`})}}function Ua(e,t){let n=new AbortController,r=u.stream.time();u.stream.info(`Attaching to background run for session=${e}`);let i=Ba(n,t,Ia);return fetch(`${bi}/chat/attach?session_id=${encodeURIComponent(e)}`,{method:`GET`,signal:n.signal}).then(n=>{if(i.received(),i.connected(),n.status===404)u.stream.info(`Run for session=${e} finished before the attach`),t.onDone({type:`done`,content:``});else return Ha(n,t,r)}).catch(e=>{i.received(),i.timedOut()?(u.stream.error(`No answer to /chat/attach within ${Ia/1e3}s`),t.onError(new za(`attach`,Ia))):e.name===`AbortError`?u.stream.warn(`Run attach detached by client`):e instanceof TypeError?(u.stream.error(`Run attach could not connect`,e),t.onError(new Ra(e))):(u.stream.error(`Run attach fetch error`,e),t.onError(e))}),n}async function Wa(){return V(`GET`,`/documents`)}async function Ga(e){return V(`POST`,`/documents/upload-path`,{filepath:e})}async function Ka(e){let t=`${bi}/documents/upload`,n=u.api.time();u.api.info(`POST ${t}`,{fileName:e.name,size:e.size});let r=new FormData;r.append(`file`,e);let i;try{i=await fetch(t,{method:`POST`,headers:Oi,body:r})}catch(e){throw u.api.error(`POST ${t} - network error`,e),e}if(!i.ok){let e=await i.text().catch(()=>``);u.api.error(`POST ${t} - HTTP ${i.status}`,{errorText:e});let n=xi(e);throw new wi(Di(i.status,n),i.status,n,Si(e))}let a=await i.json();return u.api.timed(`POST ${t} -> ${i.status}`,n,a),a}async function qa(e){return V(`DELETE`,`/documents/${e}`)}async function Ja(e){return V(`GET`,`/documents/${e}/status`)}async function Ya(e){return V(`POST`,`/documents/${e}/cancel`)}async function Xa(e){return V(`POST`,`/documents/${e}/reindex`)}async function Za(e,t){return V(`POST`,`/sessions/${e}/documents`,{document_id:t})}async function Qa(e,t){return V(`DELETE`,`/sessions/${e}/documents/${t}`)}async function $a(e){return V(`GET`,`/files/browse${e?`?path=${encodeURIComponent(e)}`:``}`)}async function eo(e,t=!0){return V(`POST`,`/documents/index-folder`,{folder_path:e,recursive:t})}async function to(e,t=!0){return V(`POST`,`/files/open`,{path:e,reveal:t})}async function no(e){return V(`POST`,`/files/open`,{path:e,launch:!0})}async function ro(e){return V(`POST`,`/files/status`,{paths:e})}async function io(e){let t=`${bi}/files/upload`,n=u.api.time();u.api.info(`POST ${t}`,{fileName:e.name,size:e.size});let r=new FormData;r.append(`file`,e);let i=await fetch(t,{method:`POST`,headers:Oi,body:r});if(!i.ok){let e=await i.text().catch(()=>`Upload failed`);throw u.api.error(`POST ${t} - HTTP ${i.status}`,{errorText:e}),Error(`Upload failed: ${e}`)}let a=await i.json();return u.api.timed(`POST ${t} -> ${i.status}`,n,a),a}async function ao(e,t,n){let r=new URLSearchParams({query:e});return t&&r.set(`file_types`,t),n&&r.set(`max_results`,String(n)),V(`GET`,`/files/search?${r}`)}async function oo(e,t){let n=new URLSearchParams({path:e});return t&&n.set(`lines`,String(t)),V(`GET`,`/files/preview?${n}`)}async function so(){return V(`POST`,`/tunnel/start`)}async function co(){return V(`POST`,`/tunnel/stop`)}async function lo(){return V(`GET`,`/tunnel/status`)}async function uo(){return V(`GET`,`/mcp/status`)}async function fo(){return V(`GET`,`/schedules`)}function po(){return Intl.DateTimeFormat().resolvedOptions().timeZone||void 0}async function mo(e,t,n){return V(`POST`,`/schedules`,{name:e,interval:t,prompt:n,timezone:po()})}async function ho(e,t){return V(`PUT`,`/schedules/${encodeURIComponent(e)}`,{status:t})}async function go(e){return V(`DELETE`,`/schedules/${encodeURIComponent(e)}`)}async function _o(e,t=20){return V(`GET`,`/schedules/${encodeURIComponent(e)}/results?limit=${t}`)}async function vo(e){return V(`POST`,`/schedules/parse`,{input:e,timezone:po()})}async function yo(e){return V(`GET`,`/sessions/${encodeURIComponent(e)}/changes`)}async function bo(e,t){return V(`GET`,`/sessions/${encodeURIComponent(e)}/changes/${encodeURIComponent(t)}/diff`)}async function xo(e,t,n=!1){return V(`POST`,`/sessions/${encodeURIComponent(e)}/changes/${encodeURIComponent(t)}/undo`,{force:n})}async function So(){return V(`GET`,`/settings/undo`)}async function Co(e,t){return V(`PUT`,`/settings/undo`,{retention_days:e,max_mb:t})}var wo=e=>`/sessions/${encodeURIComponent(e)}`;async function To(e){return V(`GET`,`${wo(e)}/environment`)}async function Eo(e,t){return V(`POST`,`${wo(e)}/environment/folders`,{path:t})}async function Do(e,t){return V(`POST`,`${wo(e)}/environment/folders/remove`,{path:t})}async function Oo(e,t){return V(`PUT`,`${wo(e)}/environment/internet`,{on:t})}async function ko(e){return V(`GET`,`${wo(e)}/outputs`)}async function Ao(e){return V(`GET`,`${wo(e)}/changes/total`)}async function jo(e,t=!1){return V(`POST`,`${wo(e)}/changes/undo`,{force:t})}async function Mo(e){return V(`GET`,`${wo(e)}/changes/git`)}async function No(e,t,n){return V(`POST`,`${wo(e)}/changes/git/commit`,{root:t,message:n,confirmed:!0})}async function Po(e,t,n,r){return V(`POST`,`${wo(e)}/changes/git/pr`,{root:t,title:n,body:r,confirmed:!0})}var Fo=5e3,Io=24,Lo=1e3,Ro=3e4,zo=0,Bo=!1,U=null,Vo=Lo;function Ho(){U&&clearTimeout(U),U=null}async function Uo(e){try{let t=await aa(`local`);t?.models&&e(t.models)}catch(e){Bo=!1,u.system.warn(`Model names unavailable; raw model ids show until the model list loads`,e)}}var Wo=Xn((e,t)=>({active:null,error:null,restoreNotice:null,queued:null,queueError:null,names:{},refresh:async()=>{Bo||(Bo=!0,Uo(t().rememberNames));try{let n=await ta();Ho(),Vo=Lo;let r=n.restore;r?.status===`pending`&&zo<Io&&(zo+=1,setTimeout(()=>{t().refresh()},Fo)),e({active:n,error:null,...r&&r.status!==`none`&&r.message?{restoreNotice:{ok:r.status===`restored`,message:r.message}}:{}})}catch(n){e({error:n instanceof Error?n.message:String(n)}),U||(U=setTimeout(()=>{U=null,t().refresh()},Vo),Vo=Math.min(Vo*2,Ro))}},retryNow:()=>{U&&(Ho(),t().refresh())},select:async t=>{let n=await ua(t),r=null;try{r=(await ga()).sessions}catch(e){u.system.error(`Could not refresh chats after a model switch; the next poll will`,e)}e({active:n,error:null,restoreNotice:null}),r?.length&&z.getState().setSessions(r)},queue:t=>e({queued:t,queueError:null}),applyQueued:async()=>{let n=t().queued;if(n)try{await t().select(n),e({queued:null})}catch(t){e({queued:null,queueError:`Couldn't switch to ${Ko(n)}: ${t instanceof Error?t.message:String(t)}`})}},rememberNames:n=>{let r={...t().names};for(let e of n)e.display_name&&(r[e.id]=e.display_name);e({names:r})},dismissRestoreNotice:()=>e({restoreNotice:null})}));z.subscribe((e,t)=>{t.isStreaming&&!e.isStreaming&&Wo.getState().queued&&Wo.getState().applyQueued()});function Go(){return Wo(e=>e.names)}function Ko(e){let t=Wo.getState();return t.names[e]?t.names[e]:t.active?.model===e&&t.active.display_name?t.active.display_name:$o(e)}function qo(e,t){return e.find(e=>e.id===t)??e[0]}function Jo(e,t){return e?.remote?{remote:!0,label:e.provider===`fireworks`?`Fireworks AI`:`AMD LLM Gateway`,description:null}:t?.inference_remote===!0?{remote:!0,label:t.inference_provider_name||`a cloud provider`,description:t.inference_description??null}:t?.inference_remote===!1?{remote:!1,label:`Local`,description:t.inference_description??null}:t===void 0&&e?.inference_remote===!1?{remote:!1,label:`Local`,description:e.inference_description??null}:null}var Yo=`GAIA can't tell whether this chat is answered on this PC or by a cloud provider, so it isn't claiming either.`;function Xo(){return Jo(Wo(e=>e.active),z(e=>qo(e.sessions,e.currentSessionId)))}function Zo(e,t,n){return t.find(e=>e.id===n)?.effective_model||e?.model||null}function Qo(e){return/^(fireworks|amd)\./.test(e)?e.slice(e.indexOf(`.`)+1):e}function $o(e){let t=Qo(e);return t.slice(t.lastIndexOf(`/`)+1)}function es(e){let t={};for(let n of e)t[n.id]=n.display_name||Ko(n.id);let n=new Map;for(let r of e)n.set(t[r.id],[...n.get(t[r.id])??[],r.id]);for(let e of n.values()){if(e.length<2)continue;let n=e.map(e=>Qo(e).split(`/`)),r=e;for(let e=1;e<=Math.max(...n.map(e=>e.length));e++){let t=n.map(t=>t.slice(-e).join(`/`));if(new Set(t).size===t.length){r=t;break}}e.forEach((e,n)=>{t[e]=r[n]})}return t}function ts(e){return e===`fireworks`?`Fireworks AI`:e===`amd`?`AMD LLM Gateway`:e}var ns={loaded:`Loaded`,downloaded:`Downloaded, ready to load`,not_downloaded:`Not downloaded`};function rs(e){return e?.label?e.source===`expected`?`${e.label} (expected)`:e.label:null}function is(e){return e?`${Math.round(e/1024)}K`:`unknown`}function as(e){return e.state??(e.downloaded?`downloaded`:`not_downloaded`)}function os(e){let t=e.download_progress?.state;return t===`starting`||t===`downloading`}var ss=3e3,cs={loaded:`Loaded`,warming:`Warming up`,idle:`Not loaded — it loads with your next message`,stopped:`Model server stopped`};function ls(e){let t=e.memory;return t?[t.model_gb?`~${t.model_gb} GB used by the model`:null,t.free_gb==null?null:`${t.free_gb} GB free`].filter(Boolean).join(` · `)||`${t.total_gb} GB (${t.source})`:e.memory_error}function us(){let e=Wo(e=>e.active);Wo(e=>e.names);let t=Xo(),n=z(e=>e.systemStatus),r=z(e=>e.openSettings),i=(0,R.useRef)(null),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(null),[d,f]=(0,R.useState)(!1),[p,m]=(0,R.useState)(!1),h=(0,R.useCallback)(async()=>{try{c(await ca()),u(null)}catch(e){u(e instanceof Error?e.message:String(e))}},[]);(0,R.useEffect)(()=>{if(!a)return;h();let e=setInterval(()=>{h()},ss);return()=>clearInterval(e)},[a,h]);let g=(0,R.useCallback)(async e=>{m(!1),f(!0),u(null);try{await la(e),await h()}catch(e){u(e instanceof Error?e.message:String(e))}finally{f(!1)}},[h]),_=n?n.lemonade_running?n.model_loaded?`loaded`:`idle`:`stopped`:`idle`,v=t?.remote?Ce:t?je:_e,y=e?.model?Ko(e.model):null,b=[t?.label,y].filter(Boolean).join(` · `)||`Model`,x=t?t.description??(t.remote?`Chat history is sent to ${t.label}`:`Runs on this PC`):Yo,S=s,C=d||!!S?.restarting,w=!!S&&S.owner!==`gaia`,T=!!S&&!(w&&S.state===`stopped`);return(0,B.jsxs)(`div`,{className:`sb-location-wrap`,children:[(0,B.jsxs)(`button`,{ref:i,type:`button`,className:`sb-location`,onClick:()=>o(e=>!e),"aria-haspopup":`dialog`,"aria-expanded":a,"aria-label":t?.remote?b:`${b}, model ${_===`idle`?`not loaded`:_}`,title:x,children:[(0,B.jsx)(v,{size:13,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:`sb-location-text`,children:b}),!t?.remote&&(0,B.jsx)(`span`,{className:`sb-location-dot is-${_}`,"aria-hidden":`true`})]}),(0,B.jsx)(Wr,{open:a,onClose:()=>o(!1),anchor:i,label:`Model status`,placement:`above`,children:(0,B.jsxs)(`div`,{className:`model-status`,children:[!S&&!l&&(0,B.jsxs)(`span`,{children:[(0,B.jsx)(L,{size:13,className:`spin`}),` Checking the model…`]}),S&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`model-status-head`,children:[(0,B.jsx)(`span`,{className:`model-status-dot is-${S.state}`,"aria-hidden":`true`}),(0,B.jsxs)(`span`,{role:`status`,children:[cs[S.state],S.state===`loaded`&&S.busy_reason===`request`?` · answering`:``]})]}),S.active_remote&&(0,B.jsxs)(`span`,{className:`settings-hint`,children:[`New messages use `,S.active_display_name,` in the cloud. Local model below.`]}),(0,B.jsxs)(`dl`,{className:`model-status-grid`,children:[(0,B.jsx)(`dt`,{children:`Model`}),(0,B.jsx)(`dd`,{title:S.model??S.active_model??void 0,children:S.display_name??(S.active_remote?`—`:S.active_display_name)??`—`}),S.placement&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{children:`Runs on`}),(0,B.jsx)(`dd`,{children:rs(S.placement)})]}),S.state!==`stopped`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{children:`Memory`}),(0,B.jsx)(`dd`,{children:ls(S)??`unknown`})]}),S.ctx_size!=null&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{children:`Context window`}),(0,B.jsxs)(`dd`,{children:[is(S.ctx_size),` tokens`]})]})]}),S.placement?.warning&&(0,B.jsx)(`span`,{className:`model-status-warning`,role:`alert`,children:S.placement.warning}),S.error&&(0,B.jsx)(`span`,{className:`settings-error`,role:`alert`,title:S.error_detail??void 0,children:S.error}),S.restart_error&&(0,B.jsx)(`span`,{className:`settings-error`,role:`alert`,children:S.restart_error})]}),l&&(0,B.jsx)(`span`,{className:`settings-error`,role:`alert`,children:l}),p&&S&&(0,B.jsxs)(`div`,{className:`model-status-confirm`,role:`alert`,children:[(0,B.jsxs)(`span`,{children:[`This reloads `,S.display_name??`the model`,` on your Lemonade at `,S.base_url,`. Other apps using it are interrupted while it reloads.`]}),(0,B.jsxs)(`div`,{className:`model-status-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>m(!1),children:`Cancel`}),(0,B.jsx)(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void g(!0),children:`Reload it`})]})]}),(0,B.jsxs)(`div`,{className:`model-status-actions`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{o(!1),r(`model`)},children:[(0,B.jsx)(an,{size:13,"aria-hidden":`true`}),` Model settings`]}),T&&(0,B.jsxs)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>w?m(!0):void g(!1),disabled:C||!S||S.busy||S.active_remote&&S.state!==`loaded`,title:S?.busy?S.busy_reason===`warm_up`?`GAIA is getting the model ready for a new chat. Restart it once that finishes.`:`The model is answering a request. Restart it once that finishes.`:S?.state===`stopped`?`Start the model server and load the model`:`Reload the model at its context size`,children:[C?(0,B.jsx)(L,{size:13,className:`spin`}):(0,B.jsx)(en,{size:13,"aria-hidden":`true`}),C?`Restarting…`:`Restart`]})]})]})})]})}var ds=500,fs=`gaia_always_allow_tools`;function ps(){try{localStorage.getItem(`gaia_always_allow_tools`)!==null&&(localStorage.removeItem(fs),console.warn(`[notificationStore] Discarded a persisted "always allow" tool list from an earlier version. Grants now cover one call in one chat and are listed in Settings → Permissions.`))}catch(e){console.error(`[notificationStore] Could not clear the legacy always-allow list:`,e)}}var ms=`allow_path_access`;function hs(e){let{path:t,kind:n}=e??{};return{target:typeof t==`string`&&t.trim()?t:null,kind:n}}function gs(e,t=!1){let{target:n,kind:r}=hs(e),i=n?r===`folder`?`the folder ${n} and everything in it`:r===`file`?`the file ${n}`:`${n}, which doesn't exist yet`:`a file or folder outside this chat`;return t?`To do what you just allowed, GAIA also needs ${i}. This chat can't reach it yet. Allow it for this chat?`:`GAIA wants to use ${i}. This chat can't reach it yet. Allow it for this chat?`}function _s(e,t=!1){let{kind:n}=hs(e),r=n===`folder`?`folder`:n===`file`?`file`:`location`;return t?`Also let GAIA use this ${r}?`:`Let GAIA use this ${r}?`}function vs(e){return e.trim().replace(/\\/g,`/`).replace(/\/+$/,``).toLowerCase()}function ys(e){let t=[`file_path`,`path`,`directory`,`dir_path`,`destination`].map(t=>e?.[t]).find(e=>typeof e==`string`&&e.trim());return typeof t==`string`?t:null}function bs(e,t,n){let r=e.find(e=>e.type===`permission_request`&&e.sessionId===t);if(!r||r.response!==`allow`||r.tool===`allow_path_access`)return!1;let i=ys(r.toolArgs),{path:a}=n??{};if(!i||typeof a!=`string`||!a.trim())return!1;let o=vs(i),s=vs(a);return o===s||o.startsWith(`${s}/`)?!0:!/^([a-z]:)?\//.test(o)&&!o.startsWith(`~`)&&s.endsWith(`/${o.replace(/^\.\//,``)}`)}function xs(e){return e===`share_engineering_context`||e===`append_engineering_context`||e===`approve_engineering_code`||e===`allow_path_access`}function Ss(e,t){return!t.alwaysScope||!t.sessionId||xs(t.tool)||t.risk===`destructive`?0:e.filter(e=>e.id!==t.id&&e.type===`permission_request`&&e.sessionId===t.sessionId&&e.response===`allow`&&e.tool===t.tool&&e.alwaysScope===t.alwaysScope&&e.risk===t.risk).length}var Cs=Xn((e,t)=>({notifications:[],showPanel:!1,typeFilter:null,addNotification:t=>e(e=>{let n=e.notifications.find(e=>e.id===t.id);return n?n.response?e:{notifications:e.notifications.map(e=>e.id===t.id?{...t,read:n.read}:e)}:{notifications:[t,...e.notifications].slice(0,ds)}}),dismiss:t=>e(e=>({notifications:e.notifications.map(e=>e.id===t?{...e,dismissed:!0}:e)})),markRead:t=>e(e=>({notifications:e.notifications.map(e=>e.id===t?{...e,read:!0}:e)})),markAllRead:()=>e(e=>({notifications:e.notifications.map(e=>({...e,read:!0}))})),clearAll:()=>e({notifications:[]}),setShowPanel:t=>e({showPanel:t}),setTypeFilter:t=>e({typeFilter:t}),dismissSessionPrompts:t=>e(e=>({notifications:e.notifications.map(e=>e.type===`permission_request`&&e.sessionId===t&&!e.response?{...e,dismissed:!0}:e)})),respondToPermission:async(n,r)=>{let i=t().notifications.find(e=>e.id===n);if(!i)throw Error(`That permission request is no longer pending.`);let a=r!==`deny`,o=r===`always`&&!xs(i.tool),s=window.gaiaAPI;if(i.sessionId)await mi(i.sessionId,a,{always:o,confirmId:i.confirmId});else if(s?.notification?.respondPermission)await s.notification.respondPermission(n,a?`allow`:`deny`,o);else throw Error(`No agent is waiting for this answer any more.`);e(e=>({notifications:e.notifications.map(e=>e.id===n?{...e,response:a?`allow`:`deny`,respondedAt:Date.now(),read:!0}:e)}))}})),ws=e=>e.notifications.filter(e=>!e.read&&!e.dismissed).length,Ts=e=>{let t=e.notifications.filter(e=>!e.dismissed);return e.typeFilter?t.filter(t=>t.type===e.typeFilter):t},Es=e=>t=>t.notifications.find(t=>t.type===`permission_request`&&t.sessionId===e&&!t.response&&!t.dismissed)??null,Ds=e=>[...new Set(e.notifications.filter(e=>e.type===`permission_request`&&e.sessionId&&!e.response&&!e.dismissed).map(e=>e.sessionId))].sort(),Os=`gaia_alert_settings`,ks={modes:{needs_approval:`banner`,question:`banner`,finished:`banner`},sound:!1,flash:!0,keepAwake:!0,batteryFloor:20},As=[`banner`,`badge`,`off`];function js(){let e=null;try{e=localStorage.getItem(Os)}catch(e){return console.warn(`[alerts] Notification settings unreadable (site data blocked); using defaults.`,e),ks}if(!e)return ks;let t;try{t=JSON.parse(e)}catch(e){return console.warn(`[alerts] Saved notification settings are corrupt; using defaults.`,e),ks}let n={...ks.modes};for(let e of Object.keys(n)){let r=t.modes?.[e];r!==void 0&&As.includes(r)?n[e]=r:r!==void 0&&console.warn(`[alerts] Ignored unknown mode ${String(r)} for ${e}.`)}let r=(e,t)=>typeof e==`boolean`?e:t,i=t.batteryFloor;return{modes:n,sound:r(t.sound,ks.sound),flash:r(t.flash,ks.flash),keepAwake:r(t.keepAwake,ks.keepAwake),batteryFloor:typeof i==`number`&&i>=0&&i<=100?i:ks.batteryFloor}}function Ms(e){try{localStorage.setItem(Os,JSON.stringify(e))}catch(e){console.warn(`[alerts] Notification settings not saved; they will reset on reload.`,e)}}var Ns=e=>({modes:e.modes,sound:e.sound,flash:e.flash,keepAwake:e.keepAwake,batteryFloor:e.batteryFloor}),Ps=Xn((e,t)=>({...js(),setMode:(n,r)=>{e({modes:{...t().modes,[n]:r}}),Ms(Ns(t()))},update:n=>{e(n),Ms(Ns(t()))}}));function Fs(e){let t=new Date(e.updated_at).getTime();return Number.isNaN(t)?0:t}function Is(e,t=new Date){let n=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),r=864e5,i=[{label:`Today`,sessions:[]},{label:`Yesterday`,sessions:[]},{label:`Previous 7 days`,sessions:[]},{label:`Previous 30 days`,sessions:[]},{label:`Older`,sessions:[]}],a=[...e].sort((e,t)=>Fs(t)-Fs(e));for(let e of a){let t=Fs(e);i[t>=n?0:t>=n-r?1:t>=n-7*r?2:t>=n-30*r?3:4].sessions.push(e)}return i.filter(e=>e.sessions.length>0)}function Ls(e,t){return t.awaiting[e.id]||t.prompting.includes(e.id)?`waiting`:t.queued.includes(e.id)?`queued`:t.running.includes(e.id)?`running`:e.last_run_status===`failed`?`failed`:e.last_run_status===`done`||e.last_run_status===`stopped`?`done`:null}function Rs(e){return e.kind===`eval`||e.kind===`scheduled`}function zs(e,t,{showAutomated:n=!1,now:r=new Date}={}){let i=n?e:e.filter(e=>!Rs(e)),a=(e,t)=>Fs(t)-Fs(e),o=i.filter(e=>Ls(e,t)===`waiting`).sort(a),s=i.filter(e=>e.pinned&&!o.includes(e)).sort(a),c=i.filter(e=>!o.includes(e)&&!s.includes(e)),l=[];return o.length&&l.push({label:`Needs you`,sessions:o}),s.length&&l.push({label:`Pinned`,sessions:s}),[...l,...Is(c,r)]}function Bs(e){return e.filter(Rs).length}function Vs(e,t,n){let r={};for(let t of e)r[t]=`running`;for(let[e,n]of Object.entries(t))r[e]=n;for(let e of n)r[e]=`permission`;return r}function Hs(e,t){let n=[];for(let[r,i]of Object.entries(t))i!==e[r]&&(i===`permission`?n.push({sessionId:r,event:`needs_approval`}):i===`question`&&n.push({sessionId:r,event:`question`}));for(let r of Object.keys(e))r in t||n.push({sessionId:r,event:`finished`});return n}var Us={needs_approval:`GAIA needs your approval`,question:`GAIA has a question`,finished:`GAIA finished`};function Ws(e,t){let n=t?.title||`A chat`;if(e!==`finished`)return{title:Us[e],body:n};switch(t?.last_run_status){case`done`:return{title:Us.finished,body:n};case`failed`:return{title:`GAIA hit a problem`,body:n};case`stopped`:return{title:`GAIA stopped`,body:n};default:return{title:`A chat stopped running`,body:n}}}function Gs(e,t,n){return n&&e===t}function Ks(e,t,n,r){let i=0;for(let a of e){if(a.kind===`eval`||a.kind===`scheduled`)continue;let e=t[a.id];(e===`permission`&&n.needs_approval!==`off`||e===`question`&&n.question!==`off`||!e&&a.unread&&a.id!==r&&n.finished!==`off`)&&i++}return i}function qs(e,t){return!e||e.charging||t<=0?!0:e.level*100>=t}function Js(){let e=window.AudioContext??window.webkitAudioContext;if(!e)throw Error(`This browser has no Web Audio, so GAIA cannot play the alert sound.`);let t=new e,n=t.currentTime;[660,880].forEach((e,r)=>{let i=t.createOscillator(),a=t.createGain();i.frequency.value=e,a.gain.setValueAtTime(1e-4,n+r*.12),a.gain.exponentialRampToValueAtTime(.15,n+r*.12+.02),a.gain.exponentialRampToValueAtTime(1e-4,n+r*.12+.18),i.connect(a).connect(t.destination),i.start(n+r*.12),i.stop(n+r*.12+.2)}),setTimeout(()=>void t.close(),600)}function Ys(e){let t=e%100;return`${e}${t>=11&&t<=13?`th`:{1:`st`,2:`nd`,3:`rd`}[e%10]??`th`}`}function Xs(){return typeof navigator<`u`&&/Mac/i.test(navigator.platform)}function Zs(e=typeof navigator<`u`?navigator.platform:``){return/Mac/i.test(e)?`/Users/you/Documents/manual.pdf`:/Win/i.test(e)?`C:\\Users\\you\\Documents\\manual.pdf`:`/home/you/Documents/manual.pdf`}var Qs={Ctrl:`⌃`,Alt:`⌥`,Shift:`⇧`,Mod:`⌘`},$s=[`Ctrl`,`Alt`,`Shift`,`Mod`];function ec(e,t=Xs()){let n=e.split(`+`),r=n.pop(),i=n.filter(e=>!(e in Qs));if(i.length)throw Error(`formatShortcut: unknown modifier(s) ${i.join(`, `)} in "${e}"; use Ctrl, Alt, Shift or Mod`);return t?$s.filter(e=>n.includes(e)).map(e=>Qs[e]).join(``)+r:[...n.map(e=>e===`Mod`?`Ctrl`:e),r].join(`+`)}var tc=`New Task`;function nc(e,t){let n=t.sessions.find(t=>t.id===e);return!(!n||n.title!==tc||(n.message_count??0)!==0||t.runningSessionIds.includes(e)||t.messageQueues?.[e]?.length||t.currentSessionId===e&&(t.messages.length!==0||t.isStreaming))}async function rc(e){if(!e)return!1;let t=z.getState();if(!nc(e,{sessions:t.sessions,currentSessionId:t.currentSessionId,messages:t.messages,isStreaming:t.isStreaming,runningSessionIds:t.runningSessionIds,messageQueues:t.messageQueues}))return!1;u.chat.info(`Removing abandoned draft session ${e}`),t.addPendingDelete(e),t.removeSession(e);try{return await ya(e),!0}catch(t){return u.chat.warn(`Failed to delete abandoned draft ${e}`,t),!1}finally{t.removePendingDelete(e)}}var ic=new URL(`gaia-robot-NKaQnEIp.png`,import.meta.url).href,ac=16,oc=`gaia-chat-sidebar-width`,sc=e=>Math.round(Math.max(200,Math.min(420,e)));function cc(){try{let e=Number(localStorage.getItem(oc));return e?sc(e):260}catch(e){return u.system.warn(`Saved sidebar width unreadable; using the default.`,e),260}}function lc(e){try{localStorage.setItem(oc,String(e))}catch(e){u.system.warn(`Sidebar width not saved; it resets on reload.`,e)}}function uc(e){let[t,n]=(0,R.useState)(cc),[r,i]=(0,R.useState)(null),a=(0,R.useCallback)(e=>{let t=sc(e);n(t),lc(t)},[]),o=(0,R.useCallback)(n=>{if(n.button!==0)return;n.preventDefault();let r=n.clientX,o=t,s=n.currentTarget;s.setPointerCapture?.(n.pointerId);let c=o,l=e=>{c=o+(e.clientX-r),i(c<150?c:sc(c))},u=()=>{s.removeEventListener(`pointermove`,l),s.removeEventListener(`pointerup`,u),s.removeEventListener(`pointercancel`,u),i(null),c<150?e():a(c)};s.addEventListener(`pointermove`,l),s.addEventListener(`pointerup`,u),s.addEventListener(`pointercancel`,u)},[e,a,t]),s=(0,R.useCallback)(e=>{let n={ArrowLeft:t-ac,ArrowRight:t+ac,Home:200,End:420}[e.key];n!==void 0&&(e.preventDefault(),a(n))},[a,t]);return{width:r??t,resizing:r!=null,handle:(0,B.jsx)(`div`,{className:`sb-resize${r==null?``:` is-dragging`}`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,"aria-valuemin":200,"aria-valuemax":420,"aria-valuenow":Math.round(r??t),tabIndex:0,title:`Drag to resize, double-click to reset`,onPointerDown:o,onKeyDown:s,onDoubleClick:()=>a(260)})}}var dc={running:`Running`,queued:`Waiting for the GPU`,waiting:`Waiting for you`,done:`Done`,failed:`Failed`},fc=`gaia-show-automated-runs`;function pc(){try{return localStorage.getItem(fc)===`1`}catch(e){return u.system.warn(`Chat-list filter unreadable (site data blocked); hiding eval and scheduled runs.`,e),!1}}function mc({session:e,active:t,status:n,queuePlace:r,unsent:i,failed:a,onSelect:o,onDelete:s,onPin:c}){let[l,u]=(0,R.useState)(!1);(0,R.useEffect)(()=>{if(!l)return;let e=setTimeout(()=>u(!1),3e3);return()=>clearTimeout(e)},[l]);let d=!!e.unread&&!t,f=n===`done`&&!d?null:n,p=r>0?`${Ys(r)} in line`:null,m=f?[dc[f],p].filter(Boolean).join(`, `):void 0,h=a>0?`${a} not sent`:i>0?`${i} to send`:null,g=[p,h].filter(Boolean).join(` · `),_=`${i} unsent message${i===1?``:`s`}`;return(0,B.jsxs)(`li`,{className:`sb-row${t?` is-active`:``}${d?` is-unread`:``}`,"data-status":f??void 0,children:[(0,B.jsxs)(`button`,{type:`button`,className:`sb-row-main`,onClick:()=>o(e.id),"aria-current":t?`page`:void 0,"aria-label":[e.title,m,h,d?`unread`:null].filter(Boolean).join(`, `),title:e.title,children:[f&&(0,B.jsx)(`span`,{className:`sb-dot is-${f}`,"aria-hidden":`true`,title:m}),e.private&&(0,B.jsx)(ze,{size:12,className:`sb-row-icon`,"aria-label":`Private chat`}),(0,B.jsx)(`span`,{className:`sb-row-title`,children:e.title}),g&&(0,B.jsx)(`span`,{className:`sb-row-queue${a>0?` is-failed`:``}`,children:g})]}),(0,B.jsx)(`button`,{type:`button`,className:`sb-row-pin${e.pinned?` is-pinned`:``}`,onClick:()=>c(e.id,!e.pinned),"aria-label":e.pinned?`Unpin ${e.title}`:`Pin ${e.title}`,"aria-pressed":!!e.pinned,title:e.pinned?`Unpin`:`Pin to top`,children:e.pinned?(0,B.jsx)(Kt,{size:13}):(0,B.jsx)(Jt,{size:13})}),(0,B.jsx)(`button`,{type:`button`,className:`sb-row-delete${l?` is-confirm`:``}`,onClick:()=>l?s(e.id):u(!0),"aria-label":l?`Confirm delete ${e.title}${i>0?` and its ${_}`:``}`:`Delete ${e.title}`,title:l?i>0?`Click again to delete this chat and its ${_}`:`Click again to delete`:`Delete`,children:l?(0,B.jsx)(`span`,{className:`sb-row-delete-label`,children:i>0?`Delete ${i} unsent?`:`Delete?`}):(0,B.jsx)(Cn,{size:13})})]})}function hc({onNewChat:e,onMobileAccess:t,tunnelActive:n}){let r=z(e=>e.sessions),i=z(e=>e.currentSessionId),a=z(e=>e.runningSessionIds),o=z(e=>e.queuedSessionIds),s=z(e=>e.awaitingBySession),c=z(e=>e.messageQueues),d=z(e=>e.updateSessionInList),f=Cs(Wn(Ds)),p=z(e=>e.sidebarOpen),m=z(e=>e.sidebarCollapsed),h=z(e=>e.toggleSidebarCollapsed),g=z(e=>e.setSidebarOpen),_=z(e=>e.setCurrentSession),v=z(e=>e.setMessages),y=z(e=>e.removeSession),b=z(e=>e.addPendingDelete),x=z(e=>e.removePendingDelete),S=z(e=>e.openSettings),C=z(e=>e.setShowMemoryDashboard),w=z(e=>e.setShowSchedules),T=z(e=>e.setShowDocLibrary),E=z(e=>e.showMemoryDashboard),D=z(e=>e.showSchedules),k=Cs(ws),A=Cs(e=>e.showPanel),j=Cs(e=>e.setShowPanel),[ee,te]=(0,R.useState)(``),[N,ne]=(0,R.useState)(null),[re,ie]=(0,R.useState)(null),[ae,oe]=(0,R.useState)(pc),se=(0,R.useRef)(null);(0,R.useEffect)(()=>{let e=()=>{m&&h(),requestAnimationFrame(()=>se.current?.focus())};return window.addEventListener(`gaia:focus-search`,e),()=>window.removeEventListener(`gaia:focus-search`,e)},[m,h]);let ce=(0,R.useMemo)(()=>({running:a,queued:o,awaiting:s,prompting:f}),[a,o,s,f]),le=Bs(r),ue=(0,R.useMemo)(()=>{let e=ee.trim().toLowerCase();return zs(e?r.filter(t=>t.title.toLowerCase().includes(e)):r,ce,{showAutomated:ae})},[r,ee,ce,ae]),de=(0,R.useCallback)(()=>{oe(e=>{try{localStorage.setItem(fc,e?`0`:`1`)}catch(e){u.system.warn(`Chat-list filter not saved; it will reset on reload.`,e)}return!e})},[]),fe=(0,R.useCallback)(e=>{d(e,{unread:!1}),Sa(e).catch(t=>{u.chat.error(`Could not mark chat ${e} read`,t),ie(`Could not mark the chat read: ${t instanceof Error?t.message:t}`)})},[d]),pe=r.find(e=>e.id===i)?.unread;(0,R.useEffect)(()=>{if(!i||!pe)return;if(document.hasFocus()){fe(i);return}let e=()=>fe(i);return window.addEventListener(`focus`,e,{once:!0}),()=>window.removeEventListener(`focus`,e)},[i,pe,fe]);let me=(0,R.useCallback)(async(e,t)=>{ie(null),d(e,{pinned:t});try{await xa(e,t)}catch(n){u.chat.error(`Could not ${t?`pin`:`unpin`} chat ${e}`,n),d(e,{pinned:!t}),ie(n instanceof Error?n.message:`Could not ${t?`pin`:`unpin`} the chat.`)}},[d]),he=(0,R.useCallback)(()=>{window.innerWidth<=768&&g(!1)},[g]),ge=(0,R.useCallback)(e=>{e===i?(_(e),he()):(rc(i),_(e),v([]),he())},[i,_,v,he]),P=(0,R.useCallback)(async e=>{ne(null),b(e);try{await ya(e),y(e)}catch(t){u.chat.error(`Delete failed for session ${e}`,t),ne(t instanceof Error?t.message:`Could not delete the chat.`)}finally{x(e)}},[b,x,y]),F=typeof window<`u`&&window.innerWidth<=768,I=m&&!F,_e=z(e=>e.setSidebarCollapsed),ve=uc((0,R.useCallback)(()=>_e(!0),[_e])),ye=!F&&!I,be=[{key:`memory`,label:`Memory`,icon:M,on:E,onClick:()=>{C(!0),he()}},{key:`schedules`,label:`Scheduled tasks`,icon:xe,on:D,onClick:()=>{w(!0),he()}},{key:`documents`,label:`Documents`,icon:qe,on:!1,onClick:()=>{T(!0),he()}}];return(0,B.jsxs)(`aside`,{className:`sb${p?` is-open`:``}${I?` is-collapsed`:``}${ve.resizing?` is-resizing`:``}`,style:ye?{width:ve.width,minWidth:ve.width}:void 0,"aria-label":`Chats`,children:[ye&&ve.handle,(0,B.jsxs)(`div`,{className:`sb-top`,children:[(0,B.jsxs)(`div`,{className:`sb-brand`,children:[(0,B.jsx)(`img`,{src:ic,alt:``,width:22,height:22}),!I&&(0,B.jsx)(`span`,{children:`GAIA`})]}),(0,B.jsx)(`button`,{type:`button`,className:`sb-icon-btn`,onClick:F?()=>g(!1):h,"aria-label":I?`Expand sidebar`:`Collapse sidebar`,title:`${I?`Expand`:`Collapse`} sidebar (${ec(`Mod+B`)})`,children:F?(0,B.jsx)(Fn,{size:17}):I?(0,B.jsx)(Rt,{size:17}):(0,B.jsx)(It,{size:17})})]}),(0,B.jsxs)(`div`,{className:`sb-actions`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`sb-nav-item`,onClick:()=>{e(),he()},title:`New chat (${ec(`Mod+Shift+O`)})`,children:[(0,B.jsx)(_n,{size:16,"aria-hidden":`true`}),!I&&(0,B.jsx)(`span`,{children:`New chat`})]}),I?(0,B.jsx)(`button`,{type:`button`,className:`sb-nav-item`,onClick:()=>window.dispatchEvent(new CustomEvent(`gaia:focus-search`)),"aria-label":`Search chats`,children:(0,B.jsx)(nn,{size:16,"aria-hidden":`true`})}):(0,B.jsxs)(`label`,{className:`sb-search`,children:[(0,B.jsx)(nn,{size:14,"aria-hidden":`true`}),(0,B.jsx)(`input`,{ref:se,type:`search`,value:ee,onChange:e=>te(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),te(``),se.current?.blur())},...l,placeholder:`Search chats`,"aria-label":`Search chats (${ec(`Mod+K`)})`})]}),be.map(({key:e,label:t,icon:n,on:r,onClick:i})=>(0,B.jsxs)(`button`,{type:`button`,className:`sb-nav-item${r?` is-active`:``}`,onClick:i,"aria-current":r?`page`:void 0,"aria-label":t,title:I?t:void 0,children:[(0,B.jsx)(n,{size:16,"aria-hidden":`true`}),!I&&(0,B.jsx)(`span`,{children:t})]},e))]}),!I&&(0,B.jsxs)(`nav`,{className:`sb-list`,"aria-label":`Recent chats`,children:[ue.length===0&&(0,B.jsx)(`p`,{className:`sb-empty`,children:ee?`No chats match.`:`No chats yet.`}),ue.map(e=>(0,B.jsxs)(`section`,{className:`sb-group${e.label===`Needs you`?` is-needs-you`:``}`,children:[(0,B.jsx)(`h2`,{className:`sb-group-label`,children:e.label}),(0,B.jsx)(`ul`,{children:e.sessions.map(e=>(0,B.jsx)(mc,{session:e,active:e.id===i,status:Ls(e,ce),queuePlace:o.indexOf(e.id)+1,unsent:c[e.id]?.length??0,failed:c[e.id]?.filter(e=>e.state===`failed`).length??0,onSelect:ge,onDelete:P,onPin:(e,t)=>void me(e,t)},e.id))})]},e.label)),le>0&&(0,B.jsx)(`button`,{type:`button`,className:`sb-filter`,onClick:de,"aria-pressed":ae,children:ae?`Hide background runs`:`Show ${le} background run${le===1?``:`s`}`}),N&&(0,B.jsx)(`p`,{className:`sb-error`,role:`alert`,children:N}),re&&(0,B.jsx)(`p`,{className:`sb-error`,role:`alert`,children:re})]}),(0,B.jsxs)(`div`,{className:`sb-bottom`,children:[!I&&(0,B.jsx)(us,{}),(0,B.jsxs)(`div`,{className:`sb-bottom-actions`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`sb-icon-btn${A?` is-active`:``}`,onClick:()=>j(!A),"aria-label":k>0?`Notifications, ${k} unread`:`Notifications`,"aria-expanded":A,title:`Notifications`,children:[(0,B.jsx)(O,{size:16}),k>0&&(0,B.jsx)(`span`,{className:`sb-badge`,"aria-hidden":`true`,children:k>99?`99+`:k})]}),t&&(0,B.jsx)(`button`,{type:`button`,className:`sb-icon-btn${n?` is-active`:``}`,onClick:t,"aria-label":n?`Mobile access is on`:`Mobile access`,title:`Mobile access`,children:(0,B.jsx)(hn,{size:16})}),(0,B.jsx)(`button`,{type:`button`,className:`sb-icon-btn`,onClick:()=>S(),"aria-label":`Settings`,title:`Settings (${ec(`Mod+,`)})`,children:(0,B.jsx)(an,{size:16})})]})]})]})}function gc(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var _c=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,vc=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,yc={};function bc(e,t){return((t||yc).jsx?vc:_c).test(e)}var xc=/[ \t\n\f\r]/g;function Sc(e){return typeof e==`object`?e.type===`text`&&Cc(e.value):Cc(e)}function Cc(e){return e.replace(xc,``)===``}var wc=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};wc.prototype.normal={},wc.prototype.property={},wc.prototype.space=void 0;function Tc(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new wc(n,r,t)}function Ec(e){return e.toLowerCase()}var Dc=class{constructor(e,t){this.attribute=t,this.property=e}};Dc.prototype.attribute=``,Dc.prototype.booleanish=!1,Dc.prototype.boolean=!1,Dc.prototype.commaOrSpaceSeparated=!1,Dc.prototype.commaSeparated=!1,Dc.prototype.defined=!1,Dc.prototype.mustUseProperty=!1,Dc.prototype.number=!1,Dc.prototype.overloadedBoolean=!1,Dc.prototype.property=``,Dc.prototype.spaceSeparated=!1,Dc.prototype.space=void 0;var Oc=e({boolean:()=>W,booleanish:()=>Ac,commaOrSpaceSeparated:()=>Nc,commaSeparated:()=>Mc,number:()=>G,overloadedBoolean:()=>jc,spaceSeparated:()=>K}),kc=0,W=Pc(),Ac=Pc(),jc=Pc(),G=Pc(),K=Pc(),Mc=Pc(),Nc=Pc();function Pc(){return 2**++kc}var Fc=Object.keys(Oc),Ic=class extends Dc{constructor(e,t,n,r){let i=-1;if(super(e,t),Lc(this,`space`,r),typeof n==`number`)for(;++i<Fc.length;){let e=Fc[i];Lc(this,Fc[i],(n&Oc[e])===Oc[e])}}};Ic.prototype.defined=!0;function Lc(e,t,n){n&&(e[t]=n)}function Rc(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Ic(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Ec(r)]=r,n[Ec(a.attribute)]=r}return new wc(t,n,e.space)}var zc=Rc({properties:{ariaActiveDescendant:null,ariaAtomic:Ac,ariaAutoComplete:null,ariaBusy:Ac,ariaChecked:Ac,ariaColCount:G,ariaColIndex:G,ariaColSpan:G,ariaControls:K,ariaCurrent:null,ariaDescribedBy:K,ariaDetails:null,ariaDisabled:Ac,ariaDropEffect:K,ariaErrorMessage:null,ariaExpanded:Ac,ariaFlowTo:K,ariaGrabbed:Ac,ariaHasPopup:null,ariaHidden:Ac,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:K,ariaLevel:G,ariaLive:null,ariaModal:Ac,ariaMultiLine:Ac,ariaMultiSelectable:Ac,ariaOrientation:null,ariaOwns:K,ariaPlaceholder:null,ariaPosInSet:G,ariaPressed:Ac,ariaReadOnly:Ac,ariaRelevant:null,ariaRequired:Ac,ariaRoleDescription:K,ariaRowCount:G,ariaRowIndex:G,ariaRowSpan:G,ariaSelected:Ac,ariaSetSize:G,ariaSort:null,ariaValueMax:G,ariaValueMin:G,ariaValueNow:G,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Bc(e,t){return t in e?e[t]:t}function Vc(e,t){return Bc(e,t.toLowerCase())}var Hc=Rc({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Mc,acceptCharset:K,accessKey:K,action:null,allow:null,allowFullScreen:W,allowPaymentRequest:W,allowUserMedia:W,alt:null,as:null,async:W,autoCapitalize:null,autoComplete:K,autoFocus:W,autoPlay:W,blocking:K,capture:null,charSet:null,checked:W,cite:null,className:K,cols:G,colSpan:null,content:null,contentEditable:Ac,controls:W,controlsList:K,coords:G|Mc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:W,defer:W,dir:null,dirName:null,disabled:W,download:jc,draggable:Ac,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:W,formTarget:null,headers:K,height:G,hidden:jc,high:G,href:null,hrefLang:null,htmlFor:K,httpEquiv:K,id:null,imageSizes:null,imageSrcSet:null,inert:W,inputMode:null,integrity:null,is:null,isMap:W,itemId:null,itemProp:K,itemRef:K,itemScope:W,itemType:K,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:W,low:G,manifest:null,max:null,maxLength:G,media:null,method:null,min:null,minLength:G,multiple:W,muted:W,name:null,nonce:null,noModule:W,noValidate:W,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:W,optimum:G,pattern:null,ping:K,placeholder:null,playsInline:W,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:W,referrerPolicy:null,rel:K,required:W,reversed:W,rows:G,rowSpan:G,sandbox:K,scope:null,scoped:W,seamless:W,selected:W,shadowRootClonable:W,shadowRootDelegatesFocus:W,shadowRootMode:null,shape:null,size:G,sizes:null,slot:null,span:G,spellCheck:Ac,src:null,srcDoc:null,srcLang:null,srcSet:null,start:G,step:null,style:null,tabIndex:G,target:null,title:null,translate:null,type:null,typeMustMatch:W,useMap:null,value:Ac,width:G,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:K,axis:null,background:null,bgColor:null,border:G,borderColor:null,bottomMargin:G,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:W,declare:W,event:null,face:null,frame:null,frameBorder:null,hSpace:G,leftMargin:G,link:null,longDesc:null,lowSrc:null,marginHeight:G,marginWidth:G,noResize:W,noHref:W,noShade:W,noWrap:W,object:null,profile:null,prompt:null,rev:null,rightMargin:G,rules:null,scheme:null,scrolling:Ac,standby:null,summary:null,text:null,topMargin:G,valueType:null,version:null,vAlign:null,vLink:null,vSpace:G,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:W,disableRemotePlayback:W,prefix:null,property:null,results:G,security:null,unselectable:null},space:`html`,transform:Vc}),Uc=Rc({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:Nc,accentHeight:G,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:G,amplitude:G,arabicForm:null,ascent:G,attributeName:null,attributeType:null,azimuth:G,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:G,by:null,calcMode:null,capHeight:G,className:K,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:G,diffuseConstant:G,direction:null,display:null,dur:null,divisor:G,dominantBaseline:null,download:W,dx:null,dy:null,edgeMode:null,editable:null,elevation:G,enableBackground:null,end:null,event:null,exponent:G,externalResourcesRequired:null,fill:null,fillOpacity:G,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Mc,g2:Mc,glyphName:Mc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:G,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:G,horizOriginX:G,horizOriginY:G,id:null,ideographic:G,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:G,k:G,k1:G,k2:G,k3:G,k4:G,kernelMatrix:Nc,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:G,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:G,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:G,overlineThickness:G,paintOrder:null,panose1:null,path:null,pathLength:G,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:K,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:G,pointsAtY:G,pointsAtZ:G,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Nc,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Nc,rev:Nc,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Nc,requiredFeatures:Nc,requiredFonts:Nc,requiredFormats:Nc,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:G,specularExponent:G,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:G,strikethroughThickness:G,string:null,stroke:null,strokeDashArray:Nc,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:G,strokeOpacity:G,strokeWidth:null,style:null,surfaceScale:G,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Nc,tabIndex:G,tableValues:null,target:null,targetX:G,targetY:G,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Nc,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:G,underlineThickness:G,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:G,values:null,vAlphabetic:G,vMathematical:G,vectorEffect:null,vHanging:G,vIdeographic:G,version:null,vertAdvY:G,vertOriginX:G,vertOriginY:G,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:G,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Bc}),Wc=Rc({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Gc=Rc({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Vc}),Kc=Rc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),qc={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Jc=/[A-Z]/g,Yc=/-[a-z]/g,Xc=/^data[-\w.:]+$/i;function Zc(e,t){let n=Ec(t),r=t,i=Dc;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Xc.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Yc,$c);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Yc.test(e)){let n=e.replace(Jc,Qc);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Ic}return new i(r,t)}function Qc(e){return`-`+e.toLowerCase()}function $c(e){return e.charAt(1).toUpperCase()}var el=Tc([zc,Hc,Wc,Gc,Kc],`html`),tl=Tc([zc,Uc,Wc,Gc,Kc],`svg`);function nl(e){return e.join(` `).trim()}var rl=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,u=1;function f(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(`
|
|
15
|
-
`);u=~n?e.length-n:u+e.length}function p(){var e={line:l,column:u};return function(t){return t.position=new m(e),_(),t}}function m(e){this.start=e,this.end={line:l,column:u},this.source=t.source}m.prototype.content=e;function h(n){var r=Error(t.source+`:`+l+`:`+u+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=u,r.source=e,!t.silent)throw r}function g(t){var n=t.exec(e);if(n){var r=n[0];return f(r),e=e.slice(r.length),n}}function _(){g(i)}function v(e){var t;for(e||=[];t=y();)t!==!1&&e.push(t);return e}function y(){var t=p();if(e.charAt(0)==`/`&&e.charAt(1)==`*`){for(var n=2;e.charAt(n)!=``&&(e.charAt(n)!=`*`||e.charAt(n+1)!=`/`);)++n;if(n+=2,e.charAt(n-1)===``)return h(`End of comment missing`);var r=e.slice(2,n-2);return u+=2,f(r),e=e.slice(n),u+=2,t({type:`comment`,comment:r})}}function b(){var e=p(),t=g(a);if(t){if(y(),!g(o))return h(`property missing ':'`);var r=g(s),i=e({type:`declaration`,property:d(t[0].replace(n,``)),value:r?d(r[0].replace(n,``)):``});return g(c),i}}function x(){var e=[];v(e);for(var t;t=b();)t!==!1&&(e.push(t),v(e));return e}return _(),x()}function d(e){return e?e.replace(l,``):``}t.exports=u})),il=n(((e,t,n)=>{var r=n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=a;var i=r(rl());function a(e,t){let n=null;if(!e||typeof e!=`string`)return n;let r=(0,i.default)(e),a=typeof t==`function`;return r.forEach(e=>{if(e.type!==`declaration`)return;let{property:r,value:i}=e;a?t(r,i,e):i&&(n||={},n[r]=i)}),n}})),al=n((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),ol=n(((e,t,n)=>{var r=(n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(il()),i=al();function a(e,t){var n={};return!e||typeof e!=`string`||(0,r.default)(e,function(e,r){e&&r&&(n[(0,i.camelCase)(e,t)]=r)}),n}a.default=a,t.exports=a})),sl=ll(`end`),cl=ll(`start`);function ll(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function ul(e){let t=cl(e),n=sl(e);if(t&&n)return{start:t,end:n}}function dl(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?pl(e.position):`start`in e||`end`in e?pl(e):`line`in e||`column`in e?fl(e):``}function fl(e){return ml(e&&e.line)+`:`+ml(e&&e.column)}function pl(e){return fl(e&&e.start)+`-`+fl(e&&e.end)}function ml(e){return e&&typeof e==`number`?e:1}var q=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=dl(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};q.prototype.file=``,q.prototype.name=``,q.prototype.reason=``,q.prototype.message=``,q.prototype.stack=``,q.prototype.column=void 0,q.prototype.line=void 0,q.prototype.ancestors=void 0,q.prototype.cause=void 0,q.prototype.fatal=void 0,q.prototype.place=void 0,q.prototype.ruleId=void 0,q.prototype.source=void 0;var hl=t(ol(),1),gl={}.hasOwnProperty,_l=new Map,vl=/[A-Z]/g,yl=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),bl=new Set([`td`,`th`]),xl=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Sl(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=Nl(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=Ml(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?tl:el,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Cl(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Cl(e,t,n){if(t.type===`element`)return wl(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Tl(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Dl(e,t,n);if(t.type===`mdxjsEsm`)return El(e,t);if(t.type===`root`)return Ol(e,t,n);if(t.type===`text`)return kl(e,t)}function wl(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=tl,e.schema=i),e.ancestors.push(t);let a=zl(e,t.tagName,!1),o=Pl(e,t),s=Il(e,t);return yl.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Sc(e)})),Al(e,o,a,t),jl(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Tl(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}Bl(e,t.position)}function El(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Bl(e,t.position)}function Dl(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=tl,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:zl(e,t.name,!0),o=Fl(e,t),s=Il(e,t);return Al(e,o,a,t),jl(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Ol(e,t,n){let r={};return jl(r,Il(e,t)),e.create(t,e.Fragment,r,n)}function kl(e,t){return t.value}function Al(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function jl(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Ml(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function Nl(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=cl(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function Pl(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&gl.call(t.properties,i)){let a=Ll(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&bl.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function Fl(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`){if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Bl(e,t.position)}else{let i=r.name,a;if(r.value&&typeof r.value==`object`){if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else Bl(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function Il(e,t){let n=[],r=-1,i=e.passKeys?new Map:_l;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=Cl(e,a,o);s!==void 0&&n.push(s)}return n}function Ll(e,t,n){let r=Zc(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?gc(n):nl(n)),r.property===`style`){let t=typeof n==`object`?n:Rl(e,String(n));return e.stylePropertyNameCase===`css`&&(t=Vl(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?qc[r.property]||r.property:r.attribute,n]}}function Rl(e,t){try{return(0,hl.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new q("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=xl+`#cannot-parse-style-attribute`,r}}function zl(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=bc(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=bc(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return gl.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);Bl(e)}function Bl(e,t){let n=new q("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=xl+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function Vl(e){let t={},n;for(n in e)gl.call(e,n)&&(t[Hl(n)]=e[n]);return t}function Hl(e){let t=e.replace(vl,Ul);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function Ul(e){return`-`+e.toLowerCase()}var Wl={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},Gl={};function Kl(e,t){let n=t||Gl;return ql(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function ql(e,t,n){if(Yl(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return Jl(e.children,t,n)}return Array.isArray(e)?Jl(e,t,n):``}function Jl(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=ql(e[i],t,n);return r.join(``)}function Yl(e){return!!(e&&typeof e==`object`)}var Xl=document.createElement(`i`);function Zl(e){let t=`&`+e+`;`;Xl.innerHTML=t;let n=Xl.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function Ql(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function $l(e,t){return e.length>0?(Ql(e,e.length,0,t),e):t}var eu={}.hasOwnProperty;function tu(e){let t={},n=-1;for(;++n<e.length;)nu(t,e[n]);return t}function nu(e,t){let n;for(n in t){let r=(eu.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){eu.call(r,a)||(r[a]=[]);let e=i[a];ru(r[a],Array.isArray(e)?e:e?[e]:[])}}}function ru(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);Ql(e,0,0,r)}function iu(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function au(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var ou=gu(/[A-Za-z]/),su=gu(/[\dA-Za-z]/),cu=gu(/[#-'*+\--9=?A-Z^-~]/);function lu(e){return e!==null&&(e<32||e===127)}var uu=gu(/\d/),du=gu(/[\dA-Fa-f]/),fu=gu(/[!-/:-@[-`{-~]/);function J(e){return e!==null&&e<-2}function pu(e){return e!==null&&(e<0||e===32)}function Y(e){return e===-2||e===-1||e===32}var mu=gu(/\p{P}|\p{S}/u),hu=gu(/\s/);function gu(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function _u(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&su(e.charCodeAt(n+1))&&su(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function X(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Y(r)?(e.enter(n),s(r)):t(r)}function s(r){return Y(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var vu={tokenize:yu};function yu(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null)e.consume(n);else return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null)e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);else return J(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var bu={tokenize:Su},xu={tokenize:Cu};function Su(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return Ql(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!(!i.currentConstruct||i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(xu,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(xu,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null)i&&v(),_(0),e.consume(n);else return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null)g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);else return J(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;Ql(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-->r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Cu(e,t,n){return X(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function wu(e){if(e===null||pu(e)||hu(e))return 1;if(mu(e))return 2}function Tu(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var Eu={name:`attention`,resolveAll:Du,tokenize:Ou};function Du(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};ku(d,-c),ku(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=$l(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=$l(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=$l(l,Tu(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=$l(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=$l(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,Ql(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function Ou(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=wu(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=wu(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function ku(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Au={name:`autolink`,tokenize:ju};function ju(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return ou(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||su(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||su(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||lu(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):cu(t)?(e.consume(t),l):n(t)}function u(e){return su(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||su(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var Mu={partial:!0,tokenize:Nu};function Nu(e,t,n){return r;function r(t){return Y(t)?X(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||J(e)?t(e):n(e)}}var Pu={continuation:{tokenize:Iu},exit:Lu,name:`blockQuote`,tokenize:Fu};function Fu(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Y(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function Iu(e,t,n){let r=this;return i;function i(t){return Y(t)?X(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(Pu,t,n)(r)}}function Lu(e){e.exit(`blockQuote`)}var Ru={name:`characterEscape`,tokenize:zu};function zu(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return fu(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var Bu={name:`characterReference`,tokenize:Vu};function Vu(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=su,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=du,u):(e.enter(`characterReferenceValue`),a=7,o=uu,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===su&&!Zl(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var Hu={partial:!0,tokenize:Gu},Uu={concrete:!0,name:`codeFenced`,tokenize:Wu};function Wu(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Y(t)?X(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||J(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(Hu,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||J(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),X(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||J(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||J(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Y(t)?X(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||J(t)?e.check(Hu,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||J(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Y(t)?X(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Y(t)?X(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||J(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function Gu(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var Ku={name:`codeIndented`,tokenize:Ju},qu={partial:!0,tokenize:Yu};function Ju(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),X(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):J(t)?e.attempt(qu,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||J(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Yu(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):J(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):X(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):J(e)?i(e):n(e)}}var Xu={name:`codeText`,previous:Q,resolve:Z,tokenize:Zu};function Z(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Q(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Zu(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):J(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||J(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var Qu=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&$u(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),$u(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),$u(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)){if(e<this.left.length){let t=this.left.splice(e,1/0);$u(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);$u(this.left,t.reverse())}}}};function $u(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function ed(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Qu(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,td(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(o[1].type!==`linePrefix`&&o[1].type!==`listItemIndent`)break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return Ql(e,0,1/0,u.slice(0)),!l}function td(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var nd={resolve:id,tokenize:ad},rd={partial:!0,tokenize:od};function id(e){return ed(e),e}function ad(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):J(t)?e.check(rd,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function od(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),X(e,a,`linePrefix`)}function a(i){if(i===null||J(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function sd(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||lu(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||J(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||pu(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||lu(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function cd(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):J(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||J(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Y(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function ld(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):J(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),X(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||J(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function ud(e,t){let n;return r;function r(i){return J(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Y(i)?X(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var dd={name:`definition`,tokenize:pd},fd={partial:!0,tokenize:md};function pd(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return cd.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=au(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return pu(t)?ud(e,l)(t):l(t)}function l(t){return sd(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(fd,d,d)(t)}function d(t){return Y(t)?X(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||J(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function md(e,t,n){return r;function r(t){return pu(t)?ud(e,i)(t):n(t)}function i(t){return ld(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Y(t)?X(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||J(e)?t(e):n(e)}}var hd={name:`hardBreakEscape`,tokenize:gd};function gd(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return J(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var _d={name:`headingAtx`,resolve:vd,tokenize:yd};function vd(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},Ql(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function yd(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||pu(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||J(n)?(e.exit(`atxHeading`),t(n)):Y(n)?X(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||pu(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var bd=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),xd=[`pre`,`script`,`style`,`textarea`],Sd={concrete:!0,name:`htmlFlow`,resolveTo:Td,tokenize:Ed},Cd={partial:!0,tokenize:Od},wd={partial:!0,tokenize:Dd};function Td(e){let t=e.length;for(;t--&&(e[t][0]!==`enter`||e[t][1].type!==`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function Ed(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ne):ou(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):ou(a)?(e.consume(a),i=4,r.interrupt?t:ne):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ne):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return ou(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||pu(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&xd.includes(l)?(i=1,r.interrupt?t(s):O(s)):bd.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||su(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Y(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||ou(t)?(e.consume(t),b):Y(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||su(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Y(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Y(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||J(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||pu(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Y(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||J(t)?O(t):Y(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),M):t===60&&i===1?(e.consume(t),ee):t===62&&i===4?(e.consume(t),re):t===63&&i===3?(e.consume(t),ne):t===93&&i===5?(e.consume(t),N):J(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Cd,ie,k)(t)):t===null||J(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(wd,A,ie)(t)}function A(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),j}function j(t){return t===null||J(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function M(t){return t===45?(e.consume(t),ne):O(t)}function ee(t){return t===47?(e.consume(t),o=``,te):O(t)}function te(t){if(t===62){let n=o.toLowerCase();return xd.includes(n)?(e.consume(t),re):O(t)}return ou(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),te):O(t)}function N(t){return t===93?(e.consume(t),ne):O(t)}function ne(t){return t===62?(e.consume(t),re):t===45&&i===2?(e.consume(t),ne):O(t)}function re(t){return t===null||J(t)?(e.exit(`htmlFlowData`),ie(t)):(e.consume(t),re)}function ie(n){return e.exit(`htmlFlow`),t(n)}}function Dd(e,t,n){let r=this;return i;function i(t){return J(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Od(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(Mu,t,n)}}var kd={name:`htmlText`,tokenize:Ad};function Ad(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):ou(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):ou(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):J(t)?(o=d,ee(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?M(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):J(t)?(o=h,ee(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?M(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?M(t):J(t)?(o=v,ee(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):J(t)?(o=y,ee(t)):(e.consume(t),y)}function b(e){return e===62?M(e):y(e)}function x(t){return ou(t)?(e.consume(t),S):n(t)}function S(t){return t===45||su(t)?(e.consume(t),S):C(t)}function C(t){return J(t)?(o=C,ee(t)):Y(t)?(e.consume(t),C):M(t)}function w(t){return t===45||su(t)?(e.consume(t),w):t===47||t===62||pu(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),M):t===58||t===95||ou(t)?(e.consume(t),E):J(t)?(o=T,ee(t)):Y(t)?(e.consume(t),T):M(t)}function E(t){return t===45||t===46||t===58||t===95||su(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):J(t)?(o=D,ee(t)):Y(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):J(t)?(o=O,ee(t)):Y(t)?(e.consume(t),O):(e.consume(t),A)}function k(t){return t===i?(e.consume(t),i=void 0,j):t===null?n(t):J(t)?(o=k,ee(t)):(e.consume(t),k)}function A(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||pu(t)?T(t):(e.consume(t),A)}function j(e){return e===47||e===62||pu(e)?T(e):n(e)}function M(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function ee(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return Y(t)?X(e,N,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):N(t)}function N(t){return e.enter(`htmlTextData`),o(t)}}var jd={name:`labelEnd`,resolveAll:Fd,resolveTo:Id,tokenize:Ld},Md={tokenize:Rd},Nd={tokenize:zd},Pd={tokenize:Bd};function Fd(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&Ql(e,0,e.length,n),e}function Id(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=$l(s,e.slice(a+1,a+r+3)),s=$l(s,[[`enter`,u,t]]),s=$l(s,Tu(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=$l(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=$l(s,e.slice(o+1)),s=$l(s,[[`exit`,c,t]]),Ql(e,a,e.length,s),e}function Ld(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(au(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(Md,u,o?u:d)(t):t===91?e.attempt(Nd,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(Pd,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function Rd(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return pu(t)?ud(e,a)(t):a(t)}function a(t){return t===41?u(t):sd(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return pu(t)?ud(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?ld(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return pu(t)?ud(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function zd(e,t,n){let r=this;return i;function i(t){return cd.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(au(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function Bd(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var Vd={name:`labelStartImage`,resolveAll:jd.resolveAll,tokenize:Hd};function Hd(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Ud={name:`labelStartLink`,resolveAll:jd.resolveAll,tokenize:Wd};function Wd(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var Gd={name:`lineEnding`,tokenize:Kd};function Kd(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}}var qd={name:`thematicBreak`,tokenize:Jd};function Jd(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||J(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Y(t)?X(e,s,`whitespace`)(t):s(t))}}var Yd={continuation:{tokenize:$d},exit:tf,name:`list`,tokenize:Qd},Xd={partial:!0,tokenize:nf},Zd={partial:!0,tokenize:ef};function Qd(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:uu(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(qd,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return uu(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(Mu,r.interrupt?n:u,e.attempt(Xd,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Y(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function $d(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Mu,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,X(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Y(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Zd,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,X(e,e.attempt(Yd,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function ef(e,t,n){let r=this;return X(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function tf(e){e.exit(this.containerState.type)}function nf(e,t,n){let r=this;return X(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Y(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var rf={name:`setextUnderline`,resolveTo:af,tokenize:of};function af(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function of(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Y(t)?X(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||J(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var sf={tokenize:cf};function cf(e){let t=this,n=e.attempt(Mu,r,e.attempt(this.parser.constructs.flowInitial,i,X(e,e.attempt(this.parser.constructs.flow,i,e.attempt(nd,i)),`linePrefix`)));return n;function r(r){if(r===null)e.consume(r);else return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null)e.consume(r);else return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var lf={resolveAll:pf()},uf=ff(`string`),df=ff(`text`);function ff(e){return{resolveAll:pf(e===`text`?mf:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null)t.consume(e);else return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function pf(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function mf(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var hf=e({attentionMarkers:()=>Cf,contentInitial:()=>_f,disable:()=>wf,document:()=>gf,flow:()=>yf,flowInitial:()=>vf,insideSpan:()=>Sf,string:()=>bf,text:()=>xf}),gf={42:Yd,43:Yd,45:Yd,48:Yd,49:Yd,50:Yd,51:Yd,52:Yd,53:Yd,54:Yd,55:Yd,56:Yd,57:Yd,62:Pu},_f={91:dd},vf={[-2]:Ku,[-1]:Ku,32:Ku},yf={35:_d,42:qd,45:[rf,qd],60:Sd,61:rf,95:qd,96:Uu,126:Uu},bf={38:Bu,92:Ru},xf={[-5]:Gd,[-4]:Gd,[-3]:Gd,33:Vd,38:Bu,42:Eu,60:[Au,kd],91:Ud,92:[hd,Ru],93:jd,95:Eu,96:Xu},Sf={null:[Eu,lf]},Cf={null:[42,95]},wf={null:[]};function Tf(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=$l(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Tu(a,l.events,l),l.events):[]}function f(e,t){return Df(p(e),t)}function p(e){return Ef(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){J(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&Ql(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function Ef(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Df(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
|
|
16
|
-
`;break;case-3:o=`\r
|
|
17
|
-
`;break;case-2:o=t?` `:` `;break;case-1:if(!t&&i)continue;o=` `;break;default:o=String.fromCharCode(a)}i=a===-2,r.push(o)}return r.join(``)}function Of(e){let t={constructs:tu([hf,...(e||{}).extensions||[]]),content:n(vu),defined:[],document:n(bu),flow:n(sf),lazy:{},string:n(uf),text:n(df)};return t;function n(e){return n;function n(n){return Tf(t,e,n)}}}function kf(e){for(;!ed(e););return e}var Af=/[\0\t\n\r]/g;function jf(){let e=1,t=``,n=!0,r;return i;function i(i,a,o){let s=[],c,l,u,d,f;for(i=t+(typeof i==`string`?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t=``,n&&=(i.charCodeAt(0)===65279&&u++,void 0);u<i.length;){if(Af.lastIndex=u,c=Af.exec(i),d=c&&c.index!==void 0?c.index:i.length,f=i.charCodeAt(d),!c){t=i.slice(u);break}if(f===10&&u===d&&r)s.push(-3),r=void 0;else switch(r&&=(s.push(-5),void 0),u<d&&(s.push(i.slice(u,d)),e+=d-u),f){case 0:s.push(65533),e++;break;case 9:for(l=Math.ceil(e/4)*4,s.push(-2);e++<l;)s.push(-1);break;case 10:s.push(-4),e=1;break;default:r=!0,e=1}u=d+1}return o&&(r&&s.push(-5),t&&s.push(t),s.push(null)),s}}var Mf=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Nf(e){return e.replace(Mf,Pf)}function Pf(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return iu(n.slice(t?2:1),t?16:10)}return Zl(n)||e}var Ff={}.hasOwnProperty;function If(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),Lf(n)(kf(Of(n).document().write(jf()(e,t,!0))))}function Lf(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(ve),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(P),blockQuote:a(fe),characterEscape:T,characterReference:T,codeFenced:a(pe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(pe,o),codeText:a(me,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(he),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(ge),hardBreakEscape:a(F),hardBreakTrailing:a(F),htmlFlow:a(I,o),htmlFlowData:T,htmlText:a(I,o),htmlTextData:T,image:a(_e),label:o,link:a(ve),listItem:a(be),listItemValue:f,listOrdered:a(ye,d),listUnordered:a(ye),paragraph:a(xe),reference:ae,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(P),strong:a(Se),thematicBreak:a(we)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:de,autolinkProtocol:ue,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:ce,characterReference:le,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(j),codeTextData:E,data:E,definition:c(),definitionDestinationString:b,definitionLabelString:v,definitionTitleString:y,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(k),htmlFlowData:E,htmlText:c(A),htmlTextData:E,image:c(ee),label:N,labelText:te,lineEnding:D,link:c(M),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:oe,resourceDestinationString:ne,resourceTitleString:re,resource:ie,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};zf(t,(e||{}).mdastExtensions||[]);let n={};return r;function r(e){let r={type:`root`,children:[]},a={stack:[r],tokenStack:[],config:t,enter:s,exit:l,buffer:o,resume:u,data:n},c=[],d=-1;for(;++d<e.length;)(e[d][1].type===`listOrdered`||e[d][1].type===`listUnordered`)&&(e[d][0]===`enter`?c.push(d):d=i(e,c.pop(),d));for(d=-1;++d<e.length;){let n=t[e[d][0]];Ff.call(n,e[d][1].type)&&n[e[d][1].type].call(Object.assign({sliceSerialize:e[d][2].sliceSerialize},a),e[d][1])}if(a.tokenStack.length>0){let e=a.tokenStack[a.tokenStack.length-1];(e[1]||$).call(a,void 0,e[0])}for(r.position={start:Rf(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:Rf(e.length>0?e[e.length-2][1].end:{line:1,column:1,offset:0})},d=-1;++d<t.transforms.length;)r=t.transforms[d](r)||r;return r}function i(e,t,n){let r=t-1,i=-1,a=!1,o,s,c,l;for(;++r<=n;){let t=e[r];switch(t[1].type){case`listUnordered`:case`listOrdered`:case`blockQuote`:t[0]===`enter`?i++:i--,l=void 0;break;case`lineEndingBlank`:t[0]===`enter`&&(o&&!l&&!i&&!c&&(c=r),l=void 0);break;case`linePrefix`:case`listItemValue`:case`listItemMarker`:case`listItemPrefix`:case`listItemPrefixWhitespace`:break;default:l=void 0}if(!i&&t[0]===`enter`&&t[1].type===`listItemPrefix`||i===-1&&t[0]===`exit`&&(t[1].type===`listUnordered`||t[1].type===`listOrdered`)){if(o){let i=r;for(s=void 0;i--;){let t=e[i];if(t[1].type===`lineEnding`||t[1].type===`lineEndingBlank`){if(t[0]===`exit`)continue;s&&(e[s][1].type=`lineEndingBlank`,a=!0),t[1].type=`lineEnding`,s=i}else if(t[1].type!==`linePrefix`&&t[1].type!==`blockQuotePrefix`&&t[1].type!==`blockQuotePrefixWhitespace`&&t[1].type!==`blockQuoteMarker`&&t[1].type!==`listItemIndent`)break}c&&(!s||c<s)&&(o._spread=!0),o.end=Object.assign({},s?e[s][1].start:t[1].end),e.splice(s||r,0,[`exit`,o,t[2]]),r++,n++}if(t[1].type===`listItemPrefix`){let i={type:`listItem`,_spread:!1,start:Object.assign({},t[1].start),end:void 0};o=i,e.splice(r,0,[`enter`,i,t[2]]),r++,n++,c=void 0,l=!0}}}return e[t][1]._spread=a,n}function a(e,t){return n;function n(n){s.call(this,e(n),n),t&&t.call(this,n)}}function o(){this.stack.push({type:`fragment`,children:[]})}function s(e,t,n){this.stack[this.stack.length-1].children.push(e),this.stack.push(e),this.tokenStack.push([t,n||void 0]),e.position={start:Rf(t.start),end:void 0}}function c(e){return t;function t(t){e&&e.call(this,t),l.call(this,t)}}function l(e,t){let n=this.stack.pop(),r=this.tokenStack.pop();if(r)r[0].type!==e.type&&(t?t.call(this,e,r[0]):(r[1]||$).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+dl({start:e.start,end:e.end})+`): it’s not open`);n.position.end=Rf(e.end)}function u(){return Kl(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(e){if(this.data.expectingFirstListItemValue){let t=this.stack[this.stack.length-2];t.start=Number.parseInt(this.sliceSerialize(e),10),this.data.expectingFirstListItemValue=void 0}}function p(){let e=this.resume(),t=this.stack[this.stack.length-1];t.lang=e}function m(){let e=this.resume(),t=this.stack[this.stack.length-1];t.meta=e}function h(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function g(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),this.data.flowCodeInside=void 0}function _(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e.replace(/(\r?\n|\r)$/g,``)}function v(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=au(this.sliceSerialize(e)).toLowerCase()}function y(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function b(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function x(e){let t=this.stack[this.stack.length-1];t.depth||=this.sliceSerialize(e).length}function S(){this.data.setextHeadingSlurpLineEnding=!0}function C(e){let t=this.stack[this.stack.length-1];t.depth=this.sliceSerialize(e).codePointAt(0)===61?1:2}function w(){this.data.setextHeadingSlurpLineEnding=void 0}function T(e){let t=this.stack[this.stack.length-1].children,n=t[t.length-1];(!n||n.type!==`text`)&&(n=Ce(),n.position={start:Rf(e.start),end:void 0},t.push(n)),this.stack.push(n)}function E(e){let t=this.stack.pop();t.value+=this.sliceSerialize(e),t.position.end=Rf(e.end)}function D(e){let n=this.stack[this.stack.length-1];if(this.data.atHardBreak){let t=n.children[n.children.length-1];t.position.end=Rf(e.end),this.data.atHardBreak=void 0}else!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(n.type)&&(T.call(this,e),E.call(this,e))}function O(){this.data.atHardBreak=!0}function k(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function A(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function M(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function ee(){let e=this.stack[this.stack.length-1];if(this.data.inReference){let t=this.data.referenceType||`shortcut`;e.type+=`Reference`,e.referenceType=t,delete e.url,delete e.title}else delete e.identifier,delete e.label;this.data.referenceType=void 0}function te(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=Nf(t),n.identifier=au(t).toLowerCase()}function N(){let e=this.stack[this.stack.length-1],t=this.resume(),n=this.stack[this.stack.length-1];this.data.inReference=!0,n.type===`link`?n.children=e.children:n.alt=t}function ne(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function re(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function ie(){this.data.inReference=void 0}function ae(){this.data.referenceType=`collapsed`}function oe(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=au(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function se(e){this.data.characterReferenceType=e.type}function ce(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=iu(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=Zl(t);let i=this.stack[this.stack.length-1];i.value+=r}function le(e){let t=this.stack.pop();t.position.end=Rf(e.end)}function ue(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function de(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function fe(){return{type:`blockquote`,children:[]}}function pe(){return{type:`code`,lang:null,meta:null,value:``}}function me(){return{type:`inlineCode`,value:``}}function he(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function ge(){return{type:`emphasis`,children:[]}}function P(){return{type:`heading`,depth:0,children:[]}}function F(){return{type:`break`}}function I(){return{type:`html`,value:``}}function _e(){return{type:`image`,title:null,url:``,alt:null}}function ve(){return{type:`link`,title:null,url:``,children:[]}}function ye(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function be(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function xe(){return{type:`paragraph`,children:[]}}function Se(){return{type:`strong`,children:[]}}function Ce(){return{type:`text`,value:``}}function we(){return{type:`thematicBreak`}}}function Rf(e){return{line:e.line,column:e.column,offset:e.offset}}function zf(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?zf(e,r):Bf(e,r)}}function Bf(e,t){let n;for(n in t)if(Ff.call(t,n))switch(n){case`canContainEols`:{let r=t[n];r&&e[n].push(...r);break}case`transforms`:{let r=t[n];r&&e[n].push(...r);break}case`enter`:case`exit`:{let r=t[n];r&&Object.assign(e[n],r);break}}}function $(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+dl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+dl({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+dl({start:t.start,end:t.end})+`) is still open`)}function Vf(e){let t=this;t.parser=n;function n(n){return If(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function Hf(e,t){let n={type:`element`,tagName:`blockquote`,properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Uf(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
|
|
18
|
-
`}]}function Wf(e,t){let n=t.value?t.value+`
|
|
19
|
-
`:``,r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=[`language-`+i[0]]);let a={type:`element`,tagName:`code`,properties:r,children:[{type:`text`,value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:`element`,tagName:`pre`,properties:{},children:[a]},e.patch(t,a),a}function Gf(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Kf(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qf(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=_u(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let c={type:`element`,tagName:`a`,properties:{href:`#`+n+`fn-`+i,id:n+`fnref-`+i+(s>1?`-`+s:``),dataFootnoteRef:!0,ariaDescribedBy:[`footnote-label`]},children:[{type:`text`,value:String(o)}]};e.patch(t,c);let l={type:`element`,tagName:`sup`,properties:{},children:[c]};return e.patch(t,l),e.applyData(t,l)}function Jf(e,t){let n={type:`element`,tagName:`h`+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Yf(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Xf(e,t){let n=t.referenceType,r=`]`;if(n===`collapsed`?r+=`[]`:n===`full`&&(r+=`[`+(t.label||t.identifier)+`]`),t.type===`imageReference`)return[{type:`text`,value:`![`+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type===`text`?a.value=`[`+a.value:i.unshift({type:`text`,value:`[`});let o=i[i.length-1];return o&&o.type===`text`?o.value+=r:i.push({type:`text`,value:r}),i}function Zf(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Xf(e,t);let i={src:_u(r.url||``),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`img`,properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function Qf(e,t){let n={src:_u(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`img`,properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function $f(e,t){let n={type:`text`,value:t.value.replace(/\r?\n|\r/g,` `)};e.patch(t,n);let r={type:`element`,tagName:`code`,properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function ep(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Xf(e,t);let i={href:_u(r.url||``)};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:`element`,tagName:`a`,properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function tp(e,t){let n={href:_u(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:`element`,tagName:`a`,properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function np(e,t,n){let r=e.all(t),i=n?rp(n):ip(t),a={},o=[];if(typeof t.checked==`boolean`){let e=r[0],n;e&&e.type===`element`&&e.tagName===`p`?n=e:(n={type:`element`,tagName:`p`,properties:{},children:[]},r.unshift(n)),n.children.length>0&&n.children.unshift({type:`text`,value:` `}),n.children.unshift({type:`element`,tagName:`input`,properties:{type:`checkbox`,checked:t.checked,disabled:!0},children:[]}),a.className=[`task-list-item`]}let s=-1;for(;++s<r.length;){let e=r[s];(i||s!==0||e.type!==`element`||e.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
20
|
-
`}),e.type===`element`&&e.tagName===`p`&&!i?o.push(...e.children):o.push(e)}let c=r[r.length-1];c&&(i||c.type!==`element`||c.tagName!==`p`)&&o.push({type:`text`,value:`
|
|
21
|
-
`});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function rp(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=ip(n[r])}return t}function ip(e){return e.spread??e.children.length>1}function ap(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start==`number`&&t.start!==1&&(n.start=t.start);++i<r.length;){let e=r[i];if(e.type===`element`&&e.tagName===`li`&&e.properties&&Array.isArray(e.properties.className)&&e.properties.className.includes(`task-list-item`)){n.className=[`contains-task-list`];break}}let a={type:`element`,tagName:t.ordered?`ol`:`ul`,properties:n,children:e.wrap(r,!0)};return e.patch(t,a),e.applyData(t,a)}function op(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sp(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function cp(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lp(e,t){let n=e.all(t),r=n.shift(),i=[];if(r){let n={type:`element`,tagName:`thead`,properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],n),i.push(n)}if(n.length>0){let r={type:`element`,tagName:`tbody`,properties:{},children:e.wrap(n,!0)},a=cl(t.children[1]),o=sl(t.children[t.children.length-1]);a&&o&&(r.position={start:a,end:o}),i.push(r)}let a={type:`element`,tagName:`table`,properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function up(e,t,n){let r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?`th`:`td`,a=n&&n.type===`table`?n.align:void 0,o=a?a.length:t.children.length,s=-1,c=[];for(;++s<o;){let n=t.children[s],r={},o=a?a[s]:void 0;o&&(r.align=o);let l={type:`element`,tagName:i,properties:r,children:[]};n&&(l.children=e.all(n),e.patch(n,l),l=e.applyData(n,l)),c.push(l)}let l={type:`element`,tagName:`tr`,properties:{},children:e.wrap(c,!0)};return e.patch(t,l),e.applyData(t,l)}function dp(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var fp=9,pp=32;function mp(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(hp(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(hp(t.slice(i),i>0,!1)),a.join(``)}function hp(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===fp||t===pp;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===fp||t===pp;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function gp(e,t){let n={type:`text`,value:mp(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function _p(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var vp={blockquote:Hf,break:Uf,code:Wf,delete:Gf,emphasis:Kf,footnoteReference:qf,heading:Jf,html:Yf,imageReference:Zf,image:Qf,inlineCode:$f,linkReference:ep,link:tp,listItem:np,list:ap,paragraph:op,root:sp,strong:cp,table:lp,tableCell:dp,tableRow:up,text:gp,thematicBreak:_p,toml:yp,yaml:yp,definition:yp,footnoteDefinition:yp};function yp(){}var bp=typeof self==`object`?self:globalThis,xp=(e,t)=>{let n=(t,n)=>(e.set(n,t),t),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let e=n([],i);for(let t of o)e.push(r(t));return e}case 2:{let e=n({},i);for(let[t,n]of o)e[r(t)]=r(n);return e}case 3:return n(new Date(o),i);case 4:{let{source:e,flags:t}=o;return n(new RegExp(e,t),i)}case 5:{let e=n(new Map,i);for(let[t,n]of o)e.set(r(t),r(n));return e}case 6:{let e=n(new Set,i);for(let t of o)e.add(r(t));return e}case 7:{let{name:e,message:t}=o;return n(new bp[e](t),i)}case 8:return n(BigInt(o),i);case`BigInt`:return n(Object(BigInt(o)),i);case`ArrayBuffer`:return n(new Uint8Array(o).buffer,o);case`DataView`:{let{buffer:e}=new Uint8Array(o);return n(new DataView(e),o)}}return n(new bp[a](o),i)};return r},Sp=e=>xp(new Map,e)(0),Cp=``,{toString:wp}={},{keys:Tp}=Object,Ep=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=wp.call(e).slice(8,-1);switch(n){case`Array`:return[1,Cp];case`Object`:return[2,Cp];case`Date`:return[3,Cp];case`RegExp`:return[4,Cp];case`Map`:return[5,Cp];case`Set`:return[6,Cp];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},Dp=([e,t])=>e===0&&(t===`function`||t===`symbol`),Op=(e,t,n,r)=>{let i=(e,t)=>{let i=r.push(e)-1;return n.set(t,i),i},a=r=>{if(n.has(r))return n.get(r);let[o,s]=Ep(r);switch(o){case 0:{let t=r;switch(s){case`bigint`:o=8,t=r.toString();break;case`function`:case`symbol`:if(e)throw TypeError(`unable to serialize `+s);t=null;break;case`undefined`:return i([-1],r)}return i([o,t],r)}case 1:{if(s){let e=r;return s===`DataView`?e=new Uint8Array(r.buffer):s===`ArrayBuffer`&&(e=new Uint8Array(r)),i([s,[...e]],r)}let e=[],t=i([o,e],r);for(let t of r)e.push(a(t));return t}case 2:{if(s)switch(s){case`BigInt`:return i([s,r.toString()],r);case`Boolean`:case`Number`:case`String`:return i([s,r.valueOf()],r)}if(t&&`toJSON`in r)return a(r.toJSON());let n=[],c=i([o,n],r);for(let t of Tp(r))(e||!Dp(Ep(r[t])))&&n.push([a(t),a(r[t])]);return c}case 3:return i([o,r.toISOString()],r);case 4:{let{source:e,flags:t}=r;return i([o,{source:e,flags:t}],r)}case 5:{let t=[],n=i([o,t],r);for(let[n,i]of r)(e||!(Dp(Ep(n))||Dp(Ep(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!Dp(Ep(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},kp=(e,{json:t,lossy:n}={})=>{let r=[];return Op(!(t||n),!!t,new Map,r)(e),r},Ap=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?Sp(kp(e,t)):structuredClone(e):(e,t)=>Sp(kp(e,t));function jp(e,t){let n=[{type:`text`,value:`↩`}];return t>1&&n.push({type:`element`,tagName:`sup`,properties:{},children:[{type:`text`,value:String(t)}]}),n}function Mp(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function Np(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||jp,r=e.options.footnoteBackLabel||Mp,i=e.options.footnoteLabel||`Footnotes`,a=e.options.footnoteLabelTagName||`h2`,o=e.options.footnoteLabelProperties||{className:[`sr-only`]},s=[],c=-1;for(;++c<e.footnoteOrder.length;){let i=e.footnoteById.get(e.footnoteOrder[c]);if(!i)continue;let a=e.all(i),o=String(i.identifier).toUpperCase(),l=_u(o.toLowerCase()),u=0,d=[],f=e.footnoteCounts.get(o);for(;f!==void 0&&++u<=f;){d.length>0&&d.push({type:`text`,value:` `});let e=typeof n==`string`?n:n(c,u);typeof e==`string`&&(e={type:`text`,value:e}),d.push({type:`element`,tagName:`a`,properties:{href:`#`+t+`fnref-`+l+(u>1?`-`+u:``),dataFootnoteBackref:``,ariaLabel:typeof r==`string`?r:r(c,u),className:[`data-footnote-backref`]},children:Array.isArray(e)?e:[e]})}let p=a[a.length-1];if(p&&p.type===`element`&&p.tagName===`p`){let e=p.children[p.children.length-1];e&&e.type===`text`?e.value+=` `:p.children.push({type:`text`,value:` `}),p.children.push(...d)}else a.push(...d);let m={type:`element`,tagName:`li`,properties:{id:t+`fn-`+l},children:e.wrap(a,!0)};e.patch(i,m),s.push(m)}if(s.length!==0)return{type:`element`,tagName:`section`,properties:{dataFootnotes:!0,className:[`footnotes`]},children:[{type:`element`,tagName:a,properties:{...Ap(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
|
|
22
|
-
`},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
|
|
23
|
-
`}]}}var Pp=(function(e){if(e==null)return zp;if(typeof e==`function`)return Rp(e);if(typeof e==`object`)return Array.isArray(e)?Fp(e):Ip(e);if(typeof e==`string`)return Lp(e);throw Error(`Expected function, string, or object as test`)});function Fp(e){let t=[],n=-1;for(;++n<e.length;)t[n]=Pp(e[n]);return Rp(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function Ip(e){let t=e;return Rp(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function Lp(e){return Rp(t);function t(t){return t&&t.type===e}}function Rp(e){return t;function t(t,n,r){return!!(Bp(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function zp(){return!0}function Bp(e){return typeof e==`object`&&!!e&&`type`in e}function Vp(e){return e}var Hp=[];function Up(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=Pp(i),o=r?-1:1;s(e,void 0,[])();function s(e,i,c){let l=e&&typeof e==`object`?e:{};if(typeof l.type==`string`){let t=typeof l.tagName==`string`?l.tagName:typeof l.name==`string`?l.name:void 0;Object.defineProperty(u,"name",{value:`node (`+Vp(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=Hp,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=Wp(n(e,c)),l[0]===!1))return l;if(`children`in e&&e.children){let t=e;if(t.children&&l[0]!==`skip`)for(d=(r?t.children.length:-1)+o,f=c.concat(t);d>-1&&d<t.children.length;){let e=t.children[d];if(u=s(e,d,f)(),u[0]===!1)return u;d=typeof u[1]==`number`?u[1]:d+o}}return l}}}function Wp(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?Hp:[e]}function Gp(e,t,n,r){let i,a,o;typeof t==`function`&&typeof n!=`function`?(a=void 0,o=t,i=n):(a=t,o=n,i=r),Up(e,a,s,i);function s(e,t){let n=t[t.length-1],r=n?n.children.indexOf(e):void 0;return o(e,r,n)}}var Kp={}.hasOwnProperty,qp={};function Jp(e,t){let n=t||qp,r=new Map,i=new Map,a={all:s,applyData:Xp,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...vp,...n.handlers},one:o,options:n,patch:Yp,wrap:Qp};return Gp(e,function(e){if(e.type===`definition`||e.type===`footnoteDefinition`){let t=e.type===`definition`?r:i,n=String(e.identifier).toUpperCase();t.has(n)||t.set(n,e)}}),a;function o(e,t){let n=e.type,r=a.handlers[n];if(Kp.call(a.handlers,n)&&r)return r(a,e,t);if(a.options.passThrough&&a.options.passThrough.includes(n)){if(`children`in e){let{children:t,...n}=e,r=Ap(n);return r.children=a.all(e),r}return Ap(e)}return(a.options.unknownHandler||Zp)(a,e,t)}function s(e){let t=[];if(`children`in e){let n=e.children,r=-1;for(;++r<n.length;){let i=a.one(n[r],e);if(i){if(r&&n[r-1].type===`break`&&(!Array.isArray(i)&&i.type===`text`&&(i.value=$p(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=$p(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function Yp(e,t){e.position&&(t.position=ul(e))}function Xp(e,t){let n=t;if(e&&e.data){let t=e.data.hName,r=e.data.hChildren,i=e.data.hProperties;typeof t==`string`&&(n.type===`element`?n.tagName=t:n={type:`element`,tagName:t,properties:{},children:`children`in n?n.children:[n]}),n.type===`element`&&i&&Object.assign(n.properties,Ap(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function Zp(e,t){let n=t.data||{},r=`value`in t&&!(Kp.call(n,`hProperties`)||Kp.call(n,`hChildren`))?{type:`text`,value:t.value}:{type:`element`,tagName:`div`,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Qp(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
|
|
24
|
-
`});++r<e.length;)r&&n.push({type:`text`,value:`
|
|
25
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
|
|
26
|
-
`}),n}function $p(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function em(e,t){let n=Jp(e,t),r=n.one(e,void 0),i=Np(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
|
|
27
|
-
`},i)),a}function tm(e,t){return e&&`run`in e?async function(n,r){let i=em(n,{file:r,...t});await e.run(i,r)}:function(n,r){return em(n,{file:r,...e||t})}}function nm(e){if(e)throw e}var rm=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return typeof Array.isArray==`function`?Array.isArray(e):r.call(e)===`[object Array]`},s=function(e){if(!e||r.call(e)!==`[object Object]`)return!1;var t=n.call(e,`constructor`),i=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,`isPrototypeOf`);if(e.constructor&&!t&&!i)return!1;for(var a in e);return a===void 0||n.call(e,a)},c=function(e,t){i&&t.name===`__proto__`?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},l=function(e,t){if(t===`__proto__`){if(!n.call(e,t))return;if(a)return a(e,t).value}return e[t]};t.exports=function e(){var t,n,r,i,a,u,d=arguments[0],f=1,p=arguments.length,m=!1;for(typeof d==`boolean`&&(m=d,d=arguments[1]||{},f=2),(d==null||typeof d!=`object`&&typeof d!=`function`)&&(d={});f<p;++f)if(t=arguments[f],t!=null)for(n in t)r=l(d,n),i=l(t,n),d!==i&&(m&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},c(d,{name:n,newValue:e(m,u,i)})):i!==void 0&&c(d,{name:n,newValue:i}));return d}}));function im(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function am(){let e=[],t={run:n,use:r};return t;function n(...t){let n=-1,r=t.pop();if(typeof r!=`function`)throw TypeError(`Expected function as last argument, not `+r);i(null,...t);function i(a,...o){let s=e[++n],c=-1;if(a)r(a);else{for(;++c<t.length;)(o[c]===null||o[c]===void 0)&&(o[c]=t[c]);t=o,s?om(s,i)(...o):r(null,...o)}}}function r(n){if(typeof n!=`function`)throw TypeError("Expected `middelware` to be a function, not "+n);return e.push(n),t}}function om(e,t){let n;return r;function r(...t){let r=e.length>t.length,o;r&&t.push(i);try{o=e.apply(this,t)}catch(e){let t=e;if(r&&n)throw t;return i(t)}r||(o&&o.then&&typeof o.then==`function`?o.then(a,i):o instanceof Error?i(o):a(o))}function i(e,...r){n||(n=!0,t(e,...r))}function a(e){i(null,e)}}var sm={basename:cm,dirname:lm,extname:um,join:dm,sep:`/`};function cm(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);mm(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?``:e.slice(n,r)}if(t===e)return``;let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function lm(e){if(mm(e),e.length===0)return`.`;let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||=!0;return t<0?e.codePointAt(0)===47?`/`:`.`:t===1&&e.codePointAt(0)===47?`//`:e.slice(0,t)}function um(e){mm(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}}else n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?``:e.slice(i,n)}function dm(...e){let t=-1,n;for(;++t<e.length;)mm(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:fm(n)}function fm(e){mm(e);let t=e.codePointAt(0)===47,n=pm(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function pm(e,t){let n=``,r=0,i=-1,a=0,o=-1,s,c;for(;++o<=e.length;){if(o<e.length)s=e.codePointAt(o);else if(s===47)break;else s=47;if(s===47){if(i!==o-1&&a!==1){if(i!==o-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf(`/`),c!==n.length-1){c<0?(n=``,r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf(`/`)),i=o,a=0;continue}}else if(n.length>0){n=``,r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+`/..`:`..`,r=2)}else n.length>0?n+=`/`+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1}i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function mm(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var hm={cwd:gm};function gm(){return`/`}function _m(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function vm(e){if(typeof e==`string`)e=new URL(e);else if(!_m(e)){let t=TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code=`ERR_INVALID_ARG_TYPE`,t}if(e.protocol!==`file:`){let e=TypeError(`The URL must be of scheme file`);throw e.code=`ERR_INVALID_URL_SCHEME`,e}return ym(e)}function ym(e){if(e.hostname!==``){let e=TypeError(`File URL host must be "localhost" or empty on darwin`);throw e.code=`ERR_INVALID_FILE_URL_HOST`,e}let t=e.pathname,n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){let e=t.codePointAt(n+2);if(e===70||e===102){let e=TypeError(`File URL path must not include encoded / characters`);throw e.code=`ERR_INVALID_FILE_URL_PATH`,e}}return decodeURIComponent(t)}var bm=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],xm=class{constructor(e){let t;t=e?_m(e)?{path:e}:typeof e==`string`||Tm(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:hm.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<bm.length;){let e=bm[n];e in t&&t[e]!==void 0&&t[e]!==null&&(this[e]=e===`history`?[...t[e]]:t[e])}let r;for(r in t)bm.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?sm.basename(this.path):void 0}set basename(e){Cm(e,`basename`),Sm(e,`basename`),this.path=sm.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?sm.dirname(this.path):void 0}set dirname(e){wm(this.basename,`dirname`),this.path=sm.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?sm.extname(this.path):void 0}set extname(e){if(Sm(e,`extname`),wm(this.dirname,`extname`),e){if(e.codePointAt(0)!==46)throw Error("`extname` must start with `.`");if(e.includes(`.`,1))throw Error("`extname` cannot contain multiple dots")}this.path=sm.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){_m(e)&&(e=vm(e)),Cm(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?sm.basename(this.path,this.extname):void 0}set stem(e){Cm(e,`stem`),Sm(e,`stem`),this.path=sm.join(this.dirname||``,e+(this.extname||``))}fail(e,t,n){let r=this.message(e,t,n);throw r.fatal=!0,r}info(e,t,n){let r=this.message(e,t,n);return r.fatal=void 0,r}message(e,t,n){let r=new q(e,t,n);return this.path&&(r.name=this.path+`:`+r.name,r.file=this.path),r.fatal=!1,this.messages.push(r),r}toString(e){return this.value===void 0?``:typeof this.value==`string`?this.value:new TextDecoder(e||void 0).decode(this.value)}};function Sm(e,t){if(e&&e.includes(sm.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+sm.sep+"`")}function Cm(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function wm(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Tm(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Em=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),Dm=t(rm(),1),Om={}.hasOwnProperty,km=new class e extends Em{constructor(){super(`copy`),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=am()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,Dm.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(Mm(`data`,this.frozen),this.namespace[e]=t,this):Om.call(this.namespace,e)&&this.namespace[e]||void 0:e?(Mm(`data`,this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;let e=this;for(;++this.freezeIndex<this.attachers.length;){let[t,...n]=this.attachers[this.freezeIndex];if(n[0]===!1)continue;n[0]===!0&&(n[0]=void 0);let r=t.call(e,...n);typeof r==`function`&&this.transformers.use(r)}return this.frozen=!0,this.freezeIndex=1/0,this}parse(e){this.freeze();let t=Fm(e),n=this.parser||this.Parser;return Am(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),Am(`process`,this.parser||this.Parser),jm(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=Fm(e),o=n.parse(a);n.run(o,a,function(e,t,r){if(e||!t||!r)return s(e);let i=t,a=n.stringify(i,r);Lm(a)?r.value=a:r.result=a,s(e,r)});function s(e,n){e||!n?i(e):r?r(n):t(void 0,n)}}}processSync(e){let t=!1,n;return this.freeze(),Am(`processSync`,this.parser||this.Parser),jm(`processSync`,this.compiler||this.Compiler),this.process(e,r),Pm(`processSync`,`process`,t),n;function r(e,r){t=!0,nm(e),n=r}}run(e,t,n){Nm(e),this.freeze();let r=this.transformers;return!n&&typeof t==`function`&&(n=t,t=void 0),n?i(void 0,n):new Promise(i);function i(i,a){let o=Fm(t);r.run(e,o,s);function s(t,r,o){let s=r||e;t?a(t):i?i(s):n(void 0,s,o)}}}runSync(e,t){let n=!1,r;return this.run(e,t,i),Pm(`runSync`,`run`,n),r;function i(e,t){nm(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=Fm(t),r=this.compiler||this.Compiler;return jm(`stringify`,r),Nm(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(Mm(`use`,this.frozen),e!=null){if(typeof e==`function`)s(e,t);else if(typeof e==`object`)Array.isArray(e)?o(e):a(e);else throw TypeError("Expected usable value, not `"+e+"`")}return this;function i(e){if(typeof e==`function`)s(e,[]);else if(typeof e==`object`){if(Array.isArray(e)){let[t,...n]=e;s(t,n)}else a(e)}else throw TypeError("Expected usable value, not `"+e+"`")}function a(e){if(!(`plugins`in e)&&!(`settings`in e))throw Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");o(e.plugins),e.settings&&(r.settings=(0,Dm.default)(!0,r.settings,e.settings))}function o(e){let t=-1;if(e!=null){if(Array.isArray(e))for(;++t<e.length;){let n=e[t];i(n)}else throw TypeError("Expected a list of plugins, not `"+e+"`")}}function s(e,t){let r=-1,i=-1;for(;++r<n.length;)if(n[r][0]===e){i=r;break}if(i===-1)n.push([e,...t]);else if(t.length>0){let[r,...a]=t,o=n[i][1];im(o)&&im(r)&&(r=(0,Dm.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function Am(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function jm(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function Mm(e,t){if(t)throw Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Nm(e){if(!im(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function Pm(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function Fm(e){return Im(e)?e:new xm(e)}function Im(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function Lm(e){return typeof e==`string`||Rm(e)}function Rm(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var zm=[],Bm={allowDangerousHtml:!0},Vm=/^(https?|ircs?|mailto|xmpp)$/i,Hm=[{from:`astPlugins`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowDangerousHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`allowNode`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowElement`},{from:`allowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`allowedElements`},{from:`className`,id:`remove-classname`},{from:`disallowedTypes`,id:`replace-allownode-allowedtypes-and-disallowedtypes`,to:`disallowedElements`},{from:`escapeHtml`,id:`remove-buggy-html-in-markdown-parser`},{from:`includeElementIndex`,id:`#remove-includeelementindex`},{from:`includeNodeIndex`,id:`change-includenodeindex-to-includeelementindex`},{from:`linkTarget`,id:`remove-linktarget`},{from:`plugins`,id:`change-plugins-to-remarkplugins`,to:`remarkPlugins`},{from:`rawSourcePos`,id:`#remove-rawsourcepos`},{from:`renderers`,id:`change-renderers-to-components`,to:`components`},{from:`source`,id:`change-source-to-children`,to:`children`},{from:`sourcePos`,id:`#remove-sourcepos`},{from:`transformImageUri`,id:`#add-urltransform`,to:`urlTransform`},{from:`transformLinkUri`,id:`#add-urltransform`,to:`urlTransform`}];function Um(e){let t=Wm(e),n=Gm(e);return Km(t.runSync(t.parse(n),n),e)}function Wm(e){let t=e.rehypePlugins||zm,n=e.remarkPlugins||zm,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Bm}:Bm;return km().use(Vf).use(n).use(tm,r).use(t)}function Gm(e){let t=e.children||``,n=new xm;return typeof t==`string`?n.value=t:``+t,n}function Km(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||qm;for(let e of Hm)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return Gp(e,l),Sl(e,{Fragment:B.Fragment,components:i,ignoreInvalidStyle:!0,jsx:B.jsx,jsxs:B.jsxs,passKeys:!0,passNode:!0});function l(e,t,i){if(e.type===`raw`&&i&&typeof t==`number`)return o?i.children.splice(t,1):i.children[t]={type:`text`,value:e.value},t;if(e.type===`element`){let t;for(t in Wl)if(Object.hasOwn(Wl,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=Wl[t];(r===null||r.includes(e.tagName))&&(e.properties[t]=c(String(n||``),t,e))}}if(e.type===`element`){let o=n?!n.includes(e.tagName):a?a.includes(e.tagName):!1;if(!o&&r&&typeof t==`number`&&(o=!r(e,t,i)),o&&i&&typeof t==`number`)return s&&e.children?i.children.splice(t,1,...e.children):i.children.splice(t,1),t}}}function qm(e){let t=e.indexOf(`:`),n=e.indexOf(`?`),r=e.indexOf(`#`),i=e.indexOf(`/`);return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||Vm.test(e.slice(0,t))?e:``}var Jm=[`script`,`iframe`,`object`,`embed`,`style`];function Ym(e){if(!e)return``;if(e.startsWith(`#`))return e;let t=e.indexOf(`:`);if(t===-1)return``;let n=e.slice(0,t).toLowerCase();return n===`https`||n===`http`||n===`mailto`?e:``}function Xm(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function Zm(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function Qm(e,t,n){let r=Pp((n||{}).ignore||[]),i=$m(t),a=-1;for(;++a<i.length;)Up(e,`text`,o);function o(e,t){let n=-1,i;for(;++n<t.length;){let e=t[n],a=i?i.children:void 0;if(r(e,a?a.indexOf(e):void 0,i))return;i=e}if(i)return s(e,t)}function s(e,t){let n=t[t.length-1],r=i[a][0],o=i[a][1],s=0,c=n.children.indexOf(e),l=!1,u=[];r.lastIndex=0;let d=r.exec(e.value);for(;d;){let n=d.index,i={index:d.index,input:d.input,stack:[...t,e]},a=o(...d,i);if(typeof a==`string`&&(a=a.length>0?{type:`text`,value:a}:void 0),a===!1?r.lastIndex=n+1:(s!==n&&u.push({type:`text`,value:e.value.slice(s,n)}),Array.isArray(a)?u.push(...a):a&&u.push(a),s=n+d[0].length,l=!0),!r.global)break;d=r.exec(e.value)}return l?(s<e.value.length&&u.push({type:`text`,value:e.value.slice(s)}),n.children.splice(c,1,...u)):u=[e],c+u.length}}function $m(e){let t=[];if(!Array.isArray(e))throw TypeError(`Expected find and replace tuple or list of tuples`);let n=!e[0]||Array.isArray(e[0])?e:[e],r=-1;for(;++r<n.length;){let e=n[r];t.push([eh(e[0]),th(e[1])])}return t}function eh(e){return typeof e==`string`?new RegExp(Zm(e),`g`):e}function th(e){return typeof e==`function`?e:function(){return e}}var nh=`phrasing`,rh=[`autolink`,`link`,`image`,`label`];function ih(){return{transforms:[fh],enter:{literalAutolink:oh,literalAutolinkEmail:sh,literalAutolinkHttp:sh,literalAutolinkWww:sh},exit:{literalAutolink:dh,literalAutolinkEmail:uh,literalAutolinkHttp:ch,literalAutolinkWww:lh}}}function ah(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:nh,notInConstruct:rh},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:nh,notInConstruct:rh},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:nh,notInConstruct:rh}]}}function oh(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function sh(e){this.config.enter.autolinkProtocol.call(this,e)}function ch(e){this.config.exit.autolinkProtocol.call(this,e)}function lh(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url=`http://`+this.sliceSerialize(e)}function uh(e){this.config.exit.autolinkEmail.call(this,e)}function dh(e){this.exit(e)}function fh(e){Qm(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,ph],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,mh]],{ignore:[`link`,`linkReference`]})}function ph(e,t,n,r,i){let a=``;if(!_h(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!hh(n)))return!1;let o=gh(n+r);if(!o[0])return!1;let s={type:`link`,title:null,url:a+t+o[0],children:[{type:`text`,value:t+o[0]}]};return o[1]?[s,{type:`text`,value:o[1]}]:s}function mh(e,t,n,r){return!_h(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function hh(e){let t=e.split(`.`);return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function gh(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(`)`),i=Xm(e,`(`),a=Xm(e,`)`);for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(`)`),a++;return[e,n]}function _h(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||hu(n)||mu(n))&&(!t||n!==47)}Dh.peek=Eh;function vh(){this.buffer()}function yh(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function bh(){this.buffer()}function xh(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function Sh(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=au(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ch(e){this.exit(e)}function wh(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=au(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Th(e){this.exit(e)}function Eh(){return`[`}function Dh(e,t,n,r){let i=n.createTracker(r),a=i.move(`[^`),o=n.enter(`footnoteReference`),s=n.enter(`reference`);return a+=i.move(n.safe(n.associationId(e),{after:`]`,before:a})),s(),o(),a+=i.move(`]`),a}function Oh(){return{enter:{gfmFootnoteCallString:vh,gfmFootnoteCall:yh,gfmFootnoteDefinitionLabelString:bh,gfmFootnoteDefinition:xh},exit:{gfmFootnoteCallString:Sh,gfmFootnoteCall:Ch,gfmFootnoteDefinitionLabelString:wh,gfmFootnoteDefinition:Th}}}function kh(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Dh},unsafe:[{character:`[`,inConstruct:[`label`,`phrasing`,`reference`]}]};function n(e,n,r,i){let a=r.createTracker(i),o=a.move(`[^`),s=r.enter(`footnoteDefinition`),c=r.enter(`label`);return o+=a.move(r.safe(r.associationId(e),{before:o,after:`]`})),c(),o+=a.move(`]:`),e.children&&e.children.length>0&&(a.shift(4),o+=a.move((t?`
|
|
28
|
-
`:` `)+r.indentLines(r.containerFlow(e,a.current()),t?jh:Ah))),s(),o}}function Ah(e,t,n){return t===0?e:jh(e,t,n)}function jh(e,t,n){return(n?``:` `)+e}var Mh=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];Lh.peek=Rh;function Nh(){return{canContainEols:[`delete`],enter:{strikethrough:Fh},exit:{strikethrough:Ih}}}function Ph(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:Mh}],handlers:{delete:Lh}}}function Fh(e){this.enter({type:`delete`,children:[]},e)}function Ih(e){this.exit(e)}function Lh(e,t,n,r){let i=n.createTracker(r),a=n.enter(`strikethrough`),o=i.move(`~~`);return o+=n.containerPhrasing(e,{...i.current(),before:o,after:`~`}),o+=i.move(`~~`),a(),o}function Rh(){return`~`}function zh(e){return e.length}function Bh(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||zh,a=[],o=[],s=[],c=[],l=0,u=-1;for(;++u<e.length;){let t=[],r=[],a=-1;for(e[u].length>l&&(l=e[u].length);++a<e[u].length;){let o=Vh(e[u][a]);if(n.alignDelimiters!==!1){let e=i(o);r[a]=e,(c[a]===void 0||e>c[a])&&(c[a]=e)}t.push(o)}o[u]=t,s[u]=r}let d=-1;if(typeof r==`object`&&`length`in r)for(;++d<l;)a[d]=Hh(r[d]);else{let e=Hh(r);for(;++d<l;)a[d]=e}d=-1;let f=[],p=[];for(;++d<l;){let e=a[d],t=``,r=``;e===99?(t=`:`,r=`:`):e===108?t=`:`:e===114&&(r=`:`);let i=n.alignDelimiters===!1?1:Math.max(1,c[d]-t.length-r.length),o=t+`-`.repeat(i)+r;n.alignDelimiters!==!1&&(i=t.length+i+r.length,i>c[d]&&(c[d]=i),p[d]=i),f[d]=o}o.splice(1,0,f),s.splice(1,0,p),u=-1;let m=[];for(;++u<o.length;){let e=o[u],t=s[u];d=-1;let r=[];for(;++d<l;){let i=e[d]||``,o=``,s=``;if(n.alignDelimiters!==!1){let e=c[d]-(t[d]||0),n=a[d];n===114?o=` `.repeat(e):n===99?e%2?(o=` `.repeat(e/2+.5),s=` `.repeat(e/2-.5)):(o=` `.repeat(e/2),s=o):s=` `.repeat(e)}n.delimiterStart!==!1&&!d&&r.push(`|`),n.padding!==!1&&(n.alignDelimiters!==!1||i!==``)&&(n.delimiterStart!==!1||d)&&r.push(` `),n.alignDelimiters!==!1&&r.push(o),r.push(i),n.alignDelimiters!==!1&&r.push(s),n.padding!==!1&&r.push(` `),(n.delimiterEnd!==!1||d!==l-1)&&r.push(`|`)}m.push(n.delimiterEnd===!1?r.join(``).replace(/ +$/,``):r.join(``))}return m.join(`
|
|
29
|
-
`)}function Vh(e){return e==null?``:String(e)}function Hh(e){let t=typeof e==`string`?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function Uh(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),Wh);return i(),o}function Wh(e,t,n){return`>`+(n?``:` `)+e}function Gh(e,t){return Kh(e,t.inConstruct,!0)&&!Kh(e,t.notInConstruct,!1)}function Kh(e,t,n){if(typeof t==`string`&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function qh(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
|
|
30
|
-
`&&Gh(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
|
|
31
|
-
`}function Jh(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!=`string`)throw TypeError(`Expected substring`);for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function Yh(e,t){return!(t.options.fences!==!1||!e.value||e.lang||!/[^ \r\n]/.test(e.value)||/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function Xh(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Zh(e,t,n,r){let i=Xh(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(Yh(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,Qh);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(Jh(a,i)+1,3)),l=n.enter(`codeFenced`),u=s.move(c);if(e.lang){let t=n.enter(`codeFencedLang${o}`);u+=s.move(n.safe(e.lang,{before:u,after:` `,encode:["`"],...s.current()})),t()}if(e.lang&&e.meta){let t=n.enter(`codeFencedMeta${o}`);u+=s.move(` `),u+=s.move(n.safe(e.meta,{before:u,after:`
|
|
32
|
-
`,encode:["`"],...s.current()})),t()}return u+=s.move(`
|
|
33
|
-
`),a&&(u+=s.move(a+`
|
|
34
|
-
`)),u+=s.move(c),l(),u}function Qh(e,t,n){return(n?``:` `)+e}function $h(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function eg(e,t,n,r){let i=$h(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`definition`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`[`);return l+=c.move(n.safe(n.associationId(e),{before:l,after:`]`,...c.current()})),l+=c.move(`]: `),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`
|
|
35
|
-
`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),o(),l}function tg(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function ng(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function rg(e,t,n){let r=wu(e),i=wu(t);return r===void 0?i===void 0?n===`_`?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}ig.peek=ag;function ig(e,t,n,r){let i=tg(n),a=n.enter(`emphasis`),o=n.createTracker(r),s=o.move(i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=rg(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=ng(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=rg(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+ng(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function ag(e,t,n){return n.options.emphasis||`*`}function og(e,t){let n=!1;return Gp(e,function(e){if(`value`in e&&/\r?\n|\r/.test(e.value)||e.type===`break`)return n=!0,!1}),!!((!e.depth||e.depth<3)&&Kl(e)&&(t.options.setext||n))}function sg(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(og(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
|
|
36
|
-
`,after:`
|
|
37
|
-
`});return r(),t(),o+`
|
|
38
|
-
`+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
|
|
39
|
-
`))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
|
|
40
|
-
`,...a.current()});return/^[\t ]/.test(l)&&(l=ng(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}cg.peek=lg;function cg(e){return e.value||``}function lg(){return`<`}ug.peek=dg;function ug(e,t,n,r){let i=$h(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.enter(`image`),s=n.enter(`label`),c=n.createTracker(r),l=c.move(`![`);return l+=c.move(n.safe(e.alt,{before:l,after:`]`,...c.current()})),l+=c.move(`](`),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter(`destinationLiteral`),l+=c.move(`<`),l+=c.move(n.safe(e.url,{before:l,after:`>`,...c.current()})),l+=c.move(`>`)):(s=n.enter(`destinationRaw`),l+=c.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...c.current()}))),s(),e.title&&(s=n.enter(`title${a}`),l+=c.move(` `+i),l+=c.move(n.safe(e.title,{before:l,after:i,...c.current()})),l+=c.move(i),s()),l+=c.move(`)`),o(),l}function dg(){return`!`}fg.peek=pg;function fg(e,t,n,r){let i=e.referenceType,a=n.enter(`imageReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`![`),l=n.safe(e.alt,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function pg(){return`!`}mg.peek=hg;function mg(e,t,n){let r=e.value||``,i="`",a=-1;for(;RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=` `+r+` `);++a<n.unsafe.length;){let e=n.unsafe[a],t=n.compilePattern(e),i;if(e.atBreak)for(;i=t.exec(r);){let e=i.index;r.charCodeAt(e)===10&&r.charCodeAt(e-1)===13&&e--,r=r.slice(0,e)+` `+r.slice(i.index+1)}}return i+r+i}function hg(){return"`"}function gg(e,t){let n=Kl(e);return!(t.options.resourceLink||!e.url||e.title||!e.children||e.children.length!==1||e.children[0].type!==`text`||n!==e.url&&`mailto:`+n!==e.url||!/^[a-z][a-z+.-]+:/i.test(e.url)||/[\0- <>\u007F]/.test(e.url))}_g.peek=vg;function _g(e,t,n,r){let i=$h(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(gg(e,n)){let t=n.stack;n.stack=[],s=n.enter(`autolink`);let r=o.move(`<`);return r+=o.move(n.containerPhrasing(e,{before:r,after:`>`,...o.current()})),r+=o.move(`>`),s(),n.stack=t,r}s=n.enter(`link`),c=n.enter(`label`);let l=o.move(`[`);return l+=o.move(n.containerPhrasing(e,{before:l,after:`](`,...o.current()})),l+=o.move(`](`),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter(`destinationLiteral`),l+=o.move(`<`),l+=o.move(n.safe(e.url,{before:l,after:`>`,...o.current()})),l+=o.move(`>`)):(c=n.enter(`destinationRaw`),l+=o.move(n.safe(e.url,{before:l,after:e.title?` `:`)`,...o.current()}))),c(),e.title&&(c=n.enter(`title${a}`),l+=o.move(` `+i),l+=o.move(n.safe(e.title,{before:l,after:i,...o.current()})),l+=o.move(i),c()),l+=o.move(`)`),s(),l}function vg(e,t,n){return gg(e,n)?`<`:`[`}yg.peek=bg;function yg(e,t,n,r){let i=e.referenceType,a=n.enter(`linkReference`),o=n.enter(`label`),s=n.createTracker(r),c=s.move(`[`),l=n.containerPhrasing(e,{before:c,after:`]`,...s.current()});c+=s.move(l+`][`),o();let u=n.stack;n.stack=[],o=n.enter(`reference`);let d=n.safe(n.associationId(e),{before:c,after:`]`,...s.current()});return o(),n.stack=u,a(),i===`full`||!l||l!==d?c+=s.move(d+`]`):i===`shortcut`?c=c.slice(0,-1):c+=s.move(`]`),c}function bg(){return`[`}function xg(e){let t=e.options.bullet||`*`;if(t!==`*`&&t!==`+`&&t!==`-`)throw Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Sg(e){let t=xg(e),n=e.options.bulletOther;if(!n)return t===`*`?`-`:`*`;if(n!==`*`&&n!==`+`&&n!==`-`)throw Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function Cg(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function wg(e){let t=e.options.rule||`*`;if(t!==`*`&&t!==`-`&&t!==`_`)throw Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function Tg(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?Cg(n):xg(n),s=e.ordered?o===`.`?`)`:`.`:Sg(n),c=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let t=e.children?e.children[0]:void 0;if((o===`*`||o===`-`)&&t&&(!t.children||!t.children[0])&&n.stack[n.stack.length-1]===`list`&&n.stack[n.stack.length-2]===`listItem`&&n.stack[n.stack.length-3]===`list`&&n.stack[n.stack.length-4]===`listItem`&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),wg(n)===o&&t){let t=-1;for(;++t<e.children.length;){let n=e.children[t];if(n&&n.type===`listItem`&&n.children&&n.children[0]&&n.children[0].type===`thematicBreak`){c=!0;break}}}}c&&(o=s),n.bulletCurrent=o;let l=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=a,i(),l}function Eg(e){let t=e.options.listItemIndent||`one`;if(t!==`tab`&&t!==`one`&&t!==`mixed`)throw Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Dg(e,t,n,r){let i=Eg(n),a=n.bulletCurrent||xg(n);t&&t.type===`list`&&t.ordered&&(a=(typeof t.start==`number`&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i===`tab`||i===`mixed`&&(t&&t.type===`list`&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+` `.repeat(o-a.length)),s.shift(o);let c=n.enter(`listItem`),l=n.indentLines(n.containerFlow(e,s.current()),u);return c(),l;function u(e,t,n){return t?(n?``:` `.repeat(o))+e:(n?a:a+` `.repeat(o-a.length))+e}}function Og(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var kg=Pp([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function Ag(e,t,n,r){return(e.children.some(function(e){return kg(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function jg(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Mg.peek=Ng;function Mg(e,t,n,r){let i=jg(n),a=n.enter(`strong`),o=n.createTracker(r),s=o.move(i+i),c=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),l=c.charCodeAt(0),u=rg(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=ng(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=rg(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+ng(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function Ng(e,t,n){return n.options.strong||`*`}function Pg(e,t,n,r){return n.safe(e.value,r)}function Fg(e){let t=e.options.ruleRepetition||3;if(t<3)throw Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Ig(e,t,n){let r=(wg(n)+(n.options.ruleSpaces?` `:``)).repeat(Fg(n));return n.options.ruleSpaces?r.slice(0,-1):r}var Lg={blockquote:Uh,break:qh,code:Zh,definition:eg,emphasis:ig,hardBreak:qh,heading:sg,html:cg,image:ug,imageReference:fg,inlineCode:mg,link:_g,linkReference:yg,list:Tg,listItem:Dg,paragraph:Og,root:Ag,strong:Mg,text:Pg,thematicBreak:Ig};function Rg(){return{enter:{table:zg,tableData:Ug,tableHeader:Ug,tableRow:Vg},exit:{codeText:Wg,table:Bg,tableData:Hg,tableHeader:Hg,tableRow:Hg}}}function zg(e){let t=e._align;this.enter({type:`table`,align:t.map(function(e){return e===`none`?null:e}),children:[]},e),this.data.inTable=!0}function Bg(e){this.exit(e),this.data.inTable=void 0}function Vg(e){this.enter({type:`tableRow`,children:[]},e)}function Hg(e){this.exit(e)}function Ug(e){this.enter({type:`tableCell`,children:[]},e)}function Wg(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Gg));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Gg(e,t){return t===`|`?t:e}function Kg(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
|
|
41
|
-
`,inConstruct:`tableCell`},{atBreak:!0,character:`|`,after:`[ :-]`},{character:`|`,inConstruct:`tableCell`},{atBreak:!0,character:`:`,after:`-`},{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{inlineCode:f,table:o,tableCell:c,tableRow:s}};function o(e,t,n,r){return l(u(e,n,r),e.align)}function s(e,t,n,r){let i=l([d(e,n,r)]);return i.slice(0,i.indexOf(`
|
|
42
|
-
`))}function c(e,t,n,r){let i=n.enter(`tableCell`),o=n.enter(`phrasing`),s=n.containerPhrasing(e,{...r,before:a,after:a});return o(),i(),s}function l(e,t){return Bh(e,{align:t,alignDelimiters:r,padding:n,stringLength:i})}function u(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`table`);for(;++i<r.length;)a[i]=d(r[i],t,n);return o(),a}function d(e,t,n){let r=e.children,i=-1,a=[],o=t.enter(`tableRow`);for(;++i<r.length;)a[i]=c(r[i],e,t,n);return o(),a}function f(e,t,n){let r=Lg.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function qg(){return{exit:{taskListCheckValueChecked:Yg,taskListCheckValueUnchecked:Yg,paragraph:Xg}}}function Jg(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:Zg}}}function Yg(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function Xg(e){let t=this.stack[this.stack.length-2];if(t&&t.type===`listItem`&&typeof t.checked==`boolean`){let e=this.stack[this.stack.length-1];e.type;let n=e.children[0];if(n&&n.type===`text`){let r=t.children,i=-1,a;for(;++i<r.length;){let e=r[i];if(e.type===`paragraph`){a=e;break}}a===e&&(n.value=n.value.slice(1),n.value.length===0?e.children.shift():e.position&&n.position&&typeof n.position.start.offset==`number`&&(n.position.start.column++,n.position.start.offset++,e.position.start=Object.assign({},n.position.start)))}}this.exit(e)}function Zg(e,t,n,r){let i=e.children[0],a=typeof e.checked==`boolean`&&i&&i.type===`paragraph`,o=`[`+(e.checked?`x`:` `)+`] `,s=n.createTracker(r);a&&s.move(o);let c=Lg.listItem(e,t,n,{...r,...s.current()});return a&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,l)),c;function l(e){return e+o}}function Qg(){return[ih(),Oh(),Nh(),Rg(),qg()]}function $g(e){return{extensions:[ah(),kh(e),Ph(),Kg(e),Jg()]}}var e_={tokenize:m_,partial:!0},t_={tokenize:h_,partial:!0},n_={tokenize:g_,partial:!0},r_={tokenize:__,partial:!0},i_={tokenize:v_,partial:!0},a_={name:`wwwAutolink`,tokenize:f_,previous:y_},o_={name:`protocolAutolink`,tokenize:p_,previous:b_},s_={name:`emailAutolink`,tokenize:d_,previous:x_},c_={};function l_(){return{text:c_}}for(var u_=48;u_<123;)c_[u_]=s_,u_++,u_===58?u_=65:u_===91&&(u_=97);c_[43]=s_,c_[45]=s_,c_[46]=s_,c_[95]=s_,c_[72]=[s_,o_],c_[104]=[s_,o_],c_[87]=[s_,a_],c_[119]=[s_,a_];function d_(e,t,n){let r=this,i,a;return o;function o(t){return!S_(t)||!x_.call(r,r.previous)||C_(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return S_(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(i_,u,l)(t):t===45||t===95||su(t)?(a=!0,e.consume(t),c):u(t)}function l(t){return e.consume(t),i=!0,c}function u(o){return a&&i&&ou(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function f_(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!y_.call(r,r.previous)||C_(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(e_,e.attempt(t_,e.attempt(n_,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function p_(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&b_.call(r,r.previous)&&!C_(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(ou(t)&&i.length<5)return i+=String.fromCodePoint(t),e.consume(t),s;if(t===58){let n=i.toLowerCase();if(n===`http`||n===`https`)return e.consume(t),c}return n(t)}function c(t){return t===47?(e.consume(t),a?l:(a=!0,c)):n(t)}function l(t){return t===null||lu(t)||pu(t)||hu(t)||mu(t)?n(t):e.attempt(t_,e.attempt(n_,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function m_(e,t,n){let r=0;return i;function i(t){return(t===87||t===119)&&r<3?(r++,e.consume(t),i):t===46&&r===3?(e.consume(t),a):n(t)}function a(e){return e===null?n(e):t(e)}}function h_(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(r_,c,s)(t):t===null||pu(t)||hu(t)||t!==45&&mu(t)?c(t):(a=!0,e.consume(t),o)}function s(t){return t===95?r=!0:(i=r,r=void 0),e.consume(t),o}function c(e){return i||r||!a?n(e):t(e)}}function g_(e,t){let n=0,r=0;return i;function i(o){return o===40?(n++,e.consume(o),i):o===41&&r<n?a(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(r_,t,a)(o):o===null||pu(o)||hu(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function __(e,t,n){return r;function r(o){return o===33||o===34||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===63||o===95||o===126?(e.consume(o),r):o===38?(e.consume(o),a):o===93?(e.consume(o),i):o===60||o===null||pu(o)||hu(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||pu(e)||hu(e)?t(e):r(e)}function a(e){return ou(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):ou(t)?(e.consume(t),o):n(t)}}function v_(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return su(e)?n(e):t(e)}}function y_(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||pu(e)}function b_(e){return!ou(e)}function x_(e){return!(e===47||S_(e))}function S_(e){return e===43||e===45||e===46||e===95||su(e)}function C_(e){let t=e.length,n=!1;for(;t--;){let r=e[t][1];if((r.type===`labelLink`||r.type===`labelImage`)&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var w_={tokenize:M_,partial:!0};function T_(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:k_,continuation:{tokenize:A_},exit:j_}},text:{91:{name:`gfmFootnoteCall`,tokenize:O_},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:E_,resolveTo:D_}}}}function E_(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let e=r.events[i][1];if(e.type===`labelImage`){o=e;break}if(e.type===`gfmFootnoteCall`||e.type===`labelLink`||e.type===`label`||e.type===`image`||e.type===`link`)break}return s;function s(i){if(!o||!o._balanced)return n(i);let s=au(r.sliceSerialize({start:o.end,end:r.now()}));return s.codePointAt(0)!==94||!a.includes(s.slice(1))?n(i):(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(i),e.exit(`gfmFootnoteCallLabelMarker`),t(i))}}function D_(e,t){let n=e.length;for(;n--;)if(e[n][1].type===`labelImage`&&e[n][0]===`enter`){e[n][1];break}e[n+1][1].type=`data`,e[n+3][1].type=`gfmFootnoteCallLabelMarker`;let r={type:`gfmFootnoteCall`,start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:`gfmFootnoteCallMarker`,start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let a={type:`gfmFootnoteCallString`,start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},o={type:`chunkString`,contentType:`string`,start:Object.assign({},a.start),end:Object.assign({},a.end)},s=[e[n+1],e[n+2],[`enter`,r,t],e[n+3],e[n+4],[`enter`,i,t],[`exit`,i,t],[`enter`,a,t],[`enter`,o,t],[`exit`,o,t],[`exit`,a,t],e[e.length-2],e[e.length-1],[`exit`,r,t]];return e.splice(n,e.length-n+1,...s),e}function O_(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(t){return e.enter(`gfmFootnoteCall`),e.enter(`gfmFootnoteCallLabelMarker`),e.consume(t),e.exit(`gfmFootnoteCallLabelMarker`),c}function c(t){return t===94?(e.enter(`gfmFootnoteCallMarker`),e.consume(t),e.exit(`gfmFootnoteCallMarker`),e.enter(`gfmFootnoteCallString`),e.enter(`chunkString`).contentType=`string`,l):n(t)}function l(s){if(a>999||s===93&&!o||s===null||s===91||pu(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(au(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return pu(s)||(o=!0),a++,e.consume(s),s===92?u:l}function u(t){return t===91||t===92||t===93?(e.consume(t),a++,l):l(t)}}function k_(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return c;function c(t){return e.enter(`gfmFootnoteDefinition`)._container=!0,e.enter(`gfmFootnoteDefinitionLabel`),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),l}function l(t){return t===94?(e.enter(`gfmFootnoteDefinitionMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionMarker`),e.enter(`gfmFootnoteDefinitionLabelString`),e.enter(`chunkString`).contentType=`string`,u):n(t)}function u(t){if(o>999||t===93&&!s||t===null||t===91||pu(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=au(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return pu(t)||(s=!0),o++,e.consume(t),t===92?d:u}function d(t){return t===91||t===92||t===93?(e.consume(t),o++,u):u(t)}function f(t){return t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),i.includes(a)||i.push(a),X(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function A_(e,t,n){return e.check(Mu,t,e.attempt(w_,t,n))}function j_(e){e.exit(`gfmFootnoteDefinition`)}function M_(e,t,n){let r=this;return X(e,i,`gfmFootnoteDefinitionIndent`,5);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`gfmFootnoteDefinitionIndent`&&i[2].sliceSerialize(i[1],!0).length===4?t(e):n(e)}}function N_(e){let t=(e||{}).singleTilde,n={name:`strikethrough`,tokenize:i,resolveAll:r};return t??=!0,{text:{126:n},insideSpan:{null:[n]},attentionMarkers:{null:[126]}};function r(e,t){let n=-1;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`strikethroughSequenceTemporary`&&e[n][1]._close){let r=n;for(;r--;)if(e[r][0]===`exit`&&e[r][1].type===`strikethroughSequenceTemporary`&&e[r][1]._open&&e[n][1].end.offset-e[n][1].start.offset===e[r][1].end.offset-e[r][1].start.offset){e[n][1].type=`strikethroughSequence`,e[r][1].type=`strikethroughSequence`;let i={type:`strikethrough`,start:Object.assign({},e[r][1].start),end:Object.assign({},e[n][1].end)},a={type:`strikethroughText`,start:Object.assign({},e[r][1].end),end:Object.assign({},e[n][1].start)},o=[[`enter`,i,t],[`enter`,e[r][1],t],[`exit`,e[r][1],t],[`enter`,a,t]],s=t.parser.constructs.insideSpan.null;s&&Ql(o,o.length,0,Tu(s,e.slice(r+1,n),t)),Ql(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),Ql(e,r-1,n-r+3,o),n=r+o.length-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`strikethroughSequenceTemporary`&&(e[n][1].type=`data`);return e}function i(e,n,r){let i=this.previous,a=this.events,o=0;return s;function s(t){return i===126&&a[a.length-1][1].type!==`characterEscape`?r(t):(e.enter(`strikethroughSequenceTemporary`),c(t))}function c(a){let s=wu(i);if(a===126)return o>1?r(a):(e.consume(a),o++,c);if(o<2&&!t)return r(a);let l=e.exit(`strikethroughSequenceTemporary`),u=wu(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var P_=class{constructor(){this.map=[]}add(e,t,n){F_(this,e,t,n)}consume(e){if(this.map.sort(function(e,t){return e[0]-t[0]}),this.map.length===0)return;let t=this.map.length,n=[];for(;t>0;)--t,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let r=n.pop();for(;r;){for(let t of r)e.push(t);r=n.pop()}this.map.length=0}};function F_(e,t,n,r){let i=0;if(n!==0||r.length!==0){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function I_(e,t){let n=!1,r=[];for(;t<e.length;){let i=e[t];if(n){if(i[0]===`enter`)i[1].type===`tableContent`&&r.push(e[t+1][1].type===`tableDelimiterMarker`?`left`:`none`);else if(i[1].type===`tableContent`){if(e[t-1][1].type===`tableDelimiterMarker`){let e=r.length-1;r[e]=r[e]===`left`?`center`:`right`}}else if(i[1].type===`tableDelimiterRow`)break}else i[0]===`enter`&&i[1].type===`tableDelimiterRow`&&(n=!0);t+=1}return r}function L_(){return{flow:{null:{name:`table`,tokenize:R_,resolveAll:z_}}}}function R_(e,t,n){let r=this,i=0,a=0,o;return s;function s(e){let t=r.events.length-1;for(;t>-1;){let e=r.events[t][1].type;if(e===`lineEnding`||e===`linePrefix`)t--;else break}let i=t>-1?r.events[t][1].type:null,a=i===`tableHead`||i===`tableRow`?S:c;return a===S&&r.parser.lazy[r.now().line]?n(e):a(e)}function c(t){return e.enter(`tableHead`),e.enter(`tableRow`),l(t)}function l(e){return e===124||(o=!0,a+=1),u(e)}function u(t){return t===null?n(t):J(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Y(t)?X(e,u,`whitespace`)(t):(a+=1,o&&(o=!1,i+=1),t===124?(e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),o=!0,u):(e.enter(`data`),d(t)))}function d(t){return t===null||t===124||pu(t)?(e.exit(`data`),u(t)):(e.consume(t),t===92?f:d)}function f(t){return t===92||t===124?(e.consume(t),d):d(t)}function p(t){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(t):(e.enter(`tableDelimiterRow`),o=!1,Y(t)?X(e,m,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):m(t))}function m(t){return t===45||t===58?g(t):t===124?(o=!0,e.enter(`tableCellDivider`),e.consume(t),e.exit(`tableCellDivider`),h):x(t)}function h(t){return Y(t)?X(e,g,`whitespace`)(t):g(t)}function g(t){return t===58?(a+=1,o=!0,e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),_):t===45?(a+=1,_(t)):t===null||J(t)?b(t):x(t)}function _(t){return t===45?(e.enter(`tableDelimiterFiller`),v(t)):x(t)}function v(t){return t===45?(e.consume(t),v):t===58?(o=!0,e.exit(`tableDelimiterFiller`),e.enter(`tableDelimiterMarker`),e.consume(t),e.exit(`tableDelimiterMarker`),y):(e.exit(`tableDelimiterFiller`),y(t))}function y(t){return Y(t)?X(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||J(n)?!o||i!==a?x(n):(e.exit(`tableDelimiterRow`),e.exit(`tableHead`),t(n)):x(n)}function x(e){return n(e)}function S(t){return e.enter(`tableRow`),C(t)}function C(n){return n===124?(e.enter(`tableCellDivider`),e.consume(n),e.exit(`tableCellDivider`),C):n===null||J(n)?(e.exit(`tableRow`),t(n)):Y(n)?X(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||pu(t)?(e.exit(`data`),C(t)):(e.consume(t),t===92?T:w)}function T(t){return t===92||t===124?(e.consume(t),w):w(t)}}function z_(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,l,u,d,f=new P_;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(V_(f,t,c,l,u),u=void 0,c=0),l={type:`table`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,l,t]])):m.type===`tableRow`||m.type===`tableDelimiterRow`?(r=!0,d=void 0,a=[0,0,0,0],o=[0,n+1,0,0],s&&(s=!1,u={type:`tableBody`,start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[[`enter`,u,t]])),i=m.type===`tableDelimiterRow`?2:u?3:1):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)?(r=!1,o[2]===0&&(a[1]!==0&&(o[0]=o[1],d=B_(f,t,a,i,void 0,d),a=[0,0,0,0]),o[2]=n)):m.type===`tableCellDivider`&&(r?r=!1:(a[1]!==0&&(o[0]=o[1],d=B_(f,t,a,i,void 0,d)),a=o,o=[a[1],n,0,0])):m.type===`tableHead`?(s=!0,c=n):m.type===`tableRow`||m.type===`tableDelimiterRow`?(c=n,a[1]===0?o[1]!==0&&(d=B_(f,t,o,i,n,d)):(o[0]=o[1],d=B_(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&V_(f,t,c,l,u),f.consume(t.events),n=-1;++n<t.events.length;){let e=t.events[n];e[0]===`enter`&&e[1].type===`table`&&(e[1]._align=I_(t.events,n))}return e}function B_(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},H_(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=H_(t.events,n[1]);if(a={type:o,start:Object.assign({},s),end:Object.assign({},s)},e.add(n[1],0,[[`enter`,a,t]]),n[2]!==0){let i=H_(t.events,n[2]),a=H_(t.events,n[3]),o={type:`tableContent`,start:Object.assign({},i),end:Object.assign({},a)};if(e.add(n[2],0,[[`enter`,o,t]]),r!==2){let r=t.events[n[2]],i=t.events[n[3]];if(r[1].end=Object.assign({},i[1].end),r[1].type=`chunkText`,r[1].contentType=`text`,n[3]>n[2]+1){let t=n[2]+1,r=n[3]-n[2]-1;e.add(t,r,[])}}e.add(n[3]+1,0,[[`exit`,o,t]])}return i!==void 0&&(a.end=Object.assign({},H_(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function V_(e,t,n,r,i){let a=[],o=H_(t.events,n);i&&(i.end=Object.assign({},o),a.push([`exit`,i,t])),r.end=Object.assign({},o),a.push([`exit`,r,t]),e.add(n+1,0,a)}function H_(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var U_={name:`tasklistCheck`,tokenize:G_};function W_(){return{text:{91:U_}}}function G_(e,t,n){let r=this;return i;function i(t){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(t):(e.enter(`taskListCheck`),e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),a)}function a(t){return pu(t)?(e.enter(`taskListCheckValueUnchecked`),e.consume(t),e.exit(`taskListCheckValueUnchecked`),o):t===88||t===120?(e.enter(`taskListCheckValueChecked`),e.consume(t),e.exit(`taskListCheckValueChecked`),o):n(t)}function o(t){return t===93?(e.enter(`taskListCheckMarker`),e.consume(t),e.exit(`taskListCheckMarker`),e.exit(`taskListCheck`),s):n(t)}function s(r){return J(r)?t(r):Y(r)?e.check({tokenize:K_},t,n)(r):n(r)}}function K_(e,t,n){return X(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function q_(e){return tu([l_(),T_(),N_(e),L_(),W_()])}var J_={};function Y_(e){let t=this,n=e||J_,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(q_(n)),a.push(Qg()),o.push($g(n))}var X_=/(?:(?<![A-Za-z0-9])[A-Za-z]:\\|\\\\[A-Za-z0-9_.$-]+\\)(?:\\\*|[^\s"`()\]<>|*]|\((?:\\\*|[^\s"`()\]<>|*])*\))*/g,Z_=/\\([!-/:-@[-`{-~])/g;function Q_(e){return e.replace(Z_,`$1`)}function $_(e,t){if(e.type===`text`&&typeof e.value==`string`){let n=e.position?.start.offset,r=e.position?.end.offset;if(n===void 0||r===void 0)return;let i=t.slice(n,r);if(!i.includes(`\\`))return;let a=e.value,o=0;for(let e of i.matchAll(X_)){let t=e[0],n=Q_(t);if(n===t){let e=a.indexOf(t,o);e!==-1&&(o=e+t.length);continue}let r=a.indexOf(n,o);r!==-1&&(a=a.slice(0,r)+t+a.slice(r+n.length),o=r+t.length)}e.value=a}else e.children?.forEach(e=>$_(e,t))}function ev(){return(e,t)=>{typeof t.value==`string`&&$_(e,t.value)}}function tv(e){if(!e.children)return;let t=[];for(let n of e.children)n.type===`text`&&n.value?.includes(`
|
|
43
|
-
`)?n.value.split(`
|
|
44
|
-
`).forEach((e,n)=>{n>0&&t.push({type:`break`}),e&&t.push({type:`text`,value:e})}):(tv(n),t.push(n));e.children=t}function nv(){return e=>{tv(e)}}function rv(e){let t=e.toolArgs??{},n=[`command`,`file_path`,`path`,`url`,`query`,`name`].map(e=>t[e]).find(e=>typeof e==`string`&&e.trim());return typeof n==`string`?n:``}var iv=new Set([`run_shell_command`,`run_cli_command`,`wait_for_condition`]);function av(e){let t=e.split(`
|
|
45
|
-
`);if(t.length<2)return null;let n=!t[t.length-1].startsWith(`in `),r=n?t[t.length-1].trim():``,i=n?t.slice(0,-1):t,a=-1;for(let e=i.length-1;e>0;e--)if(i[e].startsWith(`in `)){a=e;break}return a<0?{command:i.join(`
|
|
46
|
-
`),folder:``,extras:``,note:r}:{command:i.slice(0,a).join(`
|
|
47
|
-
`),folder:i[a].slice(3).trim(),extras:i.slice(a+1).join(` `).trim(),note:r}}function ov({code:e,previewLines:t=12,testId:n=`perm-code`}){let[r,i]=(0,R.useState)(!1),a=e.replace(/^\n+|\n+$/g,``).split(`
|
|
48
|
-
`),o=a.length>t,s=(o&&!r?a.slice(0,t):a).join(`
|
|
49
|
-
`);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`pre`,{className:`perm-card-pre perm-card-code${r?` is-expanded`:``}`,"data-testid":n,children:s}),o&&(0,B.jsx)(`button`,{type:`button`,className:`perm-card-args-toggle`,onClick:()=>i(e=>!e),"aria-expanded":r,children:r?`Show less`:`Show all ${a.length} lines`})]})}function sv({sessionId:e}){let t=Cs((0,R.useMemo)(()=>Es(e),[e]));return t?(0,B.jsx)(lv,{notification:t},t.id):null}function cv(e){if(e<60)return`${e}s`;let t=Math.floor(e/60),n=e%60;return`${t}:${String(n).padStart(2,`0`)}`}function lv({notification:e}){let t=Cs(e=>e.respondToPermission),[n,r]=(0,R.useState)(!1),[i,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(!1),l=e.timeoutSeconds!=null&&e.timeoutSeconds>0,u=(0,R.useRef)(l?Date.now()+e.timeoutSeconds*1e3:null),[d,f]=(0,R.useState)(l?e.timeoutSeconds:null),p=(0,R.useRef)(null),m=xs(e.tool),h=m?void 0:e.alwaysScope,g=e.alwaysLabel??h,_=e.alwaysLabel??(0,B.jsx)(`code`,{children:h}),v=Cs(t=>Ss(t.notifications,e)),y=!!h&&v>0,b=rv(e),x=e.toolArgs??{},S=Object.keys(x).length>0,C=typeof x._risk_note==`string`?x._risk_note:``,w=C&&typeof x.working_directory==`string`?x.working_directory:``,T=typeof x.code==`string`&&x.code.trim()?x.code:``,E=!S&&iv.has(e.tool??``)?av(e.summary??``):null;(0,R.useEffect)(()=>{p.current?.focus({preventScroll:!0})},[]),(0,R.useEffect)(()=>{if(u.current===null)return;let e=setInterval(()=>{let t=Math.max(0,Math.ceil((u.current-Date.now())/1e3));f(t),t===0&&clearInterval(e)},1e3);return()=>clearInterval(e)},[]);let D=(0,R.useCallback)(async n=>{r(!0),o(null);try{await t(e.id,n)}catch(e){o(e instanceof Error?e.message:String(e)),r(!1)}},[e.id,t]);(0,R.useEffect)(()=>{let e=e=>{e.key!==`Escape`||a(e)||d!==null&&d<=0||(e.preventDefault(),n||D(`deny`))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[D,n,d]);let O=d!==null&&d<=0;return(0,B.jsxs)(`section`,{ref:p,tabIndex:-1,className:`perm-card`,role:`alertdialog`,"aria-labelledby":`perm-${e.id}`,children:[(0,B.jsxs)(`div`,{className:`perm-card-head`,children:[(0,B.jsx)(dn,{size:16,className:`perm-card-icon`,"aria-hidden":`true`}),(0,B.jsxs)(`div`,{className:`perm-card-text`,children:[(0,B.jsx)(`h2`,{id:`perm-${e.id}`,className:`perm-card-title`,children:e.tool===`allow_path_access`?e.title:e.toolLabel?(0,B.jsxs)(B.Fragment,{children:[`Allow `,e.toolLabel,`?`]}):(0,B.jsxs)(B.Fragment,{children:[`Allow GAIA to use `,(0,B.jsx)(`code`,{children:e.tool}),`?`]})}),b&&C&&(0,B.jsx)(`pre`,{className:`perm-card-pre perm-card-exact`,children:b}),b&&!C&&(0,B.jsx)(`p`,{className:`perm-card-detail`,children:(0,B.jsx)(`code`,{children:b})}),w&&(0,B.jsxs)(`p`,{className:`perm-card-detail`,children:[`in `,(0,B.jsx)(`code`,{children:w})]}),C&&(0,B.jsx)(`p`,{className:`perm-card-risk`,role:`note`,children:C}),T&&(0,B.jsx)(ov,{code:T}),E&&(0,B.jsx)(`pre`,{className:`perm-card-pre perm-card-exact`,children:E.command}),E?.folder&&(0,B.jsxs)(`p`,{className:`perm-card-detail`,children:[`in `,(0,B.jsx)(`code`,{children:E.folder})]}),E?.extras&&(0,B.jsx)(`p`,{className:`perm-card-detail`,children:E.extras}),E?.note&&(0,B.jsx)(`p`,{className:`perm-card-risk`,role:`note`,children:E.note}),!b&&!T&&e.summary&&!E&&(0,B.jsx)(`p`,{className:`perm-card-detail`,children:e.summary}),m&&e.message&&(0,B.jsx)(`p`,{className:`perm-card-detail`,children:e.message})]}),d!==null&&!O&&(0,B.jsx)(`span`,{className:`perm-card-timer`,title:`Denied automatically when the time runs out`,children:cv(d)})]}),S&&(0,B.jsxs)(`div`,{className:`perm-card-args`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`perm-card-args-toggle`,onClick:()=>c(e=>!e),"aria-expanded":s,children:[(0,B.jsx)(ue,{size:13,className:s?`is-open`:``,"aria-hidden":`true`}),`Details`]}),s&&(0,B.jsx)(`pre`,{className:`perm-card-pre`,children:JSON.stringify(x,null,2)})]}),y&&!O&&(0,B.jsxs)(`p`,{className:`perm-card-hint`,children:[`You've allowed this `,v===1?`once`:`${v} times`,` already.`,` `,`Always allow stops asking about `,_,` in this chat.`]}),O?(0,B.jsx)(`p`,{className:`perm-card-detail`,children:`No answer in time, so GAIA was told no.`}):(0,B.jsxs)(`div`,{className:`perm-card-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`perm-btn is-primary`,onClick:()=>D(`allow`),disabled:n,children:e.tool===`allow_path_access`?`Allow for this chat`:`Allow once`}),h&&(0,B.jsxs)(`button`,{type:`button`,className:`perm-btn${y?` is-suggested`:``}`,onClick:()=>D(`always`),disabled:n,"aria-label":`Always allow ${g} in this chat`,children:[`Always allow `,_,` in this chat`]}),(0,B.jsx)(`button`,{type:`button`,className:`perm-btn`,onClick:()=>D(`deny`),disabled:n,children:`Deny`})]}),i&&(0,B.jsx)(`p`,{className:`perm-card-error`,role:`alert`,children:i})]})}function uv(e){return e?e.split(`
|
|
50
|
-
`).length:0}function dv(e){return uv(e)>15||e.length>1500}function fv(e,t=15){let n=uv(e);return n>t?`${n.toLocaleString(`en-US`)} lines`:`${e.length.toLocaleString(`en-US`)} characters`}function pv({expanded:e,onToggle:t,controls:n,collapsedLabel:r,expandedLabel:i,className:a}){return(0,B.jsxs)(`button`,{type:`button`,className:`expand-toggle${a?` ${a}`:``}`,onClick:t,"aria-expanded":e,"aria-controls":n,children:[e?(0,B.jsx)(fe,{size:13,"aria-hidden":`true`}):(0,B.jsx)(ce,{size:13,"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:e?i:r})]})}function mv(e){let t=e.replace(/\\(u[0-9a-fA-F]{0,3})?$/,``);try{return JSON.parse(`"${t}"`)}catch{return t}}function hv(e,t){let n=RegExp(`"${t}"\\s*:\\s*(\\d+)`).exec(e);return n?Number(n[1]):null}function gv(e,t){let n=RegExp(`"${t}"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)`).exec(e);return n?mv(n[1]):``}function _v(e){let t=e.trim();if(!t.startsWith(`{`))return null;let n;try{n=JSON.parse(t)}catch{return!/^\{\s*"truncated"\s*:\s*true\b/.test(t)||!/"head"\s*:\s*"/.test(t)?null:{head:gv(t,`head`),tail:gv(t,`tail`),originalChars:hv(t,`original_chars`),omittedChars:hv(t,`omitted_chars`),partial:!0}}if(!n||typeof n!=`object`)return null;let r=n;return r.truncated!==!0||typeof r.head!=`string`?null:{head:r.head,tail:typeof r.tail==`string`?r.tail:``,originalChars:typeof r.original_chars==`number`?r.original_chars:null,omittedChars:typeof r.omitted_chars==`number`?r.omitted_chars:null,partial:!1}}function vv(e){let t=e=>e.toLocaleString(`en-US`);return`Showing ${e.partial?`part of the output`:e.tail?`the first ${t(e.head.length)} and last ${t(e.tail.length)} characters`:`the first ${t(e.head.length)} characters`}${e.originalChars==null?``:` of ${t(e.originalChars)}`}${e.omittedChars==null?``:` (${t(e.omittedChars)} omitted)`}.`}function yv({text:e,renderShort:t}){let[n,r]=(0,R.useState)(!1),i=(0,R.useId)(),a=_v(e),o=a?a.tail?`${a.head}\n…\n${a.tail}`:a.head:e,s=uv(o)>25||o.length>2500;return(0,B.jsxs)(B.Fragment,{children:[a&&(0,B.jsx)(`div`,{className:`detail-result-note`,children:vv(a)}),(0,B.jsx)(`div`,{id:i,className:`detail-result-content${s&&!n?` is-collapsed`:``}`,children:a||s?o:t(o)}),s&&(0,B.jsx)(pv,{expanded:n,onToggle:()=>r(e=>!e),controls:i,collapsedLabel:`Expand (${fv(o,25)})`,expandedLabel:`Collapse`,className:`step-expand-toggle`})]})}var bv={search_file:{label:`Searched files`,activeLabel:`Searching files`,icon:nn},search_files:{label:`Searched files`,activeLabel:`Searching files`,icon:nn},search_file_content:{label:`Searched content`,activeLabel:`Searching content`,icon:nn},search_directory:{label:`Searched directory`,activeLabel:`Searching directory`,icon:nn},read_file:{label:`Read file`,activeLabel:`Reading file`,icon:qe},write_file:{label:`Wrote file`,activeLabel:`Writing file`,icon:Ge},get_file_info:{label:`Got file info`,activeLabel:`Getting file info`,icon:qe},browse_directory:{label:`Browsed directory`,activeLabel:`Browsing directory`,icon:Ze},list_directory:{label:`Listed directory`,activeLabel:`Listing directory`,icon:Ze},list_recent_files:{label:`Listed recent files`,activeLabel:`Listing recent files`,icon:Ze},analyze_data_file:{label:`Analyzed data`,activeLabel:`Analyzing data`,icon:ie},run_shell_command:{label:`Ran command`,activeLabel:`Running command`,icon:xn},execute_code:{label:`Executed code`,activeLabel:`Executing code`,icon:Te},query_documents:{label:`Queried documents`,activeLabel:`Querying documents`,icon:A},query_specific_file:{label:`Queried file`,activeLabel:`Querying file`,icon:A},search_indexed_chunks:{label:`Searched chunks`,activeLabel:`Searching chunks`,icon:A},semantic_search:{label:`Searched documents`,activeLabel:`Searching documents`,icon:A},evaluate_retrieval:{label:`Evaluated retrieval`,activeLabel:`Evaluating retrieval`,icon:A},index_document:{label:`Indexed document`,activeLabel:`Indexing document`,icon:Ne},index_documents:{label:`Indexed documents`,activeLabel:`Indexing documents`,icon:Ne},index_directory:{label:`Indexed directory`,activeLabel:`Indexing directory`,icon:Ne},index_file:{label:`Indexed file`,activeLabel:`Indexing file`,icon:Ne},list_indexed_documents:{label:`Listed documents`,activeLabel:`Listing documents`,icon:Ne},summarize_document:{label:`Summarized`,activeLabel:`Summarizing`,icon:qe},dump_document:{label:`Extracted text`,activeLabel:`Extracting text`,icon:qe},rag_status:{label:`Checked RAG status`,activeLabel:`Checking RAG`,icon:Ne},add_watch_directory:{label:`Added watch dir`,activeLabel:`Adding watch dir`,icon:Ze},web_search:{label:`Searched web`,activeLabel:`Searching web`,icon:dt},search_web:{label:`Searched web`,activeLabel:`Searching web`,icon:dt},fetch_page:{label:`Read web page`,activeLabel:`Reading web page`,icon:dt},fetch_webpage:{label:`Read web page`,activeLabel:`Reading web page`,icon:dt},analyze_data:{label:`Analyzed data`,activeLabel:`Analyzing data`,icon:ie},find_files:{label:`Found files`,activeLabel:`Finding files`,icon:nn},edit_file:{label:`Edited file`,activeLabel:`Editing file`,icon:Ge},recall:{label:`Recalled memory`,activeLabel:`Recalling memory`,icon:M},remember:{label:`Saved to memory`,activeLabel:`Saving to memory`,icon:M},update_memory:{label:`Updated memory`,activeLabel:`Updating memory`,icon:M},forget:{label:`Deleted from memory`,activeLabel:`Deleting from memory`,icon:M},search_past_conversations:{label:`Searched past chats`,activeLabel:`Searching past chats`,icon:M},request_user_input:{label:`Asked you`,activeLabel:`Asking you`,icon:Mt}},xv=new Set([`remember`,`recall`,`update_memory`,`forget`]);function Sv(e){return e.type===`tool`&&e.success!==!1&&xv.has(e.tool??``)}var Cv={label:`Used tool`,activeLabel:`Using tool`,icon:Nn};function wv(e,t){if(!e)return Cv;if(e.startsWith(`mcp_`)){let e=t?.mcpServerLabel;if(e){let n=t?.mcpTool?`${e}: ${t.mcpTool}`:e;return{label:`Used ${n}`,activeLabel:`Using ${n}`,icon:dt}}return{label:`MCP tool`,activeLabel:`Running MCP tool`,icon:dt}}if(bv[e])return bv[e];let n=e.replace(/[_-]+/g,` `).trim();return n?{...Cv,label:`Used ${n}`,activeLabel:`Using ${n}`}:Cv}function Tv(e,t){return wv(e,t).activeLabel}function Ev(e){let t=wv(e.tool,e),n=e.success==null&&!e.result;return e.active?t.activeLabel:e.success===!1?`${t.activeLabel} failed`:n?`${t.activeLabel} didn't finish`:t.label}function Dv(e){return e.mcpServerLabel?Ev(e):e.narration?jv(e.narration):Ev(e)}var Ov=48,kv=5,Av=6;function jv(e){let t=/^([^:\n]{1,40}): (.+)$/.exec(e);if(!t)return e;let[,n,r]=t;if(/^https?:\/\//i.test(r)){let e=r.replace(/^https?:\/\/(www\.)?/i,``).replace(/\/$/,``),t=e.split(`/`).filter(Boolean);return`${n}: ${e.length>Ov&&t.length>2?`${t[0]}/…/${t[t.length-1]}`:e}`}if(r.length>Ov&&/[\\/]/.test(r)&&!/\s/.test(r)){let e=r.includes(`\\`)?`\\`:`/`,t=r.split(/[\\/]/).filter(Boolean);if(t.length>2)return`${n}: …${e}${t.slice(-2).join(e)}`}return e}var Mv=/^(?:Executing step \d+ of the plan\.?|Following the plan to [\s\S]*)$/;function Nv(e,t){return!!e&&!!t&&e.length===t.length&&e.every((e,n)=>e===t[n])}function Pv(e,t){return e.tool===t.tool&&(e.detail??``)===(t.detail??``)&&e.mcpServer===t.mcpServer}function Fv(e,t,n,r){if(t==null||t<0)return;let i=n[n.length-1],a;return a=i?.active?`running`:i?.success===!1?`failed`:i&&(i.success===!0||i.result)?`done`:r?`running`:i?`stopped`:`pending`,Array.from({length:e},(e,n)=>n<t?`done`:n===t?a:`pending`)}function Iv(e,t){let n=[],r=new Map,i,a=!1;e.forEach((t,o)=>{if(Sv(t))return;let s=n[n.length-1];if(!a||t.type!==`thinking`&&t.type!==`status`||!Mv.test((t.detail||t.label||``).trim())){if(t.type===`plan`){if(a=!0,i&&Nv(i.planSteps,t.planSteps)){t.currentStep!=null&&(i.currentStep=t.currentStep),t.planNarrations&&(i.planNarrations=t.planNarrations),r.get(i.id).anchor=o;return}i&&(r.get(i.id).end=o),i={...t},n.push(i),r.set(t.id,{anchor:o,end:e.length})}else if(t.type===`tool`){let e=n.length-1;for(;e>=0&&(n[e].type===`thinking`||n[e].type===`status`);)e--;let r=e>=0?n[e]:void 0;if(r&&r.type===`tool`&&!r.active&&Pv(r,t)&&(t.active||r.success===t.success)){n[e]={...t,id:r.id,count:(r.count??1)+1};return}n.push({...t})}else if(t.type===`thinking`&&s&&s.type===`thinking`){let e=(s.detail||``)+(t.detail||``);n[n.length-1]={...t,detail:e||s.detail}}else t.type===`status`&&s&&s.type===`status`&&t.active!==!1?n[n.length-1]={...t,label:t.label||s.label}:t.type===`thinking`&&s&&s.type===`status`&&s.active!==!1?n[n.length-1]={...s,type:`thinking`,detail:t.detail||s.detail,active:t.active}:t.type===`status`&&s&&s.type===`thinking`?n[n.length-1]={...s,label:t.label||s.label,active:t.active??s.active}:n.push({...t})}});for(let a of n){let n=r.get(a.id);if(a.type!==`plan`||!a.planSteps||!n)continue;let o=e.slice(n.anchor+1,n.end).filter(e=>e.type===`tool`),s=t&&a===i;a.planStatuses=Fv(a.planSteps.length,a.currentStep,o,s)}return n}var Lv=`Waiting for you`;function Rv(e){let t=Math.max(0,Math.floor(e));return t<60?`${t}s`:`${Math.floor(t/60)}m ${String(t%60).padStart(2,`0`)}s`}function zv(e){let[t,n]=(0,R.useState)(()=>Date.now());return(0,R.useEffect)(()=>{if(!e)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function Bv({steps:e,isActive:t,variant:n=`inline`,agentStepCount:r,awaitingUser:i=!1}){let[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(new Set),l=(0,R.useRef)(new Map),u=(0,R.useRef)(t);(0,R.useEffect)(()=>{u.current=t},[t]),(0,R.useEffect)(()=>()=>{l.current.forEach(e=>clearTimeout(e)),l.current.clear()},[]);let d=(0,R.useMemo)(()=>Iv(e,t),[e,t]),f=zv(t),p=d.filter(e=>e.type===`tool`),m=p.reduce((e,t)=>e+(t.count??1),0),h=t?[...d].reverse().find(e=>e.type===`plan`&&e.planSteps?.length):void 0,g=d.filter(e=>e.type===`policy_alert`),_=g.length>0,[v,y]=(0,R.useState)(``),[b,x]=(0,R.useState)(`all`),S=(0,R.useMemo)(()=>!v&&b===`all`?d:d.filter(e=>{if(e.type!==`tool`)return!0;let t=v.toLowerCase();return!(t&&!e.tool?.toLowerCase().includes(t)&&!Dv(e).toLowerCase().includes(t)||b===`success`&&e.success!==!0||b===`error`&&e.success!==!1)}),[d,v,b]),C=d.filter(e=>e.type===`error`).length>0;(0,R.useEffect)(()=>{(_||C)&&o(!0)},[_,C]);let w=(0,R.useCallback)(e=>{let t=l.current.get(e);t&&(clearTimeout(t),l.current.delete(e)),c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);if(d.length===0)return null;let T=d.filter(e=>e.type!==`status`).reduce((e,t)=>e+(t.count??1),0),E=r&&r>0&&!e.some(Sv)?r:T||d.length,D=t?[...d].reverse().find(e=>e.type===`tool`&&e.active):void 0,O=e[e.length-1],k=_?`Blocked by policy \u00b7 ${g.length} alert${g.length===1?``:`s`}`:`${E} step${E===1?``:`s`}`+(m>0?` \u00b7 ${m} tool${m===1?``:`s`}`:``),A=t&&i?Lv:D?`${Dv(D)} \u00b7 ${Rv((f-D.timestamp)/1e3)}`:t&&O?`Waiting on the model \u00b7 ${Rv((f-O.timestamp)/1e3)}`:``;return(0,B.jsxs)(`div`,{className:`agent-activity ${n} ${t?`active`:`done`} ${C?`has-errors`:``} ${_?`has-policy-alerts`:``}`,children:[(0,B.jsxs)(`button`,{className:`agent-summary-bar`,onClick:()=>o(!a),"aria-expanded":a,"aria-label":a?`Collapse agent activity`:`Expand agent activity`,children:[(0,B.jsxs)(`div`,{className:`agent-summary-left`,children:[C?(0,B.jsx)(me,{size:14,className:`agent-icon-error`}):t?(0,B.jsx)(L,{size:14,className:`flow-tool-spinner`}):(0,B.jsx)(Ln,{size:14,className:`agent-icon-done`}),(0,B.jsx)(`span`,{className:`agent-summary-text`,children:k}),A&&(0,B.jsx)(`span`,{className:`agent-summary-live`,children:A})]}),(0,B.jsx)(`div`,{className:`agent-summary-right`,children:a?(0,B.jsx)(ce,{size:14}):(0,B.jsx)(ue,{size:14})})]}),h&&(0,B.jsx)(Jv,{step:h}),d.length>0&&(0,B.jsxs)(`div`,{className:`agent-flow-wrap ${a?`flow-expanded`:`flow-collapsed`}`,inert:!a,children:[(0,B.jsx)(`div`,{className:`agent-flow`,children:S.map(e=>e.type===`thinking`?(0,B.jsx)(Vv,{step:e,live:t&&!!e.active},e.id):e.type===`status`?t?(0,B.jsx)(Hv,{step:e},e.id):null:e.type===`tool`?(0,B.jsx)(Gv,{step:e,isExpanded:s.has(e.id),now:f,onToggle:()=>w(e.id)},e.id):e.type===`plan`?e===h?null:(0,B.jsx)(Jv,{step:e},e.id):e.type===`error`?(0,B.jsx)(Yv,{step:e},e.id):e.type===`policy_alert`?(0,B.jsx)(Xv,{step:e},e.id):null)}),a&&p.length>=Av&&(0,B.jsxs)(`div`,{className:`activity-filter-bar`,children:[(0,B.jsx)(`input`,{type:`text`,className:`activity-filter-input`,placeholder:`Filter steps…`,"aria-label":`Filter by tool name`,value:v,onChange:e=>y(e.target.value)}),(0,B.jsxs)(`select`,{className:`activity-filter-select`,"aria-label":`Filter by status`,value:b,onChange:e=>x(e.target.value),children:[(0,B.jsx)(`option`,{value:`all`,children:`All`}),(0,B.jsx)(`option`,{value:`success`,children:`Success`}),(0,B.jsx)(`option`,{value:`error`,children:`Error`})]})]})]})]})}function Vv({step:e,live:t}){let n=e.detail||e.label||``,[r,i]=(0,R.useState)(t),a=(0,R.useRef)(null);if((0,R.useEffect)(()=>{t||i(!1)},[t]),(0,R.useEffect)(()=>{t&&r&&a.current&&(a.current.scrollTop=a.current.scrollHeight)},[n,t,r]),!n)return null;let o=n.trim().split(/\s+/).length;return(0,B.jsxs)(`div`,{className:`flow-reasoning`,children:[(0,B.jsxs)(`button`,{className:`flow-reasoning-toggle`,onClick:()=>i(e=>!e),"aria-expanded":r,children:[(0,B.jsx)(M,{size:13,className:`flow-tool-icon`}),(0,B.jsx)(`span`,{children:t?`Thinking`:`Reasoning`}),(0,B.jsxs)(`span`,{className:`flow-reasoning-count`,children:[o,` word`,o===1?``:`s`]}),r?(0,B.jsx)(ce,{size:12}):(0,B.jsx)(ue,{size:12})]}),r&&(0,B.jsxs)(`div`,{ref:a,className:`flow-thought-hacker`,children:[(0,B.jsx)(`span`,{children:n}),t&&(0,B.jsx)(`span`,{className:`flow-thought-cursor`})]})]})}function Hv({step:e}){let t=e.detail||e.label||``;return t?(0,B.jsx)(`div`,{className:`flow-thought ${e.active?`active`:``}`,children:(0,B.jsx)(`span`,{className:`flow-thought-text`,children:t})}):null}function Uv(e){let t=/(['"`])([A-Z]:[\\/][^'"`\n]*?)\1|(?<![\w/\\])[A-Z]:[\\/](?:[^\s*?"'`<>|,;)}\]]+[\\/])*[^\s*?"'`<>|,;)}\]]*/gi,n=[],r=0,i;for(;(i=t.exec(e))!==null;){let t=i[1]??``;(i.index>r||t)&&n.push(e.slice(r,i.index)+t);let a=t?i[2]:i[0],o=a.replace(/[)}\]]+$/,``),s=()=>{to(o).catch(e=>u.ui.error(`Failed to open path`,e))};n.push((0,B.jsxs)(`span`,{className:`tool-result-path`,onClick:s,title:`Open: ${o}`,role:`button`,tabIndex:0,onKeyDown:e=>{e.key===`Enter`&&s()},children:[(0,B.jsx)(Ze,{size:10,style:{flexShrink:0,opacity:.7}}),o]},i.index)),(o.length<a.length||t)&&n.push(a.slice(o.length)+t),r=i.index+i[0].length}return n.length===0?e:(r<e.length&&n.push(e.slice(r)),(0,B.jsx)(B.Fragment,{children:n}))}function Wv({fileList:e}){let[t,n]=(0,R.useState)(!1),r=t?e.files:e.files.slice(0,5),i=e.total-5,a=(e,t)=>{let n=e.name||e.filename||e.file_name;return n?String(n):e.file_path&&String(e.file_path).replace(/\\/g,`/`).split(`/`).pop()||`File ${t+1}`},o=e=>e.directory?String(e.directory):``;return(0,B.jsxs)(`div`,{className:`file-list-view`,children:[r.map((e,t)=>(0,B.jsxs)(`div`,{className:`file-list-item`,children:[(0,B.jsx)(Ye,{size:11,className:`file-list-icon`}),(0,B.jsx)(`span`,{className:`file-list-name`,children:a(e,t)}),o(e)&&(0,B.jsx)(`span`,{className:`file-list-dir`,children:o(e)})]},t)),i>0&&!t&&(0,B.jsxs)(`button`,{className:`file-list-more`,onClick:()=>n(!0),children:[`+`,i,` more`]}),t&&e.files.length<e.total&&(0,B.jsxs)(`span`,{className:`file-list-truncated`,children:[`Showing `,e.files.length,` of `,e.total,` files`]})]})}function Gv({step:e,isExpanded:t,onToggle:n,now:r}){let i=wv(e.tool,e).icon,a=Dv(e),o=e.count??1,s=e.success===!1&&e.result?e.result:``,c=e.active?Rv((r-e.timestamp)/1e3):e.latencyMs==null?``:$v(e.latencyMs);return(0,B.jsxs)(`div`,{className:`flow-tool ${e.active?`active`:``} ${e.success===!1?`error`:``}`,children:[(0,B.jsxs)(`button`,{className:`flow-tool-header`,onClick:n,"aria-expanded":t,title:e.narration&&e.narration!==a?e.narration:void 0,children:[(0,B.jsxs)(`div`,{className:`flow-tool-left`,children:[e.active?(0,B.jsx)(L,{size:13,className:`flow-tool-spinner`}):e.success===!1?(0,B.jsx)(me,{size:13,style:{color:`var(--danger)`}}):e.success===!0?(0,B.jsx)(ge,{size:13,style:{color:`var(--accent-green)`}}):(0,B.jsx)(i,{size:13,className:`flow-tool-icon`}),(0,B.jsx)(`span`,{className:`flow-tool-label`,children:a}),o>1&&(0,B.jsxs)(`span`,{className:`flow-tool-count`,"aria-label":`${o} identical calls`,children:[`×`,o]}),s&&(0,B.jsx)(`span`,{className:`flow-tool-failure`,children:s})]}),(0,B.jsxs)(`div`,{className:`flow-tool-right`,children:[c&&(0,B.jsx)(`span`,{className:`flow-tool-latency`,children:c}),(0,B.jsx)(`span`,{className:`flow-tool-chevron ${t?`expanded`:``}`,children:(0,B.jsx)(ue,{size:12})})]})]}),t&&(0,B.jsxs)(`div`,{className:`flow-tool-detail`,children:[(0,B.jsxs)(`div`,{className:`flow-tool-raw`,children:[(0,B.jsx)(`span`,{className:`detail-section-label`,children:`Tool`}),(0,B.jsx)(`code`,{className:`flow-tool-badge`,children:e.tool||`unknown`}),e.mcpServer&&(0,B.jsxs)(`span`,{className:`flow-tool-mcp-server`,children:[`via `,e.mcpServer]})]}),e.detail&&!e.commandOutput&&(0,B.jsxs)(`div`,{className:`step-detail-args`,children:[(0,B.jsx)(`span`,{className:`detail-section-label`,children:`Arguments`}),(0,B.jsx)(`div`,{className:`detail-args-content`,children:ny(e.detail)})]}),e.commandOutput&&(0,B.jsx)(Qv,{output:e.commandOutput}),e.mcpOutput&&(0,B.jsxs)(`div`,{className:`step-detail-result result-success`,children:[(0,B.jsx)(`span`,{className:`detail-section-label`,children:`Output`}),(0,B.jsx)(ov,{code:e.mcpOutput.text,previewLines:kv,testId:`mcp-output`}),e.mcpOutput.truncated&&(0,B.jsx)(`div`,{className:`cmd-truncated`,children:`Output was truncated (exceeded size limit)`})]}),e.result&&!e.commandOutput&&!e.mcpOutput&&(0,B.jsxs)(`div`,{className:`step-detail-result ${e.success===!1?`result-error`:`result-success`}`,children:[(0,B.jsx)(`span`,{className:`detail-section-label`,children:e.success===!1?`Error`:`Result`}),(0,B.jsx)(yv,{text:e.result,renderShort:Uv})]}),e.retrievalChunks&&e.retrievalChunks.length>0&&(0,B.jsx)(Zv,{chunks:e.retrievalChunks}),e.fileList&&e.fileList.files.length>0&&(0,B.jsx)(Wv,{fileList:e.fileList})]})]})}var Kv={done:`Done`,running:`Running`,failed:`Failed`,stopped:`Stopped`,pending:`Not started`};function qv({status:e}){return e===`done`?(0,B.jsx)(ge,{size:13,className:`plan-icon-done`}):e===`running`?(0,B.jsx)(L,{size:13,className:`flow-tool-spinner`}):e===`failed`?(0,B.jsx)(me,{size:13,className:`plan-icon-failed`}):e===`stopped`?(0,B.jsx)(me,{size:13,className:`plan-icon-stopped`}):(0,B.jsx)(ye,{size:13,className:`plan-icon-pending`})}function Jv({step:e}){let t=e.planSteps??[];if(t.length===0)return null;let n=e.planStatuses,r=n?.filter(e=>e===`done`).length??0;return(0,B.jsxs)(`div`,{className:`flow-plan`,children:[(0,B.jsxs)(`div`,{className:`flow-plan-header`,children:[(0,B.jsx)(Tt,{size:13}),(0,B.jsx)(`span`,{children:`Plan`}),n&&(0,B.jsxs)(`span`,{className:`flow-plan-count`,children:[r,` of `,t.length,` done`]})]}),(0,B.jsx)(`ol`,{className:`flow-plan-list`,children:t.map((t,r)=>{let i=n?.[r],a=jv(e.planNarrations?.[r]||t);return(0,B.jsxs)(`li`,{className:`flow-plan-item ${i??``}`,title:t,"aria-label":i?`${Kv[i]}: ${a}`:void 0,children:[(0,B.jsx)(qv,{status:i}),(0,B.jsx)(`span`,{className:`flow-plan-text`,children:a})]},r)})})]})}function Yv({step:e}){return(0,B.jsxs)(`div`,{className:`flow-error`,children:[(0,B.jsx)(me,{size:13}),(0,B.jsx)(`span`,{children:e.detail||e.label||`An error occurred`})]})}function Xv({step:e}){return(0,B.jsxs)(`div`,{className:`flow-policy-alert`,children:[(0,B.jsxs)(`div`,{className:`flow-policy-alert-header`,children:[(0,B.jsx)(sn,{size:14}),(0,B.jsx)(`span`,{className:`flow-policy-alert-title`,children:`Policy Shield`}),(0,B.jsx)(`span`,{className:`flow-policy-alert-decision`,children:e.decision||`BLOCK`})]}),(0,B.jsxs)(`div`,{className:`flow-policy-alert-body`,children:[(0,B.jsxs)(`div`,{className:`flow-policy-alert-line`,children:[(0,B.jsx)(`span`,{children:`Tool`}),(0,B.jsx)(`code`,{children:e.tool||`unknown tool`})]}),(0,B.jsx)(`div`,{className:`flow-policy-alert-reason`,children:e.reason||e.detail}),e.ruleIds&&e.ruleIds.length>0&&(0,B.jsxs)(`div`,{className:`flow-policy-alert-line`,children:[(0,B.jsx)(`span`,{children:`Rules`}),(0,B.jsx)(`code`,{children:e.ruleIds.join(`, `)})]}),e.policyVersion&&(0,B.jsxs)(`div`,{className:`flow-policy-alert-line`,children:[(0,B.jsx)(`span`,{children:`Policy`}),(0,B.jsx)(`code`,{children:e.policyVersion})]}),(0,B.jsxs)(`div`,{className:`flow-policy-alert-line`,children:[(0,B.jsx)(`span`,{children:`Receipt`}),e.receiptId?(0,B.jsx)(`code`,{children:e.receiptId}):(0,B.jsx)(`em`,{children:`Receipt unavailable`})]})]})]})}function Zv({chunks:e}){let[t,n]=(0,R.useState)(new Set),r=e=>{n(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return(0,B.jsxs)(`div`,{className:`chunks-view`,children:[(0,B.jsxs)(`span`,{className:`detail-section-label`,children:[`Retrieved Chunks (`,e.length,`)`]}),(0,B.jsx)(`div`,{className:`chunks-list`,children:e.map(e=>{let n=t.has(e.id);return(0,B.jsxs)(`div`,{className:`chunk-card ${n?`expanded`:``}`,children:[(0,B.jsxs)(`button`,{className:`chunk-header`,onClick:()=>r(e.id),children:[(0,B.jsxs)(`div`,{className:`chunk-header-left`,children:[(0,B.jsx)(A,{size:11,style:{color:`var(--accent-cyan)`,flexShrink:0}}),e.source&&(0,B.jsx)(`span`,{className:`chunk-source`,children:e.source}),e.page!=null&&(0,B.jsxs)(`span`,{className:`chunk-page`,children:[`p.`,e.page]}),e.score!=null&&e.score>0&&(0,B.jsx)(`span`,{className:`chunk-score`,children:e.score.toFixed(2)})]}),(0,B.jsx)(`span`,{className:`chunk-chevron ${n?`expanded`:``}`,children:(0,B.jsx)(ue,{size:11})})]}),(0,B.jsx)(`div`,{className:`chunk-body ${n?`show`:``}`,children:n?(0,B.jsx)(`pre`,{className:`chunk-content`,children:e.content}):(0,B.jsx)(`div`,{className:`chunk-preview`,children:e.preview})})]},e.id)})})]})}function Qv({output:e}){let[t,n]=(0,R.useState)(!1),r=(0,R.useRef)(null);(0,R.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let i=(0,R.useCallback)(()=>{let t=e.stdout||e.stderr||``;navigator.clipboard.writeText(t).catch(()=>{}),n(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),2e3)},[e]),a=!!(e.stdout||e.stderr),o=e.returnCode!==0&&!e.expectedExit;return(0,B.jsxs)(`div`,{className:`cmd-output ${o?`cmd-error`:``}`,children:[(0,B.jsxs)(`div`,{className:`cmd-header`,children:[(0,B.jsxs)(`div`,{className:`cmd-header-left`,children:[(0,B.jsx)(xn,{size:12,className:`cmd-header-icon`}),(0,B.jsx)(`span`,{className:`cmd-header-title`,children:`Terminal`}),e.cwd&&(0,B.jsx)(`span`,{className:`cmd-cwd`,children:e.cwd})]}),(0,B.jsxs)(`div`,{className:`cmd-header-right`,children:[e.durationSeconds!=null&&(0,B.jsxs)(`span`,{className:`cmd-duration`,children:[e.durationSeconds.toFixed(1),`s`]}),e.returnCode!==0&&(0,B.jsxs)(`span`,{className:`cmd-exit-code${o?``:` cmd-exit-expected`}`,title:e.expectedExit??void 0,children:[`exit `,e.returnCode]}),a&&(0,B.jsx)(`button`,{className:`cmd-copy ${t?`copied`:``}`,onClick:i,title:t?`Copied!`:`Copy output`,"aria-label":t?`Copied to clipboard`:`Copy command output`,children:t?(0,B.jsx)(oe,{size:11}):(0,B.jsx)(De,{size:11})})]})]}),(0,B.jsxs)(`div`,{className:`cmd-line`,children:[(0,B.jsx)(`span`,{className:`cmd-prompt`,children:`$`}),(0,B.jsx)(`span`,{className:`cmd-text`,children:e.command})]}),e.stdout&&(0,B.jsx)(`pre`,{className:`cmd-stdout`,children:e.stdout}),e.stderr&&(0,B.jsx)(`pre`,{className:`cmd-stderr`,children:e.stderr}),e.truncated&&(0,B.jsx)(`div`,{className:`cmd-truncated`,children:`Output was truncated (exceeded size limit)`}),!a&&(0,B.jsx)(`div`,{className:`cmd-empty`,children:`No output`})]})}function $v(e){return e<1?`<1ms`:e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}function ey(e){let t=/^\[(.*)\]$/s.exec(e);return t?t[1].split(/,\s*/).map(e=>e.trim().replace(/^(['"])(.*)\1$/s,`$2`)).filter(Boolean).join(`, `):e}var ty=/^([A-Za-z_][\w.-]{0,29}):(?:\s+([\s\S]*))?$/;function ny(e){let t=e.includes(`
|
|
51
|
-
`)?e.split(`
|
|
52
|
-
`).filter(Boolean):e.split(/, (?=[A-Za-z_][\w.-]{0,29}:(?:\s|$))/).filter(Boolean);return t.length<=1?(0,B.jsx)(`span`,{className:`arg-value`,children:e}):(0,B.jsx)(`div`,{className:`args-grid`,children:t.map((e,t)=>{let n=ty.exec(e.trim());if(n){let e=n[1],r=ey((n[2]??``).trim());return(0,B.jsxs)(`div`,{className:`arg-row`,children:[(0,B.jsx)(`span`,{className:`arg-key`,children:e}),(0,B.jsx)(`span`,{className:`arg-value`,children:r})]},t)}return(0,B.jsx)(`div`,{className:`arg-row`,children:(0,B.jsx)(`span`,{className:`arg-value`,children:e})},t)})})}var ry=`email`;function iy(e,t){return e.filter(e=>e.id===ry&&!!e.namespaced_agent_id&&(e.required_connections?.some(e=>e.connector_id===t)??!1)).map(e=>e.namespaced_agent_id)}function ay(e){if(!e)return!1;if(e.includes(`NOT_CONNECTED:`)||e.includes(`AGENT_NOT_GRANTED:`)||e.includes(`AUTH_REQUIRED:`))return!0;let t=e.toLowerCase();return!!(t.includes(`connectors → google`)||t.includes(`connections → google`)||t.includes(`email agent needs additional google permissions`)||t.includes(`connectors → microsoft`)||t.includes(`connections → microsoft`)||t.includes(`microsoft is not currently connected`)||t.includes(`microsoft_work is not currently connected`))}function oy(e){if(!e)return`all`;let t=e.toLowerCase(),n=t.includes(`google`)||t.includes(`gmail`),r=t.includes(`microsoft_work`)||t.includes(`microsoft 365`)||t.includes(`office365`)||t.includes(`o365`);return[n,!r&&(t.includes(`microsoft`)||t.includes(`outlook`)),r].filter(Boolean).length===1?n?`google`:r?`microsoft_work`:`microsoft`:`all`}function sy(e){let t=window;t.gaia?.openExternal?t.gaia.openExternal(e):window.open(e,`_blank`,`noopener`)}function cy({connectorId:e,label:t,grantAgents:n,done:r,onDone:i}){let[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null),l=(0,R.useCallback)(async()=>{o(!0),c(null);try{let t=await Kr(e);sy((await qr(e,t.available_scopes&&t.available_scopes.length>0?t.available_scopes:t.default_scopes,n)).authorization_url),i()}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}},[e,n,i]);return(0,B.jsxs)(`div`,{className:`email-connect-cta__provider-slot`,children:[(0,B.jsxs)(`button`,{className:`email-connect-cta__button`,onClick:()=>void l(),disabled:a,"aria-label":r?`Reopen ${t} sign-in`:`Connect ${t}`,children:[a?(0,B.jsx)(L,{size:12,className:`email-connect-cta__spinner`}):(0,B.jsx)(Le,{size:12}),(0,B.jsx)(`span`,{children:r?`Reopen ${t} sign-in`:`Connect ${t}`})]}),s&&(0,B.jsx)(`div`,{className:`email-connect-cta__error`,role:`alert`,children:s})]})}function ly({content:e=``,connectorId:t}){let[n,r]=(0,R.useState)(!1),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(!1),{agents:c}=z(),l=(0,R.useCallback)(e=>iy(c,e),[c]),u=t===`google`||t===`microsoft`||t===`microsoft_work`?t:oy(e),d=u===`google`||u===`all`,f=u===`microsoft`||u===`all`,p=u===`microsoft_work`||u===`all`;return(0,B.jsxs)(`div`,{className:`email-connect-cta`,role:`region`,"aria-label":`Connect email account`,children:[(0,B.jsxs)(`div`,{className:`email-connect-cta__text`,children:[(0,B.jsx)(me,{size:14,className:`email-connect-cta__icon`}),(0,B.jsx)(`span`,{children:n||i||o?`A browser tab opened for sign-in. Return here when finished.`:`Connect your email account to use Email Triage.`})]}),(0,B.jsxs)(`div`,{className:`email-connect-cta__buttons`,children:[d&&(0,B.jsx)(cy,{connectorId:`google`,label:`Google`,grantAgents:l(`google`),done:n,onDone:()=>r(!0)}),f&&(0,B.jsx)(cy,{connectorId:`microsoft`,label:`Microsoft`,grantAgents:l(`microsoft`),done:i,onDone:()=>a(!0)}),p&&(0,B.jsx)(cy,{connectorId:`microsoft_work`,label:`Microsoft 365`,grantAgents:l(`microsoft_work`),done:o,onDone:()=>s(!0)})]})]})}function uy(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.kind===`email_pre_scan`&&Array.isArray(t.urgent)&&Array.isArray(t.actionable)&&Array.isArray(t.suggested_archives)&&Array.isArray(t.suggested_drafts)&&typeof t.informational_count==`number`}function dy(e){e&&window.dispatchEvent(new CustomEvent(`gaia:send-message`,{detail:{text:e}}))}function fy(e){let t=e.thread_id||e.message_id;if(!t)return;let n=`https://mail.google.com/mail/u/0/#inbox/${encodeURIComponent(t)}`;window.open(n,`_blank`,`noopener,noreferrer`)}function py(e){if(!e)return`(unknown)`;let t=e.trim(),n=t.indexOf(`<`);return n>0?t.slice(0,n).trim().replace(/^"|"$/g,``):t}function my({payload:e}){let[t,n]=(0,R.useState)(()=>new Set),r=(0,R.useCallback)(e=>{n(t=>{let n=new Set(t);return n.add(e),n})},[]),[i,a]=(0,R.useState)(null),o=(0,R.useRef)(null);(0,R.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]);let s=(0,R.useCallback)((e,t)=>{i||(a(e),o.current=setTimeout(()=>{a(t=>t===e?null:t)},5e3),dy(t))},[i]),c=(0,R.useCallback)(e=>{s(e.message_id,`Archive message id ${e.message_id}.`)},[s]),l=(0,R.useCallback)(e=>{s(e.message_id,`Draft a reply to message id ${e.message_id}.`)},[s]),u=(0,R.useMemo)(()=>[{key:`urgent`,title:`Urgent`,icon:(0,B.jsx)(me,{size:14}),items:e.urgent.filter(e=>!t.has(e.message_id)),intent:`urgent`},{key:`actionable`,title:`Needs a response`,icon:(0,B.jsx)(Ot,{size:14}),items:e.actionable.filter(e=>!t.has(e.message_id)),intent:`actionable`},{key:`archives`,title:`Suggested archives`,icon:(0,B.jsx)(b,{size:14}),items:e.suggested_archives.filter(e=>!t.has(e.message_id)),intent:`archive`}],[e,t]),d=u.reduce((e,t)=>e+t.items.length,0),f=e.informational_count;return(0,B.jsxs)(`div`,{className:`email-pre-scan`,role:`region`,"aria-label":`Inbox pre-scan`,children:[(0,B.jsxs)(`div`,{className:`email-pre-scan__header`,children:[(0,B.jsx)(ht,{size:16,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:`email-pre-scan__title`,children:`Inbox pre-scan`}),(0,B.jsxs)(`span`,{className:`email-pre-scan__totals`,children:[d,` surfaced`,f>0?` · ${f} informational`:``]})]}),u.map(e=>e.items.length>0?(0,B.jsx)(hy,{def:e,pendingRow:i,onApproveArchive:c,onReply:l,onDismiss:r,onOpen:fy},e.key):null),d===0&&(0,B.jsxs)(`div`,{className:`email-pre-scan__empty`,children:[(0,B.jsx)(ge,{size:14}),(0,B.jsx)(`span`,{children:`Nothing to surface — your inbox looks quiet.`})]}),(0,B.jsx)(_y,{applied:e.preferences_applied})]})}function hy({def:e,pendingRow:t,onApproveArchive:n,onReply:r,onDismiss:i,onOpen:a}){return(0,B.jsxs)(`section`,{className:`email-pre-scan__section email-pre-scan__section--${e.intent}`,children:[(0,B.jsxs)(`header`,{className:`email-pre-scan__section-header`,children:[e.icon,(0,B.jsx)(`span`,{className:`email-pre-scan__section-title`,children:e.title}),(0,B.jsx)(`span`,{className:`email-pre-scan__section-count`,children:e.items.length})]}),(0,B.jsx)(`ul`,{className:`email-pre-scan__list`,children:e.items.map(o=>(0,B.jsx)(gy,{item:o,intent:e.intent,isPending:t!==null,onApproveArchive:n,onReply:r,onDismiss:i,onOpen:a},o.message_id))})]})}function gy({item:e,intent:t,isPending:n,onApproveArchive:r,onReply:i,onDismiss:a,onOpen:o}){let s=e.reason??e.why??``,c=py(e.sender);return(0,B.jsxs)(`li`,{className:`email-pre-scan__row`,children:[(0,B.jsxs)(`div`,{className:`email-pre-scan__row-text`,children:[(0,B.jsxs)(`div`,{className:`email-pre-scan__row-meta`,children:[(0,B.jsx)(`span`,{className:`email-pre-scan__row-sender`,title:e.sender,children:c}),(0,B.jsx)(`span`,{className:`email-pre-scan__row-subject`,title:e.subject,children:e.subject||`(no subject)`})]}),s&&(0,B.jsx)(`div`,{className:`email-pre-scan__row-reason`,title:s,children:s})]}),(0,B.jsxs)(`div`,{className:`email-pre-scan__row-actions`,role:`group`,"aria-label":`Actions for this email`,children:[t===`archive`?(0,B.jsxs)(`button`,{className:`email-pre-scan__action email-pre-scan__action--primary`,onClick:()=>r(e),disabled:n,title:`Approve archive`,"aria-label":`Approve archive for "${e.subject}"`,children:[(0,B.jsx)(b,{size:12}),(0,B.jsx)(`span`,{children:`Archive`})]}):(0,B.jsxs)(`button`,{className:`email-pre-scan__action email-pre-scan__action--primary`,onClick:()=>i(e),disabled:n,title:`Draft a reply`,"aria-label":`Draft a reply to "${e.subject}"`,children:[(0,B.jsx)(_n,{size:12}),(0,B.jsx)(`span`,{children:`Reply`})]}),(0,B.jsxs)(`button`,{className:`email-pre-scan__action`,onClick:()=>o(e),title:`Open in Gmail`,"aria-label":`Open "${e.subject}" in Gmail`,children:[(0,B.jsx)(Le,{size:12}),(0,B.jsx)(`span`,{children:`Open`})]}),(0,B.jsx)(`button`,{className:`email-pre-scan__action email-pre-scan__action--ghost`,onClick:()=>a(e.message_id),title:`Dismiss this row`,"aria-label":`Dismiss "${e.subject}"`,children:(0,B.jsx)(Fn,{size:12})})]})]})}function _y({applied:e}){let t=e?.priority_senders??[],n=e?.low_priority_senders??[],r=e?.category_defaults??{};return t.length>0||n.length>0||Object.keys(r).length>0?(0,B.jsxs)(`div`,{className:`email-pre-scan__preferences`,"aria-label":`Active session preferences`,children:[(0,B.jsx)(`span`,{className:`email-pre-scan__preferences-label`,children:`Session preferences:`}),t.length>0&&(0,B.jsxs)(`span`,{className:`email-pre-scan__preferences-chip`,title:`Always urgent`,children:[`+ `,t.length,` priority sender`,t.length===1?``:`s`]}),n.length>0&&(0,B.jsxs)(`span`,{className:`email-pre-scan__preferences-chip`,title:`Always low-priority`,children:[`− `,n.length,` low-priority sender`,n.length===1?``:`s`]}),Object.entries(r).map(([e,t])=>(0,B.jsxs)(`span`,{className:`email-pre-scan__preferences-chip`,title:`${e} → ${t}`,children:[e,` → `,t]},e))]}):null}var vy=2e6;function yy({variant:e,render:t,data:n}){let r;try{r=JSON.stringify(n)}catch{r=String(n)}let i=r.length>vy,a=r;if(!i)try{a=JSON.stringify(n,null,2)}catch{a=r}let o=e===`unknown`?`Unsupported card type: "${t}"`:`Invalid ${t} payload`;return(0,B.jsxs)(`div`,{className:`render-unsupported`,children:[(0,B.jsx)(`p`,{className:`render-unsupported__message`,children:o}),(0,B.jsxs)(`details`,{className:`render-unsupported__details`,children:[(0,B.jsx)(`summary`,{children:`Raw payload`}),i?(0,B.jsxs)(`p`,{className:`render-unsupported__too-large`,children:[`Payload too large to display (`,r.length,` bytes)`]}):(0,B.jsx)(`pre`,{className:`render-unsupported__json`,children:a})]})]})}function by(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function xy(e){return e===null?``:String(e)}function Sy(e){return e===void 0||typeof e==`string`}function Cy(e){return`+${e-500} more (truncated)`}function wy(e){if(!e||typeof e!=`object`)return!1;let t=e;return Sy(t.title)&&Array.isArray(t.columns)&&t.columns.every(e=>typeof e==`string`)&&Array.isArray(t.rows)&&t.rows.every(e=>Array.isArray(e)&&e.every(by))}function Ty({data:e}){if(!wy(e))return(0,B.jsx)(yy,{variant:`invalid`,render:`table`,data:e});let t=e.rows.length>500,n=t?e.rows.slice(0,500):e.rows,r=e.columns.length>500,i=r?e.columns.slice(0,500):e.columns;return(0,B.jsxs)(`div`,{className:`render-table-card`,children:[e.title&&(0,B.jsx)(`div`,{className:`render-table-card__title`,children:e.title}),(0,B.jsx)(`div`,{className:`render-table`,children:(0,B.jsxs)(`table`,{children:[(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[i.map((e,t)=>(0,B.jsx)(`th`,{children:e},t)),r&&(0,B.jsx)(`th`,{children:Cy(e.columns.length)})]})}),(0,B.jsx)(`tbody`,{children:n.map((e,t)=>(0,B.jsx)(`tr`,{children:e.slice(0,i.length).map((e,t)=>(0,B.jsx)(`td`,{children:xy(e)},t))},t))})]})}),t&&(0,B.jsx)(`div`,{className:`render-truncation`,children:Cy(e.rows.length)})]})}function Ey(e){if(!e||typeof e!=`object`)return!1;let t=e;return Sy(t.title)&&Array.isArray(t.items)&&t.items.every(e=>e&&typeof e==`object`&&typeof e.key==`string`&&by(e.value))}function Dy({data:e}){if(!Ey(e))return(0,B.jsx)(yy,{variant:`invalid`,render:`key_value`,data:e});let t=e.items.length>500,n=t?e.items.slice(0,500):e.items;return(0,B.jsxs)(`div`,{className:`render-kv`,children:[e.title&&(0,B.jsx)(`div`,{className:`render-kv__title`,children:e.title}),(0,B.jsx)(`dl`,{className:`render-kv__list`,children:n.map((e,t)=>(0,B.jsxs)(`div`,{className:`render-kv__row`,children:[(0,B.jsx)(`dt`,{className:`render-kv__key`,children:e.key}),(0,B.jsx)(`dd`,{className:`render-kv__value`,children:xy(e.value)})]},t))}),t&&(0,B.jsx)(`div`,{className:`render-truncation`,children:Cy(e.items.length)})]})}function Oy(e){if(!e||typeof e!=`object`)return!1;let t=e;return Sy(t.title)&&(t.ordered===void 0||typeof t.ordered==`boolean`)&&Array.isArray(t.items)&&t.items.every(e=>typeof e==`string`||typeof e==`number`)}function ky({data:e}){if(!Oy(e))return(0,B.jsx)(yy,{variant:`invalid`,render:`list`,data:e});let t=e.items.length>500,n=(t?e.items.slice(0,500):e.items).map((e,t)=>(0,B.jsx)(`li`,{children:String(e)},t));return(0,B.jsxs)(`div`,{className:`render-list`,children:[e.title&&(0,B.jsx)(`div`,{className:`render-list__title`,children:e.title}),e.ordered?(0,B.jsx)(`ol`,{className:`render-list__items`,children:n}):(0,B.jsx)(`ul`,{className:`render-list__items`,children:n}),t&&(0,B.jsx)(`div`,{className:`render-truncation`,children:Cy(e.items.length)})]})}var Ay=/^data:image\/(png|jpe?g|gif|webp);base64,/;function jy(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.src==`string`&&Ay.test(t.src)&&Sy(t.alt)&&Sy(t.caption)}function My({data:e}){return jy(e)?(0,B.jsxs)(`figure`,{className:`render-image`,children:[(0,B.jsx)(`img`,{className:`render-image__img`,src:e.src,alt:e.alt??``}),e.caption&&(0,B.jsx)(`figcaption`,{className:`render-image__caption`,children:e.caption})]}):(0,B.jsx)(yy,{variant:`invalid`,render:`image`,data:e})}function Ny(e){if(!e||typeof e!=`object`)return!1;let t=e;return Sy(t.title)&&Sy(t.badge)&&Sy(t.note)&&typeof t.unified==`string`}function Py(e){return e.startsWith(`@@`)?`render-diff__line render-diff__line--hunk`:e.startsWith(`+++`)||e.startsWith(`---`)||e.startsWith(`diff `)||e.startsWith(`index `)?`render-diff__line`:e.startsWith(`+`)?`render-diff__line render-diff__line--added`:e.startsWith(`-`)?`render-diff__line render-diff__line--removed`:`render-diff__line`}function Fy({data:e}){if(!Ny(e))return(0,B.jsx)(yy,{variant:`invalid`,render:`diff`,data:e});let t=e.unified.replace(/\n$/,``).split(`
|
|
53
|
-
`).map(e=>e.replace(/\r$/,``));return(0,B.jsxs)(`div`,{className:`render-diff`,children:[(e.title||e.badge)&&(0,B.jsxs)(`div`,{className:`render-diff__title`,children:[e.badge&&(0,B.jsx)(`span`,{className:`render-diff__badge`,children:e.badge}),e.title]}),e.note&&(0,B.jsx)(`div`,{className:`render-diff__note`,children:e.note}),e.unified&&(0,B.jsx)(`pre`,{className:`render-diff__body`,children:t.map((e,t)=>(0,B.jsx)(`div`,{className:Py(e),children:e},t))})]})}function Iy(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.action==`string`&&typeof t.summary==`string`}function Ly(e){let t=e.replace(/_/g,` `).trim();return t.length>0?t:`action`}function Ry({data:e}){let[t,n]=(0,R.useState)(!1);return Iy(e)?t?(0,B.jsx)(`div`,{className:`render-confirmation render-confirmation--dismissed`,children:(0,B.jsx)(`span`,{className:`render-confirmation__dismissed-note`,children:`Confirmation dismissed`})}):(0,B.jsxs)(`div`,{className:`render-confirmation`,children:[(0,B.jsxs)(`div`,{className:`render-confirmation__header`,children:[(0,B.jsx)(`span`,{className:`render-confirmation__badge`,children:`Approval needed`}),(0,B.jsx)(`span`,{className:`render-confirmation__label`,children:Ly(e.action)}),(0,B.jsx)(`code`,{className:`render-confirmation__action`,children:e.action})]}),(0,B.jsx)(`pre`,{className:`render-confirmation__summary`,children:e.summary}),(0,B.jsxs)(`div`,{className:`render-confirmation__footer`,children:[(0,B.jsx)(`span`,{className:`render-confirmation__note`,children:`Nothing was executed. Follow the assistant's guidance below to approve this action.`}),(0,B.jsx)(`button`,{type:`button`,className:`render-confirmation__dismiss`,onClick:()=>n(!0),children:`Dismiss`})]})]}):(0,B.jsx)(yy,{variant:`invalid`,render:`needs_confirmation`,data:e})}function zy(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.session_id==`string`&&typeof t.request_id==`string`&&typeof t.question==`string`&&Array.isArray(t.options)&&typeof t.allow_free_text==`boolean`&&typeof t.sensitive==`boolean`}var By=`This question is no longer waiting for an answer. If you still want to answer it, say so in a new message.`,Vy=`••••••`;function Hy(e){return e?.httpStatus===404}function Uy({data:e}){let[t,n]=(0,R.useState)({status:`pending`}),[r,i]=(0,R.useState)(``),a=zy(e)?e.request_id:``,o=z(e=>e.liveQuestions[a]),s=z(e=>e.closeQuestion);if((0,R.useEffect)(()=>{if(!o||o.expiresAt===null)return;let e=o.expiresAt-Date.now();if(e<=0){s(a);return}let t=setTimeout(()=>s(a),e);return()=>clearTimeout(t)},[o,a,s]),!zy(e))return(0,B.jsx)(yy,{variant:`invalid`,render:`needs_input`,data:e});let c=t.status===`submitting`,l=async t=>{if(t.trim()&&!c&&o){n({status:`submitting`});try{await hi(e.session_id,e.request_id,t),n({status:`answered`}),s(e.request_id)}catch(t){if(Hy(t)){s(e.request_id),n({status:`expired`,message:By});return}n({status:`error`,message:t instanceof Error?t.message:`Failed to send the answer.`})}}};return t.status===`answered`?(0,B.jsx)(`div`,{className:`render-needs-input render-needs-input--answered`,children:(0,B.jsx)(`span`,{className:`render-needs-input__answered-note`,children:`Answered`})}):t.status===`expired`||!o&&!c?(0,B.jsxs)(`div`,{className:`render-needs-input render-needs-input--expired`,"aria-disabled":`true`,children:[(0,B.jsx)(`div`,{className:`render-needs-input__header`,children:(0,B.jsx)(`span`,{className:`render-needs-input__badge`,children:`Question`})}),(0,B.jsx)(`p`,{className:`render-needs-input__question`,children:e.question}),(0,B.jsx)(`p`,{className:`render-needs-input__expired-note`,role:`status`,children:t.status===`expired`?t.message:By})]}):(0,B.jsxs)(`div`,{className:`render-needs-input`,children:[(0,B.jsxs)(`div`,{className:`render-needs-input__header`,children:[(0,B.jsx)(`span`,{className:`render-needs-input__badge`,children:`Question`}),e.sensitive&&(0,B.jsx)(`span`,{className:`render-needs-input__sensitive-badge`,children:`Sensitive`})]}),(0,B.jsx)(`p`,{className:`render-needs-input__question`,children:e.question}),e.options.length>0&&(0,B.jsx)(`div`,{className:`render-needs-input__options`,children:e.options.map(e=>(0,B.jsx)(`button`,{type:`button`,className:`render-needs-input__option`,disabled:c,title:e.description||void 0,onClick:()=>l(e.value),children:e.label},e.value))}),e.allow_free_text&&(0,B.jsxs)(`form`,{className:`render-needs-input__free-text`,onSubmit:e=>{e.preventDefault(),l(r)},children:[(0,B.jsx)(`input`,{type:e.sensitive?`password`:`text`,className:`render-needs-input__free-text-input`,value:r,disabled:c,placeholder:e.sensitive?`Type your answer (hidden as ${Vy})`:`Type your answer…`,onChange:e=>i(e.target.value),autoComplete:`off`}),(0,B.jsx)(`button`,{type:`submit`,className:`render-needs-input__free-text-submit`,disabled:c||!r.trim(),children:`Send`})]}),t.status===`error`&&(0,B.jsx)(`p`,{className:`render-needs-input__error`,children:t.message})]})}function Wy(e){if(e&&typeof e==`object`&&e.kind===`email_pre_scan`)return e;let t=e?.data;return t&&typeof t==`object`&&t.kind===`email_pre_scan`?t:e}function Gy({data:e}){let t=Wy(e);return uy(t)?(0,B.jsx)(my,{payload:t}):(0,B.jsx)(yy,{variant:`invalid`,render:`email_pre_scan`,data:e})}var Ky={email_pre_scan:Gy,table:Ty,key_value:Dy,list:ky,image:My,diff:Fy,needs_confirmation:Ry,needs_input:Uy},qy=class extends R.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.error(`[CardErrorBoundary] card render failed:`,e)}render(){return this.state.hasError?(0,B.jsx)(`div`,{role:`alert`,className:`render-card-error`,children:`Card failed to render`}):this.props.children}};function Jy({render:e,data:t}){let n=Ky[e];return(0,B.jsx)(`div`,{className:`render-card`,children:n?(0,B.jsx)(qy,{children:(0,B.jsx)(n,{data:t})}):(0,B.jsx)(yy,{variant:`unknown`,render:e,data:t})})}function Yy(e){if(e<1e3)return`under a second`;let t=Math.round(e/1e3);if(t<60)return`${t} s`;let n=Math.floor(t/60),r=t%60;return r?`${n} min ${r} s`:`${n} min`}var Xy={stopped:`Stopped after`,interrupted:`Interrupted after`};function Zy(e,t,n){let r=[];if(e!=null&&e>0){let i=n?Xy[n]:`Answered in`;r.push(`${i} ${Yy(e)}${t?.place?` ${t.place}`:``}`)}else t?.place&&r.push(`${n?`Ran`:`Answered`} ${t.place}`);if(t?.time_to_first_token!=null&&t.time_to_first_token>0){let e=`first word in ${Yy(t.time_to_first_token*1e3)}`;r.push(r.length?e:e[0].toUpperCase()+e.slice(1))}return r.length?r.join(` · `):null}function Qy(e,t){let n=[];return e!=null&&e>0&&n.push(`Total time ${(e/1e3).toFixed(1)} s`),t?.time_to_first_token!=null&&t.time_to_first_token>0&&n.push(`First token ${(t.time_to_first_token*1e3).toFixed(0)} ms`),t?.output_tokens!=null&&t.output_tokens>0&&n.push(`${(t.input_tokens??0).toLocaleString()} → ${t.output_tokens.toLocaleString()} tokens`),t?.tokens_per_second!=null&&t.tokens_per_second>0&&n.push(`${t.tokens_per_second} tokens/s`),n}function $y({latencyMs:e,stats:t,ended:n}){let[r,i]=(0,R.useState)(!1),a=Zy(e,t,n),o=Qy(e,t);return!a&&o.length===0?null:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{children:(0,B.jsx)(`button`,{type:`button`,className:`msg-stats-summary`,"aria-expanded":r,title:o.join(`
|
|
54
|
-
`),onClick:()=>i(e=>!e),children:a??`Details`})}),r&&o.map(e=>(0,B.jsx)(`span`,{children:e},e))]})}function eb(e){return!e||e===`Thinking...`||e.startsWith(`Reading `)||/— retrying (now|in \d+s)/.test(e)}var tb=`(prefers-reduced-motion: reduce)`;function nb(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(tb).matches}function rb(){return nb()?`auto`:`smooth`}var ib=new Map;function ab(e){let t=ib.get(e);return t||(t={byMessage:new Map,checked:new Set,inFlight:null,listeners:new Set},ib.set(e,t)),t}function ob(e){let t=ab(e);return t.inFlight||=Promise.resolve().then(()=>yo(e)).then(e=>{if(!e||!Array.isArray(e.turns))throw Error(`the server sent no list of turns`);let{turns:n}=e;t.byMessage=new Map(n.filter(e=>e.message_id!=null).map(e=>[e.message_id,e])),t.listeners.forEach(e=>e())}).finally(()=>{t.inFlight=null}),t.inFlight}function sb(e){return ob(e)}function cb(e,t){let[n,r]=(0,R.useState)(()=>ib.get(e)?.byMessage.get(t)??null),[i,a]=(0,R.useState)(null);return(0,R.useEffect)(()=>{if(t<=0)return;let n=ab(e),i=()=>r(n.byMessage.get(t)??null);return n.listeners.add(i),!n.byMessage.has(t)&&!n.checked.has(t)?(n.checked.add(t),ob(e).then(()=>a(null),e=>{n.checked.delete(t),a(e instanceof Error?e.message:String(e))})):i(),()=>{n.listeners.delete(i)}},[e,t]),{turn:n,error:i,refresh:(0,R.useCallback)(()=>ob(e),[e])}}var lb=`gaia:changes-undone`;function ub(e){window.dispatchEvent(new CustomEvent(lb,{detail:e}))}function db(e,t){let n=(0,R.useRef)(t);n.current=t,(0,R.useEffect)(()=>{let t=t=>{t.detail===e&&n.current()};return window.addEventListener(lb,t),()=>window.removeEventListener(lb,t)},[e])}var fb={shell:{one:`command`,many:`commands`,prefix:`Command`},run_python:{one:`Python snippet`,many:`Python snippets`,prefix:`Python`},execute_python_file:{one:`Python script`,many:`Python scripts`,prefix:`Python script`},mcp:{one:`connected tool call`,many:`connected tool calls`,prefix:`Connected tool`},install_cli:{one:`install command`,many:`install commands`,prefix:`Install`},late_write:{one:`late file write`,many:`late file writes`,prefix:`File write`}},pb=120;function mb(e){return fb[e]??{one:e,many:e,prefix:e}}function hb(e){return e.charAt(0).toUpperCase()+e.slice(1)}function gb(e){let t=e.replace(/\s+/g,` `).trim();return t.length>pb?`${t.slice(0,119).trimEnd()}…`:t}function _b(e,t){return`${e} ${e===1?t.one:t.many}`}function vb(e){let t=new Map;for(let n of e){let e=t.get(n.kind);e||(e={kind:n.kind,count:0,entries:new Map},t.set(n.kind,e)),e.count+=1;let r=(n.detail??``).trim(),i=e.entries.get(r);i?i.count+=1:e.entries.set(r,{label:gb(r),detail:r,count:1})}return[...t.values()].map(({kind:e,count:t,entries:n})=>{let r=mb(e),i=[...n.values()],a;if(i.length===1){let e=i[0];a=e.label?`${r.prefix}: ${e.label}`:hb(r.one),e.count>1&&(a+=` ×${e.count}`)}else a=`${hb(r.many)} ×${t}`;return{kind:e,title:a,count:t,entries:i}})}function yb(e){let t=vb(e).map(e=>_b(e.count,mb(e.kind)));return t.length===0?`work`:t.length===1?t[0]:`${t.slice(0,-1).join(`, `)} and ${t[t.length-1]}`}function bb(e,{also:t=!1,inChat:n=!1,undo:r=`Undo`}={}){let i=e.length===1;return`${n?`In this chat, GAIA`:`GAIA`} ${t?`also ran`:`ran`} ${yb(e)} it can't track. If ${i?`it`:`they`} changed any files, ${r} won't restore them.`}var xb=g(),Sb=[`a[href]`,`area[href]`,`button`,`input:not([type="hidden"])`,`select`,`textarea`,`iframe`,`summary`,`[contenteditable]:not([contenteditable="false"])`,`[tabindex]`].join(`, `),Cb=[];function wb(){let e=Cb[Cb.length-1];for(let t=!0;t;){t=!1;for(let n of Cb)n!==e&&n.current&&e?.current?.contains(n.current)&&(e=n,t=!0)}return e}function Tb(e,t){for(let n=e.parentElement?.closest(`details`);n&&t.contains(n);n=n.parentElement?.closest(`details`))if(!n.open&&!n.querySelector(`:scope > summary`)?.contains(e))return!0;return!1}function Eb(e,t){let n=e.closest(`[inert]`);if(n&&t.contains(n)||Tb(e,t))return!1;if(typeof e.checkVisibility==`function`)return e.checkVisibility({visibilityProperty:!0});if(getComputedStyle(e).visibility===`hidden`)return!1;for(let n=e;n&&n!==t.parentElement;n=n.parentElement)if(n.hidden||getComputedStyle(n).display===`none`)return!1;return!0}function Db(e){let t=Array.from(e.querySelectorAll(Sb)).filter(t=>{let n=t.getAttribute(`tabindex`);return n!==null&&Number(n)<0||t.matches(`:disabled`)?!1:Eb(t,e)}),n=e=>e instanceof HTMLInputElement&&e.type===`radio`&&e.name!==``,r=new Map;for(let e of t){if(!n(e))continue;let t=r.get(e.name);(!t||e.checked&&!t.checked)&&r.set(e.name,e)}let i=new Set(r.values());return t.filter(e=>!n(e)||i.has(e))}function Ob(e,t){(0,R.useEffect)(()=>{if(!t)return;let n=e;Cb.push(n);let r=t=>{if(t.key!==`Tab`||t.defaultPrevented||wb()!==n)return;let r=e.current;if(!r)return;let i=Db(r);if(i.length===0){t.preventDefault();return}let a=document.activeElement,o=a&&r.contains(a)&&a!==r?a:null,s=(e,t)=>!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING),c=!!o&&!i.some(e=>s(e,o)),l=!!o&&!i.some(e=>s(o,e));t.shiftKey&&(!o||c)?(t.preventDefault(),i[i.length-1].focus()):!t.shiftKey&&(!o||l)&&(t.preventDefault(),i[0].focus())};return document.addEventListener(`keydown`,r),()=>{document.removeEventListener(`keydown`,r),Cb.splice(Cb.indexOf(n),1)}},[e,t])}var kb={edited:`Edited`,created:`Created`,deleted:`Deleted`};function Ab(e){if(e.too_large)return`Too large to show: ${e.before_size} → ${e.after_size} bytes.`;if(e.binary)return`Binary file: ${e.before_size} → ${e.after_size} bytes. No text diff.`;if(e.truncated)return`Diff shortened: the change is too long to show in full.`}function jb({sessionId:e,turn:t,onClose:n}){let[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(null);c(!0,n);let s=(0,R.useRef)(null);return Ob(s,!0),(0,R.useEffect)(()=>{let n=!0;return bo(e,t.turn_id).then(e=>{n&&i(e.files)},e=>{n&&o(e instanceof Error?e.message:String(e))}),()=>{n=!1}},[e,t.turn_id]),(0,xb.createPortal)((0,B.jsx)(`div`,{ref:s,className:`modal-overlay`,onClick:n,role:`dialog`,"aria-modal":`true`,"aria-label":`Review changes`,children:(0,B.jsxs)(`div`,{className:`modal-panel changes-review`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(`div`,{className:`modal-header`,children:[(0,B.jsx)(`h3`,{children:`Changes in this turn`}),(0,B.jsx)(`button`,{type:`button`,className:`btn-icon`,onClick:n,"aria-label":`Close`,children:(0,B.jsx)(Fn,{size:18})})]}),(0,B.jsxs)(`div`,{className:`modal-body changes-review-body`,children:[a&&(0,B.jsxs)(`p`,{className:`settings-error`,role:`alert`,children:[`Could not load the changes: `,a]}),!r&&!a&&(0,B.jsxs)(`p`,{className:`changes-review-loading`,children:[(0,B.jsx)(L,{size:13,className:`spin`}),` Loading changes…`]}),r?.map(e=>(0,B.jsx)(`section`,{className:`changes-review-file`,children:(0,B.jsx)(Fy,{data:{title:e.path,badge:kb[e.change],note:Ab(e),unified:e.binary||e.too_large?``:e.unified}})},e.path)),t.restored_at&&(0,B.jsx)(`p`,{className:`settings-hint`,children:`This turn was undone; these are the changes it had made.`})]})]})}),document.body)}function Mb(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function Nb({sessionId:e,messageId:t}){let{turn:n,error:r,refresh:i}=cb(e,t),[a,o]=(0,R.useState)(`idle`),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(!1),d=(0,R.useCallback)(async t=>{if(n){o(`working`),c(null);try{let r=await xo(e,n.turn_id,t),a=[];r.restored.length&&a.push(`restored ${Mb(r.restored.length,`file`)}`),r.removed.length&&a.push(`removed ${Mb(r.removed.length,`new file`)}`);let s=`Undone: ${a.join(`, `)||`no files needed changing`}.`;r.kept_folders.length&&(s+=` Kept ${Mb(r.kept_folders.length,`folder`)} it created, because they now hold other files.`),c(s),o(`done`),ub(e),await i()}catch(e){let t=e instanceof wi&&e.reason===`conflict`;c(e instanceof wi?e.detail:String(e)),o(t?`conflict`:`idle`)}}},[i,e,n]);if(r)return(0,B.jsxs)(`div`,{className:`turn-changes is-error`,role:`note`,children:[(0,B.jsx)(Tn,{size:12,"aria-hidden":`true`}),(0,B.jsxs)(`span`,{children:[`Could not check this turn's file changes: `,r]})]});if(!n||n.files.length===0&&!n.incomplete)return null;let f=n.files.length,p=!!n.restored_at,m=vb(n.untracked);return(0,B.jsxs)(`div`,{className:`turn-changes`,"aria-label":`File changes from this turn`,children:[f>0&&(0,B.jsxs)(`div`,{className:`turn-changes-row`,children:[(0,B.jsxs)(`span`,{className:`turn-changes-summary`,children:[`Changed `,Mb(f,`file`),p&&` · undone`]}),(0,B.jsxs)(`button`,{type:`button`,className:`turn-changes-btn`,onClick:()=>u(!0),children:[(0,B.jsx)(Ve,{size:12,"aria-hidden":`true`}),` Review changes`]}),!p&&a!==`confirm`&&a!==`conflict`&&(0,B.jsxs)(`button`,{type:`button`,className:`turn-changes-btn`,onClick:()=>o(`confirm`),disabled:a===`working`,children:[(0,B.jsx)(Dn,{size:12,"aria-hidden":`true`}),` `,a===`working`?`Undoing…`:`Undo this turn`]}),a===`confirm`&&(0,B.jsxs)(`span`,{className:`turn-changes-confirm`,role:`group`,"aria-label":`Confirm undo`,children:[`Put `,Mb(f,`file`),` back the way `,f===1?`it was`:`they were`,` before this turn?`,(0,B.jsx)(`button`,{type:`button`,className:`turn-changes-btn is-primary`,onClick:()=>void d(!1),children:`Undo`}),(0,B.jsx)(`button`,{type:`button`,className:`turn-changes-btn`,onClick:()=>o(`idle`),children:`Cancel`})]})]}),n.incomplete&&(0,B.jsxs)(`div`,{className:`turn-changes-warning`,role:`note`,children:[(0,B.jsx)(Tn,{size:12,"aria-hidden":`true`}),(0,B.jsxs)(`span`,{children:[bb(n.untracked,{also:f>0}),m.length>0&&(0,B.jsx)(`ul`,{children:m.map(e=>(0,B.jsx)(`li`,{children:e.entries.length===1?(0,B.jsx)(`span`,{title:e.entries[0].detail||void 0,children:e.title}):(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{children:e.title}),(0,B.jsx)(`ul`,{children:e.entries.map(e=>(0,B.jsxs)(`li`,{title:e.detail||void 0,children:[e.label||`No description`,e.count>1&&` ×${e.count}`]},e.detail))})]})},e.kind))})]})]}),s&&(0,B.jsxs)(`div`,{className:`turn-changes-message${a===`done`?` is-ok`:` is-error`}`,role:a===`done`?`status`:`alert`,children:[s,a===`conflict`&&(0,B.jsxs)(`span`,{className:`turn-changes-confirm`,children:[(0,B.jsx)(`button`,{type:`button`,className:`turn-changes-btn is-danger`,onClick:()=>void d(!0),children:`Undo anyway and lose those changes`}),(0,B.jsx)(`button`,{type:`button`,className:`turn-changes-btn`,onClick:()=>{o(`idle`),c(null)},children:`Keep them`})]})]}),l&&(0,B.jsx)(jb,{sessionId:e,turn:n,onClose:()=>u(!1)})]})}function Pb({active:e,label:t,awaitingUser:n=!1}){let r=n?Lv:t||`Thinking...`,[i]=(0,R.useState)(nb),[a,o]=(0,R.useState)(0),[s,c]=(0,R.useState)(i?`idle`:`typing`),l=(0,R.useRef)(e),u=(0,R.useRef)(r.length);u.current=r.length,(0,R.useEffect)(()=>{if(s!==`typing`)return;if(i||a>=r.length){c(`idle`);return}let e=setTimeout(()=>o(e=>e+1),30);return()=>clearTimeout(e)},[s,a,r.length,i]),(0,R.useEffect)(()=>{l.current&&!e&&(o(u.current),c(i?`done`:`erasing`)),l.current=e},[e,i]),(0,R.useEffect)(()=>{if(s!==`erasing`)return;if(a<=0){c(`done`);return}let e=setTimeout(()=>o(e=>e-1),20);return()=>clearTimeout(e)},[s,a]),(0,R.useEffect)(()=>{e&&s===`done`&&(o(0),c(`typing`))},[e,s]);let d=Ib(e,r),f=e&&!n&&eb(t),p=Ib(f),m=Xo();if(s===`done`)return null;let h=f&&p>=45;return(0,B.jsxs)(`span`,{className:`thinking-indicator${e&&!n?` is-live`:``}`,children:[(0,B.jsx)(`span`,{className:`thinking-indicator-text`,children:s===`idle`?r:r.slice(0,a)}),e&&!n&&d>=Fb&&(0,B.jsxs)(`span`,{className:`thinking-indicator-elapsed`,children:[` · `,d,`s`]}),e&&(0,B.jsx)(`span`,{className:`cursor`}),h&&(0,B.jsx)(`span`,{className:`thinking-indicator-hint`,role:`status`,children:m?.remote===!1?`Still waiting on the model — nothing has come back yet. A long prompt can take a minute or more to read on this PC. Press Stop to end it now.`:`Still waiting on the model — nothing has come back yet. A hosted model that stays silent is retried, then stopped with an error. Press Stop to end it now.`})]})}var Fb=3;function Ib(e,t){let[n,r]=(0,R.useState)(0);return(0,R.useEffect)(()=>{if(r(0),!e)return;let t=Date.now(),n=setInterval(()=>r(Math.floor((Date.now()-t)/1e3)),1e3);return()=>clearInterval(n)},[e,t]),n}function Lb(e){if(!e)return!1;let t=e.toLowerCase();return t.startsWith(`error:`)||t.startsWith(`error -`)||t.includes(`traceback (most recent`)||t.includes(`object has no attribute`)||t.includes(`is lemonade server running`)||t.includes(`connection refused`)||t.includes(`failed to fetch`)}var Rb=e=>e.replace(/\s+/g,` `).trim();function zb(e,t){let n=Rb(t);if(!n)return{steps:e,echoed:!1};let r=e.filter(e=>!(e.type===`error`&&e.detail&&Rb(e.detail)===n));return{steps:r,echoed:r.length<e.length}}var Bb=/\s*\{\s*"?tool"?\s*:\s*"[^"]+"\s*,\s*"?tool_args"?\s*:\s*\{[^}]*\}\s*\}/g,Vb=new Set([`thought`,`answer`,`tool`,`tool_args`,`goal`]),Hb=/^\{\s*"(thought|answer|tool|tool_args|goal)"\s*:/;function Ub(e,t){let n=0,r=!1,i=!1;for(let a=t;a<e.length;a++){let t=e[a];if(r)i?i=!1:t===`\\`?i=!0:t===`"`&&(r=!1);else if(t===`"`)r=!0;else if(t===`{`)n++;else if(t===`}`&&(n--,n===0))return a}return-1}function Wb(e){let t=e.indexOf(`"answer"`);if(t===-1)return null;let n=e.indexOf(`:`,t+8);if(n===-1)return null;let r=n+1;for(;r<e.length&&/\s/.test(e[r]);)r++;if(r>=e.length||e[r]!==`"`)return null;let i=e.slice(r+1);return i.endsWith(`"}`)?i=i.slice(0,-2):i.endsWith(`"`)&&(i=i.slice(0,-1)),i.replace(/\\"/g,`"`).replace(/\\n/g,`
|
|
55
|
-
`).replace(/\\\\/g,`\\`)}function Gb(e){let t;try{t=JSON.parse(e)}catch{let t=Wb(e);return t===null?e.includes(`"tool_args"`)?{action:`drop`}:{action:`keep`}:{action:`answer`,text:t}}if(typeof t!=`object`||!t||Array.isArray(t))return{action:`keep`};let n=t,r=Object.keys(n),i=r.length>0&&r.every(e=>Vb.has(e));return typeof n.tool==`string`&&n.tool_args!==void 0?{action:`drop`}:typeof n.answer==`string`&&i?{action:`answer`,text:n.answer}:typeof n.thought==`string`&&n.answer===void 0&&i?{action:`drop`}:{action:`keep`}}function Kb(e,t){let n=``,r=0;for(;r<e.length;){let i=e.indexOf(`{`,r);if(i===-1){n+=e.slice(r);break}if(!Hb.test(e.slice(i,i+40))){n+=e.slice(r,i+1),r=i+1;continue}let a=Ub(e,i);if(a===-1){n+=t?e.slice(r,i):e.slice(r);break}n+=e.slice(r,i);let o=e.slice(i,a+1),s=Gb(o);s.action===`answer`?n+=s.text:s.action===`keep`&&(n+=o),r=a+1}return n}var qb=new Set(`python.py.javascript.js.typescript.ts.java.c.cpp.csharp.cs.go.rust.ruby.rb.php.swift.kotlin.scala.r.perl.lua.bash.sh.zsh.powershell.ps1.sql.html.css.scss.sass.less.xml.json.yaml.yml.toml.ini.csv.markdown.md.dockerfile.docker.makefile.cmake.nginx.apache.graphql.proto.protobuf.jsx.tsx.vue.svelte.dart.elixir.ex.erlang.haskell.hs.ocaml.ml.fsharp.fs.clojure.clj.lisp.scheme.racket.zig.nim.crystal.julia.matlab.octave.fortran.cobol.pascal.delphi.ada.assembly.asm.nasm.wasm.solidity.sol.verilog.vhdl.text.txt.plaintext.diff.patch.log.email_pre_scan.email-pre-scan`.split(`.`));function Jb(e){return e.replace(/```(\w*)[ \t]*\n([\s\S]*?)```/g,(e,t,n)=>{let r=t.toLowerCase();return r.length>0&&r.length<=2&&!qb.has(r)?n.trim():e})}var Yb=/\n{1,2}Verification: unverified[^\n]*\s*$/;function Xb(e){let t=e;for(;;){let e=t.replace(Yb,``);if(e===t)return t;t=e}}function Zb(e,t=!1){if(!e)return e;e=Xb(e);let n=e;n=n.replace(Bb,``),n=Kb(n,t),n=n.replace(/<think>[\s\S]*?<\/think>/g,``);let r=(n.match(/\\n/g)||[]).length,i=(n.match(/\n/g)||[]).length;return r>2&&r>i*2&&(n=n.replace(/\\n/g,`
|
|
56
|
-
`),n=n.replace(/\\"/g,`"`)),n=Jb(n).trim(),Qb(n)}function Qb(e){let t=!1;return e.split(`
|
|
57
|
-
`).map(e=>(/^\s*(```|~~~)/.test(e)&&(t=!t),t?e:e.replace(/^(\s*\d+)\.(\s*)$/,`$1\\.$2`))).join(`
|
|
58
|
-
`)}function $b(e){return e?new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,second:`2-digit`,hour12:!0}):``}var ex=`Cancelled.`,tx=[`This answer was interrupted when GAIA closed. Send again to retry.`,`This answer was interrupted before it finished. Send again to retry.`,`This answer ended before GAIA could save a reply. Send again to retry.`];function nx(e,t){if(t)return`stopped`;let n=e.trim();return tx.some(e=>n.endsWith(e))?`interrupted`:void 0}function rx({message:e,isStreaming:t,agentSteps:n,agentStepsActive:r,agentStepCount:i,cards:a,onDelete:o,onResend:s,extraActions:c,latencyMs:l,liveStatus:u,awaitingUser:d}){Go();let f=(0,R.useMemo)(()=>e.role===`assistant`&&!t&&n?zb(n,e.content):{steps:n,echoed:!1},[n,e.content,e.role,t]),p=e.role===`assistant`&&(f.echoed||Lb(e.content)),m=e.role===`assistant`?e.stopState??(e.content.trim()===ex?`stopped`:void 0):void 0,h=(0,R.useMemo)(()=>e.role===`user`?e.content:Zb(e.content,!!t),[e.content,e.role,t]),[g,_]=(0,R.useState)(!1),[v,y]=(0,R.useState)(!1),b=e.role===`user`&&dv(e.content),[x,S]=(0,R.useState)(!1),C=(0,R.useId)(),w=(0,R.useRef)(null),T=(0,R.useRef)(!1),E=(0,R.useCallback)(()=>{x&&(T.current=!0),S(!x)},[x]);(0,R.useEffect)(()=>{!x&&T.current&&(T.current=!1,w.current?.scrollIntoView?.({block:`nearest`}))},[x]);let D=(0,R.useRef)(null),O=(0,R.useRef)(null);(0,R.useEffect)(()=>()=>{D.current&&clearTimeout(D.current),O.current&&clearTimeout(O.current)},[]);let k=(0,R.useCallback)(()=>{if(navigator.clipboard?.writeText)navigator.clipboard.writeText(e.content).catch(()=>{});else{let t=document.createElement(`textarea`);t.value=e.content,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}_(!0),D.current&&clearTimeout(D.current),D.current=setTimeout(()=>_(!1),2e3)},[e.content]),A=(0,R.useCallback)(()=>{v?(y(!1),O.current&&clearTimeout(O.current),o?.(e.id)):(y(!0),O.current&&clearTimeout(O.current),O.current=setTimeout(()=>y(!1),3e3))},[v,e.id,o]),j=(0,R.useCallback)(()=>{s?.(e)},[e,s]),M=e.created_at?`${e.role===`user`?`Sent`:`Replied`} ${$b(e.created_at)}`:void 0;return(0,B.jsx)(`div`,{className:`msg msg-${e.role} ${p?`msg-error`:``}`,title:M,children:(0,B.jsxs)(`div`,{className:`msg-inner`,children:[(0,B.jsxs)(`div`,{className:`msg-header`,children:[(0,B.jsx)(`div`,{className:`msg-header-left`,children:e.role===`assistant`&&t&&(0,B.jsx)(Pb,{active:!!r||!h,label:u,awaitingUser:d})}),!t&&(0,B.jsxs)(`div`,{className:`msg-actions`,children:[e.role===`user`&&s&&(0,B.jsx)(`button`,{className:`msg-action-btn`,onClick:j,title:`Resend message`,"aria-label":`Resend message`,children:(0,B.jsx)(Qt,{size:12})}),c,(0,B.jsx)(`button`,{className:`msg-copy ${g?`copied`:``}`,onClick:k,title:g?`Copied!`:`Copy message`,"aria-label":g?`Copied to clipboard`:`Copy message`,children:g?(0,B.jsx)(oe,{size:12}):(0,B.jsx)(De,{size:12})}),o&&(0,B.jsx)(`button`,{className:`msg-action-btn msg-delete ${v?`confirm`:``}`,onClick:A,title:v?`Click again to confirm`:`Delete message`,"aria-label":v?`Confirm delete message`:`Delete message`,children:(0,B.jsx)(Cn,{size:12})})]})]}),(0,B.jsxs)(`div`,{className:`msg-body`,children:[f.steps&&f.steps.length>0&&(0,B.jsx)(Bv,{steps:f.steps,isActive:r??!1,variant:r?`inline`:`summary`,agentStepCount:i??e.stats?.steps??void 0,awaitingUser:d}),p&&(0,B.jsxs)(`div`,{className:`error-banner`,children:[(0,B.jsx)(Tn,{size:14}),(0,B.jsx)(`span`,{children:`Something went wrong`})]}),(e.cards??a)?.map((e,t)=>(0,B.jsx)(Jy,{render:e.render,data:e.data},t)),b?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{ref:w,id:C,className:`msg-collapsible${x?``:` is-collapsed`}`,children:(0,B.jsx)(mx,{content:h})}),(0,B.jsx)(pv,{expanded:x,onToggle:E,controls:C,collapsedLabel:`Show all (${fv(e.content)})`,expandedLabel:`Show less`,className:`msg-expand-toggle`})]}):!(m&&h.trim()===ex)&&(0,B.jsx)(mx,{content:h,showCursor:t&&!!h&&!r,isStreaming:t}),m&&(0,B.jsxs)(`div`,{className:`msg-stopped${m===`unconfirmed`||e.stopError?` is-unconfirmed`:``}`,role:`note`,children:[(0,B.jsx)(yn,{size:9,fill:`currentColor`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:m===`unconfirmed`?`Stopped. GAIA did not confirm the stop, so some steps may be missing here. Reload the chat to see what it saved.`:e.stopError?`Stopped. GAIA reported an error while stopping: ${e.stopError}`:`Stopped`})]}),e.role===`assistant`&&!t&&ay(h)&&(0,B.jsx)(ly,{content:h}),e.role===`assistant`&&!t&&(e.stats||l!=null||e.created_at)&&(0,B.jsxs)(`div`,{className:`msg-stats`,"aria-label":`About this answer`,children:[e.created_at&&(0,B.jsx)(`span`,{className:`msg-stats-ts`,title:`Message timestamp`,children:$b(e.created_at)}),e.stats?.retried&&e.stats.model&&(0,B.jsx)(`span`,{title:`This answer was kept from Retry with… (${e.stats.model})`,children:Ko(e.stats.model)}),(0,B.jsx)($y,{latencyMs:l,stats:e.stats,ended:nx(e.content,m)})]}),e.role===`assistant`&&!t&&e.id>0&&e.session_id&&(0,B.jsx)(Nb,{sessionId:e.session_id,messageId:e.id})]})]})})}var ix=(0,R.createContext)(!1);function ax({lang:e,code:t}){let[n,r]=(0,R.useState)(!1),[i,a]=(0,R.useState)(!1),o=(0,R.useContext)(ix),s=(0,R.useId)(),c=uv(t),l=c>(o?20:25),u=l&&!i,d=(0,R.useRef)(null);(0,R.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]);let f=(0,R.useCallback)(()=>{if(navigator.clipboard?.writeText)navigator.clipboard.writeText(t).catch(()=>{});else{let e=document.createElement(`textarea`);e.value=t,e.style.position=`fixed`,e.style.opacity=`0`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e)}r(!0),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>r(!1),2e3)},[t]);return(0,B.jsxs)(`div`,{className:`code-block${u?` is-collapsed`:``}`,children:[(0,B.jsxs)(`div`,{className:`code-header`,children:[(0,B.jsx)(`span`,{className:`code-lang`,children:e||`code`}),(0,B.jsxs)(`button`,{className:`code-copy ${n?`copied`:``}`,onClick:f,title:n?`Copied!`:`Copy`,"aria-label":n?`Copied to clipboard`:`Copy code`,children:[n?(0,B.jsx)(oe,{size:13}):(0,B.jsx)(De,{size:13}),(0,B.jsx)(`span`,{children:n?`Copied`:`Copy`})]})]}),(0,B.jsx)(`pre`,{id:s,children:(0,B.jsx)(`code`,{children:t})}),l&&(0,B.jsx)(pv,{expanded:i,onToggle:()=>a(e=>!e),controls:s,collapsedLabel:`Expand (${c.toLocaleString(`en-US`)} lines)`,expandedLabel:`Collapse`,className:`code-expand-toggle`})]})}var ox=/\b[A-Z]:[\\/][^\s*?"<>|,;)}\]\\/]+(?:[\\/][^\s*?"<>|,;)}\]\\/]+)*[\\/]?/gi,sx=/[.:!']+$/,cx=RegExp(`^(?:${ox.source})$`,`i`);function lx(e){if(typeof e!=`string`)return null;let t=e.trim();return cx.test(t)?t:null}function ux({path:e}){let t=t=>{t.preventDefault(),to(e).catch(e=>{u.ui.error(`Failed to open path`,e)})};return(0,B.jsxs)(`span`,{className:`file-path-link`,onClick:t,title:`Open in file explorer: ${e}`,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t(e))},children:[(0,B.jsx)(Ze,{size:12,className:`file-path-icon`}),e]})}function dx(e){let t=new RegExp(ox.source,`gi`),n=[],r=0,i;for(;(i=t.exec(e))!==null;){i.index>r&&n.push(e.slice(r,i.index));let t=i[0].replace(sx,``);n.push((0,B.jsx)(ux,{path:t},i.index)),r=i.index+t.length}return n.length===0?e:(r<e.length&&n.push(e.slice(r)),(0,B.jsx)(B.Fragment,{children:n}))}function fx(e){return R.Children.map(e,e=>typeof e==`string`?dx(e):e)}var px={code({className:e,children:t,node:n,...r}){let i=lx(t);return i?(0,B.jsx)(ux,{path:i}):(0,B.jsx)(`code`,{className:`inline-code`,...r,children:t})},pre({children:e}){let t=R.Children.toArray(e)[0];if(R.isValidElement(t)&&(t.type===`code`||t.props?.className!==void 0||typeof t.props?.children==`string`)){let e=t.props,n=e?.className||``,r=/language-([\w-]+)/.exec(n),i=String(e?.children||``).replace(/\n$/,``),a=r?.[1]||``;return(0,B.jsx)(ax,{lang:a,code:i})}return(0,B.jsx)(`pre`,{children:e})},table({children:e}){return(0,B.jsx)(`div`,{className:`md-table-wrap`,children:(0,B.jsx)(`table`,{className:`md-table`,children:e})})},a({href:e,children:t}){return(0,B.jsx)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`md-link`,children:t})},p({children:e}){return(0,B.jsx)(`p`,{className:`md-p`,children:fx(e)})},h1({children:e}){return(0,B.jsx)(`h2`,{className:`md-h2`,children:fx(e)})},h2({children:e}){return(0,B.jsx)(`h3`,{className:`md-h3`,children:fx(e)})},h3({children:e}){return(0,B.jsx)(`h4`,{className:`md-h4`,children:fx(e)})},ul({children:e}){return(0,B.jsx)(`ul`,{className:`md-ul`,children:e})},ol({children:e,start:t}){return(0,B.jsx)(`ol`,{className:`md-ol`,start:t,children:e})},li({children:e}){return(0,B.jsx)(`li`,{className:`md-li`,children:fx(e)})},blockquote({children:e}){return(0,B.jsx)(`blockquote`,{className:`md-blockquote`,children:fx(e)})},hr(){return(0,B.jsx)(`hr`,{className:`md-hr`})},td({children:e}){return(0,B.jsx)(`td`,{children:fx(e)})},th({children:e}){return(0,B.jsx)(`th`,{children:fx(e)})}};function mx({content:e,showCursor:t,isStreaming:n=!1}){return!e&&!t?null:!e&&t?(0,B.jsx)(`span`,{className:`cursor`}):(0,B.jsx)(ix.Provider,{value:n,children:(0,B.jsxs)(`div`,{className:`md-content`,children:[(0,B.jsx)(Um,{remarkPlugins:[Y_,ev,nv],disallowedElements:[...Jm],urlTransform:Ym,components:px,children:e}),t&&(0,B.jsx)(`span`,{className:`cursor`})]})})}var hx=1e3,gx=15e3,_x=null,vx=null,yx=hx,bx=0,xx=null;function Sx(){if(_x)return _x;let e=Date.now();return _x=pi().then(t=>z.getState().setActiveRuns(t,e)).catch(e=>u.api.warn(`Could not read which chats are running`,e)).finally(()=>{_x=null}),_x}function Cx(){let e=z.getState();return e.isStreaming||e.runningSessionIds.length>0}function wx(){return Cx()?(yx=hx,hx):(yx=Math.min(yx*2,gx),yx)}function Tx(e){Sx().then(()=>{e===bx&&(vx=setTimeout(()=>Tx(e),wx()))})}function Ex(){xx&&(vx&&clearTimeout(vx),vx=null,yx=hx,Tx(++bx))}function Dx(){xx?.();let e=z.subscribe((e,t)=>{e.isStreaming&&!t.isStreaming&&Ex()}),t=()=>Ex();window.addEventListener(`focus`,t);let n=()=>{bx++,vx&&clearTimeout(vx),vx=null,e(),window.removeEventListener(`focus`,t),xx===n&&(xx=null)};return xx=n,yx=hx,Tx(++bx),n}var Ox=[0,3e3,1e4],kx=`The answer to your last message was lost: its run stopped before it finished, most often because GAIA restarted. Send the message again.`;function Ax(e){return e.name===`StreamStalledError`||e.name===`StreamDroppedError`}function jx(e){if(Ax(e))return`Lost the live view of this answer: the connection to GAIA dropped 4 times. The answer may still finish. Reopen this chat in a minute to see it.`;if(e instanceof za)return e.endpoint===`send`?`GAIA did not start this answer within ${Math.round(e.timeoutMs/1e3)} seconds; it may be busy or stuck. If the chat list shows this chat running, reopen it later to see the answer. Otherwise, send the message again.`:`GAIA did not respond when this chat reconnected to its running answer. The answer may still finish: check that GAIA is still running, then reopen this chat.`;if(e instanceof wi){let t=e.detail?xi(e.detail):``;return e.httpStatus===429?`GAIA is busy with another chat, so this message was not sent. Send it again when that chat finishes.`:e.httpStatus===409?t||`This chat is already answering a message. Wait for it to finish, or press Stop.`:`GAIA could not take this message (HTTP ${e.httpStatus})${t?`: ${t}`:`.`}`}return null}var Mx=3e3,Nx=new Set,Px=new Map,Fx=new Set,Ix=null;function Lx(e,t=Date.now()){Px.set(e,t)}function Rx(e){let t=z.getState();return t.activeRunsAt>0&&t.activeRunsAt>=(Px.get(e)??0)&&!t.runningSessionIds.includes(e)&&!t.queuedSessionIds.includes(e)}function zx(e){return Fx.add(e),()=>{Fx.delete(e),Ix?.()}}function Bx(e){return e instanceof Error?jx(e)??(e.message||`Unknown error`):String(e)}function Vx(e){let t=e?.httpStatus;return typeof t==`number`?t:void 0}function Hx(e){let t=Vx(e);return t===409||t===429}function Ux(e){z.getState().setQueueHold(e,!0),setTimeout(()=>z.getState().setQueueHold(e,!1),Mx)}function Wx(e,t,n){return Vx(n)===409&&(u.chat.info(`Chat ${e} was busy; queueing the message to try again`),z.getState().updateQueue(e,e=>xr(e,t,`queued`)),Ux(e),!0)}async function Gx(e,t,n){let r=z.getState;if(Nx.has(e)||r().queueHolds[e])return;let i=r().messageQueues[e]??[];if(i.some(e=>e.state===`sending`))return;let a=Or(i);if(a||Mr(i)){Nx.add(e);try{if(a){let t;try{t=await ci(e)}catch(t){if(Vx(t)===409){u.chat.info(`Chat ${e} is answering again; its queue waits for that turn to end`);return}u.chat.error(`Could not learn what chat ${e}'s last reply did with the messages added to it`,t),r().updateQueue(e,e=>jr(e,`GAIA could not say whether it read this message: ${Bx(t)}`));return}r().updateQueue(e,e=>Ar(e,t))}let i=Mr(r().messageQueues[e]??[]);if(!i||!n())return;r().updateQueue(e,e=>Sr(e,i.id,`queued`,`starting`));let o;try{o=await t(e,i.text)}catch(e){o={kind:`failed`,error:Bx(e)}}if(o.kind===`accepted`){Lx(e),r().updateQueue(e,e=>Cr(e,i.id)),Ex();return}if(o.kind===`busy`){u.chat.info(`Queued message found chat ${e} busy; holding it`),r().updateQueue(e,e=>wr(e,i.id)),Ux(e);return}u.chat.error(`Queued message for chat ${e} was not sent: ${o.error}`),r().updateQueue(e,e=>wr(e,i.id,o.error))}finally{Nx.delete(e)}}}function Kx(e){return e.type!==`status`||e.phase!==`waiting`}var qx=(e,t)=>new Promise(n=>{let r=!1,i=null,a=!1,o=e=>{r||(r=!0,e.kind===`accepted`&&(i?i.abort():a=!0),n(e))},s=()=>o({kind:`accepted`});u.chat.info(`Sending queued message for chat ${e} in the background`),i=Aa(e,t,{onChunk:s,onAgentEvent:e=>{Kx(e)&&s()},onDone:s,onError:e=>{Ax(e)?s():Hx(e)?o({kind:`busy`}):o({kind:`failed`,error:Bx(e)})}}),a&&i.abort()});function Jx(e=qx){let t=()=>{let t=z.getState();if(t.systemStatus?.init_state!==`initializing`)for(let n of Object.keys(t.messageQueues))!Fx.has(n)&&Rx(n)&&Gx(n,e,()=>!Fx.has(n))},n=z.subscribe((e,n)=>{(e.messageQueues!==n.messageQueues||e.queueHolds!==n.queueHolds||e.activeRunsAt!==n.activeRunsAt||e.runningSessionIds!==n.runningSessionIds||e.systemStatus!==n.systemStatus)&&t()});return Ix=t,t(),()=>{n(),Ix===t&&(Ix=null)}}var Yx=`https://github.com/amd/gaia/issues/new`,Xx=[{label:`Image`,extensions:new Set([`.jpg`,`.jpeg`,`.png`,`.gif`,`.bmp`,`.tiff`,`.webp`,`.ico`,`.heic`,`.heif`]),message:`Image files cannot be indexed for text search.`,alternatives:[`Index PDFs that contain images — text is extracted automatically`,`Paste image descriptions or OCR text directly into the chat`,`Use GAIA's VLM agent for image analysis: gaia vlm`],featureTitle:`Support image file indexing and OCR`},{label:`Video`,extensions:new Set([`.mp4`,`.avi`,`.mkv`,`.mov`,`.wmv`,`.flv`,`.webm`,`.m4v`]),message:`Video files are not supported for indexing.`,alternatives:[`Extract subtitles or transcripts from videos and index those`,`Use GAIA's voice/talk mode for audio: gaia talk`],featureTitle:`Support video file indexing`},{label:`Audio`,extensions:new Set([`.mp3`,`.wav`,`.flac`,`.aac`,`.ogg`,`.wma`,`.m4a`,`.opus`]),message:`Audio files are not supported for indexing.`,alternatives:[`Use GAIA's voice mode for speech interaction: gaia talk`,`Transcribe audio to text first, then index the transcript`],featureTitle:`Support audio file transcription and indexing`},{label:`Archive`,extensions:new Set([`.zip`,`.rar`,`.7z`,`.tar`,`.gz`,`.bz2`,`.xz`,`.tgz`]),message:`Archive files must be extracted before indexing.`,alternatives:[`Extract the archive contents to a folder`,`Then index the folder or individual files from the Document Library`],featureTitle:`Support automatic archive extraction for indexing`},{label:`Executable`,extensions:new Set([`.exe`,`.msi`,`.dll`,`.so`,`.app`,`.dmg`,`.bin`,`.com`]),message:`Executable and binary files cannot be indexed.`,alternatives:[`Index source code files (.py, .js, .ts, .java, etc.) instead`,`Index documentation or README files from the project`],featureTitle:`Support binary file analysis`},{label:`Database`,extensions:new Set([`.sqlite`,`.db`,`.mdb`,`.accdb`,`.dbf`]),message:`Database files are not supported for direct indexing.`,alternatives:[`Export data to CSV or JSON format, then index those files`,`Use SQL queries to extract relevant data to a text file`],featureTitle:`Support database file indexing`},{label:`Microsoft Office`,extensions:new Set([`.doc`,`.ppt`,`.xls`]),message:`Legacy Office formats (.doc, legacy PowerPoint .ppt, legacy Excel .xls) are not supported — GAIA reads only the modern XML-based formats. Modern Word (.docx), PowerPoint (.pptx), and Excel (.xlsx) are supported.`,alternatives:[`Re-save as .docx — GAIA indexes modern Word documents directly`,`Save modern PowerPoint as .pptx — GAIA indexes .pptx directly`,`Re-save legacy .xls workbooks as .xlsx — GAIA supports modern Excel files`],featureTitle:`Support legacy Microsoft Office (doc, ppt, xls) indexing`}];function Zx(e){let t=e.toLowerCase().startsWith(`.`)?e.toLowerCase():`.${e.toLowerCase()}`;for(let e of Xx)if(e.extensions.has(t))return e;return null}var Qx=new Set(`.pdf,.pptx,.docx,.txt,.md,.mdx,.markdown,.rst,.csv,.json,.xlsx,.html,.htm,.xml,.svg,.yaml,.yml,.py,.js,.ts,.java,.c,.cpp,.h,.rs,.go,.rb,.sh,.bat,.ps1,.log,.cfg,.ini,.toml`.split(`,`));function $x(e){let t=e.toLowerCase().startsWith(`.`)?e.toLowerCase():`.${e.toLowerCase()}`;return Qx.has(t)}function eS(){let e=navigator.userAgent;return`**Environment:**\n- GAIA Version: 0.25.1\n- Platform: ${navigator.platform||`unknown`}\n- User Agent: ${e}\n- Interface: Agent UI (Web)`}function tS(e,t){let n=[`## Feature Description`,``,t||`I would like GAIA to support: **${e}**`,``,`## Use Case`,``,`_Describe how you would use this feature:_`,``,`## Current Workaround`,``,`_Is there a workaround you are currently using?_`,``,`---`,eS(),``,`_Submitted from GAIA Agent UI_`].join(`
|
|
59
|
-
`);return`${Yx}?${new URLSearchParams({title:`[Feature] ${e}`,body:n,labels:`enhancement,agent-ui`}).toString()}`}function nS(e,t){let n=[`## Bug Description`,``,t||e,``,`## Steps to Reproduce`,``,`1. Open GAIA Agent UI`,`2. _Describe what you did:_`,`3. `,``,`## Expected Behavior`,``,`_What did you expect to happen?_`,``,`## Actual Behavior`,``,`_What happened instead?_`,``,`---`,eS(),``,`_Submitted from GAIA Agent UI_`].join(`
|
|
60
|
-
`);return`${Yx}?${new URLSearchParams({title:`[Bug] ${e}`,body:n,labels:`bug,agent-ui`}).toString()}`}var rS={corrupted:`The file looks damaged. Re-download or re-export it, then index the new copy.`,encrypted:`The PDF needs a password to open. Save a copy without the password, then index that.`,empty:`The PDF has no readable text, which usually means it is a scan. Run OCR on it, then index it again.`,empty_file:`This file is empty. Add content to it, then index it again.`};function iS(e,t){return e.startsWith(t)?e.slice(t.length).trim():e}function aS({filename:e,error:t,status:n,kind:r,onDismiss:i,timeout:a=15e3}){let o=(0,R.useRef)(null);(0,R.useEffect)(()=>(a>0&&(o.current=setTimeout(i,a)),()=>{o.current&&clearTimeout(o.current)}),[i,a]);let s=e.includes(`.`)?`.`+e.split(`.`).pop()?.toLowerCase():``,c=s?Zx(s):null,l=t.toLowerCase().includes(`unsupported file type`)||t.toLowerCase().includes(`not supported for indexing`)||t.toLowerCase().includes(`file type not allowed`)||c!==null,u=t.toLowerCase().includes(`fetch`)||t.toLowerCase().includes(`network`)||t.toLowerCase().includes(`connect`),d,f,p,m=me,h=r?rS[r]:void 0;return h?(d=`"${e}" can't be read`,f=h,p=null,m=Tn):n===404?(d=`"${e}" doesn't exist`,f=iS(t,`File not found:`),p=null,m=Tn):n===403?(d=`GAIA can't read files in that location`,f=`${t} Or drop the file here instead (up to 20 MB) and GAIA keeps its own copy.`,p=null,m=Tn):l&&c?(d=`${c.label} files not supported`,f=c.message,p=tS(c.featureTitle),m=Tn):l&&!s?(d=`"${e}" has no file extension`,f=iS(t,`File type not allowed:`),p=null,m=Tn):l?(d=`File type not supported: ${s}`,f=`This file format cannot be indexed. Supported: PDF, PPTX, TXT, MD, CSV, JSON, XLSX, HTML, XML, YAML, and 30+ code file formats.`,p=tS(`Support ${s} file indexing`),m=Tn):u?(d=`Connection error`,f=`Could not reach the GAIA server. Make sure the backend is running.`,p=nS(`Upload connection error for ${e}`),m=me):(d=`Failed to index "${e}"`,f=t||`An unexpected error occurred during indexing.`,p=nS(`Indexing error: ${t.slice(0,80)}`),m=te),(0,B.jsxs)(`div`,{className:`upload-error-toast`,role:`alert`,children:[(0,B.jsx)(m,{size:16}),(0,B.jsxs)(`div`,{className:`upload-error-content`,children:[(0,B.jsx)(`div`,{className:`upload-error-title`,children:d}),(0,B.jsxs)(`div`,{className:`upload-error-detail`,children:[f,p&&` `,p===null?null:l?(0,B.jsx)(`a`,{href:p,target:`_blank`,rel:`noopener noreferrer`,children:`Request this feature →`}):(0,B.jsx)(`a`,{href:p,target:`_blank`,rel:`noopener noreferrer`,children:`Report this issue →`})]})]}),(0,B.jsx)(`button`,{className:`upload-error-dismiss`,onClick:i,"aria-label":`Dismiss`,children:(0,B.jsx)(Fn,{size:14})})]})}function oS(e,t){let n=e=>t.some(t=>t.id===e&&t.configured),r=oy(e);return r===`google`?n(`google`):r===`microsoft`?n(`microsoft`):r===`microsoft_work`?n(`microsoft_work`):n(`google`)||n(`microsoft`)||n(`microsoft_work`)}function sS(e,t){let n=e=>t.some(t=>t.id===e&&t.configured),r=oy(e);return r===`google`?`Google`:r===`microsoft`?`Microsoft`:r===`microsoft_work`?`Microsoft 365`:n(`google`)?`Google`:n(`microsoft`)?`Microsoft`:n(`microsoft_work`)?`Microsoft 365`:`Google`}var cS=4e3;function lS({content:e,onRetry:t}){let[n,r]=(0,R.useState)([]),[i,a]=(0,R.useState)(!1),o=(0,R.useCallback)(()=>{Gr().then(e=>r(e.connectors||[])).catch(e=>u.ui.warn(`ConnectorRetryBanner: connector fetch failed`,e))},[]),s=oS(e,n);if((0,R.useEffect)(()=>{o();let e=()=>o();return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[o]),(0,R.useEffect)(()=>{if(s)return;let e=setInterval(o,cS);return()=>clearInterval(e)},[s,o]),!s||i)return null;let c=sS(e,n);return(0,B.jsxs)(`div`,{className:`connector-retry-banner`,role:`status`,children:[(0,B.jsx)(ge,{size:14,className:`connector-retry-banner__icon`}),(0,B.jsxs)(`span`,{className:`connector-retry-banner__text`,children:[c,` connected since this reply — ask again to run it now.`]}),(0,B.jsxs)(`button`,{type:`button`,className:`connector-retry-banner__btn`,onClick:()=>{a(!0),t()},children:[(0,B.jsx)(Qt,{size:12}),(0,B.jsx)(`span`,{children:`Ask again`})]}),(0,B.jsx)(`button`,{type:`button`,className:`connector-retry-banner__dismiss`,onClick:()=>a(!0),"aria-label":`Dismiss`,children:`×`})]})}var uS=240,dS=1e5;function fS({value:e,onChange:t,onSubmit:n,onStop:r,streaming:i=!1,stopping:a=!1,queueWhileStreaming:o=!1,disabledReason:s,attachments:c,placeholder:l=`Ask GAIA anything`,autoFocus:u,inputRef:d,leftControls:f,rightControls:p}){let m=(0,R.useRef)(null),h=d??m,g=(0,R.useRef)(null),_=!!s,v=e.trim().length>0||c.hasUploaded,y=c.compose(e.trim()).length,b=y>dS,x=!_&&(!i||o)&&!c.uploading&&v&&!b,S=s||l;(0,R.useLayoutEffect)(()=>{let e=h.current;if(!e)return;let t=()=>{e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,uS)}px`};if(t(),typeof ResizeObserver>`u`)return;let n=e.clientWidth,r=new ResizeObserver(()=>{e.clientWidth!==n&&(n=e.clientWidth,t())});return r.observe(e),()=>r.disconnect()},[e,S,h]);let C=(0,R.useCallback)(e=>{e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),x&&n())},[x,n]),w=(0,R.useCallback)(e=>{e.dataTransfer?.files?.length&&(e.preventDefault(),e.stopPropagation(),c.addFiles(Array.from(e.dataTransfer.files)))},[c]);return(0,B.jsxs)(`div`,{className:`composer${_?` composer-disabled`:``}`,onDrop:w,onDragOver:e=>{e.dataTransfer?.types?.includes(`Files`)&&e.preventDefault()},children:[c.attachments.length>0&&(0,B.jsx)(`ul`,{className:`composer-attachments`,"aria-label":`Attached files`,children:c.attachments.map(e=>(0,B.jsxs)(`li`,{className:`composer-attachment${e.error?` has-error`:``}`,children:[e.isImage&&e.url?(0,B.jsx)(`img`,{src:e.url,alt:``,className:`composer-attachment-thumb`}):(0,B.jsx)(qe,{size:14,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:`composer-attachment-name`,title:e.name,children:e.name}),e.uploading&&(0,B.jsx)(`span`,{className:`composer-attachment-state`,children:`Uploading…`}),e.error&&(0,B.jsx)(`span`,{className:`composer-attachment-state`,role:`alert`,children:e.error}),(0,B.jsx)(`button`,{type:`button`,className:`composer-icon-btn`,onClick:()=>c.remove(e.id),"aria-label":`Remove ${e.name}`,children:(0,B.jsx)(Fn,{size:12})})]},e.id))}),(0,B.jsx)(`textarea`,{ref:h,className:`composer-input`,value:e,onChange:e=>t(e.target.value),onKeyDown:C,onPaste:e=>{c.handlePaste(e)},placeholder:S,rows:1,disabled:_,autoFocus:u,"aria-label":`Message`}),b&&(0,B.jsxs)(`p`,{className:`composer-limit-error`,role:`alert`,children:[`Too long to send: `,y.toLocaleString(),` of `,1e5.toLocaleString(),` characters.`,` `,`Save it as a file and attach it with +, and GAIA can read all of it.`]}),(0,B.jsxs)(`div`,{className:`composer-row`,children:[(0,B.jsxs)(`div`,{className:`composer-row-left`,children:[(0,B.jsx)(`button`,{type:`button`,className:`composer-icon-btn`,onClick:()=>g.current?.click(),disabled:_,"aria-label":`Attach files`,title:`Attach files`,children:(0,B.jsx)(Xt,{size:16})}),(0,B.jsx)(`input`,{ref:g,type:`file`,multiple:!0,hidden:!0,onChange:e=>{e.target.files&&c.addFiles(Array.from(e.target.files)),e.target.value=``}}),f]}),(0,B.jsxs)(`div`,{className:`composer-row-right`,children:[p,i&&o&&v&&(0,B.jsx)(`button`,{type:`button`,className:`composer-send`,onClick:n,disabled:!x,"aria-label":`Queue message`,title:`Queue it to send when this reply ends (Enter)`,children:(0,B.jsx)(E,{size:16})}),i?(0,B.jsx)(`button`,{type:`button`,className:`composer-send is-stop`,onClick:r,disabled:a,"aria-label":`Stop`,title:a?`Stopping…`:`Stop (Esc)`,children:(0,B.jsx)(yn,{size:12,fill:`currentColor`})}):(0,B.jsx)(`button`,{type:`button`,className:`composer-send`,onClick:n,disabled:!x,"aria-label":`Send`,title:`Send (Enter)`,children:(0,B.jsx)(E,{size:16})})]})]})]})}var pS=8,mS=8;function hS({label:e,warning:t,children:n,id:r,pinned:i=!1,onUnpin:a,tabIndex:o}){let s=(0,R.useId)(),c=r??s,l=(0,R.useRef)(null),u=(0,R.useRef)(null),[d,f]=(0,R.useState)(!1),p=d||i,[m,h]=(0,R.useState)(null);return(0,R.useLayoutEffect)(()=>{if(!p){h(null);return}let e=l.current?.getBoundingClientRect(),t=u.current?.getBoundingClientRect(),n=l.current?.closest(`[role="dialog"]`)?.getBoundingClientRect()??e;if(!e||!t||!n)return;let r=window.innerWidth,i=window.innerHeight,a,o;n.right+pS+t.width<=r-mS?(a=n.right+pS,o=e.top+e.height/2-t.height/2):n.left-pS-t.width>=mS?(a=n.left-pS-t.width,o=e.top+e.height/2-t.height/2):(a=Math.min(Math.max(mS,e.right-t.width),r-mS-t.width),o=e.top-pS-t.height>=mS?e.top-pS-t.height:e.bottom+pS),o=Math.min(Math.max(mS,o),i-mS-t.height),h({left:a,top:o})},[p]),(0,R.useEffect)(()=>{if(!p)return;let e=()=>{f(!1),a?.()};return window.addEventListener(`scroll`,e,!0),()=>window.removeEventListener(`scroll`,e,!0)},[p,a]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{ref:l,type:`button`,className:`info-bubble-icon${t?` is-warning`:``}`,"aria-label":e,tabIndex:o,"aria-describedby":p?c:void 0,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),onFocus:()=>f(!0),onBlur:()=>f(!1),onClick:e=>{e.stopPropagation(),f(e=>!e)},onKeyDown:e=>{e.key===`Escape`&&p&&(e.stopPropagation(),f(!1))},children:(0,B.jsx)(_t,{size:13,"aria-hidden":`true`})}),p&&(0,xb.createPortal)((0,B.jsx)(`div`,{ref:u,id:c,role:`tooltip`,className:`info-bubble`,style:m?{left:m.left,top:m.top}:{left:0,top:0,visibility:`hidden`},children:n}),document.body)]})}function gS(e){return e<.1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function _S(e){return e?`${gS(e.input_per_million)} in · ${gS(e.output_per_million)} out per 1M tokens`:`price unknown`}function vS(e){return`$${e.toFixed(2)}`}var yS=2e3,bS=`waiting_for_os_permission`,xS=5;function SS(e,t){let n=e.rank?`#${e.rank} ${e.note??``}`.trim():null;return t?[n,_S(e.price)].filter(e=>!!e):[rs(e.placement),e.size_gb?`${e.size_gb} GB`:null,e.tokens_per_second?`${Math.round(e.tokens_per_second)} tok/s on this PC`:null,n].filter(e=>!!e)}function CS({m:e,onDownload:t,busy:n}){if(os(e)){let t=Math.round(e.download_progress?.percent??0);return(0,B.jsxs)(`span`,{className:`model-state is-downloading`,title:`Downloading, ${t}%`,children:[(0,B.jsx)(L,{size:12,className:`spin`,"aria-hidden":`true`}),` `,t,`%`]})}let r=as(e);return r===`not_downloaded`?(0,B.jsx)(`button`,{type:`button`,className:`model-state-btn`,onClick:e=>{e.stopPropagation(),t()},disabled:n,"aria-label":`Download ${e.display_name??e.id}`,title:ns.not_downloaded,tabIndex:-1,children:(0,B.jsx)(Fe,{size:13,"aria-hidden":`true`})}):r===`loaded`?(0,B.jsx)(`span`,{className:`model-state is-loaded`,role:`img`,"aria-label":ns.loaded,title:ns.loaded}):(0,B.jsx)(`span`,{className:`model-state is-ready`,title:ns.downloaded,children:`Ready`})}function wS(){let e=Wo(e=>e.active),t=Wo(e=>e.select),n=Wo(e=>e.queued),r=Wo(e=>e.queue),i=Wo(e=>e.queueError),a=Wo(e=>e.rememberNames);Wo(e=>e.names);let o=Xo(),s=z(t=>Zo(e,t.sessions,t.currentSessionId)),c=z(e=>e.isStreaming),l=z(e=>e.openSettings),u=(0,R.useRef)(null),[d,f]=(0,R.useState)(!1),[p,m]=(0,R.useState)(null),[h,g]=(0,R.useState)(0),[_,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(null),[x,S]=(0,R.useState)(null),[C,w]=(0,R.useState)(null),[T,E]=(0,R.useState)(null),[D,O]=(0,R.useState)(0),[k,A]=(0,R.useState)(null),j=(0,R.useRef)(0),M=(0,R.useRef)(null),ee=(0,R.useId)(),te=(0,R.useRef)(null),[N,ne]=(0,R.useState)(null),[re,ie]=(0,R.useState)(null),ae=(0,R.useCallback)(()=>ie(null),[]),se=(0,R.useCallback)(()=>f(!1),[]),le=(0,R.useRef)(!1),ue=(0,R.useCallback)(async(e=!1)=>{e||(le.current=!1,v(null),m(null));try{let{providers:t,lemonade_error:n}=await ea();if(n)throw Error(n);let r=t.filter(e=>!e.remote||e.models_discovered||e.id===`fireworks`||e.registered),i=await Promise.all(r.map(async e=>{if(e.remote&&!e.models_discovered)return{provider:e,models:[]};try{return{provider:e,models:(await aa(e.id)).models}}catch(t){return{provider:e,models:[],error:t instanceof Error?t.message:String(t)}}}));a(i.flatMap(e=>e.models)),g(i.flatMap(e=>e.models).filter(e=>e.available===!1).length),e||(le.current=!0),m(i.map(e=>({...e,models:e.models.filter(e=>e.available!==!1)})))}catch(e){v(e instanceof Error?e.message:String(e))}},[a]);(0,R.useEffect)(()=>{d&&(b(null),ne(null),ie(null),ue())},[d,ue]),(0,R.useEffect)(()=>{if(!d||!p||!le.current)return;let e=te.current?.querySelector(`[role="option"][tabindex="0"]`);e&&(le.current=!1,e.focus(),e.scrollIntoView?.({block:`nearest`}))},[d,p]);let de=e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;let t=Array.from(te.current?.querySelectorAll(`[role="option"]:not(:disabled)`)??[]);if(!t.length)return;let n=t.indexOf(document.activeElement),r;switch(e.key){case`ArrowDown`:r=n<0?0:Math.min(n+1,t.length-1);break;case`ArrowUp`:r=n<0?t.length-1:Math.max(n-1,0);break;case`Home`:r=0;break;case`End`:r=t.length-1;break;case`ArrowRight`:case`i`:{let r=n<0?void 0:t[n].dataset.row;if(!r)return;e.preventDefault(),ie(t=>e.key===`i`&&t===r?null:r);return}case`ArrowLeft`:e.preventDefault(),ie(null);return;default:return}e.preventDefault(),t[r].focus(),t[r].scrollIntoView?.({block:`nearest`})},fe=!!p?.some(e=>e.models.some(os)),pe=!!p?.some(e=>e.provider.key_state===bS);(0,R.useEffect)(()=>{if(!(d||T)||!(fe||T||pe))return;let e=setInterval(()=>{ue(!0)},yS);return()=>clearInterval(e)},[d,fe,T,pe,ue]);let he=(0,R.useCallback)(async e=>{w(e),O(e=>e+1),v(null);try{await Bi(e),await ue(!0)}catch(t){E(t=>t?.model===e?null:t),v(t instanceof Error?t.message:String(t))}finally{w(null),O(e=>e-1)}},[ue]),ge=(0,R.useCallback)(async(n,i)=>{if(i.remote&&!e?.remote&&y?.model!==n)return b({model:n,provider:i}),null;if(b(null),c)return r(n===e?.model?null:n),f(!1),null;S(n),v(null);try{return await t(n),A(null),f(!1),null}catch(e){let t=e instanceof Error?e.message:String(e);return v(t),t}finally{S(null)}},[e?.model,e?.remote,y,r,t,c]);(0,R.useEffect)(()=>{if(!T||!p||D>0)return;let{model:e,provider:t}=T,n=()=>(M.current!==p&&(M.current=p,j.current+=1),j.current>=xS),r=p.flatMap(e=>e.models).find(t=>t.id===e);if(!r){if(!n())return;E(null),A(`${Ko(e)} is no longer in the model list, so it wasn't switched to.`);return}if(os(r)){j.current=0;return}let i=r.download_progress;if(i?.state===`error`)E(null),A(`Downloading ${Ko(e)} failed: ${i.message??`no reason given`}`);else if(i?.state!==`complete`&&as(r)===`not_downloaded`){if(!n())return;E(null),A(`The download of ${Ko(e)} never started. Try the download button again.`)}else E(null),ge(e,t).then(t=>{t&&A(`${Ko(e)} downloaded, but switching to it failed: ${t}`)})},[p,T,D,ge]);let P=p?.flatMap(({provider:e,models:t})=>[...e.remote&&!e.models_discovered?[`key:${e.id}`]:[],...t.filter(e=>x===null&&!os(e)).map(e=>e.id)])??[],F=n??e?.model,I=N&&P.includes(N)?N:F&&P.includes(F)?F:P[0],ve=e=>({role:`option`,tabIndex:e===I?0:-1,"data-row":e,onFocus:()=>ne(e),onBlur:()=>ie(null)}),ye=o?.remote?Ce:o?je:_e,be=s?Ko(s):`Model`,xe=`${be}${o?` · ${o.label}`:``}`,Se=Object.fromEntries((p??[]).map(e=>[e.provider.id,es(e.models)])),we=e?.downloaded===!1&&s===e.model,Te=k||i||(n?`${Ko(n)} is used from your next message.`:e?.config_error?e.config_error:we?`${be} isn't downloaded yet. Open the list to download it.`:o?o.description?.replace(/`/g,``)??(o.remote?`Runs on ${o.label} — chat history leaves this PC`:`Runs on this PC`):Yo);return(0,B.jsxs)(`div`,{className:`composer-chip-wrap`,children:[(0,B.jsxs)(`button`,{ref:u,type:`button`,className:`composer-chip${we||i||k?` is-warning`:``}`,onClick:()=>f(e=>!e),"aria-haspopup":`dialog`,"aria-expanded":d,title:Te,children:[(0,B.jsx)(ye,{size:13,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:`composer-chip-label`,children:xe}),n&&(0,B.jsxs)(`span`,{className:`composer-chip-next`,children:[`→ `,Ko(n),` next`]}),we&&(0,B.jsx)(Fe,{size:12,"aria-label":`Not downloaded`}),k&&(0,B.jsx)(me,{size:12,"aria-label":`Model switch failed`}),(0,B.jsx)(ce,{size:12,"aria-hidden":`true`})]}),(0,B.jsxs)(Wr,{open:d,onClose:se,anchor:u,label:`Choose a model`,align:`end`,children:[c&&(0,B.jsxs)(`div`,{className:`popover-message`,role:`status`,children:[`This reply keeps `,s?Ko(s):`its model`,`. A model you pick here is used from your next message.`]}),k&&(0,B.jsx)(`div`,{className:`popover-message is-error`,role:`alert`,children:k}),i&&(0,B.jsx)(`div`,{className:`popover-message is-error`,role:`alert`,children:i}),_&&(0,B.jsx)(`div`,{className:`popover-message is-error`,role:`alert`,children:_}),!p&&!_&&(0,B.jsxs)(`div`,{className:`popover-message`,children:[(0,B.jsx)(L,{size:13,className:`spin`}),` Loading models…`]}),p&&(0,B.jsx)(`div`,{ref:te,role:`listbox`,"aria-label":`Models`,onKeyDown:de,children:p.map(({provider:t,models:r,error:i})=>(0,B.jsxs)(`div`,{role:`group`,"aria-labelledby":`${ee}-${t.id}`,children:[(0,B.jsx)(`div`,{className:`popover-heading`,id:`${ee}-${t.id}`,children:t.name}),i&&(0,B.jsx)(`div`,{className:`popover-message is-error`,children:i}),t.key_state===bS?(0,B.jsxs)(`div`,{className:`popover-message`,role:`status`,children:[(0,B.jsx)(L,{size:13,className:`spin`,"aria-hidden":`true`}),` `,t.key_message]}):t.remote&&!t.models_discovered&&(0,B.jsxs)(`button`,{type:`button`,className:`popover-item`,...ve(`key:${t.id}`),"aria-selected":!1,onClick:()=>{f(!1),l(`model`)},children:[(0,B.jsx)(`span`,{className:`popover-item-check`,children:(0,B.jsx)(yt,{size:13,"aria-hidden":`true`})}),(0,B.jsxs)(`span`,{className:`popover-item-body`,children:[(0,B.jsx)(`span`,{className:`popover-item-title`,children:`Add your key`}),(0,B.jsxs)(`span`,{className:`popover-item-note`,children:[`Connect `,t.name,` in Settings`]})]})]}),!i&&r.length===0&&t.models_discovered!==!1&&(0,B.jsx)(`div`,{className:`popover-message`,children:`No models yet.`}),r.map(r=>{let i=(n??e?.model)===r.id,a=!t.remote&&as(r)===`not_downloaded`,o=Se[t.id][r.id],s=SS(r,t.remote),c=`${ee}-info-${t.id}-${r.id}`;return(0,B.jsxs)(`div`,{className:`popover-row`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`popover-item`,onClick:()=>{a?(j.current=0,A(null),E({model:r.id,provider:t}),he(r.id)):(E(null),ge(r.id,t))},disabled:x!==null||os(r),...ve(r.id),"aria-selected":i,"aria-describedby":re===r.id?c:void 0,children:[(0,B.jsx)(`span`,{className:`popover-item-check`,"aria-hidden":`true`,children:x===r.id?(0,B.jsx)(L,{size:13,className:`spin`}):i?(0,B.jsx)(oe,{size:13}):null}),(0,B.jsx)(`span`,{className:`popover-item-body`,children:(0,B.jsx)(`span`,{className:`popover-item-title`,children:o})})]}),(0,B.jsxs)(hS,{label:`About ${o}`,warning:!!r.placement?.warning,id:c,pinned:re===r.id,onUnpin:ae,tabIndex:-1,children:[(0,B.jsx)(`div`,{className:`info-bubble-title`,children:o}),s.length>0&&(0,B.jsx)(`ul`,{className:`info-bubble-lines`,children:s.map(e=>(0,B.jsx)(`li`,{children:e},e))}),r.placement?.warning&&(0,B.jsx)(`ul`,{className:`info-bubble-lines`,children:(0,B.jsx)(`li`,{className:`is-warning`,children:r.placement.warning})}),(0,B.jsx)(`div`,{className:`info-bubble-id`,children:r.id})]}),(0,B.jsx)(`span`,{className:`popover-row-state`,children:!t.remote&&(0,B.jsx)(CS,{m:r,busy:C!==null,onDownload:()=>void he(r.id)})})]},r.id)})]},t.id))}),y&&(0,B.jsxs)(`div`,{className:`popover-message`,role:`alert`,children:[y.provider.privacy_notice,` `,(0,B.jsxs)(`button`,{type:`button`,className:`link-btn`,onClick:()=>ge(y.model,y.provider),children:[`Use `,Ko(y.model)]})]}),h>0&&(0,B.jsxs)(`button`,{type:`button`,className:`popover-item`,onClick:()=>{f(!1),l(`model`)},children:[(0,B.jsx)(`span`,{className:`popover-item-check`}),(0,B.jsx)(`span`,{className:`popover-item-body`,children:(0,B.jsxs)(`span`,{className:`popover-item-note`,children:[h,` `,h===1?`model isn’t`:`models aren’t`,` available on this PC — see why in Settings`]})})]}),(0,B.jsx)(`div`,{className:`popover-divider`}),(0,B.jsxs)(`button`,{type:`button`,className:`popover-item`,onClick:()=>{f(!1),l(`model`)},children:[(0,B.jsx)(`span`,{className:`popover-item-check`}),(0,B.jsx)(`span`,{className:`popover-item-body`,children:(0,B.jsx)(`span`,{className:`popover-item-title`,children:`Providers and keys…`})})]})]})]})}var TS=`gaia:permission-mode`;function ES(e,t){window.dispatchEvent(new CustomEvent(TS,{detail:{sessionId:e,mode:t}}))}function DS(e,t){let n=(0,R.useRef)(t);n.current=t,(0,R.useEffect)(()=>{if(!e)return;let t=t=>{let r=t.detail;r?.sessionId===e&&n.current(r.mode)};return window.addEventListener(TS,t),()=>window.removeEventListener(TS,t)},[e])}var OS=[{mode:`ask`,label:`Ask before acting`,note:`GAIA asks before it edits files, runs commands or uses tools that change things.`},{mode:`full_access`,label:`Full access`,note:`Runs every tool and command without asking, in this chat only.`}];function kS({sessionId:e,disabled:t}){let n=z(e=>e.draftPermissionMode),r=z(e=>e.setDraftPermissionMode),[i,a]=(0,R.useState)(e?`ask`:n),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(null),f=(0,R.useRef)(null);(0,R.useEffect)(()=>{if(!e){a(n);return}let t=!1;return gi(e).then(e=>{t||a(e.mode)}).catch(e=>{t||d(e instanceof Error?e.message:String(e))}),()=>{t=!0}},[e,n]),DS(e,a);let p=(0,R.useCallback)(async t=>{if(t===`full_access`&&!c)l(!0);else{d(null);try{if(e){let n=(await vi(e,t)).mode;a(n),ES(e,n)}else r(t),a(t);s(!1)}catch(t){d(t instanceof Error?t.message:String(t)),e&&gi(e).then(e=>a(e.mode)).catch(e=>d(t=>`${t??``} Couldn't re-read the saved mode: ${e instanceof Error?e.message:String(e)}`.trim()))}finally{l(!1)}}},[c,e,r]),m=i===`full_access`;return(0,B.jsxs)(`div`,{className:`composer-chip-wrap`,children:[(0,B.jsxs)(`button`,{ref:f,type:`button`,className:`composer-chip${m?` is-warning`:``}`,onClick:()=>{l(!1),s(e=>!e)},disabled:t,"aria-haspopup":`dialog`,"aria-expanded":o,"aria-label":`Permission mode: ${m?`full access`:`ask before acting`}`,children:[(0,B.jsx)(m?sn:ln,{size:13,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:`composer-chip-label`,children:m?`Full access`:`Ask`}),(0,B.jsx)(ce,{size:12,"aria-hidden":`true`})]}),(0,B.jsxs)(Wr,{open:o,onClose:()=>s(!1),anchor:f,label:`Permission mode`,children:[OS.map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`popover-item`,onClick:()=>p(e.mode),"aria-pressed":i===e.mode,children:[(0,B.jsx)(`span`,{className:`popover-item-check`,"aria-hidden":`true`,children:i===e.mode&&(0,B.jsx)(oe,{size:13})}),(0,B.jsxs)(`span`,{className:`popover-item-body`,children:[(0,B.jsx)(`span`,{className:`popover-item-title`,children:e.label}),(0,B.jsx)(`span`,{className:`popover-item-note`,children:e.note})]})]},e.mode)),c&&(0,B.jsxs)(`div`,{className:`popover-message`,role:`alert`,children:[`Full access lets GAIA change files and run commands on this PC without asking.`,` `,(0,B.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>p(`full_access`),children:`Turn it on`})]}),u&&(0,B.jsx)(`div`,{className:`popover-message is-error`,role:`alert`,children:u})]})]})}var AS={sending:`Adding to the running reply…`,delivered:`Added to the running reply. GAIA reads it at its next step.`,queued:`Queued. Sends when this reply ends.`};function jS(e,t){return e?AS.queued:t?`GAIA is still busy in this chat. Trying again in a few seconds.`:`Sending next.`}function MS({items:e,onRemove:t,onSteer:n,onRetry:r,replying:i=!0,busyRetry:a=!1}){let o=e.filter(e=>e.state!==`starting`);return o.length===0?null:(0,B.jsx)(`ul`,{className:`queued-messages`,"aria-label":`Messages waiting to send`,"aria-live":`polite`,children:o.map(e=>(0,B.jsxs)(`li`,{className:`queued-message is-${e.state}`,children:[e.state===`failed`?(0,B.jsx)(me,{size:12,"aria-hidden":`true`}):e.state===`queued`?(0,B.jsx)(xe,{size:12,"aria-hidden":`true`}):(0,B.jsx)(ke,{size:12,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:`queued-message-text`,title:e.text,children:e.text}),(0,B.jsx)(`span`,{className:`queued-message-state`,title:e.error,children:e.state===`failed`?`Not sent. ${e.error??``}`.trim():e.state===`queued`?jS(i,a):AS[e.state]}),e.state===`failed`&&(0,B.jsxs)(`button`,{type:`button`,className:`queued-message-steer`,onClick:()=>r(e.id),"aria-label":`Send again: ${e.text}`,children:[(0,B.jsx)(en,{size:11,"aria-hidden":`true`}),` Send again`]}),e.state===`queued`&&n&&(0,B.jsx)(`button`,{type:`button`,className:`queued-message-steer`,onClick:()=>n(e.id),title:`GAIA reads it at its next step, without starting over. It may not answer it separately.`,children:`Add to this reply`}),(e.state===`queued`||e.state===`failed`)&&(0,B.jsx)(`button`,{type:`button`,className:`queued-message-remove`,onClick:()=>t(e.id),"aria-label":`Remove queued message: ${e.text}`,title:`Remove`,children:(0,B.jsx)(Fn,{size:12})})]},e.id))})}var NS=`unknown`,PS=e=>e.toLocaleString(`en-US`);function FS({n:e}){if(e==null)return(0,B.jsx)(`span`,{className:`cp-unknown`,children:NS});let t=e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4))}K`:`${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`;return(0,B.jsx)(`span`,{title:`${PS(e)} tokens`,children:t})}function IS({s:e}){if(e==null)return(0,B.jsx)(`span`,{className:`cp-unknown`,children:NS});let t=e<.1?e===0?`0 s`:`<0.1 s`:e<10?`${e.toFixed(1)} s`:`${Math.round(e)} s`;return(0,B.jsx)(`span`,{title:`${(e*1e3).toFixed(0)} ms`,children:t})}function LS({r:e}){return e==null?(0,B.jsx)(`span`,{className:`cp-unknown`,children:NS}):(0,B.jsxs)(`span`,{title:`${e} tokens per second`,children:[Math.round(e).toLocaleString(`en-US`),` tokens/s`]})}var RS=(e,t)=>t>0?Math.round(e/t*100):0,zS=(e,t)=>{let n=RS(e,t);return n===0&&e>0?`<1`:String(n)},BS=(e,t)=>t&&e!=null?Math.floor(e/t*100):null,VS=256;function HS(e){if(e.provider===`unknown`)return NS;if(e.provider===`cloud`)return`Cloud`;if(e.provider!==`local`)return`Cloud · ${ts(e.provider)}`;if(!e.device)return e.loaded===!1?`Not loaded now`:NS;let t=e.device.toUpperCase(),n=e.backend===`npu`?`FLM`:e.backend;return n&&n!==e.device?`${t} · ${n.charAt(0).toUpperCase()}${n.slice(1)}`:t}function US({label:e,children:t,hint:n}){return(0,B.jsxs)(`div`,{className:`cp-row`,title:n,children:[(0,B.jsx)(`dt`,{children:e}),(0,B.jsx)(`dd`,{children:t})]})}function WS({t:e}){if(e.model_seconds==null||e.gaia_seconds==null)return(0,B.jsxs)(US,{label:`Took`,children:[(0,B.jsx)(IS,{s:e.wall_seconds}),` · split `,(0,B.jsx)(`span`,{className:`cp-unknown`,children:NS})]});let t=[{key:`model`,label:`In the model`,s:e.model_seconds},{key:`tools`,label:`Running tools`,s:e.tool_seconds},{key:`waiting`,label:`Waiting on you`,s:e.waiting_seconds},{key:`gaia`,label:`GAIA itself`,s:e.own_seconds??0}];return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(US,{label:`Took`,hint:`From sending the message to the answer being saved`,children:(0,B.jsx)(IS,{s:e.wall_seconds})}),(0,B.jsx)(`div`,{className:`cp-stack`,"aria-hidden":`true`,children:t.map(t=>(0,B.jsx)(`span`,{className:`cp-time-${t.key}`,style:{width:`${RS(t.s,e.wall_seconds)}%`}},t.key))}),(0,B.jsxs)(`dl`,{className:`cp-rows cp-indent`,children:[(0,B.jsx)(US,{label:`In the model`,children:(0,B.jsx)(IS,{s:e.model_seconds})}),(0,B.jsx)(US,{label:`In GAIA`,hint:`Everything that was not the model: tools, waiting on you, and GAIA's own work`,children:(0,B.jsx)(IS,{s:e.gaia_seconds})}),t.slice(1).filter(e=>e.s>0).map(e=>(0,B.jsxs)(US,{label:`· ${e.label}`,children:[(0,B.jsx)(`span`,{className:`swatch cp-time-${e.key}`,"aria-hidden":`true`}),` `,(0,B.jsx)(IS,{s:e.s})]},e.key))]})]})}function GS({why:e}){return(0,B.jsx)(`span`,{className:`cp-unknown`,title:e,children:NS})}var KS={server:`Reported by the model server`,client:`Measured by GAIA on the stream, network included`};function qS(e){return e?KS[e]:void 0}function JS({turn:e}){let t=BS(e.tokens_cached,e.tokens_in),n=e.unknown??{},r=e.tools.map(e=>`${e.name??`tool work outside a step`}: ${e.seconds??`?`} s`).join(`
|
|
61
|
-
`);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(WS,{t:e.time}),(0,B.jsxs)(`dl`,{className:`cp-rows`,children:[(0,B.jsx)(US,{label:`First word`,hint:qS(e.first_token_source),children:e.first_token_seconds==null?(0,B.jsx)(GS,{why:n.first_token_seconds}):(0,B.jsxs)(B.Fragment,{children:[`in `,(0,B.jsx)(IS,{s:e.first_token_seconds})]})}),(0,B.jsx)(US,{label:`Reading the prompt`,hint:`Prefill: new prompt tokens over time to first token`,children:e.tokens_new!=null&&e.tokens_new<VS?(0,B.jsxs)(`span`,{title:`Too few new tokens to give a reading speed; the rest came from the cache`,children:[`only `,e.tokens_new,` new tokens`]}):e.prefill_tokens_per_second==null?(0,B.jsx)(GS,{why:n.prefill_tokens_per_second}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(LS,{r:e.prefill_tokens_per_second}),e.prefill_source===`client`&&(0,B.jsx)(`span`,{className:`cp-chip`,title:`Measured by GAIA from the first word, so it includes network and queue time`,children:`approx.`})]})}),(0,B.jsx)(US,{label:`Writing the answer`,hint:qS(e.generation_source)??`Generation speed, weighted by tokens`,children:e.generation_tokens_per_second==null?(0,B.jsx)(GS,{why:n.generation_tokens_per_second}):(0,B.jsx)(LS,{r:e.generation_tokens_per_second})}),(0,B.jsxs)(US,{label:`Tokens in → out`,hint:n.tokens,children:[(0,B.jsx)(FS,{n:e.tokens_in}),` → `,(0,B.jsx)(FS,{n:e.tokens_out})]}),(0,B.jsx)(US,{label:`Reused from cache`,hint:`Prompt tokens the server did not have to read again`,children:e.tokens_cached==null?(0,B.jsx)(GS,{why:n.tokens_cached}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(FS,{n:e.tokens_cached}),t!=null&&` (${t}%)`]})}),(0,B.jsx)(US,{label:`Model calls`,children:e.model_calls}),(0,B.jsx)(US,{label:`Tool calls`,hint:r||void 0,children:e.tool_calls===0&&!e.tool_seconds_total?`none`:(0,B.jsxs)(B.Fragment,{children:[e.tool_calls,` · `,(0,B.jsx)(IS,{s:e.tool_seconds_total??0})]})}),(0,B.jsx)(US,{label:`Model loads`,children:e.loads.length===0?`none`:(0,B.jsxs)(`span`,{title:e.loads.map(e=>`${e.model}${e.replaced?.length?` replaced ${e.replaced.join(`, `)}`:``}: ${e.seconds} s`).join(`
|
|
62
|
-
`),children:[e.loads.length,` · `,(0,B.jsx)(IS,{s:e.loads.reduce((e,t)=>e+t.seconds,0)})]})}),(0,B.jsx)(US,{label:`Cost`,children:(0,B.jsx)(YS,{cost:e.cost})})]})]})}function YS({cost:e}){return e.kind===`local`?(0,B.jsx)(`span`,{title:`Runs on this PC`,children:`$0 · on this PC`}):e.kind===`estimate`&&e.usd!=null?(0,B.jsxs)(`span`,{title:`$${e.usd} at list price`,children:[`about $`,e.usd<.01?e.usd.toFixed(4):e.usd.toFixed(2)]}):(0,B.jsx)(`span`,{className:`cp-unknown`,children:NS})}function XS({totals:e}){let t=BS(e.tokens_cached,e.tokens_in);return(0,B.jsxs)(`dl`,{className:`cp-rows`,children:[(0,B.jsx)(US,{label:`Turns measured`,children:e.turns}),(0,B.jsx)(US,{label:`Total time`,children:(0,B.jsx)(IS,{s:e.wall_seconds})}),(0,B.jsx)(US,{label:`In the model`,children:(0,B.jsx)(IS,{s:e.model_seconds})}),(0,B.jsx)(US,{label:`In GAIA`,children:(0,B.jsx)(IS,{s:e.gaia_seconds})}),(0,B.jsxs)(US,{label:`Tokens in → out`,children:[(0,B.jsx)(FS,{n:e.tokens_in}),` → `,(0,B.jsx)(FS,{n:e.tokens_out})]}),(0,B.jsx)(US,{label:`Reused from cache`,children:e.tokens_cached==null?(0,B.jsx)(`span`,{className:`cp-unknown`,children:NS}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(FS,{n:e.tokens_cached}),t!=null&&` (${t}%)`]})}),(0,B.jsx)(US,{label:`Tool calls`,children:e.tool_calls}),(0,B.jsx)(US,{label:`Model loads`,children:e.loads===0?`none`:(0,B.jsxs)(B.Fragment,{children:[e.loads,` · `,(0,B.jsx)(IS,{s:e.load_seconds})]})}),(0,B.jsx)(US,{label:`Cost`,children:e.unpriced_turns>0?(0,B.jsxs)(`span`,{title:`${e.unpriced_turns} turn(s) on a model with no known price`,children:[`$`,e.usd.toFixed(2),` + `,e.unpriced_turns,` unpriced`]}):e.usd===0?`$0`:`about $${e.usd.toFixed(2)}`})]})}function ZS({usage:e}){let t=e.context_state?.put_away,n=e.context_state?.summarized;return(0,B.jsxs)(`div`,{className:`cp-full`,children:[(0,B.jsxs)(`dl`,{className:`cp-rows`,children:[(0,B.jsx)(US,{label:`Live in the window`,children:(0,B.jsx)(FS,{n:e.used})}),t&&t.results>0&&(0,B.jsxs)(US,{label:`Put away`,hint:`Older tool results moved out of the prompt; still readable`,children:[t.results,` `,t.results===1?`result`:`results`,` · `,(0,B.jsx)(FS,{n:t.tokens})]}),n&&n.turns>0&&(0,B.jsxs)(US,{label:`Summarized`,hint:`Older turns folded into a running summary; the originals stay saved`,children:[n.turns,` earlier `,n.turns===1?`turn`:`turns`,` · `,(0,B.jsx)(FS,{n:n.tokens}),` → `,(0,B.jsx)(FS,{n:n.summary_tokens})]})]}),n&&n.turns>0&&(0,B.jsx)(`p`,{className:`cp-note cp-summarized`,children:`Earlier messages summarized — still searchable.`}),e.at_risk.length>0&&(0,B.jsx)(`p`,{className:`cp-warning`,role:`status`,children:`The window is filling up. Older tool results move out of the prompt and stay readable, and the oldest turns may drop out of the model's view. They stay saved, and you can ask GAIA to recall them.`})]})}function QS({sessionId:e,busy:t,onUsage:n}){let[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(null),[l,d]=(0,R.useState)(null),[f,p]=(0,R.useState)(null),[m,h]=(0,R.useState)(`turn`),g=(0,R.useRef)(n);g.current=n;let _=(0,R.useCallback)(()=>{let t=!1,n=(n,r)=>i=>{t||(u.chat.error(`Could not read the ${n} for session=${e}`,i),r(i instanceof Error?i.message:String(i)))};return li(e).then(e=>{t||(e.available?(i(e),o(null),g.current?.(e)):(i(null),o(e.reason)),d(null))}).catch(n(`context usage`,d)),ui(e).then(e=>{t||(c(e),p(null))}).catch(n(`performance`,p)),()=>{t=!0}},[e]);(0,R.useEffect)(()=>_(),[_]);let v=(0,R.useRef)(t);(0,R.useEffect)(()=>{let e=v.current&&!t;return v.current=t,e?_():void 0},[t,_]);let y=s?.turns[s.turns.length-1]??null,b=y&&y.message_id===s?.latest_message_id?y:null,x=r?Math.max(0,r.window-r.used):0;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`section`,{"aria-labelledby":`cp-context`,children:[(0,B.jsx)(`h3`,{id:`cp-context`,children:`Context`}),l&&(0,B.jsx)(`p`,{className:`cp-error`,role:`alert`,children:l}),!r&&!l&&(0,B.jsx)(`p`,{className:`cp-note`,children:a??`Measuring…`}),r&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`p`,{className:`cp-lead`,children:[(0,B.jsxs)(`strong`,{children:[RS(r.used,r.window),`% used`]}),` · `,(0,B.jsx)(FS,{n:r.used}),` of `,(0,B.jsx)(FS,{n:r.window}),` tokens`,r.model&&(0,B.jsxs)(B.Fragment,{children:[` · `,(0,B.jsx)(`span`,{className:`cp-model`,children:r.model})]}),r.model_window!=null&&r.model_window>r.window&&(0,B.jsxs)(`span`,{className:`cp-window-note`,title:`GAIA admits this much of the window, so older turns drop out of view sooner than the model would need`,children:[` `,`· GAIA uses `,(0,B.jsx)(FS,{n:r.window}),` of the model's `,(0,B.jsx)(FS,{n:r.model_window})]}),r.tokenizer&&!r.tokenizer.exact&&(0,B.jsx)(`span`,{className:`cp-chip`,title:r.tokenizer.reason,children:`approx.`})]}),(0,B.jsx)(`div`,{className:`cp-stack`,"aria-hidden":`true`,children:(r.categories??[]).map(e=>(0,B.jsx)(`span`,{className:`cp-cat-${e.key}`,style:{width:`${e.tokens/r.window*100}%`}},e.key))}),(0,B.jsxs)(`dl`,{className:`cp-rows`,children:[(r.categories??[]).map(e=>(0,B.jsxs)(`div`,{className:`cp-row`,children:[(0,B.jsxs)(`dt`,{children:[(0,B.jsx)(`span`,{className:`swatch cp-cat-${e.key}`,"aria-hidden":`true`}),e.label]}),(0,B.jsxs)(`dd`,{children:[(0,B.jsx)(FS,{n:e.tokens}),` `,(0,B.jsxs)(`span`,{className:`cp-pct`,children:[zS(e.tokens,r.window),`%`]})]})]},e.key)),(0,B.jsxs)(`div`,{className:`cp-row is-quiet`,children:[(0,B.jsxs)(`dt`,{children:[(0,B.jsx)(`span`,{className:`swatch cp-cat-free`,"aria-hidden":`true`}),`Free`]}),(0,B.jsxs)(`dd`,{children:[(0,B.jsx)(FS,{n:x}),` `,(0,B.jsxs)(`span`,{className:`cp-pct`,children:[RS(x,r.window),`%`]})]})]}),(0,B.jsxs)(`div`,{className:`cp-row is-quiet cp-indent`,children:[(0,B.jsx)(`dt`,{children:`of which kept for the reply`}),(0,B.jsx)(`dd`,{children:(0,B.jsx)(FS,{n:Math.min(x,r.reply_reserve)})})]})]}),(0,B.jsxs)(`p`,{className:`cp-note`,children:[r.tokenizer?.exact?`Each part counted with ${r.tokenizer.model}'s own tokenizer.`:`Estimated: ${r.tokenizer?.reason??`counted with a shared tokenizer.`}`,b?.last_prompt_tokens!=null&&(0,B.jsxs)(B.Fragment,{children:[` `,`The last request carried`,` `,(0,B.jsx)(`span`,{title:`${PS(b.last_prompt_tokens)} tokens`,children:PS(b.last_prompt_tokens)}),` `,`tokens as the model server counted them, chat formatting included.`]})]}),r.tool_loading&&r.tool_loading.on_demand.length>0&&(0,B.jsxs)(`details`,{className:`cp-details`,children:[(0,B.jsxs)(`summary`,{children:[r.tool_loading.on_demand.length,` more tools load only when needed`]}),(0,B.jsxs)(`p`,{className:`cp-note`,children:[`Sent now: `,r.tool_loading.loaded.length,`. These cost nothing until a turn needs them:`]}),(0,B.jsx)(`ul`,{className:`cp-tools`,children:r.tool_loading.on_demand.map(e=>(0,B.jsx)(`li`,{children:e},e))})]}),(0,B.jsx)(ZS,{usage:r})]})]}),(0,B.jsxs)(`section`,{"aria-labelledby":`cp-hood`,children:[(0,B.jsxs)(`div`,{className:`cp-section-head`,children:[(0,B.jsx)(`h3`,{id:`cp-hood`,children:`Under the hood`}),(0,B.jsxs)(`div`,{className:`cp-toggle`,role:`group`,"aria-label":`Show`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-pressed":m===`turn`,onClick:()=>h(`turn`),children:`Last turn`}),(0,B.jsx)(`button`,{type:`button`,"aria-pressed":m===`chat`,onClick:()=>h(`chat`),children:`This chat`})]})]}),s&&(0,B.jsxs)(`dl`,{className:`cp-rows`,children:[(0,B.jsx)(US,{label:`Runs on`,hint:s.now.error??void 0,children:HS(s.now)}),s.now.provider===`local`&&(0,B.jsxs)(US,{label:`Model memory`,hint:`Model weights + KV cache at this window; free memory now`,children:[s.now.weights_gb==null?(0,B.jsx)(`span`,{className:`cp-unknown`,children:NS}):(0,B.jsxs)(B.Fragment,{children:[s.now.weights_gb.toFixed(1),` GB model`,s.now.kv_cache_gb!=null&&` + ${s.now.kv_cache_gb.toFixed(1)} GB cache`]}),` · `,s.now.free_gb==null?(0,B.jsxs)(`span`,{className:`cp-unknown`,children:[`free `,NS]}):`${s.now.free_gb.toFixed(1)} GB free`]})]}),f&&(0,B.jsx)(`p`,{className:`cp-error`,role:`alert`,children:f}),!s&&!f&&(0,B.jsx)(`p`,{className:`cp-note`,children:`Measuring…`}),s&&m===`turn`&&(b?(0,B.jsx)(JS,{turn:b}):(0,B.jsx)(`p`,{className:`cp-note`,children:s.latest_message_id==null?`Shown after GAIA's next answer in this chat.`:(0,B.jsxs)(B.Fragment,{children:[`Latest answer: `,(0,B.jsx)(`span`,{className:`cp-unknown`,children:NS}),`. It was not measured.`]})})),s&&m===`chat`&&(0,B.jsx)(XS,{totals:s.totals})]})]})}function $S({sessionId:e,busy:t,onClose:n,onUsage:r}){let i=(0,R.useRef)(null),a=(0,R.useRef)(n);a.current=n,(0,R.useEffect)(()=>{i.current?.focus()},[]);let o=(0,R.useCallback)(()=>a.current(),[]);c(!0,o);let s=(0,R.useRef)(null);return Ob(s,!0),(0,B.jsx)(`div`,{className:`cp-overlay`,onClick:n,children:(0,B.jsxs)(`aside`,{ref:s,className:`cp-sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":`Context and performance`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(`header`,{className:`cp-header`,children:[(0,B.jsx)(`h2`,{children:`Context & performance`}),(0,B.jsx)(`button`,{ref:i,type:`button`,className:`cp-icon`,onClick:n,"aria-label":`Close`,children:(0,B.jsx)(Fn,{size:16})})]}),(0,B.jsx)(`div`,{className:`cp-body`,children:(0,B.jsx)(QS,{sessionId:e,busy:t,onUsage:r})})]})})}function eC(e){return e<1e3?String(e):`${(e/1e3).toFixed(+(e<1e4))}K`}var tC=[{key:`system`,label:`System prompt`},{key:`tools`,label:`Tools`},{key:`documents`,label:`Documents`},{key:`history`,label:`Conversation`},{key:`query`,label:`Your message`}];function nC({usage:e,unavailable:t,sessionId:n,busy:r=!1,onUsage:i,onDetails:a}){let o=(0,R.useRef)(null),[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(!1),d=l&&n?(0,B.jsx)($S,{sessionId:n,busy:r,onUsage:i,onClose:()=>u(!1)}):null;if(!e)return t?(0,B.jsxs)(`span`,{className:`context-meter is-empty`,title:t,children:[(0,B.jsx)(`span`,{className:`context-meter-bar`,"aria-hidden":`true`,children:(0,B.jsx)(`span`,{style:{width:0}})}),(0,B.jsx)(`span`,{className:`context-meter-label`,children:`Context`})]}):null;let f=Math.min(100,Math.round(e.used/e.window*100)),p=e.at_risk.length>0,m=Math.max(0,e.window-e.used-e.reply_reserve);return(0,B.jsxs)(`div`,{className:`composer-chip-wrap context-meter-wrap`,children:[(0,B.jsxs)(`button`,{ref:o,type:`button`,className:`context-meter${p?` is-warning`:``}`,onClick:()=>c(e=>!e),"aria-expanded":s,"aria-label":`Context ${f}% full: ${eC(e.used)} of ${eC(e.window)} tokens`,title:`How full the model's context window is`,children:[(0,B.jsx)(`span`,{className:`context-meter-bar`,"aria-hidden":`true`,children:(0,B.jsx)(`span`,{style:{width:`${f}%`}})}),(0,B.jsxs)(`span`,{className:`context-meter-label`,children:[f,`%`]})]}),(0,B.jsx)(Wr,{open:s,onClose:()=>c(!1),anchor:o,label:`Context window`,align:`end`,children:(0,B.jsxs)(`div`,{className:`context-meter-panel`,children:[(0,B.jsxs)(`div`,{className:`context-meter-head`,children:[(0,B.jsx)(`strong`,{children:eC(e.used)}),` of `,eC(e.window),` tokens`]}),(0,B.jsx)(`div`,{className:`context-meter-stack`,"aria-hidden":`true`,children:tC.map(({key:t})=>(0,B.jsx)(`span`,{className:`part-${t}`,style:{width:`${e[t]/e.window*100}%`}},t))}),(0,B.jsxs)(`dl`,{className:`context-meter-rows`,children:[tC.filter(({key:t})=>t!==`query`||e.query>0).map(({key:t,label:n})=>(0,B.jsxs)(`div`,{className:`context-meter-row`,children:[(0,B.jsxs)(`dt`,{children:[(0,B.jsx)(`span`,{className:`swatch part-${t}`,"aria-hidden":`true`}),n]}),(0,B.jsx)(`dd`,{children:eC(e[t])})]},t)),(0,B.jsxs)(`div`,{className:`context-meter-row is-quiet`,children:[(0,B.jsx)(`dt`,{children:`Kept free for the reply`}),(0,B.jsx)(`dd`,{children:eC(e.reply_reserve)})]}),(0,B.jsxs)(`div`,{className:`context-meter-row is-quiet`,children:[(0,B.jsx)(`dt`,{children:`Free`}),(0,B.jsx)(`dd`,{children:eC(m)})]})]}),(0,B.jsxs)(`p`,{className:`context-meter-note`,children:[e.turns_in_view,` earlier `,e.turns_in_view===1?`turn is`:`turns are`,` in view`,e.turns_hidden>0&&`; ${e.turns_hidden} older ${e.turns_hidden===1?`is`:`are`} out of view`,`.`,` `,e.tokenizer?.exact?`Counted with the model's tokenizer.`:`Estimates.`,` `,`Older turns stay saved and can be recalled.`]}),n&&(0,B.jsx)(`button`,{type:`button`,className:`context-meter-details`,onClick:()=>{c(!1),a?a():u(!0)},children:`Details: context & performance`})]})}),d]})}function rC({usage:e}){if(!e||e.at_risk.length===0)return null;let t=e.at_risk.length;return(0,B.jsxs)(`div`,{className:`context-warning`,role:`status`,children:[(0,B.jsx)(Tn,{size:13,"aria-hidden":`true`}),(0,B.jsxs)(`span`,{children:[`The conversation is filling the model's context. The oldest`,t===1?` turn`:` ${t} turns`,` may drop out of the model's view next:`,` `,e.at_risk.map((e,t)=>(0,B.jsxs)(`span`,{children:[t>0&&`, `,(0,B.jsx)(`q`,{children:e})]},t)),`. They stay saved, and you can ask GAIA to recall them.`]})]})}async function iC(){let{providers:e,lemonade_error:t}=await ea();if(t)throw Error(t);return(await Promise.all(e.filter(e=>!e.remote).map(e=>aa(e.id)))).flatMap(e=>e.models.filter(e=>e.downloaded).map(e=>({id:e.id,name:e.display_name??Ko(e.id)})))}function aC({answeredBy:e,onPick:t}){let n=(0,R.useRef)(null),[r,i]=(0,R.useState)(!1),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(null),l=(0,R.useCallback)(async()=>{o(null),c(null);try{o(await iC())}catch(e){c(e instanceof Error?e.message:String(e))}},[]);(0,R.useEffect)(()=>{r&&l()},[r,l]);let u=a?.filter(t=>t.id!==e)??[];return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{ref:n,type:`button`,className:`msg-action-btn`,onClick:()=>i(e=>!e),title:`Retry with another model`,"aria-label":`Retry with another model`,"aria-expanded":r,children:(0,B.jsx)(pn,{size:12})}),(0,B.jsx)(Wr,{open:r,onClose:()=>i(!1),anchor:n,label:`Retry with`,placement:`below`,align:`end`,children:(0,B.jsxs)(`div`,{className:`retry-menu`,children:[(0,B.jsx)(`div`,{className:`retry-menu-head`,children:`Retry with…`}),s&&(0,B.jsx)(`div`,{className:`retry-menu-error`,role:`alert`,children:s}),!s&&a===null&&(0,B.jsxs)(`div`,{className:`retry-menu-empty`,children:[(0,B.jsx)(L,{size:12,className:`spin`,"aria-hidden":`true`}),` Loading models…`]}),a!==null&&u.length===0&&(0,B.jsx)(`div`,{className:`retry-menu-empty`,children:`No other model is downloaded on this PC. Add one in Settings → Model.`}),u.map(e=>(0,B.jsx)(`button`,{type:`button`,className:`retry-menu-item`,title:e.id,onClick:()=>{i(!1),t(e.id)},children:e.name},e.id))]})})]})}function oC(e){return e!=null&&e>0?`${(e/1e3).toFixed(1)} s`:null}function sC({parts:e}){let t=e.filter(Boolean);return t.length?(0,B.jsx)(`div`,{className:`compare-meta`,children:t.join(` · `)}):null}function cC({original:e,originalModel:t,originalLatencyMs:n,state:r,keeping:i,onKeep:a,onClose:o}){Go();let s=r.status===`ready`?r.result.model:r.model,c=e.stats?.tokens_per_second;return(0,B.jsxs)(`section`,{className:`answer-compare`,"aria-label":`Compare answers`,children:[(0,B.jsxs)(`header`,{className:`answer-compare-head`,children:[(0,B.jsx)(`span`,{children:`Compare answers`}),(0,B.jsx)(`button`,{type:`button`,className:`msg-action-btn`,onClick:o,"aria-label":`Close comparison`,disabled:!!i,children:(0,B.jsx)(Fn,{size:12})})]}),(0,B.jsxs)(`div`,{className:`answer-compare-cols`,children:[(0,B.jsxs)(`article`,{className:`compare-col`,"aria-label":`Answer from ${t??`the original model`}`,children:[(0,B.jsx)(`h4`,{children:t?Ko(t):`Original answer`}),(0,B.jsx)(sC,{parts:[oC(n),c?`${c} tok/s`:null]}),(0,B.jsx)(`div`,{className:`compare-body`,children:(0,B.jsx)(mx,{content:e.content})}),(0,B.jsx)(`button`,{type:`button`,className:`compare-keep`,onClick:()=>a(`original`),disabled:!!i||r.status===`running`,children:i===`original`?`Keeping…`:`Keep this answer`})]}),(0,B.jsxs)(`article`,{className:`compare-col`,"aria-label":`Answer from ${s}`,children:[(0,B.jsx)(`h4`,{children:Ko(s)}),r.status===`running`&&(0,B.jsxs)(`div`,{className:`compare-wait`,children:[(0,B.jsx)(L,{size:14,className:`spin`,"aria-hidden":`true`}),(0,B.jsxs)(`span`,{children:[`Loading `,Ko(s),`, then answering from the same evidence. Tools are not run again.`]})]}),r.status===`failed`&&(0,B.jsx)(`div`,{className:`compare-error`,role:`alert`,children:r.error}),r.status===`ready`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(sC,{parts:[`${r.result.stats.seconds.toFixed(1)} s`,r.result.stats.load_seconds>=1?`incl. ${r.result.stats.load_seconds.toFixed(1)} s loading`:null,r.result.stats.tokens_per_second?`${r.result.stats.tokens_per_second} tok/s`:null]}),(0,B.jsx)(`div`,{className:`compare-body`,children:(0,B.jsx)(mx,{content:r.result.content})}),(0,B.jsx)(`button`,{type:`button`,className:`compare-keep`,onClick:()=>a(`retry`),disabled:!!i,children:i===`retry`?`Keeping…`:`Keep this answer`})]})]})]})]})}var lC=`gaia.sessionPanel.open`,uC=`gaia.sessionPanel.width`,dC=`gaia.sessionPanel.sections`,fC={answer:!0,environment:!0,context:!1,outputs:!0,changes:!0};function pC(e,t,n){try{let r=window.localStorage.getItem(e);return r==null?n:t(r)}catch(t){return u.ui.warn(`Session panel setting ${e} unavailable; using the default`,t),n}}function mC(e,t){try{window.localStorage.setItem(e,t)}catch(t){u.ui.warn(`Could not remember session panel setting ${e}`,t)}}function hC(e){let t=typeof window<`u`?Math.floor(window.innerWidth*.5):640;return Math.round(Math.max(280,Math.min(e,640,Math.max(280,t))))}function gC(){return{open:pC(lC,e=>e!==`0`,!0),width:hC(pC(uC,e=>Number(e)||320,320)),sections:{...fC,...pC(dC,e=>JSON.parse(e),{})}}}var _C=Xn((e,t)=>({...gC(),overlayOpen:!1,focus:null,setOpen:t=>{mC(lC,t?`1`:`0`),e({open:t})},setOverlayOpen:t=>e({overlayOpen:t}),setWidth:t=>{let n=hC(t);mC(uC,String(n)),e({width:n})},setSection:(n,r)=>{let i={...t().sections,[n]:r};mC(dC,JSON.stringify(i)),e({sections:i})},reveal:n=>{let r={...t().sections,[n]:!0};mC(dC,JSON.stringify(r)),mC(lC,`1`),e({sections:r,open:!0,overlayOpen:!0,focus:{section:n,nonce:Date.now()}})},reload:()=>e({...gC(),overlayOpen:!1,focus:null})}));function vC(e){let[t,n]=(0,R.useState)(()=>typeof window.matchMedia==`function`&&window.matchMedia(e).matches);return(0,R.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function yC(e,t){if(t)return e.some(e=>e.turnSummary)?{kind:`busy`}:null;let n=e[e.length-1];return!n||n.role!==`assistant`||!n.turnSummary?null:{kind:`turn`,turn:n}}function bC(e){let t=e.live_data?.attempted??0;return t>0&&(e.live_data?.failed??0)>=t}function xC(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return e}}function SC(e){return!e||e.length===0?null:`${e.length===1?`p.`:`pp.`} ${e.join(`, `)}`}function CC(e){let{cost:t}=e;return t.kind===`local`?`No cloud charges`:t.kind===`estimate`&&typeof t.usd==`number`?`About $${t.usd<.01?t.usd.toFixed(4):t.usd.toFixed(2)} at list price`:e.model?`Not known for this model`:`Not known`}function wC(e){return e instanceof wi?e.detail||e.message:e instanceof Error?e.message:String(e)}function TC({messages:e,busy:t=!1}){let n=yC(e,t);if(!n)return null;let r=n.kind===`turn`?n.turn.turnSummary??null:null,i=r?bC(r):!1;return(0,B.jsxs)(`div`,{className:`side-rail-body`,children:[!r&&(0,B.jsx)(`p`,{className:`side-rail-pending`,role:`status`,children:`Working on this answer. Its sources, files and where its data went appear here when it finishes.`}),i&&(0,B.jsxs)(`div`,{className:`side-rail-warn`,role:`status`,children:[(0,B.jsx)(Tn,{size:14,"aria-hidden":`true`}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`strong`,{children:`Couldn't get live data`}),(0,B.jsx)(`span`,{children:`Every web lookup this turn failed, so the answer isn't based on current information.`})]})]}),r&&(r.error?(0,B.jsxs)(`p`,{className:`side-rail-error`,role:`alert`,children:[`Couldn't put together this turn's sources and details: `,r.error]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(DC,{summary:r}),(0,B.jsx)(AC,{summary:r}),(0,B.jsx)(jC,{summary:r})]}))]})}function EC({title:e,children:t}){let[n,r]=(0,R.useState)(!0);return(0,B.jsxs)(`section`,{className:`side-rail-section`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`side-rail-section-head`,onClick:()=>r(!n),"aria-expanded":n,children:[(0,B.jsx)(ue,{size:12,className:`side-rail-chevron${n?` open`:``}`,"aria-hidden":`true`}),e]}),n&&(0,B.jsx)(`div`,{className:`side-rail-section-body`,children:t})]})}function DC({summary:e}){let t=e.pages??[],n=e.documents??[];return t.length===0&&n.length===0?null:(0,B.jsx)(EC,{title:`Sources`,children:(0,B.jsxs)(`ul`,{className:`side-rail-list`,children:[t.map(e=>(0,B.jsxs)(`li`,{className:`side-rail-item`,children:[(0,B.jsx)(dt,{size:13,className:`side-rail-item-icon`,"aria-hidden":`true`}),(0,B.jsxs)(`div`,{className:`side-rail-item-text`,children:[(0,B.jsxs)(`a`,{href:Ym(e.url)||void 0,target:`_blank`,rel:`noopener noreferrer`,className:`side-rail-link`,title:e.url,children:[(0,B.jsx)(`span`,{className:`side-rail-link-text`,children:e.title||xC(e.url)}),(0,B.jsx)(Le,{size:10,"aria-hidden":`true`,className:`side-rail-link-icon`})]}),(0,B.jsxs)(`span`,{className:`side-rail-meta`,children:[xC(e.url),e.kind===`search_result`?` · search result`:``]})]})]},e.url)),n.map(e=>{let t=SC(e.pages),n=e.passages??0;return(0,B.jsxs)(`li`,{className:`side-rail-item`,children:[(0,B.jsx)(qe,{size:13,className:`side-rail-item-icon`,"aria-hidden":`true`}),(0,B.jsxs)(`div`,{className:`side-rail-item-text`,children:[(0,B.jsx)(`span`,{className:`side-rail-name`,title:e.name,children:e.name}),(0,B.jsx)(`span`,{className:`side-rail-meta`,children:[t,`${n} passage${n===1?``:`s`}`].filter(Boolean).join(` · `)})]})]},e.path)})]})})}var OC=4e3;function kC(e){let t=e.join(`
|
|
63
|
-
`),[n,r]=(0,R.useState)(()=>new Map),[i,a]=(0,R.useState)(null);return(0,R.useEffect)(()=>{if(!t)return;let e=t.split(`
|
|
64
|
-
`),n=!1,i=()=>{document.visibilityState!==`hidden`&&ro(e).then(e=>{n||(r(new Map(e.files.map(e=>[e.path,e]))),a(null))},e=>{n||(u.ui.warn(`Could not re-check the files this turn wrote`,e),a(wC(e)))})};i();let o=window.setInterval(i,OC);return window.addEventListener(`focus`,i),()=>{n=!0,window.clearInterval(o),window.removeEventListener(`focus`,i)}},[t]),{status:n,error:i}}function AC({summary:e}){let t=e.files??[],[n,r]=(0,R.useState)(null),{status:i,error:a}=kC(t.map(e=>e.path));if(t.length===0)return null;let o=(e,t)=>{r(null),e.catch(e=>{u.ui.error(`Failed to open ${t}`,e),r(`Couldn't open ${t}: ${wC(e)}`)})};return(0,B.jsxs)(EC,{title:`Files`,children:[(0,B.jsx)(`ul`,{className:`side-rail-list`,children:t.map(e=>{let t=i.get(e.path);if(t?.exists===!1)return(0,B.jsxs)(`li`,{className:`side-rail-item side-rail-item-gone`,children:[(0,B.jsx)(qe,{size:13,className:`side-rail-item-icon`,"aria-hidden":`true`}),(0,B.jsxs)(`div`,{className:`side-rail-item-text`,children:[(0,B.jsx)(`span`,{className:`side-rail-name`,title:e.path,children:e.name}),(0,B.jsx)(`span`,{className:`side-rail-meta`,children:`No longer on disk`})]})]},e.path);let n=t?.exists===!0&&typeof t.mtime==`number`&&typeof e.mtime==`number`&&t.mtime!==e.mtime;return(0,B.jsxs)(`li`,{className:`side-rail-item`,children:[(0,B.jsx)(qe,{size:13,className:`side-rail-item-icon`,"aria-hidden":`true`}),(0,B.jsxs)(`div`,{className:`side-rail-item-text`,children:[(0,B.jsx)(`span`,{className:`side-rail-name`,title:e.path,children:e.name}),n&&(0,B.jsx)(`span`,{className:`side-rail-meta`,children:`Changed since this turn`}),(0,B.jsxs)(`span`,{className:`side-rail-actions`,children:[e.openable&&(0,B.jsx)(`button`,{type:`button`,className:`side-rail-action`,onClick:()=>o(no(e.path),e.name),children:`Open`}),(0,B.jsxs)(`button`,{type:`button`,className:`side-rail-action`,onClick:()=>o(to(e.path,!0),e.name),children:[(0,B.jsx)(Ze,{size:11,"aria-hidden":`true`}),`Show in folder`]})]})]})]},e.path)})}),n&&(0,B.jsx)(`p`,{className:`side-rail-error`,role:`alert`,children:n}),a&&(0,B.jsxs)(`p`,{className:`side-rail-error`,children:[`Couldn't check whether these files changed: `,a]})]})}function jC({summary:e}){Go();let{model:t}=e,n=e.sites??[],r=(e.documents??[]).length>0;return(0,B.jsx)(EC,{title:`This turn`,children:(0,B.jsxs)(`dl`,{className:`side-rail-facts`,children:[(0,B.jsx)(`dt`,{children:`Model`}),(0,B.jsxs)(`dd`,{children:[t?(0,B.jsxs)(`span`,{className:`side-rail-where${t.remote?` remote`:``}`,children:[t.remote?(0,B.jsx)(Ce,{size:12,"aria-hidden":`true`}):(0,B.jsx)(Pt,{size:12,"aria-hidden":`true`}),t.remote?`${t.provider_name} (cloud)`:`This PC`]}):(0,B.jsx)(`span`,{className:`side-rail-where`,children:`Not reported`}),t?.name&&(0,B.jsx)(`span`,{className:`side-rail-meta`,title:t.name,children:Ko(t.name)})]}),r&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`dt`,{children:`Documents`}),(0,B.jsx)(`dd`,{children:t?.remote?`Searched on this PC. The passages used were sent to ${t.provider_name}.`:t?`Read on this PC and stayed here.`:`Searched on this PC.`})]}),(0,B.jsx)(`dt`,{children:`Websites`}),(0,B.jsx)(`dd`,{children:n.length>0?n.join(`, `):`None from GAIA's web tools`}),(0,B.jsx)(`dt`,{children:`Cost`}),(0,B.jsx)(`dd`,{children:CC(e)})]})})}function MC({id:e,title:t,summary:n,children:r}){let i=_C(t=>t.sections[e]),a=_C(e=>e.setSection),o=_C(e=>e.focus),s=(0,R.useRef)(null),c=`sp-section-${e}`;return(0,R.useEffect)(()=>{o?.section===e&&s.current?.scrollIntoView?.({block:`start`,behavior:rb()})},[o,e]),(0,B.jsxs)(`section`,{ref:s,className:`sp-section`,"aria-labelledby":`${c}-title`,children:[(0,B.jsx)(`h3`,{className:`sp-section-heading`,children:(0,B.jsxs)(`button`,{type:`button`,id:`${c}-title`,className:`sp-section-head`,"aria-expanded":i,"aria-controls":c,onClick:()=>a(e,!i),children:[(0,B.jsx)(ue,{size:13,className:`sp-chevron${i?` is-open`:``}`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:`sp-section-title`,children:t}),n!=null&&(0,B.jsx)(`span`,{className:`sp-section-summary`,children:n})]})}),i&&(0,B.jsx)(`div`,{id:c,className:`sp-section-body`,children:r})]})}function NC(e,t,n){if(e==null||!t(e))throw Error(`the server sent no ${n}`);return e}var PC=new Map;function FC(e){let t=PC.get(e);return t||(t={env:null,error:null,inFlight:null,version:0,listeners:new Set},PC.set(e,t)),t}function IC(e,t,n){let r=FC(e);r.env=t??r.env,r.error=n,r.listeners.forEach(e=>e())}function LC(e){let t=FC(e);if(t.inFlight)return t.inFlight;let n=t.version;return t.inFlight=Promise.resolve().then(()=>To(e)).then(r=>{let i=NC(r,e=>Array.isArray(e.folders),`chat's environment`);t.version===n&&IC(e,i,null)}).catch(t=>IC(e,null,t instanceof Error?t.message:String(t))).finally(()=>{t.inFlight=null}),t.inFlight}function RC(e){let[,t]=(0,R.useState)(0);(0,R.useEffect)(()=>{let n=FC(e),r=()=>t(e=>e+1);return n.listeners.add(r),!n.env&&!n.inFlight&&LC(e),()=>{n.listeners.delete(r)}},[e]);let n=(0,R.useCallback)(()=>LC(e),[e]),r=(0,R.useCallback)(async t=>{let n=await t();return FC(e).version+=1,IC(e,n,null),n},[e]),i=FC(e);return{env:i.env,error:i.error,refresh:n,change:r}}function zC(e,t){let n=(0,R.useRef)(e),r=(0,R.useRef)(t);r.current=t,(0,R.useEffect)(()=>{let t=n.current&&!e;n.current=e,t&&r.current()},[e])}var BC=`gaia:mobile-access-request`,VC=`gaia:mobile-access-state`;function HC(e){window.dispatchEvent(new CustomEvent(BC,{detail:e}))}function UC(e){window.dispatchEvent(new CustomEvent(VC,{detail:e}))}function WC(e,t){let n=(0,R.useRef)(t);n.current=t,(0,R.useEffect)(()=>{let t=e=>n.current(!!e.detail);return window.addEventListener(e,t),()=>window.removeEventListener(e,t)},[e])}var GC=e=>WC(BC,e),KC=e=>WC(VC,e);function qC({onPick:e,onClose:t}){let[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(null),[l,u]=(0,R.useState)(!1);c(!0,t);let d=(0,R.useRef)(null);Ob(d,!0);let f=(0,R.useCallback)(e=>{u(!0),s(null),Promise.resolve().then(()=>$a(e)).then(e=>{let t=NC(e,e=>Array.isArray(e.entries),`folder listing`);r(t),a(t.current_path)}).catch(e=>s(e instanceof wi?e.detail||e.message:String(e))).finally(()=>u(!1))},[]);(0,R.useEffect)(()=>f(),[f]);let p=n?.entries.filter(e=>e.type===`folder`)??[];return(0,B.jsx)(`div`,{className:`modal-overlay`,onClick:t,children:(0,B.jsxs)(`div`,{ref:d,className:`modal-panel sp-picker`,role:`dialog`,"aria-modal":`true`,"aria-label":`Add a folder to this chat`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(`div`,{className:`modal-header`,children:[(0,B.jsx)(`h3`,{children:`Add a folder`}),(0,B.jsx)(`button`,{type:`button`,className:`btn-icon`,onClick:t,"aria-label":`Close`,children:(0,B.jsx)(Fn,{size:18})})]}),(0,B.jsxs)(`div`,{className:`modal-body sp-picker-body`,children:[(0,B.jsx)(`p`,{className:`sp-meta`,children:`GAIA will be able to read and write everything in the folder you pick, in this chat only.`}),(0,B.jsxs)(`form`,{className:`sp-picker-path`,onSubmit:e=>{e.preventDefault(),i.trim()&&f(i.trim())},children:[(0,B.jsx)(`input`,{value:i,onChange:e=>a(e.target.value),"aria-label":`Folder path`,spellCheck:!1}),(0,B.jsx)(`button`,{type:`submit`,className:`sp-action`,children:`Go`})]}),n&&(0,B.jsx)(`div`,{className:`sp-picker-quick`,children:n.quick_links.map(e=>(0,B.jsx)(`button`,{type:`button`,className:`sp-action`,onClick:()=>f(e.path),children:e.name},e.path))}),(0,B.jsxs)(`ul`,{className:`sp-picker-list`,"aria-busy":l,children:[n?.parent_path&&(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>f(n.parent_path??void 0),children:[(0,B.jsx)(E,{size:13,"aria-hidden":`true`}),` Up one level`]})}),p.map(e=>(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>f(e.path),children:[(0,B.jsx)(rt,{size:13,"aria-hidden":`true`}),` `,e.name]})},e.path)),n&&p.length===0&&(0,B.jsx)(`li`,{className:`sp-meta`,children:`No folders inside.`}),l&&(0,B.jsxs)(`li`,{className:`sp-meta`,children:[(0,B.jsx)(L,{size:12,className:`spin`,"aria-hidden":`true`}),` Loading…`]})]}),o&&(0,B.jsx)(`p`,{className:`sp-error`,role:`alert`,children:o})]}),(0,B.jsxs)(`div`,{className:`sp-picker-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:t,children:`Cancel`}),(0,B.jsx)(`button`,{type:`button`,className:`btn-primary`,disabled:!n,onClick:()=>n&&e(n.current_path),children:`Use this folder`})]})]})})}function JC({checked:e,onChange:t,label:n,text:r,disabled:i}){return(0,B.jsxs)(`span`,{className:`sp-switch-wrap`,children:[(0,B.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":n,className:`sp-switch${e?` is-on`:``}`,onClick:()=>t(!e),disabled:i,children:(0,B.jsx)(`span`,{className:`sp-switch-knob`,"aria-hidden":`true`})}),r&&(0,B.jsx)(`span`,{className:`sp-state-text`,children:r})]})}var YC={added:`Added by you`,gaia_documents:`GAIA's documents folder`,scratch:`GAIA's scratch folder`,document:`Document in this chat`,working_folder:`Folder GAIA started in`,approved:`Approved during this chat`,allowed_paths:`Set by GAIA_ALLOWED_PATHS`},XC=3;function ZC(e){return e instanceof wi?e.detail||e.message:e instanceof Error?e.message:String(e)}function QC(e){let t=e.split(/[\\/]/).filter(Boolean);return t[t.length-1]??e}function $C({sessionId:e,busy:t}){let{env:n}=RC(e),r=n&&!n.internet?`Offline`:null;return(0,B.jsxs)(MC,{id:`environment`,title:`Environment`,summary:r,children:[(0,B.jsx)(nw,{sessionId:e,busy:t}),(0,B.jsx)(rw,{sessionId:e}),(0,B.jsx)(iw,{sessionId:e}),(0,B.jsx)(aw,{}),(0,B.jsx)(ow,{sessionId:e})]})}function ew({label:e,children:t}){return(0,B.jsxs)(`div`,{className:`sp-env-row`,children:[(0,B.jsx)(`div`,{className:`sp-env-label`,children:e}),(0,B.jsx)(`div`,{className:`sp-env-value`,children:t})]})}function tw(e,t){let n=e=>e.toLowerCase().replace(/^user\./,``);return n(e)===n(t)}function nw({sessionId:e,busy:t}){let n=Xo(),r=Wo(e=>e.active),i=z(t=>Zo(r,t.sessions,e)),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(null),l=n?.remote===!0,d=(0,R.useCallback)(()=>{l||Promise.resolve().then(()=>ca()).then(e=>{o(NC(e,e=>typeof e.state==`string`,`model status`)),c(null)}).catch(e=>{u.ui.warn(`Could not read where the local model runs`,e),c(ZC(e))})},[l]);if((0,R.useEffect)(d,[d]),zC(t,d),l)return(0,B.jsxs)(ew,{label:`Runs on`,children:[(0,B.jsxs)(`span`,{className:`sp-place is-remote`,children:[(0,B.jsx)(Ce,{size:13,"aria-hidden":`true`}),` `,n?.label,` (cloud)`]}),n?.description&&(0,B.jsx)(`span`,{className:`sp-meta`,children:n.description})]});if(!n)return(0,B.jsx)(ew,{label:`Runs on`,children:(0,B.jsx)(`span`,{className:`sp-meta`,title:Yo,children:`Not known yet`})});let f=!!(a?.model&&i&&!tw(a.model,i)),p=f?null:a?.memory;return(0,B.jsxs)(ew,{label:`Runs on`,children:[(0,B.jsxs)(`span`,{className:`sp-place`,children:[(0,B.jsx)(Pt,{size:13,"aria-hidden":`true`}),` This PC`,!f&&a?.placement?.label?` · ${a.placement.label}`:``]}),f?(0,B.jsxs)(`span`,{className:`sp-meta`,children:[Ko(i),` · not loaded right now`]}):a?.display_name&&(0,B.jsxs)(`span`,{className:`sp-meta`,children:[a.display_name,a.state===`loaded`?``:` · ${a.state}`]}),p&&(0,B.jsxs)(`span`,{className:`sp-meta`,children:[p.model_gb==null?`Memory in use unknown`:`${p.model_gb.toFixed(1)} GB in use`,p.free_gb==null?``:` · ${p.free_gb.toFixed(1)} GB free`]}),(s||a?.error)&&(0,B.jsx)(`span`,{className:`sp-error`,children:s??a?.error})]})}function rw({sessionId:e}){let{env:t,error:n,change:r}=RC(e),i=z(t=>t.sessions.find(t=>t.id===e)?.agent_type===`gaia`),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(null),[d,f]=(0,R.useState)(!1),p=async(e,t)=>{u(e),c(null);try{await t()}catch(e){c(ZC(e))}finally{u(null)}},m=t=>p(t.path,()=>r(()=>Do(e,t.path))),h=t=>{o(!1),p(t,()=>r(()=>Eo(e,t)))},g=t?.folders.filter(e=>e.kind===`folder`)??[],_=t?.folders.filter(e=>e.kind===`file`)??[],v=d?_:_.slice(0,XC),y=!t||!t.enforced,b=e=>(0,B.jsxs)(`li`,{className:`sp-scope-item`,children:[e.kind===`folder`?(0,B.jsx)(rt,{size:13,className:`sp-item-icon`,"aria-hidden":`true`}):(0,B.jsx)(Ye,{size:13,className:`sp-item-icon`,"aria-hidden":`true`}),(0,B.jsxs)(`div`,{className:`sp-item-text`,children:[(0,B.jsx)(`span`,{className:`sp-item-name`,title:e.path,children:QC(e.path)}),(0,B.jsxs)(`span`,{className:`sp-meta`,title:e.path,children:[YC[e.source],` · `,e.path]})]}),e.removable&&!y&&(0,B.jsx)(`button`,{type:`button`,className:`btn-icon-sm sp-item-remove`,onClick:()=>void m(e),disabled:l!==null,"aria-label":`Remove ${e.path} from this chat`,title:`Remove from this chat`,children:(0,B.jsx)(Fn,{size:12})})]},e.path);return(0,B.jsxs)(ew,{label:t&&!t.enforced?`Files GAIA can reach`:`Can read and write`,children:[!t&&!n&&(0,B.jsx)(`span`,{className:`sp-meta`,children:`Checking…`}),t&&!t.enforced&&(0,B.jsx)(`span`,{className:`sp-meta`,children:i?`These folders are where GAIA starts, not a limit: it can also reach the rest of your user folder. In Ask mode it asks before it changes anything.`:`These folders are where this chat's agent starts; it applies its own limits.`}),n&&(0,B.jsxs)(`span`,{className:`sp-error`,children:[`Couldn't read this chat's folders: `,n]}),t&&(0,B.jsxs)(B.Fragment,{children:[t.folders.length===0&&(0,B.jsx)(`span`,{className:`sp-meta`,children:`Nothing yet. GAIA can't read or write any folder in this chat.`}),(0,B.jsxs)(`ul`,{className:`sp-list`,children:[g.map(b),v.map(b)]}),_.length>XC&&(0,B.jsx)(`button`,{type:`button`,className:`link-btn sp-more`,onClick:()=>f(e=>!e),children:d?`Show fewer files`:`Show all ${_.length} files`}),!t.enforced&&(0,B.jsx)(`span`,{className:`sp-meta`,children:`This chat's agent runs as its own process, so these settings can't be changed from here.`}),t.removed.length>0&&(0,B.jsxs)(`span`,{className:`sp-meta`,children:[`Removed: `,t.removed.map(QC).join(`, `),`. GAIA is refused there until you add it back.`]}),!y&&(0,B.jsxs)(`button`,{type:`button`,className:`sp-action`,onClick:()=>o(!0),disabled:l!==null,children:[(0,B.jsx)($e,{size:12,"aria-hidden":`true`}),` Add folder`]})]}),s&&(0,B.jsx)(`span`,{className:`sp-error`,role:`alert`,children:s}),a&&(0,B.jsx)(qC,{onPick:h,onClose:()=>o(!1)})]})}function iw({sessionId:e}){let{env:t,change:n}=RC(e),[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(!1);if(!t)return null;let s=async t=>{o(!0),i(null);try{await n(()=>Oo(e,t))}catch(e){i(ZC(e))}finally{o(!1)}};return(0,B.jsxs)(ew,{label:`Internet`,children:[(0,B.jsx)(JC,{checked:t.internet,onChange:e=>void s(e),disabled:a||!t.enforced,label:`Internet for this chat`,text:t.internet?`On`:`Off: web search and pages are blocked`}),!t.enforced&&(0,B.jsx)(`span`,{className:`sp-meta`,children:`Set by the agent; can't be changed from this chat.`}),r&&(0,B.jsx)(`span`,{className:`sp-error`,role:`alert`,children:r})]})}function aw(){let[e,t]=(0,R.useState)(null),[n,r]=(0,R.useState)(!1),[i,a]=(0,R.useState)(null),o=(0,R.useCallback)(()=>{Promise.resolve().then(()=>lo()).then(e=>{t(NC(e,e=>typeof e.active==`boolean`,`phone access status`)),a(null)}).catch(e=>a(ZC(e)))},[]);(0,R.useEffect)(o,[o]),KC(()=>{r(!1),o()});let s=e?.active===!0;return(0,B.jsxs)(ew,{label:`Phone access`,children:[(0,B.jsx)(JC,{checked:s,onChange:e=>{r(!0),HC(e)},disabled:n,label:`Phone access`,text:n?s?`Stopping…`:`Starting…`:s?`On`:`Off`}),s&&(0,B.jsxs)(`span`,{className:`sp-meta`,children:[(0,B.jsx)(hn,{size:12,"aria-hidden":`true`}),` `,e?.device?`${e.device.name} connected`:`No phone connected yet`]}),s&&(0,B.jsx)(`button`,{type:`button`,className:`sp-action`,onClick:()=>HC(!0),children:`Show QR code`}),(i||e?.error)&&(0,B.jsx)(`span`,{className:`sp-error`,children:i??e?.error})]})}function ow({sessionId:e}){let[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(!1),[a,o]=(0,R.useState)(null);(0,R.useEffect)(()=>{let t=!0;return Promise.resolve().then(()=>gi(e)).then(e=>{t&&n(NC(e,e=>typeof e.mode==`string`,`permission mode`).mode)}).catch(e=>{t&&o(ZC(e))}),()=>{t=!1}},[e]),DS(e,n);let s=async t=>{if(t===`full_access`&&!r)i(!0);else{i(!1),o(null);try{let r=(await vi(e,t)).mode;n(r),ES(e,r)}catch(e){o(ZC(e))}}},c=OS.find(e=>e.mode===t)?.note;return(0,B.jsxs)(ew,{label:`Permission mode`,children:[(0,B.jsx)(`div`,{className:`sp-segmented`,role:`radiogroup`,"aria-label":`Permission mode`,children:OS.map(e=>(0,B.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t===e.mode,className:t===e.mode?`is-selected`:void 0,onClick:()=>void s(e.mode),children:[e.mode===`full_access`?(0,B.jsx)(sn,{size:12,"aria-hidden":`true`}):(0,B.jsx)(ln,{size:12,"aria-hidden":`true`}),e.mode===`ask`?`Ask`:e.label]},e.mode))}),c&&(0,B.jsx)(`span`,{className:`sp-meta`,children:c}),r&&(0,B.jsxs)(`span`,{className:`sp-confirm`,role:`alert`,children:[`Full access lets GAIA change files and run commands on this PC without asking.`,(0,B.jsx)(`button`,{type:`button`,className:`sp-action is-warning`,onClick:()=>void s(`full_access`),children:`Turn it on`}),(0,B.jsx)(`button`,{type:`button`,className:`sp-action`,onClick:()=>i(!1),children:`Cancel`})]}),a&&(0,B.jsx)(`span`,{className:`sp-error`,role:`alert`,children:a})]})}var sw={file:{label:`File`,Icon:qe},export:{label:`Export`,Icon:Ue},image:{label:`Image`,Icon:pt},document:{label:`Indexed document`,Icon:Ct},memory:{label:`Memory saved`,Icon:M},schedule:{label:`Scheduled task`,Icon:ne}},cw={created:`created`,edited:`edited`,deleted:`deleted`};function lw(e){return e instanceof wi?e.detail||e.message:e instanceof Error?e.message:String(e)}function uw(e,t=Date.now()){if(!e)return``;let n=Date.parse(`${e.replace(` `,`T`)}Z`);if(Number.isNaN(n))return``;let r=Math.max(0,Math.round((t-n)/1e3));return r<60?`just now`:r<3600?`${Math.floor(r/60)} min ago`:r<86400?`${Math.floor(r/3600)} h ago`:new Date(n).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function dw(e){return e.state===`undone`?`Undone`:e.state===`gone`?`No longer on disk`:null}function fw({sessionId:e,busy:t,onJumpToMessage:n}){return(0,B.jsx)(MC,{id:`outputs`,title:`Outputs`,children:(0,B.jsx)(pw,{sessionId:e,busy:t,onJumpToMessage:n})})}function pw({sessionId:e,busy:t,onJumpToMessage:n}){let[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(null),[l,d]=(0,R.useState)(!1),f=(0,R.useCallback)(()=>{let t=!0;return Promise.resolve().then(()=>ko(e)).then(e=>{t&&(i(NC(e,e=>Array.isArray(e.items),`list of outputs`).items),o(null))}).catch(n=>{t&&(u.ui.warn(`Could not list what session=${e} produced`,n),o(lw(n)))}),()=>{t=!1}},[e]);(0,R.useEffect)(f,[f]),zC(t,f),db(e,f);let p=(e,t)=>{c(null),e.catch(e=>c(`Couldn't open ${t}: ${lw(e)}`))};if(a)return(0,B.jsxs)(`p`,{className:`sp-error`,children:[`Couldn't list what this chat produced: `,a]});if(!r)return(0,B.jsx)(`p`,{className:`sp-meta`,children:`Checking…`});if(r.length===0)return(0,B.jsx)(`p`,{className:`sp-meta`,children:`Nothing yet. Files, documents, images and memories this chat makes appear here.`});let m=l?r:r.slice(0,5);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`ul`,{className:`sp-list`,"aria-label":`What this chat produced`,children:m.map(e=>{let{label:t,Icon:r}=sw[e.kind],i=dw(e),a=e.change&&e.kind!==`document`?cw[e.change]:void 0,o=a?`${t} ${a}`:t;return(0,B.jsxs)(`li`,{className:`sp-output${e.state===`present`?``:` is-inactive`}`,children:[(0,B.jsx)(r,{size:13,className:`sp-item-icon`,"aria-hidden":`true`}),(0,B.jsxs)(`div`,{className:`sp-item-text`,children:[(0,B.jsx)(`span`,{className:`sp-item-name`,title:e.path??e.name,children:e.name}),(0,B.jsx)(`span`,{className:`sp-meta`,children:[o,uw(e.created_at),i].filter(Boolean).join(` · `)}),(0,B.jsxs)(`span`,{className:`sp-item-actions`,children:[e.message_id!=null&&(0,B.jsxs)(`button`,{type:`button`,className:`sp-action`,onClick:()=>{n(e.message_id)||c(`That turn isn't loaded in the chat right now.`)},"aria-label":`Go to the turn that made ${e.name}`,children:[(0,B.jsx)(ke,{size:11,"aria-hidden":`true`}),` Go to turn`]}),e.openable&&e.path&&(0,B.jsx)(`button`,{type:`button`,className:`sp-action`,onClick:()=>p(no(e.path),e.name),children:`Open`}),e.revealable&&e.path&&(0,B.jsxs)(`button`,{type:`button`,className:`sp-action`,onClick:()=>p(to(e.path,!0),e.name),children:[(0,B.jsx)(Ze,{size:11,"aria-hidden":`true`}),` Show in folder`]})]})]})]},e.id)})}),r.length>5&&(0,B.jsx)(`button`,{type:`button`,className:`link-btn sp-more`,onClick:()=>d(e=>!e),children:l?`Show fewer`:`Show ${r.length-5} more`}),s&&(0,B.jsx)(`p`,{className:`sp-error`,role:`alert`,children:s})]})}function mw(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function hw(e){return e instanceof wi?e.detail||e.message:e instanceof Error?e.message:String(e)}function gw(e){let t=e.split(/[\\/]/).filter(Boolean);return t[t.length-1]??e}function _w(e){let{files:t,additions:n,deletions:r}=e.totals;return`${mw(t,`file`)} changed, +${n} −${r}`}var vw={edited:`Edited`,created:`Created`,deleted:`Deleted`};function yw({sessionId:e,busy:t,onJumpToMessage:n}){let[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(null),l=(0,R.useCallback)(()=>{Promise.resolve().then(()=>Ao(e)).then(e=>{i(NC(e,e=>Array.isArray(e.files),`list of this chat's changes`)),o(null)}).catch(t=>{u.ui.warn(`Could not total what session=${e} changed`,t),o(hw(t))})},[e]);(0,R.useEffect)(l,[l]),zC(t,()=>{c(null),l()}),db(e,l);let d=!r||r.files.length===0;return!a&&d&&!s?null:(0,B.jsxs)(MC,{id:`changes`,title:`Changes`,summary:r&&!d?`${mw(r.totals.files,`file`)} · +${r.totals.additions} −${r.totals.deletions}`:null,children:[a&&(0,B.jsxs)(`p`,{className:`sp-error`,children:[`Couldn't total this chat's changes: `,a]}),r&&!d&&(0,B.jsx)(bw,{sessionId:e,busy:t,changes:r,onChanged:l,onUndone:c,onJumpToMessage:n}),d&&s&&(0,B.jsx)(`p`,{className:`sp-ok`,role:`status`,children:s})]})}function bw({sessionId:e,busy:t,changes:n,onChanged:r,onUndone:i,onJumpToMessage:a}){let[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(`idle`),[u,d]=(0,R.useState)(null),f=n.files.length,p=async t=>{l(`working`),d(null);try{let n=await jo(e,t),r=[];n.restored.length&&r.push(`restored ${mw(n.restored.length,`file`)}`),n.removed.length&&r.push(`removed ${mw(n.removed.length,`new file`)}`);let a=`Undone: ${r.join(`, `)||`no files needed changing`}.`;n.kept_folders.length&&(a+=` Kept ${mw(n.kept_folders.length,`folder`)} the chat created, because they now hold other files.`),d(a),l(`done`),i(a),ub(e),await sb(e)}catch(e){let t=e?.reason===`conflict`;d(hw(e)),l(t?`conflict`:`idle`)}};return(0,B.jsxs)(`div`,{className:`sp-changes`,children:[(0,B.jsxs)(`p`,{className:`sp-changes-total`,"aria-live":`polite`,children:[(0,B.jsx)(`strong`,{children:_w(n)}),n.totals.uncounted>0&&(0,B.jsxs)(`span`,{className:`sp-meta`,children:[` · `,mw(n.totals.uncounted,`binary or large file`),` not line-counted`]})]}),n.pending&&(0,B.jsx)(`p`,{className:`sp-meta`,children:`A reply is still running; its changes are added when it ends.`}),(0,B.jsx)(`ul`,{className:`sp-list`,children:n.files.map(e=>{let t=e.message_ids[e.message_ids.length-1];return(0,B.jsxs)(`li`,{className:`sp-change`,children:[(0,B.jsxs)(`div`,{className:`sp-item-text`,children:[(0,B.jsx)(`span`,{className:`sp-item-name`,title:e.path,children:gw(e.path)}),(0,B.jsxs)(`span`,{className:`sp-meta`,children:[vw[e.change],e.additions!=null&&(0,B.jsxs)(B.Fragment,{children:[` · `,(0,B.jsxs)(`span`,{className:`sp-add`,children:[`+`,e.additions]}),` `,(0,B.jsxs)(`span`,{className:`sp-del`,children:[`−`,e.deletions]})]}),e.message_ids.length>1&&` · ${mw(e.message_ids.length,`turn`)}`]}),e.changed_since&&(0,B.jsxs)(`span`,{className:`sp-warn-text`,children:[(0,B.jsx)(Tn,{size:11,"aria-hidden":`true`}),` Changed outside GAIA: `,e.changed_since]})]}),t!=null&&(0,B.jsx)(`button`,{type:`button`,className:`btn-icon-sm`,onClick:()=>a(t),"aria-label":`Go to the last turn that changed ${gw(e.path)}`,title:`Go to turn`,children:(0,B.jsx)(ke,{size:12})})]},e.path)})}),n.incomplete&&(0,B.jsxs)(`p`,{className:`sp-warn-text`,role:`note`,children:[(0,B.jsx)(Tn,{size:11,"aria-hidden":`true`}),` `,bb(n.untracked,{inChat:!0,undo:`Undo all`})]}),(0,B.jsxs)(`div`,{className:`sp-actions-row`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`sp-action`,onClick:()=>s(!0),children:[(0,B.jsx)(Ve,{size:12,"aria-hidden":`true`}),` Review changes`]}),c!==`confirm`&&c!==`conflict`&&(0,B.jsxs)(`button`,{type:`button`,className:`sp-action`,onClick:()=>l(`confirm`),disabled:c===`working`||t,title:t?`Wait for the reply to finish`:void 0,children:[(0,B.jsx)(Dn,{size:12,"aria-hidden":`true`}),` `,c===`working`?`Undoing…`:`Undo all`]})]}),c===`confirm`&&(0,B.jsxs)(`div`,{className:`sp-confirm`,role:`group`,"aria-label":`Confirm undo all`,children:[`Put `,mw(f,`file`),` back the way `,f===1?`it was`:`they were`,` before this chat? Every turn's file changes are undone.`,(0,B.jsxs)(`span`,{className:`sp-actions-row`,children:[(0,B.jsx)(`button`,{type:`button`,className:`sp-action is-danger`,onClick:()=>void p(!1),children:`Undo all`}),(0,B.jsx)(`button`,{type:`button`,className:`sp-action`,onClick:()=>l(`idle`),children:`Cancel`})]})]}),u&&(0,B.jsxs)(`div`,{className:c===`done`?`sp-ok`:`sp-error`,role:c===`done`?`status`:`alert`,children:[u,c===`conflict`&&(0,B.jsxs)(`span`,{className:`sp-actions-row`,children:[(0,B.jsx)(`button`,{type:`button`,className:`sp-action is-danger`,onClick:()=>void p(!0),children:`Undo anyway and lose those changes`}),(0,B.jsx)(`button`,{type:`button`,className:`sp-action`,onClick:()=>{l(`idle`),d(null)},children:`Keep them`})]})]}),(0,B.jsx)(Cw,{sessionId:e,busy:t,onCommitted:r}),o&&(0,B.jsx)(Sw,{changes:n,onClose:()=>s(!1)})]})}function xw(e){if(e.too_large)return`Too large to show: ${e.before_size} → ${e.after_size} bytes.`;if(e.binary)return`Binary file: ${e.before_size} → ${e.after_size} bytes. No text diff.`;if(e.truncated)return`Diff shortened: the change is too long to show in full.`}function Sw({changes:e,onClose:t}){c(!0,t);let n=(0,R.useRef)(null);return Ob(n,!0),(0,B.jsx)(`div`,{ref:n,className:`modal-overlay`,onClick:t,role:`dialog`,"aria-modal":`true`,"aria-label":`Review this chat's changes`,children:(0,B.jsxs)(`div`,{className:`modal-panel changes-review`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(`div`,{className:`modal-header`,children:[(0,B.jsxs)(`h3`,{children:[`Changes in this chat · `,_w(e)]}),(0,B.jsx)(`button`,{type:`button`,className:`btn-icon`,onClick:t,"aria-label":`Close`,children:(0,B.jsx)(Fn,{size:18})})]}),(0,B.jsx)(`div`,{className:`modal-body changes-review-body`,children:e.files.map(e=>(0,B.jsx)(`section`,{className:`changes-review-file`,children:(0,B.jsx)(Fy,{data:{title:e.path,badge:vw[e.change],note:xw(e),unified:e.binary||e.too_large?``:e.unified}})},e.path))})]})})}function Cw({sessionId:e,busy:t,onCommitted:n}){let[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(null),d=(0,R.useCallback)(()=>{Promise.resolve().then(()=>Mo(e)).then(e=>{i(NC(e,e=>Array.isArray(e.repos),`list of git repositories`)),o(null)}).catch(e=>o(hw(e)))},[e]);return(0,R.useEffect)(d,[d]),zC(t,d),db(e,d),a?(0,B.jsxs)(`p`,{className:`sp-error`,children:[`Couldn't check for a git repository: `,a]}):!r||!r.available||r.repos.length===0?null:(0,B.jsxs)(`div`,{className:`sp-git`,children:[r.repos.map(e=>(0,B.jsxs)(`div`,{className:`sp-git-repo`,children:[(0,B.jsxs)(`span`,{className:`sp-meta`,title:e.root,children:[(0,B.jsx)(at,{size:12,"aria-hidden":`true`}),` `,gw(e.root),` · `,e.branch,e.uncommitted.length===0&&e.files.length>0&&` · committed`]}),(0,B.jsxs)(`span`,{className:`sp-actions-row`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`sp-action`,disabled:t||e.uncommitted.length===0,onClick:()=>{u(null),c({kind:`commit`,repo:e})},children:[(0,B.jsx)(st,{size:12,"aria-hidden":`true`}),` Commit…`]}),(0,B.jsxs)(`button`,{type:`button`,className:`sp-action`,disabled:t||e.pr_blocked!=null,title:e.pr_blocked??void 0,onClick:()=>{u(null),c({kind:`pr`,repo:e})},children:[(0,B.jsx)(lt,{size:12,"aria-hidden":`true`}),` Create PR…`]})]}),e.pr_blocked&&(0,B.jsx)(`span`,{className:`sp-meta`,children:e.pr_blocked})]},e.root)),l&&(0,B.jsx)(`p`,{className:`sp-ok`,role:`status`,children:l}),s&&(0,B.jsx)(ww,{sessionId:e,kind:s.kind,repo:s.repo,onClose:()=>c(null),onDone:e=>{c(null),u(e),d(),n()}})]})}function ww({sessionId:e,kind:t,repo:n,onClose:r,onDone:i}){let[a,o]=(0,R.useState)(n.draft.title),[s,l]=(0,R.useState)(n.draft.body),[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(null);c(!0,r,!u);let m=(0,R.useRef)(null);Ob(m,!0);let h=async()=>{d(!0),p(null);try{if(t===`commit`){let t=await No(e,n.root,`${a.trim()}\n\n${s.trim()}`.trim());i(`Committed ${mw(t.files.length,`file`)} as ${t.commit}.`)}else i(`Opened ${(await Po(e,n.root,a,s)).url}`)}catch(e){p(hw(e)),d(!1)}},g=t===`commit`?n.uncommitted:n.files;return(0,B.jsx)(`div`,{className:`modal-overlay`,onClick:u?void 0:r,children:(0,B.jsxs)(`div`,{ref:m,className:`modal-panel sp-git-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":t===`commit`?`Commit this chat’s changes`:`Create a pull request`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(`div`,{className:`modal-header`,children:[(0,B.jsx)(`h3`,{children:t===`commit`?`Commit this chat’s changes`:`Create a pull request`}),(0,B.jsx)(`button`,{type:`button`,className:`btn-icon`,onClick:r,disabled:u,"aria-label":`Close`,children:(0,B.jsx)(Fn,{size:18})})]}),(0,B.jsxs)(`div`,{className:`modal-body sp-git-body`,children:[(0,B.jsx)(`p`,{className:`sp-meta`,children:t===`commit`?`In ${n.root} on ${n.branch}. Only the files below are committed; anything else you changed stays as it is.`:`Pushes ${n.branch} to ${n.remote} (never forced), then opens a pull request with GitHub's gh tool.`}),(0,B.jsxs)(`label`,{className:`sp-field`,children:[(0,B.jsx)(`span`,{children:t===`commit`?`Summary`:`Title`}),(0,B.jsx)(`input`,{value:a,onChange:e=>o(e.target.value),disabled:u})]}),(0,B.jsxs)(`label`,{className:`sp-field`,children:[(0,B.jsx)(`span`,{children:t===`commit`?`Details`:`Description`}),(0,B.jsx)(`textarea`,{value:s,onChange:e=>l(e.target.value),rows:7,disabled:u})]}),(0,B.jsxs)(`div`,{className:`sp-meta`,children:[mw(g.length,`file`),`: `,g.join(`, `)]}),t===`commit`&&n.ignored.length>0&&(0,B.jsxs)(`div`,{className:`sp-meta`,children:[`Left out, because git ignores `,n.ignored.length===1?`it`:`them`,`: `,n.ignored.join(`, `)]}),f&&(0,B.jsx)(`p`,{className:`sp-error`,role:`alert`,children:f})]}),(0,B.jsxs)(`div`,{className:`sp-picker-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:r,disabled:u,children:`Cancel`}),(0,B.jsxs)(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void h(),disabled:u||!a.trim(),children:[u&&(0,B.jsx)(L,{size:13,className:`spin`,"aria-hidden":`true`}),t===`commit`?`Commit ${mw(g.length,`file`)}`:`Push and open PR`]})]})]})})}var Tw=`(max-width: 1099px)`,Ew=16;function Dw({sessionId:e,messages:t,busy:n,onUsage:r,onJumpToMessage:i}){let a=vC(Tw),o=_C(e=>a?e.overlayOpen:e.open),s=_C(e=>e.width),l=_C(e=>e.setWidth),u=_C(e=>e.setOpen),d=_C(e=>e.setOverlayOpen),f=_C(e=>e.focus),p=(0,R.useRef)(null),[m,h]=(0,R.useState)(null),g=(0,R.useCallback)(()=>{a?d(!1):u(!1)},[a,u,d]);c(o&&a,g);let _=(0,R.useRef)(null);Ob(_,o&&a),(0,R.useEffect)(()=>{o&&a&&p.current?.focus()},[o,a]),(0,R.useEffect)(()=>{f&&a&&d(!0)},[f,a,d]);let v=(0,R.useCallback)(e=>{if(e.button!==0)return;e.preventDefault();let t=e.clientX,n=s,r=e.currentTarget;r.setPointerCapture?.(e.pointerId);let i=n,a=e=>{i=hC(n+(t-e.clientX)),h(i)},o=()=>{r.removeEventListener(`pointermove`,a),r.removeEventListener(`pointerup`,o),r.removeEventListener(`pointercancel`,o),h(null),l(i)};r.addEventListener(`pointermove`,a),r.addEventListener(`pointerup`,o),r.addEventListener(`pointercancel`,o)},[l,s]),y=(0,R.useCallback)(e=>{let t={ArrowLeft:s+Ew,ArrowRight:s-Ew,Home:280,End:640}[e.key];t!==void 0&&(e.preventDefault(),l(t))},[l,s]);if(!o)return null;let b=m??s,x=yC(t,n);return(0,B.jsxs)(B.Fragment,{children:[a&&(0,B.jsx)(`div`,{className:`sp-backdrop`,onClick:g,"aria-hidden":`true`}),(0,B.jsxs)(`aside`,{ref:_,className:`session-panel ${a?`is-overlay`:`is-docked`}`,style:a?void 0:{width:b},"aria-label":`Session panel`,role:a?`dialog`:`complementary`,"aria-modal":a?!0:void 0,children:[!a&&(0,B.jsx)(`div`,{className:`sp-resize${m==null?``:` is-dragging`}`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize session panel`,"aria-valuemin":280,"aria-valuemax":640,"aria-valuenow":b,tabIndex:0,onPointerDown:v,onKeyDown:y,onDoubleClick:()=>l(320)}),(0,B.jsxs)(`header`,{className:`sp-header`,children:[(0,B.jsx)(`h2`,{className:`sp-title`,children:`This chat`}),(0,B.jsx)(`button`,{ref:p,type:`button`,className:`btn-icon-sm`,onClick:g,"aria-label":`Close session panel`,title:`Close`,children:a?(0,B.jsx)(Fn,{size:14}):(0,B.jsx)(Bt,{size:14})})]}),(0,B.jsxs)(`div`,{className:`sp-body`,children:[x&&(0,B.jsx)(MC,{id:`answer`,title:`This answer`,children:(0,B.jsx)(TC,{messages:t,busy:n})}),(0,B.jsx)($C,{sessionId:e,busy:n}),(0,B.jsx)(MC,{id:`context`,title:`Context & performance`,children:(0,B.jsx)(`div`,{className:`sp-context`,children:(0,B.jsx)(QS,{sessionId:e,busy:n,onUsage:r})})}),(0,B.jsx)(fw,{sessionId:e,busy:n,onJumpToMessage:i}),(0,B.jsx)(yw,{sessionId:e,busy:n,onJumpToMessage:i})]})]})]})}function Ow({messages:e,busy:t}){let n=vC(Tw),r=_C(e=>n?e.overlayOpen:e.open),i=_C(e=>e.setOpen),a=_C(e=>e.setOverlayOpen),o=yC(e,t),s=!r&&o?.kind===`turn`&&o.turn.turnSummary?bC(o.turn.turnSummary):!1,c=r?`Hide session panel`:s?`Show session panel: couldn't get live data`:`Show session panel`;return(0,B.jsx)(`button`,{type:`button`,className:`btn-icon-sm sp-toggle${r?` active`:``}${s?` is-warn`:``}`,onClick:()=>n?a(!r):i(!r),"aria-label":c,"aria-pressed":r,title:c,children:s?(0,B.jsx)(Tn,{size:15}):r?(0,B.jsx)(Bt,{size:15}):(0,B.jsx)(Ht,{size:15})})}function kw({sessionId:e}){let{env:t,change:n}=RC(e),[r,i]=(0,R.useState)(null);return!t||t.internet?null:(0,B.jsxs)(`div`,{className:`offline-notice`,role:`status`,children:[(0,B.jsx)(jn,{size:13,"aria-hidden":`true`}),(0,B.jsxs)(`span`,{children:[`Offline: internet is off for this chat, so GAIA won't search the web or open pages.`,r&&(0,B.jsxs)(`span`,{className:`offline-notice-error`,children:[` Couldn't turn it on: `,r]})]}),(0,B.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>{i(null),n(()=>Oo(e,!0)).catch(e=>{i(e instanceof wi?e.detail||e.message:String(e))})},children:`Turn on`})]})}function Aw({message:e,onDismiss:t}){return e?(0,B.jsxs)(`div`,{className:`export-error-bar`,role:`alert`,children:[(0,B.jsx)(`span`,{children:e}),(0,B.jsx)(`button`,{type:`button`,className:`btn-icon-sm`,onClick:t,"aria-label":`Dismiss export error`,children:(0,B.jsx)(Fn,{size:13})})]}):null}function jw(){return`screenshot-${new Date().toISOString().slice(0,19).replace(/[T:]/g,`-`)}.png`}function Mw(){let[e,t]=(0,R.useState)([]),n=(0,R.useRef)(!0);(0,R.useEffect)(()=>(n.current=!0,()=>{n.current=!1}),[]);let r=(0,R.useCallback)(async e=>{try{let r=await io(e.file);if(!n.current)return;t(t=>t.map(t=>t.id===e.id?{...t,uploading:!1,uploaded:!0,serverUrl:r.url}:t))}catch(r){if(u.chat.error(`Upload failed: ${e.name}`,r),!n.current)return;let i=r instanceof Error?r.message:`Upload failed`;t(t=>t.map(t=>t.id===e.id?{...t,uploading:!1,error:i}:t))}},[]),i=(0,R.useCallback)(e=>{for(let n of e){let e=n.type.startsWith(`image/`),i={id:`attach-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,file:n,name:n.name||(e?jw():`file`),url:e?URL.createObjectURL(n):``,uploading:!0,uploaded:!1,isImage:e};t(e=>[...e,i]),r(i)}},[r]),a=(0,R.useCallback)(e=>{let t=Array.from(e.clipboardData?.items??[]).filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null);return t.length!==0&&(e.preventDefault(),i(t),!0)},[i]),o=(0,R.useCallback)(e=>{t(t=>{let n=t.find(t=>t.id===e);return n?.url&&URL.revokeObjectURL(n.url),t.filter(t=>t.id!==e)})},[]),s=(0,R.useCallback)(()=>{t(e=>(e.forEach(e=>{e.url&&URL.revokeObjectURL(e.url)}),[]))},[]),c=(0,R.useCallback)(t=>{let n=e.filter(e=>e.uploaded&&e.serverUrl).map(e=>e.isImage?``:`[${e.name}](${e.serverUrl})`).join(`
|
|
65
|
-
`);return n?t?`${t}\n\n${n}`:n:t},[e]);return{attachments:e,addFiles:i,handlePaste:a,remove:o,clear:s,hasUploaded:e.some(e=>e.uploaded),uploading:e.some(e=>e.uploading),compose:c}}function Nw({sessionId:e,isStreaming:t,isStale:n,setMessages:r,refreshContext:i}){let[a,o]=(0,R.useState)(null),s=a?.state.status===`running`,c=(0,R.useRef)(!1);c.current=s;let l=(0,R.useRef)(a);l.current=a,(0,R.useEffect)(()=>{o(null)},[e]);let d=(0,R.useCallback)((r,i)=>{t||c.current||(u.chat.info(`Retrying message ${r.id} with ${i}`),o({messageId:r.id,state:{status:`running`,model:i},keeping:null}),di(e,r.id,i).then(e=>{n()||o(t=>t&&t.messageId===r.id?{...t,state:{status:`ready`,result:e}}:t)}).catch(e=>{u.chat.error(`Retry with ${i} failed`,e),!n()&&o(t=>t&&t.messageId===r.id?{...t,state:{status:`failed`,model:i,error:e instanceof Error?e.message:String(e)}}:t)}))},[e,t,n]),f=(0,R.useCallback)(async t=>{if(!a)return;let{messageId:s}=a;o({...a,keeping:t});try{let a=await fi(e,s,t);if(n())return;if(a.kept===`retry`){let e=a.stats;r(z.getState().messages.map(t=>t.id===s?{...t,content:a.content,stats:{...t.stats,...e,tokens_per_second:e.tokens_per_second??0,time_to_first_token:e.time_to_first_token??0,input_tokens:e.input_tokens??0,output_tokens:e.output_tokens??0,retried:!0}}:t)),i()}o(null)}catch(e){if(u.chat.error(`Could not keep the chosen answer`,e),n())return;o(t=>t&&{...t,keeping:null,state:{status:`failed`,model:t.state.status===`ready`?t.state.result.model:t.state.model,error:e instanceof Error?e.message:String(e)}})}},[a,e,r,n,i]);return{comparison:a,comparing:s,comparingRef:c,handleRetryWith:d,handleKeepAnswer:f,handleCloseComparison:(0,R.useCallback)(()=>{a?.state.status===`ready`?f(`original`):o(null)},[a,f]),closeForNewTurn:(0,R.useCallback)(()=>{let t=l.current;t&&(t.state.status===`ready`&&fi(e,t.messageId,`original`).catch(e=>u.chat.error(`Could not close the answer comparison`,e)),o(null))},[e])}}function Pw(e,t){let[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(null);(0,R.useEffect)(()=>{r(null),a(null)},[e]);let o=(0,R.useCallback)(()=>{li(e).then(e=>{t()||(e.available?(r(e),a(null)):(r(null),a(e.reason)))}).catch(t=>u.chat.error(`Could not measure the context for session=${e}`,t))},[e,t]);return(0,R.useEffect)(()=>{o()},[o]),{contextUsage:n,contextUnavailable:i,refreshContext:o,showContextUsage:(0,R.useCallback)(e=>{r(e),a(null)},[])}}function Fw(e,t){return(0,R.useCallback)(n=>{let r=e.current?.querySelector(`[data-message-id="${n}"]`);if(!r)return!1;let i=r.previousElementSibling,a=i?.dataset.role===`user`?i:r;return t.current=!1,a.scrollIntoView?.({block:`start`,behavior:rb()}),r.classList.add(`msg-jump-target`),window.setTimeout(()=>r.classList.remove(`msg-jump-target`),1600),!0},[e,t])}function Iw(e,t){let[n,r]=(0,R.useState)(null);(0,R.useEffect)(()=>{r(null)},[e]);let i=(0,R.useCallback)(()=>r(null),[]);return{exportChat:(0,R.useCallback)(async()=>{r(null);try{let n=await Ea(e),r=new Blob([n.content],{type:`text/markdown`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${(t||`chat`).replace(/[/\\:*?"<>|]/g,`_`).slice(0,100)}.md`,a.click(),URL.revokeObjectURL(i)}catch(e){u.chat.error(`Export failed`,e),r(e instanceof wi?`Couldn't export this chat: GAIA's backend returned an error (HTTP ${e.httpStatus}). Try Export again; if it keeps failing, check the backend log.`:`Couldn't export this chat because GAIA's backend isn't reachable. Check that GAIA is running, then try Export again.`)}},[e,t]),exportError:n,clearExportError:i}}var Lw=5200;function Rw(e=Lw){let[t,n]=(0,R.useState)(null),r=(0,R.useRef)(null),i=(0,R.useCallback)(()=>{r.current&&=(clearTimeout(r.current),null)},[]),a=(0,R.useCallback)(()=>{i(),n(null)},[i]),o=(0,R.useCallback)(t=>{i(),n(t),r.current=setTimeout(()=>{r.current=null,n(null)},e)},[i,e]);return(0,R.useEffect)(()=>i,[i]),{policyToast:t,showPolicyToast:o,dismissPolicyToast:a}}var zw=`gaia`;function Bw(e){return e.some(e=>e.id===zw)}function Vw(e){let t=e;return t?.httpStatus===422&&`${typeof t.detail==`string`?t.detail:``} ${typeof t.message==`string`?t.message:``}`.includes(`Unknown agent_type '${zw}'`)}var Hw=new Set([``,`new chat`,`new task`,`untitled`,`untitled session`,`chat`]);function Uw(e){return Hw.has((e??``).trim().toLowerCase())}var Ww=32768,Gw=`Gemma-4-E4B-it-GGUF`,Kw=3e5,qw=18e5,Jw=1e4,Yw=`GAIA is starting…`;function Xw(e,t){let n=()=>typeof document<`u`&&document.visibilityState===`hidden`,r=setInterval(()=>{n()||e()},t),i=()=>{n()||e()};return document.addEventListener(`visibilitychange`,i),()=>{clearInterval(r),document.removeEventListener(`visibilitychange`,i)}}function Zw(e){let t=()=>typeof document<`u`&&document.visibilityState===`hidden`,n=t()?null:e(),r=()=>{t()?(n?.(),n=null):n||=e()};return document.addEventListener(`visibilitychange`,r),()=>{document.removeEventListener(`visibilitychange`,r),n?.(),n=null}}var Qw=/\s*\{\s*"?(?:tool|thought|goal)"?\s*:\s*"[^"]*"[^}]*(?:"?tool_args"?\s*:\s*\{[^}]*\})?\s*\}/g,$w=new Set([`tool_start`,`tool_end`,`tool_result`]),eT=`Connection lost. Reconnecting`,tT=15e3,nT=[];function rT(e){let t=e.trim();if(!t.startsWith(`{`)||!t.includes(`"thought"`)&&!t.includes(`"answer"`)&&!t.includes(`"goal"`))return e;try{let e=JSON.parse(t);if(e.answer!==void 0)return String(e.answer)}catch{}let n=t.indexOf(`"answer"`);if(n===-1)return``;let r=t.indexOf(`:`,n+8);if(r===-1)return``;let i=r+1;for(;i<t.length&&/\s/.test(t[i]);)i++;if(i>=t.length||t[i]!==`"`)return``;let a=t.slice(i+1);return a.endsWith(`"}`)?a=a.slice(0,-2):a.endsWith(`"`)&&(a=a.slice(0,-1)),a.replace(/\\"/g,`"`).replace(/\\n/g,`
|
|
66
|
-
`).replace(/\\\\/g,`\\`)}function iT(e,t){if(e.type!==`agent_error`||e.recoverable!==!0)return!1;let n=t[t.length-1];return!n||n.type!==`tool`?!1:n.success===!1||!!n.active&&n.success==null}var aT=new Map;function oT({text:e}){return(0,B.jsx)(`div`,{className:`history-notice`,role:`note`,children:e})}function sT(e,t){let n=++t.current,r=Date.now();switch(e.type){case`thinking`:return{id:n,type:`thinking`,label:`Thinking`,detail:e.content,active:!0,timestamp:r};case`tool_start`:return{id:n,type:`tool`,label:`Using tool`,tool:e.tool,detail:e.detail,narration:e.narration,active:!0,timestamp:r,mcpServer:e.mcp_server,mcpServerLabel:e.mcp_server_label,mcpTool:e.mcp_tool};case`plan`:return{id:n,type:`plan`,label:`Created plan`,planSteps:e.steps,planNarrations:e.step_narrations,currentStep:e.current_step,active:!1,success:!0,timestamp:r};case`step`:return{id:n,type:`status`,label:`Step ${e.step}${e.total?` of ${e.total}`:``}`,active:!0,timestamp:r};case`status`:return e.message?.startsWith(`Agent: `)?null:{id:n,type:`status`,label:e.message||e.status||`Working`,active:e.status===`working`,timestamp:r};case`agent_error`:return{id:n,type:`error`,label:`Error`,detail:e.content,success:!1,active:!1,timestamp:r};case`policy_alert`:{let t=e.tool||`unknown tool`,i=e.reason||e.message||e.content||`Tool execution was blocked by governance policy.`;return{id:n,type:`policy_alert`,label:`Policy blocked ${t}`,detail:i,tool:t,decision:e.decision||`BLOCK`,reason:i,ruleIds:e.rule_ids??[],policyVersion:e.policy_version,receiptId:e.receipt_id,success:!1,active:!1,timestamp:r}}default:return null}}function cT(e){return(e||[]).map(e=>({...e,agentSteps:e.agentSteps||e.agent_steps||void 0,stats:e.stats||e.inference_stats||void 0,turnSummary:e.turnSummary||e.turn_summary||void 0}))}function lT(e){return`policy-receipt-${encodeURIComponent(e)}`}function uT({sessionId:e}){let{sessions:t,messages:n,setMessages:r,addMessage:i,removeMessage:o,removeMessagesFrom:s,updateSessionInList:c,isStreaming:d,streamingContent:f,setStreaming:p,setStreamContent:m,clearStreamContent:h,agentSteps:g,addAgentStep:_,updateLastAgentStep:v,appendThinkingContent:y,updateLastToolStep:b,clearAgentSteps:x,cards:C,appendCard:w,clearCards:T,documents:E,setDocuments:D,setShowDocLibrary:O,setShowFileBrowser:k,isLoadingMessages:A,setLoadingMessages:j,systemStatus:M}=z(),ee=Cs(e=>e.addNotification),te=Cs(e=>e.showPanel),N=Cs(e=>e.setShowPanel),ne=Cs(e=>e.setTypeFilter),re=z(e=>e.pendingPrompt),ie=z(e=>e.liveStatus),ae=z(e=>e.awaitingUser),oe=z(t=>Object.values(t.liveQuestions).some(t=>t.sessionId===e)),se=Cs(t=>Es(e)(t)!==null),ce=t.find(t=>t.id===e),le=new Set(ce?.document_ids??[]),ue=E.filter(e=>le.has(e.id)),[de,fe]=(0,R.useState)(``),[pe,me]=(0,R.useState)(!1),[he,P]=(0,R.useState)(``),[F,I]=(0,R.useState)(!1),[_e,ve]=(0,R.useState)(!1),ye=Mw(),[be,xe]=(0,R.useState)(!1),[Se,Ce]=(0,R.useState)(null),{policyToast:we,showPolicyToast:Te,dismissPolicyToast:Ee}=Rw(),[De,Oe]=(0,R.useState)(null),{exportChat:ke,exportError:Ae,clearExportError:je}=Iw(e,ce?.title),Me=ce?.agent_type&&ce.agent_type!==`gaia`?ce.agent_type:null,[Ne,Pe]=(0,R.useState)(!1),[Ie,Le]=(0,R.useState)(null),Re=(0,R.useRef)(``),Be=(0,R.useRef)([]),Ve=(0,R.useRef)([]),He=(0,R.useRef)(!1);(0,R.useEffect)(()=>{f&&(Re.current=f)},[f]),(0,R.useEffect)(()=>{g.length>0&&(Be.current=g.map(e=>({...e,active:!1})))},[g]),(0,R.useEffect)(()=>{C.length>0&&(Ve.current=[...C])},[C]),(0,R.useEffect)(()=>{if(!d&&He.current){Pe(!0);let e=setTimeout(()=>{Pe(!1),Re.current=``,Be.current=[],Ve.current=[]},350);return()=>clearTimeout(e)}He.current=d},[d]);let Ue=(0,R.useRef)(null),We=(0,R.useRef)(null),Ge=(0,R.useRef)(null),Ke=(0,R.useRef)(null),Je=(0,R.useRef)(0),Ye=(0,R.useRef)(!1),Xe=(0,R.useRef)(0),Ze=(0,R.useRef)(null),[Qe,$e]=(0,R.useState)(!1),et=(0,R.useRef)(!1),nt=(0,R.useRef)(null),rt=(0,R.useRef)(null),it=(0,R.useRef)(0),[at,ot]=(0,R.useState)(0),st=(0,R.useRef)(!1),ct=(0,R.useRef)(()=>{}),lt=z(t=>t.messageQueues[e]??nT),ut=(0,R.useCallback)(t=>z.getState().updateQueue(e,t),[e]),dt=(0,R.useRef)(!1),ft=(0,R.useRef)(!1),pt=(0,R.useRef)(!1),mt=(0,R.useRef)(d);mt.current=d;let ht=z(t=>!!t.queueHolds[e]),gt=(0,R.useRef)(``),_t=(0,R.useRef)(null),vt=(0,R.useRef)(null),yt=(0,R.useRef)(0),bt=(0,R.useRef)(!0),xt=(0,R.useCallback)(()=>z.getState().currentSessionId!==e,[e]),St=(0,R.useCallback)(()=>{_t.current=null,!xt()&>.current&&m(gt.current)},[m,xt]),Ct=(0,R.useRef)(0),wt=(0,R.useRef)(0);(0,R.useEffect)(()=>{u.chat.info(`ChatView mounted for session=${e}, loading messages...`);let t=u.chat.time();j(!0);let n=!1,i=!1,a=async(a=!1)=>{if(n||i)return;i=!0;let o=wt.current;try{if(!a){if(z.getState().isStreaming)return;let t=await wa(e);if(n||t===Ct.current||z.getState().isStreaming)return}let i=await Ta(e);if(n)return;let s=cT(i.messages);a&&wt.current!==o?Ct.current=s.length:a?(r(s),Ct.current=s.length,u.chat.timed(`Loaded ${s.length} message(s) for session=${e}`,t)):s.length!==Ct.current&&!z.getState().isStreaming&&(u.chat.info(`Messages changed externally: ${Ct.current} -> ${s.length}`),r(s),Ct.current=s.length)}catch(t){if(n)return;a&&(u.chat.error(`Failed to load messages for session=${e}`,t),r([]))}finally{i=!1,!n&&a&&j(!1)}};a(!0);let o=Xw(()=>a(!1),3e3);return()=>{n=!0,o()}},[e,r,j]),(0,R.useEffect)(()=>{Wa().then(e=>D(e.documents||[])).catch(e=>u.doc.error(`Could not load the document list`,e))},[D]);let Tt=(0,R.useRef)(!0),Et=(0,R.useRef)(!1);(0,R.useEffect)(()=>(Tt.current=!0,()=>{Tt.current=!1}),[]),(0,R.useEffect)(()=>{let{pendingPrompt:e,isLoadingMessages:t}=z.getState();e&&!t&&(z.getState().setPendingPrompt(null),Et.current=!0,setTimeout(()=>{Et.current=!1,Tt.current&&ct.current(e,{opening:!0})},0))},[re,A]),(0,R.useEffect)(()=>{if(!bt.current)return;let e=Date.now()-yt.current,t=()=>{yt.current=Date.now(),Ue.current?.scrollIntoView({behavior:rb()})};e>=100&&t(),vt.current&&clearTimeout(vt.current),vt.current=setTimeout(t,100)},[n,f,g]),(0,R.useEffect)(()=>{Ge.current?.focus()},[e]),(0,R.useEffect)(()=>{dt.current=!1},[e]);let{contextUsage:L,contextUnavailable:Dt,refreshContext:Ot,showContextUsage:kt}=Pw(e,xt),{comparison:At,comparing:jt,comparingRef:Mt,handleRetryWith:Nt,handleKeepAnswer:Pt,handleCloseComparison:Ft,closeForNewTurn:It}=Nw({sessionId:e,isStreaming:d,isStale:xt,setMessages:r,refreshContext:Ot});(0,R.useEffect)(()=>()=>{mt.current&&Lx(e),Ke.current&&!pt.current&&Ke.current.abort(),Ke.current&&=null,nt.current&&=(clearTimeout(nt.current),null),et.current=!1,rt.current=null,$e(!1),_t.current!==null&&(cancelAnimationFrame(_t.current),_t.current=null),vt.current&&=(clearTimeout(vt.current),null),Ze.current&&=(clearTimeout(Ze.current),null),Ee(),gt.current=``},[e]),(0,R.useEffect)(()=>{De&&te&&(document.getElementById(lT(De))?.scrollIntoView({behavior:rb(),block:`center`}),Oe(null))},[De,te]);let Lt=(0,R.useCallback)(()=>{let e=We.current;if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;bt.current=t<=80,ve(t>200)},[]),Rt=_C(e=>e.width),zt=_C(e=>e.reveal),Bt=Fw(We,bt),Vt=(0,R.useCallback)(()=>{bt.current=!0,Ue.current?.scrollIntoView({behavior:rb()})},[]),Ht=(0,R.useCallback)(()=>{et.current||(et.current=!0,dt.current=!0,$e(!0),Cs.getState().dismissSessionPrompts(e),z.getState().closeSessionQuestions(e),u.stream.warn(`User stopped generation; waiting for the server to close the turn`),oi(e).catch(e=>{u.stream.error(`Stop request failed; waiting for the stream to close`,e)}),Ze.current?(clearTimeout(Ze.current),Ze.current=null,rt.current?.()):nt.current=setTimeout(()=>{u.stream.error(`No closing event ${tT}ms after Stop; closing the turn locally (session=${e})`),rt.current?.()},tT))},[e]);(0,R.useEffect)(()=>{let e=e=>{e.key===`Escape`&&d&&!a(e)&&(e.preventDefault(),Ht())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[d,Ht]);let Ut=(0,R.useCallback)(async(t,n)=>{let a=n?.attach===!0,s=n?.queued===!0,l=a?n?.reconnect??0:0,f=(t||de).trim(),m=!s&&ye.hasUploaded;bt.current=!0;let g=M?.init_state===`initializing`,S=e=>{s&&n?.onQueuedOutcome?.(e)};if(!a&&Me){u.chat.warn(`Send blocked: chat ${e} belongs to the retired "${Me}" agent`),S({kind:`failed`,error:`This chat's "${Me}" agent was retired, so it cannot take new messages.`});return}let C=!n?.opening&&(z.getState().messageQueues[e]??nT).length>0;if(a){if(d&&!l)return}else if(!s&&(f||m)&&!g&&(d||Mt.current||C)){ut(e=>xr(e,ye.compose(f),`queued`)),fe(``),ye.clear(),Ge.current?.focus();return}else if(!f&&!m||d||g){S({kind:`busy`}),!f&&!m&&u.chat.debug(`Send blocked: empty message`),d&&u.chat.debug(`Send blocked: already streaming`),g&&u.chat.debug(`Send blocked: system initializing`);return}let E=f,D=null;if(a)u.chat.info(`Re-attaching to background run for session=${e}${l?` (reconnect ${l})`:``}`);else{E=s?f:ye.compose(f),u.chat.info(`Sending message to session=${e}`,{length:E.length,preview:E.slice(0,80)}),s||(fe(``),Ge.current?.focus(),ye.clear()),It();let t={id:Date.now(),session_id:e,role:`user`,content:E,created_at:new Date().toISOString(),rag_sources:null};i(t),D=t,wt.current+=1}l||(Xe.current=0),p(!0),h(),x(),T(),it.current=0,ot(0),st.current=!1,l&&z.getState().setLiveStatus(`${eT} (attempt ${l} of 3)…`),u.stream.info(`Starting agent stream...`);let O=u.stream.time(),k=``,A;Le(null);let j=!1;ft.current=!1;let te=null,N=!s;pt.current=s;let ne=e=>{N||(N=!0,pt.current=!1,n?.onQueuedOutcome?.(e),e.kind===`accepted`&&xt()&&te?.abort())},re=a||!!ce&&!Uw(ce.title),ie=()=>{ne({kind:`accepted`}),!re&&(re=!0,ba(e).then(t=>c(e,{title:t.title})).catch(e=>u.chat.warn(`Could not refresh the chat title`,e)))};gt.current=``,et.current=!1,$e(!1);let ae=()=>{nt.current&&=(clearTimeout(nt.current),null),et.current=!1,rt.current=null,$e(!1)},oe=()=>{let{agentSteps:e,cards:t}=z.getState();return{steps:e.map(e=>({...e,active:!1})),cards:[...t]}};rt.current=()=>{if(j)return;j=!0,Ye.current=!0,Je.current=Date.now(),ae(),ne({kind:`failed`,error:`Stopped before GAIA confirmed it got this message.`}),Ke.current?.abort(),Ke.current=null,_t.current!==null&&(cancelAnimationFrame(_t.current),_t.current=null);let t=gt.current||z.getState().streamingContent;if(gt.current=``,xt())return;let{steps:n,cards:r}=oe();i({id:Date.now()+1,session_id:e,role:`assistant`,content:t,created_at:new Date().toISOString(),rag_sources:null,agentSteps:n.length>0?n:void 0,cards:r.length>0?r:void 0,stopState:`unconfirmed`}),p(!1),h(),x(),T()};let se={onConnected:()=>{if(xt())return;let e=z.getState();(e.liveStatus===`Waiting for GAIA to start this answer…`||e.liveStatus?.startsWith(eT))&&e.setLiveStatus(null)},onChunk:t=>{if(ie(),xt())return;z.getState().awaitingUser&&z.getState().setAwaitingUser(!1);let n=t.content||``;if(n&&Cs.getState().dismissSessionPrompts(e),n){t.type===`answer`?k=n:(st.current&&=(k.length>0&&(k+=`
|
|
67
|
-
|
|
68
|
-
`),!1),k+=n);let e=k.replace(Qw,``).trim();if(e=rT(e),e){let t=e.lastIndexOf(`{`);if(t>-1){let n=e.slice(t);/^\{\s*"(?:thought|answer|goal|tool)"/.test(n)&&(n.match(/\{/g)||[]).length>(n.match(/\}/g)||[]).length&&(e=e.slice(0,t).trim())}}gt.current=e,_t.current===null&&(_t.current=requestAnimationFrame(St))}},onAgentEvent:t=>{if((t.type!==`status`||t.phase!==`waiting`)&&ie(),t.type===`followup_taken`&&t.text){let n=t.text;if(ut(e=>Er(e,n)),xt())return;i({id:Date.now(),session_id:e,role:`user`,content:n,created_at:new Date().toISOString(),rag_sources:null});return}if(t.type===`followup_returned`){let e=t.texts??[];ut(t=>Dr(t,e));return}if(xt())return;if(t.type===`context_usage`){kt(t);return}let n=t.type===`permission_request`||t.type===`needs_input`;if(z.getState().awaitingUser!==n&&z.getState().setAwaitingUser(n),$w.has(t.type)&&Cs.getState().dismissSessionPrompts(e),t.type===`permission_request`){let n=t.tool||``,r=t.tool_label||n,{addNotification:i,notifications:a}=Cs.getState(),o=t.confirm_id?a.find(e=>e.id===t.confirm_id):void 0;if(o){!o.response&&o.dismissed&&Cs.setState(e=>({notifications:e.notifications.map(e=>e.id===o.id?{...e,dismissed:!1}:e)}));return}let s=n===ms,c=s&&bs(a,e,t.args);i({id:t.confirm_id??`perm-${Date.now()}`,type:`permission_request`,agentId:e,sessionId:e,agentName:`GAIA`,title:s?_s(t.args,c):`Allow ${r}?`,message:s?gs(t.args,c):`GAIA needs your OK before ${r}.`,timestamp:Date.now(),read:!1,dismissed:!1,priority:`high`,tool:n,toolArgs:t.args,confirmId:t.confirm_id,alwaysScope:typeof t.always_scope==`string`?t.always_scope:void 0,alwaysLabel:typeof t.always_label==`string`&&t.always_label?t.always_label:void 0,toolLabel:t.tool_label||void 0,risk:typeof t.risk==`string`?t.risk:void 0,summary:typeof t.summary==`string`&&t.summary?t.summary:void 0,timeoutSeconds:t.timeout_seconds});return}if(t.type===`needs_confirmation`){w({render:`needs_confirmation`,data:{action:typeof t.action==`string`?t.action:``,summary:typeof t.summary==`string`?t.summary:``}});return}if(t.type===`needs_input`){if(!t.request_id){console.error(`[ChatView] needs_input event missing request_id, ignoring`);return}z.getState().openQuestion(t.request_id,e,typeof t.timeout_seconds==`number`?t.timeout_seconds:null),w({render:`needs_input`,data:{session_id:e,request_id:t.request_id,question:typeof t.question==`string`?t.question:``,options:Array.isArray(t.options)?t.options:[],allow_free_text:t.allow_free_text!==!1,sensitive:!!t.sensitive}});return}if(t.type===`policy_alert`){let n=t.tool||`unknown tool`,r=t.reason||t.message||t.content||`Tool execution was blocked by governance policy.`,i={id:t.receipt_id??`policy-${Date.now()}-${it.current+1}`,type:`policy_alert`,agentId:e,agentName:`GAIA`,title:`Blocked: ${n} is restricted by policy.`,message:r,timestamp:Date.now(),read:!1,dismissed:!1,priority:`critical`,tool:n,decision:t.decision||`BLOCK`,reason:r,ruleIds:t.rule_ids??[],policyVersion:t.policy_version,receiptId:t.receipt_id};ee(i);let a=sT(t,it);a&&_(a),Te({tool:n,receiptId:t.receipt_id});return}if(t.type===`tool_end`){b({active:!1,success:t.success!==!1});return}if(t.type===`tool_result`){typeof t.render==`string`&&t.render.length>0&&w({render:t.render,data:t.data});let e={result:t.summary||t.title||`Done`,active:!1,success:t.success!==!1,latencyMs:t.latency_ms};t.command_output&&(e.commandOutput={command:t.command_output.command,stdout:t.command_output.stdout,stderr:t.command_output.stderr,returnCode:t.command_output.return_code,expectedExit:t.command_output.expected_exit,cwd:t.command_output.cwd,durationSeconds:t.command_output.duration_seconds,truncated:t.command_output.truncated}),t.mcp_output?.text&&(e.mcpOutput=t.mcp_output),t.result_data?.chunks&&t.result_data.chunks.length>0&&(e.retrievalChunks=t.result_data.chunks.map(e=>({id:e.id,source:e.source,sourcePath:e.sourcePath,page:e.page,score:e.score,preview:e.preview,content:e.content}))),t.result_data?.type===`file_list`&&t.result_data.files?.length>0&&(e.fileList={files:t.result_data.files,total:t.result_data.total??t.result_data.files.length}),b(e);return}if(t.type===`tool_args`){let e=!!t.args&&Object.keys(t.args).length>0,n=t.detail||(e?JSON.stringify(t.args):``);b({...n?{detail:n}:{},...t.narration?{narration:t.narration}:{}});return}if(t.type===`thinking`){let e=z.getState().agentSteps,n=e[e.length-1];if(n&&n.type===`thinking`){y(t.content||``);return}let r=sT(t,it);r&&_(r);return}if(t.type===`status`){let e=t.status,n=(t.message||``).trim();if(e===`history_cut`){A=n||void 0,Le(A??null);return}if(t.phase&&n&&z.getState().setLiveStatus(n,t.phase),t.phase===`waiting`||n.toLowerCase().startsWith(`executing `))return;if(e===`working`||e===`warning`||e===`info`){let e=z.getState().agentSteps,r=e[e.length-1];if(r&&r.type===`status`&&r.active){v({label:n||`Working`,detail:n});return}if(r&&r.type===`thinking`&&r.active){v({label:n||`Thinking`});return}let i=sT(t,it);i&&_(i)}return}if(t.type===`step`){typeof t.step==`number`&&ot(t.step);return}if(t.type===`agent_error`&&iT(t,z.getState().agentSteps))return;let r=sT(t,it);r&&(_(r),t.type===`tool_start`&&(st.current=!0,z.getState().setLiveStatus(Tv(t.tool,r),`tool`)))},onDone:t=>{if(ie(),Cs.getState().dismissSessionPrompts(e),z.getState().closeSessionQuestions(e),j)return;j=!0;let n=t.cancelled===!0?`stopped`:et.current&&t.message_id==null?`unconfirmed`:void 0;if(ae(),_t.current!==null&&(cancelAnimationFrame(_t.current),_t.current=null),gt.current=``,xt())return;Je.current=Date.now(),ft.current=!0;let o=z.getState();o.setRunningSessions(o.runningSessionIds.filter(t=>t!==e));let s=t.content||k;u.chat.timed(`Agent response complete: ${s.length} chars${n?` (${n})`:``}`,O);let{steps:c,cards:l}=oe(),d=c.some(e=>e.type===`policy_alert`);if(s||d||n){Ct.current=z.getState().messages.length+1;let r={id:t.message_id||Date.now()+1,session_id:e,role:`assistant`,content:s,created_at:new Date().toISOString(),rag_sources:null,agentSteps:c.length>0?c:void 0,stats:t.stats||void 0,turnSummary:t.turn_summary||void 0,cards:l.length>0?l:void 0,stopState:n,historyNotice:A};A&&aT.set(r.id,A),i(r)}p(!1),h(),x(),T(),Ge.current&&Ge.current.focus(),setTimeout(()=>{Ta(e).then(t=>{if(xt()||z.getState().isStreaming)return;let n=z.getState().messages,o=n.filter(e=>e.cards&&e.cards.length>0),c=cT(t.messages).map(e=>{let t=o.find(t=>t.id===e.id||t.role===e.role&&t.content===e.content);return{...e,cards:t?.cards,stopState:n.find(t=>t.id===e.id)?.stopState}});r(c),Ct.current=c.length,a&&!s&&c[c.length-1]?.role===`user`&&i({id:Date.now()+2,session_id:e,role:`assistant`,content:kx,created_at:new Date().toISOString(),rag_sources:null})}).catch(t=>u.chat.error(`Could not refresh messages for session=${e}`,t))},300)},onError:t=>{let n=Ax(t),r=N&&!a&&!n&&!!D&&Wx(e,E,t);if(!N||r){if(n)ie();else{if(ne(Hx(t)?{kind:`busy`}:{kind:`failed`,error:jx(t)??(t.message||`Unknown error`)}),Je.current=Date.now(),ae(),_t.current!==null&&(cancelAnimationFrame(_t.current),_t.current=null),gt.current=``,xt())return;u.chat.info(`Queued message for session=${e} not taken: ${t.message}`),D&&o(D.id),ft.current=!0,p(!1),h(),x(),T();return}}if(n&&et.current&&!j){u.chat.warn(`Stream for session=${e} was lost while stopping; closing the turn locally`),rt.current?.();return}if(n&&!j&&!xt()&&Xe.current<3){let n=++Xe.current,r=Ox[n-1]??0;u.chat.warn(`Stream for session=${e} lost (${t.name}); reconnecting in ${r}ms (${n}/3)`),z.getState().setLiveStatus(`${eT} (attempt ${n} of 3)…`);let i=()=>{Ze.current=null,!(xt()||et.current)&&ct.current(void 0,{attach:!0,reconnect:n})};r>0?Ze.current=setTimeout(i,r):i();return}Je.current=Date.now(),Cs.getState().dismissSessionPrompts(e),z.getState().closeSessionQuestions(e);let s=et.current;if(ae(),_t.current!==null&&(cancelAnimationFrame(_t.current),_t.current=null),gt.current=``,xt())return;if(n||(ft.current=!0),u.chat.error(`Chat error for session=${e}`,t),s){let{steps:n,cards:r}=oe();i({id:Date.now()+2,session_id:e,role:`assistant`,content:k,created_at:new Date().toISOString(),rag_sources:null,agentSteps:n.length>0?n:void 0,cards:r.length>0?r:void 0,stopState:`stopped`,stopError:t.message||`Unknown error`}),Ct.current=z.getState().messages.length,p(!1),h(),x(),T();return}let c,l=t.message||``,d=`
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
*Unexpected error?* [Report it on GitHub](${nS(l.slice(0,80))})`;c=jx(t)||(l.includes(`Lemonade`)||l.includes(`LLM`)||l.includes(`Could not get response`)?`The model server did not answer. Open Settings → Model to check it, then send your message again.
|
|
72
|
-
|
|
73
|
-
Details: ${l}`+d:t instanceof TypeError||l.includes(`fetch`)||l.includes(`Failed to fetch`)||l.includes(`NetworkError`)?`Lost the connection to GAIA. Check that GAIA is still running, then send your message again.`+d:l.includes(`timed out`)||l.includes(`timeout`)||l.includes(`Timeout`)?`The request timed out. Try a shorter question, or a faster model in Settings → Model.`+d:`Error: ${l}`+d);let f={id:Date.now()+2,session_id:e,role:`assistant`,content:c,created_at:new Date().toISOString(),rag_sources:null};i(f),p(!1),h(),x(),T()}},le=a?Ua(e,se):Aa(e,E,se);te=le,Ke.current=le},[de,ye,d,e,ce,Me,i,o,r,p,St,h,c,_,v,y,b,x,w,T,ee,xt]);ct.current=Ut;let Gt=z(t=>t.runningSessionIds.includes(e)),Kt=z(e=>e.activeRunsAt>Je.current);(0,R.useEffect)(()=>{Sx()},[e]),(0,R.useEffect)(()=>{Gt?!Kt||d||Ye.current||(u.chat.info(`Resuming live view of background run for session=${e}`),ct.current(void 0,{attach:!0})):Ye.current=!1},[e,Gt,Kt,d]),(0,R.useEffect)(()=>{let e=e=>{let t=e.detail?.text;typeof t==`string`&&t.trim()&&ct.current(t)};return window.addEventListener(`gaia:send-message`,e),()=>window.removeEventListener(`gaia:send-message`,e)},[]),(0,R.useEffect)(()=>{!d&&Ge.current&&Ge.current.focus()},[d]);let qt=(0,R.useCallback)(async t=>{d||(u.chat.info(`Deleting message ${t} from session=${e}`),Ce(t),setTimeout(async()=>{o(t),Ce(null);try{await Da(e,t)}catch(n){u.chat.error(`Failed to delete message ${t}`,n),Ta(e).then(e=>{xt()||r(cT(e.messages))}).catch(t=>u.chat.error(`Could not reload messages for session=${e}`,t))}},250))},[e,d,o,r,xt]),Jt=(0,R.useCallback)(async t=>{if(d||t.role!==`user`)return;let n=t.content;u.chat.info(`Resending message ${t.id} from session=${e}`,{preview:n.slice(0,80)}),s(t.id);try{await Oa(e,t.id)}catch(n){u.chat.error(`Failed to delete messages from ${t.id}`,n),Ta(e).then(e=>{xt()||r(cT(e.messages))}).catch(t=>u.chat.error(`Could not reload messages for session=${e}`,t));return}Ut(n)},[e,d,s,r,Ut,xt]);(0,R.useEffect)(()=>zx(e),[e]);let Yt=z(()=>Rx(e)),Xt=(0,R.useCallback)((e,t)=>new Promise(e=>{ct.current(t,{queued:!0,onQueuedOutcome:e})}),[]),Zt=d||jt;(0,R.useEffect)(()=>{if(!Zt){if(dt.current){dt.current=!1;let e=lt.map(e=>e.text);e.length&&(ut(()=>[]),fe(t=>[t.trim(),...e].filter(Boolean).join(`
|
|
74
|
-
|
|
75
|
-
`)))}else lt.length===0||ht||A||re||Et.current||Me||M?.init_state===`initializing`||xt()||!ft.current&&!Yt||Gx(e,Xt,()=>Tt.current&&!xt()&&!z.getState().isStreaming&&!Mt.current)}},[Zt,lt,ht,Yt,A,re,Me,M?.init_state,e,Xt,xt]);let Qt=(0,R.useRef)(!1);(0,R.useEffect)(()=>{Qt.current&&!Zt&&Ot(),Qt.current=Zt},[Zt,Ot]);let $t=(0,R.useCallback)(t=>{let n=lt.find(e=>e.id===t&&e.state===`queued`);n&&d&&(ut(e=>Sr(e,t,`queued`,`sending`)),si(e,n.text).then(()=>ut(e=>Sr(e,t,`sending`,`delivered`))).catch(e=>{u.chat.info(`Follow-up not taken by the running reply; it stays queued: ${e instanceof Error?e.message:e}`),ut(e=>Sr(e,t,`sending`,`queued`))}))},[lt,d,e,ut]),en=(0,R.useCallback)(()=>{for(let e=n.length-1;e>=0;e--)if(n[e].role===`user`){Jt(n[e]);return}},[n,Jt]),tn=()=>{P(ce?.title||``),me(!0)},nn=async()=>{let t=he.trim().slice(0,200).trim();t&&he!==ce?.title&&t!==ce?.title&&(await va(e,{title:t,title_is_custom:!0}),c(e,{title:t})),me(!1)},rn=(0,R.useCallback)(async()=>{if(e)try{let t=await Ca(e);c(e,{private:t.private})}catch(e){u.ui.warn(`Failed to toggle private mode`,e)}},[e,c]),an=(0,R.useCallback)(async(t,n)=>{t.stopPropagation();let r=E.find(e=>e.id===n);u.doc.info(`Detaching document from session: ${r?.filename||n}`);try{await Qa(e,n);let t=(z.getState().sessions.find(t=>t.id===e)?.document_ids??[]).filter(e=>e!==n);c(e,{document_ids:t}),t.length<=3&&xe(!1),u.doc.info(`Detached document from session: ${r?.filename||n}`)}catch(e){u.doc.error(`Failed to detach document: ${r?.filename||n}`,e)}},[E,e,c]),on=(0,R.useCallback)(async t=>{if(t.preventDefault(),t.stopPropagation(),I(!1),t.dataTransfer.files.length!==0){for(let n of Array.from(t.dataTransfer.files)){u.doc.info(`Dropped on chat view: ${n.name}`);try{let t=await Ka(n);if(e&&t?.id)try{await Za(e,t.id);let r=z.getState().sessions.find(t=>t.id===e)?.document_ids??[];r.includes(t.id)||c(e,{document_ids:[...r,t.id]}),u.doc.info(`Auto-attached "${n.name}" to session ${e}`)}catch(e){u.doc.warn(`Could not attach dropped document to session: ${e}`)}}catch(e){u.doc.error(`Upload failed: ${n.name}`,e)}}try{let e=await Wa();D(e.documents||[])}catch(e){u.doc.error(`Could not refresh the document list after a drop`,e)}}},[e,c,D]),sn=e=>{e.preventDefault(),e.stopPropagation(),I(!0)},cn=e=>{e.preventDefault(),e.stopPropagation(),I(!1)},ln=n.length>0?n[n.length-1]:void 0,un=!d&&!A&&ln?.role===`assistant`&&ay(ln.content),dn=(0,R.useMemo)(()=>{let e=new Map,t;for(let r of n)if(r.role===`user`&&r.created_at)t=new Date(r.created_at).getTime();else if(r.role===`assistant`&&r.created_at&&t!==void 0){let n=new Date(r.created_at).getTime();n>t&&e.set(r.id,n-t),t=void 0}return e},[n]),fn=Me?`This chat used the retired "${Me}" agent and is read-only. Start a new chat.`:M?.init_state===`initializing`?Yw:null;return(0,B.jsxs)(`main`,{className:`task-view ${F?`drag-active`:``}`,style:{"--session-panel-w":`${Rt}px`},onDrop:on,onDragOver:sn,onDragLeave:cn,"aria-label":ce?.title||`Chat`,children:[(0,B.jsxs)(`header`,{className:`task-header`,children:[(0,B.jsx)(`div`,{className:`task-header-left`,children:pe?(0,B.jsx)(`input`,{className:`title-edit`,value:he,maxLength:200,onChange:e=>P(e.target.value),onBlur:nn,onKeyDown:e=>{e.key===`Enter`&&nn(),e.key===`Escape`&&(e.preventDefault(),me(!1))},...l,autoFocus:!0,"aria-label":`Chat title`}):(0,B.jsxs)(`button`,{type:`button`,className:`task-title`,onClick:tn,title:`Rename`,children:[(0,B.jsx)(`span`,{children:ce?.title||`New chat`}),(0,B.jsx)(Wt,{size:12,"aria-hidden":`true`,className:`task-title-edit`})]})}),(0,B.jsxs)(`div`,{className:`task-header-right`,children:[(0,B.jsx)(`button`,{className:`btn-icon-sm${ce?.private?` active`:``}`,onClick:rn,title:ce?.private?`Private: this chat is not saved to memory`:`Make private (not saved to memory)`,"aria-label":ce?.private?`Private chat on`:`Make chat private`,"aria-pressed":!!ce?.private,children:(0,B.jsx)(ze,{size:15})}),(0,B.jsx)(`button`,{className:`btn-icon-sm`,onClick:()=>k(!0),title:`Browse files on this PC`,"aria-label":`Browse files on this PC`,children:(0,B.jsx)(tt,{size:15})}),(0,B.jsx)(`button`,{className:`btn-icon-sm`,onClick:ke,title:`Export as Markdown`,"aria-label":`Export chat`,children:(0,B.jsx)(Fe,{size:15})}),(0,B.jsx)(Ow,{messages:n,busy:d})]})]}),ue.length>0&&(()=>{let e=[...ue].sort((e,t)=>{let n=e.last_accessed_at||e.indexed_at||``;return(t.last_accessed_at||t.indexed_at||``).localeCompare(n)}),t=be?e:e.slice(0,3),n=e.length-3;return(0,B.jsxs)(`div`,{className:`doc-context-bar${be?` doc-context-expanded`:``}`,"aria-label":`${ue.length} indexed document${ue.length===1?``:`s`}`,children:[(0,B.jsx)(ge,{size:12,className:`doc-context-icon`,"aria-hidden":`true`}),(0,B.jsxs)(`button`,{type:`button`,className:`doc-context-label`,onClick:()=>O(!0),title:`Manage documents`,children:[ue.length,` indexed`]}),(0,B.jsxs)(`div`,{className:`doc-context-pills${be?` doc-context-pills-expanded`:``}`,children:[t.map(e=>(0,B.jsxs)(`span`,{className:`doc-pill`,title:e.filepath||e.filename,children:[(0,B.jsx)(qe,{size:9,className:`doc-pill-icon`,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:`doc-pill-name`,children:e.filename}),(0,B.jsx)(`button`,{className:`doc-pill-remove`,onClick:t=>an(t,e.id),"aria-label":`Remove ${e.filename} from this chat`,children:(0,B.jsx)(Fn,{size:10})})]},e.id)),!be&&n>0&&(0,B.jsxs)(`button`,{className:`doc-pill-more`,onClick:e=>{e.stopPropagation(),xe(!0)},children:[`+`,n,` more`]}),be&&n>0&&(0,B.jsx)(`button`,{className:`doc-pill-collapse`,onClick:e=>{e.stopPropagation(),xe(!1)},children:`show less`})]})]})})(),(0,B.jsx)(`div`,{className:`messages-scroll`,ref:We,onScroll:Lt,children:(0,B.jsxs)(`div`,{className:`messages-column`,children:[A&&(0,B.jsx)(`div`,{className:`skeleton-messages`,"aria-label":`Loading messages`,children:[0,1,2].map(e=>(0,B.jsx)(`div`,{className:`skeleton-msg`,children:(0,B.jsxs)(`div`,{className:`skeleton-lines`,children:[(0,B.jsx)(`div`,{className:`skeleton-line`}),(0,B.jsx)(`div`,{className:`skeleton-line`}),e!==2&&(0,B.jsx)(`div`,{className:`skeleton-line`})]})},e))}),n.map((e,t)=>{if(Ne&&e.role===`assistant`&&t===n.length-1)return null;let r=e.role===`assistant`?e.historyNotice??aT.get(e.id):void 0,i=!Zt&&!At&&!Me&&!Ne&&e.role===`assistant`&&t===n.length-1&&!e.stopState&&!Lb(e.content),a=e.stats?.seconds==null?dn.get(e.id):e.stats.seconds*1e3;return(0,B.jsxs)(`div`,{className:Se===e.id?`msg-deleting`:void 0,"data-message-id":e.id,"data-role":e.role,children:[r&&(0,B.jsx)(oT,{text:r}),(0,B.jsx)(rx,{message:e,agentSteps:e.role===`assistant`?e.agentSteps:void 0,onDelete:Zt?void 0:qt,onResend:!Zt&&e.role===`user`&&!Me?Jt:void 0,extraActions:i?(0,B.jsx)(aC,{answeredBy:e.stats?.model??ce?.effective_model,onPick:t=>Nt(e,t)}):void 0,latencyMs:a}),At?.messageId===e.id&&(0,B.jsx)(cC,{original:e,originalModel:e.stats?.model??ce?.effective_model,originalLatencyMs:a,state:At.state,keeping:At.keeping,onKeep:e=>{Pt(e)},onClose:Ft})]},e.id)}),(d||Ne)&&Ie&&(0,B.jsx)(oT,{text:Ie}),(d||Ne)&&(0,B.jsx)(`div`,{className:`streaming-bubble ${Ne?`stream-ending`:`stream-active`}`,children:(0,B.jsx)(rx,{message:{id:-1,session_id:e,role:`assistant`,content:(d?f:Re.current)||``,created_at:``,rag_sources:null},isStreaming:d,agentSteps:d?g:Be.current,agentStepsActive:d&&g.some(e=>e.active),agentStepCount:at,cards:d?C:Ve.current,liveStatus:d?ie:null,awaitingUser:d&&(ae||oe||se)})}),(0,B.jsx)(`div`,{ref:Ue})]})}),(0,B.jsx)(Dw,{sessionId:e,messages:n,busy:Zt,onUsage:kt,onJumpToMessage:Bt}),_e&&(0,B.jsx)(`button`,{className:`scroll-bottom-btn`,onClick:Vt,title:`Scroll to bottom`,"aria-label":`Scroll to bottom`,children:(0,B.jsx)(S,{size:16})}),F&&(0,B.jsxs)(`div`,{className:`drag-overlay`,children:[(0,B.jsx)(kn,{size:32,strokeWidth:1.5,"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:`Drop files to index them for this chat`})]}),we&&(0,B.jsxs)(`div`,{className:`toast policy-alert-toast`,role:`alert`,children:[(0,B.jsxs)(`span`,{children:[`Blocked: `,we.tool,` is restricted by policy.`]}),we.receiptId?(0,B.jsx)(`button`,{type:`button`,className:`policy-alert-toast-link`,onClick:()=>{let e=we.receiptId;e&&(ne(`policy_alert`),N(!0),Oe(e))},children:`View receipt`}):(0,B.jsx)(`span`,{className:`policy-alert-toast-missing`,children:`Receipt unavailable`})]}),(0,B.jsx)(`div`,{className:`input-area`,children:(0,B.jsxs)(`div`,{className:`input-column`,children:[(0,B.jsx)(Aw,{message:Ae,onDismiss:je}),un&&ln&&(0,B.jsx)(lS,{content:ln.content,onRetry:en}),(0,B.jsx)(sv,{sessionId:e}),(0,B.jsx)(rC,{usage:L}),(0,B.jsx)(kw,{sessionId:e}),(0,B.jsx)(MS,{items:lt,onRemove:e=>ut(t=>Cr(t,e)),onRetry:e=>ut(t=>Sr(t,e,`failed`,`queued`)),onSteer:d&&!Qe?$t:void 0,replying:d,busyRetry:!!ht}),(0,B.jsx)(fS,{value:de,onChange:fe,onSubmit:()=>Ut(),onStop:Ht,streaming:d,stopping:Qe,queueWhileStreaming:!0,disabledReason:fn,attachments:ye,inputRef:Ge,placeholder:d?`Queue your next message`:n.length===0?`Ask GAIA anything`:`Reply to GAIA`,leftControls:(0,B.jsx)(kS,{sessionId:e,disabled:!!Me}),rightControls:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(nC,{usage:L,unavailable:Dt,sessionId:e,busy:Zt,onUsage:kt,onDetails:()=>zt(`context`)}),(0,B.jsx)(wS,{})]})})]})})]})}function dT({disabled:e}){let t=z(e=>e.draftPrivate),n=z(e=>e.setDraftPrivate);return(0,B.jsxs)(`button`,{type:`button`,className:`composer-chip${t?` is-on`:``}`,onClick:()=>n(!t),disabled:e,"aria-pressed":t,"aria-label":`Private chat`,title:t?`Private: nothing in this chat is saved to memory`:`Start a private chat (not saved to memory)`,children:[(0,B.jsx)(ze,{size:13,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:`composer-chip-label`,children:`Private`})]})}function fT({cards:e,onPick:t,disabled:n}){return e.length===0?null:(0,B.jsx)(`ul`,{className:`start-cards`,"aria-label":`Things to try`,children:e.map(e=>(0,B.jsx)(`li`,{children:(0,B.jsxs)(`button`,{type:`button`,className:`start-card`,onClick:()=>t(e),disabled:n,title:e.needs_input?`${e.prompt}…`:e.prompt,children:[(0,B.jsxs)(`span`,{className:`start-card-title`,children:[e.title,(0,B.jsx)(w,{size:13,"aria-hidden":`true`})]}),(0,B.jsx)(`span`,{className:`start-card-note`,children:e.note})]})},e.skill))})}var pT=1e3;function mT(){let[e,t]=(0,R.useState)(null);return(0,R.useEffect)(()=>{let e=!1,n,r=a=>{e||(a.state===`warming`?(t({seconds:Math.floor(a.elapsed_seconds??0),model:a.model??null,device:a.device??null}),n=setTimeout(()=>{Ni().then(r,i)},pT)):t(null))},i=n=>{e||(u.system.warn(`Warm-up status unavailable`,n),t(null))};return Mi().then(r,i),()=>{e=!0,n&&clearTimeout(n)}},[]),e}function hT(e){return e===`gpu`?`your GPU`:e===`npu`?`your NPU`:e===`cpu`?`the CPU`:null}function gT(e){return e<1?`under 1 GB`:`${e.toFixed(1)} GB`}var _T=15e3;function vT(e=new Date){let t=e.getHours();return`Good ${t<5?`evening`:t<12?`morning`:t<18?`afternoon`:`evening`}. What should we work on?`}function yT({seconds:e,model:t,device:n}){if(!t)return`Getting GAIA ready… ${e}s`;let r=hT(n);return`Loading ${Ko(t)}${r?` on ${r}`:``}… ${e}s`}function bT({detail:e,onRetry:t}){let[n,r]=(0,R.useState)(!1);return(0,B.jsxs)(`div`,{className:`new-chat-note`,children:[(0,B.jsxs)(`p`,{children:[`GAIA’s assistant didn’t start, so it can’t suggest tasks yet.`,` `,(0,B.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:t,children:`Try again`})]}),(0,B.jsxs)(`button`,{type:`button`,className:`new-chat-details`,"aria-expanded":n,onClick:()=>r(e=>!e),children:[(0,B.jsx)(ue,{size:12,className:n?`is-open`:``,"aria-hidden":`true`}),` Details`]}),n&&(0,B.jsx)(`pre`,{className:`new-chat-details-text`,children:e})]})}var xT=`document-brief`;function ST(){let{documents:e,draftDocumentIds:t,addDraftDocuments:n}=z.getState();n(e.filter(e=>e.indexing_status===`complete`&&!t.includes(e.id)).map(e=>e.id))}function CT(){let e=z(e=>e.documents),t=z(e=>e.draftDocumentIds),n=z(e=>e.removeDraftDocument),r=z(e=>e.setShowDocLibrary),i=e.filter(e=>t.includes(e.id)),a=e.filter(e=>e.indexing_status===`complete`&&!t.includes(e.id));if(!i.length&&!a.length)return null;let o=a.length;return(0,B.jsxs)(`div`,{className:`new-chat-docs`,children:[i.length>0&&(0,B.jsx)(`ul`,{className:`new-chat-doc-list`,"aria-label":`Documents for this chat`,children:i.map(e=>(0,B.jsxs)(`li`,{className:`new-chat-doc`,children:[(0,B.jsx)(qe,{size:12,"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:e.filename}),(0,B.jsx)(`button`,{type:`button`,className:`new-chat-doc-remove`,onClick:()=>n(e.id),"aria-label":`Don't attach ${e.filename}`,children:(0,B.jsx)(Fn,{size:12,"aria-hidden":`true`})})]},e.id))}),o>0&&(0,B.jsxs)(`p`,{className:`new-chat-note`,children:[i.length?`${o} more document${o===1?``:`s`} in your library. `:`Your library has ${o} document${o===1?``:`s`}; this chat can search only the ones you attach. `,(0,B.jsxs)(`button`,{type:`button`,className:`link-btn`,onClick:ST,children:[`Attach `,o===1?`it`:`all ${o}`]}),o>1&&(0,B.jsxs)(B.Fragment,{children:[` · `,(0,B.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>r(!0),children:`Choose`})]})]})]})}function wT({error:e}){let t=z(e=>e.openSettings);return(0,B.jsxs)(`div`,{className:`new-chat-setup-failed`,role:`alert`,children:[(0,B.jsx)(`p`,{className:`new-chat-setup-failed-title`,children:`GAIA’s first-run setup didn’t finish, so a chat on this PC’s model will fail.`}),(0,B.jsx)(`p`,{className:`new-chat-setup-failed-error`,children:e}),(0,B.jsxs)(`p`,{children:[`Use a cloud model, or pick a smaller one.`,` `,(0,B.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>t(`model`),children:`Choose a model`})]})]})}function TT({onSend:e,initialText:t=``,focusRequest:n=0}){let r=z(e=>e.systemStatus?.init_state===`initializing`),i=z(e=>e.systemStatus?.model_loaded?null:e.systemStatus?.setup_error??null),a=Wo(e=>!!e.active?.remote),[o,s]=(0,R.useState)(t),[c,l]=(0,R.useState)(null),[d,f]=(0,R.useState)(!1),[p,m]=(0,R.useState)(null),[h,g]=(0,R.useState)(null),_=(0,R.useRef)(null),v=Mw(),y=mT();Go();let b=(0,R.useRef)(!0),x=(0,R.useCallback)((e=!1)=>{e||g(null),Xi().then(e=>{b.current&&(m(e),g(e.skills_error??null))}).catch(e=>{u.api.warn(`New-chat suggestions unavailable`,e),b.current&&g(e instanceof Error?e.message:String(e))})},[]);(0,R.useEffect)(()=>(b.current=!0,x(),()=>{b.current=!1}),[x]),(0,R.useEffect)(()=>{Wa().then(e=>z.getState().setDocuments(e.documents||[])).catch(e=>u.api.warn(`Document library unavailable; not offering its documents`,e))},[]),(0,R.useEffect)(()=>{if(h)return Xw(()=>x(!0),_T)},[h,x]);let S=(0,R.useRef)(!1),C=(0,R.useRef)([]),w=(0,R.useCallback)(async(t,n=``)=>{if(t){if(S.current)C.current.push(n||t),s(``);else{S.current=!0,f(!0),l(null),s(``);try{let n=await e(t);v.clear();let r=C.current.splice(0),i=z.getState().currentSessionId;if(r.length>0&&i){let e=(e,t)=>n===!1?[...e,{...br(t,`failed`),error:`The first message was not sent.`}]:xr(e,t,`queued`);z.getState().updateQueue(i,t=>r.reduce(e,t))}}catch(e){let r=C.current.splice(0);s([n||t,...r].join(`
|
|
76
|
-
|
|
77
|
-
`)),l(e instanceof Error?e.message:String(e))}finally{S.current=!1,f(!1)}}}},[v,e]),T=(0,R.useCallback)(()=>w(v.compose(o.trim()),o.trim()),[v,w,o]);(0,R.useEffect)(()=>{n&&_.current?.focus()},[n]);let E=(0,R.useCallback)(e=>{e.skill===xT&&ST(),e.needs_input?(s(e.prompt),_.current?.focus()):w(v.compose(e.prompt))},[v,w]),D=p?.working_folder;return(0,B.jsx)(`main`,{className:`new-chat`,"aria-label":`New chat`,children:(0,B.jsxs)(`div`,{className:`new-chat-inner`,children:[(0,B.jsx)(`h1`,{className:`new-chat-greeting`,children:vT()}),i&&!a&&(0,B.jsx)(wT,{error:i}),(0,B.jsx)(fS,{value:o,onChange:s,onSubmit:T,attachments:v,disabledReason:r?Yw:null,autoFocus:!0,inputRef:_,leftControls:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(kS,{sessionId:null}),(0,B.jsx)(dT,{disabled:d})]}),rightControls:(0,B.jsx)(wS,{})}),D&&(0,B.jsx)(`div`,{className:`new-chat-meta`,children:(0,B.jsxs)(`span`,{className:`new-chat-folder`,title:D.gaia_folder?`GAIA works in its own folder, ${D.path}. Attach a file or start GAIA from a project folder to work there.`:`GAIA works in ${D.path}`,children:[(0,B.jsx)(rt,{size:13,"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:D.name})]})}),(0,B.jsx)(CT,{}),y!==null&&!r&&(0,B.jsx)(`p`,{className:`new-chat-warmup`,role:`status`,children:yT(y)}),c&&(0,B.jsx)(`p`,{className:`new-chat-error`,role:`alert`,children:c}),p&&(0,B.jsx)(fT,{cards:p.cards,onPick:E,disabled:r||d}),h&&(0,B.jsx)(bT,{detail:h,onRetry:()=>x()})]})})}function ET(e){let t=e?.reason;return t===`needs_key`||t===`bad_key`}function DT({provider:e,limit:t}){let[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(null);if((0,R.useEffect)(()=>{r(null),a(null),da(e).then(r).catch(e=>a(e instanceof Error?e.message:String(e)))},[e]),i)return(0,B.jsxs)(`p`,{className:`settings-error`,role:`alert`,children:[`Prices could not be loaded: `,i]});if(!n)return(0,B.jsxs)(`p`,{className:`settings-hint`,children:[(0,B.jsx)(L,{size:13,className:`spin`}),` Loading prices…`]});if(n.models.length===0)return(0,B.jsxs)(`p`,{className:`settings-hint cloud-prices-note`,children:[`Price unknown. `,n.note]});let o=t?n.models.slice(0,t):n.models;return(0,B.jsxs)(`div`,{className:`cloud-prices`,"aria-label":`Prices`,children:[(0,B.jsx)(`ul`,{className:`cloud-prices-list`,children:o.map(e=>(0,B.jsxs)(`li`,{children:[(0,B.jsxs)(`span`,{className:`cloud-prices-name`,children:[e.name,e.note&&(0,B.jsxs)(`span`,{className:`cloud-prices-note`,children:[` · `,e.note]})]}),(0,B.jsx)(`span`,{className:`cloud-prices-price`,children:_S(e.price)})]},e.model))}),(0,B.jsxs)(`span`,{className:`settings-hint`,children:[n.source,`. You pay the provider for what you use.`]})]})}function OT({label:e,value:t,ok:n}){return(0,B.jsxs)(`li`,{className:`setup-check-row${n?` is-ok`:``}`,children:[n?(0,B.jsx)(oe,{size:13,"aria-hidden":`true`}):(0,B.jsx)(_t,{size:13,"aria-hidden":`true`}),(0,B.jsx)(`span`,{className:`setup-check-label`,children:e}),(0,B.jsx)(`span`,{className:`setup-check-value`,children:t})]})}function kT(e){let t=[e.gpu_name,e.npu_detected?`Ryzen AI NPU`:null].filter(Boolean);return t.length?{value:t.join(` · `),ok:!0}:e.lemonade_running?{value:`No GPU or NPU reported; models run on the CPU`,ok:!1}:{value:`Checked once the model server is running`,ok:!1}}function AT({hardware:e,error:t}){if(t)return(0,B.jsxs)(`p`,{className:`setup-hint`,children:[`This PC’s hardware couldn’t be read (`,t,`). Setup still checks it as it goes.`]});if(!e)return(0,B.jsxs)(`p`,{className:`setup-hint`,role:`status`,children:[(0,B.jsx)(L,{size:13,className:`spin`,"aria-hidden":`true`}),` Checking this PC…`]});let n=kT(e),r=e.lemonade_running?e.warnings:e.warnings.filter(e=>!/\bNPU\b/.test(e));return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`ul`,{className:`setup-check`,"aria-label":`This PC`,children:[(0,B.jsx)(OT,{label:`Device`,value:n.value,ok:n.ok}),(0,B.jsx)(OT,{label:`Memory`,value:e.ram_gb==null?`Not reported`:`${e.ram_gb} GB`,ok:e.ram_gb!=null}),(0,B.jsx)(OT,{label:`Disk`,value:e.disk_free_gb==null?`Not reported`:`${Math.round(e.disk_free_gb)} GB free`,ok:e.disk_free_gb!=null&&e.compatible})]}),!e.compatible&&e.blockers.length>0&&(0,B.jsx)(`p`,{className:`setup-error`,role:`alert`,children:e.blockers.join(` `)}),r.length>0&&(0,B.jsx)(`p`,{className:`setup-hint`,children:r.join(` `)})]})}function jT({plan:e,planError:t,chosen:n,locked:r,onPlan:i}){let[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(!1);if(n){let t=l||e?.chat_model.user_set&&e.chat_model.id===n;return(0,B.jsxs)(`p`,{className:`setup-hint`,children:[t?`You chose `:`Setup chose `,(0,B.jsx)(`strong`,{children:$o(n)}),t?`.`:` for this PC.`]})}if(t)return(0,B.jsxs)(`p`,{className:`setup-hint`,children:[`Setup names the chat model once it has checked this PC (`,t,`).`]});if(!e)return(0,B.jsxs)(`p`,{className:`setup-hint`,role:`status`,children:[(0,B.jsx)(L,{size:13,className:`spin`,"aria-hidden":`true`}),` Working out which model fits this PC…`]});let d=e.chat_model,f=$o(d.id);if(e.decided_after_server){let t=e.options.map(e=>$o(e.id));return(0,B.jsxs)(`p`,{className:`setup-hint`,children:[`Picked once the model server is running: the largest model your GPU holds`,t.length>1?` (${t.slice(0,-1).join(`, `)}, or else ${t[t.length-1]})`:``,`. It’s named here as soon as setup chooses.`]})}let p=async e=>{o(e),c(null);try{i(await Yi(e)),u(!0)}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(null)}},m=e.memory_gb==null?``:` This PC has ${e.memory_gb} GB for models (${e.memory_source}).`,h=d.downloaded?`already downloaded`:d.size_gb==null?null:gT(d.size_gb),g=d.user_set&&!e.options.some(e=>e.id===d.id),_=!r&&!g&&e.lemonade.reachable&&e.options.filter(e=>e.fits!==!1).length>1;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`p`,{className:`setup-hint`,children:[(0,B.jsx)(`strong`,{children:f}),` will answer your chats`,h?` (${h})`:``,`.`,m,g&&` It’s your default_model; change it in Settings → Model after setup.`]}),_&&(0,B.jsx)(`div`,{className:`setup-choices`,role:`radiogroup`,"aria-label":`Chat model`,children:e.options.map(t=>(0,B.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t.id===d.id,className:`setup-choice${t.id===d.id?` is-active`:``}`,disabled:t.fits===!1||a!==null,onClick:()=>{t.id!==d.id&&p(t.id)},children:[a===t.id&&(0,B.jsx)(L,{size:14,className:`spin`,"aria-hidden":`true`}),(0,B.jsxs)(`span`,{children:[(0,B.jsxs)(`span`,{className:`setup-choice-title`,children:[$o(t.id),t.id===e.recommended_model?` (recommended)`:``]}),(0,B.jsx)(`span`,{className:`setup-choice-note`,children:t.fits===!1?t.reason:t.size_gb==null?`Size unknown`:gT(t.size_gb)})]})]},t.id))}),s&&(0,B.jsx)(`p`,{className:`setup-error`,role:`alert`,children:s})]})}function MT(){let[e,t]=(0,R.useState)(null),n=(0,R.useCallback)(()=>{Promise.resolve(ea()).then(e=>t(e?.providers?.find(e=>e.id===`amd`)?.network??null)).catch(e=>{console.warn(`[useGatewayNetwork] could not check the AMD gateway`,e),t(null)})},[]);return(0,R.useEffect)(n,[n]),{network:e,recheck:n}}var NT=[{id:`local`,title:`On this PC`,note:`Private. Models run on your AMD hardware; nothing leaves this machine.`},{id:`fireworks`,title:`Fireworks AI`,note:`Faster, larger cloud models. Needs an API key; chat history is sent to Fireworks AI.`},{id:`amd`,title:`AMD LLM Gateway`,note:`For AMD employees. Needs a gateway key; chat history is sent to the gateway.`}],PT=1e3,FT=`gaia-setup-choice`;function IT(){try{let e=localStorage.getItem(FT);return e===`local`||e===`fireworks`||e===`amd`?e:null}catch(e){return console.warn(`[SetupScreen] could not read the saved provider choice`,e),null}}function LT(e){try{localStorage.setItem(FT,e)}catch(e){console.warn(`[SetupScreen] could not save the provider choice; a reload will ask again`,e)}}function RT({status:e,n:t}){return e===`done`?(0,B.jsx)(oe,{size:14,"aria-hidden":`true`}):e===`active`?(0,B.jsx)(L,{size:14,className:`spin`,"aria-hidden":`true`}):e===`failed`||e===`cancelled`?(0,B.jsx)(me,{size:14,"aria-hidden":`true`}):(0,B.jsx)(B.Fragment,{children:t})}var zT=[`ok`,`needs_key`,`too_old`];function BT({onChosen:e}){let[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)([]),[s,c]=(0,R.useState)(!1),[l,u]=(0,R.useState)(``),[d,f]=(0,R.useState)(!1),[p,m]=(0,R.useState)(!1),[h,g]=(0,R.useState)(null),[_,v]=(0,R.useState)(null),y=(0,R.useRef)(!0),b=(0,R.useCallback)(async()=>{i(null);try{let e=await Zi();if(!e.offer)return;c(!0);let{found:t,unchecked:r=[]}=await Qi();if(!y.current)return;o(t?[]:r),t&&zT.includes(t.status)&&(n({target:e,found:t}),f(t.status===`needs_key`))}catch(e){y.current&&i(e instanceof Error?e.message:String(e))}finally{y.current&&c(!1)}},[]);(0,R.useEffect)(()=>(y.current=!0,b(),()=>{y.current=!1}),[b]);let x=(0,R.useCallback)(async n=>{if(t){m(!0),g(null);try{await $i(n===`external`?{mode:n,base_url:t.found.url,api_key:l.trim()||void 0}:{mode:n}),u(``),v(n),e(n)}catch(e){ET(e)&&f(!0),g(e instanceof Error?e.message:String(e))}finally{m(!1)}}},[t,l,e]);if(r||a.length>0)return(0,B.jsxs)(`div`,{className:`setup-row`,children:[(0,B.jsx)(`span`,{className:`setup-hint`,children:r?`Couldn't check for a Lemonade Server you already run: ${r}`:`Couldn't check whether your Lemonade Server at ${a.join(` or `)} is running: it didn't answer in time.`}),(0,B.jsxs)(`button`,{type:`button`,className:`btn-secondary`,disabled:s,onClick:()=>void b(),children:[s&&(0,B.jsx)(L,{size:13,className:`spin`}),` Check again`]})]});if(!t)return s?(0,B.jsxs)(`p`,{className:`setup-hint`,role:`status`,children:[(0,B.jsx)(L,{size:13,className:`spin`,"aria-hidden":`true`}),` Looking for a Lemonade Server you already run…`]}):null;let{target:S,found:C}=t;return _?(0,B.jsx)(`p`,{className:`setup-hint`,role:`status`,children:_===`external`?`GAIA will use your Lemonade Server at ${C.url} and won't install its own.`:`GAIA will set up its own Lemonade Server.`}):C.status===`too_old`?(0,B.jsx)(`p`,{className:`setup-hint`,children:C.message}):(0,B.jsxs)(`form`,{className:`setup-lemonade`,"aria-label":`Use your Lemonade Server`,onSubmit:e=>{e.preventDefault(),x(`external`)},children:[(0,B.jsxs)(`span`,{className:`setup-choice-title`,children:[`Use the Lemonade you already run at `,C.url,C.version?` (v${C.version})`:``]}),(0,B.jsx)(`span`,{className:`setup-choice-note`,children:S.what_gaia_does}),d&&(0,B.jsx)(`input`,{className:`settings-input`,type:`password`,autoComplete:`off`,value:l,onChange:e=>u(e.target.value),placeholder:`The API key your Lemonade Server was started with`,"aria-label":`Lemonade API key`}),(0,B.jsxs)(`div`,{className:`setup-row`,children:[(0,B.jsxs)(`button`,{type:`submit`,className:`btn-primary`,disabled:p||d&&!l.trim(),children:[p&&(0,B.jsx)(L,{size:13,className:`spin`}),` Use mine`]}),(0,B.jsx)(`button`,{type:`button`,className:`btn-secondary`,disabled:p,onClick:()=>void x(`gaia`),children:`Use GAIA’s own`})]}),h&&(0,B.jsx)(`p`,{className:`setup-error`,role:`alert`,children:h})]})}function VT({problem:e,onRetry:t,onUseGaia:n}){return(0,B.jsxs)(B.Fragment,{children:[e.start&&(0,B.jsx)(`p`,{className:`setup-hint`,children:e.start}),(0,B.jsxs)(`div`,{className:`setup-row`,children:[(0,B.jsx)(`button`,{type:`button`,className:`btn-primary`,onClick:t,children:`Try again`}),e.use_gaia&&(0,B.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:n,children:`Use GAIA’s own instead`})]}),e.use_gaia&&(0,B.jsx)(`p`,{className:`setup-hint`,children:`GAIA’s own Lemonade Server downloads its own copy of the models.`}),e.switch_hint&&(0,B.jsx)(`p`,{className:`setup-hint`,children:e.switch_hint})]})}function HT(e,t,n){return t?e.map(e=>{if(e.key===`server`&&t.lemonade.mode===`external`)return{...e,label:`Use your Lemonade Server`,detail:t.lemonade.url??e.detail};if(e.key===`models`&&!n&&!t.decided_after_server){let n=t.download_gb===0?`already downloaded`:t.download_gb==null?null:gT(t.download_gb),r=`chat model ${$o(t.chat_model.id)}, plus the embedding model`;return{...e,detail:n?`${r} (${n})`:r}}return e}):e}function UT({initial:e,onReady:t}){let n=Wo(e=>e.refresh),r=Wo(e=>e.select),[i,a]=(0,R.useState)(()=>IT()??`local`),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(null),[u,d]=(0,R.useState)(null),[f,p]=(0,R.useState)(null),[m,h]=(0,R.useState)(``),[g,_]=(0,R.useState)({busy:!1,error:null,done:!1}),[v,y]=(0,R.useState)(!1),[b,x]=(0,R.useState)(null),[S,C]=(0,R.useState)(null),[w,T]=(0,R.useState)(null),[E,D]=(0,R.useState)([]),[O,k]=(0,R.useState)(!1),A=(0,R.useRef)(null),j=(0,R.useRef)(!0);(0,R.useEffect)(()=>()=>{j.current=!1},[]);let{network:M,recheck:ee}=MT(),te=e=>e===`amd`&&M?.reachable===!1,N=i!==`local`,ne=u?.steps??HT(N?e.cloud_steps??e.steps:e.steps,b,N),re=u?.state===`running`||u?.state===`verifying`,ie=u?.state===`ready`,ae=re||ie,se=!!u?.chat_model||!!b&&!b.decided_after_server,ce=N?3:4,le=(0,R.useCallback)(()=>{l(null),Wi().then(s).catch(e=>l(e instanceof Error?e.message:String(e)))},[]),de=(0,R.useRef)(0),fe=(0,R.useCallback)(()=>{let e=++de.current;x(null),C(null),Ji().then(t=>{e===de.current&&x(t)}).catch(t=>{e===de.current&&C(t instanceof Error?t.message:String(t))})},[]);(0,R.useEffect)(()=>{Zi().then(e=>k(e.source===`config`)).catch(e=>console.warn(`[SetupScreen] could not read which Lemonade GAIA uses`,e)),le(),fe(),qi().then(e=>{e.state!==`idle`&&(d(e),e.skip_chat_model&&!IT()&&a(`fireworks`))}).catch(e=>p(`Could not read setup progress: ${e instanceof Error?e.message:e}`))},[le,fe]);let pe=(0,R.useCallback)(()=>{A.current&&clearInterval(A.current),A.current=null},[]);(0,R.useEffect)(()=>(re&&(A.current=setInterval(()=>{qi().then(d).catch(e=>{d(t=>t&&{...t,state:`failed`,error:`Lost contact with GAIA: ${e instanceof Error?e.message:e}`})})},PT)),pe),[re,pe]);let me=(0,R.useCallback)(async(e=!1)=>{p(null);try{LT(i),d(await Ki(N,e)),e&&k(!1)}catch(e){p(e instanceof Error?e.message:String(e))}},[N,i]),he=(0,R.useCallback)(async()=>{_({busy:!0,error:null,done:!1});try{await ra(i,{api_key:!O&&m||void 0},e=>_({busy:!0,error:null,done:!1,waiting:e}),()=>!j.current);let{models:e}=await aa(i),t=e.find(e=>e.rank===1)??e[0];if(!t)throw Error(`Connected, but the provider listed no chat models.`);await r(t.id),T(t.id),h(``),_({busy:!1,error:null,done:!0})}catch(e){_({busy:!1,error:e instanceof Error?e.message:String(e),done:!1})}},[i,m,r,O]),ge=(0,R.useCallback)(e=>{LT(e),a(e),_({busy:!1,error:null,done:!1})},[]),P=(0,R.useCallback)(async e=>{await n(),t(e)},[t,n]),F=ie&&(!N||g.done),I=ne.find(e=>e.status===`active`||e.status===`failed`),_e=N?w:u?.chat_model??(b&&!b.decided_after_server?b.chat_model.id:null);return(0,R.useEffect)(()=>{F&&Xi().then(e=>D(e.cards)).catch(e=>console.warn(`[SetupScreen] no first tasks to offer`,e))},[F]),(0,B.jsx)(`main`,{className:`setup`,"aria-labelledby":`setup-title`,children:(0,B.jsxs)(`div`,{className:`setup-inner`,children:[(0,B.jsx)(`h1`,{id:`setup-title`,className:`setup-title`,children:`Set up GAIA`}),(0,B.jsx)(`p`,{className:`setup-lede`,children:F?`All set.`:u?`Setting things up. Setup keeps going if you switch away.`:`A few minutes of setup, then your first chat.`}),(0,B.jsxs)(`ol`,{className:`setup-steps`,children:[(0,B.jsxs)(`li`,{className:`setup-step${o||c?` is-done`:` is-current`}`,children:[(0,B.jsxs)(`div`,{className:`setup-step-head`,children:[(0,B.jsx)(`span`,{className:`setup-step-num`,children:o||c?(0,B.jsx)(oe,{size:14,"aria-hidden":`true`}):1}),(0,B.jsx)(`span`,{className:`setup-step-label`,children:`Check this PC`})]}),!ae&&(0,B.jsx)(`div`,{className:`setup-step-body`,children:(0,B.jsx)(AT,{hardware:o,error:c})})]}),(0,B.jsxs)(`li`,{className:`setup-step${ae?` is-done`:` is-current`}`,children:[(0,B.jsxs)(`div`,{className:`setup-step-head`,children:[(0,B.jsx)(`span`,{className:`setup-step-num`,children:ae?(0,B.jsx)(oe,{size:14,"aria-hidden":`true`}):2}),(0,B.jsx)(`span`,{className:`setup-step-label`,children:`Choose where GAIA runs`})]}),!ae&&(0,B.jsxs)(`div`,{className:`setup-step-body`,children:[(0,B.jsx)(BT,{onChosen:e=>{k(e===`external`),le(),fe()}}),(0,B.jsx)(`div`,{className:`setup-choices`,role:`radiogroup`,"aria-label":`Where GAIA runs`,children:NT.map(e=>(0,B.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":i===e.id,className:`setup-choice${i===e.id?` is-active`:``}${te(e.id)?` is-disabled`:``}`,onClick:()=>a(e.id),disabled:te(e.id),children:[e.id===`local`?(0,B.jsx)(je,{size:16,"aria-hidden":`true`}):(0,B.jsx)(Ce,{size:16,"aria-hidden":`true`}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`setup-choice-title`,children:e.title}),(0,B.jsx)(`span`,{className:`setup-choice-note`,children:te(e.id)?M?.detail:e.note})]})]},e.id))}),M?.reachable===!1&&(0,B.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:ee,children:`Check the AMD gateway again`})]})]}),!N&&(0,B.jsxs)(`li`,{className:`setup-step${ae&&se?` is-done`:ae?` is-pending`:` is-current`}`,children:[(0,B.jsxs)(`div`,{className:`setup-step-head`,children:[(0,B.jsx)(`span`,{className:`setup-step-num`,children:ae&&se?(0,B.jsx)(oe,{size:14,"aria-hidden":`true`}):3}),(0,B.jsx)(`span`,{className:`setup-step-label`,children:`Chat model`})]}),(0,B.jsx)(`div`,{className:`setup-step-body`,children:(0,B.jsx)(jT,{plan:b,planError:S,chosen:u?.chat_model??null,locked:ae,onPlan:x})})]}),!u&&(0,B.jsxs)(`li`,{className:`setup-step-action`,children:[(0,B.jsx)(`button`,{type:`button`,className:`btn-primary setup-start`,onClick:()=>void me(),disabled:te(i),children:`Start setup`}),te(i)&&(0,B.jsxs)(`p`,{className:`setup-error`,role:`alert`,children:[M?.detail,`. Choose another option, or connect and check again.`]}),f&&(0,B.jsx)(`p`,{className:`setup-error`,role:`alert`,children:f})]}),ne.map((e,t)=>{let n=u?e.status:`pending`,r=n===`active`,i=n===`failed`||n===`cancelled`;return(0,B.jsxs)(`li`,{className:`setup-step is-${n??`pending`}`,"aria-current":r?`step`:void 0,children:[(0,B.jsxs)(`div`,{className:`setup-step-head`,children:[(0,B.jsx)(`span`,{className:`setup-step-num`,children:(0,B.jsx)(RT,{status:n,n:t+ce})}),(0,B.jsxs)(`span`,{className:`setup-step-label`,children:[e.label,e.detail&&(0,B.jsxs)(`span`,{className:`setup-step-detail`,children:[` — `,e.detail]})]})]}),r&&u&&(0,B.jsxs)(`div`,{className:`setup-step-body`,children:[(0,B.jsx)(`p`,{className:`setup-hint`,role:`status`,children:u.text}),u.percent!=null&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`progress`,{className:`setup-progress`,max:100,value:u.percent,"aria-label":u.text}),(0,B.jsxs)(`p`,{className:`setup-hint`,children:[u.percent,`%`,u.size?` · ${u.size}`:``]})]})]}),i&&u&&e===I&&(0,B.jsxs)(`div`,{className:`setup-step-body`,children:[(0,B.jsx)(`p`,{className:`setup-error`,role:`alert`,children:u.error??`Setup stopped.`}),u.problem?(0,B.jsx)(VT,{problem:u.problem,onRetry:()=>void me(),onUseGaia:()=>void me(!0)}):(0,B.jsxs)(`div`,{className:`setup-row`,children:[(0,B.jsx)(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void me(!!u.gaia_lemonade),children:`Try again`}),(0,B.jsxs)(`span`,{className:`setup-hint`,children:[`or run `,(0,B.jsx)(`code`,{children:u.command}),` in a terminal.`]})]}),f&&(0,B.jsx)(`p`,{className:`setup-error`,role:`alert`,children:f})]})]},e.key)}),N&&(0,B.jsxs)(`li`,{className:`setup-step${g.done?` is-done`:ie?` is-current`:` is-pending`}`,children:[(0,B.jsxs)(`div`,{className:`setup-step-head`,children:[(0,B.jsx)(`span`,{className:`setup-step-num`,children:g.done?(0,B.jsx)(oe,{size:14,"aria-hidden":`true`}):ne.length+ce}),(0,B.jsxs)(`span`,{className:`setup-step-label`,children:[`Connect `,NT.find(e=>e.id===i)?.title]})]}),ie&&!g.done&&(0,B.jsxs)(`form`,{className:`setup-step-body`,onSubmit:e=>{e.preventDefault(),he()},children:[(0,B.jsx)(`div`,{className:`setup-row`,role:`radiogroup`,"aria-label":`Cloud provider`,children:NT.filter(e=>e.id!==`local`).map(e=>(0,B.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":i===e.id,className:i===e.id?`btn-primary`:`btn-secondary`,onClick:()=>ge(e.id),disabled:g.busy||te(e.id),title:te(e.id)?M?.detail??void 0:void 0,children:e.title},e.id))}),(0,B.jsx)(DT,{provider:i,limit:3}),O?(0,B.jsx)(`p`,{className:`setup-hint`,children:`GAIA uses this provider as your Lemonade Server already has it set up. It doesn’t send your server a key or change its setup.`}):(0,B.jsx)(`p`,{className:`setup-hint`,children:`The key goes to GAIA’s local model server and your OS credential store, nowhere else.`}),(0,B.jsxs)(`div`,{className:`setup-row`,children:[!O&&(0,B.jsx)(`input`,{className:`settings-input`,type:`password`,autoComplete:`off`,value:m,onChange:e=>h(e.target.value),placeholder:`Paste API key (blank uses a key already configured)`,"aria-label":`API key`}),(0,B.jsxs)(`button`,{type:`submit`,className:`btn-primary`,disabled:g.busy,children:[g.busy&&(0,B.jsx)(L,{size:13,className:`spin`}),` Connect`]})]}),g.busy&&g.waiting&&(0,B.jsx)(`p`,{className:`setup-hint`,role:`status`,children:g.waiting}),g.error&&(0,B.jsx)(`p`,{className:`setup-error`,role:`alert`,children:g.error})]})]})]}),u&&u.log_tail&&u.log_tail.length>0&&(0,B.jsxs)(`div`,{className:`setup-log`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`setup-log-toggle`,onClick:()=>y(e=>!e),"aria-expanded":v,children:[(0,B.jsx)(ue,{size:13,className:v?`is-open`:``,"aria-hidden":`true`}),` Details`]}),v&&(0,B.jsx)(`pre`,{className:`setup-log-pre`,children:u.log_tail.join(`
|
|
78
|
-
`)})]}),F&&(0,B.jsxs)(`div`,{className:`setup-done`,role:`status`,children:[(0,B.jsxs)(`div`,{className:`setup-done-head`,children:[(0,B.jsxs)(`p`,{children:[`GAIA is ready.`,_e&&(0,B.jsxs)(B.Fragment,{children:[` `,(0,B.jsx)(`strong`,{children:$o(_e)}),` answers`,N?` in the cloud`:` on this PC`,`.`]})]}),(0,B.jsx)(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void P(),autoFocus:!0,children:`Start chatting`})]}),E.length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`setup-hint`,children:`Or start with one of these:`}),(0,B.jsx)(fT,{cards:E,onPick:e=>void P(e)})]})]})]})})}var WT=Xs()?`menu bar`:`tray`,GT=[{key:`minimizeToTray`,label:`Keep running when the window closes`,hint:`GAIA stays in the ${WT} with your model loaded. Quit from the ${WT} menu.`},{key:`startOnLogin`,label:`Start GAIA when you sign in`,hint:`Your first chat of the day starts without waiting for GAIA to open.`},{key:`startMinimized`,label:`Start in the ${WT}`,hint:`GAIA opens without its window. Use the ${WT} icon to show it.`}];function KT(){let e=window.gaiaAPI?.tray,[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(null);(0,R.useEffect)(()=>{e&&e.getConfig().then(e=>n(e.tray)).catch(e=>i(`Couldn't read the desktop settings: ${e instanceof Error?e.message:String(e)}`))},[e]);let s=(0,R.useCallback)(async r=>{if(e&&t&&a===null){o(r),i(null);try{let i=await e.setConfig({tray:{[r]:!t[r]}});n(i.tray)}catch(e){i(e instanceof Error?e.message:String(e))}finally{o(null)}}},[e,t,a]);return e?(0,B.jsxs)(`div`,{className:`settings-field`,role:`group`,"aria-labelledby":`desktop-app-label`,children:[(0,B.jsx)(`span`,{className:`settings-label`,id:`desktop-app-label`,children:`Desktop app`}),GT.map(({key:e,label:n,hint:r})=>(0,B.jsxs)(`div`,{children:[(0,B.jsxs)(`label`,{className:`setting-row`,children:[(0,B.jsx)(`span`,{children:n}),(0,B.jsxs)(`span`,{className:`toggle-switch`,children:[(0,B.jsx)(`input`,{type:`checkbox`,role:`switch`,checked:!!t?.[e],"aria-describedby":`desktop-${e}-hint`,onChange:()=>void s(e),disabled:!t||a!==null&&a!==e,"aria-busy":a===e,"aria-label":n}),(0,B.jsx)(`span`,{className:`toggle-track`})]})]}),(0,B.jsx)(`p`,{className:`settings-hint`,id:`desktop-${e}-hint`,children:r})]},e)),r&&(0,B.jsx)(`p`,{className:`settings-error`,role:`alert`,children:r})]}):null}var qT=[{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`system`,label:`Match system`}],JT=[[`Enter`,`Send`],[`Shift+Enter`,`New line`],[`Esc`,`Stop the answer`],[`Mod+Shift+O`,`New chat`],[`Mod+K`,`Search chats`],[`Mod+B`,`Show or hide the sidebar`],[`Mod+,`,`Settings`]];function YT(){let e=z(e=>e.themePreference),t=z(e=>e.setThemePreference),n=z(e=>e.palette),r=z(e=>e.setPalette),i=z(e=>e.customColors),a=z(e=>e.setCustomColors),o=e=>t=>a({...i,[e]:t.target.value.toUpperCase()});return(0,B.jsxs)(`div`,{className:`settings-pane`,children:[(0,B.jsx)(`h2`,{className:`settings-pane-title`,children:`General`}),(0,B.jsxs)(`div`,{className:`settings-field`,children:[(0,B.jsx)(`span`,{className:`settings-label`,id:`appearance-label`,children:`Appearance`}),(0,B.jsx)(`div`,{className:`segmented`,role:`radiogroup`,"aria-labelledby":`appearance-label`,children:qT.map(n=>(0,B.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e===n.value,className:e===n.value?`is-active`:``,onClick:()=>t(n.value),children:n.label},n.value))})]}),(0,B.jsx)(KT,{}),(0,B.jsxs)(`div`,{className:`settings-field`,children:[(0,B.jsx)(`span`,{className:`settings-label`,id:`palette-label`,children:`Colors`}),(0,B.jsxs)(`div`,{className:`palette-grid`,role:`radiogroup`,"aria-labelledby":`palette-label`,children:[nr.map(e=>(0,B.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n===e.id,className:`palette-tile${n===e.id?` is-active`:``}`,onClick:()=>r(e.id),children:[(0,B.jsx)(`span`,{className:`palette-swatch`,"aria-hidden":`true`,children:e.swatch.map(e=>(0,B.jsx)(`i`,{style:{background:e}},e))}),e.name]},e.id)),(0,B.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":n===`custom`,className:`palette-tile${n===`custom`?` is-active`:``}`,onClick:()=>r(`custom`),children:[(0,B.jsxs)(`span`,{className:`palette-swatch`,"aria-hidden":`true`,children:[(0,B.jsx)(`i`,{style:{background:i.base}}),(0,B.jsx)(`i`,{style:{background:i.accent}})]}),`Custom`]})]}),n===`custom`&&(0,B.jsxs)(`div`,{className:`palette-custom`,children:[(0,B.jsxs)(`label`,{className:`palette-color`,htmlFor:`custom-accent`,children:[(0,B.jsx)(`input`,{id:`custom-accent`,type:`color`,value:i.accent,onChange:o(`accent`)}),(0,B.jsxs)(`span`,{children:[`Accent`,(0,B.jsx)(`small`,{children:`Buttons, links and focus`})]})]}),(0,B.jsxs)(`label`,{className:`palette-color`,htmlFor:`custom-base`,children:[(0,B.jsx)(`input`,{id:`custom-base`,type:`color`,value:i.base,onChange:o(`base`)}),(0,B.jsxs)(`span`,{children:[`Background tint`,(0,B.jsx)(`small`,{children:`The color the grays lean toward`})]})]}),(0,B.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>a(ir),children:`Reset`}),(0,B.jsx)(`p`,{className:`settings-hint`,children:`Text colors adjust on their own so everything stays readable in light and dark.`})]})]}),(0,B.jsxs)(`div`,{className:`settings-field`,children:[(0,B.jsx)(`span`,{className:`settings-label`,children:`Keyboard shortcuts`}),(0,B.jsx)(`dl`,{className:`shortcut-list`,children:JT.map(([e,t])=>(0,B.jsxs)(`div`,{className:`shortcut-row`,children:[(0,B.jsx)(`dt`,{children:(0,B.jsx)(`kbd`,{children:ec(e)})}),(0,B.jsx)(`dd`,{children:t})]},e))})]})]})}var XT=`auto`;function ZT({model:e}){let[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null);(0,R.useEffect)(()=>{n(null),i(null),c(null),oa(e).then(n).catch(e=>i(e instanceof Error?e.message:String(e)))},[e]);let l=(0,R.useCallback)(async t=>{o(!0),i(null),c(null);try{let r=await sa(e,t===XT?null:Number(t));n(r);let i=r.chosen?is(r.chosen):`the automatic size`;r.reload?.started?c(`Reloading ${r.display_name} at ${i}. Chat pauses until it's back.`):r.reload?.reason===`already_loaded`?c(`Saved. ${r.display_name} is already loaded at ${i}, so nothing reloads.`):r.reload?.reason===`warm_up`?c(`Saved. GAIA is getting the model ready for a new chat, so ${r.display_name} switches to ${i} the next time it loads.`):r.reload?.reason===`busy`?c(`Saved. GAIA is answering right now, so ${r.display_name} switches to ${i} the next time it loads.`):r.reload?.reason===`not_gaias_server`?c(`Saved. GAIA doesn't reload models on your own server; ${r.display_name} uses ${i} the next time it loads.`):r.reload?.reason===`restarting`?c(`Saved. A reload is already running; this size applies the next time the model loads.`):c(`Saved. It applies the next time this model loads.`)}catch(e){i(e instanceof Error?e.message:String(e))}finally{o(!1)}},[e]);if(r&&!t)return(0,B.jsx)(`p`,{className:`settings-error`,role:`alert`,children:r});if(!t)return(0,B.jsxs)(`p`,{className:`settings-hint`,children:[(0,B.jsx)(L,{size:13,className:`spin`}),` Checking context sizes…`]});let u=t.chosen==null?XT:String(t.chosen),d=t.chosen!=null&&t.loaded_ctx!=null&&t.loaded_ctx!==t.chosen;return(0,B.jsxs)(`div`,{className:`settings-field`,children:[(0,B.jsx)(`label`,{className:`settings-label`,htmlFor:`ctx-size`,children:`Context size`}),(0,B.jsxs)(`select`,{id:`ctx-size`,className:`settings-input`,value:u,onChange:e=>void l(e.target.value),disabled:a||t.options.length===0,children:[(0,B.jsxs)(`option`,{value:XT,children:[`Automatic`,t.automatic?` (${is(t.automatic)})`:``]}),t.options.map(e=>(0,B.jsxs)(`option`,{value:String(e),children:[is(e),` tokens`]},e))]}),(0,B.jsxs)(`span`,{className:`settings-hint`,children:[t.note??(t.max_fit?`Up to ${is(t.max_fit)}, the most ${t.display_name} can hold on this PC (${t.memory_source}). A larger window uses more memory. GAIA reloads the model to apply it, except on a Lemonade you run yourself.`:null),d&&` Loaded now at ${is(t.loaded_ctx)}.`]}),a&&(0,B.jsxs)(`span`,{className:`settings-hint`,children:[(0,B.jsx)(L,{size:13,className:`spin`}),` Applying…`]}),s&&(0,B.jsx)(`p`,{className:`settings-ok`,role:`status`,children:s}),r&&(0,B.jsx)(`p`,{className:`settings-error`,role:`alert`,children:r})]})}function QT(){let[e,t]=(0,R.useState)(null),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(!1),c=(0,R.useCallback)(async e=>{s(!0),r(null);try{let n=await e();t(n),a(n.limit_usd==null?``:String(n.limit_usd))}catch(e){r(e instanceof Error?e.message:String(e))}finally{s(!1)}},[]);if((0,R.useEffect)(()=>{c(fa)},[c]),!e)return n?(0,B.jsx)(`p`,{className:`settings-error`,role:`alert`,children:n}):(0,B.jsxs)(`p`,{className:`settings-hint`,children:[(0,B.jsx)(L,{size:13,className:`spin`}),` Loading this month’s spending…`]});let l=e.limit_usd,u=i.trim()===``?null:Number(i),d=u===null||Number.isFinite(u)&&u>0,f=u!==l;return(0,B.jsxs)(`section`,{className:`settings-field spending`,"aria-label":`Cloud spending`,children:[(0,B.jsx)(`span`,{className:`settings-label`,children:`Cloud spending this month`}),(0,B.jsxs)(`p`,{className:`spending-total`,children:[(0,B.jsx)(`strong`,{children:vS(e.total_usd)}),l!=null&&(0,B.jsxs)(B.Fragment,{children:[` of your `,vS(l),` limit`]}),(0,B.jsxs)(`span`,{className:`settings-hint`,children:[` · `,e.turns,` cloud `,e.turns===1?`chat turn`:`chat turns`,`, at list price`]})]}),e.unpriced_turns>0&&(0,B.jsxs)(`p`,{className:`settings-hint`,children:[`Plus `,e.unpriced_turns,` `,e.unpriced_turns===1?`turn`:`turns`,` on models with an unknown price, not included above.`]}),e.state===`near`&&(0,B.jsxs)(`p`,{className:`spending-warning`,role:`status`,children:[(0,B.jsx)(Tn,{size:13,"aria-hidden":`true`}),` Close to your limit. GAIA stops before a cloud chat once it’s reached.`]}),e.state===`reached`&&(0,B.jsxs)(`div`,{className:`spending-warning`,role:`alert`,children:[(0,B.jsxs)(`p`,{children:[(0,B.jsx)(Tn,{size:13,"aria-hidden":`true`}),` You’ve reached your limit, so cloud chats are stopped until next month. Models on this PC still work.`]}),(0,B.jsx)(`button`,{type:`button`,className:`btn-secondary`,disabled:o,onClick:()=>void c(ma),children:`Allow more this month`})]}),e.state===`allowed_over`&&(0,B.jsx)(`p`,{className:`settings-hint`,children:`Over your limit; you allowed more for this month.`}),(0,B.jsxs)(`form`,{className:`settings-row`,onSubmit:e=>{e.preventDefault(),d&&f&&c(()=>pa(u))},children:[(0,B.jsx)(`label`,{className:`spending-limit-label`,htmlFor:`spend-limit`,children:`Monthly limit ($)`}),(0,B.jsx)(`input`,{id:`spend-limit`,className:`settings-input`,type:`number`,min:`0.01`,step:`0.01`,inputMode:`decimal`,placeholder:`No limit`,value:i,onChange:e=>a(e.target.value),"aria-invalid":!d}),(0,B.jsxs)(`button`,{type:`submit`,className:`btn-secondary`,disabled:o||!d||!f,children:[o?(0,B.jsx)(L,{size:13,className:`spin`}):null,` Save`]}),l!=null&&(0,B.jsx)(`button`,{type:`button`,className:`btn-secondary`,disabled:o,onClick:()=>void c(()=>pa(null)),children:`Remove limit`})]}),(0,B.jsx)(`span`,{className:`settings-hint`,children:`Counts cloud chats in GAIA’s Agent UI at list price, without cache discounts. Your provider’s bill is the final word. Turns that fail or are stopped before a reply aren’t counted. Models with an unknown price, like the AMD LLM Gateway’s, add nothing to the total, but are stopped too once the limit is reached.`}),n&&(0,B.jsx)(`p`,{className:`settings-error`,role:`alert`,children:n})]})}var $T=2e3;function eE(e){if(e.key_state===`waiting_for_os_permission`)return e.key_message??`Waiting for the OS to allow reading the saved key.`;switch(e.key_source){case`environment`:return`A key is set in ${e.env_var} and is in use.`;case`lemonade`:return`A key is already configured on the local model server.`;case`stored`:return`A saved key will be used.`;default:return`No key yet.`}}function tE(e){return e.key_source===`environment`?`Blank uses the environment key`:e.key_source?`Blank keeps the saved key`:`Paste API key`}function nE(){let e=Wo(e=>e.active),t=Wo(e=>e.select),n=Wo(e=>e.refresh),r=Wo(e=>e.rememberNames),[i,a]=(0,R.useState)(null),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(e?.provider??`local`),[u,d]=(0,R.useState)(null),[f,p]=(0,R.useState)(null),[m,h]=(0,R.useState)(``),[g,_]=(0,R.useState)(``),[v,y]=(0,R.useState)({base_url:``,auth_header_name:``,auth_header_prefix:``}),[b,x]=(0,R.useState)(null),[S,C]=(0,R.useState)(null),[w,T]=(0,R.useState)(null),E=(0,R.useRef)(c);E.current=c;let D=(0,R.useRef)(!0);(0,R.useEffect)(()=>()=>{D.current=!1},[]);let O=i?.find(e=>e.id===c)??null,k=e=>e?.network?.reachable===!1,A=!!O&&(!O.remote||!!O.models_discovered),j=(0,R.useCallback)(async()=>{s(null);try{let e=await ea();a(e.providers),e.lemonade_error&&s(e.lemonade_error)}catch(e){s(e instanceof Error?e.message:String(e))}},[]),M=(0,R.useCallback)(async(e,t=!1)=>{t||(d(null),p(null));try{let t=await aa(e);r(t.models),d(t.models),C(t.memory_gb?`${t.memory_gb} GB (${t.memory_source})`:t.capacity_error??null)}catch(e){p(e instanceof Error?e.message:String(e))}},[r]);(0,R.useEffect)(()=>{j()},[j]);let ee=!!i?.some(e=>e.key_state===`waiting_for_os_permission`);(0,R.useEffect)(()=>{if(!ee)return;let e=setInterval(()=>{j()},$T);return()=>clearInterval(e)},[ee,j]);let te=e?.provider;(0,R.useEffect)(()=>{te&&l(te)},[te]),(0,R.useEffect)(()=>{_(``),T(null),h(``)},[c]),(0,R.useEffect)(()=>{A?M(c):d(null)},[c,A,M]);let N=(0,R.useCallback)(async()=>{if(O){x(`connect`),T(null);try{let e=c===`amd`?{api_key:g||void 0,...Object.fromEntries(Object.entries(v).filter(([,e])=>e!==``))}:{api_key:g||void 0},t=()=>!D.current||E.current!==c,n=await ra(c,e,e=>{t()||T({ok:!0,text:e})},t);if(t())return;_(``),T({ok:!0,text:n.remember_error?`Connected for this session only — the key could not be kept: ${n.remember_error}`:n.remembered?`Connected. The key is kept for next time.`:`Connected.`}),await j()}catch(e){D.current&&E.current===c&&T({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{D.current&&x(null)}}},[v,c,g,j,O]),ne=(0,R.useCallback)(async()=>{x(`forget`),T(null);try{await ia(c),T({ok:!0,text:`Key cleared, here and for future sessions. An environment key, if set, stays active.`}),await j(),await n()}catch(e){T({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{x(null)}},[c,j,n]),re=(0,R.useCallback)(async e=>{x(e),T(null);try{await t(e),T({ok:!0,text:`New messages use ${Ko(e)}. It is remembered across restarts.`})}catch(e){T({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{x(null)}},[t]),ie=(0,R.useCallback)(async e=>{x(`dl:${e}`),T(null);try{await Bi(e),await M(`local`,!0)}catch(e){T({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{x(null)}},[M]),ae=!!u?.some(os);(0,R.useEffect)(()=>{if(c!==`local`||!ae)return;let e=setInterval(()=>{M(`local`,!0)},$T);return()=>clearInterval(e)},[ae,c,M]);let se=(0,R.useMemo)(()=>{let e=m.trim().toLowerCase();return(u??[]).filter(t=>!e||t.id.toLowerCase().includes(e)||(t.display_name??``).toLowerCase().includes(e))},[u,m]),ce=se.filter(e=>e.available!==!1),le=se.filter(e=>e.available===!1),ue=es(u??[]),de=e&&!e.remote&&e.model?e.model:null,fe=t=>{let n=e?.model===t.id,r=os(t)?t.download_progress:null,i=[rs(t.placement),t.size_gb?`${t.size_gb} GB ${t.downloaded?`on disk`:`download`}`:null,t.tokens_per_second?`${Math.round(t.tokens_per_second)} tok/s measured here`:null,!t.placement&&t.context_length?`Context ${t.context_length.toLocaleString()} tokens`:null].filter(Boolean).join(` · `);return(0,B.jsxs)(`li`,{className:`model-row${n?` is-current`:``}`,children:[(0,B.jsxs)(`div`,{className:`model-row-text`,children:[(0,B.jsxs)(`span`,{className:`model-row-name`,title:t.id,children:[ue[t.id],t.rank&&(0,B.jsxs)(`span`,{className:`model-row-rank`,children:[`#`,t.rank,` `,t.note]}),t.state===`loaded`&&(0,B.jsx)(`span`,{className:`model-badge is-loaded`,children:ns.loaded}),t.fits===!0&&t.available!==!1&&(0,B.jsx)(`span`,{className:`model-badge is-fit`,children:`Fits this PC`})]}),O?.remote&&(0,B.jsx)(`span`,{className:`model-row-meta${t.price?``:` is-unknown-price`}`,children:_S(t.price)}),t.display_name&&(0,B.jsx)(`span`,{className:`model-row-meta`,children:t.id}),i&&(0,B.jsx)(`span`,{className:`model-row-meta`,children:i}),t.placement?.warning&&(0,B.jsx)(`span`,{className:`model-row-meta is-warning`,role:`alert`,children:t.placement.warning}),t.unavailable_reason&&(0,B.jsxs)(`span`,{className:`model-row-meta`,children:[`Can't run here: `,t.unavailable_reason]}),t.evidence&&(0,B.jsxs)(`span`,{className:`model-row-meta`,children:[`Measured: `,t.evidence]}),r&&(0,B.jsx)(`progress`,{max:100,value:r.percent,"aria-label":`Downloading ${ue[t.id]}`})]}),n?(0,B.jsxs)(`span`,{className:`model-row-current`,children:[(0,B.jsx)(oe,{size:13,"aria-hidden":`true`}),` In use`]}):t.available===!1?null:r?(0,B.jsxs)(`span`,{className:`model-row-current`,children:[(0,B.jsx)(L,{size:13,className:`spin`}),` `,Math.round(r.percent),`%`]}):t.downloaded?(0,B.jsxs)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void re(t.id),disabled:b!==null,"aria-label":`Use ${ue[t.id]}`,children:[b===t.id?(0,B.jsx)(L,{size:13,className:`spin`}):null,` Use`]}):(0,B.jsxs)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void ie(t.id),disabled:b!==null,"aria-label":`Download ${ue[t.id]}`,children:[b===`dl:${t.id}`?(0,B.jsx)(L,{size:13,className:`spin`}):null,` Download`]})]},t.id)};return(0,B.jsxs)(`div`,{className:`settings-pane`,children:[(0,B.jsx)(`h2`,{className:`settings-pane-title`,children:`Model`}),(0,B.jsx)(`p`,{className:`settings-pane-lede`,children:`GAIA runs on this PC by default. Cloud providers are used only when you pick one of their models.`}),(0,B.jsx)(`div`,{className:`provider-tabs`,role:`radiogroup`,"aria-label":`Where GAIA runs`,children:(i??[{id:`local`,name:`Local`,remote:!1}]).map(e=>(0,B.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":c===e.id,className:`provider-tab${c===e.id?` is-active`:``}${k(e)?` is-disabled`:``}`,onClick:()=>l(e.id),disabled:k(e)&&c!==e.id,title:k(e)?e.network?.detail??void 0:void 0,children:[e.remote?(0,B.jsx)(Ce,{size:14,"aria-hidden":`true`}):(0,B.jsx)(je,{size:14,"aria-hidden":`true`}),(0,B.jsx)(`span`,{children:e.name}),e.remote&&e.models_discovered&&(0,B.jsx)(`span`,{className:`provider-tab-dot`,"aria-label":`connected`})]},e.id))}),o&&(0,B.jsx)(`p`,{className:`settings-error`,role:`alert`,children:o}),O&&(0,B.jsxs)(`section`,{className:`settings-card`,"aria-label":O.name,children:[(0,B.jsx)(`p`,{className:`settings-note`,children:O.privacy_notice}),O.id===`local`&&(0,B.jsxs)(`p`,{className:`settings-hint`,children:[`Each model runs where it was built to: GGUF models on the GPU, FLM models on the NPU.`,S&&` Memory for models: ${S}.`]}),O.remote&&!A&&(0,B.jsxs)(`div`,{className:`settings-field`,children:[(0,B.jsx)(`span`,{className:`settings-label`,children:`Prices`}),(0,B.jsx)(DT,{provider:O.id})]}),k(O)&&(0,B.jsxs)(`div`,{className:`settings-field`,children:[(0,B.jsx)(`p`,{className:`settings-error`,role:`alert`,children:O.network?.detail}),(0,B.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void j(),children:`Check again`})]}),O.remote&&!k(O)&&(0,B.jsxs)(`form`,{className:`settings-field`,onSubmit:e=>{e.preventDefault(),N()},children:[(0,B.jsx)(`span`,{className:`settings-label`,children:`API key`}),(0,B.jsx)(`span`,{className:`settings-hint`,children:eE(O)}),O.id===`amd`&&(0,B.jsxs)(`div`,{className:`settings-grid`,children:[(0,B.jsx)(`input`,{className:`settings-input`,placeholder:`Gateway URL (default https://llm-api.amd.com/Unified/v1)`,value:v.base_url,onChange:e=>y({...v,base_url:e.target.value}),"aria-label":`Gateway URL`}),(0,B.jsx)(`input`,{className:`settings-input`,placeholder:`Auth header (default Ocp-Apim-Subscription-Key)`,value:v.auth_header_name,onChange:e=>y({...v,auth_header_name:e.target.value}),"aria-label":`Auth header name`})]}),(0,B.jsxs)(`div`,{className:`settings-row`,children:[(0,B.jsx)(`input`,{className:`settings-input`,type:`password`,autoComplete:`off`,spellCheck:!1,value:g,onChange:e=>_(e.target.value),placeholder:tE(O),"aria-label":`${O.name} API key`}),(0,B.jsxs)(`button`,{type:`submit`,className:`btn-primary`,disabled:b!==null||!g&&!O.key_source,children:[b===`connect`?(0,B.jsx)(L,{size:13,className:`spin`}):null,O.models_discovered?`Reconnect`:`Connect`]}),(O.key_source===`lemonade`||O.key_source===`stored`)&&(0,B.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void ne(),disabled:b!==null,children:`Forget key`})]}),O.error&&(0,B.jsx)(`p`,{className:`settings-error`,role:`alert`,children:O.error})]}),w&&(0,B.jsx)(`p`,{className:w.ok?`settings-ok`:`settings-error`,role:w.ok?`status`:`alert`,children:w.text}),O.id===`local`&&de&&e?.downloaded!==!1&&(0,B.jsx)(ZT,{model:de}),A&&(0,B.jsxs)(`div`,{className:`settings-field`,children:[(0,B.jsx)(`span`,{className:`settings-label`,children:`Models`}),(u?.length??0)>6&&(0,B.jsx)(`input`,{className:`settings-input`,type:`search`,value:m,onChange:e=>h(e.target.value),placeholder:`Search models`,"aria-label":`Search models`}),f&&(0,B.jsx)(`p`,{className:`settings-error`,role:`alert`,children:f}),!u&&!f&&(0,B.jsxs)(`p`,{className:`settings-hint`,children:[(0,B.jsx)(L,{size:13,className:`spin`}),` Loading…`]}),u&&se.length===0&&(0,B.jsx)(`p`,{className:`settings-hint`,children:`No models match.`}),(0,B.jsx)(`ul`,{className:`model-list`,children:ce.map(fe)}),le.length>0&&(0,B.jsxs)(`details`,{className:`model-unavailable`,children:[(0,B.jsxs)(`summary`,{children:[`Not available on this PC (`,le.length,`)`]}),(0,B.jsx)(`ul`,{className:`model-list`,children:le.map(fe)})]})]}),O.remote&&(0,B.jsx)(QT,{})]})]})}function rE(){let e=z(e=>e.sessions),[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(null),a=(0,R.useCallback)(async()=>{i(null);try{n((await _i()).sessions)}catch(e){i(e instanceof Error?e.message:String(e))}},[]);(0,R.useEffect)(()=>{a()},[a]);let o=(0,R.useCallback)(async e=>{i(null);try{await e(),await a()}catch(e){i(e instanceof Error?e.message:String(e))}},[a]),s=t=>e.find(e=>e.id===t)?.title??t;return(0,B.jsxs)(`div`,{className:`settings-pane`,children:[(0,B.jsx)(`h2`,{className:`settings-pane-title`,children:`Permissions`}),(0,B.jsx)(`p`,{className:`settings-pane-lede`,children:`GAIA asks before it changes files, runs commands, or uses tools that act on your behalf. Pick a mode per chat from the shield next to the message box. “Always allow” covers one exact action in one chat and ends when GAIA restarts.`}),(0,B.jsxs)(`p`,{className:`settings-hint`,children:[`New chats start in full access only when `,(0,B.jsx)(`code`,{children:`full_access`}),` is set in`,(0,B.jsx)(`code`,{children:` ~/.gaia/config.json`}),` (the TUI’s `,(0,B.jsx)(`code`,{children:`/full-access always`}),`).`]}),r&&(0,B.jsx)(`p`,{className:`settings-error`,role:`alert`,children:r}),t&&t.length===0&&(0,B.jsx)(`p`,{className:`settings-hint`,children:`No chat has full access or anything allowed without asking.`}),t?.map(e=>(0,B.jsxs)(`section`,{className:`settings-card`,"aria-label":s(e.session_id),children:[(0,B.jsxs)(`div`,{className:`settings-row settings-row-between`,children:[(0,B.jsx)(`span`,{className:`settings-label`,children:s(e.session_id)}),e.mode===`full_access`&&(0,B.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>o(()=>vi(e.session_id,`ask`)),children:`Turn off full access`})]}),e.grants.length>0&&(0,B.jsx)(`ul`,{className:`grant-list`,children:e.grants.map(t=>(0,B.jsxs)(`li`,{className:`grant-row`,children:[(0,B.jsx)(`code`,{children:t.label}),(0,B.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>o(()=>yi(e.session_id,t.key)),"aria-label":`Revoke ${t.label}`,children:`Revoke`})]},t.key))}),e.grants.length>1&&(0,B.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>o(()=>yi(e.session_id)),children:`Revoke all in this chat`})]},e.session_id))]})}function iE({onUseSkill:e}){let[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)({}),[a,o]=(0,R.useState)(null),[s,c]=(0,R.useState)(``);(0,R.useEffect)(()=>{let e=!1;return ha().then(t=>{e||(n(t.skills),i(t.invalid))}).catch(t=>{e||o(t instanceof Error?t.message:String(t))}),()=>{e=!0}},[]);let l=s.trim().toLowerCase(),u=(t??[]).filter(e=>!l||e.name.toLowerCase().includes(l)||e.description.toLowerCase().includes(l));return(0,B.jsxs)(`div`,{className:`settings-pane`,children:[(0,B.jsx)(`h2`,{className:`settings-pane-title`,children:`Skills`}),(0,B.jsxs)(`p`,{className:`settings-pane-lede`,children:[`Skills teach GAIA a job — a workflow, a CLI, a document type. GAIA loads one when a request needs it, and keeps the lessons it learns while using it. Add your own under `,(0,B.jsx)(`code`,{children:`~/.gaia/skills`}),`.`]}),a&&(0,B.jsx)(`p`,{className:`settings-error`,role:`alert`,children:a}),!t&&!a&&(0,B.jsxs)(`p`,{className:`settings-hint`,children:[(0,B.jsx)(L,{size:13,className:`spin`}),` Loading…`]}),t&&t.length>6&&(0,B.jsx)(`input`,{className:`settings-input`,type:`search`,value:s,onChange:e=>c(e.target.value),placeholder:`Search skills`,"aria-label":`Search skills`}),t&&t.length===0&&(0,B.jsx)(`p`,{className:`settings-hint`,children:`No skills are installed.`}),(0,B.jsx)(`ul`,{className:`skill-list`,children:u.map(t=>(0,B.jsxs)(`li`,{className:`skill-row`,children:[(0,B.jsxs)(`div`,{className:`skill-row-text`,children:[(0,B.jsxs)(`span`,{className:`skill-row-name`,children:[t.name,t.version&&(0,B.jsxs)(`span`,{className:`skill-row-meta`,children:[` v`,t.version]})]}),(0,B.jsx)(`span`,{className:`skill-row-desc`,children:t.description})]}),(0,B.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>e(t.name),"aria-label":`Use ${t.name} in a new chat`,children:`Use`})]},t.name))}),Object.keys(r).length>0&&(0,B.jsxs)(`div`,{className:`settings-card`,role:`alert`,children:[(0,B.jsx)(`span`,{className:`settings-label`,children:`Skipped, could not be read`}),(0,B.jsx)(`ul`,{className:`grant-list`,children:Object.entries(r).map(([e,t])=>(0,B.jsxs)(`li`,{children:[(0,B.jsx)(`code`,{children:e}),` — `,t]},e))})]})]})}var aE=d();async function oE(e,t,n){let r=`${aE}${t}`,i={};e!==`GET`&&(i[`X-Gaia-UI`]=`1`),n!==void 0&&(i[`Content-Type`]=`application/json`);let a={method:e,headers:Object.keys(i).length>0?i:void 0,body:n===void 0?void 0:JSON.stringify(n)},o=await fetch(r,a);if(!o.ok){let e=await o.text().catch(()=>``),t=e;try{t=JSON.parse(e).detail||e}catch{}throw Error(t||`Memory API error (HTTP ${o.status})`)}if((o.headers.get(`content-type`)||``).includes(`application/json`))return o.json()}function sE(e){let t=[];for(let[n,r]of Object.entries(e))if(r!=null&&r!==``){if(Array.isArray(r))for(let e of r)t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(e))}`);else t.push(`${encodeURIComponent(n)}=${encodeURIComponent(String(r))}`)}return t.length?`?${t.join(`&`)}`:``}function cE(){return oE(`GET`,`/memory/stats`)}function lE(e=30){return oE(`GET`,`/memory/activity?days=${e}`)}function uE(e={}){return oE(`GET`,`/memory/knowledge${sE(e)}`)}function dE(e){return oE(`POST`,`/memory/knowledge`,e)}function fE(e,t){return oE(`PUT`,`/memory/knowledge/${encodeURIComponent(e)}`,t)}function pE(e){return oE(`DELETE`,`/memory/knowledge/${encodeURIComponent(e)}`)}function mE(){return oE(`GET`,`/memory/entities`)}function hE(){return oE(`GET`,`/memory/tools`)}function gE(e=20){return oE(`GET`,`/memory/conversations?limit=${e}`)}function _E(e,t=20){return oE(`GET`,`/memory/conversations/search?query=${encodeURIComponent(e)}&limit=${t}`)}function vE(e){return oE(`GET`,`/memory/conversations/${encodeURIComponent(e)}`)}function yE(e=7){return oE(`GET`,`/memory/upcoming?days=${e}`)}function bE(){return oE(`GET`,`/memory/embedding-coverage`)}function xE(){return oE(`POST`,`/memory/consolidate`)}function SE(){return oE(`POST`,`/memory/rebuild-embeddings`)}function CE(){return oE(`POST`,`/memory/reconcile`)}function wE(){return oE(`POST`,`/memory/rebuild-fts`)}function TE(){return oE(`POST`,`/memory/refresh-system-context`)}function EE(){return new EventSource(`${aE}/memory/stream-discovery`)}function DE(e){return new EventSource(`${aE}/memory/stream-inference?include_browser=${e}`)}function OE(e){return oE(`POST`,`/memory/commit-discovery`,{items:e})}function kE(e){return oE(`POST`,`/memory/commit-inference`,{insights:e})}function AE(){return oE(`GET`,`/memory/settings`)}function jE(e){return oE(`PUT`,`/memory/settings`,e)}function ME(){return oE(`DELETE`,`/memory/all`)}function NE(){return oE(`POST`,`/memory/reinitialize`)}function PE(){return oE(`GET`,`/goals/stats`)}function FE(e={}){return oE(`GET`,`/goals${sE(e)}`)}function IE(e){return oE(`POST`,`/goals`,e)}function LE(e){return oE(`PUT`,`/goals/${encodeURIComponent(e)}/approve`)}function RE(e){return oE(`PUT`,`/goals/${encodeURIComponent(e)}/reject`)}function zE(e){return oE(`PUT`,`/goals/${encodeURIComponent(e)}/cancel`)}function BE(e){return oE(`DELETE`,`/goals/${encodeURIComponent(e)}`)}function VE(){let e=z(e=>e.setShowMemoryDashboard),t=z(e=>e.closeSettings),[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(null),[o,s]=(0,R.useState)(!1);(0,R.useEffect)(()=>{AE().then(r).catch(e=>a(e instanceof Error?e.message:String(e)))},[]);let c=(0,R.useCallback)(async()=>{if(n){s(!0),a(null);try{r(await jE({memory_enabled:!n.memory_enabled}))}catch(e){a(e instanceof Error?e.message:String(e))}finally{s(!1)}}},[n]);return(0,B.jsxs)(`div`,{className:`settings-pane`,children:[(0,B.jsx)(`h2`,{className:`settings-pane-title`,children:`Memory`}),(0,B.jsx)(`p`,{className:`settings-pane-lede`,children:`GAIA remembers facts, preferences and past conversations across chats, on this PC only. Private chats (the eye icon in a chat) are never remembered.`}),(0,B.jsxs)(`label`,{className:`setting-row`,children:[(0,B.jsx)(`span`,{children:`Remember across chats`}),(0,B.jsxs)(`span`,{className:`toggle-switch`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:!!n?.memory_enabled,onChange:()=>void c(),disabled:!n||o,"aria-label":`Remember across chats`}),(0,B.jsx)(`span`,{className:`toggle-track`})]})]}),i&&(0,B.jsx)(`p`,{className:`settings-error`,role:`alert`,children:i}),(0,B.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{t(),e(!0)},children:`Open the memory dashboard`}),(0,B.jsx)(`p`,{className:`settings-hint`,children:`Search, edit and forget what GAIA remembers.`})]})}var HE=`Keep for: enter a whole number of days from 1 to 365.`,UE=`Use at most: enter a whole number of MB from 10 to 100,000.`;function WE(e,t,n){if(!/^\d+$/.test(e.trim()))return!1;let r=Number(e);return r>=t&&r<=n}function GE(e){return e<1048576?`${Math.ceil(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function KE(){let[e,t]=(0,R.useState)(null),[n,r]=(0,R.useState)(``),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(!1);(0,R.useEffect)(()=>{So().then(e=>{t(e),r(String(e.retention_days)),a(String(e.max_mb))},e=>s({ok:!1,text:`Could not read undo history settings: ${e instanceof Error?e.message:e}`}))},[]);let[u,d]=(0,R.useState)({days:!1,mb:!1}),f=!WE(n,1,365)||u.days,p=!WE(i,10,1e5)||u.mb,m=e!==null&&(n!==String(e.retention_days)||i!==String(e.max_mb)),h=async()=>{if(!(f||p)){l(!0),s(null);try{let e=await Co(Number(n),Number(i));t(e),s({ok:!0,text:`Saved. Older undo history beyond these limits was removed.`})}catch(e){let t=e instanceof wi&&e.httpStatus===422?e.fields:[],n=t.includes(`retention_days`),r=t.includes(`max_mb`);n||r?(d({days:n,mb:r}),s({ok:!1,text:`Not saved. Fix the limit marked above.`})):s({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{l(!1)}}};return(0,B.jsxs)(`div`,{className:`settings-field`,"aria-label":`Undo history`,children:[(0,B.jsx)(`span`,{className:`settings-label`,children:`Undo history`}),(0,B.jsx)(`p`,{className:`settings-hint`,children:`Before GAIA changes a file it keeps a copy, so you can undo a turn. Copies older than the time limit, or past the space limit (oldest first), are deleted. The space limit never deletes the latest turn.`}),e&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`setting-row`,children:[(0,B.jsx)(`label`,{htmlFor:`undo-days`,children:`Keep for (days)`}),(0,B.jsx)(`input`,{id:`undo-days`,type:`number`,className:`model-input undo-history-input`,min:1,max:365,value:n,"aria-invalid":f,"aria-describedby":f?`undo-days-error`:void 0,onChange:e=>{r(e.target.value),d(e=>({...e,days:!1}))}})]}),f&&(0,B.jsx)(`p`,{id:`undo-days-error`,className:`settings-error`,children:HE}),(0,B.jsxs)(`div`,{className:`setting-row`,children:[(0,B.jsx)(`label`,{htmlFor:`undo-mb`,children:`Use at most (MB)`}),(0,B.jsx)(`input`,{id:`undo-mb`,type:`number`,className:`model-input undo-history-input`,min:10,max:1e5,value:i,"aria-invalid":p,"aria-describedby":p?`undo-mb-error`:void 0,onChange:e=>{a(e.target.value),d(e=>({...e,mb:!1}))}})]}),p&&(0,B.jsx)(`p`,{id:`undo-mb-error`,className:`settings-error`,children:UE}),(0,B.jsxs)(`div`,{className:`setting-row setting-row-path`,children:[(0,B.jsx)(`span`,{children:`In use`}),(0,B.jsxs)(`span`,{children:[GE(e.used_bytes),` for `,e.turns,` turn`,e.turns===1?``:`s`,` `,`in `,(0,B.jsx)(`code`,{className:`setting-path`,children:e.path})]})]}),(0,B.jsx)(`button`,{type:`button`,className:`btn-model-save`,onClick:()=>void h(),disabled:!m||c||f||p,children:c?`Saving…`:`Save`})]}),o&&(0,B.jsx)(`p`,{className:o.ok?`settings-ok`:`settings-error`,role:o.ok?`status`:`alert`,children:o.text})]})}function qE(){let e=z(e=>e.sessions),t=z(e=>e.removeSession),n=Xo(),r=z(e=>e.systemStatus?.data_dir),[i,a]=(0,R.useState)(!1),[o,s]=(0,R.useState)(null),c=(0,R.useRef)(null);(0,R.useEffect)(()=>()=>{c.current&&clearTimeout(c.current)},[]);let l=(0,R.useCallback)(async()=>{if(!i){a(!0),c.current=setTimeout(()=>a(!1),4e3);return}a(!1);let n=[];for(let r of e)try{await ya(r.id),t(r.id)}catch(e){n.push(`${r.title}: ${e instanceof Error?e.message:e}`)}s(n.length?{ok:!1,text:`Could not delete ${n.length} chat(s): ${n.join(`; `)}`}:{ok:!0,text:`All chats deleted.`})},[i,t,e]);return(0,B.jsxs)(`div`,{className:`settings-pane`,children:[(0,B.jsx)(`h2`,{className:`settings-pane-title`,children:`Privacy`}),(0,B.jsxs)(`p`,{className:`settings-pane-lede`,children:[`Chats, documents and memory stay on this PC. `,n?.remote?`Right now answers come from ${n.label}, so each message and the chat history are sent there.`:n?`Right now answers are generated on this PC too.`:`GAIA can't tell right now whether answers are generated on this PC or by a cloud provider.`]}),r&&(0,B.jsxs)(`div`,{className:`setting-row`,children:[(0,B.jsx)(`span`,{children:`Data folder`}),(0,B.jsx)(`code`,{className:`setting-path`,children:r})]}),(0,B.jsx)(KE,{}),(0,B.jsx)(`div`,{className:`danger-divider`}),(0,B.jsx)(`p`,{className:`danger-warning`,children:`Deletes every chat and its messages. Documents and memory are kept.`}),(0,B.jsx)(`button`,{type:`button`,className:`btn-danger`,onClick:()=>void l(),disabled:e.length===0,children:i?`Click again to delete all chats`:`Delete all chats`}),o&&(0,B.jsx)(`p`,{className:o.ok?`settings-ok`:`settings-error`,role:o.ok?`status`:`alert`,children:o.text})]})}var JE=[{id:`needs_approval`,label:`Needs your approval`},{id:`question`,label:`Has a question`},{id:`finished`,label:`Finished`}],YE=[{value:`banner`,label:`Banner`},{value:`badge`,label:`Badge`},{value:`off`,label:`Off`}],XE=[0,10,20,30,50];function ZE(){return typeof Notification>`u`?`unsupported`:Notification.permission}function QE(){let e=Ps(),t=!!window.gaiaAPI,[n,r]=(0,R.useState)(ZE),i=Object.values(e.modes).includes(`banner`);return(0,B.jsxs)(`div`,{className:`settings-pane`,children:[(0,B.jsx)(`h2`,{className:`settings-pane-title`,children:`Notifications`}),(0,B.jsx)(`p`,{className:`settings-pane-lede`,children:`When a chat you aren't looking at needs you or finishes. A banner also counts on the badge.`}),JE.map(t=>(0,B.jsxs)(`div`,{className:`setting-row`,children:[(0,B.jsx)(`span`,{id:`alert-${t.id}`,children:t.label}),(0,B.jsx)(`div`,{className:`segmented`,role:`radiogroup`,"aria-labelledby":`alert-${t.id}`,children:YE.map(n=>(0,B.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":e.modes[t.id]===n.value,className:e.modes[t.id]===n.value?`is-active`:``,onClick:()=>e.setMode(t.id,n.value),children:n.label},n.value))})]},t.id)),!t&&i&&n!==`granted`&&(n==="default"?(0,B.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{Notification.requestPermission().then(r).catch(e=>{console.error(`[alerts] Notification permission request failed`,e),r(ZE())})},children:`Allow banners in this browser`}):(0,B.jsx)(`p`,{className:`settings-error`,role:`alert`,children:n===`unsupported`?`This browser can't show banners; alerts appear in the chat list only.`:`This browser blocks banners from GAIA. Allow notifications for this site in the browser’s site settings.`})),(0,B.jsxs)(`label`,{className:`setting-row`,children:[(0,B.jsx)(`span`,{children:`Play a sound`}),(0,B.jsxs)(`span`,{className:`toggle-switch`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e.sound,onChange:()=>e.update({sound:!e.sound}),"aria-label":`Play a sound`}),(0,B.jsx)(`span`,{className:`toggle-track`})]})]}),t&&(0,B.jsxs)(`label`,{className:`setting-row`,children:[(0,B.jsx)(`span`,{children:`Flash the taskbar when GAIA isn't focused`}),(0,B.jsxs)(`span`,{className:`toggle-switch`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e.flash,onChange:()=>e.update({flash:!e.flash}),"aria-label":`Flash the taskbar when GAIA isn't focused`}),(0,B.jsx)(`span`,{className:`toggle-track`})]})]}),(0,B.jsx)(`h3`,{className:`settings-label`,children:`Keep awake`}),t?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`label`,{className:`setting-row`,children:[(0,B.jsx)(`span`,{children:`Keep the PC awake while GAIA works`}),(0,B.jsxs)(`span`,{className:`toggle-switch`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:e.keepAwake,onChange:()=>e.update({keepAwake:!e.keepAwake}),"aria-label":`Keep the PC awake while GAIA works`}),(0,B.jsx)(`span`,{className:`toggle-track`})]})]}),(0,B.jsxs)(`div`,{className:`setting-row`,children:[(0,B.jsx)(`label`,{htmlFor:`battery-floor`,children:`On battery, let it sleep below`}),(0,B.jsx)(`select`,{id:`battery-floor`,value:e.batteryFloor,disabled:!e.keepAwake,onChange:t=>e.update({batteryFloor:Number(t.target.value)}),children:XE.map(e=>(0,B.jsx)(`option`,{value:e,children:e===0?`Never`:`${e}%`},e))})]}),(0,B.jsx)(`p`,{className:`settings-hint`,children:`The screen can still turn off; only sleep is held off.`})]}):(0,B.jsx)(`p`,{className:`settings-hint`,children:`Keep-awake needs the GAIA desktop app.`})]})}var $E=`modulepreload`,eD=function(e,t){return new URL(e,t).href},tD={},nD=function(e){return e.pathname.endsWith(`.css`)},rD=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},iD=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=eD(t,n);let r=s(t),i=nD(r);return rD(tD,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:$E,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},aD=(0,R.lazy)(()=>iD(()=>import(`./ConnectorsPane-CtDroHfp.js`).then(e=>({default:e.ConnectorsPane})),__vite__mapDeps([0,1,2,3]),import.meta.url)),oD=(0,R.lazy)(()=>iD(()=>import(`./AdvancedSettings-D7jNZncZ.js`).then(e=>({default:e.AdvancedSettings})),__vite__mapDeps([4,1,2,5]),import.meta.url)),sD=[{id:`general`,label:`General`},{id:`model`,label:`Model`},{id:`permissions`,label:`Permissions`},{id:`skills`,label:`Skills`},{id:`connectors`,label:`Connectors`},{id:`memory`,label:`Memory`},{id:`notifications`,label:`Notifications`},{id:`privacy`,label:`Privacy`},{id:`advanced`,label:`Advanced`}];function cD({onUseSkill:e}){let t=z(e=>e.settingsSection),n=z(e=>e.openSettings),r=z(e=>e.closeSettings),i=(0,R.useRef)(null),a=(0,R.useRef)(null),o=t!==null;if(c(o,r),Ob(i,o),(0,R.useEffect)(()=>{if(o)return a.current=document.activeElement,()=>{a.current?.focus?.()}},[o,r]),(0,R.useEffect)(()=>{o&&i.current?.querySelector(`.settings-nav-item.is-active`)?.focus()},[o]),!t)return null;let s=(()=>{switch(t){case`general`:return(0,B.jsx)(YT,{});case`model`:return(0,B.jsx)(nE,{});case`permissions`:return(0,B.jsx)(rE,{});case`skills`:return(0,B.jsx)(iE,{onUseSkill:t=>{r(),e(t)}});case`connectors`:return(0,B.jsx)(aD,{});case`memory`:return(0,B.jsx)(VE,{});case`notifications`:return(0,B.jsx)(QE,{});case`privacy`:return(0,B.jsx)(qE,{});case`advanced`:return(0,B.jsx)(oD,{})}})();return(0,B.jsx)(`div`,{className:`settings-overlay`,onMouseDown:e=>{e.target===e.currentTarget&&r()},children:(0,B.jsxs)(`div`,{ref:i,className:`settings-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":`Settings`,children:[(0,B.jsxs)(`nav`,{className:`settings-nav`,"aria-label":`Settings sections`,children:[(0,B.jsx)(`h1`,{className:`settings-nav-title`,children:`Settings`}),sD.map(e=>(0,B.jsx)(`button`,{type:`button`,"data-section":e.id,className:`settings-nav-item${t===e.id?` is-active`:``}`,"aria-current":t===e.id?`page`:void 0,onClick:t=>{t.currentTarget.focus(),n(e.id)},children:e.label},e.id))]}),(0,B.jsxs)(`div`,{className:`settings-body`,children:[(0,B.jsx)(`button`,{type:`button`,className:`settings-close`,onClick:r,"aria-label":`Close settings`,children:(0,B.jsx)(Fn,{size:18})}),(0,B.jsx)(R.Suspense,{fallback:(0,B.jsxs)(`p`,{className:`settings-hint`,children:[(0,B.jsx)(L,{size:13,className:`spin`}),` Loading…`]}),children:s})]})]})})}function lD(e,t){let[n,r]=(0,R.useState)(!1),[i,a]=(0,R.useState)(!1),o=(0,R.useRef)(null),s=(0,R.useRef)(null),c=(0,R.useRef)(null),l=(0,R.useCallback)(()=>{o.current&&=(clearTimeout(o.current),null),s.current&&=(clearTimeout(s.current),null),c.current&&=(clearInterval(c.current),null)},[]);(0,R.useEffect)(()=>l,[l]);let d=(0,R.useCallback)((e,t)=>{c.current&&clearInterval(c.current),c.current=setInterval(async()=>{try{let n=await ji();t===`load`?n.model_loaded?.toLowerCase()===e.toLowerCase()&&(r(!1),o.current&&=(clearTimeout(o.current),null),c.current&&=(clearInterval(c.current),null)):(n.model_downloaded===!0||n.model_loaded?.toLowerCase()===e.toLowerCase())&&(a(!1),s.current&&=(clearTimeout(s.current),null),c.current&&=(clearInterval(c.current),null))}catch{}},Jw)},[]),f=e??`Gemma-4-E4B-it-GGUF`;return{isLoadingModel:n,isDownloadingModel:i,loadModel:(0,R.useCallback)(async(e,t)=>{let n=e??f,i=t??32768;r(!0);try{if(!await zi(n,i)){r(!1);return}u.system.info(`Load model triggered: ${n} (ctx=${i})`),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>r(!1),Kw),d(n,`load`)}catch(e){u.system.error(`Failed to trigger model load`,e),r(!1)}},[f,t,d]),downloadModel:(0,R.useCallback)(async(e=!1,t)=>{let n=t??f;a(!0);try{await Bi(n,e),u.system.info(`Download model triggered: ${n} (force=${e})`),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>a(!1),qw),d(n,`download`)}catch(e){u.system.error(`Failed to trigger model download`,e),a(!1)}},[f,d])}}var uD=5e3,dD=2e3,fD=3e4,pD=6e4;function mD(e){return e.lemonade_running?`up`:e.lemonade_error?`unresponsive`:`down`}function hD(e){return e.kind===`slow`||e.kind===`error`||e.kind===`ok`&&mD(e.status)===`unresponsive`}function gD(e){let t=e.kind===`ok`?e.status.download_progress?.state:void 0;return t===`downloading`||t===`starting`}function _D(e){let t=null,n=0,r=!1,i=null,a=0,o=null,s=async()=>{let e={controller:new AbortController,cancelled:!1};o=e;let{controller:t}=e,n=setTimeout(()=>t.abort(),pD);try{return{kind:`ok`,status:await ji(t.signal)}}catch(n){if(e.cancelled)return null;if(t.signal.aborted)return{kind:`slow`};let r=n?.httpStatus;return r===504?{kind:`slow`}:n?.name===`ApiError`&&typeof r==`number`&&r!==502?{kind:`error`,httpStatus:r,message:n.message}:{kind:`unreachable`,error:n}}finally{clearTimeout(n),o===e&&(o=null)}},c=()=>{if(t)return t;let i=s().then(t=>{if(t!==null){n=hD(t)?n+1:0,r=gD(t);try{e(t)}catch(e){u.system.error(`Could not apply the system status; the next poll will try again`,e)}}}).finally(()=>{t===i&&(t=null)});return t=i,i},l=()=>Math.min((r?dD:uD)*2**n,fD),d=e=>{c().finally(()=>{e===a&&(i=setTimeout(()=>d(e),l()))})};return{check:c,start:()=>{let e=++a;return d(e),()=>{e===a&&(a++,i&&clearTimeout(i),i=null,o&&(o.cancelled=!0,o.controller.abort(),o=null,t=null))}}}}function vD({onRetry:e,label:t}){let[n,r]=(0,R.useState)(!1);return(0,B.jsx)(`button`,{className:`connection-banner__retry`,onClick:()=>{r(!0),Promise.resolve(e()).finally(()=>r(!1))},disabled:n,children:n?`Checking…`:t})}function yD({onRetry:e,backendSlow:t=!1,backendError:n=null}){let{backendConnected:r,systemStatus:i,currentSessionId:a,messages:o}=z(),[s,c]=(0,R.useState)(!1),l=!!a&&o.length>0,u=i?.default_model_name??`Gemma-4-E4B-it-GGUF`,{isDownloadingModel:d,downloadModel:f}=lD(u),p=(0,R.useRef)(i?.lemonade_running),m=(0,R.useRef)(i?.model_downloaded),h=(0,R.useRef)(i?.context_size_sufficient),g=(0,R.useRef)(i?.expected_model_loaded);(0,R.useEffect)(()=>{if(l)return;let e=i?.lemonade_running,t=i?.model_downloaded,n=i?.context_size_sufficient,r=i?.expected_model_loaded,a=!1;p.current!==e&&(p.current=e,e===!1&&(a=!0)),m.current!==t&&(m.current=t,t===!1&&(a=!0)),h.current!==n&&(h.current=n,n===!1&&(a=!0)),g.current!==r&&(g.current=r,r===!1&&(a=!0)),a&&c(!1)},[i,l]);let _=i?.download_progress??null,v=_?.model_name||u;if(d||_?.state===`downloading`||_?.state===`starting`||_?.state===`error`){let e=_?.total_bytes?`${(_.total_bytes/1e9).toFixed(1)} GB`:`large download`,t=_?.state===`error`;return(0,B.jsxs)(`div`,{className:`connection-banner ${t?`connection-banner--error`:`connection-banner--warning`}`,role:t?`alert`:`status`,children:[(0,B.jsx)(`div`,{className:`connection-banner__icon`,children:t?(0,B.jsx)(Tn,{size:16}):(0,B.jsx)(Fe,{size:16})}),(0,B.jsx)(`div`,{className:`connection-banner__text`,children:t?(0,B.jsxs)(B.Fragment,{children:[`Download of `,(0,B.jsx)(`strong`,{children:v}),` failed.`,` `,_?.message&&(0,B.jsx)(`span`,{className:`connection-banner__hint`,children:_.message})]}):(0,B.jsxs)(B.Fragment,{children:[`Downloading `,(0,B.jsx)(`strong`,{children:v}),` (`,e,`).`,_?.state===`downloading`&&_.file&&(0,B.jsxs)(B.Fragment,{children:[` `,(0,B.jsxs)(`span`,{className:`connection-banner__hint`,children:[`File `,_.file_index,` / `,_.total_files,`: `,(0,B.jsx)(`code`,{children:_.file})]})]})]})}),t?(0,B.jsx)(`button`,{className:`connection-banner__retry`,onClick:()=>f(!1,v),children:`Retry`}):(0,B.jsx)(`span`,{className:`connection-banner__loading connection-banner__progress`,children:_&&_.state===`downloading`&&_.total_bytes>0?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`connection-banner__progress-bar`,role:`progressbar`,"aria-valuenow":_.percent,"aria-valuemin":0,"aria-valuemax":100,"aria-label":`Download progress`,children:(0,B.jsx)(`span`,{className:`connection-banner__progress-fill`,style:{width:`${_.percent}%`}})}),(0,B.jsxs)(`span`,{className:`connection-banner__progress-label`,children:[_.percent,`% ·`,` `,(_.downloaded_bytes/1e9).toFixed(2),` /`,` `,(_.total_bytes/1e9).toFixed(2),` GB`]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(L,{size:13,className:`connection-banner__spinner`}),_?.state===`starting`?`Starting download…`:`Downloading…`]})}),t&&(0,B.jsx)(`button`,{className:`connection-banner__dismiss`,onClick:()=>c(!0),"aria-label":`Dismiss`,children:(0,B.jsx)(Fn,{size:14})})]})}if(i?.init_state===`initializing`){let e=i.init_tasks?.find(e=>e.status===`running`)?.name||`Preparing AI system`;return(0,B.jsxs)(`div`,{className:`connection-banner connection-banner--init`,role:`status`,children:[(0,B.jsx)(`div`,{className:`connection-banner__icon`,children:(0,B.jsx)(L,{size:16,className:`connection-banner__spinner`})}),(0,B.jsxs)(`div`,{className:`connection-banner__text`,children:[e,(0,B.jsxs)(`span`,{className:`thinking-dots`,children:[(0,B.jsx)(`span`,{children:`.`}),(0,B.jsx)(`span`,{children:`.`}),(0,B.jsx)(`span`,{children:`.`})]})]})]})}if(s||l)return null;if(!r)return(0,B.jsxs)(`div`,{className:`connection-banner connection-banner--error`,role:`alert`,children:[(0,B.jsx)(`div`,{className:`connection-banner__icon`,children:(0,B.jsx)(jn,{size:16})}),(0,B.jsxs)(`div`,{className:`connection-banner__text`,children:[`Lost the connection to GAIA.`,` `,(0,B.jsx)(`span`,{className:`connection-banner__hint`,children:`Check that GAIA is still running, then retry.`})]}),e&&(0,B.jsx)(vD,{onRetry:e,label:`Retry`})]});if(n)return(0,B.jsxs)(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[(0,B.jsx)(`div`,{className:`connection-banner__icon`,children:(0,B.jsx)(Tn,{size:16})}),(0,B.jsxs)(`div`,{className:`connection-banner__text`,children:[`GAIA's backend answered with an error (`,n,`).`,` `,(0,B.jsx)(`span`,{className:`connection-banner__hint`,children:`It may be overloaded. GAIA keeps checking; if it lasts, restart GAIA.`})]}),e&&(0,B.jsx)(vD,{onRetry:e,label:`Check again`})]});if(t)return(0,B.jsxs)(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[(0,B.jsx)(`div`,{className:`connection-banner__icon`,children:(0,B.jsx)(Tn,{size:16})}),(0,B.jsxs)(`div`,{className:`connection-banner__text`,children:[`GAIA is slow to answer.`,` `,(0,B.jsx)(`span`,{className:`connection-banner__hint`,children:`It may be busy with another chat or app. GAIA keeps checking.`})]}),e&&(0,B.jsx)(vD,{onRetry:e,label:`Check again`})]});if(i?.config_error)return(0,B.jsxs)(`div`,{className:`connection-banner connection-banner--error`,role:`alert`,children:[(0,B.jsx)(`div`,{className:`connection-banner__icon`,children:(0,B.jsx)(Tn,{size:16})}),(0,B.jsxs)(`div`,{className:`connection-banner__text`,children:[`GAIA settings could not be loaded.`,` `,(0,B.jsx)(`span`,{className:`connection-banner__hint`,children:i.config_error})]}),e&&(0,B.jsx)(vD,{onRetry:e,label:`Check again`})]});if(i&&!i.lemonade_running){let t=mD(i)===`unresponsive`;return(0,B.jsxs)(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[(0,B.jsx)(`div`,{className:`connection-banner__icon`,children:(0,B.jsx)(Tn,{size:16})}),(0,B.jsxs)(`div`,{className:`connection-banner__text`,children:[t?`The model server is not answering (${i.lemonade_error}). It may be busy with another app or loading a model.`:`The model server stopped responding.`,` `,i.start_command?(0,B.jsxs)(`span`,{className:`connection-banner__hint`,children:[t?`If it stays this way, restart it: `:`To start it by hand, run `,(0,B.jsx)(`code`,{children:i.start_command})]}):i.start_instruction&&(0,B.jsx)(`span`,{className:`connection-banner__hint`,children:i.start_instruction})]}),e&&(0,B.jsx)(vD,{onRetry:e,label:`Check again`}),(0,B.jsx)(`button`,{className:`connection-banner__dismiss`,onClick:()=>c(!0),"aria-label":`Dismiss`,children:(0,B.jsx)(Fn,{size:14})})]})}if(i&&i.lemonade_running&&i.model_loaded&&i.context_size_sufficient===!1){let t=i.model_context_size??0;return(0,B.jsxs)(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[(0,B.jsx)(`div`,{className:`connection-banner__icon`,children:(0,B.jsx)(xt,{size:16})}),(0,B.jsxs)(`div`,{className:`connection-banner__text`,children:[`LLM context window is too small (`,t.toLocaleString(),` tokens;`,` `,Ww.toLocaleString(),` required).`,` `,(0,B.jsx)(`span`,{className:`connection-banner__hint`,children:`Reload it with a larger context in Settings → Advanced.`})]}),e&&(0,B.jsx)(vD,{onRetry:e,label:`Check again`}),(0,B.jsx)(`button`,{className:`connection-banner__dismiss`,onClick:()=>c(!0),"aria-label":`Dismiss`,children:(0,B.jsx)(Fn,{size:14})})]})}return null}var bD={status:`idle`,version:null,progress:0,releaseNotes:null,error:null,currentVersion:null,pinnedVersion:null};function xD(){let[e,t]=(0,R.useState)({...bD});return(0,R.useEffect)(()=>{let e=window.gaiaUpdater;if(!e)return;let n=!0;e.getStatus().then(e=>{n&&e&&t(e)}).catch(()=>{});let r=e.onStatusChange(e=>{n&&e&&t(e)});return()=>{n=!1;try{r()}catch{}}},[]),e}function SD(){let e=xD(),[t,n]=(0,R.useState)(!1),r=(0,R.useCallback)(()=>{window.gaiaUpdater?.check().catch(()=>{})},[]);if(t||e.status===`idle`||e.status===`checking`||e.status===`disabled`)return null;if(e.status===`downloading`){let t=Math.max(0,Math.min(100,e.progress));return(0,B.jsxs)(`div`,{className:`update-chip update-chip--downloading`,role:`status`,"aria-live":`polite`,title:`Downloading update${e.version?` ${e.version}`:``}…`,children:[(0,B.jsx)(Fe,{size:13,className:`update-chip__icon`}),(0,B.jsxs)(`span`,{className:`update-chip__label`,children:[`Downloading update… `,t,`%`]})]})}return e.status===`available`?(0,B.jsxs)(`div`,{className:`update-chip update-chip--available`,role:`status`,title:e.releaseNotes||`A new version is available.`,children:[(0,B.jsx)(Fe,{size:13,className:`update-chip__icon`}),(0,B.jsxs)(`span`,{className:`update-chip__label`,children:[`Update available`,e.version?`: ${e.version}`:``]}),(0,B.jsx)(`button`,{type:`button`,className:`update-chip__dismiss`,onClick:()=>n(!0),"aria-label":`Dismiss update notification`,children:(0,B.jsx)(Fn,{size:11})})]}):e.status===`downloaded`?(0,B.jsxs)(`div`,{className:`update-chip update-chip--ready`,role:`status`,"aria-live":`polite`,children:[(0,B.jsx)(Qt,{size:13,className:`update-chip__icon`}),(0,B.jsx)(`button`,{type:`button`,className:`update-chip__action`,onClick:r,title:`Click to restart and apply the update`,children:`Update ready — restart to apply`})]}):e.status===`error`?(0,B.jsxs)(`div`,{className:`update-chip update-chip--error`,role:`status`,title:e.error||`Update check failed.`,children:[(0,B.jsx)(Tn,{size:13,className:`update-chip__icon`}),(0,B.jsx)(`span`,{className:`update-chip__label`,children:`Update check failed`}),(0,B.jsx)(`button`,{type:`button`,className:`update-chip__dismiss`,onClick:()=>n(!0),"aria-label":`Dismiss update error`,children:(0,B.jsx)(Fn,{size:11})})]}):null}var CD={permission_request:{icon:(0,B.jsx)(sn,{size:16}),colorClass:`notif-type-permission`,label:`Permission`},policy_alert:{icon:(0,B.jsx)(sn,{size:16}),colorClass:`notif-type-policy`,label:`Policy`},security_alert:{icon:(0,B.jsx)(Tn,{size:16}),colorClass:`notif-type-security`,label:`Security`},status_change:{icon:(0,B.jsx)(F,{size:16}),colorClass:`notif-type-status`,label:`Status`},info:{icon:(0,B.jsx)(_t,{size:16}),colorClass:`notif-type-info`,label:`Info`},error:{icon:(0,B.jsx)(me,{size:16}),colorClass:`notif-type-error`,label:`Error`}};function wD(e){let t=Date.now()-e,n=Math.floor(t/1e3);if(n<60)return`just now`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);if(i<24)return`${i}h ago`;let a=Math.floor(i/24);return a<7?`${a}d ago`:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function TD({onClose:e}){let t=Cs(Wn(Ts)),n=Cs(ws),r=Cs(e=>e.markRead),i=Cs(e=>e.markAllRead),a=Cs(e=>e.clearAll),o=Cs(e=>e.dismiss),s=Cs(e=>e.respondToPermission),l=Cs(e=>e.typeFilter),u=Cs(e=>e.setTypeFilter),d=(0,R.useCallback)(e=>{r(e)},[r]),f=(0,R.useCallback)(e=>{s(e.id,`allow`).catch(e=>console.error(`[NotificationCenter] allow failed:`,e))},[s]),p=(0,R.useCallback)(e=>{s(e.id,`deny`).catch(e=>console.error(`[NotificationCenter] deny failed:`,e))},[s]);return c(!0,e),(0,B.jsxs)(`div`,{className:`notification-center`,role:`dialog`,"aria-label":`Notification Center`,children:[(0,B.jsxs)(`div`,{className:`notification-center-header`,children:[(0,B.jsxs)(`div`,{className:`notification-center-title-row`,children:[(0,B.jsx)(`h2`,{className:`notification-center-title`,children:`Notifications`}),n>0&&(0,B.jsx)(`span`,{className:`notification-center-badge`,children:n})]}),(0,B.jsx)(`button`,{className:`btn-icon notification-center-close`,onClick:e,"aria-label":`Close notification center`,children:(0,B.jsx)(Fn,{size:18})})]}),(0,B.jsx)(`div`,{className:`notification-filter-bar`,role:`tablist`,"aria-label":`Filter notifications`,children:[{key:null,label:`All`},{key:`permission_request`,label:`Permissions`},{key:`policy_alert`,label:`Policy`},{key:`error`,label:`Errors`},{key:`security_alert`,label:`Security`},{key:`status_change`,label:`Status`},{key:`info`,label:`Info`}].map(e=>(0,B.jsx)(`button`,{role:`tab`,"aria-selected":l===e.key,className:`notification-filter-tab ${l===e.key?`active`:``}`,onClick:()=>u(e.key),children:e.label},e.key??`all`))}),(0,B.jsx)(`div`,{className:`notification-list`,children:t.length===0?(0,B.jsxs)(`div`,{className:`notification-empty`,children:[(0,B.jsx)(O,{size:40,strokeWidth:1.2}),(0,B.jsx)(`span`,{children:`No notifications`})]}):t.map(e=>{let t=CD[e.type];return(0,B.jsxs)(`div`,{className:`notification-item ${e.read?``:`unread`} ${t.colorClass}`,id:e.type===`policy_alert`&&e.receiptId?`policy-receipt-${encodeURIComponent(e.receiptId)}`:void 0,onClick:()=>d(e.id),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&d(e.id)},children:[!e.read&&(0,B.jsx)(`span`,{className:`notification-unread-dot`}),(0,B.jsx)(`span`,{className:`notification-icon`,children:t.icon}),(0,B.jsxs)(`div`,{className:`notification-content`,children:[(0,B.jsxs)(`div`,{className:`notification-content-header`,children:[(0,B.jsx)(`span`,{className:`notification-agent`,children:e.agentName}),(0,B.jsx)(`span`,{className:`notification-time`,children:wD(e.timestamp)})]}),e.title&&(0,B.jsx)(`span`,{className:`notification-title`,children:e.title}),(0,B.jsx)(`span`,{className:`notification-message`,children:e.message}),e.type===`permission_request`&&e.tool&&e.tool!==`allow_path_access`&&(0,B.jsxs)(`span`,{className:`notification-tool`,children:[`Tool: `,(0,B.jsx)(`code`,{children:e.tool})]}),e.type===`policy_alert`&&(0,B.jsxs)(`div`,{className:`notification-policy-details`,children:[e.tool&&(0,B.jsxs)(`span`,{className:`notification-tool`,children:[`Tool: `,(0,B.jsx)(`code`,{children:e.tool})]}),e.reason&&(0,B.jsxs)(`span`,{className:`notification-policy-reason`,children:[`Reason: `,e.reason]}),e.ruleIds&&e.ruleIds.length>0&&(0,B.jsxs)(`span`,{className:`notification-tool`,children:[`Rules: `,(0,B.jsx)(`code`,{children:e.ruleIds.join(`, `)})]}),e.policyVersion&&(0,B.jsxs)(`span`,{className:`notification-tool`,children:[`Policy: `,(0,B.jsx)(`code`,{children:e.policyVersion})]}),(0,B.jsxs)(`span`,{className:`notification-tool`,children:[`Receipt:`,` `,e.receiptId?(0,B.jsx)(`code`,{children:e.receiptId}):(0,B.jsx)(`em`,{children:`Receipt unavailable`})]})]}),e.type===`permission_request`&&!e.response&&(0,B.jsxs)(`div`,{className:`notification-actions`,children:[(0,B.jsxs)(`button`,{className:`notification-action-btn notification-action-allow`,onClick:t=>{t.stopPropagation(),f(e)},children:[(0,B.jsx)(oe,{size:14}),`Approve`]}),(0,B.jsxs)(`button`,{className:`notification-action-btn notification-action-deny`,onClick:t=>{t.stopPropagation(),p(e)},children:[(0,B.jsx)(Fn,{size:14}),`Deny`]})]}),e.type===`permission_request`&&e.response&&(0,B.jsx)(`span`,{className:`notification-response-badge ${e.response===`allow`?`response-allow`:`response-deny`}`,children:e.response===`allow`?`Approved`:`Denied`})]}),(0,B.jsx)(`button`,{className:`notification-dismiss`,onClick:t=>{t.stopPropagation(),o(e.id)},"aria-label":`Dismiss notification`,children:(0,B.jsx)(Fn,{size:14})})]},e.id)})}),t.length>0&&(0,B.jsxs)(`div`,{className:`notification-center-footer`,children:[(0,B.jsxs)(`button`,{className:`notification-footer-btn`,onClick:i,disabled:n===0,children:[(0,B.jsx)(oe,{size:14}),`Mark All Read`]}),(0,B.jsxs)(`button`,{className:`notification-footer-btn notification-footer-clear`,onClick:a,children:[(0,B.jsx)(Cn,{size:14}),`Clear`]})]})]})}var ED=1500,DD=e=>new Promise(t=>setTimeout(t,e));async function OD({onProgress:e,isCancelled:t=()=>!1,pollMs:n=ED}={}){try{await Hi(zw)}catch(e){if(e?.httpStatus!==409)throw e;let t=await Ui(zw).catch(()=>null);if(!t||t.status===`completed`||t.status===`failed`)throw e}for(;!t();){let t=await Ui(zw);if(e?.(t),t.status===`completed`)return;if(t.status===`failed`)throw Error(t.error||`The GAIA agent could not be installed.`);await DD(n)}}function kD({onInstalled:e}){let[t,n]=(0,R.useState)({kind:`idle`}),r=(0,R.useRef)(!1);(0,R.useEffect)(()=>()=>{r.current=!0},[]);let i=(0,R.useCallback)(async()=>{n({kind:`installing`,percent:0});try{if(await OD({isCancelled:()=>r.current,onProgress:e=>{r.current||n({kind:`installing`,percent:e.percent??0})}}),r.current)return;await e(),r.current||n({kind:`idle`})}catch(e){r.current||n({kind:`failed`,error:e instanceof Error?e.message:String(e)})}},[e]);return(0,B.jsxs)(`div`,{className:`app-notice is-warning`,role:`status`,children:[t.kind===`installing`?(0,B.jsxs)(`span`,{children:[`Installing the GAIA agent… `,Math.round(t.percent),`%`]}):t.kind===`failed`?(0,B.jsxs)(`span`,{children:[`The GAIA agent could not be installed: `,t.error]}):(0,B.jsx)(`span`,{children:`The GAIA agent isn't installed, so new chats can't start yet.`}),t.kind!==`installing`&&(0,B.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>void i(),children:t.kind===`failed`?`Try again`:`Install GAIA agent`})]})}function AD(e,t){if(!(e instanceof Error))return t;let n=e.message,r=n.match(/API \d+: (.+)/);if(r)try{let e=JSON.parse(r[1]);if(e.detail)return e.detail}catch{}return n}function jD(e,t){let{addNotification:n}=Cs.getState();for(let r of t)r.error_count<=(e[r.id]??0)||!r.last_error||n({id:`schedule-error-${r.id}-${r.error_count}`,type:`error`,agentId:`scheduler`,agentName:`GAIA`,title:`Scheduled task "${r.name}" failed`,message:r.last_error,timestamp:Date.now(),read:!1,dismissed:!1,priority:`high`,...r.session_id?{sessionId:r.session_id}:{}})}var MD=Xn((e,t)=>({schedules:[],loading:!1,error:null,selectedSchedule:null,results:[],resultsLoading:!1,errorCounts:null,loadSchedules:async()=>{t().schedules.length===0&&!t().error&&e({loading:!0}),e({error:null});try{let n=(await fo()).schedules||[],r=t().errorCounts;r&&jD(r,n),e({schedules:n,loading:!1,errorCounts:Object.fromEntries(n.map(e=>[e.id,e.error_count]))})}catch(t){u.api.error(`Failed to load schedules`,t),e({error:`Failed to load schedules`,loading:!1})}},createSchedule:async(t,n,r)=>{try{let i=await mo(t,n,r);e(e=>({schedules:[...e.schedules,i],error:null}))}catch(t){let n=AD(t,`Failed to create schedule`);throw u.api.error(`Failed to create schedule`,t),e({error:n}),t}},updateScheduleStatus:async(t,n)=>{try{let r=await ho(t,n);e(e=>({schedules:e.schedules.map(e=>e.name===t?r:e),error:null}))}catch(n){u.api.error(`Failed to update schedule "${t}"`,n),e({error:AD(n,`Failed to update schedule`)})}},deleteSchedule:async t=>{try{await go(t),e(e=>({schedules:e.schedules.filter(e=>e.name!==t),selectedSchedule:e.selectedSchedule===t?null:e.selectedSchedule,error:null}))}catch(n){u.api.error(`Failed to delete schedule "${t}"`,n),e({error:AD(n,`Failed to delete schedule`)})}},selectSchedule:n=>{e({selectedSchedule:n,results:[]}),n&&t().loadResults(n)},loadResults:async t=>{e({resultsLoading:!0});try{e({results:(await _o(t)).results||[],resultsLoading:!1})}catch(n){u.api.error(`Failed to load results for "${t}"`,n),e({results:[],resultsLoading:!1})}}})),ND=new Set([`loading_model`,`downloading_model`,`model_retry`,`waiting`]),PD=5;function FD(e,t){return{id:e,title:t.get(e)?.title??`Untitled chat`}}function ID(e){let t=new Map(e.sessions.map(e=>[e.id,e])),n=e.isStreaming&&e.currentSessionId!==null,r=[...e.runningSessionIds];n&&!r.includes(e.currentSessionId)&&r.push(e.currentSessionId);let i=new Set(r),a=new Set(e.notifications.filter(e=>e.type===`permission_request`&&!e.response&&!e.dismissed&&e.sessionId&&i.has(e.sessionId)).map(e=>e.sessionId)),o=[...a].map(e=>({...FD(e,t),reason:`approval`}));n&&e.awaitingUser&&!a.has(e.currentSessionId)&&o.push({...FD(e.currentSessionId,t),reason:`answer`});let s=n&&!e.awaitingUser&&e.livePhase&&ND.has(e.livePhase)?e.liveStatus:null,c=e.systemStatus,l=null;if(c?.default_model_is_cloud&&c.default_model_name)l={name:c.default_model_name,where:`cloud`};else if(c?.model_loaded){let e=c.model_labels?.includes(`cloud`),t=c.model_device&&c.model_device!==`none`?c.model_device:null;l={name:c.model_loaded,where:e?`cloud`:t}}let u=[...e.sessions].sort((e,t)=>t.updated_at.localeCompare(e.updated_at)).slice(0,PD).map(e=>FD(e.id,t));return{backendConnected:e.backendConnected,modelServerRunning:c&&!c.default_model_is_cloud?c.lemonade_running:null,model:l,waitingOnModel:s||null,running:r.map(e=>FD(e,t)),needsYou:o,recent:u}}function LD(e){let t=(0,R.useRef)(e);t.current=e,(0,R.useEffect)(()=>{let e=window.gaiaAPI?.tray;if(!e)return;let n=``,r=null,i=()=>{let t=z.getState(),i={backendConnected:t.backendConnected,systemStatus:t.systemStatus,sessions:t.sessions,runningSessionIds:t.runningSessionIds,currentSessionId:t.currentSessionId,isStreaming:t.isStreaming,awaitingUser:t.awaitingUser,liveStatus:t.liveStatus,livePhase:t.livePhase,notifications:Cs.getState().notifications},a=r;if(r=i,a&&Object.keys(i).every(e=>i[e]===a[e]))return;let o=ID(i),s=JSON.stringify(o);s!==n&&(n=s,e.setActivity(o).catch(e=>{n=``,u.system.error(`The tray could not take the app state`,e)}))};i();let a=z.subscribe(i),o=Cs.subscribe(i),s=e.onCommand(e=>{switch(e.type){case`open-chat`:t.current.openChat(e.sessionId);break;case`new-chat`:t.current.newChat();break;case`open-settings`:z.getState().openSettings(e.section);break;case`refresh-status`:t.current.refreshStatus();break;default:u.system.error(`Unknown tray command`,e)}});return()=>{a(),o(),s()}},[])}function RD(){(0,R.useEffect)(()=>{let e=window.gaiaAPI;if(!e)return;let t=Cs.getState().addNotification,n=[e.notification.onNotification(t),e.notification.onPermissionRequest(t),e.tray.onNavigate(e=>{let t=typeof e==`string`&&e.startsWith(`session:`)?e.slice(8):null;if(!t)return;let n=z.getState();n.currentSessionId!==t&&n.setMessages([]),n.setCurrentSession(t)})];return()=>n.forEach(e=>e())},[])}function zD(e,t,n){let r=window.gaiaAPI;if(r){r.notification.show({title:t,body:n,sessionId:e}).then(e=>{e||u.system.warn(`This OS has no desktop notifications; the badge still counts it.`)}).catch(e=>u.system.error(`Could not show the desktop notification`,e));return}if(typeof Notification>`u`){u.system.warn(`This browser has no notifications; the alert was not shown.`);return}if(Notification.permission!==`granted`){u.system.warn(`Browser notifications are ${Notification.permission}; allow them in Settings → Notifications.`);return}let i=new Notification(t,{body:n,tag:`gaia-${e}`});i.onclick=()=>{window.focus(),z.getState().setCurrentSession(e)}}function BD(){let[e,t]=(0,R.useState)(null);return(0,R.useEffect)(()=>{let e=navigator;if(!e.getBattery)return;let n=null,r=()=>{n&&t({charging:n.charging,level:n.level})};return e.getBattery().then(e=>{n=e,r(),e.addEventListener(`levelchange`,r),e.addEventListener(`chargingchange`,r)}).catch(e=>u.system.warn(`Battery level unavailable; keep-awake ignores the battery policy.`,e)),()=>{n?.removeEventListener(`levelchange`,r),n?.removeEventListener(`chargingchange`,r)}},[]),e}function VD(){RD();let e=z(e=>e.runningSessionIds),t=z(e=>e.awaitingBySession),n=z(e=>e.sessions),r=z(e=>e.currentSessionId),i=Cs(Wn(Ds)),a=Ps(),o=BD(),s=(0,R.useRef)(null),c=Vs(e,t,i),l=JSON.stringify(c);(0,R.useEffect)(()=>{let e=JSON.parse(l),t=s.current;if(s.current=e,t===null)return;let{sessions:n,currentSessionId:r}=z.getState(),i=document.hasFocus(),o=!1;for(let{sessionId:s,event:c}of Hs(t,e)){let e=n.find(e=>e.id===s);if(e?.kind===`eval`||e?.kind===`scheduled`)continue;let t=a.modes[c];if(!(t===`off`||Gs(s,r,i))&&(o=!0,t===`banner`)){if(c!==`finished`){let{title:t,body:n}=Ws(c,e);zD(s,t,n)}else ba(s).then(e=>{z.getState().updateSessionInList(s,e);let{title:t,body:n}=Ws(c,e);zD(s,t,n)}).catch(t=>{u.system.error(`Could not read how chat ${s} ended`,t);let{title:n,body:r}=Ws(c,{...e,last_run_status:null});zD(s,n,r)})}}if(o){if(a.sound)try{Js()}catch(e){u.system.warn(`Alert sound not played`,e)}a.flash&&!i&&window.gaiaAPI&&window.gaiaAPI.notification.flash().catch(e=>u.system.error(`Could not flash the taskbar button`,e))}},[l,a.modes,a.sound,a.flash]);let d=Ks(n,c,a.modes,r);(0,R.useEffect)(()=>{window.gaiaAPI?.notification.setAttentionCount(d).catch(e=>u.system.error(`Could not update the taskbar badge`,e))},[d]);let f=a.keepAwake&&e.length>0&&qs(o,a.batteryFloor);(0,R.useEffect)(()=>{window.gaiaAPI?.power.setKeepAwake(f).catch(e=>u.system.error(`Could not change keep-awake`,e))},[f])}function HD(e){if(e<=0)return`0 B`;let t=1024,n=[`B`,`KB`,`MB`,`GB`],r=Math.min(Math.floor(Math.log(e)/Math.log(t)),n.length-1);return parseFloat((e/t**r).toFixed(1))+` `+n[r]}function UD(e){return e.replace(/-/g,``).slice(0,7)}function WD(e,t){let n=t.replace(/^#/,``).toLowerCase();if(!n||n.length<4)return null;let r=e.find(e=>e.id.replace(/-/g,``).toLowerCase().startsWith(n));return r?r.id:null}function GD(e,t,n){return!e||t&&(e===t||e===UD(t))?null:n.some(t=>t.id===e)?e:WD(n,e)}function KD(e){return new URLSearchParams(e.search).get(`session`)||e.hash.replace(/^#/,``)||null}var qD=1e3,JD=3e4;function YD(e,{initialMs:t=qD,maxMs:n=JD,onError:r}={}){let i=t,a=0,o=null,s=!1,c=!1,l=!1,u=()=>{l||c||s||(o&&=(clearTimeout(o),null),s=!0,a+=1,e().then(()=>{c=!0}).catch(e=>{l||(r?.(e,a),o=setTimeout(()=>{o=null,u()},i),i=Math.min(i*2,n))}).finally(()=>{s=!1}))};return u(),{kick:()=>{o&&u()},stop:()=>{l=!0,o&&clearTimeout(o),o=null},done:()=>c}}var XD=(0,R.lazy)(()=>iD(()=>import(`./MemoryDashboard-Cxr_1R_c.js`).then(e=>({default:e.MemoryDashboard})),__vite__mapDeps([6,1,2,7,8,9]),import.meta.url)),ZD=(0,R.lazy)(()=>iD(()=>import(`./ScheduleManager-DgFrZse_.js`).then(e=>({default:e.ScheduleManager})),__vite__mapDeps([10,1,2,8,11]),import.meta.url)),QD=(0,R.lazy)(()=>iD(()=>import(`./DocumentLibrary-gE-tZarr.js`).then(e=>({default:e.DocumentLibrary})),__vite__mapDeps([12,1,2,13]),import.meta.url)),$D=(0,R.lazy)(()=>iD(()=>import(`./FileBrowser-CUJCMcVf.js`).then(e=>({default:e.FileBrowser})),__vite__mapDeps([14,1,2,7,15]),import.meta.url)),eO=(0,R.lazy)(()=>iD(()=>import(`./MobileAccessModal-CUqaV_OH.js`).then(e=>({default:e.MobileAccessModal})),__vite__mapDeps([16,1,2,17]),import.meta.url)),tO=3,nO=3e5,rO=6e3;function iO(){return(0,B.jsx)(`div`,{className:`loading-spinner`,role:`status`,"aria-label":`Loading`})}var aO=e=>e===1||e%10==0;function oO(){let e=z(e=>e.currentSessionId),t=z(e=>e.setSessions),n=z(e=>e.setCurrentSession),r=z(e=>e.addSession),a=z(e=>e.setMessages),o=z(e=>e.resetStreaming),s=z(e=>e.showDocLibrary),c=z(e=>e.showFileBrowser),l=z(e=>e.showMemoryDashboard),f=z(e=>e.showSchedules),p=z(e=>e.sidebarOpen),m=z(e=>e.setSidebarOpen),h=z(e=>e.setSystemStatus),g=z(e=>e.setBackendConnected),_=z(e=>e.setAgents),v=z(e=>e.agents),y=z(e=>e.setPendingPrompt),b=z(e=>e.setDefaultPermissionMode),x=z(e=>e.openSettings),S=z(e=>e.settingsSection),C=z(e=>e.syncSystemTheme),w=Wo(e=>e.restoreNotice),T=Wo(e=>e.dismissRestoreNotice),E=Cs(e=>e.showPanel),D=z(e=>e.systemStatus?.initialized===!0),O=Cs(e=>e.setShowPanel);(0,R.useEffect)(()=>{if(!w?.ok)return;let e=setTimeout(T,rO);return()=>clearTimeout(e)},[w,T]);let[k,A]=(0,R.useState)({state:`checking`}),j=(0,R.useRef)(k);j.current=k;let[M,ee]=(0,R.useState)(!1),te=(0,R.useRef)(M);te.current=M;let[N,ne]=(0,R.useState)(!1),re=N||M&&!Bw(v),ie=(0,R.useRef)(re);ie.current=re;let[ae,oe]=(0,R.useState)(null),[se,ce]=(0,R.useState)(``),[le,ue]=(0,R.useState)(0),[de,fe]=(0,R.useState)(!1),[pe,me]=(0,R.useState)(!1),[he,ge]=(0,R.useState)(null),P=(0,R.useCallback)(async(e=!1)=>{e||A({state:`checking`});try{await Wo.getState().refresh();let e=Wo.getState().active,t=await Gi(!!e?.remote);A(t.ready?{state:`ready`}:{state:`needed`,check:t})}catch(e){let t=e instanceof Error?e.message:String(e);u.system.warn(`Setup check could not be answered`,e),A({state:`unknown`,error:t})}},[]),F=(0,R.useRef)(0),I=(0,R.useCallback)(async()=>{let e=++F.current,t=(await Vi()).agents||[];e===F.current&&(_(t),ee(!0),Bw(t)&&ne(!1))},[_]),_e=(0,R.useCallback)(()=>{let e=te.current;ee(!1),I().catch(t=>{u.api.warn(`Agent list unavailable after setup`,t),e&&ee(!0)})},[I]);(0,R.useEffect)(()=>{let e=()=>{ie.current&&I().catch(e=>u.api.warn(`Agent list unavailable`,e))};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[I]);let ve=(0,R.useCallback)(async()=>{b((await _i()).default_mode)},[b]),ye=(0,R.useRef)([]);(0,R.useEffect)(()=>{i(`0.25.1`),P();let e=[YD(I,{onError:(e,t)=>{aO(t)&&u.api.warn(`Agent list unavailable (attempt ${t}); retrying`,e)}}),YD(ve,{onError:(e,t)=>{aO(t)&&u.api.warn(`Default permission mode unavailable (attempt ${t}); retrying`,e)}})];return ye.current=e,()=>e.forEach(e=>e.stop())},[P,I,ve]);let be=(0,R.useCallback)(()=>{ye.current.forEach(e=>e.kick()),Wo.getState().retryNow(),j.current.state===`unknown`&&P(!0)},[P]),xe=(0,R.useRef)(be);xe.current=be;let Se=(0,R.useRef)(0),Ce=(0,R.useRef)(0),we=(0,R.useRef)(null),Te=(0,R.useRef)(!1),[Ee,De]=(0,R.useState)(!1),[Oe,ke]=(0,R.useState)(null),Ae=(0,R.useCallback)(e=>{if(e.kind===`unreachable`){u.system.warn(`System status check failed`,e.error),Te.current=!0,Ce.current=0,we.current=null,De(!1),ke(null),g(!1),h(null);return}if(e.kind===`error`){u.system.warn(`System status answered HTTP ${e.httpStatus}`,e.message),Te.current&&xe.current(),Te.current=!1,Ce.current=0,we.current=null,De(!1),ke(`HTTP ${e.httpStatus}: ${e.message}`),g(!0);return}if(e.kind===`slow`){if(Ce.current+=1,we.current??=Date.now(),ke(null),u.system.warn(`System status did not answer in time (${Ce.current} in a row)`),Date.now()-we.current>=nO){De(!1),g(!1),h(null);return}g(!0),(Te.current||Ce.current>=tO)&&De(!0);return}let{status:t}=e;Te.current&&xe.current(),Te.current=!1,Ce.current=0,we.current=null,De(!1),ke(null),g(!0),Se.current=t.lemonade_running?0:Se.current+1;let n=z.getState().systemStatus;t.lemonade_running||Se.current>=tO||!n?.lemonade_running?h(t):h({...n,download_progress:t.download_progress})},[g,h]),je=(0,R.useRef)(Ae);je.current=Ae;let[Me]=(0,R.useState)(()=>_D(e=>je.current(e))),Ne=Me.check;(0,R.useEffect)(()=>Zw(Me.start),[Me]);let Pe=(0,R.useRef)(``);(0,R.useEffect)(()=>{let e=e=>{ga().then(n=>{let r=n.sessions||[];if(!e&&r.length===0&&z.getState().sessions.length>0)return;let i=r.map(e=>`${e.id}|${e.updated_at}|${e.title}|${e.inference_remote}|${e.inference_provider}|${e.inference_description}|${e.effective_model}|${e.unread}|${e.pinned}|${e.last_run_status}|${e.kind}`).join(`
|
|
79
|
-
`);i!==Pe.current&&(Pe.current=i,t(r))}).catch(t=>{e&&u.system.error(`Could not load chats`,t)})};e(!0);let n=setInterval(()=>e(!1),5e3);return()=>clearInterval(n)},[t]),(0,R.useEffect)(()=>Dx(),[]),(0,R.useEffect)(()=>{let e=()=>{MD.getState().loadSchedules()};e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]),(0,R.useEffect)(()=>Jx(),[]),VD();let Fe=(0,R.useRef)(!1);(0,R.useEffect)(()=>{let e=()=>{let e=KD(window.location),{currentSessionId:t,sessions:r}=z.getState(),i=GD(e,t,r);return i&&(n(i),a([])),i},t=()=>{Fe.current||(Fe.current=!0,!e()&&!z.getState().currentSessionId&&window.location.hash&&window.history.replaceState(null,``,window.location.pathname+window.location.search))},r=z.subscribe(e=>{e.sessions.length>0&&t()});return z.getState().sessions.length>0&&t(),window.addEventListener(`hashchange`,e),window.addEventListener(`popstate`,e),()=>{r(),window.removeEventListener(`hashchange`,e),window.removeEventListener(`popstate`,e)}},[n,a]),(0,R.useEffect)(()=>{let e=null,t=2e3,r=!1,i=null,o=()=>{r||(e=new EventSource(`${d()}/sessions/events`),e.onopen=()=>{t=2e3},e.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch(e){u.api.warn(`Malformed session event`,e);return}t.type===`set_active_session`&&t.session_id&&t.session_id!==z.getState().currentSessionId&&(n(t.session_id),a([]))},e.onerror=()=>{e?.close(),e=null,!r&&(i=setTimeout(o,t),t=Math.min(t*2,3e4))})};return o(),()=>{r=!0,i&&clearTimeout(i),e?.close()}},[n,a]),(0,R.useEffect)(()=>{if(e){let t=UD(e);window.location.hash!==`#${t}`&&window.history.replaceState(null,``,`#${t}`)}else Fe.current&&window.location.hash&&window.history.replaceState(null,``,window.location.pathname+window.location.search)},[e]);let Ie=(0,R.useCallback)(async e=>{oe(null);let t=z.getState(),i;try{i=await _a({title:`New Task`,agent_type:zw,document_ids:t.draftDocumentIds,private:t.draftPrivate})}catch(e){throw Vw(e)?(ne(!0),Error(`The GAIA agent isn't installed. Install it from the notice above, then send again.`)):e}ie.current&&(ne(!1),I().catch(e=>u.api.warn(`Agent list unavailable`,e))),t.defaultPermissionModeKnown||(await ve().catch(e=>u.api.warn(`Default permission mode unavailable; using the chip's mode`,e)),t=z.getState()),t.clearDraftDocuments(),t.setDraftPrivate(!1),r(i),n(i.id),a([]),ce(``);try{await vi(i.id,t.draftPermissionMode)}catch(e){return oe(`The chat was created, but its permission mode could not be set, so your message was not sent: ${e instanceof Error?e.message:e}`),!1}return t.resetDraftPermissionMode(),y(e),!0},[r,n,a,y,I,ve]),Le=(0,R.useCallback)(()=>{let e=z.getState(),t=e.currentSessionId;t&&nc(t,e)&&rc(t),e.setShowMemoryDashboard(!1),e.setShowSchedules(!1),n(null),a([]),ue(e=>e+1)},[n,a]);LD({openChat:(0,R.useCallback)(e=>{let t=z.getState();t.closeSettings(),e!==t.currentSessionId&&(rc(t.currentSessionId),a([])),n(e)},[n,a]),newChat:(0,R.useCallback)(()=>{z.getState().closeSettings(),Le()},[Le]),refreshStatus:()=>void Ne()});let Re=(0,R.useCallback)(e=>{Le(),Ie(`Load the \`${e}\` skill, then tell me briefly what it lets you do.`).catch(e=>oe(e instanceof Error?e.message:String(e)))},[Le,Ie]),ze=(0,R.useCallback)(e=>{A({state:`ready`}),_e(),Ne(),e&&(e.needs_input?ce(e.prompt):Ie(e.prompt).catch(e=>oe(e instanceof Error?e.message:String(e))))},[Ne,Ie,_e]);(0,R.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&(e.shiftKey&&e.key.toLowerCase()===`o`?(e.preventDefault(),Le()):!e.shiftKey&&e.key.toLowerCase()===`k`?(e.preventDefault(),window.dispatchEvent(new CustomEvent(`gaia:focus-search`))):!e.shiftKey&&e.key.toLowerCase()===`b`?(e.preventDefault(),z.getState().toggleSidebarCollapsed()):!e.shiftKey&&e.key===`,`&&(e.preventDefault(),x()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Le,x]),(0,R.useEffect)(()=>{let e=window.matchMedia?.(`(max-width: 768px)`);if(!e)return;let t=()=>m(!e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[m]),(0,R.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(prefers-color-scheme: light)`);return e.addEventListener(`change`,C),()=>e.removeEventListener(`change`,C)},[C]),(0,R.useEffect)(()=>{o()},[e,o]),(0,R.useEffect)(()=>{lo().then(e=>me(e.active===!0)).catch(e=>u.system.debug(`Mobile access unavailable`,e))},[]);let Be=(0,R.useCallback)(async()=>{if(fe(!0),ge(null),!pe)try{let e=await so();e.error?ge(e.error):me(!0)}catch(e){ge(e instanceof Error?e.message:`Could not start mobile access`)}},[pe]),Ve=(0,R.useCallback)(async()=>{try{await co(),me(!1),fe(!1)}catch(e){ge(e instanceof Error?e.message:`Could not stop mobile access`)}},[]);GC(e=>{e?Be():Ve()}),(0,R.useEffect)(()=>{UC(pe)},[pe]);let He=typeof window<`u`&&window.innerWidth<=768;if(k.state===`checking`&&!D)return(0,B.jsx)(`div`,{className:`app`,children:(0,B.jsxs)(`main`,{className:`startup`,role:`status`,"aria-label":`Starting GAIA`,children:[(0,B.jsx)(`div`,{className:`loading-spinner`,"aria-hidden":`true`}),(0,B.jsx)(`p`,{className:`startup-text`,children:`Starting GAIA…`})]})});if(k.state===`needed`)return(0,B.jsx)(`div`,{className:`app`,children:(0,B.jsx)(UT,{initial:k.check,onReady:ze})});let Ue=l?(0,B.jsx)(R.Suspense,{fallback:(0,B.jsx)(iO,{}),children:(0,B.jsx)(XD,{})}):f?(0,B.jsx)(R.Suspense,{fallback:(0,B.jsx)(iO,{}),children:(0,B.jsx)(ZD,{})}):e?(0,B.jsx)(uT,{sessionId:e},e):(0,B.jsx)(TT,{onSend:Ie,initialText:se,focusRequest:le},se);return(0,B.jsxs)(`div`,{className:`app`,children:[!p&&(0,B.jsx)(`button`,{className:`sidebar-toggle`,onClick:()=>m(!0),"aria-label":`Open sidebar`,children:(0,B.jsx)(At,{size:18})}),(0,B.jsx)(`div`,{className:`sidebar-overlay ${p?`visible`:``}`,onClick:()=>m(!1),"aria-hidden":`true`}),(0,B.jsx)(hc,{onNewChat:Le,onMobileAccess:He?void 0:()=>void Be(),tunnelActive:pe}),(0,B.jsxs)(`div`,{className:`main-content`,children:[k.state===`ready`&&(0,B.jsx)(yD,{onRetry:Ne,backendSlow:Ee,backendError:Oe}),k.state===`unknown`&&(0,B.jsxs)(`div`,{className:`app-notice is-warning`,role:`status`,children:[(0,B.jsxs)(`span`,{children:[`Could not check whether GAIA is set up: `,k.error]}),(0,B.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>void P(),children:`Check again`})]}),re&&(0,B.jsx)(kD,{onInstalled:I}),w&&(0,B.jsxs)(`div`,{className:`app-notice${w.ok?``:` is-warning`}`,role:`status`,children:[(0,B.jsx)(`span`,{children:w.message}),!w.ok&&(0,B.jsx)(`button`,{type:`button`,className:`link-btn`,onClick:()=>{T(),x(`model`)},children:`Pick a model`}),(0,B.jsx)(`button`,{type:`button`,className:`app-notice-close`,onClick:T,"aria-label":`Dismiss`,children:(0,B.jsx)(Fn,{size:14})})]}),Ue]}),s&&(0,B.jsx)(R.Suspense,{fallback:null,children:(0,B.jsx)(QD,{})}),c&&(0,B.jsx)(R.Suspense,{fallback:null,children:(0,B.jsx)($D,{})}),E&&(0,B.jsx)(`div`,{className:`notification-center-popover`,children:(0,B.jsx)(TD,{onClose:()=>O(!1)})}),de&&(0,B.jsx)(R.Suspense,{fallback:null,children:(0,B.jsx)(eO,{isOpen:de,onClose:()=>fe(!1),onStop:()=>void Ve(),error:he})}),S&&(0,B.jsx)(cD,{onUseSkill:Re}),(0,B.jsx)(SD,{}),ae&&(0,B.jsx)(`div`,{className:`toast`,role:`alert`,children:ae})]})}ps(),window.gaiaWindow&&(document.documentElement.dataset.titlebar=window.gaiaWindow.titleBar);var sO=localStorage.getItem(`gaia-chat-theme`);er(Qn(sO===`light`||sO===`dark`?sO:`system`));var cO=z.getState();_r(cO.palette,cO.customColors,cO.theme),Rn.createRoot(document.getElementById(`root`)).render((0,B.jsx)(R.StrictMode,{children:(0,B.jsx)(oO,{})}));export{Ja as $,Le as $t,DE as A,ri as At,Gw as B,Tn as Bt,gE as C,ai as Ct,yE as D,Kr as Dt,hE as E,Zr as Et,NE as F,Ln as Ft,$x as G,Xt as Gt,rS as H,hn as Ht,RE as I,Fn as It,Ko as J,Tt as Jt,Ob as K,Pt as Kt,_E as L,Nn as Lt,wE as M,Gr as Mt,CE as N,ni as Nt,FE as O,ti as Ot,TE as P,z as Pt,qa as Q,qe as Qt,jE as R,kn as Rt,lE as S,Yr as St,cE as T,Xr as Tt,aS as U,nn as Ut,Ww as V,Cn as Vt,Zx as W,Qt as Wt,$a as X,Ze as Xt,Za as Y,rt as Yt,Ya as Z,Ye as Zt,vE as _,Ka as _t,iD as a,ye as an,lo as at,PE as b,qr as bt,ME as c,me as cn,zi as ct,xE as d,ce as dn,oo as dt,Fe as en,Zi as et,IE as f,oe as fn,Xa as ft,fE as g,Li as gt,pE as h,Fi as ht,lD as i,xe as in,ji as it,SE as j,ei as jt,EE as k,$r as kt,OE as l,fe as ln,to as lt,BE as m,E as mn,$i as mt,MD as n,je as nn,Pi as nt,LE as o,F as on,eo as ot,dE as p,M as pn,ao as pt,Zs as q,L as qt,xD as r,De as rn,Ii as rt,zE as s,ge as sn,Wa as st,HD as t,Ne as tn,uo as tt,kE as u,ue as un,vo as ut,bE as v,Ga as vt,AE as w,Qr as wt,uE as x,Jr as xt,mE as y,ii as yt,ET as z,Dn as zt};
|