@amd-gaia/agent-ui 0.26.1-rc.2 → 0.27.0-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.
Files changed (56) hide show
  1. package/dist/assets/AdvancedSettings-DHERtrno.js +1 -0
  2. package/dist/assets/AutomationsSettings-4FWcRau9.js +1 -0
  3. package/dist/assets/ConnectorsPane-BGI8nBUb.css +1 -0
  4. package/dist/assets/ConnectorsPane-Dkat1zLC.js +1 -0
  5. package/dist/assets/DocumentLibrary-Dll55N7l.js +5 -0
  6. package/dist/assets/DocumentLibrary-fEMoY7lH.css +1 -0
  7. package/dist/assets/FileBrowser-1goNp4CP.css +1 -0
  8. package/dist/assets/FileBrowser-wFHqH6K_.js +4 -0
  9. package/dist/assets/MemoryDashboard-BuUBoNq8.js +1 -0
  10. package/dist/assets/MemoryDashboard-RpfLag-v.css +1 -0
  11. package/dist/assets/MessagingSettings-DomiT2rX.js +1 -0
  12. package/dist/assets/MobileAccessModal-B2gaE8nk.js +2 -0
  13. package/dist/assets/{MobileAccessModal-CX4NZmr4.css → MobileAccessModal-BrZMaERi.css} +1 -1
  14. package/dist/assets/ScheduleManager-8UE81KlQ.js +1 -0
  15. package/dist/assets/ScheduleManager-BZzEH2-W.css +1 -0
  16. package/dist/assets/Temml-CCjoacWt.woff2 +0 -0
  17. package/dist/assets/index-BiETDNik.css +1 -0
  18. package/dist/assets/index-HCZ86cyP.js +220 -0
  19. package/dist/assets/useFocusTrap-BFi0chLf.js +6 -0
  20. package/dist/assets/zap-DjkIffnX.js +1 -0
  21. package/dist/index.html +3 -3
  22. package/dist/sw.js +1 -1
  23. package/main.cjs +130 -40
  24. package/package.json +5 -3
  25. package/preload.cjs +28 -0
  26. package/services/browser-pane/bridge-error.cjs +20 -0
  27. package/services/browser-pane/bridge-server.cjs +496 -0
  28. package/services/browser-pane/cdp-session.cjs +375 -0
  29. package/services/browser-pane/contract.d.ts +448 -0
  30. package/services/browser-pane/dev-servers.cjs +478 -0
  31. package/services/browser-pane/input.cjs +375 -0
  32. package/services/browser-pane/ipc.cjs +267 -0
  33. package/services/browser-pane/navigation-policy.cjs +255 -0
  34. package/services/browser-pane/pane-host.cjs +1686 -0
  35. package/services/browser-pane/picker-world.js +360 -0
  36. package/services/browser-pane/picker.cjs +261 -0
  37. package/services/browser-pane/service-ports.cjs +66 -0
  38. package/services/dev-qa-mode.cjs +32 -0
  39. package/dist/assets/AdvancedSettings-C-9ErldS.js +0 -1
  40. package/dist/assets/AutomationsSettings-CL3K4hLZ.js +0 -1
  41. package/dist/assets/ConnectorsPane-DpGR78cA.js +0 -1
  42. package/dist/assets/ConnectorsPane-w-HLcq3n.css +0 -1
  43. package/dist/assets/DocumentLibrary-BKZdx6rJ.css +0 -1
  44. package/dist/assets/DocumentLibrary-N7tBbt9v.js +0 -5
  45. package/dist/assets/FileBrowser-CO2p3xa2.js +0 -4
  46. package/dist/assets/FileBrowser-CrRQXiPo.css +0 -1
  47. package/dist/assets/MemoryDashboard-1OIrKFIa.js +0 -1
  48. package/dist/assets/MemoryDashboard-B4AO_CU8.css +0 -1
  49. package/dist/assets/MessagingSettings-0AJnsoWA.js +0 -1
  50. package/dist/assets/MobileAccessModal-CnPB1BEN.js +0 -2
  51. package/dist/assets/ScheduleManager-BYOhqnfv.js +0 -1
  52. package/dist/assets/ScheduleManager-DQBnf_IN.css +0 -1
  53. package/dist/assets/index-Bkx-QRv4.css +0 -1
  54. package/dist/assets/index-C-3wCH_s.js +0 -116
  55. package/dist/assets/useT-DuzpQY8p.js +0 -6
  56. package/dist/assets/zap-gF9QDKfa.js +0 -1
@@ -0,0 +1,220 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ConnectorsPane-Dkat1zLC.js","./rolldown-runtime-XKyaHtl9.js","./useFocusTrap-BFi0chLf.js","./ConnectorsPane-BGI8nBUb.css","./MessagingSettings-DomiT2rX.js","./AutomationsSettings-4FWcRau9.js","./AdvancedSettings-DHERtrno.js","./MemoryDashboard-BuUBoNq8.js","./zap-DjkIffnX.js","./MemoryDashboard-RpfLag-v.css","./ScheduleManager-8UE81KlQ.js","./ScheduleManager-BZzEH2-W.css","./DocumentLibrary-Dll55N7l.js","./DocumentLibrary-fEMoY7lH.css","./FileBrowser-wFHqH6K_.js","./FileBrowser-1goNp4CP.css","./MobileAccessModal-B2gaE8nk.js","./MobileAccessModal-BrZMaERi.css"])))=>i.map(i=>d[i]);
2
+ import{n as e,r as t,t as n}from"./rolldown-runtime-XKyaHtl9.js";import{$ as r,$n as i,$r as a,$t as o,A as s,An as c,Ar as l,B as u,Bn as d,Br as f,Bt as p,C as m,Cn as h,Ct as g,D as _,Dn as v,Dt as y,E as b,En as x,Er as S,Et as C,F as w,Fn as T,Fr as E,Ft as D,G as O,Gn as k,Gr as ee,Gt as te,H as ne,Hn as A,Hr as re,Ht as ie,I as ae,Ir as j,It as oe,J as se,Jn as ce,Jr as le,Jt as ue,K as de,Kn as fe,Kr as pe,Kt as me,L as he,Ln as M,Lr as N,M as ge,Mn as _e,Mr as ve,Mt as ye,N as be,Nn as xe,Nr as Se,Nt as Ce,O as we,On as Te,Ot as Ee,P as De,Pn as Oe,Pr as ke,Pt as Ae,Q as je,Qn as Me,Qr as Ne,Qt as Pe,R as Fe,Rn as Ie,Rr as Le,Rt as Re,S as ze,Sn as Be,St as Ve,T as He,Tn as Ue,Tt as We,U as Ge,Un as Ke,Ur as qe,Ut as Je,Vn as Ye,Vr as Xe,Vt as Ze,W as Qe,Wn as $e,Wr as et,Wt as tt,X as nt,Xn as rt,Xr as it,Y as at,Yn as ot,Yr as st,Yt as ct,Z as lt,Zn as ut,Zr as dt,Zt as ft,_ as pt,_n as mt,_t as ht,a as gt,ai as _t,an as vt,ar as yt,at as bt,b as xt,bt as St,c as P,ci as Ct,cn as wt,cr as Tt,ct as Et,d as Dt,dn as Ot,dr as kt,ei as At,en as jt,er as Mt,et as Nt,f as Pt,fn as Ft,ft as It,g as Lt,gn as Rt,gt as zt,h as Bt,hn as Vt,i as Ht,ii as F,in as Ut,ir as Wt,it as Gt,j as Kt,jn as qt,jr as Jt,jt as Yt,k as Xt,kn as Zt,kt as Qt,l as I,li as L,ln as $t,lr as en,lt as tn,m as nn,mn as rn,mt as an,n as on,ni as sn,nn as cn,nr as ln,nt as un,oi as dn,on as fn,or as pn,ot as mn,p as hn,pr as gn,pt as _n,q as vn,qn as yn,qr as bn,qt as xn,r as Sn,ri as Cn,rn as wn,rr as Tn,rt as En,s as R,si as Dn,sn as On,sr as kn,st as An,t as jn,ti as Mn,tn as Nn,tr as Pn,u as z,ui as Fn,un as In,ur as Ln,ut as Rn,v as zn,vn as Bn,vt as Vn,w as Hn,wn as Un,wt as Wn,x as Gn,xn as Kn,xt as qn,y as B,yn as Jn,yt as Yn,z as Xn,zn as Zn,zr as Qn,zt as $n}from"./useFocusTrap-BFi0chLf.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 er=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&&te(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&&te(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,ee=k.port2;k.port1.onmessage=D,O=function(){ee.postMessage(null)}}else O=function(){_(D,0)};function te(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,te(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}}}})),tr=n(((e,t)=>{t.exports=er()})),nr=n((e=>{var t=Fn();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`})),rr=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=nr()})),ir=n((e=>{var t=tr(),n=Fn(),r=rr();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 f(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)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(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 m(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 h(e){var t=[null,null],n=p(e);return n===null||g(t,e,n.child,{foundSelf:!1}),t}function g(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)&&g(e,t,n.child,r))return!0;n=n.sibling}return!1}function _(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 v=null,y=null;function b(e,t,n){return e===n||e===t&&(v=e,!0)}function x(e,t,n){return e===n?(y=e,!1):e===t&&(y!==null&&(v=e),!0)}function S(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 C(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 w=Object.assign,T=Symbol.for(`react.element`),E=Symbol.for(`react.transitional.element`),D=Symbol.for(`react.portal`),O=Symbol.for(`react.fragment`),k=Symbol.for(`react.strict_mode`),ee=Symbol.for(`react.profiler`),te=Symbol.for(`react.consumer`),ne=Symbol.for(`react.context`),A=Symbol.for(`react.forward_ref`),re=Symbol.for(`react.suspense`),ie=Symbol.for(`react.suspense_list`),ae=Symbol.for(`react.memo`),j=Symbol.for(`react.lazy`),oe=Symbol.for(`react.activity`),se=Symbol.for(`react.legacy_hidden`),ce=Symbol.for(`react.memo_cache_sentinel`),le=Symbol.for(`react.view_transition`),ue=Symbol.for(`react.recoverable`),de=Symbol.iterator;function fe(e){return typeof e!=`object`||!e?null:(e=de&&e[de]||e[`@@iterator`],typeof e==`function`?e:null)}var pe=Symbol.for(`react.client.reference`);function me(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===pe?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case O:return`Fragment`;case ee:return`Profiler`;case k:return`StrictMode`;case re:return`Suspense`;case ie:return`SuspenseList`;case oe:return`Activity`;case le:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case D:return`Portal`;case ne:return e.displayName||`Context`;case te:return(e._context.displayName||`Context`)+`.Consumer`;case A: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?me(e.type)||`Memo`:t;case j:t=e._payload,e=e._init;try{return me(e(t))}catch{}}return null}var he=Array.isArray,M=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ge={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)?xp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=xp(t),e=Sp(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&&(vh._currentValue=t.memoizedState,xe(Te,e)),t=Se.current;var n=Sp(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),vh._currentValue=ge)}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&&gt(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=N.p;return e===0?(e=window.event,e===void 0?32:Ph(e.type)):e}function St(e,t){var n=N.p;try{return N.p=e,t()}finally{N.p=n}}var P=Math.random().toString(36).slice(2),Ct=`__reactFiber$`+P,wt=`__reactProps$`+P,Tt=`__reactContainer$`+P,Et=`__reactEvents$`+P,Dt=`__reactListeners$`+P,Ot=`__reactHandles$`+P,kt=`__reactResources$`+P,At=`__reactMarker$`+P,jt=`__reactLoad$`+P;function Mt(e){delete e[Ct],delete e[wt],delete e[Dt],delete e[Ot]}function Nt(e){var t;if(t=e[Ct])return t;for(var n=e.parentNode;n;){if(t=n[Tt]||n[Ct]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Cm(e);e!==null;){if(n=e[Ct])return n;e=Cm(e)}return t}e=n,n=e.parentNode}return null}function Pt(e){if(e=e[Ct]||e[Tt]){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 F=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]*$`),Ut={},Wt={};function Gt(e){return Le.call(Wt,e)?!0:Le.call(Ut,e)?!1:F.test(e)?Wt[e]=!0:(Ut[e]=!0,!1)}var Kt=!1;function qt(){var e=Kt;return Kt=!1,e}function Jt(e,t,n){if(Gt(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 Yt(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 Xt(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 Zt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Qt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function I(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 L(e){if(!e._valueTracker){var t=Qt(e)?`checked`:`value`;e._valueTracker=I(e,t,``+e[t])}}function $t(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Qt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var en=/[\n"\\]/g;function tn(e){return e.replace(en,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function nn(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=``+Zt(t)):e.value!==``+Zt(t)&&(e.value=``+Zt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):an(e,Zt(n)):o===`number`&&e.value==t?an(e,Zt(e.value)):an(e,Zt(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=``+Zt(s):e.removeAttribute(`name`)}function rn(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)){L(e);return}n=n==null?``:``+Zt(n),t=t==null?n:``+Zt(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),L(e)}function an(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function on(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=``+Zt(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 sn(e,t,n){t!=null&&(t=``+Zt(t),t!==e.value&&(e.value=t),n==null)?e.defaultValue!==t&&(e.defaultValue=t):e.defaultValue=n==null?``:``+Zt(n)}function cn(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(he(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Zt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),L(e)}function ln(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var un=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 dn(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||un.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function fn(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]=``,Kt=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(dn(e,a,r),Kt=!0)}else for(var o in t)t.hasOwnProperty(o)&&dn(e,o,t[o])}function pn(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 mn=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`]]),hn=/^[\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 gn(e){return hn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function _n(){}var vn=null;function yn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var bn=null,xn=null;function Sn(e){var t=Pt(e);if(t&&(e=t.stateNode)){var n=e[wt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(nn(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="`+tn(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[wt]||null;if(!a)throw Error(i(90));nn(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&&$t(r)}break a;case`textarea`:sn(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&on(e,!!n.multiple,t,!1)}}}var Cn=!1;function wn(e,t,n){if(Cn)return e(t,n);Cn=!0;try{return e(t)}finally{if(Cn=!1,(bn!==null||xn!==null)&&(qd(),bn&&(t=bn,e=xn,xn=bn=null,Sn(t),e)))for(t=0;t<e.length;t++)Sn(e[t])}}function Tn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[wt]||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 En=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,R=!1;if(En)try{var Dn={};Object.defineProperty(Dn,"passive",{get:function(){R=!0}}),window.addEventListener(`test`,Dn,Dn),window.removeEventListener(`test`,Dn,Dn)}catch{R=!1}var On=null,kn=null,An=null;function jn(){if(An)return An;var e,t=kn,n=t.length,r,i=`value`in On?On.value:On.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 An=i.slice(e,1<r?1-r:void 0)}function Mn(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 Nn(){return!0}function Pn(){return!1}function z(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)?Nn:Pn,this.isPropagationStopped=Pn,this}return w(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=Nn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Nn)},persist:function(){},isPersistent:Nn}),t}var In={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ln=z(In),Rn=w({},In,{view:0,detail:0}),zn=z(Rn),Bn,Vn,Hn,Un=w({},Rn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:$n,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!==Hn&&(Hn&&e.type===`mousemove`?(Bn=e.screenX-Hn.screenX,Vn=e.screenY-Hn.screenY):Vn=Bn=0,Hn=e),Bn)},movementY:function(e){return`movementY`in e?e.movementY:Vn}}),Wn=z(Un),Gn=z(w({},Un,{dataTransfer:0})),Kn=z(w({},Rn,{relatedTarget:0})),qn=z(w({},In,{animationName:0,elapsedTime:0,pseudoElement:0})),B=z(w({},In,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Jn=z(w({},In,{data:0})),Yn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Xn={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`},Zn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Qn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Zn[e])?!!t[e]:!1}function $n(){return Qn}var er=z(w({},Rn,{key:function(e){if(e.key){var t=Yn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Mn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Xn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:$n,charCode:function(e){return e.type===`keypress`?Mn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Mn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),nr=z(w({},Un,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),ir=z(w({},In,{submitter:0})),ar=z(w({},Rn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:$n})),or=z(w({},In,{propertyName:0,elapsedTime:0,pseudoElement:0})),sr=z(w({},Un,{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})),cr=z(w({},In,{newState:0,oldState:0,source:0})),lr=[9,13,27,32],ur=En&&`CompositionEvent`in window,dr=null;En&&`documentMode`in document&&(dr=document.documentMode);var fr=En&&`TextEvent`in window&&!dr,pr=En&&(!ur||dr&&8<dr&&11>=dr),mr=` `,hr=!1;function gr(e,t){switch(e){case`keyup`:return lr.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function _r(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var vr=!1;function yr(e,t){switch(e){case`compositionend`:return _r(t);case`keypress`:return t.which===32?(hr=!0,mr):null;case`textInput`:return e=t.data,e===mr&&hr?null:e;default:return null}}function br(e,t){if(vr)return e===`compositionend`||!ur&&gr(e,t)?(e=jn(),An=kn=On=null,vr=!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 pr&&t.locale!==`ko`?null:t.data;default:return null}}var xr={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 Sr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!xr[e.type]:t===`textarea`}function Cr(e,t,n,r){bn?xn?xn.push(r):xn=[r]:bn=r,t=ip(t,`onChange`),0<t.length&&(n=new Ln(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var wr=null,Tr=null;function Er(e){Xf(e,0)}function Dr(e){if($t(Ft(e)))return e}function Or(e,t){if(e===`change`)return t}var kr=!1;if(En){var Ar;if(En){var jr=`oninput`in document;if(!jr){var Mr=document.createElement(`div`);Mr.setAttribute(`oninput`,`return;`),jr=typeof Mr.oninput==`function`}Ar=jr}else Ar=!1;kr=Ar&&(!document.documentMode||9<document.documentMode)}function Nr(){wr&&(wr.detachEvent(`onpropertychange`,Pr),Tr=wr=null)}function Pr(e){if(e.propertyName===`value`&&Dr(Tr)){var t=[];Cr(t,Tr,e,yn(e)),wn(Er,t)}}function Fr(e,t,n){e===`focusin`?(Nr(),wr=t,Tr=n,wr.attachEvent(`onpropertychange`,Pr)):e===`focusout`&&Nr()}function Ir(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Dr(Tr)}function Lr(e,t){if(e===`click`)return Dr(t)}function Rr(e,t){if(e===`input`||e===`change`)return Dr(t)}function zr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Br=typeof Object.is==`function`?Object.is:zr;function Vr(e,t){if(Br(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)||!Br(e[i],t[i]))return!1}return!0}function Hr(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=Hr(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=Hr(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=En&&`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!==Hr(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&&Vr(Zr,r)||(Zr=r,r=ip(Xr,`onSelect`),0<r.length&&(t=new Ln(`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={};En&&(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=Od.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=Id;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<Ld)throw Ld=0,Rd=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 ji(e,t,n,r){return new Ai(e,t,n,r)}function Mi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ni(e,t){var n=e.alternate;return n===null?(n=ji(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 Pi(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 Fi(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)Mi(r)&&(s=1);else if(typeof r==`string`)s=ih(e,n,Se.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case oe:return e=ji(31,n,t,a),e.elementType=oe,e.lanes=o,e;case O:return Ii(n.children,a,o,t);case k:s=8,a|=24;break;case ee:return e=ji(12,n,t,a|2),e.elementType=ee,e.lanes=o,e;case re:return e=ji(13,n,t,a),e.elementType=re,e.lanes=o,e;case ie:return e=ji(19,n,t,a),e.elementType=ie,e.lanes=o,e;case se:case le:return e=a|32,e=ji(30,n,t,e),e.elementType=le,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case ne:s=10;break a;case te:s=9;break a;case A:s=11;break a;case ae:s=14;break a;case j:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ji(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Ii(e,t,n,r){return e=ji(7,e,r,t),e.lanes=n,e}function Li(e,t,n){return e=ji(6,e,null,t),e.lanes=n,e}function Ri(e){var t=ji(18,null,null,0);return t.stateNode=e,t}function zi(e,t,n){return t=ji(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Bi=new WeakMap;function Vi(e,t){if(typeof e==`object`&&e){var n=Bi.get(e);return n===void 0?(t={value:e,source:t,stack:Ie(t)},Bi.set(e,t),t):n}return{value:e,source:t,stack:Ie(t)}}var Hi=[],Ui=0,Wi=null,Gi=0,Ki=[],qi=0,Ji=null,Yi=1,Xi=``;function Zi(e,t){Hi[Ui++]=Gi,Hi[Ui++]=Wi,Wi=e,Gi=t}function Qi(e,t,n){Ki[qi++]=Yi,Ki[qi++]=Xi,Ki[qi++]=Ji,Ji=e;var r=Yi;e=Xi;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,Yi=1<<32-et(t)+i|n<<i|r,Xi=a+e}else Yi=1<<a|n<<i|r,Xi=e}function $i(e){e.return!==null&&(Zi(e,1),Qi(e,1,0))}function ea(e){for(;e===Wi;)Wi=Hi[--Ui],Hi[Ui]=null,Gi=Hi[--Ui],Hi[Ui]=null;for(;e===Ji;)Ji=Ki[--qi],Ki[qi]=null,Xi=Ki[--qi],Ki[qi]=null,Yi=Ki[--qi],Ki[qi]=null}function ta(e,t){Ki[qi++]=Yi,Ki[qi++]=Xi,Ki[qi++]=Ji,Yi=t.id,Xi=t.overflow,Ji=e}var na=null,ra=null,ia=!1,aa=null,oa=!1,sa=Error(i(519));function ca(e){throw ma(Vi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),sa}function la(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Ct]=e,t[wt]=r,n){case`dialog`:Zf(`cancel`,t),Zf(`close`,t);break;case`iframe`:case`object`:case`embed`:Zf(`load`,t);break;case`video`:case`audio`:for(n=0;n<Jf.length;n++)Zf(Jf[n],t);break;case`source`:Zf(`error`,t);break;case`img`:case`image`:case`link`:Zf(`error`,t),Zf(`load`,t);break;case`details`:Zf(`toggle`,t);break;case`input`:Zf(`invalid`,t),rn(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Zf(`invalid`,t);break;case`textarea`:Zf(`invalid`,t),cn(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||up(t.textContent,n)?(r.popover!=null&&(Zf(`beforetoggle`,t),Zf(`toggle`,t)),r.onScroll!=null&&Zf(`scroll`,t),r.onScrollEnd!=null&&Zf(`scrollend`,t),r.onClick!=null&&(t.onclick=_n),t=!0):t=!1,t||ca(e,!0)}function ua(e){for(na=e.return;na;)switch(na.tag){case 5:case 31:case 13:oa=!1;return;case 27:case 3:oa=!0;return;default:na=na.return}}function da(e){if(e!==na)return!1;if(!ia)return ua(e),ia=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||wp(e.type,e.memoizedProps)),n=!n),n&&ra&&ca(e),ua(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ra=Sm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ra=Sm(e)}else t===27?(t=ra,Np(e.type)?(e=xm,xm=null,ra=e):ra=t):ra=na?bm(e.stateNode.nextSibling):null;return!0}function fa(){ra=na=null,ia=!1}function pa(){var e=aa;return e!==null&&(bd===null?bd=e:bd.push.apply(bd,e),aa=null),e}function ma(e){aa===null?aa=[e]:aa.push(e)}var ha=ye(null),ga=null,_a=null;function va(e,t,n){xe(ha,t._currentValue),t._currentValue=n}function ya(e){e._currentValue=ha.current,be(ha)}function ba(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 xa(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),ba(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),ba(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),ba(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 Sa(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;Br(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=[vh]:e.push(vh))}a=a.return}return e!==null&&xa(t,e,n,r),t.flags|=262144,e!==null}function Ca(e){for(e=e.firstContext;e!==null;){if(!Br(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function wa(e){ga=e,_a=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ta(e){return Da(ga,e)}function Ea(e,t){return ga===null&&wa(e),Da(e,t)}function Da(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},_a===null){if(e===null)throw Error(i(308));_a=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else _a=_a.next=t;return n}var Oa=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()})}},ka=t.unstable_scheduleCallback,Aa=t.unstable_NormalPriority,ja={$$typeof:ne,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Ma(){return{controller:new Oa,data:new Map,refCount:0}}function Na(e){e.refCount--,e.refCount===0&&ka(Aa,function(){e.controller.abort()})}function Pa(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 Fa=null;function Ia(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var La=null,Ra=0,za=0,Ba=null;function Va(e,t){if(La===null){var n=La=[];Ra=0,za=Uf(),Ba={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Ra++,t.then(Ha,Ha),t}function Ha(){if(--Ra===0&&(Fa=null,La!==null)){Ba!==null&&(Ba.status=`fulfilled`);var e=La;La=null,za=0,Ba=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ua(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 Wa=M.S;M.S=function(e,t){if(Cd=He(),typeof t==`object`&&t&&typeof t.then==`function`&&Va(e,t),Fa!==null)for(var n=kf;n!==null;)Pa(n,Fa),n=n.next;if(n=e.types,n!==null){for(var r=kf;r!==null;)Pa(r,n),r=r.next;if(za!==0){r=Fa,r===null&&(r=Fa=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Wa!==null&&Wa(e,t)};var Ga=ye(null);function Ka(){var e=Ga.current;return e===null?id.pooledCache:e}function qa(e,t){t===null?xe(Ga,Ga.current):xe(Ga,t.pool)}function Ja(){var e=Ka();return e===null?null:{parent:ja._currentValue,pool:e}}var Ya=Error(i(460)),Xa=Error(i(474)),Za=Error(i(542)),Qa={then:function(){}};function $a(e){return e=e.status,e===`fulfilled`||e===`rejected`}function eo(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(_n,_n),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,io(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(_n,_n);else{if(e=id,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,io(e),e}throw no=t,Ya}}function to(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(no=e,Ya):e}}var no=null;function ro(){if(no===null)throw Error(i(459));var e=no;return no=null,e}function io(e){if(e===Ya||e===Za)throw Error(i(483))}var ao=null,oo=0;function so(e){var t=oo;return oo+=1,ao===null&&(ao=[]),eo(ao,e,t)}function co(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function lo(e,t){throw t.$$typeof===T?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function uo(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=Ni(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=Li(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===O?(e=d(e,t,n.props.children,r,n.key),co(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===j&&to(i)===t.type)?(t=a(t,n.props),co(t,n),t.return=e,t):(t=Fi(n.type,n.key,n.props,null,e.mode,r),co(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=zi(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=Ii(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=Li(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case E:return n=Fi(t.type,t.key,t.props,null,e.mode,n),co(n,t),n.return=e,n;case D:return t=zi(t,e.mode,n),t.return=e,t;case j:return t=to(t),f(e,t,n)}if(he(t)||fe(t))return t=Ii(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,so(t),n);if(t.$$typeof===ne)return f(e,Ea(e,t),n);lo(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 E:return n.key===i?l(e,t,n,r):null;case D:return n.key===i?u(e,t,n,r):null;case j:return n=to(n),p(e,t,n,r)}if(he(n)||fe(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,so(n),r);if(n.$$typeof===ne)return p(e,t,Ea(e,n),r);lo(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 E:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case D:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case j:return r=to(r),m(e,t,n,r,i)}if(he(r)||fe(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,so(r),i);if(r.$$typeof===ne)return m(e,t,n,Ea(t,r),i);lo(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),ia&&Zi(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 ia&&Zi(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)}),ia&&Zi(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),ia&&Zi(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 ia&&Zi(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)}),ia&&Zi(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===O&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case E:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===O){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),co(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===j&&to(l)===r.type){n(e,r.sibling),c=a(r,o.props),co(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===O?(c=Ii(o.props.children,e.mode,c,o.key),co(c,o),c.return=e,e=c):(c=Fi(o.type,o.key,o.props,null,e.mode,c),co(c,o),c.return=e,e=c)}return s(e);case D: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=zi(o,e.mode,c),c.return=e,e=c}return s(e);case j:return o=to(o),_(e,r,o,c)}if(he(o))return h(e,r,o,c);if(fe(o)){if(l=fe(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,so(o),c);if(o.$$typeof===ne)return _(e,r,Ea(e,o),c);lo(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=Li(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{oo=0;var i=_(e,t,n,r);return ao=null,i}catch(t){if(t===Ya||t===Za)throw t;var a=ji(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var fo=uo(!0),po=uo(!1),mo=!1;function ho(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function go(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 _o(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function vo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,rd&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 yo(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 bo(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 xo=!1;function So(){if(xo){var e=Ba;if(e!==null)throw e}}function Co(e,t,n,r){xo=!1;var i=e.updateQueue;mo=!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?(od&f)===f:(r&f)===f){f!==0&&f===za&&(xo=!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=w({},d,f);break a;case 2:mo=!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),md|=o,e.lanes=o,e.memoizedState=d}}function wo(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function To(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)wo(n[e],t)}var Eo=ye(null),Do=ye(0);function Oo(e,t){e=fd,xe(Do,e),xe(Eo,t),fd=e|t.baseLanes}function ko(){xe(Do,fd),xe(Eo,Eo.current)}function Ao(){fd=Do.current,be(Eo),be(Do)}var jo=ye(null),Mo=null;function No(e){var t=e.alternate;xe(Ro,Ro.current&1),xe(jo,e),Mo===null&&(t===null||Eo.current!==null||t.memoizedState!==null)&&(Mo=e)}function Po(e){xe(Ro,Ro.current),xe(jo,e),Mo===null&&(Mo=e)}function Fo(e){e.tag===22?(xe(Ro,Ro.current),xe(jo,e),Mo===null&&(Mo=e)):Io()}function Io(){xe(Ro,Ro.current),xe(jo,jo.current)}function Lo(e){be(jo),Mo===e&&(Mo=null),be(Ro)}var Ro=ye(0);function zo(e,t){xe(jo,jo.current),xe(Ro,t)}function Bo(e){be(Ro),be(jo),Mo===e&&(Mo=null)}function Vo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||_m(n)||vm(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 Ho=0,Uo=null,Wo=null,Go=null,Ko=!1,qo=!1,Jo=!1,Yo=0,Xo=0,Zo=null,Qo=0;function $o(){throw Error(i(321))}function es(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Br(e[n],t[n]))return!1;return!0}function ts(e,t,n,r,i,a){return Ho=a,Uo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,M.H=e===null||e.memoizedState===null?_c:vc,Jo=!1,a=n(r,i),Jo=!1,qo&&(a=rs(t,n,r,i)),ns(e),a}function ns(e){M.H=gc;var t=Wo!==null&&Wo.next!==null;if(Ho=0,Go=Wo=Uo=null,Ko=!1,Xo=0,Zo=null,t)throw Error(i(300));e===null||Fc||(e=e.dependencies,e!==null&&Ca(e)&&(Fc=!0))}function rs(e,t,n,r){Uo=e;var a=0;do{if(qo&&(Zo=null),Xo=0,qo=!1,25<=a)throw Error(i(301));if(a+=1,Go=Wo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}M.H=yc,o=t(n,r)}while(qo);return o}function is(){var e=M.H,t=e.useState()[0];return t=typeof t.then==`function`?ds(t):t,e=e.useState()[0],(Wo===null?null:Wo.memoizedState)!==e&&(Uo.flags|=1024),t}function as(){var e=Yo!==0;return Yo=0,e}function os(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ss(e){if(Ko){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ko=!1}Ho=0,Go=Wo=Uo=null,qo=!1,Xo=Yo=0,Zo=null}function cs(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Go===null?Uo.memoizedState=Go=e:Go=Go.next=e,Go}function ls(){if(Wo===null){var e=Uo.alternate;e=e===null?null:e.memoizedState}else e=Wo.next;var t=Go===null?Uo.memoizedState:Go.next;if(t!==null)Go=t,Wo=e;else{if(e===null)throw Uo.alternate===null?Error(i(467)):Error(i(310));Wo=e,e={memoizedState:Wo.memoizedState,baseState:Wo.baseState,baseQueue:Wo.baseQueue,queue:Wo.queue,next:null},Go===null?Uo.memoizedState=Go=e:Go=Go.next=e}return Go}function us(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ds(e){var t=Xo;return Xo+=1,Zo===null&&(Zo=[]),e=eo(Zo,e,t),t=Uo,(Go===null?t.memoizedState:Go.next)===null&&(t=t.alternate,M.H=t===null||t.memoizedState===null?_c:vc),e}function fs(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return ds(e);if(e.$$typeof===ue)return;if(e.$$typeof===ne)return Ta(e)}throw Error(i(438,String(e)))}function ps(e){var t=null,n=Uo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Uo.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=us(),Uo.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]=ce;return t.index++,n}function ms(e,t){return typeof t==`function`?t(e):t}function hs(e){return gs(ls(),Wo,e)}function gs(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?(Ho&f)===f:(od&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===za&&(d=!0);else if((Ho&p)===p){u=u.next,p===za&&(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,Uo.lanes|=p,md|=p;f=u.action,Jo&&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,Uo.lanes|=f,md|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Br(o,e.memoizedState)&&(Fc=!0,d&&(n=Ba,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 _s(e){var t=ls(),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);Br(o,t.memoizedState)||(Fc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function vs(e,t,n){var r=Uo,a=ls(),o=ia;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Br((Wo||a).memoizedState,n);if(s&&(a.memoizedState=n,Fc=!0),a=a.queue,Hs(xs.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||Go!==null&&!!(Go.memoizedState.tag&1),Ls(e?9:8,{destroy:void 0},bs.bind(null,r,a,n,t),null),e){if(r.flags|=2048,id===null)throw Error(i(349));o||Ho&127||ys(r,t,n)}return n}function ys(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Uo.updateQueue,t===null?(t=us(),Uo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function bs(e,t,n,r){t.value=n,t.getSnapshot=r,Ss(t)&&Cs(e)}function xs(e,t,n){return n(function(){Ss(t)&&Cs(e)})}function Ss(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Br(e,n)}catch{return!0}}function Cs(e){var t=Ei(e,2);t!==null&&Hd(t,e,2)}function ws(e){var t=cs();if(typeof e==`function`){var n=e;if(e=n(),Jo){$e(!0);try{n()}finally{$e(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:e},t}function Ts(e,t,n,r){return e.baseState=n,gs(e,Wo,typeof r==`function`?r:ms)}function Es(e,t,n,r,a){if(pc(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)}};M.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Ds(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Ds(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=M.T,o={};o.types=a===null?null:a.types,M.T=o;try{var s=n(i,r),c=M.S;c!==null&&c(o,s),Os(e,t,s)}catch(n){As(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),M.T=a}}else try{a=n(i,r),Os(e,t,a)}catch(n){As(e,t,n)}}function Os(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){ks(e,t,n)},function(n){return As(e,t,n)}):ks(e,t,n)}function ks(e,t,n){t.status=`fulfilled`,t.value=n,js(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Ds(e,n)))}function As(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,js(t),t=t.next;while(t!==r)}e.action=null}function js(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ms(e,t){return t}function Ns(e,t){if(ia){var n=id.formState;if(n!==null){a:{var r=Uo;if(ia){if(ra){b:{for(var i=ra,a=oa;i.nodeType!==8;)if(!a||(i=bm(i.nextSibling),i===null)){i=null;break b}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){ra=bm(i.nextSibling),r=i.data===`F!`;break a}}ca(r)}r=!1}r&&(t=n[0])}}return n=cs(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ms,lastRenderedState:t},n.queue=r,n=uc.bind(null,Uo,r),r.dispatch=n,r=ws(!1),a=fc.bind(null,Uo,!1,r.queue),r=cs(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Es.bind(null,Uo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Ps(e){return Fs(ls(),Wo,e)}function Fs(e,t,n){if(t=gs(e,t,Ms)[0],e=hs(ms)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=ds(t)}catch(e){throw e===Ya?Za:e}else r=t;t=ls();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(Uo.flags|=2048,Ls(9,{destroy:void 0},Is.bind(null,i,n),null)),[r,a,e]}function Is(e,t){e.action=t}function V(e){var t=ls(),n=Wo;if(n!==null)return Fs(t,n,e);ls(),t=t.memoizedState,n=ls();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Ls(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Uo.updateQueue,t===null&&(t=us(),Uo.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 Rs(){return ls().memoizedState}function zs(e,t,n,r){var i=cs();Uo.flags|=e,i.memoizedState=Ls(1|t,{destroy:void 0},n,r===void 0?null:r)}function Bs(e,t,n,r){var i=ls();r=r===void 0?null:r;var a=i.memoizedState.inst;Wo!==null&&r!==null&&es(r,Wo.memoizedState.deps)?i.memoizedState=Ls(t,a,n,r):(Uo.flags|=e,i.memoizedState=Ls(1|t,a,n,r))}function Vs(e,t){zs(8390656,8,e,t)}function Hs(e,t){Bs(2048,8,e,t)}function Us(e){Uo.flags|=4;var t=Uo.updateQueue;if(t===null)t=us(),Uo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ws(e){var t=ls().memoizedState;return Us({ref:t,nextImpl:e}),function(){if(rd&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Gs(e,t){return Bs(4,2,e,t)}function Ks(e,t){return Bs(4,4,e,t)}function qs(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 Js(e,t,n){n=n==null?null:n.concat([e]),Bs(4,4,qs.bind(null,t,e),n)}function Ys(){}function Xs(e,t){var n=ls();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&es(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Zs(e,t){var n=ls();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&es(t,r[1]))return r[0];if(r=e(),Jo){$e(!0);try{e()}finally{$e(!1)}}return n.memoizedState=[r,t],r}function Qs(e,t,n){return n===void 0||Ho&1073741824&&!(od&261930)?e.memoizedState=t:(e.memoizedState=n,e=Bd(),Uo.lanes|=e,md|=e,n)}function $s(e,t,n,r){return Br(n,t)?n:Eo.current===null?!(Ho&106)||Ho&1073741824&&!(od&261930)?(Fc=!0,e.memoizedState=n):(e=Bd(),Uo.lanes|=e,md|=e,t):(e=Qs(e,n,r),Br(e,t)||(Fc=!0),e)}function ec(e,t,n,r,i){var a=N.p;N.p=a!==0&&8>a?a:8;var o=M.T,s={};s.types=o===null?null:o.types,M.T=s,fc(e,!1,t,n);try{var c=i(),l=M.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?dc(e,t,Ua(c,r),zd(e)):dc(e,t,r,zd(e))}catch(n){dc(e,t,{then:function(){},status:`rejected`,reason:n},zd())}finally{N.p=a,o!==null&&s.types!==null&&(o.types=s.types),M.T=o}}function tc(){}function nc(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=rc(e).queue;ec(e,a,t,ge,n===null?tc:function(){return ic(e),n(r)})}function rc(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ge,baseState:ge,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:ge},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ms,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ic(e){var t=rc(e);t.next===null&&(t=e.alternate.memoizedState),dc(e,t.next.queue,{},zd())}function ac(){return Ta(vh)}function oc(){return ls().memoizedState}function sc(){return ls().memoizedState}function cc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=zd();e=_o(n);var r=vo(t,e,n);r!==null&&(Hd(r,t,n),yo(r,t,n)),t={cache:Ma()},e.payload=t;return}t=t.return}}function lc(e,t,n){var r=zd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},pc(e)?mc(t,n):(n=Ti(e,t,n,r),n!==null&&(Hd(n,e,r),hc(n,t,r)))}function uc(e,t,n){dc(e,t,n,zd())}function dc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(pc(e))mc(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,Br(s,o))return wi(e,t,i,0),id===null&&Ci(),!1}catch{}if(n=Ti(e,t,i,r),n!==null)return Hd(n,e,r),hc(n,t,r),!0}return!1}function fc(e,t,n,r){if(r={lane:2,revertLane:Uf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},pc(e)){if(t)throw Error(i(479))}else t=Ti(e,n,r,2),t!==null&&Hd(t,e,2)}function pc(e){var t=e.alternate;return e===Uo||t!==null&&t===Uo}function mc(e,t){qo=Ko=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function hc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,_t(e,n)}}var gc={readContext:Ta,use:fs,useCallback:$o,useContext:$o,useEffect:$o,useImperativeHandle:$o,useLayoutEffect:$o,useInsertionEffect:$o,useMemo:$o,useReducer:$o,useRef:$o,useState:$o,useDebugValue:$o,useDeferredValue:$o,useTransition:$o,useSyncExternalStore:$o,useId:$o,useHostTransitionStatus:$o,useFormState:$o,useActionState:$o,useOptimistic:$o,useMemoCache:$o,useCacheRefresh:$o,useEffectEvent:$o},_c={readContext:Ta,use:fs,useCallback:function(e,t){return cs().memoizedState=[e,t===void 0?null:t],e},useContext:Ta,useEffect:Vs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),zs(4194308,4,qs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return zs(4194308,4,e,t)},useInsertionEffect:function(e,t){zs(4,2,e,t)},useMemo:function(e,t){var n=cs();t=t===void 0?null:t;var r=e();if(Jo){$e(!0);try{e()}finally{$e(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=cs();if(n!==void 0){var i=n(t);if(Jo){$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=lc.bind(null,Uo,e),[r.memoizedState,e]},useRef:function(e){var t=cs();return e={current:e},t.memoizedState=e},useState:function(e){e=ws(e);var t=e.queue,n=uc.bind(null,Uo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ys,useDeferredValue:function(e,t){return Qs(cs(),e,t)},useTransition:function(){var e=ws(!1);return e=ec.bind(null,Uo,e.queue,!0,!1),cs().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Uo,a=cs();if(ia){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),id===null)throw Error(i(349));od&127||ys(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Vs(xs.bind(null,r,o,e),[e]),r.flags|=2048,Ls(9,{destroy:void 0},bs.bind(null,r,o,n,t),null),n},useId:function(){var e=cs(),t=id.identifierPrefix;if(ia){var n=Xi,r=Yi;n=(r&~(1<<32-et(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Yo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Qo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:ac,useFormState:Ns,useActionState:Ns,useOptimistic:function(e){var t=cs();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=fc.bind(null,Uo,!0,n),n.dispatch=t,[e,t]},useMemoCache:ps,useCacheRefresh:function(){return cs().memoizedState=cc.bind(null,Uo)},useEffectEvent:function(e){var t=cs(),n={impl:e};return t.memoizedState=n,function(){if(rd&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},vc={readContext:Ta,use:fs,useCallback:Xs,useContext:Ta,useEffect:Hs,useImperativeHandle:Js,useInsertionEffect:Gs,useLayoutEffect:Ks,useMemo:Zs,useReducer:hs,useRef:Rs,useState:function(){return hs(ms)},useDebugValue:Ys,useDeferredValue:function(e,t){return $s(ls(),Wo.memoizedState,e,t)},useTransition:function(){var e=hs(ms)[0],t=ls().memoizedState;return[typeof e==`boolean`?e:ds(e),t]},useSyncExternalStore:vs,useId:oc,useHostTransitionStatus:ac,useFormState:Ps,useActionState:Ps,useOptimistic:function(e,t){return Ts(ls(),Wo,e,t)},useMemoCache:ps,useCacheRefresh:sc,useEffectEvent:Ws},yc={readContext:Ta,use:fs,useCallback:Xs,useContext:Ta,useEffect:Hs,useImperativeHandle:Js,useInsertionEffect:Gs,useLayoutEffect:Ks,useMemo:Zs,useReducer:_s,useRef:Rs,useState:function(){return _s(ms)},useDebugValue:Ys,useDeferredValue:function(e,t){var n=ls();return Wo===null?Qs(n,e,t):$s(n,Wo.memoizedState,e,t)},useTransition:function(){var e=_s(ms)[0],t=ls().memoizedState;return[typeof e==`boolean`?e:ds(e),t]},useSyncExternalStore:vs,useId:oc,useHostTransitionStatus:ac,useFormState:V,useActionState:V,useOptimistic:function(e,t){var n=ls();return Wo===null?(n.baseState=e,[e,n.queue.dispatch]):Ts(n,Wo,e,t)},useMemoCache:ps,useCacheRefresh:sc,useEffectEvent:Ws};function bc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:w({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var xc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=zd(),i=_o(r);i.payload=t,n!=null&&(i.callback=n),t=vo(e,i,r),t!==null&&(Hd(t,e,r),yo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=zd(),i=_o(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=vo(e,i,r),t!==null&&(Hd(t,e,r),yo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=zd(),r=_o(n);r.tag=2,t!=null&&(r.callback=t),t=vo(e,r,n),t!==null&&(Hd(t,e,n),yo(t,e,n))}};function Sc(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?!Vr(n,r)||!Vr(i,a):!0}function Cc(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&&xc.enqueueReplaceState(t,t.state,null)}function wc(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=w({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Tc(e){yi(e)}function Ec(e){console.error(e)}function Dc(e){yi(e)}function Oc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function kc(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 Ac(e,t,n){return n=_o(n),n.tag=3,n.payload={element:null},n.callback=function(){Oc(e,t)},n}function jc(e){return e=_o(e),e.tag=3,e}function Mc(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(){kc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){kc(t,n,r),typeof i!=`function`&&(Ed===null?Ed=new Set([this]):Ed.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Nc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Sa(t,n,a,!0),n=jo.current,n!==null){switch(n.tag){case 31:case 13:case 19:return Mo===null?ef():n.alternate===null&&pd===0&&(pd=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Qa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Cf(e,r,a)),!1;case 22:return n.flags|=65536,r===Qa?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)),Cf(e,r,a)),!1}throw Error(i(435,n.tag))}return Cf(e,r,a),ef(),!1}if(ia)return t=jo.current,t===null?(r!==sa&&(t=Error(i(423),{cause:r}),ma(Vi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Vi(r,n),a=Ac(e.stateNode,r,a),bo(e,a),pd!==4&&(pd=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==sa&&(e=Error(i(422),{cause:r}),ma(Vi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Vi(o,n),yd===null?yd=[o]:yd.push(o),pd!==4&&(pd=2),t===null)return!0;r=Vi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Ac(n.stateNode,r,e),bo(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`&&(Ed===null||!Ed.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=jc(a),Mc(a,e,n,r),bo(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Pc=Error(i(461)),Fc=!1;function Ic(e,t,n,r){t.child=e===null?po(t,null,n,r):fo(t,e.child,n,r)}function Lc(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 wa(t),r=ts(e,t,n,o,a,i),s=as(),e!==null&&!Fc?(os(e,t,i),dl(e,t,i)):(ia&&s&&$i(t),t.flags|=1,Ic(e,t,r,i),t.child)}function Rc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Mi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,zc(e,t,a,r,i)):(e=Fi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!fl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Vr:n,n(o,r)&&e.ref===t.ref)return dl(e,t,i)}return t.flags|=1,e=Ni(a,r),e.ref=t.ref,e.return=t,t.child=e}function zc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Vr(a,r)&&e.ref===t.ref){if(Fc=!1,t.pendingProps=r=a,fl(e,i))e.flags&131072&&(Fc=!0);else return t.lanes=e.lanes,dl(e,t,i)}}return qc(e,t,n,r,i)}function Bc(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 Hc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&qa(t,a===null?null:a.cachePool),a===null?ko():Oo(t,a),Fo(t);else return r=t.lanes=536870912,Hc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&qa(t,null),ko(),Io()):(qa(t,a.cachePool),Oo(t,a),Io(),t.memoizedState=null);return Ic(e,t,i,n),t.child}function Vc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Hc(e,t,n,r,i){var a=Ka();return a=a===null?null:{parent:ja._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&qa(t,null),ko(),Fo(t),e!==null&&Sa(e,t,r,!0),t.childLanes=i,null}function Uc(e,t){return t=nl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Wc(e,t,n){return fo(t,e.child,null,n),e=Uc(t,t.pendingProps),e.flags|=2,Lo(t),t.memoizedState=null,e}function Gc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(ia){if(r.mode===`hidden`)return e=Uc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Vc(null,e);if(Po(t),(e=ra)?(e=gm(e,oa),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ji===null?null:{id:Yi,overflow:Xi},retryLane:536870912,hydrationErrors:null},n=Ri(e),n.return=t,t.child=n,na=t,ra=null)):e=null,e===null)throw ca(t);return t.lanes=536870912,null}return Uc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(Po(t),a){if(t.flags&256)t.flags&=-257,t=Wc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Fc||Sa(e,t,n,!1),a=(n&e.childLanes)!==0,Fc||a){if(Eo.current===null){if(r=id,r!==null&&(s=vt(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Ei(e,s),Hd(r,e,s),Pc;ef()}t=Wc(e,t,n)}else e=o.treeContext,ra=bm(s.nextSibling),na=t,ia=!0,aa=null,oa=!1,e!==null&&ta(t,e),t=Uc(t,r),t.flags|=134221824;return t}return e=Ni(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Kc(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 qc(e,t,n,r,i){return wa(t),n=ts(e,t,n,r,void 0,i),r=as(),e!==null&&!Fc?(os(e,t,i),dl(e,t,i)):(ia&&r&&$i(t),t.flags|=1,Ic(e,t,n,i),t.child)}function Jc(e,t,n,r,i,a){return wa(t),t.updateQueue=null,n=rs(t,r,n,i),ns(e),r=as(),e!==null&&!Fc?(os(e,t,a),dl(e,t,a)):(ia&&r&&$i(t),t.flags|=1,Ic(e,t,n,a),t.child)}function Yc(e,t,n,r,i){if(wa(t),t.stateNode===null){var a=ki,o=n.contextType;typeof o==`object`&&o&&(a=Ta(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=xc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},ho(t),o=n.contextType,a.context=typeof o==`object`&&o?Ta(o):ki,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(bc(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&&xc.enqueueReplaceState(a,a.state,null),Co(t,r,a,i),So(),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=wc(n,s);a.props=c;var l=a.context,u=n.contextType;o=ki,typeof u==`object`&&u&&(o=Ta(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)&&Cc(t,a,r,o),mo=!1;var f=t.memoizedState;a.state=f,Co(t,r,a,i),So(),l=t.memoizedState,s||f!==l||mo?(typeof d==`function`&&(bc(t,n,d,r),l=t.memoizedState),(c=mo||Sc(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,go(e,t),o=t.memoizedProps,u=wc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ki,typeof l==`object`&&l&&(c=Ta(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)&&Cc(t,a,r,c),mo=!1,f=t.memoizedState,a.state=f,Co(t,r,a,i),So();var p=t.memoizedState;o!==d||f!==p||mo||e!==null&&e.dependencies!==null&&Ca(e.dependencies)?(typeof s==`function`&&(bc(t,n,s,r),p=t.memoizedState),(u=mo||Sc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ca(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,Kc(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=fo(t,e.child,null,i),t.child=fo(t,null,n,i)):Ic(e,t,n,i),t.memoizedState=a.state,e=t.child):e=dl(e,t,i),e}function Xc(e,t,n,r){return fa(),t.flags|=256,Ic(e,t,n,r),t.child}var Zc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qc(e){return{baseLanes:e,cachePool:Ja()}}function $c(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=_d),e}function el(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Ro.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(ia){if(i?No(t):Io(),(e=ra)?(e=gm(e,oa),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ji===null?null:{id:Yi,overflow:Xi},retryLane:536870912,hydrationErrors:null},n=Ri(e),n.return=t,t.child=n,na=t,ra=null)):e=null,e===null)throw ca(t);return t.lanes=vm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Io(),i=t.mode,a=nl({mode:`hidden`,children:a},i),r=Ii(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=$c(e,o,n),t.memoizedState=Zc,Vc(null,r)):(No(t),tl(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return il(e,t,a,o,r,c,s,n)}return i?(Io(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Ni(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=Ii(i,a,n,null),i.flags|=2):i=Ni(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Vc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Qc(n):(a=i.cachePool,a===null?a=Ja():(s=ja._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=$c(e,o,n),t.memoizedState=Zc,Vc(e.child,r)):(No(t),n=e.child,e=n.sibling,n=Ni(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 tl(e,t){return t=nl({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function nl(e,t){return e=ji(22,e,null,t),e.lanes=0,e}function rl(e,t,n){return fo(t,e.child,null,n),e=tl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function il(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(No(t),t.flags&=-257,rl(e,t,c)):t.memoizedState===null?(Io(),o=a.fallback,s=t.mode,a=nl({mode:`visible`,children:a.children},s),o=Ii(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,fo(t,e.child,null,c),a=t.child,a.memoizedState=Qc(c),a.childLanes=$c(e,r,c),t.memoizedState=Zc,Vc(null,a)):(Io(),t.child=e.child,t.flags|=128,null);if(No(t),vm(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,ma({value:a,source:null,stack:null})),rl(e,t,c)}if(Fc||Sa(e,t,c,!1),r=(c&e.childLanes)!==0,Fc||r){if(Eo.current!==null)return rl(e,t,c);if(r=id,r!==null&&(a=vt(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,Ei(e,a),Hd(r,e,a),Pc;return _m(o)||ef(),rl(e,t,c)}return _m(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,ra=bm(o.nextSibling),na=t,ia=!0,aa=null,oa=!1,e!==null&&ta(t,e),t=tl(t,a.children),t.flags|=134221824,t)}function al(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ba(e.return,t,n)}function ol(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Vo(n)===null&&(t=e),e=e.sibling}return t}function sl(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 cl(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 ll(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Ro.current;if(t.flags&128)return zo(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,zo(t,o),i===`backwards`&&e!==null?(cl(e),Ic(e,t,r,n),cl(e)):Ic(e,t,r,n),r=ia?Gi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&al(e,n,t);else if(e.tag===19)al(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=ol(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,cl(t)),sl(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&&Vo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}sl(t,!0,n,null,a,r);break;case`together`:sl(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=ol(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),sl(t,!1,i,n,a,r)}return t.child}function ul(e,t,n){var r=t.pendingProps;return va(t,t.type,r.value),Ic(e,t,r.children,n),t.child}function dl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),md|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(Sa(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=Ni(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ni(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function fl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Ca(e)))}function pl(e,t,n){switch(t.tag){case 3:Ee(t,t.stateNode.containerInfo),va(t,ja,e.memoizedState.cache),fa();break;case 27:case 5:Oe(t);break;case 4:Ee(t,t.stateNode.containerInfo);break;case 10:va(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Po(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return No(t),t.flags|=128,null;r=Sa(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?el(e,t,n):(No(t),e=dl(e,t,n),e===null?null:e.sibling)}No(t);break;case 19:if(t.flags&128)return ll(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(Sa(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return ll(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),zo(t,Ro.current),r)break;return null;case 22:return t.lanes=0,Bc(e,t,n,t.pendingProps);case 24:va(t,ja,e.memoizedState.cache)}return dl(e,t,n)}function ml(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Fc=!0;else{if(!fl(e,n)&&!(t.flags&128))return Fc=!1,pl(e,t,n);Fc=!!(e.flags&131072)}}else Fc=!1,ia&&t.flags&1048576&&Qi(t,Gi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=to(t.elementType),t.type=e,typeof e==`function`)Mi(e)?(r=wc(e,r),t.tag=1,t=Yc(null,t,e,r,n)):(t.tag=0,t=qc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===A){t.tag=11,t=Lc(null,t,e,r,n);break a}if(a===ae){t.tag=14,t=Rc(null,t,e,r,n);break a}if(a===ne){t.tag=10,t.type=e,t=ul(null,t,n);break a}}throw t=me(e)||e,Error(i(306,t,``))}}return t;case 0:return qc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=wc(r,t.pendingProps),Yc(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,go(e,t),Co(t,r,null,n);var s=t.memoizedState;if(r=s.cache,va(t,ja,r),r!==o.cache&&xa(t,[ja],n,!0),So(),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=Xc(e,t,r,n);break a}if(r!==a){a=Vi(Error(i(424)),t),ma(a),t=Xc(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(ra=bm(e.firstChild),na=t,ia=!0,aa=null,oa=!0,n=po(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(fa(),r===a){t=dl(e,t,n);break a}Ic(e,t,r,n)}t=t.child}return t;case 26:return Kc(e,t),e===null?(n=Wm(t.type,null,t.pendingProps,null))?t.memoizedState=n:ia||(t.stateNode=Cp(t.type,t.pendingProps,we.current,t)):t.memoizedState=Wm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Oe(t),e===null&&ia&&(r=t.stateNode=Em(t.type,t.pendingProps,we.current),na=t,oa=!0,a=ra,Np(t.type)?(xm=a,ra=bm(r.firstChild)):ra=a),Ic(e,t,t.pendingProps.children,n),Kc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ia&&((a=r=ra)&&(r=mm(r,t.type,t.pendingProps,oa),r===null?a=!1:(t.stateNode=r,na=t,ra=bm(r.firstChild),oa=!1,a=!0)),a||ca(t)),Oe(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,wp(a,o)?r=null:s!==null&&wp(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=ts(e,t,is,null,null,n),vh._currentValue=a),Kc(e,t),Ic(e,t,r,n),t.child;case 6:return e===null&&ia&&((e=n=ra)&&(n=hm(n,t.pendingProps,oa),n===null?e=!1:(t.stateNode=n,na=t,ra=null,e=!0)),e||ca(t)),null;case 13:return el(e,t,n);case 4:return Ee(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=fo(t,null,r,n):Ic(e,t,r,n),t.child;case 11:return Lc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Kc(e,t),Ic(e,t,r,n),t.child;case 8:return Ic(e,t,t.pendingProps.children,n),t.child;case 12:return Ic(e,t,t.pendingProps.children,n),t.child;case 10:return ul(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,wa(t),a=Ta(a),r=r(a),t.flags|=1,Ic(e,t,r,n),t.child;case 14:return Rc(e,t,t.type,t.pendingProps,n);case 15:return zc(e,t,t.type,t.pendingProps,n);case 19:return ll(e,t,n);case 31:return Gc(e,t,n);case 22:return Bc(e,t,n,t.pendingProps);case 24:return wa(t),r=Ta(ja),e===null?(a=Ka(),a===null&&(a=id,o=Ma(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},ho(t),va(t,ja,a)):((e.lanes&n)!==0&&(go(e,t),Co(t,null,null,n),So()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,va(t,ja,r),r!==a.cache&&xa(t,[ja],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),va(t,ja,r))),Ic(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:ia&&$i(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Kc(e,t),Ic(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function hl(e){e.flags|=4}function gl(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?ah(t,r):ah(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(Zd())e.flags|=8192;else throw no=Qa,Xa}}else e.flags&=-16777217}function _l(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!oh(t)){if(Zd())e.flags|=8192;else throw no=Qa,Xa}}function vl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:ft(),e.lanes|=t,vd|=t)}function yl(e,t){if(!ia)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 bl(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 xl(e,t,n){var r=t.pendingProps;switch(ea(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return bl(t),null;case 1:return bl(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),ya(ja),De(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(da(t)?hl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,pa())),bl(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(hl(t),o===null?(bl(t),gl(t,a,null,r,n)):(bl(t),_l(t,o))):o?o===e.memoizedState?(bl(t),t.flags&=-16777217):(hl(t),bl(t),_l(t,o)):(e=e.memoizedProps,e!==r&&hl(t),bl(t),gl(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&&hl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return bl(t),t.subtreeFlags&=-33554433,null}e=Se.current,da(t)?la(t,e):(e=Em(a,r,n),t.stateNode=e,hl(t))}return bl(t),t.subtreeFlags&=-33554433,null;case 5:if(ke(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&hl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return bl(t),t.subtreeFlags&=-33554433,null}if(o=Se.current,da(t))la(t,o);else{var s=bp(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[Ct]=t,o[wt]=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(pp(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&&hl(t)}}return bl(t),t.subtreeFlags&=-33554433,gl(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&hl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=we.current,da(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=na,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[Ct]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||up(e.nodeValue,n)),e||ca(t,!0)}else e=bp(e).createTextNode(r),e[Ct]=t,t.stateNode=e}return bl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=da(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[Ct]=t}else fa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;bl(t),e=!1}else n=pa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Lo(t),t):(Lo(t),null);if(t.flags&128)throw Error(i(558))}return bl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=da(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[Ct]=t}else fa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;bl(t),a=!1}else a=pa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Lo(t),t):(Lo(t),null)}return Lo(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),vl(t,t.updateQueue),bl(t),null);case 4:return De(),e===null&&ep(t.stateNode.containerInfo),t.flags|=67108864,bl(t),null;case 10:return ya(t.type),bl(t),null;case 19:if(Bo(t),r=t.memoizedState,r===null)return bl(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)yl(r,!1);else{if(pd!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Vo(e),o!==null){for(t.flags|=128,yl(r,!1),e=o.updateQueue,t.updateQueue=e,vl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Pi(n,e),n=n.sibling;return zo(t,Ro.current&1|2),ia&&Zi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&He()>wd&&(t.flags|=128,a=!0,yl(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Vo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,vl(t,e),yl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!ia)return bl(t),null}else 2*He()-r.renderingStartTime>wd&&n!==536870912&&(t.flags|=128,a=!0,yl(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=Ro.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||ia?zo(t,o):(n=o,xe(jo,t),xe(Ro,n),Mo===null&&(Mo=t)),ia&&Zi(t,r.treeForkCount),e}return bl(t),null;case 22:case 23:return Lo(t),Ao(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(bl(t),t.subtreeFlags&6&&(t.flags|=8192)):bl(t),n=t.updateQueue,n!==null&&vl(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(Ga),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),ya(ja),bl(t),null;case 25:return null;case 30:return t.flags|=33554432,bl(t),null}throw Error(i(156,t.tag))}function Sl(e,t){switch(ea(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ya(ja),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(Lo(t),t.alternate===null)throw Error(i(340));fa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Lo(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));fa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Bo(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 ya(t.type),null;case 22:case 23:return Lo(t),Ao(),e!==null&&be(Ga),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return ya(ja),null;case 25:return null;default:return null}}function Cl(e,t){switch(ea(t),t.tag){case 3:ya(ja),De();break;case 26:case 27:case 5:ke(t);break;case 4:De();break;case 31:t.memoizedState!==null&&Lo(t);break;case 13:Lo(t);break;case 19:Bo(t);break;case 10:ya(t.type);break;case 22:case 23:Lo(t),Ao(),e!==null&&be(Ga);break;case 24:ya(ja)}}function wl(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){Sf(t,t.return,e)}}function Tl(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){Sf(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Sf(t,t.return,e)}}function El(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{To(t,n)}catch(t){Sf(e,e.return,t)}}}function Dl(e,t,n){n.props=wc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Sf(e,t,n)}}function Ol(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=Gp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Kp(e);f(e.child,!1,lm,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){Sf(e,t,n)}}function kl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Sf(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){Sf(e,t,n)}else n.current=null}}function Al(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++)dm(e.stateNode,t[n])}function jl(e){for(var t=e.return;t!==null&&(Pl(t)&&dm(e.stateNode,t.stateNode),!Nl(t));)t=t.return}function Ml(e){for(var t=e.return;t!==null&&(Pl(t)&&fm(e.stateNode,t.stateNode),!Nl(t));)t=t.return}function Nl(e){return e.tag===5||e.tag===3||e.tag===27}function Pl(e){return e&&e.tag===7&&e.stateNode!==null}function Fl(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){Sf(e,e.return,t)}}function Il(e,t,n){try{var r=e.stateNode;hp(r,e.type,n,t),r[wt]=t}catch(t){Sf(e,e.return,t)}}function Ll(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Np(e.type)||e.tag===4}function Rl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ll(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&&Np(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 zl(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=_n)),Al(e,r),Kt=!0;else if(i!==4&&(i===27&&(Al(e,r),r=null,Np(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(zl(e,t,n,r),e=e.sibling;e!==null;)zl(e,t,n,r),e=e.sibling}function Bl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),Al(e,r),Kt=!0;else if(i!==4&&(i===27&&(Al(e,r),r=null,Np(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Bl(e,t,n,r),e=e.sibling;e!==null;)Bl(e,t,n,r),e=e.sibling}function Vl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);pp(t,r,n),t[Ct]=e,t[wt]=n}catch(t){Sf(e,e.return,t)}}var Hl=!1,Ul=null;function Wl(e){(e.tag===30||e.subtreeFlags&33554432)&&(Hl=!0)}var Gl=null;function Kl(){var e=Gl;return Gl=null,e}var ql=0;function Jl(e,t,n,r,i){return ql=0,Yl(e.child,t,n,r,i)}function Yl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=zp(o);r.push(s),s.view&&(a=!0)}else a||zp(o).view&&(a=!0);Hl=!0,Ip(o,ql===0?t:t+`_`+ql,n),ql++}else e.tag===22&&e.memoizedState!==null||e.tag===30&&i||Yl(e.child,t,n,r,i)&&(a=!0);e=e.sibling}return a}function Xl(e,t){for(;e!==null;)e.tag===5?Lp(e.stateNode,e.memoizedProps):e.tag===22&&e.memoizedState!==null||e.tag===30&&t||Xl(e.child,t),e=e.sibling}function Zl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Zl(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`&&(Jl(e,n,t,null,!1)||Xl(e.child,!1))}e=e.sibling}}function Ql(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`?Zl(e):Jl(e,i,a,null,!1)?(Zl(e),n.paired||t||Vd(e,r.onEnter)):Xl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Ql(e,t),e=e.sibling;else Zl(e)}function $l(e){if(Ul!==null&&Ul.size!==0){var t=Ul;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`&&(Jl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Vd(e,n.onShare)):Xl(e.child,!1)),t.delete(r),t.size===0)break}}}$l(e)}e=e.sibling}}}function eu(e){if(e.tag===30){var t=e.memoizedProps,n=gi(t,e.stateNode),r=Ul===null?void 0:Ul.get(n),i=vi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Jl(e,n,i,null,!1)?r===void 0?Vd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Ul.delete(n),Vd(e,t.onShare)):Xl(e.child,!1)),Ul!==null&&$l(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)eu(e),e=e.sibling;else Ul!==null&&$l(e)}function tu(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`&&Jl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&tu(e);e=e.sibling}}function nu(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,Xl(e.child,!1))}nu(e)}e=e.sibling}}function ru(e){if(e.tag===30)e.stateNode.paired=null,Xl(e.child,!1),nu(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)ru(e),e=e.sibling;else nu(e)}function iu(e){for(e=e.child;e!==null;)e.tag===30?Xl(e.child,!1):e.subtreeFlags&33554432&&iu(e),e=e.sibling}function au(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&ql<a.length){var l=a[ql],u=zp(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&&Ip(c,ql===0?n:n+`_`+ql,i),s&&e.flags&4||(Gl===null&&(Gl=[]),Gl.push(c,ql===0?r:r+`_`+ql,t.memoizedProps)),ql++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:au(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function ou(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(Bp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;ql=0,i=au(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Vd(e,n.onUpdate))}else e.subtreeFlags&33554432&&ou(e,t);e=e.sibling}}var su=!1,cu=!1,lu=!1,uu=!1,du=typeof WeakSet==`function`?WeakSet:Set,fu=null,pu=!1,mu=!1,hu=!1,gu=!1;function _u(e,t,n){if(e=e.containerInfo,vp=Dh,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(yp={focusedElem:e,selectionRange:r},Dh=!1,n=(n&335544064)===n,fu=t,t=n?9270:1024;fu!==null;){if(e=fu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&eu(r[a]);if(e.alternate===null&&e.flags&2)n&&Wl(e),vu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&eu(r),vu(n);continue}if(r!==null&&r.memoizedState!==null){n&&Wl(e),vu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,fu=r):(n&&tu(e),vu(n))}}Ul=null}function vu(e){for(;fu!==null;){var t=fu,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=wc(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){Sf(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)pm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:pm(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`&&Jl(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,fu=r;break}fu=t.return}}function yu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:zu(e,n),r&4&&wl(5,n);break;case 1:if(zu(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Sf(n,n.return,e)}else{var i=wc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Sf(n,n.return,e)}}}r&64&&El(n),r&512&&Ol(n,n.return);break;case 3:if(zu(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{To(e,t)}catch(e){Sf(n,n.return,e)}}break;case 27:t===null&&r&4&&Vl(n);case 26:case 5:zu(e,n),t===null&&r&4&&Fl(n),r&512&&Ol(n,n.return);break;case 12:zu(e,n);break;case 31:zu(e,n),r&4&&Ou(e,n);break;case 13:zu(e,n),r&4&&ku(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Ef.bind(null,n),ym(e,n))));break;case 22:if(r=n.memoizedState!==null||su,!r){var a=t!==null&&t.memoizedState!==null||cu;t=su,i=cu,su=r,(cu=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Vu(e,n,r)):zu(e,n),su=t,cu=i}break;case 30:zu(e,n),r&512&&Ol(n,n.return);break;case 7:r&512&&Ol(n,n.return);default:zu(e,n)}}function bu(e,t){for(e=e.child;e!==null;)xu(e,t),e=e.sibling}function xu(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){Sf(e,e.return,t)}Su(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,Kt=!0}catch(t){Sf(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?Fp(s,!0):Fp(e.stateNode,!1)}catch(t){Sf(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&bu(e,t);break;default:bu(e,t)}}function Su(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:xu(n,r);break a;case 22:n.memoizedState===null&&Su(n,r);break a;default:Su(n,r)}}e=e.sibling}}function Cu(e){var t=e.alternate;t!==null&&(e.alternate=null,Cu(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 wu=null,Tu=!1;function Eu(e,t,n){for(n=n.child;n!==null;)Du(e,t,n),n=n.sibling}function Du(e,t,n){if(Qe&&typeof Qe.onCommitFiberUnmount==`function`)try{Qe.onCommitFiberUnmount(Ze,n)}catch{}switch(n.tag){case 26:cu||kl(n,t),Eu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!cu&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:cu||kl(n,t),Ml(n);var r=wu,i=Tu;Np(n.type)&&(wu=n.stateNode,Tu=!1),Eu(e,t,n),Dm(n.stateNode,n.type,n.memoizedProps),wu=r,Tu=i;break;case 5:cu||kl(n,t),Ml(n);case 6:if(n.tag===6&&Ml(n),r=wu,i=Tu,wu=null,Eu(e,t,n),wu=r,Tu=i,wu!==null){if(Tu)try{(wu.nodeType===9?wu.body:wu.nodeName===`HTML`?wu.ownerDocument.body:wu).removeChild(n.stateNode),Kt=!0}catch(e){Sf(n,t,e)}else try{wu.removeChild(n.stateNode),Kt=!0}catch(e){Sf(n,t,e)}}break;case 18:wu!==null&&(Tu?(e=wu,Pp(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),$h(e)):Pp(wu,n.stateNode));break;case 4:r=wu,i=Tu,wu=n.stateNode.containerInfo,Tu=!0,Eu(e,t,n),wu=r,Tu=i;break;case 0:case 11:case 14:case 15:Tl(2,n,t),cu||Tl(4,n,t),Eu(e,t,n);break;case 1:cu||(kl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Dl(n,t,r)),Eu(e,t,n);break;case 21:Eu(e,t,n);break;case 22:cu=(r=cu)||n.memoizedState!==null,Eu(e,t,n),cu=r;break;case 30:kl(n,t),Eu(e,t,n);break;case 7:cu||kl(n,t),Eu(e,t,n);break;default:Eu(e,t,n)}}function Ou(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{$h(e)}catch(e){Sf(t,t.return,e)}}}function ku(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{$h(e)}catch(e){Sf(t,t.return,e)}}function Au(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new du),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new du),t;default:throw Error(i(435,e.tag))}}function ju(e,t){var n=Au(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Df.bind(null,e,t);t.then(r,r)}})}function Mu(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(Np(l.type)){wu=l.stateNode,Tu=!1;break a}break;case 5:wu=l.stateNode,Tu=!1;break a;case 3:case 4:wu=l.stateNode.containerInfo,Tu=!0;break a}l=l.return}if(wu===null)throw Error(i(160));Du(s,c,o),wu=null,Tu=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Pu(t,e,n),t=t.sibling}var Nu=null;function Pu(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}Mu(t,e,n),Fu(e),a&4&&(Tl(3,e,e.return),wl(3,e),Tl(5,e,e.return));break;case 1:Mu(t,e,n),Fu(e),a&512&&(cu||r===null||kl(r,r.return)),a&64&&su&&(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=Nu,Mu(t,e,n),Fu(e),a&512&&(cu||r===null||kl(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(su)e.stateNode=Cp(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[Ct]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),pp(r,t,n),r[Ct]=e,Lt(r),t=r;break a;case`link`:if(o=nh(`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),pp(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=nh(`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),pp(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[Ct]=e,Lt(r),t=r}e.stateNode=t}}else su||rh(o,e.type,e.stateNode)}else e.stateNode=Zm(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&Il(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||cu||t.parentNode.removeChild(t)):a.count--,n===null?su||rh(o,e.type,e.stateNode):Zm(o,n,e.memoizedProps))}break;case 27:Mu(t,e,n),Fu(e),a&512&&(cu||r===null||kl(r,r.return)),r!==null&&a&4&&Il(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=lu,lu=!1,Mu(t,e,n),lu=o,Fu(e),a&512&&(cu||r===null||kl(r,r.return)),e.flags&32){t=e.stateNode;try{ln(t,``),Kt=!0}catch(t){Sf(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,Il(e,t,r===null?t:r.memoizedProps)),a&1024&&(uu=!0);break;case 6:if(Mu(t,e,n),Fu(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,Kt=!0}catch(t){Sf(e,e.return,t)}}break;case 3:if(Kt=!1,th=null,o=Nu,Nu=jm(t.containerInfo),Mu(t,e,n),Nu=o,Fu(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{$h(t.containerInfo)}catch(t){Sf(e,e.return,t)}uu&&(uu=!1,Iu(e)),Kt=!1;break;case 4:a=lu,lu=su,r=qt(),o=Nu,Nu=jm(e.stateNode.containerInfo),Mu(t,e,n),Fu(e),Nu=o,Kt&&mu&&(hu=!0),Kt=r,lu=a;break;case 12:Mu(t,e,n),Fu(e);break;case 31:Mu(t,e,n),Fu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,ju(e,t)));break;case 13:Mu(t,e,n),Fu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Sd=He()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,ju(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=su,l=cu,u=lu;su=c||o,lu=u||o,cu=l||s,Mu(t,e,n),cu=l,lu=u,su=c,Fu(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||su||cu||(t=s||cu,n=su,r=cu,su=o||su,cu=t,Bu(e,2),su=n,cu=r),!o&&lu||bu(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,ju(e,n))));break;case 19:Mu(t,e,n),Fu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,ju(e,t)));break;case 30:a&512&&(cu||r===null||kl(r,r.return)),a=qt(),o=mu,s=(n&335544064)===n,c=e.memoizedProps,mu=s&&vi(c.default,c.update)!==`none`,Mu(t,e,n),Fu(e),s&&r!==null&&Kt&&(e.flags|=4),mu=o,Kt=a;break;case 21:break;case 7:a&512&&(cu||r===null||kl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:Mu(t,e,n),Fu(e)}}function Fu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Ll(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(Pl(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(Nl(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;Bl(e,Rl(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(ln(l,``),n.flags&=-33),Bl(e,Rl(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;zl(e,Rl(e),u,s);break;default:throw Error(i(161))}}catch(t){Sf(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Iu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Iu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,Dh=!0,t.reset(),Dh=!1),e=e.sibling}}function Lu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Ru(t,e),t=t.sibling;else ou(t,!1)}function Ru(e,t){var n=e.alternate;if(n===null)Ql(e,!1);else switch(e.tag){case 3:if(gu=pu=!1,Kl(),Lu(t,e),!pu&&!hu){if(e=Gl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Lp(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`})),gu=!0}Gl=null;break;case 5:Lu(t,e);break;case 4:r=pu,pu=!1,Lu(t,e),pu&&(hu=!0),pu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Lu(t,e):Ql(e,!1));break;case 30:r=pu,i=Kl(),pu=!1,Lu(t,e),pu&&(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,ql=0,t=au(e,n,t,o,s,a,!0),ql!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Vd(e,e.memoizedProps.onUpdate),Gl=i):i!==null&&(i.push.apply(i,Gl),Gl=i),pu=e.flags&32?!0:r;break;default:Lu(t,e)}}function zu(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)yu(e,t.alternate,t),t=t.sibling}function Bu(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:Tl(4,n,n.return),Bu(n,r);break;case 1:kl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&Dl(n,n.return,i),Bu(n,r);break;case 27:r&2&&Dm(n.stateNode,n.type,n.memoizedProps);case 5:kl(n,n.return),n.tag!==5&&n.tag!==27||Ml(n),Bu(n,r);break;case 6:Ml(n);break;case 26:kl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||cu||i.parentNode.removeChild(i),Bu(n,r);break;case 22:n.memoizedState===null&&Bu(n,r);break;case 30:kl(n,n.return),Bu(n,r);break;case 7:kl(n,n.return);default:Bu(n,r)}e=e.sibling}}function Vu(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:Vu(i,a,n),wl(4,a);break;case 1:if(Vu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Sf(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++)wo(l[i],c)}catch(e){Sf(r,r.return,e)}}s&&o&64&&El(a),Ol(a,a.return);break;case 27:n&2&&Vl(a);case 5:a.tag!==5&&a.tag!==27||jl(a),Vu(i,a,n),s&&r===null&&o&4&&Fl(a),Ol(a,a.return);break;case 6:jl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||su||rh(jm(c.ownerDocument),a.type,c),Vu(i,a,n),s&&r===null&&o&4&&Fl(a),Ol(a,a.return);break;case 12:Vu(i,a,n);break;case 31:Vu(i,a,n),s&&o&4&&Ou(i,a);break;case 13:Vu(i,a,n),s&&o&4&&ku(i,a);break;case 22:a.memoizedState===null&&Vu(i,a,n),Ol(a,a.return);break;case 30:Vu(i,a,n),Ol(a,a.return);break;case 7:Ol(a,a.return);default:Vu(i,a,n)}t=t.sibling}}function Hu(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&&Na(n))}function Uu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Na(e))}function Wu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Gu(e,t,n,r),t=t.sibling;else i&&iu(t)}function Gu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&ru(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Wu(e,t,n,r),a&2048&&wl(9,t);break;case 1:Wu(e,t,n,r);break;case 3:Wu(e,t,n,r),i&&gu&&(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&&Na(a)));break;case 12:if(a&2048){Wu(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){Sf(t,t.return,e)}}else Wu(e,t,n,r);break;case 31:Wu(e,t,n,r);break;case 13:Wu(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&&ru(t),o._visibility&2?Wu(e,t,n,r):(o._visibility|=2,Ku(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&ru(s),o._visibility&2?Wu(e,t,n,r):qu(e,t)),a&2048&&Hu(s,t);break;case 24:Wu(e,t,n,r),a&2048&&Uu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Xl(a.child,!0),Xl(t.child,!0))),Wu(e,t,n,r);break;default:Wu(e,t,n,r)}}function Ku(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:Ku(a,o,s,c,i),wl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Ku(a,o,s,c,i)):u._visibility&2?Ku(a,o,s,c,i):qu(a,o),i&&l&2048&&Hu(o.alternate,o);break;case 24:Ku(a,o,s,c,i),i&&l&2048&&Uu(o.alternate,o);break;default:Ku(a,o,s,c,i)}t=t.sibling}}function qu(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:qu(n,r),i&2048&&Hu(r.alternate,r);break;case 24:qu(n,r),i&2048&&Uu(r.alternate,r);break;default:qu(n,r)}t=t.sibling}}var Ju=8192;function H(e,t,n){if(e.subtreeFlags&Ju)for(e=e.child;e!==null;)Yu(e,t,n),e=e.sibling}function Yu(e,t,n){switch(e.tag){case 26:H(e,t,n),e.flags&Ju&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&ch(n,e)):lh(n,Nu,e.memoizedState,e.memoizedProps));break;case 5:H(e,t,n),e.flags&Ju&&(e=e.stateNode,(t&335544128)===t&&ch(n,e));break;case 3:case 4:var r=Nu;Nu=jm(e.stateNode.containerInfo),H(e,t,n),Nu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Ju,Ju=16777216,H(e,t,n),Ju=r):H(e,t,n));break;case 30:if((e.flags&Ju)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Ul===null&&(Ul=new Map),Ul.set(r,i)}H(e,t,n);break;default:H(e,t,n)}}function Xu(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 Zu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];fu=r,ed(r,e)}Xu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Qu(e),e=e.sibling}function Qu(e){switch(e.tag){case 0:case 11:case 15:Zu(e),e.flags&2048&&Tl(9,e,e.return);break;case 3:Zu(e);break;case 12:Zu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,$u(e)):Zu(e);break;default:Zu(e)}}function $u(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];fu=r,ed(r,e)}Xu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Tl(8,t,t.return),$u(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,$u(t));break;default:$u(t)}e=e.sibling}}function ed(e,t){for(;fu!==null;){var n=fu;switch(n.tag){case 0:case 11:case 15:Tl(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:Na(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,fu=r;else a:for(n=e;fu!==null;){r=fu;var i=r.sibling,a=r.return;if(Cu(r),r===n){fu=null;break a}if(i!==null){i.return=a,fu=i;break a}fu=a}}}var td={getCacheForType:function(e){var t=Ta(ja),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ta(ja).controller.signal}},nd=typeof WeakMap==`function`?WeakMap:Map,rd=0,id=null,ad=null,od=0,sd=0,cd=null,ld=!1,ud=!1,dd=!1,fd=0,pd=0,md=0,hd=0,gd=0,_d=0,vd=0,yd=null,bd=null,xd=!1,Sd=0,Cd=0,wd=1/0,Td=null,Ed=null,Dd=0,Od=null,kd=null,Ad=0,jd=0,Md=null,Nd=null,Pd=null,Fd=null,Id=null,Ld=0,Rd=null;function zd(){return rd&2&&od!==0?od&-od:M.T===null?xt():Uf()}function Bd(){if(_d===0){if(!(od&536870912)||ia){var e=at;at<<=1,!(at&3932160)&&(at=262144),_d=e}else _d=536870912}return e=jo.current,e!==null&&(e.flags|=32),_d}function Vd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Gp(gi(e.memoizedProps,n))),Fd===null&&(Fd=[]),Fd.push(t.bind(null,r))}}function Hd(e,t,n){(e===id&&(sd===2||sd===9)||e.cancelPendingCommit!==null)&&(Yd(e,0),Kd(e,od,_d,!1)),mt(e,n),rd&2&&e===id||(e===id&&(!(rd&2)&&(hd|=n),pd===4&&Kd(e,od,_d,!1)),Ff(e))}function Ud(e,t,n){if(rd&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||lt(e,t),a=r?rf(e,t):tf(e,t,!0),o=r;do{if(a===0){ud&&!r&&Kd(e,t,0,!1);break}if(n=e.current.alternate,o&&!Gd(n))a=tf(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=yd;var l=c.current.memoizedState.isDehydrated;if(l&&(Yd(c,s).flags|=256),s=tf(c,s,!1),s!==2&&s!==6){if(dd&&!l){c.errorRecoveryDisabledLanes|=o,hd|=o,a=4;break a}o=bd,bd=a,o!==null&&(bd===null?bd=o:bd.push.apply(bd,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Yd(e,0),Kd(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:Kd(r,t,_d,!ld);break a;case 2:bd=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Sd+300-He(),10<a)){if(Kd(r,t,_d,!ld),ct(r,0,!0)!==0)break a;Ad=t,r.timeoutHandle=Dp(Wd.bind(null,r,n,bd,Td,xd,t,_d,hd,vd,ld,o,`Throttled`,-0,0),a);break a}Wd(r,n,bd,Td,xd,t,_d,hd,vd,ld,o,null,-0,0)}break}}while(1);Ff(e)}function Wd(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:_n},Ul=null,Yu(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=ph.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?Sd-He():(a&4194048)===a?Cd-He():0,m=dh(d,m),m!==null)?(Ad=a,e.cancelPendingCommit=m(df.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Kd(e,a,o,!l)):df(e,t,a,n,r,i,o,s,c,l,u,d)}function Gd(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(!Br(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 Kd(e,t,n,r){t=ut(e,t),t&=~gd,t&=~hd,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&&gt(e,n,t)}function qd(){return rd&6?!0:(If(0,!1),!1)}function Jd(){if(ad!==null){if(sd===0)var e=ad.return;else e=ad,_a=ga=null,ss(e),ao=null,oo=0,e=ad;for(;e!==null;)Cl(e.alternate,e),e=e.return;ad=null}}function Yd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,Op(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Ad=0,Jd(),id=e,ad=n=Ni(e.current,null),od=t,sd=0,cd=null,ld=!1,ud=lt(e,t),dd=!1,vd=_d=gd=hd=md=pd=0,bd=yd=null,xd=!1,fd=ut(e,t),Ci(),n}function Xd(e,t){Uo=null,M.H=gc,t===Ya||t===Za?(t=ro(),sd=3):t===Xa?(t=ro(),sd=4):sd=t===Pc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,cd=t,ad===null&&(pd=1,Oc(e,Vi(t,e.current)))}function Zd(){var e=jo.current;return e===null?!0:(od&4194048)===od?Mo===null:(od&62914560)===od||od&536870912?e===Mo:!1}function Qd(){var e=M.H;return M.H=gc,e===null?gc:e}function $d(){var e=M.A;return M.A=td,e}function ef(){pd=4,ld||(od&4194048)!==od&&jo.current!==null||(ud=!0),!(md&134217727)&&!(hd&134217727)||id===null||Kd(id,od,_d,!1)}function tf(e,t,n){var r=rd;rd|=2;var i=Qd(),a=$d();(id!==e||od!==t)&&(Td=null,Yd(e,t)),t=!1;var o=pd;a:do try{if(sd!==0&&ad!==null){var s=ad,c=cd;switch(sd){case 8:Jd(),o=6;break a;case 3:case 2:case 9:case 6:jo.current===null&&(t=!0);var l=sd;if(sd=0,cd=null,cf(e,s,c,l),n&&ud){o=0;break a}break;default:l=sd,sd=0,cd=null,cf(e,s,c,l)}}nf(),o=pd;break}catch(t){Xd(e,t)}while(1);return t&&e.shellSuspendCounter++,_a=ga=null,rd=r,M.H=i,M.A=a,ad===null&&(id=null,od=0,Ci()),o}function nf(){for(;ad!==null;)of(ad)}function rf(e,t){var n=rd;rd|=2;var r=Qd(),a=$d();id!==e||od!==t?(Td=null,wd=He()+500,Yd(e,t)):ud=lt(e,t);a:do try{if(sd!==0&&ad!==null){t=ad;var o=cd;b:switch(sd){case 1:sd=0,cd=null,cf(e,t,o,1);break;case 2:case 9:if($a(o)){sd=0,cd=null,sf(t);break}t=function(){sd!==2&&sd!==9||id!==e||(sd=7),Ff(e)},o.then(t,t);break a;case 3:sd=7;break a;case 4:sd=5;break a;case 7:$a(o)?(sd=0,cd=null,sf(t)):(sd=0,cd=null,cf(e,t,o,7));break;case 5:var s=null;switch(ad.tag){case 26:s=ad.memoizedState;case 5:case 27:var c=ad;if(s?oh(s):c.stateNode.complete){sd=0,cd=null;var l=c.sibling;if(l!==null)ad=l;else{var u=c.return;u===null?ad=null:(ad=u,lf(u))}break b}}sd=0,cd=null,cf(e,t,o,5);break;case 6:sd=0,cd=null,cf(e,t,o,6);break;case 8:Jd(),pd=6;break a;default:throw Error(i(462))}}af();break}catch(t){Xd(e,t)}while(1);return _a=ga=null,M.H=r,M.A=a,rd=n,ad===null?(id=null,od=0,Ci(),pd):0}function af(){for(;ad!==null&&!Be();)of(ad)}function of(e){var t=ml(e.alternate,e,fd);e.memoizedProps=e.pendingProps,t===null?lf(e):ad=t}function sf(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Jc(n,t,t.pendingProps,t.type,void 0,od);break;case 11:t=Jc(n,t,t.pendingProps,t.type.render,t.ref,od);break;case 5:ss(t);var r=t;r===na&&(ia?(ua(r),r.tag===5&&r.stateNode!=null&&(ra=r.stateNode)):(ua(r),ia=!0));default:Cl(n,t),t=ad=Pi(t,fd),t=ml(n,t,fd)}e.memoizedProps=e.pendingProps,t===null?lf(e):ad=t}function cf(e,t,n,r){_a=ga=null,ss(t),ao=null,oo=0;var i=t.return;try{if(Nc(e,i,t,n,od)){pd=1,Oc(e,Vi(n,e.current)),ad=null;return}}catch(t){if(i!==null)throw ad=i,t;pd=1,Oc(e,Vi(n,e.current)),ad=null;return}t.flags&32768?(ia||r===1?e=!0:ud||od&536870912?e=!1:(ld=e=!0,(r===2||r===9||r===3||r===6)&&(r=jo.current,r!==null&&r.tag===13&&(r.flags|=16384))),uf(t,e)):lf(t)}function lf(e){var t=e;do{if(t.flags&32768){uf(t,ld);return}e=t.return;var n=xl(t.alternate,t,fd);if(n!==null){ad=n;return}if(t=t.sibling,t!==null){ad=t;return}ad=t=e}while(t!==null);pd===0&&(pd=5)}function uf(e,t){do{var n=Sl(e.alternate,e);if(n!==null){n.flags&=32767,ad=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){ad=e;return}ad=e=n}while(e!==null);pd=6,ad=null}function df(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do yf();while(Dd!==0);if(rd&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===id&&(ad=id=null,od=0),kd=t,Od=e,Ad=n,Md=a,Nd=r,ff(e,t,n,s,c,l,f)}}function ff(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(jd=s,s|=Si,ht(e,n,s,r,i,a),Fd=null,(n&335544064)===n?(Id=Ia(e),r=10262):(Id=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,Of(Ke,function(){return bf(),null})):(e.callbackNode=null,e.callbackPriority=0),Hl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=M.T,M.T=null,i=N.p,N.p=2,a=rd,rd|=4;try{_u(e,t,n)}finally{rd=a,N.p=i,M.T=r}}Dd=1,Hl?Pd=Up(o,e.containerInfo,Id,hf,gf,mf,_f,bf,pf,null,null):(hf(),gf(),_f())}function pf(e){if(Dd!==0){var t=Od.onRecoverableError;t(e,{componentStack:null})}}function mf(){Dd===3&&(Dd=0,Ru(kd,Od),Dd=4)}function hf(){if(Dd===1){Dd=0;var e=Od,t=kd,n=Ad,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=M.T,M.T=null;var i=N.p;N.p=2;var a=rd;rd|=4;try{mu=hu=!1,Pu(t,e,n),n=yp;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}}Dh=!!vp,yp=vp=null}finally{rd=a,N.p=i,M.T=r}}e.current=t,Dd=2}}function gf(){if(Dd===2){Dd=0;var e=Od,t=kd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=M.T,M.T=null;var r=N.p;N.p=2;var i=rd;rd|=4;try{yu(e,t.alternate,t)}finally{rd=i,N.p=r,M.T=n}}Dd=3}}function _f(){if(Dd===4||Dd===3){Dd=0;var e=Pd;Pd=null,Ve();var t=Od,n=kd,r=Ad,i=Nd,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?Dd=5:(Dd=0,kd=Od=null,vf(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(Ed=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=M.T,a=N.p,N.p=2,M.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{M.T=n,N.p=a}}if(i=Fd,o=Id,Id=null,i!==null&&(Fd=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);Ad&3&&yf(),Ff(t),a=t.pendingLanes,r&261930&&a&42?t===Rd?Ld++:(Ld=0,Rd=t):(Ld=0,Rd=null),If(0,!1)}}function vf(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Na(t)))}function yf(){return Pd!==null&&(Pd.skipTransition(),Pd=null),hf(),gf(),_f(),bf()}function bf(){if(Dd!==5)return!1;var e=Od,t=jd;jd=0;var n=bt(Ad),r=M.T,a=N.p;try{N.p=32>n?32:n,M.T=null,n=Md,Md=null;var o=Od,s=Ad;if(Dd=0,kd=Od=null,Ad=0,rd&6)throw Error(i(331));var c=rd;if(rd|=4,Qu(o.current),Gu(o,o.current,s,n),rd=c,If(0,!1),Qe&&typeof Qe.onPostCommitFiberRoot==`function`)try{Qe.onPostCommitFiberRoot(Ze,o)}catch{}return!0}finally{N.p=a,M.T=r,vf(e,t)}}function xf(e,t,n){t=Vi(n,t),t=Ac(e.stateNode,t,2),e=vo(e,t,2),e!==null&&(mt(e,2),Ff(e))}function Sf(e,t,n){if(e.tag===3)xf(e,e,n);else for(;t!==null;){if(t.tag===3){xf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(Ed===null||!Ed.has(r))){e=Vi(n,e),n=jc(2),r=vo(t,n,2),r!==null&&(Mc(n,r,t,e),mt(r,2),Ff(r));break}}t=t.return}}function Cf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new nd;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)||(dd=!0,i.add(n),e=wf.bind(null,e,t,n),t.then(e,e))}function wf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,id===e&&(od&n)===n&&(pd===4||pd===3&&(od&62914560)===od&&300>He()-Sd?rd&2?gd|=n:Yd(e,0):gd|=n,vd===od&&(vd=0)),Ff(e)}function Tf(e,t){t===0&&(t=ft()),e=Ei(e,t),e!==null&&(mt(e,t),Ff(e))}function Ef(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Tf(e,n)}function Df(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),Tf(e,n)}function Of(e,t){return Re(e,t)}var kf=null,Af=null,jf=!1,Mf=!1,Nf=!1,Pf=0;function Ff(e){e!==Af&&e.next===null&&(Af===null?kf=Af=e:Af=Af.next=e),Mf=!0,jf||(jf=!0,Hf())}function If(e,t){if(!Nf&&Mf){Nf=!0;do for(var n=!1,r=kf;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,Vf(r,a))}else a=od,a=ct(r,r===id?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||lt(r,a)||(n=!0,Vf(r,a))}r=r.next}while(n);Nf=!1}}function Lf(){Rf()}function Rf(){Mf=jf=!1;var e=0;Pf!==0&&Ep()&&(e=Pf);for(var t=He(),n=null,r=kf;r!==null;){var i=r.next,a=zf(r,t);a===0?(r.next=null,n===null?kf=i:n.next=i,i===null&&(Af=n)):(n=r,(e!==0||a&3)&&(Mf=!0)),r=i}Dd!==0&&Dd!==5||If(e,!1),Pf!==0&&(Pf=0)}function zf(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=id,n=od,n=ct(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(sd===2||sd===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=Bf.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 Bf(e,t){if(Dd!==0&&Dd!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(yf()&&e.callbackNode!==n)return null;var r=od;return r=ct(e,e===id?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Ud(e,r,t),zf(e,He()),e.callbackNode!=null&&e.callbackNode===n?Bf.bind(null,e):null)}function Vf(e,t){if(yf())return null;Ud(e,t,!0)}function Hf(){jp(function(){rd&6?Re(We,Lf):Rf()})}function Uf(){if(Pf===0){var e=za;e===0&&(e=it,it<<=1,!(it&261888)&&(it=256)),Pf=e}return Pf}function Wf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:gn(e)}function Gf(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Wf((i[wt]||null).action),o=r.submitter;o&&(t=(t=o[wt]||null)?Wf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Ln(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Pf!==0){var e=new FormData(i,o);nc(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),nc(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Kf=0;Kf<pi.length;Kf++){var qf=pi[Kf];mi(qf.toLowerCase(),`on`+(qf[0].toUpperCase()+qf.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 Jf=`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(` `),Yf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Jf));function Xf(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 Zf(e,t){var n=t[Et];n===void 0&&(n=t[Et]=new Set);var r=e+`__bubble`;n.has(r)||(tp(t,e,2,!1),n.add(r))}function Qf(e,t,n){var r=0;t&&(r|=4),tp(n,e,r,t)}var $f=`_reactListening`+Math.random().toString(36).slice(2);function ep(e){if(!e[$f]){e[$f]=!0,zt.forEach(function(t){t!==`selectionchange`&&(Yf.has(t)||Qf(t,!1,e),Qf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[$f]||(t[$f]=!0,Qf(`selectionchange`,!1,t))}}function tp(e,t,n,r){switch(Ph(t)){case 2:var i=Oh;break;case 8:i=kh;break;default:i=Ah}n=i.bind(null,t,n,e),i=void 0,!R||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 np(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}wn(function(){var r=a,i=yn(n),s=[];a:{var c=fi.get(e);if(c!==void 0){var l=Ln,u=e;switch(e){case`keypress`:if(Mn(n)===0)break a;case`keydown`:case`keyup`:l=er;break;case`focusin`:u=`focus`,l=Kn;break;case`focusout`:u=`blur`,l=Kn;break;case`beforeblur`:case`afterblur`:l=Kn;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=Wn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Gn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=ar;break;case ai:case oi:case si:l=qn;break;case di:l=or;break;case`scroll`:case`scrollend`:l=zn;break;case`wheel`:l=sr;break;case`copy`:case`cut`:case`paste`:l=B;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=nr;break;case`submit`:l=ir;break;case`toggle`:case`beforetoggle`:l=cr}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=Tn(m,p),g!=null&&d.push(rp(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!==vn&&(u=n.relatedTarget||n.fromElement)&&(Nt(u)||u[Tt]))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=Wn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=nr,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?C(c,l,ap):null,c!==null&&op(s,u,c,d,!1),l!==null&&f!==null&&op(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 _=Or;else if(Sr(c)){if(kr)_=Rr;else{_=Ir;var v=Fr}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&pn(r.elementType)&&(_=Or):_=Lr;if(_&&=_(e,r)){Cr(s,_,n,i);break a}v&&v(e,c,r)}switch(v=r?Ft(r):window,e){case`focusin`:(Sr(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(ur)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 vr?gr(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(pr&&n.locale!==`ko`&&(vr||b!==`onCompositionStart`?b===`onCompositionEnd`&&vr&&(y=jn()):(On=i,kn=`value`in On?On.value:On.textContent,vr=!0)),v=ip(r,b),0<v.length&&(b=new Jn(b,e,null,n,i),s.push({event:b,listeners:v}),y?b.data=y:(y=_r(n),y!==null&&(b.data=y)))),(y=fr?yr(e,n):br(e,n))&&(b=ip(r,`onBeforeInput`),0<b.length&&(v=new Jn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:v,listeners:b}),v.data=y)),Gf(s,e,r,n,i)}Xf(s,t)})}function rp(e,t,n){return{instance:e,listener:t,currentTarget:n}}function ip(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=Tn(e,n),i!=null&&r.unshift(rp(e,i,a)),i=Tn(e,t),i!=null&&r.push(rp(e,i,a))),e.tag===3)return r;e=e.return}return[]}function ap(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function op(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=Tn(n,a),l!=null&&o.unshift(rp(n,l,c))):i||(l=Tn(n,a),l!=null&&o.push(rp(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var sp=/\r\n?/g,cp=/\u0000|\uFFFD/g;function lp(e){return(typeof e==`string`?e:``+e).replace(sp,`
10
+ `).replace(cp,``)}function up(e,t){return t=lp(t),lp(e)===t}function dp(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||ln(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&ln(e,``+r);else return;break;case`className`:Yt(e,`class`,r);break;case`tabIndex`:Yt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Yt(e,n,r);break;case`style`:fn(e,r,o);return;case`data`:if(t!==`object`){Yt(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=gn(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`&&dp(e,t,`name`,a.name,a,null),dp(e,t,`formEncType`,a.formEncType,a,null),dp(e,t,`formMethod`,a.formMethod,a,null),dp(e,t,`formTarget`,a.formTarget,a,null)):(dp(e,t,`encType`,a.encType,a,null),dp(e,t,`method`,a.method,a,null),dp(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=gn(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=_n);return;case`onScroll`:r!=null&&Zf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Zf(`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=gn(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`:Zf(`beforetoggle`,e),Zf(`toggle`,e),Jt(e,`popover`,r);break;case`xlinkActuate`:Xt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Xt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Xt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Xt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Xt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Xt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Xt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Xt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Xt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:Jt(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=mn.get(n)||n,Jt(e,n,r);else return}Kt=!0}function fp(e,t,n,r,a,o){switch(n){case`style`:fn(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`)ln(e,r);else if(typeof r==`number`||typeof r==`bigint`)ln(e,``+r);else return;break;case`onScroll`:r!=null&&Zf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Zf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=_n);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[wt]||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}Kt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):Jt(e,n,r)}return}Kt=!0}function pp(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Zf(`error`,e),Zf(`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:dp(e,t,o,s,n,null)}}a&&dp(e,t,`srcSet`,n.srcSet,n,null),r&&dp(e,t,`src`,n.src,n,null);return;case`input`:Zf(`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:dp(e,t,r,d,n,null)}}rn(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Zf(`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:dp(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&on(e,!!r,n,!0):on(e,!!r,t,!1);return;case`textarea`:for(s in Zf(`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:dp(e,t,s,c,n,null)}cn(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:dp(e,t,l,r,n,null)}return;case`dialog`:Zf(`beforetoggle`,e),Zf(`toggle`,e),Zf(`cancel`,e),Zf(`close`,e);break;case`iframe`:case`object`:Zf(`load`,e);break;case`video`:case`audio`:for(r=0;r<Jf.length;r++)Zf(Jf[r],e);break;case`image`:Zf(`error`,e),Zf(`load`,e);break;case`details`:Zf(`toggle`,e);break;case`embed`:case`source`:case`link`:Zf(`error`,e),Zf(`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:dp(e,t,u,r,n,null)}return;default:if(pn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&fp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&dp(e,t,c,r,n,null))}var mp={};function hp(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)||dp(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&&(Kt=!0),o=m;break;case`name`:m!==f&&(Kt=!0),a=m;break;case`checked`:m!==f&&(Kt=!0),u=m;break;case`defaultChecked`:m!==f&&(Kt=!0),d=m;break;case`value`:m!==f&&(Kt=!0),s=m;break;case`defaultValue`:m!==f&&(Kt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&dp(e,t,p,m,r,f)}}nn(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)||dp(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&&(Kt=!0),p=o;break;case`defaultValue`:o!==l&&(Kt=!0),c=o;break;case`multiple`:o!==l&&(Kt=!0),s=o;default:o!==l&&dp(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?on(e,!!n,n?[]:``,!1):on(e,!!n,t,!0)):on(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:dp(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&&(Kt=!0),p=a;break;case`defaultValue`:a!==o&&(Kt=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&dp(e,t,s,a,r,o)}sn(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:dp(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&&(Kt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:dp(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)&&dp(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:dp(e,t,u,p,r,m)}return;default:if(pn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&fp(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||fp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&dp(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||dp(e,t,f,p,r,m)}function gp(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function _p(){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&&gp(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&&gp(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 vp=null,yp=null;function bp(e){return e.nodeType===9?e:e.ownerDocument}function xp(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 Sp(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 Cp(e,t,n,r){return n=bp(n).createElement(e),n[Ct]=r,n[wt]=t,pp(n,e,t),Lt(n),n}function wp(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 Tp=null;function Ep(){var e=window.event;return e&&e.type===`popstate`?e!==Tp&&(Tp=e,!0):(Tp=null,!1)}var Dp=typeof setTimeout==`function`?setTimeout:void 0,Op=typeof clearTimeout==`function`?clearTimeout:void 0,kp=typeof Promise==`function`?Promise:void 0,Ap=typeof requestAnimationFrame==`function`?requestAnimationFrame:Dp,jp=typeof queueMicrotask==`function`?queueMicrotask:kp===void 0?Dp:function(e){return kp.resolve(null).then(e).catch(Mp)};function Mp(e){setTimeout(function(){throw e})}function Np(e){return e===`head`}function Pp(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),$h(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Om(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Om(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`&&Om(e.ownerDocument.body)}n=i}while(n);$h(t)}function Fp(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 Ip(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 Lp(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 Rp(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 zp(e){return Rp(e.getBoundingClientRect(),getComputedStyle(e),e)}function Bp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Rp(t,n,e)}function Vp(e){return e.documentElement.clientHeight}function Hp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Up(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`&&(Vp(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+=sh(f),u>uh){s.length=o;break}f=new Promise(Hp.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 Wp(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Wp.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:w({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Wp.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},Wp.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Gp(e){return{name:e,group:new Wp(`group`,e),imagePair:new Wp(`image-pair`,e),old:new Wp(`old`,e),new:new Wp(`new`,e)}}function Kp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Kp.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(Zp(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=Yp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),f(this._fragmentFiber.child,!1,qp,e,s,r)}this._eventListeners=a}};function qp(e,t,n,r){return _(e).addEventListener(t,n,r),!1}Kp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Zp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Yp(i.optionsOrUseCapture),f(this._fragmentFiber.child,!1,Jp,e,n,i),r.splice(t,1),a!==null&&a()}};function Jp(e,t,n,r){return _(e).removeEventListener(t,n,r),!1}function Yp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function Xp(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Zp(e,t,n,r){if(e.length===0)return-1;r=Xp(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&Xp(a.optionsOrUseCapture)===r)return i}return-1}Kp.prototype.dispatchEvent=function(e){var t=p(this._fragmentFiber);if(t===null)return!0;t=_(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,Yp(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,Yp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Kp.prototype.focus=function(e){f(this._fragmentFiber.child,!0,Qp,e,void 0,void 0)};function Qp(e,t){return e.tag!==6&&(e=_(e),wm(e,t))}Kp.prototype.focusLast=function(e){var t=[];f(this._fragmentFiber.child,!0,$p,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Qp(t[n],e);n--);};function $p(e,t){return t.push(e),!1}Kp.prototype.blur=function(){var e=p(this._fragmentFiber);e!==null&&(e=_(e),e=bp(e).activeElement,e!==null&&f(this._fragmentFiber.child,!1,em,e,void 0,void 0))};function em(e,t){return e.tag!==6&&(e=_(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Kp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),f(this._fragmentFiber.child,!1,tm,e,void 0,void 0)};function tm(e,t){return e.tag===6||(e=_(e),t.observe(e)),!1}Kp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),f(this._fragmentFiber.child,!1,nm,e,void 0,void 0);for(var n=t=0;n<rm.length;n++){var r=rm[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):rm[t++]=r}rm.length=t}};function nm(e,t){return e.tag===6||(e=_(e),t.unobserve(e)),!1}var rm=[],im=!1;function am(e,t,n){rm.push({fragmentInstance:e,observer:t,instance:n}),im||(im=!0,Tm(function(){im=!1;var e=rm;rm=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Kp.prototype.getClientRects=function(){var e=[];return f(this._fragmentFiber.child,!1,om,e,void 0,void 0),e};function om(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=_(e),t.push.apply(t,e.getClientRects());return!1}Kp.prototype.getRootNode=function(e){var t=p(this._fragmentFiber);return t===null?this:_(t).getRootNode(e)},Kp.prototype.compareDocumentPosition=function(e){var t=p(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];f(this._fragmentFiber.child,!1,$p,n,void 0,void 0);var r=_(t);if(n.length===0){if(n=r,m(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=h(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=_(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=_(n[0]),i=_(n[n.length-1]);var a=m(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||sm(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function sm(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=p(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=C(n,a,S),t===null?t=!1:(f(t,!0,b,a,n),a=v,v=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=C(r,a,S),t===null?t=!1:(f(t,!0,x,a,r),a=v,y=v=null,t=a!==null)),t):!1}function cm(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)}Kp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];f(this._fragmentFiber.child,!1,$p,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=h(this._fragmentFiber);if(r=n?r[1]||r[0]||p(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=_(r),cm(e,n);return}if(r=_(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=_(a),cm(a,n)):_(a).scrollIntoView(e),r+=n?-1:1}};function lm(e,t){return e=_(e),um(e,t),!1}function um(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function dm(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,Yp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<rm.length;i++){var a=rm[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(rm[r++]=a)}rm.length=r,n.observe(e)}),um(e,t))}function fm(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,Yp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?am(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function pm(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`:pm(n),Mt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function mm(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=bm(e.nextSibling),e===null)break}return null}function hm(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=bm(e.nextSibling),e===null))return null;return e}function gm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=bm(e.nextSibling),e===null))return null;return e}function _m(e){return e.data===`$?`||e.data===`$~`}function vm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function ym(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 bm(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 xm=null;function Sm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return bm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function Cm(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 wm(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 Tm(e){Ap(function(){Ap(function(t){return e(t)})})}function Em(e,t,n){switch(t=bp(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 Dm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&dp(e,t,r,null,mp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===_n&&(e.onclick=null),Mt(e)}function Om(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Mt(e)}var km=new Map,Am=new Set;function jm(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 Mm=N.d;N.d={f:Nm,r:Pm,D:Lm,C:Rm,L:zm,m:Bm,X:Hm,S:Vm,M:Um};function Nm(){var e=Mm.f(),t=qd();return e||t}function Pm(e){var t=Pt(e);t!==null&&t.tag===5&&t.type===`form`?ic(t):Mm.r(e)}var Fm=typeof document>`u`?null:document;function Im(e,t,n){var r=Fm;if(r&&typeof t==`string`&&t){var i=tn(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Am.has(i)||(Am.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),pp(t,`link`,e),Lt(t),r.head.appendChild(t)))}}function Lm(e){Mm.D(e),Im(`dns-prefetch`,e,null)}function Rm(e,t){Mm.C(e,t),Im(`preconnect`,e,t)}function zm(e,t,n){Mm.L(e,t,n);var r=Fm;if(r&&e&&t){var i=`link[rel="preload"][as="`+tn(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+tn(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+tn(n.imageSizes)+`"]`)):i+=`[href="`+tn(e)+`"]`;var a=i;switch(t){case`style`:a=Gm(e);break;case`script`:a=Ym(e)}if(!(km.has(a)||(e=w({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),km.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Km(a))||t===`script`&&r.querySelector(Xm(a))))){var o=r.createElement(`link`);pp(o,`link`,e),t===`style`&&(o[jt]=!0,o.onload=o.onerror=function(){Rt(o)}),Lt(o),r.head.appendChild(o)}}}function Bm(e,t){Mm.m(e,t);var n=Fm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+tn(r)+`"][href="`+tn(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Ym(e)}if(!km.has(a)&&(e=w({rel:`modulepreload`,href:e},t),km.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Xm(a)))return}r=n.createElement(`link`),pp(r,`link`,e),Lt(r),n.head.appendChild(r)}}}function Vm(e,t,n){Mm.S(e,t,n);var r=Fm;if(r&&e){var i=It(r).hoistableStyles,a=Gm(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Km(a)))s.loading=5;else{e=w({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=km.get(a))&&$m(e,n);var c=o=r.createElement(`link`);Lt(c),pp(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,Qm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Hm(e,t){Mm.X(e,t);var n=Fm;if(n&&e){var r=It(n).hoistableScripts,i=Ym(e),a=r.get(i);a||(a=n.querySelector(Xm(i)),a||(e=w({src:e,async:!0},t),(t=km.get(i))&&eh(e,t),a=n.createElement(`script`),Lt(a),pp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Um(e,t){Mm.M(e,t);var n=Fm;if(n&&e){var r=It(n).hoistableScripts,i=Ym(e),a=r.get(i);a||(a=n.querySelector(Xm(i)),a||(e=w({src:e,async:!0,type:`module`},t),(t=km.get(i))&&eh(e,t),a=n.createElement(`script`),Lt(a),pp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Wm(e,t,n,r){var a=(a=we.current)?jm(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=Gm(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=Gm(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(Km(e)))?o._p||(s.instance=o,s.state.loading=5):(o=km.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},km.set(e,o)),Jm(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=Ym(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 Gm(e){return`href="`+tn(e)+`"`}function Km(e){return`link[rel="stylesheet"][`+e+`]`}function qm(e){return w({},e,{"data-precedence":e.precedence,precedence:null})}function Jm(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),pp(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 Ym(e){return`[src="`+tn(e)+`"]`}function Xm(e){return`script[async]`+e}function Zm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+tn(n.href)+`"]`);if(r)return t.instance=r,Lt(r),r;var a=w({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Lt(r),pp(r,`style`,a),Qm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Gm(n.href);var o=e.querySelector(Km(a));if(o)return t.state.loading|=4,t.instance=o,Lt(o),o;r=qm(n),(a=km.get(a))&&$m(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}),pp(o,`link`,r),t.state.loading|=4,Qm(o,n.precedence,e),t.instance=o;case`script`:return o=Ym(n.src),(a=e.querySelector(Xm(o)))?(t.instance=a,Lt(a),a):(r=n,(a=km.get(o))&&(r=w({},n),eh(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Lt(a),pp(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,Qm(r,n.precedence,e));return t.instance}function Qm(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 $m(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function eh(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var th=null;function nh(e,t,n){if(th===null){var r=new Map,i=th=new Map;i.set(n,r)}else i=th,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[Ct]||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 rh(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function ih(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 ah(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function oh(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function sh(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function ch(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=sh(t),e.suspenseyImages.push(t)),e=mh.bind(e),t.decode().then(e,e))}function lh(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=Gm(r.href),a=t.querySelector(Km(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=ph.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Lt(a);return}a=t.ownerDocument||t,r=qm(r),(i=km.get(i))&&$m(r,i),a=a.createElement(`link`),Lt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),pp(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=ph.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var uh=0;function dh(e,t){return e.stylesheets&&e.count===0&&gh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&gh(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&uh===0&&(uh=62500*_p());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&gh(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>uh?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function fh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)gh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function ph(){this.count--,fh(this)}function mh(){this.imgCount--,fh(this)}var hh=null;function gh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,hh=new Map,t.forEach(_h,e),hh=null,ph.call(e))}function _h(e,t){if(!(t.state.loading&4)){var n=hh.get(e);if(n)var r=n.get(null);else{n=new Map,hh.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=ph.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 vh={$$typeof:ne,Provider:null,Consumer:null,_currentValue:ge,_currentValue2:ge,_threadCount:0};function yh(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 bh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new yh(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ji(3,null,null,t),e.current=a,a.stateNode=e,t=Ma(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},ho(a),e}function xh(e){return e?(e=ki,e):ki}function Sh(e,t,n,r,i,a){i=xh(i),r.context===null?r.context=i:r.pendingContext=i,r=_o(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=vo(e,r,t),n!==null&&(Hd(n,e,t),yo(n,e,t))}function Ch(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function wh(e,t){Ch(e,t),(e=e.alternate)&&Ch(e,t)}function Th(e){if(e.tag===13||e.tag===31){var t=Ei(e,67108864);t!==null&&Hd(t,e,67108864),wh(e,67108864)}}function Eh(e){if(e.tag===13||e.tag===31){var t=zd();t=yt(t);var n=Ei(e,t);n!==null&&Hd(n,e,t),wh(e,t)}}var Dh=!0;function Oh(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=2,Ah(e,t,n,r)}finally{N.p=a,M.T=i}}function kh(e,t,n,r){var i=M.T;M.T=null;var a=N.p;try{N.p=8,Ah(e,t,n,r)}finally{N.p=a,M.T=i}}function Ah(e,t,n,r){if(Dh){var i=jh(r);if(i===null)np(e,t,r,Mh,n),Uh(e,r);else if(Gh(i,e,t,n,r))r.stopPropagation();else if(Uh(e,r),t&4&&-1<Hh.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}Ff(a),!(rd&6)&&(wd=He()+500,If(0,!1))}}break;case 31:case 13:s=Ei(a,2),s!==null&&Hd(s,a,2),qd(),wh(a,2)}if(a=jh(r),a===null&&np(e,t,r,Mh,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else np(e,t,r,null,n)}}function jh(e){return e=yn(e),Nh(e)}var Mh=null;function Nh(e){if(Mh=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 Mh=e,null}function Ph(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 Fh=!1,Ih=null,Lh=null,Rh=null,zh=new Map,Bh=new Map,Vh=[],Hh=`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 Uh(e,t){switch(e){case`focusin`:case`focusout`:Ih=null;break;case`dragenter`:case`dragleave`:Lh=null;break;case`mouseover`:case`mouseout`:Rh=null;break;case`pointerover`:case`pointerout`:zh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Bh.delete(t.pointerId)}}function Wh(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&&Th(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Gh(e,t,n,r,i){switch(t){case`focusin`:return Ih=Wh(Ih,e,t,n,r,i),!0;case`dragenter`:return Lh=Wh(Lh,e,t,n,r,i),!0;case`mouseover`:return Rh=Wh(Rh,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return zh.set(a,Wh(zh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Bh.set(a,Wh(Bh.get(a)||null,e,t,n,r,i)),!0}return!1}function Kh(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(){Eh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,St(e.priority,function(){Eh(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 qh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=jh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);vn=r,n.target.dispatchEvent(r),vn=null}else return t=Pt(n),t!==null&&Th(t),e.blockedOn=n,!1;t.shift()}return!0}function Jh(e,t,n){qh(e)&&n.delete(t)}function Yh(){Fh=!1,Ih!==null&&qh(Ih)&&(Ih=null),Lh!==null&&qh(Lh)&&(Lh=null),Rh!==null&&qh(Rh)&&(Rh=null),zh.forEach(Jh),Bh.forEach(Jh)}function Xh(e,n){e.blockedOn===n&&(e.blockedOn=null,Fh||(Fh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Yh)))}var Zh=null;function Qh(e){Zh!==e&&(Zh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Zh===e&&(Zh=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(Nh(r||n)===null)continue;break}var a=Pt(n);a!==null&&(e.splice(t,3),t-=3,nc(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function $h(e){function t(t){return Xh(t,e)}Ih!==null&&Xh(Ih,e),Lh!==null&&Xh(Lh,e),Rh!==null&&Xh(Rh,e),zh.forEach(t),Bh.forEach(t);for(var n=0;n<Vh.length;n++){var r=Vh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Vh.length&&(n=Vh[0],n.blockedOn===null);)Kh(n),n.blockedOn===null&&Vh.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[wt]||null;if(typeof a==`function`)o||Qh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[wt]||null)s=o.formAction;else if(Nh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Qh(n)}}}function eg(){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 tg(e){this._internalRoot=e}ng.prototype.render=tg.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;Sh(n,zd(),e,t,null,null)},ng.prototype.unmount=tg.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Sh(e.current,2,null,e,null,null),qd(),t[Tt]=null}};function ng(e){this._internalRoot=e}ng.prototype.unstable_scheduleHydration=function(e){if(e){var t=xt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Vh.length&&t!==0&&t<Vh[n].priority;n++);Vh.splice(n,0,e),n===0&&Kh(e)}};var rg=n.version;if(rg!==`19.3.1`)throw Error(i(527,rg,`19.3.1`));N.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 ig={bundleType:0,version:`19.3.1`,rendererPackageName:`react-dom`,currentDispatcherRef:M,reconcilerVersion:`19.3.1`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var ag=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ag.isDisabled&&ag.supportsFiber)try{Ze=ag.inject(ig),Qe=ag}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Tc,s=Ec,c=Dc;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=bh(e,1,!1,null,null,n,r,null,o,s,c,eg),e[Tt]=t.current,ep(e),new tg(t)}})),ar=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=ir()})),or={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};or.node;var sr=L(or),cr={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`}]]};cr.node;var lr=L(cr),ur={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};ur.node;var dr=L(ur),fr={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};fr.node;var pr=L(fr),mr={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};mr.node;var hr=L(mr),gr={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};gr.node;var _r=L(gr),vr={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]};vr.node;var yr=L(vr),br={name:`audio-lines`,size:24,node:[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]};br.node;var xr=L(br),Sr={name:`ban`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]};Sr.node;var Cr=L(Sr),wr={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`}]]};wr.node;var Tr=L(wr),Er={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`}]]};Er.node;var Dr=L(Er),Or={name:`brain`,size:24,node:[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 01-3-4 4.17 4.17 0 01-3 4`,key:`5nuw1p`}],[`path`,{d:`M17.707 6.294A3 3 0 1012 5a3 3 0 10-5.707 1.294`,key:`18ldcf`}],[`path`,{d:`M17.996 5.125a4 4 0 012.526 5.77`,key:`1sdu8q`}],[`path`,{d:`M18 18a4 4 0 002-7.465`,key:`7xqqvr`}],[`path`,{d:`M19.967 17.482a4 4 0 11-7.967.517 4 4 0 11-7.967-.517`,key:`t46ysz`}],[`path`,{d:`M6 18a4 4 0 01-2-7.465`,key:`1y2m15`}],[`path`,{d:`M6.004 5.125a4 4 0 00-2.526 5.77`,key:`3cw1ss`}]]};Or.node;var kr=L(Or),Ar={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`}]]};Ar.node;var jr=L(Ar),Mr={name:`calculator`,size:24,node:[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`line`,{x1:`8`,x2:`16`,y1:`6`,y2:`6`,key:`x4nwl0`}],[`line`,{x1:`16`,x2:`16`,y1:`14`,y2:`18`,key:`wjye3r`}],[`path`,{d:`M16 10h.01`,key:`1m94wz`}],[`path`,{d:`M12 10h.01`,key:`1nrarc`}],[`path`,{d:`M8 10h.01`,key:`19clt8`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}]]};Mr.node;var Nr=L(Mr),Pr={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`}]]};Pr.node;var Fr=L(Pr),Ir={name:`captions`,size:24,node:[[`rect`,{width:`18`,height:`14`,x:`3`,y:`5`,rx:`2`,ry:`2`,key:`12ruh7`}],[`path`,{d:`M7 15h4M15 15h2M7 11h2M13 11h4`,key:`1ueiar`}]],aliases:[`subtitles`]};Ir.node;var Lr=L(Ir),Rr={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`]};Rr.node;var zr=L(Rr),Br={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};Br.node;var Vr=L(Br),Hr={name:`chef-hat`,size:24,node:[[`path`,{d:`M10 11v5`,key:`urfl79`}],[`path`,{d:`M14 11v5`,key:`w9lfkh`}],[`path`,{d:`M6 12.65c0-.457-.316-.844-.727-1.041A4 4 0 017.52 4.034a1.53 1.53 0 001.367-.547 4 4 0 016.225 0 1.53 1.53 0 001.367.547 4 4 0 012.248 7.575c-.411.197-.727.584-.727 1.04V19a2 2 0 01-2 2H8a2 2 0 01-2-2z`,key:`1dq1bt`}],[`path`,{d:`M6 16h12`,key:`u522kt`}]]};Hr.node;var Ur=L(Hr),Wr={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};Wr.node;var Gr=L(Wr),Kr={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};Kr.node;var qr=L(Kr),Jr={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Jr.node;var Yr=L(Jr),Xr={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};Xr.node;var Zr=L(Xr),Qr={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`]};Qr.node;var $r=L(Qr),ei={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`]};ei.node;var ti=L(ei),ni={name:`circle-exclamation-point`,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`,`circle-alert`]};ni.node;var ri=L(ni),ii={name:`circle-question-mark`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9 9.5a3 2.5 0 016 0c0 2-2 2-3 3.5`,key:`1awbb0`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`help-circle`,`circle-help`]};ii.node;var ai=L(ii),oi={name:`circle-stop`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`rect`,{x:`9`,y:`9`,width:`6`,height:`6`,rx:`1`,key:`1ssd4o`}]],aliases:[`stop-circle`]};oi.node;var si=L(oi),ci={name:`circle`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};ci.node;var li=L(ci),ui={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};ui.node;var di=L(ui),fi={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`}]]};fi.node;var pi=L(fi),mi={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`}]]};mi.node;var hi=L(mi),gi={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`}]]};gi.node;var _i=L(gi),vi={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`}]]};vi.node;var yi=L(vi),bi={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`}]]};bi.node;var xi=L(bi),Si={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`}]]};Si.node;var Ci=L(Si),wi={name:`dumbbell`,size:24,node:[[`path`,{d:`M17.596 12.768a2 2 0 1 0 2.829-2.829l-1.768-1.767a2 2 0 0 0 2.828-2.829l-2.828-2.828a2 2 0 0 0-2.829 2.828l-1.767-1.768a2 2 0 1 0-2.829 2.829z`,key:`9m4mmf`}],[`path`,{d:`m2.5 21.5 1.4-1.4`,key:`17g3f0`}],[`path`,{d:`m20.1 3.9 1.4-1.4`,key:`1qn309`}],[`path`,{d:`M5.343 21.485a2 2 0 1 0 2.829-2.828l1.767 1.768a2 2 0 1 0 2.829-2.829l-6.364-6.364a2 2 0 1 0-2.829 2.829l1.768 1.767a2 2 0 0 0-2.828 2.829z`,key:`1t2c92`}],[`path`,{d:`m9.6 14.4 4.8-4.8`,key:`6umqxw`}]]};wi.node;var Ti=L(wi),Ei={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};Ei.node;var Di=L(Ei),Oi={name:`eraser`,size:24,node:[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]};Oi.node;var ki=L(Oi),Ai={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`}]]};Ai.node;var ji=L(Ai),Mi={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`}]]};Mi.node;var Ni=L(Mi),Pi={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Pi.node;var Fi=L(Pi),Ii={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`}]]};Ii.node;var Li=L(Ii),Ri={name:`file-down`,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:`M12 18v-6`,key:`17g6i2`}],[`path`,{d:`m9 15 3 3 3-3`,key:`1npd3o`}]]};Ri.node;var zi=L(Ri),Bi={name:`file-headphone`,size:24,node:[[`path`,{d:`M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343`,key:`1vfytu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0`,key:`1etmh7`}]],aliases:[`file-audio`,`file-audio-2`]};Bi.node;var Vi=L(Bi),Hi={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`}]]};Hi.node;var Ui=L(Hi),Wi={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`]};Wi.node;var Gi=L(Wi),Ki={name:`file-play`,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:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]],aliases:[`file-video`]};Ki.node;var qi=L(Ki),Ji={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`}]]};Ji.node;var Yi=L(Ji),Xi={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`}]]};Xi.node;var Zi=L(Xi),Qi={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`}]]};Qi.node;var $i=L(Qi),ea={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`}]]};ea.node;var ta=L(ea),na={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`}]]};na.node;var ra=L(na),ia={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`}]]};ia.node;var aa=L(ia),oa={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`}]]};oa.node;var sa=L(oa),ca={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`]};ca.node;var la=L(ca),ua={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`}]]};ua.node;var da=L(ua),fa={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`}]]};fa.node;var pa=L(fa),ma={name:`hard-drive`,size:24,node:[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]};ma.node;var ha=L(ma),ga={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`}]]};ga.node;var _a=L(ga),va={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`}]]};va.node;var ya=L(va),ba={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`}]]};ba.node;var xa=L(ba),Sa={name:`languages`,size:24,node:[[`path`,{d:`m5 8 6 6`,key:`1wu5hv`}],[`path`,{d:`m4 14 6-6 2-3`,key:`1k1g8d`}],[`path`,{d:`M2 5h12`,key:`or177f`}],[`path`,{d:`M7 2h1`,key:`1t2jsx`}],[`path`,{d:`m22 22-5-10-5 10`,key:`don7ne`}],[`path`,{d:`M14 18h6`,key:`1m8k6r`}]]};Sa.node;var Ca=L(Sa),wa={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`]};wa.node;var Ta=L(wa),Ea={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`}]]};Ea.node;var Da=L(Ea),Oa={name:`lightbulb`,size:24,node:[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]};Oa.node;var ka=L(Oa),Aa={name:`link`,size:24,node:[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]};Aa.node;var ja=L(Aa),Ma={name:`link-2`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]};Ma.node;var Na=L(Ma),Pa={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`}]]};Pa.node;var Fa=L(Pa),Ia={name:`loader-circle`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]],aliases:[`loader-2`]};Ia.node;var La=L(Ia),Ra={name:`lock-open`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`,key:`1mm8w8`}]],aliases:[`unlock`]};Ra.node;var za=L(Ra),Ba={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};Ba.node;var Va=L(Ba),Ha={name:`map`,size:24,node:[[`path`,{d:`M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z`,key:`169xi5`}],[`path`,{d:`M15 5.764v15`,key:`1pn4in`}],[`path`,{d:`M9 3.236v15`,key:`1uimfh`}]]};Ha.node;var Ua=L(Ha),Wa={name:`menu`,size:24,node:[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]};Wa.node;var Ga=L(Wa),Ka={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 9.5a3 2.5 0 016 0c0 2-2 2-3 3.5`,key:`1awbb0`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`message-circle-question`]};Ka.node;var qa=L(Ka),Ja={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};Ja.node;var Ya=L(Ja),Xa={name:`monitor-smartphone`,size:24,node:[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]};Xa.node;var Za=L(Xa),Qa={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`}]]};Qa.node;var $a=L(Qa),eo={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};eo.node;var to=L(eo),no={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`]};no.node;var ro=L(no),io={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`]};io.node;var ao=L(io),oo={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`}]]};oo.node;var so=L(oo),co={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`}]]};co.node;var lo=L(co),uo={name:`panel-top-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`m15 14-3 3-3-3`,key:`g215vf`}]]};uo.node;var fo=L(uo),po={name:`pause`,size:24,node:[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]};po.node;var mo=L(po),ho={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`]};ho.node;var go=L(ho),_o={name:`pencil`,size:24,node:[[`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`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};_o.node;var vo=L(_o),yo={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`}]]};yo.node;var bo=L(yo),xo={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`}]]};xo.node;var So=L(xo),Co={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};Co.node;var wo=L(Co),To={name:`plug`,size:24,node:[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]};To.node;var Eo=L(To),Do={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Do.node;var Oo=L(Do),ko={name:`printer`,size:24,node:[[`path`,{d:`M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2`,key:`143wyd`}],[`path`,{d:`M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6`,key:`1itne7`}],[`rect`,{x:`6`,y:`14`,width:`12`,height:`8`,rx:`1`,key:`1ue0tg`}]]};ko.node;var Ao=L(ko),jo={name:`receipt`,size:24,node:[[`path`,{d:`M12 17V7`,key:`pyj7ub`}],[`path`,{d:`M16 8h-6a2 2 0 0 0 0 4h4a2 2 0 0 1 0 4H8`,key:`1elt7d`}],[`path`,{d:`M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z`,key:`ycz6yz`}]]};jo.node;var Mo=L(jo),No={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`}]]};No.node;var Po=L(No),Fo={name:`rotate-ccw-square`,size:24,node:[[`path`,{d:`M20 9V7a2 2 0 0 0-2-2h-6`,key:`19z8uc`}],[`path`,{d:`m15 2-3 3 3 3`,key:`177bxs`}],[`path`,{d:`M20 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2`,key:`d36hnl`}]]};Fo.node;var Io=L(Fo),Lo={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};Lo.node;var Ro=L(Lo),zo={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`}]]};zo.node;var Bo=L(zo),Vo={name:`ruler`,size:24,node:[[`path`,{d:`M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z`,key:`icamh8`}],[`path`,{d:`m14.5 12.5 2-2`,key:`inckbg`}],[`path`,{d:`m11.5 9.5 2-2`,key:`fmmyf7`}],[`path`,{d:`m8.5 6.5 2-2`,key:`vc6u1g`}],[`path`,{d:`m17.5 15.5 2-2`,key:`wo5hmg`}]]};Vo.node;var Ho=L(Vo),Uo={name:`scroll-text`,size:24,node:[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]};Uo.node;var Wo=L(Uo),Go={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};Go.node;var Ko=L(Go),qo={name:`server`,size:24,node:[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]};qo.node;var Jo=L(qo),Yo={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`}]]};Yo.node;var Xo=L(Yo),Zo={name:`share-2`,size:24,node:[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]};Zo.node;var Qo=L(Zo),$o={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`}]]};$o.node;var es=L($o),ts={name:`shield-exclamation-point`,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`}]],aliases:[`shield-alert`]};ts.node;var ns=L(ts),rs={name:`shield-question-mark`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 01-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 011-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 011.52 0C14.51 3.81 17 5 19 5a1 1 0 011 1z`,key:`1buusj`}],[`path`,{d:`M9 9.5a3 2.5 0 016 0c0 2-2 2-3 3.5`,key:`1awbb0`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`shield-question`]};rs.node;var is=L(rs),as={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`}]]};as.node;var os=L(as),ss={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`}]]};ss.node;var cs=L(ss),ls={name:`sparkles`,size:24,node:[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]],aliases:[`stars`]};ls.node;var us=L(ls),ds={name:`square-code`,size:24,node:[[`path`,{d:`m10 9-3 3 3 3`,key:`1oro0q`}],[`path`,{d:`m14 15 3-3-3-3`,key:`bz13h7`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]],aliases:[`code-square`]};ds.node;var fs=L(ds),ps={name:`square-dashed-mouse-pointer`,size:24,node:[[`path`,{d:`M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z`,key:`xwnzip`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2`,key:`y57alp`}],[`path`,{d:`M19 3a2 2 0 0 1 2 2`,key:`18rm91`}],[`path`,{d:`M5 21a2 2 0 0 1-2-2`,key:`sbafld`}],[`path`,{d:`M9 3h1`,key:`1yesri`}],[`path`,{d:`M9 21h2`,key:`1qve2z`}],[`path`,{d:`M14 3h1`,key:`1ec4yj`}],[`path`,{d:`M3 9v1`,key:`1r0deq`}],[`path`,{d:`M21 9v2`,key:`p14lih`}],[`path`,{d:`M3 14v1`,key:`vnatye`}]],aliases:[`mouse-pointer-square-dashed`]};ps.node;var ms=L(ps),hs={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`]};hs.node;var gs=L(hs),_s={name:`square`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]};_s.node;var vs=L(_s),ys={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};ys.node;var bs=L(ys),xs={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`]};xs.node;var Ss=L(xs),Cs={name:`triangle-exclamation-point`,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`,`triangle-alert`]};Cs.node;var ws=L(Cs),Ts={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`}]]};Ts.node;var Es=L(Ts),Ds={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`}]]};Ds.node;var Os=L(Ds),ks={name:`volume-2`,size:24,node:[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]};ks.node;var As=L(ks),js={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`}]]};js.node;var Ms=L(js),Ns={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`}]]};Ns.node;var Ps=L(Ns),Fs={name:`x`,size:24,node:[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]};Fs.node;var Is=L(Fs),V=t(Fn(),1),Ls=t(ar(),1),Rs=e=>Symbol.iterator in e,zs=e=>`entries`in e,Bs=(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},Vs=(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 Hs(e,t){return Object.is(e,t)?!0:typeof e!=`object`||!e||typeof t!=`object`||!t||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:Rs(e)&&Rs(t)?zs(e)&&zs(t)?Bs(e,t):Vs(e,t):Bs({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function Us(e){let t=V.useRef(void 0);return n=>{let r=e(n);return Hs(t.current,r)?t.current:t.current=r}}var Ws=14;function Gs({open:e,onClose:t,anchor:n,label:r,placement:i=`above`,align:a=`start`,className:o,children:s}){let c=(0,V.useRef)(null),[l,u]=(0,V.useState)(i),[d,f]=(0,V.useState)(null),[p,m]=(0,V.useState)(0);return(0,V.useLayoutEffect)(()=>{if(!e)return;let t=()=>{let e=n.current?.getBoundingClientRect(),t=c.current;if(!e||!t)return;let r=e.top-Ws,a=window.innerHeight-e.bottom-Ws,o=i===`above`?r:a,s=i===`above`?a:r,l=t.scrollHeight>o&&s>o;u(l?i===`above`?`below`:`above`:i),f(Math.max(0,Math.floor(l?s:o)));let d=t.offsetParent;if(!d)return;let p=d.getBoundingClientRect().left+d.clientLeft-d.scrollLeft+t.offsetLeft,h=t.offsetWidth,g=window.innerWidth-28,_=getComputedStyle(t).direction===`rtl`,v=h>g?_?window.innerWidth-Ws-h:Ws:Math.min(Math.max(p,Ws),window.innerWidth-Ws-h);m(v-p)};t();let r=new MutationObserver(t);c.current&&r.observe(c.current,{childList:!0,subtree:!0});let a=typeof ResizeObserver>`u`?null:new ResizeObserver(t);for(let e of[c.current,n.current,c.current?.offsetParent])e&&a?.observe(e);return window.addEventListener(`resize`,t),()=>{r.disconnect(),a?.disconnect(),window.removeEventListener(`resize`,t)}},[e,i,n]),Lt(e),(0,V.useEffect)(()=>{if(!e)return;(c.current?.querySelector(`button:not(:disabled), input, [tabindex="0"]`))?.focus({preventScroll:!0});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?I(`div`,{ref:c,className:`popover popover-${l} popover-${a}${o?` ${o}`:``}`,style:{...d===null?{}:{"--popover-room":`${d}px`},...p?{transform:`translateX(${p}px)`}:{}},role:`dialog`,"aria-label":r,children:s}):null}var Ks=[`model_server`,`gaia`,`service`,`agent`,`desktop`,`other`],qs=Ct(e=>({open:!1,source:`model_server`,show:(t=`model_server`)=>e({open:!0,source:t}),hide:()=>e({open:!1})})),Js=8e3,Ys=[],Xs=new Set,Zs=e=>Xs.has(e),Qs=()=>Xs.clear(),$s=Ct((e,t)=>({need:null,ensure:async n=>{if(Xs.has(n))return!0;let r=t().need;if(r)return r.job===n&&new Promise(e=>{Ys.push(e)});let i,a;try{i=await Promise.race([Xe(n),new Promise((e,t)=>{a=setTimeout(()=>t(Error(`the check timed out`)),Js)})])}catch(e){return console.warn(`[modelNeeded] could not check the model for ${n}`,e),!0}finally{clearTimeout(a)}if(!i?.needed&&!i?.off)return Xs.add(n),!0;let o=t().need;return o&&o.job!==n?!1:new Promise(t=>{Ys.push(t),o||e({need:i})})},settle:t=>{let n=Ys;Ys=[],e({need:null});for(let e of n)e(t)}})),ec=e=>$s.getState().ensure(e),tc=1e3,nc=5e3,rc=24,ic=1e3,ac=3e4,oc=0,sc=null,cc=!1,lc=null,uc=ic,dc=0;function fc(){sc&&clearTimeout(sc),sc=null}function pc(){lc&&clearTimeout(lc),lc=null}function mc(e,t){return!e.model||bc(e.model,t)}function hc(e,t){let n=++dc;t({pickLoad:{model:e,seconds:0,error:null}});let r=async()=>{let a=await ct();if(n!==dc)return;let o=Math.floor(a.elapsed_seconds??0);a.state===`warming`?(t({pickLoad:{model:e,seconds:mc(a,e)?o:0,error:null}}),setTimeout(()=>{r().catch(i)},tc)):a.state===`failed`&&mc(a,e)?t({pickLoad:{model:e,seconds:o,error:a.error?{reason:a.error}:{key:`banner.pickLoad.noReason`,reason:``}}}):t({pickLoad:null})},i=r=>{n===dc&&(F.system.warn(`Lost track of loading ${e}`,r),t({pickLoad:{model:e,seconds:0,error:{key:`banner.pickLoad.lostTrack`,reason:r instanceof Error?r.message:String(r)}}}))};r().catch(i)}async function gc(e){try{let t=await Nn(`local`);t?.models&&e(t.models)}catch(e){cc=!1,F.system.warn(`Model names unavailable; raw model ids show until the model list loads`,e)}}var _c=Ct((e,t)=>({active:null,error:null,restoreNotice:null,queued:null,queueError:null,names:{},pickLoad:null,refresh:async()=>{cc||(cc=!0,gc(t().rememberNames));try{let n=await We();pc(),uc=ic;let r=n.restore;(r?.status===`pending`||r?.status===`failed`&&r.retry)&&!sc&&oc<rc&&(oc+=1,sc=setTimeout(()=>{sc=null,t().refresh()},nc));let i=(r?.status===`restored`||r?.status===`none`)&&!r.message&&t().restoreNotice?.ok===!1;e({active:n,error:null,...r&&r.status!==`none`&&r.message?{restoreNotice:{ok:r.status===`restored`,message:r.message}}:i?{restoreNotice:null}:{}})}catch(n){e({error:n instanceof Error?n.message:String(n)}),lc||(lc=setTimeout(()=>{lc=null,t().refresh()},uc),uc=Math.min(uc*2,ac))}},retryNow:()=>{lc&&(pc(),t().refresh())},select:async t=>{Qs(),fc();let n=await Be(t),r=null;try{r=(await wn()).sessions}catch(e){F.system.error(`Could not refresh chats after a model switch; the next poll will`,e)}e({active:n,error:null,restoreNotice:null}),n.remote?(dc+=1,e({pickLoad:null})):hc(t,e),r?.length&&B.getState().setSessions(r)},queue:n=>{e({queued:n,queueError:null}),n&&!B.getState().isStreaming&&t().applyQueued()},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 ${xc(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}),retryPickLoad:async()=>{let n=t().pickLoad?.model;if(n){try{await mt(!0)}catch(t){e({pickLoad:{model:n,seconds:0,error:{key:`banner.pickLoad.startFailed`,reason:t instanceof Error?t.message:String(t)}}});return}hc(n,e)}},dismissPickLoad:()=>{dc+=1,e({pickLoad:null})}}));async function vc(e){Qs(),await _c.getState().refresh();let t=_c.getState().active;t?.model&&!t.remote&&!bc(t.model,e)&&hc(t.model,_c.setState);try{let e=(await wn()).sessions;e.length&&B.getState().setSessions(e)}catch(e){F.system.error(`Could not refresh chats after a model setting change; the next poll will`,e)}}B.subscribe((e,t)=>{t.isStreaming&&!e.isStreaming&&_c.getState().queued&&_c.getState().applyQueued()});function yc(){return _c(e=>e.names)}function bc(e,t){if(!e||!t)return!1;let n=e=>e.toLowerCase().replace(/^user\./,``);return n(e)===n(t)}function xc(e){let t=_c.getState();return t.names[e]?t.names[e]:t.active?.model===e&&t.active.display_name?t.active.display_name:Oc(e)}function Sc(e,t){return e.find(e=>e.id===t)??e[0]}function Cc(e,t,n=gt){let r=r=>{let i=t?.effective_model||e?.model;return{remote:!1,label:n.bare(`modelStatus.local`),description:r&&i?n.bare(`modelStatus.localNotice`,{model:xc(i)}):null}},i=!!t?.effective_model&&!!e?.model&&t.effective_model!==e.model;return e?.remote&&!(i&&t?.inference_remote!==void 0)?{remote:!0,label:e.provider_name||`a cloud provider`,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?r(t.inference_description):t===void 0&&e?.inference_remote===!1?r(e.inference_description):null}var wc=`GAIA can't tell whether this chat is answered on this PC or by a cloud provider, so it isn't claiming either.`;function Tc(){return Cc(_c(e=>e.active),B(e=>Sc(e.sessions,e.currentSessionId)),R())}function Ec(e,t,n){return t.find(e=>e.id===n)?.effective_model||e?.model||null}function Dc(e){return/^(fireworks|amd)\./.test(e)?e.slice(e.indexOf(`.`)+1):e}function Oc(e){let t=Dc(e);return t.slice(t.lastIndexOf(`/`)+1)}function kc(e){let t={};for(let n of e)t[n.id]=n.display_name||xc(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=>Dc(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 Ac(e){return e===`fireworks`?`Fireworks AI`:e===`amd`?`AMD LLM Gateway`:e}var jc={loaded:`Loaded`,downloaded:`Downloaded, ready to load`,not_downloaded:`Not downloaded`};function Mc(e){return e?.label?e.source===`expected`?`${e.label} (expected)`:e.label:null}function Nc(e){return e?`${Math.round(e/1024)}K`:`unknown`}function Pc(e){return e.state??(e.downloaded?`downloaded`:`not_downloaded`)}function Fc(e){let t=e.download_progress?.state;return t===`starting`||t===`downloading`}var Ic=e=>`${e}`,Lc=/([^]*)/;function Rc({text:e}){return I(P.Fragment,{children:e.split(Lc).map((e,t)=>t%2?I(`bdi`,{dir:`ltr`,children:e},t):e)})}function zc({text:e}){let[t,n]=De(e);return n===void 0?I(Rc,{text:t}):z(P.Fragment,{children:[I(Rc,{text:t}),` `,I(`small`,{className:`i18n-gloss`,lang:`en`,children:I(Rc,{text:n})})]})}function Bc({status:e}){let t=R();if(e.error_cause===`model_server_down`&&e.base_url){let n=e.owner===`gaia`?`modelStatus.serverDown.gaia`:`modelStatus.serverDown.notOurs`;return I(zc,{text:t(n,{url:Ic(e.base_url)})})}return I(P.Fragment,{children:e.error})}var Vc=3e3,Hc={loaded:`modelStatus.state.loaded`,warming:`modelStatus.state.warming`,idle:`modelStatus.state.idle`,stopped:`modelStatus.state.stopped`},Uc={loaded:`modelStatus.pillAria.loaded`,warming:`modelStatus.pillAria.warming`,idle:`modelStatus.pillAria.idle`,stopped:`modelStatus.pillAria.stopped`};function Wc(e,t){let n=e.memory;return n?!n.model_gb&&n.free_gb==null?t(`modelStatus.memoryTotal`,{size:`${n.total_gb} GB`,source:n.source}):t.compose(e=>[n.model_gb?e(`modelStatus.memoryUsed`,{size:`~${n.model_gb} GB`}):null,n.free_gb==null?null:e(`modelStatus.memoryFree`,{size:`${n.free_gb} GB`})].filter(Boolean).join(` ·\xA0`)):e.memory_error}function Gc(e,t){return e.label?e.source===`expected`?t(`modelStatus.expected`,{label:e.label}):e.label:null}function Kc(){let e=R(),t=_c(e=>e.active);_c(e=>e.names);let n=Tc(),r=B(e=>e.systemStatus),i=B(e=>e.openSettings),a=qs(e=>e.show),o=(0,V.useRef)(null),[s,c]=(0,V.useState)(!1),[l,d]=(0,V.useState)(null),[f,p]=(0,V.useState)(null),[m,h]=(0,V.useState)(!1),[g,_]=(0,V.useState)(!1),v=(0,V.useCallback)(async()=>{try{d(await Ae()),p(null)}catch(e){p(e instanceof Error?e.message:String(e))}},[]);(0,V.useEffect)(()=>{if(!s)return;v();let e=setInterval(()=>{v()},Vc);return()=>clearInterval(e)},[s,v]);let y=(0,V.useCallback)(async e=>{_(!1),h(!0),p(null);try{await Bn(e),await v()}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}},[v]),b=r?r.lemonade_running?bc(r.model_loaded,t?.model)?`loaded`:`idle`:`stopped`:`idle`,x=n?.remote?pi:n?yi:ai,S=t?.model?xc(t.model):null,C=[n?.label,S].filter(Boolean).join(` · `)||e(`modelStatus.fallbackName`),w=n?n.description??(n.remote?e(`modelStatus.sentTo`,{name:n.label}):e(`modelStatus.runsHere`)):wc,T=l,E=m||!!T?.restarting,D=!!T&&T.owner!==`gaia`,O=!!T&&!(D&&T.state===`stopped`);return z(`div`,{className:`sb-location-wrap`,children:[z(`button`,{ref:o,type:`button`,className:`sb-location`,onClick:()=>c(e=>!e),"aria-haspopup":`dialog`,"aria-expanded":s,"aria-label":n?.remote?C:e(Uc[b],{text:C}),title:S?`${C}. ${w}`:w,children:[I(x,{size:13,"aria-hidden":`true`}),z(`span`,{className:`sb-location-text`,children:[n?.label&&S&&I(`span`,{className:`sb-location-place`,children:n.label}),I(`span`,{className:`sb-location-name`,dir:`auto`,children:S??n?.label??e(`modelStatus.fallbackName`)})]}),!n?.remote&&I(`span`,{className:`sb-location-dot is-${b}`,"aria-hidden":`true`})]}),I(Gs,{open:s,onClose:()=>c(!1),anchor:o,label:e(`modelStatus.label`),placement:`above`,children:z(`div`,{className:`model-status`,children:[!T&&!f&&z(`span`,{children:[I(La,{size:13,className:`spin`}),` `,e(`modelStatus.checking`)]}),T&&z(P.Fragment,{children:[z(`div`,{className:`model-status-head`,children:[I(`span`,{className:`model-status-dot is-${T.state}`,"aria-hidden":`true`}),I(`span`,{role:`status`,children:T.state===`loaded`&&T.busy_reason===`request`?e(`modelStatus.state.loadedAnswering`):e(Hc[T.state])})]}),T.active_remote&&I(`span`,{className:`settings-hint`,children:e(`modelStatus.cloudLine`,{name:T.active_display_name??T.active_model??`—`})}),z(`dl`,{className:`model-status-grid`,children:[I(`dt`,{children:e(`modelStatus.model`)}),I(`dd`,{title:T.model??T.active_model??void 0,children:I(`bdi`,{children:T.display_name??(T.active_remote?`—`:T.active_display_name)??`—`})}),T.placement&&z(P.Fragment,{children:[I(`dt`,{children:e(`modelStatus.runsOn`)}),I(`dd`,{children:I(`bdi`,{children:Gc(T.placement,e)})})]}),T.state!==`stopped`&&z(P.Fragment,{children:[I(`dt`,{children:e(`modelStatus.memory`)}),I(`dd`,{children:Wc(T,e)??e(`modelStatus.unknown`)})]}),T.ctx_size!=null&&z(P.Fragment,{children:[I(`dt`,{children:e(`modelStatus.context`)}),I(`dd`,{children:e(`settings.ctx.tokens`,{size:Nc(T.ctx_size)})})]})]}),T.placement?.warning&&I(`span`,{className:`model-status-warning`,role:`alert`,children:T.placement.warning}),T.error&&I(`span`,{className:`settings-error`,role:`alert`,title:T.error_detail??void 0,children:I(Bc,{status:T})}),T.restart_error&&I(`span`,{className:`settings-error`,role:`alert`,children:T.restart_error})]}),f&&I(`span`,{className:`settings-error`,role:`alert`,children:f}),g&&T&&z(`div`,{className:`model-status-confirm`,role:`alert`,children:[I(`span`,{children:e(`modelStatus.confirm`,{name:T.display_name??u(`modelStatus.theModel`),url:T.base_url??`—`})}),z(`div`,{className:`model-status-actions`,children:[I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>_(!1),children:e(`modelStatus.cancel`)}),I(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void y(!0),children:e(`modelStatus.reloadIt`)})]})]}),z(`div`,{className:`model-status-actions`,children:[z(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{c(!1),i(`model`)},children:[I(Xo,{size:13,"aria-hidden":`true`}),` `,e(`modelStatus.settings`)]}),!T?.active_remote&&z(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{c(!1),a(`model_server`)},children:[I(Wo,{size:13,"aria-hidden":`true`}),` `,e(`logs.serverLog`)]}),O&&z(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>D?_(!0):void y(!1),disabled:E||!T||T.busy||T.active_remote&&T.state!==`loaded`,title:T?.busy?T.busy_reason===`warm_up`?e(`modelStatus.busyWarmUp`):e(`modelStatus.busyRequest`):T?.state===`stopped`?e(`modelStatus.startServer`):e(`modelStatus.reload`),children:[E?I(La,{size:13,className:`spin`}):I(Bo,{size:13,"aria-hidden":`true`}),e(E?`modelStatus.restarting`:`modelStatus.restart`)]})]})]})})]})}var qc=1e3;function Jc(e){return e?e.state===`running`||e.state===`verifying`||!!e.models?.some(e=>e.state===`downloading`||e.state===`verifying`):!1}function Yc(e,t){if(!e)return null;if(e.state===`running`||e.state===`verifying`)return e;let n=(e.models??[]).filter(e=>t.includes(e.id)||e.state===`downloading`||e.state===`failed`||e.state===`cancelled`),r=n.filter(e=>e.state!==`skipped`),i=r.reduce((e,t)=>e+Math.min(t.bytes_done,t.bytes_total),0),a=r.reduce((e,t)=>e+t.bytes_total,0),o=r.filter(e=>e.state===`downloading`).reduce((e,t)=>e+t.speed_bps,0);return{...e,models:n,overall:{bytes_done:i,bytes_total:a,speed_bps:o,eta_s:o>0?Math.round((a-i)/o):null,percent:a?Math.floor(i*100/a):null,failed:r.filter(e=>e.state===`failed`).length}}}var Xc=null;function Zc(e){return e instanceof Error?e.message:String(e)}var Qc=Ct((e,t)=>{let n=()=>{let e=Jc(t().status)||t().queue.length>0;e&&!Xc&&(Xc=setInterval(()=>{t().refresh()},qc)),!e&&Xc&&(clearInterval(Xc),Xc=null)},r=async()=>{let{status:n,queue:r}=t();if(r.length===0||Jc(n))return;let[i,...a]=r;e({queue:a});try{e({status:await N(i.id,i),error:null})}catch(t){e({error:Zc(t)})}};return{status:null,error:null,queue:[],started:[],refresh:async()=>{try{e({status:await et(),error:null})}catch(t){e({error:`Lost contact with GAIA: ${Zc(t)}`})}await r(),n()},enqueue:async(t,i={})=>{let a=t.map(e=>({id:e,acknowledgeLowDisk:!!i.acknowledgeLowDisk,keepTrying:!!i.keepTrying}));e(e=>({queue:[...e.queue.filter(e=>!t.includes(e.id)),...a],started:[...new Set([...e.started,...t])],error:null})),await r(),n()},cancel:async n=>{e(e=>({queue:n?e.queue.filter(e=>e.id!==n):[]}));try{await Jt(n)}catch(t){e({error:Zc(t)})}await t().refresh()}}});function $c({placement:e=`sidebar`}){let t=R(),n=Qc(e=>e.status),r=Qc(e=>e.started),i=Qc(e=>e.queue),a=Yc(n,r),o=Qc(e=>e.refresh),s=B(e=>e.openSettings),c=B(e=>e.dismissDownloadFailure),l=B(e=>e.systemStatus?.download_progress??null);(0,V.useEffect)(()=>{o()},[o]);let u=(a?.models??[]).filter(e=>e.state!==`skipped`),d=Jc(a)||i.length>0,f=l?.state===`starting`||l?.state===`downloading`,p=d||f,m=u.some(e=>e.state===`failed`)&&a?.state!==`running`,h=!p&&(m||l?.state===`error`);if(!p&&!h)return null;let g=u.filter(e=>e.state!==`failed`&&e.state!==`cancelled`),_=g.length+i.length,v=g.filter(e=>e.state===`ready`||e.state===`verifying`||e.state===`unchecked`).length,y=d?a?.overall?.percent??0:l?.percent??0,b=d?Math.min(_,v+1):1,x=d?_:1,S=!p&&l?.state===`error`&&!!l.model_name;return z(`div`,{className:`download-chip-row is-${e}`,children:[z(`button`,{type:`button`,className:`download-chip is-${e}${h&&!p?` is-failed`:``}`,onClick:()=>s(`model`),"aria-label":t(`download.chipAria`),title:t(`download.chipAria`),children:[I(h?ri:Ci,{size:13,"aria-hidden":`true`}),I(`span`,{children:h?t(`download.chipFailed`):t(`download.chip`,{done:String(b),count:String(x),pct:String(y)})}),p&&I(`span`,{className:`download-chip-bar`,"aria-hidden":`true`,children:I(`span`,{style:{inlineSize:`${y}%`}})})]}),S&&I(`button`,{type:`button`,className:`download-chip-dismiss`,onClick:()=>{let e=l?.model_name;e&&c(e).catch(()=>{})},"aria-label":t(`download.dismissFailed`),title:t(`download.dismissFailed`),children:I(Is,{size:12,"aria-hidden":`true`})})]})}var el=500,tl=`gaia_always_allow_tools`;function nl(){try{localStorage.getItem(`gaia_always_allow_tools`)!==null&&(localStorage.removeItem(tl),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 rl=`allow_path_access`;function il(e){let{path:t,kind:n}=e??{};return{target:typeof t==`string`&&t.trim()?t:null,kind:n}}function al(e,t=!1,n=gt,r=e=>e){let{target:i,kind:a}=il(e),o=i?u(a===`folder`?`prompt.path.what.folder`:a===`file`?`prompt.path.what.file`:`prompt.path.what.new`,{path:r(i)}):u(`prompt.path.what.unknown`);return n(t?`prompt.path.askAlso`:`prompt.path.ask`,{what:o})}function ol(e,t=!1,n=gt){let{kind:r}=il(e);return n(`prompt.path.${t?`titleAlso`:`title`}.${r===`folder`?`folder`:r===`file`?`file`:`location`}`)}var sl={run_python:`prompt.title.python`,execute_python_file:`prompt.title.pythonFile`,run_shell_command:`prompt.title.command`};function cl(e,t=gt,n=e=>e){let r=e.toolArgs??{};if(e.tool===`allow_path_access`)return{heading:ol(r,e.pathFollowUp,t),question:al(r,e.pathFollowUp,t,n)};if(e.tool===`trust_project_folder`)return{heading:t(`prompt.trust.title`),question:t(`prompt.trust.ask`)};let i=ll(e,t)??n(e.toolLabel??e.tool??``),a=sl[e.tool??``];return{heading:a?t(a):t(e.toolLabel?`prompt.title.tool`:`prompt.title.toolId`,{tool:i}),question:t(`prompt.needsOk`,{tool:i})}}function ll(e,t){let n=`tool.${e.tool}.active`;if(!e.toolLabel||!ae(n))return null;let r=t.bare(n);return r.charAt(0).toLowerCase()+r.slice(1)}var ul=`changes to files in `;function dl(e,t){if(e.alwaysScope?.startsWith(ul))return t.bare(`prompt.always.changes`,{folder:e.alwaysScope.slice(20)});let n=ll(e,t),r=`${e.tool} `;if(!n||!e.alwaysScope?.startsWith(r))return null;let i=e.alwaysScope.slice(r.length);return i.startsWith(`on files in `)?t.bare(`prompt.always.folder`,{action:n,folder:i.slice(12)}):t.bare(`prompt.always.file`,{action:n,name:i.startsWith(`on `)?i.slice(3):i})}function fl(e){return e.trim().replace(/\\/g,`/`).replace(/\/+$/,``).toLowerCase()}function pl(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 ml(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=pl(r.toolArgs),{path:a}=n??{};if(!i||typeof a!=`string`||!a.trim())return!1;let o=fl(i),s=fl(a);return o===s||o.startsWith(`${s}/`)?!0:!/^([a-z]:)?\//.test(o)&&!o.startsWith(`~`)&&s.endsWith(`/${o.replace(/^\.\//,``)}`)}function hl(e){return e===`share_engineering_context`||e===`append_engineering_context`||e===`approve_engineering_code`||e===`allow_path_access`||e===`trust_project_folder`}function gl(e,t){return!t.alwaysScope||!t.sessionId||hl(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 _l=Ct((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,el)}}),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 a=t().notifications.find(e=>e.id===n);if(!a)throw Error(`That permission request is no longer pending.`);let o=r!==`deny`,s=r===`always`&&!hl(a.tool),c=window.gaiaAPI;if(a.sessionId)await i(a.sessionId,o,{always:s,confirmId:a.confirmId});else if(c?.notification?.respondPermission)await c.notification.respondPermission(n,o?`allow`:`deny`,s);else throw Error(`No agent is waiting for this answer any more.`);e(e=>({notifications:e.notifications.map(e=>e.id===n?{...e,response:o?`allow`:`deny`,respondedAt:Date.now(),read:!0}:e)}));let l=B.getState();a.sessionId&&a.sessionId===l.currentSessionId&&l.awaitingUser&&l.setAwaitingUser(!1)}})),vl=e=>e.notifications.filter(e=>!e.read&&!e.dismissed).length,yl=e=>{let t=e.notifications.filter(e=>!e.dismissed);return e.typeFilter?t.filter(t=>t.type===e.typeFilter):t},bl=e=>[...new Set(e.notifications.filter(e=>!e.dismissed).map(e=>e.type))],xl=e=>t=>t.notifications.find(t=>t.type===`permission_request`&&t.sessionId===e&&!t.response&&!t.dismissed)??null,Sl=e=>[...new Set(e.notifications.filter(e=>e.type===`permission_request`&&e.sessionId&&!e.response&&!e.dismissed).map(e=>e.sessionId))].sort(),Cl=`gaia_alert_settings`,wl={modes:{needs_approval:`banner`,question:`banner`,finished:`banner`},sound:!1,flash:!0,keepAwake:!0,batteryFloor:20},Tl=[`banner`,`badge`,`off`];function El(){let e=null;try{e=localStorage.getItem(Cl)}catch(e){return console.warn(`[alerts] Notification settings unreadable (site data blocked); using defaults.`,e),wl}if(!e)return wl;let t;try{t=JSON.parse(e)}catch(e){return console.warn(`[alerts] Saved notification settings are corrupt; using defaults.`,e),wl}let n={...wl.modes};for(let e of Object.keys(n)){let r=t.modes?.[e];r!==void 0&&Tl.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,wl.sound),flash:r(t.flash,wl.flash),keepAwake:r(t.keepAwake,wl.keepAwake),batteryFloor:typeof i==`number`&&i>=0&&i<=100?i:wl.batteryFloor}}function Dl(e){try{localStorage.setItem(Cl,JSON.stringify(e))}catch(e){console.warn(`[alerts] Notification settings not saved; they will reset on reload.`,e)}}var Ol=e=>({modes:e.modes,sound:e.sound,flash:e.flash,keepAwake:e.keepAwake,batteryFloor:e.batteryFloor}),kl=Ct((e,t)=>({...El(),setMode:(n,r)=>{e({modes:{...t().modes,[n]:r}}),Dl(Ol(t()))},update:n=>{e(n),Dl(Ol(t()))}}));function Al(e){let t=new Date(e.updated_at).getTime();return Number.isNaN(t)?0:t}function jl(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)=>Al(t)-Al(e));for(let e of a){let t=Al(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 Ml(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 Nl(e){return e.kind===`eval`||e.kind===`scheduled`}function Pl(e,t,{showAutomated:n=!1,now:r=new Date}={}){let i=n?e:e.filter(e=>!Nl(e)),a=(e,t)=>Al(t)-Al(e),o=i.filter(e=>Ml(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,...jl(c,r)]}function Fl(e){return e.filter(Nl).length}function Il(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 Ll(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 Rl={needs_approval:`GAIA needs your approval`,question:`GAIA has a question`,finished:`GAIA finished`};function zl(e,t){let n=t?.title||`A chat`;if(e!==`finished`)return{title:Rl[e],body:n};switch(t?.last_run_status){case`done`:return{title:Rl.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 Bl(e,t,n){return n&&e===t}function Vl(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 Hl(e,t){return!e||e.charging||t<=0?!0:e.level*100>=t}function Ul(){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 Wl(e){let t=e%100;return`${e}${t>=11&&t<=13?`th`:{1:`st`,2:`nd`,3:`rd`}[e%10]??`th`}`}function Gl(){return typeof navigator<`u`&&/Mac/i.test(navigator.platform)}function Kl(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 ql={Ctrl:`⌃`,Alt:`⌥`,Shift:`⇧`,Mod:`⌘`},Jl=[`Ctrl`,`Alt`,`Shift`,`Mod`];function Yl(e,t=Gl()){let n=e.split(`+`),r=n.pop(),i=n.filter(e=>!(e in ql));if(i.length)throw Error(`formatShortcut: unknown modifier(s) ${i.join(`, `)} in "${e}"; use Ctrl, Alt, Shift or Mod`);return t?Jl.filter(e=>n.includes(e)).map(e=>ql[e]).join(``)+r:[...n.map(e=>e===`Mod`?`Ctrl`:e),r].join(`+`)}var Xl=new Set([`New chat`,`New Task`]);function Zl(e,t){let n=t.sessions.find(t=>t.id===e);return!(!n||!Xl.has(n.title)||(n.message_count??0)!==0||t.runningSessionIds.includes(e)||t.messageQueues?.[e]?.length||t.pendingPrompt?.sessionId===e||t.currentSessionId===e&&(t.messages.length!==0||t.isStreaming))}async function Ql(e){if(!e)return!1;let t=B.getState();if(!Zl(e,{sessions:t.sessions,currentSessionId:t.currentSessionId,messages:t.messages,isStreaming:t.isStreaming,runningSessionIds:t.runningSessionIds,messageQueues:t.messageQueues,pendingPrompt:t.pendingPrompt}))return!1;F.chat.info(`Removing abandoned draft session ${e}`),t.addPendingDelete(e),t.removeSession(e);try{return await Vn(e),!0}catch(t){return F.chat.warn(`Failed to delete abandoned draft ${e}`,t),!1}finally{t.removePendingDelete(e)}}var $l=32768,eu=`Gemma-4-E4B-it-GGUF`,tu=3e5,nu=18e5,ru=1e4,iu=`GAIA is starting…`;function au(e){let[t,n]=(0,V.useState)(()=>typeof window.matchMedia==`function`&&window.matchMedia(e).matches);return(0,V.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}var ou=e=>`${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`;function su(){let[e,t]=(0,V.useState)(()=>new Date);return(0,V.useEffect)(()=>{let e,n=()=>t(e=>ou(e)===ou(new Date)?e:new Date),r=()=>{let t=new Date,i=new Date(t.getFullYear(),t.getMonth(),t.getDate()+1).getTime();e=setTimeout(()=>{n(),r()},i-t.getTime()+1e3)};return r(),document.addEventListener(`visibilitychange`,n),window.addEventListener(`focus`,n),()=>{clearTimeout(e),document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`focus`,n)}},[]),e}var cu=new URL(`gaia-robot-NKaQnEIp.png`,import.meta.url).href,lu=16,uu=`gaia-chat-sidebar-width`,du=e=>Math.round(Math.max(200,Math.min(420,e)));function fu(){try{let e=Number(localStorage.getItem(uu));return e?du(e):260}catch(e){return F.system.warn(`Saved sidebar width unreadable; using the default.`,e),260}}function pu(e){try{localStorage.setItem(uu,String(e))}catch(e){F.system.warn(`Sidebar width not saved; it resets on reload.`,e)}}function mu(e){return getComputedStyle(e).direction===`rtl`}function hu(e){let t=R(),[n,r]=(0,V.useState)(fu),[i,a]=(0,V.useState)(null),o=(0,V.useCallback)(e=>{let t=du(e);r(t),pu(t)},[]),s=(0,V.useCallback)(t=>{if(t.button!==0)return;t.preventDefault();let r=t.clientX,i=n,s=t.currentTarget,c=mu(s)?-1:1;s.setPointerCapture?.(t.pointerId);let l=i,u=e=>{l=i+c*(e.clientX-r),a(l<150?l:du(l))},d=()=>{s.removeEventListener(`pointermove`,u),s.removeEventListener(`pointerup`,d),s.removeEventListener(`pointercancel`,d),a(null),l<150?e():o(l)};s.addEventListener(`pointermove`,u),s.addEventListener(`pointerup`,d),s.addEventListener(`pointercancel`,d)},[e,o,n]),c=(0,V.useCallback)(e=>{let t=mu(e.currentTarget)?-16:lu,r={ArrowLeft:n-t,ArrowRight:n+t,Home:200,End:420}[e.key];r!==void 0&&(e.preventDefault(),o(r))},[o,n]),l=I(`div`,{className:`sb-resize${i==null?``:` is-dragging`}`,role:`separator`,"aria-orientation":`vertical`,"aria-label":t(`sidebar.resize`),"aria-valuemin":200,"aria-valuemax":420,"aria-valuenow":Math.round(i??n),tabIndex:0,title:t(`sidebar.resizeTitle`),onPointerDown:s,onKeyDown:c,onDoubleClick:()=>o(260)});return{width:i??n,resizing:i!=null,handle:l}}function gu(e){return e.normalize(`NFKD`).replace(/\p{Mn}/gu,``).toLowerCase().replace(/ß/g,`ss`)}function _u(e){return Array.from(e,gu).join(``)}function vu(e,t){let n=_u(t.trim());if(!n)return null;let r=``,i=[],a=0;for(let t of e){let e=gu(t);r+=e;for(let t=0;t<e.length;t++)i.push(a);a+=t.length}let o=r.indexOf(n);if(o<0)return null;let s=i[o],c=i[o+n.length-1],l=c+String.fromCodePoint(e.codePointAt(c)).length;return{before:e.slice(0,s),match:e.slice(s,l),after:e.slice(l)}}var yu={running:`row.status.running`,queued:`row.status.queued`,waiting:`row.status.waiting`,done:`row.status.done`,failed:`row.status.failed`},bu={"Needs you":`sidebar.group.needsYou`,Pinned:`sidebar.group.pinned`,Today:`sidebar.group.today`,Yesterday:`sidebar.group.yesterday`,"Previous 7 days":`sidebar.group.prev7`,"Previous 30 days":`sidebar.group.prev30`,Older:`sidebar.group.older`},xu=`gaia-show-automated-runs`,Su=200,Cu=new Map;function wu({parts:e}){return z(P.Fragment,{children:[e.before,I(`mark`,{className:`sb-hit`,children:e.match}),e.after]})}function Tu(){try{return localStorage.getItem(xu)===`1`}catch(e){return F.system.warn(`Chat-list filter unreadable (site data blocked); hiding eval and scheduled runs.`,e),!1}}var Eu=e=>`sb-result-${e}`;function Du({session:e,active:t,phone:n,moved:r,focusPin:i,status:a,queuePlace:o,unsent:s,failed:c,onSelect:l,onDelete:d,onPin:f,onRename:p,rowId:m,kbdActive:h,titleMatch:g,snippet:_}){let v=R(),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)(!1),C=(0,V.useRef)(null),w=(0,V.useCallback)(()=>{S(!1),b(!1)},[]),[T,E]=(0,V.useState)(null),D=T!==null,O=(0,V.useRef)(!1),k=()=>{O.current=!1,E(e.title)},ee=(0,V.useRef)(null),te=(0,V.useRef)(null),ne=(0,V.useRef)(!1),A=(t,n=!1)=>{T===null||O.current||(O.current=!0,ne.current=n,E(null),t&&p(e.id,T))},[re,ie]=(0,V.useState)(!1);(0,V.useEffect)(()=>{if(!y||re)return;let e=setTimeout(()=>b(!1),3e3);return()=>clearTimeout(e)},[y,re]),(0,V.useEffect)(()=>{!D&&ne.current&&(ne.current=!1,ee.current?.focus())},[D]),(0,V.useEffect)(()=>{i&&te.current?.focus()},[i]);let ae=(0,V.useRef)(null);(0,V.useEffect)(()=>{r&&ae.current?.scrollIntoView?.({block:`nearest`})},[r]);let j=e=>e.preventDefault(),oe=!!e.unread&&!t,se=a===`done`&&!oe?null:a,ce=o>0?`${Wl(o)} in line`:null,le=se?[v(yu[se]),ce].filter(Boolean).join(`, `):void 0,ue=c>0?`${c} not sent`:s>0?`${s} to send`:null,de=[ce,ue].filter(Boolean).join(` · `),fe=_?`${_.before}${_.match}${_.after}`:null,pe=I(`span`,{className:`sb-row-title`,dir:`auto`,children:g?I(wu,{parts:g}):e.title});return z(`li`,{ref:ae,className:`sb-row${t?` is-active`:``}${oe?` is-unread`:``}${r?` is-moved`:``}${h?` is-kbd-active`:``}`,"data-status":se??void 0,children:[D?I(`input`,{className:`sb-row-edit`,value:T,maxLength:200,onChange:e=>E(e.target.value),onBlur:()=>A(!0),onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),A(!0,!0)),e.key===`Escape`&&(e.preventDefault(),A(!1,!0))},...Pt,autoFocus:!0,onFocus:e=>e.currentTarget.select(),"aria-label":v(`row.renameAria`,{title:e.title}),dir:`auto`}):z(`button`,{ref:ee,type:`button`,id:m,className:`sb-row-main`,onClick:()=>l(e.id),onDoubleClick:k,"aria-current":t?`page`:void 0,"aria-label":[e.title,le,ue,oe?v(`row.unread`):null,fe].filter(Boolean).join(`, `),title:e.title,children:[se&&I(`span`,{className:`sb-dot is-${se}`,"aria-hidden":`true`,title:le}),e.private&&I(Ni,{size:12,className:`sb-row-icon`,"aria-label":v(`row.private`)}),_?z(`span`,{className:`sb-row-text`,children:[pe,I(`span`,{className:`sb-row-snippet`,children:I(wu,{parts:_})})]}):pe,de&&I(`span`,{className:`sb-row-queue${c>0?` is-failed`:``}`,children:de})]}),n&&D&&z(P.Fragment,{children:[I(`button`,{type:`button`,className:`sb-row-edit-btn is-save`,onPointerDown:j,onMouseDown:j,onClick:()=>A(!0),"aria-label":v(`row.saveName`),children:I(Vr,{size:18,"aria-hidden":`true`})}),I(`button`,{type:`button`,className:`sb-row-edit-btn`,onPointerDown:j,onMouseDown:j,onClick:()=>A(!1),"aria-label":v(`row.cancelRename`),children:I(Is,{size:18,"aria-hidden":`true`})})]}),n?!D&&z(P.Fragment,{children:[I(`button`,{ref:C,type:`button`,className:`sb-row-more`,onClick:()=>x?w():S(!0),"aria-haspopup":`dialog`,"aria-expanded":x,"aria-label":v(`row.moreActions`,{title:e.title}),children:I(Di,{size:18,"aria-hidden":`true`})}),I(Gs,{open:x,onClose:w,anchor:C,label:v(`row.actions`),placement:`below`,align:`end`,children:z(`div`,{className:`sb-row-menu`,children:[z(`button`,{type:`button`,className:`popover-item`,onClick:()=>{w(),k()},children:[I(vo,{size:15,"aria-hidden":`true`}),v(`row.rename`)]}),z(`button`,{type:`button`,className:`popover-item`,onClick:()=>{w(),f(e.id,!e.pinned,!0)},children:[e.pinned?I(bo,{size:15,"aria-hidden":`true`}):I(So,{size:15,"aria-hidden":`true`}),e.pinned?v(`row.unpin`):v(`row.pin`)]}),z(`button`,{type:`button`,className:`popover-item sb-row-menu-delete`,onClick:()=>y?d(e.id):b(!0),children:[I(Ss,{size:15,"aria-hidden":`true`}),y?v(`row.tapAgain`,{label:s>0?u(Xn(`row.deleteUnsent`,s),{n:s}):u(`row.deleteConfirm`)}):v(`row.delete`)]}),y&&I(`p`,{className:`sb-row-menu-note`,children:v(`row.deleteMemoryNote`)})]})})]}):z(`span`,{className:`sb-row-actions${D?` is-editing`:``}`,children:[!D&&I(`button`,{type:`button`,className:`sb-row-rename`,onClick:k,"aria-label":v(`row.renameAria`,{title:e.title}),title:v(`row.rename`),children:I(vo,{size:13})}),I(`button`,{ref:te,type:`button`,className:`sb-row-pin${e.pinned?` is-pinned`:``}`,onClick:t=>f(e.id,!e.pinned,!1,t.detail===0),"aria-label":v(e.pinned?`row.unpinAria`:`row.pinAria`,{title:e.title}),"aria-pressed":!!e.pinned,title:e.pinned?v(`row.unpin`):v(`row.pinToTop`),children:e.pinned?I(bo,{size:13}):I(So,{size:13})}),I(`button`,{type:`button`,className:`sb-row-delete${y?` is-confirm`:``}`,onClick:()=>y?d(e.id):b(!0),onPointerEnter:()=>ie(!0),onPointerLeave:()=>ie(!1),"aria-label":y?s>0?v.plural(`row.confirmDeleteUnsentAria`,s,{title:e.title}):v(`row.confirmDeleteAria`,{title:e.title}):v(`row.deleteAria`,{title:e.title}),title:y?`${s>0?v.plural(`row.clickAgainUnsent`,s):v(`row.clickAgain`)}\n${v(`row.deleteMemoryNote`)}`:v(`row.delete`),children:y?I(`span`,{className:`sb-row-delete-label`,children:s>0?v.plural(`row.deleteUnsent`,s):v(`row.deleteConfirm`)}):I(Ss,{size:13})})]})]})}function Ou({onNewChat:e,onMobileAccess:t,tunnelActive:n}){let r=R(),i=B(e=>e.sessions),a=B(e=>e.currentSessionId),o=B(e=>e.runningSessionIds),s=B(e=>e.queuedSessionIds),c=B(e=>e.awaitingBySession),l=B(e=>e.messageQueues),u=B(e=>e.updateSessionInList),d=_l(Us(Sl)),f=B(e=>e.sidebarOpen),p=B(e=>e.sidebarCollapsed),m=B(e=>e.toggleSidebarCollapsed),h=B(e=>e.setSidebarOpen),g=B(e=>e.setCurrentSession),_=B(e=>e.setMessages),v=B(e=>e.removeSession),y=B(e=>e.addPendingDelete),b=B(e=>e.removePendingDelete),x=B(e=>e.openSettings),S=B(e=>e.settingsSection===`skills`),C=B(e=>e.setShowMemoryDashboard),w=B(e=>e.setShowSchedules),T=B(e=>e.setShowDocLibrary),E=B(e=>e.showMemoryDashboard),D=B(e=>e.showSchedules),O=_l(vl),k=_l(e=>e.showPanel),ee=_l(e=>e.setShowPanel),[te,ne]=(0,V.useState)(``),[A,re]=(0,V.useState)(null),[ie,ae]=(0,V.useState)(null),[j,oe]=(0,V.useState)(-1),[se,ce]=(0,V.useState)(null),[le,ue]=(0,V.useState)(null),[de,fe]=(0,V.useState)(Tu),pe=au(`(max-width: 768px)`),me=(0,V.useRef)(null),he=(0,V.useRef)(null);(0,V.useEffect)(()=>ne(``),[a]),(0,V.useEffect)(()=>{let e=()=>{let e=document.activeElement;e instanceof HTMLElement&&e!==me.current&&(he.current=e),p&&m(),requestAnimationFrame(()=>me.current?.focus())};return window.addEventListener(`gaia:focus-search`,e),()=>window.removeEventListener(`gaia:focus-search`,e)},[p,m]);let M=(0,V.useMemo)(()=>({running:o,queued:s,awaiting:c,prompting:d}),[o,s,c,d]),N=te.trim();(0,V.useEffect)(()=>{if(oe(-1),ae(null),!N){re(null);return}let e=new AbortController,t=setTimeout(()=>{Kn(N,de,e.signal).then(({results:e,truncated:t})=>re({query:N,results:e,truncated:!!t})).catch(t=>{e.signal.aborted||(F.chat.error(`Chat search failed`,t),ae(`Could not search inside chats: ${t instanceof Error?t.message:t}`),re({query:N,results:[],truncated:!1}))})},Su);return()=>{clearTimeout(t),e.abort()}},[N,de]);let ge=!!N&&A?.query!==N,ve=(0,V.useMemo)(()=>A&&A.query===N?new Map(A.results.map(e=>[e.session_id,e])):Cu,[A,N]),ye=Fl(i),be=su(),xe=(0,V.useMemo)(()=>{let e=_u(N);return Pl(N?i.filter(t=>_u(t.title).includes(e)||ve.has(t.id)):i,M,{showAutomated:de,now:be})},[i,N,ve,M,de,be]),Se=(0,V.useMemo)(()=>N?xe.flatMap(e=>e.sessions):[],[N,xe]),Ce=j>=0&&Se.length>0?Se[Math.min(j,Se.length-1)]:void 0;(0,V.useEffect)(()=>{Ce&&document.getElementById(Eu(Ce.id))?.scrollIntoView?.({block:`nearest`})},[Ce]);let we=(0,V.useCallback)(()=>{fe(e=>{try{localStorage.setItem(xu,e?`0`:`1`)}catch(e){F.system.warn(`Chat-list filter not saved; it will reset on reload.`,e)}return!e})},[]),Te=(0,V.useCallback)(e=>{u(e,{unread:!1}),On(e).catch(t=>{F.chat.error(`Could not mark chat ${e} read`,t),ue(`Could not mark the chat read: ${t instanceof Error?t.message:t}`)})},[u]),Ee=i.find(e=>e.id===a)?.unread;(0,V.useEffect)(()=>{if(!a||!Ee)return;if(document.hasFocus()){Te(a);return}let e=()=>Te(a);return window.addEventListener(`focus`,e,{once:!0}),()=>window.removeEventListener(`focus`,e)},[a,Ee,Te]);let[De,Oe]=(0,V.useState)(null),[ke,Ae]=(0,V.useState)(null);(0,V.useEffect)(()=>{ke&&Ae(null)},[ke]),(0,V.useEffect)(()=>{if(!De)return;let e=setTimeout(()=>Oe(null),1200);return()=>clearTimeout(e)},[De]);let je=(0,V.useCallback)(async(e,t)=>{ue(null),u(e,{pinned:t});try{await Ft(e,t)}catch(n){F.chat.error(`Could not ${t?`pin`:`unpin`} chat ${e}`,n),u(e,{pinned:!t}),ue(n instanceof Error?n.message:`Could not ${t?`pin`:`unpin`} the chat.`)}},[u]),Me=(0,V.useCallback)(async(e,t)=>{let n=t.trim().slice(0,200).trim(),r=B.getState().sessions.find(t=>t.id===e)?.title;if(n&&t!==r&&n!==r){ue(null),u(e,{title:n});try{await _e(e,{title:n,title_is_custom:!0})}catch(t){F.chat.error(`Could not rename chat ${e}`,t),r!==void 0&&u(e,{title:r}),ue(t instanceof Error?t.message:`Could not rename the chat.`)}}},[u]),Ne=(0,V.useCallback)(()=>{window.innerWidth<=768&&h(!1)},[h]),Pe=(0,V.useCallback)(e=>{e===a?(g(e),Ne()):(Ql(a),g(e),_([]),Ne())},[a,g,_,Ne]),Fe=e=>{if(e.key===`Escape`){e.preventDefault(),ne(``);let t=he.current;he.current=null;let n=t?.isConnected&&t!==document.body?t:document.querySelector(`.composer-input`);n?n.focus():me.current?.blur();return}if(!N||Se.length===0||e.nativeEvent.isComposing)return;let t=Ce?Se.indexOf(Ce):-1;e.key===`ArrowDown`?(e.preventDefault(),oe(Math.min(t+1,Se.length-1))):e.key===`ArrowUp`?(e.preventDefault(),oe(Math.max(t-1,0))):e.key===`Enter`&&(e.preventDefault(),Pe((Ce??Se[0]).id))},Ie=(0,V.useCallback)(async e=>{ce(null),y(e);try{await Vn(e),v(e)}catch(t){F.chat.error(`Delete failed for session ${e}`,t),ce(t instanceof Error?t.message:`Could not delete the chat.`)}finally{b(e)}},[y,b,v]),Le=p&&!pe,Re=B(e=>e.setSidebarCollapsed),ze=hu((0,V.useCallback)(()=>Re(!0),[Re])),Be=!pe&&!Le,Ve=[{key:`memory`,label:r(`sidebar.memory`),icon:kr,on:E,onClick:()=>{C(!0),Ne()}},{key:`schedules`,label:r(`sidebar.schedules`),icon:di,on:D,onClick:()=>{w(!0),Ne()}},{key:`connectors`,label:r(`settings.section.connectors`),icon:Eo,on:!1,onClick:()=>{x(`connectors`),Ne()}},{key:`documents`,label:r(`sidebar.documents`),icon:Yi,on:!1,onClick:()=>{T(!0),Ne()}},{key:`skills`,label:r(`settings.section.skills`),icon:us,on:S,onClick:()=>{x(`skills`),Ne()}}];return z(`aside`,{className:`sb${f?` is-open`:``}${Le?` is-collapsed`:``}${ze.resizing?` is-resizing`:``}`,style:Be?{width:ze.width,minWidth:ze.width}:void 0,"aria-label":r(`sidebar.label`),children:[Be&&ze.handle,z(`div`,{className:`sb-top`,children:[z(`div`,{className:`sb-brand`,children:[I(`img`,{src:cu,alt:``,width:22,height:22}),!Le&&I(`span`,{children:`GAIA`})]}),I(`button`,{type:`button`,className:`sb-icon-btn`,onClick:pe?()=>h(!1):m,"aria-label":r(Le?`sidebar.expand`:`sidebar.collapse`),title:r.hint(r(Le?`sidebar.expand`:`sidebar.collapse`),Yl(`Mod+B`)),children:I(pe?Is:Le?ao:ro,{size:17})})]}),z(`div`,{className:`sb-actions`,children:[Le?I(`button`,{type:`button`,className:`sb-nav-item`,onClick:()=>window.dispatchEvent(new CustomEvent(`gaia:focus-search`)),"aria-label":r(`sidebar.search`),children:I(Ko,{size:16,"aria-hidden":`true`})}):z(`label`,{className:`sb-search`,children:[I(Ko,{size:14,"aria-hidden":`true`}),I(`input`,{ref:me,type:`search`,value:te,onChange:e=>ne(e.target.value),onKeyDown:Fe,onFocus:e=>{e.relatedTarget instanceof HTMLElement&&(he.current=e.relatedTarget)},...Pt,placeholder:r.bare(`sidebar.search`),"aria-label":r.hint(r(`sidebar.search`),Yl(`Mod+K`)),"aria-controls":`sb-chat-list`,"aria-activedescendant":Ce?Eu(Ce.id):void 0,dir:`auto`})]}),I(`p`,{className:`sb-sr-only`,role:`status`,"aria-live":`polite`,children:N&&!ge?Se.length===0?r(`sidebar.noMatch`):r.plural(`sidebar.matchCount`,Se.length):``}),z(`button`,{type:`button`,className:`sb-nav-item`,onClick:()=>{e(),Ne()},title:r.hint(r(`sidebar.newChat`),Yl(`Mod+Shift+O`)),children:[I(gs,{size:16,"aria-hidden":`true`}),!Le&&I(`span`,{children:r(`sidebar.newChat`)})]}),Ve.map(({key:e,label:t,icon:n,on:r,onClick:i})=>z(`button`,{type:`button`,className:`sb-nav-item${r?` is-active`:``}`,onClick:i,"aria-current":r?`page`:void 0,"aria-label":t,title:Le?t:void 0,children:[I(n,{size:16,"aria-hidden":`true`}),!Le&&I(`span`,{children:t})]},e))]}),!Le&&z(`nav`,{className:`sb-list`,id:`sb-chat-list`,"aria-label":r(`sidebar.recent`),children:[xe.length===0&&I(`p`,{className:`sb-empty`,children:r(N?ge?`sidebar.searching`:`sidebar.noMatch`:`sidebar.empty`)}),xe.map(e=>z(`section`,{className:`sb-group${e.label===`Needs you`?` is-needs-you`:``}`,children:[I(`h2`,{className:`sb-group-label`,children:r(bu[e.label])}),I(`ul`,{children:e.sessions.map(e=>I(Du,{session:e,active:e.id===a&&!E,phone:pe,moved:e.id===De,focusPin:e.id===ke,status:Ml(e,M),queuePlace:s.indexOf(e.id)+1,unsent:l[e.id]?.length??0,failed:l[e.id]?.filter(e=>e.state===`failed`).length??0,onSelect:Pe,onDelete:Ie,onPin:(e,t,n,r)=>{n&&Oe(e),r&&Ae(e),je(e,t)},onRename:(e,t)=>void Me(e,t),rowId:N?Eu(e.id):void 0,kbdActive:Ce?.id===e.id,titleMatch:N?vu(e.title,N):null,snippet:ve.get(e.id)?.field===`message`?ve.get(e.id).snippet:null},e.id))})]},e.label)),ye>0&&I(`button`,{type:`button`,className:`sb-filter`,onClick:we,"aria-pressed":de,children:de?r(`sidebar.hideBackground`):r.plural(`sidebar.showBackground`,ye)}),N&&A?.query===N&&A.truncated&&I(`p`,{className:`sb-empty`,children:r(`sidebar.searchCapped`,{n:A.results.length})}),ie&&I(`p`,{className:`sb-error`,role:`alert`,children:ie}),se&&I(`p`,{className:`sb-error`,role:`alert`,children:se}),le&&I(`p`,{className:`sb-error`,role:`alert`,children:le})]}),!Le&&I($c,{}),z(`div`,{className:`sb-bottom`,children:[!Le&&I(Kc,{}),z(`div`,{className:`sb-bottom-actions`,children:[z(`button`,{type:`button`,className:`sb-icon-btn${k?` is-active`:``}`,onClick:()=>ee(!k),"aria-label":O>0?r(`sidebar.notificationsUnread`,{n:O}):r(`sidebar.notifications`),"aria-expanded":k,title:r(`sidebar.notifications`),children:[I(Tr,{size:16}),O>0&&I(`span`,{className:`sb-badge`,"aria-hidden":`true`,children:O>99?`99+`:O})]}),t&&I(`button`,{type:`button`,className:`sb-icon-btn${n?` is-active`:``}`,onClick:t,"aria-label":r(n?`sidebar.mobileAccessOn`:`sidebar.mobileAccess`),title:r(`sidebar.mobileAccess`),children:I(cs,{size:16})}),I(`button`,{type:`button`,className:`sb-icon-btn`,onClick:()=>x(),"aria-label":r(`sidebar.settings`),title:r.hint(r(`sidebar.settings`),Yl(`Mod+,`)),children:I(Xo,{size:16})})]})]})]})}function ku(e,t){let n=(0,V.useRef)(e),r=(0,V.useRef)(t);r.current=t,(0,V.useEffect)(()=>{let t=n.current&&!e;n.current=e,t&&r.current()},[e])}var Au=2e3;function ju(e,t,n){let r=(0,V.useRef)(n);r.current=n;let[i,a]=(0,V.useState)(0);(0,V.useEffect)(()=>{if(!e||!t)return;let n=window.setTimeout(()=>{r.current(),a(e=>e+1)},Au);return()=>window.clearTimeout(n)},[e,t,i])}function Mu(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var Nu=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Pu=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Fu={};function Iu(e,t){return((t||Fu).jsx?Pu:Nu).test(e)}var Lu=/[ \t\n\f\r]/g;function Ru(e){return typeof e==`object`?e.type===`text`&&zu(e.value):zu(e)}function zu(e){return e.replace(Lu,``)===``}var Bu=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};Bu.prototype.normal={},Bu.prototype.property={},Bu.prototype.space=void 0;function Vu(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new Bu(n,r,t)}function Hu(e){return e.toLowerCase()}var Uu=class{constructor(e,t){this.attribute=t,this.property=e}};Uu.prototype.attribute=``,Uu.prototype.booleanish=!1,Uu.prototype.boolean=!1,Uu.prototype.commaOrSpaceSeparated=!1,Uu.prototype.commaSeparated=!1,Uu.prototype.defined=!1,Uu.prototype.mustUseProperty=!1,Uu.prototype.number=!1,Uu.prototype.overloadedBoolean=!1,Uu.prototype.property=``,Uu.prototype.spaceSeparated=!1,Uu.prototype.space=void 0;var Wu=e({boolean:()=>Ku,booleanish:()=>qu,commaOrSpaceSeparated:()=>Zu,commaSeparated:()=>Xu,number:()=>H,overloadedBoolean:()=>Ju,spaceSeparated:()=>Yu}),Gu=0,Ku=Qu(),qu=Qu(),Ju=Qu(),H=Qu(),Yu=Qu(),Xu=Qu(),Zu=Qu();function Qu(){return 2**++Gu}var $u=Object.keys(Wu),ed=class extends Uu{constructor(e,t,n,r){let i=-1;if(super(e,t),td(this,`space`,r),typeof n==`number`)for(;++i<$u.length;){let e=$u[i];td(this,$u[i],(n&Wu[e])===Wu[e])}}};ed.prototype.defined=!0;function td(e,t,n){n&&(e[t]=n)}function nd(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new ed(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Hu(r)]=r,n[Hu(a.attribute)]=r}return new Bu(t,n,e.space)}var rd=nd({properties:{ariaActiveDescendant:null,ariaAtomic:qu,ariaAutoComplete:null,ariaBusy:qu,ariaChecked:qu,ariaColCount:H,ariaColIndex:H,ariaColSpan:H,ariaControls:Yu,ariaCurrent:null,ariaDescribedBy:Yu,ariaDetails:null,ariaDisabled:qu,ariaDropEffect:Yu,ariaErrorMessage:null,ariaExpanded:qu,ariaFlowTo:Yu,ariaGrabbed:qu,ariaHasPopup:null,ariaHidden:qu,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Yu,ariaLevel:H,ariaLive:null,ariaModal:qu,ariaMultiLine:qu,ariaMultiSelectable:qu,ariaOrientation:null,ariaOwns:Yu,ariaPlaceholder:null,ariaPosInSet:H,ariaPressed:qu,ariaReadOnly:qu,ariaRelevant:null,ariaRequired:qu,ariaRoleDescription:Yu,ariaRowCount:H,ariaRowIndex:H,ariaRowSpan:H,ariaSelected:qu,ariaSetSize:H,ariaSort:null,ariaValueMax:H,ariaValueMin:H,ariaValueNow:H,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function id(e,t){return t in e?e[t]:t}function ad(e,t){return id(e,t.toLowerCase())}var od=nd({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Xu,acceptCharset:Yu,accessKey:Yu,action:null,allow:null,allowFullScreen:Ku,allowPaymentRequest:Ku,allowUserMedia:Ku,alt:null,as:null,async:Ku,autoCapitalize:null,autoComplete:Yu,autoFocus:Ku,autoPlay:Ku,blocking:Yu,capture:null,charSet:null,checked:Ku,cite:null,className:Yu,cols:H,colSpan:null,content:null,contentEditable:qu,controls:Ku,controlsList:Yu,coords:H|Xu,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ku,defer:Ku,dir:null,dirName:null,disabled:Ku,download:Ju,draggable:qu,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ku,formTarget:null,headers:Yu,height:H,hidden:Ju,high:H,href:null,hrefLang:null,htmlFor:Yu,httpEquiv:Yu,id:null,imageSizes:null,imageSrcSet:null,inert:Ku,inputMode:null,integrity:null,is:null,isMap:Ku,itemId:null,itemProp:Yu,itemRef:Yu,itemScope:Ku,itemType:Yu,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ku,low:H,manifest:null,max:null,maxLength:H,media:null,method:null,min:null,minLength:H,multiple:Ku,muted:Ku,name:null,nonce:null,noModule:Ku,noValidate:Ku,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:Ku,optimum:H,pattern:null,ping:Yu,placeholder:null,playsInline:Ku,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ku,referrerPolicy:null,rel:Yu,required:Ku,reversed:Ku,rows:H,rowSpan:H,sandbox:Yu,scope:null,scoped:Ku,seamless:Ku,selected:Ku,shadowRootClonable:Ku,shadowRootDelegatesFocus:Ku,shadowRootMode:null,shape:null,size:H,sizes:null,slot:null,span:H,spellCheck:qu,src:null,srcDoc:null,srcLang:null,srcSet:null,start:H,step:null,style:null,tabIndex:H,target:null,title:null,translate:null,type:null,typeMustMatch:Ku,useMap:null,value:qu,width:H,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Yu,axis:null,background:null,bgColor:null,border:H,borderColor:null,bottomMargin:H,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ku,declare:Ku,event:null,face:null,frame:null,frameBorder:null,hSpace:H,leftMargin:H,link:null,longDesc:null,lowSrc:null,marginHeight:H,marginWidth:H,noResize:Ku,noHref:Ku,noShade:Ku,noWrap:Ku,object:null,profile:null,prompt:null,rev:null,rightMargin:H,rules:null,scheme:null,scrolling:qu,standby:null,summary:null,text:null,topMargin:H,valueType:null,version:null,vAlign:null,vLink:null,vSpace:H,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ku,disableRemotePlayback:Ku,prefix:null,property:null,results:H,security:null,unselectable:null},space:`html`,transform:ad}),sd=nd({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:Zu,accentHeight:H,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:H,amplitude:H,arabicForm:null,ascent:H,attributeName:null,attributeType:null,azimuth:H,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:H,by:null,calcMode:null,capHeight:H,className:Yu,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:H,diffuseConstant:H,direction:null,display:null,dur:null,divisor:H,dominantBaseline:null,download:Ku,dx:null,dy:null,edgeMode:null,editable:null,elevation:H,enableBackground:null,end:null,event:null,exponent:H,externalResourcesRequired:null,fill:null,fillOpacity:H,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:Xu,g2:Xu,glyphName:Xu,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:H,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:H,horizOriginX:H,horizOriginY:H,id:null,ideographic:H,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:H,k:H,k1:H,k2:H,k3:H,k4:H,kernelMatrix:Zu,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:H,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:H,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:H,overlineThickness:H,paintOrder:null,panose1:null,path:null,pathLength:H,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Yu,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:H,pointsAtY:H,pointsAtZ:H,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Zu,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Zu,rev:Zu,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Zu,requiredFeatures:Zu,requiredFonts:Zu,requiredFormats:Zu,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:H,specularExponent:H,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:H,strikethroughThickness:H,string:null,stroke:null,strokeDashArray:Zu,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:H,strokeOpacity:H,strokeWidth:null,style:null,surfaceScale:H,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Zu,tabIndex:H,tableValues:null,target:null,targetX:H,targetY:H,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Zu,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:H,underlineThickness:H,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:H,values:null,vAlphabetic:H,vMathematical:H,vectorEffect:null,vHanging:H,vIdeographic:H,version:null,vertAdvY:H,vertOriginX:H,vertOriginY:H,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:H,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:id}),cd=nd({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()}}),ld=nd({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:ad}),ud=nd({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),dd={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`},fd=/[A-Z]/g,pd=/-[a-z]/g,md=/^data[-\w.:]+$/i;function hd(e,t){let n=Hu(t),r=t,i=Uu;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&md.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(pd,_d);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!pd.test(e)){let n=e.replace(fd,gd);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=ed}return new i(r,t)}function gd(e){return`-`+e.toLowerCase()}function _d(e){return e.charAt(1).toUpperCase()}var vd=Vu([rd,od,cd,ld,ud],`html`),yd=Vu([rd,sd,cd,ld,ud],`svg`);function bd(e){return e.join(` `).trim()}var xd=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(`
11
+ `);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})),Sd=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(xd());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}})),Cd=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))}})),wd=n(((e,t,n)=>{var r=(n&&n.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(Sd()),i=Cd();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})),Td=Dd(`end`),Ed=Dd(`start`);function Dd(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 Od(e){let t=Ed(e),n=Td(e);if(t&&n)return{start:t,end:n}}function kd(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?jd(e.position):`start`in e||`end`in e?jd(e):`line`in e||`column`in e?Ad(e):``}function Ad(e){return Md(e&&e.line)+`:`+Md(e&&e.column)}function jd(e){return Ad(e&&e.start)+`-`+Ad(e&&e.end)}function Md(e){return e&&typeof e==`number`?e:1}var Nd=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=kd(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}};Nd.prototype.file=``,Nd.prototype.name=``,Nd.prototype.reason=``,Nd.prototype.message=``,Nd.prototype.stack=``,Nd.prototype.column=void 0,Nd.prototype.line=void 0,Nd.prototype.ancestors=void 0,Nd.prototype.cause=void 0,Nd.prototype.fatal=void 0,Nd.prototype.place=void 0,Nd.prototype.ruleId=void 0,Nd.prototype.source=void 0;var Pd=t(wd(),1),Fd={}.hasOwnProperty,Id=new Map,Ld=/[A-Z]/g,Rd=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),zd=new Set([`td`,`th`]),Bd=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function Vd(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=Qd(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=Zd(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`?yd:vd,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=Hd(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function Hd(e,t,n){if(t.type===`element`)return Ud(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return Wd(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return Kd(e,t,n);if(t.type===`mdxjsEsm`)return Gd(e,t);if(t.type===`root`)return qd(e,t,n);if(t.type===`text`)return Jd(e,t)}function Ud(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=yd,e.schema=i),e.ancestors.push(t);let a=af(e,t.tagName,!1),o=$d(e,t),s=tf(e,t);return Rd.has(t.tagName)&&(s=s.filter(function(e){return typeof e!=`string`||!Ru(e)})),Yd(e,o,a,t),Xd(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function Wd(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)}of(e,t.position)}function Gd(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);of(e,t.position)}function Kd(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=yd,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:af(e,t.name,!0),o=ef(e,t),s=tf(e,t);return Yd(e,o,a,t),Xd(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function qd(e,t,n){let r={};return Xd(r,tf(e,t)),e.create(t,e.Fragment,r,n)}function Jd(e,t){return t.value}function Yd(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Xd(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function Zd(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 Qd(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=Ed(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 $d(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&Fd.call(t.properties,i)){let a=nf(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&zd.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 ef(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 of(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 of(e,t.position)}else a=r.value===null||r.value;n[i]=a}return n}function tf(e,t){let n=[],r=-1,i=e.passKeys?new Map:Id;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=Hd(e,a,o);s!==void 0&&n.push(s)}return n}function nf(e,t,n){let r=hd(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?Mu(n):bd(n)),r.property===`style`){let t=typeof n==`object`?n:rf(e,String(n));return e.stylePropertyNameCase===`css`&&(t=sf(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?dd[r.property]||r.property:r.attribute,n]}}function rf(e,t){try{return(0,Pd.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new Nd("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=Bd+`#cannot-parse-style-attribute`,r}}function af(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=Iu(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=Iu(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return Fd.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);of(e)}function of(e,t){let n=new Nd("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=Bd+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function sf(e){let t={},n;for(n in e)Fd.call(e,n)&&(t[cf(n)]=e[n]);return t}function cf(e){let t=e.replace(Ld,lf);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function lf(e){return`-`+e.toLowerCase()}var uf={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`]},df={};function ff(e,t){let n=t||df;return pf(e,typeof n.includeImageAlt!=`boolean`||n.includeImageAlt,typeof n.includeHtml!=`boolean`||n.includeHtml)}function pf(e,t,n){if(hf(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 mf(e.children,t,n)}return Array.isArray(e)?mf(e,t,n):``}function mf(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=pf(e[i],t,n);return r.join(``)}function hf(e){return!!(e&&typeof e==`object`)}var gf=document.createElement(`i`);function _f(e){let t=`&`+e+`;`;gf.innerHTML=t;let n=gf.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`?!1:n!==t&&n}function vf(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 yf(e,t){return e.length>0?(vf(e,e.length,0,t),e):t}var bf={}.hasOwnProperty;function xf(e){let t={},n=-1;for(;++n<e.length;)Sf(t,e[n]);return t}function Sf(e,t){let n;for(n in t){let r=(bf.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){bf.call(r,a)||(r[a]=[]);let e=i[a];Cf(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Cf(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);vf(e,0,0,r)}function wf(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 Tf(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var Ef=Rf(/[A-Za-z]/),Df=Rf(/[\dA-Za-z]/),Of=Rf(/[#-'*+\--9=?A-Z^-~]/);function kf(e){return e!==null&&(e<32||e===127)}var Af=Rf(/\d/),jf=Rf(/[\dA-Fa-f]/),Mf=Rf(/[!-/:-@[-`{-~]/);function Nf(e){return e!==null&&e<-2}function Pf(e){return e!==null&&(e<0||e===32)}function Ff(e){return e===-2||e===-1||e===32}var If=Rf(/\p{P}|\p{S}/u),Lf=Rf(/\s/);function Rf(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function zf(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&Df(e.charCodeAt(n+1))&&Df(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 Bf(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Ff(r)?(e.enter(n),s(r)):t(r)}function s(r){return Ff(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Vf={tokenize:Hf};function Hf(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`),Bf(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 Nf(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Uf={tokenize:Gf},Wf={tokenize:Kf};function Gf(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 vf(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(Wf,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(Wf,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 Nf(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++;vf(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 Kf(e,t,n){return Bf(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function qf(e){if(e===null||Pf(e)||Lf(e))return 1;if(If(e))return 2}function Jf(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 Yf={name:`attention`,resolveAll:Xf,tokenize:Zf};function Xf(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};Qf(d,-c),Qf(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=yf(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=yf(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=yf(l,Jf(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=yf(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=yf(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,vf(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 Zf(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=qf(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=qf(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 Qf(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var $f={name:`autolink`,tokenize:ep};function ep(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 Ef(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||Df(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||Df(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||kf(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Of(t)?(e.consume(t),l):n(t)}function u(e){return Df(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||Df(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var tp={partial:!0,tokenize:np};function np(e,t,n){return r;function r(t){return Ff(t)?Bf(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||Nf(e)?t(e):n(e)}}var rp={continuation:{tokenize:ap},exit:op,name:`blockQuote`,tokenize:ip};function ip(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 Ff(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function ap(e,t,n){let r=this;return i;function i(t){return Ff(t)?Bf(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(rp,t,n)(r)}}function op(e){e.exit(`blockQuote`)}var sp={name:`characterEscape`,tokenize:cp};function cp(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 Mf(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var lp={name:`characterReference`,tokenize:up};function up(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=Df,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=jf,u):(e.enter(`characterReferenceValue`),a=7,o=Af,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===Df&&!_f(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 dp={partial:!0,tokenize:mp},fp={concrete:!0,name:`codeFenced`,tokenize:pp};function pp(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`),Ff(t)?Bf(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||Nf(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(dp,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||Nf(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Ff(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),Bf(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||Nf(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||Nf(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&&Ff(t)?Bf(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||Nf(t)?e.check(dp,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||Nf(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`),Ff(t)?Bf(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`),Ff(t)?Bf(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||Nf(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function mp(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 hp={name:`codeIndented`,tokenize:_p},gp={partial:!0,tokenize:vp};function _p(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),Bf(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):Nf(t)?e.attempt(gp,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||Nf(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function vp(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):Nf(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):Bf(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):Nf(e)?i(e):n(e)}}var yp={name:`codeText`,previous:xp,resolve:bp,tokenize:Sp};function bp(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 xp(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Sp(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)):Nf(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||Nf(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 Cp=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&&wp(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),wp(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),wp(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);wp(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);wp(this.left,t.reverse())}}}};function wp(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 Tp(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Cp(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,Ep(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 vf(e,0,1/0,u.slice(0)),!l}function Ep(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 Dp={resolve:kp,tokenize:Ap},Op={partial:!0,tokenize:jp};function kp(e){return Tp(e),e}function Ap(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):Nf(t)?e.check(Op,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 jp(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Bf(e,a,`linePrefix`)}function a(i){if(i===null||Nf(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 Mp(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||kf(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||Nf(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||Pf(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||kf(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 Np(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):Nf(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||Nf(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Ff(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function Pp(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):Nf(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),Bf(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||Nf(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 Fp(e,t){let n;return r;function r(i){return Nf(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Ff(i)?Bf(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Ip={name:`definition`,tokenize:Rp},Lp={partial:!0,tokenize:zp};function Rp(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Np.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=Tf(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 Pf(t)?Fp(e,l)(t):l(t)}function l(t){return Mp(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Lp,d,d)(t)}function d(t){return Ff(t)?Bf(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||Nf(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function zp(e,t,n){return r;function r(t){return Pf(t)?Fp(e,i)(t):n(t)}function i(t){return Pp(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Ff(t)?Bf(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||Nf(e)?t(e):n(e)}}var Bp={name:`hardBreakEscape`,tokenize:Vp};function Vp(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return Nf(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var Hp={name:`headingAtx`,resolve:Up,tokenize:Wp};function Up(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`},vf(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Wp(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||Pf(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||Nf(n)?(e.exit(`atxHeading`),t(n)):Ff(n)?Bf(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||Pf(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Gp=`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(`.`),Kp=[`pre`,`script`,`style`,`textarea`],qp={concrete:!0,name:`htmlFlow`,resolveTo:Xp,tokenize:Zp},Jp={partial:!0,tokenize:$p},Yp={partial:!0,tokenize:Qp};function Xp(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 Zp(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:ae):Ef(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):Ef(a)?(e.consume(a),i=4,r.interrupt?t:ae):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ae):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 Ef(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||Pf(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Kp.includes(l)?(i=1,r.interrupt?t(s):O(s)):Gp.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||Df(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 Ff(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||Ef(t)?(e.consume(t),b):Ff(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||Df(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Ff(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):Ff(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||Nf(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||Pf(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Ff(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||Nf(t)?O(t):Ff(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),ne):t===60&&i===1?(e.consume(t),A):t===62&&i===4?(e.consume(t),j):t===63&&i===3?(e.consume(t),ae):t===93&&i===5?(e.consume(t),ie):Nf(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check(Jp,oe,k)(t)):t===null||Nf(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(Yp,ee,oe)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return t===null||Nf(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function ne(t){return t===45?(e.consume(t),ae):O(t)}function A(t){return t===47?(e.consume(t),o=``,re):O(t)}function re(t){if(t===62){let n=o.toLowerCase();return Kp.includes(n)?(e.consume(t),j):O(t)}return Ef(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),re):O(t)}function ie(t){return t===93?(e.consume(t),ae):O(t)}function ae(t){return t===62?(e.consume(t),j):t===45&&i===2?(e.consume(t),ae):O(t)}function j(t){return t===null||Nf(t)?(e.exit(`htmlFlowData`),oe(t)):(e.consume(t),j)}function oe(n){return e.exit(`htmlFlow`),t(n)}}function Qp(e,t,n){let r=this;return i;function i(t){return Nf(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 $p(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(tp,t,n)}}var em={name:`htmlText`,tokenize:tm};function tm(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):Ef(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):Ef(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):Nf(t)?(o=d,A(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ne(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):Nf(t)?(o=h,A(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ne(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ne(t):Nf(t)?(o=v,A(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):Nf(t)?(o=y,A(t)):(e.consume(t),y)}function b(e){return e===62?ne(e):y(e)}function x(t){return Ef(t)?(e.consume(t),S):n(t)}function S(t){return t===45||Df(t)?(e.consume(t),S):C(t)}function C(t){return Nf(t)?(o=C,A(t)):Ff(t)?(e.consume(t),C):ne(t)}function w(t){return t===45||Df(t)?(e.consume(t),w):t===47||t===62||Pf(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ne):t===58||t===95||Ef(t)?(e.consume(t),E):Nf(t)?(o=T,A(t)):Ff(t)?(e.consume(t),T):ne(t)}function E(t){return t===45||t===46||t===58||t===95||Df(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):Nf(t)?(o=D,A(t)):Ff(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):Nf(t)?(o=O,A(t)):Ff(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,te):t===null?n(t):Nf(t)?(o=k,A(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||Pf(t)?T(t):(e.consume(t),ee)}function te(e){return e===47||e===62||Pf(e)?T(e):n(e)}function ne(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function A(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),re}function re(t){return Ff(t)?Bf(e,ie,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ie(t)}function ie(t){return e.enter(`htmlTextData`),o(t)}}var nm={name:`labelEnd`,resolveAll:om,resolveTo:sm,tokenize:cm},rm={tokenize:lm},im={tokenize:um},am={tokenize:dm};function om(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&&vf(e,0,e.length,n),e}function sm(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=yf(s,e.slice(a+1,a+r+3)),s=yf(s,[[`enter`,u,t]]),s=yf(s,Jf(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=yf(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=yf(s,e.slice(o+1)),s=yf(s,[[`exit`,c,t]]),vf(e,a,e.length,s),e}function cm(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(Tf(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(rm,u,o?u:d)(t):t===91?e.attempt(im,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(am,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function lm(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 Pf(t)?Fp(e,a)(t):a(t)}function a(t){return t===41?u(t):Mp(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return Pf(t)?Fp(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?Pp(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return Pf(t)?Fp(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 um(e,t,n){let r=this;return i;function i(t){return Np.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(Tf(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function dm(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 fm={name:`labelStartImage`,resolveAll:nm.resolveAll,tokenize:pm};function pm(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 mm={name:`labelStartLink`,resolveAll:nm.resolveAll,tokenize:hm};function hm(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 gm={name:`lineEnding`,tokenize:_m};function _m(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),Bf(e,t,`linePrefix`)}}var vm={name:`thematicBreak`,tokenize:ym};function ym(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||Nf(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Ff(t)?Bf(e,s,`whitespace`)(t):s(t))}}var bm={continuation:{tokenize:wm},exit:Em,name:`list`,tokenize:Cm},xm={partial:!0,tokenize:Dm},Sm={partial:!0,tokenize:Tm};function Cm(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:Af(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(vm,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 Af(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(tp,r.interrupt?n:u,e.attempt(xm,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Ff(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 wm(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(tp,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Bf(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Ff(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(Sm,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,Bf(e,e.attempt(bm,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function Tm(e,t,n){let r=this;return Bf(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 Em(e){e.exit(this.containerState.type)}function Dm(e,t,n){let r=this;return Bf(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!Ff(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Om={name:`setextUnderline`,resolveTo:km,tokenize:Am};function km(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 Am(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`),Ff(t)?Bf(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||Nf(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var jm={tokenize:Mm};function Mm(e){let t=this,n=e.attempt(tp,r,e.attempt(this.parser.constructs.flowInitial,i,Bf(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Dp,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 Nm={resolveAll:Lm()},Pm=Im(`string`),Fm=Im(`text`);function Im(e){return{resolveAll:Lm(e===`text`?Rm: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 Lm(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 Rm(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 zm=e({attentionMarkers:()=>qm,contentInitial:()=>Vm,disable:()=>Jm,document:()=>Bm,flow:()=>Um,flowInitial:()=>Hm,insideSpan:()=>Km,string:()=>Wm,text:()=>Gm}),Bm={42:bm,43:bm,45:bm,48:bm,49:bm,50:bm,51:bm,52:bm,53:bm,54:bm,55:bm,56:bm,57:bm,62:rp},Vm={91:Ip},Hm={[-2]:hp,[-1]:hp,32:hp},Um={35:Hp,42:vm,45:[Om,vm],60:qp,61:Om,95:vm,96:fp,126:fp},Wm={38:lp,92:sp},Gm={[-5]:gm,[-4]:gm,[-3]:gm,33:fm,38:lp,42:Yf,60:[$f,em],91:mm,92:[Bp,sp],93:nm,95:Yf,96:yp},Km={null:[Yf,Nm]},qm={null:[42,95]},Jm={null:[]};function Ym(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=yf(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=Jf(a,l.events,l),l.events):[]}function f(e,t){return Zm(p(e),t)}function p(e){return Xm(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){Nf(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&&vf(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 Xm(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 Zm(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=`
12
+ `;break;case-3:o=`\r
13
+ `;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 Qm(e){let t={constructs:xf([zm,...(e||{}).extensions||[]]),content:n(Vf),defined:[],document:n(Uf),flow:n(jm),lazy:{},string:n(Pm),text:n(Fm)};return t;function n(e){return n;function n(n){return Ym(t,e,n)}}}function $m(e){for(;!Tp(e););return e}var eh=/[\0\t\n\r]/g;function th(){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(eh.lastIndex=u,c=eh.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 nh=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function rh(e){return e.replace(nh,ih)}function ih(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let e=n.charCodeAt(1),t=e===120||e===88;return wf(n.slice(t?2:1),t?16:10)}return _f(n)||e}var ah={}.hasOwnProperty;function oh(e,t,n){return t&&typeof t==`object`&&(n=t,t=void 0),sh(n)($m(Qm(n).document().write(th()(e,t,!0))))}function sh(e){let t={transforms:[],canContainEols:[`emphasis`,`fragment`,`heading`,`paragraph`,`strong`],enter:{autolink:a(xe),autolinkProtocol:T,autolinkEmail:T,atxHeading:a(_e),blockQuote:a(me),characterEscape:T,characterReference:T,codeFenced:a(he),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:a(he,o),codeText:a(M,o),codeTextData:T,data:T,codeFlowValue:T,definition:a(N),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:a(ge),hardBreakEscape:a(ve),hardBreakTrailing:a(ve),htmlFlow:a(ye,o),htmlFlowData:T,htmlText:a(ye,o),htmlTextData:T,image:a(be),label:o,link:a(xe),listItem:a(Ce),listItemValue:f,listOrdered:a(Se,d),listUnordered:a(Se),paragraph:a(we),reference:se,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:a(_e),strong:a(Te),thematicBreak:a(De)},exit:{atxHeading:c(),atxHeadingSequence:x,autolink:c(),autolinkEmail:pe,autolinkProtocol:fe,blockQuote:c(),characterEscapeValue:E,characterReferenceMarkerHexadecimal:le,characterReferenceMarkerNumeric:le,characterReferenceValue:ue,characterReference:de,codeFenced:c(g),codeFencedFence:h,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:E,codeIndented:c(_),codeText:c(te),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(ee),htmlTextData:E,image:c(A),label:ie,labelText:re,lineEnding:D,link:c(ne),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ce,resourceDestinationString:ae,resourceTitleString:j,resource:oe,setextHeading:c(w),setextHeadingLineSequence:C,setextHeadingText:S,strong:c(),thematicBreak:c()}};lh(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]];ah.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]||dh).call(a,void 0,e[0])}for(r.position={start:ch(e.length>0?e[0][1].start:{line:1,column:1,offset:0}),end:ch(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:ch(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]||dh).call(this,e,r[0]));else throw Error("Cannot close `"+e.type+"` ("+kd({start:e.start,end:e.end})+`): it’s not open`);n.position.end=ch(e.end)}function u(){return ff(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=Tf(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=Ee(),n.position={start:ch(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=ch(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=ch(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 ee(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function te(){let e=this.resume(),t=this.stack[this.stack.length-1];t.value=e}function ne(){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 A(){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 re(e){let t=this.sliceSerialize(e),n=this.stack[this.stack.length-2];n.label=rh(t),n.identifier=Tf(t).toLowerCase()}function ie(){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 ae(){let e=this.resume(),t=this.stack[this.stack.length-1];t.url=e}function j(){let e=this.resume(),t=this.stack[this.stack.length-1];t.title=e}function oe(){this.data.inReference=void 0}function se(){this.data.referenceType=`collapsed`}function ce(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.label=t,n.identifier=Tf(this.sliceSerialize(e)).toLowerCase(),this.data.referenceType=`full`}function le(e){this.data.characterReferenceType=e.type}function ue(e){let t=this.sliceSerialize(e),n=this.data.characterReferenceType,r;n?(r=wf(t,n===`characterReferenceMarkerNumeric`?10:16),this.data.characterReferenceType=void 0):r=_f(t);let i=this.stack[this.stack.length-1];i.value+=r}function de(e){let t=this.stack.pop();t.position.end=ch(e.end)}function fe(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=this.sliceSerialize(e)}function pe(e){E.call(this,e);let t=this.stack[this.stack.length-1];t.url=`mailto:`+this.sliceSerialize(e)}function me(){return{type:`blockquote`,children:[]}}function he(){return{type:`code`,lang:null,meta:null,value:``}}function M(){return{type:`inlineCode`,value:``}}function N(){return{type:`definition`,identifier:``,label:null,title:null,url:``}}function ge(){return{type:`emphasis`,children:[]}}function _e(){return{type:`heading`,depth:0,children:[]}}function ve(){return{type:`break`}}function ye(){return{type:`html`,value:``}}function be(){return{type:`image`,title:null,url:``,alt:null}}function xe(){return{type:`link`,title:null,url:``,children:[]}}function Se(e){return{type:`list`,ordered:e.type===`listOrdered`,start:null,spread:e._spread,children:[]}}function Ce(e){return{type:`listItem`,spread:e._spread,checked:null,children:[]}}function we(){return{type:`paragraph`,children:[]}}function Te(){return{type:`strong`,children:[]}}function Ee(){return{type:`text`,value:``}}function De(){return{type:`thematicBreak`}}}function ch(e){return{line:e.line,column:e.column,offset:e.offset}}function lh(e,t){let n=-1;for(;++n<t.length;){let r=t[n];Array.isArray(r)?lh(e,r):uh(e,r)}}function uh(e,t){let n;for(n in t)if(ah.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 dh(e,t){throw Error(e?"Cannot close `"+e.type+"` ("+kd({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+kd({start:t.start,end:t.end})+`) is open`:"Cannot close document, a token (`"+t.type+"`, "+kd({start:t.start,end:t.end})+`) is still open`)}function fh(e){let t=this;t.parser=n;function n(n){return oh(n,{...t.data(`settings`),...e,extensions:t.data(`micromarkExtensions`)||[],mdastExtensions:t.data(`fromMarkdownExtensions`)||[]})}}function ph(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 mh(e,t){let n={type:`element`,tagName:`br`,properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:`text`,value:`
14
+ `}]}function hh(e,t){let n=t.value?t.value+`
15
+ `:``,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 gh(e,t){let n={type:`element`,tagName:`del`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _h(e,t){let n={type:`element`,tagName:`em`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function vh(e,t){let n=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,r=String(t.identifier).toUpperCase(),i=zf(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 yh(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 bh(e,t){if(e.options.allowDangerousHtml){let n={type:`raw`,value:t.value};return e.patch(t,n),e.applyData(t,n)}}function xh(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 Sh(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return xh(e,t);let i={src:zf(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 Ch(e,t){let n={src:zf(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 wh(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 Th(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return xh(e,t);let i={href:zf(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 Eh(e,t){let n={href:zf(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 Dh(e,t,n){let r=e.all(t),i=n?Oh(n):kh(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:`
16
+ `}),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:`
17
+ `});let l={type:`element`,tagName:`li`,properties:a,children:o};return e.patch(t,l),e.applyData(t,l)}function Oh(e){let t=!1;if(e.type===`list`){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r<n.length;)t=kh(n[r])}return t}function kh(e){return e.spread??e.children.length>1}function Ah(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 jh(e,t){let n={type:`element`,tagName:`p`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Mh(e,t){let n={type:`root`,children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Nh(e,t){let n={type:`element`,tagName:`strong`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Ph(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=Ed(t.children[1]),o=Td(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 Fh(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 Ih(e,t){let n={type:`element`,tagName:`td`,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}var Lh=9,Rh=32;function zh(e){let t=String(e),n=/\r?\n|\r/g,r=n.exec(t),i=0,a=[];for(;r;)a.push(Bh(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(Bh(t.slice(i),i>0,!1)),a.join(``)}function Bh(e,t,n){let r=0,i=e.length;if(t){let t=e.codePointAt(r);for(;t===Lh||t===Rh;)r++,t=e.codePointAt(r)}if(n){let t=e.codePointAt(i-1);for(;t===Lh||t===Rh;)i--,t=e.codePointAt(i-1)}return i>r?e.slice(r,i):``}function Vh(e,t){let n={type:`text`,value:zh(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Hh(e,t){let n={type:`element`,tagName:`hr`,properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Uh={blockquote:ph,break:mh,code:hh,delete:gh,emphasis:_h,footnoteReference:vh,heading:yh,html:bh,imageReference:Sh,image:Ch,inlineCode:wh,linkReference:Th,link:Eh,listItem:Dh,list:Ah,paragraph:jh,root:Mh,strong:Nh,table:Ph,tableCell:Ih,tableRow:Fh,text:Vh,thematicBreak:Hh,toml:Wh,yaml:Wh,definition:Wh,footnoteDefinition:Wh};function Wh(){}var Gh=typeof self==`object`?self:globalThis,Kh=(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 Gh[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 Gh[a](o),i)};return r},qh=e=>Kh(new Map,e)(0),Jh=``,{toString:Yh}={},{keys:Xh}=Object,Zh=e=>{let t=typeof e;if(t!==`object`||!e)return[0,t];let n=Yh.call(e).slice(8,-1);switch(n){case`Array`:return[1,Jh];case`Object`:return[2,Jh];case`Date`:return[3,Jh];case`RegExp`:return[4,Jh];case`Map`:return[5,Jh];case`Set`:return[6,Jh];case`DataView`:return[1,n]}return n.includes(`Array`)?[1,n]:n.includes(`Error`)?[7,n]:[2,n]},Qh=([e,t])=>e===0&&(t===`function`||t===`symbol`),$h=(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]=Zh(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 Xh(r))(e||!Qh(Zh(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||!(Qh(Zh(n))||Qh(Zh(i))))&&t.push([a(n),a(i)]);return n}case 6:{let t=[],n=i([o,t],r);for(let n of r)(e||!Qh(Zh(n)))&&t.push(a(n));return n}}let{message:c}=r;return i([o,{name:s,message:c}],r)};return a},eg=(e,{json:t,lossy:n}={})=>{let r=[];return $h(!(t||n),!!t,new Map,r)(e),r},tg=typeof structuredClone==`function`?(e,t)=>t&&(`json`in t||`lossy`in t)?qh(eg(e,t)):structuredClone(e):(e,t)=>qh(eg(e,t));function ng(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 rg(e,t){return`Back to reference `+(e+1)+(t>1?`-`+t:``)}function ig(e){let t=typeof e.options.clobberPrefix==`string`?e.options.clobberPrefix:`user-content-`,n=e.options.footnoteBackContent||ng,r=e.options.footnoteBackLabel||rg,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=zf(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:{...tg(o),id:`footnote-label`},children:[{type:`text`,value:i}]},{type:`text`,value:`
18
+ `},{type:`element`,tagName:`ol`,properties:{},children:e.wrap(s,!0)},{type:`text`,value:`
19
+ `}]}}var ag=(function(e){if(e==null)return ug;if(typeof e==`function`)return lg(e);if(typeof e==`object`)return Array.isArray(e)?og(e):sg(e);if(typeof e==`string`)return cg(e);throw Error(`Expected function, string, or object as test`)});function og(e){let t=[],n=-1;for(;++n<e.length;)t[n]=ag(e[n]);return lg(r);function r(...e){let n=-1;for(;++n<t.length;)if(t[n].apply(this,e))return!0;return!1}}function sg(e){let t=e;return lg(n);function n(n){let r=n,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function cg(e){return lg(t);function t(t){return t&&t.type===e}}function lg(e){return t;function t(t,n,r){return!!(dg(t)&&e.call(this,t,typeof n==`number`?n:void 0,r||void 0))}}function ug(){return!0}function dg(e){return typeof e==`object`&&!!e&&`type`in e}function fg(e){return e}var pg=[];function mg(e,t,n,r){let i;typeof t==`function`&&typeof n!=`function`?(r=n,n=t):i=t;let a=ag(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 (`+fg(e.type+(t?`<`+t+`>`:``))+`)`})}return u;function u(){let l=pg,u,d,f;if((!t||a(e,i,c[c.length-1]||void 0))&&(l=hg(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 hg(e){return Array.isArray(e)?e:typeof e==`number`?[!0,e]:e==null?pg:[e]}function gg(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),mg(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 _g={}.hasOwnProperty,vg={};function yg(e,t){let n=t||vg,r=new Map,i=new Map,a={all:s,applyData:xg,definitionById:r,footnoteById:i,footnoteCounts:new Map,footnoteOrder:[],handlers:{...Uh,...n.handlers},one:o,options:n,patch:bg,wrap:Cg};return gg(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(_g.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=tg(n);return r.children=a.all(e),r}return tg(e)}return(a.options.unknownHandler||Sg)(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=wg(i.value)),!Array.isArray(i)&&i.type===`element`)){let e=i.children[0];e&&e.type===`text`&&(e.value=wg(e.value))}Array.isArray(i)?t.push(...i):t.push(i)}}}return t}}function bg(e,t){e.position&&(t.position=Od(e))}function xg(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,tg(i)),`children`in n&&n.children&&r!=null&&(n.children=r)}return n}function Sg(e,t){let n=t.data||{},r=`value`in t&&!(_g.call(n,`hProperties`)||_g.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 Cg(e,t){let n=[],r=-1;for(t&&n.push({type:`text`,value:`
20
+ `});++r<e.length;)r&&n.push({type:`text`,value:`
21
+ `}),n.push(e[r]);return t&&e.length>0&&n.push({type:`text`,value:`
22
+ `}),n}function wg(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Tg(e,t){let n=yg(e,t),r=n.one(e,void 0),i=ig(n),a=Array.isArray(r)?{type:`root`,children:r}:r||{type:`root`,children:[]};return i&&(`children`in a,a.children.push({type:`text`,value:`
23
+ `},i)),a}function Eg(e,t){return e&&`run`in e?async function(n,r){let i=Tg(n,{file:r,...t});await e.run(i,r)}:function(n,r){return Tg(n,{file:r,...e||t})}}function Dg(e){if(e)throw e}var Og=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 kg(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 Ag(){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?jg(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 jg(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 Mg={basename:Ng,dirname:Pg,extname:Fg,join:Ig,sep:`/`};function Ng(e,t){if(t!==void 0&&typeof t!=`string`)throw TypeError(`"ext" argument must be a string`);zg(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 Pg(e){if(zg(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 Fg(e){zg(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 Ig(...e){let t=-1,n;for(;++t<e.length;)zg(e[t]),e[t]&&(n=n===void 0?e[t]:n+`/`+e[t]);return n===void 0?`.`:Lg(n)}function Lg(e){zg(e);let t=e.codePointAt(0)===47,n=Rg(e,!t);return n.length===0&&!t&&(n=`.`),n.length>0&&e.codePointAt(e.length-1)===47&&(n+=`/`),t?`/`+n:n}function Rg(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 zg(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received `+JSON.stringify(e))}var Bg={cwd:Vg};function Vg(){return`/`}function Hg(e){return!!(typeof e==`object`&&e&&`href`in e&&e.href&&`protocol`in e&&e.protocol&&e.auth===void 0)}function Ug(e){if(typeof e==`string`)e=new URL(e);else if(!Hg(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 Wg(e)}function Wg(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 Gg=[`history`,`path`,`basename`,`stem`,`extname`,`dirname`],Kg=class{constructor(e){let t;t=e?Hg(e)?{path:e}:typeof e==`string`||Xg(e)?{value:e}:e:{},this.cwd=`cwd`in t?``:Bg.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let n=-1;for(;++n<Gg.length;){let e=Gg[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)Gg.includes(r)||(this[r]=t[r])}get basename(){return typeof this.path==`string`?Mg.basename(this.path):void 0}set basename(e){Jg(e,`basename`),qg(e,`basename`),this.path=Mg.join(this.dirname||``,e)}get dirname(){return typeof this.path==`string`?Mg.dirname(this.path):void 0}set dirname(e){Yg(this.basename,`dirname`),this.path=Mg.join(e||``,this.basename)}get extname(){return typeof this.path==`string`?Mg.extname(this.path):void 0}set extname(e){if(qg(e,`extname`),Yg(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=Mg.join(this.dirname,this.stem+(e||``))}get path(){return this.history[this.history.length-1]}set path(e){Hg(e)&&(e=Ug(e)),Jg(e,`path`),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path==`string`?Mg.basename(this.path,this.extname):void 0}set stem(e){Jg(e,`stem`),qg(e,`stem`),this.path=Mg.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 Nd(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 qg(e,t){if(e&&e.includes(Mg.sep))throw Error("`"+t+"` cannot be a path: did not expect `"+Mg.sep+"`")}function Jg(e,t){if(!e)throw Error("`"+t+"` cannot be empty")}function Yg(e,t){if(!e)throw Error("Setting `"+t+"` requires `path` to be set too")}function Xg(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var Zg=(function(e){let t=this.constructor.prototype,n=t[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,t),r}),Qg=t(Og(),1),$g={}.hasOwnProperty,e_=new class e extends Zg{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=Ag()}copy(){let t=new e,n=-1;for(;++n<this.attachers.length;){let e=this.attachers[n];t.use(...e)}return t.data((0,Qg.default)(!0,{},this.namespace)),t}data(e,t){return typeof e==`string`?arguments.length===2?(r_(`data`,this.frozen),this.namespace[e]=t,this):$g.call(this.namespace,e)&&this.namespace[e]||void 0:e?(r_(`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=o_(e),n=this.parser||this.Parser;return t_(`parse`,n),n(String(t),t)}process(e,t){let n=this;return this.freeze(),t_(`process`,this.parser||this.Parser),n_(`process`,this.compiler||this.Compiler),t?r(void 0,t):new Promise(r);function r(r,i){let a=o_(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);c_(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(),t_(`processSync`,this.parser||this.Parser),n_(`processSync`,this.compiler||this.Compiler),this.process(e,r),a_(`processSync`,`process`,t),n;function r(e,r){t=!0,Dg(e),n=r}}run(e,t,n){i_(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=o_(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),a_(`runSync`,`run`,n),r;function i(e,t){Dg(e),r=t,n=!0}}stringify(e,t){this.freeze();let n=o_(t),r=this.compiler||this.Compiler;return n_(`stringify`,r),i_(e),r(e,n)}use(e,...t){let n=this.attachers,r=this.namespace;if(r_(`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,Qg.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];kg(o)&&kg(r)&&(r=(0,Qg.default)(!0,o,r)),n[i]=[e,r,...a]}}}}().freeze();function t_(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `parser`")}function n_(e,t){if(typeof t!=`function`)throw TypeError("Cannot `"+e+"` without `compiler`")}function r_(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 i_(e){if(!kg(e)||typeof e.type!=`string`)throw TypeError("Expected node, got `"+e+"`")}function a_(e,t,n){if(!n)throw Error("`"+e+"` finished async. Use `"+t+"` instead")}function o_(e){return s_(e)?e:new Kg(e)}function s_(e){return!!(e&&typeof e==`object`&&`message`in e&&`messages`in e)}function c_(e){return typeof e==`string`||l_(e)}function l_(e){return!!(e&&typeof e==`object`&&`byteLength`in e&&`byteOffset`in e)}var u_=Dt(),d_=[],f_={allowDangerousHtml:!0},p_=/^(https?|ircs?|mailto|xmpp)$/i,m_=[{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 h_(e){let t=g_(e),n=__(e);return v_(t.runSync(t.parse(n),n),e)}function g_(e){let t=e.rehypePlugins||d_,n=e.remarkPlugins||d_,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...f_}:f_;return e_().use(fh).use(n).use(Eg,r).use(t)}function __(e){let t=e.children||``,n=new Kg;return typeof t==`string`?n.value=t:``+t,n}function v_(e,t){let n=t.allowedElements,r=t.allowElement,i=t.components,a=t.disallowedElements,o=t.skipHtml,s=t.unwrapDisallowed,c=t.urlTransform||y_;for(let e of m_)Object.hasOwn(t,e.from)&&``+e.from+(e.to?"use `"+e.to+"` instead":`remove it`)+e.id;return gg(e,l),Vd(e,{Fragment:u_.Fragment,components:i,ignoreInvalidStyle:!0,jsx:u_.jsx,jsxs:u_.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 uf)if(Object.hasOwn(uf,t)&&Object.hasOwn(e.properties,t)){let n=e.properties[t],r=uf[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 y_(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||p_.test(e.slice(0,t))?e:``}var b_=[`script`,`iframe`,`object`,`embed`,`style`],x_=String.raw`(?:[A-Za-z0-9._~-]|%[0-9A-Fa-f]{2})+`,S_=RegExp(`^/api/files/uploads/(${x_})$`),C_=RegExp(`^!?\\[([^\\]\\n]*)\\]\\((/api/files/uploads/${x_})\\)$`);function w_(e){let t=S_.exec(e);if(!t)return null;let n;try{n=decodeURIComponent(t[1])}catch{return null}return!n||n.startsWith(`.`)||n!==n.replace(/^[ .]+|[ .]+$/g,``)||/[/\\:\u0000-\u001f\u007f]/.test(n)?null:t[1]}function T_(e){let t=C_.exec(e);return!t||w_(t[2])===null?null:{name:t[1],markdown:e}}function E_(e){let t=e.split(`
24
+ `),n=t.length;for(;n>0&&T_(t[n-1])!==null;)n--;if(n===t.length||n>0&&t[n-1]!==``)return{text:e,links:[]};let r=t.slice(n).map(e=>T_(e));return{text:t.slice(0,Math.max(0,n-1)).join(`
25
+ `),links:r}}function D_(e,t){if(t.length===0)return e;let n=t.map(e=>e.markdown).join(`
26
+ `);return e?`${e}\n\n${n}`:n}function O_(e){if(!e)return``;if(e.startsWith(`#`))return e;let t=w_(e);if(t!==null)return`${dn()}/files/uploads/${t}`;let n=e.indexOf(`:`);if(n===-1)return``;let r=e.slice(0,n).toLowerCase();return r===`https`||r===`http`||r===`mailto`?e:``}function k_(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 A_(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);return e.replace(/[|\\{}()[\]^$+*?.]/g,`\\$&`).replace(/-/g,`\\x2d`)}function j_(e,t,n){let r=ag((n||{}).ignore||[]),i=M_(t),a=-1;for(;++a<i.length;)mg(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([N_(e[0]),P_(e[1])])}return t}function N_(e){return typeof e==`string`?new RegExp(A_(e),`g`):e}function P_(e){return typeof e==`function`?e:function(){return e}}var F_=`phrasing`,I_=[`autolink`,`link`,`image`,`label`];function L_(){return{transforms:[G_],enter:{literalAutolink:z_,literalAutolinkEmail:B_,literalAutolinkHttp:B_,literalAutolinkWww:B_},exit:{literalAutolink:W_,literalAutolinkEmail:U_,literalAutolinkHttp:V_,literalAutolinkWww:H_}}}function R_(){return{unsafe:[{character:`@`,before:`[+\\-.\\w]`,after:`[\\-.\\w]`,inConstruct:F_,notInConstruct:I_},{character:`.`,before:`[Ww]`,after:`[\\-.\\w]`,inConstruct:F_,notInConstruct:I_},{character:`:`,before:`[ps]`,after:`\\/`,inConstruct:F_,notInConstruct:I_}]}}function z_(e){this.enter({type:`link`,title:null,url:``,children:[]},e)}function B_(e){this.config.enter.autolinkProtocol.call(this,e)}function V_(e){this.config.exit.autolinkProtocol.call(this,e)}function H_(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 U_(e){this.config.exit.autolinkEmail.call(this,e)}function W_(e){this.exit(e)}function G_(e){j_(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,K_],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,q_]],{ignore:[`link`,`linkReference`]})}function K_(e,t,n,r,i){let a=``;if(!X_(i)||(/^w/i.test(t)&&(n=t+n,t=``,a=`http://`),!J_(n)))return!1;let o=Y_(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 q_(e,t,n,r){return!X_(r,!0)||/[-\d_]$/.test(n)?!1:{type:`link`,title:null,url:`mailto:`+t+`@`+n,children:[{type:`text`,value:t+`@`+n}]}}function J_(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 Y_(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=k_(e,`(`),a=k_(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 X_(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||Lf(n)||If(n))&&(!t||n!==47)}ov.peek=av;function Z_(){this.buffer()}function Q_(e){this.enter({type:`footnoteReference`,identifier:``,label:``},e)}function $_(){this.buffer()}function ev(e){this.enter({type:`footnoteDefinition`,identifier:``,label:``,children:[]},e)}function tv(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Tf(this.sliceSerialize(e)).toLowerCase(),n.label=t}function nv(e){this.exit(e)}function rv(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Tf(this.sliceSerialize(e)).toLowerCase(),n.label=t}function iv(e){this.exit(e)}function av(){return`[`}function ov(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 sv(){return{enter:{gfmFootnoteCallString:Z_,gfmFootnoteCall:Q_,gfmFootnoteDefinitionLabelString:$_,gfmFootnoteDefinition:ev},exit:{gfmFootnoteCallString:tv,gfmFootnoteCall:nv,gfmFootnoteDefinitionLabelString:rv,gfmFootnoteDefinition:iv}}}function cv(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:ov},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?`
27
+ `:` `)+r.indentLines(r.containerFlow(e,a.current()),t?uv:lv))),s(),o}}function lv(e,t,n){return t===0?e:uv(e,t,n)}function uv(e,t,n){return(n?``:` `)+e}var dv=[`autolink`,`destinationLiteral`,`destinationRaw`,`reference`,`titleQuote`,`titleApostrophe`];gv.peek=_v;function fv(){return{canContainEols:[`delete`],enter:{strikethrough:mv},exit:{strikethrough:hv}}}function pv(){return{unsafe:[{character:`~`,inConstruct:`phrasing`,notInConstruct:dv}],handlers:{delete:gv}}}function mv(e){this.enter({type:`delete`,children:[]},e)}function hv(e){this.exit(e)}function gv(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 _v(){return`~`}function vv(e){return e.length}function yv(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||vv,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=bv(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]=xv(r[d]);else{let e=xv(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(`
28
+ `)}function bv(e){return e==null?``:String(e)}function xv(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 Sv(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()),Cv);return i(),o}function Cv(e,t,n){return`>`+(n?``:` `)+e}function wv(e,t){return Tv(e,t.inConstruct,!0)&&!Tv(e,t.notInConstruct,!1)}function Tv(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 Ev(e,t,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
29
+ `&&wv(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?``:` `;return`\\
30
+ `}function Dv(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 Ov(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 kv(e){let t=e.options.fence||"`";if(t!=="`"&&t!==`~`)throw Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Av(e,t,n,r){let i=kv(n),a=e.value||``,o=i==="`"?`GraveAccent`:`Tilde`;if(Ov(e,n)){let e=n.enter(`codeIndented`),t=n.indentLines(a,jv);return e(),t}let s=n.createTracker(r),c=i.repeat(Math.max(Dv(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:`
31
+ `,encode:["`"],...s.current()})),t()}return u+=s.move(`
32
+ `),a&&(u+=s.move(a+`
33
+ `)),u+=s.move(c),l(),u}function jv(e,t,n){return(n?``:` `)+e}function Mv(e){let t=e.options.quote||`"`;if(t!==`"`&&t!==`'`)throw Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function Nv(e,t,n,r){let i=Mv(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?` `:`
34
+ `,...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 Pv(e){let t=e.options.emphasis||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Fv(e){return`&#x`+e.toString(16).toUpperCase()+`;`}function Iv(e,t,n){let r=qf(e),i=qf(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}}Lv.peek=Rv;function Lv(e,t,n,r){let i=Pv(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=Iv(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=Fv(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=Iv(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+Fv(d));let p=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function Rv(e,t,n){return n.options.emphasis||`*`}function zv(e,t){let n=!1;return gg(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)&&ff(e)&&(t.options.setext||n))}function Bv(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(zv(e,n)){let t=n.enter(`headingSetext`),r=n.enter(`phrasing`),o=n.containerPhrasing(e,{...a.current(),before:`
35
+ `,after:`
36
+ `});return r(),t(),o+`
37
+ `+(i===1?`=`:`-`).repeat(o.length-(Math.max(o.lastIndexOf(`\r`),o.lastIndexOf(`
38
+ `))+1))}let o=`#`.repeat(i),s=n.enter(`headingAtx`),c=n.enter(`phrasing`);a.move(o+` `);let l=n.containerPhrasing(e,{before:`# `,after:`
39
+ `,...a.current()});return/^[\t ]/.test(l)&&(l=Fv(l.charCodeAt(0))+l.slice(1)),l=l?o+` `+l:o,n.options.closeAtx&&(l+=` `+o),c(),s(),l}Vv.peek=Hv;function Vv(e){return e.value||``}function Hv(){return`<`}Uv.peek=Wv;function Uv(e,t,n,r){let i=Mv(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 Wv(){return`!`}Gv.peek=Kv;function Gv(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 Kv(){return`!`}qv.peek=Jv;function qv(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 Jv(){return"`"}function Yv(e,t){let n=ff(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))}Xv.peek=Zv;function Xv(e,t,n,r){let i=Mv(n),a=i===`"`?`Quote`:`Apostrophe`,o=n.createTracker(r),s,c;if(Yv(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 Zv(e,t,n){return Yv(e,n)?`<`:`[`}Qv.peek=$v;function Qv(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 $v(){return`[`}function ey(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 ty(e){let t=ey(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 ny(e){let t=e.options.bulletOrdered||`.`;if(t!==`.`&&t!==`)`)throw Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function ry(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 iy(e,t,n,r){let i=n.enter(`list`),a=n.bulletCurrent,o=e.ordered?ny(n):ey(n),s=e.ordered?o===`.`?`)`:`.`:ty(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),ry(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 ay(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 oy(e,t,n,r){let i=ay(n),a=n.bulletCurrent||ey(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 sy(e,t,n,r){let i=n.enter(`paragraph`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,r);return a(),i(),o}var cy=ag([`break`,`delete`,`emphasis`,`footnote`,`footnoteReference`,`image`,`imageReference`,`inlineCode`,`inlineMath`,`link`,`linkReference`,`mdxJsxTextElement`,`mdxTextExpression`,`strong`,`text`,`textDirective`]);function ly(e,t,n,r){return(e.children.some(function(e){return cy(e)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function uy(e){let t=e.options.strong||`*`;if(t!==`*`&&t!==`_`)throw Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}dy.peek=fy;function dy(e,t,n,r){let i=uy(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=Iv(r.before.charCodeAt(r.before.length-1),l,i);u.inside&&(c=Fv(l)+c.slice(1));let d=c.charCodeAt(c.length-1),f=Iv(r.after.charCodeAt(0),d,i);f.inside&&(c=c.slice(0,-1)+Fv(d));let p=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},s+c+p}function fy(e,t,n){return n.options.strong||`*`}function py(e,t,n,r){return n.safe(e.value,r)}function my(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 hy(e,t,n){let r=(ry(n)+(n.options.ruleSpaces?` `:``)).repeat(my(n));return n.options.ruleSpaces?r.slice(0,-1):r}var gy={blockquote:Sv,break:Ev,code:Av,definition:Nv,emphasis:Lv,hardBreak:Ev,heading:Bv,html:Vv,image:Uv,imageReference:Gv,inlineCode:qv,link:Xv,linkReference:Qv,list:iy,listItem:oy,paragraph:sy,root:ly,strong:dy,text:py,thematicBreak:hy};function _y(){return{enter:{table:vy,tableData:Sy,tableHeader:Sy,tableRow:by},exit:{codeText:Cy,table:yy,tableData:xy,tableHeader:xy,tableRow:xy}}}function vy(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 yy(e){this.exit(e),this.data.inTable=void 0}function by(e){this.enter({type:`tableRow`,children:[]},e)}function xy(e){this.exit(e)}function Sy(e){this.enter({type:`tableCell`,children:[]},e)}function Cy(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,wy));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function wy(e,t){return t===`|`?t:e}function Ty(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?` `:`|`;return{unsafe:[{character:`\r`,inConstruct:`tableCell`},{character:`
40
+ `,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(`
41
+ `))}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 yv(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=gy.inlineCode(e,t,n);return n.stack.includes(`tableCell`)&&(r=r.replace(/\|/g,`\\$&`)),r}}function Ey(){return{exit:{taskListCheckValueChecked:Oy,taskListCheckValueUnchecked:Oy,paragraph:ky}}}function Dy(){return{unsafe:[{atBreak:!0,character:`-`,after:`[:|-]`}],handlers:{listItem:Ay}}}function Oy(e){let t=this.stack[this.stack.length-2];t.type,t.checked=e.type===`taskListCheckValueChecked`}function ky(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 Ay(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=gy.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 jy(){return[L_(),sv(),fv(),_y(),Ey()]}function My(e){return{extensions:[R_(),cv(e),pv(),Ty(e),Dy()]}}var Ny={tokenize:qy,partial:!0},Py={tokenize:Jy,partial:!0},Fy={tokenize:Yy,partial:!0},Iy={tokenize:Xy,partial:!0},Ly={tokenize:Zy,partial:!0},Ry={name:`wwwAutolink`,tokenize:Gy,previous:Qy},zy={name:`protocolAutolink`,tokenize:Ky,previous:$y},By={name:`emailAutolink`,tokenize:Wy,previous:eb},Vy={};function Hy(){return{text:Vy}}for(var Uy=48;Uy<123;)Vy[Uy]=By,Uy++,Uy===58?Uy=65:Uy===91&&(Uy=97);Vy[43]=By,Vy[45]=By,Vy[46]=By,Vy[95]=By,Vy[72]=[By,zy],Vy[104]=[By,zy],Vy[87]=[By,Ry],Vy[119]=[By,Ry];function Wy(e,t,n){let r=this,i,a;return o;function o(t){return!tb(t)||!eb.call(r,r.previous)||nb(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkEmail`),s(t))}function s(t){return tb(t)?(e.consume(t),s):t===64?(e.consume(t),c):n(t)}function c(t){return t===46?e.check(Ly,u,l)(t):t===45||t===95||Df(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&&Ef(r.previous)?(e.exit(`literalAutolinkEmail`),e.exit(`literalAutolink`),t(o)):n(o)}}function Gy(e,t,n){let r=this;return i;function i(t){return t!==87&&t!==119||!Qy.call(r,r.previous)||nb(r.events)?n(t):(e.enter(`literalAutolink`),e.enter(`literalAutolinkWww`),e.check(Ny,e.attempt(Py,e.attempt(Fy,a),n),n)(t))}function a(n){return e.exit(`literalAutolinkWww`),e.exit(`literalAutolink`),t(n)}}function Ky(e,t,n){let r=this,i=``,a=!1;return o;function o(t){return(t===72||t===104)&&$y.call(r,r.previous)&&!nb(r.events)?(e.enter(`literalAutolink`),e.enter(`literalAutolinkHttp`),i+=String.fromCodePoint(t),e.consume(t),s):n(t)}function s(t){if(Ef(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||kf(t)||Pf(t)||Lf(t)||If(t)?n(t):e.attempt(Py,e.attempt(Fy,u),n)(t)}function u(n){return e.exit(`literalAutolinkHttp`),e.exit(`literalAutolink`),t(n)}}function qy(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 Jy(e,t,n){let r,i,a;return o;function o(t){return t===46||t===95?e.check(Iy,c,s)(t):t===null||Pf(t)||Lf(t)||t!==45&&If(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 Yy(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(Iy,t,a)(o):o===null||Pf(o)||Lf(o)?t(o):(e.consume(o),i)}function a(t){return t===41&&r++,e.consume(t),i}}function Xy(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||Pf(o)||Lf(o)?t(o):n(o)}function i(e){return e===null||e===40||e===91||Pf(e)||Lf(e)?t(e):r(e)}function a(e){return Ef(e)?o(e):n(e)}function o(t){return t===59?(e.consume(t),r):Ef(t)?(e.consume(t),o):n(t)}}function Zy(e,t,n){return r;function r(t){return e.consume(t),i}function i(e){return Df(e)?n(e):t(e)}}function Qy(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Pf(e)}function $y(e){return!Ef(e)}function eb(e){return!(e===47||tb(e))}function tb(e){return e===43||e===45||e===46||e===95||Df(e)}function nb(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 rb={tokenize:db,partial:!0};function ib(){return{document:{91:{name:`gfmFootnoteDefinition`,tokenize:cb,continuation:{tokenize:lb},exit:ub}},text:{91:{name:`gfmFootnoteCall`,tokenize:sb},93:{name:`gfmPotentialFootnoteCall`,add:`after`,tokenize:ab,resolveTo:ob}}}}function ab(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=Tf(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 ob(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 sb(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||Pf(s))return n(s);if(s===93){e.exit(`chunkString`);let a=e.exit(`gfmFootnoteCallString`);return i.includes(Tf(r.sliceSerialize(a)))?(e.enter(`gfmFootnoteCallLabelMarker`),e.consume(s),e.exit(`gfmFootnoteCallLabelMarker`),e.exit(`gfmFootnoteCall`),t):n(s)}return Pf(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 cb(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||Pf(t))return n(t);if(t===93){e.exit(`chunkString`);let n=e.exit(`gfmFootnoteDefinitionLabelString`);return a=Tf(r.sliceSerialize(n)),e.enter(`gfmFootnoteDefinitionLabelMarker`),e.consume(t),e.exit(`gfmFootnoteDefinitionLabelMarker`),e.exit(`gfmFootnoteDefinitionLabel`),f}return Pf(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),Bf(e,p,`gfmFootnoteDefinitionWhitespace`)):n(t)}function p(e){return t(e)}}function lb(e,t,n){return e.check(tp,t,e.attempt(rb,t,n))}function ub(e){e.exit(`gfmFootnoteDefinition`)}function db(e,t,n){let r=this;return Bf(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 fb(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&&vf(o,o.length,0,Jf(s,e.slice(r+1,n),t)),vf(o,o.length,0,[[`exit`,a,t],[`enter`,e[n][1],t],[`exit`,e[n][1],t],[`exit`,i,t]]),vf(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=qf(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=qf(a);return l._open=!u||u===2&&!!s,l._close=!s||s===2&&!!u,n(a)}}}var pb=class{constructor(){this.map=[]}add(e,t,n){mb(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 mb(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 hb(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 gb(){return{flow:{null:{name:`table`,tokenize:_b,resolveAll:vb}}}}function _b(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):Nf(t)?a>1?(a=0,r.interrupt=!0,e.exit(`tableRow`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),p):n(t):Ff(t)?Bf(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||Pf(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,Ff(t)?Bf(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 Ff(t)?Bf(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||Nf(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 Ff(t)?Bf(e,b,`whitespace`)(t):b(t)}function b(n){return n===124?m(n):n===null||Nf(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||Nf(n)?(e.exit(`tableRow`),t(n)):Ff(n)?Bf(e,C,`whitespace`)(n):(e.enter(`data`),w(n))}function w(t){return t===null||t===124||Pf(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 vb(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 pb;for(;++n<e.length;){let p=e[n],m=p[1];p[0]===`enter`?m.type===`tableHead`?(s=!1,c!==0&&(bb(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=yb(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=yb(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=yb(f,t,o,i,n,d)):(o[0]=o[1],d=yb(f,t,a,i,n,d)),i=0):i&&(m.type===`data`||m.type===`tableDelimiterMarker`||m.type===`tableDelimiterFiller`)&&(o[3]=n)}for(c!==0&&bb(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=hb(t.events,n))}return e}function yb(e,t,n,r,i,a){let o=r===1?`tableHeader`:r===2?`tableDelimiter`:`tableData`;n[0]!==0&&(a.end=Object.assign({},xb(t.events,n[0])),e.add(n[0],0,[[`exit`,a,t]]));let s=xb(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=xb(t.events,n[2]),a=xb(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({},xb(t.events,i)),e.add(i,0,[[`exit`,a,t]]),a=void 0),a}function bb(e,t,n,r,i){let a=[],o=xb(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 xb(e,t){let n=e[t],r=n[0]===`enter`?`start`:`end`;return n[1][r]}var Sb={name:`tasklistCheck`,tokenize:wb};function Cb(){return{text:{91:Sb}}}function wb(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 Pf(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 Nf(r)?t(r):Ff(r)?e.check({tokenize:Tb},t,n)(r):n(r)}}function Tb(e,t,n){return Bf(e,r,`whitespace`);function r(e){return e===null?n(e):t(e)}}function Eb(e){return xf([Hy(),ib(),fb(e),gb(),Cb()])}var Db={};function Ob(e){let t=this,n=e||Db,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(Eb(n)),a.push(jy()),o.push(My(n))}function kb(){return{enter:{mathFlow:e,mathFlowFenceMeta:t,mathText:a},exit:{mathFlow:i,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:s,mathText:o,mathTextData:s}};function e(e){this.enter({type:`math`,meta:null,value:``,data:{hName:`pre`,hChildren:[{type:`element`,tagName:`code`,properties:{className:[`language-math`,`math-display`]},children:[]}]}},e)}function t(){this.buffer()}function n(){let e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.meta=e}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function i(e){let t=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t;let r=n.data.hChildren[0];r.type,r.tagName,r.children.push({type:`text`,value:t}),this.data.mathFlowInside=void 0}function a(e){this.enter({type:`inlineMath`,value:``,data:{hName:`code`,hProperties:{className:[`language-math`,`math-inline`]},hChildren:[]}},e),this.buffer()}function o(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,this.exit(e),n.value=t,n.data.hChildren.push({type:`text`,value:t})}function s(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}}function Ab(e){let t=(e||{}).singleDollarTextMath;return t??=!0,r.peek=i,{unsafe:[{character:`\r`,inConstruct:`mathFlowMeta`},{character:`
42
+ `,inConstruct:`mathFlowMeta`},{character:`$`,after:t?void 0:`\\$`,inConstruct:`phrasing`},{character:`$`,inConstruct:`mathFlowMeta`},{atBreak:!0,character:`$`,after:`\\$`}],handlers:{math:n,inlineMath:r}};function n(e,t,n,r){let i=e.value||``,a=n.createTracker(r),o=`$`.repeat(Math.max(Dv(i,`$`)+1,2)),s=n.enter(`mathFlow`),c=a.move(o);if(e.meta){let t=n.enter(`mathFlowMeta`);c+=a.move(n.safe(e.meta,{after:`
43
+ `,before:c,encode:[`$`],...a.current()})),t()}return c+=a.move(`
44
+ `),i&&(c+=a.move(i+`
45
+ `)),c+=a.move(o),s(),c}function r(e,n,r){let i=e.value||``,a=1;for(t||a++;RegExp(`(^|[^$])`+`\\$`.repeat(a)+`([^$]|$)`).test(i);)a++;let o=`$`.repeat(a);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` `+i+` `);let s=-1;for(;++s<r.unsafe.length;){let e=r.unsafe[s];if(!e.atBreak)continue;let t=r.compilePattern(e),n;for(;n=t.exec(i);){let e=n.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=i.slice(0,e)+` `+i.slice(n.index+1)}}return o+i+o}function i(){return`$`}}var jb={tokenize:Nb,concrete:!0,name:`mathFlow`},Mb={tokenize:Pb,partial:!0};function Nb(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){return e.enter(`mathFlow`),e.enter(`mathFlowFence`),e.enter(`mathFlowFenceSequence`),c(t)}function c(t){return t===36?(e.consume(t),o++,c):o<2?n(t):(e.exit(`mathFlowFenceSequence`),Bf(e,l,`whitespace`)(t))}function l(t){return t===null||Nf(t)?d(t):(e.enter(`mathFlowFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===null||Nf(t)?(e.exit(`chunkString`),e.exit(`mathFlowFenceMeta`),d(t)):t===36?n(t):(e.consume(t),u)}function d(n){return e.exit(`mathFlowFence`),r.interrupt?t(n):e.attempt(Mb,f,g)(n)}function f(t){return e.attempt({tokenize:_,partial:!0},g,p)(t)}function p(t){return(a?Bf(e,m,`linePrefix`,a+1):m)(t)}function m(t){return t===null?g(t):Nf(t)?e.attempt(Mb,f,g)(t):(e.enter(`mathFlowValue`),h(t))}function h(t){return t===null||Nf(t)?(e.exit(`mathFlowValue`),m(t)):(e.consume(t),h)}function g(n){return e.exit(`mathFlow`),t(n)}function _(e,t,n){let i=0;return Bf(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4);function a(t){return e.enter(`mathFlowFence`),e.enter(`mathFlowFenceSequence`),s(t)}function s(t){return t===36?(i++,e.consume(t),s):i<o?n(t):(e.exit(`mathFlowFenceSequence`),Bf(e,c,`whitespace`)(t))}function c(r){return r===null||Nf(r)?(e.exit(`mathFlowFence`),t(r)):n(r)}}}function Pb(e,t,n){let r=this;return i;function i(n){return n===null?t(n):(e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function Fb(e){let t=(e||{}).singleDollarTextMath;return t??=!0,{tokenize:n,resolve:Ib,previous:Lb,name:`mathText`};function n(e,n,r){let i=0,a,o;return s;function s(t){return e.enter(`mathText`),e.enter(`mathTextSequence`),c(t)}function c(n){return n===36?(e.consume(n),i++,c):i<2&&!t?r(n):(e.exit(`mathTextSequence`),l(n))}function l(t){return t===null?r(t):t===36?(o=e.enter(`mathTextSequence`),a=0,d(t)):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),l):Nf(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),l):(e.enter(`mathTextData`),u(t))}function u(t){return t===null||t===32||t===36||Nf(t)?(e.exit(`mathTextData`),l(t)):(e.consume(t),u)}function d(t){return t===36?(e.consume(t),a++,d):a===i?(e.exit(`mathTextSequence`),e.exit(`mathText`),n(t)):(o.type=`mathTextData`,u(t))}}}function Ib(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===`mathTextData`){e[t][1].type=`mathTextPadding`,e[n][1].type=`mathTextPadding`,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=`mathTextData`,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 Lb(e){return e!==36||this.events[this.events.length-1][1].type===`characterEscape`}function Rb(e){return{flow:{36:jb},text:{36:Fb(e)}}}var zb={};function Bb(e){let t=this,n=e||zb,r=t.data(),i=r.micromarkExtensions||=[],a=r.fromMarkdownExtensions||=[],o=r.toMarkdownExtensions||=[];i.push(Rb(n)),a.push(kb()),o.push(Ab(n))}var U=class e{constructor(t,n){let r=` `+t,i,a=n&&n.loc;if(a&&a.start<=a.end){let e=a.lexer.input;i=a.start;let t=a.end;i===e.length?r+=` at end of input: `:r+=` at position `+(i+1)+`:
46
+ `;let n=e.slice(i,t).replace(/[^]/g,`$&̲`),o;o=i>15?`…`+e.slice(i-15,i):e.slice(0,i);let s;s=t+15<e.length?e.slice(t,t+15)+`…`:e.slice(t),r+=o+n+s}let o=Error(r);return o.name=`ParseError`,o.__proto__=e.prototype,o.position=i,o}};U.prototype.__proto__=Error.prototype;var Vb=function(e,t,n){if(!Object.prototype.hasOwnProperty.call(e,t))return n;let r=e[t];return r===void 0?n:r},Hb=/([A-Z])/g,Ub=function(e){return e.replace(Hb,`-$1`).toLowerCase()},Wb={"&":`&amp;`,">":`&gt;`,"<":`&lt;`,'"':`&quot;`,"'":`&#x27;`},Gb=/[&><"']/g;function Kb(e){return String(e).replace(Gb,e=>Wb[e])}var qb=function(e){return e.type===`ordgroup`||e.type===`color`?e.body.length===1?qb(e.body[0]):e:e.type===`font`?qb(e.body):e},Jb=function(e){let t=qb(e);return t.type===`mathord`||t.type===`textord`||t.type===`atom`},Yb=function(e){if(!e)throw Error(`Expected non-null, but got `+String(e));return e},Xb=function(e){let t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==`:`||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():`_relative`},Zb=function(e){return+e.toFixed(4)},Qb=`acegıȷmnopqrsuvwxyzαγεηικμνοπρςστυχωϕ𝐚𝐜𝐞𝐠𝐦𝐧𝐨𝐩𝐪𝐫𝐬𝐮𝐯𝐰𝐱𝐲𝐳`,$b=[`__proto__`,`prototype`,`constructor`],ex=e=>{if(typeof e!=`object`||!e)return Object.create(null);for(let t of $b)Object.prototype.hasOwnProperty.call(e,t)&&delete e[t];return Object.setPrototypeOf(e,null)},tx=class{constructor(e){e||={},this.displayMode=Vb(e,`displayMode`,!1),this.annotate=Vb(e,`annotate`,!1),this.leqno=Vb(e,`leqno`,!1),this.throwOnError=Vb(e,`throwOnError`,!1),this.errorColor=Vb(e,`errorColor`,`#b22222`),this.macros=ex(Object.prototype.hasOwnProperty.call(e,`macros`)?e.macros:void 0),this.wrap=Vb(e,`wrap`,`none`),this.xml=Vb(e,`xml`,!1),this.colorIsTextColor=Vb(e,`colorIsTextColor`,!1),this.strict=Vb(e,`strict`,!1),this.trust=Vb(e,`trust`,!1);let t=Object.prototype.hasOwnProperty.call(e,`maxSize`)?e.maxSize:void 0;this.maxSize=t===void 0?[1/0,1/0]:Array.isArray(t)?t:[1/0,1/0],this.maxExpand=Math.max(0,Vb(e,`maxExpand`,1e3)),this.wrapDelimiterPairs=!0}isTrusted(e){if(e.url&&!e.protocol){let t=Xb(e.url);if(t==null)return!1;e.protocol=t}return!!(typeof this.trust==`function`?this.trust(e):this.trust)}},nx={},rx={};function ix({type:e,names:t,props:n,handler:r,mathmlBuilder:i}){let a={type:e,numArgs:n.numArgs,argTypes:n.argTypes,allowedInArgument:!!n.allowedInArgument,allowedInText:!!n.allowedInText,allowedInMath:n.allowedInMath===void 0||n.allowedInMath,numOptionalArgs:n.numOptionalArgs||0,infix:!!n.infix,primitive:!!n.primitive,handler:r};for(let e=0;e<t.length;++e)nx[t[e]]=a;e&&i&&(rx[e]=i)}function ax({type:e,mathmlBuilder:t}){ix({type:e,names:[],props:{numArgs:0},handler(){throw Error(`Should never be called.`)},mathmlBuilder:t})}var ox=function(e){return e.type===`ordgroup`&&e.body.length===1?e.body[0]:e},sx=function(e){return e.type===`ordgroup`?e.body:[e]},cx=class{constructor(e){this.children=e,this.classes=[],this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){let e=document.createDocumentFragment();for(let t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){let e=``;for(let t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e}toText(){return this.children.map(e=>e.toText()).join(``)}},lx=function(e){return e.filter(e=>e).join(` `)},ux=function(e,t){this.classes=e||[],this.attributes={},this.style=t||{}},dx=function(e){let t=document.createElement(e);t.className=lx(this.classes);for(let e in this.style)Object.prototype.hasOwnProperty.call(this.style,e)&&(t.style[e]=this.style[e]);for(let e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&t.setAttribute(e,this.attributes[e]);for(let e=0;e<this.children.length;e++)t.appendChild(this.children[e].toNode());return t},fx=function(e){let t=`<${e}`;this.classes.length&&(t+=` class="${Kb(lx(this.classes))}"`);let n=``;for(let e in this.style)Object.prototype.hasOwnProperty.call(this.style,e)&&(n+=`${Ub(e)}:${this.style[e]};`);n&&(t+=` style="${n}"`);for(let e in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,e)&&(t+=` ${e}="${Kb(this.attributes[e])}"`);t+=`>`;for(let e=0;e<this.children.length;e++)t+=this.children[e].toMarkup();return t+=`</${e}>`,t},px=class{constructor(e,t,n){ux.call(this,e,n),this.children=t||[]}setAttribute(e,t){this.attributes[e]=t}toNode(){return dx.call(this,`span`)}toMarkup(){return fx.call(this,`span`)}},mx=class{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return Kb(this.text)}},hx=class{constructor(e,t,n){this.href=e,this.classes=t,this.children=n||[]}toNode(){let e=document.createElement(`a`);e.setAttribute(`href`,this.href),this.classes.length>0&&(e.className=lx(this.classes));for(let t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){let e=`<a href='${Kb(this.href)}'`;this.classes.length>0&&(e+=` class="${Kb(lx(this.classes))}"`),e+=`>`;for(let t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e+=`</a>`,e}},gx=class{constructor(e,t,n){this.alt=t,this.src=e,this.classes=[`mord`],this.style=n}hasClass(e){return this.classes.includes(e)}toNode(){let e=document.createElement(`img`);e.src=this.src,e.alt=this.alt,e.className=`mord`;for(let t in this.style)Object.prototype.hasOwnProperty.call(this.style,t)&&(e.style[t]=this.style[t]);return e}toMarkup(){let e=`<img src='${this.src}' alt='${this.alt}'`,t=``;for(let e in this.style)Object.prototype.hasOwnProperty.call(this.style,e)&&(t+=`${Ub(e)}:${this.style[e]};`);return t&&(e+=` style="${Kb(t)}"`),e+=`>`,e}};function _x(e){return new cx(e)}var W=class{constructor(e,t,n,r){this.type=e,this.attributes={},this.children=t||[],this.classes=n||[],this.style=r||{},this.label=``}setAttribute(e,t){this.attributes[e]=t}getAttribute(e){return this.attributes[e]}setLabel(e){this.label=e}toNode(){let e=document.createElementNS(`http://www.w3.org/1998/Math/MathML`,this.type);for(let t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&e.setAttribute(t,this.attributes[t]);this.classes.length>0&&(e.className=lx(this.classes));for(let t in this.style)Object.prototype.hasOwnProperty.call(this.style,t)&&(e.style[t]=this.style[t]);for(let t=0;t<this.children.length;t++)e.appendChild(this.children[t].toNode());return e}toMarkup(){let e=`<`+this.type;for(let t in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,t)&&(e+=` `+t+`="`,e+=Kb(this.attributes[t]),e+=`"`);this.classes.length>0&&(e+=` class="${Kb(lx(this.classes))}"`);let t=``;for(let e in this.style)Object.prototype.hasOwnProperty.call(this.style,e)&&(t+=`${Ub(e)}:${this.style[e]};`);t&&(e+=` style="${t}"`),e+=`>`;for(let t=0;t<this.children.length;t++)e+=this.children[t].toMarkup();return e+=`</`+this.type+`>`,e}toText(){return this.children.map(e=>e.toText()).join(``)}},vx=class{constructor(e){this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return Kb(this.toText())}toText(){return this.text}},yx=e=>{let t;return e.length===1&&e[0].type===`mrow`?(t=e.pop(),t.type=`mstyle`):t=new W(`mstyle`,e),t},bx=e=>{let t=0;if(e.body&&Array.isArray(e.body))for(let n of e.body)t+=bx(n);else if(e.body)t+=bx(e.body);else if(e.type===`supsub`)t+=bx(e.base),e.sub&&(t+=.7*bx(e.sub)),e.sup&&(t+=.7*bx(e.sup));else if(e.type===`mathord`||e.type===`textord`)for(let n of e.text.split(``)){let e=n.codePointAt(0);t+=96<e&&e<123||944<e&&e<970?.56:47<e&&e<58?.5:.92}else t+=1;return t},xx={widehat:`ˆ`,widecheck:`ˇ`,widetilde:`~`,wideparen:`⏜`,utilde:`~`,overleftarrow:`←`,underleftarrow:`←`,xleftarrow:`←`,overrightarrow:`→`,underrightarrow:`→`,xrightarrow:`→`,underbrace:`⏟`,overbrace:`⏞`,overbracket:`⎴`,underbracket:`⎵`,overgroup:`⏠`,overparen:`⏜`,undergroup:`⏡`,underparen:`⏝`,overleftrightarrow:`↔`,underleftrightarrow:`↔`,xleftrightarrow:`↔`,Overrightarrow:`⇒`,xRightarrow:`⇒`,overleftharpoon:`↼`,xleftharpoonup:`↼`,overrightharpoon:`⇀`,xrightharpoonup:`⇀`,xLeftarrow:`⇐`,xLeftrightarrow:`⇔`,xhookleftarrow:`↩`,xhookrightarrow:`↪`,xmapsto:`↦`,xrightharpoondown:`⇁`,xleftharpoondown:`↽`,xtwoheadleftarrow:`↞`,xtwoheadrightarrow:`↠`,xlongequal:`=`,xrightleftarrows:`⇄`,xtofrom:`⇄`,xleftrightharpoons:`⇋`,xrightleftharpoons:`⇌`,yields:`→`,yieldsLeft:`←`,mesomerism:`↔`,longrightharpoonup:`⇀`,longleftharpoondown:`↽`,eqrightharpoonup:`⇀`,eqleftharpoondown:`↽`,"\\cdrightarrow":`→`,"\\cdleftarrow":`←`,"\\cdlongequal":`=`,yieldsLeftRight:`⇄`,chemequilibrium:`⇌`},Sx=function(e){let t=new W(`mo`,[new vx(xx[e.slice(1)])]);return t.setAttribute(`stretchy`,`true`),t},Cx=[`\\widehat`,`\\widecheck`],wx=e=>{let t=Sx(e.label);if(e.label.indexOf(`tilde`)>-1){let n=bx(e.base);1<n&&n<1.6?t.classes.push(`tml-tilde-2`):1.6<=n&&n<2.5?t.classes.push(`tml-tilde-3`):2.5<=n&&t.classes.push(`tml-tilde-4`)}else if(Cx.includes(e.label)){let n=bx(e.base);0<n&&n<=1?t.classes.push(`tml-hat-1`):1<n&&n<1.6?t.classes.push(`tml-hat-2`):1.6<=n&&n<2.5?t.classes.push(`tml-hat-3`):2.5<=n&&t.classes.push(`tml-hat-4`)}return t},Tx={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Ex={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Dx=Object.create(null);Dx.math=Object.create(null),Dx.text=Object.create(null);function G(e,t,n,r,i){if(e!==`math`&&e!==`text`)throw TypeError(`Invalid mode: ${e} called in defineSymbol`);let a={group:t,replace:n};Dx[e][r]=a,i&&n&&(Dx[e][n]=a)}var K=`math`,q=`text`,Ox=`accent-token`,J=`bin`,kx=`close`,Ax=`inner`,Y=`mathord`,jx=`op-token`,Mx=`open`,Nx=`punct`,X=`rel`,Px=`spacing`,Z=`textord`;G(K,X,`≡`,`\\equiv`,!0),G(K,X,`≺`,`\\prec`,!0),G(K,X,`≻`,`\\succ`,!0),G(K,X,`∼`,`\\sim`,!0),G(K,X,`⟂`,`\\perp`,!0),G(K,X,`⪯`,`\\preceq`,!0),G(K,X,`⪰`,`\\succeq`,!0),G(K,X,`≃`,`\\simeq`,!0),G(K,X,`≌`,`\\backcong`,!0),G(K,X,`|`,`\\mid`,!0),G(K,X,`≪`,`\\ll`,!0),G(K,X,`≫`,`\\gg`,!0),G(K,X,`≍`,`\\asymp`,!0),G(K,X,`∥`,`\\parallel`),G(K,X,`⌣`,`\\smile`,!0),G(K,X,`⊑`,`\\sqsubseteq`,!0),G(K,X,`⊒`,`\\sqsupseteq`,!0),G(K,X,`≐`,`\\doteq`,!0),G(K,X,`⌢`,`\\frown`,!0),G(K,X,`∋`,`\\ni`,!0),G(K,X,`∌`,`\\notni`,!0),G(K,X,`∝`,`\\propto`,!0),G(K,X,`⊢`,`\\vdash`,!0),G(K,X,`⊣`,`\\dashv`,!0),G(K,X,`∋`,`\\owns`),G(K,X,`≘`,`\\arceq`,!0),G(K,X,`≙`,`\\wedgeq`,!0),G(K,X,`≚`,`\\veeeq`,!0),G(K,X,`≛`,`\\stareq`,!0),G(K,X,`≝`,`\\eqdef`,!0),G(K,X,`≞`,`\\measeq`,!0),G(K,X,`≟`,`\\questeq`,!0),G(K,X,`≠`,`\\ne`,!0),G(K,X,`≠`,`\\neq`),G(K,X,`⩵`,`\\eqeq`,!0),G(K,X,`⩶`,`\\eqeqeq`,!0),G(K,X,`∷`,`\\dblcolon`,!0),G(K,X,`≔`,`\\coloneqq`,!0),G(K,X,`≕`,`\\eqqcolon`,!0),G(K,X,`∹`,`\\eqcolon`,!0),G(K,X,`⩴`,`\\Coloneqq`,!0),G(K,Nx,`.`,`\\ldotp`),G(K,Nx,`·`,`\\cdotp`),G(K,Z,`#`,`\\#`),G(q,Z,`#`,`\\#`),G(K,Z,`&`,`\\&`),G(q,Z,`&`,`\\&`),G(K,Z,`ℵ`,`\\aleph`,!0),G(K,Z,`∀`,`\\forall`,!0),G(K,Z,`ℏ`,`\\hbar`,!0),G(K,Z,`∃`,`\\exists`,!0),G(K,Mx,`∇`,`\\nabla`,!0),G(K,Z,`♭`,`\\flat`,!0),G(K,Z,`ℓ`,`\\ell`,!0),G(K,Z,`♮`,`\\natural`,!0),G(K,Z,`Å`,`\\Angstrom`,!0),G(q,Z,`Å`,`\\Angstrom`,!0),G(K,Z,`♣`,`\\clubsuit`,!0),G(K,Z,`♧`,`\\varclubsuit`,!0),G(K,Z,`℘`,`\\wp`,!0),G(K,Z,`♯`,`\\sharp`,!0),G(K,Z,`♢`,`\\diamondsuit`,!0),G(K,Z,`♦`,`\\vardiamondsuit`,!0),G(K,Z,`ℜ`,`\\Re`,!0),G(K,Z,`♡`,`\\heartsuit`,!0),G(K,Z,`♥`,`\\varheartsuit`,!0),G(K,Z,`ℑ`,`\\Im`,!0),G(K,Z,`♠`,`\\spadesuit`,!0),G(K,Z,`♤`,`\\varspadesuit`,!0),G(K,Z,`♀`,`\\female`,!0),G(K,Z,`♂`,`\\male`,!0),G(K,Z,`§`,`\\S`,!0),G(q,Z,`§`,`\\S`),G(K,Z,`¶`,`\\P`,!0),G(q,Z,`¶`,`\\P`),G(q,Z,`☺`,`\\smiley`,!0),G(K,Z,`☺`,`\\smiley`,!0),G(K,Z,`†`,`\\dag`),G(q,Z,`†`,`\\dag`),G(q,Z,`†`,`\\textdagger`),G(K,Z,`‡`,`\\ddag`),G(q,Z,`‡`,`\\ddag`),G(q,Z,`‡`,`\\textdaggerdbl`),G(K,kx,`⎱`,`\\rmoustache`,!0),G(K,Mx,`⎰`,`\\lmoustache`,!0),G(K,kx,`⟯`,`\\rgroup`,!0),G(K,Mx,`⟮`,`\\lgroup`,!0),G(K,J,`∓`,`\\mp`,!0),G(K,J,`⊖`,`\\ominus`,!0),G(K,J,`⊎`,`\\uplus`,!0),G(K,J,`⊓`,`\\sqcap`,!0),G(K,J,`∗`,`\\ast`),G(K,J,`⊔`,`\\sqcup`,!0),G(K,J,`◯`,`\\bigcirc`,!0),G(K,J,`∙`,`\\bullet`,!0),G(K,J,`‡`,`\\ddagger`),G(K,J,`≀`,`\\wr`,!0),G(K,J,`⨿`,`\\amalg`),G(K,J,`&`,`\\And`),G(K,J,`⫽`,`\\sslash`,!0),G(K,X,`⟵`,`\\longleftarrow`,!0),G(K,X,`⇐`,`\\Leftarrow`,!0),G(K,X,`⟸`,`\\Longleftarrow`,!0),G(K,X,`⟶`,`\\longrightarrow`,!0),G(K,X,`⇒`,`\\Rightarrow`,!0),G(K,X,`⟹`,`\\Longrightarrow`,!0),G(K,X,`↔`,`\\leftrightarrow`,!0),G(K,X,`⟷`,`\\longleftrightarrow`,!0),G(K,X,`⇔`,`\\Leftrightarrow`,!0),G(K,X,`⟺`,`\\Longleftrightarrow`,!0),G(K,X,`↤`,`\\mapsfrom`,!0),G(K,X,`↦`,`\\mapsto`,!0),G(K,X,`⟼`,`\\longmapsto`,!0),G(K,X,`↗`,`\\nearrow`,!0),G(K,X,`↩`,`\\hookleftarrow`,!0),G(K,X,`↪`,`\\hookrightarrow`,!0),G(K,X,`↘`,`\\searrow`,!0),G(K,X,`↼`,`\\leftharpoonup`,!0),G(K,X,`⇀`,`\\rightharpoonup`,!0),G(K,X,`↙`,`\\swarrow`,!0),G(K,X,`↽`,`\\leftharpoondown`,!0),G(K,X,`⇁`,`\\rightharpoondown`,!0),G(K,X,`↖`,`\\nwarrow`,!0),G(K,X,`⇌`,`\\rightleftharpoons`,!0),G(K,Y,`↯`,`\\lightning`,!0),G(K,Y,`∎`,`\\QED`,!0),G(K,Y,`‰`,`\\permil`,!0),G(q,Z,`‰`,`\\permil`),G(K,Y,`☉`,`\\astrosun`,!0),G(K,Y,`☼`,`\\sun`,!0),G(K,Y,`☾`,`\\leftmoon`,!0),G(K,Y,`☽`,`\\rightmoon`,!0),G(K,Y,`⊕`,`\\Earth`),G(K,X,`≮`,`\\nless`,!0),G(K,X,`⪇`,`\\lneq`,!0),G(K,X,`≨`,`\\lneqq`,!0),G(K,X,`≨︀`,`\\lvertneqq`),G(K,X,`⋦`,`\\lnsim`,!0),G(K,X,`⪉`,`\\lnapprox`,!0),G(K,X,`⊀`,`\\nprec`,!0),G(K,X,`⋠`,`\\npreceq`,!0),G(K,X,`⋨`,`\\precnsim`,!0),G(K,X,`⪹`,`\\precnapprox`,!0),G(K,X,`≁`,`\\nsim`,!0),G(K,X,`∤`,`\\nmid`,!0),G(K,X,`∤`,`\\nshortmid`),G(K,X,`⊬`,`\\nvdash`,!0),G(K,X,`⊭`,`\\nvDash`,!0),G(K,X,`⋪`,`\\ntriangleleft`),G(K,X,`⋬`,`\\ntrianglelefteq`,!0),G(K,X,`⊄`,`\\nsubset`,!0),G(K,X,`⊅`,`\\nsupset`,!0),G(K,X,`⊊`,`\\subsetneq`,!0),G(K,X,`⊊︀`,`\\varsubsetneq`),G(K,X,`⫋`,`\\subsetneqq`,!0),G(K,X,`⫋︀`,`\\varsubsetneqq`),G(K,X,`≯`,`\\ngtr`,!0),G(K,X,`⪈`,`\\gneq`,!0),G(K,X,`≩`,`\\gneqq`,!0),G(K,X,`≩︀`,`\\gvertneqq`),G(K,X,`⋧`,`\\gnsim`,!0),G(K,X,`⪊`,`\\gnapprox`,!0),G(K,X,`⊁`,`\\nsucc`,!0),G(K,X,`⋡`,`\\nsucceq`,!0),G(K,X,`⋩`,`\\succnsim`,!0),G(K,X,`⪺`,`\\succnapprox`,!0),G(K,X,`≆`,`\\ncong`,!0),G(K,X,`∦`,`\\nparallel`,!0),G(K,X,`∦`,`\\nshortparallel`),G(K,X,`⊯`,`\\nVDash`,!0),G(K,X,`⋫`,`\\ntriangleright`),G(K,X,`⋭`,`\\ntrianglerighteq`,!0),G(K,X,`⊋`,`\\supsetneq`,!0),G(K,X,`⊋`,`\\varsupsetneq`),G(K,X,`⫌`,`\\supsetneqq`,!0),G(K,X,`⫌︀`,`\\varsupsetneqq`),G(K,X,`⊮`,`\\nVdash`,!0),G(K,X,`⪵`,`\\precneqq`,!0),G(K,X,`⪶`,`\\succneqq`,!0),G(K,J,`⊴`,`\\unlhd`),G(K,J,`⊵`,`\\unrhd`),G(K,X,`↚`,`\\nleftarrow`,!0),G(K,X,`↛`,`\\nrightarrow`,!0),G(K,X,`⇍`,`\\nLeftarrow`,!0),G(K,X,`⇏`,`\\nRightarrow`,!0),G(K,X,`↮`,`\\nleftrightarrow`,!0),G(K,X,`⇎`,`\\nLeftrightarrow`,!0),G(K,X,`△`,`\\vartriangle`),G(K,Z,`ℏ`,`\\hslash`),G(K,Z,`▽`,`\\triangledown`),G(K,Z,`◊`,`\\lozenge`),G(K,Z,`Ⓢ`,`\\circledS`),G(K,Z,`®`,`\\circledR`,!0),G(q,Z,`®`,`\\circledR`),G(q,Z,`®`,`\\textregistered`),G(K,Z,`∡`,`\\measuredangle`,!0),G(K,Z,`∄`,`\\nexists`),G(K,Z,`℧`,`\\mho`),G(K,Z,`Ⅎ`,`\\Finv`,!0),G(K,Z,`⅁`,`\\Game`,!0),G(K,Z,`‵`,`\\backprime`),G(K,Z,`‶`,`\\backdprime`),G(K,Z,`‷`,`\\backtrprime`),G(K,Z,`▲`,`\\blacktriangle`),G(K,Z,`▼`,`\\blacktriangledown`),G(K,Z,`■`,`\\blacksquare`),G(K,Z,`⧫`,`\\blacklozenge`),G(K,Z,`★`,`\\bigstar`),G(K,Z,`∢`,`\\sphericalangle`,!0),G(K,Z,`∁`,`\\complement`,!0),G(K,Z,`╱`,`\\diagup`),G(K,Z,`╲`,`\\diagdown`),G(K,Z,`□`,`\\square`),G(K,Z,`□`,`\\Box`),G(K,Z,`◊`,`\\Diamond`),G(K,Z,`¥`,`\\yen`,!0),G(q,Z,`¥`,`\\yen`,!0),G(K,Z,`✓`,`\\checkmark`,!0),G(q,Z,`✓`,`\\checkmark`),G(K,Z,`✗`,`\\ballotx`,!0),G(q,Z,`✗`,`\\ballotx`),G(q,Z,`•`,`\\textbullet`),G(K,Z,`ℶ`,`\\beth`,!0),G(K,Z,`ℸ`,`\\daleth`,!0),G(K,Z,`ℷ`,`\\gimel`,!0),G(K,Z,`ϝ`,`\\digamma`,!0),G(K,Z,`ϰ`,`\\varkappa`),G(K,Mx,`⌜`,`\\ulcorner`,!0),G(K,kx,`⌝`,`\\urcorner`,!0),G(K,Mx,`⌞`,`\\llcorner`,!0),G(K,kx,`⌟`,`\\lrcorner`,!0),G(K,X,`≦`,`\\leqq`,!0),G(K,X,`⩽`,`\\leqslant`,!0),G(K,X,`⪕`,`\\eqslantless`,!0),G(K,X,`≲`,`\\lesssim`,!0),G(K,X,`⪅`,`\\lessapprox`,!0),G(K,X,`≊`,`\\approxeq`,!0),G(K,J,`⋖`,`\\lessdot`),G(K,X,`⋘`,`\\lll`,!0),G(K,X,`≶`,`\\lessgtr`,!0),G(K,X,`⋚`,`\\lesseqgtr`,!0),G(K,X,`⪋`,`\\lesseqqgtr`,!0),G(K,X,`≑`,`\\doteqdot`),G(K,X,`≓`,`\\risingdotseq`,!0),G(K,X,`≒`,`\\fallingdotseq`,!0),G(K,X,`∽`,`\\backsim`,!0),G(K,X,`⋍`,`\\backsimeq`,!0),G(K,X,`⫅`,`\\subseteqq`,!0),G(K,X,`⋐`,`\\Subset`,!0),G(K,X,`⊏`,`\\sqsubset`,!0),G(K,X,`≼`,`\\preccurlyeq`,!0),G(K,X,`⋞`,`\\curlyeqprec`,!0),G(K,X,`≾`,`\\precsim`,!0),G(K,X,`⪷`,`\\precapprox`,!0),G(K,X,`⊲`,`\\vartriangleleft`),G(K,X,`⊴`,`\\trianglelefteq`),G(K,X,`⊨`,`\\vDash`,!0),G(K,X,`⊫`,`\\VDash`,!0),G(K,X,`⊪`,`\\Vvdash`,!0),G(K,X,`⌣`,`\\smallsmile`),G(K,X,`⌢`,`\\smallfrown`),G(K,X,`≏`,`\\bumpeq`,!0),G(K,X,`≎`,`\\Bumpeq`,!0),G(K,X,`≧`,`\\geqq`,!0),G(K,X,`⩾`,`\\geqslant`,!0),G(K,X,`⪖`,`\\eqslantgtr`,!0),G(K,X,`≳`,`\\gtrsim`,!0),G(K,X,`⪆`,`\\gtrapprox`,!0),G(K,J,`⋗`,`\\gtrdot`),G(K,X,`⋙`,`\\ggg`,!0),G(K,X,`≷`,`\\gtrless`,!0),G(K,X,`⋛`,`\\gtreqless`,!0),G(K,X,`⪌`,`\\gtreqqless`,!0),G(K,X,`≖`,`\\eqcirc`,!0),G(K,X,`≗`,`\\circeq`,!0),G(K,X,`≜`,`\\triangleq`,!0),G(K,X,`∼`,`\\thicksim`),G(K,X,`≈`,`\\thickapprox`),G(K,X,`⫆`,`\\supseteqq`,!0),G(K,X,`⋑`,`\\Supset`,!0),G(K,X,`⊐`,`\\sqsupset`,!0),G(K,X,`≽`,`\\succcurlyeq`,!0),G(K,X,`⋟`,`\\curlyeqsucc`,!0),G(K,X,`≿`,`\\succsim`,!0),G(K,X,`⪸`,`\\succapprox`,!0),G(K,X,`⊳`,`\\vartriangleright`),G(K,X,`⊵`,`\\trianglerighteq`),G(K,X,`⊩`,`\\Vdash`,!0),G(K,X,`∣`,`\\shortmid`),G(K,X,`∥`,`\\shortparallel`),G(K,X,`≬`,`\\between`,!0),G(K,X,`⋔`,`\\pitchfork`,!0),G(K,X,`∝`,`\\varpropto`),G(K,X,`◀`,`\\blacktriangleleft`),G(K,X,`∴`,`\\therefore`,!0),G(K,X,`∍`,`\\backepsilon`),G(K,X,`▶`,`\\blacktriangleright`),G(K,X,`∵`,`\\because`,!0),G(K,X,`⋘`,`\\llless`),G(K,X,`⋙`,`\\gggtr`),G(K,J,`⊲`,`\\lhd`),G(K,J,`⊳`,`\\rhd`),G(K,X,`≂`,`\\eqsim`,!0),G(K,X,`≑`,`\\Doteq`,!0),G(K,X,`⥽`,`\\strictif`,!0),G(K,X,`⥼`,`\\strictfi`,!0),G(K,J,`∔`,`\\dotplus`,!0),G(K,J,`∖`,`\\smallsetminus`),G(K,J,`⋒`,`\\Cap`,!0),G(K,J,`⋓`,`\\Cup`,!0),G(K,J,`⩞`,`\\doublebarwedge`,!0),G(K,J,`⊟`,`\\boxminus`,!0),G(K,J,`⊞`,`\\boxplus`,!0),G(K,J,`⧄`,`\\boxslash`,!0),G(K,J,`⋇`,`\\divideontimes`,!0),G(K,J,`⋉`,`\\ltimes`,!0),G(K,J,`⋊`,`\\rtimes`,!0),G(K,J,`⋋`,`\\leftthreetimes`,!0),G(K,J,`⋌`,`\\rightthreetimes`,!0),G(K,J,`⋏`,`\\curlywedge`,!0),G(K,J,`⋎`,`\\curlyvee`,!0),G(K,J,`⊝`,`\\circleddash`,!0),G(K,J,`⊛`,`\\circledast`,!0),G(K,J,`⊺`,`\\intercal`,!0),G(K,J,`⋒`,`\\doublecap`),G(K,J,`⋓`,`\\doublecup`),G(K,J,`⊠`,`\\boxtimes`,!0),G(K,J,`⋈`,`\\bowtie`,!0),G(K,J,`⋈`,`\\Join`),G(K,J,`⟕`,`\\leftouterjoin`,!0),G(K,J,`⟖`,`\\rightouterjoin`,!0),G(K,J,`⟗`,`\\fullouterjoin`,!0),G(K,J,`∸`,`\\dotminus`,!0),G(K,J,`⟑`,`\\wedgedot`,!0),G(K,J,`⟇`,`\\veedot`,!0),G(K,J,`⩢`,`\\doublebarvee`,!0),G(K,J,`⩣`,`\\veedoublebar`,!0),G(K,J,`⩟`,`\\wedgebar`,!0),G(K,J,`⩠`,`\\wedgedoublebar`,!0),G(K,J,`⩔`,`\\Vee`,!0),G(K,J,`⩓`,`\\Wedge`,!0),G(K,J,`⩃`,`\\barcap`,!0),G(K,J,`⩂`,`\\barcup`,!0),G(K,J,`⩈`,`\\capbarcup`,!0),G(K,J,`⩀`,`\\capdot`,!0),G(K,J,`⩇`,`\\capovercup`,!0),G(K,J,`⩆`,`\\cupovercap`,!0),G(K,J,`⩍`,`\\closedvarcap`,!0),G(K,J,`⩌`,`\\closedvarcup`,!0),G(K,J,`⨪`,`\\minusdot`,!0),G(K,J,`⨫`,`\\minusfdots`,!0),G(K,J,`⨬`,`\\minusrdots`,!0),G(K,J,`⊻`,`\\Xor`,!0),G(K,J,`⊼`,`\\Nand`,!0),G(K,J,`⊽`,`\\Nor`,!0),G(K,J,`⊽`,`\\barvee`),G(K,J,`⫴`,`\\interleave`,!0),G(K,J,`⧢`,`\\shuffle`,!0),G(K,J,`⫶`,`\\threedotcolon`,!0),G(K,J,`⦂`,`\\typecolon`,!0),G(K,J,`∾`,`\\invlazys`,!0),G(K,J,`⩋`,`\\twocaps`,!0),G(K,J,`⩊`,`\\twocups`,!0),G(K,J,`⩎`,`\\Sqcap`,!0),G(K,J,`⩏`,`\\Sqcup`,!0),G(K,J,`⩖`,`\\veeonvee`,!0),G(K,J,`⩕`,`\\wedgeonwedge`,!0),G(K,J,`⧗`,`\\blackhourglass`,!0),G(K,J,`⧆`,`\\boxast`,!0),G(K,J,`⧈`,`\\boxbox`,!0),G(K,J,`⧇`,`\\boxcircle`,!0),G(K,J,`⊜`,`\\circledequal`,!0),G(K,J,`⦷`,`\\circledparallel`,!0),G(K,J,`⦶`,`\\circledvert`,!0),G(K,J,`⦵`,`\\circlehbar`,!0),G(K,J,`⟡`,`\\concavediamond`,!0),G(K,J,`⟢`,`\\concavediamondtickleft`,!0),G(K,J,`⟣`,`\\concavediamondtickright`,!0),G(K,J,`⋄`,`\\diamond`,!0),G(K,J,`⧖`,`\\hourglass`,!0),G(K,J,`⟠`,`\\lozengeminus`,!0),G(K,J,`⌽`,`\\obar`,!0),G(K,J,`⦸`,`\\obslash`,!0),G(K,J,`⨸`,`\\odiv`,!0),G(K,J,`⧁`,`\\ogreaterthan`,!0),G(K,J,`⧀`,`\\olessthan`,!0),G(K,J,`⦹`,`\\operp`,!0),G(K,J,`⨷`,`\\Otimes`,!0),G(K,J,`⨶`,`\\otimeshat`,!0),G(K,J,`⋆`,`\\star`,!0),G(K,J,`△`,`\\triangle`,!0),G(K,J,`⨺`,`\\triangleminus`,!0),G(K,J,`⨹`,`\\triangleplus`,!0),G(K,J,`⨻`,`\\triangletimes`,!0),G(K,J,`⟤`,`\\whitesquaretickleft`,!0),G(K,J,`⟥`,`\\whitesquaretickright`,!0),G(K,J,`⨳`,`\\smashtimes`,!0),G(K,X,`⇢`,`\\dashrightarrow`,!0),G(K,X,`⇠`,`\\dashleftarrow`,!0),G(K,X,`⇇`,`\\leftleftarrows`,!0),G(K,X,`⇆`,`\\leftrightarrows`,!0),G(K,X,`⇚`,`\\Lleftarrow`,!0),G(K,X,`↞`,`\\twoheadleftarrow`,!0),G(K,X,`↢`,`\\leftarrowtail`,!0),G(K,X,`↫`,`\\looparrowleft`,!0),G(K,X,`⇋`,`\\leftrightharpoons`,!0),G(K,X,`↶`,`\\curvearrowleft`,!0),G(K,X,`↺`,`\\circlearrowleft`,!0),G(K,X,`↰`,`\\Lsh`,!0),G(K,X,`⇈`,`\\upuparrows`,!0),G(K,X,`↿`,`\\upharpoonleft`,!0),G(K,X,`⇃`,`\\downharpoonleft`,!0),G(K,X,`⊶`,`\\origof`,!0),G(K,X,`⊷`,`\\imageof`,!0),G(K,X,`⊸`,`\\multimap`,!0),G(K,X,`↭`,`\\leftrightsquigarrow`,!0),G(K,X,`⇉`,`\\rightrightarrows`,!0),G(K,X,`⇄`,`\\rightleftarrows`,!0),G(K,X,`↠`,`\\twoheadrightarrow`,!0),G(K,X,`↣`,`\\rightarrowtail`,!0),G(K,X,`↬`,`\\looparrowright`,!0),G(K,X,`↷`,`\\curvearrowright`,!0),G(K,X,`↻`,`\\circlearrowright`,!0),G(K,X,`↱`,`\\Rsh`,!0),G(K,X,`⇊`,`\\downdownarrows`,!0),G(K,X,`↾`,`\\upharpoonright`,!0),G(K,X,`⇂`,`\\downharpoonright`,!0),G(K,X,`⇝`,`\\rightsquigarrow`,!0),G(K,X,`⇝`,`\\leadsto`),G(K,X,`⇛`,`\\Rrightarrow`,!0),G(K,X,`↾`,`\\restriction`),G(K,Z,`‘`,"`"),G(K,Z,`$`,`\\$`),G(q,Z,`$`,`\\$`),G(q,Z,`$`,`\\textdollar`),G(K,Z,`¢`,`\\cent`),G(q,Z,`¢`,`\\cent`),G(K,Z,`%`,`\\%`),G(q,Z,`%`,`\\%`),G(K,Z,`_`,`\\_`),G(q,Z,`_`,`\\_`),G(q,Z,`_`,`\\textunderscore`),G(q,Z,`␣`,`\\textvisiblespace`,!0),G(K,Z,`∠`,`\\angle`,!0),G(K,Z,`∞`,`\\infty`,!0),G(K,Z,`′`,`\\prime`),G(K,Z,`″`,`\\dprime`),G(K,Z,`‴`,`\\trprime`),G(K,Z,`⁗`,`\\qprime`),G(K,Z,`△`,`\\triangle`),G(q,Z,`Α`,`\\Alpha`,!0),G(q,Z,`Β`,`\\Beta`,!0),G(q,Z,`Γ`,`\\Gamma`,!0),G(q,Z,`Δ`,`\\Delta`,!0),G(q,Z,`Ε`,`\\Epsilon`,!0),G(q,Z,`Ζ`,`\\Zeta`,!0),G(q,Z,`Η`,`\\Eta`,!0),G(q,Z,`Θ`,`\\Theta`,!0),G(q,Z,`Ι`,`\\Iota`,!0),G(q,Z,`Κ`,`\\Kappa`,!0),G(q,Z,`Λ`,`\\Lambda`,!0),G(q,Z,`Μ`,`\\Mu`,!0),G(q,Z,`Ν`,`\\Nu`,!0),G(q,Z,`Ξ`,`\\Xi`,!0),G(q,Z,`Ο`,`\\Omicron`,!0),G(q,Z,`Π`,`\\Pi`,!0),G(q,Z,`Ρ`,`\\Rho`,!0),G(q,Z,`Σ`,`\\Sigma`,!0),G(q,Z,`Τ`,`\\Tau`,!0),G(q,Z,`Υ`,`\\Upsilon`,!0),G(q,Z,`Φ`,`\\Phi`,!0),G(q,Z,`Χ`,`\\Chi`,!0),G(q,Z,`Ψ`,`\\Psi`,!0),G(q,Z,`Ω`,`\\Omega`,!0),G(K,Y,`Α`,`\\Alpha`,!0),G(K,Y,`Β`,`\\Beta`,!0),G(K,Y,`Γ`,`\\Gamma`,!0),G(K,Y,`Δ`,`\\Delta`,!0),G(K,Y,`Ε`,`\\Epsilon`,!0),G(K,Y,`Ζ`,`\\Zeta`,!0),G(K,Y,`Η`,`\\Eta`,!0),G(K,Y,`Θ`,`\\Theta`,!0),G(K,Y,`Ι`,`\\Iota`,!0),G(K,Y,`Κ`,`\\Kappa`,!0),G(K,Y,`Λ`,`\\Lambda`,!0),G(K,Y,`Μ`,`\\Mu`,!0),G(K,Y,`Ν`,`\\Nu`,!0),G(K,Y,`Ξ`,`\\Xi`,!0),G(K,Y,`Ο`,`\\Omicron`,!0),G(K,Y,`Π`,`\\Pi`,!0),G(K,Y,`Ρ`,`\\Rho`,!0),G(K,Y,`Σ`,`\\Sigma`,!0),G(K,Y,`Τ`,`\\Tau`,!0),G(K,Y,`Υ`,`\\Upsilon`,!0),G(K,Y,`Φ`,`\\Phi`,!0),G(K,Y,`Χ`,`\\Chi`,!0),G(K,Y,`Ψ`,`\\Psi`,!0),G(K,Y,`Ω`,`\\Omega`,!0),G(K,Mx,`¬`,`\\neg`,!0),G(K,Mx,`¬`,`\\lnot`),G(K,Z,`⊤`,`\\top`),G(K,Z,`⊥`,`\\bot`),G(K,Z,`∅`,`\\emptyset`),G(K,Z,`⌀`,`\\varnothing`),G(K,Y,`α`,`\\alpha`,!0),G(K,Y,`β`,`\\beta`,!0),G(K,Y,`γ`,`\\gamma`,!0),G(K,Y,`δ`,`\\delta`,!0),G(K,Y,`ϵ`,`\\epsilon`,!0),G(K,Y,`ζ`,`\\zeta`,!0),G(K,Y,`η`,`\\eta`,!0),G(K,Y,`θ`,`\\theta`,!0),G(K,Y,`ι`,`\\iota`,!0),G(K,Y,`κ`,`\\kappa`,!0),G(K,Y,`λ`,`\\lambda`,!0),G(K,Y,`μ`,`\\mu`,!0),G(K,Y,`ν`,`\\nu`,!0),G(K,Y,`ξ`,`\\xi`,!0),G(K,Y,`ο`,`\\omicron`,!0),G(K,Y,`π`,`\\pi`,!0),G(K,Y,`ρ`,`\\rho`,!0),G(K,Y,`σ`,`\\sigma`,!0),G(K,Y,`τ`,`\\tau`,!0),G(K,Y,`υ`,`\\upsilon`,!0),G(K,Y,`ϕ`,`\\phi`,!0),G(K,Y,`χ`,`\\chi`,!0),G(K,Y,`ψ`,`\\psi`,!0),G(K,Y,`ω`,`\\omega`,!0),G(K,Y,`ε`,`\\varepsilon`,!0),G(K,Y,`ϑ`,`\\vartheta`,!0),G(K,Y,`ϖ`,`\\varpi`,!0),G(K,Y,`ϱ`,`\\varrho`,!0),G(K,Y,`ς`,`\\varsigma`,!0),G(K,Y,`φ`,`\\varphi`,!0),G(K,Y,`Ϙ`,`\\Coppa`,!0),G(K,Y,`ϙ`,`\\coppa`,!0),G(K,Y,`ϙ`,`\\varcoppa`,!0),G(K,Y,`Ϟ`,`\\Koppa`,!0),G(K,Y,`ϟ`,`\\koppa`,!0),G(K,Y,`Ϡ`,`\\Sampi`,!0),G(K,Y,`ϡ`,`\\sampi`,!0),G(K,Y,`Ϛ`,`\\Stigma`,!0),G(K,Y,`ϛ`,`\\stigma`,!0),G(K,Y,`⫫`,`\\Bot`),G(K,Z,`ð`,`\\eth`,!0),G(q,Z,`ð`,`ð`),G(K,Z,`Å`,`\\AA`),G(q,Z,`Å`,`\\AA`,!0),G(K,Z,`Æ`,`\\AE`,!0),G(q,Z,`Æ`,`\\AE`,!0),G(K,Z,`Ð`,`\\DH`,!0),G(q,Z,`Ð`,`\\DH`,!0),G(K,Z,`Þ`,`\\TH`,!0),G(q,Z,`Þ`,`\\TH`,!0),G(K,Z,`ß`,`\\ss`,!0),G(q,Z,`ß`,`\\ss`,!0),G(K,Z,`å`,`\\aa`),G(q,Z,`å`,`\\aa`,!0),G(K,Z,`æ`,`\\ae`,!0),G(q,Z,`æ`,`\\ae`,!0),G(K,Z,`ð`,`\\dh`),G(q,Z,`ð`,`\\dh`,!0),G(K,Z,`þ`,`\\th`,!0),G(q,Z,`þ`,`\\th`,!0),G(K,Z,`Đ`,`\\DJ`,!0),G(q,Z,`Đ`,`\\DJ`,!0),G(K,Z,`đ`,`\\dj`,!0),G(q,Z,`đ`,`\\dj`,!0),G(K,Z,`Ł`,`\\L`,!0),G(q,Z,`Ł`,`\\L`,!0),G(K,Z,`Ł`,`\\l`,!0),G(q,Z,`Ł`,`\\l`,!0),G(K,Z,`Ŋ`,`\\NG`,!0),G(q,Z,`Ŋ`,`\\NG`,!0),G(K,Z,`ŋ`,`\\ng`,!0),G(q,Z,`ŋ`,`\\ng`,!0),G(K,Z,`Œ`,`\\OE`,!0),G(q,Z,`Œ`,`\\OE`,!0),G(K,Z,`œ`,`\\oe`,!0),G(q,Z,`œ`,`\\oe`,!0),G(K,J,`∗`,`∗`,!0),G(K,J,`+`,`+`),G(K,J,`∗`,`*`),G(K,J,`⁄`,`/`,!0),G(K,J,`⁄`,`⁄`),G(K,J,`−`,`-`,!0),G(K,J,`⋅`,`\\cdot`,!0),G(K,J,`∘`,`\\circ`,!0),G(K,J,`÷`,`\\div`,!0),G(K,J,`±`,`\\pm`,!0),G(K,J,`×`,`\\times`,!0),G(K,J,`∩`,`\\cap`,!0),G(K,J,`∪`,`\\cup`,!0),G(K,J,`∖`,`\\setminus`,!0),G(K,J,`∧`,`\\land`),G(K,J,`∨`,`\\lor`),G(K,J,`∧`,`\\wedge`,!0),G(K,J,`∨`,`\\vee`,!0),G(K,Mx,`⟦`,`\\llbracket`,!0),G(K,kx,`⟧`,`\\rrbracket`,!0),G(K,Mx,`⟨`,`\\langle`,!0),G(K,Mx,`⟪`,`\\lAngle`,!0),G(K,Mx,`⦉`,`\\llangle`,!0),G(K,Mx,`|`,`\\lvert`),G(K,Mx,`‖`,`\\lVert`,!0),G(K,Z,`!`,`\\oc`),G(K,Z,`?`,`\\wn`),G(K,Z,`↓`,`\\shpos`),G(K,Z,`↕`,`\\shift`),G(K,Z,`↑`,`\\shneg`),G(K,kx,`?`,`?`),G(K,kx,`!`,`!`),G(K,kx,`‼`,`‼`),G(K,kx,`⟩`,`\\rangle`,!0),G(K,kx,`⟫`,`\\rAngle`,!0),G(K,kx,`⦊`,`\\rrangle`,!0),G(K,kx,`|`,`\\rvert`),G(K,kx,`‖`,`\\rVert`),G(K,Mx,`⦃`,`\\lBrace`,!0),G(K,kx,`⦄`,`\\rBrace`,!0),G(K,X,`=`,`\\equal`,!0),G(K,X,`:`,`:`),G(K,X,`≈`,`\\approx`,!0),G(K,X,`≅`,`\\cong`,!0),G(K,X,`≥`,`\\ge`),G(K,X,`≥`,`\\geq`,!0),G(K,X,`←`,`\\gets`),G(K,X,`>`,`\\gt`,!0),G(K,X,`∈`,`\\in`,!0),G(K,X,`∉`,`\\notin`,!0),G(K,X,``,`\\@not`),G(K,X,`⊂`,`\\subset`,!0),G(K,X,`⊃`,`\\supset`,!0),G(K,X,`⊆`,`\\subseteq`,!0),G(K,X,`⊇`,`\\supseteq`,!0),G(K,X,`⊈`,`\\nsubseteq`,!0),G(K,X,`⊈`,`\\nsubseteqq`),G(K,X,`⊉`,`\\nsupseteq`,!0),G(K,X,`⊉`,`\\nsupseteqq`),G(K,X,`⊨`,`\\models`),G(K,X,`←`,`\\leftarrow`,!0),G(K,X,`≤`,`\\le`),G(K,X,`≤`,`\\leq`,!0),G(K,X,`<`,`\\lt`,!0),G(K,X,`→`,`\\rightarrow`,!0),G(K,X,`→`,`\\to`),G(K,X,`≱`,`\\ngeq`,!0),G(K,X,`≱`,`\\ngeqq`),G(K,X,`≱`,`\\ngeqslant`),G(K,X,`≰`,`\\nleq`,!0),G(K,X,`≰`,`\\nleqq`),G(K,X,`≰`,`\\nleqslant`),G(K,X,`⫫`,`\\Perp`,!0),G(K,Px,`\xA0`,`\\ `),G(K,Px,`\xA0`,`\\space`),G(K,Px,`\xA0`,`\\nobreakspace`),G(q,Px,`\xA0`,`\\ `),G(q,Px,`\xA0`,` `),G(q,Px,`\xA0`,`\\space`),G(q,Px,`\xA0`,`\\nobreakspace`),G(K,Px,null,`\\nobreak`),G(K,Px,null,`\\allowbreak`),G(K,Nx,`,`,`,`),G(q,Nx,`:`,`:`),G(K,Nx,`;`,`;`),G(K,J,`⊼`,`\\barwedge`),G(K,J,`⊻`,`\\veebar`),G(K,J,`⊙`,`\\odot`,!0),G(K,J,`⊕︎`,`\\oplus`),G(K,J,`⊗`,`\\otimes`,!0),G(K,Z,`∂`,`\\partial`,!0),G(K,J,`⊘`,`\\oslash`,!0),G(K,J,`⊚`,`\\circledcirc`,!0),G(K,J,`⊡`,`\\boxdot`,!0),G(K,J,`△`,`\\bigtriangleup`),G(K,J,`▽`,`\\bigtriangledown`),G(K,J,`†`,`\\dagger`),G(K,J,`⋄`,`\\diamond`),G(K,J,`◃`,`\\triangleleft`),G(K,J,`▹`,`\\triangleright`),G(K,Mx,`{`,`\\{`),G(q,Z,`{`,`\\{`),G(q,Z,`{`,`\\textbraceleft`),G(K,kx,`}`,`\\}`),G(q,Z,`}`,`\\}`),G(q,Z,`}`,`\\textbraceright`),G(K,Mx,`{`,`\\lbrace`),G(K,kx,`}`,`\\rbrace`),G(K,Mx,`[`,`\\lbrack`,!0),G(q,Z,`[`,`\\lbrack`,!0),G(K,kx,`]`,`\\rbrack`,!0),G(q,Z,`]`,`\\rbrack`,!0),G(K,Mx,`(`,`\\lparen`,!0),G(K,kx,`)`,`\\rparen`,!0),G(K,Mx,`⦇`,`\\llparenthesis`,!0),G(K,kx,`⦈`,`\\rrparenthesis`,!0),G(q,Z,`<`,`\\textless`,!0),G(q,Z,`>`,`\\textgreater`,!0),G(K,Mx,`⌊`,`\\lfloor`,!0),G(K,kx,`⌋`,`\\rfloor`,!0),G(K,Mx,`⌈`,`\\lceil`,!0),G(K,kx,`⌉`,`\\rceil`,!0),G(K,Z,`\\`,`\\backslash`),G(K,Z,`|`,`|`),G(K,Z,`|`,`\\vert`),G(q,Z,`|`,`\\textbar`,!0),G(K,Z,`‖`,`\\|`),G(K,Z,`‖`,`\\Vert`),G(q,Z,`‖`,`\\textbardbl`),G(q,Z,`~`,`\\textasciitilde`),G(q,Z,`\\`,`\\textbackslash`),G(q,Z,`^`,`\\textasciicircum`),G(K,X,`↑`,`\\uparrow`,!0),G(K,X,`⇑`,`\\Uparrow`,!0),G(K,X,`↓`,`\\downarrow`,!0),G(K,X,`⇓`,`\\Downarrow`,!0),G(K,X,`↕`,`\\updownarrow`,!0),G(K,X,`⇕`,`\\Updownarrow`,!0),G(K,jx,`∐`,`\\coprod`),G(K,jx,`⋁`,`\\bigvee`),G(K,jx,`⋀`,`\\bigwedge`),G(K,jx,`⨄`,`\\biguplus`),G(K,jx,`⨄`,`\\bigcupplus`),G(K,jx,`⨃`,`\\bigcupdot`),G(K,jx,`⨇`,`\\bigdoublevee`),G(K,jx,`⨈`,`\\bigdoublewedge`),G(K,jx,`⋂`,`\\bigcap`),G(K,jx,`⋃`,`\\bigcup`),G(K,jx,`∫`,`\\int`),G(K,jx,`∫`,`\\intop`),G(K,jx,`∬`,`\\iint`),G(K,jx,`∭`,`\\iiint`),G(K,jx,`∏`,`\\prod`),G(K,jx,`∑`,`\\sum`),G(K,jx,`⨂`,`\\bigotimes`),G(K,jx,`⨁`,`\\bigoplus`),G(K,jx,`⨀`,`\\bigodot`),G(K,jx,`⨉`,`\\bigtimes`),G(K,jx,`∮`,`\\oint`),G(K,jx,`∯`,`\\oiint`),G(K,jx,`∰`,`\\oiiint`),G(K,jx,`∱`,`\\intclockwise`),G(K,jx,`∲`,`\\varointclockwise`),G(K,jx,`⨌`,`\\iiiint`),G(K,jx,`⨍`,`\\intbar`),G(K,jx,`⨎`,`\\intBar`),G(K,jx,`⨏`,`\\fint`),G(K,jx,`⨒`,`\\rppolint`),G(K,jx,`⨓`,`\\scpolint`),G(K,jx,`⨕`,`\\pointint`),G(K,jx,`⨖`,`\\sqint`),G(K,jx,`⨗`,`\\intlarhk`),G(K,jx,`⨘`,`\\intx`),G(K,jx,`⨙`,`\\intcap`),G(K,jx,`⨚`,`\\intcup`),G(K,jx,`⨅`,`\\bigsqcap`),G(K,jx,`⨆`,`\\bigsqcup`),G(K,jx,`∫`,`\\smallint`),G(q,Ax,`…`,`\\textellipsis`),G(K,Ax,`…`,`\\mathellipsis`),G(q,Ax,`…`,`\\ldots`,!0),G(K,Ax,`…`,`\\dotso`),G(K,Ax,`…`,`\\dotsc`),G(K,Ax,`…`,`\\ldots`,!0),G(K,Ax,`⋰`,`\\iddots`,!0),G(K,Ax,`⋯`,`\\cdots`,!0),G(K,Ax,`⋱`,`\\ddots`,!0),G(K,Z,`⋮`,`\\varvdots`),G(q,Z,`⋮`,`\\varvdots`),G(K,Ox,`´`,`\\acute`),G(K,Ox,"`",`\\grave`),G(K,Ox,`¨`,`\\ddot`),G(K,Ox,`…`,`\\dddot`),G(K,Ox,`….`,`\\ddddot`),G(K,Ox,`~`,`\\tilde`),G(K,Ox,`‾`,`\\bar`),G(K,Ox,`˘`,`\\breve`),G(K,Ox,`ˇ`,`\\check`),G(K,Ox,`ˆ`,`\\hat`),G(K,Ox,`→`,`\\vec`),G(K,Ox,`˙`,`\\dot`),G(K,Ox,`˚`,`\\mathring`),G(K,Y,`ı`,`\\imath`,!0),G(K,Y,`ȷ`,`\\jmath`,!0),G(K,Z,`ı`,`ı`),G(K,Z,`ȷ`,`ȷ`),G(q,Z,`ı`,`\\i`,!0),G(q,Z,`ȷ`,`\\j`,!0),G(q,Z,`ø`,`\\o`,!0),G(K,Y,`ø`,`\\o`,!0),G(q,Z,`Ø`,`\\O`,!0),G(K,Y,`Ø`,`\\O`,!0),G(q,Ox,`ˊ`,`\\'`),G(q,Ox,`ˋ`,"\\`"),G(q,Ox,`ˆ`,`\\^`),G(q,Ox,`~`,`\\~`),G(q,Ox,`ˉ`,`\\=`),G(q,Ox,`˘`,`\\u`),G(q,Ox,`˙`,`\\.`),G(q,Ox,`¸`,`\\c`),G(q,Ox,`˚`,`\\r`),G(q,Ox,`ˇ`,`\\v`),G(q,Ox,`¨`,`\\"`),G(q,Ox,`˝`,`\\H`),G(K,Ox,`ˊ`,`\\'`),G(K,Ox,`ˋ`,"\\`"),G(K,Ox,`ˆ`,`\\^`),G(K,Ox,`~`,`\\~`),G(K,Ox,`ˉ`,`\\=`),G(K,Ox,`˘`,`\\u`),G(K,Ox,`˙`,`\\.`),G(K,Ox,`¸`,`\\c`),G(K,Ox,`˚`,`\\r`),G(K,Ox,`ˇ`,`\\v`),G(K,Ox,`¨`,`\\"`),G(K,Ox,`˝`,`\\H`);var Fx={"--":!0,"---":!0,"``":!0,"''":!0};G(q,Z,`–`,`--`,!0),G(q,Z,`–`,`\\textendash`),G(q,Z,`—`,`---`,!0),G(q,Z,`—`,`\\textemdash`),G(q,Z,`‘`,"`",!0),G(q,Z,`‘`,`\\textquoteleft`),G(q,Z,`’`,`'`,!0),G(q,Z,`’`,`\\textquoteright`),G(q,Z,`“`,"``",!0),G(q,Z,`“`,`\\textquotedblleft`),G(q,Z,`”`,`''`,!0),G(q,Z,`”`,`\\textquotedblright`),G(K,Z,`°`,`\\degree`,!0),G(q,Z,`°`,`\\degree`),G(q,Z,`°`,`\\textdegree`,!0),G(K,Z,`£`,`\\pounds`),G(K,Z,`£`,`\\mathsterling`,!0),G(q,Z,`£`,`\\pounds`),G(q,Z,`£`,`\\textsterling`,!0),G(K,Z,`✠`,`\\maltese`),G(q,Z,`✠`,`\\maltese`),G(K,Z,`€`,`\\euro`,!0),G(q,Z,`€`,`\\euro`,!0),G(q,Z,`€`,`\\texteuro`),G(K,Z,`©`,`\\copyright`,!0),G(q,Z,`©`,`\\textcopyright`),G(K,Z,`⌀`,`\\diameter`,!0),G(q,Z,`⌀`,`\\diameter`),G(K,Z,`𝛤`,`\\varGamma`),G(K,Z,`𝛥`,`\\varDelta`),G(K,Z,`𝛩`,`\\varTheta`),G(K,Z,`𝛬`,`\\varLambda`),G(K,Z,`𝛯`,`\\varXi`),G(K,Z,`𝛱`,`\\varPi`),G(K,Z,`𝛴`,`\\varSigma`),G(K,Z,`𝛶`,`\\varUpsilon`),G(K,Z,`𝛷`,`\\varPhi`),G(K,Z,`𝛹`,`\\varPsi`),G(K,Z,`𝛺`,`\\varOmega`),G(q,Z,`𝛤`,`\\varGamma`),G(q,Z,`𝛥`,`\\varDelta`),G(q,Z,`𝛩`,`\\varTheta`),G(q,Z,`𝛬`,`\\varLambda`),G(q,Z,`𝛯`,`\\varXi`),G(q,Z,`𝛱`,`\\varPi`),G(q,Z,`𝛴`,`\\varSigma`),G(q,Z,`𝛶`,`\\varUpsilon`),G(q,Z,`𝛷`,`\\varPhi`),G(q,Z,`𝛹`,`\\varPsi`),G(q,Z,`𝛺`,`\\varOmega`);var Ix=`0123456789/@."`;for(let e=0;e<14;e++){let t=Ix.charAt(e);G(K,Z,t,t)}var Lx=`0123456789!@*()-=+";:?/.,`;for(let e=0;e<25;e++){let t=Lx.charAt(e);G(q,Z,t,t)}var Rx=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`;for(let e=0;e<52;e++){let t=Rx.charAt(e);G(K,Y,t,t),G(q,Z,t,t)}var zx=`ÇÐÞçþℂℍℕℙℚℝℤℎℏℊℋℌℐℑℒℓ℘ℛℜℬℰℱℳℭℨ`;for(let e=0;e<30;e++){let t=zx.charAt(e);G(K,Y,t,t),G(q,Z,t,t)}var Bx=``;for(let e=0;e<52;e++){Bx=String.fromCharCode(55349,56320+e),G(K,Y,Bx,Bx),G(q,Z,Bx,Bx),Bx=String.fromCharCode(55349,56372+e),G(K,Y,Bx,Bx),G(q,Z,Bx,Bx),Bx=String.fromCharCode(55349,56424+e),G(K,Y,Bx,Bx),G(q,Z,Bx,Bx),Bx=String.fromCharCode(55349,56580+e),G(K,Y,Bx,Bx),G(q,Z,Bx,Bx),Bx=String.fromCharCode(55349,56736+e),G(K,Y,Bx,Bx),G(q,Z,Bx,Bx),Bx=String.fromCharCode(55349,56788+e),G(K,Y,Bx,Bx),G(q,Z,Bx,Bx),Bx=String.fromCharCode(55349,56840+e),G(K,Y,Bx,Bx),G(q,Z,Bx,Bx),Bx=String.fromCharCode(55349,56944+e),G(K,Y,Bx,Bx),G(q,Z,Bx,Bx),Bx=String.fromCharCode(55349,56632+e),G(K,Y,Bx,Bx),G(q,Z,Bx,Bx);let t=Rx.charAt(e);Bx=String.fromCharCode(55349,56476+e),G(K,Y,t,Bx),G(q,Z,t,Bx)}for(let e=0;e<10;e++)Bx=String.fromCharCode(55349,57294+e),G(K,Y,Bx,Bx),G(q,Z,Bx,Bx),Bx=String.fromCharCode(55349,57314+e),G(K,Y,Bx,Bx),G(q,Z,Bx,Bx),Bx=String.fromCharCode(55349,57324+e),G(K,Y,Bx,Bx),G(q,Z,Bx,Bx),Bx=String.fromCharCode(55349,57334+e),G(K,Y,Bx,Bx),G(q,Z,Bx,Bx);function Vx(e,t,n){let r=[],i=[],a=[],o=0,s=0;for(;s<e.length;){for(;e[s]instanceof cx;)e.splice(s,1,...e[s].children);let n=e[s];if(n.attributes&&n.attributes.linebreak&&n.attributes.linebreak===`newline`){a.length>0&&i.push(new W(`mrow`,a)),i.push(n),a=[];let e=new W(`mtd`,i);e.style.textAlign=`left`,r.push(new W(`mtr`,[e])),i=[],s+=1}else{if(a.push(n),n.type&&n.type===`mo`&&n.children.length===1&&!(n.attributes.form&&n.attributes.form===`prefix`)&&!Object.prototype.hasOwnProperty.call(n.attributes,`movablelimits`)){let r=n.children[0].text;if(t===`=`&&r===`=`){if(o+=1,o>1){a.pop();let e=new W(`mrow`,a);i.push(e),a=[n]}}else if(t===`tex`){let t=s<e.length-1?e[s+1]:null,n=!0;if(!(t&&t.type===`mtext`&&t.attributes.linebreak&&t.attributes.linebreak===`nobreak`))for(let t=s+1;t<e.length;t++){let r=e[t];if(r.type&&r.type===`mspace`&&!(r.attributes.linebreak&&r.attributes.linebreak===`newline`))a.push(r),s+=1,r.attributes&&r.attributes.linebreak&&r.attributes.linebreak===`nobreak`&&(n=!1);else break}if(n){let e=new W(`mrow`,a);i.push(e),a=[]}}}s+=1}}if(a.length>0){let e=new W(`mrow`,a);i.push(e)}if(r.length>0){let e=new W(`mtd`,i);e.style.textAlign=`left`;let t=new W(`mtr`,[e]);r.push(t);let a=new W(`mtable`,r);return n||(a.setAttribute(`columnalign`,`left`),a.setAttribute(`rowspacing`,`0em`)),a}return _x(i)}var Hx=function(e,t,n){return Dx[t][e]&&Dx[t][e].replace&&e.charCodeAt(0)!==55349&&!(Object.prototype.hasOwnProperty.call(Fx,e)&&n&&(n.fontFamily&&n.fontFamily.slice(4,6)===`tt`||n.font&&n.font.slice(4,6)===`tt`))&&(e=Dx[t][e].replace),new vx(e)},Ux=(e,t)=>{if(e.children.length===0||e.children[e.children.length-1].type!==`mtext`){let n=new W(`mtext`,[new vx(t.children[0].text)]);e.children.push(n)}else e.children[e.children.length-1].children[0].text+=t.children[0].text},Wx=e=>{if(e.type!==`mrow`&&e.type!==`mstyle`||e.children.length===0)return e;let t=new W(`mrow`);for(let n=0;n<e.children.length;n++){let r=e.children[n];if(r.type===`mtext`&&Object.keys(r.attributes).length===0)Ux(t,r);else if(r.type===`mrow`){let e=!0;for(let t=0;t<r.children.length;t++)if(r.children[t].type!==`mtext`||Object.keys(r.attributes).length!==0){e=!1;break}if(e)for(let e=0;e<r.children.length;e++){let n=r.children[e];Ux(t,n)}else t.children.push(r)}else t.children.push(r)}for(let n=0;n<t.children.length;n++)if(t.children[n].type===`mtext`){let r=t.children[n];r.children[0].text.charAt(0)===` `&&(r.children[0].text=`\xA0`+r.children[0].text.slice(1));let i=r.children[0].text.length;i>0&&r.children[0].text.charAt(i-1)===` `&&(r.children[0].text=r.children[0].text.slice(0,-1)+`\xA0`);for(let[t,n]of Object.entries(e.attributes))r.attributes[t]=n}return t.children.length===1&&t.children[0].type===`mtext`?t.children[0]:t},Gx=function(e,t=!1){if(e.length===1&&!(e[0]instanceof cx))return e[0];if(!t){e[0]instanceof W&&e[0].type===`mo`&&!e[0].attributes.fence&&(e[0].attributes.lspace=`0em`,e[0].attributes.rspace=`0em`);let t=e.length-1;e[t]instanceof W&&e[t].type===`mo`&&!e[t].attributes.fence&&(e[t].attributes.lspace=`0em`,e[t].attributes.rspace=`0em`)}return new W(`mrow`,e)};function Kx(e){if(!e)return!1;if(e.type===`mi`&&e.children.length===1){let t=e.children[0];return t instanceof vx&&t.text===`.`}if(e.type===`mtext`&&e.children.length===1){let t=e.children[0];return t instanceof vx&&t.text===` `}if(e.type===`mo`&&e.children.length===1&&e.getAttribute(`separator`)===`true`&&e.getAttribute(`lspace`)===`0em`&&e.getAttribute(`rspace`)===`0em`){let t=e.children[0];return t instanceof vx&&t.text===`,`}return!1}var qx=(e,t)=>{let n=e[t],r=e[t+1];return n.type===`atom`&&n.text===`,`&&n.loc&&r.loc&&n.loc.end===r.loc.start},Jx=e=>e.type===`atom`&&e.family===`rel`||e.type===`mclass`&&e.mclass===`mrel`,Yx=function(e,t,n=!1){if(!n&&e.length===1){let n=Zx(e[0],t);return n instanceof W&&n.type===`mo`&&(n.setAttribute(`lspace`,`0em`),n.setAttribute(`rspace`,`0em`)),[n]}let r=[],i=[],a;for(let n=0;n<e.length;n++)i.push(Zx(e[n],t));for(let t=0;t<i.length;t++){let n=i[t];if(t<e.length-1&&Jx(e[t])&&Jx(e[t+1])&&n.setAttribute(`rspace`,`0em`),t>0&&Jx(e[t])&&Jx(e[t-1])&&n.setAttribute(`lspace`,`0em`),n.type===`mn`&&a&&a.type===`mn`)a.children.push(...n.children);else if(Kx(n)&&a&&a.type===`mn`)a.children.push(...n.children);else if(a&&a.type===`mn`&&t<i.length-1&&i[t+1].type===`mn`&&qx(e,t))a.children.push(...n.children);else{if(n.type===`mn`&&Kx(a))n.children=[...a.children,...n.children],r.pop();else if((n.type===`msup`||n.type===`msub`)&&n.children.length>=1&&a&&(a.type===`mn`||Kx(a))){let e=n.children[0];e instanceof W&&e.type===`mn`&&a&&(e.children=[...a.children,...e.children],r.pop())}r.push(n),a=n}}return r},Xx=function(e,t,n=!1){return Gx(Yx(e,t,n),n)},Zx=function(e,t){if(!e)return new W(`mrow`);if(rx[e.type])return rx[e.type](e,t);throw new U(`Got group of unknown type: '`+e.type+`'`)},Qx=e=>new W(`mtd`,[],[],{padding:`0`,width:`50%`}),$x=[`mrow`,`mtd`,`mtable`,`mtr`],eS=e=>{for(let t of e.children)if(t.type&&$x.includes(t.type)){if(t.classes&&t.classes[0]===`tml-label`)return t.label;{let e=eS(t);if(e)return e}}else if(!t.type){let e=eS(t);if(e)return e}},tS=(e,t,n,r)=>{t=Xx(t[0].body,n),t=Wx(t),t.classes.push(`tml-tag`);let i=eS(e);e=new W(`mtd`,[e]);let a=[Qx(),e,Qx()];a[r?0:2].children.push(t);let o=new W(`mtr`,a,[`tml-tageqn`]);i&&o.setAttribute(`id`,i);let s=new W(`mtable`,[o]);return s.style.width=`100%`,s.setAttribute(`displaystyle`,`true`),s};function nS(e,t,n,r){let i=null;e.length===1&&e[0].type===`tag`&&(i=e[0].tag,e=e[0].body);let a=Yx(e,n);if(a.length===1&&a[0]instanceof hx)return a[0];let o=r.displayMode||r.annotate?`none`:r.wrap,s=a.length===0?null:a[0],c=a.length===1&&i===null&&s instanceof W?a[0]:Vx(a,o,r.displayMode);if(i&&(c=tS(c,i,n,r.leqno)),r.annotate){let e=new W(`annotation`,[new vx(t)]);e.setAttribute(`encoding`,`application/x-tex`),c=new W(`semantics`,[c,e])}let l=new W(`math`,[c]);return r.xml&&l.setAttribute(`xmlns`,`http://www.w3.org/1998/Math/MathML`),r.displayMode&&(l.setAttribute(`display`,`block`),l.style.display=`block math`,l.classes=[`tml-display`]),l}var rS=`DHKLUcegorsuvxyzΠΥΨαδηιμνοτυχϵ`,iS=`BCEGIMNOPQRSTXZlpqtwΓΘΞΣΦΩβεζθξρςφψϑϕϱ`,aS=`AFJdfΔΛ`,oS=(e,t)=>{let n=e.isStretchy?wx(e):new W(`mo`,[Hx(e.label,e.mode)]);e.isStretchy||n.setAttribute(`stretchy`,`false`),e.label!==`\\vec`&&(n.style.mathDepth=`0`);let r=e.label===`\\c`?`munder`:`mover`,i=cS.has(e.label);if(r===`mover`&&e.mode===`math`&&!e.isStretchy&&e.base.text&&e.base.text.length===1){let t=e.base.text,r=e.label===`\\vec`,a=r===`\\vec`?`-vec`:``;r&&n.classes.push(`tml-vec`);let o=r?`-vec`:i?`-acc`:``;rS.indexOf(t)>-1?(n.classes.push(`chr-sml${a}`),n.classes.push(`wbk-sml${o}`)):iS.indexOf(t)>-1?(n.classes.push(`chr-med${a}`),n.classes.push(`wbk-med${o}`)):aS.indexOf(t)>-1?(n.classes.push(`chr-lrg${a}`),n.classes.push(`wbk-lrg${o}`)):r?n.classes.push(`wbk-vec`):i&&n.classes.push(`wbk-acc`)}else i&&n.classes.push(`wbk-acc`);return new W(r,[Zx(e.base,t),n])},sS=new Set([`\\acute`,`\\check`,`\\grave`,`\\ddot`,`\\dddot`,`\\ddddot`,`\\tilde`,`\\bar`,`\\breve`,`\\check`,`\\hat`,`\\vec`,`\\dot`,`\\mathring`]),cS=new Set([`\\acute`,`\\bar`,`\\breve`,`\\check`,`\\dot`,`\\ddot`,`\\grave`,`\\hat`,`\\mathring`,"\\`",`\\'`,`\\^`,`\\=`,`\\u`,`\\.`,`\\"`,`\\r`,`\\H`,`\\v`]),lS={"\\`":`̀`,"\\'":`́`,"\\^":`̂`,"\\~":`̃`,"\\=":`̄`,"\\u":`̆`,"\\.":`̇`,'\\"':`̈`,"\\r":`̊`,"\\H":`̋`,"\\v":`̌`,"\\c":`̧`};ix({type:`accent`,names:[`\\acute`,`\\grave`,`\\ddot`,`\\dddot`,`\\ddddot`,`\\tilde`,`\\bar`,`\\breve`,`\\check`,`\\hat`,`\\vec`,`\\dot`,`\\mathring`,`\\overparen`,`\\widecheck`,`\\widehat`,`\\wideparen`,`\\widetilde`,`\\overrightarrow`,`\\overleftarrow`,`\\Overrightarrow`,`\\overleftrightarrow`,`\\overgroup`,`\\overleftharpoon`,`\\overrightharpoon`],props:{numArgs:1},handler:(e,t)=>{let n=ox(t[0]),r=!sS.has(e.funcName);return{type:`accent`,mode:e.parser.mode,label:e.funcName,isStretchy:r,base:n}},mathmlBuilder:oS}),ix({type:`accent`,names:[`\\'`,"\\`",`\\^`,`\\~`,`\\=`,`\\c`,`\\u`,`\\.`,`\\"`,`\\r`,`\\H`,`\\v`],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:[`primitive`]},handler:(e,t)=>{let n=ox(t[0]),r=e.parser.mode;return r===`math`&&e.parser.settings.strict&&console.log(`Temml parse error: Command ${e.funcName} is invalid in math mode.`),r===`text`&&n.text&&n.text.length===1&&e.funcName in lS&&Qb.indexOf(n.text)>-1?{type:`textord`,mode:`text`,text:n.text+lS[e.funcName]}:e.funcName===`\\c`&&r===`text`&&n.text&&n.text.length===1?{type:`textord`,mode:`text`,text:n.text+`̧`}:{type:`accent`,mode:r,label:e.funcName,isStretchy:!1,base:n}},mathmlBuilder:oS}),ix({type:`accentUnder`,names:[`\\underleftarrow`,`\\underrightarrow`,`\\underleftrightarrow`,`\\undergroup`,`\\underparen`,`\\utilde`],props:{numArgs:1},handler:({parser:e,funcName:t},n)=>{let r=n[0];return{type:`accentUnder`,mode:e.mode,label:t,base:r}},mathmlBuilder:(e,t)=>{let n=wx(e);return n.style[`math-depth`]=0,new W(`munder`,[Zx(e.base,t),n])}});var uS={pt:800/803,pc:9600/803,dd:1238/1157*800/803,cc:14856/1157*800/803,nd:685/642*800/803,nc:1370/107*800/803,sp:1/65536*800/803,mm:25.4/72,cm:2.54/72,in:1/72,px:96/72},dS=[`em`,`ex`,`mu`,`pt`,`mm`,`cm`,`in`,`px`,`bp`,`pc`,`dd`,`cc`,`nd`,`nc`,`sp`],fS=function(e){return typeof e!=`string`&&(e=e.unit),dS.indexOf(e)>-1},pS=e=>[1,.7,.5][Math.max(e-1,0)],mS=function(e,t){let n=e.number;if(t.maxSize[0]<0&&n>0)return{number:0,unit:`em`};let r=e.unit;switch(r){case`mm`:case`cm`:case`in`:case`px`:return n*uS[r]>t.maxSize[1]?{number:t.maxSize[1],unit:`pt`}:{number:n,unit:r};case`em`:case`ex`:return r===`ex`&&(n*=.431),n=Math.min(n/pS(t.level),t.maxSize[0]),{number:Zb(n),unit:`em`};case`bp`:return n>t.maxSize[1]&&(n=t.maxSize[1]),{number:n,unit:`pt`};case`pt`:case`pc`:case`dd`:case`cc`:case`nd`:case`nc`:case`sp`:return n=Math.min(n*uS[r],t.maxSize[1]),{number:Zb(n),unit:`pt`};case`mu`:return n=Math.min(n/18,t.maxSize[0]),{number:Zb(n),unit:`em`};default:throw new U(`Invalid unit: '`+r+`'`)}},hS=e=>{let t=new W(`mspace`);return t.setAttribute(`width`,e+`em`),t},gS=(e,t=.3,n=0,r=!1)=>{if(e==null&&n===0)return hS(t);let i=e?[e]:[];if(t!==0&&i.unshift(hS(t)),n>0&&i.push(hS(n)),r){let e=new W(`mpadded`,i);return e.setAttribute(`height`,`0.1px`),e}return new W(`mrow`,i)},_S=(e,t)=>Number(e)/pS(t),vS=(e,t,n,r)=>{let i=Sx(e),a=e.slice(1,3)===`eq`,o=e.charAt(1)===`x`?`1.75`:e.slice(2,4)===`cd`?`3.0`:a?`1.0`:`2.0`;i.setAttribute(`lspace`,`0`),i.setAttribute(`rspace`,a?`0.5em`:`0`);let s=r.withLevel(r.level<2?2:3),c=_S(o,s.level),l=_S(o,3),u=gS(null,c.toFixed(4),0),d=gS(null,l.toFixed(4),0),f=_S(a?0:.3,s.level).toFixed(4),p,m,h=t&&t.body&&(t.body.body||t.body.length>0);if(h){let n=Zx(t,s);n=gS(n,f,f,e===`\\\\cdrightarrow`||e===`\\\\cdleftarrow`),p=new W(`mover`,[n,d])}let g=n&&n.body&&(n.body.body||n.body.length>0);if(g){let e=Zx(n,s);e=gS(e,f,f),m=new W(`munder`,[e,d])}let _;return _=!h&&!g?new W(`mover`,[i,u]):h&&g?new W(`munderover`,[i,m,p]):h?new W(`mover`,[i,p]):new W(`munder`,[i,m]),o===`3.0`&&(_.style.height=`1em`),_.setAttribute(`accent`,`false`),_};ix({type:`xArrow`,names:`\\xleftarrow.\\xrightarrow.\\xLeftarrow.\\xRightarrow.\\xleftrightarrow.\\xLeftrightarrow.\\xhookleftarrow.\\xhookrightarrow.\\xmapsto.\\xrightharpoondown.\\xrightharpoonup.\\xleftharpoondown.\\xleftharpoonup.\\xlongequal.\\xtwoheadrightarrow.\\xtwoheadleftarrow.\\xtofrom.\\xleftrightharpoons.\\xrightleftharpoons.\\yields.\\yieldsLeft.\\mesomerism.\\longrightharpoonup.\\longleftharpoondown.\\yieldsLeftRight.\\chemequilibrium.\\\\cdrightarrow.\\\\cdleftarrow.\\\\cdlongequal`.split(`.`),props:{numArgs:1,numOptionalArgs:1},handler({parser:e,funcName:t},n,r){return{type:`xArrow`,mode:e.mode,name:t,body:n[0],below:r[0]}},mathmlBuilder(e,t){let n=[vS(e.name,e.body,e.below,t)];return n.unshift(hS(.2778)),n.push(hS(.2778)),new W(`mrow`,n)}});var yS={"\\equilibriumRight":[`\\longrightharpoonup`,`\\eqleftharpoondown`],"\\equilibriumLeft":[`\\eqrightharpoonup`,`\\longleftharpoondown`]};ix({type:`stackedArrow`,names:[`\\equilibriumRight`,`\\equilibriumLeft`],props:{numArgs:1,numOptionalArgs:1},handler({parser:e,funcName:t},n,r){let i=n[0]?{type:`hphantom`,mode:e.mode,body:n[0]}:null,a=r[0]?{type:`hphantom`,mode:e.mode,body:r[0]}:null;return{type:`stackedArrow`,mode:e.mode,name:t,body:n[0],upperArrowBelow:a,lowerArrowBody:i,below:r[0]}},mathmlBuilder(e,t){let n=yS[e.name][0],r=yS[e.name][1],i=vS(n,e.body,e.upperArrowBelow,t),a=vS(r,e.lowerArrowBody,e.below,t),o,s=new W(`mpadded`,[i]);if(s.setAttribute(`voffset`,`0.3em`),s.setAttribute(`height`,`+0.3em`),s.setAttribute(`depth`,`-0.3em`),e.name===`\\equilibriumLeft`){let e=new W(`mpadded`,[a]);e.setAttribute(`width`,`0.5em`),o=new W(`mpadded`,[hS(.2778),e,s,hS(.2778)])}else s.setAttribute(`width`,e.name===`\\equilibriumRight`?`0.5em`:`0`),o=new W(`mpadded`,[hS(.2778),s,a,hS(.2778)]);return o.setAttribute(`voffset`,`-0.18em`),o.setAttribute(`height`,`-0.18em`),o.setAttribute(`depth`,`+0.18em`),o}});var bS={};function xS({type:e,names:t,props:n,handler:r,mathmlBuilder:i}){let a={type:e,numArgs:n.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:r};for(let e=0;e<t.length;++e)bS[t[e]]=a;i&&(rx[e]=i)}function SS(e,t){if(!e||e.type!==t)throw Error(`Expected node of type ${t}, but got `+(e?`node of type ${e.type}`:String(e)));return e}function CS(e){let t=wS(e);if(!t)throw Error(`Expected node of symbol group type, but got `+(e?`node of type ${e.type}`:String(e)));return t}function wS(e){return e&&(e.type===`atom`||e.type===`delimiter`||Object.prototype.hasOwnProperty.call(Ex,e.type))?e:null}var TS={">":`\\\\cdrightarrow`,"<":`\\\\cdleftarrow`,"=":`\\\\cdlongequal`,A:`\\uparrow`,V:`\\downarrow`,"|":`\\Vert`,".":`no arrow`},ES=()=>({type:`styling`,body:[],mode:`math`,scriptLevel:`display`}),DS=e=>e.type===`textord`&&e.text===`@`,OS=(e,t)=>(e.type===`mathord`||e.type===`atom`)&&e.text===t;function kS(e,t,n){let r=TS[e];switch(r){case`\\\\cdrightarrow`:case`\\\\cdleftarrow`:return n.callFunction(r,[t[0]],[t[1]]);case`\\uparrow`:case`\\downarrow`:{let e=n.callFunction(`\\\\cdleft`,[t[0]],[]),i={type:`atom`,text:r,mode:`math`,family:`rel`},a={type:`ordgroup`,mode:`math`,body:[e,n.callFunction(`\\Big`,[i],[]),n.callFunction(`\\\\cdright`,[t[1]],[])],semisimple:!0};return n.callFunction(`\\\\cdparent`,[a],[])}case`\\\\cdlongequal`:return n.callFunction(`\\\\cdlongequal`,[],[]);case`\\Vert`:return n.callFunction(`\\Big`,[{type:`textord`,text:`\\Vert`,mode:`math`}],[]);default:return{type:`textord`,text:` `,mode:`math`}}}function AS(e){let t=[];for(e.gullet.beginGroup(),e.gullet.macros.set(`\\cr`,`\\\\\\relax`),e.gullet.beginGroup();;){t.push(e.parseExpression(!1,`\\\\`)),e.gullet.endGroup(),e.gullet.beginGroup();let n=e.fetch().text;if(n===`&`||n===`\\\\`)e.consume();else if(n===`\\end`){t[t.length-1].length===0&&t.pop();break}else throw new U(`Expected \\\\ or \\cr or \\end`,e.nextToken)}let n=[],r=[n];for(let i=0;i<t.length;i++){let a=t[i],o=ES();for(let t=0;t<a.length;t++)if(!DS(a[t]))o.body.push(a[t]);else{n.push(o),t+=1;let r=CS(a[t]).text,i=[,,];if(i[0]={type:`ordgroup`,mode:`math`,body:[]},i[1]={type:`ordgroup`,mode:`math`,body:[]},!(`=|.`.indexOf(r)>-1)){if(`<>AV`.indexOf(r)>-1)for(let e=0;e<2;e++){let n=!0;for(let o=t+1;o<a.length;o++){if(OS(a[o],r)){n=!1,t=o;break}if(DS(a[o]))throw new U(`Missing a `+r+` character to complete a CD arrow.`,a[o]);i[e].body.push(a[o])}if(n)throw new U(`Missing a `+r+` character to complete a CD arrow.`,a[t])}else throw new U(`Expected one of "<>AV=|." after @.`)}let s=kS(r,i,e);n.push(s),o=ES()}i%2==0?n.push(o):n.shift(),n=[],r.push(n)}return r.pop(),e.gullet.endGroup(),e.gullet.endGroup(),{type:`array`,mode:`math`,body:r,tags:null,labels:Array(r.length+1).fill(``),envClasses:[`jot`,`cd`],cols:[],hLinesBeforeRow:Array(r.length+1).fill([])}}ix({type:`cdlabel`,names:[`\\\\cdleft`,`\\\\cdright`],props:{numArgs:1},handler({parser:e,funcName:t},n){return{type:`cdlabel`,mode:e.mode,side:t.slice(4),label:n[0]}},mathmlBuilder(e,t){if(e.label.body.length===0)return new W(`mrow`,t);let n=Zx(e.label,t);e.side===`left`&&n.classes.push(`tml-shift-left`);let r=new W(`mtd`,[n]);r.style.padding=`0`;let i=new W(`mpadded`,[new W(`mtable`,[new W(`mtr`,[r])])]);return i.setAttribute(`width`,`0.1px`),i.setAttribute(`displaystyle`,`false`),i.setAttribute(`scriptlevel`,`1`),i}}),ix({type:`cdlabelparent`,names:[`\\\\cdparent`],props:{numArgs:1},handler({parser:e},t){return{type:`cdlabelparent`,mode:e.mode,fragment:t[0]}},mathmlBuilder(e,t){return new W(`mrow`,[Zx(e.fragment,t)])}});var jS=e=>({type:`ordgroup`,mode:`math`,body:e,semisimple:!0}),MS=(e,t)=>({type:t,mode:`math`,body:jS(e)}),NS=(e,t)=>{let n=e.body;n[0].shift();let r=Array(n.length-1).fill().map(()=>[]);for(let e=1;e<n.length;e++){r[e-1].push(n[e].shift());let t=[];for(let r=0;r<n[e].length;r++)t.push(n[e][r]);r[e-1].push(MS(t,`vphantom`))}let i=Array(n.length).fill().map(()=>[]);for(let e=0;e<n[0].length;e++)i[0].push(n[0][e]);for(let e=1;e<n.length;e++)for(let t=0;t<n[0].length;t++)i[e].push(MS(n[e][t].body,`hphantom`));for(let e=0;e<n[0].length;e++)n[0][e]=MS(n[0][e].body,`hphantom`);let a={type:`array`,mode:`math`,body:r,cols:[{type:`align`,align:`c`}],rowGaps:Array(r.length-1).fill(null),hLinesBeforeRow:Array(r.length+1).fill().map(()=>[]),envClasses:[],scriptLevel:`text`,arraystretch:1,labels:Array(r.length).fill(``),arraycolsep:{number:.04,unit:`em`}},o={type:`styling`,mode:`math`,scriptLevel:`text`,body:[{type:`array`,mode:`math`,body:i,cols:Array(i.length).fill({type:`align`,align:`c`}),rowGaps:Array(i.length-1).fill(null),hLinesBeforeRow:Array(i.length+1).fill().map(()=>[]),envClasses:[],scriptLevel:`text`,arraystretch:1,labels:Array(i.length).fill(``),arraycolsep:null}]};return jS([a,{type:`supsub`,mode:`math`,stack:!0,base:{type:`op`,mode:`math`,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!0,symbol:!1,suppressBaseShift:!0,body:[{type:`leftright`,mode:`math`,body:[e],left:t?t[0]:`(`,right:t?t[1]:`)`,rightColor:void 0}]},sup:o,sub:null}])},PS=class e{constructor(e,t,n){this.lexer=e,this.start=t,this.end=n}static range(t,n){return n?!t||!t.loc||!n.loc||t.loc.lexer!==n.loc.lexer?null:new e(t.loc.lexer,t.loc.start,n.loc.end):t&&t.loc}},FS=class e{constructor(e,t){this.text=e,this.loc=t}range(t,n){return new e(n,PS.range(this,t))}},IS={DISPLAY:0,TEXT:1,SCRIPT:2,SCRIPTSCRIPT:3},LS=Object.create(null);function Q(e,t){LS[e]=t}var RS=LS;Q(`\\noexpand`,function(e){let t=e.popToken();return e.isExpandable(t.text)&&(t.noexpand=!0,t.treatAsRelax=!0),{tokens:[t],numArgs:0}}),Q(`\\expandafter`,function(e){let t=e.popToken();return e.expandOnce(!0),{tokens:[t],numArgs:0}}),Q(`\\@firstoftwo`,function(e){return{tokens:e.consumeArgs(2)[0],numArgs:0}}),Q(`\\@secondoftwo`,function(e){return{tokens:e.consumeArgs(2)[1],numArgs:0}}),Q(`\\@ifnextchar`,function(e){let t=e.consumeArgs(3);e.consumeSpaces();let n=e.future();return t[0].length===1&&t[0][0].text===n.text?{tokens:t[1],numArgs:0}:{tokens:t[2],numArgs:0}}),Q(`\\@ifstar`,`\\@ifnextchar *{\\@firstoftwo{#1}}`),Q(`\\TextOrMath`,function(e){let t=e.consumeArgs(2);return e.mode===`text`?{tokens:t[0],numArgs:0}:{tokens:t[1],numArgs:0}});var zS=e=>{let t=``;for(let n=e.length-1;n>-1;n--)t+=e[n].text;return t},BS={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15},VS=e=>{let t=e.future().text;return t===`EOF`?[null,``]:[BS[t.charAt(0)],t]},HS=(e,t,n)=>{for(let r=1;r<t.length;r++){let i=BS[t.charAt(r)];e*=n,e+=i}return e};Q(`\\char`,function(e){let t=e.popToken(),n,r=``;if(t.text===`'`)n=8,t=e.popToken();else if(t.text===`"`)n=16,t=e.popToken();else if(t.text==="`"){if(t=e.popToken(),t.text[0]===`\\`)r=t.text.charCodeAt(1);else if(t.text===`EOF`)throw new U("\\char` missing argument");else r=t.text.charCodeAt(0)}else n=10;if(n){let i=t.text;if(r=BS[i.charAt(0)],r==null||r>=n)throw new U(`Invalid base-${n} digit ${t.text}`);r=HS(r,i,n);let a;for([a,i]=VS(e);a!=null&&a<n;)r*=n,r+=a,r=HS(r,i,n),e.popToken(),[a,i]=VS(e)}return`\\@char{${r}}`});function US(e){let t=e.consumeArgs(1)[0],n=``,r=t[t.length-1].loc.start;for(let e=t.length-1;e>=0;e--){let i=t[e].loc.start;i>r&&(n+=` `,r=i),n+=t[e].text,r+=t[e].text.length}return n}Q(`\\surd`,`\\sqrt{\\vphantom{|}}`),Q(`⊕`,`\\oplus`),Q(`\\long`,``),Q(`\\bgroup`,`{`),Q(`\\egroup`,`}`),Q(`~`,`\\nobreakspace`),Q(`\\lq`,"`"),Q(`\\rq`,`'`),Q(`\\aa`,`\\r a`),Q(`\\Bbbk`,`\\Bbb{k}`),Q(`\\mathstrut`,`\\vphantom{(}`),Q(`\\underbar`,`\\underline{\\text{#1}}`),Q(`\\vdots`,`{\\varvdots\\rule{0pt}{15pt}}`),Q(`⋮`,`\\vdots`),Q(`\\arraystretch`,`1`),Q(`\\arraycolsep`,`6pt`),Q(`\\substack`,`\\begin{subarray}{c}#1\\end{subarray}`),Q(`\\iff`,`\\DOTSB\\;\\Longleftrightarrow\\;`),Q(`\\implies`,`\\DOTSB\\;\\Longrightarrow\\;`),Q(`\\impliedby`,`\\DOTSB\\;\\Longleftarrow\\;`);var WS={",":`\\dotsc`,"\\not":`\\dotsb`,"+":`\\dotsb`,"=":`\\dotsb`,"<":`\\dotsb`,">":`\\dotsb`,"-":`\\dotsb`,"*":`\\dotsb`,":":`\\dotsb`,"\\DOTSB":`\\dotsb`,"\\coprod":`\\dotsb`,"\\bigvee":`\\dotsb`,"\\bigwedge":`\\dotsb`,"\\biguplus":`\\dotsb`,"\\bigcap":`\\dotsb`,"\\bigcup":`\\dotsb`,"\\prod":`\\dotsb`,"\\sum":`\\dotsb`,"\\bigotimes":`\\dotsb`,"\\bigoplus":`\\dotsb`,"\\bigodot":`\\dotsb`,"\\bigsqcap":`\\dotsb`,"\\bigsqcup":`\\dotsb`,"\\bigtimes":`\\dotsb`,"\\And":`\\dotsb`,"\\longrightarrow":`\\dotsb`,"\\Longrightarrow":`\\dotsb`,"\\longleftarrow":`\\dotsb`,"\\Longleftarrow":`\\dotsb`,"\\longleftrightarrow":`\\dotsb`,"\\Longleftrightarrow":`\\dotsb`,"\\mapsto":`\\dotsb`,"\\longmapsto":`\\dotsb`,"\\hookrightarrow":`\\dotsb`,"\\doteq":`\\dotsb`,"\\mathbin":`\\dotsb`,"\\mathrel":`\\dotsb`,"\\relbar":`\\dotsb`,"\\Relbar":`\\dotsb`,"\\xrightarrow":`\\dotsb`,"\\xleftarrow":`\\dotsb`,"\\DOTSI":`\\dotsi`,"\\int":`\\dotsi`,"\\oint":`\\dotsi`,"\\iint":`\\dotsi`,"\\iiint":`\\dotsi`,"\\iiiint":`\\dotsi`,"\\DOTSX":`\\dotsx`};Q(`\\dots`,function(e){let t=`\\dotso`,n=e.expandAfterFuture().text;return n in WS?t=WS[n]:(n.slice(0,4)===`\\not`||n in Dx.math&&[`bin`,`rel`].includes(Dx.math[n].group))&&(t=`\\dotsb`),t}),Q(`\\dotsb`,`\\cdots`),Q(`\\dotsm`,`\\cdots`),Q(`\\dotsi`,`\\!\\cdots`),Q(`\\idotsint`,`\\int\\!\\cdots\\!\\int`),Q(`\\dotsx`,`\\ldots\\,`),Q(`\\DOTSI`,`\\relax`),Q(`\\DOTSB`,`\\relax`),Q(`\\DOTSX`,`\\relax`),Q(`\\tmspace`,`\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax`),Q(`\\,`,`{\\tmspace+{3mu}{.1667em}}`),Q(`\\thinspace`,`\\,`),Q(`\\>`,`\\mskip{4mu}`),Q(`\\:`,`{\\tmspace+{4mu}{.2222em}}`),Q(`\\medspace`,`\\:`),Q(`\\;`,`{\\tmspace+{5mu}{.2777em}}`),Q(`\\thickspace`,`\\;`),Q(`\\!`,`{\\tmspace-{3mu}{.1667em}}`),Q(`\\negthinspace`,`\\!`),Q(`\\negmedspace`,`{\\tmspace-{4mu}{.2222em}}`),Q(`\\negthickspace`,`{\\tmspace-{5mu}{.277em}}`),Q(`\\enspace`,`\\kern.5em `),Q(`\\enskip`,`\\hskip.5em\\relax`),Q(`\\quad`,`\\hskip1em\\relax`),Q(`\\qquad`,`\\hskip2em\\relax`),Q(`\\AA`,`\\TextOrMath{\\Angstrom}{\\mathring{A}}\\relax`),Q(`\\tag`,`\\@ifstar\\tag@literal\\tag@paren`),Q(`\\tag@paren`,`\\tag@literal{({#1})}`),Q(`\\tag@literal`,e=>{if(e.macros.get(`\\df@tag`))throw new U(`Multiple \\tag`);return`\\gdef\\df@tag{\\text{#1}}`}),Q(`\\notag`,`\\nonumber`),Q(`\\nonumber`,`\\gdef\\@eqnsw{0}`),Q(`\\bmod`,`\\mathbin{\\text{mod}}`),Q(`\\pod`,`\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)`),Q(`\\pmod`,`\\pod{{\\rm mod}\\mkern6mu#1}`),Q(`\\mod`,`\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1`),Q(`\\newline`,`\\\\\\relax`),Q(`\\TeX`,`\\textrm{T}\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125em\\textrm{X}`),Q(`\\LaTeX`,`\\textrm{L}\\kern-.35em\\raisebox{0.2em}{\\scriptstyle A}\\kern-.15em\\TeX`),Q(`\\Temml`,`\\textrm{T}\\kern-0.2em\\lower{0.2em}{\\textrm{E}}\\kern-0.08em{\\textrm{M}\\kern-0.08em\\raise{0.2em}\\textrm{M}\\kern-0.08em\\textrm{L}}`),Q(`\\hspace`,`\\@ifstar\\@hspacer\\@hspace`),Q(`\\@hspace`,`\\hskip #1\\relax`),Q(`\\@hspacer`,`\\rule{0pt}{0pt}\\hskip #1\\relax`),Q(`\\colon`,`\\mathpunct{\\char"3a}`),Q(`\\prescript`,`\\pres@cript{^{#1}_{#2}}{}{#3}`),Q(`\\ordinarycolon`,`\\char"3a`),Q(`\\vcentcolon`,`\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}}`),Q(`\\coloneq`,`\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2212}`),Q(`\\Coloneq`,`\\mathrel{\\char"2237\\char"2212}`),Q(`\\Eqqcolon`,`\\mathrel{\\char"3d\\char"2237}`),Q(`\\Eqcolon`,`\\mathrel{\\char"2212\\char"2237}`),Q(`\\colonapprox`,`\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"2248}`),Q(`\\Colonapprox`,`\\mathrel{\\char"2237\\char"2248}`),Q(`\\colonsim`,`\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}`),Q(`\\Colonsim`,`\\mathrel{\\raisebox{0.035em}{\\ordinarycolon}\\char"223c}`),Q(`\\ratio`,`\\vcentcolon`),Q(`\\coloncolon`,`\\dblcolon`),Q(`\\colonequals`,`\\coloneqq`),Q(`\\coloncolonequals`,`\\Coloneqq`),Q(`\\equalscolon`,`\\eqqcolon`),Q(`\\equalscoloncolon`,`\\Eqqcolon`),Q(`\\colonminus`,`\\coloneq`),Q(`\\coloncolonminus`,`\\Coloneq`),Q(`\\minuscolon`,`\\eqcolon`),Q(`\\minuscoloncolon`,`\\Eqcolon`),Q(`\\coloncolonapprox`,`\\Colonapprox`),Q(`\\coloncolonsim`,`\\Colonsim`),Q(`\\notni`,"\\mathrel{\\char`∌}"),Q(`\\limsup`,`\\DOTSB\\operatorname*{lim\\,sup}`),Q(`\\liminf`,`\\DOTSB\\operatorname*{lim\\,inf}`),Q(`\\injlim`,`\\DOTSB\\operatorname*{inj\\,lim}`),Q(`\\projlim`,`\\DOTSB\\operatorname*{proj\\,lim}`),Q(`\\varlimsup`,`\\DOTSB\\operatorname*{\\overline{\\text{lim}}}`),Q(`\\varliminf`,`\\DOTSB\\operatorname*{\\underline{\\text{lim}}}`),Q(`\\varinjlim`,`\\DOTSB\\operatorname*{\\underrightarrow{\\text{lim}}}`),Q(`\\varprojlim`,`\\DOTSB\\operatorname*{\\underleftarrow{\\text{lim}}}`),Q(`\\centerdot`,`{\\medspace\\rule{0.167em}{0.189em}\\medspace}`),Q(`\\argmin`,`\\DOTSB\\operatorname*{arg\\,min}`),Q(`\\argmax`,`\\DOTSB\\operatorname*{arg\\,max}`),Q(`\\plim`,`\\DOTSB\\operatorname*{plim}`),Q(`\\leftmodels`,`\\mathop{\\reflectbox{$\\models$}}`),Q(`\\bra`,`\\mathinner{\\langle{#1}|}`),Q(`\\ket`,`\\mathinner{|{#1}\\rangle}`),Q(`\\braket`,`\\mathinner{\\langle{#1}\\rangle}`),Q(`\\Bra`,`\\left\\langle#1\\right|`),Q(`\\Ket`,`\\left|#1\\right\\rangle`);var GS=(e,t)=>{let n=`}\\,\\middle${t[0]===`|`?`\\vert`:`\\Vert`}\\,{`;return e.slice(0,t.index)+n+e.slice(t.index+t[0].length)};Q(`\\Braket`,function(e){let t=US(e),n=/\|\||\||\\\|/g,r;for(;(r=n.exec(t))!==null;)t=GS(t,r);return`\\left\\langle{`+t+`}\\right\\rangle`}),Q(`\\Set`,function(e){let t=US(e),n=/\|\||\||\\\|/.exec(t);return n&&(t=GS(t,n)),`\\left\\{\\:{`+t+`}\\:\\right\\}`}),Q(`\\set`,function(e){return`\\{{`+US(e).replace(/\|/,`}\\mid{`)+`}\\}`}),Q(`\\angln`,`{\\angl n}`),Q(`\\odv`,`\\@ifstar\\odv@next\\odv@numerator`),Q(`\\odv@numerator`,`\\frac{\\mathrm{d}#1}{\\mathrm{d}#2}`),Q(`\\odv@next`,`\\frac{\\mathrm{d}}{\\mathrm{d}#2}#1`),Q(`\\pdv`,`\\@ifstar\\pdv@next\\pdv@numerator`);var KS=e=>{let t=e[0][0].text,n=zS(e[1]).split(`,`),r=String(n.length),i=r===`1`?`\\partial`:`\\partial^${r}`,a=``;return n.map(e=>{a+=`\\partial `+e.trim()+`\\,`}),[t,i,a.replace(/\\,$/,``)]};Q(`\\pdv@numerator`,function(e){let[t,n,r]=KS(e.consumeArgs(2));return`\\frac{${n} ${t}}{${r}}`}),Q(`\\pdv@next`,function(e){let[t,n,r]=KS(e.consumeArgs(2));return`\\frac{${n}}{${r}} ${t}`}),Q(`\\upalpha`,`\\up@greek{\\alpha}`),Q(`\\upbeta`,`\\up@greek{\\beta}`),Q(`\\upgamma`,`\\up@greek{\\gamma}`),Q(`\\updelta`,`\\up@greek{\\delta}`),Q(`\\upepsilon`,`\\up@greek{\\epsilon}`),Q(`\\upzeta`,`\\up@greek{\\zeta}`),Q(`\\upeta`,`\\up@greek{\\eta}`),Q(`\\uptheta`,`\\up@greek{\\theta}`),Q(`\\upiota`,`\\up@greek{\\iota}`),Q(`\\upkappa`,`\\up@greek{\\kappa}`),Q(`\\uplambda`,`\\up@greek{\\lambda}`),Q(`\\upmu`,`\\up@greek{\\mu}`),Q(`\\upnu`,`\\up@greek{\\nu}`),Q(`\\upxi`,`\\up@greek{\\xi}`),Q(`\\upomicron`,`\\up@greek{\\omicron}`),Q(`\\uppi`,`\\up@greek{\\pi}`),Q(`\\upalpha`,`\\up@greek{\\alpha}`),Q(`\\uprho`,`\\up@greek{\\rho}`),Q(`\\upsigma`,`\\up@greek{\\sigma}`),Q(`\\uptau`,`\\up@greek{\\tau}`),Q(`\\upupsilon`,`\\up@greek{\\upsilon}`),Q(`\\upphi`,`\\up@greek{\\phi}`),Q(`\\upchi`,`\\up@greek{\\chi}`),Q(`\\uppsi`,`\\up@greek{\\psi}`),Q(`\\upomega`,`\\up@greek{\\omega}`),Q(`\\invamp`,`\\mathbin{\\char"214b}`),Q(`\\parr`,`\\mathbin{\\char"214b}`),Q(`\\upand`,`\\mathbin{\\char"214b}`),Q(`\\with`,`\\mathbin{\\char"26}`),Q(`\\multimapinv`,`\\mathrel{\\char"27dc}`),Q(`\\multimapboth`,`\\mathrel{\\char"29df}`),Q(`\\scoh`,`{\\mkern5mu\\char"2322\\mkern5mu}`),Q(`\\sincoh`,`{\\mkern5mu\\char"2323\\mkern5mu}`),Q(`\\coh`,`{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2322}}}
47
+ {\\smash{\\lower4mu{\\char"2323}}}\\mkern5mu}`),Q(`\\incoh`,`{\\mkern5mu\\rule{}{0.7em}\\mathrlap{\\smash{\\raise2mu{\\char"2323}}}
48
+ {\\smash{\\lower4mu{\\char"2322}}}\\mkern5mu}`),Q(`\\standardstate`,"\\text{\\tiny\\char`⦵}"),Q(`\\ce`,function(e){return qS(e.consumeArgs(1)[0],`ce`)}),Q(`\\pu`,function(e){return qS(e.consumeArgs(1)[0],`pu`)}),Q(`\\uniDash`,`{\\rule{0.672em}{0.06em}}`),Q(`\\triDash`,`{\\rule{0.15em}{0.06em}\\kern2mu\\rule{0.15em}{0.06em}\\kern2mu\\rule{0.15em}{0.06em}}`),Q(`\\tripleDash`,`\\kern0.075em\\raise0.25em{\\triDash}\\kern0.075em`),Q(`\\tripleDashOverLine`,`\\kern0.075em\\mathrlap{\\raise0.125em{\\uniDash}}\\raise0.34em{\\triDash}\\kern0.075em`),Q(`\\tripleDashOverDoubleLine`,`\\kern0.075em\\mathrlap{\\mathrlap{\\raise0.48em{\\triDash}}\\raise0.27em{\\uniDash}}{\\raise0.05em{\\uniDash}}\\kern0.075em`),Q(`\\tripleDashBetweenDoubleLine`,`\\kern0.075em\\mathrlap{\\mathrlap{\\raise0.48em{\\uniDash}}\\raise0.27em{\\triDash}}{\\raise0.05em{\\uniDash}}\\kern0.075em`);var qS=function(e,t){for(var n=``,r=e.length&&e[e.length-1].loc.start,i=e.length-1;i>=0;i--)e[i].loc.start>r&&(n+=` `,r=e[i].loc.start),n+=e[i].text,r+=e[i].text.length;return JS.go($.go(n,t))},$={go:function(e,t){if(!e)return[];t===void 0&&(t=`ce`);var n=`0`,r={};r.parenthesisLevel=0,e=e.replace(/\n/g,` `),e=e.replace(/[\u2212\u2013\u2014\u2010]/g,`-`),e=e.replace(/[\u2026]/g,`...`);for(var i,a=10,o=[];;){i===e?a--:(a=10,i=e);var s=$.stateMachines[t],c=s.transitions[n]||s.transitions[`*`];iterateTransitions:for(var l=0;l<c.length;l++){var u=$.patterns.match_(c[l].pattern,e);if(u){for(var d=c[l].task,f=0;f<d.action_.length;f++){var p;if(s.actions[d.action_[f].type_])p=s.actions[d.action_[f].type_](r,u.match_,d.action_[f].option);else if($.actions[d.action_[f].type_])p=$.actions[d.action_[f].type_](r,u.match_,d.action_[f].option);else throw[`MhchemBugA`,`mhchem bug A. Please report. (`+d.action_[f].type_+`)`];$.concatArray(o,p)}if(n=d.nextState||n,e.length>0){if(d.revisit||(e=u.remainder),!d.toContinue)break iterateTransitions}else return o}}if(a<=0)throw[`MhchemBugU`,`mhchem bug U. Please report.`]}},concatArray:function(e,t){if(t){if(Array.isArray(t))for(var n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}},patterns:{patterns:{empty:/^$/,else:/^./,else2:/^./,space:/^\s/,"space A":/^\s(?=[A-Z\\$])/,space$:/^\s$/,"a-z":/^[a-z]/,x:/^x/,x$:/^x$/,i$:/^i$/,letters:/^(?:[a-zA-Z\u03B1-\u03C9\u0391-\u03A9?@]|(?:\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))))+/,"\\greek":/^\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(?:\s+|\{\}|(?![a-zA-Z]))/,"one lowercase latin letter $":/^(?:([a-z])(?:$|[^a-zA-Z]))$/,"$one lowercase latin letter$ $":/^\$(?:([a-z])(?:$|[^a-zA-Z]))\$$/,"one lowercase greek letter $":/^(?:\$?[\u03B1-\u03C9]\$?|\$?\\(?:alpha|beta|gamma|delta|epsilon|zeta|eta|theta|iota|kappa|lambda|mu|nu|xi|omicron|pi|rho|sigma|tau|upsilon|phi|chi|psi|omega)\s*\$?)(?:\s+|\{\}|(?![a-zA-Z]))$/,digits:/^[0-9]+/,"-9.,9":/^[+\-]?(?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))/,"-9.,9 no missing 0":/^[+\-]?[0-9]+(?:[.,][0-9]+)?/,"(-)(9.,9)(e)(99)":function(e){var t=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))?(\((?:[0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+))\))?(?:([eE]|\s*(\*|x|\\times|\u00D7)\s*10\^)([+\-]?[0-9]+|\{[+\-]?[0-9]+\}))?/);return t&&t[0]?{match_:t.splice(1),remainder:e.substr(t[0].length)}:null},"(-)(9)^(-9)":function(e){var t=e.match(/^(\+\-|\+\/\-|\+|\-|\\pm\s?)?([0-9]+(?:[,.][0-9]+)?|[0-9]*(?:\.[0-9]+)?)\^([+\-]?[0-9]+|\{[+\-]?[0-9]+\})/);return t&&t[0]?{match_:t.splice(1),remainder:e.substr(t[0].length)}:null},"state of aggregation $":function(e){var t=$.patterns.findObserveGroups(e,``,/^\([a-z]{1,3}(?=[\),])/,`)`,``);if(t&&t.remainder.match(/^($|[\s,;\)\]\}])/))return t;var n=e.match(/^(?:\((?:\\ca\s?)?\$[amothc]\$\))/);return n?{match_:n[0],remainder:e.substr(n[0].length)}:null},"_{(state of aggregation)}$":/^_\{(\([a-z]{1,3}\))\}/,"{[(":/^(?:\\\{|\[|\()/,")]}":/^(?:\)|\]|\\\})/,", ":/^[,;]\s*/,",":/^[,;]/,".":/^[.]/,". ":/^([.\u22C5\u00B7\u2022])\s*/,"...":/^\.\.\.(?=$|[^.])/,"* ":/^([*])\s*/,"^{(...)}":function(e){return $.patterns.findObserveGroups(e,`^{`,``,``,`}`)},"^($...$)":function(e){return $.patterns.findObserveGroups(e,`^`,`$`,`$`,``)},"^a":/^\^([0-9]+|[^\\_])/,"^\\x{}{}":function(e){return $.patterns.findObserveGroups(e,`^`,/^\\[a-zA-Z]+\{/,`}`,``,``,`{`,`}`,``,!0)},"^\\x{}":function(e){return $.patterns.findObserveGroups(e,`^`,/^\\[a-zA-Z]+\{/,`}`,``)},"^\\x":/^\^(\\[a-zA-Z]+)\s*/,"^(-1)":/^\^(-?\d+)/,"'":/^'/,"_{(...)}":function(e){return $.patterns.findObserveGroups(e,`_{`,``,``,`}`)},"_($...$)":function(e){return $.patterns.findObserveGroups(e,`_`,`$`,`$`,``)},_9:/^_([+\-]?[0-9]+|[^\\])/,"_\\x{}{}":function(e){return $.patterns.findObserveGroups(e,`_`,/^\\[a-zA-Z]+\{/,`}`,``,``,`{`,`}`,``,!0)},"_\\x{}":function(e){return $.patterns.findObserveGroups(e,`_`,/^\\[a-zA-Z]+\{/,`}`,``)},"_\\x":/^_(\\[a-zA-Z]+)\s*/,"^_":/^(?:\^(?=_)|\_(?=\^)|[\^_]$)/,"{}":/^\{\}/,"{...}":function(e){return $.patterns.findObserveGroups(e,``,`{`,`}`,``)},"{(...)}":function(e){return $.patterns.findObserveGroups(e,`{`,``,``,`}`)},"$...$":function(e){return $.patterns.findObserveGroups(e,``,`$`,`$`,``)},"${(...)}$":function(e){return $.patterns.findObserveGroups(e,"${",``,``,`}$`)},"$(...)$":function(e){return $.patterns.findObserveGroups(e,`$`,``,``,`$`)},"=<>":/^[=<>]/,"#":/^[#\u2261]/,"+":/^\+/,"-$":/^-(?=[\s_},;\]/]|$|\([a-z]+\))/,"-9":/^-(?=[0-9])/,"- orbital overlap":/^-(?=(?:[spd]|sp)(?:$|[\s,;\)\]\}]))/,"-":/^-/,"pm-operator":/^(?:\\pm|\$\\pm\$|\+-|\+\/-)/,operator:/^(?:\+|(?:[\-=<>]|<<|>>|\\approx|\$\\approx\$)(?=\s|$|-?[0-9]))/,arrowUpDown:/^(?:v|\(v\)|\^|\(\^\))(?=$|[\s,;\)\]\}])/,"\\bond{(...)}":function(e){return $.patterns.findObserveGroups(e,`\\bond{`,``,``,`}`)},"->":/^(?:<->|<-->|->|<-|<=>>|<<=>|<=>|[\u2192\u27F6\u21CC])/,CMT:/^[CMT](?=\[)/,"[(...)]":function(e){return $.patterns.findObserveGroups(e,`[`,``,``,`]`)},"1st-level escape":/^(&|\\\\|\\hline)\s*/,"\\,":/^(?:\\[,\ ;:])/,"\\x{}{}":function(e){return $.patterns.findObserveGroups(e,``,/^\\[a-zA-Z]+\{/,`}`,``,``,`{`,`}`,``,!0)},"\\x{}":function(e){return $.patterns.findObserveGroups(e,``,/^\\[a-zA-Z]+\{/,`}`,``)},"\\ca":/^\\ca(?:\s+|(?![a-zA-Z]))/,"\\x":/^(?:\\[a-zA-Z]+\s*|\\[_&{}%])/,orbital:/^(?:[0-9]{1,2}[spdfgh]|[0-9]{0,2}sp)(?=$|[^a-zA-Z])/,others:/^[\/~|]/,"\\frac{(...)}":function(e){return $.patterns.findObserveGroups(e,`\\frac{`,``,``,`}`,`{`,``,``,`}`)},"\\overset{(...)}":function(e){return $.patterns.findObserveGroups(e,`\\overset{`,``,``,`}`,`{`,``,``,`}`)},"\\underset{(...)}":function(e){return $.patterns.findObserveGroups(e,`\\underset{`,``,``,`}`,`{`,``,``,`}`)},"\\underbrace{(...)}":function(e){return $.patterns.findObserveGroups(e,`\\underbrace{`,``,``,`}_`,`{`,``,``,`}`)},"\\color{(...)}0":function(e){return $.patterns.findObserveGroups(e,`\\color{`,``,``,`}`)},"\\color{(...)}{(...)}1":function(e){return $.patterns.findObserveGroups(e,`\\color{`,``,``,`}`,`{`,``,``,`}`)},"\\color(...){(...)}2":function(e){return $.patterns.findObserveGroups(e,`\\color`,`\\`,``,/^(?=\{)/,`{`,``,``,`}`)},"\\ce{(...)}":function(e){return $.patterns.findObserveGroups(e,`\\ce{`,``,``,`}`)},oxidation$:/^(?:[+-][IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"d-oxidation$":/^(?:[+-]?\s?[IVX]+|\\pm\s*0|\$\\pm\$\s*0)$/,"roman numeral":/^[IVX]+/,"1/2$":/^[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+(?:\$[a-z]\$|[a-z])?$/,amount:function(e){var t=e.match(/^(?:(?:(?:\([+\-]?[0-9]+\/[0-9]+\)|[+\-]?(?:[0-9]+|\$[a-z]\$|[a-z])\/[0-9]+|[+\-]?[0-9]+[.,][0-9]+|[+\-]?\.[0-9]+|[+\-]?[0-9]+)(?:[a-z](?=\s*[A-Z]))?)|[+\-]?[a-z](?=\s*[A-Z])|\+(?!\s))/);if(t)return{match_:t[0],remainder:e.substr(t[0].length)};var n=$.patterns.findObserveGroups(e,``,`$`,`$`,``);return n&&(t=n.match_.match(/^\$(?:\(?[+\-]?(?:[0-9]*[a-z]?[+\-])?[0-9]*[a-z](?:[+\-][0-9]*[a-z]?)?\)?|\+|-)\$$/),t)?{match_:t[0],remainder:e.substr(t[0].length)}:null},amount2:function(e){return this.amount(e)},"(KV letters),":/^(?:[A-Z][a-z]{0,2}|i)(?=,)/,formula$:function(e){if(e.match(/^\([a-z]+\)$/))return null;var t=e.match(/^(?:[a-z]|(?:[0-9\ \+\-\,\.\(\)]+[a-z])+[0-9\ \+\-\,\.\(\)]*|(?:[a-z][0-9\ \+\-\,\.\(\)]+)+[a-z]?)$/);return t?{match_:t[0],remainder:e.substr(t[0].length)}:null},uprightEntities:/^(?:pH|pOH|pC|pK|iPr|iBu)(?=$|[^a-zA-Z])/,"/":/^\s*(\/)\s*/,"//":/^\s*(\/\/)\s*/,"*":/^\s*[*.]\s*/},findObserveGroups:function(e,t,n,r,i,a,o,s,c,l){var u=function(e,t){if(typeof t==`string`)return e.indexOf(t)===0?t:null;var n=e.match(t);return n?n[0]:null},d=function(e,t,n){for(var r=0;t<e.length;){var i=e.charAt(t),a=u(e.substr(t),n);if(a!==null&&r===0)return{endMatchBegin:t,endMatchEnd:t+a.length};if(i===`{`)r++;else if(i===`}`){if(r===0)throw[`ExtraCloseMissingOpen`,`Extra close brace or missing open brace`];r--}t++}return null},f=u(e,t);if(f===null||(e=e.substr(f.length),f=u(e,n),f===null))return null;var p=d(e,f.length,r||i);if(p===null)return null;var m=e.substring(0,r?p.endMatchEnd:p.endMatchBegin);if(a||o){var h=this.findObserveGroups(e.substr(p.endMatchEnd),a,o,s,c);if(h===null)return null;var g=[m,h.match_];return{match_:l?g.join(``):g,remainder:h.remainder}}return{match_:m,remainder:e.substr(p.endMatchEnd)}},match_:function(e,t){var n=$.patterns.patterns[e];if(n===void 0)throw[`MhchemBugP`,`mhchem bug P. Please report. (`+e+`)`];if(typeof n==`function`)return $.patterns.patterns[e](t);var r=t.match(n);return r?{match_:r[2]?[r[1],r[2]]:r[1]?r[1]:r[0],remainder:t.substr(r[0].length)}:null}},actions:{"a=":function(e,t){e.a=(e.a||``)+t},"b=":function(e,t){e.b=(e.b||``)+t},"p=":function(e,t){e.p=(e.p||``)+t},"o=":function(e,t){e.o=(e.o||``)+t},"q=":function(e,t){e.q=(e.q||``)+t},"d=":function(e,t){e.d=(e.d||``)+t},"rm=":function(e,t){e.rm=(e.rm||``)+t},"text=":function(e,t){e.text_=(e.text_||``)+t},insert:function(e,t,n){return{type_:n}},"insert+p1":function(e,t,n){return{type_:n,p1:t}},"insert+p1+p2":function(e,t,n){return{type_:n,p1:t[0],p2:t[1]}},copy:function(e,t){return t},rm:function(e,t){return{type_:`rm`,p1:t||``}},text:function(e,t){return $.go(t,`text`)},"{text}":function(e,t){var n=[`{`];return $.concatArray(n,$.go(t,`text`)),n.push(`}`),n},"tex-math":function(e,t){return $.go(t,`tex-math`)},"tex-math tight":function(e,t){return $.go(t,`tex-math tight`)},bond:function(e,t,n){return{type_:`bond`,kind_:n||t}},"color0-output":function(e,t){return{type_:`color0`,color:t[0]}},ce:function(e,t){return $.go(t)},"1/2":function(e,t){var n=[];t.match(/^[+\-]/)&&(n.push(t.substr(0,1)),t=t.substr(1));var r=t.match(/^([0-9]+|\$[a-z]\$|[a-z])\/([0-9]+)(\$[a-z]\$|[a-z])?$/);return r[1]=r[1].replace(/\$/g,``),n.push({type_:`frac`,p1:r[1],p2:r[2]}),r[3]&&(r[3]=r[3].replace(/\$/g,``),n.push({type_:`tex-math`,p1:r[3]})),n},"9,9":function(e,t){return $.go(t,`9,9`)}},createTransitions:function(e){var t,n,r,i,a={};for(t in e)for(n in e[t])for(r=n.split(`|`),e[t][n].stateArray=r,i=0;i<r.length;i++)a[r[i]]=[];for(t in e)for(n in e[t])for(r=e[t][n].stateArray||[],i=0;i<r.length;i++){var o=e[t][n];if(o.action_){o.action_=[].concat(o.action_);for(var s=0;s<o.action_.length;s++)typeof o.action_[s]==`string`&&(o.action_[s]={type_:o.action_[s]})}else o.action_=[];for(var c=t.split(`|`),l=0;l<c.length;l++)if(r[i]===`*`)for(var u in a)a[u].push({pattern:c[l],task:o});else a[r[i]].push({pattern:c[l],task:o})}return a},stateMachines:{}};$.stateMachines={ce:{transitions:$.createTransitions({empty:{"*":{action_:`output`}},else:{"0|1|2":{action_:`beginsWithBond=false`,revisit:!0,toContinue:!0}},oxidation$:{0:{action_:`oxidation-output`}},CMT:{r:{action_:`rdt=`,nextState:`rt`},rd:{action_:`rqt=`,nextState:`rdt`}},arrowUpDown:{"0|1|2|as":{action_:[`sb=false`,`output`,`operator`],nextState:`1`}},uprightEntities:{"0|1|2":{action_:[`o=`,`output`],nextState:`1`}},orbital:{"0|1|2|3":{action_:`o=`,nextState:`o`}},"->":{"0|1|2|3":{action_:`r=`,nextState:`r`},"a|as":{action_:[`output`,`r=`],nextState:`r`},"*":{action_:[`output`,`r=`],nextState:`r`}},"+":{o:{action_:`d= kv`,nextState:`d`},"d|D":{action_:`d=`,nextState:`d`},q:{action_:`d=`,nextState:`qd`},"qd|qD":{action_:`d=`,nextState:`qd`},dq:{action_:[`output`,`d=`],nextState:`d`},3:{action_:[`sb=false`,`output`,`operator`],nextState:`0`}},amount:{"0|2":{action_:`a=`,nextState:`a`}},"pm-operator":{"0|1|2|a|as":{action_:[`sb=false`,`output`,{type_:`operator`,option:`\\pm`}],nextState:`0`}},operator:{"0|1|2|a|as":{action_:[`sb=false`,`output`,`operator`],nextState:`0`}},"-$":{"o|q":{action_:[`charge or bond`,`output`],nextState:`qd`},d:{action_:`d=`,nextState:`d`},D:{action_:[`output`,{type_:`bond`,option:`-`}],nextState:`3`},q:{action_:`d=`,nextState:`qd`},qd:{action_:`d=`,nextState:`qd`},"qD|dq":{action_:[`output`,{type_:`bond`,option:`-`}],nextState:`3`}},"-9":{"3|o":{action_:[`output`,{type_:`insert`,option:`hyphen`}],nextState:`3`}},"- orbital overlap":{o:{action_:[`output`,{type_:`insert`,option:`hyphen`}],nextState:`2`},d:{action_:[`output`,{type_:`insert`,option:`hyphen`}],nextState:`2`}},"-":{"0|1|2":{action_:[{type_:`output`,option:1},`beginsWithBond=true`,{type_:`bond`,option:`-`}],nextState:`3`},3:{action_:{type_:`bond`,option:`-`}},a:{action_:[`output`,{type_:`insert`,option:`hyphen`}],nextState:`2`},as:{action_:[{type_:`output`,option:2},{type_:`bond`,option:`-`}],nextState:`3`},b:{action_:`b=`},o:{action_:{type_:`- after o/d`,option:!1},nextState:`2`},q:{action_:{type_:`- after o/d`,option:!1},nextState:`2`},"d|qd|dq":{action_:{type_:`- after o/d`,option:!0},nextState:`2`},"D|qD|p":{action_:[`output`,{type_:`bond`,option:`-`}],nextState:`3`}},amount2:{"1|3":{action_:`a=`,nextState:`a`}},letters:{"0|1|2|3|a|as|b|p|bp|o":{action_:`o=`,nextState:`o`},"q|dq":{action_:[`output`,`o=`],nextState:`o`},"d|D|qd|qD":{action_:`o after d`,nextState:`o`}},digits:{o:{action_:`q=`,nextState:`q`},"d|D":{action_:`q=`,nextState:`dq`},q:{action_:[`output`,`o=`],nextState:`o`},a:{action_:`o=`,nextState:`o`}},"space A":{"b|p|bp":{}},space:{a:{nextState:`as`},0:{action_:`sb=false`},"1|2":{action_:`sb=true`},"r|rt|rd|rdt|rdq":{action_:`output`,nextState:`0`},"*":{action_:[`output`,`sb=true`],nextState:`1`}},"1st-level escape":{"1|2":{action_:[`output`,{type_:`insert+p1`,option:`1st-level escape`}]},"*":{action_:[`output`,{type_:`insert+p1`,option:`1st-level escape`}],nextState:`0`}},"[(...)]":{"r|rt":{action_:`rd=`,nextState:`rd`},"rd|rdt":{action_:`rq=`,nextState:`rdq`}},"...":{"o|d|D|dq|qd|qD":{action_:[`output`,{type_:`bond`,option:`...`}],nextState:`3`},"*":{action_:[{type_:`output`,option:1},{type_:`insert`,option:`ellipsis`}],nextState:`1`}},". |* ":{"*":{action_:[`output`,{type_:`insert`,option:`addition compound`}],nextState:`1`}},"state of aggregation $":{"*":{action_:[`output`,`state of aggregation`],nextState:`1`}},"{[(":{"a|as|o":{action_:[`o=`,`output`,`parenthesisLevel++`],nextState:`2`},"0|1|2|3":{action_:[`o=`,`output`,`parenthesisLevel++`],nextState:`2`},"*":{action_:[`output`,`o=`,`output`,`parenthesisLevel++`],nextState:`2`}},")]}":{"0|1|2|3|b|p|bp|o":{action_:[`o=`,`parenthesisLevel--`],nextState:`o`},"a|as|d|D|q|qd|qD|dq":{action_:[`output`,`o=`,`parenthesisLevel--`],nextState:`o`}},", ":{"*":{action_:[`output`,`comma`],nextState:`0`}},"^_":{"*":{}},"^{(...)}|^($...$)":{"0|1|2|as":{action_:`b=`,nextState:`b`},p:{action_:`b=`,nextState:`bp`},"3|o":{action_:`d= kv`,nextState:`D`},q:{action_:`d=`,nextState:`qD`},"d|D|qd|qD|dq":{action_:[`output`,`d=`],nextState:`D`}},"^a|^\\x{}{}|^\\x{}|^\\x|'":{"0|1|2|as":{action_:`b=`,nextState:`b`},p:{action_:`b=`,nextState:`bp`},"3|o":{action_:`d= kv`,nextState:`d`},q:{action_:`d=`,nextState:`qd`},"d|qd|D|qD":{action_:`d=`},dq:{action_:[`output`,`d=`],nextState:`d`}},"_{(state of aggregation)}$":{"d|D|q|qd|qD|dq":{action_:[`output`,`q=`],nextState:`q`}},"_{(...)}|_($...$)|_9|_\\x{}{}|_\\x{}|_\\x":{"0|1|2|as":{action_:`p=`,nextState:`p`},b:{action_:`p=`,nextState:`bp`},"3|o":{action_:`q=`,nextState:`q`},"d|D":{action_:`q=`,nextState:`dq`},"q|qd|qD|dq":{action_:[`output`,`q=`],nextState:`q`}},"=<>":{"0|1|2|3|a|as|o|q|d|D|qd|qD|dq":{action_:[{type_:`output`,option:2},`bond`],nextState:`3`}},"#":{"0|1|2|3|a|as|o":{action_:[{type_:`output`,option:2},{type_:`bond`,option:`#`}],nextState:`3`}},"{}":{"*":{action_:{type_:`output`,option:1},nextState:`1`}},"{...}":{"0|1|2|3|a|as|b|p|bp":{action_:`o=`,nextState:`o`},"o|d|D|q|qd|qD|dq":{action_:[`output`,`o=`],nextState:`o`}},"$...$":{a:{action_:`a=`},"0|1|2|3|as|b|p|bp|o":{action_:`o=`,nextState:`o`},"as|o":{action_:`o=`},"q|d|D|qd|qD|dq":{action_:[`output`,`o=`],nextState:`o`}},"\\bond{(...)}":{"*":{action_:[{type_:`output`,option:2},`bond`],nextState:`3`}},"\\frac{(...)}":{"*":{action_:[{type_:`output`,option:1},`frac-output`],nextState:`3`}},"\\overset{(...)}":{"*":{action_:[{type_:`output`,option:2},`overset-output`],nextState:`3`}},"\\underset{(...)}":{"*":{action_:[{type_:`output`,option:2},`underset-output`],nextState:`3`}},"\\underbrace{(...)}":{"*":{action_:[{type_:`output`,option:2},`underbrace-output`],nextState:`3`}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:[{type_:`output`,option:2},`color-output`],nextState:`3`}},"\\color{(...)}0":{"*":{action_:[{type_:`output`,option:2},`color0-output`]}},"\\ce{(...)}":{"*":{action_:[{type_:`output`,option:2},`ce`],nextState:`3`}},"\\,":{"*":{action_:[{type_:`output`,option:1},`copy`],nextState:`1`}},"\\x{}{}|\\x{}|\\x":{"0|1|2|3|a|as|b|p|bp|o|c0":{action_:[`o=`,`output`],nextState:`3`},"*":{action_:[`output`,`o=`,`output`],nextState:`3`}},others:{"*":{action_:[{type_:`output`,option:1},`copy`],nextState:`3`}},else2:{a:{action_:`a to o`,nextState:`o`,revisit:!0},as:{action_:[`output`,`sb=true`],nextState:`1`,revisit:!0},"r|rt|rd|rdt|rdq":{action_:[`output`],nextState:`0`,revisit:!0},"*":{action_:[`output`,`copy`],nextState:`3`}}}),actions:{"o after d":function(e,t){var n;if((e.d||``).match(/^[0-9]+$/)){var r=e.d;e.d=void 0,n=this.output(e),e.b=r}else n=this.output(e);return $.actions[`o=`](e,t),n},"d= kv":function(e,t){e.d=t,e.dType=`kv`},"charge or bond":function(e,t){if(e.beginsWithBond){var n=[];return $.concatArray(n,this.output(e)),$.concatArray(n,$.actions.bond(e,t,`-`)),n}e.d=t},"- after o/d":function(e,t,n){var r=$.patterns.match_(`orbital`,e.o||``),i=$.patterns.match_(`one lowercase greek letter $`,e.o||``),a=$.patterns.match_(`one lowercase latin letter $`,e.o||``),o=$.patterns.match_(`$one lowercase latin letter$ $`,e.o||``),s=t===`-`&&(r&&r.remainder===``||i||a||o);!s||e.a||e.b||e.p||e.d||e.q||r||!a||(e.o=`$`+e.o+`$`);var c=[];return s?($.concatArray(c,this.output(e)),c.push({type_:`hyphen`})):(r=$.patterns.match_(`digits`,e.d||``),n&&r&&r.remainder===``?($.concatArray(c,$.actions[`d=`](e,t)),$.concatArray(c,this.output(e))):($.concatArray(c,this.output(e)),$.concatArray(c,$.actions.bond(e,t,`-`)))),c},"a to o":function(e){e.o=e.a,e.a=void 0},"sb=true":function(e){e.sb=!0},"sb=false":function(e){e.sb=!1},"beginsWithBond=true":function(e){e.beginsWithBond=!0},"beginsWithBond=false":function(e){e.beginsWithBond=!1},"parenthesisLevel++":function(e){e.parenthesisLevel++},"parenthesisLevel--":function(e){e.parenthesisLevel--},"state of aggregation":function(e,t){return{type_:`state of aggregation`,p1:$.go(t,`o`)}},comma:function(e,t){var n=t.replace(/\s*$/,``);return n!==t&&e.parenthesisLevel===0?{type_:`comma enumeration L`,p1:n}:{type_:`comma enumeration M`,p1:n}},output:function(e,t,n){var r;if(!e.r)r=[],(e.a||e.b||e.p||e.o||e.q||e.d||n)&&(e.sb&&r.push({type_:`entitySkip`}),!e.o&&!e.q&&!e.d&&!e.b&&!e.p&&n!==2?(e.o=e.a,e.a=void 0):!e.o&&!e.q&&!e.d&&(e.b||e.p)?(e.o=e.a,e.d=e.b,e.q=e.p,e.a=e.b=e.p=void 0):e.o&&e.dType===`kv`&&$.patterns.match_(`d-oxidation$`,e.d||``)?e.dType=`oxidation`:e.o&&e.dType===`kv`&&!e.q&&(e.dType=void 0),r.push({type_:`chemfive`,a:$.go(e.a,`a`),b:$.go(e.b,`bd`),p:$.go(e.p,`pq`),o:$.go(e.o,`o`),q:$.go(e.q,`pq`),d:$.go(e.d,e.dType===`oxidation`?`oxidation`:`bd`),dType:e.dType}));else{var i=e.rdt===`M`?$.go(e.rd,`tex-math`):e.rdt===`T`?[{type_:`text`,p1:e.rd||``}]:$.go(e.rd),a=e.rqt===`M`?$.go(e.rq,`tex-math`):e.rqt===`T`?[{type_:`text`,p1:e.rq||``}]:$.go(e.rq);r={type_:`arrow`,r:e.r,rd:i,rq:a}}for(var o in e)o!==`parenthesisLevel`&&o!==`beginsWithBond`&&delete e[o];return r},"oxidation-output":function(e,t){var n=[`{`];return $.concatArray(n,$.go(t,`oxidation`)),n.push(`}`),n},"frac-output":function(e,t){return{type_:`frac-ce`,p1:$.go(t[0]),p2:$.go(t[1])}},"overset-output":function(e,t){return{type_:`overset`,p1:$.go(t[0]),p2:$.go(t[1])}},"underset-output":function(e,t){return{type_:`underset`,p1:$.go(t[0]),p2:$.go(t[1])}},"underbrace-output":function(e,t){return{type_:`underbrace`,p1:$.go(t[0]),p2:$.go(t[1])}},"color-output":function(e,t){return{type_:`color`,color1:t[0],color2:$.go(t[1])}},"r=":function(e,t){e.r=t},"rdt=":function(e,t){e.rdt=t},"rd=":function(e,t){e.rd=t},"rqt=":function(e,t){e.rqt=t},"rq=":function(e,t){e.rq=t},operator:function(e,t,n){return{type_:`operator`,kind_:n||t}}}},a:{transitions:$.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:`1/2`}},else:{0:{nextState:`1`,revisit:!0}},"$(...)$":{"*":{action_:`tex-math tight`,nextState:`1`}},",":{"*":{action_:{type_:`insert`,option:`commaDecimal`}}},else2:{"*":{action_:`copy`}}}),actions:{}},o:{transitions:$.createTransitions({empty:{"*":{}},"1/2$":{0:{action_:`1/2`}},else:{0:{nextState:`1`,revisit:!0}},letters:{"*":{action_:`rm`}},"\\ca":{"*":{action_:{type_:`insert`,option:`circa`}}},"\\x{}{}|\\x{}|\\x":{"*":{action_:`copy`}},"${(...)}$|$(...)$":{"*":{action_:`tex-math`}},"{(...)}":{"*":{action_:`{text}`}},else2:{"*":{action_:`copy`}}}),actions:{}},text:{transitions:$.createTransitions({empty:{"*":{action_:`output`}},"{...}":{"*":{action_:`text=`}},"${(...)}$|$(...)$":{"*":{action_:`tex-math`}},"\\greek":{"*":{action_:[`output`,`rm`]}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:[`output`,`copy`]}},else:{"*":{action_:`text=`}}}),actions:{output:function(e){if(e.text_){var t={type_:`text`,p1:e.text_};for(var n in e)delete e[n];return t}}}},pq:{transitions:$.createTransitions({empty:{"*":{}},"state of aggregation $":{"*":{action_:`state of aggregation`}},i$:{0:{nextState:`!f`,revisit:!0}},"(KV letters),":{0:{action_:`rm`,nextState:`0`}},formula$:{0:{nextState:`f`,revisit:!0}},"1/2$":{0:{action_:`1/2`}},else:{0:{nextState:`!f`,revisit:!0}},"${(...)}$|$(...)$":{"*":{action_:`tex-math`}},"{(...)}":{"*":{action_:`text`}},"a-z":{f:{action_:`tex-math`}},letters:{"*":{action_:`rm`}},"-9.,9":{"*":{action_:`9,9`}},",":{"*":{action_:{type_:`insert+p1`,option:`comma enumeration S`}}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:`color-output`}},"\\color{(...)}0":{"*":{action_:`color0-output`}},"\\ce{(...)}":{"*":{action_:`ce`}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:`copy`}},else2:{"*":{action_:`copy`}}}),actions:{"state of aggregation":function(e,t){return{type_:`state of aggregation subscript`,p1:$.go(t,`o`)}},"color-output":function(e,t){return{type_:`color`,color1:t[0],color2:$.go(t[1],`pq`)}}}},bd:{transitions:$.createTransitions({empty:{"*":{}},x$:{0:{nextState:`!f`,revisit:!0}},formula$:{0:{nextState:`f`,revisit:!0}},else:{0:{nextState:`!f`,revisit:!0}},"-9.,9 no missing 0":{"*":{action_:`9,9`}},".":{"*":{action_:{type_:`insert`,option:`electron dot`}}},"a-z":{f:{action_:`tex-math`}},x:{"*":{action_:{type_:`insert`,option:`KV x`}}},letters:{"*":{action_:`rm`}},"'":{"*":{action_:{type_:`insert`,option:`prime`}}},"${(...)}$|$(...)$":{"*":{action_:`tex-math`}},"{(...)}":{"*":{action_:`text`}},"\\color{(...)}{(...)}1|\\color(...){(...)}2":{"*":{action_:`color-output`}},"\\color{(...)}0":{"*":{action_:`color0-output`}},"\\ce{(...)}":{"*":{action_:`ce`}},"\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:`copy`}},else2:{"*":{action_:`copy`}}}),actions:{"color-output":function(e,t){return{type_:`color`,color1:t[0],color2:$.go(t[1],`bd`)}}}},oxidation:{transitions:$.createTransitions({empty:{"*":{}},"roman numeral":{"*":{action_:`roman-numeral`}},"${(...)}$|$(...)$":{"*":{action_:`tex-math`}},else:{"*":{action_:`copy`}}}),actions:{"roman-numeral":function(e,t){return{type_:`roman numeral`,p1:t||``}}}},"tex-math":{transitions:$.createTransitions({empty:{"*":{action_:`output`}},"\\ce{(...)}":{"*":{action_:[`output`,`ce`]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:`o=`}},else:{"*":{action_:`o=`}}}),actions:{output:function(e){if(e.o){var t={type_:`tex-math`,p1:e.o};for(var n in e)delete e[n];return t}}}},"tex-math tight":{transitions:$.createTransitions({empty:{"*":{action_:`output`}},"\\ce{(...)}":{"*":{action_:[`output`,`ce`]}},"{...}|\\,|\\x{}{}|\\x{}|\\x":{"*":{action_:`o=`}},"-|+":{"*":{action_:`tight operator`}},else:{"*":{action_:`o=`}}}),actions:{"tight operator":function(e,t){e.o=(e.o||``)+`{`+t+`}`},output:function(e){if(e.o){var t={type_:`tex-math`,p1:e.o};for(var n in e)delete e[n];return t}}}},"9,9":{transitions:$.createTransitions({empty:{"*":{}},",":{"*":{action_:`comma`}},else:{"*":{action_:`copy`}}}),actions:{comma:function(){return{type_:`commaDecimal`}}}},pu:{transitions:$.createTransitions({empty:{"*":{action_:`output`}},space$:{"*":{action_:[`output`,`space`]}},"{[(|)]}":{"0|a":{action_:`copy`}},"(-)(9)^(-9)":{0:{action_:`number^`,nextState:`a`}},"(-)(9.,9)(e)(99)":{0:{action_:`enumber`,nextState:`a`}},space:{"0|a":{}},"pm-operator":{"0|a":{action_:{type_:`operator`,option:`\\pm`},nextState:`0`}},operator:{"0|a":{action_:`copy`,nextState:`0`}},"//":{d:{action_:`o=`,nextState:`/`}},"/":{d:{action_:`o=`,nextState:`/`}},"{...}|else":{"0|d":{action_:`d=`,nextState:`d`},a:{action_:[`space`,`d=`],nextState:`d`},"/|q":{action_:`q=`,nextState:`q`}}}),actions:{enumber:function(e,t){var n=[];return t[0]===`+-`||t[0]===`+/-`?n.push(`\\pm `):t[0]&&n.push(t[0]),t[1]&&($.concatArray(n,$.go(t[1],`pu-9,9`)),t[2]&&(t[2].match(/[,.]/)?$.concatArray(n,$.go(t[2],`pu-9,9`)):n.push(t[2])),t[3]=t[4]||t[3],t[3]&&(t[3]=t[3].trim(),t[3]===`e`||t[3].substr(0,1)===`*`?n.push({type_:`cdot`}):n.push({type_:`times`}))),t[3]&&n.push(`10^{`+t[5]+`}`),n},"number^":function(e,t){var n=[];return t[0]===`+-`||t[0]===`+/-`?n.push(`\\pm `):t[0]&&n.push(t[0]),$.concatArray(n,$.go(t[1],`pu-9,9`)),n.push(`^{`+t[2]+`}`),n},operator:function(e,t,n){return{type_:`operator`,kind_:n||t}},space:function(){return{type_:`pu-space-1`}},output:function(e){var t,n=$.patterns.match_(`{(...)}`,e.d||``);n&&n.remainder===``&&(e.d=n.match_);var r=$.patterns.match_(`{(...)}`,e.q||``);if(r&&r.remainder===``&&(e.q=r.match_),e.d&&=(e.d=e.d.replace(/\u00B0C|\^oC|\^{o}C/g,`{}^{\\circ}C`),e.d.replace(/\u00B0F|\^oF|\^{o}F/g,`{}^{\\circ}F`)),e.q){e.q=e.q.replace(/\u00B0C|\^oC|\^{o}C/g,`{}^{\\circ}C`),e.q=e.q.replace(/\u00B0F|\^oF|\^{o}F/g,`{}^{\\circ}F`);var i={d:$.go(e.d,`pu`),q:$.go(e.q,`pu`)};e.o===`//`?t={type_:`pu-frac`,p1:i.d,p2:i.q}:(t=i.d,i.d.length>1||i.q.length>1?t.push({type_:` / `}):t.push({type_:`/`}),$.concatArray(t,i.q))}else t=$.go(e.d,`pu-2`);for(var a in e)delete e[a];return t}}},"pu-2":{transitions:$.createTransitions({empty:{"*":{action_:`output`}},"*":{"*":{action_:[`output`,`cdot`],nextState:`0`}},"\\x":{"*":{action_:`rm=`}},space:{"*":{action_:[`output`,`space`],nextState:`0`}},"^{(...)}|^(-1)":{1:{action_:`^(-1)`}},"-9.,9":{0:{action_:`rm=`,nextState:`0`},1:{action_:`^(-1)`,nextState:`0`}},"{...}|else":{"*":{action_:`rm=`,nextState:`1`}}}),actions:{cdot:function(){return{type_:`tight cdot`}},"^(-1)":function(e,t){e.rm+=`^{`+t+`}`},space:function(){return{type_:`pu-space-2`}},output:function(e){var t=[];if(e.rm){var n=$.patterns.match_(`{(...)}`,e.rm||``);t=n&&n.remainder===``?$.go(n.match_,`pu`):{type_:`rm`,p1:e.rm}}for(var r in e)delete e[r];return t}}},"pu-9,9":{transitions:$.createTransitions({empty:{0:{action_:`output-0`},o:{action_:`output-o`}},",":{0:{action_:[`output-0`,`comma`],nextState:`o`}},".":{0:{action_:[`output-0`,`copy`],nextState:`o`}},else:{"*":{action_:`text=`}}}),actions:{comma:function(){return{type_:`commaDecimal`}},"output-0":function(e){var t=[];if(e.text_=e.text_||``,e.text_.length>4){var n=e.text_.length%3;n===0&&(n=3);for(var r=e.text_.length-3;r>0;r-=3)t.push(e.text_.substr(r,3)),t.push({type_:`1000 separator`});t.push(e.text_.substr(0,n)),t.reverse()}else t.push(e.text_);for(var i in e)delete e[i];return t},"output-o":function(e){var t=[];if(e.text_=e.text_||``,e.text_.length>4){for(var n=e.text_.length-3,r=0;r<n;r+=3)t.push(e.text_.substr(r,3)),t.push({type_:`1000 separator`});t.push(e.text_.substr(r))}else t.push(e.text_);for(var i in e)delete e[i];return t}}}};var JS={go:function(e,t){if(!e)return``;for(var n=``,r=!1,i=0;i<e.length;i++){var a=e[i];typeof a==`string`?n+=a:(n+=JS._go2(a),a.type_===`1st-level escape`&&(r=!0))}return!t&&!r&&n&&(n=`{`+n+`}`),n},_goInner:function(e){return e&&JS.go(e,!0)},_go2:function(e){var t;switch(e.type_){case`chemfive`:t=``;var n={a:JS._goInner(e.a),b:JS._goInner(e.b),p:JS._goInner(e.p),o:JS._goInner(e.o),q:JS._goInner(e.q),d:JS._goInner(e.d)};n.a&&(n.a.match(/^[+\-]/)&&(n.a=`{`+n.a+`}`),t+=n.a+`\\,`),(n.b||n.p)&&(t+=`{\\vphantom{X}}`,t+=`^{\\hphantom{`+(n.b||``)+`}}_{\\hphantom{`+(n.p||``)+`}}`,t+=`{\\vphantom{X}}`,t+=`^{\\vphantom{2}\\mathllap{`+(n.b||``)+`}}`,t+=`_{\\vphantom{2}\\mathllap{`+(n.p||``)+`}}`),n.o&&(n.o.match(/^[+\-]/)&&(n.o=`{`+n.o+`}`),t+=n.o),e.dType===`kv`?((n.d||n.q)&&(t+=`{\\vphantom{X}}`),n.d&&(t+=`^{`+n.d+`}`),n.q&&(t+=`_{`+n.q+`}`)):e.dType===`oxidation`?(n.d&&(t+=`{\\vphantom{X}}`,t+=`^{`+n.d+`}`),n.q&&(t+=`{{}}`,t+=`_{`+n.q+`}`)):(n.q&&(t+=`{{}}`,t+=`_{`+n.q+`}`),n.d&&(t+=`{{}}`,t+=`^{`+n.d+`}`));break;case`rm`:t=`\\mathrm{`+e.p1+`}`;break;case`text`:e.p1.match(/[\^_]/)?(e.p1=e.p1.replace(` `,`~`).replace(`-`,`\\text{-}`),t=`\\mathrm{`+e.p1+`}`):t=`\\text{`+e.p1+`}`;break;case`roman numeral`:t=`\\mathrm{`+e.p1+`}`;break;case`state of aggregation`:t=`\\mskip2mu `+JS._goInner(e.p1);break;case`state of aggregation subscript`:t=`\\mskip1mu `+JS._goInner(e.p1);break;case`bond`:if(t=JS._getBond(e.kind_),!t)throw[`MhchemErrorBond`,`mhchem Error. Unknown bond type (`+e.kind_+`)`];break;case`frac`:var r=`\\frac{`+e.p1+`}{`+e.p2+`}`;t=`\\mathchoice{\\textstyle`+r+`}{`+r+`}{`+r+`}{`+r+`}`;break;case`pu-frac`:var i=`\\frac{`+JS._goInner(e.p1)+`}{`+JS._goInner(e.p2)+`}`;t=`\\mathchoice{\\textstyle`+i+`}{`+i+`}{`+i+`}{`+i+`}`;break;case`tex-math`:t=e.p1+` `;break;case`frac-ce`:t=`\\frac{`+JS._goInner(e.p1)+`}{`+JS._goInner(e.p2)+`}`;break;case`overset`:t=`\\overset{`+JS._goInner(e.p1)+`}{`+JS._goInner(e.p2)+`}`;break;case`underset`:t=`\\underset{`+JS._goInner(e.p1)+`}{`+JS._goInner(e.p2)+`}`;break;case`underbrace`:t=`\\underbrace{`+JS._goInner(e.p1)+`}_{`+JS._goInner(e.p2)+`}`;break;case`color`:t=`{\\color{`+e.color1+`}{`+JS._goInner(e.color2)+`}}`;break;case`color0`:t=`\\color{`+e.color+`}`;break;case`arrow`:var a={rd:JS._goInner(e.rd),rq:JS._goInner(e.rq)},o=JS._getArrow(e.r);a.rq&&(o+=`[{\\rm `+a.rq+`}]`),a.rd?o+=`{\\rm `+a.rd+`}`:o+=`{}`,t=o;break;case`operator`:t=JS._getOperator(e.kind_);break;case`1st-level escape`:t=e.p1+` `;break;case`space`:t=` `;break;case`entitySkip`:t=`~`;break;case`pu-space-1`:t=`~`;break;case`pu-space-2`:t=`\\mkern3mu `;break;case`1000 separator`:t=`\\mkern2mu `;break;case`commaDecimal`:t=`{,}`;break;case`comma enumeration L`:t=`{`+e.p1+`}\\mkern6mu `;break;case`comma enumeration M`:t=`{`+e.p1+`}\\mkern3mu `;break;case`comma enumeration S`:t=`{`+e.p1+`}\\mkern1mu `;break;case`hyphen`:t=`\\text{-}`;break;case`addition compound`:t=`\\,{\\cdot}\\,`;break;case`electron dot`:t=`\\mkern1mu \\text{\\textbullet}\\mkern1mu `;break;case`KV x`:t=`{\\times}`;break;case`prime`:t=`\\prime `;break;case`cdot`:t=`\\cdot `;break;case`tight cdot`:t=`\\mkern1mu{\\cdot}\\mkern1mu `;break;case`times`:t=`\\times `;break;case`circa`:t=`{\\sim}`;break;case`^`:t=`uparrow`;break;case`v`:t=`downarrow`;break;case`ellipsis`:t=`\\ldots `;break;case`/`:t=`/`;break;case` / `:t=`\\,/\\,`;break;default:throw[`MhchemBugT`,`mhchem bug T. Please report.`]}return t},_getArrow:function(e){switch(e){case`->`:return`\\yields`;case`→`:return`\\yields`;case`⟶`:return`\\yields`;case`<-`:return`\\yieldsLeft`;case`<->`:return`\\mesomerism`;case`<-->`:return`\\yieldsLeftRight`;case`<=>`:return`\\chemequilibrium`;case`⇌`:return`\\chemequilibrium`;case`<=>>`:return`\\equilibriumRight`;case`<<=>`:return`\\equilibriumLeft`;default:throw[`MhchemBugT`,`mhchem bug T. Please report.`]}},_getBond:function(e){switch(e){case`-`:return`{-}`;case`1`:return`{-}`;case`=`:return`{=}`;case`2`:return`{=}`;case`#`:return`{\\equiv}`;case`3`:return`{\\equiv}`;case`~`:return`{\\tripleDash}`;case`~-`:return`{\\tripleDashOverLine}`;case`~=`:return`{\\tripleDashOverDoubleLine}`;case`~--`:return`{\\tripleDashOverDoubleLine}`;case`-~-`:return`{\\tripleDashBetweenDoubleLine}`;case`...`:return`{{\\cdot}{\\cdot}{\\cdot}}`;case`....`:return`{{\\cdot}{\\cdot}{\\cdot}{\\cdot}}`;case`->`:return`{\\rightarrow}`;case`<-`:return`{\\leftarrow}`;case`<`:return`{<}`;case`>`:return`{>}`;default:throw[`MhchemBugT`,`mhchem bug T. Please report.`]}},_getOperator:function(e){switch(e){case`+`:return` {}+{} `;case`-`:return` {}-{} `;case`=`:return` {}={} `;case`<`:return` {}<{} `;case`>`:return` {}>{} `;case`<<`:return` {}\\ll{} `;case`>>`:return` {}\\gg{} `;case`\\pm`:return` {}\\pm{} `;case`\\approx`:return` {}\\approx{} `;case`$\\approx$`:return` {}\\approx{} `;case`v`:return` \\downarrow{} `;case`(v)`:return` \\downarrow{} `;case`^`:return` \\uparrow{} `;case`(^)`:return` \\uparrow{} `;default:throw[`MhchemBugT`,`mhchem bug T. Please report.`]}}};Q(`\\darr`,`\\downarrow`),Q(`\\dArr`,`\\Downarrow`),Q(`\\Darr`,`\\Downarrow`),Q(`\\lang`,`\\langle`),Q(`\\rang`,`\\rangle`),Q(`\\uarr`,`\\uparrow`),Q(`\\uArr`,`\\Uparrow`),Q(`\\Uarr`,`\\Uparrow`),Q(`\\N`,`\\mathbb{N}`),Q(`\\R`,`\\mathbb{R}`),Q(`\\Z`,`\\mathbb{Z}`),Q(`\\alef`,`\\aleph`),Q(`\\alefsym`,`\\aleph`),Q(`\\bull`,`\\bullet`),Q(`\\clubs`,`\\clubsuit`),Q(`\\cnums`,`\\mathbb{C}`),Q(`\\Complex`,`\\mathbb{C}`),Q(`\\Dagger`,`\\ddagger`),Q(`\\diamonds`,`\\diamondsuit`),Q(`\\empty`,`\\emptyset`),Q(`\\exist`,`\\exists`),Q(`\\harr`,`\\leftrightarrow`),Q(`\\hArr`,`\\Leftrightarrow`),Q(`\\Harr`,`\\Leftrightarrow`),Q(`\\hearts`,`\\heartsuit`),Q(`\\image`,`\\Im`),Q(`\\infin`,`\\infty`),Q(`\\isin`,`\\in`),Q(`\\larr`,`\\leftarrow`),Q(`\\lArr`,`\\Leftarrow`),Q(`\\Larr`,`\\Leftarrow`),Q(`\\lrarr`,`\\leftrightarrow`),Q(`\\lrArr`,`\\Leftrightarrow`),Q(`\\Lrarr`,`\\Leftrightarrow`),Q(`\\natnums`,`\\mathbb{N}`),Q(`\\plusmn`,`\\pm`),Q(`\\rarr`,`\\rightarrow`),Q(`\\rArr`,`\\Rightarrow`),Q(`\\Rarr`,`\\Rightarrow`),Q(`\\real`,`\\Re`),Q(`\\reals`,`\\mathbb{R}`),Q(`\\Reals`,`\\mathbb{R}`),Q(`\\sdot`,`\\cdot`),Q(`\\sect`,`\\S`),Q(`\\spades`,`\\spadesuit`),Q(`\\sub`,`\\subset`),Q(`\\sube`,`\\subseteq`),Q(`\\supe`,`\\supseteq`),Q(`\\thetasym`,`\\vartheta`),Q(`\\weierp`,`\\wp`),Q(`\\quantity`,`{\\left\\{ #1 \\right\\}}`),Q(`\\qty`,`{\\left\\{ #1 \\right\\}}`),Q(`\\pqty`,`{\\left( #1 \\right)}`),Q(`\\bqty`,`{\\left[ #1 \\right]}`),Q(`\\vqty`,`{\\left\\vert #1 \\right\\vert}`),Q(`\\Bqty`,`{\\left\\{ #1 \\right\\}}`),Q(`\\absolutevalue`,`{\\left\\vert #1 \\right\\vert}`),Q(`\\abs`,`{\\left\\vert #1 \\right\\vert}`),Q(`\\norm`,`{\\left\\Vert #1 \\right\\Vert}`),Q(`\\evaluated`,`{\\left.#1 \\right\\vert}`),Q(`\\eval`,`{\\left.#1 \\right\\vert}`),Q(`\\order`,`{\\mathcal{O} \\left( #1 \\right)}`),Q(`\\commutator`,`{\\left[ #1 , #2 \\right]}`),Q(`\\comm`,`{\\left[ #1 , #2 \\right]}`),Q(`\\anticommutator`,`{\\left\\{ #1 , #2 \\right\\}}`),Q(`\\acomm`,`{\\left\\{ #1 , #2 \\right\\}}`),Q(`\\poissonbracket`,`{\\left\\{ #1 , #2 \\right\\}}`),Q(`\\pb`,`{\\left\\{ #1 , #2 \\right\\}}`),Q(`\\vectorbold`,`{\\boldsymbol{ #1 }}`),Q(`\\vb`,`{\\boldsymbol{ #1 }}`),Q(`\\vectorarrow`,`{\\vec{\\boldsymbol{ #1 }}}`),Q(`\\va`,`{\\vec{\\boldsymbol{ #1 }}}`),Q(`\\vectorunit`,`{{\\boldsymbol{\\hat{ #1 }}}}`),Q(`\\vu`,`{{\\boldsymbol{\\hat{ #1 }}}}`),Q(`\\dotproduct`,`\\mathbin{\\boldsymbol\\cdot}`),Q(`\\vdot`,`{\\boldsymbol\\cdot}`),Q(`\\crossproduct`,`\\mathbin{\\boldsymbol\\times}`),Q(`\\cross`,`\\mathbin{\\boldsymbol\\times}`),Q(`\\cp`,`\\mathbin{\\boldsymbol\\times}`),Q(`\\gradient`,`{\\boldsymbol\\nabla}`),Q(`\\grad`,`{\\boldsymbol\\nabla}`),Q(`\\divergence`,`{\\grad\\vdot}`),Q(`\\curl`,`{\\grad\\cross}`),Q(`\\laplacian`,`\\nabla^2`),Q(`\\tr`,`{\\operatorname{tr}}`),Q(`\\Tr`,`{\\operatorname{Tr}}`),Q(`\\rank`,`{\\operatorname{rank}}`),Q(`\\erf`,`{\\operatorname{erf}}`),Q(`\\Res`,`{\\operatorname{Res}}`),Q(`\\principalvalue`,`{\\mathcal{P}}`),Q(`\\pv`,`{\\mathcal{P}}`),Q(`\\PV`,`{\\operatorname{P.V.}}`),Q(`\\qqtext`,`{\\quad\\text{ #1 }\\quad}`),Q(`\\qq`,`{\\quad\\text{ #1 }\\quad}`),Q(`\\qcomma`,`{\\text{,}\\quad}`),Q(`\\qc`,`{\\text{,}\\quad}`),Q(`\\qcc`,`{\\quad\\text{c.c.}\\quad}`),Q(`\\qif`,`{\\quad\\text{if}\\quad}`),Q(`\\qthen`,`{\\quad\\text{then}\\quad}`),Q(`\\qelse`,`{\\quad\\text{else}\\quad}`),Q(`\\qotherwise`,`{\\quad\\text{otherwise}\\quad}`),Q(`\\qunless`,`{\\quad\\text{unless}\\quad}`),Q(`\\qgiven`,`{\\quad\\text{given}\\quad}`),Q(`\\qusing`,`{\\quad\\text{using}\\quad}`),Q(`\\qassume`,`{\\quad\\text{assume}\\quad}`),Q(`\\qsince`,`{\\quad\\text{since}\\quad}`),Q(`\\qlet`,`{\\quad\\text{let}\\quad}`),Q(`\\qfor`,`{\\quad\\text{for}\\quad}`),Q(`\\qall`,`{\\quad\\text{all}\\quad}`),Q(`\\qeven`,`{\\quad\\text{even}\\quad}`),Q(`\\qodd`,`{\\quad\\text{odd}\\quad}`),Q(`\\qinteger`,`{\\quad\\text{integer}\\quad}`),Q(`\\qand`,`{\\quad\\text{and}\\quad}`),Q(`\\qor`,`{\\quad\\text{or}\\quad}`),Q(`\\qas`,`{\\quad\\text{as}\\quad}`),Q(`\\qin`,`{\\quad\\text{in}\\quad}`),Q(`\\differential`,`{\\text{d}}`),Q(`\\dd`,`{\\text{d}}`),Q(`\\derivative`,`{\\frac{\\text{d}{ #1 }}{\\text{d}{ #2 }}}`),Q(`\\dv`,`{\\frac{\\text{d}{ #1 }}{\\text{d}{ #2 }}}`),Q(`\\partialderivative`,`{\\frac{\\partial{ #1 }}{\\partial{ #2 }}}`),Q(`\\variation`,`{\\delta}`),Q(`\\var`,`{\\delta}`),Q(`\\functionalderivative`,`{\\frac{\\delta{ #1 }}{\\delta{ #2 }}}`),Q(`\\fdv`,`{\\frac{\\delta{ #1 }}{\\delta{ #2 }}}`),Q(`\\innerproduct`,`{\\left\\langle {#1} \\mid { #2} \\right\\rangle}`),Q(`\\outerproduct`,`{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}`),Q(`\\dyad`,`{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}`),Q(`\\ketbra`,`{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}`),Q(`\\op`,`{\\left\\vert { #1 } \\right\\rangle\\left\\langle { #2} \\right\\vert}`),Q(`\\expectationvalue`,`{\\left\\langle {#1 } \\right\\rangle}`),Q(`\\expval`,`{\\left\\langle {#1 } \\right\\rangle}`),Q(`\\ev`,`{\\left\\langle {#1 } \\right\\rangle}`),Q(`\\matrixelement`,`{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}`),Q(`\\matrixel`,`{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}`),Q(`\\mel`,`{\\left\\langle{ #1 }\\right\\vert{ #2 }\\left\\vert{#3}\\right\\rangle}`);function YS(e){let t=[];e.consumeSpaces();let n=e.fetch().text;for(n===`\\relax`&&(e.consume(),e.consumeSpaces(),n=e.fetch().text);n===`\\hline`||n===`\\hdashline`;)e.consume(),t.push(n===`\\hdashline`),e.consumeSpaces(),n=e.fetch().text;return t}var XS=e=>{if(!e.parser.settings.displayMode)throw new U(`{${e.envName}} can be used only in display mode.`)},ZS=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,QS=e=>{let t=e.get(`\\arraystretch`);typeof t!=`string`&&(t=zS(t.tokens)),t=isNaN(t)?null:Number(t);let n=e.get(`\\arraycolsep`);typeof n!=`string`&&(n=zS(n.tokens));let r=ZS.exec(n),i=r?{number:+(r[1]+r[2]),unit:r[3]}:null;return[t,i]},$S=e=>{let t=``;for(let n=0;n<e.length;n++)if(e[n].type===`label`){if(t)throw new U(`Multiple \\labels in one row`);t=e[n].string}return t};function eC(e){if(e.indexOf(`ed`)===-1)return e.indexOf(`*`)===-1}function tC(e,{cols:t,envClasses:n,autoTag:r,singleRow:i,emptySingleRow:a,maxNumCols:o,leqno:s,arraystretch:c,arraycolsep:l},u){let d=n&&n.includes(`bordermatrix`)?`}`:`\\end`;e.gullet.beginGroup(),i||e.gullet.macros.set(`\\cr`,`\\\\\\relax`),e.gullet.beginGroup();let f=[],p=[f],m=[],h=[],g=[],_=r==null?void 0:[];function v(){r&&e.gullet.macros.set(`\\@eqnsw`,`1`,!0)}function y(){_&&(e.gullet.macros.get(`\\df@tag`)?(_.push(e.subparse([new FS(`\\df@tag`)])),e.gullet.macros.set(`\\df@tag`,void 0,!0)):_.push(!!r&&e.gullet.macros.get(`\\@eqnsw`)===`1`))}for(v(),g.push(YS(e));;){let t=e.parseExpression(!1,i?`\\end`:`\\\\`);e.gullet.endGroup(),e.gullet.beginGroup(),t={type:`ordgroup`,mode:e.mode,body:t,semisimple:!0},f.push(t);let r=e.fetch().text;if(r===`&`){if(o&&f.length===o){if(n.includes(`array`)){if(e.settings.strict)throw new U(`Too few columns specified in the {array} column argument.`,e.nextToken)}else if(o===2)throw new U(`The split environment accepts no more than two columns`,e.nextToken);else throw new U(`The equation environment accepts only one column`,e.nextToken)}e.consume()}else if(r===d){y(),f.length===1&&t.body.length===0&&(p.length>1||!a)&&p.pop(),h.push($S(t.body)),g.length<p.length+1&&g.push([]);break}else if(r===`\\\\`){e.consume();let n;e.gullet.future().text!==` `&&(n=e.parseSizeGroup(!0)),m.push(n?n.value:null),y(),h.push($S(t.body)),g.push(YS(e)),f=[],p.push(f),v()}else throw new U(`Expected & or \\\\ or \\cr or `+d,e.nextToken)}return e.gullet.endGroup(),e.gullet.endGroup(),{type:`array`,mode:e.mode,body:p,cols:t,rowGaps:m,hLinesBeforeRow:g,envClasses:n,autoTag:r,scriptLevel:u,tags:_,labels:h,leqno:s,arraystretch:c,arraycolsep:l}}function nC(e){return e.slice(0,1)===`d`?`display`:`text`}var rC={c:`center `,l:`left `,r:`right `},iC=e=>{let t=new W(`mtd`,[]);return t.style={padding:`0`,width:`50%`},e.envClasses.includes(`multline`)&&(t.style.width=`7.5%`),t},aC=function(e,t){let n=[],r=e.body.length,i=e.hLinesBeforeRow,a=e.tags&&e.tags.some(e=>e);for(let o=0;o<r;o++){let s=e.body[o],c=[],l=e.scriptLevel===`text`?IS.TEXT:e.scriptLevel===`script`?IS.SCRIPT:IS.DISPLAY;for(let n=0;n<s.length;n++){let i=new W(`mtd`,[Zx(s[n],t.withLevel(l))]);if(e.envClasses.includes(`multline`)){let e=o===0?`left`:o===r-1?`right`:`center`;e!==`center`&&i.classes.push(`tml-`+e)}c.push(i)}let u=e.body[0].length;for(let e=0;e<u-s.length;e++)c.push(new W(`mtd`,[],[],t));if(a){let n=e.tags[o],r;n===!0?r=new W(`mtext`,[new px([`tml-eqn`])]):n===!1?r=new W(`mtext`,[],[]):(r=Xx(n[0].body,t.withLevel(l),!0),r=Wx(r),r.classes=[`tml-tag`]),r&&(c.unshift(iC(e)),c.push(iC(e)),e.leqno?c[0].children.push(r):c[c.length-1].children.push(r))}let d=new W(`mtr`,c,[]),f=e.labels.shift();f&&e.tags&&e.tags[o]&&(d.setAttribute(`id`,f),Array.isArray(e.tags[o])&&d.classes.push(`tml-tageqn`)),o===0&&i[0].length>0&&(i[0].length===2?d.children.forEach(e=>{e.style.borderTop=`0.15em double`}):d.children.forEach(e=>{e.style.borderTop=i[0][0]?`0.06em dashed`:`0.06em solid`})),i[o+1].length>0&&(i[o+1].length===2?d.children.forEach(e=>{e.style.borderBottom=`0.15em double`}):d.children.forEach(e=>{e.style.borderBottom=i[o+1][0]?`0.06em dashed`:`0.06em solid`}));let p=!0;for(let e=0;e<d.children.length;e++){let t=d.children[e].children[0];if(!(t&&t.type===`mpadded`&&t.attributes.height===`0px`)){p=!1;break}}if(p){d.classes.push(`ff-squash`);for(let e=0;e<d.children.length;e++)d.children[e].style.paddingTop=`0`,d.children[e].style.paddingBottom=`0`}n.push(d)}if(e.arraystretch&&e.arraystretch!==1){let t=String(1.4*e.arraystretch-.8)+`ex`;for(let e=0;e<n.length;e++)for(let r=0;r<n[e].children.length;r++)n[e].children[r].style.paddingTop=t,n[e].children[r].style.paddingBottom=t}let o,s;if(e.envClasses.length>0&&(o=e.envClasses.includes(`abut`)||e.envClasses.includes(`cases`)?`0`:e.envClasses.includes(`small`)?`0.1389`:e.envClasses.includes(`cd`)?`0.25`:`0.4`,s=`em`),e.arraycolsep){let n=mS(e.arraycolsep,t);o=n.number.toFixed(4),s=n.unit}if(o){let t=n.length===0?0:n[0].children.length,r=(n,r)=>n===0&&r===0||n===t-1&&r===1?`0`:e.envClasses[0]===`align`?r===1?`0`:a?n%2?`1`:`0`:n%2?`0`:`1`:o;for(let e=0;e<n.length;e++)for(let t=0;t<n[e].children.length;t++)n[e].children[t].style.paddingLeft=`${r(t,0)}${s}`,n[e].children[t].style.paddingRight=`${r(t,1)}${s}`}if(e.envClasses.length===0)for(let e=0;e<n.length;e++)n[e].children[0].style.paddingLeft=`0em`,n[e].children.length===n[0].children.length&&(n[e].children[n[e].children.length-1].style.paddingRight=`0em`);if(e.envClasses.length>0){let t=e.envClasses.includes(`align`)||e.envClasses.includes(`alignat`);for(let r=0;r<n.length;r++){let i=n[r];if(t){for(let e=0;e<i.children.length;e++)i.children[e].classes=[`tml-`+(e%2?`left`:`right`)];if(a){let t=e.leqno?0:i.children.length-1;i.children[t].classes=[]}}if(i.children.length>1&&e.envClasses.includes(`cases`)&&(i.children[1].style.paddingLeft=`1em`),e.envClasses.includes(`cases`)||e.envClasses.includes(`subarray`))for(let e of i.children)e.classes.push(`tml-left`)}}let c=new W(`mtable`,n);if(e.envClasses.length>0&&(e.envClasses.includes(`jot`)?c.classes.push(`tml-jot`):e.envClasses.includes(`small`)&&c.classes.push(`tml-small`)),e.scriptLevel===`display`&&c.setAttribute(`displaystyle`,`true`),(e.autoTag||e.envClasses.includes(`multline`))&&(c.style.width=`100%`),e.cols&&e.cols.length>0){let t=e.cols,n=!1,r=0,i=t.length;for(;t[r].type===`separator`;)r+=1;for(;t[i-1].type===`separator`;)--i;if(t[0].type===`separator`){let e=t[1].type===`separator`?`0.15em double`:t[0].separator===`|`?`0.06em solid `:`0.06em dashed `;for(let t of c.children)t.children[0].style.borderLeft=e}let o=a?0:-1;for(let e=r;e<i;e++)if(t[e].type===`align`){let r=rC[t[e].align];o+=1;for(let e of c.children)r.trim()!==`center`&&o<e.children.length&&(e.children[o].classes=[`tml-`+r.trim()]);n=!0}else if(t[e].type===`separator`){if(n){let n=t[e+1].type===`separator`?`0.15em double`:t[e].separator===`|`?`0.06em solid`:`0.06em dashed`;for(let e of c.children)o<e.children.length&&(e.children[o].style.borderRight=n)}n=!1}if(t[t.length-1].type===`separator`){let e=t[t.length-2].type===`separator`?`0.15em double`:t[t.length-1].separator===`|`?`0.06em solid`:`0.06em dashed`;for(let t of c.children)t.children[t.children.length-1].style.borderRight=e,t.children[t.children.length-1].style.paddingRight=`0.4em`}}return e.envClasses.includes(`small`)&&(c=new W(`mstyle`,[c]),c.setAttribute(`scriptlevel`,`1`)),c},oC=function(e,t){e.envName.indexOf(`ed`)===-1&&XS(e);let n=e.envName===`split`,r=[],i=tC(e.parser,{cols:r,emptySingleRow:!0,autoTag:n?void 0:eC(e.envName),envClasses:[`abut`,`jot`],maxNumCols:e.envName===`split`?2:void 0,leqno:e.parser.settings.leqno},`display`),a,o=0,s=e.envName.indexOf(`at`)>-1;if(t[0]&&s){let e=``;for(let n=0;n<t[0].body.length;n++){let r=SS(t[0].body[n],`textord`);e+=r.text}if(isNaN(e))throw new U(`The alignat enviroment requires a numeric first argument.`);a=Number(e),o=a*2}i.body.forEach(function(e){if(s){let t=e.length/2;if(a<t)throw new U(`Too many math in a row: expected ${a}, but got ${t}`,e[0])}else o<e.length&&(o=e.length)});for(let e=0;e<o;++e){let t=`r`;e%2==1&&(t=`l`),r[e]={type:`align`,align:t}}return e.envName===`split`||(s?i.envClasses.push(`alignat`):i.envClasses[0]=`align`),i};xS({type:`array`,names:[`array`,`darray`],props:{numArgs:1},handler(e,t){let n=(wS(t[0])?[t[0]]:SS(t[0],`ordgroup`).body).map(function(e){let t=CS(e).text;if(`lcr`.indexOf(t)!==-1)return{type:`align`,align:t};if(t===`|`)return{type:`separator`,separator:`|`};if(t===`:`)return{type:`separator`,separator:`:`};throw new U(`Unknown column alignment: `+t,e)}),[r,i]=QS(e.parser.gullet.macros),a={cols:n,envClasses:[`array`],maxNumCols:n.length,arraystretch:r,arraycolsep:i};return tC(e.parser,a,nC(e.envName))},mathmlBuilder:aC}),xS({type:`array`,names:[`matrix`,`pmatrix`,`bmatrix`,`Bmatrix`,`vmatrix`,`Vmatrix`,`matrix*`,`pmatrix*`,`bmatrix*`,`Bmatrix*`,`vmatrix*`,`Vmatrix*`],props:{numArgs:0},handler(e){let t={matrix:null,pmatrix:[`(`,`)`],bmatrix:[`[`,`]`],Bmatrix:[`\\{`,`\\}`],vmatrix:[`|`,`|`],Vmatrix:[`\\Vert`,`\\Vert`]}[e.envName.replace(`*`,``)],n=`c`,r={envClasses:[],cols:[]};if(e.envName.charAt(e.envName.length-1)===`*`){let t=e.parser;if(t.consumeSpaces(),t.fetch().text===`[`){if(t.consume(),t.consumeSpaces(),n=t.fetch().text,`lcr`.indexOf(n)===-1)throw new U(`Expected l or c or r`,t.nextToken);t.consume(),t.consumeSpaces(),t.expect(`]`),t.consume(),r.cols=[]}}let i=tC(e.parser,r,`text`);i.cols=i.body.length>0?Array(i.body[0].length).fill({type:`align`,align:n}):[];let[a,o]=QS(e.parser.gullet.macros);return i.arraystretch=a,o&&(o!==6||o!==`pt`)&&(i.arraycolsep=o),t?{type:`leftright`,mode:e.mode,body:[i],left:t[0],right:t[1],rightColor:void 0}:i},mathmlBuilder:aC}),xS({type:`array`,names:[`bordermatrix`],props:{numArgs:0},handler(e){let t=tC(e.parser,{cols:[],envClasses:[`bordermatrix`]},`text`);return t.cols=t.body.length>0?Array(t.body[0].length).fill({type:`align`,align:`c`}):[],t.envClasses=[],t.arraystretch=1,e.envName===`matrix`?t:NS(t,e.delimiters)},mathmlBuilder:aC}),xS({type:`array`,names:[`smallmatrix`],props:{numArgs:0},handler(e){return tC(e.parser,{envClasses:[`small`]},`script`)},mathmlBuilder:aC}),xS({type:`array`,names:[`subarray`],props:{numArgs:1},handler(e,t){let n=(wS(t[0])?[t[0]]:SS(t[0],`ordgroup`).body).map(function(e){let t=CS(e).text;if(`lc`.indexOf(t)!==-1)return{type:`align`,align:t};throw new U(`Unknown column alignment: `+t,e)});if(n.length>1)throw new U(`{subarray} can contain only one column`);let r={cols:n,envClasses:[`small`]};if(r=tC(e.parser,r,`script`),r.body.length>0&&r.body[0].length>1)throw new U(`{subarray} can contain only one column`);return r},mathmlBuilder:aC}),xS({type:`array`,names:[`cases`,`dcases`,`rcases`,`drcases`],props:{numArgs:0},handler(e){let t=tC(e.parser,{cols:[],envClasses:[`cases`]},nC(e.envName));return{type:`leftright`,mode:e.mode,body:[t],left:e.envName.indexOf(`r`)>-1?`.`:`\\{`,right:e.envName.indexOf(`r`)>-1?`\\}`:`.`,rightColor:void 0}},mathmlBuilder:aC}),xS({type:`array`,names:[`align`,`align*`,`aligned`,`split`],props:{numArgs:0},handler:oC,mathmlBuilder:aC}),xS({type:`array`,names:[`alignat`,`alignat*`,`alignedat`],props:{numArgs:1},handler:oC,mathmlBuilder:aC}),xS({type:`array`,names:[`gathered`,`gather`,`gather*`],props:{numArgs:0},handler(e){e.envName!==`gathered`&&XS(e);let t={cols:[],envClasses:[`abut`,`jot`],autoTag:eC(e.envName),emptySingleRow:!0,leqno:e.parser.settings.leqno};return tC(e.parser,t,`display`)},mathmlBuilder:aC}),xS({type:`array`,names:[`equation`,`equation*`],props:{numArgs:0},handler(e){XS(e);let t={autoTag:eC(e.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,envClasses:[`align`],leqno:e.parser.settings.leqno};return tC(e.parser,t,`display`)},mathmlBuilder:aC}),xS({type:`array`,names:[`multline`,`multline*`],props:{numArgs:0},handler(e){XS(e);let t={autoTag:e.envName===`multline`,maxNumCols:1,envClasses:[`jot`,`multline`],leqno:e.parser.settings.leqno};return tC(e.parser,t,`display`)},mathmlBuilder:aC}),xS({type:`array`,names:[`CD`],props:{numArgs:0},handler(e){return XS(e),AS(e.parser)},mathmlBuilder:aC}),ix({type:`text`,names:[`\\hline`,`\\hdashline`],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(e,t){throw new U(`${e.funcName} valid only within array environment`)}});var sC=bS;ix({type:`bordermatrix`,names:[`\\bordermatrix`,`\\matrix`],props:{numArgs:0,numOptionalArgs:1},handler:({parser:e,funcName:t},n,r)=>{let i=[`(`,`)`];if(t===`\\bordermatrix`&&r[0]&&r[0].body){let e=r[0].body;e.length===1&&e[0].type===`delimiter`&&(i=[e[0].left,e[0].right])}e.consumeSpaces(),e.consume();let a=sC.bordermatrix,o={mode:e.mode,envName:t.slice(1),delimiters:i,parser:e},s=a.handler(o);return e.expect(`}`,!0),s}}),ix({type:`cancelto`,names:[`\\cancelto`],props:{numArgs:2},handler({parser:e},t){let n=t[0],r=t[1];return{type:`cancelto`,mode:e.mode,body:r,to:n,isCharacterBox:Jb(r)}},mathmlBuilder(e,t){let n=new W(`mrow`,[Zx(e.body,t)],[`ff-narrow`]),r=new W(`mphantom`,[Zx(e.body,t)]),i=new W(`mrow`,[r],[`tml-cancelto`]);i.style.color=t.color,e.isCharacterBox&&Qb.indexOf(e.body.body[0].text)>-1&&(i.style.left=`0.1em`,i.style.width=`90%`);let a=new W(`mrow`,[n,i],[`menclose`]);if(!e.isCharacterBox||/[f∫∑]/.test(e.body.body[0].text))r.style.paddingRight=`0.2em`;else{r.style.padding=`0.5ex 0.1em 0 0`;let e=new W(`mspace`,[]);e.setAttribute(`height`,`0.85em`),n.children.push(e)}let o;if(e.isCharacterBox)o=new W(`mspace`,[]),o.setAttribute(`height`,`1em`);else{let n=new W(`mpadded`,[Zx(e.body,t)]);n.setAttribute(`width`,`0.1px`),o=new W(`mphantom`,[n])}let s=Zx(e.to,t);s.style.color=t.color;let c=new W(`mpadded`,[s]);if(!e.isCharacterBox||/[f∫∑]/.test(e.body.body[0].text)){let e=new W(`mspace`,[]);e.setAttribute(`width`,`0.2em`),c.children.unshift(e)}c.setAttribute(`width`,`0.1px`);let l=new W(`mover`,[o,c]),u=new W(`mrow`,[],[`ff-nudge-left`]);return _x([Gx([a,l]),u])}}),ix({type:`textord`,names:[`\\@char`],props:{numArgs:1,allowedInText:!0},handler({parser:e,token:t},n){let r=SS(n[0],`ordgroup`).body,i=``;for(let e=0;e<r.length;e++){let t=SS(r[e],`textord`);i+=t.text}let a=parseInt(i);if(isNaN(a))throw new U(`\\@char has non-numeric argument ${i}`,t);return{type:`textord`,mode:e.mode,text:String.fromCodePoint(a)}}});var cC=/^(#[a-f0-9]{3}|#?[a-f0-9]{6})$/i,lC=/^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i,uC=/^ *\d{1,3} *(?:, *\d{1,3} *){2}$/,dC=/^ *[10](?:\.\d*)? *(?:, *[10](?:\.\d*)? *){2}$/,fC=/^[a-f0-9]{6}$/i,pC=e=>{let t=e.toString(16);return t.length===1&&(t=`0`+t),t},mC=JSON.parse(`{
49
+ "Apricot": "#ffb484",
50
+ "Aquamarine": "#08b4bc",
51
+ "Bittersweet": "#c84c14",
52
+ "blue": "#0000FF",
53
+ "Blue": "#303494",
54
+ "BlueGreen": "#08b4bc",
55
+ "BlueViolet": "#503c94",
56
+ "BrickRed": "#b8341c",
57
+ "brown": "#BF8040",
58
+ "Brown": "#802404",
59
+ "BurntOrange": "#f8941c",
60
+ "CadetBlue": "#78749c",
61
+ "CarnationPink": "#f884b4",
62
+ "Cerulean": "#08a4e4",
63
+ "CornflowerBlue": "#40ace4",
64
+ "cyan": "#00FFFF",
65
+ "Cyan": "#08acec",
66
+ "Dandelion": "#ffbc44",
67
+ "darkgray": "#404040",
68
+ "DarkOrchid": "#a8548c",
69
+ "Emerald": "#08ac9c",
70
+ "ForestGreen": "#089c54",
71
+ "Fuchsia": "#90348c",
72
+ "Goldenrod": "#ffdc44",
73
+ "gray": "#808080",
74
+ "Gray": "#98949c",
75
+ "green": "#00FF00",
76
+ "Green": "#08a44c",
77
+ "GreenYellow": "#e0e474",
78
+ "JungleGreen": "#08ac9c",
79
+ "Lavender": "#f89cc4",
80
+ "lightgray": "#c0c0c0",
81
+ "lime": "#BFFF00",
82
+ "LimeGreen": "#90c43c",
83
+ "magenta": "#FF00FF",
84
+ "Magenta": "#f0048c",
85
+ "Mahogany": "#b0341c",
86
+ "Maroon": "#b03434",
87
+ "Melon": "#f89c7c",
88
+ "MidnightBlue": "#086494",
89
+ "Mulberry": "#b03c94",
90
+ "NavyBlue": "#086cbc",
91
+ "olive": "#7F7F00",
92
+ "OliveGreen": "#407c34",
93
+ "orange": "#FF8000",
94
+ "Orange": "#f8843c",
95
+ "OrangeRed": "#f0145c",
96
+ "Orchid": "#b074ac",
97
+ "Peach": "#f8945c",
98
+ "Periwinkle": "#8074bc",
99
+ "PineGreen": "#088c74",
100
+ "pink": "#ff7f7f",
101
+ "Plum": "#98248c",
102
+ "ProcessBlue": "#08b4ec",
103
+ "purple": "#BF0040",
104
+ "Purple": "#a0449c",
105
+ "RawSienna": "#983c04",
106
+ "red": "#ff0000",
107
+ "Red": "#f01c24",
108
+ "RedOrange": "#f86434",
109
+ "RedViolet": "#a0246c",
110
+ "Rhodamine": "#f0549c",
111
+ "Royallue": "#0874bc",
112
+ "RoyalPurple": "#683c9c",
113
+ "RubineRed": "#f0047c",
114
+ "Salmon": "#f8948c",
115
+ "SeaGreen": "#30bc9c",
116
+ "Sepia": "#701404",
117
+ "SkyBlue": "#48c4dc",
118
+ "SpringGreen": "#c8dc64",
119
+ "Tan": "#e09c74",
120
+ "teal": "#007F7F",
121
+ "TealBlue": "#08acb4",
122
+ "Thistle": "#d884b4",
123
+ "Turquoise": "#08b4cc",
124
+ "violet": "#800080",
125
+ "Violet": "#60449c",
126
+ "VioletRed": "#f054a4",
127
+ "WildStrawberry": "#f0246c",
128
+ "yellow": "#FFFF00",
129
+ "Yellow": "#fff404",
130
+ "YellowGreen": "#98cc6c",
131
+ "YellowOrange": "#ffa41c"
132
+ }`),hC=(e,t)=>{let n=``;if(e===`HTML`){if(!cC.test(t))throw new U(`Invalid HTML input.`);n=t}else if(e===`RGB`){if(!uC.test(t))throw new U(`Invalid RGB input.`);t.split(`,`).map(e=>{n+=pC(Number(e.trim()))})}else{if(!dC.test(t))throw new U(`Invalid rbg input.`);t.split(`,`).map(e=>{let t=Number(e.trim());if(t>1)throw new U(`Color rgb input must be < 1.`);n+=pC(Number((t*255).toFixed(0)))})}return n.charAt(0)!==`#`&&(n=`#`+n),n},gC=(e,t,n)=>{let r=`\\\\color@${e}`;if(!lC.exec(e))throw new U(`Invalid color: '`+e+`'`,n);return fC.test(e)?`#`+e:(e.charAt(0)===`#`||(t.has(r)?e=t.get(r).tokens[0].text:mC[e]&&(e=mC[e])),e)},_C=(e,t)=>{let n=Yx(e.body,t.withColor(e.color));return n.length===0&&n.push(new W(`mrow`)),n=n.map(t=>(t.style.color=e.color,t)),_x(n)};ix({type:`color`,names:[`\\textcolor`],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:[`raw`,`raw`,`original`]},handler({parser:e,token:t},n,r){let i=r[0]&&SS(r[0],`raw`).string,a=``;if(i){let e=SS(n[0],`raw`).string;a=hC(i,e)}else a=gC(SS(n[0],`raw`).string,e.gullet.macros,t);let o=n[1];return{type:`color`,mode:e.mode,color:a,isTextColor:!0,body:sx(o)}},mathmlBuilder:_C}),ix({type:`color`,names:[`\\color`],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0,argTypes:[`raw`,`raw`]},handler({parser:e,breakOnTokenText:t,token:n},r,i){let a=i[0]&&SS(i[0],`raw`).string,o=``;if(a){let e=SS(r[0],`raw`).string;o=hC(a,e)}else o=gC(SS(r[0],`raw`).string,e.gullet.macros,n);let s=e.parseExpression(!0,t,!0);return{type:`color`,mode:e.mode,color:o,isTextColor:!1,body:s}},mathmlBuilder:_C}),ix({type:`color`,names:[`\\definecolor`],props:{numArgs:3,allowedInText:!0,argTypes:[`raw`,`raw`,`raw`]},handler({parser:e,funcName:t,token:n},r){let i=SS(r[0],`raw`).string;if(!/^[A-Za-z]+$/.test(i))throw new U(`Color name must be latin letters.`,n);let a=SS(r[1],`raw`).string;if(![`HTML`,`RGB`,`rgb`].includes(a))throw new U(`Color model must be HTML, RGB, or rgb.`,n);let o=SS(r[2],`raw`).string,s=hC(a,o);return e.gullet.macros.set(`\\\\color@${i}`,{tokens:[{text:s}],numArgs:0}),{type:`internal`,mode:e.mode}}}),ix({type:`cr`,names:[`\\\\`],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler({parser:e},t,n){let r=e.gullet.future().text===`[`?e.parseSizeGroup(!0):null,i=!e.settings.displayMode;return{type:`cr`,mode:e.mode,newLine:i,size:r&&SS(r,`size`).value}},mathmlBuilder(e,t){let n=new W(`mo`);if(e.newLine&&(n.setAttribute(`linebreak`,`newline`),e.size)){let r=mS(e.size,t);n.setAttribute(`height`,r.number+r.unit)}return n}});var vC={"\\global":`\\global`,"\\long":`\\\\globallong`,"\\\\globallong":`\\\\globallong`,"\\def":`\\gdef`,"\\gdef":`\\gdef`,"\\edef":`\\xdef`,"\\xdef":`\\xdef`,"\\let":`\\\\globallet`,"\\futurelet":`\\\\globalfuture`},yC=e=>{let t=e.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(t))throw new U(`Expected a control sequence`,e);return t},bC=e=>{let t=e.gullet.popToken();return t.text===`=`&&(t=e.gullet.popToken(),t.text===` `&&(t=e.gullet.popToken())),t},xC=(e,t,n,r)=>{let i=e.gullet.macros.get(n.text);i??=(n.noexpand=!0,{tokens:[n],numArgs:0,unexpandable:!e.gullet.isExpandable(n.text)}),e.gullet.macros.set(t,i,r)};ix({type:`internal`,names:[`\\global`,`\\long`,`\\\\globallong`],props:{numArgs:0,allowedInText:!0},handler({parser:e,funcName:t}){e.consumeSpaces();let n=e.fetch();if(vC[n.text])return(t===`\\global`||t===`\\\\globallong`)&&(n.text=vC[n.text]),SS(e.parseFunction(),`internal`);throw new U(`Invalid token after macro prefix`,n)}}),ix({type:`internal`,names:[`\\def`,`\\gdef`,`\\edef`,`\\xdef`],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=e.gullet.popToken(),r=n.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(r))throw new U(`Expected a control sequence`,n);let i=0,a,o=[[]];for(;e.gullet.future().text!==`{`;)if(n=e.gullet.popToken(),n.text===`#`){if(e.gullet.future().text===`{`){a=e.gullet.future(),o[i].push(`{`);break}if(n=e.gullet.popToken(),!/^[1-9]$/.test(n.text))throw new U(`Invalid argument number "${n.text}"`);if(parseInt(n.text)!==i+1)throw new U(`Argument number "${n.text}" out of order`);i++,o.push([])}else if(n.text===`EOF`)throw new U(`Expected a macro definition`);else o[i].push(n.text);let{tokens:s}=e.gullet.consumeArg();if(a&&s.unshift(a),t===`\\edef`||t===`\\xdef`){if(s=e.gullet.expandTokens(s),s.length>e.gullet.settings.maxExpand)throw new U(`Too many expansions in an `+t);s.reverse()}return e.gullet.macros.set(r,{tokens:s,numArgs:i,delimiters:o},t===vC[t]),{type:`internal`,mode:e.mode}}}),ix({type:`internal`,names:[`\\let`,`\\\\globallet`],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=yC(e.gullet.popToken());return e.gullet.consumeSpaces(),xC(e,n,bC(e),t===`\\\\globallet`),{type:`internal`,mode:e.mode}}}),ix({type:`internal`,names:[`\\futurelet`,`\\\\globalfuture`],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=yC(e.gullet.popToken()),r=e.gullet.popToken(),i=e.gullet.popToken();return xC(e,n,i,t===`\\\\globalfuture`),e.gullet.pushToken(i),e.gullet.pushToken(r),{type:`internal`,mode:e.mode}}}),ix({type:`internal`,names:[`\\newcommand`,`\\renewcommand`,`\\providecommand`],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({parser:e,funcName:t}){let n=``,r=e.gullet.popToken();r.text===`{`?(n=yC(e.gullet.popToken()),e.gullet.popToken()):n=yC(r);let i=e.gullet.isDefined(n);if(i&&t===`\\newcommand`)throw new U(`\\newcommand{${n}} attempting to redefine ${n}; use \\renewcommand`);if(!i&&t===`\\renewcommand`)throw new U(`\\renewcommand{${n}} when command ${n} does not yet exist; use \\newcommand`);let a=0;if(e.gullet.future().text===`[`){let t=e.gullet.popToken();if(t=e.gullet.popToken(),!/^[0-9]$/.test(t.text))throw new U(`Invalid number of arguments: "${t.text}"`);if(a=parseInt(t.text),t=e.gullet.popToken(),t.text!==`]`)throw new U(`Invalid argument "${t.text}"`)}let{tokens:o}=e.gullet.consumeArg();return t===`\\providecommand`&&e.gullet.macros.has(n)||e.gullet.macros.set(n,{tokens:o,numArgs:a}),{type:`internal`,mode:e.mode}}});var SC={"\\bigl":{mclass:`mopen`,size:1},"\\Bigl":{mclass:`mopen`,size:2},"\\biggl":{mclass:`mopen`,size:3},"\\Biggl":{mclass:`mopen`,size:4},"\\bigr":{mclass:`mclose`,size:1},"\\Bigr":{mclass:`mclose`,size:2},"\\biggr":{mclass:`mclose`,size:3},"\\Biggr":{mclass:`mclose`,size:4},"\\bigm":{mclass:`mrel`,size:1},"\\Bigm":{mclass:`mrel`,size:2},"\\biggm":{mclass:`mrel`,size:3},"\\Biggm":{mclass:`mrel`,size:4},"\\big":{mclass:`mord`,size:1},"\\Big":{mclass:`mord`,size:2},"\\bigg":{mclass:`mord`,size:3},"\\Bigg":{mclass:`mord`,size:4}},CC={"(":`)`,"\\lparen":`\\rparen`,"[":`]`,"\\lbrack":`\\rbrack`,"\\{":`\\}`,"\\lbrace":`\\rbrace`,"⦇":`⦈`,"\\llparenthesis":`\\rrparenthesis`,"\\lfloor":`\\rfloor`,"⌊":`⌋`,"\\lceil":`\\rceil`,"⌈":`⌉`,"\\langle":`\\rangle`,"⟨":`⟩`,"\\lAngle":`\\rAngle`,"⟪":`⟫`,"\\llangle":`\\rrangle`,"⦉":`⦊`,"\\lvert":`\\rvert`,"\\lVert":`\\rVert`,"\\lgroup":`\\rgroup`,"⟮":`⟯`,"\\lmoustache":`\\rmoustache`,"⎰":`⎱`,"\\llbracket":`\\rrbracket`,"⟦":`⟧`,"\\lBrace":`\\rBrace`,"⦃":`⦄`},wC=new Set(Object.keys(CC));new Set(Object.values(CC));var TC=new Set(`(,\\lparen,),\\rparen,[,\\lbrack,],\\rbrack,\\{,\\lbrace,\\},\\rbrace,⦇,\\llparenthesis,⦈,\\rrparenthesis,\\lfloor,\\rfloor,⌊,⌋,\\lceil,\\rceil,⌈,⌉,<,>,\\langle,⟨,\\rangle,⟩,\\lAngle,⟪,\\rAngle,⟫,\\llangle,⦉,\\rrangle,⦊,\\lt,\\gt,\\lvert,\\rvert,\\lVert,\\rVert,\\lgroup,\\rgroup,⟮,⟯,\\lmoustache,\\rmoustache,⎰,⎱,\\llbracket,\\rrbracket,⟦,⟧,\\lBrace,\\rBrace,⦃,⦄,/,\\backslash,|,\\vert,\\|,\\Vert,‖,\\uparrow,\\Uparrow,\\downarrow,\\Downarrow,\\updownarrow,\\Updownarrow,.`.split(`,`)),EC=new Set([`}`,`\\left`,`\\middle`,`\\right`]),DC=e=>e.length>0&&(TC.has(e)||SC[e]||EC.has(e)),OC=[0,1.2,1.8,2.4,3];function kC(e,t){e.type===`ordgroup`&&e.body.length===1&&(e=e.body[0]);let n=wS(e);if(n&&TC.has(n.text))return(n.text===`<`||n.text===`\\lt`)&&(n.text=`⟨`),(n.text===`>`||n.text===`\\gt`)&&(n.text=`⟩`),n;throw n?new U(`Invalid delimiter '${n.text}' after '${t.funcName}'`,e):new U(`Invalid delimiter type '${e.type}'`,e)}var AC=new Set([`/`,`\\`,`\\backslash`,`∖`,`\\vert`,`|`]),jC=(e,t,n,r)=>{let i=new W(`mo`,[Hx(e===`.`?``:e,t)]);return i.setAttribute(`fence`,`true`),i.setAttribute(`form`,n),i.setAttribute(`stretchy`,r?`true`:`false`),i};ix({type:`delimsizing`,names:[`\\bigl`,`\\Bigl`,`\\biggl`,`\\Biggl`,`\\bigr`,`\\Bigr`,`\\biggr`,`\\Biggr`,`\\bigm`,`\\Bigm`,`\\biggm`,`\\Biggm`,`\\big`,`\\Big`,`\\bigg`,`\\Bigg`],props:{numArgs:1,argTypes:[`primitive`]},handler:(e,t)=>{let n=kC(t[0],e),r={type:`delimsizing`,mode:e.parser.mode,size:SC[e.funcName].size,mclass:SC[e.funcName].mclass,delim:n.text},i=e.parser.fetch().text;return i!==`^`&&i!==`_`?r:{type:`ordgroup`,mode:`math`,body:[r,{type:`ordgroup`,mode:`math`,body:[]}]}},mathmlBuilder:e=>{let t=[],n=e.delim===`.`?``:e.delim;t.push(Hx(n,e.mode));let r=new W(`mo`,t);return e.mclass===`mopen`||e.mclass===`mclose`?r.setAttribute(`fence`,`true`):r.setAttribute(`fence`,`false`),(AC.has(n)||n.indexOf(`arrow`)>-1)&&r.setAttribute(`stretchy`,`true`),r.setAttribute(`symmetric`,`true`),r.setAttribute(`minsize`,OC[e.size]+`em`),r.setAttribute(`maxsize`,OC[e.size]+`em`),r}});function MC(e){if(!e.body)throw Error(`Bug: The delim ParseNode wasn't fully parsed.`)}ix({type:`leftright-right`,names:[`\\right`],props:{numArgs:1,argTypes:[`primitive`]},handler:(e,t)=>({type:`leftright-right`,mode:e.parser.mode,delim:kC(t[0],e).text})}),ix({type:`leftright`,names:[`\\left`],props:{numArgs:1,argTypes:[`primitive`]},handler:(e,t)=>{let n=kC(t[0],e),r=e.parser;++r.leftrightDepth;let i=r.parseExpression(!1,`\\right`,!0),a=r.fetch();for(;a.text===`\\middle`;){r.consume();let e=r.fetch().text;if(!Dx.math[e])throw new U(`Invalid delimiter '${e}' after '\\middle'`);kC({type:`atom`,mode:`math`,text:e},{funcName:`\\middle`}),i.push({type:`middle`,mode:`math`,delim:e}),r.consume(),i=i.concat(r.parseExpression(!1,`\\right`,!0)),a=r.fetch()}--r.leftrightDepth,r.expect(`\\right`,!1);let o=SS(r.parseFunction(),`leftright-right`);return{type:`leftright`,mode:r.mode,body:i,left:n.text,right:o.delim,isStretchy:!0}},mathmlBuilder:(e,t)=>{MC(e);let n=Yx(e.body,t),r=jC(e.left,e.mode,`prefix`,!0);n.unshift(r);let i=jC(e.right,e.mode,`postfix`,!0);if(e.body.length>0){let t=e.body[e.body.length-1];t.type===`color`&&!t.isTextColor&&i.setAttribute(`mathcolor`,t.color)}return n.push(i),Gx(n)}}),ix({type:`delimiter`,names:Array.from(wC),props:{numArgs:0,allowedInText:!0,allowedInMath:!0,allowedInArgument:!0},handler:({parser:e,funcName:t,token:n})=>{if(e.mode===`text`)return{type:`textord`,mode:`text`,text:t,loc:n.loc};if(!e.settings.wrapDelimiterPairs)return{type:`atom`,mode:`math`,family:`open`,loc:n.loc,text:t};let r=CC[t],i=e.parseExpression(!1,r,!1);if(e.fetch().text!==r)throw new U(`Unmatched delimiter`);return e.consume(),{type:`delimiter`,mode:e.mode,body:i,left:t,right:r}},mathmlBuilder:(e,t)=>{MC(e);let n=Yx(e.body,t),r=jC(e.left,e.mode,`prefix`,!1);n.unshift(r);let i=jC(e.right,e.mode,`postfix`,!1);if(e.body.length>0){let t=e.body[e.body.length-1];t.type===`color`&&!t.isTextColor&&i.setAttribute(`mathcolor`,t.color)}return n.push(i),Gx(n)}}),ix({type:`middle`,names:[`\\middle`],props:{numArgs:1,argTypes:[`primitive`]},handler:(e,t)=>{let n=kC(t[0],e);if(!e.parser.leftrightDepth)throw new U(`\\middle without preceding \\left`,n);return{type:`middle`,mode:e.parser.mode,delim:n.text}},mathmlBuilder:e=>{let t=Hx(e.delim,e.mode),n=new W(`mo`,[t]);return n.setAttribute(`stretchy`,`true`),n.setAttribute(`form`,`infix`),t.text!==`/`&&(n.setAttribute(`lspace`,`0.05em`),n.setAttribute(`rspace`,`0.05em`)),n}});var NC=[`\\boxed`,`\\fcolorbox`,`\\colorbox`],PC=(e,t)=>{let n=new W(NC.includes(e.label)?`mrow`:`menclose`,[Zx(e.body,t)]);switch(e.label){case`\\overline`:n.setAttribute(`notation`,`top`),n.classes.push(`tml-overline`);break;case`\\underline`:n.setAttribute(`notation`,`bottom`),n.classes.push(`tml-underline`);break;case`\\cancel`:n.setAttribute(`notation`,`updiagonalstrike`),n.children.push(new W(`mrow`,[],[`tml-cancel`,`upstrike`]));break;case`\\bcancel`:n.setAttribute(`notation`,`downdiagonalstrike`),n.children.push(new W(`mrow`,[],[`tml-cancel`,`downstrike`]));break;case`\\sout`:n.setAttribute(`notation`,`horizontalstrike`),n.children.push(new W(`mrow`,[],[`tml-cancel`,`sout`]));break;case`\\xcancel`:n.setAttribute(`notation`,`updiagonalstrike downdiagonalstrike`),n.children.push(new W(`mrow`,[],[`tml-cancel`,`tml-xcancel`]));break;case`\\longdiv`:n.setAttribute(`notation`,`longdiv`),n.classes.push(`longdiv-top`),n.children.push(new W(`mrow`,[],[`longdiv-arc`]));break;case`\\phase`:n.setAttribute(`notation`,`phasorangle`),n.classes.push(`phasor-bottom`),n.children.push(new W(`mrow`,[],[`phasor-angle`]));break;case`\\textcircled`:n.setAttribute(`notation`,`circle`),n.classes.push(`circle-pad`),n.children.push(new W(`mrow`,[],[`textcircle`]));break;case`\\angl`:n.setAttribute(`notation`,`actuarial`),n.classes.push(`actuarial`);break;case`\\boxed`:n.style.padding=`3pt`,n.style.border=`1px solid`,n.setAttribute(`scriptlevel`,`0`),n.setAttribute(`displaystyle`,`true`);break;case`\\fbox`:n.setAttribute(`notation`,`box`),n.classes.push(`tml-fbox`);break;case`\\fcolorbox`:case`\\colorbox`:n.style.padding=`0.3em`,e.label===`\\fcolorbox`&&(n.style.border=`0.0667em solid `+String(e.borderColor))}return e.backgroundColor&&n.setAttribute(`mathbackground`,e.backgroundColor),n};ix({type:`enclose`,names:[`\\colorbox`],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,argTypes:[`raw`,`raw`,`text`]},handler({parser:e,funcName:t},n,r){let i=r[0]&&SS(r[0],`raw`).string,a=``;if(i){let e=SS(n[0],`raw`).string;a=hC(i,e)}else a=gC(SS(n[0],`raw`).string,e.gullet.macros);let o=n[1];return{type:`enclose`,mode:e.mode,label:t,backgroundColor:a,body:o}},mathmlBuilder:PC}),ix({type:`enclose`,names:[`\\fcolorbox`],props:{numArgs:3,numOptionalArgs:1,allowedInText:!0,argTypes:[`raw`,`raw`,`raw`,`text`]},handler({parser:e,funcName:t},n,r){let i=r[0]&&SS(r[0],`raw`).string,a=``,o;if(i){let e=SS(n[0],`raw`).string,t=SS(n[0],`raw`).string;a=hC(i,e),o=hC(i,t)}else a=gC(SS(n[0],`raw`).string,e.gullet.macros),o=gC(SS(n[1],`raw`).string,e.gullet.macros);let s=n[2];return{type:`enclose`,mode:e.mode,label:t,backgroundColor:o,borderColor:a,body:s}},mathmlBuilder:PC}),ix({type:`enclose`,names:[`\\fbox`],props:{numArgs:1,argTypes:[`hbox`],allowedInText:!0},handler({parser:e},t){return{type:`enclose`,mode:e.mode,label:`\\fbox`,body:t[0]}}}),ix({type:`enclose`,names:[`\\angl`,`\\cancel`,`\\bcancel`,`\\xcancel`,`\\overline`,`\\boxed`,`\\longdiv`,`\\phase`],props:{numArgs:1},handler({parser:e,funcName:t},n){let r=n[0];return{type:`enclose`,mode:e.mode,label:t,body:r}},mathmlBuilder:PC}),ix({type:`enclose`,names:[`\\sout`],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:t},n){let r=n[0];return{type:`enclose`,mode:e.mode,label:t,body:r}},mathmlBuilder:PC}),ix({type:`enclose`,names:[`\\underline`],props:{numArgs:1,allowedInText:!0},handler({parser:e,funcName:t},n){let r=n[0];return{type:`enclose`,mode:e.mode,label:t,body:r}},mathmlBuilder:PC}),ix({type:`enclose`,names:[`\\textcircled`],props:{numArgs:1,argTypes:[`text`],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:t},n){let r=n[0];return{type:`enclose`,mode:e.mode,label:t,body:r}},mathmlBuilder:PC}),ix({type:`environment`,names:[`\\begin`,`\\end`],props:{numArgs:1,argTypes:[`text`]},handler({parser:e,funcName:t},n){let r=n[0];if(r.type!==`ordgroup`)throw new U(`Invalid environment name`,r);let i=``;for(let e=0;e<r.body.length;++e)i+=SS(r.body[e],`textord`).text;if(t===`\\begin`){if(!Object.prototype.hasOwnProperty.call(sC,i))throw new U(`No such environment: `+i,r);let t=sC[i],{args:n,optArgs:a}=e.parseArguments(`\\begin{`+i+`}`,t),o={mode:e.mode,envName:i,parser:e},s=t.handler(o,n,a);e.expect(`\\end`,!1);let c=e.nextToken,l=SS(e.parseFunction(),`environment`);if(l.name!==i)throw new U(`Mismatch: \\begin{${i}} matched by \\end{${l.name}}`,c);return s}return{type:`environment`,mode:e.mode,name:i,nameGroup:r}}}),ix({type:`envTag`,names:[`\\env@tag`],props:{numArgs:1,argTypes:[`math`]},handler({parser:e},t){return{type:`envTag`,mode:e.mode,body:t[0]}},mathmlBuilder(e,t){return new W(`mrow`)}}),ix({type:`noTag`,names:[`\\env@notag`],props:{numArgs:0},handler({parser:e}){return{type:`noTag`,mode:e.mode}},mathmlBuilder(e,t){return new W(`mrow`)}});var FC=Object.freeze({B:8426,E:8427,F:8427,H:8387,I:8391,L:8390,M:8422,R:8393,e:8394,g:8355,o:8389}),IC=Object.freeze({C:8426,H:8388,I:8392,R:8394,Z:8398}),LC=Object.freeze({C:8383,H:8389,N:8391,P:8393,Q:8393,R:8395,Z:8394}),RC=Object.freeze({ϵ:119527,ϑ:119564,ϰ:119534,φ:119577,ϱ:119535,ϖ:119563}),zC=Object.freeze({ϵ:119643,ϑ:119680,ϰ:119650,φ:119693,ϱ:119651,ϖ:119679}),BC=Object.freeze({ϵ:119701,ϑ:119738,ϰ:119708,φ:119751,ϱ:119709,ϖ:119737}),VC=Object.freeze({ϵ:119759,ϑ:119796,ϰ:119766,φ:119809,ϱ:119767,ϖ:119795}),HC=Object.freeze({upperCaseLatin:{normal:e=>0,bold:e=>119743,italic:e=>119795,"bold-italic":e=>119847,script:e=>FC[e]||119899,"script-bold":e=>119951,fraktur:e=>IC[e]||120003,"fraktur-bold":e=>120107,"double-struck":e=>LC[e]||120055,"sans-serif":e=>120159,"sans-serif-bold":e=>120211,"sans-serif-italic":e=>120263,"sans-serif-bold-italic":e=>120380,monospace:e=>120367},lowerCaseLatin:{normal:e=>0,bold:e=>119737,italic:e=>e===`h`?8358:119789,"bold-italic":e=>119841,script:e=>FC[e]||119893,"script-bold":e=>119945,fraktur:e=>119997,"fraktur-bold":e=>120101,"double-struck":e=>120049,"sans-serif":e=>120153,"sans-serif-bold":e=>120205,"sans-serif-italic":e=>120257,"sans-serif-bold-italic":e=>120309,monospace:e=>120361},upperCaseGreek:{normal:e=>0,bold:e=>119575,italic:e=>119633,"bold-italic":e=>119575,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>119749,"sans-serif-bold":e=>119749,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>119807,monospace:e=>0},lowerCaseGreek:{normal:e=>0,bold:e=>119569,italic:e=>119627,"bold-italic":e=>e===`ϕ`?119678:119685,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>119743,"sans-serif-bold":e=>119743,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>119801,monospace:e=>0},varGreek:{normal:e=>0,bold:e=>RC[e]||-51,italic:e=>0,"bold-italic":e=>zC[e]||58,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>0,"sans-serif":e=>BC[e]||116,"sans-serif-bold":e=>BC[e]||116,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>VC[e]||174,monospace:e=>0},numeral:{normal:e=>0,bold:e=>120734,italic:e=>0,"bold-italic":e=>0,script:e=>0,"script-bold":e=>0,fraktur:e=>0,"fraktur-bold":e=>0,"double-struck":e=>120744,"sans-serif":e=>120754,"sans-serif-bold":e=>120764,"sans-serif-italic":e=>0,"sans-serif-bold-italic":e=>0,monospace:e=>120774}}),UC=(e,t)=>{let n=e.codePointAt(0),r=64<n&&n<91?`upperCaseLatin`:96<n&&n<123?`lowerCaseLatin`:912<n&&n<938?`upperCaseGreek`:944<n&&n<970||e===`ϕ`?`lowerCaseGreek`:120545<n&&n<120572||RC[e]?`varGreek`:47<n&&n<58?`numeral`:`other`;return r===`other`?e:String.fromCodePoint(n+HC[r][t](e))},WC=Object.freeze({a:`ᴀ`,b:`ʙ`,c:`ᴄ`,d:`ᴅ`,e:`ᴇ`,f:`ꜰ`,g:`ɢ`,h:`ʜ`,i:`ɪ`,j:`ᴊ`,k:`ᴋ`,l:`ʟ`,m:`ᴍ`,n:`ɴ`,o:`ᴏ`,p:`ᴘ`,q:`ǫ`,r:`ʀ`,s:`s`,t:`ᴛ`,u:`ᴜ`,v:`ᴠ`,w:`ᴡ`,x:`x`,y:`ʏ`,z:`ᴢ`}),GC=[`mathrm`,`mathit`],KC=(e,t)=>{if(!GC.includes(t)||!e.body||e.body.type!==`ordgroup`||e.body.body.length===1||e.body.body[0].type!==`mathord`)return!1;for(let t=1;t<e.body.body.length;t++){let n=e.body.body[t].type;if(!(n===`mathord`||n===`textord`&&!isNaN(e.body.body[t].text)))return!1}return!0},qC=(e,t)=>{let n=e.font,r=t.withFont(n),i=Zx(e.body,r);if(i.children.length===0)return i;if(n===`boldsymbol`&&[`mo`,`mpadded`,`mrow`].includes(i.type))return i.style.fontWeight=`bold`,i;if(KC(e,n)){let e=i.children[0].children[0].children?i.children[0].children[0]:i.children[0];delete e.attributes.mathvariant;for(let t=1;t<i.children.length;t++)e.children[0].text+=i.children[t].children[0].children?i.children[t].children[0].children[0].text:i.children[t].children[0].text;if(n===`mathit`)return e.children[0].text=e.children[0].text.split(``).map(e=>UC(e,`italic`)).join(``),e;let t=new W(`mpadded`,[e]);return t.setAttribute(`lspace`,`0`),t}let a=i.children[0].type===`mo`;for(let e=1;e<i.children.length;e++)i.children[e].type===`mo`&&n===`boldsymbol`&&(i.children[e].style.fontWeight=`bold`),i.children[e].type!==`mi`&&(a=!1),(i.children[e].attributes&&i.children[e].attributes.mathvariant||``)!==`normal`&&(a=!1);if(!a)return i;let o=i.children[0];for(let e=1;e<i.children.length;e++)o.children.push(i.children[e].children[0]);return o.attributes.mathvariant&&o.attributes.mathvariant===`normal`?new W(`mrow`,[new W(`mtext`,new vx(`​`)),o]):o},JC={"\\Bbb":`\\mathbb`,"\\bold":`\\mathbf`,"\\frak":`\\mathfrak`,"\\bm":`\\boldsymbol`};ix({type:`font`,names:[`\\mathrm`,`\\mathit`,`\\mathbf`,`\\mathnormal`,`\\up@greek`,`\\boldsymbol`,`\\mathbb`,`\\mathcal`,`\\mathfrak`,`\\mathscr`,`\\mathsf`,`\\mathsfit`,`\\mathtt`,`\\Bbb`,`\\bm`,`\\bold`,`\\frak`],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:t},n)=>{let r=ox(n[0]),i=t;return i in JC&&(i=JC[i]),{type:`font`,mode:e.mode,font:i.slice(1),body:r}},mathmlBuilder:qC}),ix({type:`font`,names:[`\\rm`,`\\sf`,`\\tt`,`\\bf`,`\\it`,`\\cal`],props:{numArgs:0,allowedInText:!0},handler:({parser:e,funcName:t,breakOnTokenText:n},r)=>{let{mode:i}=e,a=e.parseExpression(!0,n,!0);return{type:`font`,mode:i,font:`math${t.slice(1)}`,body:{type:`ordgroup`,mode:e.mode,body:a}}},mathmlBuilder:qC});var YC=[`display`,`text`,`script`,`scriptscript`],XC={auto:-1,display:0,text:0,script:1,scriptscript:2},ZC=(e,t)=>{let n=t;if(e===`display`){let e=n.level>=IS.SCRIPT?IS.TEXT:IS.DISPLAY;n=n.withLevel(e)}else e===`text`&&n.level===IS.DISPLAY?n=n.withLevel(IS.TEXT):e===`auto`?n=n.incrementLevel():e===`script`?n=n.withLevel(IS.SCRIPT):e===`scriptscript`&&(n=n.withLevel(IS.SCRIPTSCRIPT));return n},QC=(e,t)=>{t=ZC(e.scriptLevel,t);let n=Zx(e.numer,t),r=Zx(e.denom,t);t.level===3&&(n.style.mathDepth=`2`,n.setAttribute(`scriptlevel`,`2`),r.style.mathDepth=`2`,r.setAttribute(`scriptlevel`,`2`));let i=new W(`mfrac`,[n,r]);if(!e.hasBarLine)i.setAttribute(`linethickness`,`0px`);else if(e.barSize){let n=mS(e.barSize,t);i.setAttribute(`linethickness`,n.number+n.unit)}if(e.leftDelim!=null||e.rightDelim!=null){let t=[];if(e.leftDelim!=null){let n=new W(`mo`,[new vx(e.leftDelim.replace(`\\`,``))]);n.setAttribute(`fence`,`true`),t.push(n)}if(t.push(i),e.rightDelim!=null){let n=new W(`mo`,[new vx(e.rightDelim.replace(`\\`,``))]);n.setAttribute(`fence`,`true`),t.push(n)}i=Gx(t)}return e.scriptLevel!==`auto`&&(i=new W(`mstyle`,[i]),i.setAttribute(`displaystyle`,String(e.scriptLevel===`display`)),i.setAttribute(`scriptlevel`,XC[e.scriptLevel])),i};ix({type:`genfrac`,names:[`\\cfrac`,`\\dfrac`,`\\frac`,`\\tfrac`,`\\dbinom`,`\\binom`,`\\tbinom`,`\\\\atopfrac`,`\\\\bracefrac`,`\\\\brackfrac`],props:{numArgs:2,allowedInArgument:!0},handler:({parser:e,funcName:t},n)=>{let r=n[0],i=n[1],a=!1,o=null,s=null,c=`auto`;switch(t){case`\\cfrac`:case`\\dfrac`:case`\\frac`:case`\\tfrac`:a=!0;break;case`\\\\atopfrac`:a=!1;break;case`\\dbinom`:case`\\binom`:case`\\tbinom`:o=`(`,s=`)`;break;case`\\\\bracefrac`:o=`\\{`,s=`\\}`;break;case`\\\\brackfrac`:o=`[`,s=`]`;break;default:throw Error(`Unrecognized genfrac command`)}return t===`\\cfrac`||t.startsWith(`\\d`)?c=`display`:t.startsWith(`\\t`)&&(c=`text`),{type:`genfrac`,mode:e.mode,continued:!1,numer:r,denom:i,hasBarLine:a,leftDelim:o,rightDelim:s,scriptLevel:c,barSize:null}},mathmlBuilder:QC}),ix({type:`infix`,names:[`\\over`,`\\choose`,`\\atop`,`\\brace`,`\\brack`],props:{numArgs:0,infix:!0},handler({parser:e,funcName:t,token:n}){let r;switch(t){case`\\over`:r=`\\frac`;break;case`\\choose`:r=`\\binom`;break;case`\\atop`:r=`\\\\atopfrac`;break;case`\\brace`:r=`\\\\bracefrac`;break;case`\\brack`:r=`\\\\brackfrac`;break;default:throw Error(`Unrecognized infix genfrac command`)}return{type:`infix`,mode:e.mode,replaceWith:r,token:n}}});var $C=function(e){let t=null;return e.length>0&&(t=e,t=t===`.`?null:t),t};ix({type:`genfrac`,names:[`\\genfrac`],props:{numArgs:6,allowedInArgument:!0,argTypes:[`math`,`math`,`size`,`text`,`math`,`math`]},handler({parser:e},t){let n=t[4],r=t[5],i=ox(t[0]),a=i.type===`atom`&&i.family===`open`?$C(i.text):null,o=ox(t[1]),s=o.type===`atom`&&o.family===`close`?$C(o.text):null,c=SS(t[2],`size`),l,u=null;c.isBlank?l=!0:(u=c.value,l=u.number>0);let d=`auto`,f=t[3];if(f.type===`ordgroup`){if(f.body.length>0){let e=SS(f.body[0],`textord`);d=YC[Number(e.text)]}}else f=SS(f,`textord`),d=YC[Number(f.text)];return{type:`genfrac`,mode:e.mode,numer:n,denom:r,continued:!1,hasBarLine:l,barSize:u,leftDelim:a,rightDelim:s,scriptLevel:d}},mathmlBuilder:QC}),ix({type:`infix`,names:[`\\above`],props:{numArgs:1,argTypes:[`size`],infix:!0},handler({parser:e,funcName:t,token:n},r){return{type:`infix`,mode:e.mode,replaceWith:`\\\\abovefrac`,barSize:SS(r[0],`size`).value,token:n}}}),ix({type:`genfrac`,names:[`\\\\abovefrac`],props:{numArgs:3,argTypes:[`math`,`size`,`math`]},handler:({parser:e,funcName:t},n)=>{let r=n[0],i=Yb(SS(n[1],`infix`).barSize),a=n[2],o=i.number>0;return{type:`genfrac`,mode:e.mode,numer:r,denom:a,continued:!1,hasBarLine:o,barSize:i,leftDelim:null,rightDelim:null,scriptLevel:`auto`}},mathmlBuilder:QC}),ix({type:`hbox`,names:[`\\hbox`],props:{numArgs:1,argTypes:[`hbox`],allowedInArgument:!0,allowedInText:!1},handler({parser:e},t){return{type:`hbox`,mode:e.mode,body:sx(t[0])}},mathmlBuilder(e,t){let n=t.withLevel(IS.TEXT);return Wx(Xx(e.body,n))}}),ix({type:`horizBracket`,names:[`\\overbrace`,`\\underbrace`,`\\overbracket`,`\\underbracket`],props:{numArgs:1},handler({parser:e,funcName:t},n){return{type:`horizBracket`,mode:e.mode,label:t,isOver:/^\\over/.test(t),base:n[0]}},mathmlBuilder:(e,t)=>{let n=Sx(e.label);return n.style[`math-depth`]=0,new W(e.isOver?`mover`:`munder`,[Zx(e.base,t),n])}}),ix({type:`html`,names:[`\\class`,`\\id`,`\\style`,`\\data`],props:{numArgs:2,argTypes:[`raw`,`original`],allowedInText:!0},handler:({parser:e,funcName:t,token:n},r)=>{let i=SS(r[0],`raw`).string,a=r[1];if(e.settings.strict)throw new U(`Function "${t}" is disabled in strict mode`,n);let o,s={};switch(t){case`\\class`:s.class=i,o={command:`\\class`,class:i};break;case`\\id`:s.id=i,o={command:`\\id`,id:i};break;case`\\style`:s.style=i,o={command:`\\style`,style:i};break;case`\\data`:{let e=i.split(`,`);for(let t=0;t<e.length;t++){let n=e[t].split(`=`);if(n.length!==2)throw new U(`Error parsing key-value for \\data`);s[`data-`+n[0].trim()]=n[1].trim()}o={command:`\\data`,attributes:s};break}default:throw Error(`Unrecognized html command`)}if(!e.settings.isTrusted(o))throw new U(`Function "${t}" is not trusted`,n);return{type:`html`,mode:e.mode,attributes:s,body:sx(a)}},mathmlBuilder:(e,t)=>{let n=Xx(e.body,t),r=[];e.attributes.class&&r.push(...e.attributes.class.trim().split(/\s+/)),n.classes=r;for(let t in e.attributes)t!==`class`&&Object.prototype.hasOwnProperty.call(e.attributes,t)&&n.setAttribute(t,e.attributes[t]);return n}});var ew=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:`bp`};{let t=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!t)throw new U(`Invalid size: '`+e+`' in \\includegraphics`);let n={number:+(t[1]+t[2]),unit:t[3]};if(!fS(n))throw new U(`Invalid unit: '`+n.unit+`' in \\includegraphics.`);return n}};ix({type:`includegraphics`,names:[`\\includegraphics`],props:{numArgs:1,numOptionalArgs:1,argTypes:[`raw`,`url`],allowedInText:!1},handler:({parser:e,token:t},n,r)=>{let i={number:0,unit:`em`},a={number:.9,unit:`em`},o={number:0,unit:`em`},s=``;if(r[0]){let e=SS(r[0],`raw`).string.split(`,`);for(let t=0;t<e.length;t++){let n=e[t].split(`=`);if(n.length===2){let e=n[1].trim();switch(n[0].trim()){case`alt`:s=e;break;case`width`:i=ew(e);break;case`height`:a=ew(e);break;case`totalheight`:o=ew(e);break;default:throw new U(`Invalid key: '`+n[0]+`' in \\includegraphics.`)}}}}let c=SS(n[0],`url`).url;if(s===``&&(s=c,s=s.replace(/^.*[\\/]/,``),s=s.substring(0,s.lastIndexOf(`.`))),!e.settings.isTrusted({command:`\\includegraphics`,url:c}))throw new U(`Function "\\includegraphics" is not trusted`,t);return{type:`includegraphics`,mode:e.mode,alt:s,width:i,height:a,totalheight:o,src:c}},mathmlBuilder:(e,t)=>{let n=mS(e.height,t),r={number:0,unit:`em`};e.totalheight.number>0&&e.totalheight.unit===n.unit&&e.totalheight.number>n.number&&(r.number=e.totalheight.number-n.number,r.unit=n.unit);let i=0;e.width.number>0&&(i=mS(e.width,t));let a={height:n.number+r.number+`em`};i.number>0&&(a.width=i.number+i.unit),r.number>0&&(a.verticalAlign=-r.number+r.unit);let o=new gx(e.src,e.alt,a);return o.height=n,o.depth=r,new W(`mtext`,[o])}}),ix({type:`kern`,names:[`\\kern`,`\\mkern`,`\\hskip`,`\\mskip`],props:{numArgs:1,argTypes:[`size`],primitive:!0,allowedInText:!0},handler({parser:e,funcName:t,token:n},r){let i=SS(r[0],`size`);if(e.settings.strict){let r=t[1]===`m`,a=i.value.unit===`mu`;if(r){if(!a)throw new U(`LaTeX's ${t} supports only mu units, not ${i.value.unit} units`,n);if(e.mode!==`math`)throw new U(`LaTeX's ${t} works only in math mode`,n)}else if(a)throw new U(`LaTeX's ${t} doesn't support mu units`,n)}return{type:`kern`,mode:e.mode,dimension:i.value}},mathmlBuilder(e,t){let n=mS(e.dimension,t),r=n.number>0&&n.unit===`em`?tw(n.number):``;if(e.mode===`text`&&r.length>0)return new W(`mtext`,[new vx(r)]);if(n.number>=0){let e=new W(`mspace`);return e.setAttribute(`width`,n.number+n.unit),e}{let e=new W(`mrow`);return e.style.marginLeft=n.number+n.unit,e}}});var tw=function(e){return e>=.05555&&e<=.05556?` `:e>=.1666&&e<=.1667?` `:e>=.2222&&e<=.2223?` `:e>=.2777&&e<=.2778?`  `:``},nw=/[^A-Za-z_0-9-]/g;ix({type:`label`,names:[`\\label`],props:{numArgs:1,argTypes:[`raw`]},handler({parser:e},t){return{type:`label`,mode:e.mode,string:t[0].string.replace(nw,``)}},mathmlBuilder(e,t){let n=new W(`mrow`,[],[`tml-label`]);return e.string.length>0&&n.setLabel(e.string),n}});var rw=[`\\clap`,`\\llap`,`\\rlap`];ix({type:`lap`,names:[`\\mathllap`,`\\mathrlap`,`\\mathclap`,`\\clap`,`\\llap`,`\\rlap`],props:{numArgs:1,allowedInText:!0},handler:({parser:e,funcName:t,token:n},r)=>{if(rw.includes(t)){if(e.settings.strict&&e.mode!==`text`)throw new U(`{${t}} can be used only in text mode.
133
+ Try \\math${t.slice(1)}`,n);t=t.slice(1)}else t=t.slice(5);let i=r[0];return{type:`lap`,mode:e.mode,alignment:t,body:i}},mathmlBuilder:(e,t)=>{let n;e.alignment===`llap`&&(n=new W(`mpadded`,[new W(`mphantom`,Yx(sx(e.body),t))]),n.setAttribute(`width`,`0.1px`));let r=Zx(e.body,t),i;if(e.alignment===`llap`?(r.style.position=`absolute`,r.style.right=`0`,r.style.bottom=`0`,i=new W(`mpadded`,[n,r])):i=new W(`mpadded`,[r]),e.alignment===`rlap`)e.body.body.length>0&&e.body.body[0].type===`genfrac`&&i.setAttribute(`lspace`,`0.16667em`);else{let t=e.alignment===`llap`?`-1`:`-0.5`;i.setAttribute(`lspace`,t+`width`),e.alignment===`llap`?i.style.position=`relative`:(i.style.display=`flex`,i.style.justifyContent=`center`)}return i.setAttribute(`width`,`0.1px`),i}}),ix({type:`ordgroup`,names:[`\\(`,`$`],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler({funcName:e,parser:t},n){let r=t.mode;t.switchMode(`math`);let i=e===`\\(`?`\\)`:`$`,a=t.parseExpression(!1,i);return t.expect(i),t.switchMode(r),{type:`ordgroup`,mode:t.mode,body:a}}}),ix({type:`text`,names:[`\\)`,`\\]`],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(e,t){throw new U(`Mismatched ${e.funcName}`,t)}});var iw=(e,t)=>{switch(t.level){case IS.DISPLAY:return e.display;case IS.TEXT:return e.text;case IS.SCRIPT:return e.script;case IS.SCRIPTSCRIPT:return e.scriptscript;default:return e.text}};ix({type:`mathchoice`,names:[`\\mathchoice`],props:{numArgs:4,primitive:!0},handler:({parser:e},t)=>({type:`mathchoice`,mode:e.mode,display:sx(t[0]),text:sx(t[1]),script:sx(t[2]),scriptscript:sx(t[3])}),mathmlBuilder:(e,t)=>Xx(iw(e,t),t)});var aw=[`text`,`textord`,`mathord`,`atom`];function ow(e,t){let n,r=Yx(e.body,t);if(e.mclass===`minner`)n=new W(`mpadded`,r);else if(e.mclass===`mord`)e.isCharacterBox||r[0].type===`mathord`?(n=r[0],n.type=`mi`,n.children.length===1&&n.children[0].text&&n.children[0].text===`∇`&&n.setAttribute(`mathvariant`,`normal`)):n=new W(`mi`,r);else{n=new W(`mrow`,r),e.mustPromote?(n=r[0],n.type=`mo`,e.isCharacterBox&&e.body[0].text&&/[A-Za-z]/.test(e.body[0].text)&&n.setAttribute(`mathvariant`,`italic`)):n=new W(`mrow`,r);let i=t.level<2;n.type===`mrow`?i&&(e.mclass===`mbin`?(n.children.unshift(hS(.2222)),n.children.push(hS(.2222))):e.mclass===`mrel`?(n.children.unshift(hS(.2778)),n.children.push(hS(.2778))):e.mclass===`mpunct`?n.children.push(hS(.1667)):e.mclass===`minner`&&(n.children.unshift(hS(.0556)),n.children.push(hS(.0556)))):e.mclass===`mbin`?(n.attributes.lspace=i?`0.2222em`:`0`,n.attributes.rspace=i?`0.2222em`:`0`):e.mclass===`mrel`?(n.attributes.lspace=i?`0.2778em`:`0`,n.attributes.rspace=i?`0.2778em`:`0`):e.mclass===`mpunct`?(n.attributes.lspace=`0em`,n.attributes.rspace=i?`0.1667em`:`0`):e.mclass===`mopen`||e.mclass===`mclose`?(n.attributes.lspace=`0em`,n.attributes.rspace=`0em`):e.mclass===`minner`&&i&&(n.attributes.lspace=`0.0556em`,n.attributes.width=`+0.1111em`),e.mclass!==`mopen`&&e.mclass!==`mclose`&&(delete n.attributes.stretchy,delete n.attributes.form)}return n}ix({type:`mclass`,names:[`\\mathord`,`\\mathbin`,`\\mathrel`,`\\mathopen`,`\\mathclose`,`\\mathpunct`,`\\mathinner`],props:{numArgs:1,primitive:!0},handler({parser:e,funcName:t},n){let r=n[0],i=Jb(r),a=!0,o={type:`mathord`,text:``,mode:e.mode},s=r.body?r.body:[r];for(let t of s)if(aw.includes(t.type))Dx[e.mode][t.text]?o.text+=Dx[e.mode][t.text].replace:t.text?o.text+=t.text:t.body&&t.body.map(e=>{o.text+=e.text});else{a=!1;break}return a&&t===`\\mathord`&&o.type===`mathord`&&o.text.length>1?o:{type:`mclass`,mode:e.mode,mclass:`m`+t.slice(5),body:sx(a?o:r),isCharacterBox:i,mustPromote:a}},mathmlBuilder:ow});var sw=e=>{let t=e.type===`ordgroup`&&e.body.length&&e.body.length===1?e.body[0]:e;if(t.type===`atom`){let n=e.body.length>0&&e.body[0].text&&Dx.math[e.body[0].text]?Dx.math[e.body[0].text].group:t.family;return n===`bin`||n===`rel`?`m`+n:`mord`}return`mord`};ix({type:`mclass`,names:[`\\@binrel`],props:{numArgs:2},handler({parser:e},t){return{type:`mclass`,mode:e.mode,mclass:sw(t[0]),body:sx(t[1]),isCharacterBox:Jb(t[1])}}}),ix({type:`mclass`,names:[`\\stackrel`,`\\overset`,`\\underset`],props:{numArgs:2},handler({parser:e,funcName:t},n){let r=n[1],i=n[0],a;a=t===`\\stackrel`?`mrel`:sw(r);let o={type:a===`mrel`||a===`mbin`?`op`:`ordgroup`,mode:r.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:t!==`\\stackrel`,body:sx(r)};return{type:`supsub`,mode:i.mode,stack:!0,base:o,sup:t===`\\underset`?null:i,sub:t===`\\underset`?i:null}},mathmlBuilder:ow});var cw=(e,t,n)=>{if(!e)return n;let r=Zx(e,t);return r.type===`mrow`&&r.children.length===0?n:r};ix({type:`multiscript`,names:[`\\sideset`,`\\pres@cript`],props:{numArgs:3},handler({parser:e,funcName:t,token:n},r){if(r[2].body.length===0)throw new U(t+`cannot parse an empty base.`);let i=r[2].body[0];if(e.settings.strict&&t===`\\sideset`&&!i.symbol)throw new U(`The base of \\sideset must be a big operator. Try \\prescript.`);if(r[0].body.length>0&&r[0].body[0].type!==`supsub`||r[1].body.length>0&&r[1].body[0].type!==`supsub`)throw new U(`\\sideset can parse only subscripts and superscripts in its first two arguments`,n);let a=r[0].body.length>0?r[0].body[0]:null,o=r[1].body.length>0?r[1].body[0]:null;return!a&&!o?i:a?{type:`multiscript`,mode:e.mode,isSideset:t===`\\sideset`,prescripts:a,postscripts:o,base:i}:{type:`styling`,mode:e.mode,scriptLevel:`text`,body:[{type:`supsub`,mode:e.mode,base:i,sup:o.sup,sub:o.sub}]}},mathmlBuilder(e,t){let n=Zx(e.base,t),r=new W(`mprescripts`),i=new W(`none`),a=[],o=cw(e.prescripts.sub,t,i),s=cw(e.prescripts.sup,t,i);return e.isSideset&&(o.setAttribute(`style`,`text-align: left;`),s.setAttribute(`style`,`text-align: left;`)),a=e.postscripts?[n,cw(e.postscripts.sub,t,i),cw(e.postscripts.sup,t,i),r,o,s]:[n,r,o,s],new W(`mmultiscripts`,a)}}),ix({type:`not`,names:[`\\not`],props:{numArgs:1,primitive:!0,allowedInText:!1},handler({parser:e},t){let n=Jb(t[0]),r;return n?(r=sx(t[0]),r[0].text.charAt(0)===`\\`&&(r[0].text=Dx.math[r[0].text].replace),r[0].text=r[0].text.slice(0,1)+`̸`+r[0].text.slice(1)):r=[{type:`textord`,mode:`math`,text:`̸`},{type:`kern`,mode:`math`,dimension:{number:-.6,unit:`em`}},t[0]],{type:`not`,mode:e.mode,body:r,isCharacterBox:n}},mathmlBuilder(e,t){return e.isCharacterBox?Yx(e.body,t,!0)[0]:Xx(e.body,t)}});var lw=[`textord`,`mathord`,`atom`],uw=[`\\smallint`],dw=[`textord`,`mathord`,`ordgroup`,`close`,`leftright`,`font`],fw=e=>{e.attributes.lspace=`0.1667em`,e.attributes.rspace=`0.1667em`},pw=(e,t)=>{let n;if(e.symbol)n=new W(`mo`,[Hx(e.name,e.mode)]),uw.includes(e.name)?n.setAttribute(`largeop`,`false`):n.setAttribute(`movablelimits`,`false`),e.fromMathOp&&fw(n);else if(e.body)n=new W(`mo`,Yx(e.body,t)),e.fromMathOp&&fw(n);else if(n=new W(`mi`,[new vx(e.name.slice(1))]),!e.parentIsSupSub){let t=new W(`mo`,[Hx(`⁡`,`text`)]),r=[n,t];if(e.needsLeadingSpace){let e=new W(`mspace`);e.setAttribute(`width`,`0.1667em`),r.unshift(e)}if(!e.isFollowedByDelimiter){let e=new W(`mspace`);e.setAttribute(`width`,`0.1667em`),r.push(e)}n=new W(`mrow`,r)}return n},mw={"∏":`\\prod`,"∐":`\\coprod`,"∑":`\\sum`,"⋀":`\\bigwedge`,"⋁":`\\bigvee`,"⋂":`\\bigcap`,"⋃":`\\bigcup`,"⨀":`\\bigodot`,"⨁":`\\bigoplus`,"⨂":`\\bigotimes`,"⨄":`\\biguplus`,"⨅":`\\bigsqcap`,"⨆":`\\bigsqcup`,"⨃":`\\bigcupdot`,"⨇":`\\bigdoublevee`,"⨈":`\\bigdoublewedge`,"⨉":`\\bigtimes`};ix({type:`op`,names:`\\coprod.\\bigvee.\\bigwedge.\\biguplus.\\bigcupplus.\\bigcupdot.\\bigcap.\\bigcup.\\bigdoublevee.\\bigdoublewedge.\\intop.\\prod.\\sum.\\bigotimes.\\bigoplus.\\bigodot.\\bigsqcap.\\bigsqcup.\\bigtimes.\\smallint.∏.∐.∑.⋀.⋁.⋂.⋃.⨀.⨁.⨂.⨃.⨄.⨅.⨆.⨇.⨈.⨉`.split(`.`),props:{numArgs:0},handler:({parser:e,funcName:t},n)=>{let r=t;return r.length===1&&(r=mw[r]),{type:`op`,mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!0,stack:!1,name:r}},mathmlBuilder:pw}),ix({type:`op`,names:[`\\mathop`],props:{numArgs:1,primitive:!0},handler:({parser:e},t)=>{let n=t[0],r=n.body?n.body:[n],i=r.length===1&&lw.includes(r[0].type);return{type:`op`,mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:i,fromMathOp:!0,stack:!1,name:i?r[0].text:null,body:i?null:sx(n)}},mathmlBuilder:pw});var hw={"∫":`\\int`,"∬":`\\iint`,"∭":`\\iiint`,"∮":`\\oint`,"∯":`\\oiint`,"∰":`\\oiiint`,"∱":`\\intclockwise`,"∲":`\\varointclockwise`,"⨌":`\\iiiint`,"⨍":`\\intbar`,"⨎":`\\intBar`,"⨏":`\\fint`,"⨒":`\\rppolint`,"⨓":`\\scpolint`,"⨕":`\\pointint`,"⨖":`\\sqint`,"⨗":`\\intlarhk`,"⨘":`\\intx`,"⨙":`\\intcap`,"⨚":`\\intcup`};ix({type:`op`,names:`\\arcsin.\\arccos.\\arctan.\\arctg.\\arcctg.\\arg.\\ch.\\cos.\\cosec.\\cosh.\\cot.\\cotg.\\coth.\\csc.\\ctg.\\cth.\\deg.\\dim.\\exp.\\hom.\\ker.\\lg.\\ln.\\log.\\sec.\\sin.\\sinh.\\sh.\\sgn.\\tan.\\tanh.\\tg.\\th`.split(`.`),props:{numArgs:0},handler({parser:e,funcName:t}){let n=e.prevAtomType,r=e.gullet.future().text;return{type:`op`,mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:DC(r),needsLeadingSpace:n.length>0&&dw.includes(n),name:t}},mathmlBuilder:pw}),ix({type:`op`,names:[`\\det`,`\\gcd`,`\\inf`,`\\lim`,`\\max`,`\\min`,`\\Pr`,`\\sup`],props:{numArgs:0},handler({parser:e,funcName:t}){let n=e.prevAtomType,r=e.gullet.future().text;return{type:`op`,mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,stack:!1,isFollowedByDelimiter:DC(r),needsLeadingSpace:n.length>0&&dw.includes(n),name:t}},mathmlBuilder:pw}),ix({type:`op`,names:`\\int.\\iint.\\iiint.\\iiiint.\\oint.\\oiint.\\oiiint.\\intclockwise.\\varointclockwise.\\intbar.\\intBar.\\fint.\\rppolint.\\scpolint.\\pointint.\\sqint.\\intlarhk.\\intx.\\intcap.\\intcup.∫.∬.∭.∮.∯.∰.∱.∲.⨌.⨍.⨎.⨏.⨒.⨓.⨕.⨖.⨗.⨘.⨙.⨚`.split(`.`),props:{numArgs:0,allowedInArgument:!0},handler({parser:e,funcName:t}){let n=t;return n.length===1&&(n=hw[n]),{type:`op`,mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,stack:!1,name:n}},mathmlBuilder:pw}),ix({type:`operatorname`,names:[`\\operatorname@`,`\\operatornamewithlimits`],props:{numArgs:1,allowedInArgument:!0},handler:({parser:e,funcName:t},n)=>{let r=n[0],i=e.prevAtomType,a=e.gullet.future().text;return{type:`operatorname`,mode:e.mode,body:sx(r),alwaysHandleSupSub:t===`\\operatornamewithlimits`,limits:!1,parentIsSupSub:!1,isFollowedByDelimiter:DC(a),needsLeadingSpace:i.length>0&&dw.includes(i)}},mathmlBuilder:(e,t)=>{let n=Yx(e.body,t.withFont(`mathrm`)),r=!0;for(let e=0;e<n.length;e++){let t=n[e];if(t instanceof W)switch(((t.type===`mrow`||t.type===`mpadded`)&&t.children.length===1&&t.children[0]instanceof W||t.type===`mrow`&&t.children.length===2&&t.children[0]instanceof W&&t.children[1]instanceof W&&t.children[1].type===`mspace`&&!t.children[1].attributes.width&&t.children[1].children.length===0)&&(t=t.children[0]),t.type){case`mi`:case`mn`:case`ms`:case`mtext`:break;case`mspace`:if(t.attributes.width){let i=t.attributes.width.replace(`em`,``),a=tw(Number(i));a===``?r=!1:n[e]=new W(`mtext`,[new vx(a)])}break;case`mo`:{let e=t.children[0];t.children.length===1&&e instanceof vx?e.text=e.text.replace(/\u2212/,`-`).replace(/\u2217/,`*`):r=!1;break}default:r=!1}else r=!1}if(r)n=[new vx(n.map(e=>e.toText()).join(``))];else if(n.length===1&&[`mover`,`munder`].includes(n[0].type)&&(n[0].children[0].type===`mi`||n[0].children[0].type===`mtext`)){if(n[0].children[0].type=`mi`,e.parentIsSupSub)return new W(`mrow`,n);{let e=new W(`mo`,[Hx(`⁡`,`text`)]);return _x([n[0],e])}}let i;if(r?(i=new W(`mi`,n),n[0].text.length===1&&i.setAttribute(`mathvariant`,`normal`)):i=new W(`mrow`,n),!e.parentIsSupSub){let t=new W(`mo`,[Hx(`⁡`,`text`)]),n=[i,t];if(e.needsLeadingSpace){let e=new W(`mspace`);e.setAttribute(`width`,`0.1667em`),n.unshift(e)}if(!e.isFollowedByDelimiter){let e=new W(`mspace`);e.setAttribute(`width`,`0.1667em`),n.push(e)}return _x(n)}return i}}),Q(`\\operatorname`,`\\@ifstar\\operatornamewithlimits\\operatorname@`),ax({type:`ordgroup`,mathmlBuilder(e,t){return Xx(e.body,t,e.semisimple)}}),ix({type:`phantom`,names:[`\\phantom`],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{let n=t[0];return{type:`phantom`,mode:e.mode,body:sx(n)}},mathmlBuilder:(e,t)=>new W(`mphantom`,Yx(e.body,t))}),ix({type:`hphantom`,names:[`\\hphantom`],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{let n=t[0];return{type:`hphantom`,mode:e.mode,body:n}},mathmlBuilder:(e,t)=>{let n=new W(`mpadded`,[new W(`mphantom`,Yx(sx(e.body),t))]);return n.setAttribute(`height`,`0px`),n.setAttribute(`depth`,`0px`),n}}),ix({type:`vphantom`,names:[`\\vphantom`],props:{numArgs:1,allowedInText:!0},handler:({parser:e},t)=>{let n=t[0];return{type:`vphantom`,mode:e.mode,body:n}},mathmlBuilder:(e,t)=>{let n=new W(`mpadded`,[new W(`mphantom`,Yx(sx(e.body),t))]);return n.setAttribute(`width`,`0.1px`),n}}),ix({type:`pmb`,names:[`\\pmb`],props:{numArgs:1,allowedInText:!0},handler({parser:e},t){return{type:`pmb`,mode:e.mode,body:sx(t[0])}},mathmlBuilder(e,t){let n=yx(Yx(e.body,t));return n.setAttribute(`style`,`font-weight:bold`),n}});var gw=(e,t)=>{let n=t.withLevel(IS.TEXT),r=new W(`mpadded`,[Zx(e.body,n)]),i=mS(e.dy,t);return r.setAttribute(`voffset`,i.number+i.unit),i.number>0?r.style.padding=i.number+i.unit+` 0 0 0`:r.style.padding=`0 0 `+Math.abs(i.number)+i.unit+` 0`,r};ix({type:`raise`,names:[`\\raise`,`\\lower`],props:{numArgs:2,argTypes:[`size`,`primitive`],primitive:!0},handler({parser:e,funcName:t},n){let r=SS(n[0],`size`).value;t===`\\lower`&&(r.number*=-1);let i=n[1];return{type:`raise`,mode:e.mode,dy:r,body:i}},mathmlBuilder:gw}),ix({type:`raise`,names:[`\\raisebox`],props:{numArgs:2,argTypes:[`size`,`hbox`],allowedInText:!0},handler({parser:e,funcName:t},n){let r=SS(n[0],`size`).value,i=n[1];return{type:`raise`,mode:e.mode,dy:r,body:i}},mathmlBuilder:gw}),ix({type:`ref`,names:[`\\ref`,`\\eqref`],props:{numArgs:1,argTypes:[`raw`]},handler({parser:e,funcName:t},n){return{type:`ref`,mode:e.mode,funcName:t,string:n[0].string.replace(nw,``)}},mathmlBuilder(e,t){let n=e.funcName===`\\ref`?[`tml-ref`]:[`tml-ref`,`tml-eqref`];return new hx(`#`+e.string,n,null)}}),ix({type:`reflect`,names:[`\\reflectbox`],props:{numArgs:1,argTypes:[`hbox`],allowedInText:!0},handler({parser:e},t){return{type:`reflect`,mode:e.mode,body:t[0]}},mathmlBuilder(e,t){let n=Zx(e.body,t);return n.style.transform=`scaleX(-1)`,n}}),ix({type:`internal`,names:[`\\relax`],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler({parser:e}){return{type:`internal`,mode:e.mode}}}),ix({type:`rule`,names:[`\\rule`],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:[`size`,`size`,`size`]},handler({parser:e},t,n){let r=n[0],i=SS(t[0],`size`),a=SS(t[1],`size`);return{type:`rule`,mode:e.mode,shift:r&&SS(r,`size`).value,width:i.value,height:a.value}},mathmlBuilder(e,t){let n=mS(e.width,t),r=mS(e.height,t),i=e.shift?mS(e.shift,t):{number:0,unit:`em`},a=t.color&&t.getColor()||`black`,o=new W(`mspace`);if(n.number>0&&r.number>0&&o.setAttribute(`mathbackground`,a),o.setAttribute(`width`,n.number+n.unit),o.setAttribute(`height`,r.number+r.unit),i.number===0)return o;let s=new W(`mpadded`,[o]);return i.number>=0?s.setAttribute(`height`,`+`+i.number+i.unit):(s.setAttribute(`height`,i.number+i.unit),s.setAttribute(`depth`,`+`+-i.number+i.unit)),s.setAttribute(`voffset`,i.number+i.unit),s}});var _w=/^[0-9]$/,vw={0:`₀`,1:`₁`,2:`₂`,3:`₃`,4:`₄`,5:`₅`,6:`₆`,7:`₇`,8:`₈`,9:`₉`},yw={0:`⁰`,1:`¹`,2:`²`,3:`³`,4:`⁴`,5:`⁵`,6:`⁶`,7:`⁷`,8:`⁸`,9:`⁹`};ix({type:`sfrac`,names:[`\\sfrac`],props:{numArgs:2,allowedInText:!0,allowedInMath:!0},handler({parser:e},t){let n=``;for(let e of t[0].body){if(e.type!==`textord`||!_w.test(e.text))throw new U(`Numerator must be an integer.`,e);n+=e.text}let r=``;for(let e of t[1].body){if(e.type!==`textord`||!_w.test(e.text))throw new U(`Denominator must be an integer.`,e);r+=e.text}return{type:`sfrac`,mode:e.mode,numerator:n,denominator:r}},mathmlBuilder(e,t){let n=e.numerator.split(``).map(e=>yw[e]).join(``),r=e.denominator.split(``).map(e=>vw[e]).join(``);return new W(`mn`,[new vx(n+`⁄`+r,e.mode,t)],[`special-fraction`])}});var bw={"\\tiny":.5,"\\sixptsize":.6,"\\Tiny":.6,"\\scriptsize":.7,"\\footnotesize":.8,"\\small":.9,"\\normalsize":1,"\\large":1.2,"\\Large":1.44,"\\LARGE":1.728,"\\huge":2.074,"\\Huge":2.488};ix({type:`sizing`,names:[`\\tiny`,`\\sixptsize`,`\\Tiny`,`\\scriptsize`,`\\footnotesize`,`\\small`,`\\normalsize`,`\\large`,`\\Large`,`\\LARGE`,`\\huge`,`\\Huge`],props:{numArgs:0,allowedInText:!0},handler:({breakOnTokenText:e,funcName:t,parser:n},r)=>{n.settings.strict&&n.mode===`math`&&console.log(`Temml strict-mode warning: Command ${t} is invalid in math mode.`);let i=n.parseExpression(!1,e,!0);return{type:`sizing`,mode:n.mode,funcName:t,body:i}},mathmlBuilder:(e,t)=>{let n=t.withFontSize(bw[e.funcName]),r=yx(Yx(e.body,n)),i=(bw[e.funcName]/t.fontSize).toFixed(4);return r.setAttribute(`mathsize`,i+`em`),r}}),ix({type:`smash`,names:[`\\smash`],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:({parser:e},t,n)=>{let r=!1,i=!1,a=n[0]&&SS(n[0],`ordgroup`);if(a){let e=``;for(let t=0;t<a.body.length;++t)if(e=a.body[t].text,e===`t`)r=!0;else if(e===`b`)i=!0;else{r=!1,i=!1;break}}else r=!0,i=!0;let o=t[0];return{type:`smash`,mode:e.mode,body:o,smashHeight:r,smashDepth:i}},mathmlBuilder:(e,t)=>{let n=new W(`mpadded`,[Zx(e.body,t)]);return e.smashHeight&&n.setAttribute(`height`,`0px`),e.smashDepth&&n.setAttribute(`depth`,`0px`),n}});var xw=`a.c.e.ı.m.n.o.r.s.u.v.w.x.z.α.ε.ι.κ.ν.ο.π.σ.τ.υ.ω.\\alpha.\\epsilon.\\iota.\\kappa.\\nu.\\omega.\\pi.\\tau.\\omega`.split(`.`);ix({type:`sqrt`,names:[`\\sqrt`],props:{numArgs:1,numOptionalArgs:1},handler({parser:e},t,n){let r=n[0],i=t[0];return i.body&&i.body.length===1&&i.body[0].text&&xw.includes(i.body[0].text)&&i.body.push({type:`rule`,mode:`math`,shift:null,width:{number:0,unit:`pt`},height:{number:.5,unit:`em`}}),{type:`sqrt`,mode:e.mode,body:i,index:r}},mathmlBuilder(e,t){let{body:n,index:r}=e;return r?new W(`mroot`,[Zx(n,t),Zx(r,t.incrementLevel())]):new W(`msqrt`,[Zx(n,t)])}});var Sw={display:0,text:1,script:2,scriptscript:3},Cw={display:[`0`,`true`],text:[`0`,`false`],script:[`1`,`false`],scriptscript:[`2`,`false`]};ix({type:`styling`,names:[`\\displaystyle`,`\\textstyle`,`\\scriptstyle`,`\\scriptscriptstyle`],props:{numArgs:0,allowedInText:!0,primitive:!0},handler({breakOnTokenText:e,funcName:t,parser:n},r){let i=n.parseExpression(!0,e,!0),a=t.slice(1,t.length-5);return{type:`styling`,mode:n.mode,scriptLevel:a,body:i}},mathmlBuilder(e,t){let n=t.withLevel(Sw[e.scriptLevel]),r=yx(Yx(e.body,n)),i=Cw[e.scriptLevel];return r.setAttribute(`scriptlevel`,i[0]),r.setAttribute(`displaystyle`,i[1]),r}});var ww=/^m(over|under|underover)$/,Tw=`DHKLUcegorsuvxyzΠΥΨαδηιμνοτυχϵ`,Ew=`BCEFGIMNOPQRSTXZlpqtwΓΘΞΣΦΩβεζθξρςφψϑϕϱ`,Dw=`AJdfΔΛ`;ax({type:`supsub`,mathmlBuilder(e,t){let n=!1,r,i,a=!1,o=!1,s=!1;e.base&&e.base.type===`horizBracket`&&(i=!!e.sup,i===e.base.isOver&&(n=!0,r=e.base.isOver)),e.base&&!e.stack&&(e.base.type===`op`||e.base.type===`operatorname`)&&(e.base.parentIsSupSub=!0,a=!e.base.symbol,o=a&&!e.isFollowedByDelimiter,s=e.base.needsLeadingSpace);let c=e.stack&&e.base.body.length===1?[Zx(e.base.body[0],t)]:[Zx(e.base,t)],l=t.inSubOrSup();if(e.sub){let n=Zx(e.sub,l);t.level===3&&n.setAttribute(`scriptlevel`,`2`),c.push(n)}if(e.sup){let n=Zx(e.sup,l);if(t.level===3&&n.setAttribute(`scriptlevel`,`2`),e.base&&e.base.text&&e.base.text.length===1){let t=e.base.text;Tw.indexOf(t)>-1?n.classes.push(`tml-sml-pad`):Ew.indexOf(t)>-1?n.classes.push(`tml-med-pad`):Dw.indexOf(t)>-1&&n.classes.push(`tml-lrg-pad`)}c.push(n)}let u;if(n)u=r?`mover`:`munder`;else if(!e.sub){let n=e.base;u=n&&n.type===`op`&&n.limits&&(t.level===IS.DISPLAY||n.alwaysHandleSupSub)||n&&n.type===`operatorname`&&n.alwaysHandleSupSub&&(n.limits||t.level===IS.DISPLAY)?`mover`:`msup`}else if(e.sup){let n=e.base;u=n&&(n.type===`op`&&n.limits||n.type===`multiscript`)&&(t.level===IS.DISPLAY||n.alwaysHandleSupSub)||n&&n.type===`operatorname`&&n.alwaysHandleSupSub&&(t.level===IS.DISPLAY||n.limits)?`munderover`:`msubsup`}else{let n=e.base;u=e.stack||n&&n.type===`op`&&n.limits&&(t.level===IS.DISPLAY||n.alwaysHandleSupSub)||n&&n.type===`operatorname`&&n.alwaysHandleSupSub&&(n.limits||t.level===IS.DISPLAY)?`munder`:`msub`}let d=new W(u,c);if(a){let e=new W(`mo`,[Hx(`⁡`,`text`)]);if(s){let t=new W(`mspace`);t.setAttribute(`width`,`0.1667em`),d=_x([t,d,e])}else d=_x([d,e]);if(o){let e=new W(`mspace`);e.setAttribute(`width`,`0.1667em`),d.children.push(e)}}else ww.test(u)&&(d=new W(`mrow`,[d]));return d}});var Ow=[`\\shortmid`,`\\nshortmid`,`\\shortparallel`,`\\nshortparallel`,`\\smallsetminus`],kw=[`\\Rsh`,`\\Lsh`,`\\restriction`],Aw=e=>{if(e.length===1){let t=e.codePointAt(0);return 8591<t&&t<8704}return e.indexOf(`arrow`)>-1||e.indexOf(`harpoon`)>-1||kw.includes(e)};ax({type:`atom`,mathmlBuilder(e,t){if(e.family===`inner`)return new W(e.mode===`text`?`mtext`:`mi`,[Hx(e.text,e.mode)]);let n=new W(`mo`,[Hx(e.text,e.mode)]);if(e.family===`punct`)n.setAttribute(`separator`,`true`);else if(e.family===`open`||e.family===`close`)e.family===`open`?(n.setAttribute(`form`,`prefix`),n.setAttribute(`stretchy`,`false`)):e.family===`close`&&(n.setAttribute(`form`,`postfix`),n.setAttribute(`stretchy`,`false`));else if(e.text===`\\mid`)n.setAttribute(`lspace`,`0.22em`),n.setAttribute(`rspace`,`0.22em`),n.setAttribute(`stretchy`,`false`);else if(e.family===`rel`&&Aw(e.text))n.setAttribute(`stretchy`,`false`);else if(Ow.includes(e.text))n.setAttribute(`mathsize`,`70%`);else if(e.text===`:`)n.attributes.lspace=`0.2222em`,n.attributes.rspace=`0.2222em`;else if(e.needsSpacing)return e.family===`bin`?new W(`mrow`,[hS(.222),n,hS(.222)]):new W(`mrow`,[hS(.2778),n,hS(.2778)]);return n}});var jw={mathbf:`bold`,mathrm:`normal`,textit:`italic`,mathit:`italic`,mathnormal:`italic`,mathbb:`double-struck`,mathcal:`script`,mathfrak:`fraktur`,mathscr:`script`,mathsf:`sans-serif`,mathtt:`monospace`},Mw=function(e,t){if(t.fontFamily===`texttt`)return`monospace`;if(t.fontFamily===`textsc`)return`normal`;if(t.fontFamily===`textsf`)return t.fontShape===`textit`&&t.fontWeight===`textbf`?`sans-serif-bold-italic`:t.fontShape===`textit`?`sans-serif-italic`:t.fontWeight===`textbf`?`sans-serif-bold`:`sans-serif`;if(t.fontShape===`textit`&&t.fontWeight===`textbf`)return`bold-italic`;if(t.fontShape===`textit`)return`italic`;if(t.fontWeight===`textbf`)return`bold`;let n=t.font;if(!n||n===`mathnormal`)return null;let r=e.mode;switch(n){case`mathit`:return`italic`;case`mathrm`:{let t=e.text.codePointAt(0);return 939<t&&t<975?`italic`:`normal`}case`greekItalic`:return`italic`;case`up@greek`:return`normal`;case`boldsymbol`:case`mathboldsymbol`:return`bold-italic`;case`mathbf`:return`bold`;case`mathbb`:return`double-struck`;case`mathfrak`:return`fraktur`;case`mathscr`:case`mathcal`:return`script`;case`mathsf`:return`sans-serif`;case`mathsfit`:return`sans-serif-italic`;case`mathtt`:return`monospace`}let i=e.text;return Dx[r][i]&&Dx[r][i].replace&&(i=Dx[r][i].replace),Object.prototype.hasOwnProperty.call(jw,n)?jw[n]:null},Nw=/^\d(?:[\d,.]*\d)?$/,Pw=/[A-Ba-z]/,Fw=new Set([`\\prime`,`\\dprime`,`\\trprime`,`\\qprime`,`\\backprime`,`\\backdprime`,`\\backtrprime`]),Iw=(e,t,n)=>{let r=new W(`mstyle`,[new W(n,[e])]);return r.style[`font-style`]=`italic`,r.style[`font-family`]=`Cambria, 'Times New Roman', serif`,t===`bold-italic`&&(r.style[`font-weight`]=`bold`),r};ax({type:`mathord`,mathmlBuilder(e,t){let n=Hx(e.text,e.mode,t),r=n.text.codePointAt(0),i=912<r&&r<938?`normal`:`italic`,a=Mw(e,t)||i;if(a===`script`)return n.text=UC(n.text,a),new W(`mi`,[n],[t.font]);a!==`italic`&&(n.text=UC(n.text,a));let o=new W(`mi`,[n]);if(a===`normal`&&(o.setAttribute(`mathvariant`,`normal`),n.text.length===1)){let e=new W(`mspace`,[]);o=new W(`mrow`,[o,e])}return o}}),ax({type:`textord`,mathmlBuilder(e,t){let n=e.text,r=n.codePointAt(0);t.fontFamily===`textsc`&&96<r&&r<123&&(n=WC[n]);let i=Hx(n,e.mode,t),a=Mw(e,t)||`normal`,o;if(Nw.test(e.text)){let t=e.mode===`text`?`mtext`:`mn`;if(a===`italic`||a===`bold-italic`)return Iw(i,a,t);a!==`normal`&&(i.text=i.text.split(``).map(e=>UC(e,a)).join(``)),o=new W(t,[i])}else if(e.mode===`text`)a!==`normal`&&(i.text=UC(i.text,a)),o=new W(`mtext`,[i]);else if(Fw.has(e.text))o=new W(`mo`,[i]),o.classes.push(`tml-prime`);else{let e=i.text;a!==`italic`&&(i.text=UC(i.text,a)),o=new W(`mi`,[i]),i.text===e&&Pw.test(e)&&o.setAttribute(`mathvariant`,`italic`)}return o}});var Lw={"\\nobreak":`nobreak`,"\\allowbreak":`allowbreak`},Rw={" ":{},"\\ ":{},"~":{className:`nobreak`},"\\space":{},"\\nobreakspace":{className:`nobreak`}};ax({type:`spacing`,mathmlBuilder(e,t){let n;if(Object.prototype.hasOwnProperty.call(Rw,e.text))n=new W(`mtext`,[new vx(`\xA0`)]);else if(Object.prototype.hasOwnProperty.call(Lw,e.text))n=new W(`mo`),e.text===`\\nobreak`&&n.setAttribute(`linebreak`,`nobreak`);else throw new U(`Unknown type of space "${e.text}"`);return n}}),ax({type:`tag`});var zw={"\\text":void 0,"\\textrm":`textrm`,"\\textsf":`textsf`,"\\texttt":`texttt`,"\\textnormal":`textrm`,"\\textsc":`textsc`},Bw={"\\textbf":`textbf`,"\\textmd":`textmd`},Vw={"\\textit":`textit`,"\\textup":`textup`},Hw=(e,t)=>{let n=e.font;return n?zw[n]?t.withTextFontFamily(zw[n]):Bw[n]?t.withTextFontWeight(Bw[n]):n===`\\emph`?t.fontShape===`textit`?t.withTextFontShape(`textup`):t.withTextFontShape(`textit`):t.withTextFontShape(Vw[n]):t};ix({type:`text`,names:[`\\text`,`\\textrm`,`\\textsf`,`\\texttt`,`\\textnormal`,`\\textsc`,`\\textbf`,`\\textmd`,`\\textit`,`\\textup`,`\\emph`],props:{numArgs:1,argTypes:[`text`],allowedInArgument:!0,allowedInText:!0},handler({parser:e,funcName:t},n){let r=n[0];return{type:`text`,mode:e.mode,body:sx(r),font:t}},mathmlBuilder(e,t){let n=Hw(e,t);return Wx(Xx(e.body,n))}}),ix({type:`vcenter`,names:[`\\vcenter`],props:{numArgs:1,argTypes:[`original`],allowedInText:!1},handler({parser:e},t){return{type:`vcenter`,mode:e.mode,body:t[0]}},mathmlBuilder(e,t){let n=new W(`mtd`,[Zx(e.body,t)]);return n.style.padding=`0`,new W(`mtable`,[new W(`mtr`,[n])])}}),ix({type:`verb`,names:[`\\verb`],props:{numArgs:0,allowedInText:!0},handler(e,t,n){throw new U(`\\verb ended by end of line instead of matching delimiter`)},mathmlBuilder(e,t){let n=new W(`mtext`,[new vx(Uw(e))]);return n.setAttribute(`mathvariant`,`monospace`),n}});var Uw=e=>e.body.replace(/ /g,e.star?`␣`:`\xA0`),Ww=nx,Gw=`[ \r
134
+ ]`,Kw=`\\\\[a-zA-Z@]+`,qw=`\\\\[^\ud800-\udfff]`,Jw=`(${Kw})${Gw}*`,Yw=`\\\\(
135
+ |[ \r ]+
136
+ ?)[ \r ]*`,Xw=`[̀-ͯ]`,Zw=RegExp(`${Xw}+$`),Qw=`(${Gw}+)|${Yw}|([!-\\[\\]-‧‪-퟿豈-￿]${Xw}*|[\ud800-\udbff][\udc00-\udfff]${Xw}*|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5|${Jw}|${qw})`,$w=class{constructor(e,t){this.input=e,this.settings=t,this.tokenRegex=new RegExp(Qw,`g`),this.catcodes={"%":14,"~":13}}setCatcode(e,t){this.catcodes[e]=t}lex(){let e=this.input,t=this.tokenRegex.lastIndex;if(t===e.length)return new FS(`EOF`,new PS(this,t,t));let n=this.tokenRegex.exec(e);if(n===null||n.index!==t)throw new U(`Unexpected character: '${e[t]}'`,new FS(e[t],new PS(this,t,t+1)));let r=n[6]||n[3]||(n[2]?`\\ `:` `);if(this.catcodes[r]===14){let t=e.indexOf(`
137
+ `,this.tokenRegex.lastIndex);if(t===-1){if(this.tokenRegex.lastIndex=e.length,this.settings.strict)throw new U(`% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode`)}else this.tokenRegex.lastIndex=t+1;return this.lex()}return new FS(r,new PS(this,t,this.tokenRegex.lastIndex))}},eT=class{constructor(e=Object.create(null),t=Object.create(null)){this.current=t,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push(Object.create(null))}endGroup(){if(this.undefStack.length===0)throw new U(`Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug`);let e=this.undefStack.pop();for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(e[t]===void 0?delete this.current[t]:this.current[t]=e[t])}has(e){return Object.prototype.hasOwnProperty.call(this.current,e)||Object.prototype.hasOwnProperty.call(this.builtins,e)}get(e){return Object.prototype.hasOwnProperty.call(this.current,e)?this.current[e]:this.builtins[e]}set(e,t,n=!1){if(n){for(let t=0;t<this.undefStack.length;t++)delete this.undefStack[t][e];this.undefStack.length>0&&(this.undefStack[this.undefStack.length-1][e]=t)}else{let t=this.undefStack[this.undefStack.length-1];t&&!Object.prototype.hasOwnProperty.call(t,e)&&(t[e]=this.current[e])}this.current[e]=t}},tT={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0},nT=class{constructor(e,t,n){this.settings=t,this.expansionCount=0,this.feed(e),this.macros=new eT(RS,t.macros),this.mode=n,this.stack=[]}feed(e){this.lexer=new $w(e,this.settings)}switchMode(e){this.mode=e}beginGroup(){this.macros.beginGroup()}endGroup(){this.macros.endGroup()}future(){return this.stack.length===0&&this.pushToken(this.lexer.lex()),this.stack[this.stack.length-1]}popToken(){return this.future(),this.stack.pop()}pushToken(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){let t,n,r;if(e){if(this.consumeSpaces(),this.future().text!==`[`)return null;t=this.popToken(),{tokens:r,end:n}=this.consumeArg([`]`])}else({tokens:r,start:t,end:n}=this.consumeArg());return this.pushToken(new FS(`EOF`,n.loc)),this.pushTokens(r),new FS(``,PS.range(t,n))}consumeSpaces(){for(;this.future().text===` `;)this.stack.pop()}consumeArg(e){let t=[],n=e&&e.length>0;n||this.consumeSpaces();let r=this.future(),i,a=0,o=0;do{if(i=this.popToken(),t.push(i),i.text===`{`)++a;else if(i.text===`}`){if(--a,a===-1)throw new U(`Extra }`,i)}else if(i.text===`EOF`)throw new U(`Unexpected end of input in a macro argument, expected '`+(e&&n?e[o]:`}`)+`'`,i);if(e&&n){if((a===0||a===1&&e[o]===`{`)&&i.text===e[o]){if(++o,o===e.length){t.splice(-o,o);break}}else o=0}}while(a!==0||n);return r.text===`{`&&t[t.length-1].text===`}`&&(t.pop(),t.shift()),t.reverse(),{tokens:t,start:r,end:i}}consumeArgs(e,t){if(t){if(t.length!==e+1)throw new U(`The length of delimiters doesn't match the number of args!`);let n=t[0];for(let e=0;e<n.length;e++){let t=this.popToken();if(n[e]!==t.text)throw new U(`Use of the macro doesn't match its definition`,t)}}let n=[];for(let r=0;r<e;r++)n.push(this.consumeArg(t&&t[r+1]).tokens);return n}expandOnce(e){let t=this.popToken(),n=t.text,r=t.noexpand?null:this._getExpansion(n);if(r==null||e&&r.unexpandable){if(e&&r==null&&n[0]===`\\`&&!this.isDefined(n))throw new U(`Undefined control sequence: `+n);return this.pushToken(t),!1}if(this.expansionCount++,this.expansionCount>this.settings.maxExpand)throw new U(`Too many expansions: infinite loop or need to increase maxExpand setting`);let i=r.tokens,a=this.consumeArgs(r.numArgs,r.delimiters);if(r.numArgs){i=i.slice();for(let e=i.length-1;e>=0;--e){let t=i[e];if(t.text===`#`){if(e===0)throw new U(`Incomplete placeholder at end of macro body`,t);if(t=i[--e],t.text===`#`)i.splice(e+1,1);else if(/^[1-9]$/.test(t.text))i.splice(e,2,...a[t.text-1]);else throw new U(`Not a valid argument number`,t)}}}return this.pushTokens(i),i.length}expandAfterFuture(){return this.expandOnce(),this.future()}expandNextToken(){for(;;)if(this.expandOnce()===!1){let e=this.stack.pop();return e.treatAsRelax&&(e.text=`\\relax`),e}throw Error()}expandMacro(e){return this.macros.has(e)?this.expandTokens([new FS(e)]):void 0}expandTokens(e){let t=[],n=this.stack.length;for(this.pushTokens(e);this.stack.length>n;)if(this.expandOnce(!0)===!1){let e=this.stack.pop();e.treatAsRelax&&=(e.noexpand=!1,!1),t.push(e)}return t}expandMacroAsText(e){let t=this.expandMacro(e);return t&&t.map(e=>e.text).join(``)}_getExpansion(e){let t=this.macros.get(e);if(t==null)return t;if(e.length===1){let t=this.lexer.catcodes[e];if(t!=null&&t!==13)return}let n=typeof t==`function`?t(this):t;if(typeof n==`string`){let e=0;if(n.indexOf(`#`)!==-1){let t=n.replace(/##/g,``);for(;t.indexOf(`#`+(e+1))!==-1;)++e}let t=new $w(n,this.settings),r=[],i=t.lex();for(;i.text!==`EOF`;)r.push(i),i=t.lex();return r.reverse(),{tokens:r,numArgs:e}}return n}isDefined(e){return this.macros.has(e)||Object.prototype.hasOwnProperty.call(Ww,e)||Object.prototype.hasOwnProperty.call(Dx.math,e)||Object.prototype.hasOwnProperty.call(Dx.text,e)||Object.prototype.hasOwnProperty.call(tT,e)}isExpandable(e){let t=this.macros.get(e);return t==null?Object.prototype.hasOwnProperty.call(Ww,e)&&!Ww[e].primitive:typeof t==`string`||typeof t==`function`||!t.unexpandable}},rT=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,iT=Object.freeze({"₊":`+`,"₋":`-`,"₌":`=`,"₍":`(`,"₎":`)`,"₀":`0`,"₁":`1`,"₂":`2`,"₃":`3`,"₄":`4`,"₅":`5`,"₆":`6`,"₇":`7`,"₈":`8`,"₉":`9`,ₐ:`a`,ₑ:`e`,ₕ:`h`,ᵢ:`i`,ⱼ:`j`,ₖ:`k`,ₗ:`l`,ₘ:`m`,ₙ:`n`,ₒ:`o`,ₚ:`p`,ᵣ:`r`,ₛ:`s`,ₜ:`t`,ᵤ:`u`,ᵥ:`v`,ₓ:`x`,ᵦ:`β`,ᵧ:`γ`,ᵨ:`ρ`,ᵩ:`ϕ`,ᵪ:`χ`,"⁺":`+`,"⁻":`-`,"⁼":`=`,"⁽":`(`,"⁾":`)`,"⁰":`0`,"¹":`1`,"²":`2`,"³":`3`,"⁴":`4`,"⁵":`5`,"⁶":`6`,"⁷":`7`,"⁸":`8`,"⁹":`9`,ᴬ:`A`,ᴮ:`B`,ᴰ:`D`,ᴱ:`E`,ᴳ:`G`,ᴴ:`H`,ᴵ:`I`,ᴶ:`J`,ᴷ:`K`,ᴸ:`L`,ᴹ:`M`,ᴺ:`N`,ᴼ:`O`,ᴾ:`P`,ᴿ:`R`,ᵀ:`T`,ᵁ:`U`,ⱽ:`V`,ᵂ:`W`,ᵃ:`a`,ᵇ:`b`,ᶜ:`c`,ᵈ:`d`,ᵉ:`e`,ᶠ:`f`,ᵍ:`g`,ʰ:`h`,ⁱ:`i`,ʲ:`j`,ᵏ:`k`,ˡ:`l`,ᵐ:`m`,ⁿ:`n`,ᵒ:`o`,ᵖ:`p`,ʳ:`r`,ˢ:`s`,ᵗ:`t`,ᵘ:`u`,ᵛ:`v`,ʷ:`w`,ˣ:`x`,ʸ:`y`,ᶻ:`z`,ᵝ:`β`,ᵞ:`γ`,ᵟ:`δ`,ᵠ:`ϕ`,ᵡ:`χ`,ᶿ:`θ`}),aT=Object.freeze({𝒜:`A`,ℬ:`B`,𝒞:`C`,𝒟:`D`,ℰ:`E`,ℱ:`F`,𝒢:`G`,ℋ:`H`,ℐ:`I`,𝒥:`J`,𝒦:`K`,ℒ:`L`,ℳ:`M`,𝒩:`N`,𝒪:`O`,𝒫:`P`,𝒬:`Q`,ℛ:`R`,𝒮:`S`,𝒯:`T`,𝒰:`U`,𝒱:`V`,𝒲:`W`,𝒳:`X`,𝒴:`Y`,𝒵:`Z`}),oT={"́":{text:`\\'`,math:`\\acute`},"̀":{text:"\\`",math:`\\grave`},"̈":{text:`\\"`,math:`\\ddot`},"̃":{text:`\\~`,math:`\\tilde`},"̄":{text:`\\=`,math:`\\bar`},"̆":{text:`\\u`,math:`\\breve`},"̌":{text:`\\v`,math:`\\check`},"̂":{text:`\\^`,math:`\\hat`},"̇":{text:`\\.`,math:`\\dot`},"̊":{text:`\\r`,math:`\\mathring`},"̋":{text:`\\H`},"̧":{text:`\\c`}},sT={á:`á`,à:`à`,ä:`ä`,ǟ:`ǟ`,ã:`ã`,ā:`ā`,ă:`ă`,ắ:`ắ`,ằ:`ằ`,ẵ:`ẵ`,ǎ:`ǎ`,â:`â`,ấ:`ấ`,ầ:`ầ`,ẫ:`ẫ`,ȧ:`ȧ`,ǡ:`ǡ`,å:`å`,ǻ:`ǻ`,ḃ:`ḃ`,ć:`ć`,č:`č`,ĉ:`ĉ`,ċ:`ċ`,ď:`ď`,ḋ:`ḋ`,é:`é`,è:`è`,ë:`ë`,ẽ:`ẽ`,ē:`ē`,ḗ:`ḗ`,ḕ:`ḕ`,ĕ:`ĕ`,ě:`ě`,ê:`ê`,ế:`ế`,ề:`ề`,ễ:`ễ`,ė:`ė`,ḟ:`ḟ`,ǵ:`ǵ`,ḡ:`ḡ`,ğ:`ğ`,ǧ:`ǧ`,ĝ:`ĝ`,ġ:`ġ`,ḧ:`ḧ`,ȟ:`ȟ`,ĥ:`ĥ`,ḣ:`ḣ`,í:`í`,ì:`ì`,ï:`ï`,ḯ:`ḯ`,ĩ:`ĩ`,ī:`ī`,ĭ:`ĭ`,ǐ:`ǐ`,î:`î`,ǰ:`ǰ`,ĵ:`ĵ`,ḱ:`ḱ`,ǩ:`ǩ`,ĺ:`ĺ`,ľ:`ľ`,ḿ:`ḿ`,ṁ:`ṁ`,ń:`ń`,ǹ:`ǹ`,ñ:`ñ`,ň:`ň`,ṅ:`ṅ`,ó:`ó`,ò:`ò`,ö:`ö`,ȫ:`ȫ`,õ:`õ`,ṍ:`ṍ`,ṏ:`ṏ`,ȭ:`ȭ`,ō:`ō`,ṓ:`ṓ`,ṑ:`ṑ`,ŏ:`ŏ`,ǒ:`ǒ`,ô:`ô`,ố:`ố`,ồ:`ồ`,ỗ:`ỗ`,ȯ:`ȯ`,ȱ:`ȱ`,ő:`ő`,ṕ:`ṕ`,ṗ:`ṗ`,ŕ:`ŕ`,ř:`ř`,ṙ:`ṙ`,ś:`ś`,ṥ:`ṥ`,š:`š`,ṧ:`ṧ`,ŝ:`ŝ`,ṡ:`ṡ`,ẗ:`ẗ`,ť:`ť`,ṫ:`ṫ`,ú:`ú`,ù:`ù`,ü:`ü`,ǘ:`ǘ`,ǜ:`ǜ`,ǖ:`ǖ`,ǚ:`ǚ`,ũ:`ũ`,ṹ:`ṹ`,ū:`ū`,ṻ:`ṻ`,ŭ:`ŭ`,ǔ:`ǔ`,û:`û`,ů:`ů`,ű:`ű`,ṽ:`ṽ`,ẃ:`ẃ`,ẁ:`ẁ`,ẅ:`ẅ`,ŵ:`ŵ`,ẇ:`ẇ`,ẘ:`ẘ`,ẍ:`ẍ`,ẋ:`ẋ`,ý:`ý`,ỳ:`ỳ`,ÿ:`ÿ`,ỹ:`ỹ`,ȳ:`ȳ`,ŷ:`ŷ`,ẏ:`ẏ`,ẙ:`ẙ`,ź:`ź`,ž:`ž`,ẑ:`ẑ`,ż:`ż`,Á:`Á`,À:`À`,Ä:`Ä`,Ǟ:`Ǟ`,Ã:`Ã`,Ā:`Ā`,Ă:`Ă`,Ắ:`Ắ`,Ằ:`Ằ`,Ẵ:`Ẵ`,Ǎ:`Ǎ`,Â:`Â`,Ấ:`Ấ`,Ầ:`Ầ`,Ẫ:`Ẫ`,Ȧ:`Ȧ`,Ǡ:`Ǡ`,Å:`Å`,Ǻ:`Ǻ`,Ḃ:`Ḃ`,Ć:`Ć`,Č:`Č`,Ĉ:`Ĉ`,Ċ:`Ċ`,Ď:`Ď`,Ḋ:`Ḋ`,É:`É`,È:`È`,Ë:`Ë`,Ẽ:`Ẽ`,Ē:`Ē`,Ḗ:`Ḗ`,Ḕ:`Ḕ`,Ĕ:`Ĕ`,Ě:`Ě`,Ê:`Ê`,Ế:`Ế`,Ề:`Ề`,Ễ:`Ễ`,Ė:`Ė`,Ḟ:`Ḟ`,Ǵ:`Ǵ`,Ḡ:`Ḡ`,Ğ:`Ğ`,Ǧ:`Ǧ`,Ĝ:`Ĝ`,Ġ:`Ġ`,Ḧ:`Ḧ`,Ȟ:`Ȟ`,Ĥ:`Ĥ`,Ḣ:`Ḣ`,Í:`Í`,Ì:`Ì`,Ï:`Ï`,Ḯ:`Ḯ`,Ĩ:`Ĩ`,Ī:`Ī`,Ĭ:`Ĭ`,Ǐ:`Ǐ`,Î:`Î`,İ:`İ`,Ĵ:`Ĵ`,Ḱ:`Ḱ`,Ǩ:`Ǩ`,Ĺ:`Ĺ`,Ľ:`Ľ`,Ḿ:`Ḿ`,Ṁ:`Ṁ`,Ń:`Ń`,Ǹ:`Ǹ`,Ñ:`Ñ`,Ň:`Ň`,Ṅ:`Ṅ`,Ó:`Ó`,Ò:`Ò`,Ö:`Ö`,Ȫ:`Ȫ`,Õ:`Õ`,Ṍ:`Ṍ`,Ṏ:`Ṏ`,Ȭ:`Ȭ`,Ō:`Ō`,Ṓ:`Ṓ`,Ṑ:`Ṑ`,Ŏ:`Ŏ`,Ǒ:`Ǒ`,Ô:`Ô`,Ố:`Ố`,Ồ:`Ồ`,Ỗ:`Ỗ`,Ȯ:`Ȯ`,Ȱ:`Ȱ`,Ő:`Ő`,Ṕ:`Ṕ`,Ṗ:`Ṗ`,Ŕ:`Ŕ`,Ř:`Ř`,Ṙ:`Ṙ`,Ś:`Ś`,Ṥ:`Ṥ`,Š:`Š`,Ṧ:`Ṧ`,Ŝ:`Ŝ`,Ṡ:`Ṡ`,Ť:`Ť`,Ṫ:`Ṫ`,Ú:`Ú`,Ù:`Ù`,Ü:`Ü`,Ǘ:`Ǘ`,Ǜ:`Ǜ`,Ǖ:`Ǖ`,Ǚ:`Ǚ`,Ũ:`Ũ`,Ṹ:`Ṹ`,Ū:`Ū`,Ṻ:`Ṻ`,Ŭ:`Ŭ`,Ǔ:`Ǔ`,Û:`Û`,Ů:`Ů`,Ű:`Ű`,Ṽ:`Ṽ`,Ẃ:`Ẃ`,Ẁ:`Ẁ`,Ẅ:`Ẅ`,Ŵ:`Ŵ`,Ẇ:`Ẇ`,Ẍ:`Ẍ`,Ẋ:`Ẋ`,Ý:`Ý`,Ỳ:`Ỳ`,Ÿ:`Ÿ`,Ỹ:`Ỹ`,Ȳ:`Ȳ`,Ŷ:`Ŷ`,Ẏ:`Ẏ`,Ź:`Ź`,Ž:`Ž`,Ẑ:`Ẑ`,Ż:`Ż`,ά:`ά`,ὰ:`ὰ`,ᾱ:`ᾱ`,ᾰ:`ᾰ`,έ:`έ`,ὲ:`ὲ`,ή:`ή`,ὴ:`ὴ`,ί:`ί`,ὶ:`ὶ`,ϊ:`ϊ`,ΐ:`ΐ`,ῒ:`ῒ`,ῑ:`ῑ`,ῐ:`ῐ`,ό:`ό`,ὸ:`ὸ`,ύ:`ύ`,ὺ:`ὺ`,ϋ:`ϋ`,ΰ:`ΰ`,ῢ:`ῢ`,ῡ:`ῡ`,ῠ:`ῠ`,ώ:`ώ`,ὼ:`ὼ`,Ύ:`Ύ`,Ὺ:`Ὺ`,Ϋ:`Ϋ`,Ῡ:`Ῡ`,Ῠ:`Ῠ`,Ώ:`Ώ`,Ὼ:`Ὼ`},cT=[`bin`,`op`,`open`,`punct`,`rel`],lT=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/,uT=/^ *\\text/,dT=class e{constructor(e,t,n=!1){this.mode=`math`,this.gullet=new nT(e,t,this.mode),this.settings=t,this.isPreamble=n,this.leftrightDepth=0,this.prevAtomType=``}expect(e,t=!0){if(this.fetch().text!==e)throw new U(`Expected '${e}', got '${this.fetch().text}'`,this.fetch());t&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken??=this.gullet.expandNextToken(),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set(`\\color`,`\\textcolor`);let e=this.parseExpression(!1);if(this.expect(`EOF`),this.isPreamble){let e=Object.create(null);return Object.entries(this.gullet.macros.current).forEach(([t,n])=>{e[t]=n}),this.gullet.endGroup(),e}let t=this.gullet.macros.get(`\\df@tag`);return this.gullet.endGroup(),t&&(this.gullet.macros.current[`\\df@tag`]=t),e}static get endOfExpression(){return[`}`,`\\endgroup`,`\\end`,`\\right`,`\\endtoggle`,`&`]}subparse(e){let t=this.nextToken;this.consume(),this.gullet.pushToken(new FS(`}`)),this.gullet.pushTokens(e);let n=this.parseExpression(!1);return this.expect(`}`),this.nextToken=t,n}parseExpression(t,n,r){let i=[];for(this.prevAtomType=``;;){this.mode===`math`&&this.consumeSpaces();let a=this.fetch();if(e.endOfExpression.indexOf(a.text)!==-1||n&&a.text===n||r&&a.text===`\\middle`||t&&Ww[a.text]&&Ww[a.text].infix)break;let o=this.parseAtom(n);if(!o)break;o.type!==`internal`&&(i.push(o),this.prevAtomType=o.type===`atom`?o.family:o.type)}return this.mode===`text`&&this.formLigatures(i),this.handleInfixNodes(i)}handleInfixNodes(e){let t=-1,n;for(let r=0;r<e.length;r++)if(e[r].type===`infix`){if(t!==-1)throw new U(`only one infix operator per group`,e[r].token);t=r,n=e[r].replaceWith}if(t!==-1&&n){let r,i,a=e.slice(0,t),o=e.slice(t+1);r=a.length===1&&a[0].type===`ordgroup`?a[0]:{type:`ordgroup`,mode:this.mode,body:a},i=o.length===1&&o[0].type===`ordgroup`?o[0]:{type:`ordgroup`,mode:this.mode,body:o};let s;return s=n===`\\\\abovefrac`?this.callFunction(n,[r,e[t],i],[]):this.callFunction(n,[r,i],[]),[s]}return e}handleSupSubscript(e){let t=this.fetch(),n=t.text;this.consume(),this.consumeSpaces();let r;do r=this.parseGroup(e);while(r.type&&r.type===`internal`);if(!r)throw new U(`Expected group after '`+n+`'`,t);return r}formatUnsupportedCmd(e){let t=[];for(let n=0;n<e.length;n++)t.push({type:`textord`,mode:`text`,text:e[n]});let n={type:`text`,mode:this.mode,body:t};return{type:`color`,mode:this.mode,color:this.settings.errorColor,body:[n]}}parseAtom(e){let t=this.parseGroup(`atom`,e);if(t&&t.type===`internal`||this.mode===`text`)return t;let n,r;for(;;){this.consumeSpaces();let e=this.fetch();if(e.text===`\\limits`||e.text===`\\nolimits`){if(t&&t.type===`op`)t.limits=e.text===`\\limits`,t.alwaysHandleSupSub=!0;else if(t&&t.type===`operatorname`)t.alwaysHandleSupSub&&(t.limits=e.text===`\\limits`);else throw new U(`Limit controls must follow a math operator`,e);this.consume()}else if(e.text===`^`){if(n)throw new U(`Double superscript`,e);n=this.handleSupSubscript(`superscript`)}else if(e.text===`_`){if(r)throw new U(`Double subscript`,e);r=this.handleSupSubscript(`subscript`)}else if(e.text===`'`){if(n)throw new U(`Double superscript`,e);let t={type:`textord`,mode:this.mode,text:`\\prime`},r=[t];for(this.consume();this.fetch().text===`'`;)r.push(t),this.consume();this.fetch().text===`^`&&r.push(this.handleSupSubscript(`superscript`)),n={type:`ordgroup`,mode:this.mode,body:r}}else if(iT[e.text]){let t=rT.test(e.text),i=[];for(i.push(new FS(iT[e.text])),this.consume();;){let e=this.fetch().text;if(!iT[e]||rT.test(e)!==t)break;i.unshift(new FS(iT[e])),this.consume()}let a=this.subparse(i);t?r={type:`ordgroup`,mode:`math`,body:a}:n={type:`ordgroup`,mode:`math`,body:a}}else break}if(n||r){if(t&&t.type===`multiscript`&&!t.postscripts)return t.postscripts={sup:n,sub:r},t;{let e=!t||t.type!==`op`&&t.type!==`operatorname`?void 0:DC(this.nextToken.text);return{type:`supsub`,mode:this.mode,base:t,sup:n,sub:r,isFollowedByDelimiter:e}}}return t}parseFunction(e,t){let n=this.fetch(),r=n.text,i=Ww[r];if(!i)return null;if(this.consume(),t&&t!==`atom`&&!i.allowedInArgument)throw new U(`Got function '`+r+`' with no arguments`+(t?` as `+t:``),n);if(this.mode===`text`&&!i.allowedInText)throw new U(`Can't use function '`+r+`' in text mode`,n);if(this.mode===`math`&&i.allowedInMath===!1)throw new U(`Can't use function '`+r+`' in math mode`,n);let a=this.prevAtomType,{args:o,optArgs:s}=this.parseArguments(r,i);return this.prevAtomType=a,this.callFunction(r,o,s,n,e)}callFunction(e,t,n,r,i){let a={funcName:e,parser:this,token:r,breakOnTokenText:i},o=Ww[e];if(o&&o.handler)return o.handler(a,t,n);throw new U(`No function handler for ${e}`)}parseArguments(e,t){let n=t.numArgs+t.numOptionalArgs;if(n===0)return{args:[],optArgs:[]};let r=[],i=[];for(let a=0;a<n;a++){let n=t.argTypes&&t.argTypes[a],o=a<t.numOptionalArgs;(t.primitive&&n==null||t.type===`sqrt`&&a===1&&i[0]==null)&&(n=`primitive`);let s=this.parseGroupOfType(`argument to '${e}'`,n,o);if(o)i.push(s);else if(s!=null)r.push(s);else throw new U(`Null argument, please report this as a bug`)}return{args:r,optArgs:i}}parseGroupOfType(e,t,n){switch(t){case`size`:return this.parseSizeGroup(n);case`url`:return this.parseUrlGroup(n);case`math`:case`text`:return this.parseArgumentGroup(n,t);case`hbox`:{let e=this.parseArgumentGroup(n,`text`);return e==null?null:{type:`styling`,mode:e.mode,body:[e],scriptLevel:`text`}}case`raw`:{let e=this.parseStringGroup(`raw`,n);return e==null?null:{type:`raw`,mode:`text`,string:e.text}}case`primitive`:{if(n)throw new U(`A primitive argument cannot be optional`);let t=this.parseGroup(e);if(t==null)throw new U(`Expected group as `+e,this.fetch());return t}case`original`:case null:case void 0:return this.parseArgumentGroup(n);default:throw new U(`Unknown group type as `+e,this.fetch())}}consumeSpaces(){for(;;){let e=this.fetch().text;if(e===` `||e===`\xA0`||e===`︎`)this.consume();else break}}parseStringGroup(e,t){let n=this.gullet.scanArgument(t);if(n==null)return null;let r=``,i;for(;(i=this.fetch()).text!==`EOF`;)r+=i.text,this.consume();return this.consume(),n.text=r,n}parseRegexGroup(e,t){let n=this.fetch(),r=n,i=``,a;for(;(a=this.fetch()).text!==`EOF`&&e.test(i+a.text);)r=a,i+=r.text,this.consume();if(i===``)throw new U(`Invalid `+t+`: '`+n.text+`'`,n);return n.range(r,i)}parseSizeGroup(e){let t,n=!1;if(this.gullet.consumeSpaces(),t=!e&&this.gullet.future().text!==`{`?this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/,`size`):this.parseStringGroup(`size`,e),!t)return null;!e&&t.text.length===0&&(t.text=`0pt`,n=!0);let r=lT.exec(t.text);if(!r)throw new U(`Invalid size: '`+t.text+`'`,t);let i={number:+(r[1]+r[2]),unit:r[3]};if(!fS(i))throw new U(`Invalid unit: '`+i.unit+`'`,t);return{type:`size`,mode:this.mode,value:i,isBlank:n}}parseUrlGroup(e){this.gullet.lexer.setCatcode(`%`,13),this.gullet.lexer.setCatcode(`~`,12);let t=this.parseStringGroup(`url`,e);if(this.gullet.lexer.setCatcode(`%`,14),this.gullet.lexer.setCatcode(`~`,13),t==null)return null;let n=t.text.replace(/\\([#$%&~_^{}])/g,`$1`);return n=t.text.replace(/{\u2044}/g,`/`),{type:`url`,mode:this.mode,url:n}}parseArgumentGroup(e,t){let n=this.gullet.scanArgument(e);if(n==null)return null;let r=this.mode;t&&this.switchMode(t),this.gullet.beginGroup();let i=this.parseExpression(!1,`EOF`);this.expect(`EOF`),this.gullet.endGroup();let a={type:`ordgroup`,mode:this.mode,loc:n.loc,body:i};return t&&this.switchMode(r),a}parseGroup(e,t){let n=this.fetch(),r=n.text;if(e===`argument to '\\left'`)return this.parseSymbol();let i;if(r===`{`||r===`\\begingroup`||r===`\\toggle`){this.consume();let e=r===`{`?`}`:r===`\\begingroup`?`\\endgroup`:`\\endtoggle`;this.gullet.beginGroup();let t=this.parseExpression(!1,e),a=this.fetch();this.expect(e),this.gullet.endGroup(),i={type:a.text===`\\endtoggle`?`toggle`:`ordgroup`,mode:this.mode,loc:PS.range(n,a),body:t,semisimple:r===`\\begingroup`||void 0}}else if(i=this.parseFunction(t,e)||this.parseSymbol(),i==null&&r[0]===`\\`&&!Object.prototype.hasOwnProperty.call(tT,r)){if(this.settings.throwOnError)throw new U(`Unsupported function name: `+r,n);i=this.formatUnsupportedCmd(r),this.consume()}return i}formLigatures(e){let t=e.length-1;for(let n=0;n<t;++n){let r=e[n],i=r.text;i===`-`&&e[n+1].text===`-`&&(n+1<t&&e[n+2].text===`-`?(e.splice(n,3,{type:`textord`,mode:`text`,loc:PS.range(r,e[n+2]),text:`---`}),t-=2):(e.splice(n,2,{type:`textord`,mode:`text`,loc:PS.range(r,e[n+1]),text:`--`}),--t)),(i===`'`||i==="`")&&e[n+1].text===i&&(e.splice(n,2,{type:`textord`,mode:`text`,loc:PS.range(r,e[n+1]),text:i+i}),--t)}}parseSymbol(){let e=this.fetch(),t=e.text;if(/^\\verb[^a-zA-Z]/.test(t)){this.consume();let e=t.slice(5),n=e.charAt(0)===`*`;if(n&&(e=e.slice(1)),e.length<2||e.charAt(0)!==e.slice(-1))throw new U(`\\verb assertion failed --
138
+ please report what input caused this bug`);return e=e.slice(1,-1),{type:`verb`,mode:`text`,body:e,star:n}}if(Object.prototype.hasOwnProperty.call(sT,t[0])&&this.mode===`math`&&!Dx[this.mode][t[0]]){if(this.settings.strict&&this.mode===`math`)throw new U(`Accented Unicode text character "${t[0]}" used in math mode`,e);t=sT[t[0]]+t.slice(1)}let n=this.mode===`math`?Zw.exec(t):null;n&&(t=t.substring(0,n.index),t===`i`?t=`ı`:t===`j`&&(t=`ȷ`));let r;if(Dx[this.mode][t]){let n=Dx[this.mode][t].group;n===`bin`&&(cT.includes(this.prevAtomType)||this.prevAtomType===``)&&(n=`open`);let i=PS.range(e),a;if(Object.prototype.hasOwnProperty.call(Tx,n)){let e=n;a={type:`atom`,mode:this.mode,family:e,loc:i,text:t},(e===`rel`||e===`bin`)&&this.prevAtomType===`text`&&uT.test(i.lexer.input.slice(i.end))&&(a.needsSpacing=!0)}else{if(aT[t]){this.consume();let e=this.fetch().text.charCodeAt(0),n=e===65025?`mathscr`:`mathcal`;return(e===65024||e===65025)&&this.consume(),{type:`font`,mode:`math`,font:n,body:{type:`mathord`,mode:`math`,loc:i,text:aT[t]}}}a={type:n,mode:this.mode,loc:i,text:t}}r=a}else if(t.charCodeAt(0)>=128||Zw.exec(t)){if(this.settings.strict&&this.mode===`math`)throw new U(`Unicode text character "${t[0]}" used in math mode`,e);r={type:`textord`,mode:`text`,loc:PS.range(e),text:t}}else return null;if(this.consume(),n)for(let t=0;t<n[0].length;t++){let i=n[0][t];if(!oT[i])throw new U(`Unknown accent ' ${i}'`,e);let a=oT[i][this.mode]||oT[i].text;if(!a)throw new U(`Accent ${i} unsupported in ${this.mode} mode`,e);r={type:`accent`,mode:this.mode,loc:PS.range(e),label:a,isStretchy:!1,base:r}}return r}},fT=function(e,t){if(!(typeof e==`string`||e instanceof String))throw TypeError(`Temml can only parse string typed expression`);let n,r;try{r=new dT(e,t),delete r.gullet.macros.current[`\\df@tag`],n=r.parse()}catch(i){if(i.toString()===`ParseError: Unmatched delimiter`)t.wrapDelimiterPairs=!1,r=new dT(e,t),delete r.gullet.macros.current[`\\df@tag`],n=r.parse();else throw i}if(!(n.length>0&&n[0].type&&n[0].type===`array`&&n[0].addEqnNum)&&r.gullet.macros.get(`\\df@tag`)){if(!t.displayMode)throw new U(`\\tag works only in display mode`);r.gullet.feed(`\\df@tag`),n=[{type:`tag`,mode:`text`,body:n,tag:r.parse()}]}return n},pT=[2,2,3,3],mT=class e{constructor(e){this.level=e.level,this.color=e.color,this.font=e.font||``,this.fontFamily=e.fontFamily||``,this.fontSize=e.fontSize||1,this.fontWeight=e.fontWeight||``,this.fontShape=e.fontShape||``,this.maxSize=e.maxSize}extend(t){let n={level:this.level,color:this.color,font:this.font,fontFamily:this.fontFamily,fontSize:this.fontSize,fontWeight:this.fontWeight,fontShape:this.fontShape,maxSize:this.maxSize};for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return new e(n)}withLevel(e){return this.extend({level:e})}incrementLevel(){return this.extend({level:Math.min(this.level+1,3)})}inSubOrSup(){return this.extend({level:pT[this.level]})}withColor(e){return this.extend({color:e})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:``})}withFontSize(e){return this.extend({fontSize:e})}withTextFontWeight(e){return this.extend({fontWeight:e,font:``})}withTextFontShape(e){return this.extend({fontShape:e,font:``})}getColor(){return this.color}},hT=`0.14.0`;function gT(e){let t={},n=0,r=document.getElementsByClassName(`tml-eqn`);for(let e of r)for(n+=1,e.setAttribute(`id`,`tml-eqn-`+String(n));e.tagName!==`mtable`;){if(e.getElementsByClassName(`tml-label`).length>0){let r=e.attributes.id.value;t[r]=String(n);break}e=e.parentElement}let i=document.getElementsByClassName(`tml-tageqn`);for(let e of i)if(e.getElementsByClassName(`tml-label`).length>0){let n=e.getElementsByClassName(`tml-tag`);if(n.length>0){let r=e.attributes.id.value;t[r]=n[0].textContent}}[...e.getElementsByClassName(`tml-ref`)].forEach(e=>{let n=e.getAttribute(`href`),r=t[n.slice(1)];e.className.indexOf(`tml-eqref`)===-1?(r=r.replace(/^\(/,``),r=r.replace(/\)$/,``)):(r.charAt(0)!==`(`&&(r=`(`+r),r.slice(-1)!==`)`&&(r+=`)`));let i=document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`mtext`);i.appendChild(document.createTextNode(r));let a=document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`math`);a.appendChild(i),e.textContent=``,e.appendChild(a)})}var _T=function(e,t,n){let r=n,i=0,a=e.length;for(;r<t.length;){let n=t[r];if(i<=0&&t.slice(r,r+a)===e)return r;n===`\\`?r++:n===`{`?i++:n===`}`&&i--,r++}return-1},vT=function(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)},yT=/^\\(?:begin|(?:eq)?ref){/,bT=function(e,t){let n,r=[],i=RegExp(`(`+t.map(e=>vT(e.left)).join(`|`)+`)`);for(;n=e.search(i),n!==-1;){n>0&&(r.push({type:`text`,data:e.slice(0,n)}),e=e.slice(n));let i=t.findIndex(t=>e.startsWith(t.left));if(n=_T(t[i].right,e,t[i].left.length),n===-1)break;let a=e.slice(0,n+t[i].right.length),o=yT.test(a)?a:e.slice(t[i].left.length,n);r.push({type:`math`,data:o,rawData:a,display:t[i].display}),e=e.slice(n+t[i].right.length)}return e!==``&&r.push({type:`text`,data:e}),r},xT=[{left:`$$`,right:`$$`,display:!0},{left:`\\(`,right:`\\)`,display:!1},{left:`\\begin{equation}`,right:`\\end{equation}`,display:!0},{left:`\\begin{equation*}`,right:`\\end{equation*}`,display:!0},{left:`\\begin{align}`,right:`\\end{align}`,display:!0},{left:`\\begin{align*}`,right:`\\end{align*}`,display:!0},{left:`\\begin{alignat}`,right:`\\end{alignat}`,display:!0},{left:`\\begin{alignat*}`,right:`\\end{alignat*}`,display:!0},{left:`\\begin{gather}`,right:`\\end{gather}`,display:!0},{left:`\\begin{gather*}`,right:`\\end{gather*}`,display:!0},{left:`\\begin{CD}`,right:`\\end{CD}`,display:!0},{left:`\\ref{`,right:`}`,display:!1},{left:`\\eqref{`,right:`}`,display:!1},{left:`\\[`,right:`\\]`,display:!0}],ST={$:[{left:`$$`,right:`$$`,display:!0},{left:"$`",right:"`$",display:!1},{left:`$`,right:`$`,display:!1}],"(":[{left:`\\[`,right:`\\]`,display:!0},{left:`\\(`,right:`\\)`,display:!1}]},CT=[{left:`\\begin{equation}`,right:`\\end{equation}`,display:!0},{left:`\\begin{equation*}`,right:`\\end{equation*}`,display:!0},{left:`\\begin{align}`,right:`\\end{align}`,display:!0},{left:`\\begin{align*}`,right:`\\end{align*}`,display:!0},{left:`\\begin{alignat}`,right:`\\end{alignat}`,display:!0},{left:`\\begin{alignat*}`,right:`\\end{alignat*}`,display:!0},{left:`\\begin{gather}`,right:`\\end{gather}`,display:!0},{left:`\\begin{gather*}`,right:`\\end{gather*}`,display:!0},{left:`\\begin{CD}`,right:`\\end{CD}`,display:!0},{left:`\\ref{`,right:`}`,display:!1},{left:`\\eqref{`,right:`}`,display:!1}],wT=e=>e===`$`||e===`(`?ST[e]:e===`$+`||e===`(+`?ST[e.slice(0,1)].concat(CT):e===`ams`?CT:e===`all`?ST[`(`].concat(ST.$).concat(CT):xT,TT=function(e,t){let n=bT(e,t.delimiters);if(n.length===1&&n[0].type===`text`)return null;let r=document.createDocumentFragment();for(let e=0;e<n.length;e++)if(n[e].type===`text`)r.appendChild(document.createTextNode(n[e].data));else{let i=document.createElement(`span`),a=n[e].data;t.displayMode=n[e].display;try{t.preProcess&&(a=t.preProcess(a)),temml.render(a,i,t)}catch(i){if(!(i instanceof U))throw i;t.errorCallback("Temml auto-render: Failed to parse `"+n[e].data+"` with ",i),r.appendChild(document.createTextNode(n[e].rawData));continue}r.appendChild(i)}return r},ET=function(e,t){for(let n=0;n<e.childNodes.length;n++){let r=e.childNodes[n];if(r.nodeType===3){let i=TT(r.textContent,t);i&&(n+=i.childNodes.length-1,e.replaceChild(i,r))}else if(r.nodeType===1){let e=` `+r.className+` `;t.ignoredTags.indexOf(r.nodeName.toLowerCase())===-1&&t.ignoredClasses.every(t=>e.indexOf(` `+t+` `)===-1)&&ET(r,t)}}},DT=function(e,t){if(!e)throw Error(`No element provided to render`);let n={};for(let e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);n.delimiters=n.fences?wT(n.fences):n.delimiters||xT,n.ignoredTags=n.ignoredTags||[`script`,`noscript`,`style`,`textarea`,`pre`,`code`,`option`],n.ignoredClasses=n.ignoredClasses||[],n.errorCallback=n.errorCallback||console.error,n.macros=n.macros||Object.create(null),ET(e,n),gT(e)},OT=function(e,t,n={}){t.textContent=``;let r=t.tagName.toLowerCase()===`math`;r&&(n.wrap=`none`);let i=NT(e,n);r||i.children.length>1?(t.textContent=``,i.children.forEach(e=>{t.appendChild(e.toNode())})):t.appendChild(i.toNode())};typeof document<`u`&&document.compatMode!==`CSS1Compat`&&(typeof console<`u`&&console.warn(`Warning: Temml doesn't work in quirks mode. Make sure your website has a suitable doctype.`),OT=function(){throw new U(`Temml doesn't work in quirks mode.`)});var kT=function(e,t){return NT(e,t).toMarkup()},AT=function(e,t){return fT(e,new tx(t))},jT=function(e,t){let n=new tx(t);if(n.macros=Object.create(null),!(typeof e==`string`||e instanceof String))throw TypeError(`Temml can only parse string typed expression`);let r=new dT(e,n,!0);return delete r.gullet.macros.current[`\\df@tag`],r.parse()},MT=function(e,t,n){if(n.throwOnError||!(e instanceof U))throw e;let r=new px([`temml-error`],[new mx(t+`
139
+
140
+ `+e.toString())]);return r.style.color=n.errorColor,r.style.whiteSpace=`pre-line`,r},NT=function(e,t){let n=new tx(t);try{return nS(fT(e,n),e,new mT({level:n.displayMode?IS.DISPLAY:IS.TEXT,maxSize:n.maxSize}),n)}catch(t){return MT(t,e,n)}},PT={version:hT,render:OT,renderToString:kT,renderMathInElement:DT,postProcess:gT,ParseError:U,definePreamble:jT,__parse:AT,__renderToMathMLTree:NT,__defineSymbol:G,__defineMacro:Q},FT=/(?<=["\u201c])(?:[A-Za-z]:\\|\\\\[A-Za-z0-9_.$-]+\\)(?:\\\*|[^"`<>|*\r\n\u201c\u201d])+(?=["\u201d])|(?:(?<![A-Za-z0-9])[A-Za-z]:\\|\\\\[A-Za-z0-9_.$-]+\\)(?:\\\*|[^\s"`()\]<>|*]|(?:(?<![,;])(?: +(?:[^\s"`()\]<>|*\\,;:]|\([^\s"`()\]<>|*\\,;:]*\))+)+|(?<=[,;]) +(?:[^\s"`()\]<>|*\\,;:]|\([^\s"`()\]<>|*\\,;:]*\))+)(?=\\)|\((?:\\\*|[^\s"`()\]<>|*])*\))*/g,IT=/\\([!-/:-@[-`{-~])/g;function LT(e){return e.replace(IT,`$1`)}function RT(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(FT)){let t=e[0],n=LT(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=>RT(e,t))}function zT(){return(e,t)=>{typeof t.value==`string`&&RT(e,t.value)}}function BT(e){if(!e.children)return;let t=[];for(let n of e.children)n.type===`text`&&n.value?.includes(`
141
+ `)?n.value.split(`
142
+ `).forEach((e,n)=>{n>0&&t.push({type:`break`}),e&&t.push({type:`text`,value:e})}):(BT(n),t.push(n));e.children=t}function VT(){return e=>{BT(e)}}var HT=/^\s*(```|~~~)/,UT=/(`+)[\s\S]*?\1/g,WT=/[\\^_{}]/,GT=e=>`$$${e}$$`;function KT(e){return e.replace(/\\\((.+?)\\\)/g,(e,t)=>GT(t)).replace(/\\\[(.+?)\\\]/g,(e,t)=>GT(t)).replace(/(^|[^\\$])\$(?![\s$])([^$\n]*?[^\s$\\])\$(?![\d$])/g,(e,t,n)=>WT.test(n)?t+GT(n):e)}function qT(e){let t=/^(\s*)(?:\\\[((?:(?!\\\]).)+)\\\]|\$\$((?:(?!\$\$).)+)\$\$)\s*$/.exec(e);if(t){let e=t[1];return`${e}$$\n${e}${(t[2]??t[3]).trim()}\n${e}$$`}let n=/^(\s*)\\[[\]]\s*$/.exec(e);if(n)return`${n[1]}$$`;let r=``,i=0;for(let t of e.matchAll(UT))r+=KT(e.slice(i,t.index))+t[0],i=t.index+t[0].length;return r+KT(e.slice(i))}function JT(e){if(!e.includes(`$`)&&!e.includes(`\\`))return e;let t=!1;return e.split(`
143
+ `).map(e=>HT.test(e)?(t=!t,e):t?e:qT(e)).join(`
144
+ `)}var YT=/^[-+−]?[$€£¥]?\s?\d[\d,.\s]*\s?(?:%|[kKmMbB]|[KMGT]?B|[$€£¥])?$/,XT=/^[-—–]?$/;function ZT(e){return e.value===void 0?(e.children??[]).map(ZT).join(``):e.value}function QT(e){let t=e.children??[],n=t.slice(1);if(n.length===0)return;let r=Math.max(...t.map(e=>e.children?.length??0));for(let i=0;i<r;i++){if(e.align?.[i])continue;let r=n.map(e=>ZT(e.children?.[i]??{type:`text`,value:``}).trim()).filter(e=>!XT.test(e));if(r.length!==0&&r.every(e=>YT.test(e)))for(let e of t){let t=e.children?.[i];t&&(t.data={...t.data,hProperties:{...t.data?.hProperties,className:`is-numeric`}})}}}function $T(e){e.type===`table`?QT(e):e.children?.forEach($T)}function eE(){return e=>{$T(e)}}var tE=new Set([`calendar/create_calendar_event`,`calendar/update_calendar_event`,`calendar/cancel_calendar_event`]),nE=/^(\d{4})-(\d{2})-(\d{2})$/,rE={year:`numeric`,month:`short`,day:`numeric`},iE={hour:`numeric`,minute:`2-digit`,timeZoneName:`short`},aE=new Map;function oE(e){let t=aE.get(e);return t||(t={time:new Intl.DateTimeFormat(e,{...rE,...iE}),timeOnly:new Intl.DateTimeFormat(e,iE),date:new Intl.DateTimeFormat(e,rE)},aE.set(e,t)),t}var sE=new Set([` `,`
145
+ `,`‌`,`‍`,`‎`,`‏`]),cE=new Set([`͏`,`ᅟ`,`ᅠ`,`⠀`,`ㅤ`,`ᅠ`]),lE=[[173,173],[847,847],[1564,1564],[4447,4448],[6068,6069],[6155,6159],[8203,8207],[8234,8238],[8288,8303],[12644,12644],[65024,65039],[65279,65279],[65440,65440],[65520,65528],[113824,113827],[119155,119162],[917504,921599]],uE=[[65024,65039],[917760,917999]],dE=[[169,169],[174,174],[8252,8252],[8265,8265],[8482,8482],[8505,8505],[8596,8601],[8617,8618],[8986,8987],[9e3,9e3],[9167,9167],[9193,9203],[9208,9210],[9410,9410],[9642,9643],[9654,9654],[9664,9664],[9723,9726],[9728,9732],[9742,9742],[9745,9745],[9748,9749],[9752,9752],[9757,9757],[9760,9760],[9762,9763],[9766,9766],[9770,9770],[9774,9775],[9784,9786],[9792,9792],[9794,9794],[9800,9811],[9823,9824],[9827,9827],[9829,9830],[9832,9832],[9851,9851],[9854,9855],[9874,9879],[9881,9881],[9883,9884],[9888,9889],[9895,9895],[9898,9899],[9904,9905],[9917,9918],[9924,9925],[9928,9928],[9934,9935],[9937,9937],[9939,9940],[9961,9962],[9968,9973],[9975,9978],[9981,9981],[9986,9986],[9989,9989],[9992,9997],[9999,9999],[10002,10002],[10004,10004],[10006,10006],[10013,10013],[10017,10017],[10024,10024],[10035,10036],[10052,10052],[10055,10055],[10060,10060],[10062,10062],[10067,10069],[10071,10071],[10083,10084],[10133,10135],[10145,10145],[10160,10160],[10175,10175],[10548,10549],[11013,11015],[11035,11036],[11088,11088],[11093,11093],[12336,12336],[12349,12349],[12951,12951],[12953,12953],[126980,126980],[127020,127023],[127124,127135],[127151,127152],[127168,127168],[127183,127184],[127222,127231],[127344,127345],[127358,127359],[127374,127374],[127377,127386],[127406,127461],[127489,127503],[127514,127514],[127535,127535],[127538,127546],[127548,127551],[127561,127583],[127590,127777],[127780,127891],[127894,127895],[127897,127899],[127902,127984],[127987,127989],[127991,127994],[128e3,128253],[128255,128317],[128329,128334],[128336,128359],[128367,128368],[128371,128378],[128391,128391],[128394,128397],[128400,128400],[128405,128406],[128420,128421],[128424,128424],[128433,128434],[128444,128444],[128450,128452],[128465,128467],[128476,128478],[128481,128481],[128483,128483],[128488,128488],[128495,128495],[128499,128499],[128506,128591],[128640,128709],[128715,128722],[128725,128741],[128745,128745],[128747,128752],[128755,128767],[128986,129023],[129036,129039],[129096,129103],[129114,129119],[129160,129167],[129198,129199],[129212,129215],[129218,129231],[129241,129279],[129292,129338],[129340,129349],[129351,129535],[129624,129631],[129646,129791],[130048,131069]],fE=[[13312,19903],[19968,40959],[63744,64255],[131072,173791],[173824,177983],[177984,178207],[178208,183983],[183984,191471],[191472,192095],[194560,195103],[196608,201551],[201552,205743]],pE=new Set([...`0123456789#*`]),mE=/^[\p{Cf}\p{Cc}\p{Zl}\p{Zp}]$/u;function hE(e,t){let n=t.codePointAt(0)??-1;return e.some(([e,t])=>e<=n&&n<=t)}var gE=e=>hE(uE,e);function _E(e,t){return t.has(e)||gE(e)?!1:cE.has(e)||mE.test(e)||hE(lE,e)}function vE(e,t){let n=e[t],r=t>0?e[t-1]:``;if(!r)return!1;if(n===`︎`||n===`️`)return hE(dE,r)?!0:n===`️`&&pE.has(r)&&e[t+1]===`⃣`;let i=n.codePointAt(0)??0;return i>=917760&&i<=917999&&hE(fE,r)}function yE(e,t,n){let r=[...t.replace(/\r\n/g,`
146
+ `)],i=r.map((t,n)=>(gE(t)?!vE(r,n):_E(t,e))?`[U+${t.codePointAt(0).toString(16).toUpperCase().padStart(4,`0`)}]`:t).join(``);return n?i:i.replace(/\n/g,`[U+000A]`)}var bE=`This text holds characters that don't show. Those that hide or reorder text appear as [U+XXXX]; ideograph variant marks are kept as written. They are saved as written.`;function xE(e,t){if(typeof t!=`string`)return!1;let n=[...t.replace(/\r\n/g,`
147
+ `)];return n.some((t,r)=>{let i=t.codePointAt(0)??0;return i>=917760&&i<=917999?!0:gE(t)?!vE(n,r):_E(t,e)})}var SE=`<<<UNTRUSTED_TEXT>>>`,CE=`<<<END_UNTRUSTED_TEXT>>>`;function wE(e){if(e===`<`||e===`>`)return e;let t=e.normalize(`NFKC`);return t===`<`||t===`>`?t:``}function TE(e){if(typeof e!=`string`)return``;let t=e,n=``;for(;n!==t;)n=t,t=t.split(SE).join(``).split(CE).join(``);let r=[...t],i=``,a=0;for(;a<r.length;){let e=wE(r[a]);if(!e){i+=r[a],a+=1;continue}let t=0,n=a;for(let i=a;i<r.length;i++)if(wE(r[i])===e)t+=1,n=i;else if(!_E(r[i],sE))break;i+=t>=3?e+e:r.slice(a,n+1).join(``),a=n+1}return i}function EE(e,t=!1){return yE(sE,TE(e),t)}function DE(e){let t=nE.exec(e);return t?new Date(Number(t[1]),Number(t[2])-1,Number(t[3])):null}function OE({start:e,end:t}){let n=R(),{time:r,timeOnly:i,date:a}=oE(n.locale),o=DE(e);if(o){let e=DE(t),r=e&&e>o?`${a.format(o)} – ${a.format(e)}`:a.format(o);return z(P.Fragment,{children:[I(`bdi`,{dir:`auto`,children:r}),` (`,n(`permission.calendar.allDay`),`)`]})}let s=new Date(e),c=new Date(t);if(Number.isNaN(s.getTime()))return I(`bdi`,{dir:`ltr`,children:e});let l=r.format(s);if(!Number.isNaN(c.getTime())&&c>s){let e=a.format(s)===a.format(c);l+=` – ${(e?i:r).format(c)}`}return I(`bdi`,{dir:`auto`,children:l})}function kE({value:e}){return I(`bdi`,{dir:`auto`,children:e})}function AE({tool:e,args:t}){let n=R(),r=Array.isArray(t.notify_attendees)?t.notify_attendees.map(e=>EE(e)).filter(Boolean):[],i=[],a=(e,t,n=!1)=>{let r=EE(t,n);r&&i.push([e,I(kE,{value:r})])},o=()=>{let e=EE(t.calendar_account);e&&i.push([n(`permission.calendar.account`),I(`bdi`,{dir:`ltr`,children:e})])};e===`calendar/create_calendar_event`?(a(n(`permission.calendar.title`),t.title),i.push([n(`permission.calendar.when`),I(OE,{start:EE(t.start),end:EE(t.end)})]),o(),a(n(`permission.calendar.location`),t.location),a(n(`permission.calendar.description`),t.description,!0)):(a(n(`permission.calendar.event`),t.expected_title),i.push([n(`permission.calendar.when`),I(OE,{start:EE(t.expected_start),end:``})]),o(),a(n(`permission.calendar.newTitle`),t.new_title),EE(t.new_start)&&i.push([n(`permission.calendar.newTime`),I(OE,{start:EE(t.new_start),end:EE(t.new_end)})]),a(n(`permission.calendar.newLocation`),t.new_location),a(n(`permission.calendar.newDescription`),t.new_description,!0));let s=[...Object.values(t),...Array.isArray(t.notify_attendees)?t.notify_attendees:[]],c=typeof t._risk_note!=`string`&&s.some(e=>xE(sE,e))?bE:``;return z(P.Fragment,{children:[z(`dl`,{className:`perm-card-facts`,"data-testid":`perm-calendar`,children:[i.map(([e,t])=>z(V.Fragment,{children:[I(`dt`,{children:e}),I(`dd`,{children:t})]},e)),I(`dt`,{children:r.length?n.plural(`permission.calendar.notifies`,r.length):n(`permission.calendar.noOne`)}),I(`dd`,{children:r.length>0&&I(`div`,{className:`perm-card-people`,tabIndex:0,children:r.map(e=>I(kE,{value:e},e))})})]}),c&&I(`p`,{className:`perm-card-risk`,role:`note`,"data-testid":`perm-calendar-unseen`,children:c})]})}var jE=20,ME=2,NE=new Set([` `,`
148
+ `]),PE=(e,t)=>yE(NE,e,t),FE=e=>xE(NE,e);function IE(e){return typeof e.old_content==`string`&&typeof e.new_content==`string`?{kind:`edit`,lines:LE(e.old_content,e.new_content)}:typeof e.content==`string`&&(typeof e.file_path==`string`||typeof e.path==`string`)?{kind:`write`,text:e.content}:null}function LE(e,t){let n=e=>e.replace(/\r\n/g,`
149
+ `).replace(/\n$/,``).split(`
150
+ `),r=e?n(e):[],i=t?n(t):[],a=0;for(;a<r.length&&a<i.length&&r[a]===i[a];)a++;let o=0;for(;o<r.length-a&&o<i.length-a&&r[r.length-1-o]===i[i.length-1-o];)o++;return a+o>=r.length&&a+o>=i.length&&e!==t?[...r.map(e=>`-${e}`),...i.map(e=>`+${e}`)]:[...r.slice(Math.max(0,a-ME),a).map(e=>` ${e}`),...r.slice(a,r.length-o).map(e=>`-${e}`),...i.slice(a,i.length-o).map(e=>`+${e}`),...r.slice(r.length-o,r.length-o+ME).map(e=>` ${e}`)]}function RE(e){return e.startsWith(`+`)?`render-diff__line render-diff__line--added`:e.startsWith(`-`)?`render-diff__line render-diff__line--removed`:`render-diff__line`}function zE({lines:e}){let t=R(),[n,r]=(0,V.useState)(!1),i=e.length>jE,a=i&&!n?e.slice(0,jE):e;return z(P.Fragment,{children:[I(`pre`,{dir:`ltr`,className:`render-diff__body perm-card-diff`,"data-testid":`perm-edit-diff`,children:a.map((e,t)=>I(`div`,{className:RE(e),children:PE(e,!0)},t))}),i&&I(`button`,{type:`button`,className:`perm-card-args-toggle`,onClick:()=>r(e=>!e),"aria-expanded":n,children:n?t(`prompt.showLess`):t(`prompt.showAllLines`,{n:e.length})})]})}function BE({args:e}){let t=R(),n=IE(e);if(!n)return null;let r=n.kind===`edit`?FE(e.old_content)||FE(e.new_content):FE(n.text);return z(`div`,{className:`perm-card-change`,children:[I(`p`,{className:`perm-card-change-label`,children:t(n.kind===`edit`?`prompt.willChange`:`prompt.willWrite`)}),n.kind===`edit`?I(zE,{lines:n.lines}):n.text?I(QE,{code:PE(n.text,!0),previewLines:jE,testId:`perm-write-preview`,exact:!0}):I(`p`,{className:`perm-card-detail`,children:t(`prompt.emptyFile`)}),r&&I(`p`,{className:`perm-card-risk`,role:`note`,"data-testid":`perm-change-unseen`,children:t(`prompt.unseenChars`)})]})}function VE(e){let t=e.toolArgs??{},n=[`command`,`file_path`,`path`,`url`,`_site`,`query`,`name`].map(e=>t[e]).find(e=>typeof e==`string`&&e.trim());return typeof n==`string`?n:``}var HE=new Set([`run_shell_command`,`wait_for_condition`]),UE=[`send_now`,`send_draft`,`reply_to_message`,`forward_message`,`discard_draft`,`update_draft`],WE=new Set([...UE,...UE.map(e=>`send-email/${e}`)]),GE=[[`Attachments left out, not sent`,`permission.mail.leftOut`],[`Attachments`,`permission.mail.attachments`],[`Subject`,`permission.mail.subject`],[`Format`,`permission.mail.format`],[`From`,`permission.mail.from`],[`Bcc`,`permission.mail.bcc`],[`Cc`,`permission.mail.cc`],[`To`,`permission.mail.to`]],KE=RegExp(`^(${GE.map(([e])=>e).join(`|`)}): (.*)$`),qE=new Set([`From`,`To`,`Cc`,`Bcc`]);function JE(e){let t=e.split(`
151
+ `),n=e=>!!e&&/^(From|To): /.test(e),r=0;for(;!n(t[r]);){let e=t.indexOf(``,r);if(e<0)return null;r=e+1}let i=[],a=r;for(;a<t.length&&t[a]!==``;a++){let e=KE.exec(t[a]);if(!e)return null;i.push([e[1],e[2]])}return i.some(([e])=>e===`To`)?{before:t.slice(0,Math.max(0,r-1)).join(`
152
+ `),fields:i,body:t.slice(a+1).join(`
153
+ `)}:null}function YE({header:e}){let t=R(),n=new Map(GE);return I(`dl`,{className:`perm-card-facts perm-mail-header`,"data-testid":`perm-mail-header`,children:e.fields.map(([e,r],i)=>z(V.Fragment,{children:[I(`dt`,{children:t(n.get(e))}),I(`dd`,{className:e===`From`?`perm-mail-from`:void 0,children:I(`bdi`,{dir:qE.has(e)?`ltr`:`auto`,children:r})})]},i))})}function XE(e){let t=e.split(`
154
+ `);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(`
155
+ `),folder:``,extras:``,note:r}:{command:i.slice(0,a).join(`
156
+ `),folder:i[a].slice(3).trim(),extras:i.slice(a+1).join(` `).trim(),note:r}}function ZE(e){return e.replace(/(\s\u2068?)((?:[A-Za-z]:)?[\\/][^\u2069]*)(\u2069?)$/,(e,t,n,r)=>`${t}${n.split(/[\\/]/).filter(Boolean).pop()??n}${r}`)}function QE({code:e,previewLines:t=12,testId:n=`perm-code`,exact:r=!1}){let i=R(),[a,o]=(0,V.useState)(!1),s=(r?e.replace(/\n$/,``):e.replace(/^\n+|\n+$/g,``)).split(`
157
+ `),c=s.length>t,l=(c&&!a?s.slice(0,t):s).join(`
158
+ `);return z(P.Fragment,{children:[I(`pre`,{dir:`ltr`,className:`perm-card-pre perm-card-code${a?` is-expanded`:``}`,"data-testid":n,children:l}),c&&I(`button`,{type:`button`,className:`perm-card-args-toggle`,onClick:()=>o(e=>!e),"aria-expanded":a,children:a?i(`prompt.showLess`):i(`prompt.showAllLines`,{n:s.length})})]})}function $E({sessionId:e}){let t=_l((0,V.useMemo)(()=>xl(e),[e]));return t?I(tD,{notification:t},t.id):null}function eD(e){if(e<60)return`${e}s`;let t=Math.floor(e/60),n=e%60;return`${t}:${String(n).padStart(2,`0`)}`}function tD({notification:e}){let t=R(),n=_l(e=>e.respondToPermission),[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(!1),l=e.timeoutSeconds!=null&&e.timeoutSeconds>0,u=(0,V.useRef)(l?e.expiresAt??Date.now()+e.timeoutSeconds*1e3:null),[d,f]=(0,V.useState)(u.current===null?null:Math.max(0,Math.ceil((u.current-Date.now())/1e3))),p=(0,V.useRef)(null),m=hl(e.tool),h=m?void 0:e.alwaysScope,g=dl(e,t)??e.alwaysLabel??h??``,_=_l(t=>gl(t.notifications,e)),v=!!h&&_>0,y=VE(e),b=e.toolArgs??{},x=Object.keys(b).length>0,S=typeof b._risk_note==`string`?b._risk_note:``,C=S&&typeof b.working_directory==`string`?b.working_directory:``,w=typeof b.code==`string`&&b.code.trim()?b.code:``,T=typeof b._exact_text==`string`?b._exact_text:WE.has(e.tool??``)?e.summary??``:``,E=!x&&HE.has(e.tool??``)?XE(e.summary??``):null,D=T?JE(T):null,O=e.tool===rl,{heading:k,question:ee}=cl(e,t,Ic),te=tE.has(e.tool??``);(0,V.useEffect)(()=>{p.current?.focus({preventScroll:!0})},[]),(0,V.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 ne=(0,V.useCallback)(async t=>{i(!0),o(null);try{await n(e.id,t)}catch(e){o(e instanceof Error?e.message:String(e)),i(!1)}},[e.id,n]);(0,V.useEffect)(()=>{let e=e=>{e.key!==`Escape`||hn(e)||d!==null&&d<=0||(e.preventDefault(),r||ne(`deny`))};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[ne,r,d]);let A=d!==null&&d<=0;return z(`section`,{ref:p,tabIndex:-1,className:`perm-card`,role:`alertdialog`,"aria-labelledby":`perm-${e.id}`,children:[z(`div`,{className:`perm-card-head`,children:[I(is,{size:16,className:`perm-card-icon`,"aria-hidden":`true`}),z(`div`,{className:`perm-card-text`,children:[I(`h2`,{id:`perm-${e.id}`,className:`perm-card-title`,children:I(zc,{text:k})}),y&&S&&I(`pre`,{dir:`ltr`,className:`perm-card-pre perm-card-exact`,children:y}),y&&!S&&I(`p`,{className:`perm-card-detail`,children:I(`code`,{dir:`ltr`,children:y})}),C&&z(`p`,{className:`perm-card-detail`,children:[t.bare(`prompt.in`),` `,I(`code`,{dir:`ltr`,children:C})]}),S&&I(`p`,{className:`perm-card-risk`,role:`note`,children:I(`bdi`,{children:S})}),w&&I(QE,{code:w}),D?.before&&I(`pre`,{dir:`ltr`,className:`perm-card-pre perm-card-exact`,children:D.before}),D&&I(YE,{header:D}),T&&I(`pre`,{dir:`ltr`,className:`perm-card-pre perm-card-exact`,"data-testid":`perm-exact-text`,children:D?D.body:T}),E&&I(`pre`,{dir:`ltr`,className:`perm-card-pre perm-card-exact`,children:E.command}),E?.folder&&z(`p`,{className:`perm-card-detail`,children:[t.bare(`prompt.in`),` `,I(`code`,{dir:`ltr`,children:E.folder})]}),E?.extras&&I(`p`,{className:`perm-card-detail`,children:I(`bdi`,{children:E.extras})}),E?.note&&I(`p`,{className:`perm-card-risk`,role:`note`,children:I(`bdi`,{children:E.note})}),te&&x&&I(AE,{tool:e.tool,args:b}),te&&!x&&e.summary&&I(`pre`,{dir:`ltr`,className:`perm-card-pre perm-card-exact`,"data-testid":`perm-exact-summary`,children:e.summary}),!y&&!w&&!T&&!te&&e.summary&&!E&&I(`p`,{className:`perm-card-detail`,children:I(`bdi`,{children:e.summary})}),m&&I(`p`,{className:`perm-card-detail perm-card-question`,children:I(zc,{text:ee})}),I(BE,{args:b})]}),d!==null&&!A&&I(`span`,{className:`perm-card-timer`,title:t(`prompt.timer`),children:eD(d)})]}),x&&!T&&z(`div`,{className:`perm-card-args`,children:[z(`button`,{type:`button`,className:`perm-card-args-toggle`,onClick:()=>c(e=>!e),"aria-expanded":s,children:[I(Yr,{size:13,className:s?`is-open`:``,"aria-hidden":`true`}),t(IE(b)?`prompt.technicalDetails`:`prompt.details`)]}),s&&I(`pre`,{dir:`ltr`,className:`perm-card-pre`,children:JSON.stringify(b,null,2)})]}),v&&!A&&I(`p`,{className:`perm-card-hint`,children:t.compose(e=>`${e(Xn(`prompt.repeated`,_),{n:_})} ${e(`prompt.alwaysHint`,{scope:g})}`)}),A?I(`p`,{className:`perm-card-detail`,children:t(`prompt.expired`)}):z(`div`,{className:`perm-card-actions`,children:[I(`button`,{type:`button`,className:`perm-btn is-primary`,onClick:()=>ne(`allow`),disabled:r,children:t(e.tool===`trust_project_folder`?`prompt.trust.allow`:O?`prompt.allowForChat`:`prompt.allowOnce`)}),h&&I(`button`,{type:`button`,className:`perm-btn${v?` is-suggested`:``}`,onClick:()=>ne(`always`),disabled:r,title:g,children:t(`prompt.alwaysAllow`,{scope:ZE(g)})}),I(`button`,{type:`button`,className:`perm-btn`,onClick:()=>ne(`deny`),disabled:r,children:t(`prompt.deny`)})]}),a&&I(`p`,{className:`perm-card-error`,role:`alert`,children:a})]})}function nD(e,t){return e.bare(Xn(`size.lines`,t),{n:t.toLocaleString(`en-US`)})}function rD(e){return e?e.split(`
159
+ `).length:0}function iD(e){return rD(e)>15||e.length>1500}var aD=e=>e.length>300?`${e.slice(0,300)}…`:e;function oD(e){let t=e.split(`
160
+ `);return t.length<=15?null:{head:t.slice(0,3).map(aD).join(`
161
+ `),tail:t.slice(-3).map(aD).join(`
162
+ `),hidden:t.length-6}}function sD(e,t,n=15){let r=rD(t);return r>n?nD(e,r):e.bare(Xn(`size.characters`,t.length),{n:t.length.toLocaleString(`en-US`)})}function cD({expanded:e,onToggle:t,controls:n,collapsedLabel:r,expandedLabel:i,className:a}){return z(`button`,{type:`button`,className:`expand-toggle${a?` ${a}`:``}`,onClick:t,"aria-expanded":e,"aria-controls":n,children:[I(e?Zr:Gr,{size:13,"aria-hidden":`true`}),I(`span`,{children:e?i:r})]})}function lD(e){let t=e.replace(/\\(u[0-9a-fA-F]{0,3})?$/,``);try{return JSON.parse(`"${t}"`)}catch{return t}}function uD(e,t){let n=RegExp(`"${t}"\\s*:\\s*(\\d+)`).exec(e);return n?Number(n[1]):null}function dD(e,t){let n=RegExp(`"${t}"\\s*:\\s*"((?:[^"\\\\]|\\\\.)*)`).exec(e);return n?lD(n[1]):``}function fD(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:dD(t,`head`),tail:dD(t,`tail`),originalChars:uD(t,`original_chars`),omittedChars:uD(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 pD(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 mD({text:e,renderShort:t}){let n=R(),[r,i]=(0,V.useState)(!1),a=(0,V.useId)(),o=fD(e),s=o?o.tail?`${o.head}\n…\n${o.tail}`:o.head:e,c=rD(s)>25||s.length>2500;return z(P.Fragment,{children:[o&&I(`div`,{className:`detail-result-note`,children:pD(o)}),I(`div`,{id:a,className:`detail-result-content${c&&!r?` is-collapsed`:``}`,children:o||c?s:t(s)}),c&&I(cD,{expanded:r,onToggle:()=>i(e=>!e),controls:a,collapsedLabel:n(`code.expand`,{size:sD(n,s,25)}),expandedLabel:n(`code.collapse`),className:`step-expand-toggle`})]})}var hD={"Thinking...":`msg.thinking`,"Reading your request":`live.readingRequest`,"Reading the tool results":`live.readingResults`,Reasoning:`live.reasoning`,"Reconnecting to the model server…":`live.reconnectingServer`,"Waiting for GAIA to start this answer…":`live.waitingStart`,"The model server stopped. GAIA is restarting it…":`live.serverRestarting`,"Starting the model server…":`live.serverStarting`};function gD(e,t){let n=hD[t];if(n)return e(n);let r=/^Reasoning — ([\d,]+) words so far$/.exec(t);return r?e(`live.reasoningWords`,{n:r[1]}):(r=/^Connection lost\. Reconnecting \(attempt (\d+) of (\d+)\)…$/.exec(t),r?e(`live.reconnectingStream`,{attempt:r[1],max:r[2]}):(r=/^Loading (\S+) into memory$/.exec(t),r?e(`live.loadingModel`,{model:r[1]}):(r=/^Reading page (\d+) of (\d+)…$/.exec(t),r?e(`live.readingPage`,{page:r[1],total:r[2]}):(r=/^Downloading the speech model, one time \(([\d.]+) GB\)$/.exec(t),r?e(`live.speechModelStart`,{size:r[1]}):(r=/^Downloading the speech model, one time — (\d+)% of ([\d.]+) GB$/.exec(t),r?e(`live.speechModelPercent`,{percent:r[1],size:r[2]}):(r=/^Downloading the speech model, one time — (\d+)% of ([\d.]+) GB, then ([\d.]+) GB for the NPU$/.exec(t),r?e(`live.speechModelPercentNpu`,{percent:r[1],size:r[2],npu:r[3]}):(r=/^Downloading the speech model's NPU part \(([\d.]+) GB\), no progress shown$/.exec(t),r?e(`live.speechModelNpu`,{size:r[1]}):t===`Downloading the speech model's NPU part, no progress shown`?e(`live.speechModelNpuNoSize`):t===`Loading the speech model`?e(`live.speechModelLoading`):(r=/^Downloaded the speech model \(([\d.]+) GB\)$/.exec(t),r?e(`live.speechModelDone`,{size:r[1]}):t===`Downloading the speech model, one time`?e(`live.speechModelStartNoSize`):(r=/^Downloading the speech model, one time — (\d+)%$/.exec(t),r?e(`live.speechModelPercentNoSize`,{percent:r[1]}):t===`Downloaded the speech model`?e(`live.speechModelDoneNoSize`):(r=/^Downloading (\S+)$/.exec(t),r?e(`live.downloadingModel`,{model:r[1]}):t))))))))))}var _D={search_file:Ko,search_files:Ko,search_file_content:Ko,search_directory:Ko,read_file:Yi,write_file:Gi,get_file_info:Yi,browse_directory:$i,list_directory:$i,list_recent_files:$i,analyze_data_file:zr,run_shell_command:bs,run_python:bs,execute_python_file:bs,analyze_image:_a,answer_question_about_image:_a,generate_image:_a,take_screenshot:_a,query_documents:Dr,query_specific_file:Dr,search_indexed_chunks:Dr,evaluate_retrieval:Dr,index_document:xi,index_documents:xi,index_directory:xi,list_indexed_documents:xi,summarize_document:Yi,dump_document:Yi,rag_status:xi,add_watch_directory:$i,transcribe_media:xr,refine_transcript:Yi,analyze_transcript:Fa,export_transcript:Lr,web_search:pa,search_web:pa,fetch_page:ja,fetch_webpage:ja,find_files:Ko,edit_file:Gi,recall:kr,remember:kr,update_memory:kr,forget:kr,forget_everything:kr,search_past_conversations:kr,request_user_input:qa,load_skill:us,use_skill:us,unload_skill:us,list_skills:us,search_skill_hub:us,install_skill:us,capture_skill:us,remove_skill:us,skill_status:us};for(let e of Object.keys(_D))if(!ae(`tool.${e}.done`)||!ae(`tool.${e}.active`))throw Error(`AgentActivity: tool "${e}" has an icon but no tool.${e}.done/.active labels in src/i18n/locales/en.ts.`);var vD=new Set([`load_skill`,`use_skill`]),yD=new Set([`remember`,`recall`,`update_memory`,`forget`]);function bD(e){return e.type===`tool`&&e.success!==!1&&yD.has(e.tool??``)}var xD={label:u(`tool.default.done`),activeLabel:u(`tool.default.active`),icon:Ps},SD=(e,t)=>({label:u(`tool.named.done`,{what:e}),activeLabel:u(`tool.named.active`,{what:e}),icon:t}),CD=(e,t)=>e(t.ref,t.params);function wD(e,t){if(!e)return xD;if(e.startsWith(`mcp_`)){let e=t?.mcpServerLabel;return e?SD(t?.mcpTool?`${e}: ${t.mcpTool}`:e,pa):{label:u(`tool.mcp.done`),activeLabel:u(`tool.mcp.active`),icon:pa}}if(ae(`tool.${e}.done`)&&ae(`tool.${e}.active`))return{label:u(`tool.${e}.done`),activeLabel:u(`tool.${e}.active`),icon:Object.prototype.hasOwnProperty.call(_D,e)?_D[e]:Ps};let n=e.replace(/[_-]+/g,` `).trim();return n?SD(n,Ps):xD}function TD(e,t){let n=wD(e.tool,e),r=e.success==null&&!e.result;return e.active?CD(t,n.activeLabel):e.timedOut?t(`tool.timedOut`,{label:n.activeLabel}):e.autoDeclined?t(`tool.autoDeclined`,{label:n.activeLabel}):e.declined?t(`tool.declined`,{label:n.activeLabel}):e.refused?t(`tool.refused`,{label:n.activeLabel}):e.success===!1?t(`tool.failed`,{label:n.activeLabel}):r?t(`tool.unfinished`,{label:n.activeLabel}):CD(t,n.label)}function ED(e,t=gt){return e.mcpServerLabel?TD(e,t):e.tool===`use_skill`&&e.detail?t(`activity.usingSkill`,{name:e.detail}):(e.declined||e.timedOut||e.refused||e.autoDeclined)&&!e.active?TD(e,t):e.narration?MD(e.narration):TD(e,t)}var DD=48,OD=5,kD=6,AD=/^Error fetching page:\s*(\d{3})?/;function jD(e,t){let n=e.result??``,r=e.tool===`fetch_page`?AD.exec(n):null;if(!r)return n;let i=r[1];return i&&[`401`,`403`,`429`].includes(i)?t(`activity.fetchBlocked`,{code:i}):t(`activity.fetchFailed`)}function MD(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>DD&&t.length>2?`${t[0]}/…/${t[t.length-1]}`:e}`}if(r.length>DD&&/[\\/]/.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}function ND(e){let t=[],n;for(let r of e)r.type===`thinking`&&!r.active&&(r.detail||``).trim()?(n&&t.push(n),n=r):n&&r.type===`tool`?(t.push({...r,thought:n}),n=void 0):(n&&t.push(n),n=void 0,t.push(r));return n&&t.push(n),t}var PD=/^(?:Executing step \d+ of the plan\.?|Following the plan to [\s\S]*)$/;function FD(e,t){return!!e&&!!t&&e.length===t.length&&e.every((e,n)=>e===t[n])}function ID(e,t){return e.tool===t.tool&&(e.detail??``)===(t.detail??``)&&e.mcpServer===t.mcpServer}function LD(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 RD(e,t){let n=[],r=new Map,i,a=!1;e.forEach((t,o)=>{if(bD(t))return;let s=n[n.length-1];if(!a||t.type!==`thinking`&&t.type!==`status`||!PD.test((t.detail||t.label||``).trim())){if(t.type===`plan`){if(a=!0,i&&FD(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&&ID(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.latencyMs!=null&&/\S$/.test(s.detail||``)&&/^\S/.test(t.detail||``)?`
163
+
164
+ `:``,r=(s.detail||``)+e+(t.detail||``);n[n.length-1]={...t,timestamp:s.timestamp,detail:r||s.detail}}else t.type===`status`&&s&&s.type===`status`&&s.success!==!1&&t.active!==!1&&!s.kept&&!t.kept?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`&&t.success!==!1&&!t.kept&&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=LD(a.planSteps.length,a.currentStep,o,s)}return n}function zD(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 BD(e){let[t,n]=(0,V.useState)(()=>Date.now());return(0,V.useEffect)(()=>{if(!e)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),t}function VD(e,t=``){let n=[];for(let r of e){if(r.type===`commentary`){let e=r.detail?.trim();e&&!t.trimStart().startsWith(e)&&n.push({kind:`note`,row:r});continue}let e=n[n.length-1];e?.kind===`steps`?e.rows.push(r):n.push({kind:`steps`,id:r.id,rows:[r]})}return n}function HD(e){if(vD.has(e.tool??``))return/:\s*(.+)$/.exec(e.narration??``)?.[1]?.trim()||void 0}var UD=3;function WD(e,t=gt){let n=[];for(let t of e){let e,r;if(t.type===`tool`&&t.timedOut)e=u(`activity.timedOut`);else if(t.type===`tool`&&t.autoDeclined)e=u(`activity.autoDeclined`);else if(t.type===`tool`&&t.declined)e=u(`activity.youDeclined`);else if(t.type===`tool`&&t.refused)e=u(`activity.gaiaRefused`);else if(t.type===`tool`){let n=wD(t.tool,t),i=HD(t);e=i?u(`activity.usedSkill`,{name:i}):n.label,r=i?u(`activity.skillFailed`,{name:i}):u(`tool.failed`,{label:n.activeLabel})}else if(t.type===`policy_alert`)e=u(`activity.blocked`);else if(t.type===`error`)e=u(`activity.hitError`);else if(t.type===`plan`)e=u(`activity.madePlan`);else continue;let i=`${e.ref}:${JSON.stringify(e.params??{})}`,a=t.type===`tool`&&t.success===!1,o=n.find(e=>e.id===i),s=t.count??1;o?(o.count+=s,o.allFailed&&=a,o.failures+=a?s:0):n.push({label:e,failedLabel:r,allFailed:a,failures:a?s:0,id:i,count:s})}return t.compose(e=>{if(n.length===0)return e(`activity.thoughtThrough`);let t=n.slice(0,UD).map((t,n)=>{let r=t.allFailed&&t.failedLabel?t.failedLabel:t.label,i=e(r.ref,r.params),a=n===0?i:i.charAt(0).toLowerCase()+i.slice(1),o=t.count>1?`${a} ×${t.count}`:a;return t.failedLabel&&!t.allFailed&&t.failures>0?e(`activity.someFailed`,{text:o,n:t.failures}):o}),r=t.join(e(`activity.summarySep`)),i=n.length-t.length;return i>0?e(`activity.summaryMore`,{list:r,n:i}):r})}function GD(e){return e.type===`error`||e.type===`policy_alert`}function KD(e){return e.type===`status`&&e.success===!1}function qD(e){return e.type===`status`&&e.kept===!0}function JD(e){return e.type!==`status`&&!(e.type===`thinking`&&!(e.detail||``).trim())}function YD(e){let t=new Map,n=[],r=e=>{let r=n[n.length-1],i=e==null?r?.latencyMs:e-n[0].timestamp;if(i!=null&&i>=0)for(let e of n)t.set(e.id,i);n=[]};for(let t of e)t.type===`thinking`||n.length>0&&t.type===`status`?t.type===`thinking`&&n.push(t):n.length>0&&r(t.timestamp);return n.length>0&&r(),t}var XD=e=>e.type===`tool`&&e.needsModel===`vision`&&!e.active;function ZD(){let e=R();return z(`div`,{className:`flow-tool-offer`,children:[I(`span`,{children:e(`activity.visionNeeded`)}),I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{ec(`vision`)},children:e(`activity.getVisionModel`)})]})}function QD({steps:e,isActive:t,running:n=t,awaitingUser:r=!1,liveLine:i,toolStatus:a=null,answer:o}){let s=R(),[c,l]=(0,V.useState)(new Map),[u,d]=(0,V.useState)(new Set),[f,p]=(0,V.useState)(``),[m,h]=(0,V.useState)(`all`),g=(0,V.useMemo)(()=>RD(e,n),[e,n]),_=(0,V.useMemo)(()=>VD(g,o),[g,o]),v=(0,V.useMemo)(()=>YD(e),[e]),y=BD(n),b=n?[...g].reverse().find(e=>e.type===`plan`&&e.planSteps?.length):void 0,x=n&&g.some(e=>e.active&&e.type!==`status`),S=n&&a?[...g].reverse().find(e=>e.type===`tool`&&e.active)?.id:void 0,C=!!f||m!==`all`,w=(0,V.useCallback)(e=>{d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),T=e=>{if(e.type!==`tool`||!C)return!0;let t=f.toLowerCase();return!(t&&!e.tool?.toLowerCase().includes(t)&&!ED(e,s).toLowerCase().includes(t)||m===`success`&&e.success!==!0||m===`error`&&e.success!==!1)},E=e=>e.type===`thinking`?I(aO,{step:e,live:n&&!!e.active,durationMs:v.get(e.id),now:y},e.id):e.type===`tool`?I(cO,{step:e,isExpanded:u.has(e.id),thoughtMs:e.thought?v.get(e.thought.id):void 0,now:y,awaitingUser:n&&r,status:e.id===S?a:null,onToggle:()=>w(e.id)},e.id):e.type===`plan`?e===b?null:I(dO,{step:e},e.id):e.type===`status`?e.kept?I(tO,{step:e},e.id):I(eO,{step:e},e.id):e.type===`error`?I(fO,{step:e},e.id):e.type===`policy_alert`?I(pO,{step:e},e.id):null;if(g.length===0)return i?I(`div`,{className:`agent-activity active`,children:I(`div`,{className:`flow-live-line`,children:i})}):null;let D=_.length-1,O=e=>ND(e.filter(e=>(JD(e)||KD(e)||qD(e))&&!$D(e,b))),k=_.reduce((e,t,r)=>{if(t.kind!==`steps`)return e;let i=n&&r===D,a=O(t.rows);return a.length<2&&!i?e:c.get(t.id)??(i||a.some(GD))?e+a.filter(e=>e.type===`tool`).length:e},0);return z(`div`,{className:`agent-activity ${n?`active`:`done`}`,children:[I(`div`,{className:`agent-timeline`,children:_.map((e,t)=>{if(e.kind===`note`)return I(nO,{text:e.row.detail??``},e.row.id);let r=n&&t===D,i=O(e.rows);if(i.length===0)return null;let a=i.some(GD);if(i.length===1&&!r)return T(i[0])?I(`div`,{className:`flow-steps single`,children:E(i[0])},e.id):null;let o=c.get(e.id)??(r||a),u=i.filter(T);return z(`div`,{className:`flow-steps ${o?`open`:`folded`} ${r?`live`:``}`,children:[!r&&z(`button`,{className:`flow-steps-summary`,onClick:()=>l(t=>new Map(t).set(e.id,!o)),"aria-expanded":o,children:[a?I(ri,{size:13,className:`agent-icon-error`}):i.some(e=>e.type===`tool`&&(e.declined||e.refused||e.autoDeclined))?I(Cr,{size:13,className:`flow-steps-done`}):I(ti,{size:13,className:`flow-steps-done`}),I(`span`,{className:`flow-steps-text`,children:WD(i,s)}),I(Yr,{size:12,className:`flow-tool-chevron ${o?`expanded`:``}`})]}),o&&I(`div`,{className:`flow-steps-rows`,children:u.map(E)}),!o&&i.filter(KD).map(E),!o&&!r&&i.some(XD)&&I(ZD,{})]},e.id)})}),b&&I(dO,{step:b}),n&&!x&&i&&I(`div`,{className:`flow-live-line`,children:i}),!n&&k>=kD&&z(`div`,{className:`activity-filter-bar`,children:[I(`input`,{type:`text`,className:`activity-filter-input`,placeholder:s(`activity.filterPlaceholder`),"aria-label":s(`activity.filterByTool`),value:f,onChange:e=>p(e.target.value)}),z(`select`,{className:`activity-filter-select`,"aria-label":s(`activity.filterByStatus`),value:m,onChange:e=>h(e.target.value),children:[I(`option`,{value:`all`,children:s.bare(`activity.filter.all`)}),I(`option`,{value:`success`,children:s.bare(`activity.filter.success`)}),I(`option`,{value:`error`,children:s.bare(`activity.filter.error`)})]})]})]})}function $D(e,t){return e.type===`plan`&&e===t}function eO({step:e}){return z(`div`,{className:`flow-warning`,role:`status`,children:[I(ri,{size:13}),I(`span`,{children:e.label})]})}function tO({step:e}){let t=R();return z(`div`,{className:`flow-done`,role:`status`,children:[I(Vr,{size:13,"aria-hidden":`true`}),I(`span`,{children:gD(t,e.label)})]})}function nO({text:e}){return I(`div`,{className:`flow-note md-content`,children:I(h_,{remarkPlugins:[Ob],disallowedElements:[...b_],urlTransform:O_,children:e})})}var rO=3e3;function iO(e,t,n=gt){return e?t!=null&&t>=rO?n(`activity.thinkingFor`,{time:zD(t/1e3)}):n(`activity.thinking`):t==null||t<1e3?n(`activity.thought`):n(`activity.thoughtFor`,{time:zD(t/1e3)})}function aO({step:e,live:t,durationMs:n,now:r}){let i=R(),a=(e.detail||``).trim(),[o,s]=(0,V.useState)(!1);return a?z(`div`,{className:`flow-reasoning ${t?`live`:``}`,children:[z(`button`,{className:`flow-reasoning-toggle`,onClick:()=>s(e=>!e),"aria-expanded":o,children:[t?I(La,{size:13,className:`flow-tool-spinner`}):I(kr,{size:13,className:`flow-tool-icon`}),I(`span`,{children:iO(t,t?r-e.timestamp:n,i)}),I(Yr,{size:12,className:`flow-tool-chevron ${o?`expanded`:``}`})]}),o&&I(`div`,{className:`flow-thought-hacker`,children:a})]}):null}function oO(e,t=gt){let n=/(['"`])([A-Z]:[\\/][^'"`\n]*?)\1|(?<![\w/\\])[A-Z]:[\\/](?:[^\s*?"'`<>|,;)}\]]+[\\/])*[^\s*?"'`<>|,;)}\]]*/gi,r=[],i=0,a;for(;(a=n.exec(e))!==null;){let n=a[1]??``;(a.index>i||n)&&r.push(e.slice(i,a.index)+n);let o=n?a[2]:a[0],s=o.replace(/[)}\]]+$/,``),c=()=>{$t(s).catch(e=>F.ui.error(`Failed to open path`,e))};r.push(z(`span`,{className:`tool-result-path`,onClick:c,title:t(`activity.openPath`,{path:s}),role:`button`,tabIndex:0,onKeyDown:e=>{e.key===`Enter`&&c()},children:[I($i,{size:10,style:{flexShrink:0,opacity:.7}}),s]},a.index)),(s.length<o.length||n)&&r.push(o.slice(s.length)+n),i=a.index+a[0].length}return r.length===0?e:(i<e.length&&r.push(e.slice(i)),I(P.Fragment,{children:r}))}function sO({fileList:e}){let t=R(),[n,r]=(0,V.useState)(!1),i=n?e.files:e.files.slice(0,5),a=e.total-5,o=(e,n)=>{let r=e.name||e.filename||e.file_name;return r?String(r):e.file_path&&String(e.file_path).replace(/\\/g,`/`).split(`/`).pop()||t(`activity.files.file`,{n:n+1})},s=e=>e.directory?String(e.directory):``;return z(`div`,{className:`file-list-view`,children:[i.map((e,t)=>z(`div`,{className:`file-list-item`,children:[e.kind===`folder`?I(aa,{size:11,className:`file-list-icon`,"data-kind":`folder`}):I(Zi,{size:11,className:`file-list-icon`}),I(`span`,{className:`file-list-name`,children:o(e,t)}),s(e)&&I(`span`,{className:`file-list-dir`,children:s(e)})]},t)),a>0&&!n&&I(`button`,{className:`file-list-more`,onClick:()=>r(!0),children:t(`activity.files.more`,{n:a})}),n&&e.files.length<e.total&&I(`span`,{className:`file-list-truncated`,children:t(`activity.files.showing`,{shown:e.files.length,total:e.total})})]})}function cO({step:e,isExpanded:t,onToggle:n,now:r,awaitingUser:i=!1,status:a=null,thoughtMs:o}){let s=R(),c=wD(e.tool,e).icon,l=!!e.active&&i,u=!l&&e.active&&a?gD(s,a):``,d=l?s(`activity.waiting`):u||ED(e,s),f=e.count??1,p=(!!e.declined||!!e.timedOut||!!e.refused||!!e.autoDeclined)&&!e.active,m=e.success===!1&&e.result&&!p&&!e.needsModel?jD(e,s):``,h=l?``:e.active?zD((r-e.timestamp)/1e3):e.latencyMs==null?``:gO(e.latencyMs);return z(`div`,{className:`flow-tool ${e.active?`active`:``} ${e.success===!1&&!p?`error`:``} ${p?`declined`:``} ${vD.has(e.tool??``)?`skill`:``}`,children:[z(`button`,{className:`flow-tool-header`,onClick:n,"aria-expanded":t,title:l||u?ED(e,s):e.narration&&e.narration!==d?e.narration:void 0,children:[z(`div`,{className:`flow-tool-left`,children:[e.active&&!l?I(La,{size:13,className:`flow-tool-spinner`}):p?I(Cr,{size:13,className:`flow-tool-icon`}):e.success===!1?I(ri,{size:13,style:{color:`var(--danger)`}}):I(c,{size:13,className:`flow-tool-icon`}),I(`span`,{className:`flow-tool-label`,dir:`auto`,children:d}),f>1&&z(`span`,{className:`flow-tool-count`,"aria-label":s(`activity.identicalCalls`,{n:f}),children:[`×`,f]}),m&&I(`span`,{className:`flow-tool-failure`,dir:`auto`,children:m})]}),z(`div`,{className:`flow-tool-right`,children:[e.thought&&I(`span`,{className:`flow-tool-thought-mark`,title:s(`activity.thoughtFirst`),"aria-hidden":`true`,children:I(kr,{size:11})}),h&&I(`span`,{className:`flow-tool-latency`,children:h}),I(`span`,{className:`flow-tool-chevron ${t?`expanded`:``}`,children:I(Yr,{size:12})})]})]}),e.needsModel===`vision`&&!e.active&&I(ZD,{}),t&&z(`div`,{className:`flow-tool-detail`,children:[e.thought?.detail&&z(`div`,{className:`flow-tool-thought`,children:[I(`span`,{className:`detail-section-label`,children:iO(!1,o,s)}),I(`div`,{className:`flow-thought-hacker`,children:e.thought.detail.trim()})]}),z(`div`,{className:`flow-tool-raw`,children:[I(`span`,{className:`detail-section-label`,children:s(`activity.detail.tool`)}),I(`code`,{className:`flow-tool-badge`,children:e.tool||`unknown`}),e.mcpServer&&I(`span`,{className:`flow-tool-mcp-server`,children:s(`activity.detail.via`,{server:e.mcpServer})})]}),e.detail&&!e.commandOutput&&z(`div`,{className:`step-detail-args`,children:[I(`span`,{className:`detail-section-label`,children:s(`activity.detail.arguments`)}),I(`div`,{className:`detail-args-content`,children:yO(e.detail)})]}),e.commandOutput&&I(hO,{output:e.commandOutput}),e.mcpOutput&&z(`div`,{className:`step-detail-result result-success`,children:[I(`span`,{className:`detail-section-label`,children:s(`activity.detail.output`)}),I(QE,{code:e.mcpOutput.text,previewLines:OD,testId:`mcp-output`}),e.mcpOutput.truncated&&I(`div`,{className:`cmd-truncated`,children:s(`activity.truncated`)})]}),e.result&&!e.commandOutput&&!e.mcpOutput&&z(`div`,{className:`step-detail-result ${e.success===!1?`result-error`:`result-success`}`,children:[I(`span`,{className:`detail-section-label`,children:e.success===!1?s(`activity.detail.error`):s(`activity.detail.result`)}),I(mD,{text:e.result,renderShort:e=>oO(e,s)})]}),e.retrievalChunks&&e.retrievalChunks.length>0&&I(mO,{chunks:e.retrievalChunks}),e.fileList&&e.fileList.files.length>0&&I(sO,{fileList:e.fileList})]})]})}var lO={done:`activity.planStatus.done`,running:`activity.planStatus.running`,failed:`activity.planStatus.failed`,stopped:`activity.planStatus.stopped`,pending:`activity.planStatus.pending`};function uO({status:e}){return e===`done`?I(ti,{size:13,className:`plan-icon-done`}):e===`running`?I(La,{size:13,className:`flow-tool-spinner`}):e===`failed`?I(ri,{size:13,className:`plan-icon-failed`}):e===`stopped`?I(ri,{size:13,className:`plan-icon-stopped`}):I(li,{size:13,className:`plan-icon-pending`})}function dO({step:e}){let t=R(),n=e.planSteps??[];if(n.length===0)return null;let r=e.planStatuses,i=r?.filter(e=>e===`done`).length??0;return z(`div`,{className:`flow-plan`,children:[z(`div`,{className:`flow-plan-header`,children:[I(Fa,{size:13}),I(`span`,{children:t(`activity.plan`)}),r&&I(`span`,{className:`flow-plan-count`,children:t(`activity.planDone`,{done:i,total:n.length})})]}),I(`ol`,{className:`flow-plan-list`,children:n.map((n,i)=>{let a=r?.[i],o=MD(e.planNarrations?.[i]||n);return z(`li`,{className:`flow-plan-item ${a??``}`,title:n,"aria-label":a?t(`activity.planItem`,{status:u(lO[a]),text:o}):void 0,children:[I(uO,{status:a}),I(`span`,{className:`flow-plan-text`,children:o})]},i)})})]})}function fO({step:e}){let t=R();return z(`div`,{className:`flow-error`,children:[I(ri,{size:13}),I(`span`,{children:e.detail||e.label||t(`activity.errorOccurred`)})]})}function pO({step:e}){let t=R();return z(`div`,{className:`flow-policy-alert`,children:[z(`div`,{className:`flow-policy-alert-header`,children:[I(ns,{size:14}),I(`span`,{className:`flow-policy-alert-title`,children:t(`activity.policy.title`)}),I(`span`,{className:`flow-policy-alert-decision`,children:e.decision||`BLOCK`})]}),z(`div`,{className:`flow-policy-alert-body`,children:[z(`div`,{className:`flow-policy-alert-line`,children:[I(`span`,{children:t(`activity.policy.tool`)}),I(`code`,{children:e.tool||`unknown tool`})]}),I(`div`,{className:`flow-policy-alert-reason`,children:e.reason||e.detail}),e.ruleIds&&e.ruleIds.length>0&&z(`div`,{className:`flow-policy-alert-line`,children:[I(`span`,{children:t(`activity.policy.rules`)}),I(`code`,{children:e.ruleIds.join(`, `)})]}),e.policyVersion&&z(`div`,{className:`flow-policy-alert-line`,children:[I(`span`,{children:t(`activity.policy.policy`)}),I(`code`,{children:e.policyVersion})]}),z(`div`,{className:`flow-policy-alert-line`,children:[I(`span`,{children:t(`activity.policy.receipt`)}),e.receiptId?I(`code`,{children:e.receiptId}):I(`em`,{children:t(`activity.policy.receiptUnavailable`)})]})]})]})}function mO({chunks:e}){let t=R(),[n,r]=(0,V.useState)(new Set),i=e=>{r(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};return z(`div`,{className:`chunks-view`,children:[I(`span`,{className:`detail-section-label`,children:t(`activity.chunks`,{n:e.length})}),I(`div`,{className:`chunks-list`,children:e.map(e=>{let r=n.has(e.id);return z(`div`,{className:`chunk-card ${r?`expanded`:``}`,children:[z(`button`,{className:`chunk-header`,onClick:()=>i(e.id),children:[z(`div`,{className:`chunk-header-left`,children:[I(Dr,{size:11,style:{color:`var(--accent-cyan)`,flexShrink:0}}),e.source&&I(`span`,{className:`chunk-source`,children:e.source}),e.page!=null&&I(`span`,{className:`chunk-page`,children:t(`activity.chunkPage`,{page:e.page})}),e.score!=null&&e.score>0&&I(`span`,{className:`chunk-score`,children:e.score.toFixed(2)})]}),I(`span`,{className:`chunk-chevron ${r?`expanded`:``}`,children:I(Yr,{size:11})})]}),I(`div`,{className:`chunk-body ${r?`show`:``}`,children:r?I(`pre`,{className:`chunk-content`,children:e.content}):I(`div`,{className:`chunk-preview`,children:e.preview})})]},e.id)})})]})}function hO({output:e}){let t=R(),[n,r]=(0,V.useState)(!1),i=(0,V.useRef)(null);(0,V.useEffect)(()=>()=>{i.current&&clearTimeout(i.current)},[]);let a=(0,V.useCallback)(()=>{let t=e.stdout||e.stderr||``;navigator.clipboard.writeText(t).catch(()=>{}),r(!0),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>r(!1),2e3)},[e]),o=!!(e.stdout||e.stderr),s=e.returnCode!==0&&!e.expectedExit;return z(`div`,{className:`cmd-output ${s?`cmd-error`:``}`,children:[z(`div`,{className:`cmd-header`,children:[z(`div`,{className:`cmd-header-left`,children:[I(bs,{size:12,className:`cmd-header-icon`}),I(`span`,{className:`cmd-header-title`,children:t(`activity.terminal`)}),e.cwd&&I(`span`,{className:`cmd-cwd`,children:e.cwd})]}),z(`div`,{className:`cmd-header-right`,children:[e.durationSeconds!=null&&z(`span`,{className:`cmd-duration`,children:[e.durationSeconds.toFixed(1),`s`]}),e.returnCode!==0&&I(`span`,{className:`cmd-exit-code${s?``:` cmd-exit-expected`}`,title:e.expectedExit??void 0,children:t(`activity.exit`,{code:e.returnCode})}),o&&I(`button`,{className:`cmd-copy ${n?`copied`:``}`,onClick:a,title:t(n?`msg.copied`:`activity.copyOutput`),"aria-label":t(n?`msg.copiedAria`:`activity.copyOutputAria`),children:I(n?Vr:hi,{size:11})})]})]}),z(`div`,{className:`cmd-line`,children:[I(`span`,{className:`cmd-prompt`,children:`$`}),I(`span`,{className:`cmd-text`,children:e.command})]}),e.stdout&&I(`pre`,{className:`cmd-stdout`,children:e.stdout}),e.stderr&&I(`pre`,{className:`cmd-stderr`,children:e.stderr}),e.truncated&&I(`div`,{className:`cmd-truncated`,children:t(`activity.truncated`)}),!o&&I(`div`,{className:`cmd-empty`,children:t(`activity.noOutput`)})]})}function gO(e){return e<1?`<1ms`:e<1e3?`${Math.round(e)}ms`:`${(e/1e3).toFixed(1)}s`}function _O(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 vO=/^([A-Za-z_][\w.-]{0,29}):(?:\s+([\s\S]*))?$/;function yO(e){let t=e.includes(`
165
+ `)?e.split(`
166
+ `).filter(Boolean):e.split(/, (?=[A-Za-z_][\w.-]{0,29}:(?:\s|$))/).filter(Boolean);return t.length<=1?I(`span`,{className:`arg-value`,children:e}):I(`div`,{className:`args-grid`,children:t.map((e,t)=>{let n=vO.exec(e.trim());if(n){let e=n[1],r=_O((n[2]??``).trim());return z(`div`,{className:`arg-row`,children:[I(`span`,{className:`arg-key`,children:e}),I(`span`,{className:`arg-value`,children:r})]},t)}return I(`div`,{className:`arg-row`,children:I(`span`,{className:`arg-value`,children:e})},t)})})}var bO=`gaia`;function xO(e){return e.some(e=>e.id===bO)}var SO=class extends Error{constructor(){super(`The GAIA agent isn't installed. Install it from the notice above, then send again.`),this.name=`FlagshipMissing`}};function CO(e){let t=e;return t?.httpStatus===422&&`${typeof t.detail==`string`?t.detail:``} ${typeof t.message==`string`?t.message:``}`.includes(`Unknown agent_type '${bO}'`)}function wO(e){return e&&!(`error`in e)?e.accounts??[]:[]}function TO(e){return e.status!==`ok`}function EO(e){let t=e.accounts??[];return t.length>1||t.some(TO)}var DO=`default`;function OO(e){return e.account_id===DO&&e.email?e.email:e.account_id}function kO(e,t){let n=t.toLowerCase();return e.find(e=>e.account_id===t||!!e.email&&e.email.toLowerCase()===n)}var AO=e=>e.status===`ok`;function jO(e,t){let n=wO(e),r=(t?kO(n,t):void 0)??(n.length===1&&TO(n[0])?n[0]:null);return{account:r,otherAccount:r!==null||n.length>1}}function MO(e,t,n){if(!e||`error`in e)return!1;if(!e.accounts)return e.configured;let r=wO(t),i=new Set(r.map(OO)),a=e.accounts.filter(AO);if(a.some(e=>!i.has(OO(e))))return!0;let o=jO(t,n).account;if(o)return a.some(e=>OO(e)===OO(o));if(r.length<=1)return a.length>0;let s=new Set(r.filter(AO).map(OO));return a.some(e=>!s.has(OO(e)))}function NO(e,t=32){if(e.length<=t)return e;let n=e.lastIndexOf(`@`),r=n>0?e.length-n:0,i=r>0&&r<=t/2?r:Math.floor((t-1)/2);return`${e.slice(0,t-1-i).replace(/[.\-_]+$/,``)}…${e.slice(e.length-i)}`}function PO(e){let t=e,n=t?.httpStatus===409&&t.body?.error===`account_choice_required`?t.body.choices:null;return Array.isArray(n)?n.map(String):null}function FO(e,t){let n=new Set(wO(t).map(OO));return wO(e).find(e=>AO(e)&&!e.is_default&&!n.has(OO(e)))??null}var IO=F.api;function LO(e){switch(e){case`connector.configured`:return`configured`;case`connector.disconnected`:return`disconnected`;case`connection.revoked`:return`disconnected`;case`connector.oauth.completed`:return`oauth_completed`;case`connection.connected`:return`oauth_completed`;case`connector.oauth.error`:return`oauth_error`;case`connector.tested`:return`tested`;case`connector.enabled`:return`enabled`;case`connector.disabled`:return`disabled`;case`connector.grant.changed`:return`grant_changed`;case`connector.activation.changed`:return`activation_changed`;case`connector.account.changed`:return`account_changed`;default:return null}}function RO(e){let t=(0,V.useRef)(e);(0,V.useEffect)(()=>{t.current=e},[e]),(0,V.useEffect)(()=>{let e=null,n=1e3,r=null,i=!1,a=()=>{i||(e=new EventSource(`${dn()}/connectors/events`),e.onopen=()=>{n=1e3},e.onmessage=e=>{try{let n=JSON.parse(e.data),r=LO(n.type);if(r===null){IO.debug(`connectors-sse: ignoring event`,n.type);return}let i=n.payload??{},a=i.connector_id??i.provider??null;t.current({connectorId:a,reason:r,payload:i})}catch(e){IO.warn(`connectors-sse: malformed event`,e)}},e.onerror=()=>{e?.close(),e=null,i||(r=setTimeout(a,n),n=Math.min(n*2,3e4))})};return a(),()=>{i=!0,r&&clearTimeout(r),e?.close()}},[])}var zO=1e9;function BO(e){return e>0&&e<1?`${Math.max(1,Math.round(e*1e3))} MB`:`${e.toFixed(1)} GB`}var VO=1024**3/zO;function HO(e,t){let n=e?Number.parseFloat(e):NaN;return Number.isFinite(n)&&e?.trim().toUpperCase().endsWith(`GB`)?BO(n*VO):e||(t==null?null:BO(t))}function UO(e){return`${e.toFixed(1)} GB`}function WO(e){return BO(e/zO)}function GO(e){let t=e/1e6;return`${t>=10?Math.round(t):t.toFixed(1)} MB/s`}function KO(e,t){return w(e).meta.dir===`rtl`?he(t,`ltr`):t}function qO(e,t){return e<90?t(`setup.eta.sec`,{n:String(Math.max(1,Math.round(e)))}):e<=7200?t(`setup.eta.min`,{n:String(Math.round(e/60))}):t(`setup.eta.long`)}function JO(e,t){return e<90?t(`setup.eta.secSpoken`,{n:String(Math.max(1,Math.round(e)))}):e<=7200?t(`setup.eta.minSpoken`,{n:String(Math.round(e/60))}):t(`setup.eta.long`)}var YO=5,XO=class{start=null;lastAt=0;lastBytes=0;movedAt=0;speed=0;shownEta=null;shownAt=0;update(e,t,n){if(this.start===null||e<this.lastBytes)return this.start=n,this.lastAt=n,this.lastBytes=e,this.movedAt=n,this.speed=0,this.shownEta=null,{speed:null,eta:null,stalledFor:0};if(this.lastBytes===0&&e>0)return this.lastAt=n,this.lastBytes=e,this.movedAt=n,{speed:null,eta:null,stalledFor:0};let r=(n-this.lastAt)/1e3;if(r>0){let t=(e-this.lastBytes)/r,i=1-Math.exp(-r/YO);this.speed=this.speed===0?t:this.speed+i*(t-this.speed),e>this.lastBytes&&(this.movedAt=n),this.lastAt=n,this.lastBytes=e}let i=(n-this.movedAt)/1e3;if((n-this.start)/1e3<10)return{speed:null,eta:null,stalledFor:i};if(this.speed<=0)return this.shownEta=null,{speed:0,eta:null,stalledFor:i};let a=Math.max(0,t-e)/this.speed;if(this.shownEta===null)this.shownEta=a;else{let e=(n-this.shownAt)/1e3,t=this.shownEta-e;this.shownEta=a<t?this.shownEta-Math.max(e,(this.shownEta-a)/2):a>this.shownEta?this.shownEta+(a-this.shownEta)*.25:a}return this.shownAt=n,{speed:this.speed,eta:Math.max(0,this.shownEta),stalledFor:i}}};function ZO(e,t){return e.filter(e=>e.id===`gaia`&&!!e.namespaced_agent_id&&(e.required_connections?.some(e=>e.connector_id===t)??!1)).map(e=>e.namespaced_agent_id)}function QO(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(`connectors → microsoft`)||t.includes(`connections → microsoft`)||t.includes(`microsoft is not currently connected`))}function $O(e){if(!e)return`all`;let t=e.toLowerCase(),n=t.includes(`google`)||t.includes(`gmail`);return n===(t.includes(`microsoft`)||t.includes(`outlook`)||t.includes(`office365`)||t.includes(`o365`))?`all`:n?`google`:`microsoft`}function ek(e){let t=window;t.gaia?.openExternal?t.gaia.openExternal(e):window.open(e,`_blank`,`noopener`)}function tk({connectorId:e,label:t,grantAgents:n,onDone:r,target:i,title:a,ready:o}){let[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(null),d=(0,V.useCallback)(async()=>{c(!0),u(null);try{ek((i?await gn(e,[],n,i):await gn(e,[],n)).authorization_url),r()}catch(e){u(e instanceof Error?e.message:String(e))}finally{c(!1)}},[e,n,r,i]);return z(`div`,{className:`email-connect-cta__provider-slot`,children:[z(`button`,{className:`email-connect-cta__button`,onClick:()=>void d(),disabled:s||!o,title:a,children:[s?I(La,{size:12,className:`email-connect-cta__spinner`}):I(ji,{size:12}),I(`span`,{children:t})]}),l&&I(`div`,{className:`email-connect-cta__error`,role:`alert`,children:l})]})}var nk=[[`google`,`Google`],[`microsoft`,`Microsoft`]],rk={addAccount:!0};function ik({onChange:e}){return RO(e),null}function ak({content:e=``,connectorId:t}){let n=R(),[r,i]=(0,V.useState)(new Set),a=(0,V.useCallback)(e=>i(t=>new Set([...t,e])),[]),[o,s]=(0,V.useState)([]),[c,l]=(0,V.useState)(!1),u=(0,V.useCallback)(()=>{S().then(e=>s(e.connectors||[])).catch(e=>F.ui.warn(`EmailConnectCta: connector fetch failed`,e)).finally(()=>l(!0))},[]);(0,V.useEffect)(()=>(u(),window.addEventListener(`focus`,u),()=>window.removeEventListener(`focus`,u)),[u]);let{agents:d}=B(),f=(0,V.useCallback)(e=>ZO(d,e),[d]),p=t===`google`||t===`microsoft`?t:$O(e),m=nk.filter(([e])=>p===e||p===`all`);return z(`div`,{className:`email-connect-cta`,role:`region`,"aria-label":n(`emailCta.label`),children:[z(`div`,{className:`email-connect-cta__text`,children:[I(ri,{size:14,className:`email-connect-cta__icon`}),I(`span`,{children:n(r.size>0?`connectCard.opened`:`emailCta.prompt`)})]}),r.size>0&&I(ik,{onChange:u}),I(`div`,{className:`email-connect-cta__buttons`,children:m.map(([e,t])=>{let i=jO(o.find(t=>t.id===e)),s=r.has(e),l={connectorId:e,grantAgents:f(e),onDone:()=>a(e),ready:c};return[i.account?I(tk,{...l,label:n(`connectCard.reconnectAccount`,{address:KO(n.locale,NO(i.account.email||i.account.account_id))}),title:i.account.email||void 0,target:{account:OO(i.account)}},`${e}:${i.account.account_id}`):I(tk,{...l,label:n(s?`emailCta.reopen`:`connectCard.connect`,{name:t})},e),i.otherAccount&&I(tk,{...l,label:n(`connectCard.otherAccount`),target:rk},`${e}:other`)]})})]})}var ok=2e6;function sk({variant:e,render:t,data:n}){let r;try{r=JSON.stringify(n)}catch{r=String(n)}let i=r.length>ok,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 z(`div`,{className:`render-unsupported`,children:[I(`p`,{className:`render-unsupported__message`,children:o}),z(`details`,{className:`render-unsupported__details`,children:[I(`summary`,{children:`Raw payload`}),i?z(`p`,{className:`render-unsupported__too-large`,children:[`Payload too large to display (`,r.length,` bytes)`]}):I(`pre`,{className:`render-unsupported__json`,children:a})]})]})}function ck(e){return e===null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`}function lk(e){return e===null?``:String(e)}function uk(e){return e===void 0||typeof e==`string`}function dk(e){return`+${e-500} more (truncated)`}function fk(e){if(!e||typeof e!=`object`)return!1;let t=e;return uk(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(ck))}function pk({data:e}){if(!fk(e))return I(sk,{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 z(`div`,{className:`render-table-card`,children:[e.title&&I(`div`,{className:`render-table-card__title`,children:e.title}),I(`div`,{className:`render-table`,children:z(`table`,{children:[I(`thead`,{children:z(`tr`,{children:[i.map((e,t)=>I(`th`,{children:e},t)),r&&I(`th`,{children:dk(e.columns.length)})]})}),I(`tbody`,{children:n.map((e,t)=>I(`tr`,{children:e.slice(0,i.length).map((e,t)=>I(`td`,{children:lk(e)},t))},t))})]})}),t&&I(`div`,{className:`render-truncation`,children:dk(e.rows.length)})]})}function mk(e){if(!e||typeof e!=`object`)return!1;let t=e;return uk(t.title)&&Array.isArray(t.items)&&t.items.every(e=>e&&typeof e==`object`&&typeof e.key==`string`&&ck(e.value))}function hk({data:e}){if(!mk(e))return I(sk,{variant:`invalid`,render:`key_value`,data:e});let t=e.items.length>500,n=t?e.items.slice(0,500):e.items;return z(`div`,{className:`render-kv`,children:[e.title&&I(`div`,{className:`render-kv__title`,children:e.title}),I(`dl`,{className:`render-kv__list`,children:n.map((e,t)=>z(`div`,{className:`render-kv__row`,children:[I(`dt`,{className:`render-kv__key`,children:e.key}),I(`dd`,{className:`render-kv__value`,children:lk(e.value)})]},t))}),t&&I(`div`,{className:`render-truncation`,children:dk(e.items.length)})]})}function gk(e){if(!e||typeof e!=`object`)return!1;let t=e;return uk(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 _k({data:e}){if(!gk(e))return I(sk,{variant:`invalid`,render:`list`,data:e});let t=e.items.length>500,n=(t?e.items.slice(0,500):e.items).map((e,t)=>I(`li`,{children:String(e)},t));return z(`div`,{className:`render-list`,children:[e.title&&I(`div`,{className:`render-list__title`,children:e.title}),e.ordered?I(`ol`,{className:`render-list__items`,children:n}):I(`ul`,{className:`render-list__items`,children:n}),t&&I(`div`,{className:`render-truncation`,children:dk(e.items.length)})]})}var vk=/^\/api\/media\/(image|audio)\/([A-Za-z0-9%._~-]+)$/;function yk(e,t){let n=vk.exec(t);if(!n||n[1]!==e)return null;let r;try{r=decodeURIComponent(n[2])}catch{return null}return r===`.`||r===`..`||/[/\\:\0]/.test(r)?null:`${dn()}/media/${e}/${n[2]}`}var bk=/^data:image\/(png|jpe?g|gif|webp);base64,/;function xk(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.src==`string`&&(bk.test(t.src)||yk(`image`,t.src)!==null)&&uk(t.alt)&&uk(t.caption)}function Sk({data:e}){let t=R(),[n,r]=(0,V.useState)(!1);if(!xk(e))return I(sk,{variant:`invalid`,render:`image`,data:e});let i=bk.test(e.src)?e.src:yk(`image`,e.src);return z(`figure`,{className:`render-image${n?` render-image--expanded`:``}`,children:[I(`button`,{type:`button`,className:`render-image__toggle`,"aria-expanded":n,"aria-label":t(n?`media.showSmaller`:`media.showFull`),onClick:()=>r(e=>!e),children:I(`img`,{className:`render-image__img`,src:i,alt:e.alt??``})}),e.caption&&I(`figcaption`,{className:`render-image__caption`,children:e.caption})]})}function Ck(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.src==`string`&&yk(`audio`,t.src)!==null&&uk(t.caption)&&uk(t.path)&&(t.duration_seconds===void 0||typeof t.duration_seconds==`number`&&Number.isFinite(t.duration_seconds)&&t.duration_seconds>=0)}function wk(e){let t=Math.round(e),n=Math.floor(t/60),r=t%60;return`${n}:${String(r).padStart(2,`0`)}`}function Tk({data:e}){let t=R(),[n,r]=(0,V.useState)(!1);if(!Ck(e))return I(sk,{variant:`invalid`,render:`audio`,data:e});let i=yk(`audio`,e.src),a=e.path?e.path.split(/[\\/]/).pop():void 0;return z(`figure`,{className:`render-audio`,children:[I(`audio`,{className:`render-audio__player`,controls:!0,preload:`metadata`,src:i,onError:()=>r(!0)}),z(`figcaption`,{className:`render-audio__caption`,children:[n&&I(`span`,{className:`render-audio__error`,role:`alert`,children:t(`media.audioUnplayable`)}),e.caption&&I(`span`,{className:`render-audio__text`,children:e.caption}),(a||e.duration_seconds!==void 0)&&z(`span`,{className:`render-audio__meta`,children:[a,a&&e.duration_seconds!==void 0&&` · `,e.duration_seconds!==void 0&&I(`bdi`,{dir:`ltr`,children:wk(e.duration_seconds)})]})]})]})}function Ek(e){if(!e||typeof e!=`object`)return!1;let t=e;return uk(t.title)&&uk(t.path)&&uk(t.badge)&&uk(t.note)&&typeof t.unified==`string`}function Dk(e){return e.startsWith(`+`)?`render-diff__line render-diff__line--added`:e.startsWith(`-`)?`render-diff__line render-diff__line--removed`:`render-diff__line`}var Ok=`⋯`;function kk(e){let t=e.replace(/\n$/,``).split(`
167
+ `).map(e=>e.replace(/\r$/,``)),n=t.findIndex(e=>e.startsWith(`@@`));return n===-1?t:t.slice(n+1).map(e=>e.startsWith(`@@`)?Ok:e)}function Ak(e){return e.split(/(?<=[\\/])/).map((e,t)=>z(`span`,{children:[e,I(`wbr`,{})]},t))}function jk({data:e}){if(!Ek(e))return I(sk,{variant:`invalid`,render:`diff`,data:e});let t=kk(e.unified),n=e.title??(e.path?e.path.split(/[\\/]/).filter(Boolean).pop():void 0);return z(`div`,{className:`render-diff`,children:[(n||e.badge)&&z(`div`,{className:`render-diff__title`,children:[e.badge&&I(`span`,{className:`render-diff__badge`,children:e.badge}),n]}),e.path&&I(`div`,{className:`render-diff__path`,dir:`ltr`,children:Ak(e.path)}),e.note&&I(`div`,{className:`render-diff__note`,children:e.note}),e.unified&&I(`pre`,{className:`render-diff__body`,children:t.map((e,t)=>I(`div`,{className:e===Ok?`render-diff__line render-diff__line--hunk`:Dk(e),children:e},t))})]})}function Mk(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.action==`string`&&typeof t.summary==`string`}function Nk(e){let t=e.replace(/_/g,` `).trim();return t.length>0?t:`action`}function Pk({data:e}){let[t,n]=(0,V.useState)(!1);return Mk(e)?t?I(`div`,{className:`render-confirmation render-confirmation--dismissed`,children:I(`span`,{className:`render-confirmation__dismissed-note`,children:`Confirmation dismissed`})}):z(`div`,{className:`render-confirmation`,children:[z(`div`,{className:`render-confirmation__header`,children:[I(`span`,{className:`render-confirmation__badge`,children:`Approval needed`}),I(`span`,{className:`render-confirmation__label`,children:Nk(e.action)}),I(`code`,{className:`render-confirmation__action`,children:e.action})]}),I(`pre`,{className:`render-confirmation__summary`,children:e.summary}),z(`div`,{className:`render-confirmation__footer`,children:[I(`span`,{className:`render-confirmation__note`,children:`Nothing was executed. Follow the assistant's guidance below to approve this action.`}),I(`button`,{type:`button`,className:`render-confirmation__dismiss`,onClick:()=>n(!0),children:`Dismiss`})]})]}):I(sk,{variant:`invalid`,render:`needs_confirmation`,data:e})}var Fk=[`p`,`strong`,`em`,`code`,`ul`,`ol`,`li`,`br`],Ik={p:({children:e})=>I(`p`,{children:I(`bdi`,{children:e})}),li:({node:e,children:t})=>e?.children.some(e=>e.type===`element`&&[`p`,`ul`,`ol`].includes(e.tagName))?I(`li`,{children:t}):I(`li`,{children:I(`bdi`,{children:t})})};function Lk({text:e}){return I(`div`,{className:`render-needs-input__question`,children:I(h_,{allowedElements:Fk,unwrapDisallowed:!0,components:Ik,children:e})})}var Rk=e=>e;function zk(e,t=gt.bare,n=Rk){if(e<1e3)return t(`answer.duration.underSecond`);let r=Math.round(e/1e3);if(r<60)return n(t(`answer.duration.sec`,{n:r}));let i=Math.floor(r/60),a=r%60;return n(a?t(`answer.duration.minSec`,{m:i,s:a}):t(`answer.duration.min`,{n:i}))}var Bk={answered:[`answer.answeredIn`,`answer.answeredInPlace`],stopped:[`answer.stoppedAfter`,`answer.stoppedAfterPlace`],interrupted:[`answer.interruptedAfter`,`answer.interruptedAfterPlace`],failed:[`answer.failedAfter`,`answer.failedAfterPlace`]},Vk={GPU:`device.gpu`,NPU:`device.npu`,CPU:`device.cpu`};function Hk(e){if(e===`on this PC`)return u(`answer.place.thisPc`);let t=/^via (.+)$/.exec(e);if(t)return u(`answer.place.via`,{provider:t[1]});let n=/^on your (.+)$/.exec(e)?.[1].split(` and `).map(e=>Vk[e]);if(n?.every(Boolean)){let e=n.slice(1).reduce((e,t)=>u(`answer.place.pair`,{a:e,b:u(t)}),u(n[0]));return u(`answer.place.on`,{device:e})}return e}function Uk(e,t){return t!==`failed`&&e?.time_to_first_token!=null&&e.time_to_first_token>0}function Wk(e,t,n,r,i,a=!1){let o=[],s=t?.place?Hk(t.place):null;if(e!=null&&e>0){let[t,a]=Bk[n??`answered`],c=zk(e,r,i);o.push(s?r(a,{time:c,place:s}):r(t,{time:c}))}else s&&o.push(r(n?`answer.ranPlace`:`answer.answeredPlace`,{place:s}));if(Uk(t,n)){let e=zk(t.time_to_first_token*1e3,r,i);o.push(r(o.length?`answer.firstWord`:`answer.firstWordLead`,{time:e}))}return t?.steps!=null&&t.steps>0&&o.push(r(Xn(`answer.steps`,t.steps),{n:t.steps})),o.length?a?o[0]:o.join(` · `):null}function Gk(e,t,n,r,i,a=!1){return Wk(e,t,n,gt.bare,Rk)===null?null:r.compose(r=>Wk(e,t,n,r,i,a)??``)}function Kk(e,t,n=gt,r=Rk,i){let a=[];if(e!=null&&e>0&&a.push(n.compose(t=>t(`answer.exact.total`,{time:r(t(`answer.duration.sec`,{n:(e/1e3).toFixed(1)}))}))),Uk(t,i)){let e=(t.time_to_first_token*1e3).toFixed(0);a.push(n.compose(t=>t(`answer.exact.firstToken`,{time:r(t(`answer.duration.ms`,{n:e}))})))}if(t?.output_tokens!=null&&t.output_tokens>0){let e=r(`${(t.input_tokens??0).toLocaleString()} → ${t.output_tokens.toLocaleString()}`);a.push(n.compose(t=>t(`answer.exact.tokens`,{flow:e})))}return t?.tokens_per_second!=null&&t.tokens_per_second>0&&a.push(n(`answer.exact.rate`,{n:t.tokens_per_second})),a}function qk({latencyMs:e,stats:t,ended:n}){let r=R(),[i,a]=(0,V.useState)(!1),o=Gk(e,t,n,r,Ic,!i),s=Gk(e,t,n,r,Rk),c=Kk(e,t,r,Ic,n);return!o&&c.length===0?null:z(P.Fragment,{children:[I(`span`,{children:I(`button`,{type:`button`,className:`msg-stats-summary`,"aria-expanded":i,title:[s,...Kk(e,t,r,Rk,n)].filter(Boolean).join(`
168
+ `),onClick:()=>a(e=>!e),children:o?I(zc,{text:o}):r(`answer.details`)})}),i&&c.map(e=>I(`span`,{children:I(zc,{text:e})},e))]})}function Jk(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`}gt(`question.expired`);var Yk=`••••••`,Xk=class extends Error{};function Zk(e){return e?.httpStatus===404}async function Qk(e,t,n,r){let i=B.getState();try{await pn(e,t,n)}catch(e){throw Zk(e)?(i.closeQuestion(t),new Xk(gt(`question.expired`))):e}i.recordAnswer(t,r),i.closeQuestion(t)}function $k(e,t){let n=e.trim(),r=t.options??[],i=n.toLowerCase(),a=r[/^\d+$/.test(n)?Number(n)-1:-1]??r.find(e=>e.label.toLowerCase()===i||e.value.toLowerCase()===i);return a?{value:a.value,shown:a.label}:t.allowFreeText===!1&&r.length>0?null:{value:n,shown:n}}function eA(e,t){let n=null;for(let[r,i]of Object.entries(e))i.sessionId===t&&!i.sensitive&&(n=r);return n}function tA(e){let[t,n]=(0,V.useState)(()=>Date.now());return(0,V.useEffect)(()=>{if(!e)return;let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),e?Math.max(0,e-t):null}function nA({data:e}){let t=R(),[n,r]=(0,V.useState)({status:`pending`}),[i,a]=(0,V.useState)(``),o=Jk(e)?e.request_id:``,s=B(e=>e.liveQuestions[o]),c=B(e=>o in e.questionAnswers),l=B(e=>e.questionAnswers[o]??null),u=B(e=>e.closeQuestion),d=tA(s?.expiresAt);if((0,V.useEffect)(()=>{if(!s||s.expiresAt===null)return;let e=s.expiresAt-Date.now();if(e<=0){u(o);return}let t=setTimeout(()=>u(o),e);return()=>clearTimeout(t)},[s,o,u]),!Jk(e))return I(sk,{variant:`invalid`,render:`needs_input`,data:e});let f=n.status===`submitting`,p=async(n,i)=>{if(n.trim()&&!f&&s){r({status:`submitting`});try{await Qk(e.session_id,e.request_id,n,e.sensitive?null:i),r({status:`pending`})}catch(e){if(e instanceof Xk){r({status:`pending`});return}r({status:`error`,message:e instanceof Error?e.message:t(`question.sendFailed`)})}}};return c?z(`div`,{className:`render-needs-input render-needs-input--answered`,children:[I(Lk,{text:e.question}),I(`p`,{className:`render-needs-input__answered-note`,role:`status`,children:l===null||e.sensitive?t(`question.youAnsweredHidden`):t(`question.youAnswered`,{answer:l})})]}):!s&&!f?z(`div`,{className:`render-needs-input render-needs-input--expired`,"aria-disabled":`true`,children:[I(`div`,{className:`render-needs-input__header`,children:I(`span`,{className:`render-needs-input__badge`,children:t(`question.badge`)})}),I(Lk,{text:e.question}),I(`p`,{className:`render-needs-input__expired-note`,role:`status`,children:t(`question.expired`)})]}):z(`div`,{className:`render-needs-input`,children:[z(`div`,{className:`render-needs-input__header`,children:[I(`span`,{className:`render-needs-input__badge`,children:t(`question.badge`)}),e.sensitive&&I(`span`,{className:`render-needs-input__sensitive-badge`,children:t(`question.sensitive`)})]}),I(Lk,{text:e.question}),e.options.length>0&&I(`div`,{className:`render-needs-input__options`,children:e.options.map(e=>I(`button`,{type:`button`,className:`render-needs-input__option`,disabled:f,title:e.description||void 0,onClick:()=>p(e.value,e.label),children:I(`bdi`,{children:e.label})},e.value))}),e.allow_free_text&&e.sensitive&&z(`form`,{className:`render-needs-input__free-text`,onSubmit:e=>{e.preventDefault(),p(i,i)},children:[I(`input`,{type:`password`,className:`render-needs-input__free-text-input`,value:i,disabled:f,placeholder:t(`question.hiddenPlaceholder`,{mask:Yk}),onChange:e=>a(e.target.value),autoComplete:`off`,autoFocus:!0}),I(`button`,{type:`submit`,className:`render-needs-input__free-text-submit`,disabled:f||!i.trim(),children:t(`question.send`)})]}),e.allow_free_text&&!e.sensitive&&I(`p`,{className:`render-needs-input__hint`,children:e.options.length>0?t(`question.typeHint`):t(`question.typeHintNoOptions`)}),d!==null&&d>0&&I(`p`,{className:`render-needs-input__hint`,children:t(`question.timeLeft`,{time:zk(d>=6e4?Math.ceil(d/6e4)*6e4:d,t.bare)})}),n.status===`error`&&I(`p`,{className:`render-needs-input__error`,children:n.message})]})}var rA=4e3,iA=150;function aA(e,t){(0,V.useEffect)(()=>{if(!e)return;let n=iA,r=setInterval(()=>{t(),--n,n<=0&&clearInterval(r)},rA);return()=>clearInterval(r)},[e,t])}function oA(e,t){return e?.length?[...new Set([...t??[],...e])]:[]}function sA(e){return e.providers.filter(t=>!e.reconnect?.includes(t))}function cA(e){let t=new Set;for(let n of e?.cards??[])n.render===`connect_account`&&O(n.data)&&sA(n.data).forEach(e=>t.add(e));return[...t]}function lA(e){let t={};for(let n of e?.cards??[])n.render===`connect_account`&&O(n.data)&&Object.assign(t,n.data.account);return t}function uA(e){return(e?.cards??[]).some(e=>e.render===`connect_account`&&O(e.data))}function dA(e,t,n){return t?e.filter(e=>e.namespaced_agent_id===t&&(e.required_connections?.some(e=>e.connector_id===n)??!1)).map(e=>e.namespaced_agent_id):[]}var fA={google:`Google`,microsoft:`Microsoft`,microsoft_work:`Microsoft 365`};function pA(e){let t=window.gaia;t?.openExternal?t.openExternal(e):window.open(e,`_blank`,`noopener`)}function mA(e){let t=e;return t?.httpStatus===503&&t.body?.error===`not_configured`}function hA({connectorId:e,name:t,connected:n,saysConnected:r,added:i,offer:a,needsSetup:o,grantAgents:s,scopes:c,onOpened:l}){let u=R(),d=B(e=>e.openSettings),f=B(e=>e.openConnectorSettings),[p,m]=(0,V.useState)(!1),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(!1);(0,V.useEffect)(()=>{o||v(!1)},[o]);let y=(0,V.useCallback)(async t=>{if(o)g(null),v(!0);else if(v(!1),s.length===0)d(`connectors`);else{m(!0),g(null);try{pA((t?await gn(e,c,s,t):await gn(e,c,s)).authorization_url),l()}catch(e){mA(e)?v(!0):g(e instanceof Error?e.message:String(e))}finally{m(!1)}}},[e,o,s,c,l,d]),b=p?I(La,{size:12,className:`render-connect__spinner`,"aria-hidden":`true`}):I(ji,{size:12,"aria-hidden":`true`}),x=u(n?`connectCard.reconnect`:`connectCard.connect`,{name:t}),{account:S}=a;return z(`div`,{className:`render-connect__provider`,children:[S?z(`button`,{type:`button`,className:`render-connect__button`,title:S.email||void 0,onClick:()=>void y({account:OO(S)}),disabled:p,children:[b,I(`span`,{children:u(`connectCard.reconnectAccount`,{address:KO(u.locale,NO(S.email||S.account_id))})})]}):z(`button`,{type:`button`,className:`render-connect__button${n?` render-connect__button--quiet`:``}`,onClick:()=>void y(),disabled:p,children:[b,I(`span`,{children:x})]}),a.otherAccount&&I(`button`,{type:`button`,className:`render-connect__button render-connect__button--quiet`,onClick:()=>void y({addAccount:!0}),disabled:p,children:I(`span`,{children:u(`connectCard.otherAccount`)})}),r&&!S&&z(`span`,{className:`render-connect__connected`,role:`status`,children:[I(ti,{size:13,"aria-hidden":`true`}),i?u(`connectCard.addedAccount`,{address:KO(u.locale,NO(i.email||i.account_id)),name:t}):u(`connectCard.connected`,{name:t})]}),h&&I(`div`,{className:`render-connect__error`,role:`alert`,children:h}),_&&z(`div`,{className:`render-connect__setup`,role:`status`,children:[I(`span`,{children:u(`connectCard.needsSetup`,{name:t})}),I(`button`,{type:`button`,className:`render-connect__settings`,onClick:()=>f(e),children:u(`connectCard.setUp`,{name:t})})]})]})}function gA({providers:e,onEnded:t}){return RO((0,V.useCallback)(n=>{n.reason===`oauth_error`&&n.connectorId&&e.includes(n.connectorId)&&t(n.payload.reason===`cancelled`?`cancelled`:`failed`)},[e,t])),null}function _A({data:e}){let t=R(),n=B(e=>e.agents),r=B(e=>e.openSettings),[i,a]=(0,V.useState)([]),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(null),f=O(e),p=(0,V.useCallback)(()=>{S().then(e=>{let t=e.connectors||[];a(t),s(e=>e??t)}).catch(e=>F.ui.warn(`ConnectAccountCard: connector fetch failed`,e))},[]);(0,V.useEffect)(()=>{if(f)return p(),window.addEventListener(`focus`,p),()=>window.removeEventListener(`focus`,p)},[f,p]);let m=B(e=>e.settingsSection!==null),h=(0,V.useRef)(m);(0,V.useEffect)(()=>{f&&h.current&&!m&&p(),h.current=m},[f,m,p]);let g=(e,t)=>e?.find(e=>e.id===t),_=t=>f&&o!==null&&MO(g(i,t),g(o,t),e.account?.[t]),v=f&&sA(e).some(_);aA(c&&!v,p);let y=(0,V.useCallback)(e=>{l(!1),d(e)},[]);if(!O(e))return I(sk,{variant:`invalid`,render:Ge,data:e});let b=e=>i.some(t=>t.id===e&&!(`error`in t)&&t.configured),x=e=>_(e)||b(e)&&wO(g(i,e)).length<=1,C=e=>i.some(t=>t.id===e&&!(`error`in t)&&!t.configured&&t.configurable===!1),w=e=>fA[e]??i.find(t=>t.id===e&&!(`error`in t))?.display_name??e,T=e=>{let t=i.find(t=>t.id===e);return t&&!(`error`in t)?t.scopes:void 0},E=t(`connectCard.prompt`);return v?E=t(`connectCard.askAgain`):u?E=t(u===`cancelled`?`connectCard.cancelled`:`connectCard.failed`):c&&(E=t(`connectCard.opened`)),z(`div`,{className:`render-connect`,role:`group`,"aria-label":t(`connectCard.label`),children:[z(`div`,{className:`render-connect__text`,children:[I(Na,{size:14,className:`render-connect__icon`,"aria-hidden":`true`}),I(`span`,{role:u?`alert`:void 0,children:E})]}),c&&I(gA,{providers:e.providers,onEnded:y}),I(`div`,{className:`render-connect__providers`,children:e.providers.map(t=>I(hA,{connectorId:t,name:w(t),connected:b(t),saysConnected:x(t),added:_(t)?FO(g(i,t),g(o,t)):null,offer:jO(g(i,t),e.account?.[t]),needsSetup:C(t),grantAgents:dA(n,e.agent_id,t),scopes:oA(e.scopes?.[t],T(t)),onOpened:()=>{d(null),l(!0)}},t))}),I(`button`,{type:`button`,className:`render-connect__settings`,onClick:()=>r(`connectors`),children:t(`connectCard.settings`)})]})}function vA(e,t,n,r,i,a,o,s){return{id:e,dimension:t,system:n,toBase:r,singular:i,plural:a,short:o,aliases:s}}var yA=[vA(`tsp`,`volume`,`us`,4.92892,`teaspoon`,`teaspoons`,`tsp`,[`teaspoons`,`teaspoon`,`tsps`,`tsp`]),vA(`tbsp`,`volume`,`us`,14.7868,`tablespoon`,`tablespoons`,`tbsp`,[`tablespoons`,`tablespoon`,`tbsps`,`tbsp`,`tbs`,`tbl`]),vA(`floz`,`volume`,`us`,29.5735,`fluid ounce`,`fluid ounces`,`fl oz`,[`fluid ounces`,`fluid ounce`,`fl. oz`,`fl oz`]),vA(`cup`,`volume`,`us`,236.588,`cup`,`cups`,`cup`,[`cups`,`cup`]),vA(`pint`,`volume`,`us`,473.176,`pint`,`pints`,`pt`,[`pints`,`pint`,`pt`]),vA(`quart`,`volume`,`us`,946.353,`quart`,`quarts`,`qt`,[`quarts`,`quart`,`qt`]),vA(`gallon`,`volume`,`us`,3785.41,`gallon`,`gallons`,`gal`,[`gallons`,`gallon`,`gal`]),vA(`oz`,`mass`,`us`,28.3495,`ounce`,`ounces`,`oz`,[`ounces`,`ounce`,`oz`]),vA(`lb`,`mass`,`us`,453.592,`pound`,`pounds`,`lb`,[`pounds`,`pound`,`lbs`,`lb`]),vA(`ml`,`volume`,`metric`,1,`ml`,`ml`,`ml`,[`millilitres`,`milliliters`,`millilitre`,`milliliter`,`ml`]),vA(`l`,`volume`,`metric`,1e3,`L`,`L`,`L`,[`litres`,`liters`,`litre`,`liter`,`l`]),vA(`g`,`mass`,`metric`,1,`g`,`g`,`g`,[`grams`,`gram`,`g`]),vA(`kg`,`mass`,`metric`,1e3,`kg`,`kg`,`kg`,[`kilograms`,`kilogram`,`kilos`,`kilo`,`kg`])],bA=Object.fromEntries(yA.map(e=>[e.id,e])),xA=yA.flatMap(e=>e.aliases.map(t=>({alias:t,unit:e}))).sort((e,t)=>t.alias.length-e.alias.length);function SA(e){let t=e.toLowerCase();for(let{alias:e,unit:n}of xA){if(!t.startsWith(e))continue;let r=t.charAt(e.length);if(/[a-z0-9]/.test(r))continue;let i=e.length+ +(r===`.`);return{unit:n,abbreviated:e!==n.singular.toLowerCase()&&e!==n.plural.toLowerCase(),length:i}}return null}var CA={us:{volume:[`tsp`,`tbsp`,`cup`],mass:[`oz`,`lb`]},metric:{volume:[`ml`,`l`],mass:[`g`,`kg`]}},wA={tbsp:1,cup:.25,lb:1,l:1,kg:1},TA=.04,EA=.1;function DA(e,t,n){let r=CA[n][t.dimension];if(t.system===n&&!r.includes(t.id))return t;let i=t.system===n?TA:EA;for(let t=r.length-1;t>0;t--){let n=bA[r[t]],a=e/n.toBase;if(!(a<wA[n.id]*(1-i))&&!(n.system===`us`&&n.dimension===`volume`&&Math.abs(kA(a)-a)/a>i))return n}return bA[r[0]]}var OA=[[0,``],[1/8,`⅛`],[1/4,`¼`],[1/3,`⅓`],[1/2,`½`],[2/3,`⅔`],[3/4,`¾`],[1,``]];function kA(e){let t=Math.floor(e),n=e-t,r=0;for(let[e]of OA)Math.abs(e-n)<Math.abs(r-n)&&(r=e);return Math.max(t+r,1/8)}function AA(e){let t=kA(e),n=Math.floor(t+1e-9),r=t-n,i=OA.find(([e])=>Math.abs(e-r)<1e-6)?.[1]??``;return n===0?i:`${n}${i}`}function jA(e,t){return t.id===`l`||t.id===`kg`?String(Math.round(e*10)/10):String(e>=20?Math.round(e/5)*5:Math.max(1,Math.round(e)))}var MA=/(\d{2,3})(?:\s*°\s*|\s*degrees?\s+|(?=[FC]\b))(Fahrenheit|Celsius|F|C)\b/g,NA=e=>e>=150?Math.round(e/5)*5:Math.round(e),PA=/^\s*(?:\/|\(|or)\s*$/;function FA(e,t){let n=[...e.matchAll(MA)].map(e=>({start:e.index,end:e.index+e[0].length,value:Number(e[1]),fahrenheit:e[2].charAt(0)===`F`,text:e[0]})),r=``,i=0;for(let a=0;a<n.length;a++){let o=n[a],s=n[a+1];if(r+=e.slice(i,o.start),s&&s.fahrenheit!==o.fahrenheit&&PA.test(e.slice(o.end,s.start))){let n=(o.fahrenheit?t===`us`:t===`metric`)?o:s;r+=n.text,i=s.end,e.slice(o.end,s.start).includes(`(`)&&e.charAt(i)===`)`&&(i+=1),a+=1}else o.fahrenheit&&t===`metric`?r+=`${NA((o.value-32)*5/9)}°C`:!o.fahrenheit&&t===`us`?r+=`${NA(o.value*9/5+32)}°F`:r+=o.text,i=o.end}return r+e.slice(i)}function IA(e){let t=new RegExp(MA.source).exec(e);return t?t[2].charAt(0)===`F`?`us`:`metric`:null}var LA={"½":1/2,"⅓":1/3,"⅔":2/3,"¼":1/4,"¾":3/4,"⅛":1/8,"⅜":3/8,"⅝":5/8,"⅞":7/8,"⅕":1/5,"⅖":2/5,"⅗":3/5,"⅘":4/5,"⅙":1/6,"⅚":5/6},RA=`[${Object.keys(LA).join(``)}]`,zA=String.raw`(?:\d+\s+\d+\/\d+|\d+\s*${RA}|\d+\/\d+|\d*\.\d+|\d+|${RA})`,BA=new RegExp(String.raw`^\s*(${zA})(?:\s*(?:-|–|to)\s*(${zA}))?`);function VA(e){let t=e.trim(),n=/^(\d+)\s+(\d+)\/(\d+)$/.exec(t);if(n)return Number(n[1])+Number(n[2])/Number(n[3]);let r=new RegExp(String.raw`^(\d*)\s*(${RA})$`).exec(t);if(r)return Number(r[1]||0)+LA[r[2]];let i=/^(\d+)\/(\d+)$/.exec(t);return i?Number(i[1])/Number(i[2]):Number(t)}var HA=/^([^()]+?)\s*\(([^()]+)\)\s*$/;function UA(e){return/^[A-Z][a-z]/.test(e)?e.charAt(0).toLowerCase()+e.slice(1):e}function WA(e){let t=BA.exec(e);if(!t){let t=HA.exec(e),n=t?WA(t[2]):null;return!t||!n||n.rest?null:{...n,rest:UA(t[1].trim())}}let n=VA(t[1]),r=t[2]?VA(t[2]):null;if(!(n>0)||r!==null&&!(r>n))return null;let i=t[0].length,a=e.slice(i),o=/^\s*/.exec(a)[0].length,s=SA(a.slice(o));return s&&(i+=o+s.length),{amount:{low:n,high:r},unit:s?.unit??null,abbreviated:s?.abbreviated??!1,lead:e.slice(0,i).trim(),rest:e.slice(i).trim()}}var GA=/\b(whole|chickens?|turkeys?|ducks?|eggs?|cans?|tins?|jars?|bottles?|loa(?:f|ves)|packages?|packets?|bags?|boxes|box)\b/i,KA=[[`egg`,`eggs`],[`clove`,`cloves`],[`can`,`cans`],[`tin`,`tins`],[`jar`,`jars`],[`onion`,`onions`],[`lemon`,`lemons`],[`lime`,`limes`],[`potato`,`potatoes`],[`tomato`,`tomatoes`],[`carrot`,`carrots`],[`shallot`,`shallots`],[`apple`,`apples`],[`banana`,`bananas`],[`avocado`,`avocados`],[`breast`,`breasts`],[`thigh`,`thighs`],[`fillet`,`fillets`],[`slice`,`slices`],[`sprig`,`sprigs`],[`stalk`,`stalks`],[`stick`,`sticks`],[`loaf`,`loaves`],[`package`,`packages`],[`packet`,`packets`],[`head`,`heads`],[`bunch`,`bunches`],[`leaf`,`leaves`],[`tortilla`,`tortillas`],[`pepper`,`peppers`],[`chicken`,`chickens`],[`cucumber`,`cucumbers`],[`yolk`,`yolks`],[`white`,`whites`],[`bag`,`bags`]];function qA(e,t){let n=e.split(/(\s+)/),r=!1;for(let e=0;e<n.length&&e<12;e+=2){let i=n[e];if(i.startsWith(`(`)&&(r=!0),r){i.includes(`)`)&&(r=!1);continue}if(/^of$/i.test(i))break;let a=i.replace(/[,.;:]+$/,``),o=KA.find(([e,t])=>a.toLowerCase()===e||a.toLowerCase()===t);if(o){let r=t?o[1]:o[0],s=/^[A-Z]/.test(a)?r.charAt(0).toUpperCase()+r.slice(1):r;return n[e]=s+i.slice(a.length),n.join(``)}if(a!==i)break}return e}function JA(e,t){return t?Math.max(1,Math.round(e)):Math.max(.5,Math.round(e*2)/2)}function YA(e,t,n){let r=e=>n?.system===`metric`?jA(e,n):AA(e),i=r(e);if(t===null)return i;let a=r(t);return a===i?i:`${i}–${a}`}function XA(e,t,n){return e.system===`metric`||t?e.short:n?e.plural:e.singular}function ZA(e,t,n,r){if(!t)return{qty:null,text:e};let{amount:i,unit:a}=t,o=a!==null&&a.system!==r;if(n===1&&!o)return{qty:t.lead,text:t.rest};if(!a){let e=GA.test(t.rest),r=JA(i.low*n,e),a=i.high===null?null:JA(i.high*n,e),o=(a??r)>1;return{qty:YA(r,a,null),text:qA(t.rest,o)}}let s=i.low*n*a.toBase,c=i.high===null?null:i.high*n*a.toBase,l=DA(s,a,r),u=s/l.toBase,d=c===null?null:c/l.toBase,f=d??u,p=(l.system===`us`?kA(f):f)>1,m=!o&&t.abbreviated;return{qty:`${YA(u,d,l)} ${XA(l,m,p)}`,text:t.rest}}var QA=[[/^h/i,3600],[/^m/i,60],[/^s/i,1]],$A=String.raw`(?:hours?|hrs?|minutes?|mins?|seconds?|secs?)\b`,ej=new RegExp(String.raw`(?:(${zA})(?:\s*(?:-|–|to)\s*(?:${zA}))?|\b(an?))[\s-]*(${$A})`,`gi`),tj=/^\s*(?:,\s*)?(?:and\s+)?$/i;function nj(e){return QA.find(([t])=>t.test(e))[1]}function rj(e){let t=[];for(let n of e.matchAll(ej)){let e=n[1]?VA(n[1]):1,r=nj(n[3]);e>0&&(!n[2]||/^(?:hour|minute)$/i.test(n[3]))&&t.push({start:n.index,end:n.index+n[0].length,seconds:Math.round(e*r),unit:r})}let n=[];for(let r of t){let t=n[n.length-1];t&&r.unit<t.unit&&tj.test(e.slice(t.end,r.start))?(t.end=r.end,t.seconds+=r.seconds,t.unit=r.unit):n.push({...r})}return n.map(({start:e,end:t,seconds:n})=>({start:e,end:t,seconds:n}))}function ij(e){let t=Math.max(0,Math.ceil(e)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n>0?`${n}:${String(r).padStart(2,`0`)}:${i}`:`${r}:${i}`}var aj=6,oj=/^day\s+\d+\b/i,sj=/^(day\s+\d+)\s+[-–—]\s+([\s\S]+)$/i;function cj(e,t=!1){let n=e.trim(),r=/^([^:\n]{1,80}):\s+([\s\S]+)$/.exec(n);if(r){let e=r[1].trim();if(e.split(/\s+/).length<=aj&&!/\d$/.test(e)||t&&oj.test(e))return{title:e,body:r[2].trim()}}let i=t?sj.exec(n):null;return i?{title:i[1],body:i[2].trim()}:{title:null,body:n}}function lj(e){let t=/(\d+)\s*(?:sets?\s*(?:of|x|×)\s*|[x×]\s*)(\d+)/i.exec(e),n=/(\d+)\s*sets?\b/i.exec(e),r=null,i=null;return rj(e).forEach((t,n)=>{let a=e.slice(Math.max(0,t.start-16),t.start);i===null&&/\brest(?:\s+for)?\s*$/i.test(a)?i=n:r===null&&/\bhold(?:\s+(?:it|for))*\s*$/i.test(a)&&(r=n)}),{sets:t?Number(t[1]):n?Number(n[1]):null,reps:t?Number(t[2]):null,holdIndex:r,restIndex:i}}var uj={recipe:{itemsLabel:`cards.ingredients`,stepsLabel:`cards.stepsHeading`,scaling:!0,units:!0,timers:!0,checkItems:!1,startLabel:`cards.startCooking`,timeline:!1,tip:`cards.tip.recipe`},workout:{itemsLabel:`cards.equipment`,stepsLabel:`cards.exercises`,scaling:!1,units:!1,timers:!0,checkItems:!0,startLabel:`cards.startWorkout`,timeline:!1,tip:`cards.tip.workout`},howto:{itemsLabel:`cards.materials`,stepsLabel:`cards.stepsHeading`,scaling:!1,units:!0,timers:!0,checkItems:!0,startLabel:`cards.start`,timeline:!1,tip:`cards.tip.howto`},checklist:{itemsLabel:`cards.items`,stepsLabel:null,scaling:!1,units:!1,timers:!1,checkItems:!0,startLabel:null,timeline:!1,tip:null},itinerary:{itemsLabel:`cards.packing`,stepsLabel:`cards.daysHeading`,scaling:!1,units:!1,timers:!1,checkItems:!0,startLabel:null,timeline:!0,tip:null}},dj=e=>typeof e==`string`,fj=e=>e==null||dj(e),pj=e=>Array.isArray(e)&&e.every(dj);function mj(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.kind!==`guide`||!dj(t.title)||!t.title.trim()||!(dj(t.guideType)&&t.guideType in uj)||!fj(t.description)||!fj(t.notes)||!pj(t.items)||!pj(t.steps)?!1:t.guideType===`recipe`?typeof t.servings==`number`&&Number.isInteger(t.servings)&&t.servings>=1:t.servings===null||t.servings===void 0}function hj(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(36)}var gj=/^(?:step\s+\d+\s*[:.)-]|\d+[.)]|[-*•])\s+/i;function _j(e){let t=uj[e.guideType],n=e=>e.map(e=>e.trim().replace(gj,``)).filter(Boolean),r=n(e.items).map(e=>({raw:e,parsed:t.units||t.scaling?WA(e):null})),i=n(e.steps).map(e=>cj(e,t.timeline)),a=[];if(t.units){for(let e of r)e.parsed?.unit&&a.push(e.parsed.unit.system);for(let e of i){let t=IA(e.body);t&&a.push(t)}}let o=a.filter(e=>e===`metric`).length;return{type:e.guideType,features:t,title:e.title.trim(),description:(e.description??``).trim(),notes:(e.notes??``).trim(),baseServings:t.scaling?e.servings:null,items:r,steps:i,nativeSystem:o>a.length-o?`metric`:`us`,convertible:a.length>0,key:hj(JSON.stringify(e))}}function vj(e,t){return!e.baseServings||!t?1:t/e.baseServings}function yj(e,t,n){let r=e.items[t];return ZA(r.raw,r.parsed,vj(e,n.servings),n.system)}function bj(e,t,n){return e.features.units?FA(t,n):t}function xj(e,t){return e.plural(`cards.servingCount`,t)}function Sj(e,t,n){return e.steps[t].title??(e.features.timeline?n(t+1):null)}function Cj(e,t,n){let r=[e.title];return e.description&&r.push(e.description),e.baseServings&&t.servings&&r.push(n.bare(`cards.makes`,{servings:n.bare(Xn(`cards.servingCount`,t.servings),{n:t.servings})})),e.items.length&&(r.push(``,n.bare(e.features.itemsLabel)),e.items.forEach((n,i)=>{let{qty:a,text:o}=yj(e,i,t),s=a?`${a} ${o}`.trim():o,c=e.features.checkItems?t.checked.has(i)?`[x] `:`[ ] `:`- `;r.push(`${c}${s}`)})),e.steps.length&&e.features.stepsLabel&&(r.push(``,n.bare(e.features.stepsLabel)),e.steps.forEach((i,a)=>{let o=bj(e,i.body,t.system),s=Sj(e,a,e=>n.bare(`cards.dayN`,{n:e})),c=s?`${s}: ${o}`:o;r.push(e.features.timeline?c:`${a+1}. ${c}`)})),e.notes&&r.push(``,n.bare(`cards.notes`),bj(e,e.notes,t.system)),r.join(`
169
+ `)}async function wj(e){if(!navigator.clipboard?.writeText)throw Error(`Clipboard is not available here`);await navigator.clipboard.writeText(e)}function Tj(){return typeof navigator<`u`&&typeof navigator.share==`function`}async function Ej(e,t){try{return await navigator.share({title:e,text:t}),!0}catch(e){if(e instanceof DOMException&&e.name===`AbortError`)return!1;throw e}}function Dj(e){return e.replace(/[&<>"']/g,e=>`&#${e.charCodeAt(0)};`)}function Oj(e,t){let n=document.createElement(`iframe`);n.setAttribute(`aria-hidden`,`true`),n.tabIndex=-1,n.style.position=`fixed`,n.style.width=`0`,n.style.height=`0`,n.style.border=`0`,document.body.appendChild(n);let r=n.contentWindow;if(!r)throw n.remove(),Error(`Could not open a print frame`);r.document.open(),r.document.write(`<!doctype html><html><head><meta charset="utf-8"><title>${Dj(e)}</title><style>body{font:14px/1.6 system-ui,sans-serif;margin:32px;}pre{white-space:pre-wrap;font:inherit;}</style></head><body><pre>${Dj(t)}</pre></body></html>`),r.document.close();let i=()=>n.remove();r.addEventListener(`afterprint`,i,{once:!0}),r.focus(),r.print(),setTimeout(i,6e4)}function kj(e,t){return`${e}:${t}`}function Aj({id:e,seconds:t,timers:n,label:r}){let i=R(),a=n.read(e,t),o=a.status===`running`?`cards.timerPause`:a.status===`paused`?`cards.timerResume`:`cards.timerStart`,s=a.status===`running`?mo:a.status===`done`?Vr:wo;return z(`button`,{type:`button`,className:`render-guide-chip is-${a.status}`,onClick:()=>n.toggle(e,t),"aria-label":i(o,{label:r}),children:[I(s,{size:11,"aria-hidden":`true`}),I(`span`,{className:`render-guide-chip__clock`,children:a.status===`done`?i(`cards.done`):ij(a.remainingSeconds)})]})}function jj({text:e,stepIndex:t,timers:n,withTimers:r}){if(!r)return I(P.Fragment,{children:e});let i=rj(e),a=0;return z(P.Fragment,{children:[i.map((r,i)=>{let o=/^[.,;:!?]+/.exec(e.slice(r.end))?.[0]??``,s=e.slice(a,r.end+o.length),c=e.slice(r.start,r.end);return a=r.end+o.length,z(V.Fragment,{children:[s,` `,I(Aj,{id:kj(t,i),seconds:r.seconds,timers:n,label:c})]},i)}),e.slice(a)]})}var Mj=rr();function Nj(){let[e,t]=(0,V.useState)(!0);return(0,V.useEffect)(()=>{if(!(`wakeLock`in navigator)){t(!1);return}let e=null,n=!0,r=()=>{document.visibilityState===`visible`&&navigator.wakeLock.request(`screen`).then(r=>{n?(e=r,t(!0)):r.release()},()=>{n&&t(!1)})};return r(),document.addEventListener(`visibilitychange`,r),()=>{n=!1,document.removeEventListener(`visibilitychange`,r),e?.release()}},[]),e}function Pj({doc:e,state:t,timers:n,onClose:r}){let i=R(),[a,o]=(0,V.useState)(0),[s,c]=(0,V.useState)({}),l=(0,V.useRef)(null),u=Nj(),d=e.steps.length,f=a===d-1;pt(!0,r),on(l,!0),(0,V.useEffect)(()=>{let e=document.activeElement;return l.current?.focus(),()=>e?.focus()},[]),(0,V.useEffect)(()=>{let e=e=>{if(!(e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey)&&!(e.target instanceof HTMLElement&&e.target.closest(`input, textarea, select`))){if(e.key===`ArrowRight`)o(e=>Math.min(d-1,e+1));else if(e.key===`ArrowLeft`)o(e=>Math.max(0,e-1));else return;e.preventDefault()}};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[d]);let p=e.steps[a],m=bj(e,p.body,t.system),h=e.features.timers?rj(m):[],g=e.type===`workout`?lj(m):null,_=s[a]??0,v=g?.restIndex??null,y=v!==null&&n.read(kj(a,v),h[v].seconds).status!==`idle`?v:h.findIndex((e,t)=>t!==v),b=y===-1?h.length?0:null:y,x=b===null?null:{id:kj(a,b),seconds:h[b].seconds},S=x?n.read(x.id,x.seconds):null;return(0,Mj.createPortal)(z(`div`,{ref:l,className:`render-guided`,role:`dialog`,"aria-modal":`true`,"aria-label":e.title,tabIndex:-1,children:[z(`div`,{className:`render-guided__top`,children:[z(`div`,{className:`render-guided__heading`,children:[I(`span`,{className:`render-guided__guide-title`,children:e.title}),e.items.length>0&&z(`details`,{className:`render-guided__items`,children:[I(`summary`,{children:i(e.features.itemsLabel)}),I(`ul`,{children:e.items.map((n,r)=>{let{qty:i,text:a}=yj(e,r,t);return z(`li`,{children:[i&&I(`strong`,{children:i}),` `,a]},r)})})]})]}),I(`button`,{type:`button`,className:`render-guided__icon`,onClick:r,"aria-label":i(`cards.closeGuided`),children:I(Is,{size:22})})]}),z(`div`,{className:`render-guided__stage`,children:[I(`h2`,{className:`render-guided__step-title`,children:p.title??i(`cards.stepTitle`,{n:a+1})}),I(`p`,{className:`render-guided__step-text`,children:I(jj,{text:m,stepIndex:a,timers:n,withTimers:e.features.timers})}),g?.sets&&z(`div`,{className:`render-guided__sets`,children:[I(`span`,{children:i(_>=g.sets?`cards.setAllDone`:`cards.setProgress`,{n:Math.min(_+1,g.sets),total:g.sets})}),I(`button`,{type:`button`,className:`render-guided__button`,onClick:()=>{if(g?.sets&&(c(e=>({...e,[a]:Math.min(g.sets,_+1)})),v!==null&&_+1<g.sets)){let e=kj(a,v);n.reset(e),n.toggle(e,h[v].seconds)}},disabled:_>=g.sets,children:i(`cards.setDone`)})]}),x&&S&&z(`div`,{className:`render-guided__timer is-${S.status}`,children:[I(`span`,{className:`render-guided__clock`,role:`timer`,children:S.status===`done`?i(`cards.done`):ij(S.remainingSeconds)}),z(`div`,{className:`render-guided__timer-actions`,children:[z(`button`,{type:`button`,className:`render-guided__button is-primary`,onClick:()=>n.toggle(x.id,x.seconds),children:[S.status===`running`?I(mo,{size:16}):I(wo,{size:16}),i(S.status===`running`?`cards.pause`:S.status===`paused`?`cards.resume`:`cards.start`)]}),S.status!==`idle`&&z(`button`,{type:`button`,className:`render-guided__button`,onClick:()=>n.reset(x.id),children:[I(vs,{size:14}),` `,i(`cards.stop`)]})]})]})]}),z(`div`,{className:`render-guided__nav`,children:[I(`button`,{type:`button`,className:`render-guided__icon`,onClick:()=>o(e=>Math.max(0,e-1)),disabled:a===0,"aria-label":i(`cards.prevStep`),children:I(qr,{size:26})}),z(`div`,{className:`render-guided__progress`,children:[I(`span`,{"aria-live":`polite`,children:i(`cards.stepOf`,{n:a+1,total:d})}),!u&&I(`span`,{className:`render-guided__note`,children:i(`cards.screenMaySleep`)})]}),f?I(`button`,{type:`button`,className:`render-guided__button is-primary`,onClick:r,children:i(`cards.finish`)}):I(`button`,{type:`button`,className:`render-guided__icon`,onClick:()=>o(e=>Math.min(d-1,e+1)),"aria-label":i(`cards.nextStep`),children:I(Yr,{size:26})})]})]}),document.body)}var Fj=250,Ij=null;function Lj(){Ij||typeof window>`u`||typeof window.AudioContext!=`function`||(Ij=new window.AudioContext)}function Rj(){if(!Ij)return;let e=Ij.currentTime;[0,.35,.7].forEach(t=>{let n=Ij.createOscillator(),r=Ij.createGain();n.frequency.value=880,r.gain.setValueAtTime(1e-4,e+t),r.gain.exponentialRampToValueAtTime(.25,e+t+.02),r.gain.exponentialRampToValueAtTime(1e-4,e+t+.3),n.connect(r).connect(Ij.destination),n.start(e+t),n.stop(e+t+.32)})}function zj(){let[e,t]=(0,V.useState)({}),[n,r]=(0,V.useState)(()=>Date.now()),i=(0,V.useRef)(e);(0,V.useEffect)(()=>{i.current=e},[e]);let a=Object.values(e).some(e=>e.status===`running`);(0,V.useEffect)(()=>{if(!a)return;let e=setInterval(()=>{let e=Date.now();r(e);let n=Object.entries(i.current).filter(([,t])=>t.status===`running`&&t.endsAt!==null&&t.endsAt<=e);n.length&&(t(e=>{let t={...e};for(let[e]of n)t[e]={...t[e],status:`done`,endsAt:null,leftMs:0};return t}),Rj())},Fj);return()=>clearInterval(e)},[a]);let o=(0,V.useCallback)((e,n)=>{Lj();let i=Date.now();r(i),t(t=>{let r=t[e],a=n*1e3;return!r||r.status===`idle`||r.status===`done`?{...t,[e]:{status:`running`,totalMs:a,endsAt:i+a,leftMs:a}}:r.status===`running`?{...t,[e]:{...r,status:`paused`,endsAt:null,leftMs:Math.max(0,r.endsAt-i)}}:{...t,[e]:{...r,status:`running`,endsAt:i+r.leftMs}}})},[]),s=(0,V.useCallback)(e=>{t(t=>{if(!t[e])return t;let n={...t};return delete n[e],n})},[]),c=(0,V.useCallback)((t,r)=>{let i=e[t];if(!i)return{status:`idle`,remainingSeconds:r};let a=i.status===`running`&&i.endsAt!==null?Math.max(0,i.endsAt-n):i.leftMs;return{status:i.status,remainingSeconds:a/1e3}},[e,n]);return(0,V.useMemo)(()=>({read:c,toggle:o,reset:s}),[c,o,s])}var Bj=`gaia:guide-tip-dismissed`,Vj=`gaia:guide-tip-dismissed`;function Hj(){try{return localStorage.getItem(Bj)===`1`}catch(e){return console.warn(`[guide] could not read whether the card tip was dismissed; showing it`,e),!1}}function Uj(e){return window.addEventListener(Vj,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(Vj,e),window.removeEventListener(`storage`,e)}}function Wj(){if(!Hj()){try{localStorage.setItem(Bj,`1`)}catch(e){console.warn(`[guide] could not save that the card tip was dismissed; it may show again`,e)}window.dispatchEvent(new Event(Vj))}}function Gj(){return(0,V.useSyncExternalStore)(Uj,Hj,()=>!0)}var Kj=99,qj=2500,Jj=e=>`gaia:guide:${e.key}`;function Yj(e){try{let t=localStorage.getItem(Jj(e)),n=t?JSON.parse(t):[];return new Set(Array.isArray(n)?n.filter(e=>Number.isInteger(e)):[])}catch(t){return console.warn(`[guide] could not read saved checks for "${e.title}"; starting unchecked`,t),new Set}}function Xj(e,t){try{t.size?localStorage.setItem(Jj(e),JSON.stringify([...t])):localStorage.removeItem(Jj(e))}catch(t){console.warn(`[guide] could not save checks for "${e.title}"; they hold until the chat closes`,t)}}function Zj({data:e}){return mj(e)?I(Qj,{wire:e}):I(sk,{variant:`invalid`,render:`guide`,data:e})}function Qj({wire:e}){let t=R(),n=(0,V.useMemo)(()=>_j(e),[e]),[r,i]=(0,V.useState)(n.baseServings),[a,o]=(0,V.useState)(n.nativeSystem),[s,c]=(0,V.useState)(()=>Yj(n)),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(null),p=zj(),m=Gj(),h={servings:r,system:a,checked:s},{features:g}=n,_=t(`cards.copied`);(0,V.useEffect)(()=>{if(!d)return;let e=setTimeout(()=>f(null),qj);return()=>clearTimeout(e)},[d]);let v=e=>{let t=new Set(s);t.has(e)?t.delete(e):t.add(e),c(t),Xj(n,t)},y=e=>n=>f(t(e,{error:n instanceof Error?n.message:String(n)})),b=()=>{wj(Cj(n,h,t)).then(()=>f(_),y(`cards.copyFailed`))},x=()=>{Ej(n.title,Cj(n,h,t)).catch(y(`cards.shareFailed`))},S=()=>{try{Oj(n.title,Cj(n,h,t))}catch(e){y(`cards.printFailed`)(e)}},C=a===`us`?`metric`:`us`,w=e=>t.bare(e===`us`?`cards.system.us`:`cards.system.metric`),T=g.units&&n.convertible;return z(`article`,{className:`render-guide`,"aria-label":n.title,children:[z(`header`,{className:`render-guide__header`,children:[I(`h3`,{className:`render-guide__title`,children:n.title}),n.description&&I(`p`,{className:`render-guide__description`,children:n.description})]}),z(`div`,{className:`render-guide__toolbar`,children:[g.scaling&&r!==null&&z(`div`,{className:`render-guide__servings`,role:`group`,"aria-label":t(`cards.servings`),children:[I(`button`,{type:`button`,className:`render-guide__icon`,onClick:()=>{Wj(),i(e=>Math.max(1,(e??1)-1))},disabled:r<=1,"aria-label":t(`cards.fewerServings`),children:I(Ya,{size:14})}),I(`output`,{className:`render-guide__servings-count`,"aria-live":`polite`,children:xj(t,r)}),I(`button`,{type:`button`,className:`render-guide__icon`,onClick:()=>{Wj(),i(e=>Math.min(Kj,(e??1)+1))},disabled:r>=Kj,"aria-label":t(`cards.moreServings`),children:I(Oo,{size:14})})]}),z(`div`,{className:`render-guide__tools`,children:[T&&z(`button`,{type:`button`,className:`render-guide__tool`,onClick:()=>{Wj(),o(C)},"aria-label":t(`cards.unitsSwitch`,{current:w(a),other:w(C)}),title:t(`cards.unitsTitle`,{other:w(C)}),children:[I(Ho,{size:15}),I(`span`,{children:w(a)})]}),Tj()&&I(`button`,{type:`button`,className:`render-guide__icon`,onClick:x,"aria-label":t(`cards.share`),title:t(`cards.share`),children:I(Qo,{size:15})}),I(`button`,{type:`button`,className:`render-guide__icon`,onClick:S,"aria-label":t(`cards.print`),title:t(`cards.print`),children:I(Ao,{size:15})}),I(`button`,{type:`button`,className:`render-guide__icon`,onClick:b,"aria-label":t(`cards.copy`),title:t(`cards.copy`),children:I(d===_?Vr:hi,{size:15})})]}),g.startLabel&&n.steps.length>0&&z(`button`,{type:`button`,className:`render-guide__start`,onClick:()=>{Wj(),u(!0)},children:[I(wo,{size:14}),t(g.startLabel)]})]}),I(`p`,{className:`render-guide__notice`,role:`status`,children:d}),n.items.length>0&&z(`section`,{className:`render-guide__section`,children:[I(`h4`,{className:`render-guide__label`,children:t(g.itemsLabel)}),I(`ul`,{className:`render-guide__items`,children:n.items.map((e,t)=>{let{qty:r,text:i}=yj(n,t,h),o=z(P.Fragment,{children:[r&&I(`span`,{className:`render-guide__qty`,children:r}),r&&` `,bj(n,i,a)]});return I(`li`,{className:`render-guide__item${s.has(t)?` is-checked`:``}`,children:g.checkItems?z(`label`,{className:`render-guide__check`,children:[I(`input`,{type:`checkbox`,checked:s.has(t),onChange:()=>v(t)}),I(`span`,{children:o})]}):o},t)})})]}),n.steps.length>0&&g.stepsLabel&&z(`section`,{className:`render-guide__section`,children:[I(`h4`,{className:`render-guide__label`,children:t(g.stepsLabel)}),I(`ol`,{className:`render-guide__steps${g.timeline?` is-timeline`:``}`,children:n.steps.map((e,r)=>{let i=Sj(n,r,e=>t(`cards.dayN`,{n:e}));return z(`li`,{className:`render-guide__step`,children:[g.timeline?I(`span`,{className:`render-guide__step-dot`,"aria-hidden":`true`}):I(`span`,{className:`render-guide__step-number`,"aria-hidden":`true`,children:r+1}),z(`div`,{className:`render-guide__step-body`,children:[i&&I(`span`,{className:`render-guide__step-title`,children:i}),I(`span`,{children:I(jj,{text:bj(n,e.body,a),stepIndex:r,timers:p,withTimers:g.timers})})]})]},r)})})]}),n.notes&&z(`aside`,{className:`render-guide__notes`,children:[I(`h4`,{className:`render-guide__label`,children:t(`cards.notes`)}),I(`p`,{children:bj(n,n.notes,a)})]}),g.tip&&!m&&z(`div`,{className:`render-guide__tip`,role:`note`,children:[I(ka,{size:15,"aria-hidden":`true`}),I(`span`,{children:t(g.tip)}),I(`button`,{type:`button`,className:`render-guide__icon`,onClick:Wj,"aria-label":t(`cards.dismissTip`),children:I(Is,{size:14})})]}),l&&I(Pj,{doc:n,state:h,timers:p,onClose:()=>u(!1)})]})}function $j({bill:e,tipPercent:t,people:n}){let r=e*t/100,i=e+r;return{tip:r,total:i,perPerson:i/n}}function eM({amount:e,annualRatePercent:t,years:n,downPayment:r}){let i=Math.max(0,e-r),a=Math.round(n*12),o=t/100/12,s=a===0?0:o===0?i/a:i*o/(1-(1+o)**-a),c=s*a;return{principal:i,monthly:s,totalPaid:c,interest:c-i}}var tM={tip:{defaultTitle:`cards.calc.tipTitle`,fields:{bill:{label:`cards.calc.bill`,min:0,max:1e9,step:.01,format:`currency`,sliderMax:500},tipPercent:{label:`cards.calc.tip`,min:0,max:100,step:1,format:`percent`,sliderMax:40},people:{label:`cards.calc.people`,min:1,max:50,step:1,format:`count`,sliderMax:20,integer:!0}},validWire:e=>e.bill>0&&e.people>=1,results:e=>{let{tip:t,total:n,perPerson:r}=$j(e),i=e.people>1;return[{label:`cards.calc.tip`,value:t,format:`currency`},{label:`cards.calc.total`,value:n,format:`currency`,primary:!i},...i?[{label:`cards.calc.perPerson`,value:r,format:`currency`,primary:!0}]:[]]}},loan:{defaultTitle:`cards.calc.loanTitle`,fields:{amount:{label:`cards.calc.price`,min:0,max:1e10,step:1e3,format:`currency`,sliderMax:1e6},downPayment:{label:`cards.calc.downPayment`,min:0,max:1e10,step:1e3,format:`currency`,sliderMax:3e5},annualRatePercent:{label:`cards.calc.rate`,min:0,max:50,step:.05,format:`percent`,sliderMax:15},years:{label:`cards.calc.term`,min:1,max:50,step:1,format:`years`}},validWire:e=>e.amount>0&&e.years>=1&&e.downPayment<e.amount,results:e=>{let{principal:t,monthly:n,totalPaid:r,interest:i}=eM(e);return[{label:`cards.calc.monthly`,value:n,format:`currency`,primary:!0},{label:`cards.calc.loanAmount`,value:t,format:`currency`},{label:`cards.calc.totalPaid`,value:r,format:`currency`},{label:`cards.calc.totalInterest`,value:i,format:`currency`}]}}};function nM(e){return tM[e]}function rM(e){if(!e||typeof e!=`object`)return!1;let t=e;if(t.kind!==`calculator`||t.calculator!==`tip`&&t.calculator!==`loan`||t.title!==void 0&&t.title!==null&&typeof t.title!=`string`||typeof t.currency!=`string`||!iM(t.currency)||!t.inputs||typeof t.inputs!=`object`)return!1;let n=t.inputs,r=nM(t.calculator);for(let[e,t]of Object.entries(r.fields)){let r=n[e];if(typeof r!=`number`||!Number.isFinite(r)||r<0||r>t.max||t.integer&&!Number.isInteger(r))return!1}return r.validWire(n)}function iM(e){if(!/^[A-Z]{3}$/.test(e))return!1;try{return new Intl.NumberFormat(`en`,{style:`currency`,currency:e}),!0}catch{return!1}}function aM(){return typeof navigator<`u`&&navigator.language||`en-US`}function oM(e,t,{locale:n,currency:r},i=gt){switch(t){case`currency`:return new Intl.NumberFormat(n,{style:`currency`,currency:r}).format(e);case`percent`:return new Intl.NumberFormat(n,{style:`percent`,maximumFractionDigits:2}).format(e/100);case`years`:{let t=new Intl.NumberFormat(n,{maximumFractionDigits:2}).format(e);return i.bare(Xn(`cards.years`,e),{n:t})}case`count`:return new Intl.NumberFormat(n).format(e)}}function sM({locale:e,currency:t}){return new Intl.NumberFormat(e,{style:`currency`,currency:t}).formatToParts(0).find(e=>e.type===`currency`)?.value??``}function cM(e,t,n,r,i=gt){let a=[e];for(let[e,o]of Object.entries(t.fields))a.push(`${i.bare(o.label)}: ${oM(n[e],o.format,r,i)}`);a.push(``);for(let e of t.results(n))a.push(`${i.bare(e.label)}: ${oM(e.value,e.format,r,i)}`);return a.join(`
170
+ `)}var lM=2500;function uM({data:e}){return rM(e)?I(dM,{wire:e}):I(sk,{variant:`invalid`,render:`calculator`,data:e})}function dM({wire:e}){let t=R(),n=nM(e.calculator),r=(0,V.useMemo)(()=>({locale:aM(),currency:e.currency}),[e.currency]),[i,a]=(0,V.useState)(()=>({...e.inputs})),[o,s]=(0,V.useState)(null),c=e.title?.trim()||t(n.defaultTitle),l=n.results(i),u=t(`cards.copied`);return(0,V.useEffect)(()=>{if(!o)return;let e=setTimeout(()=>s(null),lM);return()=>clearTimeout(e)},[o]),z(`article`,{className:`render-guide render-calc`,"aria-label":c,children:[z(`header`,{className:`render-calc__header`,children:[I(`h3`,{className:`render-guide__title`,children:c}),I(`button`,{type:`button`,className:`render-guide__icon`,onClick:()=>{wj(cM(c,n,i,r,t)).then(()=>s(u),e=>s(t(`cards.copyFailed`,{error:e instanceof Error?e.message:String(e)})))},"aria-label":t(`cards.copy`),title:t(`cards.copy`),children:I(o===u?Vr:hi,{size:15})})]}),I(`p`,{className:`render-guide__notice`,role:`status`,children:o}),I(`div`,{className:`render-calc__fields`,children:Object.entries(n.fields).map(([e,t])=>I(fM,{field:t,value:i[e],money:r,onChange:t=>a(n=>({...n,[e]:t}))},e))}),I(`dl`,{className:`render-calc__results`,"aria-live":`polite`,children:l.map(e=>z(`div`,{className:`render-calc__result${e.primary?` is-primary`:``}`,children:[I(`dt`,{children:t(e.label)}),I(`dd`,{children:oM(e.value,e.format,r,t)})]},e.label))})]})}function fM({field:e,value:t,money:n,onChange:r}){let i=R(),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(!1),l=Math.min(e.max,Math.max(e.sliderMax??e.max,t)),u=e.format===`currency`?sM(n):``,d=e.format===`percent`?`%`:e.format===`years`?i.bare(`cards.yearsShort`):``,f=i(e.label),p=t=>{o(t);let n=Number(t);t.trim()===``||!Number.isFinite(n)||n<e.min||n>e.max||(!e.integer||Number.isInteger(n))&&r(n)};return z(`div`,{className:`render-calc__field`,children:[z(`label`,{className:`render-calc__label`,children:[I(`span`,{children:f}),z(`span`,{className:`render-calc__box`,children:[u&&I(`span`,{className:`render-calc__affix`,children:u}),I(`input`,{type:s?`number`:`text`,inputMode:`decimal`,min:e.min,max:e.max,step:e.step,value:a??(s?String(t):new Intl.NumberFormat(n.locale,{maximumFractionDigits:10}).format(t)),"aria-label":f,onChange:e=>p(e.target.value),onFocus:()=>c(!0),onBlur:()=>{c(!1),o(null)}}),d&&I(`span`,{className:`render-calc__affix`,children:d})]})]}),I(`input`,{type:`range`,className:`render-calc__slider`,min:e.min,max:l,step:e.step,value:t,"aria-label":i(`cards.slider`,{name:f}),"aria-valuetext":oM(t,e.format,n,i),onChange:e=>{o(null),r(Number(e.target.value))}})]})}var pM={table:pk,key_value:hk,list:_k,image:Sk,audio:Tk,diff:jk,needs_confirmation:Pk,needs_input:nA,connect_account:_A,guide:Zj,calculator:uM},mM=class extends V.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?I(`div`,{role:`alert`,className:`render-card-error`,children:`Card failed to render`}):this.props.children}};function hM({render:e,data:t}){let n=pM[e];return I(`div`,{className:`render-card`,children:n?I(mM,{children:I(n,{data:t})}):I(sk,{variant:`unknown`,render:e,data:t})})}var gM=/(^|\n)[ \t]*```[^\n]*\n([\s\S]*?)(?:(?:(?<=\n)|\n)[ \t]*```[ \t]*(?=\n|$)|$)/g;function _M(e){let t=[];return e.replace(/`([^`\n]+)`/g,(e,n)=>`\u0000${t.push(n)-1}\u0000`).replace(/\\([\\`*_{}[\]()#+\-.!|~>])/g,(e,n)=>`\u0000${t.push(n)-1}\u0000`).replace(/!\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/\[([^\]]+)\]\(([^)]*)\)/g,(e,t,n)=>t===n||!n?t:`${t} (${n})`).replace(/^[ \t]*([-*_][ \t]*){3,}$/gm,``).replace(/^[ \t]{0,3}#{1,6}[ \t]+/gm,``).replace(/^([ \t]*)>[ \t]?/gm,`$1`).replace(/^([ \t]*)[-*+][ \t]+/gm,`$1• `).replace(/^[ \t]*\|?[ \t:|-]+\|[ \t:|-]*\n?/gm,``).replace(/^[ \t]*\|(.*?)\|?[ \t]*$/gm,(e,t)=>t.split(`|`).map(e=>e.trim()).join(` `)).replace(/(\*\*|\*|~~)(\S(?:[^\n]*?\S)?)\1/g,`$2`).replace(/(?<!\w)(__|_)(\S(?:[^\n]*?\S)?)\1(?!\w)/g,`$2`).replace(/\u0000(\d+)\u0000/g,(e,n)=>t[Number(n)])}function vM(e){let t=``,n=0;for(let r of e.matchAll(gM)){let i=r.index??0;t+=_M(e.slice(n,i))+r[1]+r[2],n=i+r[0].length}return t+=_M(e.slice(n)),t.replace(/\n{3,}/g,`
171
+
172
+ `).trim()}function yM(e){return!e||e===`Thinking...`||e.startsWith(`Reading `)||/— retrying (now|in \d+s)/.test(e)}var bM=/failed to fetch|networkerror|load failed/i;function xM(e){return e instanceof TypeError&&bM.test(e.message)}function SM(e){return xM(e)?u(`request.gaiaUnreachable`):e instanceof Nt?/\blocal only is on\b/i.test(e.detail)?u(`settings.privacy.localOnlyBlocked`):e.detail||e.message:e instanceof Error?e.message:String(e)}function CM(e,t=Ht()){let n=SM(e);return typeof n==`object`?t(n.ref,n.params):String(n)}var wM=new Map;function TM(e){let t=wM.get(e);return t||(t={byMessage:new Map,checked:new Set,inFlight:null,listeners:new Set},wM.set(e,t)),t}function EM(e){let t=TM(e);return t.inFlight||=Promise.resolve().then(()=>vt(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 DM(e){return EM(e)}function OM(e,t){let[n,r]=(0,V.useState)(()=>wM.get(e)?.byMessage.get(t)??null),[i,a]=(0,V.useState)(null);return(0,V.useEffect)(()=>{if(t<=0)return;let n=TM(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),EM(e).then(()=>a(null),e=>{n.checked.delete(t),a(SM(e))})):i(),()=>{n.listeners.delete(i)}},[e,t]),{turn:n,error:i,refresh:(0,V.useCallback)(()=>EM(e),[e])}}var kM=`gaia:changes-undone`;function AM(e){window.dispatchEvent(new CustomEvent(kM,{detail:e}))}function jM(e,t){let n=(0,V.useRef)(t);n.current=t,(0,V.useEffect)(()=>{let t=t=>{t.detail===e&&n.current()};return window.addEventListener(kM,t),()=>window.removeEventListener(kM,t)},[e])}var MM={shell:{count:`untracked.count.shell`,one:`untracked.one.shell`,bare:`untracked.bare.shell`,many:`untracked.many.shell`},run_python:{count:`untracked.count.python`,one:`untracked.one.python`,bare:`untracked.bare.python`,many:`untracked.many.python`},execute_python_file:{count:`untracked.count.script`,one:`untracked.one.script`,bare:`untracked.bare.script`,many:`untracked.many.script`},mcp:{count:`untracked.count.mcp`,one:`untracked.one.mcp`,bare:`untracked.bare.mcp`,many:`untracked.many.mcp`},install_cli:{count:`untracked.count.install`,one:`untracked.one.install`,bare:`untracked.bare.install`,many:`untracked.many.install`},late_write:{count:`untracked.count.lateWrite`,one:`untracked.one.lateWrite`,bare:`untracked.bare.lateWrite`,many:`untracked.many.lateWrite`}},NM=120;function PM(e){let t=e.replace(/\s+/g,` `).trim();return t.length>NM?`${t.slice(0,119).trimEnd()}…`:t}function FM(e,t,n){let r=MM[e];return r?n.plural(r.count,t):`${t} ${e}`}function IM(e,t,n,r){let i=MM[e];if(n.length!==1)return`${i?r(i.many):e} ×${t}`;let a=n[0],o;return o=i?a.label?r(i.one,{label:a.label}):r(i.bare):a.label?`${e}: ${a.label}`:e,a.count>1?`${o} ×${a.count}`:o}function LM(e,t=gt){let n=new Map;for(let t of e){let e=n.get(t.kind);e||(e={kind:t.kind,count:0,entries:new Map},n.set(t.kind,e)),e.count+=1;let r=(t.detail??``).trim(),i=e.entries.get(r);i?i.count+=1:e.entries.set(r,{label:PM(r),detail:r,count:1})}return[...n.values()].map(({kind:e,count:n,entries:r})=>{let i=[...r.values()];return{kind:e,title:IM(e,n,i,t),count:n,entries:i}})}function RM(e,t=gt){let n=LM(e,t).map(e=>FM(e.kind,e.count,t));return n.length===0?t(`untracked.work`):n.length===1?n[0]:t(`untracked.and`,{list:n.slice(0,-1).join(t(`untracked.sep`)),last:n[n.length-1]})}function zM(e,{also:t=!1,inChat:n=!1}={},r=gt){let i=n?`untracked.warningChat`:t?`untracked.warningAlso`:`untracked.warning`;return r.plural(i,e.length,{work:RM(e,r)})}var BM={edited:`Edited`,created:`Created`,deleted:`Deleted`};function VM(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 HM({sessionId:e,turn:t,onClose:n}){let[r,i]=(0,V.useState)(null),[a,o]=(0,V.useState)(null);pt(!0,n);let s=(0,V.useRef)(null);return on(s,!0),(0,V.useEffect)(()=>{let n=!0;return xn(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,Mj.createPortal)(I(`div`,{ref:s,className:`modal-overlay`,onClick:n,role:`dialog`,"aria-modal":`true`,"aria-label":`Review changes`,children:z(`div`,{className:`modal-panel changes-review`,onClick:e=>e.stopPropagation(),children:[z(`div`,{className:`modal-header`,children:[I(`h3`,{children:`Changes in this turn`}),I(`button`,{type:`button`,className:`btn-icon`,onClick:n,"aria-label":`Close`,children:I(Is,{size:18})})]}),z(`div`,{className:`modal-body changes-review-body`,children:[a&&z(`p`,{className:`settings-error`,role:`alert`,children:[`Could not load the changes: `,a]}),!r&&!a&&z(`p`,{className:`changes-review-loading`,children:[I(La,{size:13,className:`spin`}),` Loading changes…`]}),r?.map(e=>I(`section`,{className:`changes-review-file`,children:I(jk,{data:{path:e.path,badge:BM[e.change],note:VM(e),unified:e.binary||e.too_large?``:e.unified}})},e.path)),t.restored_at&&I(`p`,{className:`settings-hint`,children:`This turn was undone; these are the changes it had made.`})]})]})}),document.body)}function UM(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function WM({sessionId:e,messageId:t}){let n=R(),{turn:r,error:i,refresh:a}=OM(e,t),[o,s]=(0,V.useState)(`idle`),[c,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(!1),f=(0,V.useCallback)(async t=>{if(r){s(`working`),l(null);try{let n=await qt(e,r.turn_id,t),i=[];n.restored.length&&i.push(`restored ${UM(n.restored.length,`file`)}`),n.removed.length&&i.push(`removed ${UM(n.removed.length,`new file`)}`);let o=`Undone: ${i.join(`, `)||`no files needed changing`}.`;n.kept_folders.length&&(o+=` Kept ${UM(n.kept_folders.length,`folder`)} it created, because they now hold other files.`),l(o),s(`done`),AM(e),await a()}catch(e){let t=e instanceof Nt&&e.reason===`conflict`;l(e instanceof Nt?e.detail:String(e)),s(t?`conflict`:`idle`)}}},[a,e,r]);if(i)return z(`div`,{className:`turn-changes is-error`,role:`note`,children:[I(ws,{size:12,"aria-hidden":`true`}),I(`span`,{children:n(`turnChanges.loadError`,{error:i})})]});if(!r||r.files.length===0&&!r.incomplete)return null;let p=r.files.length,m=!!r.restored_at,h=LM(r.untracked,n);return z(`div`,{className:`turn-changes`,"aria-label":`File changes from this turn`,children:[p>0&&z(`div`,{className:`turn-changes-row`,children:[z(`span`,{className:`turn-changes-summary`,children:[`Changed `,UM(p,`file`),m&&` · undone`]}),z(`button`,{type:`button`,className:`turn-changes-btn`,onClick:()=>d(!0),children:[I(Li,{size:12,"aria-hidden":`true`}),` Review changes`]}),!m&&o!==`confirm`&&o!==`conflict`&&z(`button`,{type:`button`,className:`turn-changes-btn`,onClick:()=>s(`confirm`),disabled:o===`working`,children:[I(Es,{size:12,"aria-hidden":`true`}),` `,o===`working`?`Undoing…`:`Undo this turn`]}),o===`confirm`&&z(`span`,{className:`turn-changes-confirm`,role:`group`,"aria-label":`Confirm undo`,children:[`Put `,UM(p,`file`),` back the way `,p===1?`it was`:`they were`,` before this turn?`,I(`button`,{type:`button`,className:`turn-changes-btn is-primary`,onClick:()=>void f(!1),children:`Undo`}),I(`button`,{type:`button`,className:`turn-changes-btn`,onClick:()=>s(`idle`),children:`Cancel`})]})]}),r.incomplete&&z(`div`,{className:`turn-changes-warning`,role:`note`,children:[I(ws,{size:12,"aria-hidden":`true`}),z(`span`,{children:[zM(r.untracked,{also:p>0},n),h.length>0&&I(`ul`,{children:h.map(e=>I(`li`,{children:e.entries.length===1?I(`span`,{title:e.entries[0].detail||void 0,children:e.title}):z(`details`,{children:[I(`summary`,{children:e.title}),I(`ul`,{children:e.entries.map(e=>z(`li`,{title:e.detail||void 0,children:[e.label||n(`untracked.noDescription`),e.count>1&&` ×${e.count}`]},e.detail))})]})},e.kind))})]})]}),c&&z(`div`,{className:`turn-changes-message${o===`done`?` is-ok`:` is-error`}`,role:o===`done`?`status`:`alert`,children:[c,o===`conflict`&&z(`span`,{className:`turn-changes-confirm`,children:[I(`button`,{type:`button`,className:`turn-changes-btn is-danger`,onClick:()=>void f(!0),children:`Undo anyway and lose those changes`}),I(`button`,{type:`button`,className:`turn-changes-btn`,onClick:()=>{s(`idle`),l(null)},children:`Keep them`})]})]}),u&&I(HM,{sessionId:e,turn:r,onClose:()=>d(!1)})]})}async function GM(){return An(`GET`,`/speech/settings`)}async function KM(e){return An(`PUT`,`/speech/settings`,e)}async function qM(){return An(`GET`,`/speech/model`)}var JM=1e3;async function YM(e,t={}){let n=`${dn()}/speech`,r=F.api.time();F.api.info(`POST ${n}`,{chars:e.length,voice:t.voice});let i=await fetch(n,{method:`POST`,headers:{...En,"Content-Type":`application/json`},body:JSON.stringify({text:e,voice:t.voice,speed:t.speed}),signal:t.signal});if(!i.ok){let e=await i.text().catch(()=>``);F.api.error(`POST ${n} - HTTP ${i.status}`,{errorText:e});let t=In(e);throw new Nt(ye(i.status,t),i.status,t,Ot(e))}let a=await i.blob();return F.api.timed(`POST ${n} -> ${i.status} (${a.size} bytes)`,r),a}function XM(e){return e.replace(/```[\s\S]*?(```|$)/g,`
173
+ `).replace(/!\[[^\]]*\]\([^)]*\)/g,``).replace(/\[([^\]]+)\]\([^)]*\)/g,`$1`).replace(/<\/?[a-z][^>]*>/gi,``).replace(/https?:\/\/\S+/g,``).replace(/`([^`]*)`/g,`$1`).replace(/^[ \t]*([-*_][ \t]*){3,}$/gm,``).replace(/^[ \t]{0,3}#{1,6}[ \t]+/gm,``).replace(/^[ \t]*>[ \t]?/gm,``).replace(/^[ \t]*([-*+]|\d+[.)])[ \t]+/gm,``).replace(/^[ \t]*\|?[ \t:|-]+\|[ \t:|-]*$/gm,``).replace(/^[ \t]*\|(.*?)\|?[ \t]*$/gm,(e,t)=>t.split(`|`).map(e=>e.trim()).filter(Boolean).join(`, `)).replace(/(\*\*|\*|~~)(\S(?:[\s\S]*?\S)?)\1/g,`$2`).replace(/(?<!\w)(__|_)(\S(?:[\s\S]*?\S)?)\1(?!\w)/g,`$2`).split(`
174
+ `).map(e=>e.trim()).filter(Boolean).join(`
175
+ `).trim()}function ZM(e,t){let n=[],r=e.trim();for(;r.length>t;){let e=r.slice(0,t),i=Math.max(e.lastIndexOf(`, `),e.lastIndexOf(`; `),e.lastIndexOf(` `)),a=i>t/3?i+1:t;n.push(r.slice(0,a).trim()),r=r.slice(a).trim()}return r&&n.push(r),n}function QM(e,t=1e3){let n=XM(e);if(!n)return[];let r=n.split(/(?<=[.!?…؟])\s+|\n+/).flatMap((e,n)=>ZM(e,Math.min(n===0?180:600,t))),i=[],a=``;for(let e of r){let n=Math.min(i.length===0?180:600,t);a&&a.length+1+e.length>n?(i.push(a),a=e):a=a?`${a} ${e}`:e}return a&&i.push(a),i}var $M=class extends Error{};function eN(e,t){return t instanceof Nt?{messageId:e,kind:t.httpStatus===503?`unreachable`:t.httpStatus===502?`speech`:`other`,detail:t.detail||t.message}:t instanceof $M||t instanceof DOMException&&t.name===`NotAllowedError`?{messageId:e,kind:`playback`,detail:t.message}:{messageId:e,kind:`other`,detail:t instanceof Error?t.message:String(t)}}var tN=null;function nN(e){e.abort.abort(),e.audio&&(e.audio.pause(),e.audio.src=``),e.urls.forEach(e=>URL.revokeObjectURL(e)),e.urls=[]}function rN(e,t){return new Promise((n,r)=>{let i=URL.createObjectURL(t);e.urls.push(i);let a=new Audio(i);e.audio=a;let o=()=>{e.abort.signal.removeEventListener(`abort`,o),n()};a.onended=o,a.onerror=()=>r(new $M(a.error?.message||`media error ${a.error?.code??``}`.trim())),e.abort.signal.addEventListener(`abort`,o),a.play().catch(r)})}var iN=Ct((e,t)=>({messageId:null,status:null,error:null,settings:null,voiceReady:!1,downloadGb:null,setSettings:t=>e({settings:t}),stop:()=>{tN&&nN(tN),tN=null,e({messageId:null,status:null,downloadGb:null})},clearError:()=>e({error:null}),read:async(n,r)=>{t().stop();let i=QM(r,JM);if(i.length===0){e({error:{messageId:n,kind:`nothing`,detail:``}});return}let a={abort:new AbortController,audio:null,urls:[]};tN=a,e({messageId:n,status:`loading`,error:null});let o=e=>{let t=YM(e,{signal:a.abort.signal});return t.catch(()=>void 0),t};try{if(!t().voiceReady){let t=await qM();if(tN!==a)return;t.downloaded||e({status:`downloading`,downloadGb:t.size_gb})}let n=o(i[0]);for(let t=0;t<i.length;t++){let r=await n;if(tN!==a||(t+1<i.length&&(n=o(i[t+1])),e({status:`playing`,voiceReady:!0,downloadGb:null}),await rN(a,r),tN!==a))return}}catch(t){if(tN!==a||a.abort.signal.aborted)return;F.ui.error(`Read aloud failed`,t),e({error:eN(n,t)})}tN===a&&(nN(a),tN=null,e({messageId:null,status:null,downloadGb:null}))}}));function aN({messageId:e,content:t}){let n=R(),r=iN(t=>t.messageId===e),i=iN(t=>t.messageId===e?t.status:null),a=iN(e=>e.read),o=iN(e=>e.stop),s=n(r?`readAloud.stop`:`readAloud.read`);return I(`button`,{type:`button`,className:`msg-action-btn msg-read-aloud${r?` is-active`:``}`,onClick:()=>r?o():void a(e,t),title:s,"aria-label":s,"aria-pressed":r,children:i===`loading`||i===`downloading`?I(La,{size:12,className:`spin`}):I(r?vs:As,{size:12})})}function oN({messageId:e}){let t=R(),n=iN(t=>t.messageId===e&&t.status===`downloading`),r=iN(e=>e.downloadGb);return n?z(`p`,{className:`msg-read-aloud-note`,role:`status`,children:[t(`readAloud.downloading`),r!=null&&z(P.Fragment,{children:[` `,z(`bdi`,{dir:`ltr`,children:[`(~`,r,` GB)`]})]})]}):null}function sN({messageId:e}){let t=R(),n=iN(t=>t.error?.messageId===e?t.error:null),r=iN(e=>e.clearError);return n?z(`p`,{className:`msg-read-aloud-error`,role:`alert`,children:[z(`span`,{children:[t(`readAloud.error.${n.kind}`),n.detail&&I(`span`,{className:`msg-read-aloud-detail`,children:I(`bdi`,{children:n.detail})})]}),I(`button`,{type:`button`,className:`msg-action-btn`,onClick:r,"aria-label":t(`readAloud.dismiss`),title:t(`readAloud.dismiss`),children:I(Is,{size:12})})]}):null}var cN=[0,3e3,1e4],lN=`The answer to your last message was lost: its run stopped before it finished, most often because GAIA restarted. Send the message again.`;function uN(e){return e.name===`StreamStalledError`||e.name===`StreamDroppedError`}function dN(e){return e.name===`StreamDroppedError`&&e.unreachable===!0}function fN(e){return dN(e)?!1:uN(e)||e instanceof un}function pN(e,t=Ht()){if(dN(e))return t(`chatError.gaiaStopped`);if(uN(e))return t(`chatError.liveViewLost`,{n:4});if(e instanceof un)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: reopen this chat once GAIA is answering again.`;if(e instanceof Nt){let t=e.detail?In(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 mN=/context (window|size|length|limit)|exceeds the available context|maximum context|too many tokens/i,hN=/lemonade|\bLLM\b|could not get response/i,gN=/failed to fetch|networkerror|\bfetch\b/i,_N=/timed out|timeout/i,vN=/\bGF-\d{8}-\d{6}-[0-9a-f]{4}\b/;function yN(e){return vN.exec(e)?.[0]??null}function bN(e,t=Ht()){let n=xN(e,t),r=yN(e.message||``);return r?{...n,text:`${n.text}\n\n${t(`chatError.savedReport`,{id:r})}`}:n}function xN(e,t){let n=pN(e,t);if(n)return{kind:`stream`,text:n};let r=e.message||``;return mN.test(r)?{kind:`context`,text:t(`chatError.context`)}:hN.test(r)?{kind:`model_server`,text:t(`chatError.modelServer`)}:e instanceof TypeError||gN.test(r)?{kind:`connection`,text:t(`chatError.connection`)}:_N.test(r)?{kind:`timeout`,text:t(`chatError.timeout`)}:{kind:`unknown`,text:t(`chatError.unknown`)}}function SN(e){return yN(e)!==null}function CN(e){return e instanceof Error?e.message:String(e)}function wN({classes:e,note:t}){let n=R(),[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(null),l=(0,V.useCallback)(async()=>{i(!0),c(null),o(null);try{let e=await E(),t=await Le(e.name),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e.name,r.click(),setTimeout(()=>URL.revokeObjectURL(n),6e4),o(e)}catch(e){c(n(`setup.logs.reportFailed`,{error:CN(e)}))}finally{i(!1)}},[n]);return z(`div`,{className:e.root,children:[z(`button`,{type:`button`,className:e.button,onClick:()=>void l(),disabled:r,children:[r?I(La,{size:13,className:`spin`,"aria-hidden":`true`}):I(zi,{size:13,"aria-hidden":`true`}),I(`span`,{children:n(`setup.logs.report`)})]}),t&&I(`span`,{className:e.hint,children:t}),a&&z(`p`,{className:e.hint,role:`status`,children:[n(`setup.logs.reportSaved`,{size:WO(a.size_bytes)}),` `,I(`bdi`,{dir:`ltr`,children:a.path})]}),s&&I(`p`,{className:e.error,role:`alert`,children:s})]})}function TN(e){let t=Uint8Array.from(atob(e.crop),e=>e.charCodeAt(0));return new File([t],`picked-${e.ref}.png`,{type:`image/png`})}function EN(e){let{crop:t,outerHTML:n,styles:r,...i}=e.element;return{...i,outerHTML:e.include.html?n:null,styles:e.include.styles?r:null,cropUrl:e.include.screenshot?e.cropUrl:null}}var DN=Ct((e,t)=>{let n=(t,n)=>e(e=>({chips:e.chips.map(e=>e.element.ref===t?{...e,...n}:e)})),r=e=>{M(TN(e)).then(t=>n(e.ref,{uploading:!1,cropUrl:t.url})).catch(t=>{F.chat.error(`Could not upload the picture of picked element ${e.ref}`,t),n(e.ref,{uploading:!1,error:t instanceof Error?t.message:String(t)})})};return{chips:[],dismissed:[],applyPick:({run:n,elements:i})=>{let a=new Map(t().chips.map(e=>[e.element.ref,e])),o=[],s=i.filter(e=>!t().dismissed.includes(e.ref)).map(e=>{let t=a.get(e.ref);return t?{...t,element:e,run:n}:(o.push(e),{element:e,run:n,include:{html:!0,styles:!0,screenshot:!1},cropUrl:null,uploading:e.crop!==null,error:null})});e(e=>({chips:[...e.chips.filter(e=>e.run!==n),...s]})),o.filter(e=>e.crop!==null).forEach(r)},toggle:(t,n)=>e(e=>({chips:e.chips.map(e=>e.element.ref===t?{...e,include:{...e.include,[n]:!e.include[n]}}:e)})),remove:t=>e(e=>({chips:e.chips.filter(e=>e.element.ref!==t),dismissed:[...e.dismissed,t]})),take:()=>{let{chips:n}=t();if(n.length!==0)return e({chips:[]}),n.map(EN)}}});function ON(e){let t=e.name.length>40?`${e.name.slice(0,39)}…`:e.name;return t?`${e.label} "${t}"`:e.label}var kN=[{part:`html`,label:`browserPane.chip.part.html`,send:`browserPane.chip.send.html`,leaveOut:`browserPane.chip.leaveOut.html`},{part:`styles`,label:`browserPane.chip.part.styles`,send:`browserPane.chip.send.styles`,leaveOut:`browserPane.chip.leaveOut.styles`},{part:`screenshot`,label:`browserPane.chip.part.screenshot`,send:`browserPane.chip.send.screenshot`,leaveOut:`browserPane.chip.leaveOut.screenshot`}];function AN({chip:e}){let{element:t}=e,n=DN(e=>e.toggle),r=DN(e=>e.remove),i=R(),a=ON(t);return z(`li`,{className:`element-chip${e.error?` has-error`:``}`,"data-ref":t.ref,children:[t.crop?I(`img`,{className:`element-chip-thumb`,src:`data:image/png;base64,${t.crop}`,alt:``}):I(to,{size:14,"aria-hidden":`true`}),z(`span`,{className:`element-chip-text`,title:`${t.ref}: ${t.selector}\n${t.url}`,children:[I(`span`,{className:`element-chip-label`,children:a}),t.component&&z(`span`,{className:`element-chip-component`,children:[`<`,t.component.name,`>`]})]}),I(`span`,{className:`element-chip-parts`,role:`group`,"aria-label":i(`browserPane.chip.whatToSend`,{label:a}),children:kN.map(({part:r,label:a,send:o,leaveOut:s})=>{let c=r===`screenshot`&&(t.crop===null||e.error!==null);return I(`button`,{type:`button`,className:`element-chip-part`,"aria-pressed":e.include[r]&&!c,disabled:c,title:i(c?`browserPane.chip.noScreenshot`:e.include[r]?s:o),onClick:()=>n(t.ref,r),children:i(a)},r)})}),e.uploading&&I(`span`,{className:`element-chip-state`,children:i(`browserPane.chip.uploading`)}),e.error&&I(`span`,{className:`element-chip-state`,role:`alert`,children:i(`browserPane.chip.uploadFailed`)}),I(`button`,{type:`button`,className:`composer-icon-btn`,onClick:()=>r(t.ref),"aria-label":i(`browserPane.chip.remove`,{label:a}),children:I(Is,{size:12})})]})}function jN(){let e=DN(e=>e.chips),t=R();return e.length===0?null:z(P.Fragment,{children:[I(`ul`,{className:`element-chips`,"aria-label":t(`browserPane.chip.list`),children:e.map(e=>I(AN,{chip:e},e.element.ref))}),e.length>8&&I(`p`,{className:`composer-limit-error`,role:`alert`,children:t(`browserPane.chip.tooMany`,{max:8,n:e.length-8})})]})}function MN(e){let t=R(),n=DN(t=>t.chips.length===0?null:t.chips.length>8?`browserPane.block.tooMany`:t.chips.some(e=>e.uploading)?`browserPane.block.uploading`:e?`browserPane.block.streaming`:null);return n===null?null:t(n,{max:8})}function NN({elements:e}){let t=R();return I(`ul`,{className:`element-chips is-sent`,"aria-label":t(`browserPane.chip.list`),children:e.map(e=>z(`li`,{className:`element-chip`,"data-ref":e.ref,title:`${e.ref}: ${e.selector}\n${e.url}`,children:[I(to,{size:14,"aria-hidden":`true`}),z(`span`,{className:`element-chip-text`,children:[I(`span`,{className:`element-chip-label`,children:ON(e)}),e.component&&z(`span`,{className:`element-chip-component`,children:[`<`,e.component.name,`>`]})]})]},e.ref))})}var PN=10,FN=.6;function IN(e){let t=e.toLowerCase().match(/[\p{L}\p{N}]+/gu)??[],n=new Set;for(let e=1;e<t.length;e++)n.add(`${t[e-1]} ${t[e]}`);return n}function LN(e,t){if(e.size<PN||t.size<PN)return!1;let n=0;for(let r of e)t.has(r)&&n++;return n/e.size>=FN}function RN(e,t){let n=e.map((e,t)=>({step:e,index:t})).filter(({step:e})=>e.type===`commentary`&&e.detail?.trim());if(n.length===0)return e;let r=n.map(({step:e})=>IN(e.detail??``)),i=IN(t),a=new Set;return n.forEach(({index:e},t)=>{[...r.slice(t+1),i].some(e=>LN(r[t],e))&&a.add(e)}),a.size===0?e:e.filter((e,t)=>!a.has(t))}var zN=[{re:/Settings\s*(?:>|›|→)\s*Advanced\s*(?:>|›|→)\s*Custom model ID/i,section:`advanced`,target:`[data-settings-target="custom-model"]`}],BN=`Failed to start the query run:`,VN=/^(?:[A-Za-z_.]*(?:Error|Exception):|Failed to (?:preload|load|auto-download)\b)|Traceback \(most recent/,HN=1500,UN=/\brun:\s|re-run your|`gaia [a-z]/i,WN=/no model called|doesn't list (?:it|this model)|must include the .?user.? namespace|isn't installed on the local LLM server|\bmodel\b[^\n]{0,80}\bwas not found\b/i,GN=/\bmodel\b[^\n]{0,40}\b(?:couldn't|didn't|failed to) (?:pre)?load|failed to (?:pre)?load (?:lemonade )?model/i,KN=/context (?:window|size|length|limit)|exceeds the available context|maximum context|too many tokens/i,qN={general:`general`,setup:`setup`,model:`model`,permissions:`permissions`,skills:`skills`,connectors:`connectors`,messaging:`messaging`,automations:`automations`,memory:`memory`,privacy:`privacy`,notifications:`notifications`,"read aloud":`voice`,advanced:`advanced`,about:`about`},JN=/Settings\s*(?:>|›|→)\s*(General|Setup|Model|Permissions|Skills|Connectors|Messaging|Automations|Memory|Privacy|Notifications|Read aloud|Advanced|About)\b/g;function YN(e){return WN.test(e)?`modelUnavailable`:GN.test(e)?`modelLoad`:KN.test(e)?`context`:`unknown`}function XN(e){let t=ZN(e),n=YN(t),r=VN.test(t)||t.length<HN&&UN.test(t),i=n===`modelUnavailable`||n===`modelLoad`?[`model`]:[];for(let e of t.matchAll(JN)){let t=qN[e[1].toLowerCase()];i.includes(t)||i.push(t)}let a={};for(let e of zN)i.includes(e.section)&&e.re.test(t)&&(a[e.section]=e.target);return{kind:n,raw:r,sections:i,targets:a}}function ZN(e){let t=e.trim();return t.startsWith(BN)?t.slice(30).trim():t}var QN=/^!\[([^\]]*)\]\((\/api\/files\/uploads\/[^)\s]+)\)$/;function $N(e){try{return decodeURIComponent(e)}catch{return e}}function eP(e){let t=[],n=[],r=!1;for(let i of e.split(`
176
+ `)){i.trim().startsWith("```")&&(r=!r);let e=r?null:QN.exec(i.trim()),a=e?O_(e[2]):``;e&&a?t.push({src:a,name:e[1]||$N(e[2].split(`/`).pop()||``)}):n.push(i)}return t.length===0?{text:e,images:t}:{text:n.join(`
177
+ `).replace(/\n{3,}/g,`
178
+
179
+ `).trim(),images:t}}function tP({images:e,index:t,onIndex:n,onClose:r}){let i=R(),a=(0,V.useRef)(null),o=(0,V.useRef)(null),s=e.length>1,c=e[t];pt(!0,r),on(a,!0),(0,V.useEffect)(()=>{o.current?.focus()},[]);let l=(0,V.useCallback)(r=>{n((t+r+e.length)%e.length)},[t,e.length,n]);return(0,V.useEffect)(()=>{if(!s)return;let e=e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`)return;let t=a.current?getComputedStyle(a.current).direction===`rtl`:!1;e.preventDefault(),l(e.key===`ArrowRight`===t?-1:1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[s,l]),c?(0,Mj.createPortal)(I(`div`,{ref:a,className:`image-viewer`,role:`dialog`,"aria-modal":`true`,"aria-label":i(`imageViewer.dialog`),onClick:e=>{e.target===e.currentTarget&&r()},children:z(`div`,{className:`image-viewer-stage`,onClick:e=>{e.target===e.currentTarget&&r()},children:[I(`button`,{ref:o,type:`button`,className:`image-viewer-btn image-viewer-close`,onClick:r,"aria-label":i(`imageViewer.close`),children:I(Is,{size:18,"aria-hidden":`true`})}),s&&I(`button`,{type:`button`,className:`image-viewer-btn image-viewer-prev`,onClick:()=>l(-1),"aria-label":i(`imageViewer.prev`),children:I(qr,{size:20,"aria-hidden":`true`})}),I(`img`,{className:`image-viewer-img`,src:c.src,alt:c.name}),s&&I(`button`,{type:`button`,className:`image-viewer-btn image-viewer-next`,onClick:()=>l(1),"aria-label":i(`imageViewer.next`),children:I(Yr,{size:20,"aria-hidden":`true`})}),z(`p`,{className:`image-viewer-caption`,dir:`auto`,children:[I(`bdi`,{children:c.name}),s&&z(P.Fragment,{children:[` · `,I(`bdi`,{dir:`ltr`,children:i(`imageViewer.count`,{n:t+1,total:e.length})})]})]})]})}),document.body):null}function nP({images:e}){let t=R(),[n,r]=(0,V.useState)(null),i=(0,V.useRef)([]),a=(0,V.useCallback)(()=>{let e=n;r(null),e!==null&&requestAnimationFrame(()=>i.current[e]?.focus())},[n]);return e.length===0?null:z(P.Fragment,{children:[I(`ul`,{className:`image-thumbs`,"aria-label":t(`msg.images`),children:e.map((e,n)=>I(`li`,{children:I(`button`,{type:`button`,ref:e=>{i.current[n]=e},className:`image-thumb`,onClick:()=>r(n),"aria-label":t(`msg.imageOpen`,{name:e.name}),title:e.name,children:I(`img`,{src:e.src,alt:``,loading:`lazy`})})},`${e.src}-${n}`))}),n!==null&&I(tP,{images:e,index:n,onIndex:r,onClose:a})]})}var rP=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),iP=String.raw`[^\s*?"<>|,;)}\]\\/]+[\\/]`,aP=String.raw`(?:(?:[A-Za-z]:[\\/]|(?<![\p{L}\p{N}_.\-\\/])/)(?:${iP})*)?`,oP=String.raw`(?<![\p{L}\p{N}_.\-])`,sP=String.raw`(?![\p{L}\p{N}_\-]|\.[\p{L}\p{N}])`,cP=e=>e.trim().replace(/\\/g,`/`).toLowerCase(),lP=e=>e.trim().split(/[\\/]/).pop()??``,uP=e=>e.split(/[\\/]/).slice(0,-1).filter(Boolean);function dP(e){let t=new Map;for(let n of e)t.set(n.filename.toLowerCase(),[...t.get(n.filename.toLowerCase())??[],n]);let n=new Map;for(let e of t.values()){let t=Math.max(...e.map(e=>uP(e.filepath??``).length)),r=null;for(let n=1;e.length>1&&n<=t&&!r;n++){let t=e.map(e=>[...uP(e.filepath??``).slice(-n),e.filename].join(`/`));new Set(t.map(e=>e.toLowerCase())).size===e.length&&(r=t)}e.forEach((e,t)=>n.set(e,r?r[t]:e.filename))}return n}function fP(e){let t=e.filter(e=>e.filename),n=dP(t),r=new Map,i=new Map;for(let e of t){let t={id:e.id,filename:e.filename,label:n.get(e)},a=new Set([e.filename.toLowerCase()]);e.filepath&&(a.add(lP(e.filepath).toLowerCase()),i.set(cP(e.filepath),t));for(let n of a){let i=r.get(n);r.set(n,i===void 0||i?.id===e.id?t:null)}}if(r.size===0)return{re:null,byName:r,byPath:i};let a=[...r.keys()].sort((e,t)=>t.length-e.length).map(rP).join(`|`);return{re:RegExp(`${aP}${oP}(${a})${sP}`,`giu`),byName:r,byPath:i}}function pP(e,t){return e.byPath.get(cP(t))??e.byName.get(lP(t).toLowerCase())??null}function mP(e,t){if(!e.re)return[];let n=[];for(let r of t.matchAll(e.re)){let i=r.index+r[0].length,a=hP(e,t,i,lP(r[0]).toLowerCase()),o=a&&a.start<=r.index?null:pP(e,r[0]);o?n.push({start:r.index,end:i,doc:o}):a&&n.push({start:a.start,end:i,doc:a.doc})}return n}function hP(e,t,n,r){let i=t.slice(0,n).replace(/\\/g,`/`).toLowerCase(),a=null;for(let[t,o]of e.byPath)lP(t)===r&&i.endsWith(t)&&(!a||n-t.length<a.start)&&(a={start:n-t.length,doc:o});return a}var gP=`[0-9\\u0660-\\u0669\\u06F0-\\u06F9]+`,_P=`pages?|pp?\\.|[وبفل]?(?:الصفحات|الصفحتان|الصفحتين|الصفحة|صفحات|صفحتي|صفحة)|ص\\.?`,vP=String.raw`\s*(?:,|،|&|and|to|و|إلى|[-–—])\s*`,yP=new RegExp(String.raw`(?<!\p{L})(?:${_P})(?!\p{L})\s*(${gP}(?:${vP}${gP})*)`,`iu`);function bP(e){return Number(e.replace(/[٠-٩۰-۹]/g,e=>String(e.charCodeAt(0)&15)))}function xP(e){let t=yP.exec(e);if(!t||t.index>40)return[];let n=t.index+t[0].length-t[1].length,r=[];for(let e of t[1].matchAll(new RegExp(gP,`g`))){let t=bP(e[0]);t>0&&r.push({start:n+e.index,end:n+e.index+e[0].length,page:t})}return r}function SP({active:e,label:t,awaitingUser:n=!1}){let r=R(),i=n?r(`activity.waiting`):t?gD(r,t):r(`msg.thinking`),a=wP(e,i),o=e&&!n&&yM(t),s=wP(o),c=Tc();return e?z(`span`,{className:`thinking-indicator${n?``:` is-live`}`,children:[I(`span`,{className:`thinking-indicator-text`,children:i}),!n&&a>=CP&&z(`span`,{className:`thinking-indicator-elapsed`,children:[` · `,z(`bdi`,{dir:`ltr`,children:[a,`s`]})]}),o&&s>=45&&I(`span`,{className:`thinking-indicator-hint`,role:`status`,children:r(c?.remote===!1?`live.localModelWaitHint`:`live.modelWaitHint`)})]}):null}var CP=3;function wP(e,t){let[n,r]=(0,V.useState)(0);return(0,V.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}var TP=/^The model (?:call failed|stopped responding) at step \d+, so this request is unfinished\./;function EP(e){return TP.test(e.trimStart())}var DP=/[\\/]agents[\\/][^\\/\s]+[\\/]logs\b/;function OP(e){return DP.test(e)}var kP={root:`msg-report`,button:`msg-try-again`,hint:`msg-report-hint`,error:`msg-report-error`};function AP(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 jP=e=>e.replace(/\s+/g,` `).trim();function MP(e,t){let n=jP(t);if(!n)return{steps:e,echoed:!1,endedBy:null};let r=t.trimEnd(),i=e[e.length-1],a=!1,o=null;return{steps:e.filter(e=>e.type!==`error`||!e.detail?.trim()?!0:jP(e.detail)===n?(a=!0,!1):e!==i||!r.endsWith(`\n\n${e.detail.trim()}`)||(o=e.detail.trim(),!1)),echoed:a,endedBy:o}}var NP=/\s*\{\s*"?tool"?\s*:\s*"[^"]+"\s*,\s*"?tool_args"?\s*:\s*\{[^}]*\}\s*\}/g,PP=new Set([`thought`,`answer`,`tool`,`tool_args`,`goal`]),FP=/^\{\s*"(thought|answer|tool|tool_args|goal)"\s*:/;function IP(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 LP(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,`
180
+ `).replace(/\\\\/g,`\\`)}function RP(e){let t;try{t=JSON.parse(e)}catch{let t=LP(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=>PP.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 zP(e,t){let n=``,r=0;for(;r<e.length;){let i=e.indexOf(`{`,r);if(i===-1){n+=e.slice(r);break}if(!FP.test(e.slice(i,i+40))){n+=e.slice(r,i+1),r=i+1;continue}let a=IP(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=RP(o);s.action===`answer`?n+=s.text:s.action===`keep`&&(n+=o),r=a+1}return n}var BP=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`.split(`.`));function VP(e){return e.replace(/```(\w*)[ \t]*\n([\s\S]*?)```/g,(e,t,n)=>{let r=t.toLowerCase();return r.length>0&&r.length<=2&&!BP.has(r)?n.trim():e})}var HP=/\n{1,2}Verification: unverified[^\n]*\s*$/;function UP(e){let t=e;for(;;){let e=t.replace(HP,``);if(e===t)return t;t=e}}function WP(e,t=!1){if(!e)return e;e=UP(e);let n=e;n=n.replace(NP,``),n=zP(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,`
181
+ `),n=n.replace(/\\"/g,`"`)),n=VP(n).trim(),GP(n)}function GP(e){let t=!1;return e.split(`
182
+ `).map(e=>(/^\s*(```|~~~)/.test(e)&&(t=!t),t?e:e.replace(/^(\s*\d+)\.(\s*)$/,`$1\\.$2`))).join(`
183
+ `)}function KP(e,t){return e?new Date(e).toLocaleString(Sn(t),{month:`short`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,second:`2-digit`,hour12:!0}):``}function qP(e,t,n=new Date){if(!e)return``;let r=new Date(e),i=Sn(t),a=r.toLocaleTimeString(i,{hour:`numeric`,minute:`2-digit`}),o=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime(),s=Math.round((o(n)-o(r))/864e5);return s===0?a:s===1?t(`msg.yesterdayAt`,{time:a}):r.toLocaleString(i,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,...r.getFullYear()===n.getFullYear()?{}:{year:`numeric`}})}var JP=`Cancelled.`,YP=[[`This answer was interrupted when GAIA closed. Send again to retry.`,`msg.cutOff.interrupted`],[`This answer was interrupted before it finished. Send again to retry.`,`msg.cutOff.cancelled`],[`This answer ended before GAIA could save a reply. Send again to retry.`,`msg.cutOff.noReply`],[`This run was stopped because its schedule was deleted.`,`msg.cutOff.scheduleDeleted`],[`This run was stopped because its schedule was paused.`,`msg.cutOff.schedulePaused`]],XP=/(?:^|\n\n)Before it stopped, it had started these tools: (.+)\.$/;function ZP(e){let t=e.trim(),n=YP.find(([e])=>t.endsWith(e));if(!n)return null;t=t.slice(0,-n[0].length).trimEnd();let r=XP.exec(t);return r&&(t=t.slice(0,r.index).trimEnd()),{body:t,notice:n[1],tools:r?r[1]:null}}function QP(e,t,n=!1){return t?`stopped`:ZP(e)?`interrupted`:n?`failed`:void 0}var $P=320;function eF({original:e,draft:t,onDraft:n,onSend:r,onCancel:i,confirming:a=!1}){let o=R(),{text:s,links:c}=(0,V.useMemo)(()=>E_(e),[e]),[l,u]=(0,V.useState)(()=>t==null?s:E_(t).text),d=(0,V.useRef)(null),f=l.trim()!==``&&l!==s,p=()=>r(D_(l,c));return(0,V.useLayoutEffect)(()=>{let e=d.current;e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))},[]),(0,V.useLayoutEffect)(()=>{let e=d.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,$P)}px`)},[l]),z(`div`,{className:`msg-edit`,children:[I(`textarea`,{ref:d,className:`msg-edit-input`,value:l,onChange:e=>{u(e.target.value),n?.(e.target.value)},onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),i()):e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&(e.preventDefault(),f&&!a&&p())},"aria-label":o(`msg.editLabel`),readOnly:a,rows:1,dir:`auto`,...Pt}),c.length>0&&I(`ul`,{className:`msg-edit-attachments`,"aria-label":o(`composer.attached`),children:c.map((e,t)=>z(`li`,{className:`msg-edit-attachment`,children:[I(Yi,{size:14,"aria-hidden":`true`}),I(`span`,{className:`msg-edit-attachment-name`,title:e.name,dir:`auto`,children:e.name})]},t))}),!a&&z(`div`,{className:`msg-edit-actions`,children:[I(`button`,{type:`button`,className:`btn-secondary msg-edit-btn`,onClick:i,children:o(`msg.editCancel`)}),I(`button`,{type:`button`,className:`btn-primary msg-edit-btn`,onClick:p,disabled:!f,children:o(`msg.editSend`)})]})]})}var tF=/^\[schedule-run\] Run #(\d+) \u00b7 (.+)$/;function nF({message:e,isStreaming:t,agentSteps:n,agentStepsActive:r,cards:i,onDelete:a,onResend:o,extraActions:s,onTryAgain:c,onContinue:l,onRegenerate:u,onEditStart:d,editing:f=!1,editDraft:p=null,onEditDraft:m,onEdit:h,onEditCancel:g,laterCount:_=0,latest:v=!1,latencyMs:y,liveStatus:b,toolStatus:x,awaitingUser:S}){let C=R();yc();let w=(0,V.useMemo)(()=>{if(e.role!==`assistant`||!n)return{steps:n,echoed:!1,endedBy:null};let r=RN(n,e.content);return t?{steps:r,echoed:!1,endedBy:null}:MP(r,e.content)},[n,e.content,e.role,t]),T=e.role===`assistant`&&(w.echoed||e.failed===!0||AP(e.content)),E=Tc(),D=qs(e=>e.show),O=B(e=>e.openSettings),k=B(e=>e.jumpToSetting),ee=(0,V.useMemo)(()=>T&&!t?XN(e.content):null,[T,t,e.content]),te=e.role===`assistant`?e.stopState??(e.content.trim()===JP?`stopped`:void 0):void 0,ne=(0,V.useMemo)(()=>e.role===`assistant`&&!t?ZP(e.content):null,[e.content,e.role,t]),A=ne?null:w.endedBy,re=(0,V.useMemo)(()=>e.role===`user`?eP(e.content):null,[e.content,e.role]),ie=(0,V.useMemo)(()=>re?re.text:WP(ne?ne.body:A?e.content.trimEnd().slice(0,-A.length):e.content,!!t),[e.content,re,t,ne,A]),ae=!!ie.trim()&&!(te&&ie.trim()===JP),j=e.turnSummary?.files,oe=(0,V.useMemo)(()=>j?.map(e=>e.path)??[],[j]),se=`${e.session_id}:${e.id}`,[ce,le]=(0,V.useState)(!1),[ue,de]=(0,V.useState)(!1),fe=e.role===`user`&&iD(e.content),pe=(0,V.useMemo)(()=>fe?oD(e.content):null,[fe,e.content]),[me,he]=(0,V.useState)(!1),M=(0,V.useId)(),N=(0,V.useRef)(null),ge=(0,V.useRef)(!1),_e=(0,V.useCallback)(()=>{me&&(ge.current=!0),he(!me)},[me]);(0,V.useEffect)(()=>{!me&&ge.current&&(ge.current=!1,N.current?.scrollIntoView?.({block:`nearest`}))},[me]);let ve=(0,V.useRef)(null),ye=(0,V.useRef)(null);(0,V.useEffect)(()=>()=>{ve.current&&clearTimeout(ve.current),ye.current&&clearTimeout(ye.current)},[]);let be=(0,V.useCallback)(()=>{let t=e.role===`assistant`?vM(ie):e.content;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)}le(!0),ve.current&&clearTimeout(ve.current),ve.current=setTimeout(()=>le(!1),2e3)},[ie,e.content,e.role]),xe=(0,V.useCallback)(()=>{ue?(de(!1),ye.current&&clearTimeout(ye.current),a?.(e.id)):(de(!0),ye.current&&clearTimeout(ye.current),ye.current=setTimeout(()=>de(!1),3e3))},[ue,e.id,a]),[Se,Ce]=(0,V.useState)(null),we=(0,V.useCallback)(e=>{_>0?Ce(()=>e):e()},[_]),Te=(0,V.useCallback)(()=>{we(()=>o?.(e))},[e,o,we]),Ee=e.created_at?C(e.role===`user`?`msg.sent`:`msg.replied`,{time:KP(e.created_at,C)}):void 0,De=e.role===`system`?tF.exec(e.content):null;return De?I(`div`,{className:`msg-run-divider`,role:`separator`,children:C(`msg.scheduledRun`,{n:De[1],time:De[2]})}):I(`div`,{className:`msg msg-${e.role} ${T?`msg-error`:``}${v?` msg-latest`:``}`,title:Ee,children:z(`div`,{className:`msg-inner`,children:[z(`div`,{className:`msg-header`,children:[I(`div`,{className:`msg-header-left`}),!t&&!f&&z(`div`,{className:`msg-actions`,children:[e.role===`user`&&d&&h&&I(`button`,{type:`button`,className:`msg-action-btn`,onClick:()=>d(e),title:C(`msg.edit`),"aria-label":C(`msg.edit`),children:I(vo,{size:12})}),e.role===`user`&&o&&I(`button`,{className:`msg-action-btn`,onClick:Te,title:C(`msg.resend`),"aria-label":C(`msg.resend`),children:I(Po,{size:12})}),e.role===`assistant`&&u&&I(`button`,{type:`button`,className:`msg-action-btn`,onClick:u,title:C(`msg.tryAgain`),"aria-label":C(`msg.tryAgain`),children:I(Bo,{size:12})}),s,e.role===`assistant`&&!T&&ae&&I(aN,{messageId:se,content:ie}),ae&&I(`button`,{className:`msg-copy ${ce?`copied`:``}`,onClick:be,title:C(ce?`msg.copied`:`msg.copy`),"aria-label":C(ce?`msg.copiedAria`:`msg.copy`),children:I(ce?Vr:hi,{size:12})}),a&&I(`button`,{className:`msg-action-btn msg-delete ${ue?`confirm`:``}`,onClick:xe,title:C(ue?`msg.confirmDelete`:`msg.delete`),"aria-label":C(ue?`msg.confirmDeleteAria`:`msg.delete`),children:I(Ss,{size:12})})]})]}),z(`div`,{className:`msg-body`,children:[e.role===`assistant`&&(w.steps&&w.steps.length>0||t)&&I(QD,{steps:w.steps??[],isActive:r??!1,running:!!t,awaitingUser:S,toolStatus:t?x:null,answer:t?void 0:ie,liveLine:t&&I(SP,{active:!!r||!ie,label:b,awaitingUser:S})}),T&&z(`div`,{className:`error-banner`,children:[I(ws,{size:14}),I(`span`,{children:C(ee&&ee.kind!==`unknown`?`failedTurn.${ee.kind}.title`:`msg.error`)})]}),(e.cards??i)?.map((e,t)=>I(hM,{render:e.render,data:e.data},t)),e.page_elements&&e.page_elements.length>0&&I(NN,{elements:e.page_elements}),f&&h?I(eF,{original:e.content,draft:p,onDraft:m,onSend:t=>we(()=>h(e,t)),onCancel:()=>{Ce(null),g?.()},confirming:Se!==null&&!t}):fe?z(P.Fragment,{children:[!me&&pe?z(`div`,{ref:N,id:M,className:`msg-excerpt md-content`,children:[I(`div`,{className:`msg-excerpt-lines`,dir:`auto`,children:pe.head}),I(`div`,{className:`msg-excerpt-gap`,children:C.plural(`msg.moreLines`,pe.hidden)}),I(`div`,{className:`msg-excerpt-lines`,dir:`auto`,children:pe.tail})]}):I(`div`,{ref:N,id:M,className:`msg-collapsible${me?``:` is-collapsed`}`,children:I(EF,{content:ie})}),I(cD,{expanded:me,onToggle:_e,controls:M,collapsedLabel:C.hint(C(`msg.showAll`),sD(C,e.content)),expandedLabel:C(`msg.showLess`),className:`msg-expand-toggle`})]}):ee?.raw?z(P.Fragment,{children:[I(`p`,{className:`msg-failed-lead`,children:C(`failedTurn.${ee.kind}.body`)}),z(`details`,{className:`msg-failed-details`,children:[I(`summary`,{children:C(`failedTurn.details`)}),I(EF,{content:ZN(ie)})]})]}):!(te&&ie.trim()===JP)&&I(EF,{content:ie,showCursor:t&&!!ie&&!r,isStreaming:t,writtenFiles:oe}),!f&&re&&I(nP,{images:re.images}),Se&&!t&&z(`div`,{className:`msg-drop-confirm`,role:`alertdialog`,"aria-labelledby":`${M}-drop`,children:[I(`span`,{id:`${M}-drop`,children:C.plural(`msg.dropLater`,_)}),z(`div`,{className:`msg-edit-actions`,children:[I(`button`,{type:`button`,className:`btn-secondary msg-edit-btn`,onClick:()=>Ce(null),autoFocus:!0,children:C(`msg.editCancel`)}),I(`button`,{type:`button`,className:`btn-primary msg-edit-btn`,onClick:()=>{Ce(null),Se()},children:C(`msg.dropLaterGo`)})]})]}),te&&z(`div`,{className:`msg-stopped${te===`unconfirmed`||e.stopError?` is-unconfirmed`:``}`,role:`note`,children:[I(vs,{size:9,fill:`currentColor`,"aria-hidden":`true`}),I(`span`,{children:te===`unconfirmed`?C(`msg.stoppedUnconfirmed`):e.stopError?C(`msg.stoppedError`,{error:e.stopError}):C(`msg.stopped`)})]}),ne&&I(`p`,{className:`msg-cut-off`,role:`note`,children:C.compose(e=>ne.tools?`${e(`msg.cutOff.toolsRan`,{tools:ne.tools})} ${e(ne.notice)}`:e(ne.notice))}),A&&I(`p`,{className:`msg-cut-off`,role:`note`,dir:`auto`,children:A}),l&&te&&!t&&ie.trim()&&ie.trim()!==JP&&z(`button`,{type:`button`,className:`msg-try-again`,onClick:l,children:[I(wo,{size:12,"aria-hidden":`true`}),C(`msg.continue`)]}),c&&!t&&z(`button`,{type:`button`,className:`msg-try-again`,onClick:c,children:[I(Bo,{size:12,"aria-hidden":`true`}),C(`msg.tryAgain`)]}),ee?.sections.map(e=>z(`button`,{type:`button`,className:`msg-try-again`,onClick:()=>{let t=ee?.targets[e];t?k({section:e,target:t}):O(e)},children:[I(Xo,{size:12,"aria-hidden":`true`}),C.compose(t=>t(`failedTurn.openSettings`,{tab:t(`settings.section.${e}`)}))]},e)),(T||A)&&!t&&OP(A??e.content)?z(`button`,{type:`button`,className:`msg-try-again`,onClick:()=>D(`agent`),children:[I(Wo,{size:12,"aria-hidden":`true`}),C(`logs.agentLog`)]}):(T||e.role===`assistant`&&EP(e.content))&&!t&&E?.remote===!1&&z(`button`,{type:`button`,className:`msg-try-again`,onClick:()=>D(`model_server`),children:[I(Wo,{size:12,"aria-hidden":`true`}),C(`logs.serverLog`)]}),e.role===`assistant`&&!t&&(SN(e.content)||SN(e.failureText??``))&&I(wN,{classes:kP,note:C(`msg.reportNote`)}),e.role===`assistant`&&!t&&QO(ie)&&I(ak,{content:ie}),e.role===`assistant`&&!t&&(e.stats||y!=null||e.created_at)&&z(`div`,{className:`msg-stats`,"aria-label":C(`msg.about`),children:[e.created_at&&I(`span`,{className:`msg-stats-ts`,title:KP(e.created_at,C),children:qP(e.created_at,C)}),e.stats?.retried&&e.stats.model&&I(`span`,{title:`This answer was kept from Retry with… (${e.stats.model})`,children:xc(e.stats.model)}),!e.stats?.retried&&e.stats?.route?.model&&I(`span`,{className:`msg-stats-route`,title:C(`msg.route`,{reason:e.stats.route.reason??``}),children:xc(e.stats.route.model)}),I(qk,{latencyMs:y,stats:e.stats,ended:QP(e.content,te,T||!!A)})]}),e.role===`assistant`&&!t&&e.stats?.route?.degraded&&e.stats.route.notice&&I(`div`,{className:`msg-route-notice`,role:`status`,children:e.stats.route.notice}),e.role===`assistant`&&!t&&e.id>0&&e.session_id&&I(WM,{sessionId:e.session_id,messageId:e.id}),e.role===`assistant`&&I(oN,{messageId:se}),e.role===`assistant`&&I(sN,{messageId:se})]})]})})}var rF=(0,V.createContext)(!1);function iF({lang:e,code:t}){let n=R(),[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(!1),s=(0,V.useContext)(rF),c=(0,V.useId)(),l=rD(t),u=l>(s?20:25),d=u&&!a,f=(0,V.useRef)(null);(0,V.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]);let p=(0,V.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)}i(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>i(!1),2e3)},[t]);return z(`div`,{className:`code-block${d?` is-collapsed`:``}`,dir:`ltr`,children:[z(`div`,{className:`code-header`,children:[I(`span`,{className:`code-lang`,children:e||`code`}),z(`button`,{className:`code-copy ${r?`copied`:``}`,onClick:p,title:n(r?`msg.copied`:`code.copy`),"aria-label":n(r?`msg.copiedAria`:`code.copyAria`),children:[I(r?Vr:hi,{size:13}),I(`span`,{children:n(r?`code.copied`:`code.copy`)})]})]}),I(`pre`,{id:c,children:I(`code`,{children:t})}),u&&I(cD,{expanded:a,onToggle:()=>o(e=>!e),controls:c,collapsedLabel:n(`code.expand`,{size:nD(n,l)}),expandedLabel:n(`code.collapse`),className:`code-expand-toggle`})]})}var aF=/(?<=["\u201c])[A-Z]:[\\/][^*?"<>|\r\n\u201c\u201d]+(?=["\u201d])|\b[A-Z]:[\\/](?=[^\s*?"<>|,;)}\]\\/])(?:[^\s*?"<>|,;)}\]\\/]+(?:(?: +(?:[^\s*?"<>|,;:)}\]\\/]+|\([^\s*?"<>|,;:)}\]\\/]+\)))+\\|[\\/]))*(?:(?:[^\s*?"<>|,;:.)}\]\\/]+ +){1,2}[^\s*?"<>|,;)}\]\\/]+\.[A-Za-z0-9]{1,5}\b|[^\s*?"<>|,;)}\]\\/]+)?/gi,oF=/[.:!']+$/,sF=RegExp(`^(?:${aF.source})$`,`i`),cF=(0,V.createContext)([]);function lF(e,t){if(typeof t!=`string`||e.length===0)return null;let n=t.trim();if(!n)return null;if(e.includes(n))return n;if(/[\\/]/.test(n))return null;let r=n.toLowerCase(),i=e.filter(e=>(e.split(/[\\/]/).pop()??``).toLowerCase()===r);return i.length===1?i[0]:null}function uF(e){if(typeof e!=`string`)return null;let t=e.trim();return sF.test(t)?t:null}function dF({path:e,label:t}){let n=t=>{t.preventDefault(),$t(e).catch(e=>{F.ui.error(`Failed to open path`,e)})};return z(`span`,{className:`file-path-link`,dir:`ltr`,onClick:n,title:`Open in file explorer: ${e}`,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(e))},children:[I($i,{size:12,className:`file-path-icon`}),t??e]})}function fF(e){return[...e.matchAll(new RegExp(aF.source,`gi`))].map(t=>{let n=t.index+t[0].length,r=`"“`.includes(e[t.index-1]??`
184
+ `)&&`"”`.includes(e[n]??`
185
+ `);return{start:t.index,path:r?t[0]:t[0].replace(oF,``)}})}function pF(e){let t=[],n=0;for(let{start:r,path:i}of fF(e))r>n&&t.push(e.slice(n,r)),t.push(I(dF,{path:i},r)),n=r+i.length;return t.length===0?e:(n<e.length&&t.push(e.slice(n)),I(P.Fragment,{children:t}))}var mF=(0,V.createContext)(fP([]));function hF({doc:e,page:t,t:n}){return z(`a`,{className:`citation-link`,href:qn(e.id,t),target:`_blank`,rel:`noopener noreferrer`,dir:`ltr`,title:t?n(`citation.openPage`,{page:t}):n(`citation.open`,{name:e.label}),"data-doc-id":e.id,"data-page":t,children:[I(Yi,{size:12,className:`citation-icon`,"aria-hidden":`true`}),e.label]})}function gF({doc:e,page:t,label:n,t:r}){return I(`a`,{className:`citation-page`,href:qn(e.id,t),target:`_blank`,rel:`noopener noreferrer`,title:r(`citation.openPage`,{page:t}),"data-doc-id":e.id,"data-page":t,children:n})}function _F(e,t){let n=mP(e,t)[0];return xP(n?t.slice(0,n.start):t)}function vF(e,t,n,r){let i=fF(e),a=mP(t,e).filter(e=>!i.some(t=>t.start<e.start&&e.start<t.start+t.path.length)),o=[],s=(t,r,i)=>{for(let a of r){let r=i+a.start,s=i+a.end;o.push({start:r,end:s,node:I(gF,{doc:t,page:a.page,label:e.slice(r,s),t:n},`p${r}`)})}};if(r&&s(r,xP(e.slice(0,a[0]?.start??e.length)),0),a.forEach((t,r)=>{let i=xP(e.slice(t.end,a[r+1]?.start??e.length));o.push({start:t.start,end:t.end,node:I(hF,{doc:t.doc,page:i[0]?.page,t:n},`c${t.start}`)}),s(t.doc,i,t.end)}),o.length===0)return pF(e);o.sort((e,t)=>e.start-t.start);let c=[],l=0;for(let t of o)t.start>l&&c.push(I(V.Fragment,{children:pF(e.slice(l,t.start))},`t${l}`)),c.push(t.node),l=t.end;return l<e.length&&c.push(I(V.Fragment,{children:pF(e.slice(l))},`t${l}`)),I(P.Fragment,{children:c})}function yF(e,t){return typeof t==`string`?pP(e,t):null}function bF({children:e}){let t=(0,V.useContext)(mF),n=R(),r=V.Children.toArray(e),i=null,a=r.map((e,a)=>{if(typeof e==`string`){let r=vF(e,t,n,i);return i=null,I(V.Fragment,{children:r},`s${a}`)}if(i=null,V.isValidElement(e)&&e.type===SF){let o=yF(t,e.props.children);if(o){let e=r[a+1],s=typeof e==`string`?_F(t,e):[];return i=o,I(hF,{doc:o,page:s[0]?.page,t:n},`k${a}`)}}return e});return I(P.Fragment,{children:a})}function xF({tex:e,display:t}){let n=(0,V.useMemo)(()=>PT.renderToString(e,{displayMode:t,throwOnError:!1,errorColor:`var(--danger)`}),[e,t]),r=(0,V.useRef)(null),[i,a]=(0,V.useState)(!1);return(0,V.useLayoutEffect)(()=>{let e=r.current;if(t||!e)return;let n=()=>{let t=e.firstElementChild,n=e.parentElement;for(;n&&n.clientWidth===0;)n=n.parentElement;t&&n&&a(t.getBoundingClientRect().width>n.clientWidth)};n();let i=e.closest(`.md-content`);if(!i||typeof ResizeObserver>`u`)return;let o=new ResizeObserver(n);return o.observe(i),()=>o.disconnect()},[n,t]),I(t?`div`:`span`,{ref:r,className:t?`md-math md-math-display`:i?`md-math md-math-wide`:`md-math`,dir:`ltr`,dangerouslySetInnerHTML:{__html:n}})}function SF({className:e,children:t,node:n,...r}){let i=(0,V.useContext)(mF),a=(0,V.useContext)(cF),o=R();if(e?.includes(`math-inline`))return I(xF,{tex:String(t),display:!1});let s=yF(i,t);if(s)return I(hF,{doc:s,t:o});let c=uF(t);if(c)return I(dF,{path:c});let l=lF(a,t);return l?I(dF,{path:l,label:String(t).trim()}):I(`code`,{className:`inline-code`,dir:`ltr`,...r,children:t})}var CF={code:SF,pre({children:e}){let t=V.Children.toArray(e)[0];if(V.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$/,``);if(n.includes(`math-display`))return I(xF,{tex:i,display:!0});let a=r?.[1]||``;return I(iF,{lang:a,code:i})}return I(`pre`,{dir:`ltr`,children:e})},table({children:e}){return I(`div`,{className:`md-table-wrap`,children:I(`table`,{className:`md-table`,dir:`auto`,children:e})})},a({href:e,children:t}){return I(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`md-link`,children:t})},p({children:e}){return I(`p`,{className:`md-p`,dir:`auto`,children:I(bF,{children:e})})},h1({children:e}){return I(`h2`,{className:`md-h2`,dir:`auto`,children:I(bF,{children:e})})},h2({children:e}){return I(`h3`,{className:`md-h3`,dir:`auto`,children:I(bF,{children:e})})},h3({children:e}){return I(`h4`,{className:`md-h4`,dir:`auto`,children:I(bF,{children:e})})},h4({children:e}){return I(`h5`,{className:`md-h4`,dir:`auto`,children:I(bF,{children:e})})},ul({children:e}){return I(`ul`,{className:`md-ul`,dir:`auto`,children:e})},ol({children:e,start:t}){return I(`ol`,{className:`md-ol`,start:t,dir:`auto`,children:e})},li({children:e,className:t}){return I(`li`,{className:t?`md-li ${t}`:`md-li`,dir:`auto`,children:I(bF,{children:e})})},blockquote({children:e}){return I(`blockquote`,{className:`md-blockquote`,dir:`auto`,children:I(bF,{children:e})})},hr(){return I(`hr`,{className:`md-hr`})},td({children:e,className:t,style:n}){return I(`td`,{className:t,style:n,children:I(bF,{children:e})})},th({children:e,className:t,style:n}){return I(`th`,{className:t,style:n,children:I(bF,{children:e})})}},wF=[],TF=[Bb,{singleDollarTextMath:!1}];function EF({content:e,showCursor:t,isStreaming:n=!1,writtenFiles:r=wF}){let i=B(e=>e.documents),a=(0,V.useMemo)(()=>fP(i),[i]),o=(0,V.useMemo)(()=>JT(e),[e]);return!e&&!t?null:!e&&t?I(`span`,{className:`cursor`}):I(rF.Provider,{value:n,children:I(mF.Provider,{value:a,children:I(cF.Provider,{value:r,children:z(`div`,{className:`md-content`,children:[I(h_,{remarkPlugins:[Ob,TF,eE,zT,VT],disallowedElements:[...b_],urlTransform:O_,components:CF,children:o}),t&&I(`span`,{className:`cursor`})]})})})})}var DF=()=>[...B.getState().messages].reverse().find(e=>e.role===`assistant`)?.id;function OF({busy:e}){let t=R(),[n,r]=(0,V.useState)({n:0,text:``}),i=(0,V.useRef)(DF());return(0,V.useEffect)(()=>{e&&(i.current=DF())},[e]),ku(e,()=>{let e=B.getState().messages,n=e[e.length-1];if(n?.role!==`assistant`||n.id===i.current||n.stopState===`stopped`&&!n.stopError)return;let a=n.failed===!0||AP(n.content);r(e=>({n:e.n+1,text:t(a?`live.replyFailed`:`live.replyReady`)}))}),I(`div`,{className:`turn-announcer`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:I(`span`,{children:n.text},n.n)})}function kF(e){return e.type===`status`&&e.status===`working`&&!e.phase&&(e.message??``).startsWith(`Model is processing`)}function AF(e){return e.phase===`loading_tools`?Ht()(`chat.loadingTools`):e.phase===`model_queue`&&e.queue?jF(e.queue):(e.message||``).trim()}function jF(e){let t=Ht(),n=String(Math.floor(e.waited_s??0));if(e.event===`granted`)return t(`chat.modelQueue.granted`,{seconds:n});let r=e.queue_length??1;return r>1&&e.position!=null?t(`chat.modelQueue.waitingInLine`,{position:String(e.position),length:String(r),seconds:n}):!e.holder&&e.scope!==`process`?t(`chat.modelQueue.priority`,{seconds:n}):t(`chat.modelQueue.waiting`,{seconds:n})}function MF(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`commentary`:return{id:n,type:`commentary`,label:`Commentary`,detail:e.content,active:!1,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`skill_use`:return{id:n,type:`tool`,label:`Using tool`,tool:`use_skill`,detail:e.skill,narration:`Using skill: ${e.skill}`,active:!1,success:!0,timestamp:r};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`,...e.status===`warning`?{success:!1}:{},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}}var NF=`speech_model_downloaded`,PF=new Set([`tool`,`waiting`]);function FF(e){return e.livePhase&&!PF.has(e.livePhase)?e.liveStatus:null}function IF(e,t){let n=B.getState(),r=e.status,i=AF(e);if(e.phase===`recording_found`&&e.section!=null){n.addRecordingSection({section:e.section,sections:e.sections??e.section,start:e.start??``,end:e.end??``,summary:e.summary??``,items:e.items??[]});return}if(e.phase===`recording`&&e.stage!=null){n.setRecordingStage(e.stage,{state:e.state??0,percent:e.percent,etaSeconds:e.eta_seconds});return}if(e.phase===NF&&i){let e={label:i,active:!1,success:!0,kept:!0},r=n.agentSteps[n.agentSteps.length-1];r&&r.type===`status`&&r.active?n.updateLastAgentStep({...e,detail:void 0}):n.addStepBeforeRunningCall({id:++t.current,type:`status`,timestamp:Date.now(),...e}),n.setLiveStatus(null);return}if(e.phase&&i&&n.setLiveStatus(i,e.phase),e.phase===`waiting`||kF(e)||i.toLowerCase().startsWith(`executing `)||r!==`working`&&r!==`warning`&&r!==`info`)return;let a=n.agentSteps[n.agentSteps.length-1];if(a&&a.type===`status`&&a.active&&r!==`warning`){n.updateLastAgentStep({label:i||`Working`,detail:i});return}if(a&&a.type===`thinking`&&a.active){n.updateLastAgentStep({label:i||`Thinking`});return}let o=MF({...e,message:i},t);o&&n.addAgentStep(o)}var LF=/\s*\{\s*"?(?:tool|thought|goal)"?\s*:\s*"[^"]*"[^}]*(?:"?tool_args"?\s*:\s*\{[^}]*\})?\s*\}/g;function RF(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,`
186
+ `).replace(/\\\\/g,`\\`)}function zF(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}function BF(e){let t=(e||[]).filter(e=>typeof e.render==`string`&&e.render.length>0).reduce((e,t)=>Qe(e,{render:t.render,data:t.data}),[]);return t.length>0?t:void 0}function VF(e){return(e||[]).map(e=>{let t=e.agentSteps||e.agent_steps||void 0;return{...e,agentSteps:t,cards:e.cards||BF(t),stats:e.stats||e.inference_stats||void 0,turnSummary:e.turnSummary||e.turn_summary||void 0,libraryNotices:e.libraryNotices||e.library_notices||void 0,stopState:e.stopState??(e.stopped?`stopped`:void 0)}})}function HF(e,t,n){let r=e.find(e=>e.id===n.id&&e.role===`user`);if(r)return r;let i=t.findIndex(e=>e.id===n.id);if(i<0)throw Error(`Message ${n.id} is no longer in this chat.`);let a=new Set(e.map(e=>e.id)),o=i-1;for(;o>=0&&!a.has(t[o].id);)o--;let s=o<0?0:e.findIndex(e=>e.id===t[o].id)+1,c=e.slice(s).filter(e=>e.role===`user`),l=0;for(let e of t.slice(o+1,i))e.role===`user`&&c[l]?.content===e.content&&l++;return c[l]?.content===n.content?c[l]:null}function UF(e,t){return!!e&&e.role===`assistant`&&!!t.failureText&&e.content.trim()===t.failureText.trim()}function WF(e,t,n){let r=e.slice(e.findIndex(e=>e.id===t.id)+1);return r.length===0||r.length===1&&(r[0].id===n.id||UF(r[0],n))}function GF(e,t,n){let r=new Set(t.map(e=>e.id)),i=new Set(e.map(e=>e.id)),a=e.filter(e=>!r.has(e.id));for(let e of t){if(i.has(e.id)||n.has(e.id))continue;let t=a.findIndex(t=>t.role===e.role&&t.content.trim()===e.content.trim());if(t<0)continue;let[r]=a.splice(t,1);n.set(e.id,n.get(r.id)??r.id)}}function KF(e,t){let n=e[e.length-1],r=t[t.length-1];if(!n?.failed||!UF(r,n))return t;let i=e=>[...e].reverse().find(e=>e.role===`user`)?.content;return i(e)===i(t)?[...t.slice(0,-1),{...r,failed:!0,failureText:n.failureText}]:t}function qF(e){return`policy-receipt-${encodeURIComponent(e)}`}function JF(e){let t=e.content.trim();return!t||e.stopState||e.failed||e.failure||AP(t)||QM(t,1e3).length===0?!1:!MP(e.agentSteps??[],t).echoed}function YF(){(0,V.useEffect)(()=>{let e=!0,t=async()=>{try{let t=await GM();e&&t&&iN.getState().setSettings(t)}catch(e){F.ui.error(`Could not load the read-aloud settings; replies will not be read automatically`,e)}};return t(),window.addEventListener(`focus`,t),()=>{e=!1,window.removeEventListener(`focus`,t)}},[])}var XF=[`download`,`decode`,`transcribe`,`voices`,`prepare`,`analyze`],ZF=0,QF=5;function $F(e,t){return e==null?``:e<60?t(`recording.leftUnderMinute`):t(`recording.leftMinutes`,{minutes:Math.ceil(e/60)})}function eI(e){return XF.map((e,t)=>t).filter(t=>t!==ZF&&t!==QF||t in e)}function tI({state:e}){return e===1?I(Vr,{size:14,"aria-hidden":`true`}):e===2?I(Ya,{size:14,"aria-hidden":`true`}):I(`span`,{className:`recording-progress-dot`,"aria-hidden":`true`})}function nI({index:e,stage:t}){let n=R(),r=n(`recording.stage.${XF[e]}`),i=t?.state===0,a=t?.percent,o=i?$F(t?.etaSeconds,n):``,s=t?.state===2?n(`recording.skipped`):o;return z(`li`,{className:`recording-progress-row${i?` is-running`:``}${t?``:` is-waiting`}${t?.state===1?` is-done`:``}`,children:[I(`span`,{className:`recording-progress-mark`,children:I(tI,{state:t?.state})}),I(`span`,{className:`recording-progress-label`,children:r}),i&&a!=null&&z(`bdi`,{className:`recording-progress-percent`,dir:`ltr`,children:[a,`%`]}),s&&I(`span`,{className:`recording-progress-left`,children:s}),i&&I(`div`,{className:`recording-progress-track${a==null?` is-indeterminate`:``}`,role:`progressbar`,"aria-label":r,"aria-valuemin":a==null?void 0:0,"aria-valuemax":a==null?void 0:100,"aria-valuenow":a??void 0,children:I(`div`,{className:`recording-progress-fill`,style:a==null?void 0:{inlineSize:`${a}%`}})})]})}var rI=120;function iI(e){let t=[];return Object.values(e).sort((e,t)=>e.section-t.section).map(e=>{let n=e.items.filter(e=>{let n=e.title.trim().toLowerCase(),r=t.some(t=>t.title===n&&Math.abs(t.seconds-e.seconds)<rI);return r||t.push({title:n,seconds:e.seconds}),!r});return{...e,items:n}})}function aI({sections:e}){let t=R(),n=iI(e),r=n[0]?.sections??0;return z(`section`,{className:`recording-found`,"aria-label":t(`recording.found.title`),children:[z(`h4`,{className:`recording-found-title`,children:[t(`recording.found.title`),I(`span`,{className:`recording-found-count`,children:t(`recording.found.count`,{done:n.length,total:r})})]}),n.map(e=>z(`div`,{className:`recording-found-section`,children:[z(`p`,{className:`recording-found-span`,children:[z(`bdi`,{dir:`ltr`,className:`recording-found-time`,children:[e.start,`–`,e.end]}),e.summary&&I(`span`,{dir:`auto`,children:e.summary})]}),e.items.length>0&&I(`ul`,{className:`recording-found-items`,children:e.items.map(e=>z(`li`,{children:[I(`bdi`,{dir:`ltr`,className:`recording-found-time`,children:e.start}),I(`span`,{dir:`auto`,children:e.title})]},`${e.seconds}-${e.title}`))})]},e.section))]})}function oI(){let e=R(),t=B(e=>e.recordingStages),n=B(e=>e.recordingSections);return t?z(`section`,{className:`recording-progress`,"aria-label":e(`recording.title`),children:[I(`ol`,{className:`recording-progress-list`,children:eI(t).map(e=>I(nI,{index:e,stage:t[e]},e))}),n&&I(aI,{sections:n})]}):null}function sI(e,t){let n=e.tool||``,r=e.tool_label||n,{addNotification:i,notifications:a}=_l.getState(),o=e.confirm_id?a.find(t=>t.id===e.confirm_id):void 0;if(o){!o.response&&o.dismissed&&_l.setState(e=>({notifications:e.notifications.map(e=>e.id===o.id?{...e,dismissed:!1}:e)}));return}let s=n===rl,c=s&&ml(a,t,e.args);i({id:e.confirm_id??`perm-${Date.now()}`,type:`permission_request`,agentId:t,sessionId:t,agentName:`GAIA`,title:s?ol(e.args,c):n===`trust_project_folder`?`Trust this folder's instructions and skills?`:`Allow ${r}?`,message:s?al(e.args,c):n===`trust_project_folder`?`GAIA would put this folder's CLAUDE.md, AGENTS.md and skills in the model's prompt, now and every time you work in it.`:`GAIA needs your OK before ${r}.`,timestamp:Date.now(),read:!1,dismissed:!1,priority:`high`,tool:n,toolArgs:e.args,confirmId:e.confirm_id,alwaysScope:typeof e.always_scope==`string`?e.always_scope:void 0,alwaysLabel:typeof e.always_label==`string`&&e.always_label?e.always_label:void 0,toolLabel:e.tool_label||void 0,risk:typeof e.risk==`string`?e.risk:void 0,summary:typeof e.summary==`string`&&e.summary?e.summary:void 0,pathFollowUp:c||void 0,timeoutSeconds:e.timeout_seconds,expiresAt:typeof e.expires_at==`number`?e.expires_at*1e3:void 0})}function cI(e,t,n){let r=e.tool||`unknown tool`,i=e.reason||e.message||e.content||`Tool execution was blocked by governance policy.`;return{id:e.receipt_id??n,type:`policy_alert`,agentId:t,agentName:`GAIA`,title:`Blocked: ${r} is restricted by policy.`,message:i,timestamp:Date.now(),read:!1,dismissed:!1,priority:`critical`,tool:r,decision:e.decision||`BLOCK`,reason:i,ruleIds:e.rule_ids??[],policyVersion:e.policy_version,receiptId:e.receipt_id}}function lI(e){let t=e.data&&typeof e.data==`object`?e.data:{};return(e.status??t.status)===`denied`?e.timed_out===!0||t.timed_out===!0?`timedOut`:(e.denied_by??t.denied_by)===`policy`?`refused`:(e.declined_by??t.declined_by)===`agent`?`autoDeclined`:`declined`:null}function uI(e){let t={result:e.summary||e.title||`Done`,active:!1,success:e.success!==!1,latencyMs:e.latency_ms},n=lI(e);n&&(t[n]=!0),e.command_output&&(t.commandOutput={command:e.command_output.command,stdout:e.command_output.stdout,stderr:e.command_output.stderr,returnCode:e.command_output.return_code,expectedExit:e.command_output.expected_exit,cwd:e.command_output.cwd,durationSeconds:e.command_output.duration_seconds,truncated:e.command_output.truncated}),e.mcp_output?.text&&(t.mcpOutput=e.mcp_output),e.result_data?.chunks&&e.result_data.chunks.length>0&&(t.retrievalChunks=e.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}))),e.result_data?.type===`file_list`&&e.result_data.files?.length>0&&(t.fileList={files:e.result_data.files,total:e.result_data.total??e.result_data.files.length});let r=e.data&&typeof e.data==`object`?e.data.needs_model:void 0;return(e.needs_model??r)===`vision`&&(t.needsModel=`vision`),t}var dI=5e3,fI=2e3,pI=3e4,mI=6e4;function hI(e){return e?.init_state===`initializing`?!e.init_tasks||e.init_tasks.some(e=>e.status===`pending`||e.status===`running`):!1}function gI(e){return e.lemonade_running?`up`:e.lemonade_error?`unresponsive`:`down`}function _I(e){return e.kind===`slow`||e.kind===`error`||e.kind===`ok`&&gI(e.status)===`unresponsive`}function vI(e){let t=e.kind===`ok`?e.status.download_progress?.state:void 0;return t===`downloading`||t===`starting`}function yI(e){let t=null,n=0,r=!1,i=null,a=null,o=!1,s=!1,c=()=>{o||!s||a||(a=setTimeout(()=>{a=null,f()},p()))},l=0,u=null,d=async()=>{let e={controller:new AbortController,cancelled:!1};u=e;let{controller:t}=e,n=setTimeout(()=>t.abort(),mI);try{return{kind:`ok`,status:await te(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),u===e&&(u=null)}},f=()=>{if(t)return t;let i=d().then(t=>{if(t!==null){n=_I(t)?n+1:0,r=vI(t),t.kind===`ok`?s=hI(t.status):t.kind===`unreachable`&&(s=!1),c();try{e(t)}catch(e){F.system.error(`Could not apply the system status; the next poll will try again`,e)}}}).finally(()=>{t===i&&(t=null)});return t=i,i},p=()=>Math.min((r?fI:dI)*2**n,pI),m=e=>{f().finally(()=>{e===l&&(i=setTimeout(()=>m(e),p()))})};return{check:f,start:()=>{let e=++l;return o=!0,a&&clearTimeout(a),a=null,m(e),()=>{e===l&&(l++,o=!1,c(),i&&clearTimeout(i),i=null,u&&(u.cancelled=!0,u.controller.abort(),u=null,t=null))}}}}var bI=1e3,xI=15e3,SI=null,CI=null,wI=bI,TI=0,EI=null;function DI(){if(SI)return SI;let e=Date.now();return SI=Mt().then(t=>B.getState().setActiveRuns(t,e)).catch(e=>{F.api.warn(`Could not read which chats are running`,e),xM(e)&&B.getState().loseActiveRuns()}).finally(()=>{SI=null}),SI}function OI(){let e=B.getState();return e.isStreaming||e.runningSessionIds.length>0}function kI(){return OI()?(wI=bI,bI):(wI=Math.min(wI*2,xI),wI)}function AI(e){DI().then(()=>{e===TI&&(CI=setTimeout(()=>AI(e),kI()))})}function jI(){EI&&(CI&&clearTimeout(CI),CI=null,wI=bI,AI(++TI))}function MI(){EI?.();let e=B.subscribe((e,t)=>{e.isStreaming&&!t.isStreaming&&jI()}),t=()=>jI();window.addEventListener(`focus`,t);let n=()=>{TI++,CI&&clearTimeout(CI),CI=null,e(),window.removeEventListener(`focus`,t),EI===n&&(EI=null)};return EI=n,wI=bI,AI(++TI),n}var NI=3e3,PI=new Set,FI=new Map,II=new Set,LI=null;function RI(e,t=Date.now()){FI.set(e,t)}function zI(e){let t=B.getState();return t.activeRunsAt>0&&t.activeRunsAt>=(FI.get(e)??0)&&!t.runningSessionIds.includes(e)&&!t.queuedSessionIds.includes(e)}function BI(e){return II.add(e),()=>{II.delete(e),LI?.()}}function VI(e){return e instanceof Error?pN(e)??(e.message||`Unknown error`):String(e)}function HI(e){let t=e?.httpStatus;return typeof t==`number`?t:void 0}function UI(e){let t=HI(e);return t===409||t===429}function WI(e){F.chat.warn(`Chat ${e} no longer exists; dropping its queued messages`),B.getState().updateQueue(e,()=>[])}function GI(e){B.getState().setQueueHold(e,!0),setTimeout(()=>B.getState().setQueueHold(e,!1),NI)}function KI(e,t,n){return HI(n)===409&&(F.chat.info(`Chat ${e} was busy; queueing the message to try again`),B.getState().updateQueue(e,e=>xt(e,t,`queued`)),GI(e),!0)}async function qI(e,t,n){let r=B.getState;if(PI.has(e)||r().queueHolds[e])return;let i=r().messageQueues[e]??[];if(i.some(e=>e.state===`sending`))return;let a=m(i);if(a||Hn(i)){PI.add(e);try{if(a){let t;try{t=await Tn(e)}catch(t){if(HI(t)===409){F.chat.info(`Chat ${e} is answering again; its queue waits for that turn to end`);return}if(HI(t)===404){WI(e);return}F.chat.error(`Could not learn what chat ${e}'s last reply did with the messages added to it`,t),r().updateQueue(e,e=>Gn(e,`GAIA could not say whether it read this message: ${VI(t)}`));return}r().updateQueue(e,e=>_(e,t))}let i=Hn(r().messageQueues[e]??[]);if(!i||!n())return;r().updateQueue(e,e=>b(e,i.id,`queued`,`starting`));let o;try{o=await t(e,i.text)}catch(e){o={kind:`failed`,error:VI(e)}}if(o.kind===`accepted`){RI(e),r().updateQueue(e,e=>we(e,i.id)),jI();return}if(o.kind===`busy`){F.chat.info(`Queued message found chat ${e} busy; holding it`),r().updateQueue(e,e=>He(e,i.id)),GI(e);return}if(o.kind===`gone`){WI(e);return}F.chat.error(`Queued message for chat ${e} was not sent: ${o.error}`),r().updateQueue(e,e=>He(e,i.id,o.error))}finally{PI.delete(e)}}}function JI(e){return e.type!==`status`||e.phase!==`waiting`}var YI=(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`});F.chat.info(`Sending queued message for chat ${e} in the background`),i=h(e,t,{onChunk:s,onAgentEvent:e=>{JI(e)&&s()},onDone:s,onError:e=>{uN(e)?s():UI(e)?o({kind:`busy`}):HI(e)===404?o({kind:`gone`}):o({kind:`failed`,error:VI(e)})}}),a&&i.abort()});function XI(e=YI){let t=()=>{let t=B.getState();if(!hI(t.systemStatus))for(let n of Object.keys(t.messageQueues))!II.has(n)&&zI(n)&&qI(n,e,()=>!II.has(n))},n=B.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 LI=t,t(),()=>{n(),LI===t&&(LI=null)}}var ZI=new Set([`.3g2`,`.3gp`,`.asf`,`.avi`,`.divx`,`.f4v`,`.flv`,`.m2ts`,`.m2v`,`.m4v`,`.mkv`,`.mov`,`.mp4`,`.mpeg`,`.mpg`,`.mts`,`.mxf`,`.ogv`,`.rm`,`.rmvb`,`.vob`,`.webm`,`.wmv`]),QI=new Set([`.aac`,`.ac3`,`.aif`,`.aiff`,`.amr`,`.ape`,`.au`,`.caf`,`.dts`,`.eac3`,`.flac`,`.m4a`,`.m4b`,`.mka`,`.mp2`,`.mp3`,`.oga`,`.ogg`,`.opus`,`.spx`,`.wav`,`.wma`,`.wv`]);function $I(e){let t=e.lastIndexOf(`.`);return t<0?``:e.slice(t).toLowerCase()}function eL(e){return ZI.has($I(e))}function tL(e){let t=$I(e);return ZI.has(t)||QI.has(t)}function nL(e){return e===`model_server_down`||e===`model_server_busy`}function rL(e,t){return e===`model_server_down`?t(`docs.serverDown`):e===`model_server_busy`?t(`docs.serverBusy`):null}function iL(e){return e===`model_server_down`}function aL(e,t,n){return e===`model_server_down`?n(`docs.notAddedServer`,{name:t}):e===`model_server_busy`?n(`docs.notAddedServerBusy`,{name:t}):null}var oL=`https://github.com/amd/gaia/issues/new`,sL=[{label:`Image`,extensions:new Set([`.ico`,`.heic`,`.heif`]),message:`This image format cannot be indexed.`,alternatives:[`Convert it to PNG or JPEG — GAIA reads the text in those images`],featureTitle:`Support HEIC and ICO image indexing`},{label:`Video`,extensions:ZI,message:`Video files can't go in the document library.`,alternatives:[`Attach the video to a chat, and GAIA will transcribe it`],featureTitle:`Support video files in the document library`},{label:`Audio`,extensions:QI,message:`Audio files can't go in the document library.`,alternatives:[`Attach the recording to a chat, and GAIA will transcribe it`],featureTitle:`Support audio files in the document library`},{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 cL(e){let t=e.toLowerCase().startsWith(`.`)?e.toLowerCase():`.${e.toLowerCase()}`;for(let e of sL)if(e.extensions.has(t))return e;return null}var lL=new Set(`.pdf,.pptx,.docx,.epub,.png,.jpg,.jpeg,.webp,.bmp,.gif,.tif,.tiff,.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 uL(e){let t=e.toLowerCase().startsWith(`.`)?e.toLowerCase():`.${e.toLowerCase()}`;return lL.has(t)}function dL(){let e=navigator.userAgent;return`**Environment:**\n- GAIA Version: 0.27.0rc2\n- Platform: ${navigator.platform||`unknown`}\n- User Agent: ${e}\n- Interface: Agent UI (Web)`}function fL(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?_`,``,`---`,dL(),``,`_Submitted from GAIA Agent UI_`].join(`
187
+ `);return`${oL}?${new URLSearchParams({title:`[Feature] ${e}`,body:n,labels:`enhancement,agent-ui`}).toString()}`}function pL(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?_`,``,`---`,dL(),``,`_Submitted from GAIA Agent UI_`].join(`
188
+ `);return`${oL}?${new URLSearchParams({title:`[Bug] ${e}`,body:n,labels:`bug,agent-ui`}).toString()}`}var mL={corrupted:`The file looks damaged. Re-download or re-export it, then add the new copy.`,encrypted:`The PDF needs a password to open. Save a copy without the password, then add that.`,empty:`The PDF has no readable text, which usually means it is a scan. Run OCR on it, then add it again.`,empty_file:`This file is empty. Add content to it, then add it again.`,unsupported_workbook:`This is an old .xls workbook or has a password. Open it in Excel, save a copy as .xlsx without a password, then add that.`};function hL(e,t){if(!e.startsWith(t))return e;let n=e.slice(t.length).trim();return n.charAt(0).toUpperCase()+n.slice(1)}function gL({filename:e,error:t,status:n,kind:r,onDismiss:i,timeout:a=15e3}){let o=R(),s=(0,V.useRef)(null);(0,V.useEffect)(()=>(a>0&&(s.current=setTimeout(i,a)),()=>{s.current&&clearTimeout(s.current)}),[i,a]);let c=e.includes(`.`)?`.`+e.split(`.`).pop()?.toLowerCase():``,l=c?cL(c):null,u=t.toLowerCase().includes(`unsupported file type`)||t.toLowerCase().includes(`not supported for indexing`)||t.toLowerCase().includes(`file type not allowed`)||l!==null,d=t.toLowerCase().includes(`fetch`)||t.toLowerCase().includes(`network`)||t.toLowerCase().includes(`connect`),f,p,m,h=ri,g=r?mL[r]:void 0;return g?(f=`"${e}" can't be read`,p=g,m=null,h=ws):rL(r,o)?(f=aL(r,e,o)??o(`docs.notAddedServer`,{name:e}),p=rL(r,o)??t,m=null,h=ws):r===`too_large`?(f=o(`docs.tooLarge`,{name:e}),p=t,m=null,h=ws):n===404?(f=o(`docs.notFound`,{name:e}),p=o(`docs.notFoundDetail`),m=null,h=ws):n===403?(f=`GAIA can't read files in that location`,p=`${t} Or drop the file here instead (up to 20 MB) and GAIA keeps its own copy.`,m=null,h=ws):u&&l?(f=`${l.label} files not supported`,p=l.message,m=fL(l.featureTitle),h=ws):u&&!c?(f=`"${e}" has no file extension`,p=hL(t,`File type not allowed:`),m=null,h=ws):u?(f=`File type not supported: ${c}`,p=`This file format cannot be indexed. Supported: PDF, DOCX, PPTX, XLSX, EPUB, images (PNG, JPG, WEBP, ...), TXT, MD, CSV, JSON, HTML, XML, YAML, and 30+ code file formats.`,m=fL(`Support ${c} file indexing`),h=ws):d?(f=`Connection error`,p=`Could not reach the GAIA server. Make sure the backend is running.`,m=pL(`Upload connection error for ${e}`),h=ri):(f=`Failed to index "${e}"`,p=t||`An unexpected error occurred during indexing.`,m=pL(`Indexing error: ${t.slice(0,80)}`),h=jr),z(`div`,{className:`upload-error-toast`,role:`alert`,children:[I(h,{size:16}),z(`div`,{className:`upload-error-content`,children:[I(`div`,{className:`upload-error-title`,children:f}),z(`div`,{className:`upload-error-detail`,children:[p,m&&` `,m===null?null:u?I(`a`,{href:m,target:`_blank`,rel:`noopener noreferrer`,children:`Request this feature →`}):I(`a`,{href:m,target:`_blank`,rel:`noopener noreferrer`,children:`Report this issue →`})]})]}),I(`button`,{className:`upload-error-dismiss`,onClick:i,"aria-label":`Dismiss`,children:I(Is,{size:14})})]})}function _L(e,t,n=[],r=[],i={}){let a=vL(t,r,i);if(n.length>0)return n.some(a);let o=$O(e);return o===`google`?a(`google`):o===`microsoft`?a(`microsoft`):a(`google`)||a(`microsoft`)}function vL(e,t,n){return r=>MO(e.find(e=>e.id===r),t.find(e=>e.id===r),n[r])}function yL(e,t,n=[],r=[],i={}){let a=vL(t,r,i),o=n.find(a);if(o){let e=t.find(e=>e.id===o&&!(`error`in e));return e&&!(`error`in e)?e.display_name:o}let s=$O(e);return s===`google`?`Google`:s===`microsoft`?`Microsoft`:a(`google`)?`Google`:a(`microsoft`)?`Microsoft`:`Google`}function bL({content:e,providers:t=[],accounts:n,onRetry:r}){let i=R(),[a,o]=(0,V.useState)([]),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(!1),d=(0,V.useCallback)(()=>{S().then(e=>{let t=e.connectors||[];o(t),c(e=>e??t)}).catch(e=>F.ui.warn(`ConnectorRetryBanner: connector fetch failed`,e))},[]),f=s!==null&&_L(e,a,t,s,n);if((0,V.useEffect)(()=>{d();let e=()=>d();return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[d]),aA(!f,d),!f||l)return null;let p=yL(e,a,t,s??[],n);return z(`div`,{className:`connector-retry-banner`,role:`status`,children:[I(ti,{size:14,className:`connector-retry-banner__icon`}),I(`span`,{className:`connector-retry-banner__text`,children:i(`retryBanner.connected`,{name:p})}),z(`button`,{type:`button`,className:`connector-retry-banner__btn`,onClick:()=>{u(!0),r()},children:[I(Po,{size:12}),I(`span`,{children:i(`retryBanner.askAgain`)})]}),I(`button`,{type:`button`,className:`connector-retry-banner__dismiss`,onClick:()=>u(!0),"aria-label":i(`retryBanner.dismiss`),children:`×`})]})}function xL(e,t=32){let n=Array.from(e);if(n.length<=t)return e;let r=Array.from(/\.[^.\s]{1,8}$/.exec(e)?.[0]??``).length,i=Math.min(Math.max(Math.ceil(t*.45),r+4),t-2);return`${n.slice(0,t-i-1).join(``)}…${n.slice(-i).join(``)}`}function SL(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 CL(e){return e.replace(/-/g,``).slice(0,7)}function wL(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 TL(e,t){return e.key===`ArrowUp`&&!e.shiftKey&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.nativeEvent?.isComposing&&t===``}function EL(e){for(let t=e.length-1;t>=0;t--)if(e[t].role===`user`)return e[t]}function DL(e,t){for(let n=t+1;n<e.length;n++)if(e[n].role===`user`)return e.length-n;return 0}var OL=/^\/[a-z0-9-]*$/i;function kL(e){let t=OL.test(e),[n,r]=(0,V.useState)([]),[i,a]=(0,V.useState)(`loading`),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(0),[u,d]=(0,V.useState)(null);(0,V.useEffect)(()=>{if(!t)return;let e=!0;return a(e=>e===`ready`?e:`loading`),Ut().then(t=>{e&&(r(t.skills),a(`ready`),s(null))},t=>{e&&(a(`error`),s(t instanceof Error?t.message:String(t)))}),()=>{e=!1}},[t]),(0,V.useEffect)(()=>{l(0)},[e]);let f=e.toLowerCase(),p=t?n.filter(e=>`/${e.name}`.startsWith(f)):[],m=t&&u!==e&&(i!==`ready`||p.length>0),h=(0,V.useCallback)(e=>l(e),[]),g=(0,V.useCallback)(()=>d(e),[e]);return{open:m,status:i,error:o,matches:p,selected:Math.min(c,Math.max(p.length-1,0)),select:h,dismiss:g}}var AL=`composer-skill-menu`;function jL(e){return`${AL}-${e}`}function ML(e){let t=e.replace(/\s+/g,` `).trim(),n=t.indexOf(`. `);return n>=0?t.slice(0,n+1):t}function NL({menu:e,onPick:t}){let n=R();return e.open?e.status===`ready`?z(`div`,{className:`skill-menu`,children:[I(`p`,{className:`skill-menu-title`,children:n(`composer.skillsTitle`)}),I(`ul`,{id:AL,role:`listbox`,"aria-label":n(`composer.skillsTitle`),children:e.matches.map((n,r)=>z(`li`,{id:jL(r),role:`option`,"aria-selected":r===e.selected,className:`skill-menu-row${r===e.selected?` is-selected`:``}`,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>e.select(r),onClick:()=>t(n.name),children:[z(`span`,{className:`skill-menu-name`,dir:`ltr`,children:[`/`,n.name]}),I(`span`,{className:`skill-menu-desc`,dir:`auto`,children:ML(n.description)})]},n.name))})]}):I(`div`,{className:`skill-menu`,role:e.status===`error`?`alert`:`status`,children:I(`p`,{className:`skill-menu-note`,children:e.status===`error`?n(`composer.skillsFailed`,{error:e.error??``}):n(`composer.skillsLoading`)})}):null}function PL(e){return e.isMedia?eL(e.name)?qi:Vi:Yi}var FL=240,IL=1e5;function LL({value:e,onChange:t,onSubmit:n,onStop:r,streaming:i=!1,stopping:a=!1,queueWhileStreaming:o=!1,answering:s=!1,disabledReason:c,attachments:l,placeholder:u,autoFocus:d,inputRef:f,leftControls:p,rightControls:m,onEditLast:h}){let g=R(),_=(0,V.useRef)(null),v=f??_,y=(0,V.useRef)(null),b=!!c,x=e.trim().length>0||l.hasUploaded,S=l.compose(e.trim()).length,C=S>IL,w=MN(i),T=l.attachments.filter(e=>e.error).map(e=>e.name).join(`, `),E=!b&&(!i||o)&&!l.uploading&&x&&!C&&!T&&!w,D=c||u||g(`composer.placeholder`),O=kL(b?``:e),k=(0,V.useCallback)(e=>{t(`/${e} `),v.current?.focus()},[t,v]);(0,V.useLayoutEffect)(()=>{let e=v.current;if(!e)return;let t=()=>{e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,FL)}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,D,v]);let ee=(0,V.useCallback)(t=>{if(O.open&&!t.nativeEvent.isComposing){let{matches:n,selected:r}=O;if(t.key===`Escape`){t.preventDefault(),O.dismiss();return}if(n.length>0&&(t.key===`ArrowDown`||t.key===`ArrowUp`)){t.preventDefault();let e=t.key===`ArrowDown`?1:-1;O.select((r+e+n.length)%n.length);return}let i=n[r]?.name,a=i!==void 0&&e.toLowerCase()===`/${i}`;if(i&&(t.key===`Tab`||t.key===`Enter`&&!t.shiftKey&&!a)){t.preventDefault(),k(i);return}}h&&TL(t,e)?(t.preventDefault(),h()):t.key===`Enter`&&!t.shiftKey&&!t.nativeEvent.isComposing&&(t.preventDefault(),E&&n())},[E,n,h,e,O,k]),te=(0,V.useCallback)(e=>{e.dataTransfer?.files?.length&&(e.preventDefault(),e.stopPropagation(),l.addFiles(Array.from(e.dataTransfer.files)))},[l]);return z(`div`,{className:`composer${b?` composer-disabled`:``}`,onDrop:te,onDragOver:e=>{e.dataTransfer?.types?.includes(`Files`)&&e.preventDefault()},children:[I(jN,{}),l.attachments.length>0&&I(`ul`,{className:`composer-attachments`,"aria-label":g(`composer.attached`),children:l.attachments.map(e=>{let t=PL(e);return z(`li`,{title:e.isImage&&e.url?e.name:void 0,className:`composer-attachment${e.error?` has-error`:``}${e.isMedia?` is-media`:``}${e.isImage&&e.url?` is-image`:``}`,children:[e.isImage&&e.url?I(`img`,{src:e.url,alt:``,className:`composer-attachment-thumb`}):I(t,{size:14,"aria-hidden":`true`}),I(`span`,{className:`composer-attachment-name`,title:e.name,dir:`ltr`,children:xL(e.name)}),e.uploading&&I(`span`,{className:`composer-attachment-state`,children:e.progress===void 0?g(`composer.uploading`):g(`composer.uploadingPercent`,{percent:e.progress})}),e.uploaded&&e.isMedia&&I(`span`,{className:`composer-attachment-state`,children:g(`composer.mediaReady`)}),e.error&&I(`span`,{className:`composer-attachment-state`,role:`alert`,title:e.error,children:e.error}),I(`button`,{type:`button`,className:`composer-icon-btn`,onClick:()=>l.remove(e.id),"aria-label":g(`composer.remove`,{name:e.name}),children:I(Is,{size:12})})]},e.id)})}),I(NL,{menu:O,onPick:k}),I(`textarea`,{ref:v,className:`composer-input`,value:e,onChange:e=>t(e.target.value),onKeyDown:ee,onPaste:e=>{l.handlePaste(e)},placeholder:D,rows:1,disabled:b,autoFocus:d,"aria-label":g(`composer.message`),"aria-autocomplete":`list`,"aria-expanded":O.open&&O.matches.length>0,"aria-controls":O.open&&O.matches.length>0?AL:void 0,"aria-activedescendant":O.open&&O.matches.length>0?jL(O.selected):void 0,dir:`auto`}),C&&z(`p`,{className:`composer-limit-error`,role:`alert`,children:[g(`composer.tooLong`,{sent:S.toLocaleString(),max:1e5.toLocaleString()}),` `,g(`composer.tooLongHint`)]}),T&&x&&I(`p`,{className:`composer-limit-error`,role:`alert`,children:g(`composer.removeRefused`,{names:T})}),z(`div`,{className:`composer-row`,children:[z(`div`,{className:`composer-row-left`,children:[I(`button`,{type:`button`,className:`composer-icon-btn`,onClick:()=>y.current?.click(),disabled:b,"aria-label":g(`composer.attach`),title:g(`composer.attach`),children:I(Oo,{size:16})}),I(`input`,{ref:y,type:`file`,multiple:!0,hidden:!0,onChange:e=>{e.target.files&&l.addFiles(Array.from(e.target.files)),e.target.value=``}}),p]}),z(`div`,{className:`composer-row-right`,children:[m,i&&o&&x&&I(`button`,{type:`button`,className:`composer-send`,onClick:n,disabled:!E,"aria-label":g(s?`composer.sendAnswer`:`composer.queue`),title:s?g(`composer.sendAnswerTitle`):w??g(`composer.queueTitle`),children:I(yr,{size:16})}),i?I(`button`,{type:`button`,className:`composer-send is-stop`,onClick:r,disabled:a,"aria-label":g(`composer.stop`),title:a?g(`composer.stopping`):g.hint(g(`composer.stop`),`Esc`),children:I(vs,{size:12,fill:`currentColor`})}):I(`button`,{type:`button`,className:`composer-send`,onClick:n,disabled:!E,"aria-label":g(`composer.send`),title:w??g.hint(g(`composer.send`),`Enter`),children:I(yr,{size:16})})]})]})]})}var RL=8,zL=8;function BL({label:e,warning:t,children:n,id:r,pinned:i=!1,onUnpin:a,tabIndex:o}){let s=(0,V.useId)(),c=r??s,l=(0,V.useRef)(null),u=(0,V.useRef)(null),[d,f]=(0,V.useState)(!1),p=d||i,[m,h]=(0,V.useState)(null);return(0,V.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+RL+t.width<=r-zL?(a=n.right+RL,o=e.top+e.height/2-t.height/2):n.left-RL-t.width>=zL?(a=n.left-RL-t.width,o=e.top+e.height/2-t.height/2):(a=Math.min(Math.max(zL,e.right-t.width),r-zL-t.width),o=e.top-RL-t.height>=zL?e.top-RL-t.height:e.bottom+RL),o=Math.min(Math.max(zL,o),i-zL-t.height),h({left:a,top:o})},[p]),(0,V.useEffect)(()=>{if(!p)return;let e=()=>{f(!1),a?.()};return window.addEventListener(`scroll`,e,!0),()=>window.removeEventListener(`scroll`,e,!0)},[p,a]),z(P.Fragment,{children:[I(`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:I(ya,{size:13,"aria-hidden":`true`})}),p&&(0,Mj.createPortal)(I(`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 VL(e){return e<.1?`$${e.toFixed(3)}`:`$${e.toFixed(2)}`}function HL(e,t=gt){return e?t(`settings.price.perMillion`,{input:VL(e.input_per_million),output:VL(e.output_per_million)}):t(`settings.price.unknown`)}function UL(e){return`$${e.toFixed(2)}`}function WL(e,t,n,r=!1){return!ae(t)||gt(t)!==n?n:r?e.bare(t):e(t)}function GL(e,t){return WL(e,`providers.${t.id}.name`,t.name,!0)}function KL(e,t){return WL(e,`providers.${t.id}.notice`,t.privacy_notice)}var qL=2e3,JL=`waiting_for_os_permission`,YL=`store_locked`,XL=5;function ZL(e,t){let n=e.rank?`#${e.rank} ${e.note??``}`.trim():null;return t?[n,HL(e.price)].filter(e=>!!e):[Mc(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,e.custom?`added by you`:null].filter(e=>!!e)}function QL(e,t){return!bc(t,e.id)&&(Fc(e)||Pc(e)===`not_downloaded`)}function $L(e,t,n){let r=e=>e.provider.id===t?0:1;return[...e].sort((e,t)=>r(e)-r(t)).map(e=>e.provider.remote?e:{...e,models:[...e.models].sort((e,t)=>Number(QL(e,n))-Number(QL(t,n)))})}function eR({m:e,onDownload:t,busy:n}){let r=R();if(Fc(e)){let t=Math.round(e.download_progress?.percent??0);return z(`span`,{className:`model-state is-downloading`,title:`Downloading, ${t}%`,children:[I(La,{size:12,className:`spin`,"aria-hidden":`true`}),` `,t,`%`]})}let i=Pc(e);return i===`not_downloaded`?I(`button`,{type:`button`,className:`model-state-btn`,onClick:e=>{e.stopPropagation(),t()},disabled:n,"aria-label":r(`modelMenu.downloadModel`,{name:e.display_name??e.id}),title:e.size_gb?`${jc.not_downloaded} (${e.size_gb} GB)`:jc.not_downloaded,tabIndex:-1,children:I(Ci,{size:13,"aria-hidden":`true`})}):i===`loaded`?I(`span`,{className:`model-state is-loaded`,role:`img`,"aria-label":jc.loaded,title:jc.loaded}):I(`span`,{className:`model-state is-ready`,title:jc.downloaded,children:r(`modelMenu.ready`)})}function tR(){let e=R(),t=_c(e=>e.active),n=_c(e=>e.select),r=_c(e=>e.queued),i=r??t?.model,a=_c(e=>e.queue),o=_c(e=>e.queueError),s=_c(e=>e.rememberNames);_c(e=>e.names);let c=Tc(),l=B(e=>Ec(t,e.sessions,e.currentSessionId)),u=B(e=>e.isStreaming),d=B(e=>e.openSettings),f=(0,V.useRef)(null),[p,m]=(0,V.useState)(!1),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(0),[x,S]=(0,V.useState)(null),[C,w]=(0,V.useState)(null),[T,E]=(0,V.useState)(null),[D,O]=(0,V.useState)(null),[k,ee]=(0,V.useState)(null),[te,ne]=(0,V.useState)(null),[A,re]=(0,V.useState)(0),[ie,ae]=(0,V.useState)(null),j=(0,V.useRef)(0),oe=(0,V.useRef)(null),se=(0,V.useId)(),ce=(0,V.useRef)(null),le=(0,V.useRef)(null),[ue,de]=(0,V.useState)(null),[fe,pe]=(0,V.useState)(null),me=(0,V.useCallback)(()=>pe(null),[]),he=(0,V.useCallback)(()=>m(!1),[]),M=(0,V.useRef)(!1),N=(0,V.useRef)(null),ge=(0,V.useCallback)(async(t=!1)=>{t||(M.current=!1,S(null),g(null));try{let{providers:n,lemonade_error:r}=await cn();if(r)throw Error(r);let i=n.filter(e=>!e.remote||e.models_discovered||e.id===`fireworks`||e.registered),a=await Promise.all(i.map(async t=>{if(t.blocked)return{provider:t,models:[],error:e(`settings.privacy.localOnlyBlocked`)};if(t.remote&&!t.models_discovered)return{provider:t,models:[]};try{let n=await Nn(t.id);return{provider:t,models:n.models,error:n.blocked?e(`settings.privacy.localOnlyBlocked`):void 0}}catch(e){return{provider:t,models:[],error:CM(e)}}}));s(a.flatMap(e=>e.models)),b(a.flatMap(e=>e.models).filter(e=>e.available===!1).length),t||(M.current=!0),g(a.map(e=>({...e,models:e.models.filter(e=>e.available!==!1)})))}catch(e){S(CM(e))}},[s,e]),_e=(0,V.useCallback)(async()=>{try{await Jn()}catch(e){S(CM(e));return}await ge(!0)},[ge]);(0,V.useEffect)(()=>{p&&(w(null),E(null),v(!1),de(null),pe(null),ge())},[p,ge]),(0,V.useEffect)(()=>{if(!p||!h||!M.current)return;let e=ce.current?.querySelector(`[role="option"][tabindex="0"]`);e&&(M.current=!1,e.focus(),e.scrollIntoView?.({block:`nearest`}))},[p,h]),(0,V.useEffect)(()=>{let e=N.current;if(!p||!h||!e||!_)return;let t=h.find(t=>t.provider.id===e)?.models.find(e=>e.rank===null&&!bc(i,e.id));if(!t)return;let n=Array.from(ce.current?.querySelectorAll(`[role="option"]`)??[]).find(e=>e.dataset.row===t.id);n&&(N.current=null,de(t.id),n.focus(),n.scrollIntoView?.({block:`nearest`}))},[p,h,_,i]),(0,V.useEffect)(()=>{(C||T)&&le.current?.scrollIntoView?.({block:`nearest`})},[C,T]);let ve=e=>{if(e.altKey||e.ctrlKey||e.metaKey)return;let t=Array.from(ce.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(),pe(t=>e.key===`i`&&t===r?null:r);return}case`ArrowLeft`:e.preventDefault(),pe(null);return;default:return}e.preventDefault(),t[r].focus(),t[r].scrollIntoView?.({block:`nearest`})},ye=!!h?.some(e=>e.models.some(Fc)),be=!!h?.some(e=>e.provider.key_state===JL);(0,V.useEffect)(()=>{if(!(p||te)||!(ye||te||be))return;let e=setInterval(()=>{ge(!0)},qL);return()=>clearInterval(e)},[p,ye,te,be,ge]);let xe=(0,V.useCallback)(async e=>{ee(e),re(e=>e+1),S(null);try{await Ve(e),await ge(!0)}catch(t){ne(t=>t?.model===e?null:t),S(CM(t))}finally{ee(null),re(e=>e-1)}},[ge]),Se=(0,V.useCallback)((e,t,n)=>{E(null),n&&(j.current=0,ae(null),ne({model:e,provider:t})),xe(e)},[xe]),Ce=(0,V.useCallback)(async(e,r)=>{if(r.remote&&!t?.remote&&C?.model!==e)return w({model:e,provider:r}),null;if(w(null),u)return a(e===t?.model?null:e),m(!1),null;O(e),S(null);try{return await n(e),ae(null),m(!1),null}catch(e){let t=CM(e);return S(t),t}finally{O(null)}},[t?.model,t?.remote,C,a,n,u]);(0,V.useEffect)(()=>{if(!te||!h||A>0)return;let{model:e,provider:t}=te,n=()=>(oe.current!==h&&(oe.current=h,j.current+=1),j.current>=XL),r=h.flatMap(e=>e.models).find(t=>t.id===e);if(!r){if(!n())return;ne(null),ae(`${xc(e)} is no longer in the model list, so it wasn't switched to.`);return}if(Fc(r)){j.current=0;return}let i=r.download_progress;if(i?.state===`error`)ne(null),ae(`Downloading ${xc(e)} failed: ${i.message??`no reason given`}`);else if(i?.state!==`complete`&&Pc(r)===`not_downloaded`){if(!n())return;ne(null),ae(`The download of ${xc(e)} never started. Try the download button again.`)}else ne(null),Ce(e,t).then(t=>{t&&ae(`${xc(e)} downloaded, but switching to it failed: ${t}`)})},[h,te,A,Ce]);let we=(e,t)=>e.id===`fireworks`&&!_&&t.some(e=>e.rank!==null),Te=(e,t)=>we(e,t)?t.filter(e=>e.rank!==null||bc(i,e.id)):t,Ee=(e,t)=>we(e,t)&&t.some(e=>e.rank===null&&!bc(i,e.id)),De=h?.flatMap(({provider:e,models:t})=>[...e.remote&&!e.models_discovered?[`key:${e.id}`]:[],...Te(e,t).filter(e=>D===null&&!Fc(e)).map(e=>e.id),...Ee(e,t)?[`showall:${e.id}`]:[]])??[],Oe=ue&&De.includes(ue)?ue:i&&De.includes(i)?i:De[0],ke=e=>({role:`option`,tabIndex:e===Oe?0:-1,"data-row":e,onFocus:()=>de(e),onBlur:()=>pe(null)}),Ae=c?.remote?pi:c?yi:ai,je=l?xc(l):`Model`,Me=`${je}${c?` · ${c.label}`:``}`,Ne=Object.fromEntries((h??[]).map(e=>[e.provider.id,kc(e.models)])),Pe=h&&$L(h,t?.provider,i),Fe=t?.downloaded===!1&&l===t.model,Ie=ie||o||(r?`${xc(r)} is used from your next message.`:t?.config_error?t.config_error:Fe?`${je} isn't downloaded yet. Open the list to download it.`:c?c.description?.replace(/`/g,``)??(c.remote?e(`modelStatus.runsRemote`,{name:c.label}):e(`modelStatus.runsHere`)):wc);return z(`div`,{className:`composer-chip-wrap`,children:[z(`button`,{ref:f,type:`button`,className:`composer-chip${Fe||o||ie?` is-warning`:``}`,onClick:()=>m(e=>!e),"aria-haspopup":`dialog`,"aria-expanded":p,title:Ie,children:[I(Ae,{size:13,"aria-hidden":`true`}),I(`span`,{className:`composer-chip-label`,dir:`auto`,children:Me}),r&&z(`span`,{className:`composer-chip-next`,children:[`→ `,xc(r),` next`]}),Fe&&I(Ci,{size:12,"aria-label":`Not downloaded`}),ie&&I(ri,{size:12,"aria-label":`Model switch failed`}),I(Gr,{size:12,"aria-hidden":`true`})]}),z(Gs,{open:p,onClose:he,anchor:f,label:e(`modelMenu.label`),align:`end`,className:`model-menu`,children:[u&&I(`div`,{className:`popover-message`,role:`status`,children:l?e(`modelMenu.keepsModel`,{model:xc(l)}):e(`modelMenu.keepsItsModel`)}),ie&&I(`div`,{className:`popover-message is-error`,role:`alert`,children:ie}),o&&I(`div`,{className:`popover-message is-error`,role:`alert`,children:o}),x&&I(`div`,{className:`popover-message is-error`,role:`alert`,children:x}),!h&&!x&&z(`div`,{className:`popover-message`,children:[I(La,{size:13,className:`spin`}),` `,e(`modelMenu.loading`)]}),h&&I(`div`,{ref:ce,role:`listbox`,"aria-label":e(`modelMenu.models`),onKeyDown:ve,children:Pe.map(({provider:n,models:a,error:o})=>z(`div`,{role:`group`,"aria-labelledby":`${se}-${n.id}`,children:[I(`div`,{className:`popover-heading`,id:`${se}-${n.id}`,children:GL(e,n)}),o&&I(`div`,{className:`popover-message is-error`,children:o}),n.key_state===JL?z(`div`,{className:`popover-message`,role:`status`,children:[I(La,{size:13,className:`spin`,"aria-hidden":`true`}),` `,n.key_message]}):n.key_state===YL?z(`button`,{type:`button`,className:`popover-item`,...ke(`unlock:${n.id}`),"aria-selected":!1,onClick:()=>void _e(),children:[I(`span`,{className:`popover-item-check`,children:I(xa,{size:13,"aria-hidden":`true`})}),z(`span`,{className:`popover-item-body`,children:[I(`span`,{className:`popover-item-title`,children:e(`settings.key.unlockAgain`)}),I(`span`,{className:`popover-item-note`,children:e(`settings.key.storeLocked`)})]})]}):n.remote&&!n.models_discovered&&z(`button`,{type:`button`,className:`popover-item`,...ke(`key:${n.id}`),"aria-selected":!1,onClick:()=>{m(!1),d(`model`,n.id)},children:[I(`span`,{className:`popover-item-check`,children:I(xa,{size:13,"aria-hidden":`true`})}),z(`span`,{className:`popover-item-body`,children:[I(`span`,{className:`popover-item-title`,children:e(`modelMenu.addKey`)}),I(`span`,{className:`popover-item-note`,children:e(`modelMenu.connectInSettings`,{provider:n.name})})]})]}),!o&&a.length===0&&n.models_discovered!==!1&&I(`div`,{className:`popover-message`,children:e(`modelMenu.noModels`)}),Te(n,a).map((a,o,s)=>{let c=!n.remote&&QL(a,i)&&o===s.findIndex(e=>QL(e,i)),l=bc(r??t?.model,a.id),u=!n.remote&&Pc(a)===`not_downloaded`,d=Ne[n.id][a.id],f=ZL(a,n.remote),p=`${se}-info-${n.id}-${a.id}`;return z(V.Fragment,{children:[c&&I(`div`,{className:`popover-subheading`,children:e(`modelMenu.availableToDownload`)}),z(`div`,{className:`popover-row`,children:[z(`button`,{type:`button`,className:`popover-item`,onClick:()=>{u?(w(null),E({model:a.id,provider:n,pick:!0})):(ne(null),E(null),Ce(a.id,n))},disabled:D!==null||Fc(a),...ke(a.id),"aria-selected":l,"aria-describedby":fe===a.id?p:void 0,children:[I(`span`,{className:`popover-item-check`,"aria-hidden":`true`,children:D===a.id?I(La,{size:13,className:`spin`}):l?I(Vr,{size:13}):null}),z(`span`,{className:`popover-item-body is-inline`,children:[I(`span`,{className:`popover-item-title is-model`,children:d}),!n.remote&&a.size_gb?I(`span`,{className:`popover-item-meta`,children:z(`bdi`,{dir:`ltr`,children:[a.size_gb,` GB`]})}):null]})]}),z(BL,{label:`About ${d}`,warning:!!a.placement?.warning,id:p,pinned:fe===a.id,onUnpin:me,tabIndex:-1,children:[I(`div`,{className:`info-bubble-title`,children:d}),f.length>0&&I(`ul`,{className:`info-bubble-lines`,children:f.map(e=>I(`li`,{children:e},e))}),a.placement?.warning&&I(`ul`,{className:`info-bubble-lines`,children:I(`li`,{className:`is-warning`,children:a.placement.warning})}),I(`div`,{className:`info-bubble-id`,children:a.id})]}),I(`span`,{className:`popover-row-state`,children:!n.remote&&I(eR,{m:a,busy:k!==null,onDownload:()=>{w(null),E({model:a.id,provider:n,pick:!1})}})})]}),T?.model===a.id&&T.provider.id===n.id&&z(`div`,{ref:le,className:`popover-message model-download-confirm`,role:`alert`,children:[z(`span`,{children:[I(zc,{text:a.size_gb?e(`modelMenu.downloadConfirm`,{name:Ic(d),size:Ic(`${a.size_gb} GB`)}):e(`modelMenu.downloadConfirmNoSize`,{name:Ic(d)})}),T.pick&&` ${e(`modelMenu.switchWhenDone`)}`]}),z(`span`,{className:`model-download-confirm-actions`,children:[I(`button`,{type:`button`,className:`btn-primary`,onClick:()=>Se(a.id,n,T.pick),children:e(`modelMenu.download`)}),I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>E(null),children:e(`modelMenu.cancel`)})]})]}),C?.model===a.id&&C.provider.id===n.id&&z(`div`,{ref:le,className:`popover-message`,role:`alert`,children:[KL(e,C.provider),` `,I(`button`,{type:`button`,className:`link-btn`,onClick:()=>Ce(C.model,C.provider),children:e(`modelMenu.useModel`,{name:xc(C.model)})})]})]},a.id)}),Ee(n,a)&&z(`button`,{type:`button`,className:`popover-item`,...ke(`showall:${n.id}`),"aria-selected":!1,onClick:()=>{N.current=n.id,v(!0)},children:[I(`span`,{className:`popover-item-check`}),I(`span`,{className:`popover-item-body`,children:I(`span`,{className:`popover-item-title`,children:e(`settings.model.showAll`)})})]})]},n.id))}),y>0&&z(`button`,{type:`button`,className:`popover-item`,onClick:()=>{m(!1),d(`model`)},children:[I(`span`,{className:`popover-item-check`}),I(`span`,{className:`popover-item-body`,children:I(`span`,{className:`popover-item-note`,children:e.plural(`modelMenu.unavailable`,y)})})]}),I(`div`,{className:`popover-divider`}),z(`button`,{type:`button`,className:`popover-item`,onClick:()=>{m(!1),d(`model`)},children:[I(`span`,{className:`popover-item-check`,children:I(Na,{size:13,"aria-hidden":`true`})}),z(`span`,{className:`popover-item-body`,children:[I(`span`,{className:`popover-item-title`,children:e(`modelMenu.addFromLink`)}),I(`span`,{className:`popover-item-note`,children:e(`modelMenu.addFromLinkNote`)})]})]}),z(`button`,{type:`button`,className:`popover-item`,onClick:()=>{m(!1),d(`model`)},children:[I(`span`,{className:`popover-item-check`}),I(`span`,{className:`popover-item-body`,children:I(`span`,{className:`popover-item-title`,children:e(`modelMenu.providers`)})})]})]})]})}function nR(e,t,n){if(e==null||!t(e))throw Error(`the server sent no ${n}`);return e}var rR=e=>e.startsWith(`.`);function iR({onPick:e,onClose:t}){let n=R(),[r,i]=(0,V.useState)(null),[a,o]=(0,V.useState)(``),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(!1);pt(!0,t);let p=(0,V.useRef)(null);on(p,!0);let m=(0,V.useCallback)(e=>{u(!0),c(null),Promise.resolve().then(()=>Rn(e)).then(e=>{let t=nR(e,e=>Array.isArray(e.entries),`folder listing`);i(t),o(t.current_path)}).catch(e=>c(e instanceof Nt?e.detail||e.message:String(e))).finally(()=>u(!1))},[]);(0,V.useEffect)(()=>m(),[m]);let h=r?.entries.filter(e=>e.type===`folder`)??[],g=d?h:h.filter(e=>!rR(e.name));return I(`div`,{className:`modal-overlay`,onClick:t,children:z(`div`,{ref:p,className:`modal-panel sp-picker`,role:`dialog`,"aria-modal":`true`,"aria-label":n(`pick.label`),onClick:e=>e.stopPropagation(),children:[z(`div`,{className:`modal-header`,children:[I(`h3`,{children:n(`pick.title`)}),I(`button`,{type:`button`,className:`btn-icon`,onClick:t,"aria-label":n(`sp.closeShort`),children:I(Is,{size:18})})]}),z(`div`,{className:`modal-body sp-picker-body`,children:[I(`p`,{className:`sp-meta`,children:n(`pick.note`)}),z(`form`,{className:`sp-picker-path`,onSubmit:e=>{e.preventDefault(),a.trim()&&m(a.trim())},children:[I(`input`,{value:a,onChange:e=>o(e.target.value),"aria-label":n(`pick.path`),spellCheck:!1,dir:`ltr`}),I(`button`,{type:`submit`,className:`sp-action`,children:n(`pick.go`)})]}),r&&z(`div`,{className:`sp-picker-quick`,children:[r.quick_links.map(e=>I(`button`,{type:`button`,className:`sp-action`,onClick:()=>m(e.path),children:e.name},e.path)),z(`label`,{className:`sp-picker-hidden`,children:[I(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),n(`pick.showHidden`)]})]}),z(`ul`,{className:`sp-picker-list`,"aria-busy":l,children:[r?.parent_path&&I(`li`,{children:z(`button`,{type:`button`,onClick:()=>m(r.parent_path??void 0),children:[I(yr,{size:13,"aria-hidden":`true`}),` `,n(`pick.up`)]})}),g.map(e=>I(`li`,{children:z(`button`,{type:`button`,onClick:()=>m(e.path),children:[I(aa,{size:13,"aria-hidden":`true`}),` `,e.name]})},e.path)),r&&g.length===0&&I(`li`,{className:`sp-meta`,children:n(h.length>0?`pick.onlyHidden`:`pick.none`)}),l&&z(`li`,{className:`sp-meta`,children:[I(La,{size:12,className:`spin`,"aria-hidden":`true`}),` `,n(`pick.loading`)]})]}),s&&I(`p`,{className:`sp-error`,role:`alert`,children:s}),r?.folder_refusal&&I(`p`,{className:`sp-meta`,role:`status`,children:r.folder_refusal})]}),z(`div`,{className:`sp-picker-actions`,children:[I(`button`,{type:`button`,className:`btn-secondary`,onClick:t,children:n(`sp.cancel`)}),I(`button`,{type:`button`,className:`btn-primary`,disabled:!r||!!r.folder_refusal,onClick:()=>r&&e(r.current_path),children:n(`pick.use`)})]})]})})}var aR=e=>e instanceof Nt?e.detail||e.message:e instanceof Error?e.message:String(e);function oR(e){let t=R(),[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(null);return{open:n=>{a(null);let i=window.gaiaAPI?.dialog;i?i.pickFolder(n).then(async n=>{if(!n)return;let r;try{({refusal:r}=await d(n))}catch(e){a(t(`pick.checkFailed`,{error:aR(e)}));return}r?a(r):e(n)},e=>a(t(`pick.openFailed`,{error:aR(e)}))):r(!0)},picker:n?I(iR,{onPick:t=>{r(!1),e(t)},onClose:()=>r(!1)}):null,error:i}}var sR=new Map;function cR(e){let t=sR.get(e);return t||(t={env:null,error:null,inFlight:null,version:0,listeners:new Set},sR.set(e,t)),t}function lR(e,t,n){let r=cR(e);r.env=t??r.env,r.error=n,r.listeners.forEach(e=>e())}function uR(e){let t=cR(e);if(t.inFlight)return t.inFlight;let n=t.version;return t.inFlight=Promise.resolve().then(()=>$e(e)).then(r=>{let i=nR(r,e=>Array.isArray(e.folders),`chat's environment`);t.version===n&&lR(e,i,null)}).catch(t=>lR(e,null,t instanceof Error?t.message:String(t))).finally(()=>{t.inFlight=null}),t.inFlight}function dR(e){let[,t]=(0,V.useState)(0);(0,V.useEffect)(()=>{let n=cR(e),r=()=>t(e=>e+1);return n.listeners.add(r),!n.env&&!n.inFlight&&uR(e),()=>{n.listeners.delete(r)}},[e]);let n=(0,V.useCallback)(()=>uR(e),[e]),r=(0,V.useCallback)(async t=>{let n=await t();return cR(e).version+=1,lR(e,n,null),n},[e]),i=cR(e);return{env:i.env,error:i.error,refresh:n,change:r}}var fR=e=>e.split(/[\\/]/).filter(Boolean).pop()??e;function pR({folder:e,disabled:t}){let n=R(),r=B(e=>e.draftFolder),i=B(e=>e.setDraftFolder),{open:a,picker:o,error:s}=oR(i),c=e.gaia_folder?n(`folderChip.worksInOwn`,{path:e.path}):n(`folderChip.worksIn`,{path:e.path}),l=!e.gaia_folder&&z(`span`,{className:`new-chat-folder`,title:c,children:[I(aa,{size:13,"aria-hidden":`true`}),I(`span`,{className:`new-chat-folder-name`,dir:`auto`,children:e.name})]});return e.choosable?z(P.Fragment,{children:[l,r?z(`span`,{className:`new-chat-folder is-on`,title:n(`folderChip.picked`,{path:r}),children:[I(aa,{size:13,"aria-hidden":`true`}),I(`span`,{className:`new-chat-folder-name`,dir:`auto`,children:fR(r)}),I(`button`,{type:`button`,className:`new-chat-folder-clear`,onClick:()=>i(null),disabled:t,"aria-label":n(`folderChip.remove`,{name:fR(r)}),title:n(`folderChip.remove`,{name:fR(r)}),children:I(Is,{size:12,"aria-hidden":`true`})})]}):z(`button`,{type:`button`,className:`new-chat-folder is-button`,onClick:()=>a(e.path),disabled:t,"aria-haspopup":`dialog`,title:`${c} ${n(`folderChip.addHint`)}`,children:[I(Oo,{size:13,"aria-hidden":`true`}),I(`span`,{className:`new-chat-folder-name`,children:n(`folderChip.add`)})]}),s&&I(`span`,{className:`new-chat-folder-error`,role:`alert`,children:s}),o]}):l||z(`span`,{className:`new-chat-folder`,title:`${c} ${n(`folderChip.ownFixedHint`)}`,children:[I(aa,{size:13,"aria-hidden":`true`}),I(`span`,{className:`new-chat-folder-name`,children:n(`folderChip.gaiaFolder`)})]})}function mR({sessionId:e,onOpen:t}){let{env:n}=dR(e),r=n?.folders.find(e=>e.source===`working_folder`);if(!r)return null;let i=fR(r.path);return z(`button`,{type:`button`,className:`composer-chip folder-chip`,title:`GAIA works in ${r.path}`,"aria-label":`Working folder ${i}, show the chat's folders`,onClick:t,children:[I(aa,{size:13,"aria-hidden":`true`}),I(`span`,{className:`composer-chip-label`,dir:`auto`,children:i})]})}var hR=`gaia:permission-mode`;function gR(e,t){window.dispatchEvent(new CustomEvent(hR,{detail:{sessionId:e,mode:t}}))}function _R(e,t){let n=(0,V.useRef)(t);n.current=t,(0,V.useEffect)(()=>{if(!e)return;let t=t=>{let r=t.detail;r?.sessionId===e&&n.current(r.mode)};return window.addEventListener(hR,t),()=>window.removeEventListener(hR,t)},[e])}var vR=[{mode:`ask`,label:`perm.ask`,note:`perm.askNote`},{mode:`full_access`,label:`perm.full`,note:`perm.fullNote`}];function yR({sessionId:e,disabled:t}){let n=R(),r=B(e=>e.draftPermissionMode),i=B(e=>e.setDraftPermissionMode),[a,o]=(0,V.useState)(e?`ask`:r),[s,c]=(0,V.useState)(!1),[l,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(null),m=(0,V.useRef)(null),h=_l(t=>e!==null&&xl(e)(t)!==null);(0,V.useEffect)(()=>{if(!e){o(r);return}let t=!1;return Wt(e).then(e=>{t||o(e.mode)}).catch(e=>{t||p(CM(e))}),()=>{t=!0}},[e,r]),_R(e,o);let g=(0,V.useCallback)(async t=>{if(t===`full_access`&&!l)d(!0);else{p(null);try{if(e){let n=(await kt(e,t)).mode;o(n),gR(e,n),n===`full_access`&&h||c(!1)}else i(t),o(t),c(!1)}catch(t){p(CM(t)),e&&Wt(e).then(e=>o(e.mode)).catch(e=>p(t=>`${t??``} Couldn't re-read the saved mode: ${CM(e)}`.trim()))}finally{d(!1)}}},[l,h,e,i]),_=a===`full_access`,v=_?ns:es;return z(`div`,{className:`composer-chip-wrap`,children:[z(`button`,{ref:m,type:`button`,className:`composer-chip${_?` is-warning`:``}`,onClick:()=>{d(!1),c(e=>!e)},disabled:t,"aria-haspopup":`dialog`,"aria-expanded":s,"aria-label":n(`perm.chipAria`,{mode:u(_?`perm.fullLower`:`perm.askLower`)}),children:[I(v,{size:13,"aria-hidden":`true`}),I(`span`,{className:`composer-chip-label`,dir:`auto`,children:n(_?`perm.full`:`env.ask`)}),I(Gr,{size:12,"aria-hidden":`true`})]}),z(Gs,{open:s,onClose:()=>c(!1),anchor:m,label:n(`env.permission`),children:[vR.map(e=>z(`button`,{type:`button`,className:`popover-item`,onClick:()=>g(e.mode),"aria-pressed":a===e.mode,children:[I(`span`,{className:`popover-item-check`,"aria-hidden":`true`,children:a===e.mode&&I(Vr,{size:13})}),z(`span`,{className:`popover-item-body`,children:[I(`span`,{className:`popover-item-title`,children:n(e.label)}),I(`span`,{className:`popover-item-note`,children:n(e.note)})]})]},e.mode)),l&&z(`div`,{className:`popover-message`,role:`alert`,children:[n(`env.fullAccessWarn`),` `,I(`button`,{type:`button`,className:`link-btn`,onClick:()=>g(`full_access`),children:n(`env.turnOn`)})]}),_&&h&&!l&&I(`div`,{className:`popover-message`,role:`status`,children:n(`perm.fullPendingNote`)}),f&&I(`div`,{className:`popover-message is-error`,role:`alert`,children:f})]})]})}var bR={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 xR(e,t){return e?bR.queued:t?`GAIA is still busy in this chat. Trying again in a few seconds.`:`Sending next.`}function SR({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:I(`ul`,{className:`queued-messages`,"aria-label":`Messages waiting to send`,"aria-live":`polite`,children:o.map(e=>z(`li`,{className:`queued-message is-${e.state}`,children:[e.state===`failed`?I(ri,{size:12,"aria-hidden":`true`}):e.state===`queued`?I(di,{size:12,"aria-hidden":`true`}):I(_i,{size:12,"aria-hidden":`true`}),I(`span`,{className:`queued-message-text`,title:e.text,children:e.text}),I(`span`,{className:`queued-message-state`,title:e.error,children:e.state===`failed`?`Not sent. ${e.error??``}`.trim():e.state===`queued`?i&&e.note||xR(i,a):bR[e.state]}),e.state===`failed`&&z(`button`,{type:`button`,className:`queued-message-steer`,onClick:()=>r(e.id),"aria-label":`Send again: ${e.text}`,children:[I(Bo,{size:11,"aria-hidden":`true`}),` Send again`]}),e.state===`queued`&&n&&I(`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`)&&I(`button`,{type:`button`,className:`queued-message-remove`,onClick:()=>t(e.id),"aria-label":`Remove queued message: ${e.text}`,title:`Remove`,children:I(Is,{size:12})})]},e.id))})}var CR=e=>e.toLocaleString(`en-US`);function wR({n:e}){let t=R();if(e==null)return I(`span`,{className:`cp-unknown`,children:t(`ctx.unknown`)});let n=e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4))}K`:`${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`;return I(`span`,{title:t(`ctx.tokens`,{n:CR(e)}),dir:`ltr`,children:n})}function TR({s:e}){let t=R();if(e==null)return I(`span`,{className:`cp-unknown`,children:t(`ctx.unknown`)});let n=e<.1?e===0?`0 s`:`<0.1 s`:e<10?`${e.toFixed(1)} s`:`${Math.round(e)} s`;return I(`span`,{title:`${(e*1e3).toFixed(0)} ms`,dir:`ltr`,children:n})}function ER({r:e}){let t=R();return e==null?I(`span`,{className:`cp-unknown`,children:t(`ctx.unknown`)}):I(`span`,{title:t(`ctx.rateTitle`,{n:e}),children:t(`ctx.rate`,{n:Math.round(e).toLocaleString(`en-US`)})})}var DR=(e,t)=>t>0?Math.round(e/t*100):0,OR=(e,t)=>{let n=DR(e,t);return n===0&&e>0?`<1`:String(n)},kR=(e,t)=>t&&e!=null?Math.floor(e/t*100):null,AR=256;function jR(e,t=gt){if(e.provider===`unknown`)return t(`ctx.unknown`);if(e.provider===`cloud`)return t(`ctx.cloud`);if(e.provider!==`local`)return t(`ctx.cloudVia`,{provider:Ac(e.provider)});if(!e.device)return e.loaded===!1?t(`ctx.notLoadedNow`):t(`ctx.unknown`);let n=e.device.toUpperCase(),r=e.backend===`npu`?`FLM`:e.backend;return r&&r!==e.device?`${n} · ${r.charAt(0).toUpperCase()}${r.slice(1)}`:n}function MR({label:e,children:t,hint:n}){return z(`div`,{className:`cp-row`,title:n,children:[I(`dt`,{children:e}),I(`dd`,{children:t})]})}function NR({t:e}){let t=R();if(e.model_seconds==null||e.gaia_seconds==null)return z(MR,{label:t(`ctx.took`),children:[I(TR,{s:e.wall_seconds}),` · `,t.bare(`ctx.split`),` `,I(`span`,{className:`cp-unknown`,children:t(`ctx.unknown`)})]});let n=[{key:`model`,label:t(`ctx.inModel`),s:e.model_seconds},{key:`tools`,label:t(`ctx.runningTools`),s:e.tool_seconds},{key:`waiting`,label:t(`ctx.waitingOnYou`),s:e.waiting_seconds},{key:`gaia`,label:t(`ctx.gaiaItself`),s:e.own_seconds??0}];return z(P.Fragment,{children:[I(MR,{label:t(`ctx.took`),hint:t(`ctx.tookHint`),children:I(TR,{s:e.wall_seconds})}),I(`div`,{className:`cp-stack`,"aria-hidden":`true`,children:n.map(t=>I(`span`,{className:`cp-time-${t.key}`,style:{width:`${DR(t.s,e.wall_seconds)}%`}},t.key))}),z(`dl`,{className:`cp-rows cp-indent`,children:[I(MR,{label:t(`ctx.inModel`),children:I(TR,{s:e.model_seconds})}),I(MR,{label:t(`ctx.inGaia`),hint:t(`ctx.inGaiaHint`),children:I(TR,{s:e.gaia_seconds})}),n.slice(1).filter(e=>e.s>0).map(e=>z(MR,{label:`· ${e.label}`,children:[I(`span`,{className:`swatch cp-time-${e.key}`,"aria-hidden":`true`}),` `,I(TR,{s:e.s})]},e.key))]})]})}function PR({why:e}){let t=R();return I(`span`,{className:`cp-unknown`,title:e,children:t(`ctx.unknown`)})}var FR={server:`ctx.src.server`,client:`ctx.src.client`};function IR(e,t){return e?t(FR[e]):void 0}function LR({turn:e}){let t=R(),n=kR(e.tokens_cached,e.tokens_in),r=e.unknown??{},i=e.tools.map(e=>`${e.name??t(`ctx.toolOutside`)}: ${e.seconds??`?`} s`).join(`
189
+ `);return z(P.Fragment,{children:[I(NR,{t:e.time}),z(`dl`,{className:`cp-rows`,children:[I(MR,{label:t(`ctx.firstWord`),hint:IR(e.first_token_source,t),children:e.first_token_seconds==null?I(PR,{why:r.first_token_seconds}):z(P.Fragment,{children:[t.bare(`ctx.in`),` `,I(TR,{s:e.first_token_seconds})]})}),I(MR,{label:t(`ctx.readingPrompt`),hint:t(`ctx.readingHint`),children:e.tokens_new!=null&&e.tokens_new<AR?I(`span`,{title:t(`ctx.tooFewTitle`),children:t(`ctx.onlyNew`,{n:e.tokens_new})}):e.prefill_tokens_per_second==null?I(PR,{why:r.prefill_tokens_per_second}):z(P.Fragment,{children:[I(ER,{r:e.prefill_tokens_per_second}),e.prefill_source===`client`&&I(`span`,{className:`cp-chip`,title:t(`ctx.approxTitle`),children:t(`ctx.approx`)})]})}),I(MR,{label:t(`ctx.writing`),hint:IR(e.generation_source,t)??t(`ctx.writingHint`),children:e.generation_tokens_per_second==null?I(PR,{why:r.generation_tokens_per_second}):I(ER,{r:e.generation_tokens_per_second})}),I(MR,{label:t(`ctx.tokensInOut`),hint:r.tokens,children:z(`span`,{dir:`ltr`,children:[I(wR,{n:e.tokens_in}),` → `,I(wR,{n:e.tokens_out})]})}),I(MR,{label:t(`ctx.cache`),hint:t(`ctx.cacheHint`),children:e.tokens_cached==null?I(PR,{why:r.tokens_cached}):z(P.Fragment,{children:[I(wR,{n:e.tokens_cached}),n!=null&&` (${n}%)`]})}),I(MR,{label:t(`ctx.modelCalls`),children:e.model_calls}),I(MR,{label:t(`ctx.toolCalls`),hint:i||void 0,children:e.tool_calls===0&&!e.tool_seconds_total?t(`ctx.none`):z(P.Fragment,{children:[e.tool_calls,` · `,I(TR,{s:e.tool_seconds_total??0})]})}),I(MR,{label:t(`ctx.loads`),children:e.loads.length===0?t(`ctx.none`):z(`span`,{title:e.loads.map(e=>`${e.model}${e.replaced?.length?` replaced ${e.replaced.join(`, `)}`:``}: ${e.seconds} s`).join(`
190
+ `),children:[e.loads.length,` · `,I(TR,{s:e.loads.reduce((e,t)=>e+t.seconds,0)})]})}),I(MR,{label:t(`rail.cost`),children:I(RR,{cost:e.cost})})]})]})}function RR({cost:e}){let t=R();return e.kind===`local`?I(`span`,{title:t(`ctx.costLocalTitle`),children:t(`ctx.costLocal`)}):e.kind===`no_reply`?I(`span`,{children:t(`rail.costNoReply`)}):e.kind===`unreported`?I(`span`,{className:`cp-unknown`,children:t(`ctx.costUnreported`)}):e.kind===`estimate`&&e.usd!=null?I(`span`,{title:t(`ctx.listPriceTitle`,{usd:e.usd}),children:t(`ctx.about`,{usd:e.usd<.01?e.usd.toFixed(4):e.usd.toFixed(2)})}):I(`span`,{className:`cp-unknown`,children:t(`ctx.unknown`)})}function zR({totals:e}){let t=R(),n=kR(e.tokens_cached,e.tokens_in),r=I(`span`,{className:`cp-unknown`,children:t(`ctx.unknown`)});return z(`dl`,{className:`cp-rows`,children:[I(MR,{label:t(`ctx.turns`),children:e.turns}),I(MR,{label:t(`ctx.totalTime`),children:I(TR,{s:e.wall_seconds})}),I(MR,{label:t(`ctx.inModel`),children:I(TR,{s:e.model_seconds})}),I(MR,{label:t(`ctx.inGaia`),children:I(TR,{s:e.gaia_seconds})}),I(MR,{label:t(`ctx.tokensInOut`),children:z(`span`,{dir:`ltr`,children:[I(wR,{n:e.tokens_in}),` → `,I(wR,{n:e.tokens_out})]})}),I(MR,{label:t(`ctx.cache`),children:e.tokens_cached==null?r:z(P.Fragment,{children:[I(wR,{n:e.tokens_cached}),n!=null&&` (${n}%)`]})}),I(MR,{label:t(`ctx.toolCalls`),children:e.tool_calls??r}),I(MR,{label:t(`ctx.loads`),children:e.loads===0?t(`ctx.none`):z(P.Fragment,{children:[e.loads,` · `,I(TR,{s:e.load_seconds})]})}),I(MR,{label:t(`rail.cost`),children:e.usd==null?r:e.unpriced_turns>0?I(`span`,{title:t(`ctx.unpricedTitle`,{n:e.unpriced_turns}),children:t(`ctx.unpriced`,{usd:e.usd.toFixed(2),n:e.unpriced_turns})}):e.usd===0?`$0`:t(`ctx.about`,{usd:e.usd.toFixed(2)})})]})}function BR({usage:e}){let t=R(),n=e.context_state?.put_away,r=e.context_state?.summarized;return z(`div`,{className:`cp-full`,children:[z(`dl`,{className:`cp-rows`,children:[I(MR,{label:t(`ctx.live`),children:I(wR,{n:e.used})}),n&&n.results>0&&z(MR,{label:t(`ctx.putAway`),hint:t(`ctx.putAwayHint`),children:[t.plural(`ctx.results`,n.results),` · `,I(wR,{n:n.tokens})]}),r&&r.turns>0&&z(MR,{label:t(`ctx.summarized`),hint:t(`ctx.summarizedHint`),children:[t.plural(`ctx.earlier`,r.turns),` · `,I(wR,{n:r.tokens}),` → `,I(wR,{n:r.summary_tokens})]})]}),r&&r.turns>0&&I(`p`,{className:`cp-note cp-summarized`,children:t(`ctx.summarizedNote`)}),e.at_risk.length>0&&I(`p`,{className:`cp-warning`,role:`status`,children:t(`ctx.filling`)})]})}function VR({sessionId:e,busy:t,onUsage:n}){let r=R(),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),[d,f]=(0,V.useState)(null),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(`turn`),_=(0,V.useRef)(n);_.current=n;let v=(0,V.useCallback)(()=>{let t=!1,n=(n,r)=>i=>{t||(F.chat.error(`Could not read the ${n} for session=${e}`,i),r(i instanceof Error?i.message:String(i)))};return ln(e).then(e=>{t||(e.available?(a(e),s(null),_.current?.(e)):(a(null),s(e.reason)),f(null))}).catch(n(`context usage`,f)),Pn(e).then(e=>{t||(l(e),m(null))}).catch(n(`performance`,m)),()=>{t=!0}},[e]);(0,V.useEffect)(()=>v(),[v]);let y=(0,V.useRef)(t);(0,V.useEffect)(()=>{let e=y.current&&!t;return y.current=t,e?v():void 0},[t,v]);let b=c?.turns[c.turns.length-1]??null,x=b&&b.message_id===c?.latest_message_id?b:null,S=i?Math.max(0,i.window-i.used):0;return z(P.Fragment,{children:[z(`section`,{"aria-labelledby":`cp-context`,children:[I(`h3`,{id:`cp-context`,children:r(`ctx.context`)}),d&&I(`p`,{className:`cp-error`,role:`alert`,children:d}),!i&&!d&&I(`p`,{className:`cp-note`,children:o??r(`ctx.measuring`)}),i&&z(P.Fragment,{children:[z(`p`,{className:`cp-lead`,children:[I(`strong`,{children:r(`ctx.used`,{pct:DR(i.used,i.window)})}),` · `,I(wR,{n:i.used}),` `,r.bare(`ctx.of`),` `,I(wR,{n:i.window}),` `,r.bare(`ctx.tokensWord`),i.model&&z(P.Fragment,{children:[` · `,I(`span`,{className:`cp-model`,dir:`ltr`,children:i.model})]}),i.model_window!=null&&i.model_window>i.window&&z(`span`,{className:`cp-window-note`,title:r(`ctx.windowTitle`),children:[` `,`· `,r.bare(`ctx.gaiaUses`),` `,I(wR,{n:i.window}),` `,r.bare(`ctx.ofModel`),` `,I(wR,{n:i.model_window})]}),i.tokenizer&&!i.tokenizer.exact&&I(`span`,{className:`cp-chip`,title:i.tokenizer.reason,children:r(`ctx.approx`)})]}),I(`div`,{className:`cp-stack`,"aria-hidden":`true`,children:(i.categories??[]).map(e=>I(`span`,{className:`cp-cat-${e.key}`,style:{width:`${e.tokens/i.window*100}%`}},e.key))}),z(`dl`,{className:`cp-rows`,children:[(i.categories??[]).map(e=>z(`div`,{className:`cp-row`,children:[z(`dt`,{children:[I(`span`,{className:`swatch cp-cat-${e.key}`,"aria-hidden":`true`}),e.label]}),z(`dd`,{children:[I(wR,{n:e.tokens}),` `,z(`span`,{className:`cp-pct`,children:[OR(e.tokens,i.window),`%`]})]})]},e.key)),z(`div`,{className:`cp-row is-quiet`,children:[z(`dt`,{children:[I(`span`,{className:`swatch cp-cat-free`,"aria-hidden":`true`}),r(`ctx.freeRow`)]}),z(`dd`,{children:[I(wR,{n:S}),` `,z(`span`,{className:`cp-pct`,children:[DR(S,i.window),`%`]})]})]}),z(`div`,{className:`cp-row is-quiet cp-indent`,children:[I(`dt`,{children:r(`ctx.reserve`)}),I(`dd`,{children:I(wR,{n:Math.min(S,i.reply_reserve)})})]})]}),z(`p`,{className:`cp-note`,children:[i.tokenizer?.exact?r(`ctx.exactTokenizer`,{model:i.tokenizer.model}):r(`ctx.estimated`,{reason:i.tokenizer?.reason??u(`ctx.sharedTokenizer`)}),x?.last_prompt_tokens!=null&&z(P.Fragment,{children:[` `,r(`ctx.lastRequest`,{n:CR(x.last_prompt_tokens)})]})]}),i.tool_loading&&i.tool_loading.on_demand.length>0&&z(`details`,{className:`cp-details`,children:[I(`summary`,{children:r(`ctx.onDemand`,{n:i.tool_loading.on_demand.length})}),I(`p`,{className:`cp-note`,children:r(`ctx.sentNow`,{n:i.tool_loading.loaded.length})}),I(`ul`,{className:`cp-tools`,children:i.tool_loading.on_demand.map(e=>I(`li`,{children:e},e))})]}),I(BR,{usage:i})]})]}),z(`section`,{"aria-labelledby":`cp-hood`,children:[z(`div`,{className:`cp-section-head`,children:[I(`h3`,{id:`cp-hood`,children:r(`ctx.hood`)}),z(`div`,{className:`cp-toggle`,role:`group`,"aria-label":r(`ctx.show`),children:[I(`button`,{type:`button`,"aria-pressed":h===`turn`,onClick:()=>g(`turn`),children:r(`ctx.lastTurn`)}),I(`button`,{type:`button`,"aria-pressed":h===`chat`,onClick:()=>g(`chat`),children:r(`sp.title`)})]})]}),c&&z(`dl`,{className:`cp-rows`,children:[I(MR,{label:r(`env.runsOn`),hint:c.now.error??void 0,children:jR(c.now,r)}),c.now.provider===`local`&&z(MR,{label:r(`ctx.memory`),hint:r(`ctx.memoryHint`),children:[c.now.weights_gb==null?I(`span`,{className:`cp-unknown`,children:r(`ctx.unknown`)}):z(P.Fragment,{children:[r(`ctx.gbModel`,{gb:c.now.weights_gb.toFixed(1)}),c.now.kv_cache_gb!=null&&` + ${r(`ctx.gbCache`,{gb:c.now.kv_cache_gb.toFixed(1)})}`]}),` · `,c.now.free_gb==null?I(`span`,{className:`cp-unknown`,children:r(`ctx.freeUnknown`)}):r(`env.free`,{gb:c.now.free_gb.toFixed(1)})]})]}),p&&I(`p`,{className:`cp-error`,role:`alert`,children:p}),!c&&!p&&I(`p`,{className:`cp-note`,children:r(`ctx.measuring`)}),c&&h===`turn`&&(x?I(LR,{turn:x}):I(`p`,{className:`cp-note`,children:c.latest_message_id==null?r(`ctx.afterNext`):z(P.Fragment,{children:[r.bare(`ctx.latestAnswer`),` `,I(`span`,{className:`cp-unknown`,children:r(`ctx.unknown`)}),`. `,r.bare(`ctx.notMeasured`)]})})),c&&h===`chat`&&I(zR,{totals:c.totals})]})]})}function HR({sessionId:e,busy:t,onClose:n,onUsage:r}){let i=R(),a=(0,V.useRef)(null),o=(0,V.useRef)(n);o.current=n,(0,V.useEffect)(()=>{a.current?.focus()},[]);let s=(0,V.useCallback)(()=>o.current(),[]);pt(!0,s);let c=(0,V.useRef)(null);return on(c,!0),I(`div`,{className:`cp-overlay`,onClick:n,children:z(`aside`,{ref:c,className:`cp-sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":i(`ctx.sheetAria`),onClick:e=>e.stopPropagation(),children:[z(`header`,{className:`cp-header`,children:[I(`h2`,{children:i(`sp.section.context`)}),I(`button`,{ref:a,type:`button`,className:`cp-icon`,onClick:n,"aria-label":i(`sp.closeShort`),children:I(Is,{size:16})})]}),I(`div`,{className:`cp-body`,children:I(VR,{sessionId:e,busy:t,onUsage:r})})]})})}function UR(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4))}K`:`${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`}var WR=[{key:`system`,label:`ctx.meter.part.system`},{key:`tools`,label:`ctx.meter.part.tools`},{key:`documents`,label:`ctx.meter.part.documents`},{key:`history`,label:`ctx.meter.part.history`},{key:`query`,label:`ctx.meter.part.query`}];function GR({usage:e,unavailable:t,sessionId:n,busy:r=!1,onUsage:i,onDetails:a}){let o=R(),s=(0,V.useRef)(null),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(!1),f=u&&n?I(HR,{sessionId:n,busy:r,onUsage:i,onClose:()=>d(!1)}):null;if(!e)return t?z(`span`,{className:`context-meter is-empty`,title:t,"aria-label":`${o(`ctx.context`)}: ${t}`,children:[I(`span`,{className:`context-meter-label`,children:o(`ctx.context`)}),I(`span`,{"aria-hidden":`true`,children:`–`})]}):null;let p=Math.min(100,Math.round(e.used/e.window*100)),m=e.at_risk.length>0,h=Math.max(0,e.window-e.used-e.reply_reserve),g=e.model_window!=null&&e.model_window>e.window?e.model_window:null,_=g?{gaia:UR(e.window),model:UR(g)}:null,v=e.system+e.tools,y=e.used>0&&v/e.used>=.6?o(`ctx.meter.mostlySetup`,{setup:UR(v),chat:UR(e.history+e.query+e.documents)}):null;return z(`div`,{className:`composer-chip-wrap context-meter-wrap`,children:[z(`button`,{ref:s,type:`button`,className:`context-meter${m?` is-warning`:``}`,onClick:()=>l(e=>!e),"aria-expanded":c,"aria-label":o.compose(t=>{let n=t(`ctx.meter.aria`,{pct:p,used:UR(e.used),window:UR(e.window)});return _?`${n} (${t(`ctx.meter.capNote`,_)})`:n}),title:[_?o(`ctx.meter.titleCapped`,_):o(`ctx.meter.title`),y].filter(Boolean).join(`
191
+ `),children:[I(`span`,{className:`context-meter-bar`,"aria-hidden":`true`,children:I(`span`,{style:{width:`${p}%`}})}),I(`span`,{className:`context-meter-label`,children:z(`bdi`,{dir:`ltr`,children:[p,`%`]})})]}),I(Gs,{open:c,onClose:()=>l(!1),anchor:s,label:o(`ctx.meter.window`),align:`end`,children:z(`div`,{className:`context-meter-panel`,children:[z(`div`,{className:`context-meter-head`,children:[I(`strong`,{children:I(`bdi`,{dir:`ltr`,children:UR(e.used)})}),` `,o.bare(`ctx.of`),` `,I(`bdi`,{dir:`ltr`,children:UR(e.window)}),` `,o.bare(`ctx.tokensWord`),_&&z(`span`,{className:`context-meter-cap`,title:o(`ctx.windowTitle`),children:[` · `,o.bare(`ctx.gaiaUses`),` `,I(`bdi`,{dir:`ltr`,children:_.gaia}),` `,o.bare(`ctx.ofModel`),` `,I(`bdi`,{dir:`ltr`,children:_.model})]})]}),y&&I(`p`,{className:`context-meter-note is-setup`,children:y}),I(`div`,{className:`context-meter-stack`,"aria-hidden":`true`,children:WR.map(({key:t})=>I(`span`,{className:`part-${t}`,style:{width:`${e[t]/e.window*100}%`}},t))}),z(`dl`,{className:`context-meter-rows`,children:[WR.filter(({key:t})=>t!==`query`||e.query>0).map(({key:t,label:n})=>z(`div`,{className:`context-meter-row`,children:[z(`dt`,{children:[I(`span`,{className:`swatch part-${t}`,"aria-hidden":`true`}),o(n)]}),I(`dd`,{children:I(`bdi`,{dir:`ltr`,children:UR(e[t])})})]},t)),z(`div`,{className:`context-meter-row is-quiet`,children:[I(`dt`,{children:o(`ctx.meter.reserve`)}),I(`dd`,{children:I(`bdi`,{dir:`ltr`,children:UR(e.reply_reserve)})})]}),z(`div`,{className:`context-meter-row is-quiet`,children:[I(`dt`,{children:o(`ctx.freeRow`)}),I(`dd`,{children:I(`bdi`,{dir:`ltr`,children:UR(h)})})]})]}),I(`p`,{className:`context-meter-note`,children:o.compose(t=>[t(Xn(`ctx.meter.inView`,e.turns_in_view),{n:e.turns_in_view}),e.turns_hidden>0?t(Xn(`ctx.meter.hidden`,e.turns_hidden),{n:e.turns_hidden}):``,`. `,t(e.tokenizer?.exact?`ctx.meter.exact`:`ctx.meter.estimates`),` `,t(`ctx.meter.saved`)].join(``))}),n&&I(`button`,{type:`button`,className:`context-meter-details`,onClick:()=>{l(!1),a?a():d(!0)},children:o(`ctx.meter.details`)})]})}),f]})}function KR({usage:e}){let t=R(),[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(null);if(!e||e.at_risk.length===0)return null;let o=e.at_risk.join(`
192
+ `);if(i===o)return null;let s=e.at_risk.length;return z(`div`,{className:`context-warning`,role:`status`,children:[I(ws,{size:13,"aria-hidden":`true`}),z(`div`,{className:`context-warning-body`,children:[I(`span`,{children:t(`ctx.warning.short`)}),` `,I(`button`,{type:`button`,className:`link-btn`,"aria-expanded":n,onClick:()=>r(e=>!e),children:t(n?`ctx.warning.hideDetails`:`ctx.warning.details`)}),n&&z(`p`,{className:`context-warning-details`,children:[t.plural(`ctx.meter.warning`,s),` `,e.at_risk.map((e,t)=>z(`span`,{children:[t>0&&`, `,I(`q`,{children:e})]},t)),`. `,t(`ctx.meter.warningSaved`)]})]}),I(`button`,{type:`button`,className:`btn-icon-sm context-warning-close`,onClick:()=>{a(o),r(!1)},"aria-label":t(`ctx.warning.dismiss`),title:t(`ctx.warning.dismiss`),children:I(Is,{size:12,"aria-hidden":`true`})})]})}function qR(...e){return e.some(e=>e>0&&e<.01)?4:2}function JR(e,t=qR(e)){return`$${e.toFixed(t)}`}function YR(e=new Date){let t=new Date(e);return t.setHours(0,0,0,0),t.toISOString()}function XR({sessionId:e,busy:t}){let n=R(),r=_c(e=>e.active),i=B(e=>Ec(r,e.sessions,e.currentSessionId)),a=B(e=>e.openSettings),o=(0,V.useRef)(null),[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(null),d=(0,V.useCallback)(()=>c(!1),[]),f=(0,V.useCallback)(()=>{let t=!1;return(async()=>{try{let n=await y(e,YR(),i??null);t||u(n??null)}catch(n){t||F.chat.error(`Could not read cloud spending for session=${e}`,n)}})(),()=>{t=!0}},[e,i]);(0,V.useEffect)(()=>f(),[f]);let p=(0,V.useRef)(t);if((0,V.useEffect)(()=>{let e=p.current&&!t;return p.current=t,e?f():void 0},[t,f]),(0,V.useEffect)(()=>s?f():void 0,[s,f]),(0,V.useEffect)(()=>{let e,t=()=>{e?.(),e=f()};return window.addEventListener(`focus`,t),()=>{window.removeEventListener(`focus`,t),e?.()}},[f]),!l?.paid||l.model!==(i??null))return null;let{chat:m,today:h}=l,g=qR(m.usd,h.usd),_=e=>`${e.unpriced_answers>0?`≥ `:``}${JR(e.usd,g)}`,v=m.unpriced_answers+h.unpriced_answers>0,b=[...m.items].reverse(),x=e=>new Date(e).toLocaleTimeString(Sn(n),{hour:`numeric`,minute:`2-digit`});return z(`div`,{className:`composer-chip-wrap spend-meter-wrap`,children:[z(`button`,{ref:o,type:`button`,className:`context-meter spend-meter`,onClick:()=>c(e=>!e),"aria-expanded":s,"aria-label":n(`spend.aria`,{chat:_(m),today:_(h)}),title:n(v?`spend.titleExcluded`:`spend.title`),children:[I(`bdi`,{dir:`ltr`,children:_(m)}),z(`span`,{className:`spend-meter-today`,children:[`· `,n.bare(`spend.today`),` `,I(`bdi`,{dir:`ltr`,children:_(h)})]})]}),I(Gs,{open:s,onClose:d,anchor:o,label:n(`spend.window`),align:`end`,children:z(`div`,{className:`context-meter-panel spend-meter-panel`,children:[z(`dl`,{className:`context-meter-rows`,children:[z(`div`,{className:`context-meter-row`,children:[I(`dt`,{children:n(`spend.thisChat`)}),I(`dd`,{children:I(`bdi`,{dir:`ltr`,children:_(m)})})]}),z(`div`,{className:`context-meter-row`,children:[I(`dt`,{children:n.plural(`spend.todayChats`,h.chats)}),I(`dd`,{children:I(`bdi`,{dir:`ltr`,children:_(h)})})]})]}),v&&I(`p`,{className:`context-meter-note spend-meter-excluded`,role:`note`,children:n(`spend.excluded`,{chat:m.unpriced_answers,today:h.unpriced_answers})}),b.length>0&&z(P.Fragment,{children:[I(`div`,{className:`spend-meter-heading`,children:n(`spend.perAnswer`)}),I(`dl`,{className:`context-meter-rows spend-meter-answers`,children:b.map(e=>z(`div`,{className:`context-meter-row`,children:[I(`dt`,{children:I(`bdi`,{dir:`ltr`,children:x(e.created_at)})}),I(`dd`,{children:e.kind===`estimate`&&e.usd!=null?I(`bdi`,{dir:`ltr`,children:JR(e.usd)}):I(`span`,{className:`spend-meter-unknown`,children:n(e.kind===`unreported`?`ctx.costUnreported`:`ctx.unknown`)})})]},e.message_id))})]}),I(`p`,{className:`context-meter-note`,children:n(`spend.note`)}),I(`button`,{type:`button`,className:`context-meter-details`,onClick:()=>{c(!1),a(`model`)},children:n(`spend.month`)})]})})]})}function ZR(e){return{id:e.id,name:e.display_name??xc(e.id),sizeGb:e.size_gb??null}}async function QR(e){let{providers:t,lemonade_error:n}=await cn();if(n)throw Error(n);let r=t.filter(e=>!e.remote).map(e=>Nn(e.id)),i=e?t.find(t=>t.remote&&t.id===e):void 0,[a,...o]=await Promise.all([i?Nn(i.id):Promise.resolve(null),...r]);return{cloud:a&&!a.blocked?a.models.filter(e=>e.available!==!1).map(e=>({...ZR(e),sizeGb:null})):[],local:o.flatMap(e=>e.models.filter(e=>e.downloaded).map(ZR))}}function $R({answeredBy:e,onPick:t}){let n=(0,V.useRef)(null),r=R(),i=_c(e=>e.active),a=i?.remote?i.provider_name??null:null,o=i?.remote?i.provider:null,[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(null),p=(0,V.useCallback)(async()=>{u(null),f(null);try{u(await QR(o))}catch(e){f(e instanceof Error?e.message:String(e))}},[o]);(0,V.useEffect)(()=>{s&&p()},[s,p]);let m=l?.cloud.filter(t=>t.id!==e)??[],h=l?.local.filter(t=>t.id!==e)??[],g=(e,n)=>z(`button`,{type:`button`,className:`retry-menu-item`,title:e.id,onClick:()=>{c(!1),t(e.id)},children:[I(`span`,{className:`retry-menu-name`,children:e.name}),I(`span`,{className:`retry-menu-meta`,children:e.sizeGb?z(`bdi`,{dir:`ltr`,children:[e.sizeGb,` GB`]}):n})]},e.id);return z(P.Fragment,{children:[I(`button`,{ref:n,type:`button`,className:`msg-action-btn`,onClick:()=>c(e=>!e),title:r(`retry.button`),"aria-label":r(`retry.button`),"aria-expanded":s,children:I(os,{size:12})}),I(Gs,{open:s,onClose:()=>c(!1),anchor:n,label:`Retry with`,placement:`below`,align:`end`,children:z(`div`,{className:`retry-menu`,children:[I(`div`,{className:`retry-menu-head`,children:r(`retry.head`)}),d&&I(`div`,{className:`retry-menu-error`,role:`alert`,children:d}),!d&&l===null&&z(`div`,{className:`retry-menu-empty`,children:[I(La,{size:12,className:`spin`,"aria-hidden":`true`}),` `,r(`retry.loading`)]}),m.length>0&&a&&I(`div`,{className:`retry-menu-note`,children:r(`retry.onProvider`,{provider:a})}),m.map(e=>g(e,r(`retry.cloudHint`))),h.length>0&&a&&I(`div`,{className:`retry-menu-note`,children:r(`retry.onThisPc`,{provider:a})}),h.map(e=>g(e,r(`retry.localHint`))),l!==null&&m.length===0&&h.length===0&&I(`div`,{className:`retry-menu-empty`,children:r(`retry.none`)})]})})]})}function ez(e,t){return Ic(e(`answer.duration.sec`,{n:t.toFixed(1)}))}function tz(e,t){return t?Ic(e(`compare.rate`,{n:t})):null}function nz({parts:e}){let t=e.filter(e=>!!e);return t.length?I(`div`,{className:`compare-meta`,children:t.map((e,t)=>z(`span`,{children:[t>0&&` · `,I(zc,{text:e})]},t))}):null}function rz({original:e,originalModel:t,originalLatencyMs:n,state:r,keeping:i,onKeep:a,onClose:o}){yc();let s=R(),c=r.status===`ready`?r.result.model:r.model,l=e.stats?.tokens_per_second;return z(`section`,{className:`answer-compare`,"aria-label":s(`compare.title`),children:[z(`header`,{className:`answer-compare-head`,children:[I(`span`,{children:s(`compare.title`)}),I(`button`,{type:`button`,className:`msg-action-btn`,onClick:o,"aria-label":s(`compare.close`),disabled:!!i,children:I(Is,{size:12})})]}),z(`div`,{className:`answer-compare-cols`,children:[z(`article`,{className:`compare-col`,"aria-label":s(`compare.answerFrom`,{model:t??u(`compare.originalModel`)}),children:[I(`h4`,{children:t?xc(t):s(`compare.original`)}),I(nz,{parts:[n!=null&&n>0?ez(s,n/1e3):null,tz(s,l)]}),I(`div`,{className:`compare-body`,children:I(EF,{content:e.content})}),I(`button`,{type:`button`,className:`compare-keep`,onClick:()=>a(`original`),disabled:!!i||r.status===`running`,children:s(i===`original`?`compare.keeping`:`compare.keep`)})]}),z(`article`,{className:`compare-col`,"aria-label":s(`compare.answerFrom`,{model:c}),children:[I(`h4`,{children:xc(c)}),r.status===`running`&&z(`div`,{className:`compare-wait`,children:[I(La,{size:14,className:`spin`,"aria-hidden":`true`}),I(`span`,{children:s(`compare.loading`,{model:xc(c)})})]}),r.status===`failed`&&I(`div`,{className:`compare-error`,role:`alert`,children:r.error}),r.status===`ready`&&z(P.Fragment,{children:[I(nz,{parts:[ez(s,r.result.stats.seconds),r.result.stats.load_seconds>=1?s.compose(e=>e(`compare.loadTime`,{time:Ic(e(`answer.duration.sec`,{n:r.result.stats.load_seconds.toFixed(1)}))})):null,tz(s,r.result.stats.tokens_per_second)]}),I(`div`,{className:`compare-body`,children:I(EF,{content:r.result.content})}),I(`button`,{type:`button`,className:`compare-keep`,onClick:()=>a(`retry`),disabled:!!i,children:s(i===`retry`?`compare.keeping`:`compare.keep`)})]})]})]})]})}var iz=`gaia.sessionPanel.open`,az=`gaia.sessionPanel.width`,oz=`gaia.sessionPanel.sections`,sz={answer:!0,environment:!0,context:!1,outputs:!0,changes:!0,skills:!0,tools:!1};function cz(e,t,n){try{let r=window.localStorage.getItem(e);return r==null?n:t(r)}catch(t){return F.ui.warn(`Session panel setting ${e} unavailable; using the default`,t),n}}function lz(e,t){try{window.localStorage.setItem(e,t)}catch(t){F.ui.warn(`Could not remember session panel setting ${e}`,t)}}function uz(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 dz(){return{open:cz(iz,e=>e!==`0`,!0),width:uz(cz(az,e=>Number(e)||320,320)),sections:{...sz,...cz(oz,e=>JSON.parse(e),{})}}}var fz=Ct((e,t)=>({...dz(),overlayOpen:!1,focus:null,setOpen:t=>{lz(iz,t?`1`:`0`),e({open:t})},setOverlayOpen:t=>e({overlayOpen:t}),setWidth:t=>{let n=uz(t);lz(az,String(n)),e({width:n})},setSection:(n,r)=>{let i={...t().sections,[n]:r};lz(oz,JSON.stringify(i)),e({sections:i})},reveal:n=>{let r={...t().sections,[n]:!0};lz(oz,JSON.stringify(r)),lz(iz,`1`),e({sections:r,open:!0,overlayOpen:!0,focus:{section:n,nonce:Date.now()}})},reload:()=>e({...dz(),overlayOpen:!1,focus:null})})),pz=16;function mz({width:e,setWidth:t,clamp:n,min:r,max:i,defaultWidth:a}){let[o,s]=(0,V.useState)(null),c=(0,V.useCallback)(r=>{if(r.button!==0)return;r.preventDefault();let i=r.clientX,a=e,o=r.currentTarget;o.setPointerCapture?.(r.pointerId);let c=getComputedStyle(o).direction===`rtl`?-1:1,l=a,u=e=>{l=n(a+c*(i-e.clientX)),s(l)},d=()=>{o.removeEventListener(`pointermove`,u),o.removeEventListener(`pointerup`,d),o.removeEventListener(`pointercancel`,d),s(null),t(l)};o.addEventListener(`pointermove`,u),o.addEventListener(`pointerup`,d),o.addEventListener(`pointercancel`,d)},[n,t,e]),l=(0,V.useCallback)(n=>{let a=getComputedStyle(n.currentTarget).direction===`rtl`?-16:pz,o={ArrowLeft:e+a,ArrowRight:e-a,Home:r,End:i}[n.key];o!==void 0&&(n.preventDefault(),t(o))},[i,r,t,e]),u=o??e;return{width:u,dragging:o!==null,separatorProps:{role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":r,"aria-valuemax":i,"aria-valuenow":u,tabIndex:0,onPointerDown:c,onKeyDown:l,onDoubleClick:()=>t(a)}}}function hz(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 gz(e){let t=e.live_data?.attempted??0;return t>0&&(e.live_data?.failed??0)>=t}function _z(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return e}}function vz(e,t,n){let r=[];return t&&t.length>0&&r.push(e(Xn(`rail.pages`,t.length),{list:t.join(`, `)})),r.push(e(Xn(`rail.passages`,n),{n})),r.join(` · `)}function yz(e,t=gt,n=!1){let{cost:r}=e;return r.kind===`local`?t(`rail.costLocal`):r.kind===`no_reply`?t(`rail.costNoReply`):r.kind===`unreported`?t(n?`rail.costUnreportedStopped`:`rail.costUnreported`):r.kind===`estimate`&&typeof r.usd==`number`?t(`rail.costAbout`,{usd:`$${r.usd<.01?r.usd.toFixed(4):r.usd.toFixed(2)}`}):t(e.model?`rail.costUnknownModel`:`rail.costUnknown`)}function bz(e){return e instanceof Nt?e.detail||e.message:e instanceof Error?e.message:String(e)}function xz({messages:e,busy:t=!1}){let n=R(),r=hz(e,t);if(!r)return null;let i=r.kind===`turn`?r.turn.turnSummary??null:null,a=i?gz(i):!1;return z(`div`,{className:`side-rail-body`,children:[!i&&I(`p`,{className:`side-rail-pending`,role:`status`,children:n(`rail.pending`)}),a&&z(`div`,{className:`side-rail-warn`,role:`status`,children:[I(ws,{size:14,"aria-hidden":`true`}),z(`div`,{children:[I(`strong`,{children:n(`rail.noLive`)}),I(`span`,{children:n(`rail.noLiveWhy`)})]})]}),i&&(i.error?I(`p`,{className:`side-rail-error`,role:`alert`,children:n(`rail.error`,{error:i.error})}):z(P.Fragment,{children:[I(Cz,{summary:i}),I(Ez,{summary:i}),I(Dz,{summary:i,stopped:r.kind===`turn`&&!!r.turn.stopState,alone:(i.pages??[]).length===0&&(i.documents??[]).length===0&&(i.files??[]).length===0})]}))]})}function Sz({title:e,children:t}){let[n,r]=(0,V.useState)(!0);return z(`section`,{className:`side-rail-section`,children:[z(`button`,{type:`button`,className:`side-rail-section-head`,onClick:()=>r(!n),"aria-expanded":n,children:[I(Yr,{size:12,className:`side-rail-chevron${n?` open`:``}`,"aria-hidden":`true`}),e]}),n&&I(`div`,{className:`side-rail-section-body`,children:t})]})}function Cz({summary:e}){let t=R(),n=e.pages??[],r=e.documents??[];return n.length===0&&r.length===0?null:I(Sz,{title:t(`rail.sources`),children:z(`ul`,{className:`side-rail-list`,children:[n.map(e=>z(`li`,{className:`side-rail-item`,children:[I(pa,{size:13,className:`side-rail-item-icon`,"aria-hidden":`true`}),z(`div`,{className:`side-rail-item-text`,children:[z(`a`,{href:O_(e.url)||void 0,target:`_blank`,rel:`noopener noreferrer`,className:`side-rail-link`,title:e.url,children:[I(`span`,{className:`side-rail-link-text`,children:e.title||_z(e.url)}),I(ji,{size:10,"aria-hidden":`true`,className:`side-rail-link-icon`})]}),z(`span`,{className:`side-rail-meta`,children:[_z(e.url),e.kind===`search_result`?` · ${t(`rail.searchResult`)}`:``]})]})]},e.url)),r.map(e=>{let n=e.passages??0;return z(`li`,{className:`side-rail-item`,children:[I(Yi,{size:13,className:`side-rail-item-icon`,"aria-hidden":`true`}),z(`div`,{className:`side-rail-item-text`,children:[I(`span`,{className:`side-rail-name`,title:e.name,dir:`ltr`,children:e.name}),I(`span`,{className:`side-rail-meta`,children:t.compose(t=>vz(t,e.pages,n))})]})]},e.path)})]})})}var wz=4e3;function Tz(e){let t=e.join(`
193
+ `),[n,r]=(0,V.useState)(()=>new Map),[i,a]=(0,V.useState)(null);return(0,V.useEffect)(()=>{if(!t)return;let e=t.split(`
194
+ `),n=!1,i=()=>{document.visibilityState!==`hidden`&&Yt(e).then(e=>{n||(r(new Map(e.files.map(e=>[e.path,e]))),a(null))},e=>{n||(F.ui.warn(`Could not re-check the files this turn wrote`,e),a(bz(e)))})};i();let o=window.setInterval(i,wz);return window.addEventListener(`focus`,i),()=>{n=!0,window.clearInterval(o),window.removeEventListener(`focus`,i)}},[t]),{status:n,error:i}}function Ez({summary:e}){let t=R(),n=e.files??[],[r,i]=(0,V.useState)(null),{status:a,error:o}=Tz(n.map(e=>e.path));if(n.length===0)return null;let s=(e,n)=>{i(null),e.catch(e=>{F.ui.error(`Failed to open ${n}`,e),i(t(`sp.couldntOpen`,{name:n,error:bz(e)}))})};return z(Sz,{title:t(`rail.files`),children:[I(`ul`,{className:`side-rail-list`,children:n.map(e=>{let n=a.get(e.path);if(n?.exists===!1)return z(`li`,{className:`side-rail-item side-rail-item-gone`,children:[I(Yi,{size:13,className:`side-rail-item-icon`,"aria-hidden":`true`}),z(`div`,{className:`side-rail-item-text`,children:[I(`span`,{className:`side-rail-name`,title:e.path,children:e.name}),I(`span`,{className:`side-rail-meta`,children:t(`sp.gone`)})]})]},e.path);let r=n?.exists===!0&&typeof n.mtime==`number`&&typeof e.mtime==`number`&&n.mtime!==e.mtime;return z(`li`,{className:`side-rail-item`,children:[I(Yi,{size:13,className:`side-rail-item-icon`,"aria-hidden":`true`}),z(`div`,{className:`side-rail-item-text`,children:[I(`span`,{className:`side-rail-name`,title:e.path,children:e.name}),r&&I(`span`,{className:`side-rail-meta`,children:t(`rail.changedSince`)}),z(`span`,{className:`side-rail-actions`,children:[e.openable&&I(`button`,{type:`button`,className:`side-rail-action`,onClick:()=>s(wt(e.path),e.name),children:t(`sp.open`)}),z(`button`,{type:`button`,className:`side-rail-action`,onClick:()=>s($t(e.path,!0),e.name),children:[I($i,{size:11,"aria-hidden":`true`}),t(`sp.showInFolder`)]})]})]})]},e.path)})}),r&&I(`p`,{className:`side-rail-error`,role:`alert`,children:r}),o&&I(`p`,{className:`side-rail-error`,children:t(`rail.checkFailed`,{error:o})})]})}function Dz({summary:e,stopped:t,alone:n}){let r=R();yc();let{model:i}=e,a=e.sites??[],o=(e.documents??[]).length>0,s=z(`dl`,{className:`side-rail-facts`,children:[I(`dt`,{children:r(`rail.model`)}),z(`dd`,{children:[i?z(`span`,{className:`side-rail-where${i.remote?` remote`:``}`,children:[i.remote?I(pi,{size:12,"aria-hidden":`true`}):I($a,{size:12,"aria-hidden":`true`}),i.remote?r(`rail.cloudModel`,{name:i.provider_name}):r(`rail.thisPc`)]}):I(`span`,{className:`side-rail-where`,children:r(`rail.notReported`)}),i?.name&&I(`span`,{className:`side-rail-meta`,title:i.name,dir:`ltr`,children:xc(i.name)})]}),o&&z(P.Fragment,{children:[I(`dt`,{children:r(`rail.documents`)}),I(`dd`,{children:i?.remote?r(`rail.docsSent`,{provider:i.provider_name}):r(i?`rail.docsLocal`:`rail.docsSearched`)})]}),I(`dt`,{children:r(`rail.websites`)}),I(`dd`,{children:a.length>0?I(`span`,{dir:`ltr`,children:a.join(`, `)}):r(`rail.noSites`)}),I(`dt`,{children:r(`rail.cost`)}),I(`dd`,{children:yz(e,r,t)})]});return n?s:I(Sz,{title:r(`rail.thisTurn`),children:s})}var Oz=`(prefers-reduced-motion: reduce)`;function kz(e){let t=getComputedStyle(document.documentElement).getPropertyValue(e).trim(),n=/^([\d.]+)(ms|s)$/.exec(t);if(!n)throw Error(`Motion token ${e} is "${t}", not a duration; check styles/index.css.`);return parseFloat(n[1])*(n[2]===`s`?1e3:1)}function Az(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(Oz).matches}function jz(){return Az()?`auto`:`smooth`}function Mz({id:e,title:t,summary:n,children:r}){let i=fz(t=>t.sections[e]),a=fz(e=>e.setSection),o=fz(e=>e.focus),s=(0,V.useRef)(null),c=`sp-section-${e}`;return(0,V.useEffect)(()=>{o?.section===e&&s.current?.scrollIntoView?.({block:`start`,behavior:jz()})},[o,e]),z(`section`,{ref:s,className:`sp-section`,"aria-labelledby":`${c}-title`,children:[I(`h3`,{className:`sp-section-heading`,children:z(`button`,{type:`button`,id:`${c}-title`,className:`sp-section-head`,"aria-expanded":i,"aria-controls":c,onClick:()=>a(e,!i),children:[I(Yr,{size:13,className:`sp-chevron${i?` is-open`:``}`,"aria-hidden":`true`}),I(`span`,{className:`sp-section-title`,children:t}),n!=null&&I(`span`,{className:`sp-section-summary`,children:n})]})}),i&&I(`div`,{id:c,className:`sp-section-body`,children:r})]})}var Nz=e=>[...e.querySelectorAll(`[role="radio"]`)].filter(t=>t.closest(`[role="radiogroup"]`)===e),Pz=e=>!e.matches(`:disabled`)&&e.getAttribute(`aria-disabled`)!==`true`;function Fz({children:e,...t}){let n=(0,V.useRef)(null);return(0,V.useLayoutEffect)(()=>{let e=Nz(n.current),t=e.find(e=>e.getAttribute(`aria-checked`)===`true`&&Pz(e))??e.find(Pz);for(let n of e)n.tabIndex=n===t?0:-1}),I(`div`,{ref:n,role:`radiogroup`,onKeyDown:e=>{let t=Nz(e.currentTarget).filter(Pz),n=t.indexOf(document.activeElement);if(n<0)return;let r=getComputedStyle(e.currentTarget).direction===`rtl`?`ArrowRight`:`ArrowLeft`,i=e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowUp`||e.key===r?n-1:e.key===`ArrowDown`||e.key===`ArrowRight`||e.key===`ArrowLeft`?n+1:null;if(i===null)return;e.preventDefault();let a=t[(i+t.length)%t.length];a.focus(),a.getAttribute(`aria-checked`)!==`true`&&a.click()},...t,children:e})}var Iz=`gaia:mobile-access-request`,Lz=`gaia:mobile-access-state`;function Rz(e){window.dispatchEvent(new CustomEvent(Iz,{detail:e}))}function zz(e){window.dispatchEvent(new CustomEvent(Lz,{detail:e}))}function Bz(e,t){let n=(0,V.useRef)(t);n.current=t,(0,V.useEffect)(()=>{let t=e=>n.current(!!e.detail);return window.addEventListener(e,t),()=>window.removeEventListener(e,t)},[e])}var Vz=e=>Bz(Iz,e),Hz=e=>Bz(Lz,e);function Uz({checked:e,onChange:t,label:n,text:r,disabled:i}){return z(`span`,{className:`sp-switch-wrap`,children:[I(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":n,className:`sp-switch${e?` is-on`:``}`,onClick:()=>t(!e),disabled:i,children:I(`span`,{className:`sp-switch-knob`,"aria-hidden":`true`})}),r&&I(`span`,{className:`sp-state-text`,children:r})]})}var Wz={warming:`modelStatus.state.warming`,idle:`modelStatus.state.idle`,stopped:`modelStatus.state.stopped`},Gz=3e3,Kz={added:`env.source.added`,gaia_documents:`env.source.gaia_documents`,scratch:`env.source.scratch`,document:`env.source.document`,working_folder:`env.source.working_folder`,approved:`env.source.approved`,allowed_paths:`env.source.allowed_paths`},qz=3;function Jz(e){let t=e.split(/[\\/]/).filter(Boolean);return t[t.length-1]??e}function Yz({sessionId:e,busy:t}){let n=R(),{env:r,refresh:i}=dR(e);ku(t,()=>{i()});let a=r&&!r.internet?n(`env.offline`):null;return z(Mz,{id:`environment`,title:n(`env.title`),summary:a,children:[I($z,{sessionId:e}),I(nB,{sessionId:e}),I(eB,{sessionId:e}),I(tB,{}),I(Qz,{sessionId:e,busy:t})]})}function Xz({label:e,children:t}){return z(`div`,{className:`sp-env-row`,children:[I(`div`,{className:`sp-env-label`,children:e}),I(`div`,{className:`sp-env-value`,children:t})]})}function Zz(e,t){let n=e=>e.toLowerCase().replace(/^user\./,``);return n(e)===n(t)}function Qz({sessionId:e,busy:t}){let n=R(),r=Tc(),i=_c(e=>e.active),a=B(t=>Ec(i,t.sessions,e)),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),u=r?.remote===!0,d=(0,V.useCallback)(()=>{u||Promise.resolve().then(()=>Ae()).then(e=>{s(nR(e,e=>typeof e.state==`string`,`model status`)),l(null)}).catch(e=>{F.ui.warn(`Could not read where the local model runs`,e),l(CM(e))})},[u]);(0,V.useEffect)(d,[d]),ku(t,d);let f=o?.state===`warming`;if((0,V.useEffect)(()=>{if(!f)return;let e=setInterval(d,Gz);return()=>clearInterval(e)},[f,d]),u)return z(Xz,{label:n(`env.runsOn`),children:[z(`span`,{className:`sp-place is-remote`,children:[I(pi,{size:13,"aria-hidden":`true`}),` `,n(`env.cloudPlace`,{name:r?.label??``})]}),r?.description&&I(`span`,{className:`sp-meta`,children:r.description})]});if(!r)return I(Xz,{label:n(`env.runsOn`),children:I(`span`,{className:`sp-meta`,title:wc,children:n(`env.notKnownYet`)})});let p=!!(o?.model&&a&&!Zz(o.model,a)),m=p?null:o?.memory,h=o?.display_name??(o&&o.state!==`loaded`&&a?xc(a):null),g=[m?.model_gb==null?o?.state===`loaded`||o?.state===`warming`?n(`env.inUseUnknown`):null:n(`env.inUse`,{gb:m.model_gb.toFixed(1)}),m?.free_gb==null?null:n(`env.free`,{gb:m.free_gb.toFixed(1)})].filter(Boolean).join(` · `);return z(Xz,{label:n(`env.runsOn`),children:[z(`span`,{className:`sp-place`,children:[I($a,{size:13,"aria-hidden":`true`}),` `,n(`env.thisPc`),!p&&o?.placement?.label?` · ${o.placement.label}`:``]}),p?I(`span`,{className:`sp-meta`,children:n(`env.notLoaded`,{model:xc(a)})}):o&&h&&z(`span`,{className:`sp-meta`,children:[I(`bdi`,{dir:`ltr`,children:h}),o.state===`loaded`?``:` · ${n(Wz[o.state])}`]}),m&&g&&I(`span`,{className:`sp-meta`,children:g}),c?I(`span`,{className:`sp-error`,children:c}):o?.error&&I(`span`,{className:`sp-error`,children:I(Bc,{status:o})})]})}function $z({sessionId:e}){let t=R(),{env:n,error:r,change:i}=dR(e),a=B(t=>t.sessions.find(t=>t.id===e)?.agent_type===`gaia`),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(!1),f=async(e,t)=>{l(e),s(null);try{await t()}catch(e){s(CM(e))}finally{l(null)}},p=t=>f(t.path,()=>i(()=>ce(e,t.path))),{open:m,picker:h,error:g}=oR(t=>{f(t,()=>i(()=>Zn(e,t)))}),_=n?.folders.filter(e=>e.kind===`folder`)??[],v=n?.folders.filter(e=>e.kind===`file`)??[],y=u?v:v.slice(0,qz),b=!n||!n.enforced,x=e=>z(`li`,{className:`sp-scope-item`,children:[e.kind===`folder`?I(aa,{size:13,className:`sp-item-icon`,"aria-hidden":`true`}):I(Zi,{size:13,className:`sp-item-icon`,"aria-hidden":`true`}),z(`div`,{className:`sp-item-text`,children:[I(`span`,{className:`sp-item-name`,dir:`ltr`,title:e.path,children:e.name||Jz(e.path)}),z(`span`,{className:`sp-meta`,title:e.path,children:[t(Kz[e.source]),e.kind===`folder`&&z(P.Fragment,{children:[` · `,I(`span`,{className:`sp-item-path`,dir:`ltr`,children:e.path})]})]})]}),e.removable&&!b&&I(`button`,{type:`button`,className:`btn-icon-sm sp-item-remove`,onClick:()=>void p(e),disabled:c!==null,"aria-label":t(`env.remove`,{path:e.path}),title:t(`env.removeShort`),children:I(Is,{size:12})})]},e.path);return z(Xz,{label:n&&!n.enforced?t(`env.reach`):t(`env.readWrite`),children:[!n&&!r&&I(`span`,{className:`sp-meta`,children:t(`sp.checking`)}),n&&!n.enforced&&I(`span`,{className:`sp-meta`,children:t(a?`env.flagshipScope`:`env.agentScope`)}),r&&I(`span`,{className:`sp-error`,children:t(`env.foldersError`,{error:r})}),n&&z(P.Fragment,{children:[n.folders.length===0&&I(`span`,{className:`sp-meta`,children:t(`env.nothing`)}),z(`ul`,{className:`sp-list`,children:[_.map(x),y.map(x)]}),v.length>qz&&I(`button`,{type:`button`,className:`link-btn sp-more`,onClick:()=>d(e=>!e),children:u?t(`env.fewerFiles`):t(`env.allFiles`,{n:v.length})}),n.removed.length>0&&I(`span`,{className:`sp-meta`,children:t(`env.removed`,{names:n.removed.map(Jz).join(`, `)})}),!b&&z(`button`,{type:`button`,className:`sp-action`,onClick:()=>m(),disabled:c!==null,children:[I(ta,{size:12,"aria-hidden":`true`}),` `,t(`env.addFolder`)]})]}),(o??g)&&I(`span`,{className:`sp-error`,role:`alert`,children:o??g}),h]})}function eB({sessionId:e}){let t=R(),{env:n,change:r,refresh:i}=dR(e),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(!1);if(!n)return null;let l=async t=>{c(!0),o(null);try{await r(()=>ot(e,t))}catch(e){o(CM(e)),i()}finally{c(!1)}};return n.internet_enforced?z(Xz,{label:t(`env.internet`),children:[I(Uz,{checked:n.internet,onChange:e=>void l(e),disabled:s,label:t(`env.internetFor`),text:n.internet?t(`env.on`):t(`env.offBlocked`)}),a&&I(`span`,{className:`sp-error`,role:`alert`,children:a})]}):I(Xz,{label:t(`env.internet`),children:I(`span`,{className:`sp-state-text`,children:n.internet?t(`env.on`):t(`env.off`)})})}function tB(){let e=R(),[t,n]=(0,V.useState)(null),[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(null),s=(0,V.useCallback)(()=>{Promise.resolve().then(()=>me()).then(e=>{n(nR(e,e=>typeof e.active==`boolean`,`phone access status`)),o(null)}).catch(e=>o(CM(e)))},[]);(0,V.useEffect)(s,[s]),Hz(()=>{i(!1),s()});let c=t?.active===!0;return z(Xz,{label:e(`env.phone`),children:[I(Uz,{checked:c,onChange:e=>{i(!0),Rz(e)},disabled:r,label:e(`env.phone`),text:e(r?c?`env.stopping`:`env.starting`:c?`env.on`:`env.off`)}),c&&z(`span`,{className:`sp-meta`,children:[I(cs,{size:12,"aria-hidden":`true`}),` `,t?.device?e(`env.phoneConnected`,{name:t.device.name}):e(`env.noPhone`)]}),c&&I(`button`,{type:`button`,className:`sp-action`,onClick:()=>Rz(!0),children:e(`env.qr`)}),(a||c&&t?.error)&&I(`span`,{className:`sp-error`,children:a??t?.error})]})}function nB({sessionId:e}){let t=R(),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)(null),c=_l(t=>xl(e)(t)!==null);(0,V.useEffect)(()=>{let t=!0;return Promise.resolve().then(()=>Wt(e)).then(e=>{t&&r(nR(e,e=>typeof e.mode==`string`,`permission mode`).mode)}).catch(e=>{t&&s(CM(e))}),()=>{t=!1}},[e]),_R(e,r);let l=async t=>{a(!1),s(null);try{let n=(await kt(e,t)).mode;r(n),gR(e,n)}catch(e){s(CM(e))}},u=vR.find(e=>e.mode===n)?.note;return z(Xz,{label:t(`env.permission`),children:[I(Fz,{className:`sp-segmented`,"aria-label":t(`env.permission`),children:vR.map(e=>z(`button`,{type:`button`,role:`radio`,"aria-checked":n===e.mode,className:n===e.mode?`is-selected`:void 0,onClick:()=>e.mode===`full_access`?a(!0):void l(e.mode),children:[e.mode===`full_access`?I(ns,{size:12,"aria-hidden":`true`}):I(es,{size:12,"aria-hidden":`true`}),e.mode===`ask`?t(`env.ask`):t(e.label)]},e.mode))}),u&&I(`span`,{className:`sp-meta`,children:t(u)}),n===`full_access`&&c&&I(`span`,{className:`sp-meta`,role:`status`,children:t(`perm.fullPendingNote`)}),i&&z(`span`,{className:`sp-confirm`,role:`alert`,children:[t(`env.fullAccessWarn`),I(`button`,{type:`button`,className:`sp-action is-warning`,onClick:()=>void l(`full_access`),children:t(`env.turnOn`)}),I(`button`,{type:`button`,className:`sp-action`,onClick:()=>a(!1),children:t(`sp.cancel`)})]}),o&&I(`span`,{className:`sp-error`,role:`alert`,children:o})]})}var rB={file:{label:`out.kind.file`,Icon:Yi},export:{label:`out.kind.export`,Icon:Ui},image:{label:`out.kind.image`,Icon:_a},document:{label:`out.kind.document`,Icon:Da},memory:{label:`out.kind.memory`,Icon:kr},schedule:{label:`out.kind.schedule`,Icon:Fr}},iB={created:`out.change.created`,edited:`out.change.edited`,deleted:`out.change.deleted`};function aB(e,t,n){if(!e)return null;let r=Date.parse(`${e.replace(` `,`T`)}Z`);if(Number.isNaN(r))return null;let i=Math.max(0,Math.round((t-r)/1e3));return i<60?{key:`out.justNow`}:i<3600?{key:`out.minAgo`,params:{n:Math.floor(i/60)}}:i<86400?{key:`out.hAgo`,params:{n:Math.floor(i/3600)}}:new Date(r).toLocaleDateString(n,{month:`short`,day:`numeric`})}function oB(e){return e.state===`undone`?`out.undone`:e.state===`gone`?`sp.gone`:null}function sB({sessionId:e,busy:t,onJumpToMessage:n}){let r=R();return I(Mz,{id:`outputs`,title:r(`out.title`),children:I(cB,{sessionId:e,busy:t,onJumpToMessage:n})})}function cB({sessionId:e,busy:t,onJumpToMessage:n}){let r=R(),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),[d,f]=(0,V.useState)(!1),p=(0,V.useCallback)(()=>{let t=!0;return Promise.resolve().then(()=>k(e)).then(e=>{t&&(a(nR(e,e=>Array.isArray(e.items),`list of outputs`).items),s(null))}).catch(n=>{t&&(F.ui.warn(`Could not list what session=${e} produced`,n),s(SM(n)))}),()=>{t=!1}},[e]);(0,V.useEffect)(p,[p]),ku(t,p),jM(e,p);let m=(e,t)=>{l(null),e.catch(e=>l(r(`sp.couldntOpen`,{name:t,error:SM(e)})))};if(o)return I(`p`,{className:`sp-error`,children:r(`out.listError`,{error:o})});if(!i)return I(`p`,{className:`sp-meta`,children:r(`sp.checking`)});if(i.length===0)return I(`p`,{className:`sp-meta`,children:r(`out.empty`)});let h=d?i:i.slice(0,5);return z(P.Fragment,{children:[I(`ul`,{className:`sp-list`,"aria-label":r(`out.listLabel`),children:h.map(e=>{let{label:t,Icon:i}=rB[e.kind],a=oB(e),o=e.change&&e.kind!==`document`?iB[e.change]:void 0,s=aB(e.created_at,Date.now(),Sn(r)),c=r.compose(e=>[o?e(`out.kindChanged`,{kind:u(t),change:u(o)}):e(t),s==null?``:typeof s==`string`?s:e(s.key,s.params),a?e(a):``].filter(Boolean).join(` · `));return z(`li`,{className:`sp-output${e.state===`present`?``:` is-inactive`}`,children:[I(i,{size:13,className:`sp-item-icon`,"aria-hidden":`true`}),z(`div`,{className:`sp-item-text`,children:[I(`span`,{className:`sp-item-name`,dir:`ltr`,title:e.path??e.name,children:e.name}),I(`span`,{className:`sp-meta`,children:c}),z(`span`,{className:`sp-item-actions`,children:[e.message_id!=null&&z(`button`,{type:`button`,className:`sp-action`,onClick:()=>{n(e.message_id)||l(r(`out.notLoaded`))},"aria-label":r(`out.goToAria`,{name:e.name}),children:[I(_i,{size:11,"aria-hidden":`true`}),` `,r(`sp.goToTurn`)]}),e.openable&&e.path&&I(`button`,{type:`button`,className:`sp-action`,onClick:()=>m(wt(e.path),e.name),children:r(`sp.open`)}),e.revealable&&e.path&&z(`button`,{type:`button`,className:`sp-action`,onClick:()=>m($t(e.path,!0),e.name),children:[I($i,{size:11,"aria-hidden":`true`}),` `,r(`sp.showInFolder`)]})]})]})]},e.id)})}),i.length>5&&I(`button`,{type:`button`,className:`link-btn sp-more`,onClick:()=>f(e=>!e),children:d?r(`out.fewer`):r(`out.more`,{n:i.length-5})}),c&&I(`p`,{className:`sp-error`,role:`alert`,children:c})]})}function lB(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function uB(e){let t=e.split(/[\\/]/).filter(Boolean);return t[t.length-1]??e}var dB=e=>u(e===1?`chg.files.one`:`chg.files.other`,{n:e});function fB(e,t=gt){let{files:n,additions:r,deletions:i}=e.totals;return t(`chg.total`,{files:dB(n),add:r,del:i})}var pB={edited:`Edited`,created:`Created`,deleted:`Deleted`},mB={edited:`chg.edited`,created:`chg.created`,deleted:`chg.deleted`};function hB({sessionId:e,busy:t,onJumpToMessage:n}){let r=R(),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),u=(0,V.useCallback)(()=>{Promise.resolve().then(()=>fe(e)).then(e=>{a(nR(e,e=>Array.isArray(e.files),`list of this chat's changes`)),s(null)}).catch(t=>{F.ui.warn(`Could not total what session=${e} changed`,t),s(SM(t))})},[e]);(0,V.useEffect)(u,[u]),ku(t,()=>{l(null),u()}),jM(e,u);let d=!i||i.files.length===0;return!o&&d&&!c?null:z(Mz,{id:`changes`,title:r(`chg.title`),summary:i&&!d?r(`chg.summary`,{files:dB(i.totals.files),add:i.totals.additions,del:i.totals.deletions}):null,children:[o&&I(`p`,{className:`sp-error`,children:r(`chg.error`,{error:o})}),i&&!d&&I(gB,{sessionId:e,busy:t,changes:i,onChanged:u,onUndone:l,onJumpToMessage:n}),d&&c&&I(`p`,{className:`sp-ok`,role:`status`,children:c})]})}function gB({sessionId:e,busy:t,changes:n,onChanged:r,onUndone:i,onJumpToMessage:a}){let o=R(),[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(`idle`),[d,f]=(0,V.useState)(null),p=n.files.length,m=async t=>{u(`working`),f(null);try{let n=await rt(e,t),r=[];n.restored.length&&r.push(`restored ${lB(n.restored.length,`file`)}`),n.removed.length&&r.push(`removed ${lB(n.removed.length,`new file`)}`);let a=`Undone: ${r.join(`, `)||`no files needed changing`}.`;n.kept_folders.length&&(a+=` Kept ${lB(n.kept_folders.length,`folder`)} the chat created, because they now hold other files.`),f(a),u(`done`),i(a),AM(e),await DM(e)}catch(e){let t=e?.reason===`conflict`;f(CM(e)),u(t?`conflict`:`idle`)}};return z(`div`,{className:`sp-changes`,children:[z(`p`,{className:`sp-changes-total`,"aria-live":`polite`,children:[I(`strong`,{children:fB(n,o)}),n.totals.uncounted>0&&z(`span`,{className:`sp-meta`,children:[` · `,o.plural(`chg.uncounted`,n.totals.uncounted)]})]}),n.pending&&I(`p`,{className:`sp-meta`,children:o(`chg.pending`)}),I(`ul`,{className:`sp-list`,children:n.files.map(e=>{let t=e.message_ids[e.message_ids.length-1];return z(`li`,{className:`sp-change`,children:[z(`div`,{className:`sp-item-text`,children:[I(`span`,{className:`sp-item-name`,dir:`ltr`,title:e.path,children:uB(e.path)}),z(`span`,{className:`sp-meta`,children:[o(mB[e.change]),e.additions!=null&&z(P.Fragment,{children:[` · `,z(`span`,{className:`sp-add`,children:[`+`,e.additions]}),` `,z(`span`,{className:`sp-del`,children:[`−`,e.deletions]})]}),e.message_ids.length>1&&` · ${o(`chg.turns`,{n:e.message_ids.length})}`]}),e.changed_since&&z(`span`,{className:`sp-warn-text`,children:[I(ws,{size:11,"aria-hidden":`true`}),` `,o(`chg.outside`,{when:e.changed_since})]})]}),t!=null&&I(`button`,{type:`button`,className:`btn-icon-sm`,onClick:()=>a(t),"aria-label":o(`chg.goToLast`,{name:uB(e.path)}),title:o(`sp.goToTurn`),children:I(_i,{size:12})})]},e.path)})}),n.incomplete&&z(`p`,{className:`sp-warn-text`,role:`note`,children:[I(ws,{size:11,"aria-hidden":`true`}),` `,zM(n.untracked,{inChat:!0},o)]}),z(`div`,{className:`sp-actions-row`,children:[z(`button`,{type:`button`,className:`sp-action`,onClick:()=>c(!0),children:[I(Li,{size:12,"aria-hidden":`true`}),` `,o(`chg.review`)]}),l!==`confirm`&&l!==`conflict`&&z(`button`,{type:`button`,className:`sp-action`,onClick:()=>u(`confirm`),disabled:l===`working`||t,title:t?o(`chg.wait`):void 0,children:[I(Es,{size:12,"aria-hidden":`true`}),` `,o(l===`working`?`chg.undoing`:`chg.undoAll`)]})]}),l===`confirm`&&z(`div`,{className:`sp-confirm`,role:`group`,"aria-label":o(`chg.confirmLabel`),children:[o(p===1?`chg.confirm.one`:`chg.confirm.other`,{files:dB(p)}),z(`span`,{className:`sp-actions-row`,children:[I(`button`,{type:`button`,className:`sp-action is-danger`,onClick:()=>void m(!1),children:o(`chg.undoAll`)}),I(`button`,{type:`button`,className:`sp-action`,onClick:()=>u(`idle`),children:o(`sp.cancel`)})]})]}),d&&z(`div`,{className:l===`done`?`sp-ok`:`sp-error`,role:l===`done`?`status`:`alert`,children:[d,l===`conflict`&&z(`span`,{className:`sp-actions-row`,children:[I(`button`,{type:`button`,className:`sp-action is-danger`,onClick:()=>void m(!0),children:o(`chg.undoAnyway`)}),I(`button`,{type:`button`,className:`sp-action`,onClick:()=>{u(`idle`),f(null)},children:o(`chg.keep`)})]})]}),I(yB,{sessionId:e,busy:t,onCommitted:r}),s&&I(vB,{changes:n,onClose:()=>c(!1)})]})}function _B(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 vB({changes:e,onClose:t}){pt(!0,t);let n=(0,V.useRef)(null);return on(n,!0),I(`div`,{ref:n,className:`modal-overlay`,onClick:t,role:`dialog`,"aria-modal":`true`,"aria-label":`Review this chat's changes`,children:z(`div`,{className:`modal-panel changes-review`,onClick:e=>e.stopPropagation(),children:[z(`div`,{className:`modal-header`,children:[z(`h3`,{children:[`Changes in this chat · `,fB(e)]}),I(`button`,{type:`button`,className:`btn-icon`,onClick:t,"aria-label":`Close`,children:I(Is,{size:18})})]}),I(`div`,{className:`modal-body changes-review-body`,children:e.files.map(e=>I(`section`,{className:`changes-review-file`,children:I(jk,{data:{path:e.path,badge:pB[e.change],note:_B(e),unified:e.binary||e.too_large?``:e.unified}})},e.path))})]})})}function yB({sessionId:e,busy:t,onCommitted:n}){let r=R(),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(null),f=(0,V.useCallback)(()=>{Promise.resolve().then(()=>yn(e)).then(e=>{a(nR(e,e=>Array.isArray(e.repos),`list of git repositories`)),s(null)}).catch(e=>s(SM(e)))},[e]);return(0,V.useEffect)(f,[f]),ku(t,f),jM(e,f),o?I(`p`,{className:`sp-error`,children:r(`chg.gitError`,{error:o})}):!i||!i.available||i.repos.length===0?null:z(`div`,{className:`sp-git`,children:[i.repos.map(e=>z(`div`,{className:`sp-git-repo`,children:[z(`span`,{className:`sp-meta`,title:e.root,children:[I(sa,{size:12,"aria-hidden":`true`}),` `,uB(e.root),` · `,e.branch,e.uncommitted.length===0&&e.files.length>0&&` · committed`]}),z(`span`,{className:`sp-actions-row`,children:[z(`button`,{type:`button`,className:`sp-action`,disabled:t||e.uncommitted.length===0,onClick:()=>{d(null),l({kind:`commit`,repo:e})},children:[I(la,{size:12,"aria-hidden":`true`}),` Commit…`]}),z(`button`,{type:`button`,className:`sp-action`,disabled:t||e.pr_blocked!=null,title:e.pr_blocked??void 0,onClick:()=>{d(null),l({kind:`pr`,repo:e})},children:[I(da,{size:12,"aria-hidden":`true`}),` Create PR…`]})]}),e.pr_blocked&&I(`span`,{className:`sp-meta`,children:e.pr_blocked})]},e.root)),u&&I(`p`,{className:`sp-ok`,role:`status`,children:u}),c&&I(bB,{sessionId:e,kind:c.kind,repo:c.repo,onClose:()=>l(null),onDone:e=>{l(null),d(e),f(),n()}})]})}function bB({sessionId:e,kind:t,repo:n,onClose:r,onDone:i}){let[a,o]=(0,V.useState)(n.draft.title),[s,c]=(0,V.useState)(n.draft.body),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(null);pt(!0,r,!l);let p=(0,V.useRef)(null);on(p,!0);let m=async()=>{u(!0),f(null);try{if(t===`commit`){let t=await Ye(e,n.root,`${a.trim()}\n\n${s.trim()}`.trim());i(`Committed ${lB(t.files.length,`file`)} as ${t.commit}.`)}else i(`Opened ${(await A(e,n.root,a,s)).url}`)}catch(e){f(CM(e)),u(!1)}},h=t===`commit`?n.uncommitted:n.files;return I(`div`,{className:`modal-overlay`,onClick:l?void 0:r,children:z(`div`,{ref:p,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:[z(`div`,{className:`modal-header`,children:[I(`h3`,{children:t===`commit`?`Commit this chat’s changes`:`Create a pull request`}),I(`button`,{type:`button`,className:`btn-icon`,onClick:r,disabled:l,"aria-label":`Close`,children:I(Is,{size:18})})]}),z(`div`,{className:`modal-body sp-git-body`,children:[I(`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.`}),z(`label`,{className:`sp-field`,children:[I(`span`,{children:t===`commit`?`Summary`:`Title`}),I(`input`,{value:a,onChange:e=>o(e.target.value),disabled:l})]}),z(`label`,{className:`sp-field`,children:[I(`span`,{children:t===`commit`?`Details`:`Description`}),I(`textarea`,{value:s,onChange:e=>c(e.target.value),rows:7,disabled:l})]}),z(`div`,{className:`sp-meta`,children:[lB(h.length,`file`),`: `,h.join(`, `)]}),t===`commit`&&n.ignored.length>0&&z(`div`,{className:`sp-meta`,children:[`Left out, because git ignores `,n.ignored.length===1?`it`:`them`,`: `,n.ignored.join(`, `)]}),d&&I(`p`,{className:`sp-error`,role:`alert`,children:d})]}),z(`div`,{className:`sp-picker-actions`,children:[I(`button`,{type:`button`,className:`btn-secondary`,onClick:r,disabled:l,children:`Cancel`}),z(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void m(),disabled:l||!a.trim(),children:[l&&I(La,{size:13,className:`spin`,"aria-hidden":`true`}),t===`commit`?`Commit ${lB(h.length,`file`)}`:`Push and open PR`]})]})]})})}var xB=1200,SB=`gaia.browserPane.openChats`,CB=`gaia.browserPane.width`;function wB(){return typeof window>`u`?void 0:window.gaiaBrowserPane}function TB(e){try{return window.localStorage.getItem(e)}catch(t){return F.ui.warn(`Browser pane setting ${e} unavailable; using the default`,t),null}}function EB(e,t){try{window.localStorage.setItem(e,t)}catch(t){F.ui.warn(`Could not remember browser pane setting ${e}`,t)}}function DB(e){let t=typeof document<`u`?window.innerWidth-OB()-560:xB;return Math.round(Math.max(360,Math.min(e,xB,t)))}function OB(){return document.querySelector(`.main-content`)?.getBoundingClientRect().left??0}function kB(){let e=TB(SB);if(e===null)return[];try{let t=JSON.parse(e);if(!Array.isArray(t)||!t.every(e=>typeof e==`string`))throw Error(`expected a list of chat ids`);return t.slice(0,200)}catch(e){return F.ui.warn(`Ignoring unreadable ${SB}; every chat's browser pane starts closed`,e),[]}}function AB(e,t){return t===null?e.draftOpen:e.openChats.includes(t)}var jB=()=>B.getState().currentSessionId,MB=Ct((e,t)=>{let n=t=>{let n=t.slice(0,200);EB(SB,JSON.stringify(n)),e({openChats:n})};return{pane:null,openChats:wB()===void 0?[]:kB(),draftOpen:!1,width:DB(Number(TB(CB))||520),setOpen:r=>{let i=jB();i===null?e({draftOpen:r}):n([...r?[i]:[],...t().openChats.filter(e=>e!==i)]),r&&fz.getState().open&&fz.getState().setOpen(!1)},toggle:()=>t().setOpen(!AB(t(),jB())),claimDraft:r=>{t().draftOpen&&(e({draftOpen:!1}),n([r,...t().openChats.filter(e=>e!==r)])),wB()?.claimDraft(r)},forgetChat:e=>{t().openChats.includes(e)&&n(t().openChats.filter(t=>t!==e)),wB()?.forgetChat(e)},setWidth:t=>{let n=DB(t);EB(CB,String(n)),e({width:n})}}});function NB(){let e=B(e=>e.currentSessionId);return MB(t=>AB(t,e))}zn(e=>MB.getState().forgetChat(e)),B.subscribe((e,t)=>{e.currentSessionId!==t.currentSessionId&&AB(MB.getState(),e.currentSessionId)&&fz.getState().open&&fz.getState().setOpen(!1)}),fz.subscribe((e,t)=>{e.open&&!t.open&&AB(MB.getState(),jB())&&MB.getState().setOpen(!1)});function PB(e){let t=!0,n=!1,r=e.onState(e=>{n=!0,MB.setState({pane:e})});return e.getState().then(e=>{t&&!n&&MB.setState({pane:e})}).catch(e=>F.ui.error(`Could not read the browser pane state`,e)),()=>{t=!1,r()}}function FB(){return(0,V.useSyncExternalStore)(Bt,()=>nn()>0)}function IB(e){let t=e.toLowerCase().replace(/\.$/,``);return t===`localhost`||t.endsWith(`.localhost`)||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(t)||t===`[::1]`}var LB=/^[a-z][a-z0-9+.-]*:(?!\d)/i;function RB(e){let t=e.trim();if(!t||/\s/.test(t))return null;if(LB.test(t))return t;let n;try{n=new URL(`http://${t}`)}catch{return null}return IB(n.hostname)?n.href:n.hostname.includes(`.`)||n.port!==``?(n.protocol=`https:`,n.href):null}var zB={starting:`browserPane.devServer.starting`,ready:`browserPane.devServer.ready`,failed:`browserPane.devServer.failed`,exited:`browserPane.devServer.exited`,stopped:`browserPane.devServer.stopped`},BB=e=>e.status===`starting`||e.status===`ready`;function VB(e,t){t.catch(t=>F.ui.error(`Browser pane: ${e} failed`,t))}function HB(e){let t=e.chats[0],n=B(e=>e.currentSessionId),r=B(e=>e.sessions.find(e=>e.id===t)?.title),i=R();return t===n?i(`browserPane.startedHere`):r===void 0?null:i(`browserPane.startedIn`,{title:r})}function UB({server:e}){let t=HB(e);return t===null?null:I(`div`,{className:`bp-devserver-chat`,children:t})}function WB({api:e,servers:t}){let[n,r]=(0,V.useState)(!1),i=(0,V.useRef)(null),a=()=>r(!1),o=t.filter(BB).length,s=R();return z(`div`,{className:`bp-menu`,children:[I(`button`,{ref:i,type:`button`,className:`btn-icon-sm${n||o?` active`:``}`,"aria-label":s(`browserPane.devServers`),"aria-expanded":n,title:o?s(`browserPane.devServersRunning`,{n:o}):s(`browserPane.devServers`),onClick:()=>r(e=>!e),children:I(Jo,{size:15})}),z(Gs,{open:n,onClose:a,anchor:i,label:s(`browserPane.devServers`),placement:`below`,align:`end`,children:[I(`div`,{className:`popover-heading`,children:s(`browserPane.devServers`)}),t.length===0&&I(`p`,{className:`bp-devservers-empty`,children:s(`browserPane.devServersEmpty`)}),t.map(t=>z(`div`,{className:`bp-devserver`,role:`group`,"aria-label":s(`browserPane.devServerNamed`,{name:t.name}),children:[z(`div`,{className:`bp-devserver-head`,children:[I(`span`,{className:`bp-devserver-name`,children:t.name}),I(`span`,{className:`bp-devserver-status is-${t.status}`,children:s(zB[t.status])}),z(`span`,{className:`bp-devserver-port`,dir:`ltr`,children:[`:`,t.port]})]}),I(UB,{server:t}),I(`div`,{className:`bp-devserver-cmd`,title:t.cwd,dir:`ltr`,children:t.argv.join(` `)}),z(`div`,{className:`bp-devserver-actions`,children:[z(`button`,{type:`button`,className:`bp-chip`,disabled:t.status!==`ready`,onClick:()=>{a(),VB(`open dev server`,e.openTab(t.url))},children:[I(fo,{size:12,"aria-hidden":`true`}),` `,s(`browserPane.openInPane`)]}),z(`button`,{type:`button`,className:`bp-chip`,disabled:!BB(t),onClick:()=>VB(`stop dev server`,e.stopDevServer(t.key)),children:[I(si,{size:12,"aria-hidden":`true`}),` `,s(`browserPane.stopServer`)]})]})]},t.key))]})]})}var GB=`Mod+Shift+B`,KB=`Mod+Shift+S`;function qB(e,t){t.catch(t=>F.ui.error(`Browser pane: ${e} failed`,t))}function JB({pane:e,api:t,onClosePane:n,addressRef:r}){let i=e.tabs.find(t=>t.id===e.activeTabId),a=i.url!==null,o=R();return z(`div`,{className:`bp-toolbar`,children:[z(`div`,{className:`bp-tabs`,role:`tablist`,"aria-label":o(`browserPane.tabs`),children:[e.tabs.map(n=>{let r=n.id===e.activeTabId;return z(`div`,{className:`bp-tab${r?` is-active`:``}`,children:[z(`button`,{type:`button`,role:`tab`,"aria-selected":r,className:`bp-tab-title`,title:n.url??n.title,onClick:()=>qB(`select tab`,t.selectTab(n.id)),children:[n.loading&&I(`span`,{className:`bp-tab-spinner`,"aria-hidden":`true`}),n.control===`private`&&I(Va,{size:11,"aria-label":o(`browserPane.private`)}),I(`span`,{children:n.title||n.url||o(`browserPane.newTab`)})]}),I(`button`,{type:`button`,className:`bp-tab-close`,"aria-label":o(`browserPane.closeTabNamed`,{name:n.title}),title:o(`browserPane.closeTab`),onClick:()=>qB(`close tab`,t.closeTab(n.id)),children:I(Is,{size:12})})]},n.id)}),I(`button`,{type:`button`,className:`btn-icon-sm bp-new-tab`,"aria-label":o(`browserPane.newTab`),title:o(`browserPane.newTab`),onClick:()=>qB(`open tab`,t.openTab(null)),children:I(Oo,{size:14})})]}),z(`div`,{className:`bp-nav`,children:[I(`button`,{type:`button`,className:`btn-icon-sm`,"aria-label":o(`browserPane.back`),title:o(`browserPane.back`),disabled:!i.canGoBack,onClick:()=>qB(`back`,t.history(i.id,`back`)),children:I(pr,{size:15})}),I(`button`,{type:`button`,className:`btn-icon-sm`,"aria-label":o(`browserPane.forward`),title:o(`browserPane.forward`),disabled:!i.canGoForward,onClick:()=>qB(`forward`,t.history(i.id,`forward`)),children:I(hr,{size:15})}),i.loading?I(`button`,{type:`button`,className:`btn-icon-sm`,"aria-label":o(`browserPane.stopLoading`),title:o(`browserPane.stopLoading`),onClick:()=>qB(`stop`,t.history(i.id,`stop`)),children:I(Is,{size:15})}):I(`button`,{type:`button`,className:`btn-icon-sm`,"aria-label":o(`browserPane.reload`),title:o(`browserPane.reload`),disabled:!a,onClick:()=>qB(`reload`,t.history(i.id,`reload`)),children:I(Bo,{size:15})}),I(YB,{tab:i,inputRef:r,onSubmit:e=>qB(`navigate`,t.navigate(i.id,e))},i.id),I(`button`,{type:`button`,className:`btn-icon-sm${e.picking?` active`:``}`,"aria-label":o(`browserPane.select`),"aria-pressed":e.picking,title:o.hint(o(e.picking?`browserPane.selectStop`:`browserPane.selectStart`),Yl(KB)),disabled:!a,onClick:()=>qB(`select element`,t.togglePicking()),children:I(ms,{size:15})}),I(`button`,{type:`button`,className:`btn-icon-sm${i.devToolsOpen?` active`:``}`,"aria-label":o(`browserPane.devTools`),"aria-pressed":i.devToolsOpen,title:o(i.devToolsOpen?`browserPane.devToolsHide`:`browserPane.devToolsShow`),disabled:!a,onClick:()=>qB(`developer tools`,t.toggleDevTools(i.id)),children:I(fs,{size:15})}),I(tV,{api:t,tab:i}),I(WB,{api:t,servers:e.devServers}),I(XB,{api:t,tab:i}),I(`button`,{type:`button`,className:`btn-icon-sm`,"aria-label":o(`browserPane.close`),title:o.hint(o(`browserPane.close`),Yl(GB)),onClick:n,children:I(so,{size:15})})]})]})}function YB({tab:e,inputRef:t,onSubmit:n}){let[r,i]=(0,V.useState)(null),[a,o]=(0,V.useState)(!1),s=R();return(0,V.useEffect)(()=>{i(null),o(!1)},[e.url]),I(`form`,{className:`bp-address`,onSubmit:a=>{a.preventDefault();let s=RB(r??e.url??``);s===null?o(!0):(i(null),o(!1),n(s),t.current?.blur())},role:`search`,children:I(`input`,{ref:t,type:`text`,className:`bp-address-input${a?` is-invalid`:``}`,"aria-label":s(`browserPane.address`),"aria-invalid":a,title:a?s(`browserPane.addressInvalid`):void 0,placeholder:s(`browserPane.addressPlaceholder`),dir:`ltr`,spellCheck:!1,autoComplete:`off`,value:r??e.url??``,onChange:e=>{i(e.target.value),o(!1)},onFocus:e=>e.currentTarget.select(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),i(null),o(!1),e.currentTarget.blur())},...Pt})})}function XB({api:e,tab:t}){let[n,r]=(0,V.useState)(!1),i=(0,V.useRef)(null),a=()=>r(!1),o=R();return z(`div`,{className:`bp-menu`,children:[I(`button`,{ref:i,type:`button`,className:`btn-icon-sm${n?` active`:``}`,"aria-label":o(`browserPane.moreActions`),"aria-expanded":n,title:o(`browserPane.more`),onClick:()=>r(e=>!e),children:I(Di,{size:15})}),z(Gs,{open:n,onClose:a,anchor:i,label:o(`browserPane.actions`),placement:`below`,align:`end`,children:[z(`button`,{type:`button`,className:`popover-item`,onClick:()=>{a(),qB(`tab privacy`,e.setControl(t.id,t.control===`private`?`shared`:`private`))},children:[t.control===`private`?I(za,{size:14,"aria-hidden":`true`}):I(Va,{size:14,"aria-hidden":`true`}),z(`span`,{className:`popover-item-body`,children:[I(`span`,{className:`popover-item-title`,children:o(t.control===`private`?`browserPane.shareTab`:`browserPane.privateTab`)}),I(`span`,{className:`popover-item-note`,children:o(t.control===`private`?`browserPane.shareTabNote`:`browserPane.privateTabNote`)})]})]}),z(`button`,{type:`button`,className:`popover-item`,disabled:t.url===null,onClick:()=>{a(),qB(`open in system browser`,e.openExternal(t.id))},children:[I(ji,{size:14,"aria-hidden":`true`}),I(`span`,{className:`popover-item-body`,children:I(`span`,{className:`popover-item-title`,children:o(`browserPane.openExternal`)})})]}),z(`button`,{type:`button`,className:`popover-item`,onClick:()=>{a(),qB(`clear browsing data`,e.clearBrowsingData())},children:[I(ki,{size:14,"aria-hidden":`true`}),z(`span`,{className:`popover-item-body`,children:[I(`span`,{className:`popover-item-title`,children:o(`browserPane.clearData`)}),I(`span`,{className:`popover-item-note`,children:o(`browserPane.clearDataNote`)})]})]})]})]})}var ZB=[{name:`iPhone SE`,width:375,height:667,mobile:!0},{name:`iPhone 15`,width:393,height:852,mobile:!0},{name:`Pixel 8`,width:412,height:915,mobile:!0},{name:`iPad mini`,width:768,height:1024,mobile:!0},{name:`iPad Air`,width:820,height:1180,mobile:!0},{name:`Laptop`,width:1280,height:800,mobile:!1,label:`browserPane.laptop`}],QB=[{label:`browserPane.scheme.system`,value:null},{label:`browserPane.scheme.light`,value:`light`},{label:`browserPane.scheme.dark`,value:`dark`}],$B=200,eV=4e3;function tV({api:e,tab:t}){let[n,r]=(0,V.useState)(!1),i=(0,V.useCallback)(()=>r(!1),[]),a=(0,V.useRef)(null),o=t.viewport,s=o?.size??null,c=o?.colorScheme??null,[l,u]=(0,V.useState)(``),[d,f]=(0,V.useState)(``),p=R();(0,V.useEffect)(()=>{u(s?String(s.width):``),f(s?String(s.height):``)},[s?.width,s?.height]);let m=n=>{let r=n.size===null&&n.colorScheme===null;qB(`responsive`,e.setViewport(t.id,r?null:n))},h=e=>{let t=Number(e);return Number.isInteger(t)&&t>=$B&&t<=eV?t:null},g=h(l),_=h(d);return z(`div`,{className:`bp-menu`,children:[I(`button`,{ref:a,type:`button`,className:`btn-icon-sm${o?` active`:``}`,"aria-label":p(`browserPane.responsive`),"aria-expanded":n,"aria-pressed":o!==null,title:s?p(`browserPane.responsiveSize`,{width:s.width,height:s.height}):p(`browserPane.responsive`),disabled:t.url===null,onClick:()=>r(e=>!e),children:I(Za,{size:15})}),I(Gs,{open:n,onClose:i,anchor:a,label:p(`browserPane.responsive`),placement:`below`,align:`end`,children:z(`div`,{className:`bp-responsive`,children:[o?.source===`agent`&&I(`p`,{className:`bp-responsive-note`,children:p(`browserPane.agentChose`)}),z(`div`,{className:`bp-responsive-presets`,role:`group`,"aria-label":p(`browserPane.screenSize`),children:[I(`button`,{type:`button`,className:`bp-chip${s===null?` is-on`:``}`,"aria-pressed":s===null,onClick:()=>m({size:null,colorScheme:c}),children:p(`browserPane.fillPane`)}),ZB.map(e=>{let t=s!==null&&s.width===e.width&&s.height===e.height;return I(`button`,{type:`button`,className:`bp-chip${t?` is-on`:``}`,"aria-pressed":t,title:`${e.width}×${e.height}`,onClick:()=>m({size:{width:e.width,height:e.height,mobile:e.mobile},colorScheme:c}),children:e.label?p(e.label):e.name},e.name)})]}),z(`form`,{className:`bp-responsive-size`,onSubmit:e=>{e.preventDefault(),g!==null&&_!==null&&m({size:{width:g,height:_,mobile:g<768},colorScheme:c})},children:[I(`input`,{"aria-label":p(`browserPane.width`),inputMode:`numeric`,value:l,placeholder:p(`browserPane.width`),onChange:e=>u(e.target.value)}),I(`span`,{"aria-hidden":`true`,children:`×`}),I(`input`,{"aria-label":p(`browserPane.height`),inputMode:`numeric`,value:d,placeholder:p(`browserPane.height`),onChange:e=>f(e.target.value)}),I(`button`,{type:`submit`,className:`bp-chip`,disabled:g===null||_===null,children:p(`browserPane.setSize`)}),I(`button`,{type:`button`,className:`btn-icon-sm`,"aria-label":p(`browserPane.rotate`),title:p(`browserPane.rotate`),disabled:s===null,onClick:()=>s&&m({size:{...s,width:s.height,height:s.width},colorScheme:c}),children:I(Io,{size:15})})]}),I(`div`,{className:`bp-responsive-presets`,role:`group`,"aria-label":p(`browserPane.colorScheme`),children:QB.map(e=>I(`button`,{type:`button`,className:`bp-chip${c===e.value?` is-on`:``}`,"aria-pressed":c===e.value,onClick:()=>m({size:s,colorScheme:e.value}),children:p(e.label)},e.label))})]})})]})}function nV({api:e}){let t=R();return z(`div`,{className:`bp-agent-strip is-picking`,role:`status`,children:[I(`span`,{children:t(`browserPane.pickHelp`)}),I(`button`,{type:`button`,className:`bp-chip`,onClick:()=>qB(`stop selecting`,e.togglePicking()),children:t(`browserPane.done`)})]})}function rV({tab:e,api:t}){let n=R();return e.control===`private`?I(`div`,{className:`bp-agent-strip is-private`,role:`status`,children:I(`span`,{children:n(`browserPane.privateStrip`)})}):e.control===`user`?z(`div`,{className:`bp-agent-strip is-paused`,role:`status`,children:[I(`span`,{children:n(`browserPane.paused`)}),I(`button`,{type:`button`,className:`bp-chip`,onClick:()=>qB(`resume`,t.setControl(e.id,`shared`)),children:n(`browserPane.resume`)})]}):!e.agentActing&&!e.agentBusy?null:z(`div`,{className:`bp-agent-strip`,role:`status`,children:[I(`span`,{children:n(e.agentActing?`browserPane.agentUsing`:`browserPane.agentReading`)}),I(`button`,{type:`button`,className:`bp-chip`,onClick:()=>qB(`pause`,t.setControl(e.id,`user`)),children:n(`browserPane.pause`)})]})}var iV={alert:{ok:`browserPane.dialog.ok`,cancel:null},confirm:{ok:`browserPane.dialog.ok`,cancel:`browserPane.dialog.cancel`},prompt:{ok:`browserPane.dialog.ok`,cancel:`browserPane.dialog.cancel`},beforeunload:{ok:`browserPane.dialog.leave`,cancel:`browserPane.dialog.stay`}};function aV(e){try{return new URL(e).host||e}catch{return e}}function oV({tab:e,api:t}){let n=e.dialog,r=R(),[i,a]=(0,V.useState)(n?.defaultText??``);if((0,V.useEffect)(()=>a(n?.defaultText??``),[n]),!n)return null;let{ok:o,cancel:s}=iV[n.type],c=r=>{t.answerDialog(e.id,r,n.type===`prompt`&&r?i:null).catch(e=>F.ui.error(`Browser pane: answering the page box failed`,e))};return z(`form`,{className:`bp-dialog`,role:`alertdialog`,"aria-label":r(`browserPane.dialog.says`,{host:aV(n.url)}),onSubmit:e=>{e.preventDefault(),c(!0)},children:[I(`span`,{className:`bp-dialog-from`,children:r(`browserPane.dialog.says`,{host:aV(n.url)})}),I(`span`,{className:`bp-dialog-message`,children:n.message}),n.type===`prompt`&&I(`input`,{className:`bp-dialog-input`,"aria-label":r(`browserPane.dialog.answer`),value:i,onChange:e=>a(e.target.value),autoFocus:!0}),z(`span`,{className:`bp-dialog-actions`,children:[s&&I(`button`,{type:`button`,className:`bp-chip`,onClick:()=>c(!1),children:r(s)}),I(`button`,{type:`submit`,className:`bp-chip is-on`,children:r(o)})]})]})}function sV(e,t){return(e.ctrlKey||e.metaKey)&&e.shiftKey&&!e.altKey&&e.key.toLowerCase()===t}function cV({api:e}){let t=B(e=>e.currentSessionId),n=NB(),r=MB(e=>e.pane);(0,V.useEffect)(()=>PB(e),[e]),(0,V.useEffect)(()=>{e.setView(t,n)},[e,t,n]),(0,V.useEffect)(()=>()=>e.setView(B.getState().currentSessionId,!1),[e]),(0,V.useEffect)(()=>e.onPicked(e=>DN.getState().applyPick(e)),[e]),(0,V.useEffect)(()=>{let t=t=>{sV(t,`b`)?(t.preventDefault(),MB.getState().toggle()):sV(t,`s`)&&(t.preventDefault(),MB.getState().setOpen(!0),e.togglePicking().catch(e=>F.ui.warn(`Could not start selecting an element`,e)))};window.addEventListener(`keydown`,t);let n=e.onCommand(e=>{e.kind===`toggle`?MB.getState().toggle():e.chat===B.getState().currentSessionId&&MB.getState().setOpen(!0)});return()=>{window.removeEventListener(`keydown`,t),n()}},[e]);let i=r&&r.chat===t?r.tabs.find(e=>e.id===r.activeTabId):void 0;return!n||!r||!i?null:I(lV,{api:e,pane:r,active:i})}function lV({api:e,pane:t,active:n}){let r=MB(e=>e.width),i=MB(e=>e.setWidth),a=MB(e=>e.setOpen),o=FB(),s=(0,V.useRef)(null),c=(0,V.useRef)(null),[l,u]=(0,V.useState)(null),d=R(),f=mz({width:r,setWidth:i,clamp:DB,min:360,max:xB,defaultWidth:520});return(0,V.useLayoutEffect)(()=>{let t=s.current;if(!t)return;let n=()=>{let n=t.getBoundingClientRect();e.setBounds({x:n.x,y:n.y,width:n.width,height:n.height})};n();let r=new ResizeObserver(n);return r.observe(t),window.addEventListener(`resize`,n),()=>{r.disconnect(),window.removeEventListener(`resize`,n)}},[e]),(0,V.useEffect)(()=>{let t=!0;return e.setOccluded(o).then(e=>{t&&u(o?e:null)}).catch(e=>F.ui.error(`Could not hide the browser page under an overlay`,e)),()=>{t=!1}},[e,o]),(0,V.useEffect)(()=>{let e=document.documentElement;return e.style.setProperty(`--browser-pane-inset`,`${f.width}px`),()=>{e.style.removeProperty(`--browser-pane-inset`)}},[f.width]),(0,V.useEffect)(()=>{n.url===null&&c.current?.focus()},[n.id,n.url]),z(`aside`,{className:`browser-pane`,style:{width:f.width},"aria-label":d(`browserPane.label`),children:[I(`div`,{className:`bp-resize${f.dragging?` is-dragging`:``}`,"aria-label":d(`browserPane.resize`),...f.separatorProps}),I(JB,{pane:t,api:e,onClosePane:()=>a(!1),addressRef:c}),t.picking?I(nV,{api:e}):I(rV,{tab:n,api:e}),n.dialog&&I(oV,{tab:n,api:e}),n.notice&&I(fV,{notice:n.notice,t:d}),z(`div`,{ref:s,className:`bp-viewport`,children:[l&&I(`img`,{className:`bp-frozen`,src:l,alt:``,"aria-hidden":`true`}),n.url===null&&!l&&I(pV,{pane:t,onOpen:t=>{e.navigate(n.id,t).catch(e=>F.ui.error(`Browser pane: navigate failed`,e))}})]})]})}var uV={media:`browserPane.permission.media`,geolocation:`browserPane.permission.geolocation`,notifications:`browserPane.permission.notifications`};function dV(e,t){switch(e.kind){case`blocked`:return e.message;case`load-failed`:return t(`browserPane.notice.loadFailed`,{url:e.url,message:e.message});case`permission-denied`:{let n=uV[e.permission];return t(`browserPane.notice.permissionDenied`,{what:n?{ref:n}:e.permission,origin:e.origin||{ref:`browserPane.notice.thisPage`}})}}}function fV({notice:e,t}){return I(`div`,{className:`bp-notice is-${e.kind}`,role:e.kind===`load-failed`?`alert`:`status`,children:dV(e,t)})}function pV({pane:e,onOpen:t}){let n=R();return z(`div`,{className:`bp-newtab`,children:[I(`h2`,{className:`bp-newtab-title`,children:n(`browserPane.newTab`)}),e.recent.length===0?I(`p`,{className:`bp-newtab-empty`,children:n(`browserPane.newTabEmpty`)}):I(`ul`,{className:`bp-recent`,"aria-label":n(`browserPane.recent`),children:e.recent.map(e=>I(`li`,{children:z(`button`,{type:`button`,className:`bp-recent-item`,onClick:()=>t(e.url),title:e.url,children:[I(`span`,{className:`bp-recent-title`,children:e.title}),I(`span`,{className:`bp-recent-url`,dir:`ltr`,children:e.url})]})},e.url))})]})}function mV(){let e=NB(),t=MB(e=>e.toggle),n=R();if(!wB())return null;let r=n(e?`browserPane.hide`:`browserPane.show`),i=n.hint(r,Yl(GB));return I(`button`,{type:`button`,className:`btn-icon-sm bp-toggle${e?` active`:``}`,onClick:t,"aria-label":r,"aria-pressed":e,title:i,children:I(pa,{size:15})})}var hV={mcp:`tools.cat.mcp`,skill:`tools.cat.skill`,agent:`tools.cat.agent`};function gV(e,t){let n=hV[e];return n?t(n):e.replace(/_/g,` `)}function _V(e){let t=new Map;for(let n of e){let e=t.get(n.category);e?e.push(n):t.set(n.category,[n])}return[...t.entries()]}function vV(e){return e.split(`
195
+ `,1)[0].trim()}function yV({sessionId:e,busy:t}){let n=R();return I(Mz,{id:`tools`,title:n(`tools.title`),children:I(bV,{sessionId:e,busy:t})})}function bV({sessionId:e,busy:t}){let n=R(),[r,i]=(0,V.useState)(null),[a,o]=(0,V.useState)(null),s=(0,V.useCallback)(()=>{let t=!0;return Promise.resolve().then(()=>Ke(e)).then(e=>{t&&(i(nR(e,e=>Array.isArray(e.tools),`list of tools`).tools),o(null))}).catch(n=>{if(!t)return;let r=n.httpStatus,a=n.detail;F.ui.warn(`Could not list the tools of session=${e}`,n),i(null),o({notRunning:r===409,text:a||SM(n)})}),()=>{t=!1}},[e]);return(0,V.useEffect)(s,[s]),ku(t,s),ju(t,a?.notRunning===!0,s),a?.notRunning?I(`p`,{className:`sp-meta`,role:`status`,children:n(`tools.notRunning`)}):a?I(`p`,{className:`sp-error`,role:`alert`,children:n(`tools.listError`,{error:a.text})}):r?r.length===0?I(`p`,{className:`sp-meta`,children:n(`tools.empty`)}):I(`div`,{className:`sp-tools`,"aria-label":n(`tools.listLabel`),role:`group`,children:_V(r).map(([e,t])=>{let r=gV(e,n);return z(`section`,{className:`sp-tool-group`,"aria-label":r,children:[z(`h4`,{className:`sp-tool-group-title`,children:[r,` `,I(`span`,{className:`sp-meta`,children:t.length})]}),I(`ul`,{className:`sp-list`,children:t.map(e=>z(`li`,{className:`sp-tool`,children:[I(`code`,{className:`sp-item-name`,dir:`ltr`,children:e.name}),e.description&&I(`span`,{className:`sp-meta`,title:e.description,children:vV(e.description)})]},e.name))})]},e)})}):I(`p`,{className:`sp-meta`,children:n(`sp.checking`)})}var xV={model:`skills.how.model`,user:`skills.how.user`,auto:`skills.how.auto`,always:`skills.how.always`};function SV({sessionId:e,busy:t}){let n=R(),r=B(e=>e.skillUses),[i,a]=(0,V.useState)(void 0),[o,s]=(0,V.useState)(null),c=(0,V.useCallback)(()=>{let t=!0;return Promise.resolve().then(()=>Ke(e)).then(e=>{if(!t)return;let n=nR(e,e=>e.skills===null||Array.isArray(e.skills),`list of skills`);a(n.skills??null),s(null)}).catch(n=>{if(!t)return;let r=n.httpStatus,i=n.detail;F.ui.warn(`Could not list the skills of session=${e}`,n),a(void 0),s({notRunning:r===409,text:i||(n instanceof Error?n.message:String(n))})}),()=>{t=!1}},[e]);return(0,V.useEffect)(c,[c,r]),ku(t,c),ju(t,o?.notRunning===!0,c),i===null?null:I(Mz,{id:`skills`,title:n(`skills.title`),children:I(CV,{skills:i,failure:o})})}function CV({skills:e,failure:t}){let n=R();return t?.notRunning?I(`p`,{className:`sp-meta`,role:`status`,children:n(`skills.notRunning`)}):t?I(`p`,{className:`sp-error`,children:n(`skills.listError`,{error:t.text})}):e===void 0?I(`p`,{className:`sp-meta`,children:n(`sp.checking`)}):e.length===0?I(`p`,{className:`sp-meta`,children:n(`skills.empty`)}):I(`ul`,{className:`sp-list`,"aria-label":n(`skills.listLabel`),children:e.map(e=>z(`li`,{className:`sp-tool sp-skill`,children:[z(`span`,{className:`sp-skill-name`,children:[I(us,{size:12,"aria-hidden":`true`}),I(`code`,{className:`sp-item-name`,dir:`ltr`,children:e.name})]}),I(`span`,{className:`sp-meta`,children:n(xV[e.how]??`skills.how.always`)})]},e.name))})}var wV=`(max-width: 1099px)`;function TV({sessionId:e,messages:t,busy:n,onUsage:r,onJumpToMessage:i}){let a=R(),o=au(wV),s=fz(e=>o?e.overlayOpen:e.open),c=fz(e=>e.width),l=fz(e=>e.setWidth),u=fz(e=>e.setOpen),d=fz(e=>e.setOverlayOpen),f=fz(e=>e.focus),p=(0,V.useRef)(null),m=mz({width:c,setWidth:l,clamp:uz,min:280,max:640,defaultWidth:320}),h=(0,V.useCallback)(()=>{o?d(!1):u(!1)},[o,u,d]);pt(s&&o,h);let g=(0,V.useRef)(null);if(on(g,s&&o),(0,V.useEffect)(()=>{s&&o&&p.current?.focus()},[s,o]),(0,V.useEffect)(()=>{f&&o&&d(!0)},[f,o,d]),!s)return null;let _=hz(t,n);return z(P.Fragment,{children:[o&&I(`div`,{className:`sp-backdrop`,onClick:h,"aria-hidden":`true`}),z(`aside`,{ref:g,className:`session-panel ${o?`is-overlay`:`is-docked`}`,style:o?void 0:{width:m.width},"aria-label":a(`sp.label`),role:o?`dialog`:`complementary`,"aria-modal":o?!0:void 0,children:[!o&&I(`div`,{className:`sp-resize${m.dragging?` is-dragging`:``}`,"aria-label":a(`sp.resize`),...m.separatorProps}),z(`header`,{className:`sp-header`,children:[I(`h2`,{className:`sp-title`,children:a(`sp.title`)}),I(`button`,{ref:p,type:`button`,className:`btn-icon-sm`,onClick:h,"aria-label":a(`sp.close`),title:a(`sp.closeShort`),children:I(o?Is:so,{size:14})})]}),z(`div`,{className:`sp-body`,children:[_&&I(Mz,{id:`answer`,title:a(`sp.section.answer`),children:I(xz,{messages:t,busy:n})}),I(sB,{sessionId:e,busy:n,onJumpToMessage:i}),I(hB,{sessionId:e,busy:n,onJumpToMessage:i}),I(Yz,{sessionId:e,busy:n}),I(SV,{sessionId:e,busy:n}),I(`h3`,{className:`sp-group-title`,children:a(`sp.details`)}),I(Mz,{id:`context`,title:a(`sp.section.context`),children:I(`div`,{className:`sp-context`,children:I(VR,{sessionId:e,busy:n,onUsage:r})})}),I(yV,{sessionId:e,busy:n})]})]})]})}function EV({messages:e,busy:t}){let n=R(),r=au(wV),i=fz(e=>r?e.overlayOpen:e.open),a=fz(e=>e.setOpen),o=fz(e=>e.setOverlayOpen),s=hz(e,t),c=!i&&s?.kind===`turn`&&s.turn.turnSummary?gz(s.turn.turnSummary):!1,l=n(i?`sp.hide`:c?`sp.showWarn`:`sp.show`);return z(P.Fragment,{children:[I(mV,{}),I(`button`,{type:`button`,className:`btn-icon-sm sp-toggle${i?` active`:``}${c?` is-warn`:``}`,onClick:()=>r?o(!i):a(!i),"aria-label":l,"aria-pressed":i,title:l,children:I(c?ws:i?so:lo,{size:15})})]})}function DV({isPrivate:e,onToggle:t}){let n=R();return I(`button`,{className:`btn-icon-sm task-header-private`,onClick:t,title:n(e?`chat.privateOffTitle`:`composer.privateOnTitle`),"aria-label":n(e?`composer.privateOff`:`composer.privateOn`),"data-private":e?`true`:void 0,children:I(e?Ni:Fi,{size:15})})}function OV(e){let t=0,n=0;for(let r of e){if(n>=1e4)return`size`;if(t>=100)return`files`;if(n+=r.chunk_count,t+=1,n>1e4&&t>1)return`size`}return null}function kV({sessionId:e,onDetachFailed:t}){let n=B(t=>t.sessions.find(t=>t.id===e)),r=B(e=>e.documents),i=B(e=>e.setShowDocLibrary),a=B(e=>e.updateSessionInList),[o,s]=(0,V.useState)(!1),c=R(),l=new Set(n?.document_ids??[]),u=r.filter(e=>l.has(e.id)),d=(0,V.useCallback)(async(n,i)=>{n.stopPropagation();let o=r.find(e=>e.id===i);F.doc.info(`Detaching document from session: ${o?.filename||i}`);try{await Yn(e,i);let t=(B.getState().sessions.find(t=>t.id===e)?.document_ids??[]).filter(e=>e!==i);a(e,{document_ids:t}),t.length<=3&&s(!1),F.doc.info(`Detached document from session: ${o?.filename||i}`)}catch(e){F.doc.error(`Failed to detach document: ${o?.filename||i}`,e),t(o?.filename||i,e)}},[r,e,a,t]);if(u.length===0)return null;let f=[...u].sort((e,t)=>{let n=e.last_accessed_at||e.indexed_at||``;return(t.last_accessed_at||t.indexed_at||``).localeCompare(n)}),p=o?f:f.slice(0,3),m=f.length-3,h=u.filter(e=>e.indexing_status===`failed`),g=h.length,_=h.filter(e=>nL(e.error_kind)).length,v=g-_,y=u.length-g,b=new Map(u.map(e=>[e.id,e])),x=OV((n?.document_ids??[]).flatMap(e=>{let t=b.get(e);return t&&t.indexing_status!==`failed`?[t]:[]})),S=c.compose(e=>[y>0?e(Xn(`docsBar.count`,y),{n:y}):null,v>0?e(Xn(`docsBar.failed`,v),{n:v}):null,_>0?e(Xn(`docsBar.serverWaiting`,_),{n:_}):null].filter(Boolean).join(` · `));return z(`div`,{className:`doc-context-bar${o?` doc-context-expanded`:``}`,"aria-label":g>0?S:c.plural(`docsBar.aria`,y),children:[g>0?I(ri,{size:12,className:`doc-context-icon doc-context-icon-failed`,"aria-hidden":`true`}):I(ti,{size:12,className:`doc-context-icon`,"aria-hidden":`true`}),I(`button`,{type:`button`,className:`doc-context-label`,onClick:()=>i(!0),title:c(`docsBar.manage`),children:S}),z(`div`,{className:`doc-context-pills${o?` doc-context-pills-expanded`:``}`,children:[p.map(e=>{let t=e.indexing_status===`failed`,n=nL(e.error_kind)?`docsBar.serverTitle`:`docsBar.failedTitle`;return z(`span`,{className:`doc-pill${t?` doc-pill-failed`:``}`,title:t?c(n,{name:e.filename}):e.filepath||e.filename,children:[I(t?ri:Yi,{size:9,className:`doc-pill-icon`,"aria-hidden":`true`}),I(`span`,{className:`doc-pill-name`,dir:`ltr`,children:xL(e.filename,24)}),I(`button`,{className:`doc-pill-remove`,onClick:t=>d(t,e.id),"aria-label":c(`docsBar.remove`,{name:e.filename}),children:I(Is,{size:10})})]},e.id)}),!o&&m>0&&I(`button`,{className:`doc-pill-more`,onClick:e=>{e.stopPropagation(),s(!0)},children:c(`docsBar.more`,{n:m})})]}),o&&m>0&&I(`button`,{className:`doc-pill-collapse`,onClick:e=>{e.stopPropagation(),s(!1)},children:c(`docsBar.less`)}),x&&z(`p`,{className:`doc-context-past-cap`,role:`status`,children:[I(ri,{size:12,className:`doc-context-icon doc-context-icon-warn`,"aria-hidden":`true`}),I(`span`,{className:`doc-context-past-cap-text`,children:x===`size`?c(`docsBar.pastSize`,{passages:1e4.toLocaleString(),n:y}):c(`docsBar.pastCap`,{limit:100,n:y})})]})]})}var AV=5e3;function jV(e){let[t,n]=(0,V.useState)({usage:null,error:null});return(0,V.useEffect)(()=>{if(!e)return;let t,r=null,i=!1,a=e=>{i||document.hidden||(t=setTimeout(o,e))};async function o(){r=new AbortController;try{let e=await Ze(r.signal);if(i)return;n({usage:e,error:null}),a(e.interval_ms)}catch(e){if(i||r.signal.aborted)return;F.ui.warn(`Could not read resource usage`,e),n(t=>({usage:t.usage,error:e instanceof Error?e.message:String(e)})),a(AV)}}let s=()=>{document.hidden?(clearTimeout(t),r?.abort()):(clearTimeout(t),o())};return o(),document.addEventListener(`visibilitychange`,s),()=>{i=!0,clearTimeout(t),r?.abort(),document.removeEventListener(`visibilitychange`,s)}},[e]),e?t:{usage:null,error:null}}var MV=1024**3;function NV(e){return(e/MV).toFixed(1)}function PV(e){return`${Math.round(e)}%`}var FV=[[1e9,`Gbps`],[1e6,`Mbps`],[1e3,`Kbps`]];function IV(e){return FV.find(([t])=>e>=t)??FV[FV.length-1]}function LV(e,[t]){let n=e/t;return n<.05?`0`:n>=100?n.toFixed(0):n.toFixed(1)}function RV(e){let t=Math.max(1e5,...e),n=10**Math.floor(Math.log10(t));return[1,2,5,10].find(e=>t<=e*n)*n}function zV(e,t){let n=e.slice(-60),r=60-n.length;return n.map((e,n)=>[(r+n)/59*100,98-Math.max(0,Math.min(t,e))/t*96])}function BV(e){return e.map(([e,t],n)=>`${n?`L`:`M`}${e.toFixed(2)} ${t.toFixed(2)}`).join(` `)}function VV({values:e,max:t=100,dashed:n}){let r=zV(e,t),i=BV(r),a=r.length>1?`${i} L100 100 L${r[0][0].toFixed(2)} 100 Z`:``,o=n?zV(n,t):[];return z(`svg`,{className:`resource-spark`,viewBox:`0 0 100 100`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[I(`path`,{className:`resource-spark-grid`,d:`M0 25H100M0 50H100M0 75H100M25 0V100M50 0V100M75 0V100`,vectorEffect:`non-scaling-stroke`}),a&&I(`path`,{className:`resource-spark-area`,d:a}),r.length>1&&I(`path`,{className:`resource-spark-line`,d:i,vectorEffect:`non-scaling-stroke`}),o.length>1&&I(`path`,{className:`resource-spark-line is-dashed`,d:BV(o),vectorEffect:`non-scaling-stroke`})]})}var HV={gpu:`resources.gpu`,npu:`resources.npu`,ethernet:`resources.ethernet`,wifi:`resources.wifi`,network:`resources.network`};function UV(e,t,n){let r=e(HV[t.kind]),i=n.filter(e=>e.kind===t.kind);return i.length>1?e(`resources.numbered`,{label:r,n:i.indexOf(t)}):r}function WV(e){let t=IV(e);return`${LV(e,t)} ${t[1]}`}function GV(e,t,n,r){return{key:`${t}-unavailable`,tone:t,label:n,value:``,detail:e(`resources.unavailable`),title:e(`resources.unavailableWhy`,{label:n,reason:r}),history:[]}}function KV(e){return[e.send_bps,e.recv_bps,...e.send_history,...e.recv_history].every(e=>e===0)}function qV(e){let t=e.filter(e=>!KV(e));return t.length>0?t:e.slice(0,1)}function JV(e,t){let n=[];if(t.cpu){let r=t.cpu.ghz==null?void 0:`${t.cpu.ghz.toFixed(2)} GHz`;n.push({key:`cpu`,tone:`cpu`,label:e(`resources.cpu`),value:PV(t.cpu.percent),detail:r,title:[e(`resources.cpu`),PV(t.cpu.percent),r].filter(Boolean).join(` · `),history:t.cpu.history})}if(t.memory){let r=t.memory,i=`${NV(r.used_bytes)}/${NV(r.total_bytes)} GB`;n.push({key:`memory`,tone:`memory`,label:e(`resources.memory`),value:PV(r.percent),detail:i,title:`${e(`resources.memory`)} · ${i} (${PV(r.percent)})`,history:r.history})}let r=t.devices??[];for(let t of r){let i=t.memory_used_bytes==null?void 0:`${NV(t.memory_used_bytes)} GB`;n.push({key:t.id,tone:t.kind,label:UV(e,t,r),value:PV(t.percent),detail:i,name:t.name,title:[t.name,PV(t.percent),i&&e(`resources.inUse`,{size:i})].filter(Boolean).join(` · `),history:t.history})}t.devices_error&&n.push(GV(e,`gpu`,e(`resources.gpu`),t.devices_error)),t.npus_error&&n.push(GV(e,`npu`,e(`resources.npu`),t.npus_error));let i=qV(t.networks??[]);for(let t of i){let r=IV(Math.max(t.send_bps,t.recv_bps)),a=LV(t.send_bps,r),o=LV(t.recv_bps,r);n.push({key:t.id,tone:`network`,label:UV(e,t,i),value:``,detail:e(`resources.sendRecv`,{send:a,recv:o,unit:r[1]}),name:t.name,title:[t.name,t.description,e(`resources.send`,{rate:WV(t.send_bps)}),e(`resources.receive`,{rate:WV(t.recv_bps)})].join(` · `),history:t.recv_history,dashed:t.send_history,max:RV([...t.recv_history,...t.send_history])})}return t.networks_error&&n.push(GV(e,`network`,e(`resources.network`),t.networks_error)),n}function YV({onClose:e}){let t=R(),{usage:n,error:r}=jV(!0),i=n?.ready?JV(t,n):[];return z(`section`,{className:`resource-strip`,"aria-label":t(`resources.region`),children:[i.length>0?I(`ul`,{className:`resource-tiles${r?` is-stale`:``}`,children:i.map(e=>z(`li`,{className:`resource-tile tone-${e.tone}`,title:e.title,children:[I(VV,{values:e.history,max:e.max,dashed:e.dashed}),z(`span`,{className:`resource-text`,children:[z(`span`,{className:`resource-label`,children:[I(`bdi`,{children:e.label}),e.name&&I(`span`,{className:`resource-sr-only`,children:` (${e.name})`})]}),z(`span`,{className:`resource-reading`,children:[e.value&&I(`bdi`,{dir:`ltr`,className:`resource-value`,children:e.value}),e.detail&&I(`bdi`,{dir:`ltr`,className:`resource-detail`,children:e.detail})]})]})]},e.key))}):I(`p`,{className:`resource-status`,role:`status`,children:t(r?`resources.error`:`resources.reading`)}),r&&i.length>0&&I(`p`,{className:`resource-status is-error`,role:`status`,title:r,children:t(`resources.error`)}),I(`button`,{type:`button`,className:`btn-icon-sm resource-close`,onClick:e,"aria-label":t(`resources.hide`),title:t(`resources.hide`),children:I(Is,{size:14,"aria-hidden":`true`})})]})}function XV({sessionId:e}){let t=R(),{env:n,change:r}=dR(e),[i,a]=(0,V.useState)(null);return!n||n.internet?null:z(`div`,{className:`offline-notice`,role:`status`,children:[I(Ms,{size:13,"aria-hidden":`true`}),z(`span`,{children:[t(`offline.text`),i&&z(`span`,{className:`offline-notice-error`,children:[` `,t(`offline.error`,{error:i})]})]}),I(`button`,{type:`button`,className:`link-btn`,onClick:()=>{a(null),r(()=>ot(e,!0)).catch(e=>{a(e instanceof Nt?e.detail||e.message:String(e))})},children:t(`offline.turnOn`)})]})}function ZV({message:e,onDismiss:t,dismissLabel:n}){return e?z(`div`,{className:`export-error-bar`,role:`alert`,children:[I(`span`,{children:e}),I(`button`,{type:`button`,className:`btn-icon-sm`,onClick:t,"aria-label":n,children:I(Is,{size:13})})]}):null}var QV=`gaia.resourceMonitor.visible`;function $V(){try{return window.localStorage.getItem(QV)!==`0`}catch(e){return F.ui.warn(`Resource usage setting unavailable; showing it`,e),!0}}var eH=Ct(e=>({visible:$V(),setVisible:t=>{try{window.localStorage.setItem(QV,t?`1`:`0`)}catch(e){F.ui.warn(`Could not remember the resource usage setting`,e)}e({visible:t})},reload:()=>e({visible:$V()})})),tH={".doc":`.docx`,".xls":`.xlsx`,".ppt":`.pptx`};function nH(e,t){if(!(e instanceof Nt))return e instanceof Error?e.message:t(`composer.uploadFailed`);let{extension:n,size_mb:r,max_mb:i}=e.body??{};switch(e.reason){case`no_extension`:return t(`composer.upload.noExtension`);case`unsupported_type`:{let e=tH[String(n)];return e?t(`composer.upload.legacyOffice`,{ext:String(n),modern:e}):t(`composer.upload.unsupported`,{ext:String(n)})}case`empty_file`:return t(`composer.upload.empty`);case`too_large`:return t(`composer.upload.tooLarge`,{size:String(r),max:String(i)});default:return e.message}}function rH(){return`screenshot-${new Date().toISOString().slice(0,19).replace(/[T:]/g,`-`)}.png`}function iH(){let e=R(),[t,n]=(0,V.useState)([]),r=(0,V.useRef)(!0),i=(0,V.useRef)([]);i.current=t;let a=(0,V.useRef)(new Map);(0,V.useEffect)(()=>(r.current=!0,()=>{r.current=!1}),[]);let o=(0,V.useCallback)(async t=>{let i=new AbortController;a.current.set(t.id,i);try{let e=t.isMedia?await Ie(t.file,e=>{r.current&&n(n=>n.map(n=>n.id===t.id?{...n,progress:e}:n))},i.signal):await M(t.file);if(!r.current)return;n(n=>n.map(n=>n.id===t.id?{...n,uploading:!1,uploaded:!0,serverUrl:e.url}:n))}catch(a){if(i.signal.aborted||(F.chat.error(`Upload failed: ${t.name}`,a),!r.current))return;let o=nH(a,e);n(e=>e.map(e=>e.id===t.id?{...e,uploading:!1,error:o}:e))}finally{a.current.delete(t.id)}},[e]),s=(0,V.useCallback)(e=>{let t=[...i.current];for(let r of e){if(t.some(e=>!e.error&&e.file.name===r.name&&e.file.size===r.size&&e.file.lastModified===r.lastModified))continue;let e=r.type.startsWith(`image/`),i={id:`attach-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,file:r,name:r.name||(e?rH():`file`),url:e?URL.createObjectURL(r):``,uploading:!0,uploaded:!1,isImage:e,isMedia:tL(r.name)};t.push(i),n(e=>[...e,i]),o(i)}},[o]),c=(0,V.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(),s(t),!0)},[s]),l=(0,V.useCallback)(e=>{a.current.get(e)?.abort(),n(t=>{let n=t.find(t=>t.id===e);return n?.url&&URL.revokeObjectURL(n.url),t.filter(t=>t.id!==e)})},[]),u=(0,V.useCallback)(()=>{n(e=>(e.forEach(e=>{e.url&&URL.revokeObjectURL(e.url)}),[]))},[]),d=(0,V.useCallback)(n=>{let r=t.filter(e=>e.uploaded&&e.serverUrl).map(e=>{let t=e.name.replace(/[[\]]/g,` `).trim();return e.isImage?`![${t}](${e.serverUrl})`:`[${t}](${e.serverUrl})`}).join(`
196
+ `);if(!r)return n;let i=n||(t.some(e=>e.uploaded&&e.isMedia)?e(`composer.mediaPrompt`):``);return i?`${i}\n\n${r}`:r},[t,e]);return{attachments:t,addFiles:s,handlePaste:c,remove:l,clear:u,hasUploaded:t.some(e=>e.uploaded),hasImage:t.some(e=>e.uploaded&&e.isImage),uploading:t.some(e=>e.uploading),compose:d,takeElements:DN.getState().take}}function aH({sessionId:e,isStreaming:t,isStale:n,setMessages:r,refreshContext:i}){let[a,o]=(0,V.useState)(null),s=a?.state.status===`running`,c=(0,V.useRef)(!1);c.current=s;let l=(0,V.useRef)(a);l.current=a,(0,V.useEffect)(()=>{o(null)},[e]);let u=(0,V.useCallback)((r,i)=>{t||c.current||(F.chat.info(`Retrying message ${r.id} with ${i}`),o({messageId:r.id,state:{status:`running`,model:i},keeping:null}),kn(e,r.id,i).then(e=>{n()||o(t=>t&&t.messageId===r.id?{...t,state:{status:`ready`,result:e}}:t)}).catch(e=>{F.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]),d=(0,V.useCallback)(async t=>{if(!a)return;let{messageId:s}=a;o({...a,keeping:t});try{let a=await Me(e,s,t);if(n())return;if(a.kept===`retry`){let e=a.stats;r(B.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(F.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:u,handleKeepAnswer:d,handleCloseComparison:(0,V.useCallback)(()=>{a?.state.status===`ready`?d(`original`):o(null)},[a,d]),closeForNewTurn:(0,V.useCallback)(()=>{let t=l.current;t&&(t.state.status===`ready`&&Me(e,t.messageId,`original`).catch(e=>F.chat.error(`Could not close the answer comparison`,e)),o(null))},[e])}}function oH(e,t){let[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null);(0,V.useEffect)(()=>{r(null),a(null)},[e]);let o=(0,V.useCallback)(()=>{ln(e).then(e=>{t()||(e.available?(r(e),a(null)):(r(null),a(e.reason)))}).catch(t=>F.chat.error(`Could not measure the context for session=${e}`,t))},[e,t]);return(0,V.useEffect)(()=>{o()},[o]),{contextUsage:n,contextUnavailable:i,refreshContext:o,showContextUsage:(0,V.useCallback)(e=>{r(e),a(null)},[])}}function sH(e,t){return(0,V.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:jz()}),r.classList.add(`msg-jump-target`),window.setTimeout(()=>r.classList.remove(`msg-jump-target`),1600),!0},[e,t])}var cH=1,lH=80,uH=500,dH=new Set([`PageUp`,`ArrowUp`,`Home`]),fH=new Set([`PageDown`,`ArrowDown`,`End`]);function pH(e,t,n){let r=(0,V.useRef)(0),i=(0,V.useRef)(0),a=(0,V.useRef)(0),o=(0,V.useRef)(!1),s=(0,V.useCallback)(()=>o.current||Date.now()-a.current<uH,[]),c=(0,V.useCallback)(()=>{a.current=Date.now()},[]),l=(0,V.useCallback)(()=>{a.current=0},[]),u=(0,V.useCallback)(()=>{let a=e.current;if(!a)return;let o=a.scrollHeight-a.scrollTop-a.clientHeight,c=i.current,l=a.scrollTop<r.current&&s();r.current=a.scrollTop,i.current=o,o<=cH?t.current=!0:l?t.current=!1:o<=lH&&o<c&&(t.current=!0),n(o)},[e,t,n,s]),d=(0,V.useCallback)(e=>{e.deltaY<0?c():e.deltaY>0&&l()},[c,l]),f=(0,V.useCallback)(e=>{e.target===e.currentTarget&&(o.current=!0)},[]);return(0,V.useEffect)(()=>{let n=e.current;if(!n||typeof ResizeObserver>`u`)return;let r=n.clientHeight,i=new ResizeObserver(()=>{let e=n.clientHeight<r;r=n.clientHeight,e&&t.current&&!s()&&(n.scrollTop=n.scrollHeight)});return i.observe(n),()=>i.disconnect()},[e,t,s]),(0,V.useEffect)(()=>{let e=()=>{o.current=!1},t=e=>{let t=e.target;t instanceof Element&&t.closest(`input, textarea, select, [contenteditable="true"]`)||(dH.has(e.key)||e.key===` `&&e.shiftKey?c():(fH.has(e.key)||e.key===` `)&&l())};return window.addEventListener(`pointerup`,e),window.addEventListener(`pointercancel`,e),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`pointerup`,e),window.removeEventListener(`pointercancel`,e),window.removeEventListener(`keydown`,t)}},[c,l]),(0,V.useEffect)(()=>{let n=e.current;if(!n||typeof ResizeObserver>`u`)return;let r=n.clientHeight,i=new ResizeObserver(()=>{let e=n.clientHeight<r;r=n.clientHeight,e&&t.current&&!s()&&(n.scrollTop=n.scrollHeight)});return i.observe(n),()=>i.disconnect()},[e,t,s]),{userScrolling:s,clearUserScroll:l,listProps:{onScroll:u,onWheel:d,onTouchMove:c,onPointerDown:f}}}function mH(e,t){let[n,r]=(0,V.useState)(null);(0,V.useEffect)(()=>{r(null)},[e]);let i=(0,V.useCallback)(()=>r(null),[]);return{exportChat:(0,V.useCallback)(async()=>{r(null);try{let n=await g(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){F.chat.error(`Export failed`,e),r(e instanceof Nt?`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. Try Export again once GAIA is answering.`)}},[e,t]),exportError:n,clearExportError:i}}var hH=5200;function gH(e=hH){let[t,n]=(0,V.useState)(null),r=(0,V.useRef)(null),i=(0,V.useCallback)(()=>{r.current&&=(clearTimeout(r.current),null)},[]),a=(0,V.useCallback)(()=>{i(),n(null)},[i]),o=(0,V.useCallback)(t=>{i(),n(t),r.current=setTimeout(()=>{r.current=null,n(null)},e)},[i,e]);return(0,V.useEffect)(()=>i,[i]),{policyToast:t,showPolicyToast:o,dismissPolicyToast:a}}var _H=new Set([``,`new chat`,`new task`,`untitled`,`untitled session`,`chat`]);function vH(e){return _H.has((e??``).trim().toLowerCase())}function yH(e,t){let n=B.getState(),r=n.sessions.find(t=>t.id===e)?.document_ids??[],i=t.filter(e=>!r.includes(e));i.length>0&&n.updateSessionInList(e,{document_ids:[...r,...i]})}function bH(e,t){if(t.length===0)return;let n=B.getState(),r=new Set(t.map(e=>e.id));n.setDocuments([...t,...n.documents.filter(e=>!r.has(e.id))]),yH(e,t.map(e=>e.id))}async function xH(e,t){let n=[];for(let r of t){F.doc.info(`Dropped on chat view: ${r.name}`);try{let t=await T(r);if(t?.indexing_status===`failed`){let e=nL(t.error_kind)?`server`:`unreadable`;F.doc.warn(`"${r.name}" couldn't be added (${t.error_kind??`unreadable`}); not attaching it`),n.push({name:r.name,stage:e,error:t.last_error??null})}else if(e&&t?.id)try{await Et(e,t.id),yH(e,[t.id]),F.doc.info(`Auto-attached "${r.name}" to session ${e}`)}catch(e){F.doc.warn(`Could not attach dropped document to session: ${e}`),n.push({name:r.name,stage:`attach`,error:e})}}catch(e){F.doc.error(`Upload failed: ${r.name}`,e),n.push({name:r.name,stage:`upload`,error:e})}}try{let e=await o();B.getState().setDocuments(e.documents||[])}catch(e){F.doc.error(`Could not refresh the document list after a drop`,e)}return n}function SH(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 CH(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 wH=2e3,TH=9e4;function EH(){let e=R(),[t,n]=(0,V.useState)(null),[r,i]=(0,V.useState)(null),[a,o]=(0,V.useState)(`idle`),[s,c]=(0,V.useState)(null),l=(0,V.useRef)(!0),u=(0,V.useCallback)(async()=>{try{let e=await Ae();return l.current&&n(e),e}catch(e){return l.current&&c(e instanceof Error?e.message:String(e)),null}},[]);(0,V.useEffect)(()=>(l.current=!0,u(),Ce().then(e=>{l.current&&i(e)}).catch(e=>{l.current&&c(e instanceof Error?e.message:String(e))}),()=>{l.current=!1}),[u]);let d=(0,V.useCallback)(async()=>{c(null);let e=await u();e&&o(e.state===`stopped`?`still_down`:`back`)},[u]),f=(0,V.useCallback)(async()=>{o(`starting`),c(null);try{await Bn(!1)}catch(e){if(!l.current)return;c(e instanceof Error?e.message:String(e)),o(`idle`);return}let e=Date.now()+TH;for(;l.current&&Date.now()<e;){await new Promise(e=>setTimeout(e,wH));let e=await u();if(!l.current)return;if(e?.restart_error){c(e.restart_error),o(`idle`);return}if(e&&e.state!==`stopped`&&!e.restarting){o(`back`);return}}l.current&&o(`still_down`)},[u]),p=(0,V.useCallback)(async()=>{o(`switching`),c(null);try{let e=await Ue({mode:`gaia`});if(!l.current)return;i(e),o(`back`)}catch(e){if(!l.current)return;c(e instanceof Error?e.message:String(e)),o(`idle`)}},[]),m=a===`starting`||a===`switching`,h=t?.owner===`gaia`,g=!h&&r?.mode===`external`&&r.source!==`env`;return a===`back`?I(`div`,{className:`server-down-notice server-down-notice--ok`,role:`status`,children:I(`p`,{children:e(`serverDown.back`)})}):z(`div`,{className:`server-down-notice`,role:`alert`,children:[z(`strong`,{className:`server-down-notice__title`,children:[I(ws,{size:14,"aria-hidden":`true`}),` `,e(`serverDown.title`)]}),I(`p`,{children:e(`serverDown.body`)}),t&&!h&&!g&&I(`p`,{children:e(`serverDown.notOurs`)}),a===`still_down`&&I(`p`,{children:e(`serverDown.stillDown`)}),s&&I(`p`,{children:I(`bdi`,{dir:`ltr`,className:`server-down-notice__raw`,children:s})}),z(`div`,{className:`server-down-notice__actions`,children:[h&&I(`button`,{type:`button`,className:`btn-primary`,disabled:m,onClick:()=>void f(),children:a===`starting`?z(P.Fragment,{children:[I(La,{size:13,className:`btn-spinner`,"aria-hidden":`true`}),` `,e(`serverDown.starting`)]}):e(`serverDown.start`)}),g&&I(`button`,{type:`button`,className:`btn-primary`,disabled:m,onClick:()=>void p(),children:a===`switching`?z(P.Fragment,{children:[I(La,{size:13,className:`btn-spinner`,"aria-hidden":`true`}),` `,e(`serverDown.switching`)]}):e(`serverDown.useOwn`)}),I(`button`,{type:`button`,className:`btn-secondary`,disabled:m,onClick:()=>void d(),children:e(`settings.key.checkAgain`)})]})]})}function DH(e,t=``){let[n,r]=(0,V.useState)(()=>e&&sn(e)||t),i=(0,V.useRef)(e);return(0,V.useEffect)(()=>{i.current!==e&&(i.current=e,r(e?sn(e):``))},[e]),(0,V.useEffect)(()=>{e&&i.current===e&&Cn(e,n)},[e,n]),[n,r]}function OH(e,t){return DH(t?null:At(e))}var kH=-2,AH=`opening`;function jH(e,t,n){return!t||e.some(e=>e.role===`user`&&e.content.trim()===t)?e:[...e,{id:kH,session_id:n,role:`user`,content:t,created_at:``,rag_sources:null}]}function MH({sessionId:e,pendingPrompt:t,messages:n,messageCount:r,isLoadingMessages:i,initializing:a,mountedRef:o,send:s}){let c=(0,V.useRef)(!1),[l,u]=(0,V.useState)(null);(0,V.useEffect)(()=>{let e=t?.text;if(!e||t.sending||B.getState().isLoadingMessages||a)return;let n={...t,sending:!0};B.getState().setPendingPrompt(n),c.current=!0,u(e.trim()),setTimeout(()=>{c.current=!1;let t=B.getState();t.pendingPrompt===n?o.current?(t.setPendingPrompt(null),s.current(e,{opening:!0}).finally(()=>{o.current&&u(null)})):t.setPendingPrompt({sessionId:n.sessionId,text:n.text}):o.current&&u(null)},0)},[t,i,a]);let d=!a&&r===0?t?.text.trim()||l:null,f=(0,V.useRef)(null);d&&!f.current&&(f.current=d);let p=f.current?n.find(e=>e.role===`user`&&e.content.trim()===f.current):void 0;return{openingRef:c,openingShown:d,rows:jH(n,d,e),isUnsent:e=>e.id===kH,openingKey:e=>e.id===kH||e===p?AH:void 0}}var NH=new Set([`tool_start`,`tool_end`,`tool_result`]),PH=`Connection lost. Reconnecting`,FH=15e3,IH=[],LH=[],RH=[],zH=new Map;function BH({text:e}){return I(`div`,{className:`history-notice`,role:`note`,children:e})}function VH({notices:e}){return I(`div`,{className:`library-notices`,role:`note`,children:e.map((e,t)=>I(`div`,{dir:`auto`,children:e},`${t}-${e}`))})}var HH=12e3;function UH({sessionId:e}){let t=R(),{sessions:n,messages:r,setMessages:i,addMessage:a,removeMessage:l,removeMessagesFrom:u,updateSessionInList:d,isStreaming:f,streamingContent:p,setStreaming:m,setStreamContent:g,clearStreamContent:_,agentSteps:v,addAgentStep:y,updateLastAgentStep:x,appendThinkingContent:S,updateLastToolStep:C,clearAgentSteps:w,cards:T,appendCard:E,clearCards:D,setDocuments:O,setShowFileBrowser:k,isLoadingMessages:ee,setLoadingMessages:ne,systemStatus:A}=B(),re=_l(e=>e.addNotification),ae=_l(e=>e.showPanel),j=_l(e=>e.setShowPanel),oe=_l(e=>e.setTypeFilter),se=B(t=>t.pendingPrompt?.sessionId===e?t.pendingPrompt:null),ce=B(e=>e.liveStatus),le=B(FF),ue=B(e=>e.awaitingUser),de=B(t=>Object.values(t.liveQuestions).some(t=>t.sessionId===e)),fe=B(t=>eA(t.liveQuestions,e)),pe=_l(t=>xl(e)(t)!==null),me=n.find(t=>t.id===e),[he,M]=OH(e,me?.private),[N,ge]=(0,V.useState)(!1),[ve,ye]=(0,V.useState)(``),[be,xe]=(0,V.useState)(!1),[Se,Ce]=(0,V.useState)(!1),Te=iH(),[Ee,De]=(0,V.useState)(null),{policyToast:Oe,showPolicyToast:ke,dismissPolicyToast:Ae}=gH(),[je,Me]=(0,V.useState)(null),{exportChat:Ne,exportError:Pe,clearExportError:Fe}=mH(e,me?.title),[Ie,Le]=(0,V.useState)(null);(0,V.useEffect)(()=>Le(null),[e]);let ze=(0,V.useCallback)((e,n)=>{Le(t(`chat.detachFailed`,{name:e,error:SM(n)}))},[t]),Be=me?.agent_type&&me.agent_type!==`gaia`?me.agent_type:null,[Ve,He]=(0,V.useState)(null),Ue=(0,V.useRef)(new Map),We=(0,V.useRef)(new Set);YF(),(0,V.useEffect)(()=>()=>iN.getState().stop(),[]);let Ge=(0,V.useRef)(null),Ke=(0,V.useRef)(null),qe=(0,V.useRef)(null),Je=(0,V.useRef)(null),Ye=(0,V.useRef)(0),Xe=(0,V.useRef)(!1),Ze=(0,V.useRef)(0),Qe=(0,V.useRef)(null),[$e,et]=(0,V.useState)(!1),tt=(0,V.useRef)(!1),nt=(0,V.useRef)(null),rt=(0,V.useRef)(null),it=(0,V.useRef)(0),at=(0,V.useRef)(!1),ot=(0,V.useRef)(async()=>!1),st=(0,V.useRef)(!1),ct=B(t=>t.messageQueues[e]??IH),lt=(0,V.useCallback)(t=>B.getState().updateQueue(e,t),[e]),dt=(0,V.useRef)(!1),[ft,pt]=(0,V.useState)(!1),mt=(0,V.useRef)(!1),gt=(0,V.useRef)(!1),_t=(0,V.useRef)(f);_t.current=f;let vt=B(t=>!!t.queueHolds[e]),yt=_c(e=>!!e.queued),bt=(0,V.useRef)(``),St=(0,V.useRef)(null),Ct=(0,V.useRef)(null),wt=(0,V.useRef)(0),Tt=(0,V.useRef)(!0),{userScrolling:Et,clearUserScroll:Dt,listProps:Ot}=pH(Ke,Tt,e=>Ce(e>200)),kt=(0,V.useCallback)(()=>B.getState().currentSessionId!==e,[e]),jt=(0,V.useCallback)(()=>{St.current=null,kt()||bt.current&&g(bt.current)},[g,kt]),Mt=(0,V.useRef)(0),Nt=(0,V.useRef)(0);(0,V.useEffect)(()=>{F.chat.info(`ChatView mounted for session=${e}, loading messages...`);let t=F.chat.time();ne(!0);let n=!1,r=!1,a=async(a=!1)=>{if(n||r)return;r=!0;let o=Nt.current;try{if(!a){if(B.getState().isStreaming)return;let t=await Re(e);if(n||t===Mt.current||B.getState().isStreaming)return}let r=await $n(e);if(n)return;let s=VF(r.messages);if(a&&Nt.current!==o)Mt.current=s.length;else if(a)i(s),Mt.current=s.length,F.chat.timed(`Loaded ${s.length} message(s) for session=${e}`,t);else if(s.length!==Mt.current&&!B.getState().isStreaming){F.chat.info(`Messages changed externally: ${Mt.current} -> ${s.length}`);let e=B.getState().messages;GF(e,s,Ue.current),i(KF(e,s)),Mt.current=s.length}}catch(t){if(n)return;a&&(F.chat.error(`Failed to load messages for session=${e}`,t),i([]))}finally{r=!1,!n&&a&&ne(!1)}};a(!0);let o=SH(()=>a(!1),3e3);return()=>{n=!0,o()}},[e,i,ne]),(0,V.useEffect)(()=>{o().then(e=>O(e.documents||[])).catch(e=>F.doc.error(`Could not load the document list`,e))},[O]);let Ft=(0,V.useRef)(!0),It=hI(A);(0,V.useEffect)(()=>(Ft.current=!0,()=>{Ft.current=!1}),[]);let{openingRef:Lt,openingShown:Rt,rows:Bt,isUnsent:Vt,openingKey:Ut}=MH({sessionId:e,pendingPrompt:se,messages:r,messageCount:me?.message_count??0,isLoadingMessages:ee,initializing:It,mountedRef:Ft,send:ot});(0,V.useEffect)(()=>{if(!Tt.current)return;let e=Date.now()-wt.current,t=()=>{Tt.current&&!Et()&&(wt.current=Date.now(),Ge.current?.scrollIntoView({behavior:`instant`}))};e>=100&&t(),Ct.current&&clearTimeout(Ct.current),Ct.current=setTimeout(t,100)},[r,p,v]),(0,V.useEffect)(()=>{qe.current?.focus()},[e]),(0,V.useEffect)(()=>{dt.current=!1},[e]);let{contextUsage:Wt,contextUnavailable:Gt,refreshContext:qt,showContextUsage:Jt}=oH(e,kt),{comparison:Yt,comparing:Zt,comparingRef:Qt,handleRetryWith:L,handleKeepAnswer:$t,handleCloseComparison:nn,closeForNewTurn:rn}=aH({sessionId:e,isStreaming:f,isStale:kt,setMessages:i,refreshContext:qt});(0,V.useEffect)(()=>()=>{_t.current&&RI(e),Je.current&&!gt.current&&Je.current.abort(),Je.current&&=null,nt.current&&=(clearTimeout(nt.current),null),tt.current=!1,rt.current=null,et(!1),St.current!==null&&(cancelAnimationFrame(St.current),St.current=null),Ct.current&&=(clearTimeout(Ct.current),null),Qe.current&&=(clearTimeout(Qe.current),null),Ae(),bt.current=``,B.getState().resetStreaming()},[e]),(0,V.useEffect)(()=>{je&&ae&&(document.getElementById(qF(je))?.scrollIntoView({behavior:jz(),block:`center`}),Me(null))},[je,ae]);let an=fz(e=>e.width),on=fz(e=>e.reveal),sn=eH(e=>e.visible),cn=eH(e=>e.setVisible),ln=(0,V.useRef)(null),[un,dn]=(0,V.useState)(!1),fn=(0,V.useCallback)(()=>{cn(!1),dn(!0),ln.current?.focus()},[cn]);(0,V.useEffect)(()=>{if(!un)return;if(sn){dn(!1);return}let e=window.setTimeout(()=>dn(!1),HH);return()=>window.clearTimeout(e)},[un,sn]);let pn=sH(Ke,Tt),mn=(0,V.useCallback)(()=>{Tt.current=!0,Dt(),Ge.current?.scrollIntoView({behavior:jz()})},[Dt]),gn=(0,V.useCallback)(()=>{tt.current||(tt.current=!0,dt.current=!0,et(!0),_l.getState().dismissSessionPrompts(e),B.getState().closeSessionQuestions(e),F.stream.warn(`User stopped generation; waiting for the server to close the turn`),ut(e).catch(e=>{F.stream.error(`Stop request failed; waiting for the stream to close`,e)}),Qe.current?(clearTimeout(Qe.current),Qe.current=null,rt.current?.()):nt.current=setTimeout(()=>{F.stream.error(`No closing event ${FH}ms after Stop; closing the turn locally (session=${e})`),rt.current?.()},FH))},[e]);(0,V.useEffect)(()=>{let e=e=>{e.key===`Escape`&&f&&!hn(e)&&(e.preventDefault(),gn())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[f,gn]);let _n=(0,V.useCallback)(async(t,n)=>{let r=n?.attach===!0,o=n?.queued===!0,s=r?n?.reconnect??0:0,c=!r&&t===void 0,u=(c?he:t??``).trim(),p=c&&Te.hasUploaded,v=c&&Te.hasImage,b=()=>{if(!c)return u;let e=Te.compose(u);return M(``),Te.clear(),qe.current?.focus(),e};Tt.current=!0;let T=hI(B.getState().systemStatus),O=e=>{o&&n?.onQueuedOutcome?.(e)};if(!r&&Be)return F.chat.warn(`Send blocked: chat ${e} belongs to the retired "${Be}" agent`),O({kind:`failed`,error:`This chat's "${Be}" agent was retired, so it cannot take new messages.`}),!1;let k=!n?.opening&&(B.getState().messageQueues[e]??IH).length>0;if(r){if(f&&!s)return!1}else if(!o&&(u||p)&&!T&&(f||Qt.current||k)){if(v&&!Zs(`vision`)&&!await ec(`vision`))return!1;let e=b();return lt(t=>xt(t,e,`queued`)),!0}else if(!u&&!p||f||T)return O({kind:`busy`}),!u&&!p&&F.chat.debug(`Send blocked: empty message`),f&&F.chat.debug(`Send blocked: already streaming`),T&&F.chat.debug(`Send blocked: system initializing`),!1;if(!r&&!o&&(!Zs(`chat`)||v&&!Zs(`vision`))){if(st.current)return!1;st.current=!0;try{if(!await ec(`chat`)||v&&!await ec(`vision`))return!1}finally{st.current=!1}if(kt()){let t=b();return c&&!me?.private&&Mn(At(e)),lt(e=>xt(e,t,`queued`)),!0}}let ee=u,te=null,ne=r||o?void 0:Te.takeElements();if(r)F.chat.info(`Re-attaching to background run for session=${e}${s?` (reconnect ${s})`:``}`);else{ee=b(),F.chat.info(`Sending message to session=${e}`,{length:ee.length,preview:ee.slice(0,80)}),rn();let t={id:Date.now(),session_id:e,role:`user`,content:ee,created_at:new Date().toISOString(),rag_sources:null,page_elements:ne};a(t),te=t,Nt.current+=1}s||(Ze.current=0),m(!0),_(),w(),D(),it.current=0,at.current=!1,s&&B.getState().setLiveStatus(`${PH} (attempt ${s} of 3)…`),F.stream.info(`Starting agent stream...`);let A=F.stream.time(),ae=``,j;He(null);let oe=!1;mt.current=!1,r||pt(!1);let se=null,ce=!o;gt.current=o;let le=e=>{ce||(ce=!0,gt.current=!1,n?.onQueuedOutcome?.(e),e.kind===`accepted`&&kt()&&se?.abort())},ue=r||!!me&&!vH(me.title),de=()=>{le({kind:`accepted`}),ue||(ue=!0,ie(e).then(t=>d(e,{title:t.title})).catch(e=>F.chat.warn(`Could not refresh the chat title`,e)))};bt.current=``,tt.current=!1,et(!1);let fe=()=>{nt.current&&=(clearTimeout(nt.current),null),tt.current=!1,rt.current=null,et(!1)},pe=()=>{let{agentSteps:e,cards:t}=B.getState();return{steps:e.map(e=>({...e,active:!1})),cards:[...t]}};rt.current=()=>{if(oe)return;oe=!0,Xe.current=!0,Ye.current=Date.now(),fe(),le({kind:`failed`,error:`Stopped before GAIA confirmed it got this message.`}),Je.current?.abort(),Je.current=null,St.current!==null&&(cancelAnimationFrame(St.current),St.current=null);let t=bt.current||B.getState().streamingContent;if(bt.current=``,kt())return;let{steps:n,cards:r}=pe();a({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`}),m(!1),_(),w(),D()};let N={onConnected:()=>{if(kt())return;let e=B.getState();(e.liveStatus===`Waiting for GAIA to start this answer…`||e.liveStatus?.startsWith(PH))&&e.setLiveStatus(null)},onChunk:t=>{if(de(),kt())return;B.getState().awaitingUser&&B.getState().setAwaitingUser(!1);let n=t.content||``;if(n&&_l.getState().dismissSessionPrompts(e),n){if(t.type===`answer`)ae=n;else{at.current&&=(ae.length>0&&(ae+=`
197
+
198
+ `),!1),ae+=n;let e=B.getState().agentSteps,t=e[e.length-1];t?.type===`thinking`&&t.active&&x({active:!1,latencyMs:Date.now()-t.timestamp})}let e=ae.replace(LF,``).trim();if(e=RF(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())}}bt.current=e,St.current===null&&(St.current=requestAnimationFrame(jt))}},onAgentEvent:t=>{if((t.type!==`status`||t.phase!==`waiting`)&&de(),t.type===`followup_taken`&&t.text){let n=t.text;if(lt(e=>Kt(e,n)),kt())return;a({id:Date.now(),session_id:e,role:`user`,content:n,created_at:new Date().toISOString(),rag_sources:null});return}if(t.type===`followup_unavailable`){kt()||pt(!0);return}if(t.type===`followup_returned`){let e=t.texts??[];lt(t=>Xt(t,e));return}if(kt())return;if(t.type===`context_usage`){Jt(t);return}let n=t.type===`permission_request`||t.type===`needs_input`;if(B.getState().awaitingUser!==n&&B.getState().setAwaitingUser(n),NH.has(t.type)&&_l.getState().dismissSessionPrompts(e),t.type===`permission_request`){sI(t,e);return}if(t.type===`needs_confirmation`){E({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}B.getState().openQuestion(t.request_id,e,typeof t.timeout_seconds==`number`?t.timeout_seconds:null,{options:Array.isArray(t.options)?t.options:[],allowFreeText:t.allow_free_text!==!1,sensitive:!!t.sensitive}),E({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=cI(t,e,`policy-${Date.now()}-${it.current+1}`);re(n);let r=MF(t,it);r&&y(r),ke({tool:n.tool,receiptId:t.receipt_id});return}if((t.type===`tool_end`||t.type===`tool_result`)&&B.getState().livePhase===`tool`&&B.getState().setLiveStatus(null),t.type===`tool_end`){C({active:!1,success:t.success!==!1});return}if(t.type===`tool_result`){typeof t.render==`string`&&t.render.length>0&&E({render:t.render,data:t.data}),C(uI(t));return}if(t.type===`tool_args`){let e=!!t.args&&Object.keys(t.args).length>0,n=t.detail||(e?JSON.stringify(t.args):``);C({...n?{detail:n}:{},...t.narration?{narration:t.narration}:{}});let r=B.getState(),i=[...r.agentSteps].reverse().find(e=>e.type===`tool`);t.narration&&i?.active&&r.livePhase===`tool`&&r.setLiveStatus(ED(i,Ht()),`tool`);return}if(t.type===`skill_use`){B.getState().addSkillStep(t.how===`model`?null:MF(t,it));return}if(t.type===`commentary`){ae=``,at.current=!1,bt.current=``,g(``);let e=MF(t,it);e&&y(e);return}if(t.retracts_answer&&(ae=``,at.current=!1,bt.current=``,g(``),t.type===`status`)){let e=MF({type:`status`,status:`warning`,message:Ht()(`live.answerRestarted`)},it);e&&y(e);return}if(t.type===`thinking`){let e=B.getState().agentSteps,n=e[e.length-1];if(n&&n.type===`thinking`){S(t.content||``);return}let r=MF(t,it);r&&y(r);return}if(t.type===`status`){if(t.status===`history_cut`){j=(t.message||``).trim()||void 0,He(j??null);return}IF(t,it);return}if(t.type===`step`||t.type===`agent_error`&&zF(t,B.getState().agentSteps))return;let r=MF(t,it);r&&(y(r),t.type===`tool_start`&&(at.current=!0,B.getState().setLiveStatus(ED(r,Ht()),`tool`),t.tool===`load_skill`&&B.getState().addSkillStep(null)))},onDone:t=>{if(de(),_l.getState().dismissSessionPrompts(e),B.getState().closeSessionQuestions(e),oe)return;oe=!0;let n=t.cancelled===!0?`stopped`:tt.current&&t.message_id==null?`unconfirmed`:void 0;if(fe(),St.current!==null&&(cancelAnimationFrame(St.current),St.current=null),bt.current=``,bH(e,t.documents_added??[]),kt())return;Ye.current=Date.now(),mt.current=!0;let o=B.getState();o.setRunningSessions(o.runningSessionIds.filter(t=>t!==e));let s=t.content||ae;F.chat.timed(`Agent response complete: ${s.length} chars${n?` (${n})`:``}`,A);let{steps:c,cards:l}=pe(),u=c.some(e=>e.type===`policy_alert`);if(s||u||n){Mt.current=B.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:j,libraryNotices:t.library_notices,failure:t.failed?t.failure:void 0};j&&zH.set(r.id,j),We.current.add(r.id),a(r);let i=iN.getState();i.settings?.auto&&JF(r)&&i.read(`${e}:${r.id}`,WP(s))}m(!1),_(),w(),D(),qe.current&&qe.current.focus(),setTimeout(()=>{$n(e).then(t=>{if(kt()||B.getState().isStreaming)return;let n=B.getState().messages,o=n.filter(e=>e.cards&&e.cards.length>0),c=VF(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??e.cards,stopState:e.stopState??n.find(t=>t.id===e.id)?.stopState,failure:e.failure??n.find(t=>t.id===e.id)?.failure}});GF(n,c,Ue.current),i(c),Mt.current=c.length,r&&!s&&c[c.length-1]?.role===`user`&&a({id:Date.now()+2,session_id:e,role:`assistant`,content:lN,created_at:new Date().toISOString(),rag_sources:null})}).catch(t=>F.chat.error(`Could not refresh messages for session=${e}`,t))},300)},onError:t=>{let n=uN(t),i=ce&&!r&&!n&&!!te&&KI(e,ee,t);if(!ce||i){if(n)de();else{if(le(UI(t)?{kind:`busy`}:{kind:`failed`,error:bN(t).text}),Ye.current=Date.now(),fe(),St.current!==null&&(cancelAnimationFrame(St.current),St.current=null),bt.current=``,kt())return;F.chat.info(`Queued message for session=${e} not taken: ${t.message}`),te&&l(te.id),mt.current=!0,m(!1),_(),w(),D();return}}if(n&&tt.current&&!oe){F.chat.warn(`Stream for session=${e} was lost while stopping; closing the turn locally`),rt.current?.();return}if(n&&!Ft.current)return;if(n&&!oe&&!kt()&&Ze.current<3){let n=++Ze.current,r=cN[n-1]??0;F.chat.warn(`Stream for session=${e} lost (${t.name}); reconnecting in ${r}ms (${n}/3)`),B.getState().setLiveStatus(`${PH} (attempt ${n} of 3)…`);let i=()=>{Qe.current=null,!Ft.current||kt()||tt.current||ot.current(void 0,{attach:!0,reconnect:n})};r>0?Qe.current=setTimeout(i,r):i();return}Ye.current=Date.now(),_l.getState().dismissSessionPrompts(e),B.getState().closeSessionQuestions(e);let o=tt.current;if(fe(),St.current!==null&&(cancelAnimationFrame(St.current),St.current=null),bt.current=``,kt())return;if(n||(mt.current=!0),F.chat.error(`Chat error for session=${e}`,t),o){let{steps:n,cards:r}=pe();a({id:Date.now()+2,session_id:e,role:`assistant`,content:ae,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`}),Mt.current=B.getState().messages.length,m(!1),_(),w(),D();return}let{kind:s,text:c}=bN(t),u=s===`stream`?c:c+`
199
+
200
+ ---
201
+ *Unexpected error?* [Report it on GitHub](${pL((t.message||``).slice(0,80))})`,d={id:Date.now()+2,session_id:e,role:`assistant`,content:u,created_at:new Date().toISOString(),rag_sources:null,failed:!fN(t),failureText:t.message||void 0};a(d),m(!1),_(),w(),D()}},ge=r?tn(e,N):h(e,ee,{...N,pageElements:ne});return se=ge,Je.current=ge,!0},[he,Te,f,e,me,Be,a,l,i,m,jt,_,d,y,x,S,C,w,E,D,re,kt]);ot.current=_n;let vn=B(t=>t.runningSessionIds.includes(e)),yn=B(e=>e.activeRunsAt>Ye.current);(0,V.useEffect)(()=>{DI()},[e]),(0,V.useEffect)(()=>{vn?!yn||f||Xe.current||(F.chat.info(`Resuming live view of background run for session=${e}`),ot.current(void 0,{attach:!0})):Xe.current=!1},[e,vn,yn,f]),(0,V.useEffect)(()=>{let e=e=>{let t=e.detail?.text;typeof t==`string`&&t.trim()&&ot.current(t)};return window.addEventListener(`gaia:send-message`,e),()=>window.removeEventListener(`gaia:send-message`,e)},[]),(0,V.useEffect)(()=>{!f&&qe.current&&qe.current.focus()},[f]);let bn=(0,V.useCallback)(async t=>{f||(F.chat.info(`Deleting message ${t} from session=${e}`),De(t),setTimeout(async()=>{l(t),De(null);try{await zt(e,t)}catch(n){F.chat.error(`Failed to delete message ${t}`,n),$n(e).then(e=>{kt()||i(VF(e.messages))}).catch(t=>F.chat.error(`Could not reload messages for session=${e}`,t))}},250))},[e,f,l,i,kt]),xn=(0,V.useRef)(!1),Sn=(0,V.useCallback)(async(n,r,a)=>{if(f||n.role!==`user`||xn.current)return!1;xn.current=!0;let o=a??n.content;F.chat.info(`Resending message ${n.id} from session=${e}`,{preview:o.slice(0,80)});let s=n=>re({id:`resend-failed-${e}-${Date.now()}`,type:`error`,agentId:e,agentName:`GAIA`,title:t(`chatError.resendFailed`),message:n,timestamp:Date.now(),read:!1,dismissed:!1,priority:`high`,sessionId:e});try{if(hI(B.getState().systemStatus)){let e=await te();if(B.getState().setSystemStatus(e),hI(e))return s(t(`chatError.resendStarting`)),!1}if(!Zs(`chat`)&&!await ec(`chat`))return!1;let a=await $n(e);if(kt())return!1;let c=VF(a.messages),l=HF(c,B.getState().messages,n);if(l&&r&&!WF(c,l,r))return F.chat.info(`Message ${n.id} was answered since it failed; not resending`),i(c),Mt.current=c.length,!1;if(l&&await ht(e,l.id),kt()){let{sessions:t,pendingDeleteIds:n}=B.getState();return t.some(t=>t.id===e)&&!n.includes(e)&&lt(e=>xt(e,o,`queued`)),!0}}catch(r){F.chat.error(`Could not resend message ${n.id} in session=${e}`,r);let i=r instanceof Error?bN(r):null;return s(i?.kind===`connection`||i?.kind===`timeout`?i.text:t(`chatError.resendStale`)),!1}finally{xn.current=!1}u(n.id);let c=!1;try{c=await ot.current(o)}catch(t){F.chat.error(`Could not resend message ${n.id} in session=${e}; queued it`,t)}return c||lt(e=>xt(e,o,`queued`)),!0},[e,f,u,i,lt,kt,re,t]);(0,V.useEffect)(()=>BI(e),[e]);let Cn=B(()=>zI(e)),wn=(0,V.useCallback)((e,t)=>new Promise(e=>{ot.current(t,{queued:!0,onQueuedOutcome:e})}),[]),Tn=f||Zt;(0,V.useEffect)(()=>{if(!Tn){if(dt.current){dt.current=!1;let e=ct.map(e=>e.text);e.length&&(lt(()=>[]),M(t=>[t.trim(),...e].filter(Boolean).join(`
202
+
203
+ `)))}else ct.length===0||vt||yt||ee||se||Lt.current||Be||It||kt()||!mt.current&&!Cn||qI(e,wn,()=>Ft.current&&!kt()&&!B.getState().isStreaming&&!Qt.current)}},[Tn,ct,vt,yt,Cn,ee,se,Be,It,e,wn,kt]);let En=(0,V.useRef)(!1);(0,V.useEffect)(()=>{En.current&&!Tn&&qt(),En.current=Tn},[Tn,qt]);let Dn=(0,V.useCallback)(t=>{let n=ct.find(e=>e.id===t&&e.state===`queued`);n&&f&&(lt(e=>b(e,t,`queued`,`sending`)),en(e,n.text).then(()=>lt(e=>b(e,t,`sending`,`delivered`))).catch(e=>{F.chat.info(`Follow-up not taken by the running reply; it stays queued: ${e instanceof Error?e.message:e}`),lt(e=>s(e,t))}))},[ct,f,e,lt]),On=(0,V.useCallback)(async()=>{let n=fe?B.getState().liveQuestions[fe]:void 0,r=he.trim();if(!fe||!n||!r||Te.hasUploaded){_n();return}let i=$k(r,n);if(!i)Le(t(`composer.pickAnOption`));else{Le(null),M(``);try{await Qk(e,fe,i.value,i.shown)}catch(e){M(r),e instanceof Xk||Le(t(`composer.answerFailed`,{error:SM(e)}))}}},[fe,he,Te,_n,M,e,t]),kn=(0,V.useCallback)(()=>{for(let e=r.length-1;e>=0;e--)if(r[e].role===`user`){Sn(r[e]);return}},[r,Sn]),An=(0,V.useCallback)(e=>{let t=r.indexOf(e);for(let n=t-1;n>=0;n--)if(r[n].role===`user`){Sn(r[n],e);return}},[r,Sn]),jn=(0,V.useCallback)(e=>{let t=r.indexOf(e);for(let e=t-1;e>=0;e--)if(r[e].role===`user`){Sn(r[e]);return}},[r,Sn]),[Nn,Pn]=(0,V.useState)(null),Fn=(0,V.useRef)(null),In=(0,V.useCallback)(e=>{Fn.current=null,Pn(e)},[]),Ln=(0,V.useCallback)(()=>{let e=EL(r);e&&In(e.id)},[r,In]),Rn=(0,V.useCallback)(()=>{Fn.current=null,Pn(null),qe.current?.focus()},[]),zn=(0,V.useCallback)(async(e,t)=>{Fn.current=t,await Sn(e,void 0,t)&&(Fn.current=null,Pn(t=>t===e.id?null:t))},[Sn]),Bn=(0,V.useCallback)(()=>{ot.current(t(`msg.continuePrompt`))},[t]),Vn=()=>{ye(me?.title||``),ge(!0)},Hn=async()=>{let n=ve.trim().slice(0,200).trim();if(n&&ve!==me?.title&&n!==me?.title){Le(null);try{await _e(e,{title:n,title_is_custom:!0}),d(e,{title:n})}catch(n){F.chat.error(`Could not rename chat ${e}`,n),Le(t(`chat.renameFailed`,{error:SM(n)}))}}ge(!1)},Un=(0,V.useCallback)(async()=>{if(e){Le(null);try{let t=await c(e);d(e,{private:t.private})}catch(e){F.ui.warn(`Failed to toggle private mode`,e),Le(t(`chat.privateFailed`,{error:SM(e)}))}}},[e,d,t]),Wn=(0,V.useCallback)(async n=>{if(n.preventDefault(),n.stopPropagation(),xe(!1),n.dataTransfer.files.length===0)return;let r=Array.from(n.dataTransfer.files),i=r.filter(e=>tL(e.name));i.length>0&&Te.addFiles(i);let a=r.filter(e=>!tL(e.name));if(a.length===0||!await ec(`embedding`))return;Le(null);let o=await xH(e,a);o.length>0&&Le(o.map(({name:e,stage:n,error:r})=>n===`unreadable`||n===`server`?t(n===`server`?`docsBar.serverTitle`:`docsBar.failedTitle`,{name:e}):t(n===`attach`?`chat.dropAttachFailed`:`chat.dropUploadFailed`,{name:e,error:SM(r)})).join(` `))},[e,Te,t]),Gn=e=>{e.dataTransfer?.types?.includes(`Files`)&&(e.preventDefault(),e.stopPropagation(),xe(!0))},Kn=e=>{e.preventDefault(),e.stopPropagation(),xe(!1)},qn=r.length>0?r[r.length-1]:void 0,Jn=(0,V.useMemo)(()=>cA(qn),[qn]),Yn=(0,V.useMemo)(()=>lA(qn),[qn]),Xn=!f&&!ee&&qn?.role===`assistant`&&(uA(qn)?Jn.length>0:QO(qn.content)),Zn=(0,V.useMemo)(()=>{let e=new Map,t;for(let n of r)if(n.role===`user`&&n.created_at)t=new Date(n.created_at).getTime();else if(n.role===`assistant`&&n.created_at&&t!==void 0){let r=new Date(n.created_at).getTime();r>t&&e.set(n.id,r-t),t=void 0}return e},[r]),Qn=Be?`This chat used the retired "${Be}" agent and is read-only. Start a new chat.`:hI(A)?iu:null;return z(`main`,{className:`task-view ${be?`drag-active`:``}`,style:{"--session-panel-w":`${an}px`},onDrop:Wn,onDragOver:Gn,onDragLeave:Kn,"aria-label":me?.title||`Chat`,children:[I(OF,{busy:Tn}),z(`header`,{className:`task-header`,children:[I(`div`,{className:`task-header-left`,children:N?I(`input`,{className:`title-edit`,value:ve,maxLength:200,onChange:e=>ye(e.target.value),onBlur:Hn,onKeyDown:e=>{e.key===`Enter`&&!e.nativeEvent.isComposing&&Hn(),e.key===`Escape`&&(e.preventDefault(),ge(!1))},...Pt,autoFocus:!0,"aria-label":`Chat title`,dir:`auto`}):z(`button`,{type:`button`,className:`task-title`,onClick:Vn,title:t(`row.rename`),children:[I(`span`,{children:vH(me?.title)?t(`sidebar.newChat`):me?.title}),I(go,{size:12,"aria-hidden":`true`,className:`task-title-edit`})]})}),z(`div`,{className:`task-header-right`,children:[I(`button`,{ref:ln,className:`btn-icon-sm task-header-resources`,onClick:()=>cn(!sn),"aria-pressed":sn,"aria-label":t(`resources.toggle`),title:t(sn?`resources.hide`:`resources.show`),children:I(sr,{size:15,"aria-hidden":`true`})}),I(DV,{isPrivate:!!me?.private,onToggle:Un}),I(`button`,{className:`btn-icon-sm`,onClick:()=>k(!0),title:t(`chat.browseFiles`),"aria-label":t(`chat.browseFiles`),children:I(ra,{size:15})}),I(`button`,{className:`btn-icon-sm`,onClick:Ne,title:t(`chat.exportTitle`),"aria-label":t(`chat.exportLabel`),children:I(Ci,{size:15})}),I(EV,{messages:r,busy:f})]})]}),sn&&I(YV,{onClose:fn}),!sn&&un&&z(`div`,{className:`resource-strip resource-hidden-note`,role:`status`,children:[I(`span`,{children:t(`resources.hiddenNote`)}),I(`button`,{type:`button`,className:`resource-hidden-undo`,onClick:()=>cn(!0),children:t(`resources.show`)})]}),I(kV,{sessionId:e,onDetachFailed:ze}),I(`div`,{className:`messages-scroll`,ref:Ke,...Ot,children:z(`div`,{className:`messages-column`,children:[ee&&!Rt&&I(`div`,{className:`skeleton-messages`,"aria-label":t(`chat.loadingMessages`),children:[0,1,2].map(e=>I(`div`,{className:`skeleton-msg`,children:z(`div`,{className:`skeleton-lines`,children:[I(`div`,{className:`skeleton-line`}),I(`div`,{className:`skeleton-line`}),e!==2&&I(`div`,{className:`skeleton-line`})]})},e))}),Bt.map((e,t)=>{let n=e.role===`assistant`?e.historyNotice??zH.get(e.id):void 0,i=e.role===`assistant`&&QP(e.content,e.stopState)===`interrupted`,a=e.role===`assistant`&&e.stopState===`stopped`&&!e.stopError,o=(e.failed===!0||i||a)&&!Tn&&!Be&&t===r.length-1,s=!o&&!Tn&&!Yt&&!Be&&e.role===`assistant`&&t===r.length-1&&!e.stopState&&!e.failed&&!AP(e.content),c=e.stats?.seconds==null?Zn.get(e.id):e.stats.seconds*1e3,l=Vt(e);return z(`div`,{className:Ee===e.id?`msg-deleting`:We.current.has(Ue.current.get(e.id)??e.id)?`msg-settled`:void 0,"data-message-id":e.id,"data-role":e.role,children:[n&&I(BH,{text:n}),e.libraryNotices&&e.libraryNotices.length>0&&I(VH,{notices:e.libraryNotices}),I(nF,{message:e,agentSteps:e.role===`assistant`?e.agentSteps:void 0,onDelete:!Tn&&!l?bn:void 0,onResend:!Tn&&!l&&e.role===`user`&&!Be?Sn:void 0,onEditStart:!Tn&&!l&&e.role===`user`&&!Be?()=>In(e.id):void 0,editing:Nn===e.id&&!Tn,editDraft:Nn===e.id?Fn.current:null,onEditDraft:e=>{Fn.current=e},onEdit:zn,onEditCancel:Rn,laterCount:e.role===`user`?DL(r,t):0,onRegenerate:s&&!l?()=>jn(e):void 0,extraActions:s?I($R,{answeredBy:e.stats?.model??me?.effective_model,onPick:t=>L(e,t)}):void 0,onTryAgain:o?()=>An(e):void 0,onContinue:o&&a?Bn:void 0,latest:e.role===`assistant`&&t===r.length-1,latencyMs:c}),e.failure===`model_server_down`&&t===r.length-1&&!Tn&&I(EH,{}),Yt?.messageId===e.id&&I(rz,{original:e,originalModel:e.stats?.model??me?.effective_model,originalLatencyMs:c,state:Yt.state,keeping:Yt.keeping,onKeep:e=>{$t(e)},onClose:nn})]},Ut(e)??Ue.current.get(e.id)??e.id)}),f&&Ve&&I(BH,{text:Ve}),f&&I(oI,{}),(f||!!Rt)&&I(`div`,{className:`streaming-bubble stream-active`,children:I(nF,{message:{id:-1,session_id:e,role:`assistant`,content:f&&p||``,created_at:``,rag_sources:null},isStreaming:f||!!Rt,agentSteps:f?v:LH,agentStepsActive:f&&v.some(e=>e.active),cards:f?T:RH,liveStatus:f?ce:null,toolStatus:f?le:null,awaitingUser:f&&(ue||de||pe)})}),I(`div`,{ref:Ge})]})}),I(TV,{sessionId:e,messages:r,busy:Tn,onUsage:Jt,onJumpToMessage:pn}),be&&z(`div`,{className:`drag-overlay`,children:[I(Os,{size:32,strokeWidth:1.5,"aria-hidden":`true`}),I(`span`,{children:t(`chat.dropOverlay`)})]}),Oe&&z(`div`,{className:`toast policy-alert-toast`,role:`alert`,children:[I(`span`,{children:t(`chat.policyBlocked`,{tool:Oe.tool})}),Oe.receiptId?I(`button`,{type:`button`,className:`policy-alert-toast-link`,onClick:()=>{let e=Oe.receiptId;e&&(oe(`policy_alert`),j(!0),Me(e))},children:t(`chat.policyViewReceipt`)}):I(`span`,{className:`policy-alert-toast-missing`,children:t(`activity.policy.receiptUnavailable`)})]}),z(`div`,{className:`input-area`,children:[Se&&I(`button`,{className:`scroll-bottom-btn`,onClick:mn,title:t(`chat.scrollBottom`),"aria-label":t(`chat.scrollBottom`),children:I(dr,{size:16})}),z(`div`,{className:`input-column`,children:[I(ZV,{message:Pe,onDismiss:Fe,dismissLabel:t(`chat.dismissExportError`)}),I(ZV,{message:Ie,onDismiss:()=>Le(null),dismissLabel:t(`chat.dismissError`)}),Xn&&qn&&I(bL,{content:qn.content,providers:Jn,accounts:Yn,onRetry:kn},qn.id),I($E,{sessionId:e}),I(KR,{usage:Wt}),I(XV,{sessionId:e}),se&&It&&I(`ul`,{className:`queued-messages`,"aria-label":t(`composer.heldLabel`),"aria-live":`polite`,children:z(`li`,{className:`queued-message is-queued`,children:[I(di,{size:12,"aria-hidden":`true`}),I(`span`,{className:`queued-message-text`,title:se.text,children:se.text}),I(`span`,{className:`queued-message-state`,children:t(`composer.heldUntilStarted`)})]})}),I(SR,{items:ct,onRemove:e=>lt(t=>we(t,e)),onRetry:e=>lt(t=>b(t,e,`failed`,`queued`)),onSteer:f&&!$e&&!ft?Dn:void 0,replying:f,busyRetry:!!vt}),I(LL,{value:he,onChange:M,onSubmit:fe?On:()=>_n(),answering:!!fe,onStop:gn,streaming:f,stopping:$e,queueWhileStreaming:!0,disabledReason:Qn,attachments:Te,inputRef:qe,onEditLast:!Tn&&!Be?Ln:void 0,placeholder:fe?t(`composer.answerQuestion`):f?t(`composer.queueNext`):r.length===0?t(`composer.placeholder`):t(`composer.reply`),leftControls:I(yR,{sessionId:e,disabled:!!Be}),rightControls:z(P.Fragment,{children:[I(GR,{usage:Wt,unavailable:Gt,sessionId:e,busy:Tn,onUsage:Jt,onDetails:()=>on(`context`)}),I(XR,{sessionId:e,busy:Tn}),I(mR,{sessionId:e,onOpen:()=>on(`environment`)}),I(tR,{})]})})]})]})]})}var WH=1.1,GH=60,KH=110,qH=24,JH=2.4,YH=Math.PI*2,XH=(e,t,n)=>{let r=Math.min(1,Math.max(0,(n-e)/(t-e)));return r*r*(3-2*r)};function ZH(e){let t=e;return()=>{t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}var QH=class{cols=0;rows=0;w=0;h=0;ox=0;oy=0;time=0;energy=new Float32Array;offset=new Float32Array;mask=new Float32Array;phase=new Float32Array;waves=[];ripples=[];waveIn=1.5;dragIn=0;activity=`idle`;progress=0;pointer=null;exit=null;done=!1;settled=!1;rand;constructor(e=7){this.rand=ZH(e)}get cleared(){return this.done}get dissolving(){return this.exit!==null||this.done}resize(e,t,n){this.w=e,this.h=t,this.cols=Math.ceil(e/30),this.rows=Math.ceil(t/30),this.ox=(e-this.cols*30)/2,this.oy=(t-this.rows*30)/2;let r=this.cols*this.rows;this.energy=new Float32Array(r),this.offset=new Float32Array(r*2),this.phase=Float32Array.from({length:r},()=>this.rand()*YH),this.setHole(n)}setHole(e){this.mask.length!==this.cols*this.rows&&(this.mask=new Float32Array(this.cols*this.rows));for(let t=0;t<this.rows;t++)for(let n=0;n<this.cols;n++){let[r,i]=this.center(n,t),a=Math.hypot((r-e.cx)/e.rx,(i-e.cy)/e.ry);this.mask[t*this.cols+n]=(.3+.7*XH(.75,1.5,a))*XH(0,50,i)*XH(0,50,this.h-i)}}setActivity(e){e!==this.activity&&(this.activity=e,this.waveIn=0)}setProgress(e){this.progress=Math.min(1,Math.max(0,e))}setPointer(e,t,n,r=0){this.pointer={x:e,y:t,down:n,speed:r}}clearPointer(){this.pointer=null}ripple(e,t,n){this.ripples.length>24&&this.ripples.shift(),this.ripples.push({x:e,y:t,r:0,t:0,life:1.2+n*.6,strength:n,speed:150+this.rand()*50,phase:this.rand()*YH})}dissolve(e,t){this.ripple(e,t,1);let n=Math.hypot(Math.max(e,this.w-e),Math.max(t,this.h-t))*1.15;this.exit={x:e,y:t,t:0,reach:n,phase:this.rand()*YH},this.done=!1}restore(){this.exit=null,this.done=!1,this.settled=!1,this.energy.fill(0),this.offset.fill(0),this.ripples=[],this.waves=[]}energyAt(e,t){return this.energy[t*this.cols+e]}offsetAt(e,t){let n=t*this.cols+e;return[this.offset[n*2],this.offset[n*2+1]]}center(e,t){return[this.ox+(e+.5)*30,this.oy+(t+.5)*30]}step(e){if(this.done)return!1;if(this.settled&&this.activity===`idle`&&!this.pointer&&!this.ripples.length&&!this.waves.length&&!this.exit&&this.waveIn>e)return this.waveIn-=e,!1;this.time+=e;let t=this.time,n=this.cols+this.rows*.6;if(this.waveIn-=e,this.waveIn<=0){if(this.activity===`loading`)this.waveIn=.9+this.rand()*.5,this.waves.push({front:-3,speed:14+this.rand()*6,dir:1,span:n,strength:.5+this.rand()*.2});else if(this.activity===`idle`){this.waveIn=3+this.rand()*4;let e=this.rand()<.5?1:-1;this.waves.push({front:e>0?-3:n+3,speed:7+this.rand()*4,dir:e,span:n,strength:.45})}else this.waveIn=1}let r=this.pointer;r?.down&&(this.dragIn-=e,this.dragIn<=0&&(this.dragIn=.12,this.ripple(r.x,r.y,.7)));let i=Math.exp(-e*JH),a=Math.min(1,e*14),o=Math.min(1,e*9),s=r?GH+Math.min(80,r.speed*.08):0,c=r?.5+Math.min(.45,r.speed/2e3):0,l=this.activity===`download`?this.progress*this.rows:-1,{cols:u,rows:d,energy:f,offset:p}=this,m=0,h=0;for(let e=0;e<d;e++)for(let n=0;n<u;n++){let g=e*u+n,[_,v]=this.center(n,e),y=f[g]*i,b=0,x=0,S=0,C=.55+.45*Math.sin(n*1.7+e*2.3+t*.6),w=n+e*.6+.9*Math.sin(e*.45+t*.8)+.5*Math.sin(n*.21-t*1.1);for(let e of this.waves){let t=1-Math.abs(w-e.front)/1.5;t>0&&(b=Math.max(b,t*e.strength*C))}for(let e of this.ripples){let t=_-e.x,n=v-e.y,r=Math.hypot(t,n)||1;if(Math.abs(r-e.r)>qH+.11*e.r)continue;let i=Math.atan2(n,t),a=e.r*(1+.07*Math.sin(5*i+e.phase)+.04*Math.sin(9*i-e.phase*2)),o=1-Math.abs(r-a)/qH;if(o<=0)continue;let s=(1-e.t/e.life)**1.3;b=Math.max(b,o*.85*e.strength*s),x+=t/r*o*7*e.strength*s,S+=n/r*o*7*e.strength*s}if(r){let e=_-r.x,t=v-r.y,n=Math.hypot(e,t)||1;if(n<s&&(b=Math.max(b,(1-n/s)**1.4*c)),n<KH){let i=(1-n/KH)**2*(10+Math.min(10,r.speed/120));x+=e/n*i,S+=t/n*i}}let T=0;if(l>=0){let r=l-(d-1-e+.5+.35*Math.sin(n*.55+t*2.1)+.2*Math.sin(n*1.31-t*1.3));r>0&&(T=.16),r>-1&&r<1&&(b=Math.max(b,(1-Math.abs(r))*(.45+.35*Math.sin(t*3+this.phase[g]))))}f[g]=Math.max(T,b>y?y+(b-y)*a:y),p[g*2]+=(x-p[g*2])*o,p[g*2+1]+=(S-p[g*2+1])*o,m=Math.max(m,f[g]),h=Math.max(h,Math.abs(p[g*2]),Math.abs(p[g*2+1]))}return this.settled=m<.04&&h<.05,this.waves=this.waves.filter(t=>(t.front+=t.dir*t.speed*e,t.front>=-4&&t.front<=t.span+4)),this.ripples=this.ripples.filter(t=>(t.t+=e,t.r+=t.speed*e*(1-.35*t.t/t.life),t.t<t.life)),this.exit&&(this.exit.t+=e,this.exit.t>=1.1&&(this.exit=null,this.done=!0)),!0}draw(e,t){if(e.clearRect(0,0,this.w,this.h),this.done)return;let{cols:n,rows:r,energy:i,offset:a,mask:o}=this,s=t.dark?.17:.14;e.lineWidth=1;for(let c=0;c<r;c++)for(let r=0;r<n;r++){let l=c*n+r,[u,d]=this.center(r,c),f=u+a[l*2],p=d+a[l*2+1],m=i[l],h=o[l];if(m<.04){e.fillStyle=t.fg,e.globalAlpha=s*h,e.fillRect(f-1,p-1,2,2);continue}let g=2+m*19,_=Math.max(1,6-m*3);e.beginPath(),e.roundRect(f-g/2,p-g/2,g,g,_),e.fillStyle=t.accent,e.globalAlpha=(.12+m*.22)*h,e.fill(),e.strokeStyle=t.accent,e.globalAlpha=m*.5*h,e.stroke()}this.exit&&this.drawExit(e,t),e.globalAlpha=1}drawExit(e,t){let n=this.exit,r=Math.min(1,n.t/WH),i=(1-(1-r)**3)*n.reach,a=new Path2D;for(let e=0;e<=180;e++){let t=e/180*YH,r=i*(1+.06*Math.sin(3*t+n.phase+n.t*1.5)+.03*Math.sin(5*t-n.phase*1.7-n.t*2.2)),o=n.x+Math.cos(t)*r,s=n.y+Math.sin(t)*r;e?a.lineTo(o,s):a.moveTo(o,s)}a.closePath(),e.globalAlpha=1,e.globalCompositeOperation=`destination-out`,e.fill(a),e.globalCompositeOperation=`source-over`,e.strokeStyle=t.accent,e.lineWidth=1.4,e.globalAlpha=.55*(1-r)**.7,e.stroke(a)}},$H=90;function eU(){let e=getComputedStyle(document.documentElement);return{fg:e.getPropertyValue(`--text-primary`).trim(),accent:e.getPropertyValue(`--accent-solid`).trim(),dark:document.documentElement.getAttribute(`data-theme`)===`dark`}}function tU(e,t,n){let r=e.getBoundingClientRect();return r.width?{cx:r.left-t.left+r.width/2,cy:r.top-t.top+r.height/2,rx:r.width/2+n,ry:r.height/2+n+10}:null}function nU({activity:e,progress:t=0,pulse:n,docked:r,contentRef:i,composerRef:a}){let o=(0,V.useRef)(null),s=(0,V.useRef)(null),c=(0,V.useRef)(null),l=(0,V.useRef)(()=>{}),u=(0,V.useRef)(()=>{}),d=(0,V.useRef)(r),f=(0,V.useRef)({value:n,at:0});d.current=r,(0,V.useEffect)(()=>{let e=o.current,t=e?.parentElement;if(!e||!t)return;let n=e.getContext(`2d`);if(!n){F.ui.warn(`New-chat background is off: the browser gave no 2D canvas context (often low graphics memory).`);return}c.current=t;let r=new QH;s.current=r;let f=typeof window.matchMedia==`function`?window.matchMedia(Oz):null,p=eU(),m=0,h=0,g=!1,_=``,v={x:0,y:0,at:0,speed:0},y=()=>r.draw(n,p),b=(e,t=!1)=>{let n=d.current?a.current:i.current,r=(n&&tU(n,e,d.current?24:40))??{cx:e.width/2,cy:e.height/2,rx:1,ry:1},o=`${Math.round(r.cx)},${Math.round(r.cy)},${Math.round(r.rx)},${Math.round(r.ry)}`;return t||o!==_?(_=o,r):null},x=()=>{let i=t.getBoundingClientRect();if(!i.width||!i.height)return;let a=Math.min(2,window.devicePixelRatio||1);e.width=Math.round(i.width*a),e.height=Math.round(i.height*a),n.setTransform(a,0,0,a,0,0),r.resize(i.width,i.height,b(i,!0)),y()},S=e=>{if(m=requestAnimationFrame(S),e-h<31.833333333333336)return;let n=Math.min(.1,(e-h)/1e3);h=e;let i=b(t.getBoundingClientRect());i&&r.setHole(i),e-v.at>80&&(v.speed*=.8),(r.step(n)||i)&&y(),r.cleared&&w()},C=()=>{g||document.hidden||f?.matches||r.cleared||(g=!0,h=performance.now(),m=requestAnimationFrame(S))},w=()=>{g=!1,cancelAnimationFrame(m)};l.current=C,u.current=()=>{let e=b(t.getBoundingClientRect());e&&r.setHole(e),g||y()};let T=()=>document.hidden?w():C(),E=()=>{w(),y(),C()},D=()=>{p=eU(),y()},O=e=>{let n=t.getBoundingClientRect(),i=e.clientX-n.left,a=e.clientY-n.top,o=performance.now();if(v.at&&o>v.at){let e=Math.hypot(i-v.x,a-v.y)/((o-v.at)/1e3);v.speed+=(Math.min(4e3,e)-v.speed)*.35}Object.assign(v,{x:i,y:a,at:o});let s=e.target instanceof Element&&e.target.closest(`button, a, input, textarea, .composer`);r.setPointer(i,a,(e.buttons&1)==1&&!s,v.speed)},k=()=>{v.at=0,v.speed=0,r.clearPointer()},ee=typeof ResizeObserver>`u`?null:new ResizeObserver(x);ee?.observe(t,{box:`border-box`});let te=new MutationObserver(D);return te.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`,`data-palette`,`style`]}),document.addEventListener(`visibilitychange`,T),f?.addEventListener(`change`,E),t.addEventListener(`pointermove`,O),t.addEventListener(`pointerleave`,k),x(),C(),()=>{w(),ee?.disconnect(),te.disconnect(),document.removeEventListener(`visibilitychange`,T),f?.removeEventListener(`change`,E),t.removeEventListener(`pointermove`,O),t.removeEventListener(`pointerleave`,k),s.current=null,l.current=()=>{},u.current=()=>{}}},[i,a]);let p=(0,V.useCallback)(()=>{let e=c.current,t=a.current;if(!e||!t)return null;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return[r.left-n.left+r.width/2,r.top-n.top+r.height/2]},[a]);return(0,V.useEffect)(()=>{let t=s.current;if(t){if(t.setActivity(e),e===`sending`){let e=p();e&&t.dissolve(...e)}else t.dissolving&&(t.restore(),l.current())}},[e,p]),(0,V.useEffect)(()=>{s.current?.setProgress(t)},[t]),(0,V.useEffect)(()=>{u.current()},[r]),(0,V.useEffect)(()=>{let e=f.current;if(n===e.value)return;let t=performance.now();if(e.value=n,t-e.at<$H)return;e.at=t;let r=p();r&&s.current?.ripple(...r,.45)},[n,p]),I(`canvas`,{ref:o,className:`npu-backdrop`,"aria-hidden":`true`})}async function rU(e,t,n){let r=`${dn()}${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.status!==204&&(o.headers.get(`content-type`)||``).includes(`application/json`))return o.json()}function iU(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 aU(){return rU(`GET`,`/memory/stats`)}function oU(e=30){return rU(`GET`,`/memory/activity?days=${e}`)}function sU(e={}){return rU(`GET`,`/memory/knowledge${iU(e)}`)}function cU(e){return rU(`POST`,`/memory/knowledge`,e)}function lU(e,t){return rU(`PUT`,`/memory/knowledge/${encodeURIComponent(e)}`,t)}function uU(e){return rU(`DELETE`,`/memory/knowledge/${encodeURIComponent(e)}`)}function dU(){return rU(`GET`,`/memory/entities`)}function fU(){return rU(`GET`,`/memory/tools`)}function pU(e=20){return rU(`GET`,`/memory/conversations?limit=${e}`)}function mU(e,t=20){return rU(`GET`,`/memory/conversations/search?query=${encodeURIComponent(e)}&limit=${t}`)}function hU(e){return rU(`GET`,`/memory/conversations/${encodeURIComponent(e)}`)}function gU(e=7){return rU(`GET`,`/memory/upcoming?days=${e}`)}function _U(){return rU(`GET`,`/memory/embedding-coverage`)}function vU(){return rU(`POST`,`/memory/consolidate`)}function yU(){return rU(`POST`,`/memory/rebuild-embeddings`)}function bU(){return rU(`POST`,`/memory/reconcile`)}function xU(){return rU(`POST`,`/memory/rebuild-fts`)}function SU(){return rU(`POST`,`/memory/refresh-system-context`)}function CU(){return new EventSource(`${dn()}/memory/stream-discovery`)}function wU(e){return new EventSource(`${dn()}/memory/stream-inference?include_browser=${e}`)}function TU(e){return rU(`POST`,`/memory/commit-discovery`,{items:e})}function EU(e){return rU(`POST`,`/memory/commit-inference`,{insights:e})}function DU(){return rU(`GET`,`/memory/settings`)}function OU(e){return rU(`PUT`,`/memory/settings`,e)}function kU(){return rU(`GET`,`/memory/embedder`)}function AU(e){return rU(`PUT`,`/memory/embedder`,{device:e})}function jU(){return rU(`DELETE`,`/memory/all`)}function MU(){return rU(`POST`,`/memory/reinitialize`)}function NU(){return rU(`GET`,`/goals/health`)}function PU(){return rU(`POST`,`/goals/store/reset`)}function FU(){return rU(`GET`,`/goals/stats`)}function IU(e={}){return rU(`GET`,`/goals${iU(e)}`)}function LU(e){return rU(`POST`,`/goals`,e)}function RU(e){return rU(`PUT`,`/goals/${encodeURIComponent(e)}/approve`)}function zU(e){return rU(`PUT`,`/goals/${encodeURIComponent(e)}/reject`)}function BU(e){return rU(`PUT`,`/goals/${encodeURIComponent(e)}/cancel`)}function VU(e){return rU(`DELETE`,`/goals/${encodeURIComponent(e)}`)}function HU({disabled:e}){let t=R(),n=B(e=>e.draftPrivate),r=B(e=>e.setDraftPrivate),i=B(e=>e.settingsSection!==null),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(!1),d=(0,V.useRef)(null),f=(0,V.useCallback)(()=>u(!1),[]);if((0,V.useEffect)(()=>{if(i)return;let e=!1;return DU().then(t=>{e||(o(t.memory_enabled),c(!1))}).catch(t=>{e||(F.ui.error(`Could not read the memory setting for the Private chip`,t),o(null),c(!0))}),()=>{e=!0}},[i]),(0,V.useEffect)(()=>{a===!1&&n&&r(!1)},[a,n,r]),a===!1)return z(`button`,{type:`button`,className:`composer-chip composer-chip-memory is-unavailable`,disabled:!0,"aria-label":t(`composer.memoryOff`),title:t(`composer.memoryOffTitle`),children:[I(Ni,{size:13,"aria-hidden":`true`}),I(`span`,{className:`composer-chip-label`,dir:`auto`,children:t(`composer.memoryOff`)})]});let p=e=>{r(e),u(!1)},m=[{priv:!1,Icon:Fi,label:t(`composer.remember`),note:t(s?`composer.memoryUnknownTitle`:`composer.rememberNote`)},{priv:!0,Icon:Ni,label:t(`composer.privateChat`),note:t(`composer.privateChatNote`)}];return z(`div`,{className:`composer-chip-wrap`,children:[z(`button`,{ref:d,type:`button`,className:`composer-chip composer-chip-memory${n?` is-on`:``}`,onClick:()=>u(e=>!e),disabled:e,"aria-haspopup":`dialog`,"aria-expanded":l,"aria-label":t(`composer.memoryChipAria`,{state:t(n?`composer.private`:s?`composer.memoryUnknown`:`composer.memoryOn`)}),title:t(n?`composer.privateChatNote`:s?`composer.memoryUnknownTitle`:`composer.rememberNote`),children:[I(n?Ni:Fi,{size:13,"aria-hidden":`true`}),I(`span`,{className:`composer-chip-label`,dir:`auto`,children:t(n?`composer.private`:s?`composer.memoryUnknown`:`composer.memoryOn`)}),I(Gr,{size:12,"aria-hidden":`true`})]}),I(Gs,{open:l,onClose:f,anchor:d,label:t(`composer.memoryMenu`),children:m.map(({priv:e,Icon:t,label:r,note:i})=>z(`button`,{type:`button`,className:`popover-item`,onClick:()=>p(e),"aria-pressed":n===e,children:[I(`span`,{className:`popover-item-check`,"aria-hidden":`true`,children:I(n===e?Vr:t,{size:13})}),z(`span`,{className:`popover-item-body`,children:[I(`span`,{className:`popover-item-title`,children:r}),I(`span`,{className:`popover-item-note`,children:i})]})]},String(e)))})]})}var UU=[{icon:Ur,label:`cards.try.recipe`,prompt:`cards.try.recipePrompt`},{icon:Ti,label:`cards.try.workout`,prompt:`cards.try.workoutPrompt`},{icon:Ps,label:`cards.try.howTo`,prompt:`cards.try.howToPrompt`},{icon:Fa,label:`cards.try.checklist`,prompt:`cards.try.checklistPrompt`},{icon:Ua,label:`cards.try.trip`,prompt:`cards.try.tripPrompt`},{icon:Mo,label:`cards.try.bill`,prompt:`cards.try.billPrompt`},{icon:Nr,label:`cards.try.loan`,prompt:`cards.try.loanPrompt`}];function WU({onPick:e,disabled:t}){let n=R();return z(`div`,{className:`try-chips`,role:`group`,"aria-label":n(`cards.tryGroup`),children:[I(`span`,{className:`try-chips-label`,"aria-hidden":`true`,children:n(`cards.try`)}),UU.map(({icon:r,label:i,prompt:a})=>{let o=n(i),s=n.bare(a);return z(`button`,{type:`button`,className:`try-chip`,title:s,"aria-label":`${o}: ${s}`,onClick:()=>e(s),disabled:t,children:[I(r,{size:14,"aria-hidden":`true`}),o]},i)})]})}var GU=1e3;function KU(){let[e,t]=(0,V.useState)(null);return(0,V.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(()=>{ct().then(r,i)},GU)):t(null))},i=n=>{e||(F.system.warn(`Warm-up status unavailable`,n),t(null))};return mt().then(r,i),()=>{e=!0,n&&clearTimeout(n)}},[]),e}function qU(e){return e===`gpu`?`your GPU`:e===`npu`?`your NPU`:e===`cpu`?`the CPU`:null}function JU(e){return e<1?`under 1 GB`:`${e.toFixed(1)} GB`}var YU=15e3;function XU(e=new Date,t=gt){let n=e.getHours();return t(`newChat.greeting.${n<5?`evening`:n<12?`morning`:n<18?`afternoon`:`evening`}`)}var ZU={gpu:`device.gpu`,npu:`device.npu`,cpu:`device.cpu`};function QU({seconds:e,model:t,device:n},r=gt){if(!t)return r(`newChat.warmup.ready`,{s:e});let i=xc(t),a=n?ZU[n]:void 0;if(a)return r(`newChat.warmup.loadingOn`,{model:i,where:u(a),s:e});let o=qU(n);return o?r(`newChat.warmup.loadingOn`,{model:i,where:o,s:e}):r(`newChat.warmup.loading`,{model:i,s:e})}function $U({detail:e,onRetry:t}){let n=R(),[r,i]=(0,V.useState)(!1);return z(`div`,{className:`new-chat-note`,children:[z(`p`,{children:[n(`newChat.assistantUnavailable`),` `,I(`button`,{type:`button`,className:`link-btn`,onClick:t,children:n(`newChat.tryAgain`)})]}),z(`button`,{type:`button`,className:`new-chat-details`,"aria-expanded":r,onClick:()=>i(e=>!e),children:[I(Yr,{size:12,className:r?`is-open`:``,"aria-hidden":`true`}),` `,n(`newChat.details`)]}),r&&I(`pre`,{className:`new-chat-details-text`,children:e})]})}function eW(){let{documents:e,draftDocumentIds:t,addDraftDocuments:n}=B.getState();n(e.filter(e=>e.indexing_status===`complete`&&!t.includes(e.id)).map(e=>e.id))}function tW(){let e=R(),[t,n]=(0,V.useState)(!1),r=B(e=>e.documents),i=B(e=>e.draftDocumentIds),a=B(e=>e.removeDraftDocument),o=B(e=>e.setShowDocLibrary),s=r.filter(e=>i.includes(e.id)),c=r.filter(e=>e.indexing_status===`complete`&&!i.includes(e.id));if(!s.length&&!c.length)return null;let l=c.length,u=s.length-5,d=t||u<=0?s:s.slice(0,5);return z(`div`,{className:`new-chat-docs`,children:[s.length>0&&I(`ul`,{id:`new-chat-doc-list`,className:`new-chat-doc-list${t?` is-expanded`:``}`,"aria-label":e(`newChat.docs.forChat`),children:d.map(t=>z(`li`,{className:`new-chat-doc`,children:[I(Yi,{size:12,"aria-hidden":`true`}),I(`span`,{dir:`ltr`,children:t.filename}),I(`button`,{type:`button`,className:`new-chat-doc-remove`,onClick:()=>a(t.id),"aria-label":e(`newChat.docs.dontAttach`,{name:t.filename}),children:I(Is,{size:12,"aria-hidden":`true`})})]},t.id))}),u>0&&I(`button`,{type:`button`,className:`link-btn new-chat-doc-toggle`,"aria-expanded":t,"aria-controls":`new-chat-doc-list`,onClick:()=>n(e=>!e),children:t?e(`newChat.docs.fewer`):e(`newChat.docs.hidden`,{n:u})}),l>0&&z(`p`,{className:`new-chat-note`,children:[s.length?e.plural(`newChat.docs.more`,l):e.plural(`newChat.docs.library`,l),` `,I(`button`,{type:`button`,className:`link-btn`,onClick:eW,children:l===1?e(`newChat.docs.attachIt`):e(`newChat.docs.attachAll`,{n:l})}),l>1&&z(P.Fragment,{children:[` · `,I(`button`,{type:`button`,className:`link-btn`,onClick:()=>o(!0),children:e(`newChat.docs.choose`)})]})]})]})}function nW({error:e}){let t=R(),n=B(e=>e.openSettings);return z(`div`,{className:`new-chat-setup-failed`,role:`alert`,children:[I(`p`,{className:`new-chat-setup-failed-title`,children:t(`newChat.setupFailed.title`)}),I(`p`,{className:`new-chat-setup-failed-error`,children:e}),z(`p`,{children:[t(`newChat.setupFailed.hint`),` `,I(`button`,{type:`button`,className:`link-btn`,onClick:()=>n(`model`),children:t(`newChat.setupFailed.choose`)})]})]})}function rW({onSend:e,initialText:t=``,focusRequest:n=0,agentMissing:r=!1,agentRefused:i=!1}){let s=R(),c=B(e=>hI(e.systemStatus)),l=B(e=>e.systemStatus?.download_progress??null),u=B(e=>e.systemStatus?.model_loaded?null:e.systemStatus?.setup_error??null),d=_c(e=>!!e.active?.remote),[f,p]=DH(a,t),[m,h]=(0,V.useState)(null),[g,_]=(0,V.useState)(i),[v,y]=(0,V.useState)(!1),[b,x]=(0,V.useState)(null),[S,C]=(0,V.useState)(null),w=(0,V.useRef)(null),T=(0,V.useRef)(null),E=(0,V.useRef)(null),D=iH(),O=KU();yc();let k=(0,V.useRef)(!0),te=(0,V.useCallback)((e=!1)=>{e||C(null),ee().then(e=>{k.current&&(x(e),C(e.skills_error??null))}).catch(e=>{F.api.warn(`New-chat start screen unavailable`,e),k.current&&C(CM(e))})},[]);(0,V.useEffect)(()=>(k.current=!0,te(),()=>{k.current=!1}),[te]),(0,V.useEffect)(()=>{o().then(e=>B.getState().setDocuments(e.documents||[])).catch(e=>F.api.warn(`Document library unavailable; not offering its documents`,e))},[]),(0,V.useEffect)(()=>{if(S)return SH(()=>te(!0),YU)},[S,te]);let ne=(0,V.useRef)(!1),A=(0,V.useRef)([]),re=(0,V.useCallback)(async(t,n=``)=>{if(t){if(ne.current)A.current.push(n||t),p(``);else{ne.current=!0,y(!0),h(null),_(!1),p(``);try{let n=await e(t);D.clear();let r=A.current.splice(0),i=B.getState().currentSessionId;if(r.length>0&&i){let e=(e,t)=>n===!1?[...e,{...ze(t,`failed`),error:`The first message was not sent.`}]:xt(e,t,`queued`);B.getState().updateQueue(i,t=>r.reduce(e,t))}}catch(e){let r=A.current.splice(0);p([n||t,...r].join(`
204
+
205
+ `)),e instanceof SO?_(!0):h(CM(e))}finally{ne.current=!1,y(!1)}}}},[D,e]),ie=(0,V.useCallback)(()=>re(D.compose(f.trim()),f.trim()),[D,re,f]);(0,V.useEffect)(()=>{n&&w.current?.focus()},[n]),(0,V.useEffect)(()=>{let e=w.current;t&&e&&(e.focus(),e.setSelectionRange(e.value.length,e.value.length))},[t]);let ae=v,j=(0,V.useRef)(null);(0,V.useLayoutEffect)(()=>{let e=T.current;if(!e)return;typeof e.getAnimations==`function`&&e.getAnimations().forEach(e=>e.cancel());let t=e.getBoundingClientRect().top,n=j.current;if(j.current={top:t,docked:ae},!n||n.docked===ae||Az()||typeof e.animate!=`function`)return;let r=getComputedStyle(document.documentElement).getPropertyValue(`--ease`).trim();if(!r)throw Error(`Motion token --ease is not set; check styles/index.css.`);e.animate([{transform:`translateY(${n.top-t}px)`},{transform:`none`}],{duration:kz(`--duration-spring`),easing:r})});let oe=(0,V.useRef)(``),se=(0,V.useCallback)(e=>{let t=oe.current,n=(t&&f.endsWith(t)?f.slice(0,-t.length):f).trimEnd();oe.current=e,p(n?`${n}\n\n${e}`:e),w.current?.focus()},[f,p]),ce=l?.state===`starting`||l?.state===`downloading`,le=v?`sending`:ce?`download`:c||O!==null?`loading`:`idle`,ue=b?.working_folder;return z(`main`,{className:`new-chat${ae?` is-docked`:``}`,"aria-label":s(`newChat.label`),children:[I(nU,{activity:le,progress:(l?.percent??0)/100,pulse:f.length,docked:ae,contentRef:T,composerRef:E}),I(`div`,{className:`new-chat-actions`,children:I(mV,{})}),z(`div`,{className:`new-chat-inner`,ref:T,children:[I(`h1`,{className:`new-chat-greeting`,"aria-hidden":ae,children:XU(new Date,s)}),u&&!d&&I(nW,{error:u}),I(`div`,{ref:E,children:I(LL,{value:f,onChange:p,onSubmit:ie,attachments:D,disabledReason:c?s(`composer.starting`):null,autoFocus:!0,inputRef:w,leftControls:z(P.Fragment,{children:[I(yR,{sessionId:null}),I(HU,{disabled:v})]}),rightControls:I(tR,{})})}),I(`div`,{className:`new-chat-meta`,children:ue&&I(pR,{folder:ue,disabled:c||v})}),I(tW,{}),O!==null&&!c&&I(`p`,{className:`new-chat-warmup`,role:`status`,children:QU(O,s)}),m&&I(`p`,{className:`new-chat-error`,role:`alert`,children:m}),g&&r&&I(`p`,{className:`new-chat-error`,role:`alert`,children:s(`agentNotice.sendRefused`)}),I(WU,{onPick:se,disabled:c||v}),S&&I($U,{detail:S,onRetry:()=>te()})]})]})}var iW=1e3,aW=15,oW=5,sW=new Map;function cW(){let e=R(),t=$s(e=>e.need),n=$s(e=>e.settle),r=(0,V.useRef)(null),i=(0,V.useRef)(null),a=(0,V.useRef)(0),o=(0,V.useRef)(0),s=(0,V.useRef)(null);s.current=t;let[c,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(null),[m,h]=(0,V.useState)(!1),g=(0,V.useCallback)(()=>{i.current&&clearInterval(i.current),i.current=null},[]);(0,V.useEffect)(()=>(l(null),d(!1),p(null),h(!1),g),[t,g]);let _=(0,V.useCallback)(()=>{g(),u&&t?.model&&Jt(t.model.id).catch(e=>console.warn(`[ModelNeededDialog] could not cancel the download`,e)),n(!1)},[u,t,n,g]);pt(!!t,_),on(r,!!t);let v=(0,V.useCallback)(async r=>{if(!t?.model)return;let c=t,u=t.model.id,f=(sW.get(u)??0)+1;sW.set(u,f),p(null),d(!0),a.current=0,o.current=0;try{await N(u,{acknowledgeLowDisk:r})}catch(e){if(s.current!==c)return;d(!1),p(e instanceof Error?e.message:String(e)),e instanceof Nt&&e.body?.code===`low_disk`&&h(!0);return}s.current===c?(g(),i.current=setInterval(()=>{et().then(t=>{if(s.current!==c){g();return}o.current=0;let r=t.models?.find(e=>e.id===u);if(r)r.bytes_total>0&&l(Math.floor(r.bytes_done*100/r.bytes_total)),r.state===`ready`||r.state===`verifying`?(g(),n(!0)):(r.state===`failed`||r.state===`cancelled`)&&(g(),d(!1),p(r.error??e(`modelNeeded.failed`)));else{if(++a.current<aW)return;g(),d(!1),p(e(`modelNeeded.failed`))}}).catch(e=>{s.current===c?++o.current<oW||(g(),d(!1),p(e instanceof Error?e.message:String(e))):g()})},iW)):sW.get(u)===f&&Jt(u).catch(e=>console.warn(`[ModelNeededDialog] could not cancel the download`,e))},[t,n,g,e]);if(t?.off)return(0,Mj.createPortal)(I(`div`,{className:`model-needed-overlay`,children:z(`div`,{ref:r,className:`model-needed`,role:`dialog`,"aria-modal":`true`,"aria-label":e(`modelNeeded.off.${t.off}.title`),children:[I(`h2`,{className:`model-needed-title`,children:e(`modelNeeded.off.${t.off}.title`)}),I(`p`,{className:`model-needed-from`,children:e(`modelNeeded.off.${t.off}.body`)}),z(`div`,{className:`model-needed-actions`,children:[I(`button`,{type:`button`,className:`btn-secondary`,onClick:_,children:e(`modelNeeded.notNow`)}),I(`button`,{type:`button`,className:`btn-primary`,onClick:()=>n(!0),children:e(`modelNeeded.off.send`)})]})]})}),document.body);if(!t?.model)return null;let{model:y,job:b,disk_free_gb:x}=t,S=y.size_gb!=null&&x!=null&&y.size_gb>x,C=S||m;return(0,Mj.createPortal)(I(`div`,{className:`model-needed-overlay`,children:z(`div`,{ref:r,className:`model-needed`,role:`dialog`,"aria-modal":`true`,"aria-label":e(`modelNeeded.dialog`),children:[I(`h2`,{className:`model-needed-title`,children:e(`modelNeeded.title.${b}`)}),z(`p`,{className:`model-needed-line`,children:[I(`bdi`,{children:y.name}),y.size_gb!=null&&z(P.Fragment,{children:[`, `,I(`bdi`,{dir:`ltr`,children:BO(y.size_gb)})]}),x!=null&&z(P.Fragment,{children:[` · `,e(`modelNeeded.free`),` `,I(`bdi`,{dir:`ltr`,children:BO(x)})]})]}),y.source&&z(`p`,{className:`model-needed-from`,children:[e(`setup.contents.from`),` `,I(`bdi`,{dir:`ltr`,children:y.source})]}),I(`p`,{className:`model-needed-from`,children:e(`modelNeeded.waits`)}),u&&(c==null?z(`p`,{role:`status`,children:[I(La,{size:13,className:`spin`,"aria-hidden":`true`}),` `,e(`modelNeeded.starting`)]}):I(`progress`,{className:`setup-progress`,max:100,value:c,"aria-label":e(`modelNeeded.dialog`)})),S&&!u&&I(`p`,{className:`setup-error`,role:`alert`,children:e(`modelNeeded.lowDisk`,{need:BO(y.size_gb??0),free:BO(x??0),freeUp:BO((y.size_gb??0)-(x??0))})}),f&&I(`p`,{className:`setup-error`,role:`alert`,children:f}),z(`div`,{className:`model-needed-actions`,children:[I(`button`,{type:`button`,className:`btn-secondary`,onClick:_,children:e(`modelNeeded.notNow`)}),I(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void v(C),disabled:u,children:e(C?`setup.confirm.downloadAnyway`:f?`setup.tryAgain`:`modelNeeded.download`)})]})]})}),document.body)}function lW(e,t,n){let r=(0,V.useRef)(n);(0,V.useEffect)(()=>{r.current=n});let i=(0,V.useRef)(!1),a=(0,V.useRef)(null);if(t&&!i.current){let e=document.activeElement;a.current=e instanceof HTMLElement?e:null}(0,V.useEffect)(()=>{if(!t)return;i.current=!0;let n=a.current,o=e.current;if(o&&!o.contains(document.activeElement)){let e=r.current?.()??jn(o)[0];e?e.focus():(o.hasAttribute(`tabindex`)||o.setAttribute(`tabindex`,`-1`),o.focus())}return()=>{i.current=!1;let e=document.activeElement;(!e||e===document.body||o?.contains(e))&&n?.isConnected&&n.focus()}},[e,t])}var uW=2e3,dW=`⁦`,fW=`⁩`,pW={model_server:`logs.source.modelServer`,gaia:`logs.source.gaia`,service:`logs.source.service`,agent:`logs.source.agent`,desktop:`logs.source.desktop`,other:`logs.source.other`},mW={model_server:`logs.hint.modelServer`,gaia:`logs.hint.gaia`,service:`logs.hint.service`,agent:`logs.hint.agent`,desktop:`logs.hint.desktop`,other:`logs.hint.other`},hW={no_file:`logs.reason.noFile`,unreadable:`logs.reason.unreadable`,not_running:`logs.reason.notRunning`,remote:`logs.reason.remote`,no_stream:`logs.reason.noStream`,stream_failed:`logs.reason.streamFailed`},gW=e=>e.severity===`warning`||e.severity===`error`;function _W(e){return e instanceof Error?e.message:String(e)}function vW(e){let t=e=>String(e).padStart(2,`0`);return`${e.getFullYear()}${t(e.getMonth()+1)}${t(e.getDate())}-${t(e.getHours())}${t(e.getMinutes())}${t(e.getSeconds())}`}function yW({source:e,file:t}){let n=R(),[r,i]=(0,V.useState)(null),[a,o]=(0,V.useState)([]),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(!0),[d,f]=(0,V.useState)(!0),[p,m]=(0,V.useState)(!1),[h,g]=(0,V.useState)(null),_=(0,V.useRef)(null),v=(0,V.useRef)(!1),y=(0,V.useRef)(null),b=(0,V.useRef)(!0),x=(0,V.useRef)(null),S=(0,V.useCallback)(async n=>{if(!v.current){v.current=!0,n&&u(!0);try{let r=await D(e,{file:t,after:n?null:_.current});r.cursor&&(_.current=r.cursor);let a=r.lines??[],s=n||!!r.reset;o(e=>(s?a:[...e,...a]).slice(-5e3)),i(e=>s||!e?r:{...r,server_answering:r.server_answering??e.server_answering,dropped:e.dropped}),c(null)}catch(e){c(_W(e))}finally{v.current=!1,u(!1)}}},[e,t]);(0,V.useEffect)(()=>{_.current=null,b.current=!0,i(null),o([]),g(null),S(!0)},[S]),(0,V.useEffect)(()=>{if(!d)return;let e=setInterval(()=>{S(!1)},uW);return()=>clearInterval(e)},[d,S]);let C=p?a.filter(gW):a,w=C.map(e=>e.text).join(`
206
+ `),T=(0,V.useCallback)(()=>{let e=y.current;e&&b.current&&(e.scrollTop=e.scrollHeight,x.current=e.scrollTop)},[]);(0,V.useEffect)(T,[w,T]);let E=C.length>0;(0,V.useEffect)(()=>{let e=y.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(T);return t.observe(e),e.firstElementChild&&t.observe(e.firstElementChild),()=>t.disconnect()},[E,T]);let O=(0,V.useCallback)(async()=>{try{await navigator.clipboard.writeText(w),g({ok:!0,text:n(`logs.copied`)})}catch(e){g({ok:!1,text:n(`logs.copyFailed`,{error:_W(e)})})}},[n,w]),k=(0,V.useCallback)(()=>{let t=URL.createObjectURL(new Blob([`${w}\n`],{type:`text/plain;charset=utf-8`})),n=document.createElement(`a`);n.href=t,n.download=`gaia-${e.replace(`_`,`-`)}-log-${vW(new Date)}.txt`,n.click(),setTimeout(()=>URL.revokeObjectURL(t),6e4),g(null)},[e,w]),ee=e===`model_server`,te=r&&!r.available&&r.reason?!ee&&r.reason===`no_file`?`logs.reason.notWritten`:hW[r.reason]:void 0;return z(`div`,{className:`log-viewer-view`,children:[I(`p`,{className:`log-viewer-hint`,children:n(mW[e])}),r?.source===`file`&&r.log_path&&z(`p`,{className:`log-viewer-source`,children:[n(`logs.fromFile`),` `,I(`bdi`,{dir:`ltr`,children:r.log_path})]}),r?.source===`stream`&&z(`p`,{className:`log-viewer-source`,children:[n(`logs.fromStream`),` `,I(`bdi`,{dir:`ltr`,children:r.base_url})]}),ee&&r?.source===`file`&&r.server_answering===!1&&I(`p`,{className:`log-viewer-warning`,role:`alert`,children:n(`logs.notAnswering`)}),te&&z(`div`,{className:`log-viewer-warning`,role:`alert`,children:[I(`p`,{children:n(te)}),r?.detail&&I(`p`,{className:`log-viewer-detail`,children:I(`bdi`,{dir:`ltr`,children:r.detail})})]}),r?.available&&r.detail&&I(`p`,{className:`log-viewer-hint`,role:`note`,children:I(`bdi`,{dir:`ltr`,children:r.detail})}),s&&I(`p`,{className:`log-viewer-warning`,role:`alert`,children:n(`logs.readFailed`,{error:s})}),z(`div`,{className:`log-viewer-toolbar`,children:[z(`label`,{className:`log-viewer-check`,children:[I(`input`,{type:`checkbox`,checked:d,onChange:e=>f(e.target.checked)}),n(`logs.follow`)]}),z(`label`,{className:`log-viewer-check`,children:[I(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked)}),n(`logs.problemsOnly`)]}),z(`div`,{className:`log-viewer-actions`,children:[z(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void S(!0),disabled:l,children:[l?I(La,{size:13,className:`spin`,"aria-hidden":`true`}):I(Bo,{size:13,"aria-hidden":`true`}),n(`logs.refresh`)]}),z(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void O(),disabled:!w,children:[h?.ok?I(Vr,{size:13,"aria-hidden":`true`}):I(hi,{size:13,"aria-hidden":`true`}),n(`logs.copy`)]}),z(`button`,{type:`button`,className:`btn-secondary`,onClick:k,disabled:!w,children:[I(zi,{size:13,"aria-hidden":`true`}),n(`logs.save`)]})]})]}),l&&!r?z(`p`,{className:`log-viewer-empty`,role:`status`,children:[I(La,{size:13,className:`spin`,"aria-hidden":`true`}),` `,n(`logs.loading`)]}):r?.available&&C.length===0?I(`p`,{className:`log-viewer-empty`,role:`status`,children:p&&a.length>0?n(`logs.noProblems`):n(`logs.empty`)}):C.length>0&&I(`pre`,{ref:y,className:`log-viewer-lines`,dir:`ltr`,tabIndex:0,"aria-label":n(pW[e]),onScroll:e=>{let t=e.currentTarget;t.scrollTop!==x.current&&(x.current=null,b.current=t.scrollHeight-t.scrollTop-t.clientHeight<8)},children:I(`span`,{className:`log-viewer-body`,children:C.map((e,t)=>z(`span`,{className:e.severity?`is-${e.severity}`:void 0,children:[e.text,`
207
+ `]},t))})}),(r?.dropped??0)>0&&I(`p`,{className:`log-viewer-hint`,children:n(`logs.older`)}),h&&I(`p`,{className:h.ok?`settings-ok`:`log-viewer-warning`,role:h.ok?`status`:`alert`,children:h.text})]})}function bW(){let e=R(),[t,n]=(0,V.useState)(!1),[r,i]=(0,V.useState)(null),[a,o]=(0,V.useState)(null),s=(0,V.useCallback)(async()=>{n(!0),o(null),i(null);try{let e=await E(),t=await Le(e.name),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=e.name,r.click(),setTimeout(()=>URL.revokeObjectURL(n),6e4),i(e)}catch(t){o(e(`logs.saveAllFailed`,{error:_W(t)}))}finally{n(!1)}},[e]);return z(`div`,{className:`log-viewer-save-all`,children:[z(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void s(),disabled:t,children:[t?I(La,{size:13,className:`spin`,"aria-hidden":`true`}):I(lr,{size:13,"aria-hidden":`true`}),e(`logs.saveAll`)]}),I(`span`,{className:`log-viewer-hint`,children:e(`setup.logs.reportNote`)}),r&&z(`p`,{className:`log-viewer-hint`,role:`status`,children:[e(`logs.savedAll`,{size:WO(r.size_bytes)}),` `,I(`bdi`,{dir:`ltr`,children:r.path})]}),a&&I(`p`,{className:`log-viewer-warning`,role:`alert`,children:a})]})}function xW(){let e=R(),t=qs(e=>e.open),n=qs(e=>e.source),r=qs(e=>e.show),i=qs(e=>e.hide),a=(0,V.useRef)(null),o=(0,V.useRef)(null),[s,c]=(0,V.useState)({}),[l,u]=(0,V.useState)(null);if(pt(t,i),on(a,t),lW(a,t,()=>o.current),(0,V.useEffect)(()=>{t&&oe().then(e=>c(Object.fromEntries(e.sources.map(e=>[e.id,e.files??[]])))).catch(e=>console.warn(`[LogsDialog] could not list log files`,e))},[t]),(0,V.useEffect)(()=>{u(null)},[n]),!t)return null;let d=s[n]??[];return(0,Mj.createPortal)(I(`div`,{className:`log-viewer-overlay`,onMouseDown:e=>{e.target===e.currentTarget&&i()},children:z(`div`,{ref:a,className:`log-viewer`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`log-viewer-title`,children:[z(`div`,{className:`log-viewer-head`,children:[I(`h2`,{id:`log-viewer-title`,className:`log-viewer-title`,children:e(`logs.title`)}),I(`button`,{ref:o,type:`button`,className:`log-viewer-close`,onClick:i,"aria-label":e(`logs.close`),title:e(`logs.close`),children:I(Is,{size:16,"aria-hidden":`true`})})]}),I(`div`,{className:`log-viewer-tabs`,role:`tablist`,"aria-label":e(`logs.title`),children:Ks.map(t=>I(`button`,{type:`button`,role:`tab`,"aria-selected":t===n,className:t===n?`is-active`:``,onClick:()=>r(t),children:t===`gaia`?I(`bdi`,{children:e(pW[t])}):e(pW[t])},t))}),d.length>1&&z(`label`,{className:`log-viewer-file`,children:[e(`logs.file`),I(`select`,{dir:`ltr`,value:l??d[0].name,onChange:e=>u(e.target.value),children:d.map(e=>z(`option`,{value:e.name,children:[e.name,e.size_bytes==null?``:` (${dW}${SL(e.size_bytes)}${fW})`]},e.name))})]}),I(`div`,{role:`tabpanel`,className:`log-viewer-panel`,children:I(yW,{source:n,file:l},`${n}:${l??``}`)}),I(`p`,{className:`log-viewer-hint`,children:e(`logs.privacy`)}),I(bW,{})]})}),document.body)}var SW=[{label:`shortcuts.newChat`,keys:`Mod+Shift+O`},{label:`shortcuts.search`,keys:`Mod+K`},{label:`shortcuts.sidebar`,keys:`Mod+B`},{label:`shortcuts.settings`,keys:`Mod+,`},{label:`shortcuts.sheet`,keys:`Mod+/`},{label:`shortcuts.browserPane`,keys:`Mod+Shift+B`,desktopOnly:!0},{label:`shortcuts.send`,keys:`Enter`},{label:`shortcuts.newLine`,keys:`Shift+Enter`},{label:`shortcuts.editLast`,keys:`↑`},{label:`shortcuts.stop`,keys:`Esc`}];function CW(){let e=!!wB();return SW.filter(t=>e||!t.desktopOnly)}function wW({onClose:e}){let t=R(),n=(0,V.useRef)(null);return pt(!0,e),on(n,!0),lW(n,!0),I(`div`,{ref:n,className:`modal-overlay`,onClick:e,role:`dialog`,"aria-modal":`true`,"aria-label":t(`shortcuts.title`),children:z(`div`,{className:`modal-panel shortcuts-dialog`,onClick:e=>e.stopPropagation(),children:[z(`div`,{className:`modal-header`,children:[I(`h3`,{children:t(`shortcuts.title`)}),I(`button`,{type:`button`,className:`btn-icon`,onClick:e,"aria-label":t(`shortcuts.close`),children:I(Is,{size:18,"aria-hidden":`true`})})]}),I(`dl`,{className:`modal-body shortcuts-list`,children:CW().map(({label:e,keys:n})=>z(`div`,{className:`shortcuts-row`,children:[I(`dt`,{children:t(e)}),I(`dd`,{children:I(`kbd`,{dir:`ltr`,children:Yl(n)})})]},e))})]})})}function TW(e){let t=e?.reason;return t===`needs_key`||t===`bad_key`}function EW({provider:e,limit:t,picked:n=null,onPick:r,pickDisabled:i=!1,onDefault:a}){let o=R(),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(null),d=(0,V.useRef)(a);if(d.current=a,(0,V.useEffect)(()=>{let t=!0;return c(null),u(null),d.current?.(null),Ee(e).then(e=>{t&&(c(e),d.current?.(e.models[0]?.model??null))}).catch(e=>{t&&u(e instanceof Error?e.message:String(e))}),()=>{t=!1}},[e]),l)return I(`p`,{className:`settings-error`,role:`alert`,children:o(`settings.price.loadFailed`,{reason:l})});if(!s)return z(`p`,{className:`settings-hint`,children:[I(La,{size:13,className:`spin`}),` `,o(`settings.price.loading`)]});if(s.models.length===0)return z(`p`,{className:`settings-hint cloud-prices-note`,children:[o(`settings.price.unknownSentence`),` `,I(`bdi`,{children:s.note})]});let f=t?s.models.slice(0,t):s.models,p=n?s.models.find(e=>e.model===n&&!f.includes(e)):void 0,m=p?[...f,p]:f,h=n??m[0]?.model,g=r!==void 0;return z(`div`,{className:`cloud-prices`,"aria-label":o(`settings.model.prices`),children:[g&&I(`p`,{className:`cloud-prices-legend`,id:`cloud-prices-legend`,children:o(`settings.price.pickLegend`)}),I(`ul`,{className:`cloud-prices-list${g?` is-pickable`:``}`,role:g?`radiogroup`:void 0,"aria-labelledby":g?`cloud-prices-legend`:void 0,children:m.map((t,n)=>{let a=z(`span`,{className:`cloud-prices-name`,children:[I(`bdi`,{children:t.name}),n===0&&g&&z(`span`,{className:`cloud-prices-default`,children:[` · `,o(`settings.price.default`)]}),t.note&&z(`span`,{className:`cloud-prices-note`,children:[` · `,I(`bdi`,{children:t.note})]})]});return z(`li`,{className:g&&h===t.model?`is-chosen`:void 0,children:[g?z(`label`,{className:`cloud-prices-pick`,children:[I(`input`,{type:`radio`,name:`cloud-model-${e}`,value:t.model,checked:h===t.model,disabled:i,onChange:()=>r(t.model)}),a]}):a,I(`span`,{className:`cloud-prices-price`,children:HL(t.price,o)})]},t.model)})}),z(`span`,{className:`settings-hint`,children:[I(`bdi`,{children:s.source}),`. `,o(`settings.price.payProvider`)]})]})}function DW(){return au(Oz)}function OW(e,t=150){let n=DW(),[r,i]=(0,V.useState)(e),a=(0,V.useRef)(e);return(0,V.useEffect)(()=>{if(n||typeof requestAnimationFrame!=`function`){a.current=e,i(e);return}let r=a.current,o=performance.now(),s=0,c=n=>{let l=Math.min(1,(n-o)/t),u=1-(1-l)**3,d=r+(e-r)*u;a.current=d,i(d),l<1&&(s=requestAnimationFrame(c))};return s=requestAnimationFrame(c),()=>cancelAnimationFrame(s)},[e,t,n]),r}function kW(e,t){let[n,r]=(0,V.useState)(e);return(0,V.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function AW(){let[e,t]=(0,V.useState)(()=>typeof document>`u`||document.visibilityState!==`hidden`);return(0,V.useEffect)(()=>{let e=()=>t(document.visibilityState!==`hidden`);return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e}var jW=180;function MW({open:e,children:t}){let[n,r]=(0,V.useState)(e),[i,a]=(0,V.useState)(e),o=(0,V.useRef)(t);return e&&(o.current=t),(0,V.useEffect)(()=>{if(e){r(!0);let e=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(e)}a(!1);let t=setTimeout(()=>r(!1),jW);return()=>clearTimeout(t)},[e]),n?I(`div`,{className:`reveal${i?` is-open`:``}`,"aria-hidden":!e||void 0,children:I(`div`,{className:`reveal-inner`,children:e?t:o.current})}):null}var NW=e=>e?.catalog??[],PW=e=>e.roles.includes(`vision`),FW=e=>e.roles.includes(`embedding`),IW=e=>e.recipe===`flm`,LW=e=>e.fits===!1&&(e.fit_code===`npu`||e.fit_code===`backend`),RW=e=>e.support===null,zW=e=>e?.feature_tier!==`compact`;function BW(e,t){let n=e.find(e=>e.id===t.defaultChat);return n&&IW(n)||t.vision===`none`?null:t.vision?t.vision:n?.reads_images?n.id:e.find(e=>PW(e)&&e.gaia_model)?.id??null}function VW(e,t){let n=BW(t,e),r=new Set(e.ticked),i=new Set(e.unticked);for(let a of t)PW(a)&&a.id!==e.defaultChat&&(a.id===n?(r.add(a.id),i.delete(a.id)):a.downloaded||(r.delete(a.id),i.add(a.id)));return{...e,ticked:r,unticked:i}}function HW(e,t,n){let r=new Set(e.ticked),i=t.find(t=>t.id===e.defaultChat);i&&!i.downloaded&&r.delete(i.id);let a=t.find(e=>e.id===n);if(a?.downloaded||r.add(n),!zW(a))for(let e of t)e.roles.includes(`image_creation`)&&r.delete(e.id);return VW({...e,ticked:r,defaultChat:n,chatChosen:!0,vision:null},t)}function UW(e,t,n){return VW({...e,vision:n},t)}function WW(e,t){if(t.vision===`none`)return null;let n=BW(e,t),r=e.find(e=>e.id===t.defaultChat);return r&&IW(r)||n===(r?.reads_images?r.id:e.find(e=>PW(e)&&e.gaia_model)?.id)?null:n}function GW(e){return e.filter(e=>e.gaia_model&&(e.planned||e.recommended||e.downloaded||e.partial))}function KW(e){let t=new Set(GW(e).map(e=>e.id));return e.filter(e=>e.gaia_model&&!t.has(e.id))}function qW(e){return e.filter(e=>!e.gaia_model&&e.downloaded)}function JW(e){let t=NW(e),n=new Set(t.filter(e=>e.selected||e.gaia_model&&e.downloaded&&!e.skipped).map(e=>e.id)),r=!t.find(t=>t.id===e.chat_model.id)?.reads_images&&t.some(e=>PW(e)&&e.gaia_model&&e.skipped);return VW({ticked:n,defaultChat:e.chat_model.id,unticked:new Set,chatChosen:e.chat_model.user_set,vision:e.vision_model??(r?`none`:null)},t)}function YW(e,t){return e.filter(e=>e.chat_choice&&(t.has(e.id)||e.downloaded))}function XW(e,t,n,r){let i=new Set(e.ticked),a=new Set(e.unticked);r?(i.add(n),a.delete(n)):(i.delete(n),a.add(n));let o=YW(t,i),s=e.defaultChat;if(!s||!o.some(e=>e.id===s)){let e=t.find(e=>e.id===n);s=r&&e?.chat_choice?n:(o.find(e=>e.recommended)??o[0])?.id??null}return{...e,ticked:i,defaultChat:s,unticked:a}}function ZW(e,t,n){let r=t.find(e=>e.id===n)?.downloaded;return{...e,defaultChat:n,chatChosen:!0,ticked:r?e.ticked:new Set([...e.ticked,n])}}function QW(e){let t=NW(e),n=new Set(t.filter(e=>e.recommended||e.gaia_model&&e.downloaded).map(e=>e.id)),r=YW(t,n);return VW({ticked:n,defaultChat:e.recommended_model&&r.some(t=>t.id===e.recommended_model)?e.recommended_model:(r.find(e=>e.recommended)??r[0])?.id??null,unticked:new Set,chatChosen:!1,vision:null},t)}function $W(e,t){return e.filter(e=>t.ticked.has(e.id)&&!e.downloaded).sort((e,t)=>(t.size_gb??0)-(e.size_gb??0))}function eG(e,t){let n=$W(NW(e),t).map(e=>e.size_gb),r=n.every(e=>e!=null)?oG(n.reduce((e,t)=>e+t,0)):null,i=e.disk?.free_gb??null;return{downloadGb:r,freeGb:i,afterGb:r!=null&&i!=null?oG(i-r):null}}function tG(e,t){let{downloadGb:n,freeGb:r}=eG(e,t);return n==null||r==null||n<=r?null:{needGb:n,freeGb:r,freeUpGb:oG(n-r),drop:$W(NW(e),t).find(e=>e.size_gb!=null&&n-e.size_gb<=r)??null}}function nG(e,t){return e.filter(e=>e.fits===!1&&(t.ticked.has(e.id)||e.id===t.defaultChat))}function rG(e,t){let n=[];for(let r of NW(e)){if(!r.planned){r.skipped&&t.ticked.has(r.id)&&n.push({id:r.id,skipped:!1});continue}if(r.id===e.chat_model.id){r.skipped&&n.push({id:r.id,skipped:!1});continue}let i=t.ticked.has(r.id);!i&&!r.skipped&&n.push({id:r.id,skipped:!0}),i&&r.skipped&&n.push({id:r.id,skipped:!1})}return n}function iG(e,t){return NW(e).filter(e=>t.ticked.has(e.id)&&!e.planned&&!e.downloaded).map(e=>e.id)}function aG(e,t){let n=(e.models??[]).filter(e=>e.state!==`skipped`);if(!t?.catalog||n.length===0)return e.overall;let r=0,i=0;for(let e of n){let n=t.catalog.find(t=>t.id===e.id),a=n?.downloaded?0:n?.size_gb==null?e.bytes_total:Math.min(e.bytes_total||1/0,n.size_gb*1e9),o=Math.max(0,e.bytes_total-a);i+=a,r+=e.state===`ready`||e.state===`verifying`?a:Math.min(a,Math.max(0,e.bytes_done-o))}return{bytes_done:r,bytes_total:i,speed_bps:e.overall?.speed_bps??0,eta_s:null,percent:i>0?Math.floor(r*100/i):100,failed:n.filter(e=>e.state===`failed`).length}}function oG(e){return Math.round(e*10)/10}var sG=6;function cG(e,t){let n=[];return e.chat_choice&&!FW(e)&&n.push(t(`setup.models.purpose.chat`)),PW(e)&&n.push(t(`setup.models.purpose.vision`)),FW(e)&&n.push(t(`setup.models.purpose.documents`)),e.roles.includes(`speech`)&&n.push(t(`setup.models.purpose.speech`)),e.roles.includes(`voice`)&&n.push(t(`setup.models.purpose.voice`)),e.roles.includes(`image_creation`)&&n.push(t(`setup.models.purpose.imageCreation`)),n}function lG(e,t){return FW(e)?t(`setup.models.line.documents`):PW(e)?t(`setup.models.line.vision`):e.roles.includes(`speech`)?t(`setup.models.line.speech`):e.roles.includes(`voice`)?t(`setup.models.line.voice`):e.roles.includes(`image_creation`)?t(`setup.models.line.imageCreation`):t(`setup.models.line.chat`)}function uG(e,t){return e.downloaded?t(`setup.models.status.onPc`):e.size_gb==null?t(`setup.models.status.sizeUnknown`):e.partial?t(`setup.models.status.partial`,{size:BO(e.size_gb)}):t(`setup.models.status.download`,{size:BO(e.size_gb)})}function dG(e,t){return e.fits!==!0||e.need_gb==null||e.capacity_gb==null?null:t(`setup.models.fit.ok`,{need:UO(e.need_gb),have:UO(e.capacity_gb)})}function fG(e,t){return e.fit_code===`npu`?t(`setup.models.warn.npu`):e.fit_code===`backend`?t(`setup.models.warn.backend`):e.need_gb!=null&&e.capacity_gb!=null?t(`setup.models.warn.tooBig`,{need:UO(e.need_gb),have:UO(e.capacity_gb)}):t(`setup.models.warn.tooBigNoNumbers`)}function pG(e,t,n,r){return!PW(e)&&!FW(e)||PW(e)&&!e.downloaded&&r?null:n===`settings`?e.downloaded?t(`settings.models.warn.kept`,{name:e.name}):t(PW(e)?`settings.models.warn.vision`:`settings.models.warn.documents`,{name:e.name}):t(PW(e)?`setup.models.warn.vision`:`setup.models.warn.documents`,{name:e.name})}function mG({entry:e,ticked:t,onToggle:n,disabled:r,progress:i,actions:a,place:o,imagesCovered:s}){let c=R(),l=(0,V.useId)(),u=e.fits===!1,d=t?null:pG(e,c,o,s),f=i?.state===`downloading`&&i.bytes_total>0,p=u?fG(e,c):d,m=[`${l}-status`,`${l}-note`,p?`${l}-warn`:null].filter(Boolean).join(` `);return z(`li`,{className:`mc-row${t?` is-ticked`:``}${p?` has-warning`:``}`,children:[z(`div`,{className:`mc-row-top`,children:[z(`label`,{className:`mc-row-main`,children:[I(`input`,{type:`checkbox`,className:`mc-input`,checked:t,disabled:r,onChange:e=>n(e.target.checked),"aria-describedby":m}),I(`span`,{className:`mc-box`,"aria-hidden":`true`,children:I(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,children:I(`path`,{className:`mc-tick`,d:`M3.5 8.5l3 3 6-7`})})}),z(`span`,{className:`mc-text`,children:[z(`span`,{className:`mc-name-line`,children:[I(`bdi`,{className:`mc-name`,title:e.id,children:e.name}),z(`span`,{className:`mc-chips`,children:[cG(e,c).map(e=>I(`span`,{className:`mc-chip`,children:e},e)),IW(e)&&I(`span`,{className:`mc-chip is-npu`,children:c(`setup.models.npu`)})]})]}),z(`span`,{className:`mc-status`,id:`${l}-status`,children:[f?c(`setup.models.status.downloading`,{done:WO(i.bytes_done),total:WO(i.bytes_total)}):uG(e,c),e.recommended&&I(`span`,{className:`mc-pill`,children:c(`setup.models.recommended`)}),e.fits===null&&z(`span`,{className:`mc-chip is-unknown`,children:[I(ai,{size:11,"aria-hidden":`true`}),` `,c(`setup.models.fitUnknown`)]})]}),I(`span`,{className:`mc-note`,id:`${l}-note`,children:c.compose(t=>[lG(e,t),dG(e,t),e.fits===null?t(`setup.models.fit.unknown`):null].filter(Boolean).join(` `))})]})]}),a&&I(`span`,{className:`mc-actions`,children:a})]}),f&&I(`progress`,{className:`mc-mini-progress`,max:i.bytes_total,value:i.bytes_done,"aria-label":c(`setup.progress.rowLabel`,{name:e.name,state:c(`setup.state.downloading`)})}),I(MW,{open:!!p,children:z(`p`,{className:`mc-warn${u?` is-big`:``}`,role:`note`,id:`${l}-warn`,children:[I(ws,{size:13,"aria-hidden":`true`}),I(`span`,{children:p})]})})]})}function hG({plan:e,selection:t}){let n=R(),{downloadGb:r,freeGb:i,afterGb:a}=eG(e,t),o=tG(e,t),s=OW(r??0),c=OW(a??0),l=gG(e.disk?.path??null),u=r!=null&&i?Math.min(1,r/i):0,d=kW(r==null?n(`setup.summary.spokenUnknown`):a==null?n(`setup.summary.spokenNoDisk`,{download:BO(r)}):n(`setup.summary.spoken`,{download:BO(r),after:BO(Math.max(0,a))}),600);return z(`div`,{className:`mc-summary${o?` is-warn`:``}`,role:`group`,"aria-label":n(`setup.summary.label`),children:[z(`div`,{className:`mc-summary-stats`,children:[z(`span`,{className:`mc-stat`,children:[I(`span`,{className:`mc-stat-label`,children:n(`setup.summary.download`)}),I(`bdi`,{className:`mc-stat-value`,children:r==null?n(`setup.summary.sizeUnknown`):BO(_G(s))})]}),z(`span`,{className:`mc-stat`,children:[z(`span`,{className:`mc-stat-label`,children:[I(ha,{size:12,"aria-hidden":`true`}),` `,l?z(P.Fragment,{children:[n(`setup.summary.freeOn`),` `,I(`bdi`,{dir:`ltr`,className:`mc-stat-path`,children:l})]}):n(`setup.summary.free`)]}),I(`bdi`,{className:`mc-stat-value`,children:i==null?n(`setup.summary.freeUnknown`):BO(i)})]}),a!=null&&!o&&z(`span`,{className:`mc-stat`,children:[I(`span`,{className:`mc-stat-label`,children:n(`setup.summary.after`)}),I(`bdi`,{className:`mc-stat-value`,children:BO(Math.max(0,_G(c)))})]})]}),i!=null&&I(`div`,{className:`mc-disk`,"aria-hidden":`true`,children:I(`span`,{className:`mc-disk-fill`,style:{inlineSize:`${(u*100).toFixed(1)}%`}})}),I(MW,{open:!!o,children:o&&z(`p`,{className:`mc-disk-warn`,role:`note`,children:[I(ws,{size:13,"aria-hidden":`true`}),I(`span`,{children:o.drop?n(`setup.summary.shortDrop`,{need:BO(o.needGb),free:BO(o.freeGb),drive:l??n(`setup.summary.theDrive`),freeUp:BO(o.freeUpGb),name:o.drop.name,saves:BO(o.drop.size_gb??0)}):n(`setup.summary.short`,{need:BO(o.needGb),free:BO(o.freeGb),drive:l??n(`setup.summary.theDrive`),freeUp:BO(o.freeUpGb)})})]})}),I(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:d})]})}function gG(e){if(!e)return null;let t=/^([A-Za-z]:)[\\/]/.exec(e);return t?t[1]:e}function _G(e){return Math.round(e*10)/10}function vG({plan:e,selection:t,onToggle:n,onDefaultChat:r,labelledBy:i,cloud:a,disabled:o,progress:s,rowActions:c,place:l=`setup`}){let u=R(),d=NW(e),[f,p]=(0,V.useState)(``),m=(0,V.useId)(),h=a?d.filter(FW):GW(d),g=a?[]:KW(d),_=a?[]:qW(d),v=(0,V.useMemo)(()=>{let e=f.trim().toLowerCase();return e?_.filter(t=>t.id.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)):_},[_,f]),y=YW(d,t.ticked),b=e=>I(mG,{entry:e,ticked:t.ticked.has(e.id),onToggle:t=>n(e.id,t),disabled:o,progress:s?.[e.id],actions:c?.(e),place:l,imagesCovered:d.some(n=>n.id!==e.id&&PW(n)&&(t.ticked.has(n.id)||n.downloaded===!0))},e.id);return z(`div`,{className:`mc`,children:[I(`ul`,{className:`mc-list`,role:`group`,"aria-labelledby":i,children:h.map(b)}),a?I(`p`,{className:`setup-hint`,children:u(`setup.models.cloudNote`)}):I(`p`,{className:`mc-foot`,children:u(`setup.models.neverDeletes`)}),g.length>0&&z(`details`,{className:`mc-more`,children:[I(`summary`,{children:u(`setup.models.more`,{n:String(g.length)})}),I(`ul`,{className:`mc-list`,role:`group`,"aria-label":u(`setup.models.moreLabel`),children:g.map(b)})]}),_.length>0&&z(`details`,{className:`mc-more`,children:[I(`summary`,{children:u(`setup.models.installed`,{n:String(_.length)})}),_.length>sG&&I(`input`,{className:`settings-input mc-search`,type:`search`,value:f,onChange:e=>p(e.target.value),placeholder:u(`setup.models.search`),"aria-label":u(`setup.models.search`)}),I(`ul`,{className:`mc-list`,role:`radiogroup`,"aria-label":u(`setup.models.installedLabel`),children:v.map(e=>I(`li`,{className:`mc-row is-installed${t.defaultChat===e.id?` is-ticked`:``}`,children:z(`label`,{className:`mc-row-main`,children:[I(`input`,{type:`radio`,name:`${m}-installed`,className:`mc-radio`,checked:t.defaultChat===e.id,disabled:o,onChange:()=>r(e.id)}),z(`span`,{className:`mc-text`,children:[z(`span`,{className:`mc-name-line`,children:[I(`bdi`,{className:`mc-name`,title:e.id,children:e.name}),z(`span`,{className:`mc-chips`,children:[I(`span`,{className:`mc-chip`,children:u(`setup.models.purpose.chat`)}),IW(e)&&I(`span`,{className:`mc-chip is-npu`,children:u(`setup.models.npu`)})]})]}),z(`span`,{className:`mc-status`,children:[u(`setup.models.status.onPc`),` · `,u(`setup.models.useAsDefault`)]})]})]})},e.id))})]}),!a&&z(`div`,{className:`mc-default`,children:[I(`label`,{htmlFor:m,className:`mc-default-label`,children:u(`setup.models.defaultChat`)}),z(`select`,{id:m,className:`settings-input mc-select`,value:t.defaultChat??``,disabled:o||y.length===0,onChange:e=>r(e.target.value),children:[y.length===0&&I(`option`,{value:``,children:u.bare(`setup.models.noChat`)}),y.map(e=>z(`option`,{value:e.id,children:[e.name,IW(e)?` (${u(`setup.models.npu`)})`:``]},e.id))]})]})]})}function yG(){let e=R();return z(`div`,{className:`mc`,"aria-busy":`true`,children:[z(`p`,{className:`setup-hint`,role:`status`,children:[I(La,{size:13,className:`spin`,"aria-hidden":`true`}),` `,e(`setup.models.loading`)]}),I(`ul`,{className:`mc-list`,"aria-hidden":`true`,children:[0,1,2].map(e=>I(`li`,{className:`mc-row is-skeleton`,children:I(`span`,{className:`mc-skeleton`})},e))})]})}function bG({entry:e}){let t=R();return e.support===`verified`?I(`span`,{className:`mc-chip is-verified`,children:t(`setup.label.verified`)}):e.support===`untested`?I(`span`,{className:`mc-chip is-untested`,children:t(`setup.label.untested`)}):null}function xG({name:e,entry:t,checked:n,recommended:r,disabled:i,onPick:a,children:o}){let s=R();return I(`li`,{className:`mc-row${n?` is-ticked`:``}`,children:z(`label`,{className:`mc-row-main`,children:[I(`input`,{type:`radio`,className:`mc-radio`,name:e,checked:n,disabled:i||LW(t),onChange:a}),z(`span`,{className:`mc-text`,children:[z(`span`,{className:`mc-name-line`,children:[I(`span`,{className:`mc-name`,title:t.id,children:I(`bdi`,{children:t.name})}),z(`span`,{className:`mc-chips`,children:[r&&I(`span`,{className:`mc-pill`,children:s(`setup.models.recommended`)}),I(bG,{entry:t}),IW(t)&&I(`bdi`,{className:`mc-chip is-npu`,children:s(`setup.models.npu`)})]})]}),I(`span`,{className:`mc-status`,children:uG(t,s)}),t.fits===!1&&z(`span`,{className:`mc-warn is-big`,role:`note`,children:[I(ws,{size:13,"aria-hidden":`true`}),` `,fG(t,s)]}),o]})]})})}function SG({label:e,note:t,size:n,checked:r,disabled:i,warning:a,chips:o,onChange:s}){return I(`li`,{className:`mc-row${r?` is-ticked`:``}${i?` is-off`:``}`,children:z(`label`,{className:`mc-row-main`,children:[I(`input`,{type:`checkbox`,className:`mc-input`,checked:r,disabled:i,onChange:e=>s(e.target.checked)}),I(`span`,{className:`mc-box`,"aria-hidden":`true`,children:I(`svg`,{viewBox:`0 0 16 16`,width:`14`,height:`14`,children:I(`path`,{className:`mc-tick`,d:`M3.5 8.5l3 3 6-7`})})}),z(`span`,{className:`mc-text`,children:[z(`span`,{className:`mc-name-line`,children:[I(`span`,{className:`mc-name`,children:I(`bdi`,{children:e})}),I(`span`,{className:`mc-chips`,children:o})]}),I(`span`,{className:`mc-status`,children:I(`bdi`,{dir:`ltr`,children:n})}),I(`span`,{className:`mc-note`,children:t}),a&&z(`span`,{className:`mc-warn`,role:`note`,children:[I(ws,{size:13,"aria-hidden":`true`}),` `,a]})]})]})})}function CG({plan:e,selection:t,onSelection:n,disabled:r}){let i=R(),a=(0,V.useId)(),o=NW(e),[s,c]=(0,V.useState)(!1),l=o.find(e=>e.id===t.defaultChat),u=!!l&&IW(l),d=o.filter(e=>e.chat_choice&&!FW(e)&&(e.gaia_model||e.downloaded)&&IW(e)===u),f=d.filter(e=>e.support===`verified`),p=d.filter(e=>e.support!==`verified`),m=BW(o,t),h=!!l?.reads_images,g=o.filter(e=>PW(e)&&e.id!==l?.id),_=o.find(FW),v=e=>o.find(t=>RW(t)&&t.roles.includes(e)),y=e=>e.downloaded?i(`setup.models.status.onPc`):e.size_gb==null?i(`setup.contents.sizeOnDownload`):BO(e.size_gb),b=(e,r)=>n(XW(t,o,e,r)),x=e=>n(HW(t,o,e)),S=e=>n(UW(t,o,e)),C=v(`speech`),w=v(`voice`),T=v(`image_creation`),E=zW(l),D=l?.support===`untested`;return z(`div`,{className:`mc`,children:[z(`section`,{className:`mc-job`,"aria-labelledby":`${a}-chat`,children:[I(`h3`,{className:`mc-job-title`,id:`${a}-chat`,children:i(`setup.job.chat`)}),I(`p`,{className:`setup-hint`,children:i(`setup.job.verifiedNote`)}),I(`ul`,{className:`mc-list`,role:`radiogroup`,"aria-labelledby":`${a}-chat`,children:f.map(n=>I(xG,{name:`${a}-chat-model`,entry:n,checked:n.id===t.defaultChat,recommended:n.id===e.recommended_model,disabled:r,onPick:()=>x(n.id)},n.id))}),p.length>0&&z(P.Fragment,{children:[I(`p`,{className:`setup-hint`,children:i(`setup.job.untestedNote`)}),I(`ul`,{className:`mc-list`,role:`radiogroup`,"aria-labelledby":`${a}-chat`,children:p.map(e=>I(xG,{name:`${a}-chat-model`,entry:e,checked:e.id===t.defaultChat,recommended:!1,disabled:r,onPick:()=>x(e.id)},e.id))})]}),D&&z(`p`,{className:`mc-warn`,role:`note`,children:[I(ws,{size:13,"aria-hidden":`true`}),` `,i(`setup.job.untestedPicked`)]})]}),z(`section`,{className:`mc-job`,"aria-labelledby":`${a}-vision`,children:[I(`h3`,{className:`mc-job-title`,id:`${a}-vision`,children:i(`setup.job.vision`)}),u?I(`p`,{className:`setup-hint`,role:`note`,children:i(`setup.job.visionOffNpu`,{name:l?.name??``})}):h?z(`div`,{className:`setup-card`,children:[z(`p`,{className:`mc-job-line`,children:[I(`bdi`,{children:i(`setup.job.visionBuiltIn`,{name:l?.name??``})}),I(`span`,{className:`setup-ok`,children:i(`setup.job.nothingMore`)})]}),I(`button`,{type:`button`,className:`link-btn`,"aria-expanded":s,onClick:()=>c(e=>!e),children:i(s?`setup.job.hideVision`:`setup.job.otherVision`)})]}):I(`p`,{className:`setup-hint`,children:i(`setup.job.visionNeeded`,{name:l?.name??``})}),!u&&(!h||s)&&z(`ul`,{className:`mc-list`,role:`radiogroup`,"aria-labelledby":`${a}-vision`,children:[g.map(e=>I(xG,{name:`${a}-vision-model`,entry:e,checked:m===e.id,recommended:!h&&e.gaia_model&&e.support===`verified`,disabled:r,onPick:()=>S(e.id)},e.id)),I(`li`,{className:`mc-row${m===null?` is-ticked`:``}`,children:z(`label`,{className:`mc-row-main`,children:[I(`input`,{type:`radio`,className:`mc-radio`,name:`${a}-vision-model`,checked:h?m===l?.id:m===null,disabled:r,onChange:()=>S(h?null:`none`)}),z(`span`,{className:`mc-text`,children:[I(`span`,{className:`mc-name`,children:i(h?`setup.job.useChatForVision`:`setup.job.skipVision`)}),m===null&&!h&&z(`span`,{className:`mc-warn`,role:`note`,children:[I(ws,{size:13,"aria-hidden":`true`}),` `,i(`setup.job.skipVisionNote`)]})]})]})})]})]}),_&&z(`section`,{className:`mc-job`,"aria-labelledby":`${a}-docs`,children:[I(`h3`,{className:`mc-job-title`,id:`${a}-docs`,children:i(`setup.job.documents`)}),I(`ul`,{className:`mc-list`,children:I(SG,{label:_.name,note:i(`setup.models.line.documents`),size:y(_),checked:t.ticked.has(_.id),disabled:r,warning:t.ticked.has(_.id)?null:i(`setup.job.documentsOff`),chips:z(P.Fragment,{children:[I(`span`,{className:`mc-pill`,children:i(`setup.models.recommended`)}),I(bG,{entry:_})]}),onChange:e=>b(_.id,e)})})]}),z(`section`,{className:`mc-job`,"aria-labelledby":`${a}-extras`,children:[I(`h3`,{className:`mc-job-title`,id:`${a}-extras`,children:i(`setup.job.extras`)}),I(`p`,{className:`setup-hint`,children:i(`setup.job.extrasNote`)}),z(`ul`,{className:`mc-list`,children:[C&&I(SG,{label:i(`setup.job.speech`),note:i(`setup.job.speechNote`),size:y(C),checked:t.ticked.has(C.id),disabled:r,onChange:e=>b(C.id,e)}),w&&I(SG,{label:i(`setup.job.voice`),note:i(`setup.job.voiceNote`),size:y(w),checked:t.ticked.has(w.id),disabled:r,onChange:e=>b(w.id,e)}),T&&I(SG,{label:i(`setup.job.images`),note:i(`setup.job.imagesNote`),size:y(T),checked:t.ticked.has(T.id),disabled:r||!E,warning:E?null:i(`setup.job.imagesBlocked`,{name:l?.name??``}),onChange:e=>b(T.id,e)})]})]}),I(wG,{plan:e,selection:t})]})}function wG({plan:e,selection:t}){let n=R(),r=NW(e),i=e=>r.find(t=>t.id===e)?.name??e??n(`setup.get.off`),a=e=>r.find(n=>RW(n)&&n.roles.includes(e)&&t.ticked.has(n.id)),o=r.find(e=>FW(e)&&t.ticked.has(e.id)),s=r.find(e=>e.id===t.defaultChat),c=BW(r,t),l=[a(`speech`)&&n(`setup.job.speech`),a(`voice`)&&n(`setup.job.voice`)].filter(Boolean).join(`, `);return z(`section`,{className:`setup-card`,"aria-label":n(`setup.get.title`),children:[I(`h3`,{className:`mc-job-title`,children:n(`setup.get.title`)}),z(`dl`,{className:`setup-summary-list`,children:[z(`div`,{children:[I(`dt`,{children:n(`setup.job.chat`)}),I(`dd`,{children:I(`bdi`,{children:i(t.defaultChat)})})]}),z(`div`,{children:[I(`dt`,{children:n(`setup.job.vision`)}),I(`dd`,{children:I(`bdi`,{children:s&&IW(s)?n(`setup.get.offNpu`):c?i(c):n(`setup.get.off`)})})]}),z(`div`,{children:[I(`dt`,{children:n(`setup.job.documents`)}),I(`dd`,{children:I(`bdi`,{children:o?o.name:n(`setup.get.off`)})})]}),z(`div`,{children:[I(`dt`,{children:n(`setup.get.voice`)}),I(`dd`,{children:l||n(`setup.get.off`)})]}),z(`div`,{children:[I(`dt`,{children:n(`setup.job.images`)}),I(`dd`,{children:zW(s)?a(`image_creation`)?n(`setup.get.on`):n(`setup.get.off`):n(`setup.get.notAvailable`)})]})]})]})}var TG=(0,V.createContext)(void 0),EG=TG.Provider;function DG({children:e}){let t=(0,V.useContext)(TG);return t===void 0?I(`div`,{className:`setup-row setup-nav`,children:e}):t===null?null:(0,Mj.createPortal)(I(`div`,{className:`setup-footer-row`,children:e}),t)}function OG({title:e,children:t,confirmLabel:n,cancelLabel:r,onConfirm:i,onCancel:a,danger:o,busy:s}){let c=(0,V.useRef)(null),l=(0,V.useRef)(null),u=(0,V.useId)(),d=(0,V.useId)();return on(c,!0),(0,V.useEffect)(()=>{let e=document.activeElement;return l.current?.focus(),()=>e?.focus?.()},[]),pt(!0,a,!s),(0,Mj.createPortal)(I(`div`,{className:`confirm-overlay`,children:z(`div`,{ref:c,className:`confirm-sheet`,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":u,"aria-describedby":t?d:void 0,children:[I(`h2`,{id:u,className:`confirm-title`,children:e}),t&&I(`div`,{id:d,className:`confirm-body`,children:t}),z(`div`,{className:`confirm-actions`,children:[I(`button`,{ref:l,type:`button`,className:`btn-secondary`,onClick:a,disabled:s,children:r}),I(`button`,{type:`button`,className:o?`btn-danger`:`btn-primary`,onClick:i,disabled:s,children:n})]})]})}),document.body)}function kG(e){return e===`windows`?`Windows`:e===`linux`?`Linux`:e}function AG(e){let t=/^Run:\s*(.+)$/.exec(e)??/^(sudo .+)$/.exec(e);return t?t[1].trim():null}function jG(e,t){return e.setting&&Math.abs(e.setting.current_gb-t)<.05&&e.gpu_gb!=null?e.gpu_gb:e.presets?.find(e=>Math.abs(e.setting_gb-t)<.05)?.gpu_gb??null}function MG(e,t,n=!1){return t==null?e(n?`gpu.appliedAny`:`gpu.pending.restartAny`):e(n?`gpu.applied`:`gpu.pending.restart`,{gb:BO(t)})}function NG(e){e.focus({preventScroll:!0});for(let t=e.parentElement;t;t=t.parentElement){let n=getComputedStyle(t).overflowY;if(n!==`auto`&&n!==`scroll`)continue;let r=e.getBoundingClientRect().top-t.getBoundingClientRect().top;(r<0||r>t.clientHeight-40)&&(t.scrollTop+=r-16);return}}function PG(e){return e instanceof Error?e.message:String(e)}function FG({status:e,targetGpuGb:t}){let n=R(),r=e=>Math.round(e*10),i=r(e.total_gb??0),a=r(e.gpu_gb??0),o=t!=null&&r(t)>a?r(t):null,s=o==null?0:o-a,c=Math.max(0,i-a-s),l=e=>BO(e/10),u=e=>i>0?Math.min(100,e/i*100):0,d=e.pending?.state===`took_effect`;return z(`div`,{className:`gpu-split`,children:[z(`div`,{className:`gpu-bar${d?` is-new`:``}`,role:`img`,"aria-label":o==null?n(`gpu.split.aria`,{cpu:l(c),gpu:l(a)}):n(`gpu.split.ariaTarget`,{cpu:l(c),gpu:l(o),now:l(a)}),children:[I(`span`,{className:`gpu-seg is-gpu`,style:{inlineSize:`${u(a)}%`}}),I(`span`,{className:`gpu-seg is-target`,style:{inlineSize:`${u(s)}%`}}),I(`span`,{className:`gpu-seg is-cpu`}),o!=null&&I(`span`,{className:`gpu-marker`,style:{insetInlineStart:`${u(o)}%`}})]}),z(`div`,{className:`gpu-legend`,"aria-hidden":`true`,children:[I(`span`,{className:`gpu-key is-gpu`,children:I(`bdi`,{children:n(`gpu.split.gpu`,{gb:l(a)})})}),o!=null&&I(`span`,{className:`gpu-key is-target`,children:I(`bdi`,{children:n(`gpu.split.added`,{gb:l(s)})})}),I(`span`,{className:`gpu-key is-cpu`,children:I(`bdi`,{children:n(`gpu.split.cpu`,{gb:l(c)})})})]})]})}function IG({presets:e,value:t,onChange:n,recommended:r,max:i,keepGb:a,disabled:o}){let s=R();return z(Fz,{className:`gpu-presets`,"aria-label":s(`gpu.presets.label`),children:[a!=null&&I(`button`,{type:`button`,role:`radio`,"aria-checked":t===null,className:`gpu-preset${t===null?` is-active`:``}`,disabled:o,onClick:()=>n(null),children:I(`bdi`,{children:s(`gpu.presets.keep`,{gb:BO(a)})})}),e.map(e=>z(`button`,{type:`button`,role:`radio`,"aria-checked":e.setting_gb===t,className:`gpu-preset${e.setting_gb===t?` is-active`:``}`,disabled:o,onClick:()=>n(e.setting_gb),children:[I(`bdi`,{children:s(`gpu.presets.gpu`,{gb:BO(e.gpu_gb)})}),e.setting_gb===r&&z(P.Fragment,{children:[` `,I(`span`,{className:`gpu-tag is-recommended`,children:s(`gpu.presets.recommended`)})]}),e.setting_gb===i&&z(P.Fragment,{children:[` `,I(`span`,{className:`gpu-tag is-max`,children:s(`gpu.presets.max`)})]})]},e.setting_gb))]})}function LG({status:e,onStatus:t,mode:n,names:r,onSkip:i,onContinue:a,onBack:o,headingId:s,cloud:c=!1}){let u=R(),d=_c(e=>!!e.active?.remote)||c,p=(0,V.useCallback)(()=>{let e=s?document.getElementById(s):null;e&&NG(e)},[s]);(0,V.useEffect)(()=>{n===`setup`&&p()},[n,p]);let m=(0,V.useId)(),h=e.presets??[],g=d?null:e.recommended_setting_gb??null,[_,v]=(0,V.useState)(g??(e.gpu_gb==null?h[0]?.setting_gb??null:null)),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)(null),[C,w]=(0,V.useState)(void 0),[T,E]=(0,V.useState)(null),[D,O]=(0,V.useState)(null),[k,ee]=(0,V.useState)(null),[te,ne]=(0,V.useState)(null),A=h.find(e=>e.setting_gb===_)??null,re=h.length>0&&h[h.length-1].setting_gb===e.setting?.max_gb?h[h.length-1].setting_gb:null,ie=A&&e.total_gb!=null?Math.max(0,e.total_gb-A.gpu_gb):null,ae=g==null&&!d?(e.models??[]).find(e=>e.default&&e.fits_now):void 0,oe=(A?.unlocks??[]).slice(0,2).map(e=>r[e]??e),se=e.pending??null,ce=e.method===`apply`,le=e.guided_value!==null,ue=(0,V.useCallback)(async()=>{b(!0),S(null),O(`steps`),ee(null);try{let e=await f(_??void 0);w(e.guided_value),S(e.guided_value===null?[]:e.guided_steps??[])}catch(e){w(void 0),S([]),ee({kind:`error`,message:PG(e)})}finally{O(null)}},[_]),de=async()=>{if(_!=null){E(null),O(`apply`),ee(null);try{t(await l(_)),ee({kind:`applied`})}catch(e){let t=e instanceof Nt&&e.httpStatus===403;ee(t?{kind:`denied`}:{kind:`error`,message:PG(e)}),t&&p()}finally{O(null)}}},fe=async()=>{E(null),O(`revert`),ee(null);try{t(await st()),ee({kind:`applied`})}catch(e){ee(e instanceof Nt&&e.httpStatus===403?{kind:`denied`}:{kind:`error`,message:PG(e)})}finally{O(null)}},pe=async()=>{if(_!=null){O(`done`),ee(null);try{t(await bn(_)),b(!1)}catch(e){ee({kind:`error`,message:PG(e)})}finally{O(null)}}},me=async()=>{O(`keep`),ee(null);try{t(await j())}catch(e){ee({kind:`error`,message:PG(e)})}finally{O(null)}},he=async e=>{try{await navigator.clipboard.writeText(e),ne(e)}catch(e){ee({kind:`error`,message:u(`gpu.copyFailed`,{reason:PG(e)})})}},M=se?.state===`restart_required`;return z(`div`,{className:`gpu`,children:[I(`p`,{className:`setup-hint`,children:u(`gpu.body`,{total:BO(e.total_gb??0),gpu:BO(e.gpu_gb??0)})}),I(FG,{status:e,targetGpuGb:!M&&!y?A?.gpu_gb??null:null}),se?.state===`took_effect`&&z(`div`,{className:`gpu-notice is-ok`,role:`status`,children:[I(Vr,{size:14,"aria-hidden":`true`}),I(`span`,{children:u(`gpu.pending.tookEffect`,{gb:BO(e.gpu_gb??0)})}),I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void me(),disabled:D!==null,children:u(`gpu.ok`)})]}),M&&z(`div`,{className:`gpu-notice`,role:`status`,children:[I(ya,{size:14,"aria-hidden":`true`}),I(`span`,{children:u.compose(t=>[MG(t,jG(e,se.setting_gb),k?.kind===`applied`),t(`gpu.pending.restartHow`),n===`setup`?t(`gpu.pending.downloadsFirst`):null].filter(Boolean).join(` `))}),se.source===`guided`&&I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void me(),disabled:D!==null,children:u(`gpu.keep`,{gb:BO(e.gpu_gb??0)})})]}),se?.state===`not_applied`&&z(`div`,{className:`gpu-notice is-warn`,role:`status`,children:[I(ws,{size:14,"aria-hidden":`true`}),I(`span`,{children:u(`gpu.pending.notApplied`,{gb:BO(e.gpu_gb??0)})}),I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void me(),disabled:D!==null,children:u(`gpu.keep`,{gb:BO(e.gpu_gb??0)})})]}),!M&&!y&&h.length>0&&z(P.Fragment,{children:[ae&&z(`p`,{className:`gpu-unlock is-keep`,children:[I(Vr,{size:13,"aria-hidden":`true`}),` `,u(`gpu.keepRecommended`,{model:r[ae.id]??ae.id})]}),I(IG,{presets:h,value:_,onChange:v,recommended:g,max:re,keepGb:e.gpu_gb??null,disabled:D!==null}),A&&I(`p`,{className:`gpu-unlock`,children:oe.length>0?u(oe.length>1?`gpu.unlock.two`:`gpu.unlock.one`,{gb:BO(A.gpu_gb),a:oe[0],b:oe[1]??``}):u(`gpu.unlock.none`,{gb:BO(A.gpu_gb)})}),A&&A.setting_gb===re&&ie!=null&&z(`p`,{className:`gpu-unlock is-warn`,role:`note`,children:[I(ws,{size:13,"aria-hidden":`true`}),` `,u(`gpu.maxWarn`,{cpu:BO(ie),os:kG(e.os)})]}),I(`p`,{className:`setup-hint`,children:u.compose(t=>`${t(`gpu.reserve`,{gb:BO(e.reserve_gb??16),os:kG(e.os)})} ${t(`gpu.needs`)}`)}),!ce&&e.method_reason&&I(`p`,{className:`setup-hint`,children:I(`bdi`,{dir:`ltr`,children:e.method_reason})})]}),!M&&!y&&h.length===0&&I(`p`,{className:`setup-hint`,children:u(`gpu.noPresets`)}),y&&z(`div`,{className:`gpu-guided`,children:[A&&I(`p`,{className:`setup-hint`,id:m,children:u(`gpu.guided.lede`,{gb:BO(A.gpu_gb)})}),x===null?z(`p`,{className:`setup-hint`,role:`status`,children:[I(La,{size:13,className:`spin`,"aria-hidden":`true`}),` `,u(`gpu.guided.loading`)]}):C===null?I(`p`,{className:`setup-hint`,children:u(`gpu.noPresets`)}):I(`ol`,{className:`gpu-steps`,"aria-labelledby":m,children:x.map(e=>{let t=AG(e);return z(`li`,{children:[I(`span`,{children:e}),t&&z(`button`,{type:`button`,className:`btn-secondary gpu-copy`,onClick:()=>void he(t),"aria-label":u(`gpu.copyAria`,{what:t}),children:[I(te===t?Vr:hi,{size:12,"aria-hidden":`true`}),u(te===t?`gpu.copied`:`gpu.copy`)]})]},e)})}),z(DG,{children:[I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>b(!1),disabled:D!==null,children:u(`gpu.guided.back`)}),!ce&&C!==null&&z(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void pe(),disabled:D!==null||_==null,children:[D===`done`&&I(La,{size:13,className:`spin`,"aria-hidden":`true`}),` `,u(`gpu.guided.done`)]})]})]}),D===`apply`||D===`revert`?z(`p`,{className:`setup-hint`,role:`status`,children:[I(La,{size:13,className:`spin`,"aria-hidden":`true`}),` `,u(`gpu.waiting`)]}):null,k?.kind===`denied`&&z(`div`,{className:`gpu-notice is-warn`,role:`alert`,children:[I(ws,{size:14,"aria-hidden":`true`}),I(`span`,{children:u(`gpu.denied`)})]}),k?.kind===`error`&&I(`p`,{className:`setup-error`,role:`alert`,children:k.message}),!y&&(()=>{let t=!M&&ce&&h.length>0&&I(`button`,{type:`button`,className:`btn-primary`,onClick:()=>E(`apply`),disabled:D!==null||_==null,children:k?.kind===`denied`||se?.state===`not_applied`?u(`gpu.tryAgain`):u(`gpu.apply`)}),r=!M&&h.length>0&&le&&I(`button`,{type:`button`,className:ce?`btn-secondary`:`btn-primary`,onClick:()=>void ue(),disabled:D!==null||_==null,children:u(`gpu.showMe`)});return n===`setup`?z(DG,{children:[o&&I(`button`,{type:`button`,className:`btn-secondary`,onClick:o,children:u(`setup.back`)}),M?a&&I(`button`,{type:`button`,className:`btn-primary`,onClick:a,autoFocus:!0,children:u(`setup.continue`)}):_==null&&h.length>0?(i??a)&&I(`button`,{type:`button`,className:`btn-primary`,onClick:i??a,disabled:D!==null,children:u(`gpu.keepAsIs`)}):z(P.Fragment,{children:[i&&I(`button`,{type:`button`,className:`btn-secondary`,onClick:i,disabled:D!==null,children:u(`gpu.skip`)}),ce?z(P.Fragment,{children:[r,t]}):r]})]}):z(`div`,{className:`setup-row gpu-actions`,children:[t,r,e.revert?.available&&z(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>E(`revert`),disabled:D!==null,children:[I(Ro,{size:13,"aria-hidden":`true`}),` `,u(`gpu.undo`)]})]})})(),T===`apply`&&_!=null&&z(OG,{title:A?u(`gpu.consent.title`,{gb:BO(A.gpu_gb)}):u(`gpu.consent.titleAny`),confirmLabel:u(`setup.continue`),cancelLabel:u(`setup.cancel`),onConfirm:()=>void de(),onCancel:()=>E(null),children:[I(`p`,{children:A?u(`gpu.consent.body`,{name:e.setting?.name??``,gb:BO(A.gpu_gb)}):u(`gpu.consent.bodyAny`,{name:e.setting?.name??``})}),I(`p`,{className:`confirm-note`,children:u(`gpu.consent.saved`,{gb:BO(e.gpu_gb??0)})})]}),T===`revert`&&I(OG,{title:u(`gpu.revert.title`),confirmLabel:u(`setup.continue`),cancelLabel:u(`setup.cancel`),onConfirm:()=>void fe(),onCancel:()=>E(null),children:I(`p`,{children:u(`gpu.revert.body`)})})]})}function RG({plan:e,planError:t,onRetryPlan:n,onUseRecommended:r,selection:i,onSelection:a,cloud:o,keepTrying:s,onKeepTrying:c,onBack:l,onContinue:u,busy:d,error:f}){let p=R(),m=(0,V.useRef)(null),[h,g]=(0,V.useState)(!1),_=!!e&&!!i&&!!e.catalog,v=(0,V.useRef)(null);if(_&&v.current===null&&(v.current=!o&&$W(NW(e),i).length===0&&!!i.defaultChat&&NW(e).some(e=>e.downloaded)),(0,V.useEffect)(()=>{_&&m.current?.querySelector(`input:not([disabled])`)?.focus()},[_,h]),t&&!_)return z(`div`,{className:`setup-models-error`,children:[I(`p`,{className:`setup-error`,role:`alert`,children:p(`setup.models.listFailed`,{reason:t})}),z(`div`,{className:`setup-row`,children:[I(`button`,{type:`button`,className:`btn-primary`,onClick:n,children:p(`setup.tryAgain`)}),I(`button`,{type:`button`,className:`btn-secondary`,onClick:r,children:p(`setup.models.useRecommended`)})]}),I(`p`,{className:`setup-hint`,children:p(`setup.models.useRecommendedNote`)})]});if(!_)return I(yG,{});let y=NW(e),b=$W(y,i),x=!o&&!i.defaultChat,S=tG(e,i),C=o?[]:y.filter(e=>e.fits===!1&&i.ticked.has(e.id)),w=!h&&!!v.current&&b.length===0,T=p(S?`setup.continueAnyway`:`setup.continue`);return w?z(`div`,{className:`setup-present`,role:`status`,children:[z(`p`,{children:[I(Vr,{size:14,"aria-hidden":`true`}),` `,p(`setup.models.allPresent`)]}),I(`button`,{type:`button`,className:`link-btn`,onClick:()=>g(!0),children:p(`setup.models.change`)}),z(DG,{children:[I(`button`,{type:`button`,className:`btn-secondary`,onClick:l,disabled:d,children:p(`setup.back`)}),z(`button`,{type:`button`,className:`btn-primary`,onClick:()=>u(!1),disabled:d,children:[d&&I(La,{size:13,className:`spin`,"aria-hidden":`true`}),` `,p(`setup.finish`)]})]}),f&&I(`p`,{className:`setup-error`,role:`alert`,children:f})]}):z(`div`,{className:`setup-models`,ref:m,children:[I(`p`,{className:`setup-hint`,children:p(`setup.job.lede`)}),I(CG,{plan:e,selection:i,onSelection:a,disabled:d}),!o&&I(`button`,{type:`button`,className:`link-btn setup-reset`,onClick:()=>a(QW(e)),disabled:d,children:p(`setup.models.resetRecommended`)}),z(`div`,{className:`setup-models-footer`,children:[I(hG,{plan:e,selection:i}),z(`label`,{className:`setup-keep-trying`,children:[I(`input`,{type:`checkbox`,checked:s,onChange:e=>c(e.target.checked),disabled:d}),I(`span`,{children:p(`setup.keepTrying`)})]}),I(MW,{open:x,children:I(`p`,{className:`setup-error`,id:`setup-no-chat`,children:p(`setup.models.noChatReason`)})}),C.length>0&&I(`span`,{className:`visually-hidden`,children:C.map(e=>fG(e,p)).join(` `)}),f&&I(`p`,{className:`setup-error`,role:`alert`,children:f}),z(DG,{children:[I(`button`,{type:`button`,className:`btn-secondary`,onClick:l,disabled:d,children:p(`setup.back`)}),z(`button`,{type:`button`,className:`btn-primary`,onClick:()=>u(!!S),disabled:d||x,"aria-describedby":x?`setup-no-chat`:void 0,children:[d&&I(La,{size:13,className:`spin`,"aria-hidden":`true`}),` `,T]})]})]})]})}function zG({plan:e,chatModel:t,gpu:n}){let r=R();if(!e?.catalog)return null;let i=e.catalog,a=e=>e?i.find(t=>t.id===e)?.name??e:null,o=BW(i,{ticked:new Set,unticked:new Set,chatChosen:!1,defaultChat:t,vision:e.vision_model??null}),s=i.find(e=>e.id===o)??i.find(e=>PW(e)&&e.gaia_model),c=i.find(e=>FW(e)&&e.downloaded),l=i.filter(e=>e.gaia_model&&e.planned&&e.skipped),u=n?.pending,d=i.find(e=>e.id===t);return z(`dl`,{className:`setup-summary-list`,children:[t&&z(`div`,{children:[I(`dt`,{children:r(`setup.ready.chat`)}),z(`dd`,{children:[I(`bdi`,{children:a(t)}),d?.recipe===`flm`?` (${r(`setup.models.npu`)})`:``]})]}),z(`div`,{children:[I(`dt`,{children:r(`setup.ready.vision`)}),I(`dd`,{children:s?.downloaded?I(`bdi`,{children:s.name}):r(`setup.ready.visionOff`,{name:s?.name??`Gemma-4-E4B-it`})})]}),c&&z(`div`,{children:[I(`dt`,{children:r(`setup.ready.documents`)}),I(`dd`,{children:I(`bdi`,{children:c.name})})]}),l.length>0&&z(`div`,{children:[I(`dt`,{children:r(`setup.ready.notInstalled`)}),I(`dd`,{children:l.map(e=>e.name).join(`, `)})]}),u?.state===`restart_required`&&z(`div`,{className:`is-warn`,children:[I(`dt`,{children:r(`setup.ready.gpu`)}),z(`dd`,{children:[I(ws,{size:13,"aria-hidden":`true`}),` `,MG(r,n?jG(n,u.setting_gb):null)]})]}),u?.state===`took_effect`&&z(`div`,{children:[I(`dt`,{children:r(`setup.ready.gpu`)}),I(`dd`,{children:n?.gpu_gb==null?r(`setup.ready.gpuChanged`):r(`setup.ready.gpuNow`,{gb:BO(n.gpu_gb)})})]})]})}function BG(e){if(e.skill===`document-brief`){let t=/^(\d+) /.exec(e.note)?.[1];return t?{n:Number(t)}:void 0}if(e.skill===`coding`){let t=/^In (.+)$/.exec(e.note)?.[1];return t?{folder:t}:void 0}}function VG(e,t,n,r){let i=`${n}.one`,a=`${n}.other`,o=ae(i)&&ae(a)&&typeof r?.n==`number`?r.n===1?i:a:n;return!ae(o)||ne[o].includes(`{`)&&!r?t:gt(o,r)===t?e(o,r):t}function HG(e,t){return{title:VG(t,e.title,`card.${e.skill}.title`),note:VG(t,e.note,`card.${e.skill}.note`,BG(e))}}function UG({text:e}){let t=De(e);return t.length===1?I(P.Fragment,{children:e}):I(P.Fragment,{children:t.map((e,t)=>I(`span`,{className:`start-card-part`,children:e},t))})}function WG({cards:e,onPick:t,disabled:n}){let r=R();return e.length===0?null:I(`ul`,{className:`start-cards`,"aria-label":r(`newChat.cardsLabel`),children:e.map(e=>{let{title:i,note:a}=HG(e,r);return I(`li`,{children:z(`button`,{type:`button`,className:`start-card`,onClick:()=>t(e),disabled:n,title:e.needs_input?`${e.prompt}…`:e.prompt,children:[z(`span`,{className:`start-card-title`,children:[i,I(_r,{size:13,"aria-hidden":`true`})]}),I(`span`,{className:`start-card-note`,children:I(UG,{text:a})})]})},e.skill)})})}function GG(){let[e,t]=(0,V.useState)(null),[n,r]=(0,V.useState)([]),i=(0,V.useCallback)(()=>{Promise.resolve(cn()).then(e=>{t(e?.providers?.find(e=>e.id===`amd`)?.network??null),r(e?.providers??[])}).catch(e=>{console.warn(`[useGatewayNetwork] could not check the AMD gateway`,e),t(null)})},[]);return(0,V.useEffect)(i,[i]),{network:e,providers:n,recheck:i}}function KG(e,t,n){return t===`active`?n(`setup.contents.working`):t===`done`?n(`setup.contents.ready`):t===`failed`?n(`setup.contents.failed`):e.installed?n(`setup.contents.alreadyHere`):n(`setup.contents.waiting`)}function qG(e,t){return e==null?t(`setup.contents.sizeOnDownload`):BO(e)}function JG({state:e}){return e===`done`?I(Vr,{size:13,"aria-hidden":`true`}):e===`active`?I(La,{size:13,className:`spin`,"aria-hidden":`true`}):I(e===`failed`?Is:li,{size:13,"aria-hidden":`true`})}function YG({id:e,error:t,transient:n,onRetry:r,disabled:i}){let a=R(),o=a(`setup.component.${e}`);return z(`div`,{className:`setup-content-failure`,role:`alert`,children:[I(`p`,{children:a(n?`setup.contents.failedNetwork`:`setup.contents.failedOther`,{name:o})}),t&&z(`details`,{className:`dl-details`,children:[I(`summary`,{children:a(`setup.progress.details`)}),I(`pre`,{dir:`ltr`,children:t})]}),r&&I(`button`,{type:`button`,className:`btn-primary`,onClick:r,disabled:i,"aria-label":a(`setup.contents.retryNamed`,{name:o}),children:a(`setup.progress.retry`)})]})}function XG({plan:e,run:t,models:n=[],onRetry:r,retryDisabled:i}){let a=R();return z(`ul`,{className:`setup-contents`,children:[(e.components??[]).map(e=>{let n=t?.components?.[e.id],o=t!=null&&t.state!==`running`&&t.state!==`verifying`,s=n===`active`&&o?void 0:n;return z(`li`,{className:`setup-content is-${s??(e.installed?`done`:`waiting`)}`,children:[I(`span`,{className:`setup-content-icon`,children:I(JG,{state:s??(e.installed?`done`:void 0)})}),z(`span`,{className:`setup-content-main`,children:[I(`span`,{className:`setup-content-name`,children:a(`setup.component.${e.id}`)}),I(`span`,{className:`setup-content-note`,children:a(`setup.component.${e.id}Note`)}),e.bundled?I(`span`,{className:`setup-content-from`,children:a(`setup.contents.bundled`)}):z(`span`,{className:`setup-content-from`,children:[a(`setup.contents.from`),` `,I(`bdi`,{dir:`ltr`,children:e.source})]})]}),z(`span`,{className:`setup-content-side`,children:[I(`bdi`,{dir:`ltr`,children:qG(e.size_gb,a)}),I(`span`,{children:KG(e,s,a)})]}),s===`failed`&&o&&!t?.problem&&I(YG,{id:e.id,error:t?.error,transient:t?.component_kinds?.[e.id]===`transient`,onRetry:r,disabled:i})]},e.id)}),n.map(e=>z(`li`,{className:`setup-content is-waiting`,children:[I(`span`,{className:`setup-content-icon`,children:I(JG,{state:void 0})}),z(`span`,{className:`setup-content-main`,children:[I(`span`,{className:`setup-content-name`,children:I(`bdi`,{children:e.name})}),I(`span`,{className:`setup-content-note`,children:e.roles.map(e=>a(`setup.purpose.${e}`)).join(` · `)}),e.source&&z(`span`,{className:`setup-content-from`,children:[a(`setup.contents.from`),` `,I(`bdi`,{dir:`ltr`,children:e.source})]})]}),I(`span`,{className:`setup-content-side`,children:I(`bdi`,{dir:`ltr`,children:qG(e.size_gb,a)})})]},e.id))]})}function ZG({lines:e,className:t,id:n}){let r=(0,V.useRef)(null),i=(0,V.useRef)(!0),a=e.join(`
208
+ `);return(0,V.useEffect)(()=>{let e=r.current;e&&i.current&&(e.scrollTop=e.scrollHeight)},[a]),I(`pre`,{ref:r,id:n,className:t,dir:`ltr`,tabIndex:0,onScroll:e=>{let t=e.currentTarget;i.current=t.scrollHeight-t.scrollTop-t.clientHeight<8},children:a})}var QG=1e9,$G={downloading:0,verifying:1,failed:2,ready:3,unchecked:3,cancelled:4,queued:5,skipped:6};function eK(e){return e.roles.includes(`embedding`)?0:e.roles.includes(`chat`)?1:2}function tK(e){return[...e].filter(e=>e.state!==`skipped`).sort((e,t)=>$G[e.state]-$G[t.state]||eK(e)-eK(t))}var nK=/^\s*(Downloading:|Downloaded\b|\[[=\-\s>#]*\])/;function rK(e){return e.some(e=>e.trim()&&!nK.test(e))}var iK={queued:`setup.state.queued`,downloading:`setup.state.downloading`,verifying:`setup.state.verifying`,ready:`setup.state.ready`,failed:`setup.state.failed`,skipped:`setup.state.skipped`,cancelled:`setup.state.cancelled`,unchecked:`setup.state.unchecked`};function aK(e){return e?e.state===`running`||e.state===`verifying`||!!e.models?.some(e=>e.state===`downloading`||e.state===`queued`||e.state===`verifying`):!1}function oK(e,t,n,r){switch(e.error_kind){case`network`:return r(`setup.fail.network`,{name:t});case`disk_full`:{let i=Math.max(0,e.bytes_total-e.bytes_done)/1e9,a=n==null?i:Math.max(.1,i-n);return r(`setup.fail.diskFull`,{name:t,done:WO(e.bytes_done),need:BO(a)})}case`verify`:return r(`setup.fail.verify`,{name:t});case`memory`:return r(`setup.fail.testMemory`,{name:t});case`stuck`:return r(`setup.fail.testStuck`,{name:t});case`answer`:return r(`setup.fail.testAnswer`,{name:t});case`window`:return r(`setup.fail.testWindow`,{name:t});case`path_too_long`:return r(`setup.fail.pathTooLong`,{name:t});default:return r(`setup.fail.lemonade`,{name:t})}}function sK({model:e,name:t,estimate:n,now:r,freeGb:i,onRetry:a,onResume:o,onSkip:s,onRestart:c,busy:l,retryLater:u,checking:d,checkingFor:f}){let p=R(),m=(0,V.useId)(),h=(0,V.useId)(),[g,_]=(0,V.useState)(!1),v=e.log??[],y=e.bytes_total>0?Math.min(100,e.bytes_done/e.bytes_total*100):e.state===`ready`?100:0,b=p(iK[e.state]),x=e.retrying_until?Math.max(0,Math.round(e.retrying_until-r/1e3)):0,S=e.state===`downloading`&&!x?n?.stalledFor??0:0,C=e.state===`verifying`&&d||e.state===`downloading`&&!x&&S<15,w;if(e.state===`downloading`){let t=KO(p.locale,e.bytes_total>0?`${WO(e.bytes_done)} / ${WO(e.bytes_total)}`:WO(e.bytes_done));if(x>0)w=p(`setup.progress.retrying`,{n:String(x)});else if(S>=60)w=p(`setup.progress.stuck`);else if(S>=15)w=p(`setup.progress.stalled`,{n:`15`});else if(n?.speed&&n.eta!=null){let{speed:e,eta:r}=n;w=p.compose(n=>`${t} · ${KO(p.locale,GO(e))} · ${qO(r,n)}`)}else w=p.compose(e=>`${t} · ${e(`setup.progress.estimating`)}`)}else w=e.state===`verifying`?d?f>=10?p(`setup.progress.checkingFor`,{n:String(f)}):p(`setup.progress.checkingLoad`):p(`setup.progress.waitingCheck`):e.state===`ready`?e.bytes_total?WO(e.bytes_total):``:e.state===`unchecked`?p(`setup.progress.unchecked`):e.state===`cancelled`?e.bytes_done>0?p(`setup.progress.keptPartial`,{done:WO(e.bytes_done)}):``:e.state===`queued`&&e.bytes_total?WO(e.bytes_total):``;let T=e.state===`downloading`?p.compose(t=>[t(`setup.progress.percent`,{n:String(Math.floor(y))}),e.bytes_total?t(`setup.progress.of`,{done:WO(e.bytes_done),total:WO(e.bytes_total)}):null,n?.eta==null?null:JO(n.eta,t)].filter(Boolean).join(`, `)):b;return z(`li`,{className:`dl-row is-${e.state}${C?` is-live`:``}${S>=15?` is-stalled`:``}`,children:[z(`div`,{className:`dl-row-head`,children:[I(`span`,{className:`dl-icon`,"aria-hidden":`true`,children:e.state===`ready`||e.state===`unchecked`?I(Vr,{size:14}):e.state===`failed`?I(ri,{size:14}):e.state===`cancelled`?I(mo,{size:13}):I(`span`,{className:`dl-dot`})}),I(`span`,{className:`dl-name`,children:I(`bdi`,{title:e.id,children:t})}),I(`span`,{className:`dl-state`,children:b}),e.state===`downloading`&&z(`bdi`,{className:`dl-pct`,children:[Math.floor(y),`%`]}),e.state!==`failed`&&rK(v)&&I(`button`,{type:`button`,className:`dl-log-toggle`,onClick:()=>_(e=>!e),"aria-expanded":g,"aria-controls":h,"aria-label":p(`setup.progress.logFor`,{name:t}),title:p(`setup.progress.logFor`,{name:t}),children:I(Yr,{size:14,className:g?`is-open`:``,"aria-hidden":`true`})})]}),I(`div`,{className:`dl-track`,role:`progressbar`,"aria-label":p(`setup.progress.rowLabel`,{name:t,state:b}),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":C&&e.state===`verifying`?void 0:Math.floor(y),"aria-valuetext":T,children:I(`span`,{className:`dl-fill`,style:{inlineSize:`${e.state===`verifying`?100:y}%`}})}),w&&I(`p`,{className:`dl-detail`,children:I(`bdi`,{children:w})}),g&&e.state!==`failed`&&rK(v)&&I(ZG,{lines:v,id:h,className:`dl-log`}),e.state===`failed`&&z(`div`,{className:`dl-fail`,children:[I(`p`,{className:`dl-error`,id:m,children:oK(e,t,i,p)}),(v.length>0||e.error)&&z(`details`,{className:`dl-details`,children:[I(`summary`,{children:p(`setup.progress.details`)}),I(`pre`,{dir:`ltr`,children:v.length>0?v.join(`
209
+ `):e.error})]}),u?I(`p`,{className:`dl-detail`,children:p(`setup.progress.retryLater`)}):z(`div`,{className:`setup-row`,children:[a&&z(`button`,{type:`button`,className:`btn-primary`,disabled:l,onClick:()=>a(e.id,e.error_kind),"aria-describedby":m,children:[I(Bo,{size:13,"aria-hidden":`true`}),` `,p(`setup.progress.retry`)]}),s&&I(`button`,{type:`button`,className:`btn-secondary`,disabled:l,onClick:()=>s(e.id),children:p(`setup.progress.skipModel`)})]})]}),e.state===`cancelled`&&o&&I(`div`,{className:`setup-row`,children:I(`button`,{type:`button`,className:`btn-secondary`,disabled:l,onClick:()=>o(e.id),children:p(`setup.progress.resume`)})}),S>=60&&c&&I(`div`,{className:`setup-row`,children:z(`button`,{type:`button`,className:`btn-secondary`,disabled:l,onClick:c,children:[I(Bo,{size:13,"aria-hidden":`true`}),` `,p(`setup.progress.retry`)]})})]})}function cK({status:e,names:t,freeGb:n=null,onCancel:r,onRetry:i,onResume:a,onResumeAll:o,onSkip:s,onRestart:c,busy:l=!1,retryLater:u=!1,labelledBy:d}){let f=R(),p=AW(),m=(0,V.useMemo)(()=>tK(e.models??[]),[e.models]),h=(0,V.useRef)(new Map),g=(0,V.useRef)(new Map),_=(0,V.useRef)(new XO),v=(0,V.useRef)(!1),[y,b]=(0,V.useState)(()=>Date.now()),[x,S]=(0,V.useState)(!1),[C,w]=(0,V.useState)(null),T=i&&((e,t)=>{let n=m.find(t=>t.id===e);t===`verify`&&n?w(n):i(e,t)}),[E,D]=(0,V.useState)(``),[O,k]=(0,V.useState)(``),ee=(0,V.useRef)(null),te=e.state===`verifying`||e.state!==`running`&&m.some(e=>e.state===`verifying`),ne=(0,V.useRef)(new Map);(0,V.useEffect)(()=>{if(!p||!(m.some(e=>e.retrying_until)||te))return;let e=setInterval(()=>b(Date.now()),1e3);return()=>clearInterval(e)},[m,p,te]);let A=e.overall,{estimates:re,overallEstimate:ie}=(0,V.useMemo)(()=>{let e=Date.now(),t={};for(let n of m){if(n.state!==`downloading`){h.current.delete(n.id);continue}let r=h.current.get(n.id),i=n.downloaded_before_gb??null;r&&g.current.get(n.id)===i||(r=new XO,h.current.set(n.id,r),g.current.set(n.id,i)),t[n.id]=r.update(n.bytes_done,n.bytes_total,e)}let n=m.some(e=>e.state===`downloading`);n&&!v.current&&(_.current=new XO),v.current=n;let r=m.filter(e=>e.state===`downloading`||e.state===`queued`).reduce((e,t)=>e+Math.max(0,t.bytes_total-t.bytes_done),0);return{estimates:t,overallEstimate:n&&A?_.current.update(A.bytes_done,A.bytes_done+r,e):void 0}},[m,A]);(0,V.useEffect)(()=>{let e=new Map(m.map(e=>[e.id,e.state])),n=Math.floor((A?.percent??0)/25),r=ee.current;if(ee.current={states:e,quarter:n},!r)return;let i=[];for(let e of m){if(r.states.get(e.id)===e.state)continue;let n=t[e.id]??e.id;e.state===`failed`?k(f(`setup.progress.announceFailed`,{name:n})):i.push(f(`setup.progress.announceState`,{name:n,state:f(iK[e.state])}))}n>r.quarter&&n>0&&n<4&&i.push(f(`setup.progress.announceOverall`,{n:String(n*25)})),i.length&&D(i.join(`. `))},[m,A?.percent,t,f]);let ae=e=>{if(!te)return ne.current.delete(e),0;let t=Date.now(),n=ne.current.get(e)??t;return ne.current.set(e,n),Math.floor((t-n)/1e3)},j=aK(e),oe=m.filter(e=>e.state===`cancelled`),se=A?.failed??m.filter(e=>e.state===`failed`).length,ce=A?.percent??0,le=()=>{(A?.bytes_done??0)>QG?S(!0):r?.()},ue=f.compose(e=>[e(`setup.progress.overallPct`,{n:String(ce)}),A&&A.bytes_total>0?e(`setup.progress.of`,{done:WO(A.bytes_done),total:WO(A.bytes_total)}):null,j&&ie?.speed?KO(f.locale,GO(ie.speed)):null,j?ie?.eta==null?e(`setup.progress.estimating`):e(`setup.progress.left`,{eta:qO(ie.eta,e)}):null,se>0?e(`setup.progress.failedCount`,{n:String(se)}):null].filter(Boolean).join(` · `));return z(`section`,{className:`dl${p?``:` is-paused`}`,"aria-labelledby":d,children:[z(`div`,{className:`dl-overall`,children:[I(`p`,{className:`dl-overall-line`,children:I(`bdi`,{children:ue})}),I(`div`,{className:`dl-track is-overall${m.some(e=>e.state===`downloading`)?` is-live`:``}`,role:`progressbar`,"aria-label":f(`setup.progress.overallLabel`),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":ce,"aria-valuetext":f(`setup.progress.percent`,{n:String(ce)}),children:I(`span`,{className:`dl-fill`,style:{inlineSize:`${ce}%`}})})]}),I(`ul`,{className:`dl-list`,children:m.map(e=>I(sK,{model:e,name:t[e.id]??e.id,estimate:re[e.id],now:y,freeGb:n,onRetry:T,onResume:j?void 0:a,onSkip:s,onRestart:c,busy:l,retryLater:u,checking:te,checkingFor:ae(e.id)},e.id))}),j&&I(`p`,{className:`setup-hint dl-controls`,children:f(`setup.progress.keepsGoing`)}),(j&&r||!j&&oe.length>0&&o)&&z(DG,{children:[j&&r&&I(`button`,{type:`button`,className:`btn-secondary`,onClick:le,disabled:l,children:f(`setup.progress.cancel`)}),!j&&oe.length>0&&o&&I(`button`,{type:`button`,className:`btn-primary`,onClick:o,disabled:l,children:f(`setup.progress.resumeAll`)})]}),I(`span`,{className:`visually-hidden`,"aria-live":`polite`,children:E}),I(`span`,{className:`visually-hidden`,role:`alert`,children:O}),x&&I(OG,{title:f(`setup.progress.cancelTitle`),confirmLabel:f(`setup.progress.cancelConfirm`),cancelLabel:f(`setup.progress.cancelKeep`),onConfirm:()=>{S(!1),r?.()},onCancel:()=>S(!1),children:I(`p`,{children:f(`setup.progress.cancelBody`)})}),C&&I(OG,{title:f(`setup.redownload.title`,{name:t[C.id]??C.id}),confirmLabel:f(`setup.redownload.confirm`),cancelLabel:f(`setup.redownload.keep`),onConfirm:()=>{let e=C;w(null),i?.(e.id,`verify`)},onCancel:()=>w(null),children:I(`p`,{children:f(`setup.redownload.body`,{name:t[C.id]??C.id,size:WO(C.bytes_total)})})})]})}function lK({run:e,plan:t,idle:n,bar:r=!0}){let i=R(),a=t?.components??[],o=a.find(t=>e.components?.[t.id]===`active`),s=a.filter(t=>e.components?.[t.id]===`done`||e.components?.[t.id]==null&&t.installed).length,c=e.percent==null?null:Math.max(0,Math.min(100,Math.round(e.percent))),l=o?i(`setup.download.now`,{name:i(`setup.component.${o.id}`)}):n;return z(`div`,{className:`setup-activity`,children:[z(`p`,{className:`setup-hint`,children:[I(La,{size:13,className:`spin`,"aria-hidden":`true`}),` `,I(`span`,{role:`status`,children:l}),c!=null&&z(P.Fragment,{children:[` · `,z(`bdi`,{dir:`ltr`,children:[c,`%`]})]}),a.length>0&&z(P.Fragment,{children:[` · `,i(`setup.download.partsReady`,{done:String(s),total:String(a.length)})]})]}),r&&c!=null&&I(`progress`,{className:`setup-progress`,max:100,value:c,"aria-label":l})]})}var uK=[`check`,`download`,`test`],dK={root:`setup-report`,button:`btn-secondary setup-report-button`,hint:`setup-hint`,error:`setup-error`},fK=/\d+(\.\d+)?\s*%/;function pK(e){let t=[],n=null;for(let r of e){let e=r.search(fK),i=e>=0?r.slice(0,e):null;i!==null&&i===n?t[t.length-1]=r:t.push(r),n=i}return t}function mK({run:e,before:t={},failed:n=!1}){let r=R(),[i,a]=(0,V.useState)(n),[o,s]=(0,V.useState)(()=>new Set);(0,V.useEffect)(()=>{n&&a(!0)},[n]);let c=e=>s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),l=n=>pK([...t[n]??[],...e?.logs?.[n]??[]]),u=uK.filter(e=>l(e).length>0);return z(`section`,{className:`setup-logs`,"aria-label":r(`setup.logs.title`),children:[z(`button`,{type:`button`,className:`setup-log-toggle setup-help-toggle`,onClick:()=>a(e=>!e),"aria-expanded":i,"aria-controls":`setup-help`,children:[I(Yr,{size:13,className:i?`is-open`:``,"aria-hidden":`true`}),` `,r(`setup.logs.help`)]}),i&&z(`div`,{id:`setup-help`,className:`setup-help`,children:[u.map(e=>{let t=l(e),n=o.has(e);return z(`div`,{className:`setup-log`,children:[z(`button`,{type:`button`,className:`setup-log-toggle`,onClick:()=>c(e),"aria-expanded":n,children:[I(Yr,{size:13,className:n?`is-open`:``,"aria-hidden":`true`}),` `,r(`setup.logs.${e}`)]}),n&&I(ZG,{lines:t,className:`setup-log-pre`})]},e)}),I(wN,{classes:dK,note:r(`setup.logs.reportNote`)})]})]})}function hK(){let e=R(),t=B(e=>e.locale),n=B(e=>e.setLocale);return z(`label`,{className:`setup-language`,children:[I(Ca,{size:14,"aria-hidden":`true`}),I(`span`,{className:`visually-hidden`,children:e(`settings.language`)}),I(`select`,{value:t,onChange:e=>n(e.target.value),children:ge.map(({meta:e})=>I(`option`,{value:e.code,lang:e.code,dir:e.dir,children:Fe(e)},e.code))})]})}var gK={driver:[`setup.npu.problem.driver`,`setup.npu.fix.driver`],device:[`setup.npu.problem.device`,`setup.npu.fix.device`],firmware:[`setup.npu.problem.firmware`,`setup.npu.fix.firmware`],access:[`setup.npu.problem.access`,`setup.npu.fix.access`],memlock:[`setup.npu.problem.memlock`,`setup.npu.fix.memlock`],runtime:[`setup.npu.problem.runtime`,`setup.npu.fix.runtime`]},_K={cancelled:`setup.npu.fixError.cancelled`,timeout:`setup.npu.fixError.timeout`,not_authorized:`setup.npu.fixError.notAuthorized`,no_pkexec:`setup.npu.fixError.noPkexec`};function vK({problem:e}){let t=R(),n=gK[e.code];if(!n)return z(`li`,{children:[I(`strong`,{children:e.title}),` `,e.fix]});let r=e.params,i=n[1];e.code===`access`&&r.group&&(i=`setup.npu.fix.accessGroup`);let a=n[0];return e.code===`memlock`&&r.fix===`restart`&&(a=`setup.npu.problem.memlockStill`,i=`setup.npu.fix.memlockRestart`),e.code===`memlock`&&r.fix===`stuck`&&(a=`setup.npu.problem.memlockStuck`,i=`setup.npu.fix.memlockStuck`),z(`li`,{children:[I(`strong`,{children:t(a,{device:r.device??``,limit:r.limit??``,version:r.version??``,detail:r.detail??``})}),` `,t(i,{group:r.group??``})]})}function yK({problems:e,disabled:t,onRecheck:n,id:r=`setup-npu-problems`}){let i=R(),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(null),l=e.some(e=>e.code===`memlock`&&e.params.fix===`apply`),u=async(e,t)=>{o(!0),c(null);try{await e(),n?.()}catch(e){let n=e instanceof Nt?e.body?.code:void 0,r=n&&n in _K?_K[n]:t;c(i(r))}finally{o(!1)}};return z(`div`,{className:`setup-npu-problems`,id:r,role:`note`,children:[I(`p`,{children:i(`setup.npu.notReady`)}),I(`ul`,{children:e.map(e=>I(vK,{problem:e},e.code))}),I(`p`,{className:`setup-hint`,children:i(`setup.npu.meanwhile`)}),s&&I(`p`,{className:`setup-npu-error`,role:`alert`,children:s}),z(`div`,{className:`setup-npu-actions`,children:[l&&I(`button`,{type:`button`,className:`btn-primary`,disabled:t||a,onClick:()=>void u(Qn,`setup.npu.fixError.failed`),children:i(`setup.npu.fixMemlock`)}),n&&I(`button`,{type:`button`,className:`btn-secondary`,disabled:t||a,onClick:()=>void u(pe,`setup.npu.recheckFailed`),children:i(`setup.npu.recheck`)})]})]})}async function bK(){let e=await p();e.reachable&&(e.available_backends??[]).some(e=>e.name===`vulkan`)&&(e.preferred_backend??e.default_backend)!==`vulkan`&&await x(`vulkan`)}function xK({plan:e,selection:t,onSelection:n,disabled:r=!1,onRecheck:i}){let a=R(),o=NW(e),s=e.npu?.present&&!e.npu.ready?e.npu.problems:[],c=s.length?void 0:o.find(e=>IW(e)&&e.gaia_model&&e.chat_choice&&e.fits!==!1)??o.find(e=>IW(e)&&e.chat_choice&&e.downloaded&&!LW(e)),l=!s.length&&!c&&o.some(e=>IW(e)&&e.fit_code===`npu`),u=!!o.find(e=>e.id===t.defaultChat&&IW(e)),d=QW(e).defaultChat,f=d&&!o.find(e=>e.id===d&&IW(e))?d:o.find(e=>e.chat_choice&&e.gaia_model&&e.support===`verified`&&!IW(e))?.id,p=e=>{e===`npu`&&c&&!u&&n(HW(t,o,c.id)),e===`gpu`&&u&&f&&n(HW(t,o,f))},m=[{id:`gpu`,label:a(`setup.backend.gpu`)},...c?[{id:`npu`,label:a(`setup.backend.npu`)}]:[],...s.length?[{id:`npu`,label:a(`setup.backend.npu`),unavailable:!0}]:[]],h=u?`npu`:`gpu`;return z(`section`,{className:`setup-backend`,"aria-labelledby":`setup-backend-title`,children:[I(`h3`,{className:`mc-job-title`,id:`setup-backend-title`,children:a(`setup.backend.title`)}),I(Fz,{className:`segmented`,"aria-labelledby":`setup-backend-title`,children:m.map(e=>I(`button`,{type:`button`,role:`radio`,"aria-checked":h===e.id,"aria-describedby":e.unavailable?`setup-npu-problems`:void 0,className:h===e.id?`is-active`:``,disabled:r||e.unavailable,onClick:()=>p(e.id),children:I(`bdi`,{children:e.label})},e.id))}),s.length>0?I(yK,{problems:s,disabled:r,onRecheck:i}):I(`p`,{className:`setup-hint`,children:a(c?`setup.backend.hint`:l?`setup.backend.hintNpuUnusable`:`setup.backend.hintNoNpu`)})]})}var SK=({children:e})=>I(`bdi`,{dir:`ltr`,children:e});function CK({label:e,children:t}){return z(`div`,{className:`found-row`,children:[I(`dt`,{children:e}),I(`dd`,{children:t})]})}function wK(e){return e.family?`${e.name} (${e.family})`:e.name}var TK=[[`llamacpp`,`llama.cpp`],[`flm`,`FastFlowLM`],[`whispercpp`,`whisper.cpp`],[`kokoro`,`Kokoro`],[`sd-cpp`,`stable-diffusion.cpp`]],EK=new Set([`llamacpp`,`flm`]);function DK(e){let t=[];for(let[n,r]of TK){let i=(e.backends??[]).find(e=>e.recipe===n&&e.default);i&&i.state!==`unsupported`&&t.push({name:r,b:i})}return t}function OK(e,t){return e?e.kind===`release_candidate`&&e.rc?`${e.version.replace(/rc\d+$/,``)} RC ${e.rc}`:e.kind===`source`&&e.commit?`${e.version} (${e.commit})`:e.version:t??null}var kK={release:`release`,release_candidate:`release candidate`,local:`local build`,source:`from source`};function AK(e,t){let n=e.system,r=e=>(n?.devices??[]).filter(t=>t.available&&e(t.kind)),i=r(e=>e.endsWith(`gpu`)),a=r(e=>e.endsWith(`npu`)),o=DK(e);return{sys:n,cpu:r(e=>e===`cpu`)[0],gpus:i,graphics:i.length?i.map(wK).join(`; `):t?.gpu_name??null,npus:a,runsOn:i[0]?.name??t?.gpu_name??null,npu:a[0]??null,runtimes:o,gaia:OK(n?.gaia_build,n?.gaia_version),build:n?.gaia_build?.kind??null,software:[OK(n?.gaia_build,n?.gaia_version)?`GAIA ${OK(n?.gaia_build,n?.gaia_version)}`:null,n?.lemonade_version?`Lemonade ${n.lemonade_version}`:null,...o.filter(({b:e})=>EK.has(e.recipe)&&MK(e)).map(({name:e,b:t})=>`${e} ${t.version??t.backend}`)].filter(e=>!!e),totalMemory:HO(n?.physical_memory,t?.ram_gb),freeGb:e.disk?.free_gb??t?.disk_free_gb??null,modelsPath:e.disk?.path??null,gaiaHome:n?.gaia_home??null}}var jK={installed:`installed`,update_required:`installed, updates on first use`},MK=e=>e.state===`installed`||e.state===`update_required`,NK={chat:`setup.job.chat`,vision:`setup.job.vision`,embedding:`setup.job.documents`,speech:`setup.job.speech`,voice:`setup.job.voice`,image_creation:`setup.job.images`};function PK(e,t){let n=AK(e,t),r=e.lemonade.mode===`external`?`the user's own`:`GAIA's own`;return[`GAIA: ${n.gaia??`unknown`}${n.build?`, ${kK[n.build]}`:``} (agent ${n.sys?.agent_version??`not installed yet`})`,`Model server: ${r} Lemonade ${n.sys?.lemonade_version??`(version not reported)`}${e.lemonade.url?` at ${e.lemonade.url}`:``}`,...n.runtimes.map(({name:e,b:t})=>`${e}: ${t.backend}${t.version?` ${t.version}`:``} (${jK[t.state??``]??`not installed`})`),`OS: ${n.sys?.os??t?.os??`unknown`}`,`Processor: ${n.cpu?.name??n.sys?.processor??`unknown`}${n.cpu?.cores?` (${n.cpu.cores} cores, ${n.cpu.threads??n.cpu.cores} threads)`:``}`,`Graphics: ${n.graphics??`none found`}`,`NPU: ${n.npus.map(wK).join(`; `)||`none found`}`,`Memory: ${n.totalMemory??`unknown`}${e.capacity_gb==null?``:`, ${BO(e.capacity_gb)} for models${e.memory_source?` (${e.memory_source})`:``}`}`,`Models folder: ${n.modelsPath??`unknown`}${n.freeGb==null?``:` (${BO(n.freeGb)} free)`}`,`GAIA data and logs: ${n.gaiaHome??`unknown`}`].join(`
210
+ `)}function FK({plan:e,hardware:t,onChangeMemory:n}){let r=R(),i=AK(e,t),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(null),d=async e=>{u(null);try{await $t(e,!1)}catch(e){u(r(`setup.found.openFailed`,{error:e instanceof Error?e.message:String(e)}))}},f=I(`span`,{className:`found-muted`,children:r(`setup.found.unknown`)}),p=[...t?.blockers??[],...(t?.warnings??[]).filter(e=>t?.lemonade_running||!/\bNPU\b/.test(e))],m=(0,V.useRef)(null);(0,V.useEffect)(()=>()=>{m.current&&clearTimeout(m.current)},[]);let h=e=>{c(e),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>c(null),2e3)};return z(`section`,{className:`setup-card found`,"aria-label":r(`setup.found.title`),children:[z(`div`,{className:`found-head`,children:[I(`h3`,{className:`mc-job-title`,children:r(`setup.found.title`)}),I(`button`,{type:`button`,className:`found-copy`,onClick:()=>{navigator.clipboard.writeText(PK(e,t)).then(()=>h(`done`),e=>{console.warn(`[DetectedSummary] could not copy the details`,e),h(`failed`)})},"aria-label":r(`setup.found.copy`),title:r(`setup.found.copy`),children:I(s===`done`?Vr:hi,{size:14,"aria-hidden":`true`})}),s&&I(`span`,{className:`found-copied`,role:`status`,children:r(s===`done`?`setup.found.copied`:`setup.found.copyFailed`)})]}),z(`dl`,{className:`found-glance`,children:[z(CK,{label:r(`setup.found.runsOn`),children:[i.runsOn?I(SK,{children:i.runsOn}):f,i.npu&&I(`span`,{className:`found-chip`,children:I(SK,{children:`NPU`})})]}),z(CK,{label:r(`setup.found.memory`),children:[e.capacity_gb!=null&&i.totalMemory?r(`setup.found.memoryOf`,{size:BO(e.capacity_gb),total:i.totalMemory}):e.capacity_gb==null?i.totalMemory?I(SK,{children:i.totalMemory}):f:I(SK,{children:BO(e.capacity_gb)}),n&&I(`button`,{type:`button`,className:`link-btn found-link`,onClick:n,children:r(`setup.found.changeMemory`)})]}),I(CK,{label:r(`setup.found.space`),children:i.freeGb==null?f:I(SK,{children:BO(i.freeGb)})}),z(CK,{label:r(`setup.found.software`),children:[i.software.length?I(SK,{children:i.software.join(` · `)}):f,i.build&&i.build!==`release`&&I(`span`,{className:`found-chip`,children:r(`setup.found.build.${i.build}`)})]})]}),z(`div`,{className:`found-paths`,children:[[[`setup.found.modelsFolder`,i.modelsPath],[`setup.found.gaiaFolder`,i.gaiaHome]].map(([e,t])=>t&&z(`button`,{type:`button`,className:`link-btn found-open`,onClick:()=>void d(t),title:t,children:[I($i,{size:13,"aria-hidden":`true`}),` `,r(e)]},e)),l&&I(`p`,{className:`setup-error`,role:`alert`,children:l})]}),p.length>0&&z(`details`,{className:`dl-details found-warnings`,children:[z(`summary`,{children:[I(ri,{size:13,"aria-hidden":`true`}),` `,r(`setup.found.noticed`)]}),I(`ul`,{children:p.map(e=>I(`li`,{children:I(SK,{children:e})},e))})]}),z(`button`,{type:`button`,className:`setup-log-toggle found-more`,onClick:()=>o(e=>!e),"aria-expanded":a,children:[I(Yr,{size:13,className:a?`is-open`:``,"aria-hidden":`true`}),` `,r(`setup.found.details`)]}),a&&z(`div`,{className:`found-details`,children:[I(`h4`,{className:`found-group`,children:r(`setup.found.software`)}),z(`dl`,{className:`found-list`,children:[z(CK,{label:I(SK,{children:`GAIA`}),children:[i.gaia?I(SK,{children:i.gaia}):f,i.build&&i.build!==`release`&&I(`span`,{className:`found-chip`,children:r(`setup.found.build.${i.build}`)})]}),I(CK,{label:r(`setup.found.agent`),children:i.sys?.agent_version?I(SK,{children:i.sys.agent_version}):I(`span`,{className:`found-muted`,children:r(`setup.found.agentLater`)})}),z(CK,{label:r(`setup.found.server`),children:[e.lemonade.mode===`external`?r(`setup.found.serverYours`):r(`setup.found.serverOwn`),i.sys?.lemonade_version&&z(P.Fragment,{children:[` `,I(SK,{children:i.sys.lemonade_version})]}),e.lemonade.url&&I(`span`,{className:`found-sub`,children:I(SK,{children:e.lemonade.url})})]})]}),I(`h4`,{className:`found-group`,children:r(`setup.found.runtime`)}),i.runtimes.length?I(`div`,{className:`found-table-wrap`,children:z(`table`,{className:`found-table`,children:[I(`thead`,{className:`visually-hidden`,children:z(`tr`,{children:[I(`th`,{scope:`col`,children:r(`setup.found.col.runtime`)}),I(`th`,{scope:`col`,children:r(`setup.found.col.device`)}),I(`th`,{scope:`col`,children:r(`setup.found.col.version`)}),I(`th`,{scope:`col`,children:r(`setup.found.col.state`)})]})}),I(`tbody`,{children:i.runtimes.map(({name:e,b:t})=>z(`tr`,{children:[I(`th`,{scope:`row`,children:I(SK,{children:e})}),I(`td`,{children:I(SK,{children:t.backend})}),I(`td`,{children:I(SK,{children:t.version??``})}),I(`td`,{className:MK(t)?`is-installed`:void 0,children:r(MK(t)?`setup.pc.backend.installed`:`setup.pc.backend.available`)})]},t.recipe))})]})}):I(`p`,{className:`found-muted`,children:r(`setup.found.unknown`)}),I(`h4`,{className:`found-group`,children:r(`setup.found.models`)}),(e.catalog??[]).length?I(`div`,{className:`found-table-wrap`,children:z(`table`,{className:`found-table`,children:[I(`thead`,{className:`visually-hidden`,children:z(`tr`,{children:[I(`th`,{scope:`col`,children:r(`setup.found.col.model`)}),I(`th`,{scope:`col`,children:r(`setup.found.col.job`)}),I(`th`,{scope:`col`,children:r(`setup.found.col.tested`)}),I(`th`,{scope:`col`,children:r(`setup.found.col.size`)}),I(`th`,{scope:`col`,children:r(`setup.found.col.state`)})]})}),I(`tbody`,{children:(e.catalog??[]).map(e=>z(`tr`,{children:[I(`th`,{scope:`row`,title:e.id,children:I(`bdi`,{children:e.name})}),I(`td`,{children:e.roles.map(e=>r(NK[e])).join(` · `)}),z(`td`,{children:[e.support===`verified`&&I(`span`,{className:`mc-chip is-verified`,children:r(`setup.label.verified`)}),e.support===`untested`&&I(`span`,{className:`mc-chip is-untested`,children:r(`setup.label.untested`)})]}),I(`td`,{children:I(SK,{children:e.full_size_gb??e.size_gb?BO(e.full_size_gb??e.size_gb):``})}),I(`td`,{className:e.downloaded?`is-installed`:void 0,children:r(e.downloaded?`setup.models.status.onPc`:`setup.found.notDownloaded`)})]},e.id))})]})}):I(`p`,{className:`found-muted`,children:r(`setup.found.unknown`)}),I(`h4`,{className:`found-group`,children:r(`setup.found.hardware`)}),z(`dl`,{className:`found-list`,children:[I(CK,{label:r(`setup.found.os`),children:i.sys?.os??t?.os?I(SK,{children:i.sys?.os??t?.os}):f}),z(CK,{label:r(`setup.found.cpu`),children:[i.cpu||i.sys?.processor?I(SK,{children:i.cpu?.name??i.sys?.processor}):f,i.cpu?.cores?I(`span`,{className:`found-sub`,children:r(`setup.found.cores`,{cores:String(i.cpu.cores),threads:String(i.cpu.threads??i.cpu.cores)})}):null]}),I(CK,{label:r(`setup.found.gpu`),children:i.graphics?I(SK,{children:i.graphics}):I(`span`,{className:`found-muted`,children:r(`setup.found.none`)})}),I(CK,{label:r(`setup.found.npu`),children:i.npus.length?I(SK,{children:i.npus.map(wK).join(`; `)}):I(`span`,{className:`found-muted`,children:r(`setup.found.none`)})})]})]})]})}function IK({state:e}){return e===`done`?I(Vr,{size:13,"aria-hidden":`true`}):e===`active`?I(La,{size:13,className:`spin`,"aria-hidden":`true`}):I(e===`failed`?Is:e===`question`?ai:li,{size:13,"aria-hidden":`true`})}function LK({hardware:e,hardwareError:t,plan:n,serverRun:r,awaitingChoice:i=!1}){let a=R(),[o,s]=(0,V.useState)(!1),c=!!n?.lemonade.reachable,l=r?.state===`failed`||r?.state===`cancelled`,u=a(n?.lemonade.mode===`external`?`setup.found.serverYours`:`setup.found.serverOwn`),d=n?.system?.lemonade_version?a(`setup.checks.serverFound`,{version:n.system.lemonade_version,whose:u}):u,f=e?`done`:t?`failed`:`active`,p=[e?.gpu_name,e?.npu_detected?a(`setup.checks.npu`):null].filter(Boolean).join(` · `),m=t?null:n?.capacity_gb==null?c?HO(n?.system?.physical_memory,e?.ram_gb):null:BO(n.capacity_gb),h=t?`failed`:m?`done`:l?`failed`:i?`waiting`:`active`,g=[{id:`device`,label:a(`setup.checks.device`),value:t?`${a(`setup.system.unread`)} ${t}`:p||null,state:f},{id:`memory`,label:a(`setup.found.memory`),value:m,state:h},{id:`disk`,label:a(`setup.checks.disk`),value:e?.disk_free_gb==null?null:a(`setup.checks.diskValue`,{size:KO(a.locale,`${Math.round(e.disk_free_gb)} GB`)}),state:f},{id:`server`,label:a(`setup.checks.server`),value:c?d:i?a(`setup.checks.serverChoose`):null,state:c?`done`:l?`failed`:i?`question`:e?`active`:`waiting`},{id:`models`,label:a(`setup.checks.backends`),value:c&&n?.catalog?a(`setup.checks.backendsValue`,{models:String(n.catalog.length),downloaded:String(n.catalog.filter(e=>e.downloaded).length)}):null,state:c&&n?.catalog?`done`:c?`active`:`waiting`}],_=g.filter(e=>e.state===`done`).length,v=Math.round(_/g.length*100),y=I(`ul`,{className:`setup-rows`,id:`setup-check-rows`,children:g.map(e=>z(`li`,{className:`setup-result is-${e.state}`,children:[I(IK,{state:e.state}),I(`span`,{className:`setup-result-label`,children:e.label}),e.value&&I(`bdi`,{className:`setup-result-value`,children:e.value})]},e.id))});return _===g.length?z(`section`,{className:`setup-card setup-checks-done`,"aria-label":a(`setup.check.title`),children:[I(`p`,{className:`setup-result is-done`,role:`status`,children:z(`button`,{type:`button`,className:`setup-checks-toggle`,"aria-expanded":o,"aria-controls":`setup-check-rows`,onClick:()=>s(e=>!e),children:[I(Vr,{size:13,"aria-hidden":`true`}),I(`span`,{className:`setup-result-label`,children:a(`setup.checks.allPassed`,{n:String(g.length)})}),I(Yr,{size:13,className:o?`is-open`:``,"aria-hidden":`true`})]})}),o&&y]}):z(`section`,{className:`setup-card`,"aria-label":a(`setup.check.title`),children:[I(`div`,{className:`setup-bar-head`,children:i?I(`span`,{children:a(`setup.checks.waitingChoice`)}):z(P.Fragment,{children:[I(`span`,{children:a(`setup.checks.count`,{done:String(_),total:String(g.length)})}),z(`bdi`,{dir:`ltr`,children:[v,`%`]})]})}),I(`progress`,{className:`setup-progress`,max:100,value:v,"aria-label":a(`setup.check.title`)}),y]})}function RK({steps:e}){let t=R();return z(`nav`,{className:`setup-rail`,"aria-label":t(`setup.rail.label`),children:[I(`p`,{className:`setup-rail-title`,children:t(`setup.title`)}),I(`ol`,{className:`setup-rail-list`,children:e.map((e,t)=>{let n=e.status===`done`?I(Vr,{size:13,"aria-hidden":`true`}):e.status===`active`?I(La,{size:13,className:`spin`,"aria-hidden":`true`}):e.status===`failed`?I(ri,{size:13,"aria-hidden":`true`}):t+1,r=z(P.Fragment,{children:[I(`span`,{className:`setup-rail-num`,children:n}),I(`span`,{children:e.label})]}),i=`setup-rail-step is-${e.status}${e.shown?` is-shown`:``}`,a=e.shown?`step`:void 0;return I(`li`,{children:e.onOpen?I(`button`,{type:`button`,className:i,onClick:e.onOpen,children:r}):I(`span`,{className:i,"aria-current":a,children:r})},e.id)})})]})}var zK={memory:`setup.test.why.memory`,broken:`setup.test.why.broken`,stuck:`setup.test.why.stuck`,missing:`setup.test.why.missing`,agent:`setup.test.why.agent`,answer:`setup.test.why.answer`,window:`setup.test.why.window`};function BK(e,t){return t(`setup.test.job.${e}`)}function VK({state:e}){return e===`passed`?I(Vr,{size:13,"aria-hidden":`true`}):e===`running`?I(La,{size:13,className:`spin`,"aria-hidden":`true`}):I(e===`failed`?Is:e===`skipped`?Ya:li,{size:13,"aria-hidden":`true`})}function HK(e,t){return e.state===`running`?t(`setup.test.running`):e.state===`failed`?t(`setup.test.failed`):e.state===`skipped`?t(`setup.test.skipped`):e.seconds==null?t(`setup.test.passed`):t(`setup.test.passedIn`,{seconds:String(Math.round(e.seconds))})}function UK({run:e,expected:t,names:n,catalog:r,onRetry:i,onChooseAnother:a,onCancel:o,onDownloadAgain:s,busy:c}){let l=R(),u=e.tests??[],d=new Set(u.map(e=>e.job)),f=t.filter(e=>!d.has(e)),p=u.filter(e=>e.state!==`running`).length,m=Math.max(u.length+f.length,1),h=Math.round(p/m*100),g=u.filter(e=>e.state===`failed`).filter(e=>!r.find(t=>t.id===e.subject)?.roles.some(e=>[`speech`,`voice`,`image_creation`].includes(e))),_=e.state===`failed`||e.state===`cancelled`,v=s?[...new Set(g.filter(e=>e.kind===`broken`&&e.subject).map(e=>e.subject))]:[],[y,b]=(0,V.useState)(null),x=r.find(e=>e.id===y)?.full_size_gb,S=_&&e.components?.agent===`failed`,C=g.some(e=>e.subject&&e.kind!==`missing`),w=e.state===`verifying`&&!u.some(e=>e.state===`running`)?f[0]:void 0;return z(P.Fragment,{children:[z(`section`,{className:`setup-card`,"aria-label":l(`setup.test.title`),children:[z(`div`,{className:`setup-bar-head`,children:[I(`span`,{children:l(`setup.test.count`,{done:String(p),total:String(m)})}),z(`bdi`,{dir:`ltr`,children:[h,`%`]})]}),I(`progress`,{className:`setup-progress`,max:100,value:h,"aria-label":l(`setup.test.title`)}),z(`ul`,{className:`setup-rows`,children:[u.map(e=>z(`li`,{className:`setup-result is-${e.state}`,children:[I(VK,{state:e.state}),z(`span`,{className:`setup-result-label`,children:[BK(e.job,l),e.subject&&z(`bdi`,{className:`setup-result-model`,children:[` `,n[e.subject]??xc(e.subject)]})]}),I(`span`,{className:`setup-result-value`,children:HK(e,l)}),e.error&&z(`div`,{className:`setup-result-error`,children:[I(`p`,{children:l(e.kind===`broken`&&!s?`setup.test.why.brokenYours`:zK[e.kind??``]??`setup.test.why.other`)}),z(`details`,{className:`dl-details`,children:[I(`summary`,{children:l(`setup.progress.details`)}),I(`pre`,{dir:`ltr`,children:e.error})]})]})]},`${e.job}:${e.subject??``}`)),f.map(e=>e===`agent`&&S?z(`li`,{className:`setup-result is-failed`,children:[I(VK,{state:`failed`}),I(`span`,{className:`setup-result-label`,children:BK(e,l)}),I(`span`,{className:`setup-result-value`,children:l(`setup.test.failed`)}),I(`div`,{className:`setup-result-error`,children:I(`p`,{children:l(`setup.test.why.hub`)})})]},e):e===w?z(`li`,{className:`setup-result is-running`,children:[I(VK,{state:`running`}),I(`span`,{className:`setup-result-label`,children:BK(e,l)}),I(`span`,{className:`setup-result-value`,children:l(`setup.test.starting`)})]},e):z(`li`,{className:`setup-result is-waiting`,children:[I(VK,{state:`waiting`}),I(`span`,{className:`setup-result-label`,children:BK(e,l)}),I(`span`,{className:`setup-result-value`,children:l(`setup.test.waiting`)})]},e))]})]}),e.state===`verifying`&&o&&I(DG,{children:I(`button`,{type:`button`,className:`btn-secondary`,onClick:o,disabled:c,children:l(`setup.progress.cancel`)})}),_&&z(`div`,{className:`setup-failure`,role:`alert`,children:[I(`p`,{children:e.state===`cancelled`?l(`setup.test.cancelled`):g.some(e=>e.kind===`memory`)?l(`setup.test.failedMemory`):l(`setup.test.failedHelp`)}),z(DG,{children:[C&&a&&I(`button`,{type:`button`,className:`btn-secondary`,onClick:a,disabled:c,children:l(`setup.test.chooseAnother`)}),I(`button`,{type:`button`,className:v.length?`btn-secondary`:`btn-primary`,onClick:i,disabled:c,children:l(`setup.test.tryAgain`)}),v.map(e=>I(`button`,{type:`button`,className:`btn-primary setup-wrap-btn`,onClick:()=>b(e),disabled:c,children:v.length===1?l(`setup.test.downloadItAgain`):l(`setup.test.downloadAgain`,{name:n[e]??e})},e))]})]}),y&&I(OG,{title:l(`setup.redownload.title`,{name:n[y]??y}),confirmLabel:l(`setup.redownload.confirm`),cancelLabel:l(`setup.redownload.keep`),onConfirm:()=>{let e=y;b(null),s?.(e)},onCancel:()=>b(null),children:I(`p`,{children:l(`setup.redownload.body`,{name:n[y]??y,size:x==null?``:BO(x)})})})]})}var WK=`https://app.fireworks.ai/settings/users/api-keys`,GK=`https://amd-gaia.ai/docs/guides/llm-gateway`,KK=[{id:`local`,title:`setup.where.local`,note:`setup.where.localNote`},{id:`fireworks`,title:`Fireworks AI`,note:`setup.where.fireworksNote`},{id:`amd`,title:`AMD LLM Gateway`,note:`setup.where.amdNote`}];function qK(e,t){return ae(e.title)?t(e.title):e.title}var JK=1e3,YK=`gaia-setup-choice`;function XK(){try{let e=localStorage.getItem(YK);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 ZK(e){try{localStorage.setItem(YK,e)}catch(e){console.warn(`[SetupScreen] could not save the provider choice; a reload will ask again`,e)}}var QK=[`ok`,`needs_key`,`too_old`];function $K({onChosen:e,onNothingToOffer:t,onFound:n,canInstallOwn:r=!0}){let i=R(),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)([]),[d,f]=(0,V.useState)(!1),[p,m]=(0,V.useState)(``),[h,g]=(0,V.useState)(!1),[_,v]=(0,V.useState)(!1),[y,b]=(0,V.useState)(null),[x,S]=(0,V.useState)(null),[C,w]=(0,V.useState)(null),[T,E]=(0,V.useState)(`gaia`),D=(0,V.useRef)(!0),O=(0,V.useCallback)(async()=>{c(null);try{let e=await Ce();if(!e.offer){t?.();return}f(!0);let{found:r,unchecked:i=[]}=await St();if(!D.current)return;u(r?[]:i),r&&QK.includes(r.status)?(o({target:e,found:r}),n?.(r),g(r.status===`needs_key`),r.status===`too_old`&&t?.()):i.length===0&&t?.()}catch(e){D.current&&c(e instanceof Error?e.message:String(e))}finally{D.current&&f(!1)}},[t,n]);(0,V.useEffect)(()=>(D.current=!0,O(),()=>{D.current=!1}),[O]);let k=(0,V.useCallback)(async t=>{if(a){b(t),S(null);try{await Ue(t===`external`?{mode:t,base_url:a.found.url,api_key:p.trim()||void 0}:{mode:t}),m(``),w(t),e(t)}catch(e){TW(e)&&g(!0),S(e instanceof Error?e.message:String(e))}finally{b(null)}}},[a,p,e]);if(s||l.length>0)return z(P.Fragment,{children:[I(`p`,{className:`setup-hint`,children:s?i(`setup.offer.checkFailed`):i(`setup.offer.noAnswer`,{url:l.join(`, `)})}),s&&z(`details`,{className:`dl-details`,children:[I(`summary`,{children:i(`setup.progress.details`)}),I(`pre`,{dir:`ltr`,children:s})]}),z(DG,{children:[z(`button`,{type:`button`,className:`btn-secondary`,disabled:d,onClick:()=>void O(),children:[d&&I(La,{size:13,className:`spin`}),` `,i(`setup.offer.checkAgain`)]}),t&&r&&I(`button`,{type:`button`,className:`btn-primary`,disabled:d,onClick:t,children:i(`setup.offer.useOwn`)})]})]});if(!a)return d?z(`p`,{className:`setup-hint`,role:`status`,children:[I(La,{size:13,className:`spin`,"aria-hidden":`true`}),` `,i(`setup.offer.looking`)]}):null;let{target:ee,found:te}=a;return C?I(`p`,{className:`setup-hint`,role:`status`,children:C===`external`?i(`setup.offer.usingYours`,{url:te.url}):i(`setup.offer.usingOwn`)}):te.status===`too_old`?z(`p`,{className:`setup-hint`,role:`status`,children:[i(`setup.offer.tooOld`),` `,z(`bdi`,{dir:`ltr`,className:`setup-choice-note`,children:[`Lemonade `,te.version??``,` · `,te.url]})]}):z(`form`,{id:`setup-lemonade-form`,className:`setup-lemonade`,"aria-label":i(`setup.offer.label`),onSubmit:e=>{e.preventDefault(),k(T)},children:[z(`fieldset`,{className:`setup-choices`,disabled:!!y,children:[I(`legend`,{className:`setup-choice-title`,children:i(`setup.offer.title`)}),[{mode:`gaia`,title:`setup.offer.useOwn`,note:`setup.offer.ownNote`},{mode:`external`,title:`setup.offer.useMine`,note:`setup.offer.mineNote`}].map(e=>z(`label`,{className:`setup-choice${T===e.mode?` is-active`:``}`,children:[I(`input`,{type:`radio`,name:`setup-server`,value:e.mode,checked:T===e.mode,onChange:()=>{E(e.mode),S(null)}}),z(`span`,{children:[z(`span`,{className:`setup-choice-title`,children:[i(e.title),e.mode===`gaia`&&I(`span`,{className:`setup-choice-tag`,children:i(`setup.offer.recommended`)})]}),I(`span`,{className:`setup-choice-note`,children:i(e.note)})]})]},e.mode))]}),z(`button`,{type:`button`,className:`setup-log-toggle setup-offer-more`,onClick:()=>v(e=>!e),"aria-expanded":_,"aria-controls":`setup-offer-detail`,children:[I(Yr,{size:13,className:_?`is-open`:``,"aria-hidden":`true`}),` `,i(`setup.offer.whatGaiaDoes`)]}),_&&z(`div`,{id:`setup-offer-detail`,children:[I(`p`,{className:`setup-choice-note`,children:z(`bdi`,{dir:`ltr`,children:[`Lemonade`,te.version?` ${te.version}`:``,` · `,te.url]})}),I(`p`,{className:`setup-choice-note`,children:i(`setup.offer.whatGaiaDoesText`)})]}),T===`external`&&h&&I(`input`,{className:`settings-input`,type:`password`,autoComplete:`off`,value:p,onChange:e=>m(e.target.value),placeholder:i(`setup.offer.keyPlaceholder`),"aria-label":i(`setup.offer.keyLabel`)}),x&&(h&&T===`external`?I(`p`,{className:`setup-error`,role:`alert`,children:i(`setup.offer.keyRejected`)}):I(tq,{text:x})),I(DG,{children:z(`button`,{type:`submit`,form:`setup-lemonade-form`,className:`btn-primary`,disabled:!!y||T===`external`&&h&&!p.trim(),children:[y&&I(La,{size:13,className:`spin`}),` `,i(`setup.continue`)]})})]})}function eq({problem:e,onRetry:t,onUseGaia:n}){let r=R(),i=e.kind===`server_too_old`&&e.use_gaia;return z(P.Fragment,{children:[e.start&&z(`details`,{className:`dl-details`,children:[I(`summary`,{children:r(`setup.server.howToStart`)}),I(`pre`,{dir:`ltr`,children:e.start})]}),z(DG,{children:[I(`button`,{type:`button`,className:i?`btn-secondary`:`btn-primary`,onClick:t,children:r(`setup.tryAgain`)}),e.use_gaia&&I(`button`,{type:`button`,className:i?`btn-primary`:`btn-secondary`,onClick:n,children:r(`setup.server.useGaia`)})]}),e.use_gaia&&I(`p`,{className:`setup-hint`,children:r(`setup.server.useGaiaNote`)}),e.use_gaia&&e.env_url&&I(`p`,{className:`setup-hint`,children:r(`setup.server.envIgnoredNote`,{url:e.env_url})})]})}function tq({text:e}){let t=R();return z(`div`,{className:`setup-error`,role:`alert`,children:[I(`p`,{children:t(`setup.failedLead`)}),z(`details`,{className:`dl-details`,children:[I(`summary`,{children:t(`setup.progress.details`)}),I(`pre`,{dir:`ltr`,children:e})]})]})}function nq({run:e}){let t=R();return e.problem?z(`div`,{className:`setup-error`,role:`alert`,children:[I(`p`,{children:t(e.problem.kind===`server_too_old`?`setup.server.tooOld`:`setup.server.unreachable`)}),z(`details`,{className:`dl-details`,children:[I(`summary`,{children:t(`setup.progress.details`)}),I(`pre`,{dir:`ltr`,children:e.problem.message})]})]}):z(`div`,{className:`setup-error`,role:`alert`,children:[I(`p`,{children:t(e.components?.server===`failed`?`setup.server.ownFailed`:`setup.stopped`)}),e.error&&z(`details`,{className:`dl-details`,children:[I(`summary`,{children:t(`setup.progress.details`)}),I(`pre`,{dir:`ltr`,children:e.error})]})]})}var rq=[`check`,`plan`,`key`,`models`,`gpu`,`download`,`test`,`ready`];function iq(e){return e instanceof Error?e.message:String(e)}function aq({onReady:e,onClose:t}){let n=R(),r=_c(e=>e.refresh),i=_c(e=>e.select),[a,o]=(0,V.useState)(`local`),[s,c]=(0,V.useState)(`check`),[l,u]=(0,V.useState)(!1),[d,p]=(0,V.useState)(`models`),[m,h]=(0,V.useState)(null),[g,_]=(0,V.useState)(null),[v,y]=(0,V.useState)(()=>new Set([`check`])),b=(0,V.useRef)(`check`),[x,S]=(0,V.useState)(null),[C,w]=(0,V.useState)(null),[T,E]=(0,V.useState)(null),[D,O]=(0,V.useState)(null),[k,te]=(0,V.useState)(null),[ne,A]=(0,V.useState)(``),[ie,ae]=(0,V.useState)({busy:!1,error:null,done:!1}),[j,oe]=(0,V.useState)(null),[se,ce]=(0,V.useState)(null),[ue,de]=(0,V.useState)(null),[fe,pe]=(0,V.useState)(null),[me,he]=(0,V.useState)(null),[M,ge]=(0,V.useState)(null),[_e,ve]=(0,V.useState)(!1),[ye,be]=(0,V.useState)(null),[xe,we]=(0,V.useState)(!1),[Te,Ee]=(0,V.useState)(!1),[De,Oe]=(0,V.useState)(null),[Ae,je]=(0,V.useState)(!1),[Me,Pe]=(0,V.useState)(null),[Fe,Ie]=(0,V.useState)(null),[Le,Re]=(0,V.useState)(null),[ze,Be]=(0,V.useState)(!1),[Ve,He]=(0,V.useState)([]),[Ue,We]=(0,V.useState)([]),[Ge,Ke]=(0,V.useState)([]),[Je,Ye]=(0,V.useState)(!1),[Xe,Ze]=(0,V.useState)(!1),Qe=(0,V.useRef)({gaiaLemonade:!1,options:{}}),$e=(0,V.useRef)(null),tt=(0,V.useRef)(!1),nt=(0,V.useRef)(!1),[rt,at]=(0,V.useState)(!1),[ot,st]=(0,V.useState)(!1),ct=(0,V.useCallback)(()=>st(!0),[]),[lt,ut]=(0,V.useState)(null),[ft,pt]=(0,V.useState)(null),mt=(0,V.useRef)(!0);(0,V.useEffect)(()=>(mt.current=!0,()=>{mt.current=!1}),[]);let{network:ht,providers:gt,recheck:_t}=GG(),vt=e=>gt.find(t=>t.id===e),yt=vt(a),bt=yt?.key_source===`environment`&&yt.key_hint?yt:void 0,xt=e=>!!vt(e)?.blocked,St=ht?.reachable!==!1||a===`amd`,Ct=yt?.key_source===`stored`||yt?.key_source===`lemonade`,wt=xt(`fireworks`)&&xt(`amd`),Tt=e=>xt(e)||e===`amd`&&ht?.reachable===!1,Et=e=>xt(e)?n(`settings.privacy.localOnlyBlocked`):n(`setup.key.gatewayOff`),Dt=a!==`local`,Ot=T?.server_only?T:null,kt=T&&!T.server_only?T:null,At=T?.state===`running`||T?.state===`verifying`,jt=kt?.state===`ready`,Mt=aK(T),Pt=!(kt?.models??[]).some(e=>e.state===`downloading`||e.state===`queued`)&&((kt?.tests?.length??0)>0||kt?.state===`verifying`),Ft=(0,V.useCallback)(()=>{w(null),re().then(S).catch(e=>w(iq(e)))},[]),It=(0,V.useRef)(0),Lt=(0,V.useCallback)(async()=>{let e=++It.current;ce(null);try{let t=await qe(!1);return e===It.current?(oe(t),t):null}catch(t){return e===It.current&&ce(iq(t)),null}},[]),Rt=(0,V.useCallback)(async()=>{try{let e=await f();mt.current&&ge(e??null)}catch(e){console.warn(`[SetupScreen] GPU memory could not be read; the step stays hidden`,e)}},[]),zt=t!=null;(0,V.useEffect)(()=>{Ce().then(e=>Ye(e.source===`config`)).catch(e=>console.warn(`[SetupScreen] could not read which Lemonade GAIA uses`,e)),Ft(),Lt(),et().then(e=>{e.state===`idle`&&!e.models?.length||zt&&e.state!==`running`&&e.state!==`verifying`||(E(e),e.server_only||c(`download`),e.skip_chat_model&&o(XK()===`amd`?`amd`:`fireworks`))}).catch(e=>te(iq(e))).finally(()=>at(!0))},[Ft,Lt,zt]),(0,V.useEffect)(()=>{j?.catalog&&j.lemonade.reachable&&(de(e=>e??JW(j)),Rt(),!T&&j.catalog.some(e=>e.partial&&e.selected)&&je(!0))},[j,Rt,T]);let Bt=(0,V.useCallback)(()=>{$e.current&&clearInterval($e.current),$e.current=null},[]),Vt=(T?.models??[]).filter(e=>e.state===`failed`&&e.error_kind===`disk_full`).length;(0,V.useEffect)(()=>{Vt>0&&Lt()},[Vt,Lt]);let Ht=(0,V.useCallback)(async()=>{try{let e=await et();if(O(null),e.state===`idle`&&!e.models?.length){E(null),c(`plan`),Ze(!0),Lt();return}E(e)}catch(e){O(iq(e))}},[Lt,n]);(0,V.useEffect)(()=>(!Mt&&!D||($e.current=setInterval(()=>{Ht()},JK)),Bt),[Mt,D,Ht,Bt]),(0,V.useEffect)(()=>{Ot&&Ot.state===`ready`&&(Ft(),Lt())},[Ot,Ot?.state,Ft,Lt]),(0,V.useEffect)(()=>{jt&&(Ft(),Lt().then(e=>{e&&he(e)}),Rt())},[jt,Ft,Lt,Rt]);let F=(0,V.useRef)(!1),Ut=(0,V.useCallback)(async(e=!1,t={})=>{if(F.current)return!1;F.current=!0,te(null),Oe(null),je(!1),Ze(!1);try{ZK(a),Qe.current={gaiaLemonade:e,options:t};let n=await Ne(Dt,e,t);E(n),_(null);let r=t.extraModels??[];return r.length&&Ke(e=>e.filter(e=>!r.includes(e))),t.serverOnly||c(`download`),e&&Ye(!1),!0}catch(e){let t=it(e);if(t)return be({kind:`server`,detail:t,then:`run`}),!1;if(e instanceof Nt&&e.httpStatus===409){let e=await et().catch(()=>null);if(e&&(e.state===`running`||e.state===`verifying`))return E(e),_(null),e.server_only||c(`download`),!0}return te(iq(e)),!1}finally{F.current=!1}},[a,Dt]);(0,V.useEffect)(()=>{s===`check`&&rt&&ot&&j&&!j.lemonade.reachable&&!T&&!tt.current&&(tt.current=!0,Ut(!1,{serverOnly:!0}))},[s,rt,ot,j,T,Ut]);let Wt=!!(ue&&j?.catalog&&j.lemonade.reachable&&(x||C)),Gt=(0,V.useCallback)(()=>{let{gaiaLemonade:e,options:t}=Qe.current;Ut(e,t)},[Ut]),Kt=(0,V.useCallback)((e,t=j)=>{pe(t);let n=t&&ue&&!Dt?iG(t,ue):[];return Ut(!1,{acknowledgeLowDisk:e,keepTrying:_e,extraModels:n})},[j,ue,Dt,_e,Ut]),[qt,Yt]=(0,V.useState)(!1),Xt=(0,V.useRef)(!1),Zt=(0,V.useCallback)(async(e,t=xe)=>{if(!j||!ue||Xt.current)return;Oe(null),Yt(e);let r=NW(j),i=Dt?[]:nG(r,ue).filter(e=>!e.downloaded||e.id===ue.defaultChat),a=i.find(LW);if(a){let e=a.id===ue.defaultChat?`setup.models.cantRun.chat`:`setup.models.cantRun.other`;Oe(n(e,{name:a.name,why:fG(a,n)}))}else if(!Dt&&!t&&i.length>0&&i.every(e=>e.need_gb!=null))be({kind:`no_fit`,models:i});else{Ee(!0),Xt.current=!0;try{let n=j;if(!Dt&&ue.defaultChat&&ue.defaultChat!==n.chat_model.id)try{n=await Se(ue.defaultChat,t,!1)}catch(e){let t=it(e);if(t){be({kind:`server`,detail:t,then:`chat`});return}throw e}if(!Dt){await bK();let e=WW(r,ue);e!==(n.vision_model??null)&&(n=await ke(e,!1));for(let e of rG(n,ue))n=await dt(e.id,e.skipped,!1)}oe(n),await Kt(e,n)}catch(e){Oe(iq(e))}finally{Xt.current=!1,Ee(!1)}}},[j,ue,Dt,xe,Kt,n]),Qt=(0,V.useCallback)(e=>{Oe(null),s===`download`?_(e===b.current?null:e):(_(null),c(e===`test`||e===`ready`?`download`:e))},[s]),L=(0,V.useCallback)(()=>{g??o(`local`),Qt(`plan`)},[Qt,g]),$t=(0,V.useCallback)(()=>{At&&g!=null||(o(`local`),u(!0),Qt(`models`))},[Qt,At,g]),[en,tn]=(0,V.useState)(`local`),nn=_c(e=>e.active?.remote&&e.active.provider!==`local`?e.active.provider:null),rn=_c(e=>e.active?.remote?e.active.model:null),an=(0,V.useCallback)(e=>{At&&g!=null||(u(!1),o(e),tn(`cloud`),Ie(e===nn?rn:null),Qt(`key`))},[Qt,At,g,nn,rn]),on=(0,V.useCallback)(()=>an(XK()===`amd`?`amd`:`fireworks`),[an]),sn=(0,V.useCallback)(()=>{nn?an(nn):Qt(`plan`)},[nn,an,Qt]),cn=!!M?.applies,ln=(0,V.useCallback)(()=>{Qt((g??s)===`gpu`?d:`plan`)},[d,Qt,g,s]),un=(0,V.useCallback)(e=>{p(e),Qt(`gpu`)},[Qt]),dn=(0,V.useRef)({prev:null,next:null});(0,V.useEffect)(()=>{let e=e=>{if(!e.altKey||ye||(e.target instanceof Element?e.target:null)?.closest(`input, textarea, select, [contenteditable="true"]`))return;let t=e.key===`ArrowLeft`?dn.current.prev:e.key===`ArrowRight`?dn.current.next:null;t&&(e.preventDefault(),Qt(t))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[Qt,ye]);let fn=(0,V.useCallback)(async()=>{try{await Jt(),await Ht()}catch(e){Oe(iq(e))}},[Ht]),pn=(0,V.useCallback)(async(e,t)=>{Oe(null),Ee(!0);try{t===`verify`&&await le(e),t===`disk_full`&&Lt();try{E(await N(e,{keepTrying:_e}))}catch(t){let n=it(t);if(!n)throw t;be({kind:`server`,detail:n,then:`retry`,id:e})}}catch(e){Oe(iq(e))}finally{Ee(!1)}},[_e,Lt]),mn=(0,V.useCallback)(async e=>{Oe(null),Ee(!0);try{j?.catalog?.find(t=>t.id===e)?.planned&&oe(await dt(e,!0,!1)),E(t=>t&&{...t,models:t.models?.map(t=>t.id===e?{...t,state:`skipped`}:t)});let{options:t}=Qe.current;Qe.current.options={...t,extraModels:t.extraModels?.filter(t=>t!==e)},de(t=>t&&t.ticked.has(e)?XW(t,NW(j),e,!1):t)}catch(e){Oe(iq(e))}finally{Ee(!1)}},[j]),hn=(0,V.useCallback)(async()=>{await fn(),Gt()},[fn,Gt]),gn=(0,V.useCallback)(async()=>{if(!At){ae({busy:!0,error:null,done:!1});try{await _n(a,{api_key:!Je&&ne||void 0},e=>ae({busy:!0,error:null,done:!1,waiting:e}),()=>!mt.current);let{models:e}=await Nn(a),t=Fe??Le,r=t?e.find(e=>e.id===t):e.find(e=>e.rank===1)??e[0];if(!r)throw Error(t?n(`setup.key.modelNotOffered`,{model:Oc(t)}):n(`setup.key.noModels`));await i(r.id),Pe(r.id),A(``),ae({busy:!1,error:null,done:!0}),Kt(!1)}catch(e){ae({busy:!1,error:iq(e),done:!1})}}},[a,ne,Fe,Le,i,Je,Kt,n,At]),vn=(0,V.useCallback)(e=>{ZK(e),o(e),Ie(e===nn?rn:null),Re(null),ae({busy:!1,error:null,done:!1})},[nn,rn]);(0,V.useEffect)(()=>{if(!jt||Ue.length===0||nt.current)return;let e=Ue;nt.current=!0,Ut(!1,{keepTrying:_e,extraModels:e}).then(t=>{nt.current=!1,We(t=>t.filter(t=>!e.includes(t))),t||Ke(t=>[...t,...e.filter(e=>!t.includes(e))])})},[jt,Ue,_e,Ut]);let yn=jt&&Ue.length===0,bn=Dt?Me:kt?.chat_model??(j&&!j.decided_after_server?j.chat_model.id:null),xn=(0,V.useCallback)(async t=>{Oe(null);try{!Dt&&bn&&await i(bn),await r()}catch(e){Oe(iq(e));return}e(t)},[bn,Dt,e,r,i]);(0,V.useEffect)(()=>{yn&&ee().then(e=>He(e.cards)).catch(e=>console.warn(`[SetupScreen] no first tasks to offer`,e))},[yn]);let Sn=(0,V.useMemo)(()=>{let e={};for(let t of j?.catalog??[])e[t.id]=t.name;return e},[j]),Cn=T?.state===`failed`||T?.state===`cancelled`,wn=T?.state===`failed`||!!k||!!se||!!C||!!D||!!De,Tn=zt?Ve:Ve.filter(e=>e.skill!==`check-in`),En=kt&&(kt.state===`failed`||kt.state===`cancelled`)&&(kt.models??[]).length>0&&(kt.models??[]).every(e=>e.state===`ready`||e.state===`skipped`||e.state===`verifying`||e.state===`unchecked`)&&!Mt,Dn=!!kt&&Cn&&!kt.problem&&Object.values(kt.components??{}).includes(`failed`),On=NW(j),kn=ue?$W(On,ue):[],An=j&&ue?tG(j,ue):null,jn=ue?On.filter(e=>ue.ticked.has(e.id)&&e.downloaded).length:0,Mn=On.some(e=>e.downloaded),Pn=Wt?jn===0?Mn?`setup.check.ledeOthersOnPc`:`setup.check.ledeDone`:kn.length===0?`setup.check.ledeAllOnPc`:`setup.check.ledeSomeOnPc`:`setup.check.lede`,Fn=On.find(e=>e.id===ue?.defaultChat),In=!!x&&!x.compatible&&x.blockers.length>0,Ln=yn?`ready`:s===`download`&&Pt?`test`:s;b.current=Ln;let Rn=g??Ln;(0,V.useEffect)(()=>{y(e=>e.has(Rn)?e:new Set(e).add(Rn))},[Rn]);let zn=(0,V.useRef)(!0);(0,V.useEffect)(()=>{if(zn.current){zn.current=!1;return}let e=document.querySelector(`.setup-scroll`);e&&(e.scrollTop=0),document.getElementById(`setup-title`)?.focus({preventScroll:!0})},[Rn]);let Bn=[{id:`check`,label:n(`setup.check.title`),key:`setup.check.title`},{id:`plan`,label:n(`setup.plan.step`),key:`setup.plan.step`},{id:`download`,label:n(`setup.download.step`),key:`setup.download.step`},{id:`test`,label:n(`setup.test.step`),key:`setup.test.step`},{id:`ready`,label:n(`setup.ready.step`),key:`setup.ready.step`}],Vn=e=>e===`models`||e===`key`?`plan`:e===`gpu`?d===`check`?`check`:`plan`:e,Hn=Dt?`key`:l?`models`:`plan`,Un=Bn.findIndex(e=>e.id===Vn(Ln)),Wn=e=>e===`download`||e===`test`||e===`ready`,Gn=[];if(x){let e=[j?.system?.physical_memory?`${HO(j.system.physical_memory,null)} installed`:null,x.ram_gb==null?null:`${x.ram_gb} GB the OS can use`].filter(Boolean).join(`, `),t=x.disk_free_gb==null?null:`${Math.round(x.disk_free_gb)} GB free on disk`;Gn.push(`This PC: ${[x.gpu_name,x.npu_detected?`NPU`:null].filter(Boolean).join(`, `)||`no GPU reported`}`+[e,t].filter(Boolean).map(e=>`; ${e}`).join(``))}else C&&Gn.push(`Couldn't read this PC: ${C}`);lt&&(Gn.push(`Found your Lemonade${lt.version?` ${lt.version}`:``} at ${lt.url}`),Gn.push(ft===`external`?`You chose your own Lemonade`:ft===`gaia`?`You chose GAIA's own Lemonade`:`Waiting for you to choose which Lemonade GAIA uses`)),j&&(!lt||ft)?Gn.push(j.lemonade.reachable?`Model server answering at ${j.lemonade.url??`its address`}`:`No model server answering yet`):se&&Gn.push(`Couldn't read the model list: ${se}`);let Kn=(e,t)=>t<=Un||v.has(e)&&!Wn(e),qn=Bn.map((e,t)=>({id:e.id,label:e.label,status:t<Un?`done`:t>Un?`pending`:Ln===`ready`?`done`:Cn&&(Ln===`download`||Ln===`test`||Ln===`check`)?`failed`:At&&(Ln===`download`||Ln===`test`)?`active`:`current`,shown:e.id===Vn(Rn),onOpen:e.id!==Vn(Rn)&&Kn(e.id,t)?()=>Qt(e.id===`plan`?Hn:e.id):void 0})),B=Bn.findIndex(e=>e.id===Vn(Rn)),Jn=Rn===`gpu`&&d===`check`?.5:rq.indexOf(Rn),Yn=(0,V.useRef)(Jn),Xn=(0,V.useRef)(`forward`);Yn.current!==Jn&&(Xn.current=Jn>Yn.current?`forward`:`back`,Yn.current=Jn);let Zn=Rn===`gpu`?d:Rn===`models`||Rn===`key`?`plan`:B>0?Bn[B-1].id===`plan`?Hn:Bn[B-1].id:null,Qn=(Rn!==`gpu`&&B>=0&&B<Bn.length-1&&Kn(Bn[B+1].id,B+1)?Bn[B+1].id:null)??(g==null?Rn===`check`&&Wt?`plan`:Rn===`gpu`?d:null:null);dn.current={prev:Zn,next:Qn};let $n=Rn===`gpu`||Rn===`models`||Rn===`key`,er=g!=null&&At,tr=[`server`];Dt||tr.push(`chat`),!Dt&&ue&&BW(On,ue)&&tr.push(`vision`),ue&&On.some(e=>FW(e)&&ue.ticked.has(e.id))&&tr.push(`embedding`);for(let e of On)ue&&RW(e)&&ue.ticked.has(e.id)&&!e.downloaded&&tr.push(e.roles[0]);tr.push(`agent`);let nr=Dt&&ie.done&&Me?z(`p`,{className:`setup-ok setup-key-accepted`,role:`status`,children:[I(Vr,{size:14,"aria-hidden":`true`}),` `,n(`setup.key.accepted`,{model:Oc(Me)})]}):null,rr=ue&&!Dt?On.filter(e=>RW(e)&&!ue.ticked.has(e.id)&&!e.downloaded&&(zW(Fn)||!e.roles.includes(`image_creation`))):[],ir=On.find(e=>e.fit_code===`memory`&&e.chat_choice&&e.support===`verified`);return z(`main`,{className:`setup`,"aria-labelledby":`setup-title`,children:[I(RK,{steps:qn}),I(EG,{value:m,children:z(`div`,{className:`setup-pane`,children:[I(`div`,{className:`setup-scroll`,children:z(`div`,{className:`setup-inner`,children:[B>=0&&z(`nav`,{className:`setup-topnav`,"aria-label":n(`setup.nav.label`),children:[I(`button`,{type:`button`,className:`setup-arrow`,onClick:()=>Zn&&Qt(Zn),disabled:!Zn,"aria-label":n(`setup.nav.prev`),children:I(qr,{size:16,"aria-hidden":`true`})}),I(`button`,{type:`button`,className:`setup-arrow`,onClick:()=>Qn&&Qt(Qn),disabled:!Qn,"aria-label":n(`setup.nav.next`),children:I(Yr,{size:16,"aria-hidden":`true`})}),I(`span`,{children:I(`bdi`,{children:n(`setup.nav.stepOf`,{n:String(B+1),total:String(Bn.length)})})}),g!=null&&g!==Ln&&I(`button`,{type:`button`,className:`link-btn`,onClick:()=>_(null),children:n.compose(e=>e(`setup.nav.toLive`,{step:e(Bn.find(e=>e.id===Ln)?.key??`setup.download.step`)}))}),I(hK,{})]}),Ae&&s!==`download`&&z(`div`,{className:`setup-banner`,role:`status`,children:[I(ya,{size:14,"aria-hidden":`true`}),I(`span`,{children:n(`setup.resume.banner`)})]}),Xe&&s!==`download`&&I(`p`,{className:`setup-hint`,role:`status`,children:n(`setup.interrupted`)}),z(`div`,{className:`setup-stage is-${Xn.current}`,children:[Rn===`check`&&z(P.Fragment,{children:[I(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(Wt?`setup.check.headingDone`:`setup.check.heading`)}),I(`p`,{className:`setup-lede`,children:n(Pn)}),I(LK,{hardware:x,hardwareError:C,plan:j,serverRun:Ot,awaitingChoice:!!lt&&!ot}),Ot?.state===`running`&&z(P.Fragment,{children:[I(lK,{run:Ot,idle:n(`setup.check.serverWorking`),bar:!1}),I(DG,{children:I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void fn(),children:n(`setup.progress.cancel`)})})]}),Wt&&j&&I(FK,{plan:j,hardware:x,onChangeMemory:cn&&g==null?()=>un(`check`):void 0}),Wt&&g==null&&!(lt&&!ot)&&I(DG,{children:I(`button`,{type:`button`,className:`btn-primary`,onClick:sn,children:n(`setup.continue`)})}),Ot&&Cn&&z(P.Fragment,{children:[I(nq,{run:Ot}),Ot.problem?I(eq,{problem:Ot.problem,onRetry:()=>void Ut(!1,{serverOnly:!0}),onUseGaia:()=>void Ut(!0,{serverOnly:!0})}):I(DG,{children:I(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void Ut(!!Ot.gaia_lemonade,{serverOnly:!0}),children:n(`setup.tryAgain`)})})]}),se&&!j&&z(P.Fragment,{children:[I(tq,{text:se}),z(DG,{children:[I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void Ut(!1,{keepTrying:_e}),children:n(`setup.models.useRecommended`)}),I(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void Lt(),children:n(`setup.tryAgain`)})]}),I(`p`,{className:`setup-hint`,children:n(`setup.models.useRecommendedNote`)})]}),k&&I(tq,{text:k}),k&&!Ot&&j&&!j.lemonade.reachable&&I(DG,{children:I(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void Ut(!1,{serverOnly:!0}),children:n(`setup.tryAgain`)})}),rt&&j&&(!j.lemonade.reachable&&!Ot||Wt&&g==null&&j.lemonade.mode!==`external`)&&I($K,{onNothingToOffer:ct,canInstallOwn:!j.lemonade.reachable&&!Ot,onFound:ut,onChosen:e=>{Ye(e===`external`),pt(e),st(!0),Ft(),Lt()}})]}),Rn===`plan`&&j&&ue&&z(P.Fragment,{children:[I(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.plan.title`)}),I(`p`,{className:`setup-lede`,children:n(`setup.plan.lede`)}),z(`div`,{className:`setup-where`,children:[z(`section`,{className:`setup-hero setup-where-card${en===`local`?` is-active`:``}`,"aria-label":n(`setup.plan.label`),onClick:()=>!er&&tn(`local`),children:[I(`p`,{className:`setup-eyebrow`,children:ue.chatChosen?n(`setup.plan.yours`):n(`setup.plan.recommended`)}),z(`p`,{className:`setup-hero-title`,children:[I(`input`,{type:`radio`,name:`setup-where`,checked:en===`local`,onChange:()=>tn(`local`),disabled:er,"aria-labelledby":`setup-where-local`}),I(`bdi`,{id:`setup-where-local`,children:n(`setup.plan.run`,{name:Fn?.name??``})})]}),z(`dl`,{className:`setup-facts`,children:[z(`div`,{children:[I(`dt`,{children:n(`setup.summary.download`)}),I(`dd`,{children:I(`bdi`,{dir:`ltr`,children:BO(eG(j,ue).downloadGb??0)})})]}),z(`div`,{children:[I(`dt`,{children:n(`setup.plan.runsOn`)}),I(`dd`,{children:I(`bdi`,{children:Fn&&IW(Fn)?n(`setup.checks.npu`):x?.gpu_name??n(`setup.plan.cpu`)})})]}),z(`div`,{children:[I(`dt`,{children:n(`setup.plan.diskAfter`)}),I(`dd`,{children:I(`bdi`,{dir:`ltr`,children:eG(j,ue).afterGb==null?`—`:BO(Math.max(0,eG(j,ue).afterGb))})})]})]}),z(`ul`,{className:`setup-reasons`,children:[!ue.chatChosen&&I(`li`,{children:n(`setup.plan.why.evaluated`)}),Fn?.need_gb!=null&&Fn.capacity_gb!=null&&Fn.fits&&I(`li`,{children:n(`setup.plan.why.fits`,{need:UO(Fn.need_gb),have:UO(Fn.capacity_gb)})}),I(`li`,{children:n(`setup.plan.why.private`)}),Fn&&IW(Fn)&&I(`li`,{children:n(`setup.plan.why.noImagesNpu`)}),ir&&ir.id!==Fn?.id&&ir.need_gb!=null&&ir.capacity_gb!=null&&I(`li`,{children:n(`setup.plan.why.bigger`,{name:ir.name,need:UO(ir.need_gb),have:UO(ir.capacity_gb)})})]}),kn.length>0&&I(`p`,{className:`setup-hint`,children:n(`setup.plan.cancelAnytime`)})]}),z(`section`,{className:`setup-hero setup-where-card${en===`cloud`?` is-active`:``}${wt?` is-disabled`:``}`,"aria-label":n(`setup.plan.cloudLabel`),onClick:()=>!er&&!wt&&tn(`cloud`),children:[z(`p`,{className:`setup-hero-title`,children:[I(`input`,{type:`radio`,name:`setup-where`,checked:en===`cloud`,onChange:()=>tn(`cloud`),disabled:er||wt,"aria-labelledby":`setup-where-cloud`}),I(`span`,{id:`setup-where-cloud`,children:n(`setup.plan.cloud`)})]}),wt?I(`p`,{className:`setup-hint`,children:n(`settings.privacy.localOnlyBlocked`)}):z(`ul`,{className:`setup-reasons`,children:[I(`li`,{children:n(`setup.plan.cloudWhy.stillLocal`)}),I(`li`,{children:n(`setup.plan.cloudWhy.key`)}),I(`li`,{children:n(`setup.plan.cloudWhy.sent`)})]})]})]}),z(DG,{children:[en!==`cloud`&&I(`button`,{type:`button`,className:`btn-secondary`,onClick:$t,disabled:Te||er,children:n(`setup.plan.customize`)}),en===`cloud`?I(`button`,{type:`button`,className:`btn-primary`,onClick:on,disabled:er,children:n(`setup.continue`)}):z(`button`,{type:`button`,className:`btn-primary`,onClick:()=>An?be({kind:`low_disk`}):void Zt(!1),disabled:Te||In||er,children:[Te&&I(La,{size:13,className:`spin`,"aria-hidden":`true`}),` `,kn.length?n(`setup.plan.start`):n(`setup.plan.startNoDownload`)]})]}),t&&I(`div`,{className:`setup-row`,children:I(`button`,{type:`button`,className:`link-btn`,onClick:t,children:n(`setup.backToGaia`)})}),In&&z(`div`,{className:`setup-error`,role:`alert`,children:[I(`p`,{children:n(`setup.blocked`)}),z(`details`,{className:`dl-details`,children:[I(`summary`,{children:n(`setup.progress.details`)}),I(`pre`,{dir:`ltr`,children:x?.blockers.join(`
211
+ `)})]})]}),An&&I(`p`,{className:`setup-error`,role:`alert`,children:n(`setup.summary.short`,{need:BO(An.needGb),free:BO(An.freeGb),drive:n(`setup.summary.theDrive`),freeUp:BO(An.freeUpGb)})}),(De??k)&&I(tq,{text:De??k}),en!==`cloud`&&z(`details`,{className:`setup-disclosure`,children:[I(`summary`,{children:n(`setup.plan.whatDownloads`)}),I(XG,{plan:j,models:kn})]})]}),Rn===`gpu`&&M&&z(P.Fragment,{children:[I(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.gpu.title`)}),I(`p`,{className:`setup-lede`,children:n(`setup.gpu.lede`)}),I(LG,{status:M,onStatus:ge,mode:`setup`,headingId:`setup-title`,names:Sn,cloud:a!==`local`,onBack:ln,onSkip:()=>Qt(d),onContinue:()=>Qt(d)})]}),Rn===`models`&&z(P.Fragment,{children:[I(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.models.title`)}),j&&ue&&I(xK,{plan:j,selection:ue,onSelection:de,disabled:Te||er,onRecheck:()=>void Lt()}),cn&&M?.total_gb!=null&&M.gpu_gb!=null&&z(`p`,{className:`setup-hint setup-gpu-option`,children:[n(`setup.models.gpu`,{gpu:BO(M.gpu_gb),total:BO(M.total_gb)}),` `,I(`button`,{type:`button`,className:`link-btn`,onClick:()=>un(`models`),disabled:Te||er,children:n(`setup.found.changeMemory`)})]}),I(RG,{plan:j,planError:se,onRetryPlan:()=>void Lt(),onUseRecommended:()=>void Ut(!1,{keepTrying:_e}),selection:ue,onSelection:de,cloud:!1,keepTrying:_e,onKeepTrying:ve,onBack:ln,onContinue:e=>void Zt(e),busy:Te||er,error:De??k})]}),Rn===`key`&&z(`form`,{id:`setup-key-form`,onSubmit:e=>{e.preventDefault(),gn()},className:`setup-form`,children:[I(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.key.title`)}),I(Fz,{className:`setup-choices`,"aria-label":n(`setup.key.provider`),children:KK.filter(e=>e.id!==`local`&&(e.id!==`amd`||St)).map(e=>z(`button`,{type:`button`,role:`radio`,"aria-checked":a===e.id,className:`setup-choice${a===e.id?` is-active`:``}${Tt(e.id)?` is-disabled`:``}`,onClick:()=>vn(e.id),disabled:ie.busy||Tt(e.id),title:xt(e.id)?n(`settings.privacy.localOnlyBlocked`):void 0,children:[I(pi,{size:16,"aria-hidden":`true`}),z(`span`,{children:[I(`span`,{className:`setup-choice-title`,children:I(`bdi`,{children:qK(e,n)})}),I(`span`,{className:`setup-choice-note`,children:Tt(e.id)?Et(e.id):n(e.note)})]})]},e.id))}),ht?.reachable===!1&&St&&I(`button`,{type:`button`,className:`link-btn setup-start`,onClick:_t,children:n(`setup.key.checkAgain`)}),xt(a)&&I(`p`,{className:`setup-a11y-alert`,role:`alert`,children:n(`settings.privacy.localOnlyBlocked`)}),a===`fireworks`&&!Je&&!xt(a)&&z(`section`,{className:`setup-card`,children:[I(`h3`,{className:`mc-job-title`,children:n(`setup.key.getOne`)}),z(`ol`,{className:`setup-key-steps`,children:[I(`li`,{children:I(`a`,{href:WK,target:`_blank`,rel:`noreferrer`,children:n(`setup.key.step1`)})}),I(`li`,{children:n(`setup.key.step2`)}),I(`li`,{children:n(`setup.key.step3`)})]})]}),a===`amd`&&!Je&&!xt(a)&&I(`section`,{className:`setup-card`,children:I(`p`,{className:`setup-hint`,children:I(`a`,{href:GK,target:`_blank`,rel:`noreferrer`,children:n(`setup.key.gatewayHelp`)})})}),!xt(a)&&I(EW,{provider:a,limit:3,picked:Fe,onPick:Ie,onDefault:Re,pickDisabled:ie.busy||er}),!Je&&z(P.Fragment,{children:[I(`label`,{className:`setup-key-label`,htmlFor:`setup-key-input`,children:n(`setup.key.labelFor`,{provider:qK(KK.find(e=>e.id===a)??KK[1],n)})}),z(`div`,{className:`setup-row setup-key-row`,children:[I(`input`,{id:`setup-key-input`,className:`settings-input`,type:ze?`text`:`password`,autoComplete:`off`,spellCheck:!1,value:ne,onChange:e=>A(e.target.value),placeholder:Ct?n.bare(`setup.key.placeholder`):n.bare(`setup.key.placeholderNew`)}),I(`button`,{type:`button`,className:`btn-secondary setup-key-show`,"aria-label":n(ze?`setup.key.hide`:`setup.key.show`),title:n(ze?`setup.key.hide`:`setup.key.show`),onClick:()=>Be(e=>!e),children:I(ze?Ni:Fi,{size:14,"aria-hidden":`true`})})]})]}),I(`p`,{className:`setup-hint`,children:n(Je?`setup.key.usersServer`:`setup.key.where`)}),bt&&!Je&&!ne&&I(`p`,{className:`setup-hint`,role:`status`,children:n(`setup.key.foundEnv`,{name:bt.name,hint:bt.key_hint??``})}),ie.busy&&!ie.waiting&&I(`p`,{className:`setup-hint`,role:`status`,children:n(`setup.key.testing`)}),ie.busy&&ie.waiting&&I(`p`,{className:`setup-hint`,role:`status`,children:ie.waiting}),ie.error&&I(`p`,{className:`setup-error`,role:`alert`,children:ie.error}),z(DG,{children:[I(`button`,{type:`button`,className:`btn-secondary`,onClick:L,disabled:ie.busy,children:n(`setup.back`)}),z(`button`,{type:`submit`,form:`setup-key-form`,className:`btn-primary`,disabled:ie.busy||Tt(a)||er,children:[ie.busy&&I(La,{size:13,className:`spin`}),` `,n(`setup.key.connect`)]})]})]}),Rn===`download`&&!kt&&z(P.Fragment,{children:[I(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.download.title`)}),I(`p`,{className:`setup-lede`,children:n(`setup.download.lede`)}),nr,z(`p`,{className:`setup-hint`,role:`status`,children:[I(La,{size:13,className:`spin`,"aria-hidden":`true`}),` `,n(`setup.download.starting`)]})]}),Rn===`download`&&kt&&z(P.Fragment,{children:[I(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.download.title`)}),I(`p`,{className:`setup-lede`,children:n(`setup.download.lede`)}),nr,j&&I(`section`,{className:`setup-card`,"aria-label":n(`setup.contents.title`),children:I(XG,{plan:j,run:kt,onRetry:Gt,retryDisabled:Te})}),(kt.models?.length??0)>0?I(`div`,{className:D?`is-stale`:void 0,children:I(cK,{status:{...kt,overall:aG(kt,fe??j)},names:Sn,freeGb:j?.disk?.free_gb??null,onCancel:()=>void fn(),onRetry:(e,t)=>void pn(e,t),onResume:e=>void pn(e,null),onResumeAll:Gt,onSkip:e=>void mn(e),onRestart:()=>void hn(),busy:Te||!!D,retryLater:At,labelledBy:`setup-title`})}):At?z(P.Fragment,{children:[I(lK,{run:kt,plan:j,idle:n(`setup.download.working`)}),I(DG,{children:I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void fn(),disabled:Te,children:n(`setup.progress.cancel`)})})]}):null,rr.length>0&&z(`section`,{className:`setup-card`,"aria-label":n(`setup.optional.title`),children:[I(`h3`,{className:`mc-job-title`,children:n(`setup.optional.title`)}),I(`p`,{className:`setup-hint`,children:n(`setup.optional.lede`)}),I(`ul`,{className:`setup-rows`,children:rr.map(e=>{let t=Ue.includes(e.id);return z(`li`,{className:`setup-result is-waiting`,children:[I(`span`,{className:`setup-result-label`,children:n(`setup.purpose.${e.roles[0]}`)}),z(`span`,{className:`setup-result-value`,children:[I(`bdi`,{dir:`ltr`,children:e.size_gb==null?n(`setup.contents.sizeOnDownload`):BO(e.size_gb)}),I(`button`,{type:`button`,className:`btn-secondary`,"aria-pressed":t,onClick:()=>We(n=>t?n.filter(t=>t!==e.id):[...n,e.id]),children:n(t?`setup.optional.added`:`setup.optional.add`)})]})]},e.id)})})]}),D&&z(P.Fragment,{children:[I(`p`,{className:`setup-error`,role:`alert`,children:n(`setup.lostContact`,{error:D})}),I(DG,{children:I(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void Ht(),children:n(`setup.reconnect`)})})]}),Cn&&En&&!Dn&&kt.state===`failed`&&!kt.model_failed&&(kt.problem?I(eq,{problem:kt.problem,onRetry:Gt,onUseGaia:()=>void Ut(!0,Qe.current.options)}):z(`div`,{className:`setup-error`,role:`alert`,children:[I(`p`,{children:n(`setup.download.stoppedBeforeCheck`)}),kt.error&&z(`details`,{className:`dl-details`,children:[I(`summary`,{children:n(`setup.progress.details`)}),I(`pre`,{dir:`ltr`,children:kt.error})]})]})),Cn&&En&&!Dn&&z(P.Fragment,{children:[I(`p`,{className:`setup-hint`,children:n(`setup.download.finishNote`)}),I(DG,{children:I(`button`,{type:`button`,className:`btn-primary`,onClick:Gt,disabled:Te,children:n(`setup.finish`)})})]}),Cn&&!En&&!Dn&&!(kt.models??[]).some(e=>e.state===`failed`||e.state===`cancelled`)&&z(P.Fragment,{children:[I(nq,{run:kt}),kt.problem?I(eq,{problem:kt.problem,onRetry:Gt,onUseGaia:()=>void Ut(!0,Qe.current.options)}):I(DG,{children:I(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void Ut(!!kt.gaia_lemonade,Qe.current.options),children:n(`setup.tryAgain`)})})]}),(De||k)&&I(tq,{text:De??k})]}),Rn===`test`&&kt&&z(P.Fragment,{children:[I(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.test.title`)}),I(`p`,{className:`setup-lede`,children:n(`setup.test.lede`)}),I(UK,{run:kt,expected:tr,names:Sn,catalog:On,onRetry:Gt,onChooseAnother:Dt?void 0:$t,onCancel:()=>void fn(),onDownloadAgain:j?.lemonade.mode===`external`?void 0:e=>void pn(e,`verify`),busy:Te}),Cn&&kt.error&&!(kt.tests??[]).some(e=>e.error===kt.error)&&z(`details`,{className:`dl-details`,children:[I(`summary`,{children:n(`setup.progress.details`)}),I(`pre`,{dir:`ltr`,children:kt.error})]}),(De||k)&&I(tq,{text:De??k})]}),Rn===`ready`&&z(P.Fragment,{children:[I(`h1`,{id:`setup-title`,className:`setup-title`,tabIndex:-1,children:n(`setup.ready.heading`)}),z(`div`,{className:`setup-done`,role:`status`,children:[I(`div`,{className:`setup-done-head`,children:bn&&I(`p`,{children:n(Dt?`setup.ready.answersCloud`:`setup.ready.answersLocal`,{model:Dt?xc(bn):Sn[bn]??me?.catalog?.find(e=>e.id===bn)?.name??xc(bn)})})}),I(DG,{children:I(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void xn(),autoFocus:!0,children:n(`setup.ready.start`)})}),!Dt&&me&&I(zG,{plan:me,chatModel:bn,gpu:M}),k&&I(tq,{text:k}),(kt?.tests??[]).filter(e=>e.state===`failed`).map(e=>I(`p`,{className:`setup-failed-extra`,role:`alert`,children:n(`setup.ready.extraFailed`,{job:n(`setup.test.job.${e.job}`)})},`${e.job}:${e.subject??``}`)),Ge.length>0&&!ye&&I(`p`,{className:`setup-failed-extra`,role:`alert`,children:n(`setup.ready.extraNotFetched`,{names:Ge.map(e=>Sn[e]??e).join(`, `)})}),Tn.length>0&&z(P.Fragment,{children:[I(`p`,{className:`setup-hint`,children:n(`setup.ready.tasks`)}),I(WG,{cards:Tn,onPick:e=>void xn(e)})]})]})]})]},Rn),t&&!At&&Rn!==`plan`&&Rn!==`ready`&&I(`div`,{className:`setup-row`,children:I(`button`,{type:`button`,className:`link-btn setup-close`,onClick:t,children:n(`setup.backToGaia`)})}),er&&($n||Rn===`plan`)&&I(`p`,{className:`setup-hint`,role:`status`,children:n(`setup.nav.runGoing`)}),I(mK,{run:T,before:{check:Gn},failed:wn})]})}),I(`div`,{className:`setup-footer`,ref:h})]})}),ye?.kind===`no_fit`&&I(OG,{title:ye.models.length===1?n(`setup.confirm.noFitOne`,{name:ye.models[0].name}):n(`setup.confirm.noFitMany`),confirmLabel:n(`setup.confirm.downloadAnyway`),cancelLabel:n(`setup.confirm.pickSmaller`),onConfirm:()=>{be(null),we(!0),Zt(qt,!0)},onCancel:()=>be(null),children:ye.models.map(e=>z(`p`,{children:[I(`bdi`,{children:e.name}),`: `,fG(e,n)]},e.id))}),ye?.kind===`low_disk`&&An&&I(OG,{title:n(`setup.confirm.lowDiskTitle`),confirmLabel:n(`setup.confirm.downloadAnyway`),cancelLabel:n(`setup.confirm.changeModels`),onConfirm:()=>{be(null),Zt(!0)},onCancel:()=>{be(null),$t()},children:I(`p`,{children:n(`setup.summary.short`,{need:BO(An.needGb),free:BO(An.freeGb),drive:n(`setup.summary.theDrive`),freeUp:BO(An.freeUpGb)})})}),ye?.kind===`server`&&I(OG,{title:ye.detail.code===`low_disk`?n(`setup.confirm.lowDiskTitle`):n(`setup.confirm.noFitServerTitle`),confirmLabel:ye.detail.code===`low_disk`?n(`setup.confirm.downloadAnyway`):n(`setup.confirm.useAnyway`),cancelLabel:n(`setup.confirm.changeModels`),onConfirm:()=>{let e=ye;if(be(null),e.then===`chat`)we(!0),Zt(qt,!0);else if(e.then===`retry`)N(e.id,{keepTrying:_e,acknowledgeLowDisk:!0}).then(E).catch(e=>Oe(iq(e)));else{let{gaiaLemonade:e,options:t}=Qe.current;Ut(e,{...t,acknowledgeLowDisk:!0})}},onCancel:()=>{let e=ye;be(null),e.then!==`retry`&&!jt&&$t()},children:I(`p`,{children:ye.detail.message})})]})}function oq({title:e,titleId:t,count:n,hint:r,defaultOpen:i=!1,forceOpen:a=!1,targetId:o,children:s}){let[c,l]=(0,V.useState)(i);return z(`details`,{className:`settings-disclosure`,"data-settings-target":o,open:c||a,onToggle:e=>{a||l(e.currentTarget.open)},children:[z(`summary`,{onClick:e=>{a&&e.preventDefault()},children:[I(Gr,{size:15,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),z(`span`,{className:`settings-disclosure-text`,children:[I(`span`,{className:`settings-disclosure-title`,id:t,tabIndex:t?-1:void 0,children:e}),r&&I(`span`,{className:`settings-disclosure-hint`,children:r})]}),n!=null&&I(`bdi`,{dir:`ltr`,className:`settings-disclosure-count`,children:n})]}),I(`div`,{className:`settings-disclosure-body`,children:s})]})}var sq=u(Gl()?`settings.desktop.menuBar`:`settings.desktop.tray`),cq=[{key:`minimizeToTray`,label:`settings.desktop.keepRunning`,hint:`settings.desktop.keepRunningHint`},{key:`startOnLogin`,label:`settings.desktop.startOnLogin`,hint:`settings.desktop.startOnLoginHint`},{key:`startMinimized`,label:`settings.desktop.startMinimized`,hint:`settings.desktop.startMinimizedHint`}],lq=new Set([`startMinimized`]),uq={minimizeToTray:`settings.desktop.keepRunningNoTray`};function dq(e){return e?.reason===`no-host`?`settings.desktop.noTray`:e?.reason===`check-failed`?`settings.desktop.noTrayCheckFailed`:null}function fq(){let e=R(),t=window.gaiaAPI?.tray,[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null);(0,V.useEffect)(()=>{t&&t.getConfig().then(e=>{r(e.tray),a(e.host)}).catch(t=>s(e(`settings.desktop.readFailed`,{reason:t instanceof Error?t.message:String(t)})))},[t,e]);let u=(0,V.useCallback)(async e=>{if(t&&n&&c===null){l(e),s(null);try{let i=await t.setConfig({tray:{[e]:!n[e]}});r(i.tray),a(i.host)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(null)}}},[t,n,c]);if(!t)return null;let d=dq(i);return I(oq,{title:e(`settings.desktop.title`),children:z(`div`,{className:`settings-field`,role:`group`,"aria-labelledby":`desktop-app-label`,children:[I(`span`,{className:`settings-label`,id:`desktop-app-label`,children:e(`settings.desktop.title`)}),cq.map(({key:t,label:r,hint:i})=>{let a=lq.has(t)?d:null,o=d&&uq[t]||i;return z(`div`,{children:[z(`label`,{className:`setting-row`,children:[I(`span`,{children:e(r,{tray:sq})}),z(`span`,{className:`toggle-switch`,children:[I(`input`,{id:`desktop-${t}`,type:`checkbox`,role:`switch`,checked:!a&&!!n?.[t],"aria-describedby":`desktop-${t}-hint`,onChange:()=>void u(t),disabled:!!a||!n||c!==null&&c!==t,"aria-busy":c===t,"aria-label":e(r,{tray:sq})}),I(`span`,{className:`toggle-track`})]})]}),I(`p`,{className:`settings-hint`,id:`desktop-${t}-hint`,children:a?e(a):e(o,{tray:sq})})]},t)}),o&&I(`p`,{className:`settings-error`,role:`alert`,children:o})]})})}function pq(){return window.gaiaUpdater}var mq={status:`idle`,version:null,progress:0,releaseNotes:null,error:null,currentVersion:null,pinnedVersion:null,autoUpdate:!1,includePrereleases:!1};function hq(){let[e,t]=(0,V.useState)({...mq}),n=(0,V.useRef)(!1),r=(0,V.useRef)(0),i=(0,V.useCallback)(async()=>{let e=pq();if(!e)return;let i=r.current;try{let r=await e.getStatus();n.current&&r&&t(r)}catch(e){F.system.error(`Reading the update status failed`,e),n.current&&r.current===i&&t(e=>({...e,readFailed:!0}))}},[]);return(0,V.useEffect)(()=>{let e=pq();if(!e)return;n.current=!0;let a=e.onStatusChange(e=>{e&&(r.current+=1,n.current&&t(e))});return i(),()=>{n.current=!1,a()}},[i]),{...e,reload:i}}var gq=`gaia-update-error:`;function _q(e,t){let n=`update.err.${e}`;return ae(n)?u(n,t??{}):null}function vq(e){let t=e instanceof Error?e.message:String(e),n=t.indexOf(gq);if(n<0)return t.replace(/^Error invoking remote method '[^']+': (?:Error: )?/,``);let r;try{r=JSON.parse(t.slice(n+18))}catch{return t.slice(0,n)+t.slice(n+18)}let i=_q(r.code,r.params)??r.message??r.code,a=r.note&&_q(r.note.code,r.note.params);return a?u(`update.err.withNote`,{error:i,note:a}):i}function yq(e,t){let n=vq(e);return typeof n==`object`?t(n.ref,n.params):String(n)}function bq(){return window.gaiaUpdater}function xq({onClose:e,manualInstall:t=!1}){let n=R(),[r,i]=(0,V.useState)({kind:`loading`}),a=(0,V.useRef)(null);(0,V.useEffect)(()=>{let e=bq();e?e.listReleases().then(e=>{i(Array.isArray(e)?{kind:`list`,releases:e}:{kind:`error`,message:e.error})}).catch(()=>{i({kind:`error`,message:`Couldn't reach GitHub to list releases — check your connection; you can still download installers from the Releases page.`})}):i({kind:`error`,message:`Couldn't reach GitHub to list releases — check your connection; you can still download installers from the Releases page.`})},[]),pt(!0,e),on(a,!0),(0,V.useEffect)(()=>{let e=a.current;e&&e.querySelector(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)?.focus()},[]),(0,V.useEffect)(()=>{let e=a.current;if(!e)return;function t(t){if(t.key!==`Tab`||!e)return;let n=e.querySelectorAll(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);if(n.length===0)return;let r=n[0],i=n[n.length-1];t.shiftKey?document.activeElement===r&&(t.preventDefault(),i?.focus()):document.activeElement===i&&(t.preventDefault(),r?.focus())}return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[]);function o(e,t){e.isCurrent||i({kind:`confirm`,release:e,releases:t})}async function s(t){i({kind:`installing`});let r=bq();if(!r)i({kind:`error`,message:n(`update.picker.noBridge`)});else try{await r.installVersion(t.tag),e()}catch(e){i({kind:`error`,message:n(`update.picker.failed`,{reason:vq(e)})})}}function c(e){if(!e)return``;try{return new Date(e).toLocaleDateString(Sn(n),{year:`numeric`,month:`short`,day:`numeric`})}catch{return e}}return I(`div`,{className:`version-picker-overlay`,onClick:t=>{t.target===t.currentTarget&&e()},children:z(`div`,{className:`version-picker-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":n(`update.picker.title`),ref:a,children:[z(`div`,{className:`version-picker-header`,children:[I(`h3`,{children:n(`update.picker.title`)}),I(`button`,{className:`version-picker-close`,onClick:e,"aria-label":n(`update.picker.close`),type:`button`,children:`×`})]}),z(`div`,{className:`version-picker-body`,children:[r.kind===`loading`&&z(`div`,{className:`version-picker-loading`,"aria-busy":`true`,children:[I(`span`,{className:`version-picker-spinner`}),n(`update.picker.loading`)]}),r.kind===`error`&&z(`div`,{className:`version-picker-error`,children:[I(`p`,{children:r.message}),I(`p`,{children:I(`a`,{href:`https://github.com/amd/gaia/releases`,target:`_blank`,rel:`noreferrer`,children:n(`update.picker.browse`)})})]}),r.kind===`list`&&I(`ul`,{className:`version-picker-list`,role:`listbox`,"aria-label":n(`update.picker.listAria`),children:r.releases.map(e=>I(`li`,{children:z(`button`,{type:`button`,className:`version-picker-row`,"data-version":e.version,"aria-label":e.isCurrent?n(`update.picker.rowInstalled`,{version:e.version}):e.isPinned?n(`update.picker.rowPinned`,{version:e.version}):e.version,"aria-disabled":e.isCurrent?`true`:`false`,onClick:()=>o(e,r.releases),disabled:e.isCurrent,children:[I(`span`,{className:`vp-version`,children:e.version}),I(`span`,{className:`vp-date`,children:c(e.date)}),e.isCurrent&&I(`span`,{className:`vp-badge vp-badge-current`,children:n(`update.picker.installed`)}),e.isPinned&&!e.isCurrent&&I(`span`,{className:`vp-badge vp-badge-pinned`,children:n(`update.picker.pinned`)}),!e.isCurrent&&I(`span`,{className:`vp-arrow`,"aria-hidden":`true`,children:`›`})]})},e.tag))}),r.kind===`list`&&z(`p`,{className:`version-picker-more`,children:[n(`update.picker.recent`,{n:r.releases.length}),` `,I(`a`,{href:`https://github.com/amd/gaia/releases`,target:`_blank`,rel:`noreferrer`,children:n(`update.picker.browseAll`)})]}),r.kind===`confirm`&&z(`div`,{className:`version-picker-confirm`,children:[t?I(`p`,{children:n(`update.picker.manual`,{version:r.release.version})}):z(P.Fragment,{children:[I(`p`,{children:n(`update.picker.confirm`,{version:r.release.version})}),I(`p`,{className:`vp-confirm-note`,children:n(`update.picker.confirmNote`,{version:r.release.version})})]}),z(`div`,{className:`vp-confirm-actions`,children:[I(`button`,{type:`button`,className:`vp-btn-cancel`,onClick:()=>i({kind:`list`,releases:r.releases}),children:n(`update.picker.back`)}),t?I(`a`,{className:`vp-btn-confirm`,href:r.release.notesUrl??`https://github.com/amd/gaia/releases`,target:`_blank`,rel:`noopener noreferrer`,children:n(`update.picker.openRelease`)}):I(`button`,{type:`button`,className:`vp-btn-confirm`,onClick:()=>s(r.release),children:n(`update.picker.install`)})]})]}),r.kind===`installing`&&z(`div`,{className:`version-picker-loading`,"aria-busy":`true`,children:[I(`span`,{className:`version-picker-spinner`}),n(`update.picker.starting`)]})]})]})})}var Sq=`https://github.com/amd/gaia/releases`;function Cq(e){return/^\d+\.\d+\.\d+-/.test(e??``)}function wq(e,t){let n=e.version??``;if(e.readFailed)return t(`update.status.readFailed`);switch(e.status){case`checking`:return t(`update.status.checking`);case`available`:return t(`update.status.available`,{version:n});case`downloading`:return e.preparing?t(`update.status.preparing`,{version:n}):t(`update.status.downloading`,{version:n,pct:e.progress});case`downloaded`:return t(`update.status.downloaded`,{version:n});case`error`:return t(`update.status.error`,{reason:e.error??t(`update.status.unknownError`)});case`no-channel`:return e.error??t(`update.status.noChannel`);case`disabled`:return t(`update.status.disabled`);default:return t(`update.status.upToDate`)}}function Tq(){let e=hq(),t=R(),n=pq(),[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(!1);if(!n)return null;async function l(e,r){if(n){i(!0),o(null);try{await r(n)}catch(n){F.system.error(`${e} failed`,n),o(t(`update.settings.failed`,{action:u(e),reason:vq(n)}))}finally{i(!1)}}}let d=e.status===`disabled`,f=r||e.status===`checking`||e.status===`downloading`,p=e.readFailed?wq(e,t):`${t(`update.settings.running`,{version:e.currentVersion??t(`update.settings.unknownVersion`)})} ${wq(e,t)}`,m=[`available`,`downloaded`,`error`].includes(e.status)||!!e.pinnedVersion||!!e.installFailed||!!e.configError||!!e.readFailed||!!a;return I(oq,{title:t(`update.settings.title`),titleId:`updates-label`,hint:p,forceOpen:m,children:z(`div`,{className:`settings-field`,role:`group`,"aria-labelledby":`updates-label`,children:[I(`p`,{className:`visually-hidden`,role:`status`,children:p}),!e.manualInstall&&z(P.Fragment,{children:[z(`label`,{className:`setting-row`,children:[I(`span`,{children:t(`update.settings.auto`)}),z(`span`,{className:`toggle-switch`,children:[I(`input`,{type:`checkbox`,role:`switch`,checked:e.autoUpdate,"aria-describedby":`updates-auto-hint`,"aria-label":t(`update.settings.auto`),"aria-busy":r,disabled:d,onChange:()=>{r||l(`update.action.saveAuto`,t=>t.setAutoUpdate(!e.autoUpdate))}}),I(`span`,{className:`toggle-track`})]})]}),I(`p`,{className:`settings-hint`,id:`updates-auto-hint`,children:t(`update.settings.autoHint`)})]}),z(`label`,{className:`setting-row`,children:[I(`span`,{children:t(`update.settings.rc`)}),z(`span`,{className:`toggle-switch`,children:[I(`input`,{type:`checkbox`,role:`switch`,checked:!!e.includePrereleases,"aria-describedby":`updates-rc-hint`,"aria-label":t(`update.settings.rc`),"aria-busy":r,disabled:d,onChange:()=>{r||l(`update.action.saveRc`,t=>t.setIncludePrereleases(!e.includePrereleases))}}),I(`span`,{className:`toggle-track`})]})]}),z(`p`,{className:`settings-hint`,id:`updates-rc-hint`,children:[t(`update.settings.rcHint`),Cq(e.currentVersion)&&` ${t(`update.settings.rcHintRunning`)}`]}),e.pinnedVersion&&z(`p`,{className:`settings-hint`,children:[t(`update.settings.pinned`,{version:e.pinnedVersion}),` `,I(`button`,{type:`button`,className:`btn-secondary`,disabled:r,onClick:()=>void l(`update.action.resume`,e=>e.resumeUpdates()),children:t(`update.settings.unpin`)})]}),z(`div`,{className:`setting-actions`,children:[e.status===`available`&&e.manualInstall&&I(`a`,{className:`btn-primary update-download-link`,href:e.downloadUrl??Sq,target:`_blank`,rel:`noopener noreferrer`,"aria-describedby":`updates-manual-hint`,children:t(`update.settings.downloadVersion`,{version:e.version??``})}),e.status===`available`&&!e.manualInstall&&!e.pinnedVersion&&I(`button`,{type:`button`,className:`btn-primary`,disabled:r,onClick:()=>void l(`update.action.download`,e=>e.downloadUpdate()),children:t(`update.settings.updateTo`,{version:e.version??``})}),e.status===`downloaded`&&I(`button`,{type:`button`,className:`btn-primary`,disabled:r,onClick:()=>void l(`update.action.restart`,e=>e.restart()),children:t(`update.settings.restart`)}),e.readFailed?I(`button`,{type:`button`,className:`btn-secondary`,disabled:r,onClick:async()=>{i(!0);try{await e.reload()}finally{i(!1)}},children:t(`update.settings.retryRead`)}):I(`button`,{type:`button`,className:`btn-secondary`,disabled:f||d,onClick:()=>void l(`update.action.check`,e=>e.check()),children:t(`update.settings.check`)}),I(`button`,{type:`button`,className:`btn-secondary`,disabled:f||d,onClick:()=>c(!0),children:t(`update.settings.pick`)}),e.previousVersion&&I(`button`,{type:`button`,className:`btn-secondary`,"aria-describedby":`updates-back-hint`,disabled:f||d,onClick:()=>void l(`update.action.goBack`,e=>e.revertUpdate()),children:t(`update.settings.goBack`,{version:e.previousVersion})})]}),e.status===`available`&&e.manualInstall&&I(`p`,{className:`settings-hint`,id:`updates-manual-hint`,children:t(`update.settings.manualHint`)}),e.previousVersion&&I(`p`,{className:`settings-hint`,id:`updates-back-hint`,children:t(`update.settings.goBackHint`)}),e.installFailed&&I(`p`,{className:`settings-error`,role:`alert`,children:t(`update.settings.installFailed`,{...e.installFailed,url:Sq})}),e.lastCheckError&&I(`p`,{className:`settings-hint`,children:t(`update.settings.lastCheckError`,{reason:e.lastCheckError})}),e.configError&&I(`p`,{className:`settings-error`,role:`alert`,children:e.configError}),a&&I(`p`,{className:`settings-error`,role:`alert`,children:a}),s&&I(xq,{onClose:()=>c(!1),manualInstall:e.manualInstall})]})})}var Eq=[{value:`light`,label:`settings.theme.light`},{value:`dark`,label:`settings.theme.dark`},{value:`system`,label:`settings.theme.system`}],Dq={default:`palette.default`,stone:`palette.stone`,marble:`palette.marble`,glacier:`palette.glacier`,forest:`palette.forest`,sage:`palette.sage`,basalt:`palette.basalt`,gold:`palette.gold`,dusk:`palette.dusk`,custom:`settings.colors.custom`};function Oq(){let e=R(),t=B(e=>e.locale),n=B(e=>e.setLocale),r=B(e=>e.themePreference),i=B(e=>e.setThemePreference),a=B(e=>e.palette),o=B(e=>e.setPalette),s=B(e=>e.customColors),c=B(e=>e.setCustomColors),l=eH(e=>e.visible),u=eH(e=>e.setVisible),d=e=>t=>c({...s,[e]:t.target.value.toUpperCase()});return z(`div`,{className:`settings-pane`,children:[I(`h2`,{className:`settings-pane-title`,children:e(`settings.section.general`)}),z(`div`,{className:`settings-field`,children:[I(`label`,{className:`settings-label`,htmlFor:`ui-language`,children:e(`settings.language`)}),I(`select`,{id:`ui-language`,className:`settings-input`,value:t,onChange:e=>n(e.target.value),children:ge.map(({meta:e})=>I(`option`,{value:e.code,lang:e.code,dir:e.dir,children:Fe(e)},e.code))}),I(`span`,{className:`settings-hint`,children:e(`settings.languageHint`)})]}),z(`div`,{className:`settings-field`,children:[I(`span`,{className:`settings-label`,id:`appearance-label`,children:e(`settings.appearance`)}),I(Fz,{className:`segmented`,"aria-labelledby":`appearance-label`,children:Eq.map(t=>I(`button`,{type:`button`,role:`radio`,"aria-checked":r===t.value,className:r===t.value?`is-active`:``,onClick:()=>i(t.value),children:e(t.label)},t.value))})]}),z(`div`,{className:`settings-field`,children:[z(`label`,{className:`setting-row`,children:[I(`span`,{children:e(`resources.settings`)}),z(`span`,{className:`toggle-switch`,children:[I(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked),"aria-label":e(`resources.settings`),"aria-describedby":`resources-hint`}),I(`span`,{className:`toggle-track`})]})]}),I(`span`,{className:`settings-hint`,id:`resources-hint`,children:e(`resources.settingsHint`)})]}),z(oq,{title:e(`settings.colors`),titleId:`palette-label`,defaultOpen:a===`custom`,children:[z(Fz,{className:`palette-grid`,"aria-labelledby":`palette-label`,children:[vn.map(t=>z(`button`,{type:`button`,role:`radio`,"aria-checked":a===t.id,className:`palette-tile${a===t.id?` is-active`:``}`,onClick:()=>o(t.id),children:[I(`span`,{className:`palette-swatch`,"aria-hidden":`true`,children:t.swatch.map(e=>I(`i`,{style:{background:e}},e))}),e(Dq[t.id])]},t.id)),z(`button`,{type:`button`,role:`radio`,"aria-checked":a===`custom`,className:`palette-tile${a===`custom`?` is-active`:``}`,onClick:()=>o(`custom`),children:[z(`span`,{className:`palette-swatch`,"aria-hidden":`true`,children:[I(`i`,{style:{background:s.base}}),I(`i`,{style:{background:s.accent}})]}),e(`settings.colors.custom`)]})]}),a===`custom`&&z(`div`,{className:`palette-custom`,children:[z(`label`,{className:`palette-color`,htmlFor:`custom-accent`,children:[I(`input`,{id:`custom-accent`,type:`color`,value:s.accent,onChange:d(`accent`)}),z(`span`,{children:[e(`settings.colors.accent`),I(`small`,{children:e(`settings.colors.accentHint`)})]})]}),z(`label`,{className:`palette-color`,htmlFor:`custom-base`,children:[I(`input`,{id:`custom-base`,type:`color`,value:s.base,onChange:d(`base`)}),z(`span`,{children:[e(`settings.colors.base`),I(`small`,{children:e(`settings.colors.baseHint`)})]})]}),I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>c(de),children:e(`settings.colors.reset`)}),I(`p`,{className:`settings-hint`,children:e(`settings.colors.hint`)})]})]}),I(fq,{}),I(Tq,{}),I(oq,{title:e(`settings.shortcuts`),children:I(`dl`,{className:`shortcut-list`,children:CW().map(({label:t,keys:n})=>z(`div`,{className:`shortcut-row`,children:[I(`dt`,{children:I(`kbd`,{children:Yl(n)})}),I(`dd`,{children:e(t)})]},t))})})]})}function kq(e){return/not reachable|not answering|model server at|ConnectionPool|NewConnectionError|Connection refused|Max retries/i.test(e)}function Aq(e){return/gaia init/i.test(e??``)}var jq=`GAIA doesn't run this model server, so it can't start it. Start it the way you usually do.`;function Mq(e,t){return t?t===jq?e(`server.otherServerStart`):t:null}function Nq(e){return!!e&&!e.lemonade_running&&(Aq(e.start_command)||Aq(e.start_instruction))}function Pq({className:e=`btn-secondary`}){let t=R();return I(`button`,{type:`button`,className:e,onClick:()=>window.dispatchEvent(new CustomEvent(`gaia:set-up-local`)),children:t(`settings.errors.setUpLocal`)})}function Fq({message:e,onRetry:t}){let n=R(),r=B(e=>Nq(e.systemStatus));return kq(e)?z(`div`,{className:`settings-notice`,role:`alert`,children:[I(`strong`,{children:n(r?`settings.errors.notInstalledTitle`:`settings.errors.serverDownTitle`)}),I(`p`,{children:n(r?`settings.errors.notInstalled`:`settings.errors.serverDown`)}),r&&I(Pq,{className:`btn-primary`}),t&&I(`button`,{type:`button`,className:`btn-secondary`,onClick:t,children:n(`settings.key.checkAgain`)}),z(`details`,{className:`settings-more`,children:[z(`summary`,{children:[I(Gr,{size:13,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),` `,n(`settings.errors.details`)]}),I(`bdi`,{dir:`ltr`,className:`settings-notice-raw`,children:e})]})]}):I(`p`,{className:`settings-error`,role:`alert`,children:e})}function Iq({onAdded:e}){let t=R(),[n,r]=(0,V.useState)(``),[i,a]=(0,V.useState)(``),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(null),f=(0,V.useRef)(``),p=(0,V.useCallback)(async e=>{let t=n.trim();f.current=t,l(`check`),d(null);try{let n=await It(t,e);if(f.current!==t)return;s(n),a(n.file??e)}catch(e){if(f.current!==t)return;s(null),d(e instanceof Error?e.message:String(e))}finally{l(null)}},[n]),m=(0,V.useCallback)(async()=>{l(`add`),d(null);try{let{report:o}=await Gt(n.trim(),i);r(``),a(``),s(null),e(o.display_name??o.model_id??t(`settings.custom.theModel`))}catch(e){d(e instanceof Error?e.message:String(e))}finally{l(null)}},[e,i,n,t]);return z(`form`,{className:`settings-field custom-model-add`,onSubmit:e=>{e.preventDefault(),p(``)},children:[I(`label`,{className:`visually-hidden`,htmlFor:`custom-model-url`,children:t(`settings.custom.title`)}),I(`span`,{className:`settings-hint`,children:t(`settings.custom.hint`)}),z(`div`,{className:`settings-row`,children:[I(`input`,{id:`custom-model-url`,className:`settings-input`,type:`url`,inputMode:`url`,dir:`ltr`,spellCheck:!1,autoComplete:`off`,value:n,readOnly:c!==null,onChange:e=>{r(e.target.value),s(null),a(``),f.current=``},placeholder:`https://huggingface.co/unsloth/Qwen3-4B-Instruct-2507-GGUF`}),z(`button`,{type:`submit`,className:`btn-secondary`,disabled:c!==null||!n.trim(),children:[c===`check`?I(La,{size:13,className:`spin`}):null,` `,t(`settings.custom.check`)]})]}),o&&(()=>{let e=I(`ul`,{className:`custom-model-checks`,"aria-label":t(`settings.custom.checks`),children:o.checks.map(e=>z(`li`,{className:e.ok?`is-ok`:`is-failed`,children:[e.ok?I(Vr,{size:13,"aria-label":t(`settings.custom.passed`)}):I(Is,{size:13,"aria-label":t(`settings.custom.failed`)}),z(`bdi`,{children:[I(`strong`,{children:e.label}),` — `,e.detail]})]},e.id))});return o.ok?z(`details`,{className:`custom-model-checks-summary`,children:[z(`summary`,{children:[I(Vr,{size:13,"aria-hidden":`true`}),` `,t(`settings.custom.allPassed`,{n:o.checks.length})]}),e]}):e})(),o&&o.warnings.length>0&&I(`ul`,{className:`custom-model-checks`,"aria-label":t(`settings.custom.warnings`),children:o.warnings.map(e=>z(`li`,{className:`is-warning`,children:[I(ws,{size:13,"aria-label":t(`settings.custom.warning`)}),` `,I(`bdi`,{children:e})]},e))}),o&&o.variants.length>1&&z(`div`,{className:`settings-row`,children:[I(`label`,{className:`settings-hint`,htmlFor:`custom-model-quant`,children:t(`settings.custom.quantization`)}),I(`select`,{id:`custom-model-quant`,className:`settings-input`,value:i,onChange:e=>void p(e.target.value),disabled:c!==null,children:o.variants.map(e=>z(`option`,{value:e.file,children:[e.quant,` · `,e.size_gb,` GB`,e.fits?``:` · ${t.bare(`settings.custom.tooLarge`)}`]},e.file))})]}),o?.ok&&z(`div`,{className:`settings-row`,children:[z(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void m(),disabled:c!==null,children:[c===`add`?I(La,{size:13,className:`spin`}):null,` `,t(`settings.custom.add`,{name:o.display_name??``})]}),I(`span`,{className:`settings-hint`,children:t(`settings.model.sizeDownload`,{size:`${o.size_gb} GB`})})]}),u&&I(Fq,{message:u})]})}function Lq(e){return e instanceof Error?e.message:String(e)}function Rq(e,t){return e.size===t.size&&[...e].every(e=>t.has(e))}function zq({downloadsSlot:e}){let t=R(),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(!1),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(!1),[_,v]=(0,V.useState)(null),[y,b]=(0,V.useState)(null),x=Qc(e=>e.status),S=Qc(e=>e.started),C=(0,V.useMemo)(()=>Yc(x,S),[x,S]),w=Qc(e=>e.error),T=Qc(e=>e.refresh),E=Qc(e=>e.enqueue),D=Qc(e=>e.cancel),O=(0,V.useCallback)(async(e=!1)=>{a(null);try{let t=await qe();r(t),s(n=>e||!n?JW(t):n)}catch(e){a(Lq(e))}},[]);(0,V.useEffect)(()=>{O(!0),T(),(async()=>{try{v(await f()??null)}catch(e){b(Lq(e))}})()},[O,T]);let k=(C?.models??[]).filter(e=>e.state===`ready`).map(e=>e.id).join(`,`),ee=(0,V.useRef)(k);(0,V.useEffect)(()=>{k!==ee.current&&(ee.current=k,O(!0))},[k,O]);let te=(0,V.useMemo)(()=>{let e={};for(let t of C?.models??[])e[t.id]=t;return e},[C]),ne=(0,V.useMemo)(()=>{let e={};for(let t of n?.catalog??[])e[t.id]=t.name;return e},[n]),A=(0,V.useMemo)(()=>n?JW(n):null,[n]),re=NW(n),ie=n&&o?$W(re,o).filter(e=>te[e.id]?.state!==`downloading`):[],ae=ie.reduce((e,t)=>e+(t.size_gb??0),0),j=!!n&&!!o&&!!A&&(!Rq(o.ticked,A.ticked)||o.defaultChat!==A.defaultChat||ie.length>0),oe=(0,V.useCallback)(async(e,i)=>{if(!n||!o)return;if(m(null),!e){let e=nG(re,o).filter(e=>!e.downloaded||e.id===o.defaultChat);if(e.length>0&&e.every(e=>e.need_gb!=null)){l({kind:`no_fit`,models:e});return}}let a=tG(n,o);if(a&&!i)l({kind:`low_disk`,message:a.drop?t(`setup.summary.shortDrop`,{need:BO(a.needGb),free:BO(a.freeGb),drive:gG(n.disk?.path??null)??t(`setup.summary.theDrive`),freeUp:BO(a.freeUpGb),name:a.drop.name,saves:BO(a.drop.size_gb??0)}):t(`setup.summary.short`,{need:BO(a.needGb),free:BO(a.freeGb),drive:gG(n.disk?.path??null)??t(`setup.summary.theDrive`),freeUp:BO(a.freeUpGb)})});else{d(!0);try{let i=n,a=!1;if(o.defaultChat&&o.defaultChat!==i.chat_model.id){a=!0;try{i=await Se(o.defaultChat,e||h)}catch(e){let t=it(e);if(t){l({kind:`server`,detail:t});return}throw e}}for(let e of rG(i,o))i=await dt(e.id,e.skipped);let c=$W(NW(i),o).map(e=>e.id).filter(e=>te[e]?.state!==`downloading`);r(i),s({...o,defaultChat:i.chat_model.id});let u=null;if(a&&i.chat_model.downloaded)try{await _c.getState().select(i.chat_model.id)}catch(e){u=Lq(e),_c.getState().refresh()}else _c.getState().refresh();c.length&&await E(c,{acknowledgeLowDisk:!0}),m(u===null?{ok:!0,text:t(`settings.models.applied`)}:{ok:!1,text:t(`settings.models.appliedNotSwitched`,{reason:u})})}catch(e){m({ok:!1,text:Lq(e)})}finally{d(!1)}}},[n,o,re,h,te,E,t]),se=(0,V.useCallback)(async e=>{l(null),d(!0),m(null);try{let n=await le(e.id);Qs(),r(n),s(JW(n)),m({ok:!0,text:t(`settings.models.removed`,{name:e.name,size:BO(n.freed_gb)})})}catch(e){m({ok:!1,text:Lq(e)})}finally{d(!1)}},[t]),ce=(0,V.useCallback)((e,t)=>{(async()=>{try{t===`verify`&&await le(e),await E([e])}catch(e){m({ok:!1,text:Lq(e)})}})()},[E]),ue=!!C&&(C.models?.length??0)>0&&(aK(C)||C.models.some(e=>e.state!==`skipped`))&&C&&z(`section`,{className:`settings-field models-pane-section`,"aria-labelledby":`settings-downloads-title`,children:[I(`span`,{className:`settings-label`,id:`settings-downloads-title`,children:t(`settings.models.downloads`)}),I(cK,{status:C,names:ne,freeGb:n?.disk?.free_gb??null,onCancel:()=>void D(),onRetry:ce,onResume:e=>void E([e]),onResumeAll:()=>void E((C.models??[]).filter(e=>e.state===`cancelled`).map(e=>e.id))}),w&&I(`p`,{className:`settings-error`,role:`alert`,children:w})]});return z(P.Fragment,{children:[I(oq,{title:t(`settings.models.manage`),hint:t(`settings.models.manageHint`),forceOpen:!!i||p?.ok===!1,children:z(`section`,{className:`settings-field models-pane-section`,"aria-labelledby":`settings-models-title`,children:[I(`span`,{className:`visually-hidden`,id:`settings-models-title`,children:t(`settings.models.title`)}),I(`p`,{className:`settings-hint`,children:t(`settings.models.lede`)}),i&&I(Fq,{message:i}),n&&!n.lemonade.reachable&&I(`p`,{className:`settings-hint`,children:t(`settings.models.unavailable`)}),!n&&!i&&z(`p`,{className:`settings-hint`,children:[I(La,{size:13,className:`spin`,"aria-hidden":`true`}),` `,t(`setup.models.loading`)]}),n&&n.lemonade.reachable&&o&&z(P.Fragment,{children:[I(vG,{plan:n,selection:o,onToggle:(e,t)=>s(XW(o,re,e,t)),onDefaultChat:e=>s(ZW(o,re,e)),labelledBy:`settings-models-title`,place:`settings`,disabled:u,progress:te,rowActions:e=>e.downloaded&&e.id!==o.defaultChat?I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>l({kind:`remove`,entry:e}),disabled:u||te[e.id]?.state===`downloading`,"aria-label":t(`settings.models.removeAria`,{name:e.name}),children:t(`settings.models.remove`)}):null}),I(hG,{plan:n,selection:o}),I(`div`,{className:`models-apply`,children:z(`button`,{type:`button`,className:`btn-primary`,disabled:!j||u,onClick:()=>void oe(!1,!1),children:[u&&I(La,{size:13,className:`spin`,"aria-hidden":`true`}),u?t(`settings.models.applying`):ie.length>0?t(`settings.models.applyDownload`,{size:BO(Math.round(ae*10)/10)}):t(`settings.models.apply`)]})})]}),p?.ok&&I(`p`,{className:`settings-ok`,role:`status`,children:p.text}),p&&!p.ok&&I(Fq,{message:p.text})]})}),(_?.applies||y&&!kq(y))&&I(oq,{title:t(`gpu.settingsTitle`),titleId:`settings-gpu-title`,defaultOpen:!!_?.pending||!!y,children:z(`section`,{className:`settings-field models-pane-section`,"aria-labelledby":`settings-gpu-title`,children:[y&&I(`p`,{className:`settings-error`,role:`alert`,children:y}),_?.applies&&I(LG,{status:_,onStatus:v,mode:`settings`,names:ne,headingId:`settings-gpu-title`})]})}),e?(0,Mj.createPortal)(ue,e):e===void 0&&ue,c?.kind===`remove`&&I(OG,{title:t(`settings.models.removeTitle`,{name:c.entry.name}),confirmLabel:t(`settings.models.removeConfirm`),cancelLabel:t(`settings.models.keep`),danger:!0,onConfirm:()=>void se(c.entry),onCancel:()=>l(null),children:I(`p`,{children:PW(c.entry)?t(`settings.models.removeVision`,{size:BO(c.entry.full_size_gb??0)}):t(`settings.models.removeBody`,{size:BO(c.entry.full_size_gb??0)})})}),c?.kind===`no_fit`&&I(OG,{title:c.models.length===1?t(`setup.confirm.noFitOne`,{name:c.models[0].name}):t(`setup.confirm.noFitMany`),confirmLabel:t(`setup.confirm.downloadAnyway`),cancelLabel:t(`setup.confirm.pickSmaller`),onConfirm:()=>{l(null),g(!0),oe(!0,!1)},onCancel:()=>l(null),children:c.models.map(e=>z(`p`,{children:[I(`bdi`,{children:e.name}),`: `,fG(e,t)]},e.id))}),c?.kind===`low_disk`&&I(OG,{title:t(`setup.confirm.lowDiskTitle`),confirmLabel:t(`setup.confirm.downloadAnyway`),cancelLabel:t(`setup.confirm.changeModels`),onConfirm:()=>{l(null),oe(!0,!0)},onCancel:()=>l(null),children:I(`p`,{children:c.message})}),c?.kind===`server`&&I(OG,{title:t(`setup.confirm.noFitServerTitle`),confirmLabel:t(`setup.confirm.useAnyway`),cancelLabel:t(`setup.confirm.changeModels`),onConfirm:()=>{l(null),g(!0),oe(!0,!1)},onCancel:()=>l(null),children:I(`p`,{children:c.detail.message})})]})}var Bq=`auto`;function Vq({model:e}){let t=R(),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(null);(0,V.useEffect)(()=>{r(null),a(null),l(null),Qt(e).then(r).catch(e=>a(e instanceof Error?e.message:String(e)))},[e]);let d=(0,V.useCallback)(async n=>{s(!0),a(null),l(null);try{let i=await Un(e,n===Bq?null:Number(n));r(i);let a={name:i.display_name,size:i.chosen?Nc(i.chosen):u(`settings.ctx.automaticSize`)},o=i.reload?.reason;i.reload?.started?l(t(`settings.ctx.reloading`,a)):l(o===`already_loaded`?t(`settings.ctx.alreadyLoaded`,a):o===`warm_up`?t(`settings.ctx.warmUp`,a):o===`busy`?t(`settings.ctx.busy`,a):o===`not_gaias_server`?t(`settings.ctx.ownServer`,a):t(o===`restarting`?`settings.ctx.restarting`:`settings.ctx.nextLoad`))}catch(e){a(e instanceof Error?e.message:String(e))}finally{s(!1)}},[e,t]);if(i&&!n)return kq(i)?I(`p`,{className:`settings-hint`,children:t(`settings.ctx.serverDown`)}):I(`p`,{className:`settings-error`,role:`alert`,children:i});if(!n)return z(`p`,{className:`settings-hint`,children:[I(La,{size:13,className:`spin`}),` `,t(`settings.ctx.checking`)]});let f=n.chosen==null?Bq:String(n.chosen),p=n.chosen!=null&&n.loaded_ctx!=null&&n.loaded_ctx!==n.chosen;return z(P.Fragment,{children:[z(`div`,{className:`model-in-use-field`,children:[I(`label`,{className:`settings-label`,htmlFor:`ctx-size`,children:t(`settings.ctx.label`)}),z(`select`,{id:`ctx-size`,className:`settings-input`,value:f,onChange:e=>void d(e.target.value),disabled:o||n.options.length===0,children:[I(`option`,{value:Bq,children:n.automatic?t.bare(`settings.ctx.automaticAt`,{size:Nc(n.automatic)}):t.bare(`settings.ctx.automatic`)}),n.options.map(e=>I(`option`,{value:String(e),children:t.bare(`settings.ctx.tokens`,{size:Nc(e)})},e))]})]}),n.note&&I(`span`,{className:`settings-hint`,children:I(`bdi`,{children:n.note})}),!n.note&&!!n.max_fit&&z(`details`,{className:`settings-more`,children:[z(`summary`,{children:[I(Gr,{size:13,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),` `,t(`settings.ctx.about`)]}),I(`span`,{className:`settings-hint`,children:t(`settings.ctx.explain`,{size:Nc(n.max_fit),name:n.display_name,memory:n.memory_source})})]}),p&&I(`span`,{className:`settings-hint`,children:t(`settings.ctx.loadedAt`,{size:Nc(n.loaded_ctx)})}),o&&z(`span`,{className:`settings-hint`,children:[I(La,{size:13,className:`spin`}),` `,t(`settings.ctx.applying`)]}),c&&I(`p`,{className:`settings-ok`,role:`status`,children:c}),i&&I(`p`,{className:`settings-error`,role:`alert`,children:i})]})}function Hq({row:e,providerName:t,choices:n,labels:r,disabled:i,onSwitch:a}){let o=R(),s=_c(e=>e.active),c=_c(e=>e.error),l=s?.model??null,u=!!s?.remote,d=n.some(e=>bc(l,e.id)),f=s?.downloaded??e?.downloaded,p=u?null:e?.state===`loaded`?o(`settings.model.loaded`):f===!0?o(`settings.model.downloaded`):f===!1?o(`settings.model.notDownloaded`):null,m=e?.placement?.device;return z(`section`,{className:`settings-card model-in-use`,"aria-label":o(`settings.model.inUseTitle`),children:[I(`span`,{className:`model-in-use-label`,children:o(`settings.model.inUseTitle`)}),l?I(`bdi`,{className:`model-in-use-name`,title:l,children:e?.display_name||s?.display_name||xc(l)}):s||c?I(`span`,{className:`settings-hint`,children:o(`settings.model.noneInUse`)}):I(`span`,{className:`settings-hint`,children:o(`settings.loading`)}),s?.config_error&&I(`p`,{className:`settings-error`,role:`alert`,children:I(`bdi`,{children:s.config_error})}),l&&!u&&e?.available===!1&&I(`p`,{className:`settings-error`,role:`alert`,children:o(`settings.model.inUseCantRun`)}),l&&z(`span`,{className:`model-chips`,children:[u&&I(`span`,{className:`model-badge is-device`,children:o(`settings.model.cloud`)}),u&&t&&I(`bdi`,{className:`model-badge is-ready`,children:t}),m&&I(`span`,{className:`model-badge is-device`,children:m.toUpperCase()}),p&&I(`span`,{className:`model-badge ${e?.state===`loaded`?`is-loaded`:`is-ready`}`,children:p}),e?.fits===!0&&I(`span`,{className:`model-badge is-fit`,children:o(`settings.model.fits`)}),!!e?.size_gb&&z(`bdi`,{dir:`ltr`,className:`model-badge is-size`,children:[e.size_gb,` GB`]}),u&&!!e?.context_length&&I(`span`,{className:`model-badge is-ready`,children:o(`settings.model.contextChip`,{size:Nc(e.context_length)})})]}),(n.length>1||n.length===1&&!d)&&z(`div`,{className:`model-in-use-field`,children:[I(`label`,{className:`settings-label`,htmlFor:`model-switch`,children:o(`settings.model.switch`)}),z(`select`,{id:`model-switch`,className:`settings-input`,value:d?n.find(e=>bc(l,e.id))?.id:``,onChange:e=>a(e.target.value),disabled:i,children:[!d&&I(`option`,{value:``,disabled:!0,children:o.bare(`settings.model.switchPlaceholder`)}),n.map(e=>I(`option`,{value:e.id,children:r[e.id]},e.id))]})]}),l&&!u&&s?.downloaded!==!1&&I(Vq,{model:l})]})}var Uq=e=>new Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:0}).format(e),Wq={"best overall, fastest":`settings.model.note.bestFastest`,cheapest:`settings.model.note.cheapest`,"most truthful":`settings.model.note.mostTruthful`},Gq=/^(\d+\/\d+) tasks · quality ([\d.]+\/5) · (\$[\d.]+) per (\d+)-task run$/;function Kq(e,t){let n=Gq.exec(t);return e.compose(e=>e(`settings.model.measured`,{evidence:n?e(`settings.model.evidence`,{tasks:n[1],quality:n[2],cost:n[3],n:n[4]}):t}))}function qq({model:e,label:t,current:n,remote:r,busy:i,onUse:a,onDownload:o,onAskRemove:s,onNpuRecheck:c}){let l=R(),u=Fc(e)?e.download_progress:null,d=e.placement?.label,f=l.compose(t=>[d&&(e.placement?.source===`expected`?t(`settings.model.expected`,{label:d}):d),e.size_gb?t(e.downloaded?`settings.model.sizeOnDisk`:`settings.model.sizeDownload`,{size:`${e.size_gb} GB`}):null,e.tokens_per_second?t(`settings.model.speed`,{speed:`${Math.round(e.tokens_per_second)} tok/s`}):null,!e.placement&&e.context_length?t(`settings.model.contextTokens`,{size:Uq(e.context_length)}):null].filter(Boolean).join(` · `)),p=!!(e.display_name||f||e.evidence||e.custom&&e.source_url);return z(`li`,{className:`model-row${n?` is-current`:``}`,children:[z(`div`,{className:`model-row-text`,children:[I(`bdi`,{className:`model-row-name`,title:e.id,children:t}),z(`div`,{className:`model-chips`,children:[e.placement?.device&&I(`span`,{className:`model-badge is-device`,children:e.placement.device.toUpperCase()}),e.rank&&z(`span`,{className:`model-badge is-rank`,children:[z(`bdi`,{dir:`ltr`,children:[`#`,e.rank]}),` `,e.note&&(Wq[e.note]?l(Wq[e.note]):I(`bdi`,{children:e.note}))]}),e.state===`loaded`&&I(`span`,{className:`model-badge is-loaded`,children:l(`settings.model.loaded`)}),e.fits===!0&&e.available!==!1&&I(`span`,{className:`model-badge is-fit`,children:l(`settings.model.fits`)}),e.custom&&I(`span`,{className:`model-badge is-custom`,children:l(`settings.model.custom`)}),!!e.size_gb&&z(`bdi`,{dir:`ltr`,className:`model-badge is-size`,children:[e.size_gb,` GB`]}),p&&z(`details`,{className:`settings-more model-row-facts`,children:[z(`summary`,{children:[I(Gr,{size:13,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),` `,l(`settings.model.details`)]}),e.display_name&&I(`span`,{className:`model-row-meta`,children:I(`bdi`,{children:e.id})}),f&&I(`span`,{className:`model-row-meta`,children:f}),e.evidence&&I(`span`,{className:`model-row-meta`,children:Kq(l,e.evidence)}),e.custom&&e.source_url&&I(`span`,{className:`model-row-meta`,children:l(`settings.model.from`,{url:e.source_url})})]})]}),r&&I(`span`,{className:`model-row-meta${e.price?``:` is-unknown-price`}`,children:HL(e.price,l)}),e.placement?.warning&&I(`span`,{className:`model-row-meta is-warning`,role:`alert`,children:I(`bdi`,{children:e.placement.warning})}),e.npu_problems?.length?I(yK,{problems:e.npu_problems,disabled:i!==null,onRecheck:c,id:`npu-problems-${e.id}`}):e.unavailable_reason&&I(`span`,{className:`model-row-meta`,children:l(`settings.model.cantRun`,{reason:e.unavailable_reason})}),u&&I(`progress`,{max:100,value:u.percent,"aria-label":l(`settings.model.downloadingAria`,{name:t})})]}),z(`div`,{className:`model-row-actions`,children:[e.custom&&!n&&!u&&z(`button`,{type:`button`,className:`btn-secondary`,onClick:s,disabled:i!==null,"aria-label":l(`settings.models.removeAria`,{name:t}),children:[i===`rm:${e.id}`?I(La,{size:13,className:`spin`}):null,l(`settings.models.remove`)]}),n&&e.available===!1?I(`span`,{className:`model-row-current is-blocked`,children:l(`settings.model.inUseBlocked`)}):n?z(`span`,{className:`model-row-current`,children:[I(Vr,{size:13,"aria-hidden":`true`}),` `,l(`settings.model.inUse`)]}):e.available===!1?null:u?z(`span`,{className:`model-row-current`,children:[I(La,{size:13,className:`spin`}),` `,u.message?I(`bdi`,{children:u.message}):z(`bdi`,{dir:`ltr`,children:[Math.round(u.percent),`%`]})]}):e.downloaded?z(`button`,{type:`button`,className:`btn-secondary`,onClick:a,disabled:i!==null,"aria-label":l(`settings.model.useAria`,{name:t}),children:[i===e.id?I(La,{size:13,className:`spin`}):null,` `,l(`settings.model.use`)]}):z(`button`,{type:`button`,className:`btn-secondary`,onClick:o,disabled:i!==null,"aria-label":l(`settings.model.downloadAria`,{name:t}),children:[i===`dl:${e.id}`?I(La,{size:13,className:`spin`}):null,` `,l(`settings.model.download`)]})]})]})}function Jq(){let e=R(),[t,n]=(0,V.useState)(null),[r,i]=(0,V.useState)(null),[a,o]=(0,V.useState)(``),[s,c]=(0,V.useState)(!1),l=(0,V.useCallback)(async e=>{c(!0),i(null);try{let t=await e();n(t),o(t.limit_usd==null?``:String(t.limit_usd))}catch(e){i(e instanceof Error?e.message:String(e))}finally{c(!1)}},[]);if((0,V.useEffect)(()=>{l(tt)},[l]),!t)return r?I(`p`,{className:`settings-error`,role:`alert`,children:r}):z(`p`,{className:`settings-hint`,children:[I(La,{size:13,className:`spin`}),` `,e(`settings.spend.loading`)]});let u=t.limit_usd,d=a.trim()===``?null:Number(a),f=d===null||Number.isFinite(d)&&d>0,p=d!==u;return z(`section`,{className:`settings-field spending`,"aria-label":e(`settings.spend.aria`),children:[I(`span`,{className:`settings-label`,children:e(`settings.spend.title`)}),z(`p`,{className:`spending-total`,children:[I(`bdi`,{dir:`ltr`,children:I(`strong`,{children:UL(t.total_usd)})}),u!=null&&z(P.Fragment,{children:[` `,e(`settings.spend.ofLimit`,{limit:UL(u)})]}),z(`span`,{className:`settings-hint`,children:[` · `,e.plural(`settings.spend.turns`,t.turns-t.unpriced_turns-t.unreported_turns)]})]}),t.unpriced_turns>0&&I(`p`,{className:`settings-hint`,children:e.plural(`settings.spend.unpriced`,t.unpriced_turns)}),t.unreported_turns>0&&I(`p`,{className:`settings-hint`,children:e.plural(`settings.spend.unreported`,t.unreported_turns)}),t.state===`near`&&z(`p`,{className:`spending-warning`,role:`status`,children:[I(ws,{size:13,"aria-hidden":`true`}),` `,e(`settings.spend.near`)]}),t.state===`reached`&&z(`div`,{className:`spending-warning`,role:`alert`,children:[z(`p`,{children:[I(ws,{size:13,"aria-hidden":`true`}),` `,e(`settings.spend.reached`)]}),I(`button`,{type:`button`,className:`btn-secondary`,disabled:s,onClick:()=>void l(mn),children:e(`settings.spend.allow`)})]}),t.state===`allowed_over`&&I(`p`,{className:`settings-hint`,children:e(`settings.spend.allowed`)}),z(`form`,{className:`settings-row`,onSubmit:e=>{e.preventDefault(),f&&p&&l(()=>v(d))},children:[I(`label`,{className:`spending-limit-label`,htmlFor:`spend-limit`,children:e(`settings.spend.limit`)}),I(`input`,{id:`spend-limit`,className:`settings-input`,type:`number`,min:`0.01`,step:`0.01`,inputMode:`decimal`,placeholder:e.bare(`settings.spend.noLimit`),value:a,onChange:e=>o(e.target.value),"aria-invalid":!f}),z(`button`,{type:`submit`,className:`btn-secondary`,disabled:s||!f||!p,children:[s?I(La,{size:13,className:`spin`}):null,` `,e(`settings.advanced.save`)]}),u!=null&&I(`button`,{type:`button`,className:`btn-secondary`,disabled:s,onClick:()=>void l(()=>v(null)),children:e(`settings.spend.removeLimit`)})]}),I(`span`,{className:`settings-hint`,children:e(`settings.spend.how`)}),r&&I(`p`,{className:`settings-error`,role:`alert`,children:r})]})}var Yq=2e3;function Xq(e,t){return e.key_source===`environment`?t(`settings.key.setIn`,{name:e.env_var??``}):`••••••••••••••••••••${e.key_hint?` ${e.key_hint}`:``}`}function Zq(){let e=R(),t=_c(e=>e.active),n=_c(e=>e.select),r=_c(e=>e.refresh),i=_c(e=>e.rememberNames),a=B(e=>!!e.systemStatus&&gI(e.systemStatus)===`unresponsive`),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),u=B(e=>e.settingsProvider),[d,f]=(0,V.useState)(u??t?.provider??`local`),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(``),[y,b]=(0,V.useState)(!1),[x,S]=(0,V.useState)(``),[C,w]=(0,V.useState)(!1),[T,E]=(0,V.useState)(!1),[D,O]=(0,V.useState)({base_url:``,auth_header_name:``,auth_header_prefix:``}),[k,ee]=(0,V.useState)(null),[te,ne]=(0,V.useState)(null),[A,re]=(0,V.useState)(null),[ie,ae]=(0,V.useState)(null),[j,oe]=(0,V.useState)(!1),[se,ce]=(0,V.useState)(null),[le,ue]=(0,V.useState)(null),de=(0,V.useRef)(d);de.current=d;let fe=(0,V.useRef)(!0);(0,V.useEffect)(()=>(fe.current=!0,()=>{fe.current=!1}),[]);let pe=o?.find(e=>e.id===d)??null,me=e=>e?.network?.reachable===!1,he=e=>!!e?.blocked,M=!!pe&&!he(pe)&&(!pe.remote||!!pe.models_discovered),N=(0,V.useCallback)(async()=>{l(null);try{let e=await cn();s(e.providers),e.lemonade_error&&l(e.lemonade_error)}catch(e){l(e instanceof Error?e.message:String(e))}},[]),ge=(0,V.useCallback)(async()=>{try{await Jn()}catch(e){l(e instanceof Error?e.message:String(e));return}await N()},[N]),_e=(0,V.useCallback)(async(t,n=!1)=>{n||(m(null),g(null));try{let n=await Nn(t);i(n.models),m(n.models),ne(n.memory_gb?`${n.memory_gb} GB (${n.memory_source})`:n.capacity_error??null),n.blocked&&g(e(`settings.privacy.localOnlyBlocked`))}catch(e){g(e instanceof Error?e.message:String(e))}},[i,e]);(0,V.useEffect)(()=>{N()},[N]);let ve=!!o?.some(e=>e.key_state===`waiting_for_os_permission`);(0,V.useEffect)(()=>{if(!ve)return;let e=setInterval(()=>{N()},Yq);return()=>clearInterval(e)},[ve,N]);let ye=t?.provider;(0,V.useEffect)(()=>{ye&&!u&&f(ye)},[ye,u]),(0,V.useEffect)(()=>{S(``),w(!1),E(!1),re(null),v(``),b(!1),oe(!1)},[d]),(0,V.useEffect)(()=>{M?_e(d):m(null)},[d,M,_e]);let be=(0,V.useCallback)(async()=>{if(pe){ee(`connect`),re(null);try{let t=d===`amd`?{api_key:x||void 0,...Object.fromEntries(Object.entries(D).filter(([,e])=>e!==``))}:{api_key:x||void 0},n=()=>!fe.current||de.current!==d,r=await _n(d,t,e=>{n()||re({ok:!0,text:e})},n);if(n())return;S(``),w(!1),re({ok:!0,text:r.remember_error?e(`settings.key.sessionOnly`,{reason:r.remember_error}):r.known_models?e(`settings.key.knownModels`,{name:pe.name}):r.remembered?e(`settings.key.kept`):e(`settings.key.connectedDone`)}),await N()}catch(e){fe.current&&de.current===d&&re({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{fe.current&&ee(null)}}},[D,d,x,N,pe,e]),xe=(0,V.useCallback)(async()=>{ee(`forget`),E(!1),re(null);try{await Wn(d),re({ok:!0,text:e(`settings.key.cleared`)}),await N(),await r()}catch(e){re({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{ee(null)}},[d,N,r,e]),Se=(0,V.useCallback)(async t=>{ee(t),re(null);try{await n(t),re({ok:!0,text:e(`settings.model.switched`,{name:xc(t)})}),await _e(d,!0)}catch(e){re({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{ee(null)}},[d,_e,n,e]),Ce=(0,V.useCallback)(async e=>{ee(`dl:${e}`),re(null),oe(!1);try{await Ve(e),await _e(`local`,!0)}catch(e){re({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{ee(null)}},[_e]),we=(0,V.useCallback)(async t=>{let n=_c.getState().active?.model;ee(`rm:${t}`),re(null);try{let r=await Rt(t);ae(null);let i=r.cleared.includes(`last_model`)?`settings.model.removedLast`:r.cleared.includes(`default_model`)?`settings.model.removedDefault`:`settings.model.removed`;re({ok:!0,text:e(i,{name:r.display_name})}),await _e(`local`,!0),await vc(n)}catch(e){re({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{ee(null)}},[_e,e]),Te=(0,V.useCallback)(async t=>{re({ok:!0,text:e(`settings.model.added`,{name:t})}),oe(!0),await _e(`local`,!0)},[_e,e]),Ee=!!p?.some(Fc);(0,V.useEffect)(()=>{if(Ee)return()=>{r()}},[Ee,r]),(0,V.useEffect)(()=>{if(d!==`local`||!Ee)return;let e=setInterval(()=>{_e(`local`,!0)},Yq);return()=>clearInterval(e)},[Ee,d,_e]);let De=t?.model,Oe=p?.find(e=>bc(De,e.id));(0,V.useEffect)(()=>{Oe&&ce(Oe)},[Oe]);let ke=(0,V.useMemo)(()=>{let e=_.trim().toLowerCase();return(p??[]).filter(t=>!e||t.id.toLowerCase().includes(e)||(t.display_name??``).toLowerCase().includes(e))},[p,_]),Ae=ke.filter(e=>e.available!==!1),je=d===`fireworks`&&!y&&!_.trim()&&Ae.some(e=>e.rank!==null),Me=e=>e.rank!==null||e.id===t?.model,Ne=je?Ae.filter(Me):Ae,Pe=je?Ae.filter(e=>!Me(e)):[],Fe=ke.filter(e=>e.available===!1),Ie=kc(p??[]),Le=!!_.trim(),Re=e=>bc(t?.model,e.id),ze=pe?.id===`local`,Be=Ne.filter(e=>e.downloaded).sort((e,t)=>Number(Re(t))-Number(Re(e))),He=Ne.filter(e=>!e.downloaded),Ue=(p??[]).filter(e=>e.available!==!1&&e.downloaded),We=Ue.filter(Me),Ge=ie?(p??[]).find(e=>e.id===ie)??null:null,Ke=d===`fireworks`&&We.some(e=>e.rank!==null)?We:Ue,qe=e=>I(qq,{model:e,label:Ie[e.id],current:Re(e),remote:!!pe?.remote,busy:k,onUse:()=>void Se(e.id),onDownload:()=>void Ce(e.id),onAskRemove:()=>ae(e.id),onNpuRecheck:()=>void _e(d,!0)},e.id);return z(`div`,{className:`settings-pane`,children:[I(`h2`,{className:`settings-pane-title`,children:e(`settings.section.model`)}),I(Hq,{row:Oe??(bc(se?.id,t?.model)?se:null),providerName:t?.provider_name??null,choices:M?Ke:[],labels:Ie,disabled:k!==null,onSwitch:e=>void Se(e)}),I(Fz,{className:`provider-tabs`,"aria-label":e(`settings.model.whereRuns`),children:(o??[{id:`local`,name:`Local`,remote:!1}]).map(t=>z(`button`,{type:`button`,role:`radio`,"aria-checked":d===t.id,className:`provider-tab${d===t.id?` is-active`:``}${me(t)||he(t)?` is-disabled`:``}`,onClick:()=>f(t.id),disabled:(me(t)||he(t))&&d!==t.id,title:he(t)?e(`settings.privacy.localOnlyBlocked`):me(t)?e(`setup.key.gatewayOff`):void 0,children:[t.remote?I(pi,{size:14,"aria-hidden":`true`}):I(yi,{size:14,"aria-hidden":`true`}),I(`span`,{children:GL(e,t)}),t.remote&&t.models_discovered&&I(`span`,{className:`provider-tab-dot`,"aria-label":e(`settings.key.connectedDot`)})]},t.id))}),!o&&!c&&z(`p`,{className:`settings-hint`,role:`status`,children:[I(La,{size:13,className:`spin`}),` `,e(a?`settings.model.waitingServer`:`settings.loading`)]}),c&&I(Fq,{message:c,onRetry:()=>{N(),_e(d)}}),pe&&z(`section`,{className:`settings-card`,"aria-label":GL(e,pe),children:[pe.remote&&I(`p`,{className:`settings-note`,children:I(`bdi`,{children:KL(e,pe)})}),z(`details`,{className:`settings-more`,children:[z(`summary`,{children:[I(Gr,{size:13,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),` `,e(`settings.model.howItWorks`)]}),I(`p`,{className:`settings-hint`,children:e(`settings.model.lede`)}),ze&&I(`p`,{className:`settings-hint`,children:I(`bdi`,{children:KL(e,pe)})}),ze&&I(`p`,{className:`settings-hint`,children:e(`settings.model.devices`)}),ze&&te&&I(`p`,{className:`settings-hint`,children:e(`settings.model.memory`,{memory:te})})]}),pe.remote&&!M&&z(`div`,{className:`settings-field`,children:[I(`span`,{className:`settings-label`,children:e(`settings.model.prices`)}),I(EW,{provider:pe.id})]}),he(pe)&&I(`div`,{className:`settings-field`,children:I(`p`,{className:`settings-error`,role:`alert`,children:e(`settings.privacy.localOnlyBlocked`)})}),me(pe)&&z(`div`,{className:`settings-field`,children:[I(`p`,{className:`settings-error`,role:`alert`,children:pe.network?.detail}),I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void N(),children:e(`settings.key.checkAgain`)})]}),pe.remote&&!me(pe)&&!he(pe)&&z(`form`,{className:`settings-field`,"data-settings-target":`cloud-key`,onSubmit:e=>{e.preventDefault(),be()},children:[z(`div`,{className:`settings-row settings-row-between`,children:[I(`span`,{className:`settings-label`,children:e(`settings.key.title`)}),pe.key_source&&I(`span`,{className:`settings-key-status ${M?`settings-ok`:`settings-error`}`,children:e(M?`settings.key.connected`:`settings.key.notConnected`)})]}),!pe.key_source&&pe.key_state===`store_locked`&&z(`span`,{className:`settings-hint`,role:`status`,children:[e(`settings.key.storeLocked`),` `,I(`button`,{type:`button`,className:`link-btn`,onClick:()=>void ge(),children:e(`settings.key.unlockAgain`)})]}),!pe.key_source&&pe.key_state!==`store_locked`&&I(`span`,{className:`settings-hint`,children:pe.key_state===`waiting_for_os_permission`?pe.key_message??e(`settings.key.waitingOs`):e(`settings.key.none`)}),pe.id===`amd`&&(!pe.key_source||C)&&z(`div`,{className:`settings-grid`,children:[I(`input`,{className:`settings-input`,placeholder:e(`settings.key.gatewayPlaceholder`),value:D.base_url,onChange:e=>O({...D,base_url:e.target.value}),"aria-label":e(`settings.key.gatewayUrl`)}),I(`input`,{className:`settings-input`,placeholder:e(`settings.key.headerPlaceholder`),value:D.auth_header_name,onChange:e=>O({...D,auth_header_name:e.target.value}),"aria-label":e(`settings.key.headerName`)})]}),pe.key_source&&!C?z(`div`,{className:`settings-row`,children:[I(`input`,{className:`settings-input settings-key-masked`,readOnly:!0,value:Xq(pe,e),"aria-label":e(`settings.key.savedAria`,{name:pe.name})}),!M&&z(`button`,{type:`submit`,className:`btn-primary`,disabled:k!==null,children:[k===`connect`?I(La,{size:13,className:`spin`}):null,e(`settings.key.reconnect`)]}),(pe.key_source!==`environment`||pe.key_from_gaia_env)&&z(P.Fragment,{children:[I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>w(!0),disabled:k!==null,children:e(`settings.key.replace`)}),pe.key_source!==`environment`&&I(`button`,{type:`button`,className:`btn-secondary settings-key-remove`,onClick:()=>E(!0),disabled:k!==null,"aria-label":e(`settings.key.remove`),title:e(`settings.key.remove`),children:I(Ss,{size:14,"aria-hidden":`true`})})]})]}):z(`div`,{className:`settings-row`,children:[I(`input`,{className:`settings-input`,type:`password`,autoComplete:`off`,spellCheck:!1,autoFocus:C,value:x,onChange:e=>S(e.target.value),placeholder:e(C?`settings.key.pasteNew`:`settings.key.paste`),"aria-label":e(`settings.key.fieldAria`,{name:pe.name})}),z(`button`,{type:`submit`,className:`btn-primary`,disabled:k!==null||!x,children:[k===`connect`?I(La,{size:13,className:`spin`}):null,e(C?`settings.key.save`:`settings.key.connect`)]}),C&&I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{S(``),w(!1)},disabled:k!==null,children:e(`settings.key.cancel`)})]}),pe.key_source&&!M&&!pe.error&&!C&&I(`p`,{className:`settings-hint`,children:e(`settings.key.notConnectedHint`,{name:pe.name})}),pe.error&&I(`p`,{className:`settings-error`,role:`alert`,children:pe.error})]}),A?.ok&&I(`p`,{className:`settings-ok`,role:`status`,children:A.text}),A&&!A.ok&&I(Fq,{message:A.text}),pe.known_models&&I(`p`,{className:`settings-hint`,role:`status`,children:e(`settings.key.knownList`,{name:pe.name})}),ze&&I(`div`,{className:`models-downloads-slot`,ref:ue}),M&&z(`div`,{className:`settings-field`,children:[I(`span`,{className:`settings-label`,children:e(`settings.model.models`)}),(p?.length??0)>6&&I(`input`,{className:`settings-input`,type:`search`,value:_,onChange:e=>v(e.target.value),placeholder:e(`settings.model.search`),"aria-label":e(`settings.model.search`)}),h&&!(c&&kq(h))&&I(Fq,{message:h}),!p&&!h&&z(`p`,{className:`settings-hint`,children:[I(La,{size:13,className:`spin`}),` `,e(`settings.loading`)]}),p&&ke.length===0&&!h&&I(`p`,{className:`settings-hint`,children:e(Le||!ze?`settings.model.noMatch`:`settings.model.noModels`)}),ze?z(P.Fragment,{children:[Be.length>0&&I(oq,{title:e(`settings.model.groupDownloaded`),count:Be.length,defaultOpen:!0,forceOpen:Le,targetId:`models-on-pc`,children:I(`ul`,{className:`model-list`,children:Be.map(qe)})}),He.length>0&&I(oq,{title:e(`settings.model.groupAvailable`),count:He.length,defaultOpen:Be.length===0,forceOpen:Le||j||He.some(Fc),children:I(`ul`,{className:`model-list`,children:He.map(qe)})})]}):I(`ul`,{className:`model-list`,children:Ne.map(qe)}),je&&Pe.length>0&&I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>b(!0),children:e(`settings.model.showAll`)}),d===`fireworks`&&y&&!Le&&I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>b(!1),children:e(`settings.model.showRecommended`)}),Fe.length>0&&I(oq,{title:e(`settings.model.groupUnavailable`),count:Fe.length,forceOpen:Le,children:I(`ul`,{className:`model-list`,children:Fe.map(qe)})})]}),ze&&M&&I(oq,{title:e(`settings.custom.title`),children:I(Iq,{onAdded:e=>void Te(e)})}),ze&&M&&I(zq,{downloadsSlot:le}),pe.remote&&I(Jq,{})]}),Ge&&I(OG,{title:e(`settings.models.removeTitle`,{name:Ie[Ge.id]??Ge.id}),confirmLabel:Ge.downloaded?e(`settings.model.removeDownload`):e(`settings.models.remove`),cancelLabel:e(`settings.models.keep`),danger:!0,onConfirm:()=>{ae(null),we(Ge.id)},onCancel:()=>ae(null),children:Ge.downloaded&&I(`p`,{children:e(`settings.model.removeDownloadBody`)})}),T&&pe&&I(OG,{title:e(`settings.key.removeAsk`),confirmLabel:e(`settings.key.remove`),cancelLabel:e(`settings.models.keep`),danger:!0,onConfirm:()=>void xe(),onCancel:()=>E(!1),children:I(`p`,{children:e(`settings.key.removeBody`,{name:pe.name})})})]})}function Qq(){let e=R(),t=B(e=>e.sessions),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(null),u=(0,V.useCallback)(async()=>{l(null);try{let e=await yt();r(e.sessions),a(e.default_mode),B.getState().setDefaultPermissionMode(e.default_mode)}catch(e){l(e instanceof Error?e.message:String(e))}},[]);(0,V.useEffect)(()=>{u()},[u]);let d=(0,V.useCallback)(async e=>{l(null);try{await e(),await u()}catch(e){l(e instanceof Error?e.message:String(e))}},[u]),f=(0,V.useCallback)(async e=>{s(!1),await d(()=>Ln(e))},[d]),p=()=>{i===`full_access`?f(`ask`):s(e=>!e)},m=e=>t.find(t=>t.id===e)?.title??e;return z(`div`,{className:`settings-pane`,children:[I(`h2`,{className:`settings-pane-title`,children:e(`settings.section.permissions`)}),I(`p`,{className:`settings-pane-lede`,children:e(`settings.permissions.lede`)}),z(`details`,{className:`settings-more`,children:[z(`summary`,{children:[I(Gr,{size:13,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),` `,e(`settings.model.howItWorks`)]}),I(`p`,{className:`settings-hint`,children:e(`settings.permissions.perChat`)})]}),z(`section`,{className:`settings-card`,"aria-label":e(`settings.permissions.newChats`),children:[z(`label`,{className:`setting-row`,children:[I(`span`,{className:`settings-label`,children:e(`settings.permissions.fullAccess`)}),z(`span`,{className:`toggle-switch`,children:[I(`input`,{type:`checkbox`,checked:i===`full_access`,onChange:p,disabled:i===null,"aria-label":e(`settings.permissions.fullAccess`)}),I(`span`,{className:`toggle-track`})]})]}),I(`p`,{className:`settings-hint`,children:e(i===`full_access`?`settings.permissions.on`:`settings.permissions.off`)}),o&&z(`div`,{className:`settings-warning`,role:`alert`,children:[I(`p`,{children:e(`settings.permissions.warning`)}),z(`div`,{className:`settings-row`,children:[I(`button`,{type:`button`,className:`btn-danger`,onClick:()=>void f(`full_access`),children:e(`settings.permissions.turnOn`)}),I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>s(!1),children:e(`settings.key.cancel`)})]})]})]}),c&&I(`p`,{className:`settings-error`,role:`alert`,children:c}),n&&n.length===0&&I(`p`,{className:`settings-hint`,children:e(`settings.permissions.none`)}),!!n?.length&&I(oq,{title:e(`settings.permissions.chats`),count:n.length,defaultOpen:!0,children:n.map(t=>z(`section`,{className:`settings-field permission-chat`,"aria-label":m(t.session_id),children:[z(`div`,{className:`settings-row settings-row-between`,children:[I(`bdi`,{className:`settings-label`,children:m(t.session_id)}),t.mode===`full_access`&&I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>d(async()=>{let e=(await kt(t.session_id,`ask`)).mode;gR(t.session_id,e)}),children:e(`settings.permissions.turnOff`)})]}),t.grants.length>0&&I(`ul`,{className:`grant-list`,children:t.grants.map(n=>z(`li`,{className:`grant-row`,children:[I(`code`,{children:n.label}),I(`button`,{type:`button`,className:`link-btn`,onClick:()=>d(()=>Tt(t.session_id,n.key)),"aria-label":e(`settings.permissions.revokeAria`,{name:n.label}),children:e(`settings.permissions.revoke`)})]},n.key))}),t.grants.length>1&&I(`button`,{type:`button`,className:`link-btn`,onClick:()=>d(()=>Tt(t.session_id)),children:e(`settings.permissions.revokeAll`)})]},t.session_id))})]})}var $q=(e,t)=>!e.error&&(!e.installed||e.update)&&(t||!e.has_code);function eJ(e,t){let n=e.added.filter(e=>e.updated).map(e=>e.name),r=e.added.filter(e=>!e.updated).map(e=>e.name),i=(e,n)=>n.length>3?t(`settings.skills.link.${e}Count`,{n:n.length}):t(`settings.skills.link.${e}`,{names:n.join(`, `)});return[r.length?i(`added`,r):``,n.length?i(`updated`,n):``].filter(Boolean).join(` `)}function tJ({onAdded:e}){let t=R(),[n,r]=(0,V.useState)(``),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),[d,f]=(0,V.useState)(new Set),[p,m]=(0,V.useState)(!1),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)([]);(0,V.useEffect)(()=>{let e=!1;return jt().then(t=>{e||v(t.libraries)}).catch(n=>{e||s(t(`settings.skills.link.featuredFailed`,{error:CM(n,t)}))}),()=>{e=!0}},[t]);let y=async e=>{if(e.trim()){a(`preview`),s(null),l(null),g(null);try{let t=await rn(e.trim());l(t),f(new Set(t.skills.filter(e=>$q(e,!1)).map(e=>e.name)))}catch(e){s(CM(e,t))}finally{a(null)}}},b=async()=>{if(c&&d.size!==0){a(`add`),s(null);try{let t=await bt(c.link,[...d],p,c.pin);g(t),l(null),r(``),t.added.length&&e()}catch(e){s(CM(e,t))}finally{a(null)}}},x=e=>f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),S=e=>{if(m(e),!e&&c){let e=new Set(c.skills.filter(e=>e.has_code).map(e=>e.name));f(t=>new Set([...t].filter(t=>!e.has(t))))}},C=c?.skills.filter(e=>$q(e,p))??[],w=C.length>0&&C.every(e=>d.has(e.name)),T=c?.skills.some(e=>e.has_code&&!e.error)??!1;return z(`div`,{className:`settings-card skill-link`,children:[z(`div`,{className:`skill-link-top`,children:[I(`span`,{className:`settings-label`,children:t(`settings.skills.link.title`)}),_.map(e=>{let n=`settings.skills.link.featured.${e.id}`,a=ae(n);return I(`button`,{type:`button`,className:`btn-secondary skill-link-chip`,onClick:()=>{r(e.url),y(e.url)},disabled:i!==null,title:a?t(n):e.description,"aria-label":t(`settings.skills.link.getAria`,{name:e.name,description:a?u(n):e.description}),children:t(`settings.skills.link.get`,{name:e.name})},e.id)})]}),z(`form`,{className:`skill-link-form`,onSubmit:e=>{e.preventDefault(),y(n)},children:[I(`input`,{className:`settings-input`,type:`text`,inputMode:`url`,value:n,onChange:e=>r(e.target.value),onPaste:e=>{let t=e.clipboardData.getData(`text`).trim();t&&(e.preventDefault(),r(t),y(t))},placeholder:t.bare(`settings.skills.link.placeholder`),title:t(`settings.skills.link.hint`),"aria-label":t(`settings.skills.link.aria`),disabled:i!==null}),I(`button`,{type:`submit`,className:`btn-secondary`,disabled:!n.trim()||i!==null,children:i===`preview`?z(P.Fragment,{children:[I(La,{size:13,className:`spin`}),` `,t(`settings.skills.link.reading`)]}):t(`settings.skills.link.read`)})]}),o&&I(`p`,{className:`settings-error`,role:`alert`,children:o}),c&&z(`div`,{className:`skill-link-preview`,children:[z(`details`,{className:`skill-link-warning`,role:`note`,children:[z(`summary`,{children:[I(ws,{size:14,"aria-hidden":`true`}),t(`settings.skills.link.trust`)]}),I(`p`,{children:I(`bdi`,{children:c.warning})})]}),z(`div`,{className:`skill-link-head`,children:[I(`span`,{children:t(`settings.skills.link.found`,{n:c.skills.length,source:c.source})}),C.length>1&&I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>f(w?new Set:new Set(C.map(e=>e.name))),children:t(w?`settings.skills.link.none`:`settings.skills.link.all`)})]}),I(`ul`,{className:`skill-list skill-link-list`,children:c.skills.map(e=>{let n=$q(e,p),r=e.error?e.verdict===`BLOCK`?t(`settings.skills.link.tagBlocked`):t(`settings.skills.link.tagUnreadable`):e.installed&&!e.update?t(`settings.skills.link.tagElsewhere`):e.update?t(`settings.skills.link.tagUpdate`):null,i=e.error??(e.installed&&!e.update?t(`settings.skills.link.whyElsewhere`):e.update?t(`settings.skills.link.whyUpdate`):null),a=!!i||e.findings.length>0||e.has_code&&!p;return I(`li`,{className:`skill-row`,children:z(`label`,{className:`skill-link-pick`,children:[I(`input`,{type:`checkbox`,checked:n&&d.has(e.name),disabled:!n,onChange:()=>x(e.name),"aria-label":t(`settings.skills.link.addAria`,{name:e.name})}),z(`span`,{className:`skill-row-text`,children:[z(`span`,{className:`skill-row-name`,children:[e.name,r&&I(`span`,{className:`skill-link-tag${e.error?` is-bad`:``}`,children:r}),e.has_code&&I(`span`,{className:`skill-link-tag`,children:t(`settings.skills.link.tagCode`)}),e.verdict===`REVIEW`&&I(`span`,{className:`skill-link-tag`,children:t(`settings.skills.link.tagReview`)})]}),e.description&&I(`span`,{className:`skill-row-desc skill-link-desc`,dir:`auto`,title:e.description,children:I(`bdi`,{children:e.description})}),e.permissions.length>0?z(`span`,{className:`skill-link-perms`,children:[I(`span`,{className:`skill-link-perms-label`,children:t(`settings.skills.link.can`)}),I(`ul`,{"aria-label":t(`settings.skills.link.permsAria`,{name:e.name}),children:e.permissions.map(e=>z(`li`,{children:[I(`bdi`,{children:e.text}),` `,I(`bdi`,{dir:`ltr`,children:I(`code`,{children:e.grant})})]},e.grant))})]}):I(`span`,{className:`skill-link-perms`,children:t(e.permissions_unreadable?`settings.skills.link.permissionsUnreadable`:`settings.skills.link.noPermissions`)}),a&&z(`details`,{className:`skill-link-findings`,children:[I(`summary`,{children:t(`settings.skills.link.details`)}),i&&I(`p`,{children:I(`bdi`,{children:i})}),e.has_code&&!p&&I(`p`,{children:t(`settings.skills.link.shipsCode`)}),e.findings.length>0&&I(`ul`,{children:e.findings.map(e=>I(`li`,{children:I(`bdi`,{children:e})},e))})]})]})]})},e.path)})}),z(`div`,{className:`skill-link-actions`,children:[T&&z(`label`,{className:`skill-link-code`,title:t(`settings.skills.link.codeHint`),children:[I(`input`,{type:`checkbox`,checked:p,onChange:e=>S(e.target.checked)}),I(`span`,{children:t(`settings.skills.link.includeCode`)})]}),I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>l(null),disabled:i!==null,children:t(`settings.skills.link.cancel`)}),I(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void b(),disabled:d.size===0||i!==null,children:i===`add`?z(P.Fragment,{children:[I(La,{size:13,className:`spin`}),` `,t(`settings.skills.link.adding`)]}):t(`settings.skills.link.add`,{n:d.size})})]})]}),h&&z(`div`,{className:`skill-link-result`,role:`status`,children:[h.added.length>0&&I(`p`,{children:eJ(h,t)}),Object.keys(h.failed).length>0&&z(`details`,{children:[I(`summary`,{children:t(`settings.skills.link.notAdded`,{n:Object.keys(h.failed).length})}),I(`ul`,{className:`grant-list`,children:Object.entries(h.failed).map(([e,t])=>z(`li`,{children:[I(`bdi`,{children:I(`strong`,{children:e})}),` — `,I(`bdi`,{children:t})]},e))})]})]})]})}var nJ={path:`~/.gaia/skills`},rJ=[{source:`agent-bundled`,title:`settings.skills.bundled`,note:`settings.skills.bundledNote`},{source:`user`,title:`settings.skills.yours`,note:`settings.skills.yoursNote`,empty:`settings.skills.yoursEmpty`,params:nJ},{source:`claude-project`,title:`settings.skills.project`,note:`settings.skills.projectNote`,params:{path:`.claude/skills`}},{source:`claude-import`,title:`settings.skills.import`,note:`settings.skills.importNote`}];function iJ(e){return/description is \d+ characters/.test(e)?`settings.skills.skipped.tooLong`:/'description' is missing/.test(e)?`settings.skills.skipped.noDescription`:`settings.skills.skipped.other`}function aJ({text:e}){let t=R(),n=(0,V.useRef)(null),[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(!1);return(0,V.useLayoutEffect)(()=>{let e=n.current;if(!e||r)return;let t=()=>o(e.scrollHeight>e.clientHeight+1);if(t(),typeof ResizeObserver>`u`)return;let i=new ResizeObserver(t);return i.observe(e),()=>i.disconnect()},[e,r]),z(P.Fragment,{children:[I(`span`,{ref:n,className:`skill-row-desc${r?` is-open`:``}${a||r?` is-toggle`:``}`,dir:`auto`,onClick:a||r?()=>i(!r):void 0,children:I(`bdi`,{children:e})}),(a||r)&&I(`button`,{type:`button`,className:`skill-row-more`,"aria-expanded":r,onClick:()=>i(!r),children:t(r?`settings.skills.less`:`settings.skills.more`)})]})}function oJ({onUseSkill:e}){let t=R(),[n,r]=(0,V.useState)(null),[i,a]=(0,V.useState)({}),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(``),u=(0,V.useRef)(null),d=(0,V.useRef)(!0),f=(0,V.useCallback)(()=>{Ut().then(e=>{d.current&&(r(e.skills),a(e.invalid),s(null))}).catch(e=>{d.current&&s(e instanceof Error?e.message:String(e))})},[]);(0,V.useEffect)(()=>(d.current=!0,f(),window.addEventListener(`focus`,f),()=>{d.current=!1,window.removeEventListener(`focus`,f)}),[f]);let p=c.trim().toLowerCase(),m=(n??[]).filter(e=>!p||e.name.toLowerCase().includes(p)||e.description.toLowerCase().includes(p)),h=n?.every(e=>rJ.some(t=>t.source===e.source))??!1,g=n=>z(`li`,{className:`skill-row`,children:[z(`div`,{className:`skill-row-text`,children:[z(`span`,{className:`skill-row-name`,children:[I(`span`,{title:n.version?`v${n.version}`:void 0,children:n.name}),n.always_on&&z(`span`,{className:`skill-row-meta`,children:[` · `,t(`settings.skills.alwaysOn`)]})]}),I(aJ,{text:n.description})]}),!n.always_on&&I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>e(n.name),"aria-label":t(`settings.skills.useAria`,{name:n.name}),children:t(`settings.skills.try`)})]},n.name);return z(`div`,{className:`settings-pane`,children:[I(`h2`,{className:`settings-pane-title`,children:t(`settings.section.skills`)}),I(`p`,{className:`settings-pane-lede`,children:t(`settings.skills.lede`)}),z(`details`,{className:`settings-more`,children:[z(`summary`,{children:[I(Gr,{size:13,className:`settings-disclosure-chevron`,"aria-hidden":`true`}),` `,t(`settings.model.howItWorks`)]}),I(`p`,{className:`settings-hint`,children:t(`settings.skills.how`,nJ)})]}),I(tJ,{onAdded:f}),o&&I(`p`,{className:`settings-error`,role:`alert`,children:o}),!n&&!o&&z(`p`,{className:`settings-hint`,children:[I(La,{size:13,className:`spin`}),` `,t(`settings.loading`)]}),n&&n.length>6&&I(`input`,{ref:u,className:`settings-input`,type:`search`,value:c,onChange:e=>l(e.target.value),placeholder:t(`settings.skills.search`),"aria-label":t(`settings.skills.search`)}),n&&n.length===0&&I(`p`,{className:`settings-hint`,children:t(`settings.skills.none`)}),p&&n&&n.length>0&&m.length===0&&z(`p`,{className:`settings-hint`,role:`status`,children:[t(`settings.skills.noMatch`,{query:c.trim()}),` `,I(`button`,{type:`button`,className:`link-btn`,onClick:()=>{l(``),u.current?.focus()},children:t(`settings.skills.clearSearch`)})]}),h?rJ.map(e=>{let n=m.filter(t=>t.source===e.source);return n.length===0&&(p||!e.empty)?null:I(oq,{title:t(e.title),count:n.length,hint:t(e.note,e.params),defaultOpen:e.source===`agent-bundled`||e.source===`user`&&n.length>0,forceOpen:!!p,children:I(`section`,{"aria-label":t(e.title),children:n.length===0?I(`p`,{className:`settings-hint`,children:e.empty&&t(e.empty,e.params)}):I(`ul`,{className:`skill-list`,children:n.map(g)})})},e.source)}):I(`ul`,{className:`skill-list`,children:m.map(g)}),Object.keys(i).length>0&&z(`div`,{className:`settings-card`,role:`alert`,children:[I(`span`,{className:`settings-label`,children:t(`settings.skills.skipped`)}),I(`ul`,{className:`grant-list`,children:Object.entries(i).map(([e,n])=>I(`li`,{children:t(iJ(n),{name:e.split(/[\\/]/).filter(Boolean).pop()??e})},e))})]})]})}var sJ=`profile`;function cJ(){let e=R(),[t,n]=(0,V.useState)(null),[r,i]=(0,V.useState)(null),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)(!1);(0,V.useEffect)(()=>{kU().then(n).catch(e=>i(e instanceof Error?e.message:String(e)))},[]);let l=(0,V.useCallback)(async e=>{o(!0),i(null),c(!1);try{let t=await AU(e===sJ?null:e);n(t),c(t.changed!==!1)}catch(e){i(e instanceof Error?e.message:String(e)),await kU().then(n).catch(()=>void 0)}finally{o(!1)}},[]);if(!t)return r?I(`p`,{className:`settings-error`,role:`alert`,children:r}):z(`p`,{className:`settings-hint`,children:[I(La,{size:13,className:`spin`}),` `,e(`settings.memory.embedder.checking`)]});let u=t.options.find(e=>e.device===t.device),d=t=>e.bare(t===`npu`?`settings.memory.embedder.npu`:`settings.memory.embedder.gpu`);return z(P.Fragment,{children:[z(`div`,{className:`model-in-use-field`,children:[I(`label`,{className:`settings-label`,htmlFor:`embedder-device`,children:e(`settings.memory.embedder.label`)}),z(`select`,{id:`embedder-device`,className:`settings-input`,value:t.chosen?t.device:sJ,onChange:e=>void l(e.target.value),disabled:a,children:[I(`option`,{value:sJ,children:e.bare(`settings.memory.embedder.default`,{device:d(t.default_device)})}),t.options.map(t=>I(`option`,{value:t.device,disabled:t.available===!1,children:t.present===!1?e.bare(`settings.memory.embedder.unavailable`,{device:d(t.device)}):t.proven?d(t.device):e.bare(`settings.memory.embedder.unproven`,{device:d(t.device)})},t.device))]})]}),z(`span`,{className:`settings-hint`,children:[e(`settings.memory.embedder.runsOn`,{name:he(u?.display_name??t.device,`ltr`),device:d(t.device)}),` `,e(`settings.memory.embedder.why`)]}),t.options.some(e=>e.device===`npu`&&!e.proven&&e.present)&&I(`span`,{className:`settings-hint`,children:e(`settings.memory.embedder.npuUnproven`)}),u?.downloaded===!1&&I(`span`,{className:`settings-hint`,children:e(`settings.memory.embedder.notDownloaded`)}),a&&z(`span`,{className:`settings-hint`,children:[I(La,{size:13,className:`spin`}),` `,e(`settings.memory.embedder.applying`)]}),s&&I(`p`,{className:`settings-ok`,role:`status`,children:e(`settings.memory.embedder.changed`)}),r&&I(`p`,{className:`settings-error`,role:`alert`,children:r})]})}function lJ(){let e=R(),t=B(e=>e.setShowMemoryDashboard),n=B(e=>e.closeSettings),[r,i]=(0,V.useState)(null),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(!1);(0,V.useEffect)(()=>{DU().then(i).catch(e=>o(e instanceof Error?e.message:String(e)))},[]);let l=(0,V.useCallback)(async()=>{if(r){c(!0),o(null);try{i(await OU({memory_enabled:!r.memory_enabled}))}catch(e){o(e instanceof Error?e.message:String(e))}finally{c(!1)}}},[r]);return z(`div`,{className:`settings-pane`,children:[I(`h2`,{className:`settings-pane-title`,children:e(`settings.section.memory`)}),I(`p`,{className:`settings-pane-lede`,children:e(`settings.memory.lede`)}),z(`section`,{className:`settings-card`,"aria-label":e(`settings.section.memory`),children:[z(`label`,{className:`setting-row`,children:[I(`span`,{children:e(`settings.memory.remember`)}),z(`span`,{className:`toggle-switch`,children:[I(`input`,{type:`checkbox`,checked:!!r?.memory_enabled,onChange:()=>void l(),disabled:!r||s,"aria-label":e(`settings.memory.remember`)}),I(`span`,{className:`toggle-track`})]})]}),a&&I(`p`,{className:`settings-error`,role:`alert`,children:a}),z(`div`,{className:`settings-row settings-row-between`,children:[I(`span`,{className:`settings-hint`,children:e(`settings.memory.dashboardHint`)}),I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{n(),t(!0)},children:e(`settings.memory.dashboard`)})]})]}),I(`section`,{className:`settings-card`,"aria-label":e(`settings.memory.embedder.label`),children:I(cJ,{})})]})}function uJ(e,t,n){if(!/^\d+$/.test(e.trim()))return!1;let r=Number(e);return r>=t&&r<=n}function dJ(e){return e<1048576?`${Math.ceil(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function fJ(){let e=R(),[t,n]=(0,V.useState)(null),[r,i]=(0,V.useState)(``),[a,o]=(0,V.useState)(``),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(!1);(0,V.useEffect)(()=>{ue().then(e=>{n(e),i(String(e.retention_days)),o(String(e.max_mb))},t=>c({ok:!1,text:e(`settings.undo.readFailed`,{reason:t instanceof Error?t.message:String(t)})}))},[e]);let[d,f]=(0,V.useState)({days:!1,mb:!1}),p=!uJ(r,1,365)||d.days,m=!uJ(a,10,1e5)||d.mb,h=t!==null&&(r!==String(t.retention_days)||a!==String(t.max_mb)),g=async()=>{if(!(p||m)){u(!0),c(null);try{let t=await Oe(Number(r),Number(a));n(t),c({ok:!0,text:e(`settings.undo.saved`)})}catch(t){let n=t instanceof Nt&&t.httpStatus===422?t.fields:[],r=n.includes(`retention_days`),i=n.includes(`max_mb`);r||i?(f({days:r,mb:i}),c({ok:!1,text:e(`settings.undo.fix`)})):c({ok:!1,text:t instanceof Error?t.message:String(t)})}finally{u(!1)}}};return z(`div`,{className:`settings-field`,"aria-label":e(`settings.privacy.undo`),children:[I(`span`,{className:`settings-label`,children:e(`settings.privacy.undo`)}),I(`p`,{className:`settings-hint`,children:e(`settings.undo.hint`)}),t&&z(P.Fragment,{children:[z(`div`,{className:`setting-row`,children:[I(`label`,{htmlFor:`undo-days`,children:e(`settings.undo.days`)}),I(`input`,{id:`undo-days`,type:`number`,className:`model-input undo-history-input`,min:1,max:365,value:r,"aria-invalid":p,"aria-describedby":p?`undo-days-error`:void 0,onChange:e=>{i(e.target.value),f(e=>({...e,days:!1}))}})]}),p&&I(`p`,{id:`undo-days-error`,className:`settings-error`,children:e(`settings.undo.daysError`)}),z(`div`,{className:`setting-row`,children:[I(`label`,{htmlFor:`undo-mb`,children:e(`settings.undo.mb`)}),I(`input`,{id:`undo-mb`,type:`number`,className:`model-input undo-history-input`,min:10,max:1e5,value:a,"aria-invalid":m,"aria-describedby":m?`undo-mb-error`:void 0,onChange:e=>{o(e.target.value),f(e=>({...e,mb:!1}))}})]}),m&&I(`p`,{id:`undo-mb-error`,className:`settings-error`,children:e(`settings.undo.mbError`)}),z(`div`,{className:`setting-row setting-row-path`,children:[I(`span`,{children:e(`settings.undo.inUse`)}),z(`span`,{children:[e.plural(`settings.undo.used`,t.turns,{size:dJ(t.used_bytes)}),` `,I(`bdi`,{dir:`ltr`,children:I(`code`,{className:`setting-path`,children:t.path})})]})]}),I(`button`,{type:`button`,className:`btn-primary`,onClick:()=>void g(),disabled:!h||l||p||m,children:e(l?`settings.models.applying`:`settings.advanced.save`)})]}),s&&I(`p`,{className:s.ok?`settings-ok`:`settings-error`,role:s.ok?`status`:`alert`,children:s.text})]})}var pJ={root:`settings-report`,button:`btn-secondary`,hint:`settings-hint`,error:`settings-error`};function mJ(){let e=R(),t=B(e=>e.sessions),n=B(e=>e.removeSession),r=Tc(),i=B(e=>e.systemStatus?.data_dir),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(null),[p,m]=(0,V.useState)(!1),[h,g]=(0,V.useState)(null);(0,V.useEffect)(()=>{let e=!0;return Je().then(t=>{e&&f(t.network_policy===`local_ai_only`)}).catch(t=>{e&&g({ok:!1,text:t instanceof Error?t.message:String(t)})}),()=>{e=!1}},[]);let _=(0,V.useCallback)(async()=>{if(d===null||p)return;let t=d,n=_c.getState().active?.model,r=!t;f(r),m(!0),g(null);try{let t=await xe({network_policy:r?`local_ai_only`:`cloud_allowed`});f(t.network_policy===`local_ai_only`),vc(n);let i=t.policy_notices??[],a=i.some(e=>e.severity===`warning`),o=i.length?i.map(t=>t.code===`users_server_keeps_keys`?e(`settings.privacy.usersServerKeepsKeys`,{url:t.url??``}):t.code===`runtime_keys_not_dropped`?e(`settings.privacy.runtimeKeysNotDropped`,{reason:t.reason??``}):t.code===`saved_models_not_checked`&&t.cause===`model_server_down`&&t.models?.length?e.plural(`settings.privacy.savedModelNotCheckedServerDown`,t.models.length,{models:t.models.join(`, `)}):t.code===`saved_models_not_checked`?e(`settings.privacy.savedModelsNotChecked`,{reason:t.reason??``}):e(`settings.privacy.policyNoticeUnknown`)).join(` `):e(r?`settings.privacy.localOnlyOn`:`settings.privacy.localOnlyOff`);g({ok:!a,text:o})}catch(e){f(t),g({ok:!1,text:e instanceof Error?e.message:String(e)})}finally{m(!1)}},[d,p,e]),v=(0,V.useCallback)(async t=>{try{await $t(t,!1)}catch(t){u({ok:!1,text:e(`settings.privacy.openFolderFailed`,{reason:t instanceof Error?t.message:String(t)})})}},[e]),y=(0,V.useCallback)(async()=>{c(!0);let r=[];for(let e of t)try{await Vn(e.id),n(e.id)}catch(t){r.push(`${e.title}: ${t instanceof Error?t.message:t}`)}c(!1),o(null),u(r.length?{ok:!1,text:e(`settings.privacy.deleteFailed`,{n:r.length,reason:r.join(`; `)})}:{ok:!0,text:e(`settings.privacy.deleted`)})},[n,t,e]);return z(`div`,{className:`settings-pane`,children:[I(`h2`,{className:`settings-pane-title`,children:e(`settings.section.privacy`)}),z(`section`,{className:`settings-card`,"aria-label":e(`settings.privacy.localOnlyTitle`),children:[z(`div`,{children:[z(`label`,{className:`setting-row`,children:[I(`strong`,{children:e(`settings.privacy.localOnlyTitle`)}),z(`span`,{className:`toggle-switch`,children:[I(`input`,{type:`checkbox`,role:`switch`,checked:d===!0,"aria-label":e(`settings.privacy.localOnlyTitle`),"aria-describedby":`privacy-local-only-hint`,onChange:()=>void _(),disabled:d===null,"aria-busy":p}),I(`span`,{className:`toggle-track`})]})]}),I(`p`,{className:`settings-hint`,id:`privacy-local-only-hint`,children:e(`settings.privacy.localOnlyHint`)})]}),h&&I(`p`,{className:h.ok?`settings-ok`:`settings-error`,role:h.ok?`status`:`alert`,children:h.text})]}),z(`section`,{className:`settings-card`,"aria-labelledby":`privacy-where-title`,children:[I(`h3`,{className:`settings-label`,id:`privacy-where-title`,children:e(`settings.privacy.whereTitle`)}),I(`p`,{className:`settings-note`,children:e(`settings.privacy.stays`)}),I(`p`,{className:r?.remote?`settings-note`:`settings-hint`,children:r?.remote?e(`settings.privacy.remote`,{name:r.label}):e(r?`settings.privacy.local`:`settings.privacy.unknown`)}),i&&z(`div`,{className:`setting-row setting-row-path`,children:[I(`span`,{children:e(`settings.privacy.dataFolder`)}),z(`span`,{className:`setting-path-actions`,children:[I(`bdi`,{dir:`ltr`,className:`setting-path`,children:i}),I(`button`,{type:`button`,className:`link-btn`,onClick:()=>void v(i),children:e(`settings.privacy.openFolder`)})]})]})]}),z(`section`,{className:`settings-card`,"aria-labelledby":`privacy-report-title`,children:[I(`h3`,{className:`settings-label`,id:`privacy-report-title`,children:e(`settings.privacy.reportTitle`)}),I(`p`,{className:`settings-note`,children:e(`settings.privacy.reportNote`)}),I(wN,{classes:pJ})]}),I(oq,{title:e(`settings.privacy.undo`),children:I(fJ,{})}),z(`section`,{className:`settings-card`,"aria-labelledby":`privacy-delete-title`,children:[I(`h3`,{className:`settings-label`,id:`privacy-delete-title`,children:e(`settings.privacy.deleteTitle`)}),I(`p`,{className:`danger-warning`,children:t.length===0?e(`settings.privacy.nothingToDelete`):e(`settings.privacy.deleteWarning`)}),I(`button`,{type:`button`,className:`btn-danger`,onClick:()=>{u(null),o(t.length)},disabled:t.length===0,children:e(`settings.privacy.delete`)})]}),a!==null&&z(OG,{title:e.plural(`settings.privacy.deleteAsk`,a),confirmLabel:e.plural(`settings.privacy.deleteYes`,a),cancelLabel:e(`settings.privacy.deleteCancel`),onConfirm:()=>void y(),onCancel:()=>o(null),danger:!0,busy:s,children:[I(`p`,{children:e(`settings.privacy.deleteWarning`)}),I(`p`,{children:e(`settings.privacy.deleteFinal`)})]}),l&&I(`p`,{className:l.ok?`settings-ok`:`settings-error`,role:l.ok?`status`:`alert`,children:l.text})]})}var hJ=[{id:`needs_approval`,label:`settings.alerts.approval`},{id:`question`,label:`settings.alerts.question`},{id:`finished`,label:`settings.alerts.finished`}],gJ=[{value:`banner`,label:`settings.alerts.banner`},{value:`badge`,label:`settings.alerts.badge`},{value:`off`,label:`settings.alerts.off`}],_J=[0,10,20,30,50];function vJ(){return typeof Notification>`u`?`unsupported`:Notification.permission}function yJ(){let e=R(),t=kl(),n=!!window.gaiaAPI,[r,i]=(0,V.useState)(vJ),a=Object.values(t.modes).includes(`banner`);return z(`div`,{className:`settings-pane`,children:[I(`h2`,{className:`settings-pane-title`,children:e(`settings.section.notifications`)}),I(`p`,{className:`settings-pane-lede`,children:e(`settings.alerts.lede`)}),z(`section`,{className:`settings-card`,"aria-label":e(`settings.alerts.when`),children:[hJ.map(n=>z(`div`,{className:`setting-row`,children:[I(`span`,{id:`alert-${n.id}`,children:e(n.label)}),I(Fz,{className:`segmented`,"aria-labelledby":`alert-${n.id}`,children:gJ.map(r=>I(`button`,{type:`button`,role:`radio`,"aria-checked":t.modes[n.id]===r.value,className:t.modes[n.id]===r.value?`is-active`:``,onClick:()=>t.setMode(n.id,r.value),children:e(r.label)},r.value))})]},n.id)),!n&&a&&r!==`granted`&&(r==="default"?I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{Notification.requestPermission().then(i).catch(e=>{console.error(`[alerts] Notification permission request failed`,e),i(vJ())})},children:e(`settings.alerts.allow`)}):I(`p`,{className:`settings-error`,role:`alert`,children:e(r===`unsupported`?`settings.alerts.unsupported`:`settings.alerts.blocked`)})),z(`label`,{className:`setting-row`,children:[I(`span`,{children:e(`settings.alerts.sound`)}),z(`span`,{className:`toggle-switch`,children:[I(`input`,{type:`checkbox`,checked:t.sound,onChange:()=>t.update({sound:!t.sound}),"aria-label":e(`settings.alerts.sound`)}),I(`span`,{className:`toggle-track`})]})]}),n&&z(`label`,{className:`setting-row`,children:[I(`span`,{children:e(`settings.alerts.flash`)}),z(`span`,{className:`toggle-switch`,children:[I(`input`,{type:`checkbox`,checked:t.flash,onChange:()=>t.update({flash:!t.flash}),"aria-label":e(`settings.alerts.flash`)}),I(`span`,{className:`toggle-track`})]})]})]}),z(`section`,{className:`settings-card`,"aria-labelledby":`keep-awake-title`,children:[I(`h3`,{className:`settings-label`,id:`keep-awake-title`,children:e(`settings.alerts.keepAwakeTitle`)}),n?z(P.Fragment,{children:[z(`label`,{className:`setting-row`,children:[I(`span`,{children:e(`settings.alerts.keepAwake`)}),z(`span`,{className:`toggle-switch`,children:[I(`input`,{type:`checkbox`,checked:t.keepAwake,onChange:()=>t.update({keepAwake:!t.keepAwake}),"aria-label":e(`settings.alerts.keepAwake`)}),I(`span`,{className:`toggle-track`})]})]}),z(`div`,{className:`setting-row`,children:[I(`label`,{htmlFor:`battery-floor`,children:e(`settings.alerts.battery`)}),I(`select`,{id:`battery-floor`,className:`settings-input settings-select-compact`,value:t.batteryFloor,disabled:!t.keepAwake,onChange:e=>t.update({batteryFloor:Number(e.target.value)}),children:_J.map(t=>I(`option`,{value:t,children:t===0?e.bare(`settings.alerts.never`):`${t}%`},t))})]}),I(`p`,{className:`settings-hint`,children:e(`settings.alerts.screen`)})]}):I(`p`,{className:`settings-hint`,children:e(`settings.alerts.desktopOnly`)})]})]})}var bJ=[50,75,100,125,150,175,200],xJ=[{accent:`american`,gender:`female`},{accent:`american`,gender:`male`},{accent:`british`,gender:`female`},{accent:`british`,gender:`male`}],SJ=`settings:preview`,CJ=`Hello, I'm GAIA. This is how I'll read my replies to you.`;function wJ(e){return e instanceof Nt?e.detail||e.message:String(e)}function TJ(){let e=R(),t=iN(e=>e.settings),n=iN(e=>e.setSettings),r=iN(e=>e.read),i=iN(e=>e.stop),a=iN(e=>e.messageId===SJ),o=iN(e=>e.messageId===SJ&&e.status===`loading`),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(!1);(0,V.useEffect)(()=>{GM().then(n).catch(e=>c(wJ(e)))},[n]);let p=e=>{f(!0),u(null),iN.getState().messageId===SJ&&i(),KM(e).then(n).catch(e=>u(wJ(e))).finally(()=>f(!1))};return s?z(`div`,{className:`settings-pane`,children:[I(`h2`,{className:`settings-pane-title`,children:e(`settings.section.voice`)}),I(`p`,{className:`settings-error`,role:`alert`,children:e(`readAloud.settings.loadFailed`,{reason:s})})]}):t?z(`div`,{className:`settings-pane`,children:[I(`h2`,{className:`settings-pane-title`,children:e(`settings.section.voice`)}),I(`p`,{className:`settings-pane-lede`,children:e(`readAloud.settings.lede`)}),z(`div`,{className:`settings-field`,children:[I(`label`,{className:`settings-label`,htmlFor:`read-aloud-voice`,children:e(`readAloud.settings.voice`)}),z(`div`,{className:`read-aloud-voice-row`,children:[I(`select`,{id:`read-aloud-voice`,className:`settings-input`,value:t.voice,disabled:d,onChange:e=>p({voice:e.target.value}),children:xJ.map(n=>I(`optgroup`,{label:e(`readAloud.group.${n.accent}.${n.gender}`),children:t.voices.filter(e=>e.accent===n.accent&&e.gender===n.gender).map(e=>I(`option`,{value:e.id,lang:`en`,children:e.name},e.id))},`${n.accent}-${n.gender}`))}),z(`button`,{type:`button`,className:`btn-secondary`,"aria-pressed":a,disabled:d,onClick:()=>a?i():void r(SJ,CJ),children:[o?I(La,{size:13,className:`spin`}):I(a?vs:As,{size:13}),e(a?`readAloud.stop`:`readAloud.settings.preview`)]})]}),I(`span`,{className:`settings-hint`,children:e(`readAloud.settings.englishOnly`)}),I(sN,{messageId:SJ})]}),z(`div`,{className:`settings-field`,children:[I(`label`,{className:`settings-label`,htmlFor:`read-aloud-speed`,children:e(`readAloud.settings.speed`)}),I(`select`,{id:`read-aloud-speed`,className:`settings-input`,value:t.speed,disabled:d,onChange:e=>p({speed:Number(e.target.value)}),children:(bJ.includes(t.speed)?bJ:[...bJ,t.speed].sort((e,t)=>e-t)).map(t=>I(`option`,{value:t,children:t===100?e.bare(`readAloud.settings.normalSpeed`):`⁦${(t/100).toLocaleString(e.locale)}×⁩`},t))})]}),z(`label`,{className:`setting-row`,children:[I(`span`,{children:e(`readAloud.settings.auto`)}),z(`span`,{className:`toggle-switch`,children:[I(`input`,{type:`checkbox`,checked:t.auto,disabled:d,onChange:()=>p({auto:!t.auto}),"aria-label":e(`readAloud.settings.auto`)}),I(`span`,{className:`toggle-track`})]})]}),I(`p`,{className:`settings-hint`,children:e(`readAloud.settings.shared`)}),l&&I(`p`,{className:`settings-error`,role:`alert`,children:e(`readAloud.settings.saveFailed`,{reason:l})})]}):z(`p`,{className:`settings-hint`,children:[I(La,{size:13,className:`spin`}),` `,e(`settings.loading`)]})}function EJ(){let e=R(),t=B(e=>e.jumpToSetting),n=B(e=>e.closeSettings),r=B(e=>e.runSetupAgain),i=_c(e=>e.active),a=B(e=>e.systemStatus?.lemonade_running===!1),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(null),[p,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(!1);(0,V.useEffect)(()=>{qe().then(s).catch(e=>g(e instanceof Error?e.message:String(e))),re().then(l).catch(e=>g(e instanceof Error?e.message:String(e))),f().then(e=>d(e??null)).catch(e=>m(e instanceof Error?e.message:String(e)))},[]);let y=o?.catalog?.find(e=>e.id===o.chat_model.id),b=(i?.model?i.remote?i.label??xc(i.model):xc(i.model):null)??y?.name??null,x=(o?.catalog??[]).filter(e=>e.downloaded),S=x.reduce((e,t)=>e+(t.full_size_gb??0),0),C=[c?.gpu_name,c?.npu_detected?e(`setup.checks.npu`):null].filter(Boolean).join(` · `),w=HO(o?.system?.physical_memory,c?.ram_gb),T=w&&KO(e.locale,w),E=o?.capacity_gb==null?null:KO(e.locale,BO(o.capacity_gb)),D=E?T?e(`settings.setup.memoryOf`,{size:E,total:T}):e(`settings.setup.memoryFor`,{size:E}):T,O=[{title:e(`settings.setup.where`),rows:[{label:e(`settings.setup.chatRuns`),value:b,section:`model`,target:`.model-in-use`},{label:e(`settings.setup.cloudKeys`),value:null,section:`model`,target:`[data-settings-target="cloud-key"]`,provider:`fireworks`}]},{title:e(`setup.pc.step`),rows:[{label:e(`settings.setup.detected`),value:[C,D].filter(Boolean).join(` · `)||null},{label:e(`settings.setup.server`),value:o?.lemonade.mode===`external`?e(`settings.setup.serverYours`):e(`settings.setup.serverOwn`),section:`advanced`,target:`[data-settings-target="model-server"]`},{label:e(`setup.gpu.title`),value:null,section:`model`,target:`#settings-gpu-title`,provider:`local`,shown:!!u?.applies||!!p&&!kq(p)}]},{title:e(`setup.models.step`),rows:[{label:e(`settings.setup.models`),value:o?.catalog?e(`settings.setup.modelsValue`,{n:String(x.length),size:BO(S)}):null,section:`model`,target:`[data-settings-target="models-on-pc"]`,provider:`local`},{label:e(`settings.setup.context`),value:null,section:`model`,target:`#ctx-size`,shown:!!i?.model&&!i.remote&&i.downloaded!==!1}]},{title:e(`settings.setup.after`),rows:[{label:e(`settings.section.connectors`),value:null,section:`connectors`},{label:e(`settings.section.memory`),value:null,section:`memory`},{label:e(`settings.language`),value:null,section:`general`,target:`#ui-language`},{label:e(`settings.setup.signIn`),value:null,section:`general`,target:`#desktop-startOnLogin`,shown:!!window.gaiaAPI?.tray}]}];return z(`div`,{className:`settings-pane`,children:[I(`h2`,{className:`settings-pane-title`,children:e(`settings.section.setup`)}),I(`p`,{className:`settings-hint`,children:e(`settings.setup.lede`)}),z(`div`,{className:`settings-setup-status`,children:[z(`span`,{children:[I(`strong`,{children:e(a?`settings.setup.serverDown`:`settings.setup.ready`)}),b&&!a&&z(`span`,{className:`settings-hint`,children:[` `,I(`bdi`,{children:e(`settings.setup.running`,{name:b})})]})]}),I(`button`,{type:`button`,className:`btn-secondary`,"data-testid":`setup-run-again`,onClick:()=>v(!0),children:e(`settings.setup.runAgain`)})]}),h&&I(`p`,{className:`setup-error`,role:`alert`,children:h}),O.map(e=>z(`section`,{className:`settings-setup-group`,"aria-label":e.title,children:[I(`h3`,{className:`settings-label`,children:e.title}),e.rows.filter(e=>e.shown!==!1).map(e=>{let n=z(`span`,{children:[I(`span`,{className:`settings-setup-row-label`,children:e.label}),e.value&&I(`bdi`,{className:`settings-hint settings-setup-row-value`,children:e.value})]}),r=e.section;return r?z(`button`,{type:`button`,className:`settings-setup-row`,onClick:()=>t({section:r,target:e.target??`.settings-pane-title`,from:`setup`},e.provider),children:[n,I(Yr,{size:14,className:`settings-setup-chevron`,"aria-hidden":`true`})]},e.label):I(`div`,{className:`settings-setup-row is-fact`,children:n},e.label)})]},e.title)),_&&I(OG,{title:e(`settings.setup.confirmTitle`),confirmLabel:e(`settings.setup.confirmYes`),cancelLabel:e(`setup.again.notNow`),onConfirm:()=>{v(!1),n(),r(!0)},onCancel:()=>v(!1),children:I(`p`,{children:e(`settings.setup.confirmBody`)})})]})}var DJ=[{label:`settings.about.whatsNew`,href:`https://github.com/amd/gaia/releases`},{label:`settings.about.docs`,href:`https://amd-gaia.ai/docs/guides/agent-ui`},{label:`settings.about.report`,href:`https://github.com/amd/gaia/issues/new/choose`},{label:`settings.about.license`,href:`https://github.com/amd/gaia/blob/main/LICENSE.md`}];function OJ(){let e=R(),t=B(e=>e.openSettings),n=`GAIA v0.27.0rc2`,[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(null),s=(0,V.useRef)(null);(0,V.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]);let c=(0,V.useCallback)(async()=>{o(null);try{await navigator.clipboard.writeText(n),i(!0),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>i(!1),2e3)}catch(t){o(e(`settings.about.copyFailed`,{reason:t instanceof Error?t.message:String(t)}))}},[e,n]);return z(`div`,{className:`settings-pane`,children:[I(`h2`,{className:`settings-pane-title`,children:e(`settings.section.about`)}),z(`section`,{className:`settings-card`,"aria-labelledby":`about-version`,children:[z(`div`,{className:`settings-row settings-row-between`,children:[z(`span`,{children:[I(`strong`,{id:`about-version`,children:I(`bdi`,{dir:`ltr`,children:n})}),` `,I(`span`,{className:`beta-badge`,children:`BETA`})]}),z(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>void c(),children:[I(r?Vr:hi,{size:13,"aria-hidden":`true`}),e(r?`settings.about.copied`:`settings.about.copy`)]})]}),I(`p`,{className:`settings-hint`,children:e(`settings.advanced.about`)}),a&&I(`p`,{className:`settings-error`,role:`alert`,children:a})]}),z(`section`,{className:`settings-card`,"aria-label":e(`settings.about.links`),children:[I(`ul`,{className:`settings-about-links`,children:DJ.map(t=>I(`li`,{children:z(`a`,{href:t.href,target:`_blank`,rel:`noopener noreferrer`,children:[e(t.label),` `,I(ji,{size:12,"aria-hidden":`true`})]})},t.href))}),z(`p`,{className:`settings-hint`,children:[e(`settings.about.reportHint`),` `,I(`button`,{type:`button`,className:`link-btn`,onClick:()=>t(`privacy`),children:e(`settings.about.reportWhere`)})]})]})]})}var kJ=class extends V.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidUpdate(e){this.state.hasError&&e.resetKey!==this.props.resetKey&&this.setState({hasError:!1})}componentDidCatch(e,t){console.error(`[ErrorBoundary] ${this.props.area} failed to render:`,e,t.componentStack)}render(){return this.state.hasError?I(AJ,{variant:this.props.variant??`fill`,onRetry:()=>this.setState({hasError:!1})}):this.props.children}};function AJ({onRetry:e,variant:t}){let n=R();return z(`div`,{role:`alert`,className:`error-boundary error-boundary-${t}`,children:[I(`p`,{className:`error-boundary-title`,children:n(`errorBoundary.title`)}),I(`p`,{className:`error-boundary-body`,children:n(t===`window`?`errorBoundary.bodyWindow`:`errorBoundary.body`)}),z(`div`,{className:`error-boundary-actions`,children:[I(`button`,{type:`button`,className:`btn-primary`,onClick:e,children:n(`errorBoundary.retry`)}),I(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>window.location.reload(),children:n(`errorBoundary.reload`)})]})]})}var jJ=`modulepreload`,MJ=function(e,t){return new URL(e,t).href},NJ={},PJ=function(e){return e.pathname.endsWith(`.css`)},FJ=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},IJ=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=MJ(t,n);let r=s(t),i=PJ(r);return FJ(NJ,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`:jJ,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)=>{let i=a=>{t.removeEventListener(`load`,i),t.removeEventListener(`error`,i),a.type===`error`?n(Error(`Unable to preload CSS for ${r}`)):e(a)};t.addEventListener(`load`,i),t.addEventListener(`error`,i)})})}).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)})},LJ=(0,V.lazy)(()=>IJ(()=>import(`./ConnectorsPane-Dkat1zLC.js`).then(e=>({default:e.ConnectorsPane})),__vite__mapDeps([0,1,2,3]),import.meta.url)),RJ=(0,V.lazy)(()=>IJ(()=>import(`./MessagingSettings-DomiT2rX.js`).then(e=>({default:e.MessagingSettings})),__vite__mapDeps([4,1,2]),import.meta.url)),zJ=(0,V.lazy)(()=>IJ(()=>import(`./AutomationsSettings-4FWcRau9.js`).then(e=>({default:e.AutomationsSettings})),__vite__mapDeps([5,1,2]),import.meta.url)),BJ=(0,V.lazy)(()=>IJ(()=>import(`./AdvancedSettings-DHERtrno.js`).then(e=>({default:e.AdvancedSettings})),__vite__mapDeps([6,1,2]),import.meta.url)),VJ=[`general`,`setup`,`model`,`permissions`,`skills`,`connectors`,`messaging`,`automations`,`memory`,`notifications`,`voice`,`privacy`,`advanced`,`about`];function HJ({onUseSkill:e}){let t=R(),n=B(e=>e.settingsSection),r=B(e=>e.openSettings),i=B(e=>e.closeSettings),a=B(e=>e.settingsJump),o=(0,V.useRef)(null),s=(0,V.useRef)(null),c=n!==null;if(pt(c,i),on(o,c),lW(o,c,()=>o.current?.querySelector(`.settings-nav-item.is-active`)),(0,V.useLayoutEffect)(()=>{s.current&&(s.current.scrollTop=0)},[n]),(0,V.useEffect)(()=>{let e=s.current;if(!a||a.section!==n||!e)return;o.current?.querySelector(`[data-section="${n}"]`)?.focus();let t,r=null,i=()=>r?.scrollIntoView({block:`start`}),c=typeof ResizeObserver>`u`?null:new ResizeObserver(i),l=()=>c?.disconnect(),u=[`wheel`,`touchstart`,`pointerdown`,`keydown`],d=()=>{let n=e.querySelector(a.target);if(!n||n.disabled)return!1;for(let e=n.closest(`details`);e;e=e.parentElement?.closest(`details`)??null)e.open=!0;r=n.closest(`.model-in-use-field, .settings-field, details, .settings-card`)??n,r.classList.add(`settings-target-hit`),i();let o=n instanceof HTMLDetailsElement?n.querySelector(`summary`):n.closest(`summary`)??n;o&&(o.matches(`summary, button, input, select, textarea, a[href], [tabindex]`)||(o.tabIndex=-1),o.focus({preventScroll:!0}));let s=n.closest(`.settings-pane`);return s&&c?.observe(s),t=setTimeout(()=>r?.classList.remove(`settings-target-hit`),1600),!0},f=new MutationObserver(()=>{d()&&f.disconnect()});d()||f.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`disabled`]}),u.forEach(t=>e.addEventListener(t,l,{passive:!0}));let p=setTimeout(()=>f.disconnect(),5e3);return()=>{f.disconnect(),l(),u.forEach(t=>e.removeEventListener(t,l)),clearTimeout(p),clearTimeout(t)}},[a,n]),!n)return null;let l=a&&a.section===n?a.from:void 0,u=e=>{let t=VJ.indexOf(n),i=e.key===`ArrowDown`?(t+1)%VJ.length:e.key===`ArrowUp`?(t-1+VJ.length)%VJ.length:e.key===`Home`?0:e.key===`End`?VJ.length-1:null;i!==null&&(e.preventDefault(),r(VJ[i]),o.current?.querySelector(`[data-section="${VJ[i]}"]`)?.focus())},d=(()=>{switch(n){case`general`:return I(Oq,{});case`setup`:return I(EJ,{});case`model`:return I(Zq,{});case`permissions`:return I(Qq,{});case`skills`:return I(oJ,{onUseSkill:t=>{i(),e(t)}});case`connectors`:return I(LJ,{});case`messaging`:return I(RJ,{});case`automations`:return I(zJ,{});case`memory`:return I(lJ,{});case`notifications`:return I(yJ,{});case`voice`:return I(TJ,{});case`privacy`:return I(mJ,{});case`advanced`:return I(BJ,{});case`about`:return I(OJ,{})}})();return I(`div`,{className:`settings-overlay`,onMouseDown:e=>{e.target===e.currentTarget&&i()},children:z(`div`,{ref:o,className:`settings-dialog`,role:`dialog`,"aria-modal":`true`,"aria-label":t(`settings.title`),children:[z(`nav`,{className:`settings-nav`,"aria-label":t(`settings.sections`),onKeyDown:u,children:[I(`h1`,{className:`settings-nav-title`,children:t(`settings.title`)}),VJ.map(e=>I(`button`,{type:`button`,"data-section":e,className:`settings-nav-item${n===e?` is-active`:``}`,"aria-current":n===e?`page`:void 0,tabIndex:n===e?0:-1,onClick:t=>{t.currentTarget.focus(),r(e)},children:t(`settings.section.${e}`)},e))]}),z(`div`,{className:`settings-body`,children:[I(`button`,{type:`button`,className:`settings-close`,onClick:i,"aria-label":t(`settings.close`),children:I(Is,{size:18})}),l&&z(`button`,{type:`button`,className:`settings-back`,onClick:()=>{r(l),o.current?.querySelector(`[data-section="${l}"]`)?.focus()},children:[I(qr,{size:14,"aria-hidden":`true`}),t.compose(e=>e(`settings.backTo`,{section:e(`settings.section.${l}`)}))]}),I(`div`,{ref:s,className:`settings-scroll`,children:I(kJ,{area:`settings.${n}`,children:I(V.Suspense,{fallback:z(`p`,{className:`settings-hint`,children:[I(La,{size:13,className:`spin`}),` `,t(`settings.loading`)]}),children:d})},n)})]})]})})}var UJ=`gaia:personalize-connector`,WJ=[[`google`,`my last two weeks of Gmail (and Google Calendar, if it is connected)`],[`microsoft`,`my last two weeks of Outlook mail (and calendar, if it is connected)`],[`slack`,`my recent Slack channels and direct messages`],[`github`,`my recent GitHub activity: open PRs, review requests, issues and notifications`]];function GJ(e,t){let n=e.toLowerCase().replace(/^mcp-/,``),r=WJ.find(([e])=>n.startsWith(e));return r?r[1]:`my recent activity in ${t}`}function KJ(e){let t=e.toLowerCase().replace(/^mcp-/,``),n=WJ.find(([e])=>t.startsWith(e));return n?n[0]:null}function qJ({connectorId:e,displayName:t}){return[`I just connected ${t}. Get to know me from ${GJ(e,t)}.`,`Read only — do not send, delete, label or change anything.`,`If you have no tools that read it, or they fail, tell me you couldn't reach it and stop. Never guess or count what it holds.`,`1. Skim the recent items and work out who I deal with most, what I work on, recurring meetings or threads, and what keeps landing on my plate.`,`2. Save the durable facts to memory (people, projects, preferences, routines). Skip one-off details and anything sensitive like passwords, codes or financial numbers.`,`3. Recommend up to five automations you could run for me on a schedule, each with what it does, how often, and why it fits what you saw.`,`Don't create any schedules yet — tell me what you saved and list the automations so I can pick which to set up.`].join(`
212
+ `)}function JJ(e){window.dispatchEvent(new CustomEvent(UJ,{detail:e}))}var YJ=Ct((e,t)=>({lifecycle:null,restartError:null,apply:n=>{n.apiBase&&Dn(n.apiBase),e({lifecycle:n,restartError:n.status===`running`?null:t().restartError})},restart:async()=>{let n=window.gaiaAPI?.backend;if(!n)throw Error(`Restart GAIA needs the desktop app.`);e({restartError:null});try{t().apply(await n.restart())}catch(t){F.system.error(`Restart GAIA failed`,t),e({restartError:t instanceof Error?t.message:String(t)})}}}));function XJ(){let e=window.gaiaAPI?.backend;e&&e.getState().then(e=>YJ.getState().apply(e)).catch(e=>F.system.error(`Could not read the backend state from the desktop app`,e))}function ZJ(e){let t=window.gaiaAPI?.backend;if(!t)return()=>{};let n=t=>{let n=YJ.getState().lifecycle?.status;YJ.getState().apply(t),t.status===`running`&&n&&n!==`running`&&e()},r=t.onState(n);return t.getState().then(n).catch(e=>F.system.error(`Could not read the backend state from the desktop app`,e)),r}function QJ(e,t){let[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)(null),c=(0,V.useRef)(null),l=(0,V.useRef)(null),u=(0,V.useRef)(null),d=(0,V.useCallback)(()=>{c.current&&=(clearTimeout(c.current),null),l.current&&=(clearTimeout(l.current),null),u.current&&=(clearInterval(u.current),null)},[]);(0,V.useEffect)(()=>d,[d]);let f=(0,V.useCallback)((e,t)=>{u.current&&clearInterval(u.current),u.current=setInterval(async()=>{try{let n=await te();t===`load`?bc(n.model_loaded,e)&&(r(!1),c.current&&=(clearTimeout(c.current),null),u.current&&=(clearInterval(u.current),null)):(n.model_downloaded===!0||bc(n.model_loaded,e))&&(a(!1),l.current&&=(clearTimeout(l.current),null),u.current&&=(clearInterval(u.current),null))}catch{}},ru)},[]),p=e??`Gemma-4-E4B-it-GGUF`;return(0,V.useEffect)(()=>s(null),[p]),{isLoadingModel:n,isDownloadingModel:i,downloadError:o,loadModel:(0,V.useCallback)(async(e,n)=>{let i=e??p,a=n??t;r(!0);try{if(!await fn(i,a)){r(!1);return}F.system.info(`Load model triggered: ${i} (ctx=${a??`server default`})`),c.current&&clearTimeout(c.current),c.current=setTimeout(()=>r(!1),tu),f(i,`load`)}catch(e){F.system.error(`Failed to trigger model load`,e),r(!1)}},[p,t,f]),downloadModel:(0,V.useCallback)(async(e=!1,t,n=!1)=>{let r=t??p;a(!0),s(null);try{await Ve(r,e,n),F.system.info(`Download model triggered: ${r} (force=${e})`),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>a(!1),nu),f(r,`download`)}catch(e){F.system.error(`Failed to trigger model download`,e),s(e instanceof Error?e.message:String(e)),a(!1)}},[p,f])}}function $J({onRetry:e,label:t,busyLabel:n=`Checking…`}){let[r,i]=(0,V.useState)(!1);return I(`button`,{className:`connection-banner__retry`,onClick:()=>{i(!0),Promise.resolve(e()).finally(()=>i(!1))},disabled:r,children:r?n:t})}function eY(e){return`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`}function tY({lifecycle:e}){let t=R(),n=YJ(e=>e.restart),r=YJ(e=>e.restartError),i=e.status===`restarting`,[a,o]=(0,V.useState)(()=>Date.now());if((0,V.useEffect)(()=>{if(!i)return;o(Date.now());let e=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(e)},[i]),i){let n=e.since?Math.max(0,Math.floor((a-e.since)/1e3)):0;return z(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[I(`div`,{className:`connection-banner__icon`,children:I(La,{size:16,className:`connection-banner__spinner`})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[t(`banner.restarting`),` `,I(`bdi`,{dir:`ltr`,className:`connection-banner__timer`,children:eY(n)}),` `,I(`span`,{className:`connection-banner__hint`,children:t(`banner.restartingHint`)})]})]})}return z(`div`,{className:`connection-banner connection-banner--error`,role:`alert`,children:[I(`div`,{className:`connection-banner__icon`,children:I(ws,{size:16})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[t(`banner.restartStopped`),` `,I(`span`,{className:`connection-banner__hint`,children:r?t(`banner.restartFailed`,{error:r}):t(`banner.restartStoppedHint`)})]}),I($J,{onRetry:n,label:t(`banner.restartButton`),busyLabel:t(`banner.restartingShort`)})]})}function nY({onRetry:e,backendSlow:t=!1,backendError:n=null}){let r=R(),{backendConnected:i,systemStatus:a,currentSessionId:o,messages:s}=B(),c=YJ(e=>e.lifecycle),[l,u]=(0,V.useState)(!1),d=!!o&&s.length>0,f=a?.default_model_name??`Gemma-4-E4B-it-GGUF`,{isDownloadingModel:p,downloadError:m,downloadModel:h}=QJ(f),g=_c(e=>e.pickLoad),_=_c(e=>e.retryPickLoad),v=_c(e=>e.dismissPickLoad);yc();let y=(0,V.useRef)(a?.lemonade_running),b=(0,V.useRef)(a?.model_downloaded),x=(0,V.useRef)(a?.context_size_sufficient),S=(0,V.useRef)(a?.expected_model_loaded);(0,V.useEffect)(()=>{if(d)return;let e=a?.lemonade_running,t=a?.model_downloaded,n=a?.context_size_sufficient,r=a?.expected_model_loaded,i=!1;y.current!==e&&(y.current=e,e===!1&&(i=!0)),b.current!==t&&(b.current=t,t===!1&&(i=!0)),x.current!==n&&(x.current=n,n===!1&&(i=!0)),S.current!==r&&(S.current=r,r===!1&&(i=!0)),i&&u(!1)},[a,d]);let C=a?.download_progress??null,w=p||C?.state===`downloading`||C?.state===`starting`,T=B(e=>e.dismissDownloadFailure);if(c&&c.status!==`running`)return I(tY,{lifecycle:c});let E=C?.model_name||f,D=async()=>{try{await T(C?.model_name??E)}catch{}};if(w||C?.state===`error`){let e=C?.total_bytes?`${(C.total_bytes/1e9).toFixed(1)} GB`:`large download`,t=C?.state===`error`;return z(`div`,{className:`connection-banner ${t?`connection-banner--error`:`connection-banner--warning`}`,role:t?`alert`:`status`,children:[I(`div`,{className:`connection-banner__icon`,children:I(t?ws:Ci,{size:16})}),I(`div`,{className:`connection-banner__text`,dir:`auto`,children:t?z(P.Fragment,{children:[`Download of `,I(`strong`,{children:E}),` failed.`,` `,(m??C?.message)&&I(`span`,{className:`connection-banner__hint`,children:m??C?.message})]}):z(P.Fragment,{children:[`Downloading `,I(`strong`,{children:E}),` (`,e,`).`,C?.state===`downloading`&&C.file&&z(P.Fragment,{children:[` `,z(`span`,{className:`connection-banner__hint`,children:[`File `,C.file_index,` / `,C.total_files,`: `,I(`code`,{children:C.file})]})]})]})}),t?I(`button`,{className:`connection-banner__retry`,onClick:()=>h(!1,E,!a?.model_loaded),children:`Retry`}):I(`span`,{className:`connection-banner__loading connection-banner__progress`,children:C&&C.state===`downloading`&&C.total_bytes>0?z(P.Fragment,{children:[I(`span`,{className:`connection-banner__progress-bar`,role:`progressbar`,"aria-valuenow":C.percent,"aria-valuemin":0,"aria-valuemax":100,"aria-label":`Download progress`,children:I(`span`,{className:`connection-banner__progress-fill`,style:{width:`${C.percent}%`}})}),z(`span`,{className:`connection-banner__progress-label`,children:[C.percent,`% ·`,` `,(C.downloaded_bytes/1e9).toFixed(2),` /`,` `,(C.total_bytes/1e9).toFixed(2),` GB`]})]}):z(P.Fragment,{children:[I(La,{size:13,className:`connection-banner__spinner`}),C?.state===`starting`?C.message??`Starting download…`:`Downloading…`]})}),t&&I(`button`,{className:`connection-banner__dismiss`,onClick:()=>void D(),"aria-label":`Dismiss`,children:I(Is,{size:14})})]})}if(g){let e=xc(g.model);return g.error?z(`div`,{className:`connection-banner connection-banner--error`,role:`alert`,children:[I(`div`,{className:`connection-banner__icon`,children:I(ws,{size:16})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[r(`banner.pickLoad.failed`,{model:e}),` `,I(`span`,{className:`connection-banner__hint`,dir:`auto`,children:g.error.key?r(g.error.key,{reason:g.error.reason}):g.error.reason})]}),I($J,{onRetry:_,label:r(`banner.pickLoad.retry`)}),I(`button`,{className:`connection-banner__dismiss`,onClick:v,"aria-label":r(`banner.dismiss`),children:I(Is,{size:14})})]}):z(`div`,{className:`connection-banner connection-banner--init`,role:`status`,children:[I(`div`,{className:`connection-banner__icon`,children:I(La,{size:16,className:`connection-banner__spinner`})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[r(`banner.pickLoad.loading`,{model:e}),` `,I(`bdi`,{dir:`ltr`,children:r(`banner.pickLoad.seconds`,{s:g.seconds})}),` `,I(`span`,{className:`connection-banner__hint`,children:r(`banner.pickLoad.canType`)})]})]})}if(hI(a)&&!t&&!n){let e=a?.init_tasks?.find(e=>e.status===`running`)?.step,t=`banner.boot.${e}`,n=e&&ae(t)?r(t):r(`banner.boot.generic`);return z(`div`,{className:`connection-banner connection-banner--init`,role:`status`,children:[I(`div`,{className:`connection-banner__icon`,children:I(La,{size:16,className:`connection-banner__spinner`})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[n,z(`span`,{className:`thinking-dots`,children:[I(`span`,{children:`.`}),I(`span`,{children:`.`}),I(`span`,{children:`.`})]})]})]})}if(l||d)return null;if(!i)return z(`div`,{className:`connection-banner connection-banner--error`,role:`alert`,children:[I(`div`,{className:`connection-banner__icon`,children:I(Ms,{size:16})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[r(`banner.unreachable`),` `,I(`span`,{className:`connection-banner__hint`,children:r(`banner.unreachableHint`)})]}),e&&I($J,{onRetry:e,label:`Retry`})]});if(n)return z(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[I(`div`,{className:`connection-banner__icon`,children:I(ws,{size:16})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[`GAIA's backend answered with an error (`,n,`).`,` `,I(`span`,{className:`connection-banner__hint`,children:`It may be overloaded. GAIA keeps checking; if it lasts, restart GAIA.`})]}),e&&I($J,{onRetry:e,label:`Check again`})]});if(t)return z(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[I(`div`,{className:`connection-banner__icon`,children:I(ws,{size:16})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[`GAIA is slow to answer.`,` `,I(`span`,{className:`connection-banner__hint`,children:`It may be busy with another chat or app. GAIA keeps checking.`})]}),e&&I($J,{onRetry:e,label:`Check again`})]});if(a?.config_error)return z(`div`,{className:`connection-banner connection-banner--error`,role:`alert`,children:[I(`div`,{className:`connection-banner__icon`,children:I(ws,{size:16})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[`GAIA settings could not be loaded.`,` `,I(`span`,{className:`connection-banner__hint`,children:a.config_error})]}),e&&I($J,{onRetry:e,label:`Check again`})]});if(a&&!a.lemonade_running){let t=gI(a)===`unresponsive`,n=!t&&Nq(a),i=t&&Aq(a.start_command)?null:a.start_command,o=t&&Aq(a.start_instruction)?null:a.start_instruction;return z(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[I(`div`,{className:`connection-banner__icon`,children:I(ws,{size:16})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[r(t?`banner.serverHung`:`banner.serverStopped`),` `,n?I(`span`,{className:`connection-banner__hint`,children:r(`banner.finishSetup`)}):i?z(`span`,{className:`connection-banner__hint`,children:[r(t?`banner.restartHint`:`banner.startHint`),` `,I(`code`,{dir:`ltr`,children:i})]}):o&&I(`span`,{className:`connection-banner__hint`,children:Mq(r,o)})]}),n&&I(Pq,{className:`connection-banner__retry`}),e&&I($J,{onRetry:e,label:r(`settings.key.checkAgain`)}),I(`button`,{className:`connection-banner__dismiss`,onClick:()=>u(!0),"aria-label":`Dismiss`,children:I(Is,{size:14})})]})}if(a&&a.lemonade_running&&a.model_loaded&&a.context_size_sufficient===!1){let t=a.model_context_size??0;return z(`div`,{className:`connection-banner connection-banner--warning`,role:`status`,children:[I(`div`,{className:`connection-banner__icon`,children:I(Ta,{size:16})}),z(`div`,{className:`connection-banner__text`,dir:`auto`,children:[`LLM context window is too small (`,t.toLocaleString(),` tokens;`,` `,$l.toLocaleString(),` required).`,` `,I(`span`,{className:`connection-banner__hint`,children:`Reload it with a larger context in Settings → Advanced.`})]}),e&&I($J,{onRetry:e,label:`Check again`}),I(`button`,{className:`connection-banner__dismiss`,onClick:()=>u(!0),"aria-label":`Dismiss`,children:I(Is,{size:14})})]})}return null}var rY=`https://github.com/amd/gaia/releases`;function iY(){let e=hq(),t=R(),[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(null),o=(0,V.useCallback)(e=>{let n=pq();n&&(a(null),n[e]().catch(n=>{F.system.error(`Update ${e} failed`,n),a(yq(n,t))}))},[t]);if(n)return null;let s=e.installFailed?t(`update.chip.installFailedDetail`,e.installFailed):null,c=e.status===`downloading`||e.status===`downloaded`;if(e.startFailed&&e.previousVersion&&!c)return z(`div`,{className:`update-chip update-chip--error`,role:`status`,children:[I(ws,{size:13,className:`update-chip__icon`}),I(`span`,{className:`update-chip__label`,title:i??void 0,children:t(i?`update.chip.updateFailed`:`update.chip.startFailed`)}),I(`button`,{type:`button`,className:`update-chip__action`,onClick:()=>o(`revertUpdate`),children:t(`update.chip.goBack`,{version:e.previousVersion})}),I(`button`,{type:`button`,className:`update-chip__dismiss`,onClick:()=>r(!0),"aria-label":t(`update.chip.dismissError`),children:I(Is,{size:11})})]});let l=e.status===`available`||e.status===`downloaded`;if(s&&!l)return z(`div`,{className:`update-chip update-chip--error`,role:`status`,title:s??void 0,children:[I(ws,{size:13,className:`update-chip__icon`}),I(`span`,{className:`update-chip__label`,children:t(`update.chip.installFailed`)}),I(`button`,{type:`button`,className:`update-chip__dismiss`,onClick:()=>r(!0),"aria-label":t(`update.chip.dismissError`),children:I(Is,{size:11})})]});if(e.status===`idle`||e.status===`checking`||e.status===`disabled`||e.status===`no-channel`)return null;if(e.status===`downloading`){let n=Math.max(0,Math.min(100,e.progress));return z(`div`,{className:`update-chip update-chip--downloading`,role:`status`,"aria-live":`polite`,title:t(`update.chip.downloadingTitle`,{version:e.version??``}),children:[I(Ci,{size:13,className:`update-chip__icon`}),I(`span`,{className:`update-chip__label`,children:e.preparing?t(`update.chip.preparing`):t(`update.chip.downloading`,{pct:n})})]})}return e.status===`available`?z(`div`,{className:`update-chip update-chip--available`,role:`status`,title:e.manualInstall?t(`update.chip.manualTitle`,{version:e.version??``}):i||s||e.releaseNotes||t(`update.chip.availableTitle`),children:[I(Ci,{size:13,className:`update-chip__icon`}),I(`span`,{className:`update-chip__label`,children:i?t(`update.chip.updateFailed`):s?t(`update.chip.installFailed`):t(`update.chip.available`,{version:e.version??``})}),e.manualInstall?I(`a`,{className:`update-chip__action`,href:e.downloadUrl??rY,target:`_blank`,rel:`noopener noreferrer`,children:t(`update.chip.download`)}):!e.pinnedVersion&&I(`button`,{type:`button`,className:`update-chip__action`,onClick:()=>o(`downloadUpdate`),children:t(`update.chip.updateNow`)}),I(`button`,{type:`button`,className:`update-chip__dismiss`,onClick:()=>r(!0),"aria-label":t(`update.chip.dismiss`),children:I(Is,{size:11})})]}):e.status===`downloaded`?z(`div`,{className:`update-chip update-chip--ready`,role:`status`,"aria-live":`polite`,children:[I(Po,{size:13,className:`update-chip__icon`}),I(`button`,{type:`button`,className:`update-chip__action`,onClick:()=>o(`restart`),title:i||s||t(`update.chip.restartTitle`),children:t(i?`update.chip.restartFailed`:s?`update.chip.installFailedRetry`:`update.chip.ready`)})]}):e.status===`error`?z(`div`,{className:`update-chip update-chip--error`,role:`status`,title:e.error||t(`update.chip.checkFailed`),children:[I(ws,{size:13,className:`update-chip__icon`}),I(`span`,{className:`update-chip__label`,children:t(`update.chip.checkFailed`)}),I(`button`,{type:`button`,className:`update-chip__dismiss`,onClick:()=>r(!0),"aria-label":t(`update.chip.dismissError`),children:I(Is,{size:11})})]}):null}var aY={permission_request:{icon:I(ns,{size:16}),colorClass:`notif-type-permission`},policy_alert:{icon:I(ns,{size:16}),colorClass:`notif-type-policy`},security_alert:{icon:I(ws,{size:16}),colorClass:`notif-type-security`},status_change:{icon:I($r,{size:16}),colorClass:`notif-type-status`},info:{icon:I(ya,{size:16}),colorClass:`notif-type-info`},error:{icon:I(ri,{size:16}),colorClass:`notif-type-error`}};function oY(e,t){let n=Date.now()-e,r=Math.floor(n/1e3);if(r<60)return t(`time.justNow`);let i=Math.floor(r/60);if(i<60)return t(`time.minutesAgo`,{n:i});let a=Math.floor(i/60);if(a<24)return t(`time.hoursAgo`,{n:a});let o=Math.floor(a/24);return o<7?t(`time.daysAgo`,{n:o}):new Date(e).toLocaleDateString(Sn(t),{month:`short`,day:`numeric`})}function sY({onClose:e,onOpenChat:t}){let n=R(),r=_l(Us(yl)),i=_l(vl),a=_l(e=>e.markRead),o=_l(e=>e.markAllRead),s=_l(e=>e.clearAll),c=_l(e=>e.dismiss),l=_l(e=>e.respondToPermission),u=_l(e=>e.typeFilter),d=_l(Us(bl)),f=_l(e=>e.setTypeFilter),p=(0,V.useCallback)(e=>{a(e.id),e.sessionId&&e.type!==`permission_request`&&t?.(e.sessionId)},[a,t]),m=(0,V.useCallback)(e=>{l(e.id,`allow`).catch(e=>console.error(`[NotificationCenter] allow failed:`,e))},[l]),h=(0,V.useCallback)(e=>{l(e.id,`deny`).catch(e=>console.error(`[NotificationCenter] deny failed:`,e))},[l]);pt(!0,e);let g=[{key:null,label:n(`notifications.filter.all`)},{key:`permission_request`,label:n(`notifications.filter.permissions`)},{key:`policy_alert`,label:n(`notifications.filter.policy`)},{key:`error`,label:n(`notifications.filter.errors`)},{key:`security_alert`,label:n(`notifications.filter.security`)},{key:`status_change`,label:n(`notifications.filter.status`)},{key:`info`,label:n(`notifications.filter.info`)}].filter(e=>e.key===null||e.key===u||d.includes(e.key)),_=g.length>2||u!==null;return z(`div`,{className:`notification-center`,role:`dialog`,"aria-label":n(`notifications.dialogAria`),children:[z(`div`,{className:`notification-center-header`,children:[z(`div`,{className:`notification-center-title-row`,children:[I(`h2`,{className:`notification-center-title`,children:n(`notifications.title`)}),i>0&&I(`span`,{className:`notification-center-badge`,children:i})]}),I(`button`,{className:`btn-icon notification-center-close`,onClick:e,"aria-label":n(`notifications.close`),children:I(Is,{size:18})})]}),_&&I(`div`,{className:`notification-filter-bar`,role:`tablist`,"aria-label":n(`notifications.filterAria`),children:g.map(e=>I(`button`,{role:`tab`,"aria-selected":u===e.key,className:`notification-filter-tab ${u===e.key?`active`:``}`,onClick:()=>f(e.key),children:e.label},e.key??`all`))}),I(`div`,{className:`notification-list`,children:r.length===0?z(`div`,{className:`notification-empty`,children:[I(Tr,{size:40,strokeWidth:1.2}),I(`span`,{children:n(`notifications.empty`)})]}):r.map(e=>{let t=aY[e.type],r=e.type===`permission_request`&&e.tool?cl(e,n,Ic):null;return z(`div`,{className:`notification-item ${e.read?``:`unread`} ${t.colorClass}`,id:e.type===`policy_alert`&&e.receiptId?`policy-receipt-${encodeURIComponent(e.receiptId)}`:void 0,onClick:()=>p(e),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&p(e)},children:[!e.read&&I(`span`,{className:`notification-unread-dot`}),I(`span`,{className:`notification-icon`,children:t.icon}),z(`div`,{className:`notification-content`,children:[z(`div`,{className:`notification-content-header`,children:[I(`span`,{className:`notification-agent`,dir:`auto`,children:e.agentName}),I(`span`,{className:`notification-time`,children:oY(e.timestamp,n)})]}),r?z(P.Fragment,{children:[I(`span`,{className:`notification-title`,children:I(zc,{text:r.heading})}),I(`span`,{className:`notification-message`,dir:`auto`,children:I(zc,{text:r.question})})]}):z(P.Fragment,{children:[e.title&&I(`span`,{className:`notification-title`,children:e.title}),I(`span`,{className:`notification-message`,dir:`auto`,children:e.message})]}),e.type===`policy_alert`&&z(`div`,{className:`notification-policy-details`,children:[e.tool&&z(`span`,{className:`notification-tool`,children:[n(`activity.policy.tool`),`: `,I(`code`,{dir:`ltr`,children:e.tool})]}),e.reason&&z(`span`,{className:`notification-policy-reason`,children:[n(`notifications.reason`),`: `,e.reason]}),e.ruleIds&&e.ruleIds.length>0&&z(`span`,{className:`notification-tool`,children:[n(`activity.policy.rules`),`: `,I(`code`,{dir:`ltr`,children:e.ruleIds.join(`, `)})]}),e.policyVersion&&z(`span`,{className:`notification-tool`,children:[n(`activity.policy.policy`),`: `,I(`code`,{dir:`ltr`,children:e.policyVersion})]}),z(`span`,{className:`notification-tool`,children:[n(`activity.policy.receipt`),`:`,` `,e.receiptId?I(`code`,{dir:`ltr`,children:e.receiptId}):I(`em`,{children:n(`activity.policy.receiptUnavailable`)})]})]}),e.type===`permission_request`&&!e.response&&z(`div`,{className:`notification-actions`,children:[z(`button`,{className:`notification-action-btn notification-action-allow`,onClick:t=>{t.stopPropagation(),m(e)},children:[I(Vr,{size:14}),n(`notifications.approve`)]}),z(`button`,{className:`notification-action-btn notification-action-deny`,onClick:t=>{t.stopPropagation(),h(e)},children:[I(Is,{size:14}),n(`notifications.deny`)]})]}),e.type===`permission_request`&&e.response&&I(`span`,{className:`notification-response-badge ${e.response===`allow`?`response-allow`:`response-deny`}`,children:e.response===`allow`?n(`notifications.approved`):n(`notifications.denied`)})]}),I(`button`,{className:`notification-dismiss`,onClick:t=>{t.stopPropagation(),c(e.id)},"aria-label":n(`notifications.dismiss`),children:I(Is,{size:14})})]},e.id)})}),r.length>0&&z(`div`,{className:`notification-center-footer`,children:[z(`button`,{className:`notification-footer-btn`,onClick:o,disabled:i===0,children:[I(Vr,{size:14}),n(`notifications.markAllRead`)]}),z(`button`,{className:`notification-footer-btn notification-footer-clear`,onClick:s,children:[I(Ss,{size:14}),n(`notifications.clear`)]})]})]})}var cY=1500,lY=e=>new Promise(t=>setTimeout(t,e));async function uY({onProgress:e,isCancelled:t=()=>!1,pollMs:n=cY}={}){try{await ft(bO)}catch(e){if(e?.httpStatus!==409)throw e;let t=await C(bO).catch(()=>null);if(!t||t.status===`completed`||t.status===`failed`)throw e}for(;!t();){let t=await C(bO);if(e?.(t),t.status===`completed`)return;if(t.status===`failed`)throw Error(t.error||`The GAIA agent could not be installed.`);await lY(n)}}function dY({onInstalled:e,noBuild:t=!1}){let n=R(),[r,i]=(0,V.useState)({kind:`idle`}),a=(0,V.useRef)(!1);(0,V.useEffect)(()=>()=>{a.current=!0},[]);let o=(0,V.useCallback)(async()=>{i({kind:`installing`,percent:0});try{if(await uY({isCancelled:()=>a.current,onProgress:e=>{a.current||i({kind:`installing`,percent:e.percent??0})}}),a.current)return;await e(),a.current||i({kind:`idle`})}catch(e){a.current||i({kind:`failed`,error:e instanceof Error?e.message:String(e)})}},[e]);return t?I(`div`,{className:`app-notice is-warning`,role:`status`,children:I(`span`,{children:n(`agentNotice.noBuild`)})}):z(`div`,{className:`app-notice is-warning`,role:`status`,children:[r.kind===`installing`?I(`span`,{children:n(`agentNotice.installing`,{percent:Math.round(r.percent)})}):r.kind===`failed`?I(`span`,{children:n(`agentNotice.failed`,{error:r.error})}):I(`span`,{children:n(`agentNotice.missing`)}),r.kind!==`installing`&&I(`button`,{type:`button`,className:`link-btn`,onClick:()=>void o(),children:r.kind===`failed`?n(`agentNotice.retry`):n(`agentNotice.install`)})]})}async function fY(){return An(`GET`,`/schedules`)}function pY(){return Intl.DateTimeFormat().resolvedOptions().timeZone||void 0}async function mY(e,t,n){return An(`POST`,`/schedules`,{name:e,interval:t,prompt:n,timezone:pY()})}async function hY(e,t,n){return An(`PATCH`,`/schedules/${encodeURIComponent(e)}`,{interval:t,prompt:n,timezone:pY()})}async function gY(e,t){return An(`PUT`,`/schedules/${encodeURIComponent(e)}`,{status:t})}async function _Y(e){return An(`POST`,`/schedules/${encodeURIComponent(e)}/run`)}async function vY(e){return An(`DELETE`,`/schedules/${encodeURIComponent(e)}`)}async function yY(e,t=20){return An(`GET`,`/schedules/${encodeURIComponent(e)}/results?limit=${t}`)}async function bY(e){return An(`POST`,`/schedules/parse`,{input:e,timezone:pY()})}function xY(e){return e.replace(/^\s*(```|~~~).*$/gm,``).replace(/!?\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/`([^`]+)`/g,`$1`).replace(/\*\*(.+?)\*\*/g,`$1`).replace(/(^|[^\w])__(?=\S)(.+?\S)__(?![\w.])/g,`$1$2`).replace(/(^|[^\w*])\*(?!\s)(.*?\S)\*(?!\w)/g,`$1$2`).replace(/(^|[^\w])_(?![\s_])(.+?)_(?!\w)/g,`$1$2`).replace(/^\s{0,3}(#{1,6}\s+|>\s?|[-*+]\s+)/gm,``).replace(/\s+/g,` `).trim()}function SY(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}var CY=`gaia-schedule-announced-errors`;function wY(){let e;try{e=localStorage.getItem(CY)}catch(e){return F.system.warn(`Announced schedule failures unreadable; failures from before launch may be announced again. localStorage is blocked -- check private-browsing or site-data settings.`,e),{}}if(!e)return{};try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return Object.fromEntries(Object.entries(t).filter(([,e])=>typeof e==`number`));F.system.warn(`Ignored malformed "${CY}"; failures from before launch may be announced again.`)}catch(e){F.system.warn(`"${CY}" is corrupt; failures from before launch may be announced again.`,e)}return{}}function TY(e){try{localStorage.setItem(CY,JSON.stringify(e))}catch(e){F.system.warn(`Announced schedule failures not saved; they may be announced again on the next launch. localStorage is blocked -- check private-browsing or site-data settings.`,e)}}function EY(e,t){let{addNotification:n}=_l.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:Ht()(`schedules.failed`,{name:r.name}),message:r.last_error,timestamp:Date.now(),read:!1,dismissed:!1,priority:`high`,...r.session_id?{sessionId:r.session_id}:{}})}function DY(e){return e.run_count-+!!e.running}function OY(e,t,n){let{addNotification:r}=_l.getState();for(let i of n){let n=DY(i);n<=(t[i.id]??0)||i.error_count>(e[i.id]??0)||r({id:`schedule-done-${i.id}-${n}`,type:`info`,agentId:`scheduler`,agentName:`GAIA`,title:Ht()(`schedules.finished`,{name:i.name}),message:xY(i.last_result??``),timestamp:Date.now(),read:!1,dismissed:!1,priority:`medium`,...i.session_id?{sessionId:i.session_id}:{}})}}var kY=Ct((e,t)=>({schedules:[],loading:!1,error:null,actionError:null,selectedSchedule:null,results:[],resultsLoading:!1,errorCounts:null,finishedCounts:{},draft:null,setDraft:t=>e({draft:t}),loadSchedules:async()=>{t().schedules.length===0&&!t().error&&e({loading:!0}),e({error:null});try{let n=(await fY()).schedules||[],r=t().errorCounts,i=t().finishedCounts,a=r??wY();EY(a,n),r&&OY(a,i,n);let o=Object.fromEntries(n.map(e=>[e.id,e.error_count]));TY(o),e({schedules:n,loading:!1,errorCounts:o,finishedCounts:Object.fromEntries(n.map(e=>[e.id,Math.max(DY(e),i[e.id]??0)]))})}catch(t){F.api.error(`Failed to load schedules`,t),e({error:`Failed to load schedules`,loading:!1})}},createSchedule:async(t,n,r)=>{try{let i=await mY(t,n,r);e(e=>({schedules:[...e.schedules,i],actionError:null}))}catch(e){throw F.api.error(`Failed to create schedule`,e),e}},editSchedule:async(t,n,r)=>{try{let i=await hY(t,n,r);e(e=>({schedules:e.schedules.map(e=>e.name===t?i:e),actionError:null}))}catch(e){throw F.api.error(`Failed to edit schedule "${t}"`,e),e}},updateScheduleStatus:async(t,n)=>{try{let r=await gY(t,n);e(e=>({schedules:e.schedules.map(e=>e.name===t?r:e),actionError:null}))}catch(n){F.api.error(`Failed to update schedule "${t}"`,n),e({actionError:SY(n,`Failed to update schedule`)})}},runScheduleNow:async t=>{try{let n=await _Y(t);e(e=>({schedules:e.schedules.map(e=>e.name===t?n:e),actionError:null}))}catch(n){F.api.error(`Failed to run schedule "${t}" now`,n),e({actionError:SY(n,`Could not run the schedule now`)})}},deleteSchedule:async t=>{try{await vY(t),e(e=>({schedules:e.schedules.filter(e=>e.name!==t),selectedSchedule:e.selectedSchedule===t?null:e.selectedSchedule,actionError:null}))}catch(n){F.api.error(`Failed to delete schedule "${t}"`,n),e({actionError:SY(n,`Failed to delete schedule`)})}},selectSchedule:n=>{e({selectedSchedule:n,results:[],resultsLoading:!1}),n&&t().loadResults(n)},loadResults:async n=>{e({resultsLoading:!0});try{let r=await yY(n);if(t().selectedSchedule!==n)return;e({results:r.results||[],resultsLoading:!1})}catch(r){if(F.api.error(`Failed to load results for "${n}"`,r),t().selectedSchedule!==n)return;e({results:[],resultsLoading:!1})}},dismissActionError:()=>e({actionError:null})})),AY=`goal-store-error-`,jY=0;function MY(){let e=_l.getState();for(let t of e.notifications)t.id.startsWith(AY)&&!t.read&&e.markRead(t.id)}var NY=Ct((e,t)=>({error:null,damaged:!1,check:async()=>{let n,r;try{({error:n,damaged:r}=await NU())}catch(e){F.api.error(`Could not check the goal store`,e);return}n&&n!==t().error&&(jY+=1,_l.getState().addNotification({id:`${AY}${jY}`,type:`error`,agentId:`goals`,agentName:`GAIA`,title:Ht()(`mem.goals.storeError`),message:n,timestamp:Date.now(),read:!1,dismissed:!1,priority:`high`})),n||MY(),e({error:n,damaged:!!r})}})),PY=new Set([`loading_model`,`downloading_model`,`model_retry`,`waiting`]),FY=5;function IY(e,t){return{id:e,title:t.get(e)?.title??`Untitled chat`}}function LY(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=>({...IY(e,t),reason:`approval`}));n&&e.awaitingUser&&!a.has(e.currentSessionId)&&o.push({...IY(e.currentSessionId,t),reason:`answer`});for(let[n,r]of Object.entries(e.awaitingBySession))o.some(e=>e.id===n)||o.push({...IY(n,t),reason:r===`question`?`answer`:`approval`});let s=n&&!e.awaitingUser&&e.livePhase&&PY.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,FY).map(e=>IY(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=>IY(e,t)),needsYou:o,recent:u}}function RY(e){let t=(0,V.useRef)(e);t.current=e,(0,V.useEffect)(()=>{let e=window.gaiaAPI?.tray;if(!e)return;let n=``,r=null,i=()=>{let t=B.getState(),i={backendConnected:t.backendConnected,systemStatus:t.systemStatus,sessions:t.sessions,runningSessionIds:t.runningSessionIds,awaitingBySession:t.awaitingBySession,currentSessionId:t.currentSessionId,isStreaming:t.isStreaming,awaitingUser:t.awaitingUser,liveStatus:t.liveStatus,livePhase:t.livePhase,notifications:_l.getState().notifications},a=r;if(r=i,a&&Object.keys(i).every(e=>i[e]===a[e]))return;let o=LY(i),s=JSON.stringify(o);s!==n&&(n=s,e.setActivity(o).catch(e=>{n=``,F.system.error(`The tray could not take the app state`,e)}))};i();let a=B.subscribe(i),o=_l.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`:B.getState().openSettings(e.section);break;case`refresh-status`:t.current.refreshStatus();break;default:F.system.error(`Unknown tray command`,e)}});return()=>{a(),o(),s()}},[])}function zY(){(0,V.useEffect)(()=>{let e=window.gaiaAPI;if(!e)return;let t=_l.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=B.getState();n.currentSessionId!==t&&n.setMessages([]),n.setCurrentSession(t)})];return()=>n.forEach(e=>e())},[])}function BY(e,t,n){let r=window.gaiaAPI;if(r){r.notification.show({title:t,body:n,sessionId:e}).then(e=>{e||F.system.warn(`This OS has no desktop notifications; the badge still counts it.`)}).catch(e=>F.system.error(`Could not show the desktop notification`,e));return}if(typeof Notification>`u`){F.system.warn(`This browser has no notifications; the alert was not shown.`);return}if(Notification.permission!==`granted`){F.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(),B.getState().setCurrentSession(e)}}function VY(){let[e,t]=(0,V.useState)(null);return(0,V.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=>F.system.warn(`Battery level unavailable; keep-awake ignores the battery policy.`,e)),()=>{n?.removeEventListener(`levelchange`,r),n?.removeEventListener(`chargingchange`,r)}},[]),e}function HY(){zY();let e=B(e=>e.runningSessionIds),t=B(e=>e.awaitingBySession),n=B(e=>e.sessions),r=B(e=>e.currentSessionId),i=_l(Us(Sl)),a=kl(),o=VY(),s=(0,V.useRef)(null),c=Il(e,t,i),l=JSON.stringify(c);(0,V.useEffect)(()=>{let e=JSON.parse(l),t=s.current;if(s.current=e,t===null)return;let{sessions:n,currentSessionId:r}=B.getState(),i=document.hasFocus(),o=!1;for(let{sessionId:s,event:c}of Ll(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`||Bl(s,r,i))&&(o=!0,t===`banner`)){if(c!==`finished`){let{title:t,body:n}=zl(c,e);BY(s,t,n)}else ie(s).then(e=>{B.getState().updateSessionInList(s,e);let{title:t,body:n}=zl(c,e);BY(s,t,n)}).catch(t=>{F.system.error(`Could not read how chat ${s} ended`,t);let{title:n,body:r}=zl(c,{...e,last_run_status:null});BY(s,n,r)})}}if(o){if(a.sound)try{Ul()}catch(e){F.system.warn(`Alert sound not played`,e)}a.flash&&!i&&window.gaiaAPI&&window.gaiaAPI.notification.flash().catch(e=>F.system.error(`Could not flash the taskbar button`,e))}},[l,a.modes,a.sound,a.flash]);let u=Vl(n,c,a.modes,r);(0,V.useEffect)(()=>{window.gaiaAPI?.notification.setAttentionCount(u).catch(e=>F.system.error(`Could not update the taskbar badge`,e))},[u]);let d=a.keepAwake&&e.length>0&&Hl(o,a.batteryFloor);(0,V.useEffect)(()=>{window.gaiaAPI?.power.setKeepAwake(d).catch(e=>F.system.error(`Could not change keep-awake`,e))},[d])}function UY(e){return e.indexing_status===`failed`&&nL(e.error_kind)}function WY(){let e=B(e=>e.systemStatus?.lemonade_running===!0),t=B(e=>e.setDocuments),n=(0,V.useRef)(!1),r=(0,V.useRef)(!1);(0,V.useEffect)(()=>{if(!e)return;if(n.current){r.current=!0;return}let i=async()=>{let{documents:e}=await o(),n=(e||[]).filter(UY).map(e=>e.id);if(n.length===0)return;F.doc.info(`Model server is back; retrying ${n.length} document(s) that were waiting for it`);for(let e of n){let n=(await o()).documents||[],r=n.find(t=>t.id===e);if(r&&UY(r)){t(n.map(t=>t.id===e?{...t,indexing_status:`indexing`}:t));try{await Vt(e),F.doc.info(`Indexed "${r.filename}" now the model server is back`)}catch(e){F.doc.warn(`"${r.filename}" still couldn't be indexed after the model server came back`,e)}}}let r=await o();t(r.documents||[])};n.current=!0,(async()=>{try{do{r.current=!1;try{await i()}catch(e){F.doc.warn(`Could not retry the documents waiting for the model server`,e)}}while(r.current&&B.getState().systemStatus?.lemonade_running===!0)}finally{n.current=!1}})()},[e,t])}var GY=`GAIA Agent UI`;function KY(){let e=B(e=>e.sessions.find(t=>t.id===e.currentSessionId)?.title);(0,V.useEffect)(()=>{document.title=e?.trim()?`${e.trim()} - GAIA`:GY},[e])}function qY(e,t,n){return!e||t&&(e===t||e===CL(t))?null:n.some(t=>t.id===e)?e:wL(n,e)}function JY(e){return new URLSearchParams(e.search).get(`session`)||e.hash.replace(/^#/,``)||null}var YY=`gaia:last-session`;function XY(e){try{e?localStorage.setItem(YY,e):localStorage.removeItem(YY)}catch(e){F.ui.warn(`Could not save the open chat for the next launch`,e)}}function ZY(){try{return localStorage.getItem(YY)}catch(e){return F.ui.warn(`Could not read the chat open at last launch`,e),null}}var QY=1e3,$Y=3e4;function eX(e,{initialMs:t=QY,maxMs:n=$Y,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}}function tX(e,t,n){return e&&!t&&!n}var nX=(0,V.lazy)(()=>IJ(()=>import(`./MemoryDashboard-BuUBoNq8.js`).then(e=>({default:e.MemoryDashboard})),__vite__mapDeps([7,1,2,8,9]),import.meta.url)),rX=(0,V.lazy)(()=>IJ(()=>import(`./ScheduleManager-8UE81KlQ.js`).then(e=>({default:e.ScheduleManager})),__vite__mapDeps([10,1,2,8,11]),import.meta.url)),iX=(0,V.lazy)(()=>IJ(()=>import(`./DocumentLibrary-Dll55N7l.js`).then(e=>({default:e.DocumentLibrary})),__vite__mapDeps([12,1,2,13]),import.meta.url)),aX=(0,V.lazy)(()=>IJ(()=>import(`./FileBrowser-wFHqH6K_.js`).then(e=>({default:e.FileBrowser})),__vite__mapDeps([14,1,2,15]),import.meta.url)),oX=(0,V.lazy)(()=>IJ(()=>import(`./MobileAccessModal-B2gaE8nk.js`).then(e=>({default:e.MobileAccessModal})),__vite__mapDeps([16,1,2,17]),import.meta.url)),sX=3,cX=3e5,lX=6e3,uX=6e4,dX=e=>e instanceof TypeError,fX=e=>new Promise(t=>setTimeout(t,e)),pX=3e5,mX=class extends Error{},hX=class extends Error{constructor(e){super(Ht().bare(`setup.unknown.modelUnread`,{error:e}))}};async function gX(){let e=Date.now()+pX;for(;;){let t=await et();if(t.state===`ready`)return;if(t.state===`failed`||t.state===`cancelled`)throw new mX(t.error||Ht().bare(`setup.upgrading.stopped`));if(Date.now()>=e)throw Error(Ht().bare(`setup.upgrading.slow`));await fX(QY)}}function _X(){return I(`div`,{className:`loading-spinner`,role:`status`,"aria-label":`Loading`})}var vX=e=>e===1||e%10==0;function yX(){let e=R();KY();let t=B(e=>e.currentSessionId),n=B(e=>e.setSessions),r=B(e=>e.setCurrentSession),i=B(e=>e.addSession),o=B(e=>e.setMessages),s=B(e=>e.showDocLibrary),c=B(e=>e.showFileBrowser),l=B(e=>e.showMemoryDashboard),u=B(e=>e.showSchedules),d=B(e=>e.sidebarOpen),f=B(e=>e.sidebarCollapsed),p=B(e=>e.setSidebarOpen),m=B(e=>e.setSystemStatus),h=B(e=>e.setBackendConnected),g=B(e=>e.setAgents),_=B(e=>e.agents),v=B(e=>e.setPendingPrompt),y=B(e=>e.setDefaultPermissionMode),b=B(e=>e.openSettings),x=B(e=>e.settingsSection),S=B(e=>e.syncSystemTheme),C=_c(e=>e.restoreNotice),w=_c(e=>e.dismissRestoreNotice),T=_l(e=>e.showPanel),E=B(e=>e.systemStatus?.initialized===!0),D=(0,V.useRef)(!1),O=_l(e=>e.setShowPanel);(0,V.useEffect)(()=>{if(!C?.ok)return;let e=setTimeout(w,lX);return()=>clearTimeout(e)},[C,w]);let[k,ee]=(0,V.useState)({state:`checking`}),te=B(e=>e.setupAgain),ne=B(e=>e.runSetupAgain),A=(0,V.useRef)(k);A.current=k;let[re,ie]=(0,V.useState)(!1),ae=(0,V.useRef)(re);ae.current=re;let[j,oe]=(0,V.useState)(!1),[se,ce]=(0,V.useState)(!1),le=j||re&&!xO(_),ue=(0,V.useRef)(le);ue.current=le;let[de,fe]=(0,V.useState)(null),[pe,he]=(0,V.useState)(!1),[M,N]=(0,V.useState)(``),[ge,_e]=(0,V.useState)(0),[ye,be]=(0,V.useState)(0),[xe,Se]=(0,V.useState)(!1),[Ce,we]=(0,V.useState)(!1),[Ee,De]=(0,V.useState)(null),[Oe,ke]=(0,V.useState)(null),Ae=(0,V.useRef)(async()=>{}),je=(0,V.useRef)(async()=>{}),Me=(0,V.useCallback)(async(e=!1,t=!1)=>{e||ee({state:`checking`});let n=0;try{for(;;){await _c.getState().refresh();let e=_c.getState().active,r=!!e?.remote,i;try{if(i=await ve(r),!e&&!i.ready)throw new hX(_c.getState().error??`no answer`)}catch(e){let r=dX(e)||e instanceof hX;if(!t||!r||n>=uX)throw e;await fX(QY),n+=QY;continue}if(!i.ready&&i.stage===`upgrade`){ee({state:`upgrading`});let e=await et();(!e.upgrade_embedded||e.state!==`running`&&e.state!==`verifying`)&&await Ne(r,!1,{upgradeEmbedded:!0}),await gX(),i=await ve(r)}n>0&&await Promise.all([Ae.current(),je.current()]),ce(!!i.no_agent_build);let a=!i.ready&&i.stage===`server`&&!!i.initialized;ee(i.ready?{state:`ready`}:a?{state:`serverDown`,modelListUnread:!!i.model_list_unread}:{state:`needed`,check:i});return}}catch(e){let t=e instanceof Error?e.message:String(e);if(e instanceof mX){F.system.warn(`Updating the local model server failed`,e),ee({state:`unknown`,error:t,upgradeFailed:!0});return}F.system.warn(`Setup check could not be answered`,e),ee({state:`unknown`,error:t})}},[]),Fe=B(e=>!!e.systemStatus&&gI(e.systemStatus)===`unresponsive`),Ie=B(e=>e.systemStatus?.lemonade_running===!0);(0,V.useEffect)(()=>{k.state===`serverDown`&&Ie&&Me(!0)},[k.state,Ie,Me]);let Le=B(e=>e.systemStatus?.lemonade_running===!1);(0,V.useEffect)(()=>{if(k.state!==`ready`||!Le)return;let e=!1;return ve(!!_c.getState().active?.remote).then(t=>{!e&&!t.ready&&t.stage===`server`&&t.initialized&&ee({state:`serverDown`,modelListUnread:!!t.model_list_unread})}).catch(e=>F.system.warn(`Could not confirm the model server is down`,e)),()=>{e=!0}},[k.state,Le]);let Re=(0,V.useRef)(0),ze=(0,V.useCallback)(async()=>{let e=++Re.current,t=(await Pe()).agents||[];e===Re.current&&(g(t),ie(!0),xO(t)&&oe(!1))},[g]),Be=(0,V.useCallback)(()=>{let e=ae.current;ie(!1),ze().catch(t=>{F.api.warn(`Agent list unavailable after setup`,t),e&&ie(!0)})},[ze]);(0,V.useEffect)(()=>{let e=()=>{ue.current&&ze().catch(e=>F.api.warn(`Agent list unavailable`,e))};return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[ze]);let Ve=(0,V.useCallback)(async()=>{y((await yt()).default_mode)},[y]),He=(0,V.useRef)([]);(0,V.useEffect)(()=>{_t(`0.27.0rc2`),Me(!1,!0);let e=[eX(ze,{onError:(e,t)=>{vX(t)&&F.api.warn(`Agent list unavailable (attempt ${t}); retrying`,e)}}),eX(Ve,{onError:(e,t)=>{vX(t)&&F.api.warn(`Default permission mode unavailable (attempt ${t}); retrying`,e)}})];return He.current=e,()=>e.forEach(e=>e.stop())},[Me,ze,Ve]);let Ue=(0,V.useCallback)(()=>{He.current.forEach(e=>e.kick()),_c.getState().retryNow(),je.current();let e=A.current;e.state===`unknown`&&!e.upgradeFailed&&Me(!0)},[Me]),We=(0,V.useRef)(Ue);We.current=Ue;let Ge=(0,V.useRef)(0),Ke=(0,V.useRef)(0),qe=(0,V.useRef)(null),Je=(0,V.useRef)(!1),[Ye,Xe]=(0,V.useState)(!1),[Ze,Qe]=(0,V.useState)(null),$e=(0,V.useCallback)(e=>{if(e.kind===`unreachable`){F.system.warn(`System status check failed`,e.error),XJ(),Je.current=!0,Ke.current=0,qe.current=null,Xe(!1),Qe(null),h(!1),m(null);return}if(e.kind===`error`){F.system.warn(`System status answered HTTP ${e.httpStatus}`,e.message),Je.current&&We.current(),Je.current=!1,Ke.current=0,qe.current=null,Xe(!1),Qe(`HTTP ${e.httpStatus}: ${e.message}`),h(!0);return}if(e.kind===`slow`){if(Ke.current+=1,qe.current??=Date.now(),Qe(null),F.system.warn(`System status did not answer in time (${Ke.current} in a row)`),Date.now()-qe.current>=cX){Xe(!1),h(!1),m(null);return}h(!0),(Je.current||Ke.current>=sX)&&Xe(!0);return}let{status:t}=e;Je.current&&We.current(),Je.current=!1,Ke.current=0,qe.current=null,Xe(!1),Qe(null),h(!0),Ge.current=t.lemonade_running?0:Ge.current+1;let n=B.getState().systemStatus;t.lemonade_running||Ge.current>=sX||!n?.lemonade_running?m(t):m({...n,download_progress:t.download_progress})},[h,m]),tt=(0,V.useRef)($e);tt.current=$e;let[nt]=(0,V.useState)(()=>yI(e=>tt.current(e))),rt=nt.check;Ae.current=rt,(0,V.useEffect)(()=>CH(nt.start),[nt]),(0,V.useEffect)(()=>ZJ(()=>{rt()}),[rt]);let it=(0,V.useRef)(``);(0,V.useEffect)(()=>{let e=e=>wn().then(t=>{let r=t.sessions||[];if(!e&&r.length===0&&B.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(`
213
+ `);if(i===it.current)return;it.current=i,n(r);let a=_c.getState().active?.model;a&&r.some(e=>e.effective_model&&e.effective_model!==a)&&_c.getState().refresh()}).catch(t=>{e&&F.system.error(`Could not load chats`,t)});je.current=()=>e(!1),e(!0);let t=setInterval(()=>void e(!1),5e3);return()=>clearInterval(t)},[n]),(0,V.useEffect)(()=>MI(),[]),(0,V.useEffect)(()=>{let e=()=>{kY.getState().loadSchedules()};e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]),(0,V.useEffect)(()=>{let e=()=>{NY.getState().check()};e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[]),(0,V.useEffect)(()=>XI(),[]),HY(),WY();let at=(0,V.useRef)(!1),ot=(0,V.useRef)(!1);(0,V.useEffect)(()=>{let e=()=>{let e=JY(window.location),{currentSessionId:t,sessions:n}=B.getState(),i=qY(e,t,n);return i&&(r(i),o([])),i},t=()=>{if(at.current||(at.current=!0,e()||B.getState().currentSessionId))return;if(window.location.hash){window.history.replaceState(null,``,window.location.pathname+window.location.search);return}if(ot.current||sn(`new-chat`))return;let{sessions:t}=B.getState(),n=qY(ZY(),null,t);n&&(r(n),o([]))},n=B.subscribe(e=>{e.sessions.length>0&&t()});return B.getState().sessions.length>0&&t(),window.addEventListener(`hashchange`,e),window.addEventListener(`popstate`,e),()=>{n(),window.removeEventListener(`hashchange`,e),window.removeEventListener(`popstate`,e)}},[r,o]),(0,V.useEffect)(()=>{let e=null,t=2e3,n=!1,i=null,a=()=>{n||(e=new EventSource(`${dn()}/sessions/events`),e.onopen=()=>{t=2e3},e.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch(e){F.api.warn(`Malformed session event`,e);return}t.type===`set_active_session`&&t.session_id&&t.session_id!==B.getState().currentSessionId&&(r(t.session_id),o([]))},e.onerror=()=>{e?.close(),e=null,n||(i=setTimeout(a,t),t=Math.min(t*2,3e4))})};return a(),()=>{n=!0,i&&clearTimeout(i),e?.close()}},[r,o]),(0,V.useEffect)(()=>{if(at.current&&XY(t),t){let e=CL(t);window.location.hash!==`#${e}`&&window.history.replaceState(null,``,`#${e}`)}else at.current&&window.location.hash&&window.history.replaceState(null,``,window.location.pathname+window.location.search)},[t]);let st=(0,V.useCallback)(async e=>{if(fe(null),he(!1),!await ec(`chat`))return N(e),!1;let t=B.getState(),n;try{n=await an({title:`New chat`,agent_type:bO,document_ids:t.draftDocumentIds,private:t.draftPrivate,folders:t.draftFolder?[t.draftFolder]:[]})}catch(e){throw CO(e)?(oe(!0),new SO):e}ue.current&&(oe(!1),ze().catch(e=>F.api.warn(`Agent list unavailable`,e))),t.defaultPermissionModeKnown||(await Ve().catch(e=>F.api.warn(`Default permission mode unavailable; using the chip's mode`,e)),t=B.getState()),t.clearDraftDocuments(),t.setDraftPrivate(!1),t.setDraftFolder(null);let s=null;try{await kt(n.id,t.draftPermissionMode)}catch(e){s=e}return Mn(a),s&&!n.private&&Cn(At(n.id),e),i(n),MB.getState().claimDraft(n.id),r(n.id),o([]),N(``),s?(fe(`The chat was created, but its permission mode could not be set, so your message was not sent${n.private?``:` — it is in the chat's box`}: ${s instanceof Error?s.message:s}`),!1):(t.resetDraftPermissionMode(),v({sessionId:n.id,text:e}),!0)},[i,r,o,v,ze,Ve]),ct=(0,V.useCallback)(async e=>{try{return await st(e)}catch(t){if(!(t instanceof SO))throw t;let n=sn(a),r=n.trimEnd().endsWith(e)?n:[n,e].filter(Boolean).join(`
214
+
215
+ `);return Cn(a,r),N(r),he(!0),be(e=>e+1),!1}},[st]),lt=(0,V.useCallback)(()=>{let e=B.getState(),t=e.currentSessionId,n=e.pendingPrompt?.sessionId===t?e.pendingPrompt:null;n&&(e.setPendingPrompt(null),N(n.text)),t&&Zl(t,B.getState())&&Ql(t),e.setShowMemoryDashboard(!1),e.setShowSchedules(!1),ot.current=!0,he(!1),r(null),o([]),_e(e=>e+1)},[r,o]),ut=(0,V.useCallback)(e=>{let t=B.getState();t.closeSettings(),e!==t.currentSessionId&&(Ql(t.currentSessionId),o([])),r(e)},[r,o]),dt=(0,V.useCallback)(e=>{let t=B.getState();t.setShowMemoryDashboard(!1),t.setShowSchedules(!1),O(!1),ut(e)},[ut]);RY({openChat:ut,newChat:(0,V.useCallback)(()=>{B.getState().closeSettings(),lt()},[lt]),refreshStatus:()=>void rt()});let ft=(0,V.useCallback)(t=>{let n=B.getState(),r=n.pendingPrompt?.sessionId===n.currentSessionId?n.pendingPrompt?.text:null;lt();let i=e.bare(`settings.skills.tryPrompt`,{name:t}),o=[sn(a),r].filter(Boolean).join(`
216
+
217
+ `),s=o.trimEnd().endsWith(i)?o:[o,i].filter(Boolean).join(`
218
+
219
+ `);Cn(a,s),N(s),be(e=>e+1)},[lt,e]);(0,V.useEffect)(()=>{let e=e=>{let t=e.detail;B.getState().closeSettings(),lt(),ct(qJ(t)).catch(e=>fe(e instanceof Error?e.message:String(e)))};return window.addEventListener(UJ,e),()=>window.removeEventListener(UJ,e)},[lt,ct]);let pt=(0,V.useCallback)(e=>{ee({state:`ready`}),Be(),rt(),e&&(e.needs_input?N(e.prompt):ct(e.prompt).catch(e=>fe(e instanceof Error?e.message:String(e))))},[rt,ct,Be]),mt=(0,V.useCallback)(()=>{ee({state:`ready`}),rt()},[rt]);(0,V.useEffect)(()=>{let e=()=>{B.getState().closeSettings(),ee({state:`addingLocal`})};return window.addEventListener(`gaia:set-up-local`,e),()=>window.removeEventListener(`gaia:set-up-local`,e)},[]);let[ht,gt]=(0,V.useState)(!1);(0,V.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&(e.shiftKey&&e.key.toLowerCase()===`o`?(e.preventDefault(),lt()):!e.shiftKey&&e.key.toLowerCase()===`k`?(e.preventDefault(),window.dispatchEvent(new CustomEvent(`gaia:focus-search`))):!e.shiftKey&&e.key.toLowerCase()===`b`?(e.preventDefault(),B.getState().toggleSidebarCollapsed()):!e.shiftKey&&e.key===`,`?(e.preventDefault(),b()):e.key===`/`&&(e.preventDefault(),gt(e=>!e)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[lt,b]),(0,V.useEffect)(()=>{let e=window.matchMedia?.(`(max-width: 768px)`);if(!e)return;let t=()=>p(!e.matches);return t(),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[p]),(0,V.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(prefers-color-scheme: light)`);return e.addEventListener(`change`,S),()=>e.removeEventListener(`change`,S)},[S]),(0,V.useEffect)(()=>{me().then(e=>we(e.active===!0)).catch(e=>F.system.debug(`Mobile access unavailable`,e))},[]);let vt=(0,V.useCallback)(async()=>{if(Se(!0),De(null),Ce)ke(null);else try{let e=await Te(),t=e.reason===`ngrok_not_installed`;if(ke(t?e.installCommands??[]:null),t)return;e.error?De(e.error):we(!0)}catch(e){ke(null),De(e instanceof Error?e.message:`Could not start mobile access`)}},[Ce]),bt=(0,V.useCallback)(async()=>{try{await Zt(),we(!1),Se(!1)}catch(e){De(e instanceof Error?e.message:`Could not stop mobile access`)}},[]);Vz(e=>{e?vt():bt()}),(0,V.useEffect)(()=>{zz(Ce)},[Ce]);let xt=au(`(max-width: 768px)`),St=tX(k.state===`checking`,E,D.current);if(!St&&k.state!==`needed`&&(D.current=!0),St)return I(`div`,{className:`app`,children:z(`main`,{className:`startup`,role:`status`,"aria-label":`Starting GAIA`,children:[I(`div`,{className:`loading-spinner`,"aria-hidden":`true`}),I(`p`,{className:`startup-text`,children:`Starting GAIA…`})]})});if(k.state===`upgrading`)return I(`div`,{className:`app`,children:z(`main`,{className:`startup`,role:`status`,"aria-live":`polite`,"aria-label":e(`setup.upgrading.notice`),children:[I(`div`,{className:`loading-spinner`,"aria-hidden":`true`}),I(`p`,{className:`startup-text`,children:e(`setup.upgrading.notice`)})]})});if(k.state===`needed`||k.state===`addingLocal`||te){let e=te?()=>ne(!1):k.state===`addingLocal`?mt:void 0;return z(`div`,{className:`app`,children:[I(aq,{onReady:e=>{ne(!1),pt(e)},onClose:e}),I(cW,{}),I(iY,{})]})}let P=!l&&!u?wB():void 0,Ct=l?I(V.Suspense,{fallback:I(_X,{}),children:I(nX,{})}):t?I(UH,{sessionId:t},t):I(rW,{onSend:st,initialText:M,focusRequest:ge,agentMissing:le,agentRefused:pe},`${ye}:${M}`);return z(`div`,{className:`app`,children:[!d&&I(`button`,{className:`sidebar-toggle`,onClick:()=>p(!0),"aria-label":e(`sidebar.open`),children:I(Ga,{size:18})}),I(`div`,{className:`sidebar-overlay ${d?`visible`:``}`,onClick:()=>p(!1),"aria-hidden":`true`}),I(kJ,{area:`sidebar`,variant:`compact`,children:I(Ou,{onNewChat:lt,onMobileAccess:xt?void 0:()=>void vt(),tunnelActive:Ce})}),z(`div`,{className:`main-content`,children:[(k.state===`ready`||k.state===`checking`||k.state===`serverDown`&&Fe)&&I(nY,{onRetry:rt,backendSlow:Ye,backendError:Ze}),k.state===`serverDown`&&!Fe&&z(`div`,{className:`app-notice is-warning`,role:`status`,children:[I(`span`,{children:e(k.modelListUnread?`setup.modelListUnread.notice`:`setup.serverDown.notice`)}),I(`button`,{type:`button`,className:`link-btn`,onClick:()=>void Me(!0),children:e(`setup.unknown.retry`)}),!k.modelListUnread&&I(`button`,{type:`button`,className:`link-btn`,onClick:()=>ne(!0),children:e(`setup.serverDown.setup`)})]}),k.state===`unknown`&&(k.upgradeFailed?z(`div`,{className:`app-notice is-warning`,role:`status`,children:[I(`span`,{children:e(`setup.upgrading.failed`,{error:k.error})}),I(`button`,{type:`button`,className:`link-btn`,onClick:()=>void Me(),children:e(`setup.upgrading.retry`)})]}):z(`div`,{className:`app-notice is-warning`,role:`status`,children:[I(`span`,{children:e(`setup.unknown.failed`,{error:k.error})}),I(`button`,{type:`button`,className:`link-btn`,onClick:()=>void Me(),children:e(`setup.unknown.retry`)})]})),(!d||f)&&I($c,{placement:`main`}),le&&I(dY,{onInstalled:ze,noBuild:se}),C&&z(`div`,{className:`app-notice${C.ok?``:` is-warning`}`,role:`status`,children:[I(`span`,{children:C.message}),!C.ok&&I(`button`,{type:`button`,className:`link-btn`,onClick:()=>{w(),b(`model`)},children:`Pick a model`}),I(`button`,{type:`button`,className:`app-notice-close`,onClick:w,"aria-label":`Dismiss`,children:I(Is,{size:14})})]}),I(kJ,{resetKey:l?`memory`:t??`new-${ge}`,area:`main`,children:Ct})]}),P&&I(cV,{api:P}),u&&I(V.Suspense,{fallback:null,children:I(rX,{})}),s&&I(V.Suspense,{fallback:null,children:I(iX,{})}),c&&I(V.Suspense,{fallback:null,children:I(aX,{onStartChat:ct})}),T&&I(`div`,{className:`notification-center-popover`,children:I(sY,{onClose:()=>O(!1),onOpenChat:dt})}),xe&&I(V.Suspense,{fallback:null,children:I(oX,{isOpen:xe,onClose:()=>Se(!1),onStop:()=>void bt(),error:Ee,setupCommands:Oe,onRetry:()=>void vt()})}),x&&I(HJ,{onUseSkill:ft}),I(cW,{}),I(xW,{}),ht&&I(wW,{onClose:()=>gt(!1)}),I(iY,{}),de&&z(`div`,{className:`toast toast-dismissible`,role:`alert`,children:[I(`span`,{children:de}),I(`button`,{type:`button`,className:`toast-dismiss`,onClick:()=>fe(null),"aria-label":e(`banner.dismiss`),children:I(Is,{size:14,"aria-hidden":`true`})})]})]})}var bX=`agent-refresh`,xX={"pre-checks":`engine.stage.preChecks`,"ensure-uv":`engine.stage.ensureUv`,"create-venv":`engine.stage.createVenv`,"install-package":`engine.stage.installPackage`,verify:`engine.stage.verify`,[bX]:`engine.stage.agentRefresh`,start:`engine.stage.start`},SX={disk:`engine.hint.disk`,network:`engine.hint.network`,tls:`engine.hint.tls`,locked:`engine.hint.locked`,daemon:`engine.hint.daemon`};function CX(e,t){if(!e)return t(`engine.stage.neutral`);let n=xX[e];return n?t(n):(console.warn(`[EngineInstallScreen] install stage "${e}" has no label`),t(`engine.stage.neutral`))}function wX(e,t){return e.reason?t(SX[e.reason]):t(e.stage===bX?`engine.hint.agent`:`engine.hint.other`)}function TX(e){return e.reason===`locked`&&e.lockedBy?.length?e.lockedBy:null}function EX(e,t){let n=e.name??String(e.pid),r=e.folder;return e.isGaia?r?t(`engine.locked.gaia`,{name:n,folder:r}):t(`engine.locked.gaiaNoFolder`,{name:n}):r?t(`engine.locked.other`,{name:n,folder:r}):t(`engine.locked.otherNoFolder`,{name:n})}function DX({status:e}){let t=R(),n=CX(e.stage,t);return z(`div`,{className:`engine-progress`,role:`status`,children:[z(`div`,{className:`engine-progress-head`,children:[I(`span`,{children:n}),e.percent!==null&&z(`bdi`,{dir:`ltr`,children:[e.percent,`%`]})]}),I(`progress`,{className:`engine-bar`,"aria-label":n,max:100,value:e.percent??void 0})]})}function OX({error:e,busy:t,notice:n,onRetry:r,onCloseLockers:i,onContinue:a,onRevert:o,onOpenLog:s}){let c=R(),l=TX(e),u=l!==null&&l.every(e=>e.isGaia),d=(l?.length??0)>1;return z(`div`,{className:`engine-failure`,children:[z(`div`,{role:`alert`,children:[l?z(P.Fragment,{children:[l.map(e=>I(`p`,{className:`engine-hint`,children:EX(e,c)},e.pid)),!u&&I(`p`,{className:`engine-hint`,children:c(d?`engine.locked.closeThenMany`:`engine.locked.closeThen`)})]}):I(`p`,{className:`engine-hint`,children:wX(e,c)}),I(`p`,{className:`engine-error`,children:I(`bdi`,{dir:`ltr`,children:e.message})})]}),u&&I(`button`,{type:`button`,className:`btn-primary engine-retry`,disabled:t,onClick:i,autoFocus:!0,children:c(d?`engine.locked.closeMany`:`engine.locked.close`)}),I(`button`,{type:`button`,className:`${u?`btn-secondary`:`btn-primary`} engine-retry`,disabled:t,onClick:r,autoFocus:!u,children:c(`engine.tryAgain`)}),e.stage===bX&&I(`button`,{type:`button`,className:`btn-secondary engine-retry`,disabled:t,onClick:a,children:c(`engine.continueWithout`)}),e.previousVersion&&I(`button`,{type:`button`,className:`btn-secondary engine-retry`,disabled:t,onClick:o,children:c(`update.chip.goBack`,{version:e.previousVersion})}),n&&I(`p`,{className:`engine-error`,role:`alert`,children:I(`bdi`,{dir:`ltr`,children:n})}),z(`details`,{className:`engine-details`,children:[I(`summary`,{children:c(`engine.details`)}),I(`pre`,{className:`engine-log`,dir:`ltr`,children:e.logTail.join(`
220
+ `)}),I(`button`,{type:`button`,className:`btn-secondary`,onClick:s,children:c(`engine.openLog`)})]})]})}function kX(){let e=R(),[t,n]=(0,V.useState)({phase:`running`,stage:null,percent:null,message:``,error:null}),[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(null),s=(0,V.useCallback)(e=>{console.error(`[EngineInstallScreen] the desktop app did not answer`,e),o(e instanceof Error?e.message:String(e))},[]);(0,V.useEffect)(()=>{let e=window.gaiaInstall,t=e.onProgress(n);return e.status().then(n).catch(s),t},[s]);let c=(0,V.useCallback)(()=>{i(!0),o(null),window.gaiaInstall.retry().catch(s).finally(()=>i(!1))},[s]),l=(0,V.useCallback)(()=>{i(!0),o(null),window.gaiaInstall.closeLockingPrograms().catch(s).finally(()=>i(!1))},[s]),u=(0,V.useCallback)(()=>{i(!0),o(null),window.gaiaInstall.continueWithoutAgentUpdate().catch(s).finally(()=>i(!1))},[s]),d=(0,V.useCallback)(()=>{i(!0),o(null),window.gaiaInstall.revert().then(e=>{e||i(!1)}).catch(e=>{s(e),i(!1)})},[s]),f=(0,V.useCallback)(()=>{o(null),window.gaiaInstall.openLogFile().then(e=>{e.ok||o(e.message)}).catch(s)},[s]),{error:p}=t,m=t.phase===`failed`&&p,h=e(m?p.stage===bX?`engine.failed.agentTitle`:`engine.failed.title`:`engine.title`);return I(`div`,{className:`app`,children:I(`main`,{className:`engine`,children:z(`div`,{className:`engine-inner`,children:[I(`h1`,{className:`engine-title`,children:h}),m?I(OX,{error:p,busy:r,notice:a,onRetry:c,onCloseLockers:l,onContinue:u,onRevert:d,onOpenLog:f}):z(P.Fragment,{children:[I(`p`,{className:`engine-lede`,children:e(`engine.lede`)}),I(DX,{status:t}),a&&I(`p`,{className:`engine-error`,role:`alert`,children:I(`bdi`,{dir:`ltr`,children:a})})]})]})})})}function AX(){return!!window.gaiaInstall&&new URLSearchParams(window.location.search).get(`engine`)===`install`}async function jX(e){if(!e.isProduction||e.protocol!==`https:`&&e.protocol!==`http:`||!e.serviceWorker)return!1;try{return await e.serviceWorker.register(`./sw.js`,{scope:`./`}),!0}catch(e){return console.error(`[pwa] Service worker registration failed, so the UI is not cached for an installed app:`,e),!1}}nl(),nt();var MX=localStorage.getItem(`gaia-chat-theme`);at(lt(MX===`light`||MX===`dark`?MX:`system`));var NX=B.getState();se(NX.palette,NX.customColors,NX.theme),be(NX.locale),je(),r(),Ls.createRoot(document.getElementById(`root`)).render(I(V.StrictMode,{children:I(kJ,{area:`app`,variant:`window`,children:AX()?I(kX,{}):I(yX,{})})})),window.addEventListener(`load`,()=>{jX({isProduction:!0,protocol:window.location.protocol,serviceWorker:`serviceWorker`in navigator?navigator.serviceWorker:void 0})});export{SH as $,Yi as $t,hU as A,Ps as At,gU as B,Po as Bt,EU as C,Gl as Ct,VU as D,ec as Dt,cU as E,_c as Et,oU as F,us as Ft,xU as G,$a as Gt,CU as H,wo as Ht,pU as I,cs as It,MU as J,Na as Jt,bU as K,La as Kt,DU as L,Ko as Lt,dU as M,Es as Mt,FU as N,ws as Nt,uU as O,qs as Ot,sU as P,Ss as Pt,OU as Q,Zi as Qt,aU as R,Wo as Rt,TU as S,Kl as St,LU as T,vc as Tt,wU as U,vo as Ut,IU as V,Oo as Vt,yU as W,mo as Wt,PU as X,aa as Xt,zU as Y,ha as Yt,mU as Z,$i as Zt,lW as _,Vr as _n,EO as _t,KJ as a,yi as an,uL as at,BU as b,pr as bn,h_ as bt,Fq as c,li as cn,aL as ct,Nq as d,ti as dn,KO as dt,Fi as en,Fz as et,Mq as f,$r as fn,RO as ft,bW as g,Gr as gn,TO as gt,TW as h,qr as hn,NO as ht,QJ as i,xi as in,cL as it,_U as j,Os as jt,lU as k,Is as kt,Pq as l,si as ln,iL as lt,OG as m,Yr as mn,OO as mt,kY as n,Di as nn,mL as nt,JJ as o,hi as on,nL as ot,oq as p,Zr as pn,PO as pt,SU as q,Fa as qt,bY as r,Ci as rn,gL as rt,IJ as s,di as sn,rL as st,NY as t,ji as tn,SL as tt,Aq as u,ri as un,SM as ut,JU as v,kr as vn,b_ as vt,vU as w,xc as wt,jU as x,eu as xt,RU as y,yr as yn,O_ as yt,fU as z,Bo as zt};