@prismshadow/penguin-server 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/api/types.d.ts +156 -4
- package/dist/chunk-V6KH4FRG.js +76 -0
- package/dist/chunk-V6KH4FRG.js.map +1 -0
- package/dist/index.js +3696 -2074
- package/dist/index.js.map +1 -1
- package/dist/lock.d.ts +18 -0
- package/dist/lock.js +17 -0
- package/dist/lock.js.map +1 -0
- package/package.json +9 -4
- package/web-dist/assets/index-BvejhGl5.css +1 -0
- package/web-dist/assets/{index-BgHHHLga.js → index-DTZ3P5wj.js} +1 -1
- package/web-dist/assets/index-yzk1uoHO.js +172 -0
- package/web-dist/index.html +2 -2
- package/web-dist/assets/index-BOvgZOwz.js +0 -173
- package/web-dist/assets/index-DGdg-i_E.css +0 -1
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&s(d)}).observe(document,{childList:!0,subtree:!0});function r(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(o){if(o.ep)return;o.ep=!0;const c=r(o);fetch(o.href,c)}})();function dv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xm={exports:{}},Ki={};var My;function Rj(){if(My)return Ki;My=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(s,o,c){var d=null;if(c!==void 0&&(d=""+c),o.key!==void 0&&(d=""+o.key),"key"in o){c={};for(var f in o)f!=="key"&&(c[f]=o[f])}else c=o;return o=c.ref,{$$typeof:e,type:s,key:d,ref:o!==void 0?o:null,props:c}}return Ki.Fragment=n,Ki.jsx=r,Ki.jsxs=r,Ki}var Ey;function _j(){return Ey||(Ey=1,xm.exports=Rj()),xm.exports}var l=_j(),ym={exports:{}},Pe={};var Ay;function Ij(){if(Ay)return Pe;Ay=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),k=Symbol.iterator;function w(C){return C===null||typeof C!="object"?null:(C=k&&C[k]||C["@@iterator"],typeof C=="function"?C:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,M={};function E(C,z,N){this.props=C,this.context=z,this.refs=M,this.updater=N||S}E.prototype.isReactComponent={},E.prototype.setState=function(C,z){if(typeof C!="object"&&typeof C!="function"&&C!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,C,z,"setState")},E.prototype.forceUpdate=function(C){this.updater.enqueueForceUpdate(this,C,"forceUpdate")};function R(){}R.prototype=E.prototype;function I(C,z,N){this.props=C,this.context=z,this.refs=M,this.updater=N||S}var H=I.prototype=new R;H.constructor=I,T(H,E.prototype),H.isPureReactComponent=!0;var D=Array.isArray;function L(){}var $={H:null,A:null,T:null,S:null},K=Object.prototype.hasOwnProperty;function X(C,z,N){var Q=N.ref;return{$$typeof:e,type:C,key:z,ref:Q!==void 0?Q:null,props:N}}function U(C,z){return X(C.type,z,C.props)}function V(C){return typeof C=="object"&&C!==null&&C.$$typeof===e}function O(C){var z={"=":"=0",":":"=2"};return"$"+C.replace(/[=:]/g,function(N){return z[N]})}var W=/\/+/g;function Z(C,z){return typeof C=="object"&&C!==null&&C.key!=null?O(""+C.key):z.toString(36)}function B(C){switch(C.status){case"fulfilled":return C.value;case"rejected":throw C.reason;default:switch(typeof C.status=="string"?C.then(L,L):(C.status="pending",C.then(function(z){C.status==="pending"&&(C.status="fulfilled",C.value=z)},function(z){C.status==="pending"&&(C.status="rejected",C.reason=z)})),C.status){case"fulfilled":return C.value;case"rejected":throw C.reason}}throw C}function F(C,z,N,Q,se){var le=typeof C;(le==="undefined"||le==="boolean")&&(C=null);var he=!1;if(C===null)he=!0;else switch(le){case"bigint":case"string":case"number":he=!0;break;case"object":switch(C.$$typeof){case e:case n:he=!0;break;case p:return he=C._init,F(he(C._payload),z,N,Q,se)}}if(he)return se=se(C),he=Q===""?"."+Z(C,0):Q,D(se)?(N="",he!=null&&(N=he.replace(W,"$&/")+"/"),F(se,z,N,"",function(pe){return pe})):se!=null&&(V(se)&&(se=U(se,N+(se.key==null||C&&C.key===se.key?"":(""+se.key).replace(W,"$&/")+"/")+he)),z.push(se)),1;he=0;var xe=Q===""?".":Q+":";if(D(C))for(var ne=0;ne<C.length;ne++)Q=C[ne],le=xe+Z(Q,ne),he+=F(Q,z,N,le,se);else if(ne=w(C),typeof ne=="function")for(C=ne.call(C),ne=0;!(Q=C.next()).done;)Q=Q.value,le=xe+Z(Q,ne++),he+=F(Q,z,N,le,se);else if(le==="object"){if(typeof C.then=="function")return F(B(C),z,N,Q,se);throw z=String(C),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys(C).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.")}return he}function P(C,z,N){if(C==null)return C;var Q=[],se=0;return F(C,Q,"","",function(le){return z.call(N,le,se++)}),Q}function ce(C){if(C._status===-1){var z=C._result;z=z(),z.then(function(N){(C._status===0||C._status===-1)&&(C._status=1,C._result=N)},function(N){(C._status===0||C._status===-1)&&(C._status=2,C._result=N)}),C._status===-1&&(C._status=0,C._result=z)}if(C._status===1)return C._result.default;throw C._result}var oe=typeof reportError=="function"?reportError:function(C){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof C=="object"&&C!==null&&typeof C.message=="string"?String(C.message):String(C),error:C});if(!window.dispatchEvent(z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",C);return}console.error(C)},A={map:P,forEach:function(C,z,N){P(C,function(){z.apply(this,arguments)},N)},count:function(C){var z=0;return P(C,function(){z++}),z},toArray:function(C){return P(C,function(z){return z})||[]},only:function(C){if(!V(C))throw Error("React.Children.only expected to receive a single React element child.");return C}};return Pe.Activity=y,Pe.Children=A,Pe.Component=E,Pe.Fragment=r,Pe.Profiler=o,Pe.PureComponent=I,Pe.StrictMode=s,Pe.Suspense=m,Pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=$,Pe.__COMPILER_RUNTIME={__proto__:null,c:function(C){return $.H.useMemoCache(C)}},Pe.cache=function(C){return function(){return C.apply(null,arguments)}},Pe.cacheSignal=function(){return null},Pe.cloneElement=function(C,z,N){if(C==null)throw Error("The argument must be a React element, but you passed "+C+".");var Q=T({},C.props),se=C.key;if(z!=null)for(le in z.key!==void 0&&(se=""+z.key),z)!K.call(z,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&z.ref===void 0||(Q[le]=z[le]);var le=arguments.length-2;if(le===1)Q.children=N;else if(1<le){for(var he=Array(le),xe=0;xe<le;xe++)he[xe]=arguments[xe+2];Q.children=he}return X(C.type,se,Q)},Pe.createContext=function(C){return C={$$typeof:d,_currentValue:C,_currentValue2:C,_threadCount:0,Provider:null,Consumer:null},C.Provider=C,C.Consumer={$$typeof:c,_context:C},C},Pe.createElement=function(C,z,N){var Q,se={},le=null;if(z!=null)for(Q in z.key!==void 0&&(le=""+z.key),z)K.call(z,Q)&&Q!=="key"&&Q!=="__self"&&Q!=="__source"&&(se[Q]=z[Q]);var he=arguments.length-2;if(he===1)se.children=N;else if(1<he){for(var xe=Array(he),ne=0;ne<he;ne++)xe[ne]=arguments[ne+2];se.children=xe}if(C&&C.defaultProps)for(Q in he=C.defaultProps,he)se[Q]===void 0&&(se[Q]=he[Q]);return X(C,le,se)},Pe.createRef=function(){return{current:null}},Pe.forwardRef=function(C){return{$$typeof:f,render:C}},Pe.isValidElement=V,Pe.lazy=function(C){return{$$typeof:p,_payload:{_status:-1,_result:C},_init:ce}},Pe.memo=function(C,z){return{$$typeof:h,type:C,compare:z===void 0?null:z}},Pe.startTransition=function(C){var z=$.T,N={};$.T=N;try{var Q=C(),se=$.S;se!==null&&se(N,Q),typeof Q=="object"&&Q!==null&&typeof Q.then=="function"&&Q.then(L,oe)}catch(le){oe(le)}finally{z!==null&&N.types!==null&&(z.types=N.types),$.T=z}},Pe.unstable_useCacheRefresh=function(){return $.H.useCacheRefresh()},Pe.use=function(C){return $.H.use(C)},Pe.useActionState=function(C,z,N){return $.H.useActionState(C,z,N)},Pe.useCallback=function(C,z){return $.H.useCallback(C,z)},Pe.useContext=function(C){return $.H.useContext(C)},Pe.useDebugValue=function(){},Pe.useDeferredValue=function(C,z){return $.H.useDeferredValue(C,z)},Pe.useEffect=function(C,z){return $.H.useEffect(C,z)},Pe.useEffectEvent=function(C){return $.H.useEffectEvent(C)},Pe.useId=function(){return $.H.useId()},Pe.useImperativeHandle=function(C,z,N){return $.H.useImperativeHandle(C,z,N)},Pe.useInsertionEffect=function(C,z){return $.H.useInsertionEffect(C,z)},Pe.useLayoutEffect=function(C,z){return $.H.useLayoutEffect(C,z)},Pe.useMemo=function(C,z){return $.H.useMemo(C,z)},Pe.useOptimistic=function(C,z){return $.H.useOptimistic(C,z)},Pe.useReducer=function(C,z,N){return $.H.useReducer(C,z,N)},Pe.useRef=function(C){return $.H.useRef(C)},Pe.useState=function(C){return $.H.useState(C)},Pe.useSyncExternalStore=function(C,z,N){return $.H.useSyncExternalStore(C,z,N)},Pe.useTransition=function(){return $.H.useTransition()},Pe.version="19.2.7",Pe}var Ry;function Vh(){return Ry||(Ry=1,ym.exports=Ij()),ym.exports}var v=Vh(),bm={exports:{}},Yi={},vm={exports:{}},km={};var _y;function Lj(){return _y||(_y=1,(function(e){function n(F,P){var ce=F.length;F.push(P);e:for(;0<ce;){var oe=ce-1>>>1,A=F[oe];if(0<o(A,P))F[oe]=P,F[ce]=A,ce=oe;else break e}}function r(F){return F.length===0?null:F[0]}function s(F){if(F.length===0)return null;var P=F[0],ce=F.pop();if(ce!==P){F[0]=ce;e:for(var oe=0,A=F.length,C=A>>>1;oe<C;){var z=2*(oe+1)-1,N=F[z],Q=z+1,se=F[Q];if(0>o(N,ce))Q<A&&0>o(se,N)?(F[oe]=se,F[Q]=ce,oe=Q):(F[oe]=N,F[z]=ce,oe=z);else if(Q<A&&0>o(se,ce))F[oe]=se,F[Q]=ce,oe=Q;else break e}}return P}function o(F,P){var ce=F.sortIndex-P.sortIndex;return ce!==0?ce:F.id-P.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var m=[],h=[],p=1,y=null,k=3,w=!1,S=!1,T=!1,M=!1,E=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function H(F){for(var P=r(h);P!==null;){if(P.callback===null)s(h);else if(P.startTime<=F)s(h),P.sortIndex=P.expirationTime,n(m,P);else break;P=r(h)}}function D(F){if(T=!1,H(F),!S)if(r(m)!==null)S=!0,L||(L=!0,O());else{var P=r(h);P!==null&&B(D,P.startTime-F)}}var L=!1,$=-1,K=5,X=-1;function U(){return M?!0:!(e.unstable_now()-X<K)}function V(){if(M=!1,L){var F=e.unstable_now();X=F;var P=!0;try{e:{S=!1,T&&(T=!1,R($),$=-1),w=!0;var ce=k;try{t:{for(H(F),y=r(m);y!==null&&!(y.expirationTime>F&&U());){var oe=y.callback;if(typeof oe=="function"){y.callback=null,k=y.priorityLevel;var A=oe(y.expirationTime<=F);if(F=e.unstable_now(),typeof A=="function"){y.callback=A,H(F),P=!0;break t}y===r(m)&&s(m),H(F)}else s(m);y=r(m)}if(y!==null)P=!0;else{var C=r(h);C!==null&&B(D,C.startTime-F),P=!1}}break e}finally{y=null,k=ce,w=!1}P=void 0}}finally{P?O():L=!1}}}var O;if(typeof I=="function")O=function(){I(V)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,Z=W.port2;W.port1.onmessage=V,O=function(){Z.postMessage(null)}}else O=function(){E(V,0)};function B(F,P){$=E(function(){F(e.unstable_now())},P)}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(F){F.callback=null},e.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):K=0<F?Math.floor(1e3/F):5},e.unstable_getCurrentPriorityLevel=function(){return k},e.unstable_next=function(F){switch(k){case 1:case 2:case 3:var P=3;break;default:P=k}var ce=k;k=P;try{return F()}finally{k=ce}},e.unstable_requestPaint=function(){M=!0},e.unstable_runWithPriority=function(F,P){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var ce=k;k=F;try{return P()}finally{k=ce}},e.unstable_scheduleCallback=function(F,P,ce){var oe=e.unstable_now();switch(typeof ce=="object"&&ce!==null?(ce=ce.delay,ce=typeof ce=="number"&&0<ce?oe+ce:oe):ce=oe,F){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=ce+A,F={id:p++,callback:P,priorityLevel:F,startTime:ce,expirationTime:A,sortIndex:-1},ce>oe?(F.sortIndex=ce,n(h,F),r(m)===null&&F===r(h)&&(T?(R($),$=-1):T=!0,B(D,ce-oe))):(F.sortIndex=A,n(m,F),S||w||(S=!0,L||(L=!0,O()))),F},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(F){var P=k;return function(){var ce=k;k=P;try{return F.apply(this,arguments)}finally{k=ce}}}})(km)),km}var Iy;function Oj(){return Iy||(Iy=1,vm.exports=Lj()),vm.exports}var wm={exports:{}},_n={};var Ly;function Dj(){if(Ly)return _n;Ly=1;var e=Vh();function n(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)h+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var s={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},o=Symbol.for("react.portal");function c(m,h,p){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:m,containerInfo:h,implementation:p}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return _n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,_n.createPortal=function(m,h){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(n(299));return c(m,h,null,p)},_n.flushSync=function(m){var h=d.T,p=s.p;try{if(d.T=null,s.p=2,m)return m()}finally{d.T=h,s.p=p,s.d.f()}},_n.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,s.d.C(m,h))},_n.prefetchDNS=function(m){typeof m=="string"&&s.d.D(m)},_n.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var p=h.as,y=f(p,h.crossOrigin),k=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;p==="style"?s.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:y,integrity:k,fetchPriority:w}):p==="script"&&s.d.X(m,{crossOrigin:y,integrity:k,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},_n.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var p=f(h.as,h.crossOrigin);s.d.M(m,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&s.d.M(m)},_n.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var p=h.as,y=f(p,h.crossOrigin);s.d.L(m,p,{crossOrigin:y,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},_n.preloadModule=function(m,h){if(typeof m=="string")if(h){var p=f(h.as,h.crossOrigin);s.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else s.d.m(m)},_n.requestFormReset=function(m){s.d.r(m)},_n.unstable_batchedUpdates=function(m,h){return m(h)},_n.useFormState=function(m,h,p){return d.H.useFormState(m,h,p)},_n.useFormStatus=function(){return d.H.useHostTransitionStatus()},_n.version="19.2.7",_n}var Oy;function fv(){if(Oy)return wm.exports;Oy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),wm.exports=Dj(),wm.exports}var Dy;function zj(){if(Dy)return Yi;Dy=1;var e=Oj(),n=Vh(),r=fv();function s(t){var a="https://react.dev/errors/"+t;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)a+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+t+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var a=t,i=t;if(t.alternate)for(;a.return;)a=a.return;else{t=a;do a=t,(a.flags&4098)!==0&&(i=a.return),t=a.return;while(t)}return a.tag===3?i:null}function d(t){if(t.tag===13){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function f(t){if(t.tag===31){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function m(t){if(c(t)!==t)throw Error(s(188))}function h(t){var a=t.alternate;if(!a){if(a=c(t),a===null)throw Error(s(188));return a!==t?null:t}for(var i=t,u=a;;){var x=i.return;if(x===null)break;var b=x.alternate;if(b===null){if(u=x.return,u!==null){i=u;continue}break}if(x.child===b.child){for(b=x.child;b;){if(b===i)return m(x),t;if(b===u)return m(x),a;b=b.sibling}throw Error(s(188))}if(i.return!==u.return)i=x,u=b;else{for(var j=!1,_=x.child;_;){if(_===i){j=!0,i=x,u=b;break}if(_===u){j=!0,u=x,i=b;break}_=_.sibling}if(!j){for(_=b.child;_;){if(_===i){j=!0,i=b,u=x;break}if(_===u){j=!0,u=b,i=x;break}_=_.sibling}if(!j)throw Error(s(189))}}if(i.alternate!==u)throw Error(s(190))}if(i.tag!==3)throw Error(s(188));return i.stateNode.current===i?t:a}function p(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t;for(t=t.child;t!==null;){if(a=p(t),a!==null)return a;t=t.sibling}return null}var y=Object.assign,k=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),I=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),U=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function O(t){return t===null||typeof t!="object"?null:(t=V&&t[V]||t["@@iterator"],typeof t=="function"?t:null)}var W=Symbol.for("react.client.reference");function Z(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===W?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case T:return"Fragment";case E:return"Profiler";case M:return"StrictMode";case D:return"Suspense";case L:return"SuspenseList";case X:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case S:return"Portal";case I:return t.displayName||"Context";case R:return(t._context.displayName||"Context")+".Consumer";case H:var a=t.render;return t=t.displayName,t||(t=a.displayName||a.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case $:return a=t.displayName||null,a!==null?a:Z(t.type)||"Memo";case K:a=t._payload,t=t._init;try{return Z(t(a))}catch{}}return null}var B=Array.isArray,F=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ce={pending:!1,data:null,method:null,action:null},oe=[],A=-1;function C(t){return{current:t}}function z(t){0>A||(t.current=oe[A],oe[A]=null,A--)}function N(t,a){A++,oe[A]=t.current,t.current=a}var Q=C(null),se=C(null),le=C(null),he=C(null);function xe(t,a){switch(N(le,a),N(se,t),N(Q,null),a.nodeType){case 9:case 11:t=(t=a.documentElement)&&(t=t.namespaceURI)?Xx(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=Xx(a),t=Zx(a,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}z(Q),N(Q,t)}function ne(){z(Q),z(se),z(le)}function pe(t){t.memoizedState!==null&&N(he,t);var a=Q.current,i=Zx(a,t.type);a!==i&&(N(se,t),N(Q,i))}function be(t){se.current===t&&(z(Q),z(se)),he.current===t&&(z(he),qi._currentValue=ce)}var Fe,qe;function $e(t){if(Fe===void 0)try{throw Error()}catch(i){var a=i.stack.trim().match(/\n( *(at )?)/);Fe=a&&a[1]||"",qe=-1<i.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+Fe+t+qe}var Ye=!1;function Et(t,a){if(!t||Ye)return"";Ye=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(a){var me=function(){throw Error()};if(Object.defineProperty(me.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(me,[])}catch(ie){var re=ie}Reflect.construct(t,[],me)}else{try{me.call()}catch(ie){re=ie}t.call(me.prototype)}}else{try{throw Error()}catch(ie){re=ie}(me=t())&&typeof me.catch=="function"&&me.catch(function(){})}}catch(ie){if(ie&&re&&typeof ie.stack=="string")return[ie.stack,re.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var b=u.DetermineComponentFrameRoot(),j=b[0],_=b[1];if(j&&_){var q=j.split(`
|
|
4
|
-
`),ee=_.split(`
|
|
5
|
-
`);for(x=u=0;u<q.length&&!q[u].includes("DetermineComponentFrameRoot");)u++;for(;x<ee.length&&!ee[x].includes("DetermineComponentFrameRoot");)x++;if(u===q.length||x===ee.length)for(u=q.length-1,x=ee.length-1;1<=u&&0<=x&&q[u]!==ee[x];)x--;for(;1<=u&&0<=x;u--,x--)if(q[u]!==ee[x]){if(u!==1||x!==1)do if(u--,x--,0>x||q[u]!==ee[x]){var de=`
|
|
6
|
-
`+q[u].replace(" at new "," at ");return t.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",t.displayName)),de}while(1<=u&&0<=x);break}}}finally{Ye=!1,Error.prepareStackTrace=i}return(i=t?t.displayName||t.name:"")?$e(i):""}function kn(t,a){switch(t.tag){case 26:case 27:case 5:return $e(t.type);case 16:return $e("Lazy");case 13:return t.child!==a&&a!==null?$e("Suspense Fallback"):$e("Suspense");case 19:return $e("SuspenseList");case 0:case 15:return Et(t.type,!1);case 11:return Et(t.type.render,!1);case 1:return Et(t.type,!0);case 31:return $e("Activity");default:return""}}function je(t){try{var a="",i=null;do a+=kn(t,i),i=t,t=t.return;while(t);return a}catch(u){return`
|
|
7
|
-
Error generating stack: `+u.message+`
|
|
8
|
-
`+u.stack}}var We=Object.prototype.hasOwnProperty,jt=e.unstable_scheduleCallback,yt=e.unstable_cancelCallback,Qt=e.unstable_shouldYield,wn=e.unstable_requestPaint,Xe=e.unstable_now,ba=e.unstable_getCurrentPriorityLevel,ue=e.unstable_ImmediatePriority,ye=e.unstable_UserBlockingPriority,Ne=e.unstable_NormalPriority,He=e.unstable_LowPriority,De=e.unstable_IdlePriority,At=e.log,Rt=e.unstable_setDisableYieldValue,$t=null,Ke=null;function Wt(t){if(typeof At=="function"&&Rt(t),Ke&&typeof Ke.setStrictMode=="function")try{Ke.setStrictMode($t,t)}catch{}}var Ze=Math.clz32?Math.clz32:na,dn=Math.log,lt=Math.LN2;function na(t){return t>>>=0,t===0?32:31-(dn(t)/lt|0)|0}var Hn=256,_t=262144,En=4194304;function Ut(t){var a=t&42;if(a!==0)return a;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Nt(t,a,i){var u=t.pendingLanes;if(u===0)return 0;var x=0,b=t.suspendedLanes,j=t.pingedLanes;t=t.warmLanes;var _=u&134217727;return _!==0?(u=_&~b,u!==0?x=Ut(u):(j&=_,j!==0?x=Ut(j):i||(i=_&~t,i!==0&&(x=Ut(i))))):(_=u&~b,_!==0?x=Ut(_):j!==0?x=Ut(j):i||(i=u&~t,i!==0&&(x=Ut(i)))),x===0?0:a!==0&&a!==x&&(a&b)===0&&(b=x&-x,i=a&-a,b>=i||b===32&&(i&4194048)!==0)?a:x}function Dn(t,a){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&a)===0}function va(t,a){switch(t){case 1:case 2:case 4:case 8:case 64:return a+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 a+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 Ha(){var t=En;return En<<=1,(En&62914560)===0&&(En=4194304),t}function Pn(t){for(var a=[],i=0;31>i;i++)a.push(t);return a}function xn(t,a){t.pendingLanes|=a,a!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Fn(t,a,i,u,x,b){var j=t.pendingLanes;t.pendingLanes=i,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=i,t.entangledLanes&=i,t.errorRecoveryDisabledLanes&=i,t.shellSuspendCounter=0;var _=t.entanglements,q=t.expirationTimes,ee=t.hiddenUpdates;for(i=j&~i;0<i;){var de=31-Ze(i),me=1<<de;_[de]=0,q[de]=-1;var re=ee[de];if(re!==null)for(ee[de]=null,de=0;de<re.length;de++){var ie=re[de];ie!==null&&(ie.lane&=-536870913)}i&=~me}u!==0&&ke(t,u,0),b!==0&&x===0&&t.tag!==0&&(t.suspendedLanes|=b&~(j&~a))}function ke(t,a,i){t.pendingLanes|=a,t.suspendedLanes&=~a;var u=31-Ze(a);t.entangledLanes|=a,t.entanglements[u]=t.entanglements[u]|1073741824|i&261930}function Ee(t,a){var i=t.entangledLanes|=a;for(t=t.entanglements;i;){var u=31-Ze(i),x=1<<u;x&a|t[u]&a&&(t[u]|=a),i&=~x}}function dt(t,a){var i=a&-a;return i=(i&42)!==0?1:Qe(i),(i&(t.suspendedLanes|a))!==0?0:i}function Qe(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function Bt(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function pt(){var t=P.p;return t!==0?t:(t=window.event,t===void 0?32:ky(t.type))}function Sn(t,a){var i=P.p;try{return P.p=t,a()}finally{P.p=i}}var jn=Math.random().toString(36).slice(2),bt="__reactFiber$"+jn,Kt="__reactProps$"+jn,fn="__reactContainer$"+jn,Pr="__reactEvents$"+jn,ol="__reactListeners$"+jn,ai="__reactHandles$"+jn,xr="__reactResources$"+jn,qn="__reactMarker$"+jn;function yr(t){delete t[bt],delete t[Kt],delete t[Pr],delete t[ol],delete t[ai]}function Pa(t){var a=t[bt];if(a)return a;for(var i=t.parentNode;i;){if(a=i[fn]||i[bt]){if(i=a.alternate,a.child!==null||i!==null&&i.child!==null)for(t=sy(t);t!==null;){if(i=t[bt])return i;t=sy(t)}return a}t=i,i=t.parentNode}return null}function er(t){if(t=t[bt]||t[fn]){var a=t.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return t}return null}function tr(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t.stateNode;throw Error(s(33))}function An(t){var a=t[xr];return a||(a=t[xr]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function It(t){t[qn]=!0}var Ms=new Set,Es={};function zn(t,a){ka(t,a),ka(t+"Capture",a)}function ka(t,a){for(Es[t]=a,t=0;t<a.length;t++)Ms.add(a[t])}var ri=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]*$"),nr={},wa={};function Fr(t){return We.call(wa,t)?!0:We.call(nr,t)?!1:ri.test(t)?wa[t]=!0:(nr[t]=!0,!1)}function ar(t,a,i){if(Fr(a))if(i===null)t.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":t.removeAttribute(a);return;case"boolean":var u=a.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){t.removeAttribute(a);return}}t.setAttribute(a,""+i)}}function ae(t,a,i){if(i===null)t.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttribute(a,""+i)}}function ve(t,a,i,u){if(u===null)t.removeAttribute(i);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(i);return}t.setAttributeNS(a,i,""+u)}}function Ie(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function it(t){var a=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function qt(t,a,i){var u=Object.getOwnPropertyDescriptor(t.constructor.prototype,a);if(!t.hasOwnProperty(a)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var x=u.get,b=u.set;return Object.defineProperty(t,a,{configurable:!0,get:function(){return x.call(this)},set:function(j){i=""+j,b.call(this,j)}}),Object.defineProperty(t,a,{enumerable:u.enumerable}),{getValue:function(){return i},setValue:function(j){i=""+j},stopTracking:function(){t._valueTracker=null,delete t[a]}}}}function Lt(t){if(!t._valueTracker){var a=it(t)?"checked":"value";t._valueTracker=qt(t,a,""+t[a])}}function en(t){if(!t)return!1;var a=t._valueTracker;if(!a)return!0;var i=a.getValue(),u="";return t&&(u=it(t)?t.checked?"true":"false":t.value),t=u,t!==i?(a.setValue(t),!0):!1}function yn(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var rr=/[\n"\\]/g;function an(t){return t.replace(rr,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Sa(t,a,i,u,x,b,j,_){t.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?t.type=j:t.removeAttribute("type"),a!=null?j==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+Ie(a)):t.value!==""+Ie(a)&&(t.value=""+Ie(a)):j!=="submit"&&j!=="reset"||t.removeAttribute("value"),a!=null?Vr(t,j,Ie(a)):i!=null?Vr(t,j,Ie(i)):u!=null&&t.removeAttribute("value"),x==null&&b!=null&&(t.defaultChecked=!!b),x!=null&&(t.checked=x&&typeof x!="function"&&typeof x!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?t.name=""+Ie(_):t.removeAttribute("name")}function qr(t,a,i,u,x,b,j,_){if(b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(t.type=b),a!=null||i!=null){if(!(b!=="submit"&&b!=="reset"||a!=null)){Lt(t);return}i=i!=null?""+Ie(i):"",a=a!=null?""+Ie(a):i,_||a===t.value||(t.value=a),t.defaultValue=a}u=u??x,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=_?t.checked:!!u,t.defaultChecked=!!u,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(t.name=j),Lt(t)}function Vr(t,a,i){a==="number"&&yn(t.ownerDocument)===t||t.defaultValue===""+i||(t.defaultValue=""+i)}function Rn(t,a,i,u){if(t=t.options,a){a={};for(var x=0;x<i.length;x++)a["$"+i[x]]=!0;for(i=0;i<t.length;i++)x=a.hasOwnProperty("$"+t[i].value),t[i].selected!==x&&(t[i].selected=x),x&&u&&(t[i].defaultSelected=!0)}else{for(i=""+Ie(i),a=null,x=0;x<t.length;x++){if(t[x].value===i){t[x].selected=!0,u&&(t[x].defaultSelected=!0);return}a!==null||t[x].disabled||(a=t[x])}a!==null&&(a.selected=!0)}}function Fo(t,a,i){if(a!=null&&(a=""+Ie(a),a!==t.value&&(t.value=a),i==null)){t.defaultValue!==a&&(t.defaultValue=a);return}t.defaultValue=i!=null?""+Ie(i):""}function qo(t,a,i,u){if(a==null){if(u!=null){if(i!=null)throw Error(s(92));if(B(u)){if(1<u.length)throw Error(s(93));u=u[0]}i=u}i==null&&(i=""),a=i}i=Ie(a),t.defaultValue=i,u=t.textContent,u===i&&u!==""&&u!==null&&(t.value=u),Lt(t)}function Gr(t,a){if(a){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=a;return}}t.textContent=a}var hd=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 si(t,a,i){var u=a.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?u?t.setProperty(a,""):a==="float"?t.cssFloat="":t[a]="":u?t.setProperty(a,i):typeof i!="number"||i===0||hd.has(a)?a==="float"?t.cssFloat=i:t[a]=(""+i).trim():t[a]=i+"px"}function li(t,a,i){if(a!=null&&typeof a!="object")throw Error(s(62));if(t=t.style,i!=null){for(var u in i)!i.hasOwnProperty(u)||a!=null&&a.hasOwnProperty(u)||(u.indexOf("--")===0?t.setProperty(u,""):u==="float"?t.cssFloat="":t[u]="");for(var x in a)u=a[x],a.hasOwnProperty(x)&&i[x]!==u&&si(t,x,u)}else for(var b in a)a.hasOwnProperty(b)&&si(t,b,a[b])}function te(t){if(t.indexOf("-")===-1)return!1;switch(t){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 we=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"],["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"]]),ze=/^[\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 ct(t){return ze.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function at(){}var ja=null;function As(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Rs=null,Wr=null;function Qp(t){var a=er(t);if(a&&(t=a.stateNode)){var i=t[Kt]||null;e:switch(t=a.stateNode,a.type){case"input":if(Sa(t,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),a=i.name,i.type==="radio"&&a!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+an(""+a)+'"][type="radio"]'),a=0;a<i.length;a++){var u=i[a];if(u!==t&&u.form===t.form){var x=u[Kt]||null;if(!x)throw Error(s(90));Sa(u,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(a=0;a<i.length;a++)u=i[a],u.form===t.form&&en(u)}break e;case"textarea":Fo(t,i.value,i.defaultValue);break e;case"select":a=i.value,a!=null&&Rn(t,!!i.multiple,a,!1)}}}var pd=!1;function Xp(t,a,i){if(pd)return t(a,i);pd=!0;try{var u=t(a);return u}finally{if(pd=!1,(Rs!==null||Wr!==null)&&(Rc(),Rs&&(a=Rs,t=Wr,Wr=Rs=null,Qp(a),t)))for(a=0;a<t.length;a++)Qp(t[a])}}function ii(t,a){var i=t.stateNode;if(i===null)return null;var u=i[Kt]||null;if(u===null)return null;i=u[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(s(231,a,typeof i));return i}var br=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),gd=!1;if(br)try{var oi={};Object.defineProperty(oi,"passive",{get:function(){gd=!0}}),window.addEventListener("test",oi,oi),window.removeEventListener("test",oi,oi)}catch{gd=!1}var Kr=null,xd=null,Vo=null;function Zp(){if(Vo)return Vo;var t,a=xd,i=a.length,u,x="value"in Kr?Kr.value:Kr.textContent,b=x.length;for(t=0;t<i&&a[t]===x[t];t++);var j=i-t;for(u=1;u<=j&&a[i-u]===x[b-u];u++);return Vo=x.slice(t,1<u?1-u:void 0)}function Go(t){var a=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&a===13&&(t=13)):t=a,t===10&&(t=13),32<=t||t===13?t:0}function Wo(){return!0}function Jp(){return!1}function Vn(t){function a(i,u,x,b,j){this._reactName=i,this._targetInst=x,this.type=u,this.nativeEvent=b,this.target=j,this.currentTarget=null;for(var _ in t)t.hasOwnProperty(_)&&(i=t[_],this[_]=i?i(b):b[_]);return this.isDefaultPrevented=(b.defaultPrevented!=null?b.defaultPrevented:b.returnValue===!1)?Wo:Jp,this.isPropagationStopped=Jp,this}return y(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Wo)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Wo)},persist:function(){},isPersistent:Wo}),a}var _s={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ko=Vn(_s),ci=y({},_s,{view:0,detail:0}),Ew=Vn(ci),yd,bd,ui,Yo=y({},ci,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:kd,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==ui&&(ui&&t.type==="mousemove"?(yd=t.screenX-ui.screenX,bd=t.screenY-ui.screenY):bd=yd=0,ui=t),yd)},movementY:function(t){return"movementY"in t?t.movementY:bd}}),eg=Vn(Yo),Aw=y({},Yo,{dataTransfer:0}),Rw=Vn(Aw),_w=y({},ci,{relatedTarget:0}),vd=Vn(_w),Iw=y({},_s,{animationName:0,elapsedTime:0,pseudoElement:0}),Lw=Vn(Iw),Ow=y({},_s,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),Dw=Vn(Ow),zw=y({},_s,{data:0}),tg=Vn(zw),Uw={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},$w={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"},Bw={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Hw(t){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(t):(t=Bw[t])?!!a[t]:!1}function kd(){return Hw}var Pw=y({},ci,{key:function(t){if(t.key){var a=Uw[t.key]||t.key;if(a!=="Unidentified")return a}return t.type==="keypress"?(t=Go(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?$w[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:kd,charCode:function(t){return t.type==="keypress"?Go(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Go(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),Fw=Vn(Pw),qw=y({},Yo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ng=Vn(qw),Vw=y({},ci,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:kd}),Gw=Vn(Vw),Ww=y({},_s,{propertyName:0,elapsedTime:0,pseudoElement:0}),Kw=Vn(Ww),Yw=y({},Yo,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Qw=Vn(Yw),Xw=y({},_s,{newState:0,oldState:0}),Zw=Vn(Xw),Jw=[9,13,27,32],wd=br&&"CompositionEvent"in window,di=null;br&&"documentMode"in document&&(di=document.documentMode);var eS=br&&"TextEvent"in window&&!di,ag=br&&(!wd||di&&8<di&&11>=di),rg=" ",sg=!1;function lg(t,a){switch(t){case"keyup":return Jw.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ig(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var cl=!1;function tS(t,a){switch(t){case"compositionend":return ig(a);case"keypress":return a.which!==32?null:(sg=!0,rg);case"textInput":return t=a.data,t===rg&&sg?null:t;default:return null}}function nS(t,a){if(cl)return t==="compositionend"||!wd&&lg(t,a)?(t=Zp(),Vo=xd=Kr=null,cl=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return ag&&a.locale!=="ko"?null:a.data;default:return null}}var aS={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 og(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a==="input"?!!aS[t.type]:a==="textarea"}function cg(t,a,i,u){Rs?Wr?Wr.push(u):Wr=[u]:Rs=u,a=Uc(a,"onChange"),0<a.length&&(i=new Ko("onChange","change",null,i,u),t.push({event:i,listeners:a}))}var fi=null,mi=null;function rS(t){Vx(t,0)}function Qo(t){var a=tr(t);if(en(a))return t}function ug(t,a){if(t==="change")return a}var dg=!1;if(br){var Sd;if(br){var jd="oninput"in document;if(!jd){var fg=document.createElement("div");fg.setAttribute("oninput","return;"),jd=typeof fg.oninput=="function"}Sd=jd}else Sd=!1;dg=Sd&&(!document.documentMode||9<document.documentMode)}function mg(){fi&&(fi.detachEvent("onpropertychange",hg),mi=fi=null)}function hg(t){if(t.propertyName==="value"&&Qo(mi)){var a=[];cg(a,mi,t,As(t)),Xp(rS,a)}}function sS(t,a,i){t==="focusin"?(mg(),fi=a,mi=i,fi.attachEvent("onpropertychange",hg)):t==="focusout"&&mg()}function lS(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Qo(mi)}function iS(t,a){if(t==="click")return Qo(a)}function oS(t,a){if(t==="input"||t==="change")return Qo(a)}function cS(t,a){return t===a&&(t!==0||1/t===1/a)||t!==t&&a!==a}var aa=typeof Object.is=="function"?Object.is:cS;function hi(t,a){if(aa(t,a))return!0;if(typeof t!="object"||t===null||typeof a!="object"||a===null)return!1;var i=Object.keys(t),u=Object.keys(a);if(i.length!==u.length)return!1;for(u=0;u<i.length;u++){var x=i[u];if(!We.call(a,x)||!aa(t[x],a[x]))return!1}return!0}function pg(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function gg(t,a){var i=pg(t);t=0;for(var u;i;){if(i.nodeType===3){if(u=t+i.textContent.length,t<=a&&u>=a)return{node:i,offset:a-t};t=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=pg(i)}}function xg(t,a){return t&&a?t===a?!0:t&&t.nodeType===3?!1:a&&a.nodeType===3?xg(t,a.parentNode):"contains"in t?t.contains(a):t.compareDocumentPosition?!!(t.compareDocumentPosition(a)&16):!1:!1}function yg(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var a=yn(t.document);a instanceof t.HTMLIFrameElement;){try{var i=typeof a.contentWindow.location.href=="string"}catch{i=!1}if(i)t=a.contentWindow;else break;a=yn(t.document)}return a}function Nd(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a&&(a==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||a==="textarea"||t.contentEditable==="true")}var uS=br&&"documentMode"in document&&11>=document.documentMode,ul=null,Cd=null,pi=null,Td=!1;function bg(t,a,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Td||ul==null||ul!==yn(u)||(u=ul,"selectionStart"in u&&Nd(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),pi&&hi(pi,u)||(pi=u,u=Uc(Cd,"onSelect"),0<u.length&&(a=new Ko("onSelect","select",null,a,i),t.push({event:a,listeners:u}),a.target=ul)))}function Is(t,a){var i={};return i[t.toLowerCase()]=a.toLowerCase(),i["Webkit"+t]="webkit"+a,i["Moz"+t]="moz"+a,i}var dl={animationend:Is("Animation","AnimationEnd"),animationiteration:Is("Animation","AnimationIteration"),animationstart:Is("Animation","AnimationStart"),transitionrun:Is("Transition","TransitionRun"),transitionstart:Is("Transition","TransitionStart"),transitioncancel:Is("Transition","TransitionCancel"),transitionend:Is("Transition","TransitionEnd")},Md={},vg={};br&&(vg=document.createElement("div").style,"AnimationEvent"in window||(delete dl.animationend.animation,delete dl.animationiteration.animation,delete dl.animationstart.animation),"TransitionEvent"in window||delete dl.transitionend.transition);function Ls(t){if(Md[t])return Md[t];if(!dl[t])return t;var a=dl[t],i;for(i in a)if(a.hasOwnProperty(i)&&i in vg)return Md[t]=a[i];return t}var kg=Ls("animationend"),wg=Ls("animationiteration"),Sg=Ls("animationstart"),dS=Ls("transitionrun"),fS=Ls("transitionstart"),mS=Ls("transitioncancel"),jg=Ls("transitionend"),Ng=new Map,Ed="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error 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(" ");Ed.push("scrollEnd");function Fa(t,a){Ng.set(t,a),zn(a,[t])}var Xo=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Na=[],fl=0,Ad=0;function Zo(){for(var t=fl,a=Ad=fl=0;a<t;){var i=Na[a];Na[a++]=null;var u=Na[a];Na[a++]=null;var x=Na[a];Na[a++]=null;var b=Na[a];if(Na[a++]=null,u!==null&&x!==null){var j=u.pending;j===null?x.next=x:(x.next=j.next,j.next=x),u.pending=x}b!==0&&Cg(i,x,b)}}function Jo(t,a,i,u){Na[fl++]=t,Na[fl++]=a,Na[fl++]=i,Na[fl++]=u,Ad|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function Rd(t,a,i,u){return Jo(t,a,i,u),ec(t)}function Os(t,a){return Jo(t,null,null,a),ec(t)}function Cg(t,a,i){t.lanes|=i;var u=t.alternate;u!==null&&(u.lanes|=i);for(var x=!1,b=t.return;b!==null;)b.childLanes|=i,u=b.alternate,u!==null&&(u.childLanes|=i),b.tag===22&&(t=b.stateNode,t===null||t._visibility&1||(x=!0)),t=b,b=b.return;return t.tag===3?(b=t.stateNode,x&&a!==null&&(x=31-Ze(i),t=b.hiddenUpdates,u=t[x],u===null?t[x]=[a]:u.push(a),a.lane=i|536870912),b):null}function ec(t){if(50<zi)throw zi=0,Hf=null,Error(s(185));for(var a=t.return;a!==null;)t=a,a=t.return;return t.tag===3?t.stateNode:null}var ml={};function hS(t,a,i,u){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ra(t,a,i,u){return new hS(t,a,i,u)}function _d(t){return t=t.prototype,!(!t||!t.isReactComponent)}function vr(t,a){var i=t.alternate;return i===null?(i=ra(t.tag,a,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=a,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&65011712,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,a=t.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i.refCleanup=t.refCleanup,i}function Tg(t,a){t.flags&=65011714;var i=t.alternate;return i===null?(t.childLanes=0,t.lanes=a,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=i.childLanes,t.lanes=i.lanes,t.child=i.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=i.memoizedProps,t.memoizedState=i.memoizedState,t.updateQueue=i.updateQueue,t.type=i.type,a=i.dependencies,t.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),t}function tc(t,a,i,u,x,b){var j=0;if(u=t,typeof t=="function")_d(t)&&(j=1);else if(typeof t=="string")j=bj(t,i,Q.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case X:return t=ra(31,i,a,x),t.elementType=X,t.lanes=b,t;case T:return Ds(i.children,x,b,a);case M:j=8,x|=24;break;case E:return t=ra(12,i,a,x|2),t.elementType=E,t.lanes=b,t;case D:return t=ra(13,i,a,x),t.elementType=D,t.lanes=b,t;case L:return t=ra(19,i,a,x),t.elementType=L,t.lanes=b,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case I:j=10;break e;case R:j=9;break e;case H:j=11;break e;case $:j=14;break e;case K:j=16,u=null;break e}j=29,i=Error(s(130,t===null?"null":typeof t,"")),u=null}return a=ra(j,i,a,x),a.elementType=t,a.type=u,a.lanes=b,a}function Ds(t,a,i,u){return t=ra(7,t,u,a),t.lanes=i,t}function Id(t,a,i){return t=ra(6,t,null,a),t.lanes=i,t}function Mg(t){var a=ra(18,null,null,0);return a.stateNode=t,a}function Ld(t,a,i){return a=ra(4,t.children!==null?t.children:[],t.key,a),a.lanes=i,a.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},a}var Eg=new WeakMap;function Ca(t,a){if(typeof t=="object"&&t!==null){var i=Eg.get(t);return i!==void 0?i:(a={value:t,source:a,stack:je(a)},Eg.set(t,a),a)}return{value:t,source:a,stack:je(a)}}var hl=[],pl=0,nc=null,gi=0,Ta=[],Ma=0,Yr=null,sr=1,lr="";function kr(t,a){hl[pl++]=gi,hl[pl++]=nc,nc=t,gi=a}function Ag(t,a,i){Ta[Ma++]=sr,Ta[Ma++]=lr,Ta[Ma++]=Yr,Yr=t;var u=sr;t=lr;var x=32-Ze(u)-1;u&=~(1<<x),i+=1;var b=32-Ze(a)+x;if(30<b){var j=x-x%5;b=(u&(1<<j)-1).toString(32),u>>=j,x-=j,sr=1<<32-Ze(a)+x|i<<x|u,lr=b+t}else sr=1<<b|i<<x|u,lr=t}function Od(t){t.return!==null&&(kr(t,1),Ag(t,1,0))}function Dd(t){for(;t===nc;)nc=hl[--pl],hl[pl]=null,gi=hl[--pl],hl[pl]=null;for(;t===Yr;)Yr=Ta[--Ma],Ta[Ma]=null,lr=Ta[--Ma],Ta[Ma]=null,sr=Ta[--Ma],Ta[Ma]=null}function Rg(t,a){Ta[Ma++]=sr,Ta[Ma++]=lr,Ta[Ma++]=Yr,sr=a.id,lr=a.overflow,Yr=t}var Nn=null,Ht=null,ot=!1,Qr=null,Ea=!1,zd=Error(s(519));function Xr(t){var a=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw xi(Ca(a,t)),zd}function _g(t){var a=t.stateNode,i=t.type,u=t.memoizedProps;switch(a[bt]=t,a[Kt]=u,i){case"dialog":et("cancel",a),et("close",a);break;case"iframe":case"object":case"embed":et("load",a);break;case"video":case"audio":for(i=0;i<$i.length;i++)et($i[i],a);break;case"source":et("error",a);break;case"img":case"image":case"link":et("error",a),et("load",a);break;case"details":et("toggle",a);break;case"input":et("invalid",a),qr(a,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":et("invalid",a);break;case"textarea":et("invalid",a),qo(a,u.value,u.defaultValue,u.children)}i=u.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||a.textContent===""+i||u.suppressHydrationWarning===!0||Yx(a.textContent,i)?(u.popover!=null&&(et("beforetoggle",a),et("toggle",a)),u.onScroll!=null&&et("scroll",a),u.onScrollEnd!=null&&et("scrollend",a),u.onClick!=null&&(a.onclick=at),a=!0):a=!1,a||Xr(t,!0)}function Ig(t){for(Nn=t.return;Nn;)switch(Nn.tag){case 5:case 31:case 13:Ea=!1;return;case 27:case 3:Ea=!0;return;default:Nn=Nn.return}}function gl(t){if(t!==Nn)return!1;if(!ot)return Ig(t),ot=!0,!1;var a=t.tag,i;if((i=a!==3&&a!==27)&&((i=a===5)&&(i=t.type,i=!(i!=="form"&&i!=="button")||nm(t.type,t.memoizedProps)),i=!i),i&&Ht&&Xr(t),Ig(t),a===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));Ht=ry(t)}else if(a===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));Ht=ry(t)}else a===27?(a=Ht,ds(t.type)?(t=im,im=null,Ht=t):Ht=a):Ht=Nn?Ra(t.stateNode.nextSibling):null;return!0}function zs(){Ht=Nn=null,ot=!1}function Ud(){var t=Qr;return t!==null&&(Yn===null?Yn=t:Yn.push.apply(Yn,t),Qr=null),t}function xi(t){Qr===null?Qr=[t]:Qr.push(t)}var $d=C(null),Us=null,wr=null;function Zr(t,a,i){N($d,a._currentValue),a._currentValue=i}function Sr(t){t._currentValue=$d.current,z($d)}function Bd(t,a,i){for(;t!==null;){var u=t.alternate;if((t.childLanes&a)!==a?(t.childLanes|=a,u!==null&&(u.childLanes|=a)):u!==null&&(u.childLanes&a)!==a&&(u.childLanes|=a),t===i)break;t=t.return}}function Hd(t,a,i,u){var x=t.child;for(x!==null&&(x.return=t);x!==null;){var b=x.dependencies;if(b!==null){var j=x.child;b=b.firstContext;e:for(;b!==null;){var _=b;b=x;for(var q=0;q<a.length;q++)if(_.context===a[q]){b.lanes|=i,_=b.alternate,_!==null&&(_.lanes|=i),Bd(b.return,i,t),u||(j=null);break e}b=_.next}}else if(x.tag===18){if(j=x.return,j===null)throw Error(s(341));j.lanes|=i,b=j.alternate,b!==null&&(b.lanes|=i),Bd(j,i,t),j=null}else j=x.child;if(j!==null)j.return=x;else for(j=x;j!==null;){if(j===t){j=null;break}if(x=j.sibling,x!==null){x.return=j.return,j=x;break}j=j.return}x=j}}function xl(t,a,i,u){t=null;for(var x=a,b=!1;x!==null;){if(!b){if((x.flags&524288)!==0)b=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var j=x.alternate;if(j===null)throw Error(s(387));if(j=j.memoizedProps,j!==null){var _=x.type;aa(x.pendingProps.value,j.value)||(t!==null?t.push(_):t=[_])}}else if(x===he.current){if(j=x.alternate,j===null)throw Error(s(387));j.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(t!==null?t.push(qi):t=[qi])}x=x.return}t!==null&&Hd(a,t,i,u),a.flags|=262144}function ac(t){for(t=t.firstContext;t!==null;){if(!aa(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function $s(t){Us=t,wr=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Cn(t){return Lg(Us,t)}function rc(t,a){return Us===null&&$s(t),Lg(t,a)}function Lg(t,a){var i=a._currentValue;if(a={context:a,memoizedValue:i,next:null},wr===null){if(t===null)throw Error(s(308));wr=a,t.dependencies={lanes:0,firstContext:a},t.flags|=524288}else wr=wr.next=a;return i}var pS=typeof AbortController<"u"?AbortController:function(){var t=[],a=this.signal={aborted:!1,addEventListener:function(i,u){t.push(u)}};this.abort=function(){a.aborted=!0,t.forEach(function(i){return i()})}},gS=e.unstable_scheduleCallback,xS=e.unstable_NormalPriority,rn={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Pd(){return{controller:new pS,data:new Map,refCount:0}}function yi(t){t.refCount--,t.refCount===0&&gS(xS,function(){t.controller.abort()})}var bi=null,Fd=0,yl=0,bl=null;function yS(t,a){if(bi===null){var i=bi=[];Fd=0,yl=Wf(),bl={status:"pending",value:void 0,then:function(u){i.push(u)}}}return Fd++,a.then(Og,Og),a}function Og(){if(--Fd===0&&bi!==null){bl!==null&&(bl.status="fulfilled");var t=bi;bi=null,yl=0,bl=null;for(var a=0;a<t.length;a++)(0,t[a])()}}function bS(t,a){var i=[],u={status:"pending",value:null,reason:null,then:function(x){i.push(x)}};return t.then(function(){u.status="fulfilled",u.value=a;for(var x=0;x<i.length;x++)(0,i[x])(a)},function(x){for(u.status="rejected",u.reason=x,x=0;x<i.length;x++)(0,i[x])(void 0)}),u}var Dg=F.S;F.S=function(t,a){bx=Xe(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&yS(t,a),Dg!==null&&Dg(t,a)};var Bs=C(null);function qd(){var t=Bs.current;return t!==null?t:Ot.pooledCache}function sc(t,a){a===null?N(Bs,Bs.current):N(Bs,a.pool)}function zg(){var t=qd();return t===null?null:{parent:rn._currentValue,pool:t}}var vl=Error(s(460)),Vd=Error(s(474)),lc=Error(s(542)),ic={then:function(){}};function Ug(t){return t=t.status,t==="fulfilled"||t==="rejected"}function $g(t,a,i){switch(i=t[i],i===void 0?t.push(a):i!==a&&(a.then(at,at),a=i),a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,Hg(t),t;default:if(typeof a.status=="string")a.then(at,at);else{if(t=Ot,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=a,t.status="pending",t.then(function(u){if(a.status==="pending"){var x=a;x.status="fulfilled",x.value=u}},function(u){if(a.status==="pending"){var x=a;x.status="rejected",x.reason=u}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,Hg(t),t}throw Ps=a,vl}}function Hs(t){try{var a=t._init;return a(t._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(Ps=i,vl):i}}var Ps=null;function Bg(){if(Ps===null)throw Error(s(459));var t=Ps;return Ps=null,t}function Hg(t){if(t===vl||t===lc)throw Error(s(483))}var kl=null,vi=0;function oc(t){var a=vi;return vi+=1,kl===null&&(kl=[]),$g(kl,t,a)}function ki(t,a){a=a.props.ref,t.ref=a!==void 0?a:null}function cc(t,a){throw a.$$typeof===k?Error(s(525)):(t=Object.prototype.toString.call(a),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":t)))}function Pg(t){function a(Y,G){if(t){var J=Y.deletions;J===null?(Y.deletions=[G],Y.flags|=16):J.push(G)}}function i(Y,G){if(!t)return null;for(;G!==null;)a(Y,G),G=G.sibling;return null}function u(Y){for(var G=new Map;Y!==null;)Y.key!==null?G.set(Y.key,Y):G.set(Y.index,Y),Y=Y.sibling;return G}function x(Y,G){return Y=vr(Y,G),Y.index=0,Y.sibling=null,Y}function b(Y,G,J){return Y.index=J,t?(J=Y.alternate,J!==null?(J=J.index,J<G?(Y.flags|=67108866,G):J):(Y.flags|=67108866,G)):(Y.flags|=1048576,G)}function j(Y){return t&&Y.alternate===null&&(Y.flags|=67108866),Y}function _(Y,G,J,fe){return G===null||G.tag!==6?(G=Id(J,Y.mode,fe),G.return=Y,G):(G=x(G,J),G.return=Y,G)}function q(Y,G,J,fe){var Re=J.type;return Re===T?de(Y,G,J.props.children,fe,J.key):G!==null&&(G.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===K&&Hs(Re)===G.type)?(G=x(G,J.props),ki(G,J),G.return=Y,G):(G=tc(J.type,J.key,J.props,null,Y.mode,fe),ki(G,J),G.return=Y,G)}function ee(Y,G,J,fe){return G===null||G.tag!==4||G.stateNode.containerInfo!==J.containerInfo||G.stateNode.implementation!==J.implementation?(G=Ld(J,Y.mode,fe),G.return=Y,G):(G=x(G,J.children||[]),G.return=Y,G)}function de(Y,G,J,fe,Re){return G===null||G.tag!==7?(G=Ds(J,Y.mode,fe,Re),G.return=Y,G):(G=x(G,J),G.return=Y,G)}function me(Y,G,J){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=Id(""+G,Y.mode,J),G.return=Y,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case w:return J=tc(G.type,G.key,G.props,null,Y.mode,J),ki(J,G),J.return=Y,J;case S:return G=Ld(G,Y.mode,J),G.return=Y,G;case K:return G=Hs(G),me(Y,G,J)}if(B(G)||O(G))return G=Ds(G,Y.mode,J,null),G.return=Y,G;if(typeof G.then=="function")return me(Y,oc(G),J);if(G.$$typeof===I)return me(Y,rc(Y,G),J);cc(Y,G)}return null}function re(Y,G,J,fe){var Re=G!==null?G.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Re!==null?null:_(Y,G,""+J,fe);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case w:return J.key===Re?q(Y,G,J,fe):null;case S:return J.key===Re?ee(Y,G,J,fe):null;case K:return J=Hs(J),re(Y,G,J,fe)}if(B(J)||O(J))return Re!==null?null:de(Y,G,J,fe,null);if(typeof J.then=="function")return re(Y,G,oc(J),fe);if(J.$$typeof===I)return re(Y,G,rc(Y,J),fe);cc(Y,J)}return null}function ie(Y,G,J,fe,Re){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return Y=Y.get(J)||null,_(G,Y,""+fe,Re);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case w:return Y=Y.get(fe.key===null?J:fe.key)||null,q(G,Y,fe,Re);case S:return Y=Y.get(fe.key===null?J:fe.key)||null,ee(G,Y,fe,Re);case K:return fe=Hs(fe),ie(Y,G,J,fe,Re)}if(B(fe)||O(fe))return Y=Y.get(J)||null,de(G,Y,fe,Re,null);if(typeof fe.then=="function")return ie(Y,G,J,oc(fe),Re);if(fe.$$typeof===I)return ie(Y,G,J,rc(G,fe),Re);cc(G,fe)}return null}function Ce(Y,G,J,fe){for(var Re=null,mt=null,Me=G,Ge=G=0,st=null;Me!==null&&Ge<J.length;Ge++){Me.index>Ge?(st=Me,Me=null):st=Me.sibling;var ht=re(Y,Me,J[Ge],fe);if(ht===null){Me===null&&(Me=st);break}t&&Me&&ht.alternate===null&&a(Y,Me),G=b(ht,G,Ge),mt===null?Re=ht:mt.sibling=ht,mt=ht,Me=st}if(Ge===J.length)return i(Y,Me),ot&&kr(Y,Ge),Re;if(Me===null){for(;Ge<J.length;Ge++)Me=me(Y,J[Ge],fe),Me!==null&&(G=b(Me,G,Ge),mt===null?Re=Me:mt.sibling=Me,mt=Me);return ot&&kr(Y,Ge),Re}for(Me=u(Me);Ge<J.length;Ge++)st=ie(Me,Y,Ge,J[Ge],fe),st!==null&&(t&&st.alternate!==null&&Me.delete(st.key===null?Ge:st.key),G=b(st,G,Ge),mt===null?Re=st:mt.sibling=st,mt=st);return t&&Me.forEach(function(gs){return a(Y,gs)}),ot&&kr(Y,Ge),Re}function Oe(Y,G,J,fe){if(J==null)throw Error(s(151));for(var Re=null,mt=null,Me=G,Ge=G=0,st=null,ht=J.next();Me!==null&&!ht.done;Ge++,ht=J.next()){Me.index>Ge?(st=Me,Me=null):st=Me.sibling;var gs=re(Y,Me,ht.value,fe);if(gs===null){Me===null&&(Me=st);break}t&&Me&&gs.alternate===null&&a(Y,Me),G=b(gs,G,Ge),mt===null?Re=gs:mt.sibling=gs,mt=gs,Me=st}if(ht.done)return i(Y,Me),ot&&kr(Y,Ge),Re;if(Me===null){for(;!ht.done;Ge++,ht=J.next())ht=me(Y,ht.value,fe),ht!==null&&(G=b(ht,G,Ge),mt===null?Re=ht:mt.sibling=ht,mt=ht);return ot&&kr(Y,Ge),Re}for(Me=u(Me);!ht.done;Ge++,ht=J.next())ht=ie(Me,Y,Ge,ht.value,fe),ht!==null&&(t&&ht.alternate!==null&&Me.delete(ht.key===null?Ge:ht.key),G=b(ht,G,Ge),mt===null?Re=ht:mt.sibling=ht,mt=ht);return t&&Me.forEach(function(Aj){return a(Y,Aj)}),ot&&kr(Y,Ge),Re}function Mt(Y,G,J,fe){if(typeof J=="object"&&J!==null&&J.type===T&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case w:e:{for(var Re=J.key;G!==null;){if(G.key===Re){if(Re=J.type,Re===T){if(G.tag===7){i(Y,G.sibling),fe=x(G,J.props.children),fe.return=Y,Y=fe;break e}}else if(G.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===K&&Hs(Re)===G.type){i(Y,G.sibling),fe=x(G,J.props),ki(fe,J),fe.return=Y,Y=fe;break e}i(Y,G);break}else a(Y,G);G=G.sibling}J.type===T?(fe=Ds(J.props.children,Y.mode,fe,J.key),fe.return=Y,Y=fe):(fe=tc(J.type,J.key,J.props,null,Y.mode,fe),ki(fe,J),fe.return=Y,Y=fe)}return j(Y);case S:e:{for(Re=J.key;G!==null;){if(G.key===Re)if(G.tag===4&&G.stateNode.containerInfo===J.containerInfo&&G.stateNode.implementation===J.implementation){i(Y,G.sibling),fe=x(G,J.children||[]),fe.return=Y,Y=fe;break e}else{i(Y,G);break}else a(Y,G);G=G.sibling}fe=Ld(J,Y.mode,fe),fe.return=Y,Y=fe}return j(Y);case K:return J=Hs(J),Mt(Y,G,J,fe)}if(B(J))return Ce(Y,G,J,fe);if(O(J)){if(Re=O(J),typeof Re!="function")throw Error(s(150));return J=Re.call(J),Oe(Y,G,J,fe)}if(typeof J.then=="function")return Mt(Y,G,oc(J),fe);if(J.$$typeof===I)return Mt(Y,G,rc(Y,J),fe);cc(Y,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,G!==null&&G.tag===6?(i(Y,G.sibling),fe=x(G,J),fe.return=Y,Y=fe):(i(Y,G),fe=Id(J,Y.mode,fe),fe.return=Y,Y=fe),j(Y)):i(Y,G)}return function(Y,G,J,fe){try{vi=0;var Re=Mt(Y,G,J,fe);return kl=null,Re}catch(Me){if(Me===vl||Me===lc)throw Me;var mt=ra(29,Me,null,Y.mode);return mt.lanes=fe,mt.return=Y,mt}}}var Fs=Pg(!0),Fg=Pg(!1),Jr=!1;function Gd(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Wd(t,a){t=t.updateQueue,a.updateQueue===t&&(a.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function es(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function ts(t,a,i){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(gt&2)!==0){var x=u.pending;return x===null?a.next=a:(a.next=x.next,x.next=a),u.pending=a,a=ec(t),Cg(t,null,i),a}return Jo(t,u,a,i),ec(t)}function wi(t,a,i){if(a=a.updateQueue,a!==null&&(a=a.shared,(i&4194048)!==0)){var u=a.lanes;u&=t.pendingLanes,i|=u,a.lanes=i,Ee(t,i)}}function Kd(t,a){var i=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var x=null,b=null;if(i=i.firstBaseUpdate,i!==null){do{var j={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};b===null?x=b=j:b=b.next=j,i=i.next}while(i!==null);b===null?x=b=a:b=b.next=a}else x=b=a;i={baseState:u.baseState,firstBaseUpdate:x,lastBaseUpdate:b,shared:u.shared,callbacks:u.callbacks},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=a:t.next=a,i.lastBaseUpdate=a}var Yd=!1;function Si(){if(Yd){var t=bl;if(t!==null)throw t}}function ji(t,a,i,u){Yd=!1;var x=t.updateQueue;Jr=!1;var b=x.firstBaseUpdate,j=x.lastBaseUpdate,_=x.shared.pending;if(_!==null){x.shared.pending=null;var q=_,ee=q.next;q.next=null,j===null?b=ee:j.next=ee,j=q;var de=t.alternate;de!==null&&(de=de.updateQueue,_=de.lastBaseUpdate,_!==j&&(_===null?de.firstBaseUpdate=ee:_.next=ee,de.lastBaseUpdate=q))}if(b!==null){var me=x.baseState;j=0,de=ee=q=null,_=b;do{var re=_.lane&-536870913,ie=re!==_.lane;if(ie?(rt&re)===re:(u&re)===re){re!==0&&re===yl&&(Yd=!0),de!==null&&(de=de.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var Ce=t,Oe=_;re=a;var Mt=i;switch(Oe.tag){case 1:if(Ce=Oe.payload,typeof Ce=="function"){me=Ce.call(Mt,me,re);break e}me=Ce;break e;case 3:Ce.flags=Ce.flags&-65537|128;case 0:if(Ce=Oe.payload,re=typeof Ce=="function"?Ce.call(Mt,me,re):Ce,re==null)break e;me=y({},me,re);break e;case 2:Jr=!0}}re=_.callback,re!==null&&(t.flags|=64,ie&&(t.flags|=8192),ie=x.callbacks,ie===null?x.callbacks=[re]:ie.push(re))}else ie={lane:re,tag:_.tag,payload:_.payload,callback:_.callback,next:null},de===null?(ee=de=ie,q=me):de=de.next=ie,j|=re;if(_=_.next,_===null){if(_=x.shared.pending,_===null)break;ie=_,_=ie.next,ie.next=null,x.lastBaseUpdate=ie,x.shared.pending=null}}while(!0);de===null&&(q=me),x.baseState=q,x.firstBaseUpdate=ee,x.lastBaseUpdate=de,b===null&&(x.shared.lanes=0),ls|=j,t.lanes=j,t.memoizedState=me}}function qg(t,a){if(typeof t!="function")throw Error(s(191,t));t.call(a)}function Vg(t,a){var i=t.callbacks;if(i!==null)for(t.callbacks=null,t=0;t<i.length;t++)qg(i[t],a)}var wl=C(null),uc=C(0);function Gg(t,a){t=_r,N(uc,t),N(wl,a),_r=t|a.baseLanes}function Qd(){N(uc,_r),N(wl,wl.current)}function Xd(){_r=uc.current,z(wl),z(uc)}var sa=C(null),Aa=null;function ns(t){var a=t.alternate;N(tn,tn.current&1),N(sa,t),Aa===null&&(a===null||wl.current!==null||a.memoizedState!==null)&&(Aa=t)}function Zd(t){N(tn,tn.current),N(sa,t),Aa===null&&(Aa=t)}function Wg(t){t.tag===22?(N(tn,tn.current),N(sa,t),Aa===null&&(Aa=t)):as()}function as(){N(tn,tn.current),N(sa,sa.current)}function la(t){z(sa),Aa===t&&(Aa=null),z(tn)}var tn=C(0);function dc(t){for(var a=t;a!==null;){if(a.tag===13){var i=a.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||sm(i)||lm(i)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var jr=0,Ve=null,Ct=null,sn=null,fc=!1,Sl=!1,qs=!1,mc=0,Ni=0,jl=null,vS=0;function Xt(){throw Error(s(321))}function Jd(t,a){if(a===null)return!1;for(var i=0;i<a.length&&i<t.length;i++)if(!aa(t[i],a[i]))return!1;return!0}function ef(t,a,i,u,x,b){return jr=b,Ve=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,F.H=t===null||t.memoizedState===null?A0:gf,qs=!1,b=i(u,x),qs=!1,Sl&&(b=Yg(a,i,u,x)),Kg(t),b}function Kg(t){F.H=Mi;var a=Ct!==null&&Ct.next!==null;if(jr=0,sn=Ct=Ve=null,fc=!1,Ni=0,jl=null,a)throw Error(s(300));t===null||ln||(t=t.dependencies,t!==null&&ac(t)&&(ln=!0))}function Yg(t,a,i,u){Ve=t;var x=0;do{if(Sl&&(jl=null),Ni=0,Sl=!1,25<=x)throw Error(s(301));if(x+=1,sn=Ct=null,t.updateQueue!=null){var b=t.updateQueue;b.lastEffect=null,b.events=null,b.stores=null,b.memoCache!=null&&(b.memoCache.index=0)}F.H=R0,b=a(i,u)}while(Sl);return b}function kS(){var t=F.H,a=t.useState()[0];return a=typeof a.then=="function"?Ci(a):a,t=t.useState()[0],(Ct!==null?Ct.memoizedState:null)!==t&&(Ve.flags|=1024),a}function tf(){var t=mc!==0;return mc=0,t}function nf(t,a,i){a.updateQueue=t.updateQueue,a.flags&=-2053,t.lanes&=~i}function af(t){if(fc){for(t=t.memoizedState;t!==null;){var a=t.queue;a!==null&&(a.pending=null),t=t.next}fc=!1}jr=0,sn=Ct=Ve=null,Sl=!1,Ni=mc=0,jl=null}function Un(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return sn===null?Ve.memoizedState=sn=t:sn=sn.next=t,sn}function nn(){if(Ct===null){var t=Ve.alternate;t=t!==null?t.memoizedState:null}else t=Ct.next;var a=sn===null?Ve.memoizedState:sn.next;if(a!==null)sn=a,Ct=t;else{if(t===null)throw Ve.alternate===null?Error(s(467)):Error(s(310));Ct=t,t={memoizedState:Ct.memoizedState,baseState:Ct.baseState,baseQueue:Ct.baseQueue,queue:Ct.queue,next:null},sn===null?Ve.memoizedState=sn=t:sn=sn.next=t}return sn}function hc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ci(t){var a=Ni;return Ni+=1,jl===null&&(jl=[]),t=$g(jl,t,a),a=Ve,(sn===null?a.memoizedState:sn.next)===null&&(a=a.alternate,F.H=a===null||a.memoizedState===null?A0:gf),t}function pc(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Ci(t);if(t.$$typeof===I)return Cn(t)}throw Error(s(438,String(t)))}function rf(t){var a=null,i=Ve.updateQueue;if(i!==null&&(a=i.memoCache),a==null){var u=Ve.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(a={data:u.data.map(function(x){return x.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),i===null&&(i=hc(),Ve.updateQueue=i),i.memoCache=a,i=a.data[a.index],i===void 0)for(i=a.data[a.index]=Array(t),u=0;u<t;u++)i[u]=U;return a.index++,i}function Nr(t,a){return typeof a=="function"?a(t):a}function gc(t){var a=nn();return sf(a,Ct,t)}function sf(t,a,i){var u=t.queue;if(u===null)throw Error(s(311));u.lastRenderedReducer=i;var x=t.baseQueue,b=u.pending;if(b!==null){if(x!==null){var j=x.next;x.next=b.next,b.next=j}a.baseQueue=x=b,u.pending=null}if(b=t.baseState,x===null)t.memoizedState=b;else{a=x.next;var _=j=null,q=null,ee=a,de=!1;do{var me=ee.lane&-536870913;if(me!==ee.lane?(rt&me)===me:(jr&me)===me){var re=ee.revertLane;if(re===0)q!==null&&(q=q.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),me===yl&&(de=!0);else if((jr&re)===re){ee=ee.next,re===yl&&(de=!0);continue}else me={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},q===null?(_=q=me,j=b):q=q.next=me,Ve.lanes|=re,ls|=re;me=ee.action,qs&&i(b,me),b=ee.hasEagerState?ee.eagerState:i(b,me)}else re={lane:me,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},q===null?(_=q=re,j=b):q=q.next=re,Ve.lanes|=me,ls|=me;ee=ee.next}while(ee!==null&&ee!==a);if(q===null?j=b:q.next=_,!aa(b,t.memoizedState)&&(ln=!0,de&&(i=bl,i!==null)))throw i;t.memoizedState=b,t.baseState=j,t.baseQueue=q,u.lastRenderedState=b}return x===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function lf(t){var a=nn(),i=a.queue;if(i===null)throw Error(s(311));i.lastRenderedReducer=t;var u=i.dispatch,x=i.pending,b=a.memoizedState;if(x!==null){i.pending=null;var j=x=x.next;do b=t(b,j.action),j=j.next;while(j!==x);aa(b,a.memoizedState)||(ln=!0),a.memoizedState=b,a.baseQueue===null&&(a.baseState=b),i.lastRenderedState=b}return[b,u]}function Qg(t,a,i){var u=Ve,x=nn(),b=ot;if(b){if(i===void 0)throw Error(s(407));i=i()}else i=a();var j=!aa((Ct||x).memoizedState,i);if(j&&(x.memoizedState=i,ln=!0),x=x.queue,uf(Jg.bind(null,u,x,t),[t]),x.getSnapshot!==a||j||sn!==null&&sn.memoizedState.tag&1){if(u.flags|=2048,Nl(9,{destroy:void 0},Zg.bind(null,u,x,i,a),null),Ot===null)throw Error(s(349));b||(jr&127)!==0||Xg(u,a,i)}return i}function Xg(t,a,i){t.flags|=16384,t={getSnapshot:a,value:i},a=Ve.updateQueue,a===null?(a=hc(),Ve.updateQueue=a,a.stores=[t]):(i=a.stores,i===null?a.stores=[t]:i.push(t))}function Zg(t,a,i,u){a.value=i,a.getSnapshot=u,e0(a)&&t0(t)}function Jg(t,a,i){return i(function(){e0(a)&&t0(t)})}function e0(t){var a=t.getSnapshot;t=t.value;try{var i=a();return!aa(t,i)}catch{return!0}}function t0(t){var a=Os(t,2);a!==null&&Qn(a,t,2)}function of(t){var a=Un();if(typeof t=="function"){var i=t;if(t=i(),qs){Wt(!0);try{i()}finally{Wt(!1)}}}return a.memoizedState=a.baseState=t,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nr,lastRenderedState:t},a}function n0(t,a,i,u){return t.baseState=i,sf(t,Ct,typeof u=="function"?u:Nr)}function wS(t,a,i,u,x){if(bc(t))throw Error(s(485));if(t=a.action,t!==null){var b={payload:x,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){b.listeners.push(j)}};F.T!==null?i(!0):b.isTransition=!1,u(b),i=a.pending,i===null?(b.next=a.pending=b,a0(a,b)):(b.next=i.next,a.pending=i.next=b)}}function a0(t,a){var i=a.action,u=a.payload,x=t.state;if(a.isTransition){var b=F.T,j={};F.T=j;try{var _=i(x,u),q=F.S;q!==null&&q(j,_),r0(t,a,_)}catch(ee){cf(t,a,ee)}finally{b!==null&&j.types!==null&&(b.types=j.types),F.T=b}}else try{b=i(x,u),r0(t,a,b)}catch(ee){cf(t,a,ee)}}function r0(t,a,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(u){s0(t,a,u)},function(u){return cf(t,a,u)}):s0(t,a,i)}function s0(t,a,i){a.status="fulfilled",a.value=i,l0(a),t.state=i,a=t.pending,a!==null&&(i=a.next,i===a?t.pending=null:(i=i.next,a.next=i,a0(t,i)))}function cf(t,a,i){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do a.status="rejected",a.reason=i,l0(a),a=a.next;while(a!==u)}t.action=null}function l0(t){t=t.listeners;for(var a=0;a<t.length;a++)(0,t[a])()}function i0(t,a){return a}function o0(t,a){if(ot){var i=Ot.formState;if(i!==null){e:{var u=Ve;if(ot){if(Ht){t:{for(var x=Ht,b=Ea;x.nodeType!==8;){if(!b){x=null;break t}if(x=Ra(x.nextSibling),x===null){x=null;break t}}b=x.data,x=b==="F!"||b==="F"?x:null}if(x){Ht=Ra(x.nextSibling),u=x.data==="F!";break e}}Xr(u)}u=!1}u&&(a=i[0])}}return i=Un(),i.memoizedState=i.baseState=a,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i0,lastRenderedState:a},i.queue=u,i=T0.bind(null,Ve,u),u.dispatch=i,u=of(!1),b=pf.bind(null,Ve,!1,u.queue),u=Un(),x={state:a,dispatch:null,action:t,pending:null},u.queue=x,i=wS.bind(null,Ve,x,b,i),x.dispatch=i,u.memoizedState=t,[a,i,!1]}function c0(t){var a=nn();return u0(a,Ct,t)}function u0(t,a,i){if(a=sf(t,a,i0)[0],t=gc(Nr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var u=Ci(a)}catch(j){throw j===vl?lc:j}else u=a;a=nn();var x=a.queue,b=x.dispatch;return i!==a.memoizedState&&(Ve.flags|=2048,Nl(9,{destroy:void 0},SS.bind(null,x,i),null)),[u,b,t]}function SS(t,a){t.action=a}function d0(t){var a=nn(),i=Ct;if(i!==null)return u0(a,i,t);nn(),a=a.memoizedState,i=nn();var u=i.queue.dispatch;return i.memoizedState=t,[a,u,!1]}function Nl(t,a,i,u){return t={tag:t,create:i,deps:u,inst:a,next:null},a=Ve.updateQueue,a===null&&(a=hc(),Ve.updateQueue=a),i=a.lastEffect,i===null?a.lastEffect=t.next=t:(u=i.next,i.next=t,t.next=u,a.lastEffect=t),t}function f0(){return nn().memoizedState}function xc(t,a,i,u){var x=Un();Ve.flags|=t,x.memoizedState=Nl(1|a,{destroy:void 0},i,u===void 0?null:u)}function yc(t,a,i,u){var x=nn();u=u===void 0?null:u;var b=x.memoizedState.inst;Ct!==null&&u!==null&&Jd(u,Ct.memoizedState.deps)?x.memoizedState=Nl(a,b,i,u):(Ve.flags|=t,x.memoizedState=Nl(1|a,b,i,u))}function m0(t,a){xc(8390656,8,t,a)}function uf(t,a){yc(2048,8,t,a)}function jS(t){Ve.flags|=4;var a=Ve.updateQueue;if(a===null)a=hc(),Ve.updateQueue=a,a.events=[t];else{var i=a.events;i===null?a.events=[t]:i.push(t)}}function h0(t){var a=nn().memoizedState;return jS({ref:a,nextImpl:t}),function(){if((gt&2)!==0)throw Error(s(440));return a.impl.apply(void 0,arguments)}}function p0(t,a){return yc(4,2,t,a)}function g0(t,a){return yc(4,4,t,a)}function x0(t,a){if(typeof a=="function"){t=t();var i=a(t);return function(){typeof i=="function"?i():a(null)}}if(a!=null)return t=t(),a.current=t,function(){a.current=null}}function y0(t,a,i){i=i!=null?i.concat([t]):null,yc(4,4,x0.bind(null,a,t),i)}function df(){}function b0(t,a){var i=nn();a=a===void 0?null:a;var u=i.memoizedState;return a!==null&&Jd(a,u[1])?u[0]:(i.memoizedState=[t,a],t)}function v0(t,a){var i=nn();a=a===void 0?null:a;var u=i.memoizedState;if(a!==null&&Jd(a,u[1]))return u[0];if(u=t(),qs){Wt(!0);try{t()}finally{Wt(!1)}}return i.memoizedState=[u,a],u}function ff(t,a,i){return i===void 0||(jr&1073741824)!==0&&(rt&261930)===0?t.memoizedState=a:(t.memoizedState=i,t=kx(),Ve.lanes|=t,ls|=t,i)}function k0(t,a,i,u){return aa(i,a)?i:wl.current!==null?(t=ff(t,i,u),aa(t,a)||(ln=!0),t):(jr&42)===0||(jr&1073741824)!==0&&(rt&261930)===0?(ln=!0,t.memoizedState=i):(t=kx(),Ve.lanes|=t,ls|=t,a)}function w0(t,a,i,u,x){var b=P.p;P.p=b!==0&&8>b?b:8;var j=F.T,_={};F.T=_,pf(t,!1,a,i);try{var q=x(),ee=F.S;if(ee!==null&&ee(_,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var de=bS(q,u);Ti(t,a,de,ca(t))}else Ti(t,a,u,ca(t))}catch(me){Ti(t,a,{then:function(){},status:"rejected",reason:me},ca())}finally{P.p=b,j!==null&&_.types!==null&&(j.types=_.types),F.T=j}}function NS(){}function mf(t,a,i,u){if(t.tag!==5)throw Error(s(476));var x=S0(t).queue;w0(t,x,a,ce,i===null?NS:function(){return j0(t),i(u)})}function S0(t){var a=t.memoizedState;if(a!==null)return a;a={memoizedState:ce,baseState:ce,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nr,lastRenderedState:ce},next:null};var i={};return a.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Nr,lastRenderedState:i},next:null},t.memoizedState=a,t=t.alternate,t!==null&&(t.memoizedState=a),a}function j0(t){var a=S0(t);a.next===null&&(a=t.alternate.memoizedState),Ti(t,a.next.queue,{},ca())}function hf(){return Cn(qi)}function N0(){return nn().memoizedState}function C0(){return nn().memoizedState}function CS(t){for(var a=t.return;a!==null;){switch(a.tag){case 24:case 3:var i=ca();t=es(i);var u=ts(a,t,i);u!==null&&(Qn(u,a,i),wi(u,a,i)),a={cache:Pd()},t.payload=a;return}a=a.return}}function TS(t,a,i){var u=ca();i={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},bc(t)?M0(a,i):(i=Rd(t,a,i,u),i!==null&&(Qn(i,t,u),E0(i,a,u)))}function T0(t,a,i){var u=ca();Ti(t,a,i,u)}function Ti(t,a,i,u){var x={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(bc(t))M0(a,x);else{var b=t.alternate;if(t.lanes===0&&(b===null||b.lanes===0)&&(b=a.lastRenderedReducer,b!==null))try{var j=a.lastRenderedState,_=b(j,i);if(x.hasEagerState=!0,x.eagerState=_,aa(_,j))return Jo(t,a,x,0),Ot===null&&Zo(),!1}catch{}if(i=Rd(t,a,x,u),i!==null)return Qn(i,t,u),E0(i,a,u),!0}return!1}function pf(t,a,i,u){if(u={lane:2,revertLane:Wf(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},bc(t)){if(a)throw Error(s(479))}else a=Rd(t,i,u,2),a!==null&&Qn(a,t,2)}function bc(t){var a=t.alternate;return t===Ve||a!==null&&a===Ve}function M0(t,a){Sl=fc=!0;var i=t.pending;i===null?a.next=a:(a.next=i.next,i.next=a),t.pending=a}function E0(t,a,i){if((i&4194048)!==0){var u=a.lanes;u&=t.pendingLanes,i|=u,a.lanes=i,Ee(t,i)}}var Mi={readContext:Cn,use:pc,useCallback:Xt,useContext:Xt,useEffect:Xt,useImperativeHandle:Xt,useLayoutEffect:Xt,useInsertionEffect:Xt,useMemo:Xt,useReducer:Xt,useRef:Xt,useState:Xt,useDebugValue:Xt,useDeferredValue:Xt,useTransition:Xt,useSyncExternalStore:Xt,useId:Xt,useHostTransitionStatus:Xt,useFormState:Xt,useActionState:Xt,useOptimistic:Xt,useMemoCache:Xt,useCacheRefresh:Xt};Mi.useEffectEvent=Xt;var A0={readContext:Cn,use:pc,useCallback:function(t,a){return Un().memoizedState=[t,a===void 0?null:a],t},useContext:Cn,useEffect:m0,useImperativeHandle:function(t,a,i){i=i!=null?i.concat([t]):null,xc(4194308,4,x0.bind(null,a,t),i)},useLayoutEffect:function(t,a){return xc(4194308,4,t,a)},useInsertionEffect:function(t,a){xc(4,2,t,a)},useMemo:function(t,a){var i=Un();a=a===void 0?null:a;var u=t();if(qs){Wt(!0);try{t()}finally{Wt(!1)}}return i.memoizedState=[u,a],u},useReducer:function(t,a,i){var u=Un();if(i!==void 0){var x=i(a);if(qs){Wt(!0);try{i(a)}finally{Wt(!1)}}}else x=a;return u.memoizedState=u.baseState=x,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:x},u.queue=t,t=t.dispatch=TS.bind(null,Ve,t),[u.memoizedState,t]},useRef:function(t){var a=Un();return t={current:t},a.memoizedState=t},useState:function(t){t=of(t);var a=t.queue,i=T0.bind(null,Ve,a);return a.dispatch=i,[t.memoizedState,i]},useDebugValue:df,useDeferredValue:function(t,a){var i=Un();return ff(i,t,a)},useTransition:function(){var t=of(!1);return t=w0.bind(null,Ve,t.queue,!0,!1),Un().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,a,i){var u=Ve,x=Un();if(ot){if(i===void 0)throw Error(s(407));i=i()}else{if(i=a(),Ot===null)throw Error(s(349));(rt&127)!==0||Xg(u,a,i)}x.memoizedState=i;var b={value:i,getSnapshot:a};return x.queue=b,m0(Jg.bind(null,u,b,t),[t]),u.flags|=2048,Nl(9,{destroy:void 0},Zg.bind(null,u,b,i,a),null),i},useId:function(){var t=Un(),a=Ot.identifierPrefix;if(ot){var i=lr,u=sr;i=(u&~(1<<32-Ze(u)-1)).toString(32)+i,a="_"+a+"R_"+i,i=mc++,0<i&&(a+="H"+i.toString(32)),a+="_"}else i=vS++,a="_"+a+"r_"+i.toString(32)+"_";return t.memoizedState=a},useHostTransitionStatus:hf,useFormState:o0,useActionState:o0,useOptimistic:function(t){var a=Un();a.memoizedState=a.baseState=t;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=i,a=pf.bind(null,Ve,!0,i),i.dispatch=a,[t,a]},useMemoCache:rf,useCacheRefresh:function(){return Un().memoizedState=CS.bind(null,Ve)},useEffectEvent:function(t){var a=Un(),i={impl:t};return a.memoizedState=i,function(){if((gt&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}},gf={readContext:Cn,use:pc,useCallback:b0,useContext:Cn,useEffect:uf,useImperativeHandle:y0,useInsertionEffect:p0,useLayoutEffect:g0,useMemo:v0,useReducer:gc,useRef:f0,useState:function(){return gc(Nr)},useDebugValue:df,useDeferredValue:function(t,a){var i=nn();return k0(i,Ct.memoizedState,t,a)},useTransition:function(){var t=gc(Nr)[0],a=nn().memoizedState;return[typeof t=="boolean"?t:Ci(t),a]},useSyncExternalStore:Qg,useId:N0,useHostTransitionStatus:hf,useFormState:c0,useActionState:c0,useOptimistic:function(t,a){var i=nn();return n0(i,Ct,t,a)},useMemoCache:rf,useCacheRefresh:C0};gf.useEffectEvent=h0;var R0={readContext:Cn,use:pc,useCallback:b0,useContext:Cn,useEffect:uf,useImperativeHandle:y0,useInsertionEffect:p0,useLayoutEffect:g0,useMemo:v0,useReducer:lf,useRef:f0,useState:function(){return lf(Nr)},useDebugValue:df,useDeferredValue:function(t,a){var i=nn();return Ct===null?ff(i,t,a):k0(i,Ct.memoizedState,t,a)},useTransition:function(){var t=lf(Nr)[0],a=nn().memoizedState;return[typeof t=="boolean"?t:Ci(t),a]},useSyncExternalStore:Qg,useId:N0,useHostTransitionStatus:hf,useFormState:d0,useActionState:d0,useOptimistic:function(t,a){var i=nn();return Ct!==null?n0(i,Ct,t,a):(i.baseState=t,[t,i.queue.dispatch])},useMemoCache:rf,useCacheRefresh:C0};R0.useEffectEvent=h0;function xf(t,a,i,u){a=t.memoizedState,i=i(u,a),i=i==null?a:y({},a,i),t.memoizedState=i,t.lanes===0&&(t.updateQueue.baseState=i)}var yf={enqueueSetState:function(t,a,i){t=t._reactInternals;var u=ca(),x=es(u);x.payload=a,i!=null&&(x.callback=i),a=ts(t,x,u),a!==null&&(Qn(a,t,u),wi(a,t,u))},enqueueReplaceState:function(t,a,i){t=t._reactInternals;var u=ca(),x=es(u);x.tag=1,x.payload=a,i!=null&&(x.callback=i),a=ts(t,x,u),a!==null&&(Qn(a,t,u),wi(a,t,u))},enqueueForceUpdate:function(t,a){t=t._reactInternals;var i=ca(),u=es(i);u.tag=2,a!=null&&(u.callback=a),a=ts(t,u,i),a!==null&&(Qn(a,t,i),wi(a,t,i))}};function _0(t,a,i,u,x,b,j){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,b,j):a.prototype&&a.prototype.isPureReactComponent?!hi(i,u)||!hi(x,b):!0}function I0(t,a,i,u){t=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(i,u),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(i,u),a.state!==t&&yf.enqueueReplaceState(a,a.state,null)}function Vs(t,a){var i=a;if("ref"in a){i={};for(var u in a)u!=="ref"&&(i[u]=a[u])}if(t=t.defaultProps){i===a&&(i=y({},i));for(var x in t)i[x]===void 0&&(i[x]=t[x])}return i}function L0(t){Xo(t)}function O0(t){console.error(t)}function D0(t){Xo(t)}function vc(t,a){try{var i=t.onUncaughtError;i(a.value,{componentStack:a.stack})}catch(u){setTimeout(function(){throw u})}}function z0(t,a,i){try{var u=t.onCaughtError;u(i.value,{componentStack:i.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function bf(t,a,i){return i=es(i),i.tag=3,i.payload={element:null},i.callback=function(){vc(t,a)},i}function U0(t){return t=es(t),t.tag=3,t}function $0(t,a,i,u){var x=i.type.getDerivedStateFromError;if(typeof x=="function"){var b=u.value;t.payload=function(){return x(b)},t.callback=function(){z0(a,i,u)}}var j=i.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(t.callback=function(){z0(a,i,u),typeof x!="function"&&(is===null?is=new Set([this]):is.add(this));var _=u.stack;this.componentDidCatch(u.value,{componentStack:_!==null?_:""})})}function MS(t,a,i,u,x){if(i.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(a=i.alternate,a!==null&&xl(a,i,x,!0),i=sa.current,i!==null){switch(i.tag){case 31:case 13:return Aa===null?_c():i.alternate===null&&Zt===0&&(Zt=3),i.flags&=-257,i.flags|=65536,i.lanes=x,u===ic?i.flags|=16384:(a=i.updateQueue,a===null?i.updateQueue=new Set([u]):a.add(u),qf(t,u,x)),!1;case 22:return i.flags|=65536,u===ic?i.flags|=16384:(a=i.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([u])},i.updateQueue=a):(i=a.retryQueue,i===null?a.retryQueue=new Set([u]):i.add(u)),qf(t,u,x)),!1}throw Error(s(435,i.tag))}return qf(t,u,x),_c(),!1}if(ot)return a=sa.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=x,u!==zd&&(t=Error(s(422),{cause:u}),xi(Ca(t,i)))):(u!==zd&&(a=Error(s(423),{cause:u}),xi(Ca(a,i))),t=t.current.alternate,t.flags|=65536,x&=-x,t.lanes|=x,u=Ca(u,i),x=bf(t.stateNode,u,x),Kd(t,x),Zt!==4&&(Zt=2)),!1;var b=Error(s(520),{cause:u});if(b=Ca(b,i),Di===null?Di=[b]:Di.push(b),Zt!==4&&(Zt=2),a===null)return!0;u=Ca(u,i),i=a;do{switch(i.tag){case 3:return i.flags|=65536,t=x&-x,i.lanes|=t,t=bf(i.stateNode,u,t),Kd(i,t),!1;case 1:if(a=i.type,b=i.stateNode,(i.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(is===null||!is.has(b))))return i.flags|=65536,x&=-x,i.lanes|=x,x=U0(x),$0(x,t,i,u),Kd(i,x),!1}i=i.return}while(i!==null);return!1}var vf=Error(s(461)),ln=!1;function Tn(t,a,i,u){a.child=t===null?Fg(a,null,i,u):Fs(a,t.child,i,u)}function B0(t,a,i,u,x){i=i.render;var b=a.ref;if("ref"in u){var j={};for(var _ in u)_!=="ref"&&(j[_]=u[_])}else j=u;return $s(a),u=ef(t,a,i,j,b,x),_=tf(),t!==null&&!ln?(nf(t,a,x),Cr(t,a,x)):(ot&&_&&Od(a),a.flags|=1,Tn(t,a,u,x),a.child)}function H0(t,a,i,u,x){if(t===null){var b=i.type;return typeof b=="function"&&!_d(b)&&b.defaultProps===void 0&&i.compare===null?(a.tag=15,a.type=b,P0(t,a,b,u,x)):(t=tc(i.type,null,u,a,a.mode,x),t.ref=a.ref,t.return=a,a.child=t)}if(b=t.child,!Mf(t,x)){var j=b.memoizedProps;if(i=i.compare,i=i!==null?i:hi,i(j,u)&&t.ref===a.ref)return Cr(t,a,x)}return a.flags|=1,t=vr(b,u),t.ref=a.ref,t.return=a,a.child=t}function P0(t,a,i,u,x){if(t!==null){var b=t.memoizedProps;if(hi(b,u)&&t.ref===a.ref)if(ln=!1,a.pendingProps=u=b,Mf(t,x))(t.flags&131072)!==0&&(ln=!0);else return a.lanes=t.lanes,Cr(t,a,x)}return kf(t,a,i,u,x)}function F0(t,a,i,u){var x=u.children,b=t!==null?t.memoizedState:null;if(t===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((a.flags&128)!==0){if(b=b!==null?b.baseLanes|i:i,t!==null){for(u=a.child=t.child,x=0;u!==null;)x=x|u.lanes|u.childLanes,u=u.sibling;u=x&~b}else u=0,a.child=null;return q0(t,a,b,i,u)}if((i&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},t!==null&&sc(a,b!==null?b.cachePool:null),b!==null?Gg(a,b):Qd(),Wg(a);else return u=a.lanes=536870912,q0(t,a,b!==null?b.baseLanes|i:i,i,u)}else b!==null?(sc(a,b.cachePool),Gg(a,b),as(),a.memoizedState=null):(t!==null&&sc(a,null),Qd(),as());return Tn(t,a,x,i),a.child}function Ei(t,a){return t!==null&&t.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function q0(t,a,i,u,x){var b=qd();return b=b===null?null:{parent:rn._currentValue,pool:b},a.memoizedState={baseLanes:i,cachePool:b},t!==null&&sc(a,null),Qd(),Wg(a),t!==null&&xl(t,a,u,!0),a.childLanes=x,null}function kc(t,a){return a=Sc({mode:a.mode,children:a.children},t.mode),a.ref=t.ref,t.child=a,a.return=t,a}function V0(t,a,i){return Fs(a,t.child,null,i),t=kc(a,a.pendingProps),t.flags|=2,la(a),a.memoizedState=null,t}function ES(t,a,i){var u=a.pendingProps,x=(a.flags&128)!==0;if(a.flags&=-129,t===null){if(ot){if(u.mode==="hidden")return t=kc(a,u),a.lanes=536870912,Ei(null,t);if(Zd(a),(t=Ht)?(t=ay(t,Ea),t=t!==null&&t.data==="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:Yr!==null?{id:sr,overflow:lr}:null,retryLane:536870912,hydrationErrors:null},i=Mg(t),i.return=a,a.child=i,Nn=a,Ht=null)):t=null,t===null)throw Xr(a);return a.lanes=536870912,null}return kc(a,u)}var b=t.memoizedState;if(b!==null){var j=b.dehydrated;if(Zd(a),x)if(a.flags&256)a.flags&=-257,a=V0(t,a,i);else if(a.memoizedState!==null)a.child=t.child,a.flags|=128,a=null;else throw Error(s(558));else if(ln||xl(t,a,i,!1),x=(i&t.childLanes)!==0,ln||x){if(u=Ot,u!==null&&(j=dt(u,i),j!==0&&j!==b.retryLane))throw b.retryLane=j,Os(t,j),Qn(u,t,j),vf;_c(),a=V0(t,a,i)}else t=b.treeContext,Ht=Ra(j.nextSibling),Nn=a,ot=!0,Qr=null,Ea=!1,t!==null&&Rg(a,t),a=kc(a,u),a.flags|=4096;return a}return t=vr(t.child,{mode:u.mode,children:u.children}),t.ref=a.ref,a.child=t,t.return=a,t}function wc(t,a){var i=a.ref;if(i===null)t!==null&&t.ref!==null&&(a.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(s(284));(t===null||t.ref!==i)&&(a.flags|=4194816)}}function kf(t,a,i,u,x){return $s(a),i=ef(t,a,i,u,void 0,x),u=tf(),t!==null&&!ln?(nf(t,a,x),Cr(t,a,x)):(ot&&u&&Od(a),a.flags|=1,Tn(t,a,i,x),a.child)}function G0(t,a,i,u,x,b){return $s(a),a.updateQueue=null,i=Yg(a,u,i,x),Kg(t),u=tf(),t!==null&&!ln?(nf(t,a,b),Cr(t,a,b)):(ot&&u&&Od(a),a.flags|=1,Tn(t,a,i,b),a.child)}function W0(t,a,i,u,x){if($s(a),a.stateNode===null){var b=ml,j=i.contextType;typeof j=="object"&&j!==null&&(b=Cn(j)),b=new i(u,b),a.memoizedState=b.state!==null&&b.state!==void 0?b.state:null,b.updater=yf,a.stateNode=b,b._reactInternals=a,b=a.stateNode,b.props=u,b.state=a.memoizedState,b.refs={},Gd(a),j=i.contextType,b.context=typeof j=="object"&&j!==null?Cn(j):ml,b.state=a.memoizedState,j=i.getDerivedStateFromProps,typeof j=="function"&&(xf(a,i,j,u),b.state=a.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof b.getSnapshotBeforeUpdate=="function"||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(j=b.state,typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount(),j!==b.state&&yf.enqueueReplaceState(b,b.state,null),ji(a,u,b,x),Si(),b.state=a.memoizedState),typeof b.componentDidMount=="function"&&(a.flags|=4194308),u=!0}else if(t===null){b=a.stateNode;var _=a.memoizedProps,q=Vs(i,_);b.props=q;var ee=b.context,de=i.contextType;j=ml,typeof de=="object"&&de!==null&&(j=Cn(de));var me=i.getDerivedStateFromProps;de=typeof me=="function"||typeof b.getSnapshotBeforeUpdate=="function",_=a.pendingProps!==_,de||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(_||ee!==j)&&I0(a,b,u,j),Jr=!1;var re=a.memoizedState;b.state=re,ji(a,u,b,x),Si(),ee=a.memoizedState,_||re!==ee||Jr?(typeof me=="function"&&(xf(a,i,me,u),ee=a.memoizedState),(q=Jr||_0(a,i,q,u,re,ee,j))?(de||typeof b.UNSAFE_componentWillMount!="function"&&typeof b.componentWillMount!="function"||(typeof b.componentWillMount=="function"&&b.componentWillMount(),typeof b.UNSAFE_componentWillMount=="function"&&b.UNSAFE_componentWillMount()),typeof b.componentDidMount=="function"&&(a.flags|=4194308)):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=u,a.memoizedState=ee),b.props=u,b.state=ee,b.context=j,u=q):(typeof b.componentDidMount=="function"&&(a.flags|=4194308),u=!1)}else{b=a.stateNode,Wd(t,a),j=a.memoizedProps,de=Vs(i,j),b.props=de,me=a.pendingProps,re=b.context,ee=i.contextType,q=ml,typeof ee=="object"&&ee!==null&&(q=Cn(ee)),_=i.getDerivedStateFromProps,(ee=typeof _=="function"||typeof b.getSnapshotBeforeUpdate=="function")||typeof b.UNSAFE_componentWillReceiveProps!="function"&&typeof b.componentWillReceiveProps!="function"||(j!==me||re!==q)&&I0(a,b,u,q),Jr=!1,re=a.memoizedState,b.state=re,ji(a,u,b,x),Si();var ie=a.memoizedState;j!==me||re!==ie||Jr||t!==null&&t.dependencies!==null&&ac(t.dependencies)?(typeof _=="function"&&(xf(a,i,_,u),ie=a.memoizedState),(de=Jr||_0(a,i,de,u,re,ie,q)||t!==null&&t.dependencies!==null&&ac(t.dependencies))?(ee||typeof b.UNSAFE_componentWillUpdate!="function"&&typeof b.componentWillUpdate!="function"||(typeof b.componentWillUpdate=="function"&&b.componentWillUpdate(u,ie,q),typeof b.UNSAFE_componentWillUpdate=="function"&&b.UNSAFE_componentWillUpdate(u,ie,q)),typeof b.componentDidUpdate=="function"&&(a.flags|=4),typeof b.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof b.componentDidUpdate!="function"||j===t.memoizedProps&&re===t.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||j===t.memoizedProps&&re===t.memoizedState||(a.flags|=1024),a.memoizedProps=u,a.memoizedState=ie),b.props=u,b.state=ie,b.context=q,u=de):(typeof b.componentDidUpdate!="function"||j===t.memoizedProps&&re===t.memoizedState||(a.flags|=4),typeof b.getSnapshotBeforeUpdate!="function"||j===t.memoizedProps&&re===t.memoizedState||(a.flags|=1024),u=!1)}return b=u,wc(t,a),u=(a.flags&128)!==0,b||u?(b=a.stateNode,i=u&&typeof i.getDerivedStateFromError!="function"?null:b.render(),a.flags|=1,t!==null&&u?(a.child=Fs(a,t.child,null,x),a.child=Fs(a,null,i,x)):Tn(t,a,i,x),a.memoizedState=b.state,t=a.child):t=Cr(t,a,x),t}function K0(t,a,i,u){return zs(),a.flags|=256,Tn(t,a,i,u),a.child}var wf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Sf(t){return{baseLanes:t,cachePool:zg()}}function jf(t,a,i){return t=t!==null?t.childLanes&~i:0,a&&(t|=oa),t}function Y0(t,a,i){var u=a.pendingProps,x=!1,b=(a.flags&128)!==0,j;if((j=b)||(j=t!==null&&t.memoizedState===null?!1:(tn.current&2)!==0),j&&(x=!0,a.flags&=-129),j=(a.flags&32)!==0,a.flags&=-33,t===null){if(ot){if(x?ns(a):as(),(t=Ht)?(t=ay(t,Ea),t=t!==null&&t.data!=="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:Yr!==null?{id:sr,overflow:lr}:null,retryLane:536870912,hydrationErrors:null},i=Mg(t),i.return=a,a.child=i,Nn=a,Ht=null)):t=null,t===null)throw Xr(a);return lm(t)?a.lanes=32:a.lanes=536870912,null}var _=u.children;return u=u.fallback,x?(as(),x=a.mode,_=Sc({mode:"hidden",children:_},x),u=Ds(u,x,i,null),_.return=a,u.return=a,_.sibling=u,a.child=_,u=a.child,u.memoizedState=Sf(i),u.childLanes=jf(t,j,i),a.memoizedState=wf,Ei(null,u)):(ns(a),Nf(a,_))}var q=t.memoizedState;if(q!==null&&(_=q.dehydrated,_!==null)){if(b)a.flags&256?(ns(a),a.flags&=-257,a=Cf(t,a,i)):a.memoizedState!==null?(as(),a.child=t.child,a.flags|=128,a=null):(as(),_=u.fallback,x=a.mode,u=Sc({mode:"visible",children:u.children},x),_=Ds(_,x,i,null),_.flags|=2,u.return=a,_.return=a,u.sibling=_,a.child=u,Fs(a,t.child,null,i),u=a.child,u.memoizedState=Sf(i),u.childLanes=jf(t,j,i),a.memoizedState=wf,a=Ei(null,u));else if(ns(a),lm(_)){if(j=_.nextSibling&&_.nextSibling.dataset,j)var ee=j.dgst;j=ee,u=Error(s(419)),u.stack="",u.digest=j,xi({value:u,source:null,stack:null}),a=Cf(t,a,i)}else if(ln||xl(t,a,i,!1),j=(i&t.childLanes)!==0,ln||j){if(j=Ot,j!==null&&(u=dt(j,i),u!==0&&u!==q.retryLane))throw q.retryLane=u,Os(t,u),Qn(j,t,u),vf;sm(_)||_c(),a=Cf(t,a,i)}else sm(_)?(a.flags|=192,a.child=t.child,a=null):(t=q.treeContext,Ht=Ra(_.nextSibling),Nn=a,ot=!0,Qr=null,Ea=!1,t!==null&&Rg(a,t),a=Nf(a,u.children),a.flags|=4096);return a}return x?(as(),_=u.fallback,x=a.mode,q=t.child,ee=q.sibling,u=vr(q,{mode:"hidden",children:u.children}),u.subtreeFlags=q.subtreeFlags&65011712,ee!==null?_=vr(ee,_):(_=Ds(_,x,i,null),_.flags|=2),_.return=a,u.return=a,u.sibling=_,a.child=u,Ei(null,u),u=a.child,_=t.child.memoizedState,_===null?_=Sf(i):(x=_.cachePool,x!==null?(q=rn._currentValue,x=x.parent!==q?{parent:q,pool:q}:x):x=zg(),_={baseLanes:_.baseLanes|i,cachePool:x}),u.memoizedState=_,u.childLanes=jf(t,j,i),a.memoizedState=wf,Ei(t.child,u)):(ns(a),i=t.child,t=i.sibling,i=vr(i,{mode:"visible",children:u.children}),i.return=a,i.sibling=null,t!==null&&(j=a.deletions,j===null?(a.deletions=[t],a.flags|=16):j.push(t)),a.child=i,a.memoizedState=null,i)}function Nf(t,a){return a=Sc({mode:"visible",children:a},t.mode),a.return=t,t.child=a}function Sc(t,a){return t=ra(22,t,null,a),t.lanes=0,t}function Cf(t,a,i){return Fs(a,t.child,null,i),t=Nf(a,a.pendingProps.children),t.flags|=2,a.memoizedState=null,t}function Q0(t,a,i){t.lanes|=a;var u=t.alternate;u!==null&&(u.lanes|=a),Bd(t.return,a,i)}function Tf(t,a,i,u,x,b){var j=t.memoizedState;j===null?t.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:u,tail:i,tailMode:x,treeForkCount:b}:(j.isBackwards=a,j.rendering=null,j.renderingStartTime=0,j.last=u,j.tail=i,j.tailMode=x,j.treeForkCount=b)}function X0(t,a,i){var u=a.pendingProps,x=u.revealOrder,b=u.tail;u=u.children;var j=tn.current,_=(j&2)!==0;if(_?(j=j&1|2,a.flags|=128):j&=1,N(tn,j),Tn(t,a,u,i),u=ot?gi:0,!_&&t!==null&&(t.flags&128)!==0)e:for(t=a.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Q0(t,i,a);else if(t.tag===19)Q0(t,i,a);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===a)break e;for(;t.sibling===null;){if(t.return===null||t.return===a)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(x){case"forwards":for(i=a.child,x=null;i!==null;)t=i.alternate,t!==null&&dc(t)===null&&(x=i),i=i.sibling;i=x,i===null?(x=a.child,a.child=null):(x=i.sibling,i.sibling=null),Tf(a,!1,x,i,b,u);break;case"backwards":case"unstable_legacy-backwards":for(i=null,x=a.child,a.child=null;x!==null;){if(t=x.alternate,t!==null&&dc(t)===null){a.child=x;break}t=x.sibling,x.sibling=i,i=x,x=t}Tf(a,!0,i,null,b,u);break;case"together":Tf(a,!1,null,null,void 0,u);break;default:a.memoizedState=null}return a.child}function Cr(t,a,i){if(t!==null&&(a.dependencies=t.dependencies),ls|=a.lanes,(i&a.childLanes)===0)if(t!==null){if(xl(t,a,i,!1),(i&a.childLanes)===0)return null}else return null;if(t!==null&&a.child!==t.child)throw Error(s(153));if(a.child!==null){for(t=a.child,i=vr(t,t.pendingProps),a.child=i,i.return=a;t.sibling!==null;)t=t.sibling,i=i.sibling=vr(t,t.pendingProps),i.return=a;i.sibling=null}return a.child}function Mf(t,a){return(t.lanes&a)!==0?!0:(t=t.dependencies,!!(t!==null&&ac(t)))}function AS(t,a,i){switch(a.tag){case 3:xe(a,a.stateNode.containerInfo),Zr(a,rn,t.memoizedState.cache),zs();break;case 27:case 5:pe(a);break;case 4:xe(a,a.stateNode.containerInfo);break;case 10:Zr(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Zd(a),null;break;case 13:var u=a.memoizedState;if(u!==null)return u.dehydrated!==null?(ns(a),a.flags|=128,null):(i&a.child.childLanes)!==0?Y0(t,a,i):(ns(a),t=Cr(t,a,i),t!==null?t.sibling:null);ns(a);break;case 19:var x=(t.flags&128)!==0;if(u=(i&a.childLanes)!==0,u||(xl(t,a,i,!1),u=(i&a.childLanes)!==0),x){if(u)return X0(t,a,i);a.flags|=128}if(x=a.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),N(tn,tn.current),u)break;return null;case 22:return a.lanes=0,F0(t,a,i,a.pendingProps);case 24:Zr(a,rn,t.memoizedState.cache)}return Cr(t,a,i)}function Z0(t,a,i){if(t!==null)if(t.memoizedProps!==a.pendingProps)ln=!0;else{if(!Mf(t,i)&&(a.flags&128)===0)return ln=!1,AS(t,a,i);ln=(t.flags&131072)!==0}else ln=!1,ot&&(a.flags&1048576)!==0&&Ag(a,gi,a.index);switch(a.lanes=0,a.tag){case 16:e:{var u=a.pendingProps;if(t=Hs(a.elementType),a.type=t,typeof t=="function")_d(t)?(u=Vs(t,u),a.tag=1,a=W0(null,a,t,u,i)):(a.tag=0,a=kf(null,a,t,u,i));else{if(t!=null){var x=t.$$typeof;if(x===H){a.tag=11,a=B0(null,a,t,u,i);break e}else if(x===$){a.tag=14,a=H0(null,a,t,u,i);break e}}throw a=Z(t)||t,Error(s(306,a,""))}}return a;case 0:return kf(t,a,a.type,a.pendingProps,i);case 1:return u=a.type,x=Vs(u,a.pendingProps),W0(t,a,u,x,i);case 3:e:{if(xe(a,a.stateNode.containerInfo),t===null)throw Error(s(387));u=a.pendingProps;var b=a.memoizedState;x=b.element,Wd(t,a),ji(a,u,null,i);var j=a.memoizedState;if(u=j.cache,Zr(a,rn,u),u!==b.cache&&Hd(a,[rn],i,!0),Si(),u=j.element,b.isDehydrated)if(b={element:u,isDehydrated:!1,cache:j.cache},a.updateQueue.baseState=b,a.memoizedState=b,a.flags&256){a=K0(t,a,u,i);break e}else if(u!==x){x=Ca(Error(s(424)),a),xi(x),a=K0(t,a,u,i);break e}else for(t=a.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,Ht=Ra(t.firstChild),Nn=a,ot=!0,Qr=null,Ea=!0,i=Fg(a,null,u,i),a.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling;else{if(zs(),u===x){a=Cr(t,a,i);break e}Tn(t,a,u,i)}a=a.child}return a;case 26:return wc(t,a),t===null?(i=cy(a.type,null,a.pendingProps,null))?a.memoizedState=i:ot||(i=a.type,t=a.pendingProps,u=$c(le.current).createElement(i),u[bt]=a,u[Kt]=t,Mn(u,i,t),It(u),a.stateNode=u):a.memoizedState=cy(a.type,t.memoizedProps,a.pendingProps,t.memoizedState),null;case 27:return pe(a),t===null&&ot&&(u=a.stateNode=ly(a.type,a.pendingProps,le.current),Nn=a,Ea=!0,x=Ht,ds(a.type)?(im=x,Ht=Ra(u.firstChild)):Ht=x),Tn(t,a,a.pendingProps.children,i),wc(t,a),t===null&&(a.flags|=4194304),a.child;case 5:return t===null&&ot&&((x=u=Ht)&&(u=lj(u,a.type,a.pendingProps,Ea),u!==null?(a.stateNode=u,Nn=a,Ht=Ra(u.firstChild),Ea=!1,x=!0):x=!1),x||Xr(a)),pe(a),x=a.type,b=a.pendingProps,j=t!==null?t.memoizedProps:null,u=b.children,nm(x,b)?u=null:j!==null&&nm(x,j)&&(a.flags|=32),a.memoizedState!==null&&(x=ef(t,a,kS,null,null,i),qi._currentValue=x),wc(t,a),Tn(t,a,u,i),a.child;case 6:return t===null&&ot&&((t=i=Ht)&&(i=ij(i,a.pendingProps,Ea),i!==null?(a.stateNode=i,Nn=a,Ht=null,t=!0):t=!1),t||Xr(a)),null;case 13:return Y0(t,a,i);case 4:return xe(a,a.stateNode.containerInfo),u=a.pendingProps,t===null?a.child=Fs(a,null,u,i):Tn(t,a,u,i),a.child;case 11:return B0(t,a,a.type,a.pendingProps,i);case 7:return Tn(t,a,a.pendingProps,i),a.child;case 8:return Tn(t,a,a.pendingProps.children,i),a.child;case 12:return Tn(t,a,a.pendingProps.children,i),a.child;case 10:return u=a.pendingProps,Zr(a,a.type,u.value),Tn(t,a,u.children,i),a.child;case 9:return x=a.type._context,u=a.pendingProps.children,$s(a),x=Cn(x),u=u(x),a.flags|=1,Tn(t,a,u,i),a.child;case 14:return H0(t,a,a.type,a.pendingProps,i);case 15:return P0(t,a,a.type,a.pendingProps,i);case 19:return X0(t,a,i);case 31:return ES(t,a,i);case 22:return F0(t,a,i,a.pendingProps);case 24:return $s(a),u=Cn(rn),t===null?(x=qd(),x===null&&(x=Ot,b=Pd(),x.pooledCache=b,b.refCount++,b!==null&&(x.pooledCacheLanes|=i),x=b),a.memoizedState={parent:u,cache:x},Gd(a),Zr(a,rn,x)):((t.lanes&i)!==0&&(Wd(t,a),ji(a,null,null,i),Si()),x=t.memoizedState,b=a.memoizedState,x.parent!==u?(x={parent:u,cache:u},a.memoizedState=x,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=x),Zr(a,rn,u)):(u=b.cache,Zr(a,rn,u),u!==x.cache&&Hd(a,[rn],i,!0))),Tn(t,a,a.pendingProps.children,i),a.child;case 29:throw a.pendingProps}throw Error(s(156,a.tag))}function Tr(t){t.flags|=4}function Ef(t,a,i,u,x){if((a=(t.mode&32)!==0)&&(a=!1),a){if(t.flags|=16777216,(x&335544128)===x)if(t.stateNode.complete)t.flags|=8192;else if(Nx())t.flags|=8192;else throw Ps=ic,Vd}else t.flags&=-16777217}function J0(t,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!hy(a))if(Nx())t.flags|=8192;else throw Ps=ic,Vd}function jc(t,a){a!==null&&(t.flags|=4),t.flags&16384&&(a=t.tag!==22?Ha():536870912,t.lanes|=a,El|=a)}function Ai(t,a){if(!ot)switch(t.tailMode){case"hidden":a=t.tail;for(var i=null;a!==null;)a.alternate!==null&&(i=a),a=a.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?a||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function Pt(t){var a=t.alternate!==null&&t.alternate.child===t.child,i=0,u=0;if(a)for(var x=t.child;x!==null;)i|=x.lanes|x.childLanes,u|=x.subtreeFlags&65011712,u|=x.flags&65011712,x.return=t,x=x.sibling;else for(x=t.child;x!==null;)i|=x.lanes|x.childLanes,u|=x.subtreeFlags,u|=x.flags,x.return=t,x=x.sibling;return t.subtreeFlags|=u,t.childLanes=i,a}function RS(t,a,i){var u=a.pendingProps;switch(Dd(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Pt(a),null;case 1:return Pt(a),null;case 3:return i=a.stateNode,u=null,t!==null&&(u=t.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),Sr(rn),ne(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(t===null||t.child===null)&&(gl(a)?Tr(a):t===null||t.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Ud())),Pt(a),null;case 26:var x=a.type,b=a.memoizedState;return t===null?(Tr(a),b!==null?(Pt(a),J0(a,b)):(Pt(a),Ef(a,x,null,u,i))):b?b!==t.memoizedState?(Tr(a),Pt(a),J0(a,b)):(Pt(a),a.flags&=-16777217):(t=t.memoizedProps,t!==u&&Tr(a),Pt(a),Ef(a,x,t,u,i)),null;case 27:if(be(a),i=le.current,x=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&Tr(a);else{if(!u){if(a.stateNode===null)throw Error(s(166));return Pt(a),null}t=Q.current,gl(a)?_g(a):(t=ly(x,u,i),a.stateNode=t,Tr(a))}return Pt(a),null;case 5:if(be(a),x=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&Tr(a);else{if(!u){if(a.stateNode===null)throw Error(s(166));return Pt(a),null}if(b=Q.current,gl(a))_g(a);else{var j=$c(le.current);switch(b){case 1:b=j.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:b=j.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":b=j.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":b=j.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":b=j.createElement("div"),b.innerHTML="<script><\/script>",b=b.removeChild(b.firstChild);break;case"select":b=typeof u.is=="string"?j.createElement("select",{is:u.is}):j.createElement("select"),u.multiple?b.multiple=!0:u.size&&(b.size=u.size);break;default:b=typeof u.is=="string"?j.createElement(x,{is:u.is}):j.createElement(x)}}b[bt]=a,b[Kt]=u;e:for(j=a.child;j!==null;){if(j.tag===5||j.tag===6)b.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===a)break e;for(;j.sibling===null;){if(j.return===null||j.return===a)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}a.stateNode=b;e:switch(Mn(b,x,u),x){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&Tr(a)}}return Pt(a),Ef(a,a.type,t===null?null:t.memoizedProps,a.pendingProps,i),null;case 6:if(t&&a.stateNode!=null)t.memoizedProps!==u&&Tr(a);else{if(typeof u!="string"&&a.stateNode===null)throw Error(s(166));if(t=le.current,gl(a)){if(t=a.stateNode,i=a.memoizedProps,u=null,x=Nn,x!==null)switch(x.tag){case 27:case 5:u=x.memoizedProps}t[bt]=a,t=!!(t.nodeValue===i||u!==null&&u.suppressHydrationWarning===!0||Yx(t.nodeValue,i)),t||Xr(a,!0)}else t=$c(t).createTextNode(u),t[bt]=a,a.stateNode=t}return Pt(a),null;case 31:if(i=a.memoizedState,t===null||t.memoizedState!==null){if(u=gl(a),i!==null){if(t===null){if(!u)throw Error(s(318));if(t=a.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[bt]=a}else zs(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Pt(a),t=!1}else i=Ud(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=i),t=!0;if(!t)return a.flags&256?(la(a),a):(la(a),null);if((a.flags&128)!==0)throw Error(s(558))}return Pt(a),null;case 13:if(u=a.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(x=gl(a),u!==null&&u.dehydrated!==null){if(t===null){if(!x)throw Error(s(318));if(x=a.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(s(317));x[bt]=a}else zs(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Pt(a),x=!1}else x=Ud(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=x),x=!0;if(!x)return a.flags&256?(la(a),a):(la(a),null)}return la(a),(a.flags&128)!==0?(a.lanes=i,a):(i=u!==null,t=t!==null&&t.memoizedState!==null,i&&(u=a.child,x=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(x=u.alternate.memoizedState.cachePool.pool),b=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(b=u.memoizedState.cachePool.pool),b!==x&&(u.flags|=2048)),i!==t&&i&&(a.child.flags|=8192),jc(a,a.updateQueue),Pt(a),null);case 4:return ne(),t===null&&Xf(a.stateNode.containerInfo),Pt(a),null;case 10:return Sr(a.type),Pt(a),null;case 19:if(z(tn),u=a.memoizedState,u===null)return Pt(a),null;if(x=(a.flags&128)!==0,b=u.rendering,b===null)if(x)Ai(u,!1);else{if(Zt!==0||t!==null&&(t.flags&128)!==0)for(t=a.child;t!==null;){if(b=dc(t),b!==null){for(a.flags|=128,Ai(u,!1),t=b.updateQueue,a.updateQueue=t,jc(a,t),a.subtreeFlags=0,t=i,i=a.child;i!==null;)Tg(i,t),i=i.sibling;return N(tn,tn.current&1|2),ot&&kr(a,u.treeForkCount),a.child}t=t.sibling}u.tail!==null&&Xe()>Ec&&(a.flags|=128,x=!0,Ai(u,!1),a.lanes=4194304)}else{if(!x)if(t=dc(b),t!==null){if(a.flags|=128,x=!0,t=t.updateQueue,a.updateQueue=t,jc(a,t),Ai(u,!0),u.tail===null&&u.tailMode==="hidden"&&!b.alternate&&!ot)return Pt(a),null}else 2*Xe()-u.renderingStartTime>Ec&&i!==536870912&&(a.flags|=128,x=!0,Ai(u,!1),a.lanes=4194304);u.isBackwards?(b.sibling=a.child,a.child=b):(t=u.last,t!==null?t.sibling=b:a.child=b,u.last=b)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=Xe(),t.sibling=null,i=tn.current,N(tn,x?i&1|2:i&1),ot&&kr(a,u.treeForkCount),t):(Pt(a),null);case 22:case 23:return la(a),Xd(),u=a.memoizedState!==null,t!==null?t.memoizedState!==null!==u&&(a.flags|=8192):u&&(a.flags|=8192),u?(i&536870912)!==0&&(a.flags&128)===0&&(Pt(a),a.subtreeFlags&6&&(a.flags|=8192)):Pt(a),i=a.updateQueue,i!==null&&jc(a,i.retryQueue),i=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==i&&(a.flags|=2048),t!==null&&z(Bs),null;case 24:return i=null,t!==null&&(i=t.memoizedState.cache),a.memoizedState.cache!==i&&(a.flags|=2048),Sr(rn),Pt(a),null;case 25:return null;case 30:return null}throw Error(s(156,a.tag))}function _S(t,a){switch(Dd(a),a.tag){case 1:return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 3:return Sr(rn),ne(),t=a.flags,(t&65536)!==0&&(t&128)===0?(a.flags=t&-65537|128,a):null;case 26:case 27:case 5:return be(a),null;case 31:if(a.memoizedState!==null){if(la(a),a.alternate===null)throw Error(s(340));zs()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 13:if(la(a),t=a.memoizedState,t!==null&&t.dehydrated!==null){if(a.alternate===null)throw Error(s(340));zs()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 19:return z(tn),null;case 4:return ne(),null;case 10:return Sr(a.type),null;case 22:case 23:return la(a),Xd(),t!==null&&z(Bs),t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 24:return Sr(rn),null;case 25:return null;default:return null}}function ex(t,a){switch(Dd(a),a.tag){case 3:Sr(rn),ne();break;case 26:case 27:case 5:be(a);break;case 4:ne();break;case 31:a.memoizedState!==null&&la(a);break;case 13:la(a);break;case 19:z(tn);break;case 10:Sr(a.type);break;case 22:case 23:la(a),Xd(),t!==null&&z(Bs);break;case 24:Sr(rn)}}function Ri(t,a){try{var i=a.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var x=u.next;i=x;do{if((i.tag&t)===t){u=void 0;var b=i.create,j=i.inst;u=b(),j.destroy=u}i=i.next}while(i!==x)}}catch(_){wt(a,a.return,_)}}function rs(t,a,i){try{var u=a.updateQueue,x=u!==null?u.lastEffect:null;if(x!==null){var b=x.next;u=b;do{if((u.tag&t)===t){var j=u.inst,_=j.destroy;if(_!==void 0){j.destroy=void 0,x=a;var q=i,ee=_;try{ee()}catch(de){wt(x,q,de)}}}u=u.next}while(u!==b)}}catch(de){wt(a,a.return,de)}}function tx(t){var a=t.updateQueue;if(a!==null){var i=t.stateNode;try{Vg(a,i)}catch(u){wt(t,t.return,u)}}}function nx(t,a,i){i.props=Vs(t.type,t.memoizedProps),i.state=t.memoizedState;try{i.componentWillUnmount()}catch(u){wt(t,a,u)}}function _i(t,a){try{var i=t.ref;if(i!==null){switch(t.tag){case 26:case 27:case 5:var u=t.stateNode;break;case 30:u=t.stateNode;break;default:u=t.stateNode}typeof i=="function"?t.refCleanup=i(u):i.current=u}}catch(x){wt(t,a,x)}}function ir(t,a){var i=t.ref,u=t.refCleanup;if(i!==null)if(typeof u=="function")try{u()}catch(x){wt(t,a,x)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(x){wt(t,a,x)}else i.current=null}function ax(t){var a=t.type,i=t.memoizedProps,u=t.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":i.autoFocus&&u.focus();break e;case"img":i.src?u.src=i.src:i.srcSet&&(u.srcset=i.srcSet)}}catch(x){wt(t,t.return,x)}}function Af(t,a,i){try{var u=t.stateNode;ej(u,t.type,i,a),u[Kt]=a}catch(x){wt(t,t.return,x)}}function rx(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&ds(t.type)||t.tag===4}function Rf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||rx(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&ds(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function _f(t,a,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,a?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(t,a):(a=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.appendChild(t),i=i._reactRootContainer,i!=null||a.onclick!==null||(a.onclick=at));else if(u!==4&&(u===27&&ds(t.type)&&(i=t.stateNode,a=null),t=t.child,t!==null))for(_f(t,a,i),t=t.sibling;t!==null;)_f(t,a,i),t=t.sibling}function Nc(t,a,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,a?i.insertBefore(t,a):i.appendChild(t);else if(u!==4&&(u===27&&ds(t.type)&&(i=t.stateNode),t=t.child,t!==null))for(Nc(t,a,i),t=t.sibling;t!==null;)Nc(t,a,i),t=t.sibling}function sx(t){var a=t.stateNode,i=t.memoizedProps;try{for(var u=t.type,x=a.attributes;x.length;)a.removeAttributeNode(x[0]);Mn(a,u,i),a[bt]=t,a[Kt]=i}catch(b){wt(t,t.return,b)}}var Mr=!1,on=!1,If=!1,lx=typeof WeakSet=="function"?WeakSet:Set,bn=null;function IS(t,a){if(t=t.containerInfo,em=Gc,t=yg(t),Nd(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var u=i.getSelection&&i.getSelection();if(u&&u.rangeCount!==0){i=u.anchorNode;var x=u.anchorOffset,b=u.focusNode;u=u.focusOffset;try{i.nodeType,b.nodeType}catch{i=null;break e}var j=0,_=-1,q=-1,ee=0,de=0,me=t,re=null;t:for(;;){for(var ie;me!==i||x!==0&&me.nodeType!==3||(_=j+x),me!==b||u!==0&&me.nodeType!==3||(q=j+u),me.nodeType===3&&(j+=me.nodeValue.length),(ie=me.firstChild)!==null;)re=me,me=ie;for(;;){if(me===t)break t;if(re===i&&++ee===x&&(_=j),re===b&&++de===u&&(q=j),(ie=me.nextSibling)!==null)break;me=re,re=me.parentNode}me=ie}i=_===-1||q===-1?null:{start:_,end:q}}else i=null}i=i||{start:0,end:0}}else i=null;for(tm={focusedElem:t,selectionRange:i},Gc=!1,bn=a;bn!==null;)if(a=bn,t=a.child,(a.subtreeFlags&1028)!==0&&t!==null)t.return=a,bn=t;else for(;bn!==null;){switch(a=bn,b=a.alternate,t=a.flags,a.tag){case 0:if((t&4)!==0&&(t=a.updateQueue,t=t!==null?t.events:null,t!==null))for(i=0;i<t.length;i++)x=t[i],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&b!==null){t=void 0,i=a,x=b.memoizedProps,b=b.memoizedState,u=i.stateNode;try{var Ce=Vs(i.type,x);t=u.getSnapshotBeforeUpdate(Ce,b),u.__reactInternalSnapshotBeforeUpdate=t}catch(Oe){wt(i,i.return,Oe)}}break;case 3:if((t&1024)!==0){if(t=a.stateNode.containerInfo,i=t.nodeType,i===9)rm(t);else if(i===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":rm(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(s(163))}if(t=a.sibling,t!==null){t.return=a.return,bn=t;break}bn=a.return}}function ix(t,a,i){var u=i.flags;switch(i.tag){case 0:case 11:case 15:Ar(t,i),u&4&&Ri(5,i);break;case 1:if(Ar(t,i),u&4)if(t=i.stateNode,a===null)try{t.componentDidMount()}catch(j){wt(i,i.return,j)}else{var x=Vs(i.type,a.memoizedProps);a=a.memoizedState;try{t.componentDidUpdate(x,a,t.__reactInternalSnapshotBeforeUpdate)}catch(j){wt(i,i.return,j)}}u&64&&tx(i),u&512&&_i(i,i.return);break;case 3:if(Ar(t,i),u&64&&(t=i.updateQueue,t!==null)){if(a=null,i.child!==null)switch(i.child.tag){case 27:case 5:a=i.child.stateNode;break;case 1:a=i.child.stateNode}try{Vg(t,a)}catch(j){wt(i,i.return,j)}}break;case 27:a===null&&u&4&&sx(i);case 26:case 5:Ar(t,i),a===null&&u&4&&ax(i),u&512&&_i(i,i.return);break;case 12:Ar(t,i);break;case 31:Ar(t,i),u&4&&ux(t,i);break;case 13:Ar(t,i),u&4&&dx(t,i),u&64&&(t=i.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(i=PS.bind(null,i),oj(t,i))));break;case 22:if(u=i.memoizedState!==null||Mr,!u){a=a!==null&&a.memoizedState!==null||on,x=Mr;var b=on;Mr=u,(on=a)&&!b?Rr(t,i,(i.subtreeFlags&8772)!==0):Ar(t,i),Mr=x,on=b}break;case 30:break;default:Ar(t,i)}}function ox(t){var a=t.alternate;a!==null&&(t.alternate=null,ox(a)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(a=t.stateNode,a!==null&&yr(a)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Vt=null,Gn=!1;function Er(t,a,i){for(i=i.child;i!==null;)cx(t,a,i),i=i.sibling}function cx(t,a,i){if(Ke&&typeof Ke.onCommitFiberUnmount=="function")try{Ke.onCommitFiberUnmount($t,i)}catch{}switch(i.tag){case 26:on||ir(i,a),Er(t,a,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:on||ir(i,a);var u=Vt,x=Gn;ds(i.type)&&(Vt=i.stateNode,Gn=!1),Er(t,a,i),Hi(i.stateNode),Vt=u,Gn=x;break;case 5:on||ir(i,a);case 6:if(u=Vt,x=Gn,Vt=null,Er(t,a,i),Vt=u,Gn=x,Vt!==null)if(Gn)try{(Vt.nodeType===9?Vt.body:Vt.nodeName==="HTML"?Vt.ownerDocument.body:Vt).removeChild(i.stateNode)}catch(b){wt(i,a,b)}else try{Vt.removeChild(i.stateNode)}catch(b){wt(i,a,b)}break;case 18:Vt!==null&&(Gn?(t=Vt,ty(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,i.stateNode),zl(t)):ty(Vt,i.stateNode));break;case 4:u=Vt,x=Gn,Vt=i.stateNode.containerInfo,Gn=!0,Er(t,a,i),Vt=u,Gn=x;break;case 0:case 11:case 14:case 15:rs(2,i,a),on||rs(4,i,a),Er(t,a,i);break;case 1:on||(ir(i,a),u=i.stateNode,typeof u.componentWillUnmount=="function"&&nx(i,a,u)),Er(t,a,i);break;case 21:Er(t,a,i);break;case 22:on=(u=on)||i.memoizedState!==null,Er(t,a,i),on=u;break;default:Er(t,a,i)}}function ux(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{zl(t)}catch(i){wt(a,a.return,i)}}}function dx(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{zl(t)}catch(i){wt(a,a.return,i)}}function LS(t){switch(t.tag){case 31:case 13:case 19:var a=t.stateNode;return a===null&&(a=t.stateNode=new lx),a;case 22:return t=t.stateNode,a=t._retryCache,a===null&&(a=t._retryCache=new lx),a;default:throw Error(s(435,t.tag))}}function Cc(t,a){var i=LS(t);a.forEach(function(u){if(!i.has(u)){i.add(u);var x=FS.bind(null,t,u);u.then(x,x)}})}function Wn(t,a){var i=a.deletions;if(i!==null)for(var u=0;u<i.length;u++){var x=i[u],b=t,j=a,_=j;e:for(;_!==null;){switch(_.tag){case 27:if(ds(_.type)){Vt=_.stateNode,Gn=!1;break e}break;case 5:Vt=_.stateNode,Gn=!1;break e;case 3:case 4:Vt=_.stateNode.containerInfo,Gn=!0;break e}_=_.return}if(Vt===null)throw Error(s(160));cx(b,j,x),Vt=null,Gn=!1,b=x.alternate,b!==null&&(b.return=null),x.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)fx(a,t),a=a.sibling}var qa=null;function fx(t,a){var i=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Wn(a,t),Kn(t),u&4&&(rs(3,t,t.return),Ri(3,t),rs(5,t,t.return));break;case 1:Wn(a,t),Kn(t),u&512&&(on||i===null||ir(i,i.return)),u&64&&Mr&&(t=t.updateQueue,t!==null&&(u=t.callbacks,u!==null&&(i=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=i===null?u:i.concat(u))));break;case 26:var x=qa;if(Wn(a,t),Kn(t),u&512&&(on||i===null||ir(i,i.return)),u&4){var b=i!==null?i.memoizedState:null;if(u=t.memoizedState,i===null)if(u===null)if(t.stateNode===null){e:{u=t.type,i=t.memoizedProps,x=x.ownerDocument||x;t:switch(u){case"title":b=x.getElementsByTagName("title")[0],(!b||b[qn]||b[bt]||b.namespaceURI==="http://www.w3.org/2000/svg"||b.hasAttribute("itemprop"))&&(b=x.createElement(u),x.head.insertBefore(b,x.querySelector("head > title"))),Mn(b,u,i),b[bt]=t,It(b),u=b;break e;case"link":var j=fy("link","href",x).get(u+(i.href||""));if(j){for(var _=0;_<j.length;_++)if(b=j[_],b.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&b.getAttribute("rel")===(i.rel==null?null:i.rel)&&b.getAttribute("title")===(i.title==null?null:i.title)&&b.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){j.splice(_,1);break t}}b=x.createElement(u),Mn(b,u,i),x.head.appendChild(b);break;case"meta":if(j=fy("meta","content",x).get(u+(i.content||""))){for(_=0;_<j.length;_++)if(b=j[_],b.getAttribute("content")===(i.content==null?null:""+i.content)&&b.getAttribute("name")===(i.name==null?null:i.name)&&b.getAttribute("property")===(i.property==null?null:i.property)&&b.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&b.getAttribute("charset")===(i.charSet==null?null:i.charSet)){j.splice(_,1);break t}}b=x.createElement(u),Mn(b,u,i),x.head.appendChild(b);break;default:throw Error(s(468,u))}b[bt]=t,It(b),u=b}t.stateNode=u}else my(x,t.type,t.stateNode);else t.stateNode=dy(x,u,t.memoizedProps);else b!==u?(b===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):b.count--,u===null?my(x,t.type,t.stateNode):dy(x,u,t.memoizedProps)):u===null&&t.stateNode!==null&&Af(t,t.memoizedProps,i.memoizedProps)}break;case 27:Wn(a,t),Kn(t),u&512&&(on||i===null||ir(i,i.return)),i!==null&&u&4&&Af(t,t.memoizedProps,i.memoizedProps);break;case 5:if(Wn(a,t),Kn(t),u&512&&(on||i===null||ir(i,i.return)),t.flags&32){x=t.stateNode;try{Gr(x,"")}catch(Ce){wt(t,t.return,Ce)}}u&4&&t.stateNode!=null&&(x=t.memoizedProps,Af(t,x,i!==null?i.memoizedProps:x)),u&1024&&(If=!0);break;case 6:if(Wn(a,t),Kn(t),u&4){if(t.stateNode===null)throw Error(s(162));u=t.memoizedProps,i=t.stateNode;try{i.nodeValue=u}catch(Ce){wt(t,t.return,Ce)}}break;case 3:if(Pc=null,x=qa,qa=Bc(a.containerInfo),Wn(a,t),qa=x,Kn(t),u&4&&i!==null&&i.memoizedState.isDehydrated)try{zl(a.containerInfo)}catch(Ce){wt(t,t.return,Ce)}If&&(If=!1,mx(t));break;case 4:u=qa,qa=Bc(t.stateNode.containerInfo),Wn(a,t),Kn(t),qa=u;break;case 12:Wn(a,t),Kn(t);break;case 31:Wn(a,t),Kn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Cc(t,u)));break;case 13:Wn(a,t),Kn(t),t.child.flags&8192&&t.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Mc=Xe()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Cc(t,u)));break;case 22:x=t.memoizedState!==null;var q=i!==null&&i.memoizedState!==null,ee=Mr,de=on;if(Mr=ee||x,on=de||q,Wn(a,t),on=de,Mr=ee,Kn(t),u&8192)e:for(a=t.stateNode,a._visibility=x?a._visibility&-2:a._visibility|1,x&&(i===null||q||Mr||on||Gs(t)),i=null,a=t;;){if(a.tag===5||a.tag===26){if(i===null){q=i=a;try{if(b=q.stateNode,x)j=b.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{_=q.stateNode;var me=q.memoizedProps.style,re=me!=null&&me.hasOwnProperty("display")?me.display:null;_.style.display=re==null||typeof re=="boolean"?"":(""+re).trim()}}catch(Ce){wt(q,q.return,Ce)}}}else if(a.tag===6){if(i===null){q=a;try{q.stateNode.nodeValue=x?"":q.memoizedProps}catch(Ce){wt(q,q.return,Ce)}}}else if(a.tag===18){if(i===null){q=a;try{var ie=q.stateNode;x?ny(ie,!0):ny(q.stateNode,!1)}catch(Ce){wt(q,q.return,Ce)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===t)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;i===a&&(i=null),a=a.return}i===a&&(i=null),a.sibling.return=a.return,a=a.sibling}u&4&&(u=t.updateQueue,u!==null&&(i=u.retryQueue,i!==null&&(u.retryQueue=null,Cc(t,i))));break;case 19:Wn(a,t),Kn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Cc(t,u)));break;case 30:break;case 21:break;default:Wn(a,t),Kn(t)}}function Kn(t){var a=t.flags;if(a&2){try{for(var i,u=t.return;u!==null;){if(rx(u)){i=u;break}u=u.return}if(i==null)throw Error(s(160));switch(i.tag){case 27:var x=i.stateNode,b=Rf(t);Nc(t,b,x);break;case 5:var j=i.stateNode;i.flags&32&&(Gr(j,""),i.flags&=-33);var _=Rf(t);Nc(t,_,j);break;case 3:case 4:var q=i.stateNode.containerInfo,ee=Rf(t);_f(t,ee,q);break;default:throw Error(s(161))}}catch(de){wt(t,t.return,de)}t.flags&=-3}a&4096&&(t.flags&=-4097)}function mx(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var a=t;mx(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),t=t.sibling}}function Ar(t,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)ix(t,a.alternate,a),a=a.sibling}function Gs(t){for(t=t.child;t!==null;){var a=t;switch(a.tag){case 0:case 11:case 14:case 15:rs(4,a,a.return),Gs(a);break;case 1:ir(a,a.return);var i=a.stateNode;typeof i.componentWillUnmount=="function"&&nx(a,a.return,i),Gs(a);break;case 27:Hi(a.stateNode);case 26:case 5:ir(a,a.return),Gs(a);break;case 22:a.memoizedState===null&&Gs(a);break;case 30:Gs(a);break;default:Gs(a)}t=t.sibling}}function Rr(t,a,i){for(i=i&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var u=a.alternate,x=t,b=a,j=b.flags;switch(b.tag){case 0:case 11:case 15:Rr(x,b,i),Ri(4,b);break;case 1:if(Rr(x,b,i),u=b,x=u.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(ee){wt(u,u.return,ee)}if(u=b,x=u.updateQueue,x!==null){var _=u.stateNode;try{var q=x.shared.hiddenCallbacks;if(q!==null)for(x.shared.hiddenCallbacks=null,x=0;x<q.length;x++)qg(q[x],_)}catch(ee){wt(u,u.return,ee)}}i&&j&64&&tx(b),_i(b,b.return);break;case 27:sx(b);case 26:case 5:Rr(x,b,i),i&&u===null&&j&4&&ax(b),_i(b,b.return);break;case 12:Rr(x,b,i);break;case 31:Rr(x,b,i),i&&j&4&&ux(x,b);break;case 13:Rr(x,b,i),i&&j&4&&dx(x,b);break;case 22:b.memoizedState===null&&Rr(x,b,i),_i(b,b.return);break;case 30:break;default:Rr(x,b,i)}a=a.sibling}}function Lf(t,a){var i=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),t=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(t=a.memoizedState.cachePool.pool),t!==i&&(t!=null&&t.refCount++,i!=null&&yi(i))}function Of(t,a){t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&yi(t))}function Va(t,a,i,u){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)hx(t,a,i,u),a=a.sibling}function hx(t,a,i,u){var x=a.flags;switch(a.tag){case 0:case 11:case 15:Va(t,a,i,u),x&2048&&Ri(9,a);break;case 1:Va(t,a,i,u);break;case 3:Va(t,a,i,u),x&2048&&(t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&yi(t)));break;case 12:if(x&2048){Va(t,a,i,u),t=a.stateNode;try{var b=a.memoizedProps,j=b.id,_=b.onPostCommit;typeof _=="function"&&_(j,a.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(q){wt(a,a.return,q)}}else Va(t,a,i,u);break;case 31:Va(t,a,i,u);break;case 13:Va(t,a,i,u);break;case 23:break;case 22:b=a.stateNode,j=a.alternate,a.memoizedState!==null?b._visibility&2?Va(t,a,i,u):Ii(t,a):b._visibility&2?Va(t,a,i,u):(b._visibility|=2,Cl(t,a,i,u,(a.subtreeFlags&10256)!==0||!1)),x&2048&&Lf(j,a);break;case 24:Va(t,a,i,u),x&2048&&Of(a.alternate,a);break;default:Va(t,a,i,u)}}function Cl(t,a,i,u,x){for(x=x&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var b=t,j=a,_=i,q=u,ee=j.flags;switch(j.tag){case 0:case 11:case 15:Cl(b,j,_,q,x),Ri(8,j);break;case 23:break;case 22:var de=j.stateNode;j.memoizedState!==null?de._visibility&2?Cl(b,j,_,q,x):Ii(b,j):(de._visibility|=2,Cl(b,j,_,q,x)),x&&ee&2048&&Lf(j.alternate,j);break;case 24:Cl(b,j,_,q,x),x&&ee&2048&&Of(j.alternate,j);break;default:Cl(b,j,_,q,x)}a=a.sibling}}function Ii(t,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var i=t,u=a,x=u.flags;switch(u.tag){case 22:Ii(i,u),x&2048&&Lf(u.alternate,u);break;case 24:Ii(i,u),x&2048&&Of(u.alternate,u);break;default:Ii(i,u)}a=a.sibling}}var Li=8192;function Tl(t,a,i){if(t.subtreeFlags&Li)for(t=t.child;t!==null;)px(t,a,i),t=t.sibling}function px(t,a,i){switch(t.tag){case 26:Tl(t,a,i),t.flags&Li&&t.memoizedState!==null&&vj(i,qa,t.memoizedState,t.memoizedProps);break;case 5:Tl(t,a,i);break;case 3:case 4:var u=qa;qa=Bc(t.stateNode.containerInfo),Tl(t,a,i),qa=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=Li,Li=16777216,Tl(t,a,i),Li=u):Tl(t,a,i));break;default:Tl(t,a,i)}}function gx(t){var a=t.alternate;if(a!==null&&(t=a.child,t!==null)){a.child=null;do a=t.sibling,t.sibling=null,t=a;while(t!==null)}}function Oi(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var u=a[i];bn=u,yx(u,t)}gx(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)xx(t),t=t.sibling}function xx(t){switch(t.tag){case 0:case 11:case 15:Oi(t),t.flags&2048&&rs(9,t,t.return);break;case 3:Oi(t);break;case 12:Oi(t);break;case 22:var a=t.stateNode;t.memoizedState!==null&&a._visibility&2&&(t.return===null||t.return.tag!==13)?(a._visibility&=-3,Tc(t)):Oi(t);break;default:Oi(t)}}function Tc(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var u=a[i];bn=u,yx(u,t)}gx(t)}for(t=t.child;t!==null;){switch(a=t,a.tag){case 0:case 11:case 15:rs(8,a,a.return),Tc(a);break;case 22:i=a.stateNode,i._visibility&2&&(i._visibility&=-3,Tc(a));break;default:Tc(a)}t=t.sibling}}function yx(t,a){for(;bn!==null;){var i=bn;switch(i.tag){case 0:case 11:case 15:rs(8,i,a);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var u=i.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:yi(i.memoizedState.cache)}if(u=i.child,u!==null)u.return=i,bn=u;else e:for(i=t;bn!==null;){u=bn;var x=u.sibling,b=u.return;if(ox(u),u===i){bn=null;break e}if(x!==null){x.return=b,bn=x;break e}bn=b}}}var OS={getCacheForType:function(t){var a=Cn(rn),i=a.data.get(t);return i===void 0&&(i=t(),a.data.set(t,i)),i},cacheSignal:function(){return Cn(rn).controller.signal}},DS=typeof WeakMap=="function"?WeakMap:Map,gt=0,Ot=null,Je=null,rt=0,kt=0,ia=null,ss=!1,Ml=!1,Df=!1,_r=0,Zt=0,ls=0,Ws=0,zf=0,oa=0,El=0,Di=null,Yn=null,Uf=!1,Mc=0,bx=0,Ec=1/0,Ac=null,is=null,mn=0,os=null,Al=null,Ir=0,$f=0,Bf=null,vx=null,zi=0,Hf=null;function ca(){return(gt&2)!==0&&rt!==0?rt&-rt:F.T!==null?Wf():pt()}function kx(){if(oa===0)if((rt&536870912)===0||ot){var t=_t;_t<<=1,(_t&3932160)===0&&(_t=262144),oa=t}else oa=536870912;return t=sa.current,t!==null&&(t.flags|=32),oa}function Qn(t,a,i){(t===Ot&&(kt===2||kt===9)||t.cancelPendingCommit!==null)&&(Rl(t,0),cs(t,rt,oa,!1)),xn(t,i),((gt&2)===0||t!==Ot)&&(t===Ot&&((gt&2)===0&&(Ws|=i),Zt===4&&cs(t,rt,oa,!1)),or(t))}function wx(t,a,i){if((gt&6)!==0)throw Error(s(327));var u=!i&&(a&127)===0&&(a&t.expiredLanes)===0||Dn(t,a),x=u?$S(t,a):Ff(t,a,!0),b=u;do{if(x===0){Ml&&!u&&cs(t,a,0,!1);break}else{if(i=t.current.alternate,b&&!zS(i)){x=Ff(t,a,!1),b=!1;continue}if(x===2){if(b=a,t.errorRecoveryDisabledLanes&b)var j=0;else j=t.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){a=j;e:{var _=t;x=Di;var q=_.current.memoizedState.isDehydrated;if(q&&(Rl(_,j).flags|=256),j=Ff(_,j,!1),j!==2){if(Df&&!q){_.errorRecoveryDisabledLanes|=b,Ws|=b,x=4;break e}b=Yn,Yn=x,b!==null&&(Yn===null?Yn=b:Yn.push.apply(Yn,b))}x=j}if(b=!1,x!==2)continue}}if(x===1){Rl(t,0),cs(t,a,0,!0);break}e:{switch(u=t,b=x,b){case 0:case 1:throw Error(s(345));case 4:if((a&4194048)!==a)break;case 6:cs(u,a,oa,!ss);break e;case 2:Yn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((a&62914560)===a&&(x=Mc+300-Xe(),10<x)){if(cs(u,a,oa,!ss),Nt(u,0,!0)!==0)break e;Ir=a,u.timeoutHandle=Jx(Sx.bind(null,u,i,Yn,Ac,Uf,a,oa,Ws,El,ss,b,"Throttled",-0,0),x);break e}Sx(u,i,Yn,Ac,Uf,a,oa,Ws,El,ss,b,null,-0,0)}}break}while(!0);or(t)}function Sx(t,a,i,u,x,b,j,_,q,ee,de,me,re,ie){if(t.timeoutHandle=-1,me=a.subtreeFlags,me&8192||(me&16785408)===16785408){me={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:at},px(a,b,me);var Ce=(b&62914560)===b?Mc-Xe():(b&4194048)===b?bx-Xe():0;if(Ce=kj(me,Ce),Ce!==null){Ir=b,t.cancelPendingCommit=Ce(Rx.bind(null,t,a,b,i,u,x,j,_,q,de,me,null,re,ie)),cs(t,b,j,!ee);return}}Rx(t,a,b,i,u,x,j,_,q)}function zS(t){for(var a=t;;){var i=a.tag;if((i===0||i===11||i===15)&&a.flags&16384&&(i=a.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var u=0;u<i.length;u++){var x=i[u],b=x.getSnapshot;x=x.value;try{if(!aa(b(),x))return!1}catch{return!1}}if(i=a.child,a.subtreeFlags&16384&&i!==null)i.return=a,a=i;else{if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function cs(t,a,i,u){a&=~zf,a&=~Ws,t.suspendedLanes|=a,t.pingedLanes&=~a,u&&(t.warmLanes|=a),u=t.expirationTimes;for(var x=a;0<x;){var b=31-Ze(x),j=1<<b;u[b]=-1,x&=~j}i!==0&&ke(t,i,a)}function Rc(){return(gt&6)===0?(Ui(0),!1):!0}function Pf(){if(Je!==null){if(kt===0)var t=Je.return;else t=Je,wr=Us=null,af(t),kl=null,vi=0,t=Je;for(;t!==null;)ex(t.alternate,t),t=t.return;Je=null}}function Rl(t,a){var i=t.timeoutHandle;i!==-1&&(t.timeoutHandle=-1,aj(i)),i=t.cancelPendingCommit,i!==null&&(t.cancelPendingCommit=null,i()),Ir=0,Pf(),Ot=t,Je=i=vr(t.current,null),rt=a,kt=0,ia=null,ss=!1,Ml=Dn(t,a),Df=!1,El=oa=zf=Ws=ls=Zt=0,Yn=Di=null,Uf=!1,(a&8)!==0&&(a|=a&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=a;0<u;){var x=31-Ze(u),b=1<<x;a|=t[x],u&=~b}return _r=a,Zo(),i}function jx(t,a){Ve=null,F.H=Mi,a===vl||a===lc?(a=Bg(),kt=3):a===Vd?(a=Bg(),kt=4):kt=a===vf?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,ia=a,Je===null&&(Zt=1,vc(t,Ca(a,t.current)))}function Nx(){var t=sa.current;return t===null?!0:(rt&4194048)===rt?Aa===null:(rt&62914560)===rt||(rt&536870912)!==0?t===Aa:!1}function Cx(){var t=F.H;return F.H=Mi,t===null?Mi:t}function Tx(){var t=F.A;return F.A=OS,t}function _c(){Zt=4,ss||(rt&4194048)!==rt&&sa.current!==null||(Ml=!0),(ls&134217727)===0&&(Ws&134217727)===0||Ot===null||cs(Ot,rt,oa,!1)}function Ff(t,a,i){var u=gt;gt|=2;var x=Cx(),b=Tx();(Ot!==t||rt!==a)&&(Ac=null,Rl(t,a)),a=!1;var j=Zt;e:do try{if(kt!==0&&Je!==null){var _=Je,q=ia;switch(kt){case 8:Pf(),j=6;break e;case 3:case 2:case 9:case 6:sa.current===null&&(a=!0);var ee=kt;if(kt=0,ia=null,_l(t,_,q,ee),i&&Ml){j=0;break e}break;default:ee=kt,kt=0,ia=null,_l(t,_,q,ee)}}US(),j=Zt;break}catch(de){jx(t,de)}while(!0);return a&&t.shellSuspendCounter++,wr=Us=null,gt=u,F.H=x,F.A=b,Je===null&&(Ot=null,rt=0,Zo()),j}function US(){for(;Je!==null;)Mx(Je)}function $S(t,a){var i=gt;gt|=2;var u=Cx(),x=Tx();Ot!==t||rt!==a?(Ac=null,Ec=Xe()+500,Rl(t,a)):Ml=Dn(t,a);e:do try{if(kt!==0&&Je!==null){a=Je;var b=ia;t:switch(kt){case 1:kt=0,ia=null,_l(t,a,b,1);break;case 2:case 9:if(Ug(b)){kt=0,ia=null,Ex(a);break}a=function(){kt!==2&&kt!==9||Ot!==t||(kt=7),or(t)},b.then(a,a);break e;case 3:kt=7;break e;case 4:kt=5;break e;case 7:Ug(b)?(kt=0,ia=null,Ex(a)):(kt=0,ia=null,_l(t,a,b,7));break;case 5:var j=null;switch(Je.tag){case 26:j=Je.memoizedState;case 5:case 27:var _=Je;if(j?hy(j):_.stateNode.complete){kt=0,ia=null;var q=_.sibling;if(q!==null)Je=q;else{var ee=_.return;ee!==null?(Je=ee,Ic(ee)):Je=null}break t}}kt=0,ia=null,_l(t,a,b,5);break;case 6:kt=0,ia=null,_l(t,a,b,6);break;case 8:Pf(),Zt=6;break e;default:throw Error(s(462))}}BS();break}catch(de){jx(t,de)}while(!0);return wr=Us=null,F.H=u,F.A=x,gt=i,Je!==null?0:(Ot=null,rt=0,Zo(),Zt)}function BS(){for(;Je!==null&&!Qt();)Mx(Je)}function Mx(t){var a=Z0(t.alternate,t,_r);t.memoizedProps=t.pendingProps,a===null?Ic(t):Je=a}function Ex(t){var a=t,i=a.alternate;switch(a.tag){case 15:case 0:a=G0(i,a,a.pendingProps,a.type,void 0,rt);break;case 11:a=G0(i,a,a.pendingProps,a.type.render,a.ref,rt);break;case 5:af(a);default:ex(i,a),a=Je=Tg(a,_r),a=Z0(i,a,_r)}t.memoizedProps=t.pendingProps,a===null?Ic(t):Je=a}function _l(t,a,i,u){wr=Us=null,af(a),kl=null,vi=0;var x=a.return;try{if(MS(t,x,a,i,rt)){Zt=1,vc(t,Ca(i,t.current)),Je=null;return}}catch(b){if(x!==null)throw Je=x,b;Zt=1,vc(t,Ca(i,t.current)),Je=null;return}a.flags&32768?(ot||u===1?t=!0:Ml||(rt&536870912)!==0?t=!1:(ss=t=!0,(u===2||u===9||u===3||u===6)&&(u=sa.current,u!==null&&u.tag===13&&(u.flags|=16384))),Ax(a,t)):Ic(a)}function Ic(t){var a=t;do{if((a.flags&32768)!==0){Ax(a,ss);return}t=a.return;var i=RS(a.alternate,a,_r);if(i!==null){Je=i;return}if(a=a.sibling,a!==null){Je=a;return}Je=a=t}while(a!==null);Zt===0&&(Zt=5)}function Ax(t,a){do{var i=_S(t.alternate,t);if(i!==null){i.flags&=32767,Je=i;return}if(i=t.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!a&&(t=t.sibling,t!==null)){Je=t;return}Je=t=i}while(t!==null);Zt=6,Je=null}function Rx(t,a,i,u,x,b,j,_,q){t.cancelPendingCommit=null;do Lc();while(mn!==0);if((gt&6)!==0)throw Error(s(327));if(a!==null){if(a===t.current)throw Error(s(177));if(b=a.lanes|a.childLanes,b|=Ad,Fn(t,i,b,j,_,q),t===Ot&&(Je=Ot=null,rt=0),Al=a,os=t,Ir=i,$f=b,Bf=x,vx=u,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,qS(Ne,function(){return Dx(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||u){u=F.T,F.T=null,x=P.p,P.p=2,j=gt,gt|=4;try{IS(t,a,i)}finally{gt=j,P.p=x,F.T=u}}mn=1,_x(),Ix(),Lx()}}function _x(){if(mn===1){mn=0;var t=os,a=Al,i=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||i){i=F.T,F.T=null;var u=P.p;P.p=2;var x=gt;gt|=4;try{fx(a,t);var b=tm,j=yg(t.containerInfo),_=b.focusedElem,q=b.selectionRange;if(j!==_&&_&&_.ownerDocument&&xg(_.ownerDocument.documentElement,_)){if(q!==null&&Nd(_)){var ee=q.start,de=q.end;if(de===void 0&&(de=ee),"selectionStart"in _)_.selectionStart=ee,_.selectionEnd=Math.min(de,_.value.length);else{var me=_.ownerDocument||document,re=me&&me.defaultView||window;if(re.getSelection){var ie=re.getSelection(),Ce=_.textContent.length,Oe=Math.min(q.start,Ce),Mt=q.end===void 0?Oe:Math.min(q.end,Ce);!ie.extend&&Oe>Mt&&(j=Mt,Mt=Oe,Oe=j);var Y=gg(_,Oe),G=gg(_,Mt);if(Y&&G&&(ie.rangeCount!==1||ie.anchorNode!==Y.node||ie.anchorOffset!==Y.offset||ie.focusNode!==G.node||ie.focusOffset!==G.offset)){var J=me.createRange();J.setStart(Y.node,Y.offset),ie.removeAllRanges(),Oe>Mt?(ie.addRange(J),ie.extend(G.node,G.offset)):(J.setEnd(G.node,G.offset),ie.addRange(J))}}}}for(me=[],ie=_;ie=ie.parentNode;)ie.nodeType===1&&me.push({element:ie,left:ie.scrollLeft,top:ie.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<me.length;_++){var fe=me[_];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}Gc=!!em,tm=em=null}finally{gt=x,P.p=u,F.T=i}}t.current=a,mn=2}}function Ix(){if(mn===2){mn=0;var t=os,a=Al,i=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||i){i=F.T,F.T=null;var u=P.p;P.p=2;var x=gt;gt|=4;try{ix(t,a.alternate,a)}finally{gt=x,P.p=u,F.T=i}}mn=3}}function Lx(){if(mn===4||mn===3){mn=0,wn();var t=os,a=Al,i=Ir,u=vx;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?mn=5:(mn=0,Al=os=null,Ox(t,t.pendingLanes));var x=t.pendingLanes;if(x===0&&(is=null),Bt(i),a=a.stateNode,Ke&&typeof Ke.onCommitFiberRoot=="function")try{Ke.onCommitFiberRoot($t,a,void 0,(a.current.flags&128)===128)}catch{}if(u!==null){a=F.T,x=P.p,P.p=2,F.T=null;try{for(var b=t.onRecoverableError,j=0;j<u.length;j++){var _=u[j];b(_.value,{componentStack:_.stack})}}finally{F.T=a,P.p=x}}(Ir&3)!==0&&Lc(),or(t),x=t.pendingLanes,(i&261930)!==0&&(x&42)!==0?t===Hf?zi++:(zi=0,Hf=t):zi=0,Ui(0)}}function Ox(t,a){(t.pooledCacheLanes&=a)===0&&(a=t.pooledCache,a!=null&&(t.pooledCache=null,yi(a)))}function Lc(){return _x(),Ix(),Lx(),Dx()}function Dx(){if(mn!==5)return!1;var t=os,a=$f;$f=0;var i=Bt(Ir),u=F.T,x=P.p;try{P.p=32>i?32:i,F.T=null,i=Bf,Bf=null;var b=os,j=Ir;if(mn=0,Al=os=null,Ir=0,(gt&6)!==0)throw Error(s(331));var _=gt;if(gt|=4,xx(b.current),hx(b,b.current,j,i),gt=_,Ui(0,!1),Ke&&typeof Ke.onPostCommitFiberRoot=="function")try{Ke.onPostCommitFiberRoot($t,b)}catch{}return!0}finally{P.p=x,F.T=u,Ox(t,a)}}function zx(t,a,i){a=Ca(i,a),a=bf(t.stateNode,a,2),t=ts(t,a,2),t!==null&&(xn(t,2),or(t))}function wt(t,a,i){if(t.tag===3)zx(t,t,i);else for(;a!==null;){if(a.tag===3){zx(a,t,i);break}else if(a.tag===1){var u=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(is===null||!is.has(u))){t=Ca(i,t),i=U0(2),u=ts(a,i,2),u!==null&&($0(i,u,a,t),xn(u,2),or(u));break}}a=a.return}}function qf(t,a,i){var u=t.pingCache;if(u===null){u=t.pingCache=new DS;var x=new Set;u.set(a,x)}else x=u.get(a),x===void 0&&(x=new Set,u.set(a,x));x.has(i)||(Df=!0,x.add(i),t=HS.bind(null,t,a,i),a.then(t,t))}function HS(t,a,i){var u=t.pingCache;u!==null&&u.delete(a),t.pingedLanes|=t.suspendedLanes&i,t.warmLanes&=~i,Ot===t&&(rt&i)===i&&(Zt===4||Zt===3&&(rt&62914560)===rt&&300>Xe()-Mc?(gt&2)===0&&Rl(t,0):zf|=i,El===rt&&(El=0)),or(t)}function Ux(t,a){a===0&&(a=Ha()),t=Os(t,a),t!==null&&(xn(t,a),or(t))}function PS(t){var a=t.memoizedState,i=0;a!==null&&(i=a.retryLane),Ux(t,i)}function FS(t,a){var i=0;switch(t.tag){case 31:case 13:var u=t.stateNode,x=t.memoizedState;x!==null&&(i=x.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(s(314))}u!==null&&u.delete(a),Ux(t,i)}function qS(t,a){return jt(t,a)}var Oc=null,Il=null,Vf=!1,Dc=!1,Gf=!1,us=0;function or(t){t!==Il&&t.next===null&&(Il===null?Oc=Il=t:Il=Il.next=t),Dc=!0,Vf||(Vf=!0,GS())}function Ui(t,a){if(!Gf&&Dc){Gf=!0;do for(var i=!1,u=Oc;u!==null;){if(t!==0){var x=u.pendingLanes;if(x===0)var b=0;else{var j=u.suspendedLanes,_=u.pingedLanes;b=(1<<31-Ze(42|t)+1)-1,b&=x&~(j&~_),b=b&201326741?b&201326741|1:b?b|2:0}b!==0&&(i=!0,Px(u,b))}else b=rt,b=Nt(u,u===Ot?b:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(b&3)===0||Dn(u,b)||(i=!0,Px(u,b));u=u.next}while(i);Gf=!1}}function VS(){$x()}function $x(){Dc=Vf=!1;var t=0;us!==0&&nj()&&(t=us);for(var a=Xe(),i=null,u=Oc;u!==null;){var x=u.next,b=Bx(u,a);b===0?(u.next=null,i===null?Oc=x:i.next=x,x===null&&(Il=i)):(i=u,(t!==0||(b&3)!==0)&&(Dc=!0)),u=x}mn!==0&&mn!==5||Ui(t),us!==0&&(us=0)}function Bx(t,a){for(var i=t.suspendedLanes,u=t.pingedLanes,x=t.expirationTimes,b=t.pendingLanes&-62914561;0<b;){var j=31-Ze(b),_=1<<j,q=x[j];q===-1?((_&i)===0||(_&u)!==0)&&(x[j]=va(_,a)):q<=a&&(t.expiredLanes|=_),b&=~_}if(a=Ot,i=rt,i=Nt(t,t===a?i:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,i===0||t===a&&(kt===2||kt===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&&yt(u),t.callbackNode=null,t.callbackPriority=0;if((i&3)===0||Dn(t,i)){if(a=i&-i,a===t.callbackPriority)return a;switch(u!==null&&yt(u),Bt(i)){case 2:case 8:i=ye;break;case 32:i=Ne;break;case 268435456:i=De;break;default:i=Ne}return u=Hx.bind(null,t),i=jt(i,u),t.callbackPriority=a,t.callbackNode=i,a}return u!==null&&u!==null&&yt(u),t.callbackPriority=2,t.callbackNode=null,2}function Hx(t,a){if(mn!==0&&mn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var i=t.callbackNode;if(Lc()&&t.callbackNode!==i)return null;var u=rt;return u=Nt(t,t===Ot?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(wx(t,u,a),Bx(t,Xe()),t.callbackNode!=null&&t.callbackNode===i?Hx.bind(null,t):null)}function Px(t,a){if(Lc())return null;wx(t,a,!0)}function GS(){rj(function(){(gt&6)!==0?jt(ue,VS):$x()})}function Wf(){if(us===0){var t=yl;t===0&&(t=Hn,Hn<<=1,(Hn&261888)===0&&(Hn=256)),us=t}return us}function Fx(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:ct(""+t)}function qx(t,a){var i=a.ownerDocument.createElement("input");return i.name=a.name,i.value=a.value,t.id&&i.setAttribute("form",t.id),a.parentNode.insertBefore(i,a),t=new FormData(t),i.parentNode.removeChild(i),t}function WS(t,a,i,u,x){if(a==="submit"&&i&&i.stateNode===x){var b=Fx((x[Kt]||null).action),j=u.submitter;j&&(a=(a=j[Kt]||null)?Fx(a.formAction):j.getAttribute("formAction"),a!==null&&(b=a,j=null));var _=new Ko("action","action",null,u,x);t.push({event:_,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(us!==0){var q=j?qx(x,j):new FormData(x);mf(i,{pending:!0,data:q,method:x.method,action:b},null,q)}}else typeof b=="function"&&(_.preventDefault(),q=j?qx(x,j):new FormData(x),mf(i,{pending:!0,data:q,method:x.method,action:b},b,q))},currentTarget:x}]})}}for(var Kf=0;Kf<Ed.length;Kf++){var Yf=Ed[Kf],KS=Yf.toLowerCase(),YS=Yf[0].toUpperCase()+Yf.slice(1);Fa(KS,"on"+YS)}Fa(kg,"onAnimationEnd"),Fa(wg,"onAnimationIteration"),Fa(Sg,"onAnimationStart"),Fa("dblclick","onDoubleClick"),Fa("focusin","onFocus"),Fa("focusout","onBlur"),Fa(dS,"onTransitionRun"),Fa(fS,"onTransitionStart"),Fa(mS,"onTransitionCancel"),Fa(jg,"onTransitionEnd"),ka("onMouseEnter",["mouseout","mouseover"]),ka("onMouseLeave",["mouseout","mouseover"]),ka("onPointerEnter",["pointerout","pointerover"]),ka("onPointerLeave",["pointerout","pointerover"]),zn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),zn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),zn("onBeforeInput",["compositionend","keypress","textInput","paste"]),zn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),zn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),zn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var $i="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(" "),QS=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat($i));function Vx(t,a){a=(a&4)!==0;for(var i=0;i<t.length;i++){var u=t[i],x=u.event;u=u.listeners;e:{var b=void 0;if(a)for(var j=u.length-1;0<=j;j--){var _=u[j],q=_.instance,ee=_.currentTarget;if(_=_.listener,q!==b&&x.isPropagationStopped())break e;b=_,x.currentTarget=ee;try{b(x)}catch(de){Xo(de)}x.currentTarget=null,b=q}else for(j=0;j<u.length;j++){if(_=u[j],q=_.instance,ee=_.currentTarget,_=_.listener,q!==b&&x.isPropagationStopped())break e;b=_,x.currentTarget=ee;try{b(x)}catch(de){Xo(de)}x.currentTarget=null,b=q}}}}function et(t,a){var i=a[Pr];i===void 0&&(i=a[Pr]=new Set);var u=t+"__bubble";i.has(u)||(Gx(a,t,2,!1),i.add(u))}function Qf(t,a,i){var u=0;a&&(u|=4),Gx(i,t,u,a)}var zc="_reactListening"+Math.random().toString(36).slice(2);function Xf(t){if(!t[zc]){t[zc]=!0,Ms.forEach(function(i){i!=="selectionchange"&&(QS.has(i)||Qf(i,!1,t),Qf(i,!0,t))});var a=t.nodeType===9?t:t.ownerDocument;a===null||a[zc]||(a[zc]=!0,Qf("selectionchange",!1,a))}}function Gx(t,a,i,u){switch(ky(a)){case 2:var x=jj;break;case 8:x=Nj;break;default:x=fm}i=x.bind(null,a,i,t),x=void 0,!gd||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(x=!0),u?x!==void 0?t.addEventListener(a,i,{capture:!0,passive:x}):t.addEventListener(a,i,!0):x!==void 0?t.addEventListener(a,i,{passive:x}):t.addEventListener(a,i,!1)}function Zf(t,a,i,u,x){var b=u;if((a&1)===0&&(a&2)===0&&u!==null)e:for(;;){if(u===null)return;var j=u.tag;if(j===3||j===4){var _=u.stateNode.containerInfo;if(_===x)break;if(j===4)for(j=u.return;j!==null;){var q=j.tag;if((q===3||q===4)&&j.stateNode.containerInfo===x)return;j=j.return}for(;_!==null;){if(j=Pa(_),j===null)return;if(q=j.tag,q===5||q===6||q===26||q===27){u=b=j;continue e}_=_.parentNode}}u=u.return}Xp(function(){var ee=b,de=As(i),me=[];e:{var re=Ng.get(t);if(re!==void 0){var ie=Ko,Ce=t;switch(t){case"keypress":if(Go(i)===0)break e;case"keydown":case"keyup":ie=Fw;break;case"focusin":Ce="focus",ie=vd;break;case"focusout":Ce="blur",ie=vd;break;case"beforeblur":case"afterblur":ie=vd;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ie=eg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ie=Rw;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ie=Gw;break;case kg:case wg:case Sg:ie=Lw;break;case jg:ie=Kw;break;case"scroll":case"scrollend":ie=Ew;break;case"wheel":ie=Qw;break;case"copy":case"cut":case"paste":ie=Dw;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ie=ng;break;case"toggle":case"beforetoggle":ie=Zw}var Oe=(a&4)!==0,Mt=!Oe&&(t==="scroll"||t==="scrollend"),Y=Oe?re!==null?re+"Capture":null:re;Oe=[];for(var G=ee,J;G!==null;){var fe=G;if(J=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||J===null||Y===null||(fe=ii(G,Y),fe!=null&&Oe.push(Bi(G,fe,J))),Mt)break;G=G.return}0<Oe.length&&(re=new ie(re,Ce,null,i,de),me.push({event:re,listeners:Oe}))}}if((a&7)===0){e:{if(re=t==="mouseover"||t==="pointerover",ie=t==="mouseout"||t==="pointerout",re&&i!==ja&&(Ce=i.relatedTarget||i.fromElement)&&(Pa(Ce)||Ce[fn]))break e;if((ie||re)&&(re=de.window===de?de:(re=de.ownerDocument)?re.defaultView||re.parentWindow:window,ie?(Ce=i.relatedTarget||i.toElement,ie=ee,Ce=Ce?Pa(Ce):null,Ce!==null&&(Mt=c(Ce),Oe=Ce.tag,Ce!==Mt||Oe!==5&&Oe!==27&&Oe!==6)&&(Ce=null)):(ie=null,Ce=ee),ie!==Ce)){if(Oe=eg,fe="onMouseLeave",Y="onMouseEnter",G="mouse",(t==="pointerout"||t==="pointerover")&&(Oe=ng,fe="onPointerLeave",Y="onPointerEnter",G="pointer"),Mt=ie==null?re:tr(ie),J=Ce==null?re:tr(Ce),re=new Oe(fe,G+"leave",ie,i,de),re.target=Mt,re.relatedTarget=J,fe=null,Pa(de)===ee&&(Oe=new Oe(Y,G+"enter",Ce,i,de),Oe.target=J,Oe.relatedTarget=Mt,fe=Oe),Mt=fe,ie&&Ce)t:{for(Oe=XS,Y=ie,G=Ce,J=0,fe=Y;fe;fe=Oe(fe))J++;fe=0;for(var Re=G;Re;Re=Oe(Re))fe++;for(;0<J-fe;)Y=Oe(Y),J--;for(;0<fe-J;)G=Oe(G),fe--;for(;J--;){if(Y===G||G!==null&&Y===G.alternate){Oe=Y;break t}Y=Oe(Y),G=Oe(G)}Oe=null}else Oe=null;ie!==null&&Wx(me,re,ie,Oe,!1),Ce!==null&&Mt!==null&&Wx(me,Mt,Ce,Oe,!0)}}e:{if(re=ee?tr(ee):window,ie=re.nodeName&&re.nodeName.toLowerCase(),ie==="select"||ie==="input"&&re.type==="file")var mt=ug;else if(og(re))if(dg)mt=oS;else{mt=lS;var Me=sS}else ie=re.nodeName,!ie||ie.toLowerCase()!=="input"||re.type!=="checkbox"&&re.type!=="radio"?ee&&te(ee.elementType)&&(mt=ug):mt=iS;if(mt&&(mt=mt(t,ee))){cg(me,mt,i,de);break e}Me&&Me(t,re,ee),t==="focusout"&&ee&&re.type==="number"&&ee.memoizedProps.value!=null&&Vr(re,"number",re.value)}switch(Me=ee?tr(ee):window,t){case"focusin":(og(Me)||Me.contentEditable==="true")&&(ul=Me,Cd=ee,pi=null);break;case"focusout":pi=Cd=ul=null;break;case"mousedown":Td=!0;break;case"contextmenu":case"mouseup":case"dragend":Td=!1,bg(me,i,de);break;case"selectionchange":if(uS)break;case"keydown":case"keyup":bg(me,i,de)}var Ge;if(wd)e:{switch(t){case"compositionstart":var st="onCompositionStart";break e;case"compositionend":st="onCompositionEnd";break e;case"compositionupdate":st="onCompositionUpdate";break e}st=void 0}else cl?lg(t,i)&&(st="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(st="onCompositionStart");st&&(ag&&i.locale!=="ko"&&(cl||st!=="onCompositionStart"?st==="onCompositionEnd"&&cl&&(Ge=Zp()):(Kr=de,xd="value"in Kr?Kr.value:Kr.textContent,cl=!0)),Me=Uc(ee,st),0<Me.length&&(st=new tg(st,t,null,i,de),me.push({event:st,listeners:Me}),Ge?st.data=Ge:(Ge=ig(i),Ge!==null&&(st.data=Ge)))),(Ge=eS?tS(t,i):nS(t,i))&&(st=Uc(ee,"onBeforeInput"),0<st.length&&(Me=new tg("onBeforeInput","beforeinput",null,i,de),me.push({event:Me,listeners:st}),Me.data=Ge)),WS(me,t,ee,i,de)}Vx(me,a)})}function Bi(t,a,i){return{instance:t,listener:a,currentTarget:i}}function Uc(t,a){for(var i=a+"Capture",u=[];t!==null;){var x=t,b=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||b===null||(x=ii(t,i),x!=null&&u.unshift(Bi(t,x,b)),x=ii(t,a),x!=null&&u.push(Bi(t,x,b))),t.tag===3)return u;t=t.return}return[]}function XS(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Wx(t,a,i,u,x){for(var b=a._reactName,j=[];i!==null&&i!==u;){var _=i,q=_.alternate,ee=_.stateNode;if(_=_.tag,q!==null&&q===u)break;_!==5&&_!==26&&_!==27||ee===null||(q=ee,x?(ee=ii(i,b),ee!=null&&j.unshift(Bi(i,ee,q))):x||(ee=ii(i,b),ee!=null&&j.push(Bi(i,ee,q)))),i=i.return}j.length!==0&&t.push({event:a,listeners:j})}var ZS=/\r\n?/g,JS=/\u0000|\uFFFD/g;function Kx(t){return(typeof t=="string"?t:""+t).replace(ZS,`
|
|
9
|
-
`).replace(JS,"")}function Yx(t,a){return a=Kx(a),Kx(t)===a}function Tt(t,a,i,u,x,b){switch(i){case"children":typeof u=="string"?a==="body"||a==="textarea"&&u===""||Gr(t,u):(typeof u=="number"||typeof u=="bigint")&&a!=="body"&&Gr(t,""+u);break;case"className":ae(t,"class",u);break;case"tabIndex":ae(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":ae(t,i,u);break;case"style":li(t,u,b);break;case"data":if(a!=="object"){ae(t,"data",u);break}case"src":case"href":if(u===""&&(a!=="a"||i!=="href")){t.removeAttribute(i);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(i);break}u=ct(""+u),t.setAttribute(i,u);break;case"action":case"formAction":if(typeof u=="function"){t.setAttribute(i,"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}else typeof b=="function"&&(i==="formAction"?(a!=="input"&&Tt(t,a,"name",x.name,x,null),Tt(t,a,"formEncType",x.formEncType,x,null),Tt(t,a,"formMethod",x.formMethod,x,null),Tt(t,a,"formTarget",x.formTarget,x,null)):(Tt(t,a,"encType",x.encType,x,null),Tt(t,a,"method",x.method,x,null),Tt(t,a,"target",x.target,x,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(i);break}u=ct(""+u),t.setAttribute(i,u);break;case"onClick":u!=null&&(t.onclick=at);break;case"onScroll":u!=null&&et("scroll",t);break;case"onScrollEnd":u!=null&&et("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(i=u.__html,i!=null){if(x.children!=null)throw Error(s(60));t.innerHTML=i}}break;case"multiple":t.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":t.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){t.removeAttribute("xlink:href");break}i=ct(""+u),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(i,""+u):t.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":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":u&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(i,""):t.removeAttribute(i);break;case"capture":case"download":u===!0?t.setAttribute(i,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(i,u):t.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?t.setAttribute(i,u):t.removeAttribute(i);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?t.removeAttribute(i):t.setAttribute(i,u);break;case"popover":et("beforetoggle",t),et("toggle",t),ar(t,"popover",u);break;case"xlinkActuate":ve(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":ve(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":ve(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":ve(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":ve(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":ve(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":ve(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":ve(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":ve(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":ar(t,"is",u);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=we.get(i)||i,ar(t,i,u))}}function Jf(t,a,i,u,x,b){switch(i){case"style":li(t,u,b);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(s(61));if(i=u.__html,i!=null){if(x.children!=null)throw Error(s(60));t.innerHTML=i}}break;case"children":typeof u=="string"?Gr(t,u):(typeof u=="number"||typeof u=="bigint")&&Gr(t,""+u);break;case"onScroll":u!=null&&et("scroll",t);break;case"onScrollEnd":u!=null&&et("scrollend",t);break;case"onClick":u!=null&&(t.onclick=at);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Es.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(x=i.endsWith("Capture"),a=i.slice(2,x?i.length-7:void 0),b=t[Kt]||null,b=b!=null?b[i]:null,typeof b=="function"&&t.removeEventListener(a,b,x),typeof u=="function")){typeof b!="function"&&b!==null&&(i in t?t[i]=null:t.hasAttribute(i)&&t.removeAttribute(i)),t.addEventListener(a,u,x);break e}i in t?t[i]=u:u===!0?t.setAttribute(i,""):ar(t,i,u)}}}function Mn(t,a,i){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":et("error",t),et("load",t);var u=!1,x=!1,b;for(b in i)if(i.hasOwnProperty(b)){var j=i[b];if(j!=null)switch(b){case"src":u=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:Tt(t,a,b,j,i,null)}}x&&Tt(t,a,"srcSet",i.srcSet,i,null),u&&Tt(t,a,"src",i.src,i,null);return;case"input":et("invalid",t);var _=b=j=x=null,q=null,ee=null;for(u in i)if(i.hasOwnProperty(u)){var de=i[u];if(de!=null)switch(u){case"name":x=de;break;case"type":j=de;break;case"checked":q=de;break;case"defaultChecked":ee=de;break;case"value":b=de;break;case"defaultValue":_=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(s(137,a));break;default:Tt(t,a,u,de,i,null)}}qr(t,b,_,q,ee,j,x,!1);return;case"select":et("invalid",t),u=j=b=null;for(x in i)if(i.hasOwnProperty(x)&&(_=i[x],_!=null))switch(x){case"value":b=_;break;case"defaultValue":j=_;break;case"multiple":u=_;default:Tt(t,a,x,_,i,null)}a=b,i=j,t.multiple=!!u,a!=null?Rn(t,!!u,a,!1):i!=null&&Rn(t,!!u,i,!0);return;case"textarea":et("invalid",t),b=x=u=null;for(j in i)if(i.hasOwnProperty(j)&&(_=i[j],_!=null))switch(j){case"value":u=_;break;case"defaultValue":x=_;break;case"children":b=_;break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(s(91));break;default:Tt(t,a,j,_,i,null)}qo(t,u,x,b);return;case"option":for(q in i)i.hasOwnProperty(q)&&(u=i[q],u!=null)&&(q==="selected"?t.selected=u&&typeof u!="function"&&typeof u!="symbol":Tt(t,a,q,u,i,null));return;case"dialog":et("beforetoggle",t),et("toggle",t),et("cancel",t),et("close",t);break;case"iframe":case"object":et("load",t);break;case"video":case"audio":for(u=0;u<$i.length;u++)et($i[u],t);break;case"image":et("error",t),et("load",t);break;case"details":et("toggle",t);break;case"embed":case"source":case"link":et("error",t),et("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in i)if(i.hasOwnProperty(ee)&&(u=i[ee],u!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,a));default:Tt(t,a,ee,u,i,null)}return;default:if(te(a)){for(de in i)i.hasOwnProperty(de)&&(u=i[de],u!==void 0&&Jf(t,a,de,u,i,void 0));return}}for(_ in i)i.hasOwnProperty(_)&&(u=i[_],u!=null&&Tt(t,a,_,u,i,null))}function ej(t,a,i,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,b=null,j=null,_=null,q=null,ee=null,de=null;for(ie in i){var me=i[ie];if(i.hasOwnProperty(ie)&&me!=null)switch(ie){case"checked":break;case"value":break;case"defaultValue":q=me;default:u.hasOwnProperty(ie)||Tt(t,a,ie,null,u,me)}}for(var re in u){var ie=u[re];if(me=i[re],u.hasOwnProperty(re)&&(ie!=null||me!=null))switch(re){case"type":b=ie;break;case"name":x=ie;break;case"checked":ee=ie;break;case"defaultChecked":de=ie;break;case"value":j=ie;break;case"defaultValue":_=ie;break;case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(s(137,a));break;default:ie!==me&&Tt(t,a,re,ie,u,me)}}Sa(t,j,_,q,ee,de,b,x);return;case"select":ie=j=_=re=null;for(b in i)if(q=i[b],i.hasOwnProperty(b)&&q!=null)switch(b){case"value":break;case"multiple":ie=q;default:u.hasOwnProperty(b)||Tt(t,a,b,null,u,q)}for(x in u)if(b=u[x],q=i[x],u.hasOwnProperty(x)&&(b!=null||q!=null))switch(x){case"value":re=b;break;case"defaultValue":_=b;break;case"multiple":j=b;default:b!==q&&Tt(t,a,x,b,u,q)}a=_,i=j,u=ie,re!=null?Rn(t,!!i,re,!1):!!u!=!!i&&(a!=null?Rn(t,!!i,a,!0):Rn(t,!!i,i?[]:"",!1));return;case"textarea":ie=re=null;for(_ in i)if(x=i[_],i.hasOwnProperty(_)&&x!=null&&!u.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:Tt(t,a,_,null,u,x)}for(j in u)if(x=u[j],b=i[j],u.hasOwnProperty(j)&&(x!=null||b!=null))switch(j){case"value":re=x;break;case"defaultValue":ie=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(s(91));break;default:x!==b&&Tt(t,a,j,x,u,b)}Fo(t,re,ie);return;case"option":for(var Ce in i)re=i[Ce],i.hasOwnProperty(Ce)&&re!=null&&!u.hasOwnProperty(Ce)&&(Ce==="selected"?t.selected=!1:Tt(t,a,Ce,null,u,re));for(q in u)re=u[q],ie=i[q],u.hasOwnProperty(q)&&re!==ie&&(re!=null||ie!=null)&&(q==="selected"?t.selected=re&&typeof re!="function"&&typeof re!="symbol":Tt(t,a,q,re,u,ie));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 Oe in i)re=i[Oe],i.hasOwnProperty(Oe)&&re!=null&&!u.hasOwnProperty(Oe)&&Tt(t,a,Oe,null,u,re);for(ee in u)if(re=u[ee],ie=i[ee],u.hasOwnProperty(ee)&&re!==ie&&(re!=null||ie!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(s(137,a));break;default:Tt(t,a,ee,re,u,ie)}return;default:if(te(a)){for(var Mt in i)re=i[Mt],i.hasOwnProperty(Mt)&&re!==void 0&&!u.hasOwnProperty(Mt)&&Jf(t,a,Mt,void 0,u,re);for(de in u)re=u[de],ie=i[de],!u.hasOwnProperty(de)||re===ie||re===void 0&&ie===void 0||Jf(t,a,de,re,u,ie);return}}for(var Y in i)re=i[Y],i.hasOwnProperty(Y)&&re!=null&&!u.hasOwnProperty(Y)&&Tt(t,a,Y,null,u,re);for(me in u)re=u[me],ie=i[me],!u.hasOwnProperty(me)||re===ie||re==null&&ie==null||Tt(t,a,me,re,u,ie)}function Qx(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function tj(){if(typeof performance.getEntriesByType=="function"){for(var t=0,a=0,i=performance.getEntriesByType("resource"),u=0;u<i.length;u++){var x=i[u],b=x.transferSize,j=x.initiatorType,_=x.duration;if(b&&_&&Qx(j)){for(j=0,_=x.responseEnd,u+=1;u<i.length;u++){var q=i[u],ee=q.startTime;if(ee>_)break;var de=q.transferSize,me=q.initiatorType;de&&Qx(me)&&(q=q.responseEnd,j+=de*(q<_?1:(_-ee)/(q-ee)))}if(--u,a+=8*(b+j)/(x.duration/1e3),t++,10<t)break}}if(0<t)return a/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var em=null,tm=null;function $c(t){return t.nodeType===9?t:t.ownerDocument}function Xx(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Zx(t,a){if(t===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&a==="foreignObject"?0:t}function nm(t,a){return t==="textarea"||t==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var am=null;function nj(){var t=window.event;return t&&t.type==="popstate"?t===am?!1:(am=t,!0):(am=null,!1)}var Jx=typeof setTimeout=="function"?setTimeout:void 0,aj=typeof clearTimeout=="function"?clearTimeout:void 0,ey=typeof Promise=="function"?Promise:void 0,rj=typeof queueMicrotask=="function"?queueMicrotask:typeof ey<"u"?function(t){return ey.resolve(null).then(t).catch(sj)}:Jx;function sj(t){setTimeout(function(){throw t})}function ds(t){return t==="head"}function ty(t,a){var i=a,u=0;do{var x=i.nextSibling;if(t.removeChild(i),x&&x.nodeType===8)if(i=x.data,i==="/$"||i==="/&"){if(u===0){t.removeChild(x),zl(a);return}u--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")u++;else if(i==="html")Hi(t.ownerDocument.documentElement);else if(i==="head"){i=t.ownerDocument.head,Hi(i);for(var b=i.firstChild;b;){var j=b.nextSibling,_=b.nodeName;b[qn]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&b.rel.toLowerCase()==="stylesheet"||i.removeChild(b),b=j}}else i==="body"&&Hi(t.ownerDocument.body);i=x}while(i);zl(a)}function ny(t,a){var i=t;t=0;do{var u=i.nextSibling;if(i.nodeType===1?a?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(a?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),u&&u.nodeType===8)if(i=u.data,i==="/$"){if(t===0)break;t--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||t++;i=u}while(i)}function rm(t){var a=t.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var i=a;switch(a=a.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":rm(i),yr(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}t.removeChild(i)}}function lj(t,a,i,u){for(;t.nodeType===1;){var x=i;if(t.nodeName.toLowerCase()!==a.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[qn])switch(a){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(b=t.getAttribute("rel"),b==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(b!==x.rel||t.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||t.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||t.getAttribute("title")!==(x.title==null?null:x.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(b=t.getAttribute("src"),(b!==(x.src==null?null:x.src)||t.getAttribute("type")!==(x.type==null?null:x.type)||t.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&b&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(a==="input"&&t.type==="hidden"){var b=x.name==null?null:""+x.name;if(x.type==="hidden"&&t.getAttribute("name")===b)return t}else return t;if(t=Ra(t.nextSibling),t===null)break}return null}function ij(t,a,i){if(a==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=Ra(t.nextSibling),t===null))return null;return t}function ay(t,a){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Ra(t.nextSibling),t===null))return null;return t}function sm(t){return t.data==="$?"||t.data==="$~"}function lm(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function oj(t,a){var i=t.ownerDocument;if(t.data==="$~")t._reactRetry=a;else if(t.data!=="$?"||i.readyState!=="loading")a();else{var u=function(){a(),i.removeEventListener("DOMContentLoaded",u)};i.addEventListener("DOMContentLoaded",u),t._reactRetry=u}}function Ra(t){for(;t!=null;t=t.nextSibling){var a=t.nodeType;if(a===1||a===3)break;if(a===8){if(a=t.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return t}var im=null;function ry(t){t=t.nextSibling;for(var a=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"||i==="/&"){if(a===0)return Ra(t.nextSibling);a--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||a++}t=t.nextSibling}return null}function sy(t){t=t.previousSibling;for(var a=0;t;){if(t.nodeType===8){var i=t.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(a===0)return t;a--}else i!=="/$"&&i!=="/&"||a++}t=t.previousSibling}return null}function ly(t,a,i){switch(a=$c(i),t){case"html":if(t=a.documentElement,!t)throw Error(s(452));return t;case"head":if(t=a.head,!t)throw Error(s(453));return t;case"body":if(t=a.body,!t)throw Error(s(454));return t;default:throw Error(s(451))}}function Hi(t){for(var a=t.attributes;a.length;)t.removeAttributeNode(a[0]);yr(t)}var _a=new Map,iy=new Set;function Bc(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Lr=P.d;P.d={f:cj,r:uj,D:dj,C:fj,L:mj,m:hj,X:gj,S:pj,M:xj};function cj(){var t=Lr.f(),a=Rc();return t||a}function uj(t){var a=er(t);a!==null&&a.tag===5&&a.type==="form"?j0(a):Lr.r(t)}var Ll=typeof document>"u"?null:document;function oy(t,a,i){var u=Ll;if(u&&typeof a=="string"&&a){var x=an(a);x='link[rel="'+t+'"][href="'+x+'"]',typeof i=="string"&&(x+='[crossorigin="'+i+'"]'),iy.has(x)||(iy.add(x),t={rel:t,crossOrigin:i,href:a},u.querySelector(x)===null&&(a=u.createElement("link"),Mn(a,"link",t),It(a),u.head.appendChild(a)))}}function dj(t){Lr.D(t),oy("dns-prefetch",t,null)}function fj(t,a){Lr.C(t,a),oy("preconnect",t,a)}function mj(t,a,i){Lr.L(t,a,i);var u=Ll;if(u&&t&&a){var x='link[rel="preload"][as="'+an(a)+'"]';a==="image"&&i&&i.imageSrcSet?(x+='[imagesrcset="'+an(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(x+='[imagesizes="'+an(i.imageSizes)+'"]')):x+='[href="'+an(t)+'"]';var b=x;switch(a){case"style":b=Ol(t);break;case"script":b=Dl(t)}_a.has(b)||(t=y({rel:"preload",href:a==="image"&&i&&i.imageSrcSet?void 0:t,as:a},i),_a.set(b,t),u.querySelector(x)!==null||a==="style"&&u.querySelector(Pi(b))||a==="script"&&u.querySelector(Fi(b))||(a=u.createElement("link"),Mn(a,"link",t),It(a),u.head.appendChild(a)))}}function hj(t,a){Lr.m(t,a);var i=Ll;if(i&&t){var u=a&&typeof a.as=="string"?a.as:"script",x='link[rel="modulepreload"][as="'+an(u)+'"][href="'+an(t)+'"]',b=x;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":b=Dl(t)}if(!_a.has(b)&&(t=y({rel:"modulepreload",href:t},a),_a.set(b,t),i.querySelector(x)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Fi(b)))return}u=i.createElement("link"),Mn(u,"link",t),It(u),i.head.appendChild(u)}}}function pj(t,a,i){Lr.S(t,a,i);var u=Ll;if(u&&t){var x=An(u).hoistableStyles,b=Ol(t);a=a||"default";var j=x.get(b);if(!j){var _={loading:0,preload:null};if(j=u.querySelector(Pi(b)))_.loading=5;else{t=y({rel:"stylesheet",href:t,"data-precedence":a},i),(i=_a.get(b))&&om(t,i);var q=j=u.createElement("link");It(q),Mn(q,"link",t),q._p=new Promise(function(ee,de){q.onload=ee,q.onerror=de}),q.addEventListener("load",function(){_.loading|=1}),q.addEventListener("error",function(){_.loading|=2}),_.loading|=4,Hc(j,a,u)}j={type:"stylesheet",instance:j,count:1,state:_},x.set(b,j)}}}function gj(t,a){Lr.X(t,a);var i=Ll;if(i&&t){var u=An(i).hoistableScripts,x=Dl(t),b=u.get(x);b||(b=i.querySelector(Fi(x)),b||(t=y({src:t,async:!0},a),(a=_a.get(x))&&cm(t,a),b=i.createElement("script"),It(b),Mn(b,"link",t),i.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},u.set(x,b))}}function xj(t,a){Lr.M(t,a);var i=Ll;if(i&&t){var u=An(i).hoistableScripts,x=Dl(t),b=u.get(x);b||(b=i.querySelector(Fi(x)),b||(t=y({src:t,async:!0,type:"module"},a),(a=_a.get(x))&&cm(t,a),b=i.createElement("script"),It(b),Mn(b,"link",t),i.head.appendChild(b)),b={type:"script",instance:b,count:1,state:null},u.set(x,b))}}function cy(t,a,i,u){var x=(x=le.current)?Bc(x):null;if(!x)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(a=Ol(i.href),i=An(x).hoistableStyles,u=i.get(a),u||(u={type:"style",instance:null,count:0,state:null},i.set(a,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){t=Ol(i.href);var b=An(x).hoistableStyles,j=b.get(t);if(j||(x=x.ownerDocument||x,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},b.set(t,j),(b=x.querySelector(Pi(t)))&&!b._p&&(j.instance=b,j.state.loading=5),_a.has(t)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},_a.set(t,i),b||yj(x,t,i,j.state))),a&&u===null)throw Error(s(528,""));return j}if(a&&u!==null)throw Error(s(529,""));return null;case"script":return a=i.async,i=i.src,typeof i=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Dl(i),i=An(x).hoistableScripts,u=i.get(a),u||(u={type:"script",instance:null,count:0,state:null},i.set(a,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function Ol(t){return'href="'+an(t)+'"'}function Pi(t){return'link[rel="stylesheet"]['+t+"]"}function uy(t){return y({},t,{"data-precedence":t.precedence,precedence:null})}function yj(t,a,i,u){t.querySelector('link[rel="preload"][as="style"]['+a+"]")?u.loading=1:(a=t.createElement("link"),u.preload=a,a.addEventListener("load",function(){return u.loading|=1}),a.addEventListener("error",function(){return u.loading|=2}),Mn(a,"link",i),It(a),t.head.appendChild(a))}function Dl(t){return'[src="'+an(t)+'"]'}function Fi(t){return"script[async]"+t}function dy(t,a,i){if(a.count++,a.instance===null)switch(a.type){case"style":var u=t.querySelector('style[data-href~="'+an(i.href)+'"]');if(u)return a.instance=u,It(u),u;var x=y({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),It(u),Mn(u,"style",x),Hc(u,i.precedence,t),a.instance=u;case"stylesheet":x=Ol(i.href);var b=t.querySelector(Pi(x));if(b)return a.state.loading|=4,a.instance=b,It(b),b;u=uy(i),(x=_a.get(x))&&om(u,x),b=(t.ownerDocument||t).createElement("link"),It(b);var j=b;return j._p=new Promise(function(_,q){j.onload=_,j.onerror=q}),Mn(b,"link",u),a.state.loading|=4,Hc(b,i.precedence,t),a.instance=b;case"script":return b=Dl(i.src),(x=t.querySelector(Fi(b)))?(a.instance=x,It(x),x):(u=i,(x=_a.get(b))&&(u=y({},i),cm(u,x)),t=t.ownerDocument||t,x=t.createElement("script"),It(x),Mn(x,"link",u),t.head.appendChild(x),a.instance=x);case"void":return null;default:throw Error(s(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(u=a.instance,a.state.loading|=4,Hc(u,i.precedence,t));return a.instance}function Hc(t,a,i){for(var u=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=u.length?u[u.length-1]:null,b=x,j=0;j<u.length;j++){var _=u[j];if(_.dataset.precedence===a)b=_;else if(b!==x)break}b?b.parentNode.insertBefore(t,b.nextSibling):(a=i.nodeType===9?i.head:i,a.insertBefore(t,a.firstChild))}function om(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.title==null&&(t.title=a.title)}function cm(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.integrity==null&&(t.integrity=a.integrity)}var Pc=null;function fy(t,a,i){if(Pc===null){var u=new Map,x=Pc=new Map;x.set(i,u)}else x=Pc,u=x.get(i),u||(u=new Map,x.set(i,u));if(u.has(t))return u;for(u.set(t,null),i=i.getElementsByTagName(t),x=0;x<i.length;x++){var b=i[x];if(!(b[qn]||b[bt]||t==="link"&&b.getAttribute("rel")==="stylesheet")&&b.namespaceURI!=="http://www.w3.org/2000/svg"){var j=b.getAttribute(a)||"";j=t+j;var _=u.get(j);_?_.push(b):u.set(j,[b])}}return u}function my(t,a,i){t=t.ownerDocument||t,t.head.insertBefore(i,a==="title"?t.querySelector("head > title"):null)}function bj(t,a,i){if(i===1||a.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(t=a.disabled,typeof a.precedence=="string"&&t==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function hy(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function vj(t,a,i,u){if(i.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var x=Ol(u.href),b=a.querySelector(Pi(x));if(b){a=b._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(t.count++,t=Fc.bind(t),a.then(t,t)),i.state.loading|=4,i.instance=b,It(b);return}b=a.ownerDocument||a,u=uy(u),(x=_a.get(x))&&om(u,x),b=b.createElement("link"),It(b);var j=b;j._p=new Promise(function(_,q){j.onload=_,j.onerror=q}),Mn(b,"link",u),i.instance=b}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(i,a),(a=i.state.preload)&&(i.state.loading&3)===0&&(t.count++,i=Fc.bind(t),a.addEventListener("load",i),a.addEventListener("error",i))}}var um=0;function kj(t,a){return t.stylesheets&&t.count===0&&Vc(t,t.stylesheets),0<t.count||0<t.imgCount?function(i){var u=setTimeout(function(){if(t.stylesheets&&Vc(t,t.stylesheets),t.unsuspend){var b=t.unsuspend;t.unsuspend=null,b()}},6e4+a);0<t.imgBytes&&um===0&&(um=62500*tj());var x=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Vc(t,t.stylesheets),t.unsuspend)){var b=t.unsuspend;t.unsuspend=null,b()}},(t.imgBytes>um?50:800)+a);return t.unsuspend=i,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(x)}}:null}function Fc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Vc(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var qc=null;function Vc(t,a){t.stylesheets=null,t.unsuspend!==null&&(t.count++,qc=new Map,a.forEach(wj,t),qc=null,Fc.call(t))}function wj(t,a){if(!(a.state.loading&4)){var i=qc.get(t);if(i)var u=i.get(null);else{i=new Map,qc.set(t,i);for(var x=t.querySelectorAll("link[data-precedence],style[data-precedence]"),b=0;b<x.length;b++){var j=x[b];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(i.set(j.dataset.precedence,j),u=j)}u&&i.set(null,u)}x=a.instance,j=x.getAttribute("data-precedence"),b=i.get(j)||u,b===u&&i.set(null,x),i.set(j,x),this.count++,u=Fc.bind(this),x.addEventListener("load",u),x.addEventListener("error",u),b?b.parentNode.insertBefore(x,b.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(x,t.firstChild)),a.state.loading|=4}}var qi={$$typeof:I,Provider:null,Consumer:null,_currentValue:ce,_currentValue2:ce,_threadCount:0};function Sj(t,a,i,u,x,b,j,_,q){this.tag=1,this.containerInfo=t,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=Pn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pn(0),this.hiddenUpdates=Pn(null),this.identifierPrefix=u,this.onUncaughtError=x,this.onCaughtError=b,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=q,this.incompleteTransitions=new Map}function py(t,a,i,u,x,b,j,_,q,ee,de,me){return t=new Sj(t,a,i,j,q,ee,de,me,_),a=1,b===!0&&(a|=24),b=ra(3,null,null,a),t.current=b,b.stateNode=t,a=Pd(),a.refCount++,t.pooledCache=a,a.refCount++,b.memoizedState={element:u,isDehydrated:i,cache:a},Gd(b),t}function gy(t){return t?(t=ml,t):ml}function xy(t,a,i,u,x,b){x=gy(x),u.context===null?u.context=x:u.pendingContext=x,u=es(a),u.payload={element:i},b=b===void 0?null:b,b!==null&&(u.callback=b),i=ts(t,u,a),i!==null&&(Qn(i,t,a),wi(i,t,a))}function yy(t,a){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<a?i:a}}function dm(t,a){yy(t,a),(t=t.alternate)&&yy(t,a)}function by(t){if(t.tag===13||t.tag===31){var a=Os(t,67108864);a!==null&&Qn(a,t,67108864),dm(t,67108864)}}function vy(t){if(t.tag===13||t.tag===31){var a=ca();a=Qe(a);var i=Os(t,a);i!==null&&Qn(i,t,a),dm(t,a)}}var Gc=!0;function jj(t,a,i,u){var x=F.T;F.T=null;var b=P.p;try{P.p=2,fm(t,a,i,u)}finally{P.p=b,F.T=x}}function Nj(t,a,i,u){var x=F.T;F.T=null;var b=P.p;try{P.p=8,fm(t,a,i,u)}finally{P.p=b,F.T=x}}function fm(t,a,i,u){if(Gc){var x=mm(u);if(x===null)Zf(t,a,u,Wc,i),wy(t,u);else if(Tj(x,t,a,i,u))u.stopPropagation();else if(wy(t,u),a&4&&-1<Cj.indexOf(t)){for(;x!==null;){var b=er(x);if(b!==null)switch(b.tag){case 3:if(b=b.stateNode,b.current.memoizedState.isDehydrated){var j=Ut(b.pendingLanes);if(j!==0){var _=b;for(_.pendingLanes|=2,_.entangledLanes|=2;j;){var q=1<<31-Ze(j);_.entanglements[1]|=q,j&=~q}or(b),(gt&6)===0&&(Ec=Xe()+500,Ui(0))}}break;case 31:case 13:_=Os(b,2),_!==null&&Qn(_,b,2),Rc(),dm(b,2)}if(b=mm(u),b===null&&Zf(t,a,u,Wc,i),b===x)break;x=b}x!==null&&u.stopPropagation()}else Zf(t,a,u,null,i)}}function mm(t){return t=As(t),hm(t)}var Wc=null;function hm(t){if(Wc=null,t=Pa(t),t!==null){var a=c(t);if(a===null)t=null;else{var i=a.tag;if(i===13){if(t=d(a),t!==null)return t;t=null}else if(i===31){if(t=f(a),t!==null)return t;t=null}else if(i===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;t=null}else a!==t&&(t=null)}}return Wc=t,null}function ky(t){switch(t){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"resize":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"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"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ba()){case ue:return 2;case ye:return 8;case Ne:case He:return 32;case De:return 268435456;default:return 32}default:return 32}}var pm=!1,fs=null,ms=null,hs=null,Vi=new Map,Gi=new Map,ps=[],Cj="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 wy(t,a){switch(t){case"focusin":case"focusout":fs=null;break;case"dragenter":case"dragleave":ms=null;break;case"mouseover":case"mouseout":hs=null;break;case"pointerover":case"pointerout":Vi.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gi.delete(a.pointerId)}}function Wi(t,a,i,u,x,b){return t===null||t.nativeEvent!==b?(t={blockedOn:a,domEventName:i,eventSystemFlags:u,nativeEvent:b,targetContainers:[x]},a!==null&&(a=er(a),a!==null&&by(a)),t):(t.eventSystemFlags|=u,a=t.targetContainers,x!==null&&a.indexOf(x)===-1&&a.push(x),t)}function Tj(t,a,i,u,x){switch(a){case"focusin":return fs=Wi(fs,t,a,i,u,x),!0;case"dragenter":return ms=Wi(ms,t,a,i,u,x),!0;case"mouseover":return hs=Wi(hs,t,a,i,u,x),!0;case"pointerover":var b=x.pointerId;return Vi.set(b,Wi(Vi.get(b)||null,t,a,i,u,x)),!0;case"gotpointercapture":return b=x.pointerId,Gi.set(b,Wi(Gi.get(b)||null,t,a,i,u,x)),!0}return!1}function Sy(t){var a=Pa(t.target);if(a!==null){var i=c(a);if(i!==null){if(a=i.tag,a===13){if(a=d(i),a!==null){t.blockedOn=a,Sn(t.priority,function(){vy(i)});return}}else if(a===31){if(a=f(i),a!==null){t.blockedOn=a,Sn(t.priority,function(){vy(i)});return}}else if(a===3&&i.stateNode.current.memoizedState.isDehydrated){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Kc(t){if(t.blockedOn!==null)return!1;for(var a=t.targetContainers;0<a.length;){var i=mm(t.nativeEvent);if(i===null){i=t.nativeEvent;var u=new i.constructor(i.type,i);ja=u,i.target.dispatchEvent(u),ja=null}else return a=er(i),a!==null&&by(a),t.blockedOn=i,!1;a.shift()}return!0}function jy(t,a,i){Kc(t)&&i.delete(a)}function Mj(){pm=!1,fs!==null&&Kc(fs)&&(fs=null),ms!==null&&Kc(ms)&&(ms=null),hs!==null&&Kc(hs)&&(hs=null),Vi.forEach(jy),Gi.forEach(jy)}function Yc(t,a){t.blockedOn===a&&(t.blockedOn=null,pm||(pm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,Mj)))}var Qc=null;function Ny(t){Qc!==t&&(Qc=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Qc===t&&(Qc=null);for(var a=0;a<t.length;a+=3){var i=t[a],u=t[a+1],x=t[a+2];if(typeof u!="function"){if(hm(u||i)===null)continue;break}var b=er(i);b!==null&&(t.splice(a,3),a-=3,mf(b,{pending:!0,data:x,method:i.method,action:u},u,x))}}))}function zl(t){function a(q){return Yc(q,t)}fs!==null&&Yc(fs,t),ms!==null&&Yc(ms,t),hs!==null&&Yc(hs,t),Vi.forEach(a),Gi.forEach(a);for(var i=0;i<ps.length;i++){var u=ps[i];u.blockedOn===t&&(u.blockedOn=null)}for(;0<ps.length&&(i=ps[0],i.blockedOn===null);)Sy(i),i.blockedOn===null&&ps.shift();if(i=(t.ownerDocument||t).$$reactFormReplay,i!=null)for(u=0;u<i.length;u+=3){var x=i[u],b=i[u+1],j=x[Kt]||null;if(typeof b=="function")j||Ny(i);else if(j){var _=null;if(b&&b.hasAttribute("formAction")){if(x=b,j=b[Kt]||null)_=j.formAction;else if(hm(x)!==null)continue}else _=j.action;typeof _=="function"?i[u+1]=_:(i.splice(u,3),u-=3),Ny(i)}}}function Cy(){function t(b){b.canIntercept&&b.info==="react-transition"&&b.intercept({handler:function(){return new Promise(function(j){return x=j})},focusReset:"manual",scroll:"manual"})}function a(){x!==null&&(x(),x=null),u||setTimeout(i,20)}function i(){if(!u&&!navigation.transition){var b=navigation.currentEntry;b&&b.url!=null&&navigation.navigate(b.url,{state:b.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,x=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(i,100),function(){u=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),x!==null&&(x(),x=null)}}}function gm(t){this._internalRoot=t}Xc.prototype.render=gm.prototype.render=function(t){var a=this._internalRoot;if(a===null)throw Error(s(409));var i=a.current,u=ca();xy(i,u,t,a,null,null)},Xc.prototype.unmount=gm.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var a=t.containerInfo;xy(t.current,2,null,t,null,null),Rc(),a[fn]=null}};function Xc(t){this._internalRoot=t}Xc.prototype.unstable_scheduleHydration=function(t){if(t){var a=pt();t={blockedOn:null,target:t,priority:a};for(var i=0;i<ps.length&&a!==0&&a<ps[i].priority;i++);ps.splice(i,0,t),i===0&&Sy(t)}};var Ty=n.version;if(Ty!=="19.2.7")throw Error(s(527,Ty,"19.2.7"));P.findDOMNode=function(t){var a=t._reactInternals;if(a===void 0)throw typeof t.render=="function"?Error(s(188)):(t=Object.keys(t).join(","),Error(s(268,t)));return t=h(a),t=t!==null?p(t):null,t=t===null?null:t.stateNode,t};var Ej={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:F,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Zc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Zc.isDisabled&&Zc.supportsFiber)try{$t=Zc.inject(Ej),Ke=Zc}catch{}}return Yi.createRoot=function(t,a){if(!o(t))throw Error(s(299));var i=!1,u="",x=L0,b=O0,j=D0;return a!=null&&(a.unstable_strictMode===!0&&(i=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(x=a.onUncaughtError),a.onCaughtError!==void 0&&(b=a.onCaughtError),a.onRecoverableError!==void 0&&(j=a.onRecoverableError)),a=py(t,1,!1,null,null,i,u,null,x,b,j,Cy),t[fn]=a.current,Xf(t),new gm(a)},Yi.hydrateRoot=function(t,a,i){if(!o(t))throw Error(s(299));var u=!1,x="",b=L0,j=O0,_=D0,q=null;return i!=null&&(i.unstable_strictMode===!0&&(u=!0),i.identifierPrefix!==void 0&&(x=i.identifierPrefix),i.onUncaughtError!==void 0&&(b=i.onUncaughtError),i.onCaughtError!==void 0&&(j=i.onCaughtError),i.onRecoverableError!==void 0&&(_=i.onRecoverableError),i.formState!==void 0&&(q=i.formState)),a=py(t,1,!0,a,i??null,u,x,q,b,j,_,Cy),a.context=gy(null),i=a.current,u=ca(),u=Qe(u),x=es(u),x.callback=null,ts(i,x,u),i=u,a.current.lanes=i,xn(a,i),or(a),t[fn]=a.current,Xf(t),new Xc(a)},Yi.version="19.2.7",Yi}var zy;function Uj(){if(zy)return bm.exports;zy=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(n){console.error(n)}}return e(),bm.exports=zj(),bm.exports}var $j=Uj();const mv={appName:"PenguinHarness",nav:{chat:"对话",newChat:"新对话",agents:"智能体",skills:"技能库",models:"模型库",usage:"成本中心",traces:"轨迹观测",benchmark:"评估中心",lastConversation:"最近一次对话",collapseSidebar:"收起侧栏",expandSidebar:"展开侧栏",collapseGroup:"折叠",expandGroup:"展开",pinGroup:"置顶分组",unpinGroup:"取消置顶"},settings:{language:"语言",showCliSessions:"显示 CLI 会话",theme:"主题",themeLight:"浅色",themeDark:"深色",followSystem:"跟随系统",langZh:"中文",langEn:"English",fontSize:"字号",fontSmall:"小",fontMedium:"中",fontLarge:"大",accent:"主题色",accentNames:{neutral:"灰白",blue:"蓝",green:"绿",violet:"紫",rose:"红",amber:"橙"}},update:{lastUpdated:e=>`最近更新日期 ${e}`,newVersionBadge:"有新版本可用",newVersion:e=>`新版本 v${e} 可用`,checkNow:"检查更新",checking:"检查中…",foundNew:e=>`发现新版本 v${e},点击下方更新入口即可安装`,upToDate:"已是最新版本",checkFailed:"检查更新失败,请稍后重试",checkDisabled:"更新检查已关闭(PENGUIN_UPDATE_CHECK=off)",releaseNotes:"更新说明",updateNow:"立即更新",updating:"更新中…",updated:"更新完成,重启服务后生效",restartHint:"在终端重新运行 penguin web(或 penguin server)即可完成重启",failed:"更新失败",unsupported:"当前安装方式不支持在线更新",confirmBody:"将下载最新版本并安装到服务器上的安装目录(数据目录不受影响)。安装完成后需要重启服务才会生效。",adminOnly:"只有管理员可以在这里执行更新。"},common:{save:"保存",cancel:"取消",create:"创建",delete:"删除",edit:"编辑",settings:"设置",confirm:"确认",close:"关闭",loading:"加载中…",saved:"已保存",saving:"保存中…",noChangesToSave:"当前没有需要保存的修改",confirmSaveTitle:"保存修改",confirmSaveBody:"确定保存这些修改吗?修改将写入服务器上的配置文件。",none:"(无)",retry:"重试",unknownError:"请求失败,请稍后重试",requiredField:"此项必填",copied:"已复制",name:"名称",username:"用户名",role:"角色",actions:"操作",created:"创建时间",cost:"成本",time:"时间"},auth:{usernameHint:"2~32 位:小写字母开头,仅小写字母、数字与下划线",password:"密码",passwordHint:"至少 8 个字符",showPassword:"显示密码",hidePassword:"隐藏密码",login:"登录",logout:"登出",admin:"管理员",defaultAdminNote:"首次使用请以内置管理员登录:admin / penguin-2026,登录后请尽快修改密码"},account:{changePassword:"修改密码",oldPassword:"当前密码",oldPasswordHint:"内置管理员的默认初始密码为 penguin-2026",newPassword:"新密码",confirmPassword:"确认新密码",passwordMismatch:"两次输入的新密码不一致",initialPasswordBanner:"当前账号正在使用初始密码,建议尽快修改",changeNow:"去修改"},admin:{users:"用户管理",roleAdmin:"管理员",roleUser:"用户",createUser:"新增用户",initialPassword:"初始密码",initialPasswordFlag:"初始密码",defaultProjectNote:e=>`将自动创建默认 Project:${e}`,resetPassword:"重置密码",resetPasswordTitle:e=>`重置 ${e} 的密码`,resetPasswordNote:"重置后该用户的登录会话全部失效,需用新密码重新登录",deleteUserTitle:e=>`删除用户 ${e}`,deleteUserConfirm:e=>`将删除用户 ${e} 及其名下全部 Project(含数据目录),不可恢复。`},project:{switcher:"Project",create:"新建 Project",createTitle:"新建 Project",id:"Project id",idHint:"2~64 位:小写字母开头,仅小写字母、数字与下划线;创建后不可修改",idPrefixHint:"id 固定以「用户名-」为前缀,后接小写字母、数字或下划线;创建后不可修改",name:"显示名(可选,缺省为 Project id)",displayName:"显示名",settings:"Project 设置",settingsTitle:"Project 设置",members:"成员",addMember:"添加成员",removeMember:"移除",deleteProject:"删除 Project",deleteConfirm:"确认删除该 Project?项目目录将被递归删除,不可恢复。",deleteDefaultForbidden:"default_project 与 CLI 共用,不允许在 Web 端删除",deleteLastForbidden:"这是当前账号最后一个 Project,删除后将无 Project 可用;请先创建新的 Project",noCredentialTitle:"尚未配置模型 credential",noCredentialBody:"当前 Project 的默认模型尚未配置 API key,发起对话前请先前往模型页配置。",goToModels:"前往模型页",later:"稍后再说"},agent:{listTitle:"Agents",create:"创建 Agent",createTitle:"创建 Agent",id:"Agent id",idHint:"2~64 位:小写字母开头,仅小写字母、数字与下划线;创建后不可修改",nameHint:"留空则使用 Agent id 作为名称",description:"描述",activeSessions:"活跃 Session",sessionCount:e=>`${e} 个 Session`,toolCount:e=>`${e} 个工具`,vaultKeyCount:e=>`${e} 个密钥`,scheduleCount:e=>`${e} 个定时任务`,updatedAt:"最后修改",activity:e=>`近 ${e} 天 Session 活跃度`,settings:"Agent 设置",backToList:"返回 Agents",tabOverview:"概览",tabPrompt:"Prompt",tabRuntime:"运行参数",tabTools:"工具",tabVault:"密钥保险柜",tabSchedules:"定时任务",stateDir:"State 路径",agentsMd:"AGENTS.md",systemPrompt:"system_prompt 模板",placeholdersTitle:"可用占位符(点击插入)",insertPlaceholder:"插入到 system_prompt 光标处",placeholders:[["{{AGENTS_MD}}","注入 AGENTS.md 内容"],["{{VAULT_KEYS}}","注入密钥保险柜的键名小节(无键时为空)"],["{{SKILL_METADATA}}","注入已安装 Skill 的元数据行(无 Skill 时为空)"],["{{PLATFORM}}","运行平台"],["{{OS_VERSION}}","操作系统版本"],["{{DATE}}","当前日期"],["{{PROJECT_DIR}}","PenguinHarness 应用数据根目录(存放全部 Agent 数据与 Project 级数据;不是本次任务的工作目录)"],["{{AGENT_ID}}","当前 Agent id"],["{{CWD}}","Workspace 绝对路径"],["{{PROVIDER}}","模型 provider 分组"],["{{MODEL_ID}}","上游模型 id"],["{{SESSION_ID}}","当前 Session id"]],maxTurns:"max_turns(单 Task 最大轮次,-1 不限制)",maxTokens:"model.max_tokens",thinkingLevel:"model.thinking_level",thinkingLevelOptions:[["","不提交覆盖值,沿用当前生效的配置。"],["low","开启较低强度的扩展推理。"],["medium","开启中等强度的扩展推理(新建 Agent 的缺省档位)。"],["high","开启较高强度的扩展推理,响应更慢。"],["xhigh","开启最高强度的扩展推理,部分模型上效果与 high 相同。"]],thinkingLevelNoneKept:"已存的历史档位:新选择不再提供关闭档(多数模型不支持关闭思考)。",timeoutMs:"model.timeoutMs",timeoutMsHint:"单次 Request 超时,毫秒",compaction:"上下文压缩(compaction)",maxContextLength:"max_context_length",maxContextLengthHint:"触发压缩的上下文阈值",maxSessionTurns:"max_session_turns",maxSessionTurnsHint:"触发压缩的轮数阈值",compactionMode:"mode(压缩方式)",compactionModeOptions:[["","不提交覆盖值,沿用当前生效的配置。"],["summarize","先让模型为旧上下文生成摘要,再从摘要续接新的上下文窗口(缺省)。"],["discard","不生成摘要,直接丢弃旧上下文,下一轮从新窗口重新开始。"]],compactionPrompt:"prompt(摘要提示词)",maxTurnsInvalid:"max_turns 必须 > 0 或为 -1",timeoutInvalid:"timeoutMs 必须 > 0 或为 -1",toolFieldInvalid:(e,n)=>`${e}: ${n} 必须是 > 0 的整数或 -1`,toolPermission:"permission",permissionReadLabel:"Read-only",permissionReadDescription:"仅读取。审批模式为 read-only 时自动放行,无需确认。",permissionReadWriteLabel:"Read & write",permissionReadWriteDescription:"可修改。审批模式为 read-only 时需人工确认。",toolTimeout:"timeoutMs",toolMaxOutput:"maxOutputLength",toolCallDescription:"call_description",callDescriptionHint:"call_description:开启(缺省)时该工具的 schema 保留可选的 description 参数——模型为每次调用写一句说明,运行期间展示给用户;关闭则装配时从 schema 滤除该参数。仅参数中定义了 description 属性的工具可切换。",mcpServers:"MCP Server(只读)",defaultValue:"(缺省)",deleteAgent:"删除 Agent",builtinUndeletable:"内置 Agent 不可被删除",deleteConfirm:e=>`确认删除 Agent「${e}」?其目录(含全部 Trace)将被递归删除,不可恢复。`,stateVersion:"Agent State 版本",transferTitle:"导出 / 导入",transferDesc:"导出当前 Agent State 快照包(tar.gz);导入整目录覆盖,并以包内版本为准。",exportSnapshot:"导出快照",importSnapshot:"导入快照",importing:"导入中…",importDone:e=>`导入完成,Agent State 版本 v${e}`,importConflictTitle:"版本冲突",importConflictBody:"快照包版本不高于当前版本,导入将覆盖现有 Agent State。确认继续?",resetConfigTitle:"还原为默认配置",resetConfigDesc:"把 system_config.yaml 还原为当前内置默认值(与 Skill 更新同语义):自定义的系统提示词、工具列表、模型/压缩参数与 MCP Server 将被覆盖,仅保留名称、描述与版本号。",resetConfigAction:"还原为默认配置",resetConfigConfirmBody:"此操作会用当前默认值覆盖该 Agent 的现有配置:自定义系统提示词、工具列表、模型/压缩参数与 MCP Server 全部被替换,仅保留名称与描述。与 Skill 更新一样不可撤销,确认继续?",resetConfigDone:"配置已还原为当前默认值"},models:{title:"模型配置",addCustom:"添加自定义模型",addToGroup:"新增模型",editTitle:"模型配置",addTitle:"新增模型(OpenAI 协议)",addTitleVendor:"新增模型",addProtocolHint:"新增模型固定走 OpenAI Chat Completions 兼容协议(不按模型 id 自动路由),base URL 填其兼容端点",addAutoRouteHint:"该分组的新模型按上游 id 由 AgentHub 自动路由到厂商官方客户端:base URL 留空即官方端点,API key 留空按解析出的客户端读取环境变量",baseUrlOfficialNote:"注意:该模型走厂商官方协议——自定义 base URL 必须是兼容官方协议的端点,不会因此切换为 OpenAI 协议",autoRouteNone:"该 id 无法被 AgentHub 自动路由:请核对 id,或改在 Custom / 自建分组下以 OpenAI 协议接入",addGroup:"新增分组",addGroupTitle:"新增分组",addGroupDesc:"自建分组与 Custom 同语义:组内模型走 OpenAI Chat Completions 兼容协议(base URL 必填,API key 留空读取 OPENAI_API_KEY)。分组由模型条目承载,保存首个模型后即出现。",groupNameLabel:"分组名",groupNameHint:"小写字母 / 数字开头,可含 - 与 _",groupNameInvalid:"分组名只能用小写字母、数字、- 与 _(首字符为字母或数字),长度不超过 32",groupNameExists:"该分组名已被内置分组或既有条目占用",groupEmptyHint:"该分组暂无模型,点「新增模型」添加",searchPlaceholder:"搜索模型:id / 名称 / 厂商",noSearchResults:"没有匹配的模型",syncCatalog:"同步预置",syncCatalogHint:"用内置目录更新预置模型:新增缺失条目、以目录字段为准刷新差异;本地新增模型与 API key 保持不变",syncDone:(e,n)=>`预置模型已同步:新增 ${e}、更新 ${n}`,syncUpToDate:"预置模型已是最新",homepage:"模型主页",speedTest:"测速",speedTestTitle:"分组测速",speedTestConfirm:e=>`将对该分组的 ${e} 个模型逐个发起一次真实请求,测量首 token 延迟(TTFT)与输出速率(TPS),会消耗少量 API 额度。是否继续?`,speedTestStart:"开始测速",speedPending:"测速中…",speedFailed:"测速失败",ttftTitle:"首 token 延迟(TTFT)",tpsTitle:"输出速率(TPS)",modelCount:e=>`${e} 个模型`,modelId:"模型 ID",modelIdHint:"上游 API 使用的模型 id,如 gpt-5.5",displayName:"模型名称",displayNameHint:"留空则展示模型 ID",providerGroup:"分组",contextWindow:"上下文窗口",tokenUnit:"Token",contextWindowHint:"留空表示未知",maxTokens:"最大输出长度",maxTokensHint:"留空沿用 Agent 设置",maxTokensTitle:"按模型限制单次请求的最大输出 Token 数;留空沿用 Agent 设置,小上下文模型建议调低",maxTokensInvalid:"必须为正整数",clientTypeLocked:e=>`协议:${e}(沿用原配置,不可修改)`,vision:"支持视觉",visionOffProxyHint:"使用视觉代理模型读图",visionBadge:"视觉",freeBadge:"免费",visionModelBadge:"视觉代理",setVisionModel:"设为视觉代理模型",visionModelHint:"供不支持图片的模型经 describe_image 代读图片",priceUnitShort:"/M tok",testConnection:"测试连通性",testing:"测试中…",testOk:e=>`连通正常(${e} ms)`,testFailed:e=>`连通失败:${e}`,priceCacheRead:"缓存读取价格",priceCacheWrite:"缓存写入价格",priceOutput:"输出价格",currency:"币种",currencyUsd:"美元 $",currencyCny:"人民币 ¥",apiKey:"API key",apiKeyKeepHint:"留空保留现有 key",apiKeyEnvHint:e=>`留空则使用环境变量 ${e}`,keyConfigured:"已配置 key",clearApiKey:"清除已存 API key",baseUrl:"自定义 base URL",baseUrlHint:"留空使用厂商默认地址",baseUrlRequired:"必须填写 base URL",contextWindowDefaultHint:e=>`留空按 ${e} 计`,confirmDeleteTitle:"删除模型",confirmDelete:e=>`确定删除「${e}」?该模型的配置与 API key 将一并移除。`,groupApiKey:"统一配置 API key",groupApiKeyTitle:e=>`为「${e}」统一配置 API key`,groupApiKeyHint:e=>`将写入该分组下全部 ${e} 个模型;留空不改动。`,getApiKey:"获取 API key",getModelIds:"获取模型 id",groupKeyApplied:e=>`已为 ${e} 个模型配置 API key`,providerEnvNotes:{zhipu:"缺省端点为 Z.AI 国际版(api.z.ai);智谱开放平台(bigmodel.cn)的 key 需填 base URL https://open.bigmodel.cn/api/paas/v4",moonshot:"缺省端点为国内版(api.moonshot.cn);platform.kimi.com(国际)的 key 需填 base URL https://api.moonshot.ai/v1"},confirmVisionModelTitle:"设为视觉代理模型",confirmVisionModel:e=>`确定把「${e}」设为视觉代理模型?不支持图片的模型将由它经 describe_image 代读图片。`,confirmSaveTitle:"保存模型配置",confirmSave:e=>`确定保存对「${e}」的配置修改?`,confirmDefaultTitle:"设为默认模型",confirmDefault:e=>`确定把「${e}」设为默认模型?新建的 Session 将默认使用它。`,default:"默认",setDefault:"设为默认模型",remove:"删除模型",readOnlyHint:"member 只读;模型与 credential 修改仅 owner 可执行",empty:"尚未配置任何模型",noKey:"未配置 key",showModelsWithoutKey:e=>`显示未配置 key 的模型(${e} 个)`,modelIdExists:"该模型 id 已存在",pricingAllOrNone:"三项价格需一并填写",pricingInvalid:"必须为数字",contextWindowInvalid:"必须为数字"},vault:{desc:"本 Agent 专属的环境变量(存于 agent_state/.vault.toml):键值对注入其 shell 命令(exec_command)的子进程环境;键名会告知模型,值不进入模型上下文。子 Agent 使用各自的保险柜,不继承。保存后自下一个任务起生效(进行中的任务不受影响)。",key:"键名",value:"值",valueMasked:"值(掩码)",add:"添加",addTitle:"添加环境变量",remove:"删除",deleteTitle:"删除环境变量",deleteConfirm:e=>`确认删除环境变量「${e}」?值不可恢复。`,overwriteTitle:"覆盖已有环境变量",overwriteConfirm:e=>`「${e}」已存在,保存将覆盖原值且不可恢复。`,empty:"尚未配置任何环境变量",readOnlyHint:"member 只读;Vault 修改仅 owner 可执行",keyHint:"字母、数字与下划线,不能以数字开头",keyInvalid:"键名不合法:仅字母、数字与下划线,且不能以数字开头",valueRequired:"值不能为空"},schedule:{desc:"定时任务(agent_state/schedule/*.toml):到点自动向目标 Session 发送 prompt;文件亦可手工编辑,Web 端修改后即时生效。",readOnlyHint:"member 只读;定时任务修改仅 owner 可执行",colStatus:"状态",colPeriod:"周期",colTarget:"目标",colFireTimes:"下次 / 最近触发",colQueued:"排队",statusNames:{active:"生效",disabled:"停用",expired:"已过期",done:"已完成",missed:"已错过",invalid:"无效"},queued:"排队中",once:"一次性",newSession:"新建会话",invalidFiles:"解析失败的文件(已跳过调度)",empty:"尚未配置定时任务",enable:"启用",disable:"停用",addTitle:"新建定时任务",editTitle:e=>`编辑定时任务「${e}」`,nameHint:"即文件名(不含 .toml),创建后不可改",prompt:"Prompt",enabled:"启用",startAt:"开始时间",endAt:"结束时间(可选)",period:"周期",periodPlaceholder:"30m / 12h / 7d,留空为一次性",target:"目标",targetNew:"每次新建会话",targetSession:"绑定 Session",sessionId:"Session id",workspace:"Workspace(可选,留空自动创建)",model:"Model",modelDefault:"Project 默认",deleteTitle:"删除定时任务",deleteConfirm:e=>`确认删除定时任务「${e}」?`},skills:{pageTitle:"技能库",pageDesc:"内置 Skill 库:浏览、快捷调用,或安装到 Agent。",quickInvoke:"快捷调用",quickInvokeText:e=>`使用 ${e} 技能`,manageInstall:"管理安装",manageInstallTitle:e=>`管理安装:${e}`,install:"安装",installed:"已安装",uninstall:"卸载",skillCount:e=>`${e} 个技能`,usedByAgents:e=>e===0?"未被使用":`${e} 个 Agent 在用`,installedToast:(e,n)=>`已将 ${e} 安装到 ${n}`,updateOutdated:e=>`有新版本:更新 ${e} 个 Agent 的安装`,updateAction:"更新",updateConfirmTitle:e=>`更新 ${e}`,updateConfirmWarning:e=>`更新 ${e} 会把库内当前副本重装到各 Agent,覆盖其已安装的文件——对已装技能的本地改动会丢失,如有需要请先导出备份。`,updatedToast:(e,n)=>`已将 ${e} 更新到最新版(${n} 个 Agent)`,uninstalledToast:(e,n)=>`已从 ${n} 卸载 ${e}`,uninstallConfirmTitle:e=>`卸载 ${e}`,uninstallConfirmBody:(e,n)=>`确定从 ${n} 卸载 ${e} 吗?已安装的技能文件(含本地改动)将被删除。`},chat:{newSessionMenu:"新建对话",chooseAgent:"选择 Agent",chooseModel:"选择模型",thinkingLevel:"思考等级",thinkingLevelNames:{none:"无",low:"低",medium:"中",high:"高",xhigh:"极高"},workspaceUseThis:"使用此目录",workspaceUp:"上级目录",workspaceNoSubdirs:"无子目录",workspaceAuto:"自动临时目录",workspaceClear:"改用自动临时目录",workspaceDirInvalid:"目录不存在或无法访问,已回退",groupByWorkspace:"按工作区分组",groupByAgent:"按 Agent 分组",tempWorkspaces:"临时工作区",newSessionInWorkspace:"在此工作区新建对话",draftSubtitle:"最擅长 AI 开发任务的自进化 Agent",exampleFolders:{webapps:"搭建网页应用",agents:"搭建和优化智能体"},exampleTasks:{game:{label:"2D 企鹅雪橇越野小游戏",desc:"可爱南极企鹅滑雪橇跳石头,难度由易到难的 2D 纯前端小游戏",prompt:"做一个可爱的南极企鹅滑雪橇越野 2D 小游戏:按空格键起跳,跃过冰面上迎面而来的石头;开局要足够简单、上手无压力,滑行速度与障碍密度随时间平滑、循序渐进地上升,避免突然变难,实时计分,撞上石头即结束并可一键重新开始。2D 横版画面、可爱卡通风,纯前端实现(单个 HTML 文件即可),界面遵循 web-design 技能。完成后在浏览器里自测一次,确认开局能轻松玩过几秒,并告诉我怎么打开和怎么玩。"},gamecenter:{label:"多智能体搭建小游戏中心",desc:"并行产出 10 个玩法互不重复的纯前端小游戏,配一个统一风格的索引首页",prompt:`用多智能体并行搭建一个网页小游戏中心:10 个玩法互不重复的纯前端小游戏,外加一个索引首页。
|
|
10
|
-
|
|
11
|
-
## 分工方式
|
|
12
|
-
- 先规划这 10 个游戏(例如贪吃蛇、2048、俄罗斯方块、打砖块、扫雷、记忆翻牌、推箱子、太空射击、跳跃平台、节奏点击),确认玩法确实互不重复,并定好统一的目录结构、配色与交互规范。
|
|
13
|
-
- 再把 10 个游戏分派给多个子智能体并行实现,每个子智能体只负责自己的那一个游戏,严格按既定规范产出,互不改动他人的文件。
|
|
14
|
-
|
|
15
|
-
## 每个游戏
|
|
16
|
-
- 独立的 \`games/<slug>/index.html\`,纯前端单文件、file:// 直接打开即可运行,不依赖后端与任何 CDN 资源。
|
|
17
|
-
- 具备开始 / 重新开始、实时计分或计时、失败或通关结算,并同时支持键盘与触摸操作,页面内写明玩法说明。
|
|
18
|
-
- 提供返回索引首页的入口。
|
|
19
|
-
|
|
20
|
-
## 索引首页
|
|
21
|
-
- 根目录 \`index.html\`:卡片网格列出全部 10 个游戏(名称 + 一句话玩法 + 操作方式),点击进入对应游戏。
|
|
22
|
-
- 与所有游戏共用一套设计语言,遵循 web-design 技能。
|
|
23
|
-
|
|
24
|
-
## 收尾
|
|
25
|
-
- 统一验收:10 个游戏玩法确实不重复、风格一致,索引页的链接全部可达。
|
|
26
|
-
- 在浏览器里逐个自测,确认都能开始、能结束、能重开,然后告诉我怎么打开。`},lol:{label:"英雄联盟音乐播放器",desc:"用 SoundCloud Widget API 播放历届 Worlds 主题曲,单文件即开即用",prompt:`用 SoundCloud Widget API(见 https://developers.soundcloud.com/docs/api/html5-widget)做一个英雄联盟 Worlds 主题曲播放器,单文件 index.html,file:// 打开即用。
|
|
27
|
-
|
|
28
|
-
## 技术约束
|
|
29
|
-
- 使用 SC.Widget JS API(widget.load / widget.toggle / widget.setVolume / widget.seekTo),引入 https://w.soundcloud.com/player/api.js
|
|
30
|
-
- iframe 必须可见(180px 高),visual=true color=f0b90b single_active=true
|
|
31
|
-
- 仅包含以下 8 首已确认可播曲目(oEmbed 验证通过),不要添加未经 oEmbed 验证的曲目:
|
|
32
|
-
- Warriors (S4) — soundcloud.com/leagueoflegends/warriors
|
|
33
|
-
- Worlds Collide (S5) — soundcloud.com/leagueoflegends/worlds-collide
|
|
34
|
-
- Legends Never Die (S7) — soundcloud.com/leagueoflegends/legends-never-die
|
|
35
|
-
- Phoenix (S9) — soundcloud.com/leagueoflegends/phoenix
|
|
36
|
-
- Burn It All Down (S11) — soundcloud.com/leagueoflegends/burn-it-all-down
|
|
37
|
-
- GODS (S13) — soundcloud.com/leagueoflegends/gods
|
|
38
|
-
- Heavy Is The Crown (S14) — soundcloud.com/linkinpark/heavy-is-the-crown
|
|
39
|
-
- Sacrifice (S15) — soundcloud.com/leagueoflegends/sacrifice
|
|
40
|
-
|
|
41
|
-
## 布局
|
|
42
|
-
- 左侧 260px 粘性侧边栏:曲目列表(S4/S5/… 标签 + emoji + 曲名 + 年份),点击高亮金色边框,SC.Widget.load() 切歌 + auto_play
|
|
43
|
-
- 右侧主区域:Hero 标题 + 桌面时钟(80px 等宽金色 HH:MM:SS,每秒刷新,冒号闪烁)+ 心情标签
|
|
44
|
-
- 播放器卡片:SoundCloud iframe + 自定义控制栏(⏮ ▶/⏸ ⏭ + 曲目信息 + 音量滑块,点击喇叭图标静音切换)
|
|
45
|
-
- 心情波动区:15 根金色动画柱,切歌时重新随机生成
|
|
46
|
-
- 键盘快捷键:空格播放暂停、← → 切歌、↑ ↓ 调音量
|
|
47
|
-
|
|
48
|
-
## 设计
|
|
49
|
-
Penguin 视觉风格(见 web-design 技能),默认深色。手机端侧边栏变为顶部横向滚动。
|
|
50
|
-
|
|
51
|
-
完成后在浏览器打开 index.html 自测一次。`},rag:{label:"构建 Claude Code 文档 RAG 智能体",desc:"收集 claude-code-docs 仓库,生成可对话、带来源引用的 RAG 知识应用",prompt:"收集 https://github.com/ericbuess/claude-code-docs 的文档,构建一个 RAG 知识应用:克隆仓库并整理语料,建立检索索引;应用化身 Claude Code 配置专家,检索增强回答 Claude Code 相关问题并标注可点击的来源引用——引用要能展示命中的原文片段,并链接到真实文档;按 web-design 技能提供美观的 Web 聊天界面。完成后运行应用,用一个中文问题和一个英文问题各自测一次,确认两者都检索到了正确的英文文档、流式回答正常,并告诉我访问方式。"},agentBenchmarkBuild:{label:"构建通用决策智能体和评测基准",desc:"创建一个通用决策 Agent,并用足球、售后和投资任务检验它",prompt:`请依次使用 \`agent-creation\` 和 \`benchmark-design\`,创建决策 Agent,并产出 Frozen Benchmark 与 Formal Baseline。
|
|
52
|
-
|
|
53
|
-
Agent:
|
|
54
|
-
- id:\`finite_choice_agent\`
|
|
55
|
-
- 能力:面对有限选项,在公开信息不足或冲突时仍能给出稳定、可解释的选择
|
|
56
|
-
- installed_skills:\`[]\`
|
|
57
|
-
|
|
58
|
-
Benchmark:
|
|
59
|
-
- id:\`contextual-choice-adaptation\`
|
|
60
|
-
- capability:从公开规则、历史案例和当前事实中形成并迁移稳定的有限选择决策过程
|
|
61
|
-
- runs:\`1\`
|
|
62
|
-
- desired_baseline_score:\`<75\`
|
|
63
|
-
- pilot_iteration_limit:\`5\`
|
|
64
|
-
|
|
65
|
-
场景:
|
|
66
|
-
1. 根据历史比赛与当前信息进行足球投注决策。
|
|
67
|
-
2. 根据售后政策与工单事实选择处置动作。
|
|
68
|
-
3. 根据投资策略、历史市场与当前指标选择投资动作。`},agentOptimization:{label:"优化通用决策智能体的准确率",desc:"根据已有评测结果改进 Agent,并验证新版本是否真正提升",prompt:"请使用 `agent-optimization`,根据 Frozen Benchmark 优化决策 Agent。\n\n- test_agent_id:`finite_choice_agent`\n- benchmark_id:`contextual-choice-adaptation`\n- capability_direction:提高信息不完整、规则冲突和有限选项决策中的稳定性\n- desired_score:`>=95`\n- candidate_round_limit:`5`"}},sessionList:"Session",defaultSessionTitle:"新对话",model:"Model",workspace:"Workspace",workspaceHint:"留空自动创建临时目录;指定时必须是服务器上已存在的目录",approvalMode:"审批模式",approvalModeNames:{"allow-all":"全部放行","deny-all":"全部拒绝","read-only":"放行只读","always-ask":"总是询问"},approvalModes:{"allow-all":"全部放行(allow-all)","deny-all":"全部拒绝(deny-all)","read-only":"放行只读(read-only)","always-ask":"总是询问(always-ask)"},statusRunning:"运行中",statusCompacting:"压缩中",pendingApprovals:e=>`${e} 个待审批`,jumpToLatest:"回到最新消息",outlineTitle:"对话索引",outlineTickLabel:(e,n)=>`第 ${e} 轮:${n}`,outlineNoText:"(图片或附件)",outlineAnswering:"回答生成中…",inputPlaceholder:"输入消息,Enter 发送,Shift+Enter 换行,可粘贴图片",inputPlaceholderShort:"输入消息…",steerPlaceholder:"给运行中的 Agent 留言,随下一轮对话送达",steerPlaceholderShort:"给运行中的 Agent 留言…",steerSend:"发送给运行中的 Agent",steerQueuedIndicator:"插话已排队,将随下一轮送达",steerQueuedItem:e=>`插话已排队,将随下一轮送达:${e}`,userSteering:"用户插话",steerModeLabel:"运行中发送方式",steerModeSteer:"插话",steerModeSteerHint:"立即插话:随下一轮对话送达运行中的 Agent",steerModeFollowUp:"排队",steerModeFollowUpHint:"排队跟进:本轮结束后自动作为新消息发送",followUpPlaceholder:"排队为下一条消息,本轮结束后自动发送",followUpPlaceholderShort:"排队为下一条消息…",followUpSend:"排队为下一条消息",followUpQueuedChip:e=>`${e} 条跟进消息已排队,本轮结束后自动发送`,send:"发送",stop:"停止",compact:"压缩上下文",approve:"允许",deny:"拒绝",decisionAllow:"已批准",decisionDeny:"已拒绝",decisionManual:"手动",decisionAuto:"自动",thinking:"思考",subagent:"子会话",subagentRunning:"运行中",aborted:e=>`[已中断]${e?`:${e}`:""}`,modelAuthDead:"模型 API 认证失败:请在模型配置页更新该模型的 API key,或新建会话。",modelAuthDeadOpenModels:"打开模型配置",modelAuthDeadRetry:"重试",modelAuthDeadCta:"新建会话",modelAuthDeadPlaceholder:"模型认证失败,请先更新 API key",reconnect:(e,n,r,s)=>{const o=e==="timeout"?"连接超时或网络中断":e==="malformed"?"响应不完整或无法解析":"模型服务返回错误",c=n==="gaveUp"?"已停止重试":n==="retried"?`已发起第 ${r} 次重试`:s!==void 0?`第 ${r} 次重试,${s} 秒后发起…`:`正在发起第 ${r} 次重试…`;return`[重试] ${o},${c}`},reconnectRetryNow:"立即重试",reconnectGiveUp:"放弃",imageAlt:"用户上传的图片",toolImageAlt:"工具输出的图片",imagesAsPathHint:"当前模型不支持直接查看图片:发送时图片将保存到会话临时目录,以文件路径转交(模型经 describe_image 查看)",infoPanel:"Session 信息",sessionStats:"统计",statTokens:"Token 累计",statElapsed:"用时",statInput:"输入 tokens",statCached:"已缓存",statOutput:"输出 tokens",statTps:"输出 TPS",statParenOpen:"(",statParenClose:")",noSessions:"还没有 Session",emptyStream:"发送一条消息开始对话",historyLoadFailed:"历史消息加载失败",statsLabel:"统计信息",removeImage:"移除图片",openWorkspace:"打开工作区",openAgents:"智能体面板",filesInMessage:e=>`${e} 个文件`,imagesInMessage:e=>`${e} 张图片`,openPreview:"点击预览",showMoreFiles:e=>`显示其余 ${e} 个文件`,showLess:"收起",moreGroups:e=>`更多分组(${e})`,contextUsage:"上下文占用",contextUnknown:"上下文占用:压缩后待下次请求回报",slashHint:"输入 / 使用命令",switchAgent:"交给其他 Agent,发送时开启新会话",switchAgentTitle:"选择 Agent",agentSearchPlaceholder:"搜索 Agent:id / 名称",agentsNoMatch:"没有匹配的 Agent",handoffTargetTitle:e=>`发送后交接给 ${e}`,handoffRemove:"移除交接目标",skillsSelect:"技能",skillRemove:"移除技能",skillsSearchPlaceholder:"搜索技能",skillsNoMatch:"没有匹配的技能",skillsEmptyHint:"暂无已装技能,去技能库添加",skillsAutoMessage:e=>`使用 ${e.join("、")} 技能`,handoffFrom:e=>`由 ${e} 的对话交接而来`,handoffBack:e=>e?`回到原对话:${e}`:"回到原对话",switchModel:"切换模型,发送时开启新会话延续本对话",switchModelTitle:"切换模型",modelSwitchTargetTitle:e=>`发送后换用 ${e} 延续本对话`,modelSwitchRemove:"移除切换模型",modelSwitchBusyHint:"本轮结束后才能切换模型:新会话要从当前会话的记录接续",modelSwitchFrom:e=>e?`已切换模型(原为 ${e}),延续原会话`:"已切换模型,延续原会话",modelSwitchAutoMessage:"换用新模型继续这段对话",scheduledFrom:e=>`由定时任务「${e}」触发`,emptyGreeting:"开始一段新对话",compactionRunning:e=>`压缩进行中(${e})…`,compactionDone:e=>e==="discard"?"[压缩] 完成,旧上下文已丢弃":"[压缩] 完成,已切换到摘要后的新上下文",compactionFailed:e=>`[压缩] ${e==="aborted"?"已中断":"失败"},保留当前上下文`,unknownTool:"(未知工具)",workRunning:"运行中",workDone:"运行完毕",workGroupSteps:e=>`${e} 步`,approvalWaiting:"待审批",copyCode:"复制代码",copyReply:"复制回复",copyMessage:"复制消息",deleteSession:"删除对话",renameSession:"重命名对话",renameSessionLabel:"标题",deleteSessionConfirm:e=>`确定删除「${e}」?该对话的消息与 Trace 将被移除,且不可恢复。`,archiveSession:"归档",unarchiveSession:"取消归档",loadMore:"更多",folderGroups:{subagent:e=>`子智能体(${e})`,schedule:e=>`定时任务(${e})`,archived:e=>`已归档(${e})`},skillsBanner:e=>`使用技能:${e.join("、")}`,attachedFilesBanner:e=>`附加文件:${e.join("、")}`,plusMenu:"更多输入方式",uploadImage:"上传图片",uploadImageDesc:"为本条消息附加图片",uploadFile:"上传文件",uploadFileDesc:"文件存入会话临时目录,模型按路径读取",removeFile:"移除文件",attachmentTooLarge:e=>`${e} 超过 10MB 上限,未添加。`,goalMode:"目标模式",goalModeDesc:"循环运行直至目标完成",goalBudgetLabel:"Token 预算",goalBudgetUnlimited:"预算不限",goalBudgetValue:e=>`预算 ${e}`,goalBudgetPlaceholder:"例如 500k",goalBudgetHint:"支持 k/m 后缀;留空表示预算不限",goalBudgetInvalid:"无效预算:应为正数,可带 k/m 后缀(500k、2m)",goalBudgetSave:"保存预算",goalRemove:"退出目标模式",goalRoundBanner:e=>`目标 · 第 ${e} 轮`,goalRoundImages:e=>`${e} 张附图`,goalProgress:(e,n)=>`第 ${e} 轮 · tokens ${n}`,goalStatus:{active:"进行中",complete:"已完成",blocked:"受阻",budget_limited:"预算耗尽",aborted:"已中断"}},subagentPanel:{title:"智能体面板",topologyLabel:"调用关系",mainSessionNote:"主会话请在对话区查看",empty:"本次任务尚未派生子智能体",nodeRunning:"运行中",nodeDone:"已完成"},files:{title:"文件",upload:"上传",download:"下载",openInNewTab:"新页面打开",previewNotIsolatedHint:"当前访问地址无法提供独立预览源,页面将以沙箱模式打开:localStorage、Cookie 与第三方 embed 不可用。经 127.0.0.1 或 localhost 访问,或配置 PENGUIN_PREVIEW_ORIGIN 即可解除。",refresh:"刷新",root:"根目录",empty:"空目录",previewUnsupported:"该类型不支持预览,请下载查看",uploaded:"已上传",overwriteTitle:"覆盖同名文件",overwriteConfirm:e=>`当前目录已存在以下 ${e} 个同名文件,上传将覆盖:`,loadFailed:"加载失败",previewTruncated:"内容过大,预览已截断,请下载查看完整文件",details:"详情",workspacePath:"Workspace 路径",htmlRendered:"渲染视图",htmlSource:"源码",backToList:"返回列表",resizeHandle:"拖拽调整宽度,双击恢复默认"},usage:{title:"成本与统计",today:"今日",last7d:"近 7 天",total:"累计",tokens:"Token",requests:"Requests",from:"起始日期",to:"结束日期",colCacheRead:"cache_read",colCacheWrite:"cache_write",colOutput:"output",uncostedNote:"* 只计入配置了价格的模型成本",filterAllAgents:"全部 Agent",filterAllModels:"全部模型",chartAgentCalls:"各 Agent 调用次数",chartSuccessRate:"各模型成功率",chartTokenTrend:"Token 逐日变化",chartCostTrend:"成本逐日变化",empty:"暂无用量记录",successAborted:"已中断(不计入)",errors:"异常",errorsTotal:"总数",errorsUnexpected:"未预期",errorsExpected:"预期内",errorsTopCode:"最常见",errorsColCode:"来源 · 错误码",errorsColKind:"类型",errorsColMessage:"消息",errorsEmpty:"暂无异常",errorsNewer:"较新",errorsOlder:"更早",errorsPageOf:(e,n,r)=>`第 ${e} / ${n} 页 · 共 ${r} 条`},traces:{title:"轨迹观测",timeline:"执行时间线",laneLLM:"模型",kindThinking:"思考",kindModelReply:"模型回复",kindToolGen:"工具调用生成",legendToolExec:"工具调用执行",legendApprovalWait:"审批等待",task:e=>`第 ${e} 轮`,globalSummary:"全局统计",tasksLabel:"轮次",messages:"消息",truncatedNote:(e,n)=>`仅展示前 ${e} / ${n} 条消息`,zoom:"缩放",zoomReset:"双击复位缩放",zoomOut:"缩小",zoomIn:"放大",linkHint:"鼠标移到时间线段或消息行即可联动高亮,点击时间线段跳转到对应消息;图例可高亮同类;拖动下方滑块平移/缩放",filesTitle:"Trace 文件",selectSession:"在左侧选择一个 Session",toolCalls:"工具调用",taskInput:"本轮输入 tokens",taskOutput:"本轮输出 tokens",cacheHit:"命中缓存",hitRate:"命中率",compactions:"压缩次数",compactionRound:"压缩",empty:"该 Agent 暂无 Trace",inProgress:"进行中",systemPrompt:"系统提示词",toolDefs:e=>`工具定义(${e})`,exportFile:"导出",importTrace:"导入 Trace",importing:"导入中…",fileTooLarge:"文件超过 14MB 上限。"},benchmark:{title:"评估中心",selectBenchmark:"在左侧选择一个 Benchmark",emptyAgent:"该 Agent 暂无 Benchmark",caseCount:e=>`${e} 题`,trendTitle:e=>`${e}随时间变化`,cases:"题目",viewCase:"查看详情",taskMaterials:"任务材料",rubric:"评分标准",agentHidden:"被测 Agent 不可见",caseFileUnavailable:"案例文件暂时无法读取",evaluations:"评估明细",noEvaluations:"暂无评估记录",summaryLabel:"评估说明",legendUnlabeled:"未标注模型",colVersion:"版本",colModel:"模型 ID",colThinkingLevel:"推理强度",colScore:"Score",colDuration:"耗时",colCase:"题目",colRun:"运行",colSession:"Session"},errors:{networkError:"网络错误,请检查连接",modelCredentialMissing:e=>`模型 ${e} 还没有可用的 API key,请先在「模型」页为它配置`,noDefaultModel:"该 Project 还没有默认模型,请先在「模型」页添加模型并设为默认",byCode:{invalid_credentials:"用户名或密码错误。",password_mismatch:"当前密码不正确。",invalid_password:"密码至少 8 位。",admin_required:"仅管理员可执行此操作。",not_found:"资源不存在,或你没有访问权限。",agent_not_found:"该 Agent 已不存在。",agent_exists:"该 Agent id 已被占用。",project_exists:"该 Project id 已被占用。",user_exists:"该用户名已被占用。",user_not_found:"该用户已不存在。",cannot_delete_admin:"内置 admin 不可删除。",member_not_found:"该用户不是本 Project 的成员。",schedule_exists:"已存在同名定时任务。",schedule_not_found:"该定时任务已不存在。",unknown_skill:"该技能不在技能库中。",file_not_found:"该文件已不存在。",file_too_large:"文件过大。",too_many_files:"一条消息附加的文件过多。",payload_too_large:"请求体过大。",dir_not_absolute:"目录必须是绝对路径。",not_a_dir:"该路径不是目录。",path_not_found:"该路径不存在。",workspace_missing:"该 Session 的 Workspace 已不存在。",task_in_progress:"该 Session 已有任务在运行。",version_conflict:"快照版本不高于当前版本。",invalid_title:"标题无效。",invalid_trace:"该文件不是有效的 Trace 文件。",trace_session_exists:"该 Agent 已存在同名 Session,无法导入重复的 Trace。"}}};let g=mv;function Bj(e){g=e}const Hj={appName:"PenguinHarness",nav:{chat:"Chat",newChat:"New chat",agents:"Agents",skills:"Skills",models:"Models",usage:"Cost Center",traces:"Trajectories",benchmark:"Evaluation Center",lastConversation:"Last conversation",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",collapseGroup:"Collapse",expandGroup:"Expand",pinGroup:"Pin group",unpinGroup:"Unpin group"},settings:{language:"Language",showCliSessions:"Show CLI sessions",theme:"Theme",themeLight:"Light",themeDark:"Dark",followSystem:"System",langZh:"中文",langEn:"English",fontSize:"Font size",fontSmall:"S",fontMedium:"M",fontLarge:"L",accent:"Accent",accentNames:{neutral:"Neutral",blue:"Blue",green:"Green",violet:"Violet",rose:"Rose",amber:"Amber"}},update:{lastUpdated:e=>`Last updated ${e}`,newVersionBadge:"New version available",newVersion:e=>`New version v${e} available`,checkNow:"Check for updates",checking:"Checking…",foundNew:e=>`New version v${e} found — use the update entry below to install`,upToDate:"You're on the latest version",checkFailed:"Update check failed — try again later",checkDisabled:"Update checks are disabled (PENGUIN_UPDATE_CHECK=off)",releaseNotes:"Release notes",updateNow:"Update now",updating:"Updating…",updated:"Update complete — restart the service to apply",restartHint:"Restart by re-running penguin web (or penguin server) in a terminal",failed:"Update failed",unsupported:"This install cannot be updated from the web UI",confirmBody:"Downloads the latest release and installs it into the install directory on the server (the data directory is not touched). Restart the service afterwards for the update to take effect.",adminOnly:"Only an administrator can run the update from here."},common:{save:"Save",cancel:"Cancel",create:"Create",delete:"Delete",edit:"Edit",settings:"Settings",confirm:"Confirm",close:"Close",loading:"Loading…",saved:"Saved",saving:"Saving…",noChangesToSave:"No changes to save",confirmSaveTitle:"Save changes",confirmSaveBody:"Save these changes? They will be written to the configuration files on the server.",none:"(none)",retry:"Retry",unknownError:"Request failed, please try again later",requiredField:"This field is required",copied:"Copied",name:"Name",username:"Username",role:"Role",actions:"Actions",created:"Created",cost:"Cost",time:"Time"},auth:{usernameHint:"2–32 chars: starts with a lowercase letter; lowercase letters, digits and underscores only",password:"Password",passwordHint:"At least 8 characters",showPassword:"Show password",hidePassword:"Hide password",login:"Sign in",logout:"Sign out",admin:"Admin",defaultAdminNote:"First run: sign in as the built-in admin (admin / penguin-2026), then change the password soon"},account:{changePassword:"Change password",oldPassword:"Current password",oldPasswordHint:"The built-in admin's default initial password is penguin-2026",newPassword:"New password",confirmPassword:"Confirm new password",passwordMismatch:"New passwords do not match",initialPasswordBanner:"This account is using its initial password. Please change it soon.",changeNow:"Change now"},admin:{users:"Users",roleAdmin:"Admin",roleUser:"User",createUser:"Add user",initialPassword:"Initial password",initialPasswordFlag:"initial password",defaultProjectNote:e=>`A default Project will be created: ${e}`,resetPassword:"Reset password",resetPasswordTitle:e=>`Reset password for ${e}`,resetPasswordNote:"All sign-in sessions of this user will be revoked; they must sign in with the new password",deleteUserTitle:e=>`Delete user ${e}`,deleteUserConfirm:e=>`This deletes user ${e} and every Project they own (including data directories). This cannot be undone.`},project:{switcher:"Project",create:"New Project",createTitle:"New Project",id:"Project id",idHint:"2–64 chars: starts with a lowercase letter; lowercase letters, digits and underscores only. Cannot be changed later.",idPrefixHint:"The id is prefixed with your username and a hyphen; append lowercase letters, digits or underscores. Cannot be changed later.",name:"Display name (optional, defaults to the Project id)",displayName:"Display name",settings:"Project settings",settingsTitle:"Project settings",members:"Members",addMember:"Add member",removeMember:"Remove",deleteProject:"Delete Project",deleteConfirm:"Delete this Project? Its directory will be removed recursively and cannot be recovered.",deleteLastForbidden:"This is the last Project on this account; create another Project before deleting it",deleteDefaultForbidden:"default_project is shared with the CLI and cannot be deleted from the web",noCredentialTitle:"No model credential configured",noCredentialBody:"The default model of this Project has no API key yet. Configure it on the Models page before chatting.",goToModels:"Go to Models",later:"Later"},agent:{listTitle:"Agents",create:"Create agent",createTitle:"Create agent",id:"Agent id",idHint:"2–64 chars: starts with a lowercase letter; lowercase letters, digits and underscores only. Cannot be changed later.",nameHint:"Leave empty to use the agent id as the name",description:"Description",activeSessions:"Active Sessions",sessionCount:e=>`${e} session${e===1?"":"s"}`,toolCount:e=>`${e} tool${e===1?"":"s"}`,vaultKeyCount:e=>`${e} vault key${e===1?"":"s"}`,scheduleCount:e=>`${e} scheduled task${e===1?"":"s"}`,updatedAt:"Last modified",activity:e=>`${e}-day session activity`,settings:"Agent settings",backToList:"Back to Agents",tabOverview:"Overview",tabPrompt:"Prompt",tabRuntime:"Runtime",tabTools:"Tools",tabVault:"Vault",tabSchedules:"Schedules",stateDir:"State path",agentsMd:"AGENTS.md",systemPrompt:"system_prompt template",placeholdersTitle:"Available placeholders (click to insert)",insertPlaceholder:"Insert at the system_prompt cursor",placeholders:[["{{AGENTS_MD}}","Injects the AGENTS.md content"],["{{VAULT_KEYS}}","Injects the vault key-name section (empty when no keys)"],["{{SKILL_METADATA}}","Injects the installed skills' metadata lines (empty when none)"],["{{PLATFORM}}","Runtime platform"],["{{OS_VERSION}}","Operating system version"],["{{DATE}}","Current date"],["{{PROJECT_DIR}}","PenguinHarness app data root — all agents' data and project-level data; not the task working directory"],["{{AGENT_ID}}","Current agent id"],["{{CWD}}","Absolute Workspace path"],["{{PROVIDER}}","Model provider group"],["{{MODEL_ID}}","Upstream model id"],["{{SESSION_ID}}","Current Session id"]],maxTurns:"max_turns (max turns per Task, -1 = unlimited)",maxTokens:"model.max_tokens",thinkingLevel:"model.thinking_level",thinkingLevelOptions:[["","Send no override — keep whatever is currently configured."],["low","Enables a lower tier of extended reasoning."],["medium","Enables a medium tier of extended reasoning (the default tier for a newly created agent)."],["high","Enables a higher tier of extended reasoning; slower responses."],["xhigh","Enables the highest tier of extended reasoning; identical to high on some models."]],thinkingLevelNoneKept:"Stored legacy tier: new selections no longer offer the off tier (many models cannot disable thinking).",timeoutMs:"model.timeoutMs",timeoutMsHint:"Per-request timeout, ms",compaction:"Context compaction",maxContextLength:"max_context_length",maxContextLengthHint:"Context threshold that triggers compaction",maxSessionTurns:"max_session_turns",maxSessionTurnsHint:"Turn threshold that triggers compaction",compactionMode:"mode (compaction strategy)",compactionModeOptions:[["","Send no override — keep whatever is currently configured."],["summarize","Summarizes the old context with the model, then continues from that summary in a fresh window (default)."],["discard","Drops the old context without summarizing; the next turn starts fresh in a new window."]],compactionPrompt:"prompt (summarization prompt)",maxTurnsInvalid:"max_turns must be > 0 or -1",timeoutInvalid:"timeoutMs must be > 0 or -1",toolFieldInvalid:(e,n)=>`${e}: ${n} must be a positive integer or -1`,toolPermission:"permission",permissionReadLabel:"Read-only",permissionReadDescription:"Only reads. Auto-approved when the approval mode is read-only.",permissionReadWriteLabel:"Read & write",permissionReadWriteDescription:"Can modify things. Needs manual confirmation when the approval mode is read-only.",toolTimeout:"timeoutMs",toolMaxOutput:"maxOutputLength",toolCallDescription:"call_description",callDescriptionHint:"call_description: when on (the default), the tool's schema keeps the optional description argument — a model-written sentence about each call, shown to the user while it runs; when off, the argument is filtered out of the schema at assembly. Only tools whose parameters declare a description property can be toggled.",mcpServers:"MCP Servers (read-only)",defaultValue:"(default)",deleteAgent:"Delete agent",builtinUndeletable:"Built-in agents cannot be deleted",deleteConfirm:e=>`Delete agent "${e}"? Its directory (including all Traces) will be removed recursively and cannot be recovered.`,stateVersion:"Agent State version",transferTitle:"Export / import",transferDesc:"Export the current Agent State snapshot (tar.gz); importing overwrites the whole directory and adopts the version inside the package.",exportSnapshot:"Export snapshot",importSnapshot:"Import snapshot",importing:"Importing…",importDone:e=>`Import finished, Agent State version v${e}`,importConflictTitle:"Version conflict",importConflictBody:"The snapshot's version is not newer than the current one; importing will overwrite the existing Agent State. Continue?",resetConfigTitle:"Restore default configuration",resetConfigDesc:"Restores system_config.yaml to the current built-in defaults (same semantics as a skill update): the custom system prompt, tool list, model/compaction settings and MCP servers are overwritten; only name, description and the State version are kept.",resetConfigAction:"Restore default configuration",resetConfigConfirmBody:"This overwrites the agent's existing configuration with the current defaults: the custom system prompt, tool list, model/compaction settings and MCP servers are all replaced, keeping only name and description. Like a skill update this cannot be undone. Continue?",resetConfigDone:"Configuration restored to the current defaults"},models:{title:"Models",addCustom:"Add custom model",addToGroup:"Add model",editTitle:"Model settings",addTitle:"Add model (OpenAI protocol)",addTitleVendor:"Add model",addProtocolHint:"New models always use the OpenAI Chat Completions protocol (no auto-routing by model id); set the base URL to a compatible endpoint",addAutoRouteHint:"New models in this group are auto-routed by their upstream id to the vendor's official client: leave the base URL empty for the official endpoint, and an empty API key falls back to the resolved client's environment variable",baseUrlOfficialNote:"Note: this model uses the vendor's official protocol — a custom base URL must serve an endpoint compatible with it; it never switches the model to the OpenAI protocol",autoRouteNone:"AgentHub cannot auto-route this id: double-check it, or add the model under Custom / a user-defined group with the OpenAI protocol",addGroup:"Add group",addGroupTitle:"Add group",addGroupDesc:"User-defined groups share Custom semantics: models use the OpenAI Chat Completions protocol (base URL required; an empty API key reads OPENAI_API_KEY). Groups live on model entries — the group appears once its first model is saved.",groupNameLabel:"Group name",groupNameHint:"Starts with a lowercase letter / digit; may contain - and _",groupNameInvalid:"Group names may only use lowercase letters, digits, - and _ (starting with a letter or digit), up to 32 characters",groupNameExists:"This name is taken by a built-in group or an existing entry",groupEmptyHint:"No models in this group yet; use “Add model” to create one",searchPlaceholder:"Search models: id / name / provider",noSearchResults:"No matching models",syncCatalog:"Sync presets",syncCatalogHint:"Update preset models from the built-in catalog: add missing entries and reset differing ones to the catalog's fields; locally added models and API keys are left untouched",syncDone:(e,n)=>`Presets synced: ${e} added, ${n} updated`,syncUpToDate:"Presets are already up to date",homepage:"Model page",speedTest:"Speed test",speedTestTitle:"Speed test",speedTestConfirm:e=>`This sends one real request to each of the ${e} models in this group, one at a time, to measure time-to-first-token (TTFT) and output rate (TPS). It consumes a small amount of API quota. Continue?`,speedTestStart:"Start",speedPending:"Testing…",speedFailed:"Test failed",ttftTitle:"Time to first token (TTFT)",tpsTitle:"Output rate (TPS)",modelCount:e=>`${e} model${e===1?"":"s"}`,modelId:"Model ID",modelIdHint:"The upstream API model id, e.g. gpt-5.5",displayName:"Display name",displayNameHint:"Defaults to the model ID",providerGroup:"Group",contextWindow:"Context window",tokenUnit:"Token",contextWindowHint:"Leave empty if unknown",maxTokens:"Max output tokens",maxTokensHint:"Empty = inherit agent setting",maxTokensTitle:"Caps output tokens per request; leave empty to inherit the agent setting — lower it for small-context models",maxTokensInvalid:"Must be a positive integer",clientTypeLocked:e=>`Protocol: ${e} (kept as configured; not editable)`,vision:"Vision support",visionOffProxyHint:"Images are read via the vision proxy model",visionBadge:"Vision",freeBadge:"Free",visionModelBadge:"Proxy vision",setVisionModel:"Set as proxy vision model",visionModelHint:"Describes images via describe_image for models without vision",priceUnitShort:"/M tok",testConnection:"Test connection",testing:"Testing…",testOk:e=>`Connected (${e} ms)`,testFailed:e=>`Failed: ${e}`,priceCacheRead:"Cache read price",priceCacheWrite:"Cache write price",priceOutput:"Output price",currency:"Currency",currencyUsd:"USD $",currencyCny:"CNY ¥",apiKey:"API key",apiKeyKeepHint:"Leave empty to keep the current key",apiKeyEnvHint:e=>`Leave empty to use the ${e} env var`,keyConfigured:"Key configured",clearApiKey:"Clear stored API key",baseUrl:"Custom base URL",baseUrlHint:"Leave empty to use the provider default",baseUrlRequired:"A base URL is required",contextWindowDefaultHint:e=>`Defaults to ${e} if empty`,confirmDeleteTitle:"Delete model",confirmDelete:e=>`Delete "${e}"? Its configuration and API key will be removed.`,groupApiKey:"Set API key for group",groupApiKeyTitle:e=>`Set the API key for ${e}`,groupApiKeyHint:e=>`Applies to all ${e} models in this group; leave empty to keep them unchanged.`,getApiKey:"Get API key",getModelIds:"Get model IDs",groupKeyApplied:e=>`API key set for ${e} models`,providerEnvNotes:{zhipu:"Defaults to the Z.AI global endpoint (api.z.ai); keys from bigmodel.cn need base URL https://open.bigmodel.cn/api/paas/v4",moonshot:"Defaults to the China endpoint (api.moonshot.cn); keys from platform.kimi.com need base URL https://api.moonshot.ai/v1"},confirmVisionModelTitle:"Set as proxy vision model",confirmVisionModel:e=>`Make "${e}" the proxy vision model? Models without vision will read images through it via describe_image.`,confirmSaveTitle:"Save model settings",confirmSave:e=>`Save the changes to "${e}"?`,confirmDefaultTitle:"Set as default model",confirmDefault:e=>`Make "${e}" the default model? New sessions will use it by default.`,default:"Default",setDefault:"Set as default model",remove:"Delete model",readOnlyHint:"Members have read-only access; only owners can change models and credentials",empty:"No models configured yet",noKey:"No key",showModelsWithoutKey:e=>`Show model${e===1?"":"s"} without a key (${e})`,modelIdExists:"This model id already exists",pricingAllOrNone:"Fill all three prices",pricingInvalid:"Must be a number",contextWindowInvalid:"Must be a number"},vault:{desc:"Environment variables owned by this agent (stored in agent_state/.vault.toml), injected into the environment of its shell commands (exec_command); key names are shared with the model, values never enter the model context. Subagents use their own vaults and do not inherit this one. Saved changes take effect from the next task (a task already running is unaffected).",key:"Name",value:"Value",valueMasked:"Value (masked)",add:"Add",addTitle:"Add variable",remove:"Remove",deleteTitle:"Delete variable",deleteConfirm:e=>`Delete variable "${e}"? Its value cannot be recovered.`,overwriteTitle:"Overwrite existing variable",overwriteConfirm:e=>`"${e}" already exists — saving will overwrite its value, which cannot be recovered.`,empty:"No variables configured yet",readOnlyHint:"Members are read-only; only the owner can edit the vault",keyHint:"Letters, digits and underscores; must not start with a digit",keyInvalid:"Invalid name: only letters, digits and underscores, not starting with a digit",valueRequired:"Value must not be empty"},schedule:{desc:"Scheduled tasks (agent_state/schedule/*.toml): the prompt is sent to the target Session on schedule; files can also be edited by hand, and changes made here take effect immediately.",readOnlyHint:"Members are read-only; only the owner can modify schedules",colStatus:"Status",colPeriod:"Period",colTarget:"Target",colFireTimes:"Next / last fired",colQueued:"Queue",statusNames:{active:"Active",disabled:"Disabled",expired:"Expired",done:"Done",missed:"Missed",invalid:"Invalid"},queued:"Queued",once:"One-off",newSession:"New session",invalidFiles:"Files that failed to parse (skipped by the scheduler)",empty:"No scheduled tasks yet",enable:"Enable",disable:"Disable",addTitle:"New scheduled task",editTitle:e=>`Edit scheduled task "${e}"`,nameHint:"The file name (without .toml); cannot be changed later",prompt:"Prompt",enabled:"Enabled",startAt:"Start at",endAt:"End at (optional)",period:"Period",periodPlaceholder:"30m / 12h / 7d; leave empty for a one-off task",target:"Target",targetNew:"New session each time",targetSession:"Bound Session",sessionId:"Session id",workspace:"Workspace (optional, auto-created when empty)",model:"Model",modelDefault:"Project default",deleteTitle:"Delete scheduled task",deleteConfirm:e=>`Delete scheduled task "${e}"?`},skills:{pageTitle:"Skill library",pageDesc:"Built-in skill library: browse, quick-start a chat, or install to agents.",quickInvoke:"Quick start",quickInvokeText:e=>`use the ${e} skill`,manageInstall:"Manage installs",manageInstallTitle:e=>`Manage installs: ${e}`,install:"Install",installed:"Installed",uninstall:"Uninstall",skillCount:e=>e===1?"1 skill":`${e} skills`,usedByAgents:e=>e===0?"not used yet":e===1?"used by 1 agent":`used by ${e} agents`,installedToast:(e,n)=>`Installed ${e} to ${n}`,updateOutdated:e=>`Update available: update ${e} agent install(s)`,updateAction:"Update",updateConfirmTitle:e=>`Update ${e}`,updateConfirmWarning:e=>`Updating ${e} reinstalls the library copy over each agent's installed files — any local edits to the installed skill are lost. Export a backup first if you need them.`,updatedToast:(e,n)=>`Updated ${e} to the latest version (${n} agent(s))`,uninstalledToast:(e,n)=>`Uninstalled ${e} from ${n}`,uninstallConfirmTitle:e=>`Uninstall ${e}`,uninstallConfirmBody:(e,n)=>`Uninstall ${e} from ${n}? Its installed files (local edits included) will be deleted.`},chat:{newSessionMenu:"New chat",chooseAgent:"Choose agent",chooseModel:"Choose model",thinkingLevel:"Thinking level",thinkingLevelNames:{none:"None",low:"Low",medium:"Medium",high:"High",xhigh:"Extreme High"},workspaceUseThis:"Use this dir",workspaceUp:"Parent dir",workspaceNoSubdirs:"No subdirectories",workspaceAuto:"Auto temp directory",workspaceClear:"Use auto temp directory instead",workspaceDirInvalid:"Directory does not exist or is inaccessible; reverted",groupByWorkspace:"Group by workspace",groupByAgent:"Group by agent",tempWorkspaces:"Temp workspaces",newSessionInWorkspace:"New chat in this workspace",draftSubtitle:"The self-evolving agent that excels at AI development tasks",exampleFolders:{webapps:"Build web apps",agents:"Build and optimize agents"},exampleTasks:{game:{label:"2D penguin sled game",desc:"A cute Antarctic penguin sleds over rocks, easy start with a gentle difficulty ramp — a 2D pure-frontend mini game",prompt:"Build a cute Antarctic penguin sledding 2D game: press Space to jump over the rocks coming up on the ice; start easy and forgiving, with sled speed and obstacle density ramping up smoothly and gradually over time (no sudden spikes), live scoring, and hitting a rock ending the run with one-click restart. A 2D side-scroller with a cute cartoon look, pure frontend (a single HTML file is fine), styled per the web-design skill. When done, test it in a browser once, confirm the first few seconds are easy to clear, and tell me how to open it and how to play."},gamecenter:{label:"A mini-game center built by multiple agents",desc:"Ten pure-frontend games with no repeated mechanics, built in parallel behind one index page",prompt:`Build a web mini-game center with multiple agents working in parallel: 10 pure-frontend games with no two sharing the same mechanic, plus an index page.
|
|
69
|
-
|
|
70
|
-
## How to split the work
|
|
71
|
-
- First plan the 10 games (say snake, 2048, tetris, breakout, minesweeper, memory match, sokoban, space shooter, platform jumper, rhythm tap), confirm no two mechanics repeat, and fix a shared directory layout, palette and interaction spec.
|
|
72
|
-
- Then hand the 10 games to several subagents to implement in parallel — each subagent owns exactly one game, follows the agreed spec, and never edits another's files.
|
|
73
|
-
|
|
74
|
-
## Each game
|
|
75
|
-
- Its own \`games/<slug>/index.html\`: pure frontend, a single file that runs straight from file://, with no backend and no CDN assets.
|
|
76
|
-
- Start / restart, live score or timer, a lose-or-clear summary, both keyboard and touch controls, and the rules written on the page.
|
|
77
|
-
- A way back to the index page.
|
|
78
|
-
|
|
79
|
-
## Index page
|
|
80
|
-
- \`index.html\` at the root: a card grid listing all 10 games (name + one-line mechanic + controls), each card opening its game.
|
|
81
|
-
- One design language shared with every game, following the web-design skill.
|
|
82
|
-
|
|
83
|
-
## Wrap-up
|
|
84
|
-
- Review as a whole: the 10 mechanics really are distinct, the styling is consistent, and every index link resolves.
|
|
85
|
-
- Self-test each game in a browser — it starts, it ends, it restarts — then tell me how to open it.`},lol:{label:"League of Legends music player",desc:"Worlds anthems on the SoundCloud Widget API — a single file that opens from file://",prompt:`Build a League of Legends Worlds anthem player with the SoundCloud Widget API (see https://developers.soundcloud.com/docs/api/html5-widget): a single index.html that works when opened from file://.
|
|
86
|
-
|
|
87
|
-
## Technical constraints
|
|
88
|
-
- Use the SC.Widget JS API (widget.load / widget.toggle / widget.setVolume / widget.seekTo), loading https://w.soundcloud.com/player/api.js
|
|
89
|
-
- The iframe must stay visible (180px tall), with visual=true color=f0b90b single_active=true
|
|
90
|
-
- Include ONLY these 8 tracks confirmed playable (oEmbed-verified); do not add tracks that are not oEmbed-verified:
|
|
91
|
-
- Warriors (S4) — soundcloud.com/leagueoflegends/warriors
|
|
92
|
-
- Worlds Collide (S5) — soundcloud.com/leagueoflegends/worlds-collide
|
|
93
|
-
- Legends Never Die (S7) — soundcloud.com/leagueoflegends/legends-never-die
|
|
94
|
-
- Phoenix (S9) — soundcloud.com/leagueoflegends/phoenix
|
|
95
|
-
- Burn It All Down (S11) — soundcloud.com/leagueoflegends/burn-it-all-down
|
|
96
|
-
- GODS (S13) — soundcloud.com/leagueoflegends/gods
|
|
97
|
-
- Heavy Is The Crown (S14) — soundcloud.com/linkinpark/heavy-is-the-crown
|
|
98
|
-
- Sacrifice (S15) — soundcloud.com/leagueoflegends/sacrifice
|
|
99
|
-
|
|
100
|
-
## Layout
|
|
101
|
-
- Left 260px sticky sidebar: the track list (S4/S5/… badge + emoji + title + year); clicking highlights with a gold border and switches tracks via SC.Widget.load() with auto_play
|
|
102
|
-
- Right main area: hero title + a desktop clock (80px monospace gold HH:MM:SS, refreshed every second, blinking colons) + a mood tag
|
|
103
|
-
- Player card: the SoundCloud iframe + a custom control bar (⏮ ▶/⏸ ⏭ + track info + a volume slider; clicking the speaker icon toggles mute)
|
|
104
|
-
- Mood-wave section: 15 gold animated bars, re-randomized on every track switch
|
|
105
|
-
- Keyboard shortcuts: Space play/pause, ← → previous/next, ↑ ↓ volume
|
|
106
|
-
|
|
107
|
-
## Design
|
|
108
|
-
Penguin visual style (see the web-design skill), dark by default. On phones the sidebar becomes a horizontally scrolling top bar.
|
|
109
|
-
|
|
110
|
-
When done, open index.html in a browser and self-test once.`},rag:{label:"Build a Claude Code docs RAG agent",desc:"Collect the claude-code-docs repo into a conversational RAG knowledge app with source citations",prompt:"Collect the docs from https://github.com/ericbuess/claude-code-docs and build a RAG knowledge app: clone the repo and prepare the corpus, then build a retrieval index; the app acts as a Claude Code configuration expert, answering Claude Code questions with retrieval-augmented replies and clickable citations that reveal the matched original text chunk and link to the real documents; give it a beautiful web chat UI following the web-design skill. When done, run the app and self-test one Chinese question and one English question, confirming both retrieve the right English documents and stream their answers, then tell me how to access it."},agentBenchmarkBuild:{label:"Build a general-purpose decision agent and its benchmark",desc:"Create a general decision Agent and test it on football, after-sales, and investment tasks",prompt:`Use \`agent-creation\` followed by \`benchmark-design\` to create a decision Agent and produce a frozen Benchmark with a Formal Baseline.
|
|
111
|
-
|
|
112
|
-
Agent:
|
|
113
|
-
- id: \`finite_choice_agent\`
|
|
114
|
-
- capability: make stable, explainable finite choices when public information is incomplete or conflicting
|
|
115
|
-
- installed_skills: \`[]\`
|
|
116
|
-
|
|
117
|
-
Benchmark:
|
|
118
|
-
- id: \`contextual-choice-adaptation\`
|
|
119
|
-
- capability: form and transfer a stable finite-choice decision process from public rules, historical examples, and current facts
|
|
120
|
-
- runs: \`1\`
|
|
121
|
-
- desired_baseline_score: \`<75\`
|
|
122
|
-
- pilot_iteration_limit: \`5\`
|
|
123
|
-
|
|
124
|
-
Scenarios:
|
|
125
|
-
1. Make football betting decisions from historical matches and current information.
|
|
126
|
-
2. Choose after-sales actions from policy and ticket facts.
|
|
127
|
-
3. Choose investment actions from a strategy, historical markets, and current indicators.`},agentOptimization:{label:"Improve the general-purpose decision agent's accuracy",desc:"Improve an Agent from existing evaluation results and verify that the new version is better",prompt:"Use `agent-optimization` to optimize a decision Agent against its frozen Benchmark.\n\n- test_agent_id: `finite_choice_agent`\n- benchmark_id: `contextual-choice-adaptation`\n- capability_direction: improve stability under incomplete information, conflicting rules, and finite choices\n- desired_score: `>=95`\n- candidate_round_limit: `5`"}},sessionList:"Sessions",defaultSessionTitle:"New chat",model:"Model",workspace:"Workspace",workspaceHint:"Leave empty for an auto-created temp directory; if set, it must be an existing directory on the server",approvalMode:"Approval mode",approvalModeNames:{"allow-all":"Approve everything","deny-all":"Deny everything","read-only":"Approve read-only","always-ask":"Ask every time"},approvalModes:{"allow-all":"Approve everything (allow-all)","deny-all":"Deny everything (deny-all)","read-only":"Approve read-only (read-only)","always-ask":"Ask every time (always-ask)"},statusRunning:"Running",statusCompacting:"Compacting",pendingApprovals:e=>`${e} pending approval${e>1?"s":""}`,jumpToLatest:"Jump to latest",outlineTitle:"Outline",outlineTickLabel:(e,n)=>`Turn ${e}: ${n}`,outlineNoText:"(image or attachment)",outlineAnswering:"Answering…",inputPlaceholder:"Type a message. Enter to send, Shift+Enter for newline, paste images",inputPlaceholderShort:"Type a message…",steerPlaceholder:"Message the running agent — delivered with the next turn",steerPlaceholderShort:"Message the running agent…",steerSend:"Send to the running agent",steerQueuedIndicator:"Steering queued — delivered with the next turn",steerQueuedItem:e=>`Steering queued — delivered with the next turn: ${e}`,userSteering:"User steering",steerModeLabel:"Mid-run send mode",steerModeSteer:"Steer",steerModeSteerHint:"Steer now: delivered to the running agent with the next turn",steerModeFollowUp:"Queue",steerModeFollowUpHint:"Queue a follow-up: sent automatically as a new message when this run finishes",followUpPlaceholder:"Queue as the next message — sent automatically when this run finishes",followUpPlaceholderShort:"Queue as the next message…",followUpSend:"Queue as the next message",followUpQueuedChip:e=>`${e} follow-up ${e===1?"message":"messages"} queued — sent when this run finishes`,send:"Send",stop:"Stop",compact:"Compact context",approve:"Allow",deny:"Deny",decisionAllow:"Approved",decisionDeny:"Denied",decisionManual:"manual",decisionAuto:"auto",thinking:"Thinking",subagent:"Subagent",subagentRunning:"Running",aborted:e=>`[Aborted]${e?`: ${e}`:""}`,modelAuthDead:"Model API authentication failed: update this model's API key on the Models page, or start a new Session.",modelAuthDeadOpenModels:"Open Models page",modelAuthDeadRetry:"Retry",modelAuthDeadCta:"New Session",modelAuthDeadPlaceholder:"Model authentication failed — update the API key first",reconnect:(e,n,r,s)=>{const o=e==="timeout"?"Connection timed out":e==="malformed"?"Response incomplete or unparseable":"The model provider returned an error",c=n==="gaveUp"?"no further retries":n==="retried"?`retry #${r} sent`:s!==void 0?`retry #${r} in ${s}s…`:`starting retry #${r}…`;return`[Retry] ${o}; ${c}`},reconnectRetryNow:"Retry now",reconnectGiveUp:"Give up",imageAlt:"Image uploaded by user",toolImageAlt:"Image from tool output",imagesAsPathHint:"This model cannot view images directly: on send, images are saved to the session scratchpad and passed as file paths (viewed via describe_image)",infoPanel:"Session info",sessionStats:"Stats",statTokens:"Total Tokens",statElapsed:"Elapsed",statInput:"Input tokens",statCached:"cached",statOutput:"Output tokens",statTps:"Output TPS",statParenOpen:" (",statParenClose:")",noSessions:"No Sessions yet",emptyStream:"Send a message to start the conversation",historyLoadFailed:"Failed to load history",statsLabel:"Stats",removeImage:"Remove image",openWorkspace:"Open workspace",openAgents:"Agents panel",filesInMessage:e=>`${e} ${e===1?"file":"files"}`,imagesInMessage:e=>`${e} ${e===1?"image":"images"}`,openPreview:"Click to preview",showMoreFiles:e=>`Show ${e} more ${e===1?"file":"files"}`,showLess:"Show less",moreGroups:e=>`More groups (${e})`,contextUsage:"Context usage",contextUnknown:"Context usage: unknown until the next request reports it",slashHint:"Type / for commands",switchAgent:"Hand off to another agent — opens a new session on send",switchAgentTitle:"Choose agent",agentSearchPlaceholder:"Search agents: id / name",agentsNoMatch:"No matching agents",handoffTargetTitle:e=>`Sending hands this conversation to ${e}`,handoffRemove:"Remove handoff target",skillsSelect:"Skills",skillRemove:"Remove skill",skillsSearchPlaceholder:"Search skills",skillsNoMatch:"No matching skills",skillsEmptyHint:"No skills installed yet — add some from the skill library",skillsAutoMessage:e=>e.length===1?`use the ${e[0]} skill`:`use the ${e.join(", ")} skills`,handoffFrom:e=>`Handed off from ${e}'s conversation`,handoffBack:e=>e?`Back to the original conversation: ${e}`:"Back to the original conversation",switchModel:"Switch model — on send, continues this conversation in a new session",switchModelTitle:"Switch model",modelSwitchTargetTitle:e=>`Sending continues this conversation on ${e}`,modelSwitchRemove:"Remove model switch",modelSwitchBusyHint:"The model switch waits for this turn to finish: the new session continues from this session's record",modelSwitchFrom:e=>e?`Switched model (was ${e}) — continued from the earlier conversation`:"Switched model — continued from the earlier conversation",modelSwitchAutoMessage:"Continue this conversation on the new model",scheduledFrom:e=>`Triggered by scheduled task "${e}"`,emptyGreeting:"Start a new conversation",compactionRunning:e=>`Compaction in progress (${e})…`,compactionDone:e=>e==="discard"?"[Compaction] done, old context discarded":"[Compaction] done, switched to the summarized context",compactionFailed:e=>`[Compaction] ${e==="aborted"?"aborted":"failed"}, keeping current context`,unknownTool:"(unknown tool)",workRunning:"Running",workDone:"Done",workGroupSteps:e=>`${e} ${e===1?"step":"steps"}`,approvalWaiting:"awaiting approval",copyCode:"Copy code",copyReply:"Copy reply",copyMessage:"Copy message",deleteSession:"Delete chat",renameSession:"Rename chat",renameSessionLabel:"Title",deleteSessionConfirm:e=>`Delete "${e}"? Its messages and Trace will be removed permanently.`,archiveSession:"Archive",unarchiveSession:"Unarchive",loadMore:"More",folderGroups:{subagent:e=>`Subagents (${e})`,schedule:e=>`Scheduled (${e})`,archived:e=>`Archived (${e})`},skillsBanner:e=>`Using skill${e.length===1?"":"s"}: ${e.join(", ")}`,attachedFilesBanner:e=>`Attached file${e.length===1?"":"s"}: ${e.join(", ")}`,plusMenu:"More input options",uploadImage:"Upload image",uploadImageDesc:"Attach images to this message",uploadFile:"Upload file",uploadFileDesc:"Saved to the session scratchpad; the model reads them by path",removeFile:"Remove file",attachmentTooLarge:e=>`${e} exceeds the 10MB limit and was not attached.`,goalMode:"Goal mode",goalModeDesc:"Loop until the goal completes",goalBudgetLabel:"Token budget",goalBudgetUnlimited:"Budget unlimited",goalBudgetValue:e=>`Budget ${e}`,goalBudgetPlaceholder:"e.g. 500k",goalBudgetHint:"Use a k/m suffix; leave blank for no budget limit",goalBudgetInvalid:"Invalid budget: use a positive number with an optional k/m suffix (500k, 2m)",goalBudgetSave:"Save budget",goalRemove:"Exit goal mode",goalRoundBanner:e=>`Goal · round ${e}`,goalRoundImages:e=>e===1?"1 attached image":`${e} attached images`,goalProgress:(e,n)=>`round ${e} · tokens ${n}`,goalStatus:{active:"running",complete:"complete",blocked:"blocked",budget_limited:"budget exhausted",aborted:"interrupted"}},subagentPanel:{title:"Agents panel",topologyLabel:"Call graph",mainSessionNote:"The main conversation stays in the chat area",empty:"No subagents in the current task yet",nodeRunning:"running",nodeDone:"done"},files:{title:"Files",upload:"Upload",download:"Download",openInNewTab:"Open in new tab",previewNotIsolatedHint:"This address has no separate preview origin, so the page opens sandboxed: localStorage, cookies and third-party embeds will not work. Reach the app over 127.0.0.1 or localhost, or set PENGUIN_PREVIEW_ORIGIN.",refresh:"Refresh",root:"Workspace root",empty:"Empty directory",previewUnsupported:"Preview not supported for this type; download instead",uploaded:"Uploaded",overwriteTitle:"Overwrite existing files",overwriteConfirm:e=>`The current directory already has ${e} file(s) with these names — uploading will overwrite:`,loadFailed:"Failed to load",previewTruncated:"File too large; preview truncated, download for the full file",details:"Details",workspacePath:"Workspace path",htmlRendered:"Rendered",htmlSource:"Source",backToList:"Back to list",resizeHandle:"Drag to resize, double-click to reset"},usage:{title:"Costs & usage",today:"Today",last7d:"Last 7 days",total:"Total",tokens:"Tokens",requests:"Requests",from:"From",to:"To",colCacheRead:"cache_read",colCacheWrite:"cache_write",colOutput:"output",uncostedNote:"* Only models with configured pricing count toward cost",filterAllAgents:"All agents",filterAllModels:"All models",chartAgentCalls:"Calls per agent",chartSuccessRate:"Model success rate",chartTokenTrend:"Daily token trend",chartCostTrend:"Daily cost trend",empty:"No usage records",successAborted:"Aborted (excluded)",errors:"Errors",errorsTotal:"Total",errorsUnexpected:"Unexpected",errorsExpected:"Expected",errorsTopCode:"Most common",errorsColCode:"Source · code",errorsColKind:"Type",errorsColMessage:"Message",errorsEmpty:"No errors",errorsNewer:"Newer",errorsOlder:"Older",errorsPageOf:(e,n,r)=>`Page ${e} / ${n} · ${r} total`},traces:{title:"Traces",timeline:"Execution timeline",laneLLM:"Model",kindThinking:"thinking",kindModelReply:"model reply",kindToolGen:"tool call gen",legendToolExec:"tool exec",legendApprovalWait:"approval wait",task:e=>`Turn ${e}`,globalSummary:"Overall",tasksLabel:"Turns",messages:"Messages",truncatedNote:(e,n)=>`Showing first ${e} / ${n} messages`,zoom:"Zoom",zoomReset:"Double-click to reset zoom",zoomOut:"Zoom out",zoomIn:"Zoom in",linkHint:"Hover a timeline segment or event row to cross-highlight, click a segment to jump to its message; legend highlights its kind; drag the bar below to pan/zoom",filesTitle:"Trace files",selectSession:"Select a Session on the left",toolCalls:"Tool calls",taskInput:"Input tokens this turn",taskOutput:"Output tokens this turn",cacheHit:"Cache hits",hitRate:"Hit rate",compactions:"compactions",compactionRound:"Compaction",empty:"No Traces for this agent",inProgress:"in progress",systemPrompt:"System prompt",toolDefs:e=>`Tool definitions (${e})`,exportFile:"Export",importTrace:"Import Trace",importing:"Importing…",fileTooLarge:"The file exceeds the 14MB limit."},benchmark:{title:"Evaluation Center",selectBenchmark:"Select a Benchmark on the left",emptyAgent:"No Benchmarks for this agent",caseCount:e=>`${e} case${e===1?"":"s"}`,trendTitle:e=>`${e} over time`,cases:"Cases",viewCase:"View details",taskMaterials:"Task materials",rubric:"Scoring rubric",agentHidden:"Hidden from Target Agent",caseFileUnavailable:"Case files are unavailable",evaluations:"Evaluations",noEvaluations:"No evaluations yet",summaryLabel:"Summary",legendUnlabeled:"unlabeled model",colVersion:"Version",colModel:"Model ID",colThinkingLevel:"Thinking level",colScore:"Score",colDuration:"Duration",colCase:"Case",colRun:"Run",colSession:"Session"},errors:{networkError:"Network error, please check your connection",modelCredentialMissing:e=>`Model ${e} has no API key yet — configure it on the Models page first`,noDefaultModel:"This project has no default model yet — add one on the Models page first",byCode:{invalid_credentials:"Incorrect username or password.",password_mismatch:"The current password is incorrect.",invalid_password:"Password must be at least 8 characters.",admin_required:"Only an admin can perform this operation.",not_found:"This resource does not exist, or you do not have access.",agent_not_found:"This agent no longer exists.",agent_exists:"This agent id is already taken.",project_exists:"This Project id is already taken.",user_exists:"This username is already taken.",user_not_found:"This user no longer exists.",cannot_delete_admin:"The built-in admin cannot be deleted.",member_not_found:"This user is not a member of the Project.",schedule_exists:"A scheduled task with this name already exists.",schedule_not_found:"This scheduled task no longer exists.",unknown_skill:"This skill is not in the library.",file_not_found:"This file no longer exists.",file_too_large:"The file is too large.",too_many_files:"Too many files attached to one message.",payload_too_large:"The request is too large.",dir_not_absolute:"The directory must be an absolute path.",not_a_dir:"That path is not a directory.",path_not_found:"That path does not exist.",workspace_missing:"This Session's Workspace no longer exists.",task_in_progress:"This Session already has a task running.",version_conflict:"The snapshot's version is not newer than the current one.",invalid_title:"The title is invalid.",invalid_trace:"This file is not a valid Trace file.",trace_session_exists:"This agent already has a Session with that id; a duplicate Trace cannot be imported."}}},hv="penguin.lang",pv=v.createContext(null);function Pj(e){return e?.toLowerCase().startsWith("zh")?"zh":"en"}function Fj(){return Pj(navigator.language)}function qj(e){return e==="system"?Fj():e}function Vj(){const e=localStorage.getItem(hv);return e==="zh"||e==="en"||e==="system"?e:"system"}function Gj({children:e}){const[n,r]=v.useState(Vj),[,s]=v.useState(0),o=qj(n);Bj(o==="en"?Hj:mv),v.useEffect(()=>{if(n!=="system")return;const d=()=>s(f=>f+1);return window.addEventListener("languagechange",d),()=>window.removeEventListener("languagechange",d)},[n]);const c=v.useCallback(d=>{localStorage.setItem(hv,d),r(d)},[]);return l.jsx(pv.Provider,{value:{lang:n,locale:o,setLang:c},children:e})}function Wj({children:e}){const{locale:n}=Ja();return l.jsx("div",{className:"contents",children:e},n)}function Ja(){const e=v.useContext(pv);if(!e)throw new Error("useLocale must be used within a LocaleProvider");return e}const Gh=7,gv="penguin.theme",xv="penguin.fontScale",yv="penguin.accent",bv="penguin.currency",Kj={sm:"16px",md:"18px",lg:"20px"},vv=v.createContext(null);function Yj(){const e=localStorage.getItem(gv);return e==="light"||e==="dark"||e==="system"?e:"system"}function Qj(){const e=localStorage.getItem(xv);return e==="sm"||e==="md"||e==="lg"?e:"md"}function Xj(){const e=localStorage.getItem(yv);return e==="neutral"||e==="blue"||e==="green"||e==="violet"||e==="rose"||e==="amber"?e:"neutral"}function Zj(){return localStorage.getItem(bv)==="CNY"?"CNY":"USD"}function Jj(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function e5({children:e}){const[n,r]=v.useState(Yj),[s,o]=v.useState(Jj),[c,d]=v.useState(Qj),[f,m]=v.useState(Xj),[h,p]=v.useState(Zj),y=n==="system"?s:n==="dark";v.useEffect(()=>{document.documentElement.classList.toggle("dark",y)},[y]),v.useEffect(()=>{document.documentElement.style.fontSize=Kj[c]},[c]),v.useEffect(()=>{f==="neutral"?delete document.documentElement.dataset.accent:document.documentElement.dataset.accent=f},[f]),v.useEffect(()=>{if(n!=="system")return;const M=window.matchMedia("(prefers-color-scheme: dark)"),E=R=>o(R.matches);return o(M.matches),M.addEventListener("change",E),()=>M.removeEventListener("change",E)},[n]);const k=v.useCallback(M=>{localStorage.setItem(gv,M),r(M)},[]),w=v.useCallback(M=>{localStorage.setItem(xv,M),d(M)},[]),S=v.useCallback(M=>{localStorage.setItem(yv,M),m(M)},[]),T=v.useCallback(M=>{localStorage.setItem(bv,M),p(M)},[]);return l.jsx(vv.Provider,{value:{mode:n,dark:y,setMode:k,fontScale:c,setFontScale:w,accent:f,setAccent:S,currency:h,setCurrency:T},children:e})}function Ns(){const e=v.useContext(vv);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}const t5=[{value:"neutral",color:"#6b7280"},{value:"blue",color:"#2563eb"},{value:"green",color:"#15803d"},{value:"violet",color:"#7c3aed"},{value:"rose",color:"#be123c"},{value:"amber",color:"#b45309"}];class Xa extends Error{status;code;constructor(n,r,s){super(s),this.name="ApiError",this.status=n,this.code=r}}let kv=null;function Uy(e){kv=e}function n5(e){return e.startsWith("/api/auth/")}async function Te(e,n={}){return(await wv(e,n)).data}async function wv(e,n={}){let r=e;if(n.query){const f=new URLSearchParams;for(const[h,p]of Object.entries(n.query))p!==void 0&&f.set(h,String(p));const m=f.toString();m&&(r+=`?${m}`)}let s;try{s=await fetch(r,{method:n.method??"GET",credentials:"same-origin",...n.body!==void 0?{headers:{"Content-Type":"application/json"},body:JSON.stringify(n.body)}:{}})}catch{throw new Xa(0,"network_error",g.errors.networkError)}if(!s.ok){let f="http_error",m=g.common.unknownError;try{const h=await s.json();h.error?.code&&(f=h.error.code),h.error?.message&&(m=h.error.message)}catch{}throw s.status===401&&!n5(e)&&kv?.(),new Xa(s.status,f,m)}const o=Date.parse(s.headers.get("date")??""),c=Number.isFinite(o)?o:null;if(s.status===204)return{data:void 0,serverNowMs:c};const d=await s.text();return d?{data:JSON.parse(d),serverNowMs:c}:{data:void 0,serverNowMs:c}}const a5=e=>Te("/api/auth/login",{method:"POST",body:e}),r5=()=>Te("/api/auth/logout",{method:"POST",body:{}}),Cu=()=>Te("/api/me"),s5=e=>Te("/api/me/password",{method:"PUT",body:e}),Sv=()=>Te("/api/me/prefs"),Wh=e=>Te("/api/me/prefs",{method:"PUT",body:e}),l5=()=>Te("/api/admin/users"),i5=e=>Te("/api/admin/users",{method:"POST",body:e}),o5=(e,n)=>Te(`/api/admin/users/${encodeURIComponent(e)}/password`,{method:"POST",body:n}),c5=e=>Te(`/api/admin/users/${encodeURIComponent(e)}`,{method:"DELETE"}),u5=()=>Te("/api/projects"),d5=e=>Te("/api/projects",{method:"POST",body:e}),f5=(e,n)=>Te(`/api/projects/${encodeURIComponent(e)}`,{method:"PATCH",body:n}),m5=e=>Te(`/api/projects/${encodeURIComponent(e)}`,{method:"DELETE"}),Sm=e=>Te(`/api/projects/${encodeURIComponent(e)}/members`),h5=(e,n)=>Te(`/api/projects/${encodeURIComponent(e)}/members`,{method:"POST",body:n}),p5=(e,n)=>Te(`/api/projects/${encodeURIComponent(e)}/members/${encodeURIComponent(n)}`,{method:"DELETE"}),Xu=e=>Te(`/api/projects/${encodeURIComponent(e)}/models`),g5=(e,n)=>Te(`/api/projects/${encodeURIComponent(e)}/models`,{method:"PUT",body:n}),jv=(e,n)=>Te(`/api/projects/${encodeURIComponent(e)}/models/test`,{method:"POST",body:n}),x5=(e,n)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/vault`),y5=(e,n,r)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/vault`,{method:"PUT",body:r}),b5=e=>Te(`/api/projects/${encodeURIComponent(e)}/agents`),v5=(e,n)=>Te(`/api/projects/${encodeURIComponent(e)}/agents`,{method:"POST",body:n}),Kh=(e,n)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/config`),Nv=(e,n,r)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/config`,{method:"PUT",body:r}),k5=(e,n)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/config/reset`,{method:"POST"}),w5=(e,n)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces`),$y=(e,n,r)=>{const s=r?`?limit=${r.limit}&offset=${r.offset}`+(r.category?`&category=${r.category}`:"")+(r.withCounts?"&counts=1":"")+(r.cli?"&cli=1":""):"";return Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/sessions${s}`)},By=(e,n="")=>Te(`/api/projects/${encodeURIComponent(e)}/dirs?path=${encodeURIComponent(n)}`),ih=(e,n,r)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/sessions`,{method:"POST",body:r}),Hy=e=>Te(`/api/sessions/${encodeURIComponent(e)}`),oh=(e,n)=>Te(`/api/sessions/${encodeURIComponent(e)}`,{method:"PATCH",body:n}),_u=e=>Te(`/api/sessions/${encodeURIComponent(e)}`,{method:"DELETE"}),S5=e=>wv(`/api/sessions/${encodeURIComponent(e)}/messages`).then(({data:n,serverNowMs:r})=>({...n,serverNowMs:r})),uo=(e,n)=>Te(`/api/sessions/${encodeURIComponent(e)}/tasks`,{method:"POST",body:n}),j5=e=>Te(`/api/sessions/${encodeURIComponent(e)}/goal`),N5=(e,n,r)=>Te(`/api/sessions/${encodeURIComponent(e)}/approvals/${encodeURIComponent(n)}`,{method:"POST",body:r}),C5=e=>Te(`/api/sessions/${encodeURIComponent(e)}/abort`,{method:"POST",body:{}}),T5=e=>Te(`/api/sessions/${encodeURIComponent(e)}/retry-now`,{method:"POST",body:{}}),M5=(e,n)=>Te(`/api/sessions/${encodeURIComponent(e)}/steer`,{method:"POST",body:n}),E5=e=>Te(`/api/sessions/${encodeURIComponent(e)}/compact`,{method:"POST",body:{}}),A5=(e,n,r,s,o,c)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/${encodeURIComponent(r)}/${s}`,{query:{offset:o,limit:c}}),R5=(e,n,r,s)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/${encodeURIComponent(r)}/${s}/analysis`),_5=(e,n,r,s)=>`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/${encodeURIComponent(r)}/${s}/download`,I5=(e,n,r)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/import`,{method:"POST",body:r}),L5=(e,n)=>Te(`/api/projects/${encodeURIComponent(e)}/usage/errors`,{query:{offset:String(n.offset),limit:String(n.limit),from:n.from,to:n.to,agentId:n.agentId}}),Cv=(e,n)=>Te(`/api/projects/${encodeURIComponent(e)}/usage`,{query:{from:n.from,to:n.to,groupBy:n.groupBy,agentId:n.agentId,provider:n.provider,modelId:n.modelId}}),O5=(e,n)=>Te(`/api/projects/${e}/agents/${n}`,{method:"DELETE"}),D5=(e,n)=>Te(`/api/sessions/${e}/files`,{query:{path:n}}),xs=(e,n,r=!1)=>`/api/sessions/${e}/files/content?path=${encodeURIComponent(n)}${r?"&download=1":""}`,Py=(e,n)=>`/api/sessions/${e}/files/preview-redirect?path=${encodeURIComponent(n)}`,z5=(e,n,r)=>Te(`/api/sessions/${e}/files/content`,{method:"PUT",body:{dataBase64:r},query:{path:n}}),U5=(e,n)=>Te(`/api/sessions/${e}/files/stat`,{method:"POST",body:{paths:n}}),$5=(e,n)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules`),B5=(e,n,r)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules`,{method:"POST",body:r}),Fy=(e,n,r,s)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules/${encodeURIComponent(r)}`,{method:"PUT",body:s}),H5=(e,n,r)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules/${encodeURIComponent(r)}`,{method:"DELETE"}),P5=()=>Te("/api/skills"),Yh=(e,n)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills`),qy=(e,n,r)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills`,{method:"POST",body:{names:r}}),F5=(e,n,r)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills/${encodeURIComponent(r)}`,{method:"DELETE"}),q5=(e,n)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/benchmarks`),V5=(e,n,r)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/benchmarks/${encodeURIComponent(r)}/cases`),Tv=(e,n,r,s,o)=>`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/benchmarks/${encodeURIComponent(r)}/cases/${encodeURIComponent(s)}${o==="rubric"?"/rubric":""}/files`,G5=(e,n,r,s,o,c)=>Te(Tv(e,n,r,s,c),{query:{path:o}}),W5=(e,n,r,s,o,c,d)=>`${Tv(e,n,r,s,c)}/content?path=${encodeURIComponent(o)}`+(d?.download?"&download=1":"")+(d?.preview&&!d.download?"&preview=1":""),K5=(e,n)=>`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/export`,Y5=(e,n,r)=>Te(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/import`,{method:"POST",body:r}),Q5=()=>Te("/api/version"),Mv=(e=!1)=>Te(`/api/version/update-check${e?"?force=1":""}`),X5=()=>Te("/api/version/update",{method:"POST",body:{}}),Ev=v.createContext(null);function Z5({children:e}){const[n,r]=v.useState(void 0),[s,o]=v.useState(!0);v.useEffect(()=>(Uy(()=>r(null)),()=>Uy(null)),[]),v.useEffect(()=>{let m=!1;return Cu().then(h=>{m||(r(h.user),o(h.previewIsolated))}).catch(h=>{m||(h instanceof Xa&&h.status,r(null))}),()=>{m=!0}},[]);const c=v.useCallback(async(m,h)=>{const p=await a5({userId:m,password:h});r(p.user);try{const y=await Cu();r(y.user),o(y.previewIsolated)}catch{}},[]),d=v.useCallback(async()=>{try{await r5()}finally{r(null)}},[]),f=v.useCallback(async()=>{const m=await Cu();r(m.user),o(m.previewIsolated)},[]);return l.jsx(Ev.Provider,{value:{user:n,previewIsolated:s,login:c,logout:d,refresh:f},children:e})}function Bn(){const e=v.useContext(Ev);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const Qh=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Av=/^[\\/]{2}/;function J5(e,n){return n+e.replace(/\\/g,"/")}const Vy="popstate";function Gy(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function eN(e={}){function n(s,o){let c=o.state?.masked,{pathname:d,search:f,hash:m}=c||s.location;return ch("",{pathname:d,search:f,hash:m},o.state&&o.state.usr||null,o.state&&o.state.key||"default",c?{pathname:s.location.pathname,search:s.location.search,hash:s.location.hash}:void 0)}function r(s,o){return typeof o=="string"?o:ko(o)}return nN(n,r,null,e)}function Ft(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function hr(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function tN(){return Math.random().toString(36).substring(2,10)}function Wy(e,n){return{usr:e.state,key:e.key,idx:n,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function ch(e,n,r=null,s,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?Zl(n):n,state:r,key:n&&n.key||s||tN(),mask:o}}function ko({pathname:e="/",search:n="",hash:r=""}){return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Zl(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substring(r),e=e.substring(0,r));let s=e.indexOf("?");s>=0&&(n.search=e.substring(s),e=e.substring(0,s)),e&&(n.pathname=e)}return n}function nN(e,n,r,s={}){let{window:o=document.defaultView,v5Compat:c=!1}=s,d=o.history,f="POP",m=null,h=p();h==null&&(h=0,d.replaceState({...d.state,idx:h},""));function p(){return(d.state||{idx:null}).idx}function y(){f="POP";let M=p(),E=M==null?null:M-h;h=M,m&&m({action:f,location:T.location,delta:E})}function k(M,E){f="PUSH";let R=Gy(M)?M:ch(T.location,M,E);h=p()+1;let I=Wy(R,h),H=T.createHref(R.mask||R);try{d.pushState(I,"",H)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;o.location.assign(H)}c&&m&&m({action:f,location:T.location,delta:1})}function w(M,E){f="REPLACE";let R=Gy(M)?M:ch(T.location,M,E);h=p();let I=Wy(R,h),H=T.createHref(R.mask||R);d.replaceState(I,"",H),c&&m&&m({action:f,location:T.location,delta:0})}function S(M){return aN(o,M)}let T={get action(){return f},get location(){return e(o,d)},listen(M){if(m)throw new Error("A history only accepts one active listener");return o.addEventListener(Vy,y),m=M,()=>{o.removeEventListener(Vy,y),m=null}},createHref(M){return n(o,M)},createURL:S,encodeLocation(M){let E=S(M);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:k,replace:w,go(M){return d.go(M)}};return T}function aN(e,n,r=!1){let s="http://localhost";e&&(s=e.location.origin!=="null"?e.location.origin:e.location.href),Ft(s,"No window.location.(origin|href) available to create URL");let o=typeof n=="string"?n:ko(n);return o=o.replace(/ $/,"%20"),!r&&Av.test(o)&&(o=s+o),new URL(o,s)}function Rv(e,n,r="/"){return rN(e,n,r,!1)}function rN(e,n,r,s,o){let c=Ss((typeof n=="string"?Zl(n):n).pathname||"/",r);if(c==null)return null;let d=sN(e),f=null,m=Dv(c);for(let h=0;f==null&&h<d.length;++h)f=xN(d[h],m,s);return f}function sN(e){let n=_v(e);return lN(n),n}function _v(e,n=[],r=[],s="",o=!1){let c=(d,f,m=o,h)=>{let p={relativePath:h===void 0?d.path||"":h,caseSensitive:d.caseSensitive===!0,childrenIndex:f,route:d};if(p.relativePath.startsWith("/")){if(!p.relativePath.startsWith(s)&&m)return;Ft(p.relativePath.startsWith(s),`Absolute route path "${p.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),p.relativePath=p.relativePath.slice(s.length)}let y=Ya([s,p.relativePath]),k=r.concat(p);d.children&&d.children.length>0&&(Ft(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${y}".`),_v(d.children,n,k,y,m)),!(d.path==null&&!d.index)&&n.push({path:y,score:pN(y,d.index),routesMeta:k.map((w,S)=>{let[T,M]=Ov(w.relativePath,w.caseSensitive,S===k.length-1);return{...w,matcher:T,compiledParams:M}})})};return e.forEach((d,f)=>{if(d.path===""||!d.path?.includes("?"))c(d,f);else for(let m of Iv(d.path))c(d,f,!0,m)}),n}function Iv(e){let n=e.split("/");if(n.length===0)return[];let[r,...s]=n,o=r.endsWith("?"),c=r.replace(/\?$/,"");if(s.length===0)return o?[c,""]:[c];let d=Iv(s.join("/")),f=[];return f.push(...d.map(m=>m===""?c:[c,m].join("/"))),o&&f.push(...d),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function lN(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:gN(n.routesMeta.map(s=>s.childrenIndex),r.routesMeta.map(s=>s.childrenIndex)))}const iN=/^:[\w-]+$/,oN=/^:[\w-]+/,cN=3.5,uN=3,dN=2,fN=1,mN=10,hN=-2,Ky=e=>e==="*";function pN(e,n){let r=e.split("/"),s=r.length;return r.some(Ky)&&(s+=hN),n&&(s+=dN),r.filter(o=>!Ky(o)).reduce((o,c)=>o+(iN.test(c)?uN:oN.test(c)?cN:c===""?fN:mN),s)}function gN(e,n){return e.length===n.length&&e.slice(0,-1).every((r,s)=>r===n[s])?e[e.length-1]-n[n.length-1]:0}function xN(e,n,r=!1){let{routesMeta:s}=e,o={},c="/",d=[];for(let f=0;f<s.length;++f){let m=s[f],h=f===s.length-1,p=c==="/"?n:n.slice(c.length)||"/",y={path:m.relativePath,caseSensitive:m.caseSensitive,end:h},k=m.matcher&&m.compiledParams?Lv(y,p,m.matcher,m.compiledParams):wo(y,p),w=m.route;if(!k&&h&&r&&!s[s.length-1].route.index&&(k=wo({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},p)),!k)return null;Object.assign(o,k.params),d.push({params:o,pathname:Ya([c,k.pathname]),pathnameBase:vN(Ya([c,k.pathnameBase])),route:w}),k.pathnameBase!=="/"&&(c=Ya([c,k.pathnameBase]))}return d}function wo(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,s]=Ov(e.path,e.caseSensitive,e.end);return Lv(e,n,r,s)}function Lv(e,n,r,s){let o=n.match(r);if(!o)return null;let c=o[0],d=c.replace(/(.)\/+$/,"$1"),f=o.slice(1);return{params:s.reduce((m,{paramName:h,isOptional:p},y)=>{if(h==="*"){let w=f[y]||"";d=c.slice(0,c.length-w.length).replace(/(.)\/+$/,"$1")}const k=f[y];return p&&!k?m[h]=void 0:m[h]=(k||"").replace(/%2F/g,"/"),m},{}),pathname:c,pathnameBase:d,pattern:e}}function Ov(e,n=!1,r=!0){hr(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let s=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,f,m,h)=>{if(s.push({paramName:d,isOptional:f!=null}),f){let p=h.charAt(m+c.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(?=\/|$|\()/g,"(?:/$1)?");return e.endsWith("*")?(s.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,n?void 0:"i"),s]}function Dv(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return hr(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),e}}function Ss(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,s=e.charAt(r);return s&&s!=="/"?null:e.slice(r)||"/"}function yN(e,n="/"){let{pathname:r,search:s="",hash:o=""}=typeof e=="string"?Zl(e):e,c;return r?(r=zv(r),r.startsWith("/")?c=Yy(r.substring(1),"/"):c=Yy(r,n)):c=n,{pathname:c,search:kN(s),hash:wN(o)}}function Yy(e,n){let r=Uv(n).split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function jm(e,n,r,s){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(s)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function bN(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function Xh(e){let n=bN(e);return n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase)}function Zu(e,n,r,s=!1){let o;typeof e=="string"?o=Zl(e):(o={...e},Ft(!o.pathname||!o.pathname.includes("?"),jm("?","pathname","search",o)),Ft(!o.pathname||!o.pathname.includes("#"),jm("#","pathname","hash",o)),Ft(!o.search||!o.search.includes("#"),jm("#","search","hash",o)));let c=e===""||o.pathname==="",d=c?"/":o.pathname,f;if(d==null)f=r;else{let y=n.length-1;if(!s&&d.startsWith("..")){let k=d.split("/");for(;k[0]==="..";)k.shift(),y-=1;o.pathname=k.join("/")}f=y>=0?n[y]:"/"}let m=yN(o,f),h=d&&d!=="/"&&d.endsWith("/"),p=(c||d===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(h||p)&&(m.pathname+="/"),m}const zv=e=>e.replace(/[\\/]{2,}/g,"/"),Ya=e=>zv(e.join("/")),Uv=e=>e.replace(/\/+$/,""),vN=e=>Uv(e).replace(/^\/*/,"/"),kN=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,wN=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;var SN=class{status;statusText;data;error;internal;constructor(e,n,r,s=!1){this.status=e,this.statusText=n||"",this.internal=s,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function jN(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function NN(e){return Ya(e.map(n=>n.route.path).filter(Boolean))||"/"}const $v=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Bv(e,n){let r=e;if(typeof r!="string"||!Qh.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let s=r,o=!1;if($v)try{let c=new URL(window.location.href),d=Av.test(r)?new URL(J5(r,c.protocol)):new URL(r),f=Ss(d.pathname,n);d.origin===c.origin&&f!=null?r=f+d.search+d.hash:o=!0}catch{hr(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:o,to:r}}const Hv=["POST","PUT","PATCH","DELETE"];new Set(Hv);const CN=["GET",...Hv];new Set(CN);const TN=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function MN(e){try{return TN.includes(new URL(e).protocol)}catch{return!1}}const Jl=v.createContext(null);Jl.displayName="DataRouter";const Ju=v.createContext(null);Ju.displayName="DataRouterState";const Pv=v.createContext(!1);function EN(){return v.useContext(Pv)}const Fv=v.createContext({isTransitioning:!1});Fv.displayName="ViewTransition";const AN=v.createContext(new Map);AN.displayName="Fetchers";const RN=v.createContext(null);RN.displayName="Await";const $a=v.createContext(null);$a.displayName="Navigation";const _o=v.createContext(null);_o.displayName="Location";const Ba=v.createContext({outlet:null,matches:[],isDataRoute:!1});Ba.displayName="Route";const Zh=v.createContext(null);Zh.displayName="RouteError";const qv="REACT_ROUTER_ERROR",_N="REDIRECT",IN="ROUTE_ERROR_RESPONSE";function LN(e){if(e.startsWith(`${qv}:${_N}:{`))try{let n=JSON.parse(e.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function ON(e){if(e.startsWith(`${qv}:${IN}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new SN(n.status,n.statusText,n.data)}catch{}}function DN(e,{relative:n}={}){Ft(sl(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:s}=v.useContext($a),{hash:o,pathname:c,search:d}=Io(e,{relative:n}),f=c;return r!=="/"&&(f=c==="/"?r:Ya([r,c])),s.createHref({pathname:f,search:d,hash:o})}function sl(){return v.useContext(_o)!=null}function xa(){return Ft(sl(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(_o).location}function Vv(e){Ft(sl(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:n}=xa();return v.useMemo(()=>wo(e,Dv(n)),[n,e])}const Gv="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function ya(){let{isDataRoute:e}=v.useContext(Ba);return e?ZN():zN()}function zN(){Ft(sl(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(Jl),{basename:n,navigator:r}=v.useContext($a),{matches:s}=v.useContext(Ba),{pathname:o}=xa(),c=JSON.stringify(Xh(s)),d=v.useRef(!1);return v.useLayoutEffect(()=>{d.current=!0}),v.useCallback((f,m={})=>{if(hr(d.current,Gv),!d.current)return;if(typeof f=="number"){r.go(f);return}let h=Zu(f,JSON.parse(c),o,m.relative==="path");e==null&&n!=="/"&&(h.pathname=h.pathname==="/"?n:Ya([n,h.pathname])),(m.replace?r.replace:r.push)(h,m.state,m)},[n,r,c,o,e])}const UN=v.createContext(null);function $N(e){let n=v.useContext(Ba).outlet;return v.useMemo(()=>n&&v.createElement(UN.Provider,{value:e},n),[n,e])}function Wv(){let{matches:e}=v.useContext(Ba);return e[e.length-1]?.params??{}}function Io(e,{relative:n}={}){let{matches:r}=v.useContext(Ba),{pathname:s}=xa(),o=JSON.stringify(Xh(r));return v.useMemo(()=>Zu(e,JSON.parse(o),s,n==="path"),[e,o,s,n])}function BN(e,n){return Kv(e,n)}function Kv(e,n,r){Ft(sl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=v.useContext($a),{matches:o}=v.useContext(Ba),c=o[o.length-1],d=c?c.params:{};c&&c.pathname;let f=c?c.pathnameBase:"/";c&&c.route;let m=xa(),h;if(n){let S=typeof n=="string"?Zl(n):n;Ft(f==="/"||S.pathname?.startsWith(f),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${S.pathname}" was given in the \`location\` prop.`),h=S}else h=m;let p=h.pathname||"/",y=p;if(f!=="/"){let S=f.replace(/^\//,"").split("/");y="/"+p.replace(/^\//,"").split("/").slice(S.length).join("/")}let k=r&&r.state.matches.length?r.state.matches.map(S=>Object.assign(S,{route:r.manifest[S.route.id]||S.route})):Rv(e,{pathname:y}),w=GN(k&&k.map(S=>Object.assign({},S,{params:Object.assign({},d,S.params),pathname:Ya([f,s.encodeLocation?s.encodeLocation(S.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?f:Ya([f,s.encodeLocation?s.encodeLocation(S.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:S.pathnameBase])})),o,r);return n&&w?v.createElement(_o.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...h},navigationType:"POP"}},w):w}function HN(){let e=XN(),n=jN(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null;return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},n),r?v.createElement("pre",{style:{padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"}},r):null,null)}const PN=v.createElement(HN,null);var FN=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=Pv;static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=ON(e.digest);r&&(e=r)}let n=e!==void 0?v.createElement(Ba.Provider,{value:this.props.routeContext},v.createElement(Zh.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?v.createElement(qN,{error:e},n):n}};const Nm=new WeakMap;function qN({children:e,error:n}){let{basename:r}=v.useContext($a);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let s=LN(n.digest);if(s){let o=Nm.get(n);if(o)throw o;let c=Bv(s.location,r),d=c.absoluteURL||c.to;if(MN(d))throw new Error("Invalid redirect location");if($v&&!Nm.get(n))if(c.isExternal||s.reloadDocument)window.location.href=d;else{const f=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:s.replace}));throw Nm.set(n,f),f}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d}`})}}return e}function VN({routeContext:e,match:n,children:r}){let s=v.useContext(Jl);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(Ba.Provider,{value:e},r)}function GN(e,n=[],r){let s=r?.state;if(e==null){if(!s)return null;if(s.errors)e=s.matches;else if(n.length===0&&!s.initialized&&s.matches.length>0)e=s.matches;else return null}let o=e,c=s?.errors;if(c!=null){let p=o.findIndex(y=>y.route.id&&c?.[y.route.id]!==void 0);Ft(p>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),o=o.slice(0,Math.min(o.length,p+1))}let d=!1,f=-1;if(r&&s){d=s.renderFallback;for(let p=0;p<o.length;p++){let y=o[p];if((y.route.HydrateFallback||y.route.hydrateFallbackElement)&&(f=p),y.route.id){let{loaderData:k,errors:w}=s,S=y.route.loader&&!k.hasOwnProperty(y.route.id)&&(!w||w[y.route.id]===void 0);if(y.route.lazy||S){r.isStatic&&(d=!0),f>=0?o=o.slice(0,f+1):o=[o[0]];break}}}}let m=r?.onError,h=s&&m?(p,y)=>{m(p,{location:s.location,params:s.matches?.[0]?.params??{},pattern:NN(s.matches),errorInfo:y})}:void 0;return o.reduceRight((p,y,k)=>{let w,S=!1,T=null,M=null;s&&(w=c&&y.route.id?c[y.route.id]:void 0,T=y.route.errorElement||PN,d&&(f<0&&k===0?(JN("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,M=null):f===k&&(S=!0,M=y.route.hydrateFallbackElement||null)));let E=n.concat(o.slice(0,k+1)),R=()=>{let I;return w?I=T:S?I=M:y.route.Component?I=v.createElement(y.route.Component,null):y.route.element?I=y.route.element:I=p,v.createElement(VN,{match:y,routeContext:{outlet:p,matches:E,isDataRoute:s!=null},children:I})};return s&&(y.route.ErrorBoundary||y.route.errorElement||k===0)?v.createElement(FN,{location:s.location,revalidation:s.revalidation,component:T,error:w,children:R(),routeContext:{outlet:null,matches:E,isDataRoute:!0},onError:h}):R()},null)}function Jh(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function WN(e){let n=v.useContext(Jl);return Ft(n,Jh(e)),n}function KN(e){let n=v.useContext(Ju);return Ft(n,Jh(e)),n}function YN(e){let n=v.useContext(Ba);return Ft(n,Jh(e)),n}function ep(e){let n=YN(e),r=n.matches[n.matches.length-1];return Ft(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function QN(){return ep("useRouteId")}function XN(){let e=v.useContext(Zh),n=KN("useRouteError"),r=ep("useRouteError");return e!==void 0?e:n.errors?.[r]}function ZN(){let{router:e}=WN("useNavigate"),n=ep("useNavigate"),r=v.useRef(!1);return v.useLayoutEffect(()=>{r.current=!0}),v.useCallback(async(s,o={})=>{hr(r.current,Gv),r.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:n,...o}))},[e,n])}const Qy={};function JN(e,n,r){Qy[e]||(Qy[e]=!0,hr(!1,r))}v.memo(eC);function eC({routes:e,manifest:n,future:r,state:s,isStatic:o,onError:c}){return Kv(e,void 0,{manifest:n,state:s,isStatic:o,onError:c})}function So({to:e,replace:n,state:r,relative:s}){Ft(sl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=v.useContext($a);hr(!o,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:c}=v.useContext(Ba),{pathname:d}=xa(),f=ya(),m=Zu(e,Xh(c),d,s==="path"),h=JSON.stringify(m);return v.useEffect(()=>{f(JSON.parse(h),{replace:n,state:r,relative:s})},[f,h,s,n,r]),null}function tC(e){return $N(e.context)}function Xn(e){Ft(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function nC({basename:e="/",children:n=null,location:r,navigationType:s="POP",navigator:o,static:c=!1,useTransitions:d}){Ft(!sl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=v.useMemo(()=>({basename:f,navigator:o,static:c,useTransitions:d,future:{}}),[f,o,c,d]);typeof r=="string"&&(r=Zl(r));let{pathname:h="/",search:p="",hash:y="",state:k=null,key:w="default",mask:S}=r,T=v.useMemo(()=>{let M=Ss(h,f);return M==null?null:{location:{pathname:M,search:p,hash:y,state:k,key:w,mask:S},navigationType:s}},[f,h,p,y,k,w,s,S]);return hr(T!=null,`<Router basename="${f}"> is not able to match the URL "${h}${p}${y}" because it does not start with the basename, so the <Router> won't render anything.`),T==null?null:v.createElement($a.Provider,{value:m},v.createElement(_o.Provider,{children:n,value:T}))}function aC({children:e,location:n}){return BN(uh(e),n)}function uh(e,n=[]){let r=[];return v.Children.forEach(e,(s,o)=>{if(!v.isValidElement(s))return;let c=[...n,o];if(s.type===v.Fragment){r.push.apply(r,uh(s.props.children,c));return}Ft(s.type===Xn,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`);let d=s.props;Ft(!d.index||!d.children,"An index route cannot have child routes.");let f={id:d.id||c.join("-"),caseSensitive:d.caseSensitive,element:d.element,Component:d.Component,index:d.index,path:d.path,middleware:d.middleware,loader:d.loader,action:d.action,hydrateFallbackElement:d.hydrateFallbackElement,HydrateFallback:d.HydrateFallback,errorElement:d.errorElement,ErrorBoundary:d.ErrorBoundary,shouldRevalidate:d.shouldRevalidate,handle:d.handle,lazy:d.lazy};d.children&&(f.children=uh(d.children,c)),r.push(f)}),r}const Tu="application/x-www-form-urlencoded";function ed(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function rC(e){return ed(e)&&e.tagName.toLowerCase()==="button"}function sC(e){return ed(e)&&e.tagName.toLowerCase()==="form"}function lC(e){return ed(e)&&e.tagName.toLowerCase()==="input"}function iC(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function oC(e,n){return e.button===0&&(!n||n==="_self")&&!iC(e)}function dh(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,r)=>{let s=e[r];return n.concat(Array.isArray(s)?s.map(o=>[r,o]):[[r,s]])},[]))}function cC(e,n){let r=dh(e);return n&&n.forEach((s,o)=>{r.has(o)||n.getAll(o).forEach(c=>{r.append(o,c)})}),r}let Jc=null;function uC(){if(Jc===null)try{new FormData(document.createElement("form"),0),Jc=!1}catch{Jc=!0}return Jc}const dC=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Cm(e){return e!=null&&!dC.has(e)?(hr(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Tu}"`),null):e}function fC(e,n){let r,s,o,c,d;if(sC(e)){let f=e.getAttribute("action");s=f?Ss(f,n):null,r=e.getAttribute("method")||"get",o=Cm(e.getAttribute("enctype"))||Tu,c=new FormData(e)}else if(rC(e)||lC(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||f.getAttribute("action");if(s=m?Ss(m,n):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||"get",o=Cm(e.getAttribute("formenctype"))||Cm(f.getAttribute("enctype"))||Tu,c=new FormData(f,e),!uC()){let{name:h,type:p,value:y}=e;if(p==="image"){let k=h?`${h}.`:"";c.append(`${k}x`,"0"),c.append(`${k}y`,"0")}else h&&c.append(h,y)}}else{if(ed(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r="get",s=null,o=Tu,d=e}return c&&o==="text/plain"&&(d=c,c=void 0),{action:s,method:r.toLowerCase(),encType:o,formData:c,body:d}}function tp(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Yv(e,n){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r.pathname.endsWith("/")?r.pathname=`${r.pathname}_.${n}`:r.pathname=`${r.pathname}.${n}`,r}async function mC(e,n){if(e.id in n)return n[e.id];try{let r=await import(e.module);return n[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function hC(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function pC(e,n,r){return bC((await Promise.all(e.map(async s=>{let o=n.routes[s.route.id];if(o){let c=await mC(o,r);return c.links?c.links():[]}return[]}))).flat(1).filter(hC).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function Xy(e,n,r,s,o,c){let d=(m,h)=>r[h]?m.route.id!==r[h].route.id:!0,f=(m,h)=>r[h].pathname!==m.pathname||r[h].route.path?.endsWith("*")&&r[h].params["*"]!==m.params["*"];return c==="assets"?n.filter((m,h)=>d(m,h)||f(m,h)):c==="data"?n.filter((m,h)=>{let p=s.routes[m.route.id];if(!p||!p.hasLoader)return!1;if(d(m,h)||f(m,h))return!0;if(m.route.shouldRevalidate){let y=m.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof y=="boolean")return y}return!0}):[]}function gC(e,n,{includeHydrateFallback:r}={}){return xC(e.map(s=>{let o=n.routes[s.route.id];if(!o)return[];let c=[o.module];return o.clientActionModule&&(c=c.concat(o.clientActionModule)),o.clientLoaderModule&&(c=c.concat(o.clientLoaderModule)),r&&o.hydrateFallbackModule&&(c=c.concat(o.hydrateFallbackModule)),o.imports&&(c=c.concat(o.imports)),c}).flat(1))}function xC(e){return[...new Set(e)]}function yC(e){let n={},r=Object.keys(e).sort();for(let s of r)n[s]=e[s];return n}function bC(e,n){let r=new Set;return new Set(n),e.reduce((s,o)=>{let c=JSON.stringify(yC(o));return r.has(c)||(r.add(c),s.push({key:c,link:o})),s},[])}function vC(){let e=v.useContext(Jl);return tp(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function kC(){let e=v.useContext(Ju);return tp(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}const np=v.createContext(void 0);np.displayName="FrameworkContext";function ap(){let e=v.useContext(np);return tp(e,"You must render this element inside a <HydratedRouter> element"),e}function wC(e,n){let r=v.useContext(np),[s,o]=v.useState(!1),[c,d]=v.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:h,onMouseLeave:p,onTouchStart:y}=n,k=v.useRef(null);v.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let T=E=>{E.forEach(R=>{d(R.isIntersecting)})},M=new IntersectionObserver(T,{threshold:.5});return k.current&&M.observe(k.current),()=>{M.disconnect()}}},[e]),v.useEffect(()=>{if(s){let T=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(T)}}},[s]);let w=()=>{o(!0)},S=()=>{o(!1),d(!1)};return r?e!=="intent"?[c,k,{}]:[c,k,{onFocus:Qi(f,w),onBlur:Qi(m,S),onMouseEnter:Qi(h,w),onMouseLeave:Qi(p,S),onTouchStart:Qi(y,w)}]:[!1,k,{}]}function Qi(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function SC({page:e,...n}){let r=EN(),{nonce:s}=ap(),{router:o}=vC(),c=v.useMemo(()=>Rv(o.routes,e,o.basename),[o.routes,e,o.basename]);return c?(n.nonce==null&&s&&(n={...n,nonce:s}),r?v.createElement(NC,{page:e,matches:c,...n}):v.createElement(CC,{page:e,matches:c,...n})):null}function jC(e){let{manifest:n,routeModules:r}=ap(),[s,o]=v.useState([]);return v.useEffect(()=>{let c=!1;return pC(e,n,r).then(d=>{c||o(d)}),()=>{c=!0}},[e,n,r]),s}function NC({page:e,matches:n,...r}){let s=xa(),o=v.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let c=Yv(e,"rsc"),d=!1,f=[];for(let m of n)typeof m.route.shouldRevalidate=="function"?d=!0:f.push(m.route.id);return d&&f.length>0&&c.searchParams.set("_routes",f.join(",")),[c.pathname+c.search]},[e,s,n]);return v.createElement(v.Fragment,null,o.map(c=>v.createElement("link",{key:c,rel:"prefetch",as:"fetch",href:c,...r})))}function CC({page:e,matches:n,...r}){let s=xa(),{manifest:o,routeModules:c}=ap(),{loaderData:d,matches:f}=kC(),m=v.useMemo(()=>Xy(e,n,f,o,s,"data"),[e,n,f,o,s]),h=v.useMemo(()=>Xy(e,n,f,o,s,"assets"),[e,n,f,o,s]),p=v.useMemo(()=>{if(e===s.pathname+s.search+s.hash)return[];let w=new Set,S=!1;if(n.forEach(M=>{let E=o.routes[M.route.id];!E||!E.hasLoader||(!m.some(R=>R.route.id===M.route.id)&&M.route.id in d&&c[M.route.id]?.shouldRevalidate||E.hasClientLoader?S=!0:w.add(M.route.id))}),w.size===0)return[];let T=Yv(e,"data");return S&&w.size>0&&T.searchParams.set("_routes",n.filter(M=>w.has(M.route.id)).map(M=>M.route.id).join(",")),[T.pathname+T.search]},[d,s,o,m,n,e,c]),y=v.useMemo(()=>gC(h,o),[h,o]),k=jC(h);return v.createElement(v.Fragment,null,p.map(w=>v.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...r})),y.map(w=>v.createElement("link",{key:w,rel:"modulepreload",href:w,...r})),k.map(({key:w,link:S})=>v.createElement("link",{key:w,nonce:r.nonce,...S,crossOrigin:S.crossOrigin??r.crossOrigin})))}function TC(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}const MC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{MC&&(window.__reactRouterVersion="8.3.0")}catch{}function EC({basename:e,children:n,useTransitions:r,window:s}){let o=v.useRef(null);o.current==null&&(o.current=eN({window:s,v5Compat:!0}));let c=o.current,[d,f]=v.useState({action:c.action,location:c.location}),m=v.useCallback(h=>{r===!1?f(h):v.startTransition(()=>f(h))},[r]);return v.useLayoutEffect(()=>c.listen(m),[c,m]),v.createElement(nC,{basename:e,children:n,location:d.location,navigationType:d.action,navigator:c,useTransitions:r})}const rp=v.forwardRef(function({onClick:n,discover:r="render",prefetch:s="none",relative:o,reloadDocument:c,replace:d,mask:f,state:m,target:h,to:p,preventScrollReset:y,viewTransition:k,defaultShouldRevalidate:w,...S},T){let{basename:M,navigator:E,useTransitions:R}=v.useContext($a),I=typeof p=="string"&&Qh.test(p),H=Bv(p,M);p=H.to;let D=DN(p,{relative:o}),L=xa(),$=null;if(f){let B=Zu(f,[],L.mask?L.mask.pathname:"/",!0);M!=="/"&&(B.pathname=B.pathname==="/"?M:Ya([M,B.pathname])),$=E.createHref(B)}let[K,X,U]=wC(s,S),V=_C(p,{replace:d,mask:f,state:m,target:h,preventScrollReset:y,relative:o,viewTransition:k,defaultShouldRevalidate:w,useTransitions:R});function O(B){n&&n(B),B.defaultPrevented||V(B)}let W=!(H.isExternal||c),Z=v.createElement("a",{...S,...U,href:(W?$:void 0)||H.absoluteURL||D,onClick:W?O:n,ref:TC(T,X),target:h,"data-discover":!I&&r==="render"?"true":void 0});return K&&!I?v.createElement(v.Fragment,null,Z,v.createElement(SC,{page:D})):Z});rp.displayName="Link";const sp=v.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:s="",end:o=!1,style:c,to:d,viewTransition:f,children:m,...h},p){let y=Io(d,{relative:h.relative}),k=xa(),w=v.useContext(Ju),{navigator:S,basename:T}=v.useContext($a),M=w!=null&&zC(y)&&f===!0,E=S.encodeLocation?S.encodeLocation(y).pathname:y.pathname,R=k.pathname,I=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;r||(R=R.toLowerCase(),I=I?I.toLowerCase():null,E=E.toLowerCase()),I&&T&&(I=Ss(I,T)||I);const H=E!=="/"&&E.endsWith("/")?E.length-1:E.length;let D=R===E||!o&&R.startsWith(E)&&R.charAt(H)==="/",L=I!=null&&(I===E||!o&&I.startsWith(E)&&I.charAt(H)==="/"),$={isActive:D,isPending:L,isTransitioning:M},K=D?n:void 0,X;typeof s=="function"?X=s($):X=[s,D?"active":null,L?"pending":null,M?"transitioning":null].filter(Boolean).join(" ");let U=typeof c=="function"?c($):c;return v.createElement(rp,{...h,"aria-current":K,className:X,ref:p,style:U,to:d,viewTransition:f},typeof m=="function"?m($):m)});sp.displayName="NavLink";const AC=v.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:s,replace:o,state:c,method:d="get",action:f,onSubmit:m,relative:h,preventScrollReset:p,viewTransition:y,defaultShouldRevalidate:k,...w},S)=>{let{useTransitions:T}=v.useContext($a),M=OC(),E=DC(f,{relative:h}),R=d.toLowerCase()==="get"?"get":"post",I=typeof f=="string"&&Qh.test(f),H=D=>{if(m&&m(D),D.defaultPrevented)return;D.preventDefault();let L=D.nativeEvent.submitter,$=L?.getAttribute("formmethod")||d,K=()=>M(L||D.currentTarget,{fetcherKey:n,method:$,navigate:r,replace:o,state:c,relative:h,preventScrollReset:p,viewTransition:y,defaultShouldRevalidate:k});T&&r!==!1?v.startTransition(()=>K()):K()};return v.createElement("form",{ref:S,method:R,action:E,onSubmit:s?m:H,...w,"data-discover":!I&&e==="render"?"true":void 0})});AC.displayName="Form";function RC(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Qv(e){let n=v.useContext(Jl);return Ft(n,RC(e)),n}function _C(e,{target:n,replace:r,mask:s,state:o,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:m,useTransitions:h}={}){let p=ya(),y=xa(),k=Io(e,{relative:d});return v.useCallback(w=>{if(oC(w,n)){w.preventDefault();let S=r!==void 0?r:ko(y)===ko(k),T=()=>p(e,{replace:S,mask:s,state:o,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:m});h?v.startTransition(()=>T()):T()}},[y,p,k,r,s,o,n,e,c,d,f,m,h])}function lp(e){hr(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let n=v.useRef(dh(e)),r=v.useRef(!1),s=xa(),o=v.useMemo(()=>cC(s.search,r.current?null:n.current),[s.search]),c=ya();return[o,v.useCallback((d,f)=>{const m=dh(typeof d=="function"?d(new URLSearchParams(o)):d);r.current=!0,c("?"+m,f)},[c,o])]}let IC=0,LC=()=>`__${String(++IC)}__`;function OC(){let{router:e}=Qv("useSubmit"),{basename:n}=v.useContext($a),r=QN(),s=e.fetch,o=e.navigate;return v.useCallback(async(c,d={})=>{let{action:f,method:m,encType:h,formData:p,body:y}=fC(c,n);d.navigate===!1?await s(d.fetcherKey||LC(),r,d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:p,body:y,formMethod:d.method||m,formEncType:d.encType||h,flushSync:d.flushSync}):await o(d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:p,body:y,formMethod:d.method||m,formEncType:d.encType||h,replace:d.replace,state:d.state,fromRouteId:r,flushSync:d.flushSync,viewTransition:d.viewTransition})},[s,o,n,r])}function DC(e,{relative:n}={}){let{basename:r}=v.useContext($a),s=v.useContext(Ba);Ft(s,"useFormAction must be used inside a RouteContext");let[o]=s.matches.slice(-1),c={...Io(e||".",{relative:n})},d=xa();if(e==null){c.search=d.search;let f=new URLSearchParams(c.search),m=f.getAll("index");if(m.some(h=>h==="")){f.delete("index"),m.filter(p=>p).forEach(p=>f.append("index",p));let h=f.toString();c.search=h?`?${h}`:""}}return(!e||e===".")&&o.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(c.pathname=c.pathname==="/"?r:Ya([r,c.pathname])),ko(c)}function zC(e,{relative:n}={}){let r=v.useContext(Fv);Ft(r!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=Qv("useViewTransitionState"),o=Io(e,{relative:n});if(!r.isTransitioning)return!1;let c=Ss(r.currentLocation.pathname,s)||r.currentLocation.pathname,d=Ss(r.nextLocation.pathname,s)||r.nextLocation.pathname;return wo(o.pathname,d)!=null||wo(o.pathname,c)!=null}const Zy="penguin.lastProjectId",Jy=e=>`penguin.lastAgentId.${e}`,Xv=v.createContext(null);function fh(e){return e.name??e.projectId}function hn(e){return e.name??e.agentId}function UC({children:e}){const[n,r]=v.useState([]),[s,o]=v.useState(!0),[c,d]=v.useState(null),[f,m]=v.useState([]),[h,p]=v.useState(!0),[y,k]=v.useState(null),w=v.useCallback(async()=>{o(!0);try{const R=await u5();r(R.projects),d(I=>{const H=I??localStorage.getItem(Zy);return(R.projects.find(L=>L.projectId===H)??R.projects[0])?.projectId??null})}finally{o(!1)}},[]);v.useEffect(()=>{w()},[w]);const S=v.useCallback(R=>{R!==c&&(localStorage.setItem(Zy,R),d(R),k(null),m([]),p(!0),Wh({lastProjectId:R}).catch(()=>{}))},[c]),T=v.useCallback(async()=>{if(c){p(!0);try{const R=await b5(c);m(R.agents),k(I=>{const H=I??localStorage.getItem(Jy(c)),D=R.agents.find($=>$.agentId===H),L=R.agents.find($=>$.agentId==="default_agent")??R.agents[0]??null;return(D??L)?.agentId??null})}finally{p(!1)}}},[c]);v.useEffect(()=>{m([]),T()},[T]);const M=v.useCallback(R=>{c&&localStorage.setItem(Jy(c),R),k(R)},[c]),E=v.useMemo(()=>{const R=n.find(H=>H.projectId===c)??null,I=f.find(H=>H.agentId===y)??null;return{projects:n,projectsLoading:s,currentProject:R,setCurrentProjectId:S,reloadProjects:w,agents:f,agentsLoading:h,currentAgent:I,setCurrentAgentId:M,reloadAgents:T}},[n,s,c,S,w,f,h,y,M,T]);return l.jsx(Xv.Provider,{value:E,children:e})}function gn(){const e=v.useContext(Xv);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e}function Zv(e,n){const r=new EventSource(e);r.onmessage=o=>{try{n.onOmniMessage(JSON.parse(o.data),o.lastEventId||null)}catch{}},r.addEventListener("server_event",o=>{try{n.onServerEvent(JSON.parse(o.data),o.lastEventId||null)}catch{}}),n.onOpen&&(r.onopen=n.onOpen);const{onError:s}=n;return s&&(r.onerror=()=>s(r.readyState===EventSource.CLOSED)),{close:()=>r.close()}}function $C(e,n){return Zv(`/api/sessions/${encodeURIComponent(e)}/stream`,n)}function BC(e){return Zv("/api/events",e)}const Jv="\0temp-workspaces",HC=/[/\\]workspaces[/\\]tmp-[0-9a-f]{8}$/;function PC(e){const n=e.trim();return n===""||HC.test(n)}function Iu(e){return PC(e)?Jv:e.trim()}function FC(e){const n=e.trim().split(/[/\\]+/).filter(Boolean);return n[n.length-1]??"/"}const Js=10,eu=10;function e1(e,n){return e.length>n?{items:e.slice(0,n),hasMore:!0}:{items:e,hasMore:!1}}function Ka(e){return e.archived?"archived":e.source==="subagent"||e.source==="schedule"?e.source:"active"}const ip=["subagent","schedule","archived"];function t1(e){const n={active:[],subagent:[],schedule:[],archived:[]};for(const r of e)n[Ka(r)].push(r);return n}const qC=["active",...ip];function VC(e){const n=new Map;for(const[r,s]of e)for(const[o,c]of Object.entries(s)){const d=Iu(o);let f=n.get(d);f||(f={totals:{active:0,subagent:0,schedule:0,archived:0},agents:{active:[],subagent:[],schedule:[],archived:[]}},n.set(d,f));for(const m of qC){const h=c[m];h>0&&(f.totals[m]+=h,f.agents[m].includes(r)||f.agents[m].push(r))}}return n}function ek(e){let n=null;for(const r of e){const s=Ka(r);s!=="active"&&s!=="schedule"||(!n||r.createdAt>n.createdAt||r.createdAt===n.createdAt&&r.sessionId>n.sessionId)&&(n=r)}return n}function GC(e){const n=new Map;for(const o of e){const c=Iu(o.workspace);let d=n.get(c);if(!d){const f=c===Jv;d={key:c,label:f?"":FC(o.workspace),fullPath:f?null:o.workspace.trim(),temp:f,sessions:[]},n.set(c,d)}d.sessions.push(o)}const r=(o,c)=>o<c?1:o>c?-1:0,s=[...n.values()];for(const o of s)o.sessions.sort((c,d)=>r(c.createdAt,d.createdAt));return s.sort((o,c)=>o.temp!==c.temp?o.temp?1:-1:r(o.sessions[0]?.createdAt??"",c.sessions[0]?.createdAt??"")),s}function n1(e,n,r){if(r.size===0)return[...e];const s=[],o=[];for(const c of e)(r.has(n(c))?s:o).push(c);return[...s,...o]}const tk=v.createContext(null),ys=(e,n)=>`${e}\0${n}`;function WC({children:e}){const{currentProject:n,agents:r}=gn(),s=n?.projectId??null,o=r.map(oe=>oe.agentId).join(","),[c,d]=v.useState([]),[f,m]=v.useState(new Map),[h,p]=v.useState(new Map),[y,k]=v.useState(new Map),[w,S]=v.useState(!0),[T,M]=v.useState(!1);v.useEffect(()=>{let oe=!1;return Sv().then(A=>{!oe&&A.prefs.showCliSessions===!0&&M(!0)}).catch(()=>{}),()=>{oe=!0}},[]);const E=v.useCallback(oe=>{M(oe),Wh({showCliSessions:oe}).catch(()=>{})},[]),R=v.useRef(0),I=v.useRef([]);I.current=c;const H=v.useRef(f);H.current=f;const D=v.useRef(h);D.current=h;const L=v.useCallback(async()=>{const oe=o===""?[]:o.split(",");if(!s||oe.length===0)return;const A=++R.current;S(!0);try{const C=await Promise.all(oe.map(async he=>{const xe=["active",...ip.filter(ne=>H.current.has(ys(he,ne)))];try{const ne=await Promise.all(xe.map(async pe=>{const be=await $y(s,he,{offset:0,limit:Js+1,category:pe,...pe==="active"?{withCounts:!0}:{},...T?{cli:!0}:{}});return{category:pe,counts:be.counts,workspaceCounts:be.workspaceCounts,...e1(be.sessions,Js)}}));return{agentId:he,pages:ne}}catch{return{agentId:he,pages:[]}}}));if(A!==R.current)return;const z=[],N=new Set,Q=new Map,se=new Map,le=new Map;for(const he of C)for(const xe of he.pages){Q.set(ys(he.agentId,xe.category),{hasMore:xe.hasMore,fetched:xe.items.length}),xe.counts&&se.set(he.agentId,xe.counts),xe.workspaceCounts&&le.set(he.agentId,xe.workspaceCounts);for(const ne of xe.items)N.has(ne.sessionId)||(N.add(ne.sessionId),z.push(ne))}d(z),m(Q),p(se),k(le)}finally{A===R.current&&S(!1)}},[s,o,T]);v.useEffect(()=>{d([]),H.current=new Map,m(H.current),p(new Map),k(new Map),L()},[L]);const $=v.useCallback(async(oe,A)=>{if(!s)return;const C=[...new Set(oe)].filter(se=>{const le=H.current.get(ys(se,A));return le===void 0?(D.current.get(se)?.[A]??0)>0:le.hasMore});if(C.length===0)return;const z=R.current,N=await Promise.all(C.map(async se=>{const le=H.current.get(ys(se,A))?.fetched??0;try{const he=(await $y(s,se,{offset:le,limit:Js+1,category:A,...T?{cli:!0}:{}})).sessions;return{agentId:se,...e1(he,Js)}}catch{return null}}));if(z!==R.current)return;const Q=N.filter(se=>se!==null);d(se=>{const le=new Set(se.map(xe=>xe.sessionId)),he=Q.flatMap(xe=>xe.items.filter(ne=>!le.has(ne.sessionId)));return he.length>0?[...se,...he]:se}),m(se=>{const le=new Map(se);for(const he of Q){const xe=ys(he.agentId,A);le.set(xe,{hasMore:he.hasMore,fetched:(se.get(xe)?.fetched??0)+he.items.length})}return le})},[s,T]),K=v.useCallback((oe,A)=>f.has(ys(oe,A)),[f]),X=v.useCallback((oe,A)=>{const C=f.get(ys(oe,A));return C!==void 0?C.hasMore:(h.get(oe)?.[A]??0)>0},[f,h]),U=v.useCallback((oe,A,C)=>{const{agentId:z,workspace:N}=oe;p(Q=>{const se=Q.get(z);if(!se)return Q;const le=new Map(Q);return le.set(z,{...se,[A]:Math.max(0,se[A]+C)}),le}),k(Q=>{const se=Q.get(z);if(!se)return Q;const le=se[N]??{active:0,subagent:0,schedule:0,archived:0},he=new Map(Q);return he.set(z,{...se,[N]:{...le,[A]:Math.max(0,le[A]+C)}}),he})},[]),V=v.useRef(L);V.current=L;const O=v.useRef(s);O.current=s,v.useEffect(()=>{const oe=BC({onOmniMessage:()=>{},onServerEvent:A=>{A.type==="schedule_fired"&&A.projectId===O.current&&V.current()}});return()=>oe.close()},[]);const W=v.useCallback(oe=>{R.current+=1,!I.current.some(C=>C.sessionId===oe.sessionId)&&H.current.get(ys(oe.agentId,Ka(oe)))?.hasMore===!1&&U(oe,Ka(oe),1),d(C=>[oe,...C.filter(z=>z.sessionId!==oe.sessionId)])},[U]),Z=v.useCallback(oe=>{R.current+=1;const A=I.current.find(C=>C.sessionId===oe);A&&U(A,Ka(A),-1),d(C=>C.filter(z=>z.sessionId!==oe))},[U]),B=v.useCallback(oe=>{const A=I.current.find(C=>C.sessionId===oe.sessionId);A&&Ka(A)!==Ka(oe)&&(U(oe,Ka(A),-1),U(oe,Ka(oe),1)),d(C=>C.map(z=>z.sessionId===oe.sessionId?oe:z))},[U]),F=v.useCallback((oe,A)=>{d(C=>{const z=C.find(N=>N.sessionId===oe);return!z||z.status===A?C:C.map(N=>N.sessionId===oe?{...N,status:A}:N)})},[]),P=v.useCallback((oe,A)=>{d(C=>C.map(z=>z.sessionId===oe?{...z,title:A}:z))},[]),ce=v.useMemo(()=>{const oe=new Map;for(const A of c){const C=oe.get(A.agentId);C?C.push(A):oe.set(A.agentId,[A])}for(const A of oe.values())A.sort((C,z)=>z.createdAt.localeCompare(C.createdAt)||z.sessionId.localeCompare(C.sessionId));return{sessions:c,byAgent:oe,countsByAgent:h,workspaceCountsByAgent:y,isLoadedFor:K,hasMoreFor:X,loading:w,reload:L,loadMoreFor:$,add:W,remove:Z,replace:B,setStatus:F,setTitle:P,showCliSessions:T,setShowCliSessions:E}},[c,h,y,K,X,w,L,$,W,Z,B,F,P,T,E]);return l.jsx(tk.Provider,{value:ce,children:e})}function ll(){const e=v.useContext(tk);if(!e)throw new Error("useSessions must be used within a SessionsProvider");return e}function op({size:e=12,className:n=""}){return l.jsx("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor","aria-hidden":!0,className:`shrink-0 ${n}`,children:l.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function nk({size:e=13,className:n=""}){return l.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":!0,className:`shrink-0 ${n}`,children:l.jsx("path",{d:"M5 12l4 4L19 6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function KC({size:e=13,className:n=""}){return l.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":!0,className:`shrink-0 ${n}`,children:l.jsx("path",{d:"M12 4v11m0 0l-5-5m5 5l5-5M4 20h16",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function YC({size:e=13,className:n=""}){return l.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":!0,className:`shrink-0 ${n}`,children:l.jsx("path",{d:"M12 15V4m0 0L7 9m5-5l5 5M4 20h16",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})}function cp({onClose:e,className:n="",...r}){return l.jsx("button",{type:"button","aria-label":g.common.close,onClick:e,className:`rounded-md p-1.5 text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300 ${n}`,...r,children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor","aria-hidden":!0,children:l.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})})}function QC({open:e,side:n="left",title:r,onClose:s,children:o,widthClass:c}){return v.useEffect(()=>{if(!e)return;const d=f=>{f.key==="Escape"&&s()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,s]),e?l.jsxs("div",{className:"fixed inset-0 z-50",children:[l.jsx("div",{className:"anim-fade absolute inset-0 bg-black/45",onMouseDown:s}),l.jsxs("div",{className:`absolute inset-y-0 flex w-[80vw] flex-col bg-white shadow-xl dark:bg-gray-900 ${c??"max-w-xs"} ${n==="left"?"anim-drawer-left left-0 border-r border-gray-200 dark:border-gray-800":"anim-drawer-right right-0 border-l border-gray-200 dark:border-gray-800"}`,children:[l.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-gray-200 px-4 py-3 dark:border-gray-800",children:[l.jsx("span",{className:"text-base font-semibold",children:r??""}),l.jsx(cp,{onClose:s})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto pb-[env(safe-area-inset-bottom)]",children:o})]})]}):null}function Ue({d:e,size:n=13,className:r=""}){return l.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:`block shrink-0 ${r}`,"aria-hidden":!0,children:l.jsx("path",{d:e})})}function tl(e){const n=e.toFixed(1);return n.endsWith(".0")?n.slice(0,-2):n}function ft(e){const n=Math.abs(e);return n<1e3?`${e}`:n<1e6?`${tl(e/1e3)}k`:`${tl(e/1e6)}M`}function vn(e,n){if(e<1e3)return`${Math.round(e)}ms`;const r=e/1e3;if(r<60&&!(n?.compact&&r>=10))return`${tl(r)}s`;const s=Math.round(r);return s<60?`${s}s`:`${Math.floor(s/60)}m${s%60}s`}function ak(e){const n=Math.max(0,Math.floor(e/1e3));return n<60?`${n}s`:`${Math.floor(n/60)}m${n%60}s`}function mh(e,n){return n>0?e/(n/1e3):null}function Lu(e){return e==null||!Number.isFinite(e)?"—":`${Math.abs(e)<1e3?tl(e):ft(e)} tok/s`}function rk(e,n){const r=e+n;return r>0?e/r:null}function up(e){return e==null||!Number.isFinite(e)?"—":`${Math.round(e*100)}%`}function Za(e,n="USD",r){if(e==null)return"—";const s=n==="CNY"?"¥":"$",o=n==="CNY"?e*7:e;if(o===0)return`${s}0`;const c=Math.abs(o);if(r?.compact&&c<1)return`${s}${Number(o.toPrecision(2))}`;const d=c>=100?0:c>=1?2:4;return`${s}${o.toFixed(d)}`}function jo(e){return Number.isInteger(e)?`${e}`:e.toFixed(2).replace(/0+$/,"").replace(/\.$/,"")}function a1(e){return Number(e.toFixed(1))<1024}function No(e){if(e<1024)return`${e}B`;const n=e/1024;if(a1(n))return`${tl(n)}KB`;const r=n/1024;return a1(r)?`${tl(r)}MB`:`${tl(r/1024)}GB`}function el(e){return e<10?`0${e}`:`${e}`}function ma(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:`${n.getFullYear()}-${el(n.getMonth()+1)}-${el(n.getDate())} ${el(n.getHours())}:${el(n.getMinutes())}`}const XC=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function sk(e,n){const r=/^\d{4}-(\d{2})-(\d{2})(?:$|T)/.exec(e);if(!r)return e;const s=Number(r[1]),o=Number(r[2]);return s<1||s>12||o<1||o>31?e:n==="en"?`${XC[s-1]} ${o}`:`${s} 月 ${o} 日`}function lk(e,n){const r=new Date(e);return Number.isNaN(r.getTime())?"":r.toLocaleString(n==="en"?"en-US":"zh-CN",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function Ou(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function ZC(e,n){const r=new Date(e);if(Number.isNaN(r.getTime()))return e;const s=Math.round((Ou(new Date)-Ou(r))/864e5);return s<0?ma(e):s===0?n==="en"?"today":"今天":s===1?n==="en"?"yesterday":"昨天":n==="en"?`${s} days ago`:`${s} 天前`}function JC(e,n){const r=new Date(e);if(Number.isNaN(r.getTime()))return e;const s=Math.round((Ou(new Date)-Ou(r))/864e5);return s<0?e:s===0?n==="en"?"updated today":"今天更新":s===1?n==="en"?"updated yesterday":"昨天更新":n==="en"?`updated ${s} days ago`:`${s} 天前更新`}function e4(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:`${el(n.getHours())}:${el(n.getMinutes())}:${el(n.getSeconds())}`}function Ae(e,n){return e instanceof Xa?e.code==="model_credential_missing"?n?.modelId?g.errors.modelCredentialMissing(n.modelId):e.message:e.code==="no_default_model"?g.errors.noDefaultModel:g.errors.byCode[e.code]??e.message:g.common.unknownError}function dp({checked:e,onChange:n,disabled:r,className:s,...o}){return l.jsx("button",{type:"button",role:"switch","aria-checked":e,disabled:r,onClick:()=>n(!e),className:"relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-gray-400/30 disabled:cursor-not-allowed disabled:opacity-60 "+(e?"bg-[var(--accent-bg)]":"bg-gray-300 dark:bg-gray-600")+` ${s??""}`,...o,children:l.jsx("span",{"aria-hidden":!0,className:`inline-block size-4 transform rounded-full bg-white shadow transition-transform duration-200 ${e?"translate-x-[18px]":"translate-x-0.5"}`})})}var ei=fv();const tu=4,Xi=8;function ha({button:e,open:n,setOpen:r,children:s,menuClass:o,menuStyle:c,className:d,portal:f,onEscape:m}){const h=v.useRef(null),p=v.useRef(null),[y,k]=v.useState(null);v.useEffect(()=>{if(!n)return;const T=E=>{const R=E.target;h.current?.contains(R)||p.current?.contains(R)||r(!1)},M=E=>{E.key==="Escape"&&(m?m():r(!1))};return window.addEventListener("mousedown",T),window.addEventListener("keydown",M),()=>{window.removeEventListener("mousedown",T),window.removeEventListener("keydown",M)}},[n,r,m]);const w=v.useCallback(()=>{if(!n||!f||!h.current){k(null);return}const T=h.current.getBoundingClientRect(),M=p.current,E=M?.offsetWidth??0,R=M?.offsetHeight??0,I=f.align==="right"?T.right-E:T.left,H=Math.max(Xi,Math.min(I,window.innerWidth-E-Xi)),D=window.innerHeight-T.bottom-tu-Xi,L=T.top-tu-Xi,$=f.direction==="up",X=($?R<=L:R<=D)?$:L>D;k({left:H,maxHeight:Math.max(0,X?L:D),...X?{bottom:window.innerHeight-T.top+tu}:{top:T.bottom+tu}})},[n,f?.direction,f?.align,s]);v.useLayoutEffect(w,[w]),v.useEffect(()=>{if(!n||!f)return;const T=M=>{p.current?.contains(M.target)||w()};return window.addEventListener("scroll",T,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",w)}},[n,f,w]);const S=`anim-pop z-40 overflow-y-auto rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900 ${f?"":"max-h-[70vh]"} ${o??"left-0 top-full mt-1 w-64 max-w-[calc(100vw-2rem)] origin-top-left"}`;return l.jsxs("div",{className:`relative ${d??""}`,ref:h,children:[e,n&&(f?ei.createPortal(l.jsx("div",{ref:p,style:{position:"fixed",...y?{left:y.left,maxHeight:y.maxHeight,...y.top!==void 0?{top:y.top}:{},...y.bottom!==void 0?{bottom:y.bottom}:{}}:{left:0,top:0,visibility:"hidden"},maxWidth:`calc(100vw - ${Xi*2}px)`,...c},className:S,children:s}),document.body):l.jsx("div",{ref:p,...c!==void 0?{style:c}:{},className:`absolute ${S}`,children:s}))]})}function t4(e){let n=2166136261;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619);return n>>>0}function n4(e){return t4(e)%360}function ik(e){const n=n4(e);return{bg:`hsl(${n} 55% 50% / 0.14)`,fg:`hsl(${n} 55% 28%)`,fgDark:`hsl(${n} 55% 73%)`}}const r1=typeof Intl<"u"&&typeof Intl.Segmenter=="function"?new Intl.Segmenter(void 0,{granularity:"grapheme"}):void 0;function s1(e){if(e){if(!r1)return Array.from(e)[0];for(const n of r1.segment(e))return n.segment}}function ok(e,n){const r=s1(e.trim())??s1((n??"").trim());return r?r.toUpperCase():"?"}function pa({id:e,name:n,size:r=18,className:s}){const o=ik(e);return l.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",className:s,style:{"--tile-fg":o.fg,"--tile-fg-dark":o.fgDark},"aria-hidden":!0,role:"img",children:[l.jsx("rect",{x:"0",y:"0",width:"24",height:"24",rx:"5",fill:o.bg}),l.jsx("text",{x:"12",y:"12",textAnchor:"middle",dominantBaseline:"central",fontSize:"13",fontWeight:"700",className:"[fill:var(--tile-fg)] dark:[fill:var(--tile-fg-dark)]",children:ok(n??"",e)})]})}function Ln({open:e,size:n=14,className:r=""}){return l.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:`block shrink-0 transition-transform duration-200 ${e?"rotate-90":""} ${r}`,children:l.jsx("path",{d:"M9 5l7 7-7 7"})})}const a4={success:2500,info:4e3,error:6e3};let Ur=[],r4=1;const hh=new Set;function ph(){for(const e of hh)e(Ur)}const s4=160;function ck(e){const n=Ur.find(r=>r.id===e);!n||n.leaving||(Ur=Ur.map(r=>r.id===e?{...r,leaving:!0}:r),ph(),setTimeout(()=>{Ur=Ur.filter(r=>r.id!==e),ph()},s4))}function fp(e,n){if(!n)return;const r=r4++;Ur=[...Ur,{id:r,kind:e,text:n}],ph(),setTimeout(()=>ck(r),a4[e])}const ea=e=>fp("success",e),xt=e=>fp("error",e),Cs=e=>fp("info",e),l4={success:"border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900 dark:bg-emerald-950 dark:text-emerald-200",error:"border-red-200 bg-red-50 text-red-800 dark:border-red-900 dark:bg-red-950 dark:text-red-200",info:"border-sky-200 bg-sky-50 text-sky-800 dark:border-sky-900 dark:bg-sky-950 dark:text-sky-200"};function i4(){const[e,n]=v.useState(Ur);return v.useEffect(()=>(hh.add(n),()=>{hh.delete(n)}),[]),e.length===0?null:ei.createPortal(l.jsx("div",{className:"pointer-events-none fixed inset-x-0 top-3 z-[100] flex flex-col items-center gap-2 px-4",children:e.map(r=>l.jsx("button",{type:"button",onClick:()=>ck(r.id),className:`pointer-events-auto max-w-lg break-words rounded-md border px-3 py-2 text-left text-sm shadow-lg ${r.leaving?"anim-toast-out":"anim-toast-in"} ${l4[r.kind]}`,children:r.text},r.id))}),document.body)}function td({text:e,className:n=""}){const r=v.useRef(null),[s,o]=v.useState(!1);return v.useLayoutEffect(()=>{const c=r.current;if(!c)return;const d=()=>o(c.scrollWidth>c.clientWidth+1);if(d(),typeof ResizeObserver>"u")return;const f=new ResizeObserver(d);return f.observe(c),()=>f.disconnect()},[e,n]),l.jsx("span",{ref:r,className:`truncate ${n}`,...s?{title:e}:{},children:e})}const o4={gray:"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-300",brand:"bg-gray-200/80 text-gray-700 dark:bg-gray-700/60 dark:text-gray-200",green:"bg-emerald-50 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300",yellow:"bg-yellow-50 text-yellow-700 dark:bg-yellow-950 dark:text-yellow-300",amber:"bg-amber-50 text-amber-700 dark:bg-amber-950 dark:text-amber-300",red:"bg-red-50 text-red-700 dark:bg-red-950 dark:text-red-300"};function Jt({tone:e="gray",children:n}){return l.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-semibold ${o4[e]}`,children:n})}function c4(e){switch(e){case"completed":return"green";case"aborted":return"amber";default:return"red"}}const Zi=[];function pn({open:e,title:n,onClose:r,children:s,footer:o,widthClass:c,headerless:d}){return v.useEffect(()=>{if(!e)return;const f=Symbol("modal");Zi.push(f);const m=h=>{h.key==="Escape"&&Zi[Zi.length-1]===f&&r()};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m);const h=Zi.lastIndexOf(f);h!==-1&&Zi.splice(h,1)}},[e,r]),e?ei.createPortal(l.jsx("div",{className:"anim-fade fixed inset-0 z-50 flex items-end justify-center bg-black/45 p-0 sm:items-center sm:p-4",onMouseDown:f=>{f.target===f.currentTarget&&r()},children:l.jsxs("div",{...d?{role:"dialog","aria-label":n}:{},className:`anim-pop w-full ${c??"sm:max-w-md"} rounded-t-lg border border-gray-200 bg-white pb-[env(safe-area-inset-bottom)] shadow-xl sm:rounded-lg sm:pb-0 dark:border-gray-800 dark:bg-gray-900`,children:[!d&&l.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 px-4 py-3 dark:border-gray-800",children:[l.jsx("h2",{className:"text-base font-semibold",children:n}),l.jsx(cp,{onClose:r})]}),l.jsx("div",{className:"max-h-[70vh] overflow-y-auto px-4 py-4",children:s}),o&&l.jsx("div",{className:"flex justify-end gap-2 border-t border-gray-200 px-4 py-3 dark:border-gray-800",children:o})]})}),document.body):null}const u4={primary:"bg-[var(--accent-bg)] text-[var(--accent-fg)] border border-[var(--accent-bg)] transition-opacity hover:opacity-90 disabled:opacity-50",secondary:"bg-white text-gray-800 border border-gray-300 hover:bg-gray-50 dark:bg-gray-900 dark:text-gray-200 dark:border-gray-700 dark:hover:bg-gray-800",danger:"bg-white text-red-600 border border-gray-300 hover:border-red-300 hover:bg-red-50 dark:bg-gray-900 dark:text-red-400 dark:border-gray-700 dark:hover:bg-red-950",ghost:"bg-transparent text-gray-600 border border-transparent hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100"},d4={sm:"px-2.5 py-1 text-xs rounded-md",md:"px-3 py-1.5 text-sm rounded-md",icon:"p-1.5 rounded-md"};function Se({variant:e="secondary",size:n="md",className:r,...s}){return l.jsx("button",{type:"button",className:`inline-flex items-center justify-center gap-1 font-medium transition-colors duration-150 disabled:cursor-not-allowed disabled:opacity-60 ${u4[e]} ${d4[n]} ${r??""}`,...s})}function f4({tone:e}){const n=e==="danger"?"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-3zM12 9v4m0 4h.01":"M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z";return l.jsx("span",{"aria-hidden":!0,className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-full ${e==="danger"?"bg-red-100 text-red-600 dark:bg-red-950/60 dark:text-red-400":"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-300"}`,children:l.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:l.jsx("path",{d:n})})})}function ga({open:e,title:n,onClose:r,onConfirm:s,confirmLabel:o,tone:c="danger",busy:d=!1,children:f}){return l.jsxs(pn,{open:e,title:n,onClose:r,headerless:!0,widthClass:"sm:max-w-sm",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(f4,{tone:c}),l.jsx("div",{className:"min-w-0 flex-1 pt-1.5",children:f})]}),l.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[l.jsx(Se,{size:"sm",onClick:r,disabled:d,children:g.common.cancel}),l.jsx(Se,{size:"sm",variant:c,disabled:d,onClick:s,children:o??g.common.confirm})]})]})}function nd(){const[e,n]=v.useState(null),r=l.jsx(ga,{open:e!==null,title:g.common.confirmSaveTitle,tone:"primary",confirmLabel:g.common.save,onClose:()=>n(null),onConfirm:()=>{e?.(),n(null)},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:g.common.confirmSaveBody})});return{requestSave:s=>n(()=>s),element:r}}const mp="rounded-md border border-gray-300 bg-white text-gray-900 transition-[border-color,box-shadow] duration-200 hover:border-gray-400 focus:border-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-400/30 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100 dark:hover:border-gray-600 dark:focus:border-gray-400 dark:focus:ring-gray-500/30",uk="w-full px-3 py-1.5 text-left transition-colors duration-150";function Gl({children:e,required:n}){return l.jsxs("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:[e,n&&l.jsx("span",{className:"ml-0.5 text-red-500 dark:text-red-400","aria-hidden":!0,children:"*"})]})}function dk({children:e}){return l.jsx("span",{className:"mt-1 block text-xs text-gray-500 dark:text-gray-500",children:e})}function ks({id:e,children:n}){return l.jsx("span",{id:e,role:"alert",className:"mt-1 block text-xs text-red-600 dark:text-red-400",children:n})}function Lo({label:e,hint:n,error:r,errorId:s,required:o,children:c}){return!e&&!n&&!r?l.jsx(l.Fragment,{children:c}):l.jsxs("label",{className:"block",children:[e!=null&&e!==""&&l.jsx(Gl,{required:o,children:e}),c,r?l.jsx(ks,{id:s,children:r}):n?l.jsx(dk,{children:n}):null]})}const fk=`w-full ${mp} placeholder:text-gray-400 disabled:cursor-not-allowed disabled:opacity-60 dark:placeholder:text-gray-500`,hp={base:"px-3 py-2 text-base",sm:"px-2 py-1 text-xs"},ad="!border-red-400 !bg-red-50 hover:!border-red-500 focus:!border-red-500 focus:!ring-red-400/30 dark:!border-red-800 dark:!bg-red-950/40 dark:hover:!border-red-700 dark:focus:!border-red-600";function pp(e,n){return e!==void 0&&e!=="off"?{autoComplete:e}:{autoComplete:n?"new-password":"off","data-1p-ignore":"","data-lpignore":"true","data-bwignore":"","data-form-type":"other"}}const rd=pp(void 0,!1);function tt({label:e,hint:n,error:r,invalid:s,required:o,size:c="base",className:d,autoComplete:f,...m}){const h=!!r||!!s,p=v.useId();return l.jsx(Lo,{label:e,hint:n,error:r,errorId:p,required:o,children:l.jsx("input",{className:`${fk} ${hp[c]} ${h?ad:""} ${d??""}`,"aria-invalid":h?!0:void 0,"aria-required":o||void 0,"aria-describedby":r?p:void 0,...pp(f,m.type==="password"),...m})})}const Kl=v.forwardRef(function({label:n,hint:r,error:s,invalid:o,required:c,mono:d,size:f="base",className:m,autoComplete:h,...p},y){const k=!!s||!!o,w=v.useId();return l.jsx(Lo,{label:n,hint:r,error:s,errorId:w,required:c,children:l.jsx("textarea",{ref:y,className:`${fk} px-3 py-2 ${f==="sm"?"text-xs leading-relaxed":"text-base"} ${d?"font-mono":""} ${k?ad:""} ${m??""}`,"aria-invalid":k?!0:void 0,"aria-required":c||void 0,"aria-describedby":s?w:void 0,...pp(h,!1),...p})})});function ql({options:e,value:n,onChange:r,cols:s=3}){return l.jsx("div",{className:`grid ${s===2?"grid-cols-2":"grid-cols-3"} gap-0.5 rounded-md bg-gray-100 p-0.5 dark:bg-gray-800`,children:e.map(o=>l.jsx("button",{type:"button",onClick:()=>r(o.value),className:`rounded px-1 py-1 text-xs transition-colors duration-150 ${n===o.value?"bg-white font-medium text-gray-900 shadow-sm dark:bg-gray-600 dark:text-gray-100":"text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200"}`,children:o.label},o.value))})}function Gt({className:e}){return l.jsx("div",{className:`animate-pulse rounded bg-gray-200 dark:bg-gray-800 ${e??"h-4 w-full"}`})}function Ua({rows:e=3}){return l.jsx("div",{className:"space-y-2 p-2",children:Array.from({length:e},(n,r)=>l.jsx(Gt,{className:"h-8 w-full"},r))})}function mk({className:e,children:n}){return l.jsx("div",{className:`rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900 ${e??"p-4"}`,children:n??l.jsxs(l.Fragment,{children:[l.jsx(Gt,{className:"h-3 w-20"}),l.jsx(Gt,{className:"mt-2.5 h-6 w-28"}),l.jsx(Gt,{className:"mt-2.5 h-3 w-24"})]})})}function pr(e){v.useEffect(()=>{document.title=e?`${e} · ${g.appName}`:g.appName},[e])}var m4=["partial_text","partial_thinking","partial_tool_call","partial_tool_call_output"];function Du(e){return m4.includes(e.type??"")}function gp(e){return e.type==="event_msg"}function h4(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xp(e,n){return`[${e}]
|
|
128
|
-
${n}
|
|
129
|
-
[/${e}]`}function Oo(e,n,r=""){const s=h4(e);return[new RegExp(`\\[${s}\\]${n}\\[/${s}\\]`,r),new RegExp(`<${s}>${n}</${s}>`,r)]}function sd(e,n){return e[0].exec(n)??e[1].exec(n)}var fr={summary:"summary",userSteering:"user_steering",useSkills:"use_skills",handoffFrom:"handoff_from",scheduledTask:"scheduled_task",modelSwitchFrom:"model_switch_from"},p4="[attached image: ",g4="[attached file: ",x4=/^\[attached image: (.+)\]$/,y4=/^\[attached file: (.+)\]$/;function b4(e){return x4.exec(e)?.[1]??null}function v4(e){return y4.exec(e)?.[1]??null}Oo(fr.summary,"([\\s\\S]*?)");function gh(e,n){if(e.length===0)return n;const r=xp(fr.useSkills,`skills: ${e.join(", ")}`);return n?`${r}
|
|
130
|
-
|
|
131
|
-
${n}`:r}var k4=Oo(fr.useSkills,"\\nskills: ([^\\n]+)\\n");function hk(e){const n=sd(k4,e);if(!n||n.index!==0)return null;const r=n[1].split(",").map(s=>s.trim()).filter(s=>s.length>0);return r.length===0?null:{skills:r,rest:e.slice(n[0].length).replace(/^\n+/,"")}}function pk(e){const n=/^([\w-]+) \((.*)\)$/.exec(e);return n?{id:n[1],label:n[2]}:{id:e}}function yp(e,n){const r=new RegExp(`^(${n.join("|")}): (.+)$`),s=[];for(const o of e.split(`
|
|
132
|
-
`)){const c=r.exec(o);c&&s.push([c[1],c[2]])}return s}function w4(e){const n=e.agentName&&e.agentName!==e.agentId?` (${e.agentName})`:"",r=[`agent: ${e.agentId}${n}`];if(e.sessionId){const s=e.sessionTitle?` (${e.sessionTitle})`:"";r.push(`session: ${e.sessionId}${s}`)}return e.workspace&&r.push(`workspace: ${e.workspace}`),xp(fr.handoffFrom,["The user handed this conversation to you from another one; its origin is listed below and the user's message, if any, follows. When the request refers to an agent, session, or files without naming them, it means this origin.",...r].join(`
|
|
133
|
-
`))}var S4=Oo(fr.handoffFrom,"\\n([\\s\\S]*)\\n","");function gk(e){const n=e.trim(),r=sd(S4,n);if(!r||r.index!==0||r[0].length!==n.length)return null;const s={agentId:""};for(const[o,c]of yp(r[1],["agent","session","workspace"])){if(o==="workspace"){s.workspace=c;continue}const{id:d,label:f}=pk(c);o==="agent"?(s.agentId=d,f!==void 0&&(s.agentName=f)):(s.sessionId=d,f!==void 0&&(s.sessionTitle=f))}return s.agentId?s:null}var j4=Oo(fr.scheduledTask,"\\n([\\s\\S]*?)\\n");function xk(e){const n=sd(j4,e);if(!n||n.index!==0)return null;const r={name:"",firedAt:""};for(const[s,o]of yp(n[1],["schedule","fired_at"]))s==="schedule"?r.name=o:r.firedAt=o;return r.name?{origin:r,rest:e.slice(n[0].length).replace(/^\n+/,"")}:null}function N4(e){const n=e.sessionTitle?` (${e.sessionTitle})`:"",r=[`session: ${e.sessionId}${n}`];return e.tracePath&&r.push(`trace: ${e.tracePath}`),e.workspace&&r.push(`workspace: ${e.workspace}`),e.prevModelId&&r.push(`previous_model: ${e.prevModelId}`),e.prevProvider&&r.push(`previous_provider: ${e.prevProvider}`),xp(fr.modelSwitchFrom,["The user switched models: this conversation continues an earlier conversation, now on a different model. Its origin is listed below and the user's message, if any, follows. The earlier history is NOT in your context — when you need it, read the trace file at the path below (JSONL, one message envelope per line: user/assistant text, tool calls and results).",...r].join(`
|
|
134
|
-
`))}var C4=Oo(fr.modelSwitchFrom,"\\n([\\s\\S]*)\\n");function yk(e){const n=e.trim(),r=sd(C4,n);if(!r||r.index!==0||r[0].length!==n.length)return null;const s={sessionId:""},o=["session","trace","workspace","previous_model","previous_provider"];for(const[c,d]of yp(r[1],o))if(c==="session"){const{id:f,label:m}=pk(d);s.sessionId=f,m!==void 0&&(s.sessionTitle=m)}else c==="trace"?s.tracePath=d:c==="workspace"?s.workspace=d:c==="previous_model"?s.prevModelId=d:s.prevProvider=d;return s.sessionId?s:null}var T4=new RegExp(`^\\[${fr.userSteering}\\]\\n([\\s\\S]*?)\\n\\[/${fr.userSteering}\\]\\s*$`);function M4(e){const n=T4.exec(e);return n?n[1]:null}function bk(e){const n=/^\[goal\]\nround: (\d+)\n[\s\S]*?\n\[\/goal\](?:\n|$)/.exec(e);if(!n)return null;const r=Number(n[1]);return!Number.isInteger(r)||r<=0?null:{round:r,rest:e.slice(n[0].length).replace(/^\n+/,"")}}function vk(e,n){return n?(e.cacheRead*n.cacheRead+e.cacheWrite*n.cacheWrite+e.output*n.output)/1e6:null}function E4(){return{contextNow:0,contextStale:!1,contextAtLastStats:0,sessionTotal:0,subagentTotal:0,taskTokens:0,taskCacheRead:0,taskCacheWrite:0,taskOutput:0,taskMainOutput:0,taskLlmMs:0,pendingCompactionTokens:0,pendingCompactionCacheRead:0,pendingCompactionCacheWrite:0,pendingCompactionOutput:0,hasUsage:!1,sessionElapsedMs:0,compactionActive:!1}}function kk(e,n){e.taskCacheRead+=n.request.cache_read,e.taskCacheWrite+=n.request.cache_write,e.taskOutput+=n.request.output}function A4(e,n){if(e.sessionTotal=n.session.total,e.compactionActive){e.pendingCompactionTokens+=n.request.total,e.pendingCompactionCacheRead+=n.request.cache_read,e.pendingCompactionCacheWrite+=n.request.cache_write,e.pendingCompactionOutput+=n.request.output;return}e.taskTokens+=n.request.total,kk(e,n),e.contextNow=n.request.total,e.contextStale=!1,e.taskMainOutput+=n.request.output,e.hasUsage=!0}function R4(e){e.pendingCompactionTokens!==0&&(e.taskTokens+=e.pendingCompactionTokens,e.taskCacheRead+=e.pendingCompactionCacheRead,e.taskCacheWrite+=e.pendingCompactionCacheWrite,e.taskOutput+=e.pendingCompactionOutput,e.hasUsage=!0,bp(e))}function bp(e){e.pendingCompactionTokens=0,e.pendingCompactionCacheRead=0,e.pendingCompactionCacheWrite=0,e.pendingCompactionOutput=0}function _4(e,n){n>0&&(e.taskLlmMs+=n)}function I4(e,n){e.taskTokens+=n.request.total,kk(e,n),e.subagentTotal+=n.request.total,e.hasUsage=!0}function L4(e){e.compactionActive=!0}function O4(e,n){e.compactionActive=!1,n==="completed"&&(e.contextStale=!0)}function D4(e){e.taskTokens=0,e.taskCacheRead=0,e.taskCacheWrite=0,e.taskOutput=0,e.taskMainOutput=0,e.taskLlmMs=0,bp(e),e.hasUsage=!1,e.compactionActive=!1}function z4(e,n){if(e.sessionElapsedMs+=n,bp(e),!e.hasUsage)return e.taskTokens=0,null;const r={context:e.contextNow,contextDelta:e.contextNow-e.contextAtLastStats,tokens:e.sessionTotal+e.subagentTotal,tokensDelta:e.taskTokens,elapsedMs:e.sessionElapsedMs,elapsedDeltaMs:n,tokensByBucket:{cacheRead:e.taskCacheRead,cacheWrite:e.taskCacheWrite,output:e.taskOutput},outputTps:mh(e.taskMainOutput,e.taskLlmMs)};return e.contextAtLastStats=e.contextNow,e.taskTokens=0,e.taskCacheRead=0,e.taskCacheWrite=0,e.taskOutput=0,e.taskMainOutput=0,e.taskLlmMs=0,e.hasUsage=!1,e.compactionActive=!1,r}function U4(e,n,r,s){const o=n&&r!=null?Math.max(0,s-r):0;return e.sessionElapsedMs+o}function $4(e,n){const r=e.tokensByBucket;return`[${n.stats}] ${n.input} ${ft(r.cacheRead+r.cacheWrite)}${n.parenOpen}${n.cached} ${ft(r.cacheRead)}${n.parenClose} · ${n.output} ${ft(r.output)} · ${Lu(e.outputTps)}`}function B4(e){return e==="failed"||e==="timeout"||e==="malformed"}function wk(e,n){return{items:[],nested:e,meta:null,stats:E4(),openText:null,openThinking:null,pendingText:null,pendingThinking:null,openSteering:null,toolCards:new Map,subagents:new Map,localDecisions:n,pendingDecisions:new Map,pendingDecisionTs:new Map,lastTsMs:0,openRequestBeginMs:null,openApprovalWaitMs:0,reconnectRun:0,lastAuthFailureMs:null,taskOpen:!1,taskStartLocalMs:0,taskFirstTsMs:0,taskLastTsMs:0,taskLastReqEndMs:null,nextItemId:1}}function Mu(e=new Set){return wk(!1,e)}function H4(e,n){return e===null?!1:n===null||e>n}function Jn(e){return e.nextItemId++}function zu(e,n,r=Date.now()){if(n.origin&&n.origin.length>0){t3(e,n,r);return}if(P4(n)||(e.openSteering=null),n.type==="model_msg"){if(e.stats.compactionActive){Oa(e,n.timestamp),Tm(e,n.timestamp);return}if(Du(n.payload)){Oa(e,n.timestamp),X4(e,n.payload,Ga(n.timestamp));return}Z4(e,n.payload,n.timestamp,r),Tm(e,n.timestamp);return}if(gp(n)){Oa(e,n.timestamp),J4(e,n.payload,Ga(n.timestamp),r),Tm(e,n.timestamp);return}if(n.type==="session_meta"&&e.nested){const s=n.payload,o={agentId:F4(s.agent_state),provider:s.provider,modelId:s.model_id};s.source!==void 0&&(o.source=s.source),e.meta=o}}function P4(e){return e.type==="model_msg"&&e.payload.type==="image_url"}function F4(e){const n=e.split(/[\\/]/).filter(r=>r.length>0);return n.length>=2?n[n.length-2]:null}function q4(e,n){const r=n.join("/");for(const s of e)if(s.startsWith(`${r} `)||s.startsWith(`${r}/`))return!0;return!1}function Ga(e){const n=Date.parse(e);return Number.isFinite(n)?n:void 0}function Tm(e,n){const r=Date.parse(n);Number.isFinite(r)&&(e.lastTsMs=r)}function V4(e,n,r=Date.now(),s=null){for(const o of n)zu(e,o,r);if(e.taskOpen){const o=e.taskLastTsMs-e.taskFirstTsMs,c=s===null?0:s-e.taskFirstTsMs;e.taskStartLocalMs=r-Math.max(0,o,c)}}function G4(e){vp(e)}function W4(e){vp(e)}function K4(e,n){e.localDecisions.add(n)}function Yl(e,n){return`${e?.join("/")??""} ${n}`}function Y4(e,n,r){let s=e;for(const o of n??[])if(s=s.subagents.get(o),!s)return null;return s.toolCards.get(r)??null}function Oa(e,n){if(!e.taskOpen||e.stats.compactionActive)return;const r=Date.parse(n);!Number.isFinite(r)||r<=e.taskLastTsMs||(e.taskLastTsMs=r)}function l1(e,n,r){vp(e);const s=vh(e);s&&(s.gaveUp=!0),e.reconnectRun=0,e.openRequestBeginMs=null,e.openApprovalWaitMs=0,e.taskOpen=!0,e.taskStartLocalMs=r;const o=Date.parse(n);e.taskFirstTsMs=Number.isFinite(o)?o:r,e.taskLastTsMs=e.taskFirstTsMs,e.taskLastReqEndMs=null,D4(e.stats)}function vp(e){if(!e.taskOpen)return;e.taskOpen=!1,Sk(e);const n=e.taskLastReqEndMs??e.taskLastTsMs,r=Math.max(0,n-e.taskFirstTsMs),s=z4(e.stats,r);if(e.nested)return;const o=Q4(e);if(s===null&&o.text==="")return;const c={kind:"task_stats",id:Jn(e),stats:s,assistantText:o.text,...o.atMs!==void 0?{atMs:o.atMs}:{}};let d=e.items.length;for(;d>0&&e.items[d-1].kind==="compaction";)d--;e.items.splice(d,0,c)}function Q4(e){const n=[];let r;for(let s=e.items.length-1;s>=0;s--){const o=e.items[s];if(o.kind==="task_stats")break;o.kind==="assistant_text"&&o.text.trim()&&(n.push(o.text),r===void 0&&(r=o.atMs))}return{text:n.reverse().join(`
|
|
135
|
-
|
|
136
|
-
`),...r!==void 0?{atMs:r}:{}}}function X4(e,n,r){switch(n.type){case"partial_text":{if(n.event_type==="start"){e.pendingText=null;const o={kind:"assistant_text",id:Jn(e),text:n.text??"",streaming:!0,...r!==void 0?{atMs:r}:{}};e.openText=o,e.items.push(o);return}const s=e.openText;if(!s)return;n.text&&(s.text+=n.text),n.event_type==="stop"&&(s.streaming=!1,n.stop_reason!==void 0&&(s.stopReason=n.stop_reason),e.pendingText=s,e.openText=null);return}case"partial_thinking":{if(n.event_type==="start"){e.pendingThinking=null;const o={kind:"thinking",id:Jn(e),thinking:n.thinking??"",streaming:!0};r!==void 0&&(o.startedAtMs=r),e.openThinking=o,e.items.push(o);return}const s=e.openThinking;if(!s)return;n.thinking&&(s.thinking+=n.thinking),n.event_type==="stop"&&(s.streaming=!1,n.stop_reason!==void 0&&(s.stopReason=n.stop_reason),xh(s,r),e.pendingThinking=s,e.openThinking=null);return}case"partial_tool_call":{const s=e.toolCards.get(n.tool_call_id);if(s?.callComplete)return;if(n.event_type==="start"){if(s){s.name=n.name||s.name,s.argumentsText=n.arguments??"",s.callStreaming=!0,r!==void 0&&s.argStartedAtMs===void 0&&(s.argStartedAtMs=r);return}const o=bh(e,{toolCallId:n.tool_call_id,name:n.name,argumentsText:n.arguments??"",callStreaming:!0});r!==void 0&&(o.argStartedAtMs=r);return}if(!s)return;n.name&&!s.name&&(s.name=n.name),n.arguments&&(s.argumentsText+=n.arguments),n.event_type==="stop"&&(s.callStreaming=!1,n.stop_reason!==void 0&&(s.callStopReason=n.stop_reason),r!==void 0&&(s.callStartedAtMs=r));return}case"partial_tool_call_output":{const s=e.toolCards.get(n.tool_call_id);if(!s||s.outputComplete)return;if(n.event_type==="start"){s.outputStreaming=!0,n.output&&(s.output+=n.output),n.images&&n.images.length>0&&(s.images=n.images);return}if(!s.outputStreaming)return;n.output&&(s.output+=n.output),n.images&&n.images.length>0&&(s.images=n.images),n.event_type==="stop"&&(s.outputStreaming=!1,n.stop_reason!==void 0&&(s.outputStopReason=n.stop_reason),jk(s,r));return}}}function Z4(e,n,r,s){switch(n.type){case"text":{if(n.role==="user"){if(n.text.startsWith("[context_summary]")||n.text.startsWith("<context_summary>")){Oa(e,r);return}const f=M4(n.text);if(f!==null){Oa(e,r);const h=Ga(r),p={kind:"user_steering",id:Jn(e),text:f,...h!==void 0?{atMs:h}:{}};e.items.push(p),e.openSteering=p;return}l1(e,r,s);const m=Ga(r);e.items.push({kind:"user_text",id:Jn(e),text:n.text,...m!==void 0?{atMs:m}:{}});return}Oa(e,r);const o=e.pendingText??e.openText;if(o){if(!n.text.trim()){ho(e,o),o===e.openText&&(e.openText=null),e.pendingText=null;return}o.text=n.text,o.streaming=!1;const f=Ga(r);f!==void 0&&(o.atMs=f),n.stop_reason!==void 0&&(o.stopReason=n.stop_reason),o===e.openText&&(e.openText=null),e.pendingText=null;return}if(!n.text.trim())return;const c=Ga(r),d={kind:"assistant_text",id:Jn(e),text:n.text,streaming:!1,...c!==void 0?{atMs:c}:{}};n.stop_reason!==void 0&&(d.stopReason=n.stop_reason),e.items.push(d);return}case"image_url":{if(e.openSteering){Oa(e,r),e.openSteering.images=[...e.openSteering.images??[],n.image_url];return}l1(e,r,s);const o=Ga(r);e.items.push({kind:"user_image",id:Jn(e),imageUrl:n.image_url,...o!==void 0?{atMs:o}:{}});return}case"thinking":{Oa(e,r);const o=Ga(r),c=e.pendingThinking??e.openThinking;if(c){if(!n.thinking.trim()){ho(e,c),c===e.openThinking&&(e.openThinking=null),e.pendingThinking=null;return}c.thinking=n.thinking,c.streaming=!1,n.stop_reason!==void 0&&(c.stopReason=n.stop_reason),xh(c,o),c===e.openThinking&&(e.openThinking=null),e.pendingThinking=null;return}if(!n.thinking.trim())return;const d={kind:"thinking",id:Jn(e),thinking:n.thinking,streaming:!1};n.stop_reason!==void 0&&(d.stopReason=n.stop_reason),e.lastTsMs>0&&(d.startedAtMs=e.lastTsMs),xh(d,o),e.items.push(d);return}case"tool_call":{Oa(e,r);const o=Ga(r),c=e.toolCards.get(n.tool_call_id),d=c?.callComplete?void 0:c;if(d){d.name=n.name,d.argumentsText=n.arguments,d.callStreaming=!1,d.callComplete=!0,n.stop_reason!==void 0&&(d.callStopReason=n.stop_reason),o!==void 0&&(d.callStartedAtMs=o),yh(e,d),i1(d);return}c&&!c.outputComplete&&(c.outputComplete=!0,c.outputStreaming=!1,c.outputStopReason??="aborted");const f=bh(e,{toolCallId:n.tool_call_id,name:n.name,argumentsText:n.arguments,callStreaming:!1});f.callComplete=!0,n.stop_reason!==void 0&&(f.callStopReason=n.stop_reason),o!==void 0&&(f.callStartedAtMs=o),yh(e,f),e.lastTsMs>0&&(f.argStartedAtMs=e.lastTsMs),i1(f);return}case"tool_call_output":{Oa(e,r);let o=e.toolCards.get(n.tool_call_id);o||(o=bh(e,{toolCallId:n.tool_call_id,name:"",argumentsText:"",callStreaming:!1})),o.output=n.output,n.images&&n.images.length>0&&(o.images=n.images),o.outputStreaming=!1,o.outputComplete=!0,n.stop_reason!==void 0&&(o.outputStopReason=n.stop_reason),jk(o,Ga(r));return}case"inline_data":case"inline_thinking":Oa(e,r);return}}function Sk(e){for(const n of e.toolCards.values())n.callComplete&&!n.outputComplete&&(n.outputComplete=!0,n.outputStreaming=!1,n.outputStopReason??="aborted")}function i1(e){!e.callStopReason||e.callStopReason==="completed"||e.outputComplete||(e.outputComplete=!0,e.outputStreaming=!1,e.outputStopReason??=e.callStopReason)}function xh(e,n){n===void 0||e.startedAtMs===void 0||(e.durationMs=Math.max(0,n-e.startedAtMs))}function jk(e,n){if(n===void 0)return;const r=e.approvalAtMs??e.callStartedAtMs;if(r===void 0)return;const s=e.argStartedAtMs!==void 0&&e.callStartedAtMs!==void 0?Math.max(0,e.callStartedAtMs-e.argStartedAtMs):0;e.durationMs=s+Math.max(0,n-r)}function yh(e,n){if(n.approvalWaitCounted)return;const{callStartedAtMs:r,approvalAtMs:s}=n;if(r===void 0||s===void 0)return;n.approvalWaitCounted=!0;const o=s-r;o>0&&(e.openApprovalWaitMs+=o)}function bh(e,n){const r={kind:"tool_call",id:Jn(e),toolCallId:n.toolCallId,name:n.name,argumentsText:n.argumentsText,callStreaming:n.callStreaming,callComplete:!1,output:"",outputStreaming:!1,outputComplete:!1},s=e.pendingDecisions.get(n.toolCallId);if(s!==void 0){r.decision=s,r.decisionSource=e.localDecisions.has(n.toolCallId)?"manual":"remote",e.pendingDecisions.delete(n.toolCallId);const o=e.pendingDecisionTs.get(n.toolCallId);o!==void 0&&(r.approvalAtMs=o,e.pendingDecisionTs.delete(n.toolCallId))}return e.toolCards.set(n.toolCallId,r),e.items.push(r),r}function J4(e,n,r,s){switch(n.type){case"approval_decision":{const o=e.toolCards.get(n.tool_call_id);o?(o.decision=n.decision,o.decisionSource=e.localDecisions.has(n.tool_call_id)?"manual":"remote",r!==void 0&&o.approvalAtMs===void 0&&(o.approvalAtMs=r),yh(e,o)):(e.pendingDecisions.set(n.tool_call_id,n.decision),r!==void 0&&e.pendingDecisionTs.set(n.tool_call_id,r));return}case"abort":{Sk(e);const o=vh(e);o&&(o.gaveUp=!0),e.reconnectRun=0;const c={kind:"abort",id:Jn(e)};n.reason!=null&&(c.reason=n.reason),e.items.push(c);return}case"token_usage":A4(e.stats,n);return;case"compaction_begin":{L4(e.stats),e.items.push({kind:"compaction",id:Jn(e),reason:n.reason,mode:n.mode,running:!0});return}case"compaction_end":{O4(e.stats,n.status);const o=e3(e);if(o)o.running=!1,o.status=n.status;else{const c={kind:"compaction",id:Jn(e),reason:n.reason,mode:n.mode,running:!1,status:n.status};e.items.push(c)}return}case"request_begin":{const o=vh(e);o&&(o.retrying=!0),e.stats.compactionActive||(e.openRequestBeginMs=r??null,e.openApprovalWaitMs=0);return}case"request_end":{if(e.stats.compactionActive)return;if(n.status==="auth"&&(e.lastAuthFailureMs=r??Date.now()),n.status==="completed"&&(e.lastAuthFailureMs=null),e.openRequestBeginMs!==null&&r!==void 0&&_4(e.stats,r-e.openRequestBeginMs-e.openApprovalWaitMs),e.openRequestBeginMs=null,e.openApprovalWaitMs=0,r!==void 0&&(e.taskLastReqEndMs=r),R4(e.stats),B4(n.status)){e.reconnectRun+=1;const o={kind:"reconnect",id:Jn(e),status:n.status,attempt:e.reconnectRun,retrying:!1};typeof n.retry_in_ms=="number"&&n.retry_in_ms>0&&(o.plannedDelayMs=n.retry_in_ms,o.arrivedAtMs=s??Date.now()),e.items.push(o)}else e.reconnectRun=0;return}}}function e3(e){for(let n=e.items.length-1;n>=0;n--){const r=e.items[n];if(r.kind==="compaction"&&r.running)return r}return null}function vh(e){for(let n=e.items.length-1;n>=0;n--){const r=e.items[n];if(r.kind==="reconnect")return!r.retrying&&!r.gaveUp?r:null}return null}function t3(e,n,r){const s=n.origin[0];gp(n)&&n.payload.type==="token_usage"&&I4(e.stats,n.payload),Oa(e,n.timestamp);let o=e.subagents.get(s);o||(o=wk(!0,e.localDecisions),o.firstSeenLocalMs=r,e.subagents.set(s,o),n3(e,s,o)),o.lastActivityLocalMs=r;const c=Ga(n.timestamp);c!==void 0&&(o.firstTsMs===void 0&&(o.firstTsMs=c),(o.lastActivityTsMs===void 0||c>o.lastActivityTsMs)&&(o.lastActivityTsMs=c));const d=n.origin.slice(1),f={...n};d.length>0?f.origin=d:delete f.origin,zu(o,f,r)}function n3(e,n,r){for(let s=e.items.length-1;s>=0;s--){const o=e.items[s];if(o.kind==="tool_call"&&o.name==="run_subagent"&&!o.subagent&&!o.outputComplete&&o.decision==="allow"){o.subagent=r,o.subagentSessionId=n;return}}e.items.push({kind:"subagent",id:Jn(e),sessionId:n,model:r})}function a3(e,n=100){const r=new Set;for(let s=Math.max(0,e.length-n);s<e.length;s++)r.add(JSON.stringify(e[s]));return r}function r3(e,n){return e.has(JSON.stringify(n))}function Nk(e,n){if(n.origin&&n.origin.length>0){const s=e.subagents.get(n.origin[0]);if(!s)return;const o=n.origin.slice(1),c={...n};o.length>0?c.origin=o:delete c.origin,Nk(s,c);return}if(n.type!=="model_msg"||Du(n.payload))return;const r=n.payload;switch(r.type){case"text":{if(r.role!=="assistant")return;const s=e.pendingText??e.openText;s&&(ho(e,s),s===e.openText&&(e.openText=null),e.pendingText=null);return}case"thinking":{const s=e.pendingThinking??e.openThinking;s&&(ho(e,s),s===e.openThinking&&(e.openThinking=null),e.pendingThinking=null);return}case"tool_call":{const s=e.toolCards.get(r.tool_call_id);s&&!s.callComplete&&(ho(e,s),e.toolCards.delete(r.tool_call_id));return}case"tool_call_output":{const s=e.toolCards.get(r.tool_call_id);s&&!s.outputComplete&&(s.output="",s.outputStreaming=!1);return}default:return}}function ho(e,n){const r=e.items.indexOf(n);r>=0&&e.items.splice(r,1)}function mr({title:e,description:n,action:r}){return l.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-12 text-center",children:[l.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:e}),n&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:n}),r&&l.jsx("div",{className:"mt-2",children:r})]})}const un={input:"M12 15V5m0 0L8 9m4-4l4 4M4 19h16",output:"M12 3v10m0 0l-4-4m4 4l4-4M4 19h16",cacheHit:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-5a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm0-3a1 1 0 1 0 0-2 1 1 0 0 0 0 2z",toolCalls:"M14.7 6.3a4 4 0 0 0-5 5L4 17v3h3l5.7-5.7a4 4 0 0 0 5-5l-2.5 2.5-2-2 2.5-2.5z",tps:"M5 18a8 8 0 1 1 14 0M12 12l4-3",elapsed:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-14v5l3 2",cost:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-15v12m2.6-9.3c-.5-.8-1.5-1.2-2.6-1.2-1.5 0-2.7.8-2.7 2 0 2.7 5.4 1.3 5.4 4 0 1.2-1.2 2-2.7 2-1.2 0-2.2-.5-2.7-1.4",copy:"M9 9h9v9a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V9zM7 15H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v1",check:"M5 13l4 4L19 7"},Ck=/[/\\]scratchpad[/\\]([^/\\]+)[/\\]([^/\\]+)$/;function s3(e){if(/^https?:\/\//i.test(e))return e;const n=Ck.exec(e);return n?`/api/sessions/${encodeURIComponent(n[1])}/scratchpad/${encodeURIComponent(n[2])}`:null}function Uu(e){if(!e.includes(p4)&&!e.includes(g4))return{text:e,images:[],files:[]};const n=[],r=[],s=[];for(const o of e.split(`
|
|
137
|
-
`)){const c=o.trim(),d=b4(c),f=d!==null?s3(d):null;if(f){r.push(f);continue}const m=v4(c);if(m!==null&&Ck.test(m)){s.push(m);continue}n.push(o)}return{text:n.join(`
|
|
138
|
-
`).replace(/\n+$/,""),images:r,files:s}}function l3(e){const n=e.split(/[/\\]/);return n[n.length-1]||e}function i3(e,n){const r=n||{};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const o3=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,c3=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,u3={};function o1(e,n){return(u3.jsx?c3:o3).test(e)}const d3=/[ \t\n\f\r]/g;function f3(e){return typeof e=="object"?e.type==="text"?c1(e.value):!1:c1(e)}function c1(e){return e.replace(d3,"")===""}class Do{constructor(n,r,s){this.normal=r,this.property=n,s&&(this.space=s)}}Do.prototype.normal={};Do.prototype.property={};Do.prototype.space=void 0;function Tk(e,n){const r={},s={};for(const o of e)Object.assign(r,o.property),Object.assign(s,o.normal);return new Do(r,s,n)}function kh(e){return e.toLowerCase()}class ta{constructor(n,r){this.attribute=r,this.property=n}}ta.prototype.attribute="";ta.prototype.booleanish=!1;ta.prototype.boolean=!1;ta.prototype.commaOrSpaceSeparated=!1;ta.prototype.commaSeparated=!1;ta.prototype.defined=!1;ta.prototype.mustUseProperty=!1;ta.prototype.number=!1;ta.prototype.overloadedBoolean=!1;ta.prototype.property="";ta.prototype.spaceSeparated=!1;ta.prototype.space=void 0;let m3=0;const Be=il(),cn=il(),wh=il(),ge=il(),Dt=il(),nl=il(),ua=il();function il(){return 2**++m3}const Sh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Be,booleanish:cn,commaOrSpaceSeparated:ua,commaSeparated:nl,number:ge,overloadedBoolean:wh,spaceSeparated:Dt},Symbol.toStringTag,{value:"Module"})),Mm=Object.keys(Sh);class kp extends ta{constructor(n,r,s,o){let c=-1;if(super(n,r),u1(this,"space",o),typeof s=="number")for(;++c<Mm.length;){const d=Mm[c];u1(this,Mm[c],(s&Sh[d])===Sh[d])}}}kp.prototype.defined=!0;function u1(e,n,r){r&&(e[n]=r)}function ti(e){const n={},r={};for(const[s,o]of Object.entries(e.properties)){const c=new kp(s,e.transform(e.attributes||{},s),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(c.mustUseProperty=!0),n[s]=c,r[kh(s)]=s,r[kh(c.attribute)]=s}return new Do(n,r,e.space)}const Mk=ti({properties:{ariaActiveDescendant:null,ariaAtomic:cn,ariaAutoComplete:null,ariaBusy:cn,ariaChecked:cn,ariaColCount:ge,ariaColIndex:ge,ariaColSpan:ge,ariaControls:Dt,ariaCurrent:null,ariaDescribedBy:Dt,ariaDetails:null,ariaDisabled:cn,ariaDropEffect:Dt,ariaErrorMessage:null,ariaExpanded:cn,ariaFlowTo:Dt,ariaGrabbed:cn,ariaHasPopup:null,ariaHidden:cn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Dt,ariaLevel:ge,ariaLive:null,ariaModal:cn,ariaMultiLine:cn,ariaMultiSelectable:cn,ariaOrientation:null,ariaOwns:Dt,ariaPlaceholder:null,ariaPosInSet:ge,ariaPressed:cn,ariaReadOnly:cn,ariaRelevant:null,ariaRequired:cn,ariaRoleDescription:Dt,ariaRowCount:ge,ariaRowIndex:ge,ariaRowSpan:ge,ariaSelected:cn,ariaSetSize:ge,ariaSort:null,ariaValueMax:ge,ariaValueMin:ge,ariaValueNow:ge,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function Ek(e,n){return n in e?e[n]:n}function Ak(e,n){return Ek(e,n.toLowerCase())}const h3=ti({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:nl,acceptCharset:Dt,accessKey:Dt,action:null,allow:null,allowFullScreen:Be,allowPaymentRequest:Be,allowUserMedia:Be,alpha:Be,alt:null,as:null,async:Be,autoCapitalize:null,autoComplete:Dt,autoFocus:Be,autoPlay:Be,blocking:Dt,capture:null,charSet:null,checked:Be,cite:null,className:Dt,closedBy:null,colorSpace:null,cols:ge,colSpan:ge,command:null,commandFor:null,content:null,contentEditable:cn,controls:Be,controlsList:Dt,coords:ge|nl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Be,defer:Be,dir:null,dirName:null,disabled:Be,download:wh,draggable:cn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Be,formTarget:null,headers:Dt,height:ge,hidden:wh,high:ge,href:null,hrefLang:null,htmlFor:Dt,httpEquiv:Dt,id:null,imageSizes:null,imageSrcSet:null,inert:Be,inputMode:null,integrity:null,is:null,isMap:Be,itemId:null,itemProp:Dt,itemRef:Dt,itemScope:Be,itemType:Dt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Be,low:ge,manifest:null,max:null,maxLength:ge,media:null,method:null,min:null,minLength:ge,multiple:Be,muted:Be,name:null,nonce:null,noModule:Be,noValidate:Be,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:Be,optimum:ge,pattern:null,ping:Dt,placeholder:null,playsInline:Be,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Be,referrerPolicy:null,rel:Dt,required:Be,reversed:Be,rows:ge,rowSpan:ge,sandbox:Dt,scope:null,scoped:Be,seamless:Be,selected:Be,shadowRootClonable:Be,shadowRootCustomElementRegistry:Be,shadowRootDelegatesFocus:Be,shadowRootMode:null,shadowRootSerializable:Be,shape:null,size:ge,sizes:null,slot:null,span:ge,spellCheck:cn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ge,step:null,style:null,tabIndex:ge,target:null,title:null,translate:null,type:null,typeMustMatch:Be,useMap:null,value:cn,width:ge,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Dt,axis:null,background:null,bgColor:null,border:ge,borderColor:null,bottomMargin:ge,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Be,declare:Be,event:null,face:null,frame:null,frameBorder:null,hSpace:ge,leftMargin:ge,link:null,longDesc:null,lowSrc:null,marginHeight:ge,marginWidth:ge,noResize:Be,noHref:Be,noShade:Be,noWrap:Be,object:null,profile:null,prompt:null,rev:null,rightMargin:ge,rules:null,scheme:null,scrolling:cn,standby:null,summary:null,text:null,topMargin:ge,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ge,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Be,disablePictureInPicture:Be,disableRemotePlayback:Be,exportParts:nl,part:Dt,prefix:null,property:null,results:ge,security:null,unselectable:null},space:"html",transform:Ak}),p3=ti({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",maskType:"mask-type",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:ua,accentHeight:ge,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ge,amplitude:ge,arabicForm:null,ascent:ge,attributeName:null,attributeType:null,azimuth:ge,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ge,by:null,calcMode:null,capHeight:ge,className:Dt,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:ge,diffuseConstant:ge,direction:null,display:null,dur:null,divisor:ge,dominantBaseline:null,download:Be,dx:null,dy:null,edgeMode:null,editable:null,elevation:ge,enableBackground:null,end:null,event:null,exponent:ge,externalResourcesRequired:null,fill:null,fillOpacity:ge,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:nl,g2:nl,glyphName:nl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ge,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ge,horizOriginX:ge,horizOriginY:ge,id:null,ideographic:ge,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ge,k:ge,k1:ge,k2:ge,k3:ge,k4:ge,kernelMatrix:ua,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ge,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ge,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:ge,overlineThickness:ge,paintOrder:null,panose1:null,path:null,pathLength:ge,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Dt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ge,pointsAtY:ge,pointsAtZ:ge,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ua,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ua,rev:ua,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ua,requiredFeatures:ua,requiredFonts:ua,requiredFormats:ua,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:ge,specularExponent:ge,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ge,strikethroughThickness:ge,string:null,stroke:null,strokeDashArray:ua,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ge,strokeOpacity:ge,strokeWidth:null,style:null,surfaceScale:ge,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ua,tabIndex:ge,tableValues:null,target:null,targetX:ge,targetY:ge,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ua,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ge,underlineThickness:ge,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ge,values:null,vAlphabetic:ge,vMathematical:ge,vectorEffect:null,vHanging:ge,vIdeographic:ge,version:null,vertAdvY:ge,vertOriginX:ge,vertOriginY:ge,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ge,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ek}),Rk=ti({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),_k=ti({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Ak}),Ik=ti({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),g3={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"},x3=/[A-Z]/g,d1=/-[a-z]/g,y3=/^data[-\w.:]+$/i;function b3(e,n){const r=kh(n);let s=n,o=ta;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&y3.test(n)){if(n.charAt(4)==="-"){const c=n.slice(5).replace(d1,k3);s="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=n.slice(4);if(!d1.test(c)){let d=c.replace(x3,v3);d.charAt(0)!=="-"&&(d="-"+d),n="data"+d}}o=kp}return new o(s,n)}function v3(e){return"-"+e.toLowerCase()}function k3(e){return e.charAt(1).toUpperCase()}const w3=Tk([Mk,h3,Rk,_k,Ik],"html"),wp=Tk([Mk,p3,Rk,_k,Ik],"svg");function S3(e){return e.join(" ").trim()}var Ul={},Em,f1;function j3(){if(f1)return Em;f1=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
|
|
139
|
-
`,h="/",p="*",y="",k="comment",w="declaration";function S(M,E){if(typeof M!="string")throw new TypeError("First argument must be a string");if(!M)return[];E=E||{};var R=1,I=1;function H(Z){var B=Z.match(n);B&&(R+=B.length);var F=Z.lastIndexOf(m);I=~F?Z.length-F:I+Z.length}function D(){var Z={line:R,column:I};return function(B){return B.position=new L(Z),X(),B}}function L(Z){this.start=Z,this.end={line:R,column:I},this.source=E.source}L.prototype.content=M;function $(Z){var B=new Error(E.source+":"+R+":"+I+": "+Z);if(B.reason=Z,B.filename=E.source,B.line=R,B.column=I,B.source=M,!E.silent)throw B}function K(Z){var B=Z.exec(M);if(B){var F=B[0];return H(F),M=M.slice(F.length),B}}function X(){K(r)}function U(Z){var B;for(Z=Z||[];B=V();)B!==!1&&Z.push(B);return Z}function V(){var Z=D();if(!(h!=M.charAt(0)||p!=M.charAt(1))){for(var B=2;y!=M.charAt(B)&&(p!=M.charAt(B)||h!=M.charAt(B+1));)++B;if(B+=2,y===M.charAt(B-1))return $("End of comment missing");var F=M.slice(2,B-2);return I+=2,H(F),M=M.slice(B),I+=2,Z({type:k,comment:F})}}function O(){var Z=D(),B=K(s);if(B){if(V(),!K(o))return $("property missing ':'");var F=K(c),P=Z({type:w,property:T(B[0].replace(e,y)),value:F?T(F[0].replace(e,y)):y});return K(d),P}}function W(){var Z=[];U(Z);for(var B;B=O();)B!==!1&&(Z.push(B),U(Z));return Z}return X(),W()}function T(M){return M?M.replace(f,y):y}return Em=S,Em}var m1;function N3(){if(m1)return Ul;m1=1;var e=Ul&&Ul.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Ul,"__esModule",{value:!0}),Ul.default=r;const n=e(j3());function r(s,o){let c=null;if(!s||typeof s!="string")return c;const d=(0,n.default)(s),f=typeof o=="function";return d.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:p}=m;f?o(h,p,m):p&&(c=c||{},c[h]=p)}),c}return Ul}var Ji={},h1;function C3(){if(h1)return Ji;h1=1,Object.defineProperty(Ji,"__esModule",{value:!0}),Ji.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,c=function(h){return!h||r.test(h)||e.test(h)},d=function(h,p){return p.toUpperCase()},f=function(h,p){return"".concat(p,"-")},m=function(h,p){return p===void 0&&(p={}),c(h)?h:(h=h.toLowerCase(),p.reactCompat?h=h.replace(o,f):h=h.replace(s,f),h.replace(n,d))};return Ji.camelCase=m,Ji}var eo,p1;function T3(){if(p1)return eo;p1=1;var e=eo&&eo.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},n=e(N3()),r=C3();function s(o,c){var d={};return!o||typeof o!="string"||(0,n.default)(o,function(f,m){f&&m&&(d[(0,r.camelCase)(f,c)]=m)}),d}return s.default=s,eo=s,eo}var M3=T3();const E3=dv(M3),Lk=Ok("end"),Sp=Ok("start");function Ok(e){return n;function n(r){const s=r&&r.position&&r.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function A3(e){const n=Sp(e),r=Lk(e);if(n&&r)return{start:n,end:r}}function po(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?g1(e.position):"start"in e||"end"in e?g1(e):"line"in e||"column"in e?jh(e):""}function jh(e){return x1(e&&e.line)+":"+x1(e&&e.column)}function g1(e){return jh(e&&e.start)+"-"+jh(e&&e.end)}function x1(e){return e&&typeof e=="number"?e:1}class On extends Error{constructor(n,r,s){super(),typeof r=="string"&&(s=r,r=void 0);let o="",c={},d=!1;if(r&&("line"in r&&"column"in r?c={place:r}:"start"in r&&"end"in r?c={place:r}:"type"in r?c={ancestors:[r],place:r.position}:c={...r}),typeof n=="string"?o=n:!c.cause&&n&&(d=!0,o=n.message,c.cause=n),!c.ruleId&&!c.source&&typeof s=="string"){const m=s.indexOf(":");m===-1?c.ruleId=s:(c.source=s.slice(0,m),c.ruleId=s.slice(m+1))}if(!c.place&&c.ancestors&&c.ancestors){const m=c.ancestors[c.ancestors.length-1];m&&(c.place=m.position)}const f=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=f?f.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=f?f.line:void 0,this.name=po(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=d&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}On.prototype.file="";On.prototype.name="";On.prototype.reason="";On.prototype.message="";On.prototype.stack="";On.prototype.column=void 0;On.prototype.line=void 0;On.prototype.ancestors=void 0;On.prototype.cause=void 0;On.prototype.fatal=void 0;On.prototype.place=void 0;On.prototype.ruleId=void 0;On.prototype.source=void 0;const jp={}.hasOwnProperty,R3=new Map,_3=/[A-Z]/g,I3=new Set(["table","tbody","thead","tfoot","tr"]),L3=new Set(["td","th"]),Dk="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function O3(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let s;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=F3(r,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=P3(r,n.jsx,n.jsxs)}const o={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:s,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?wp:w3,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},c=zk(o,e,void 0);return c&&typeof c!="string"?c:o.create(e,o.Fragment,{children:c||void 0},void 0)}function zk(e,n,r){if(n.type==="element")return D3(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return z3(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return $3(e,n,r);if(n.type==="mdxjsEsm")return U3(e,n);if(n.type==="root")return B3(e,n,r);if(n.type==="text")return H3(e,n)}function D3(e,n,r){const s=e.schema;let o=s;n.tagName.toLowerCase()==="svg"&&s.space==="html"&&(o=wp,e.schema=o),e.ancestors.push(n);const c=$k(e,n.tagName,!1),d=q3(e,n);let f=Cp(e,n);return I3.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!f3(m):!0})),Uk(e,d,c,n),Np(d,f),e.ancestors.pop(),e.schema=s,e.create(n,c,d,r)}function z3(e,n){if(n.data&&n.data.estree&&e.evaluater){const s=n.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}Co(e,n.position)}function U3(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Co(e,n.position)}function $3(e,n,r){const s=e.schema;let o=s;n.name==="svg"&&s.space==="html"&&(o=wp,e.schema=o),e.ancestors.push(n);const c=n.name===null?e.Fragment:$k(e,n.name,!0),d=V3(e,n),f=Cp(e,n);return Uk(e,d,c,n),Np(d,f),e.ancestors.pop(),e.schema=s,e.create(n,c,d,r)}function B3(e,n,r){const s={};return Np(s,Cp(e,n)),e.create(n,e.Fragment,s,r)}function H3(e,n){return n.value}function Uk(e,n,r,s){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=s)}function Np(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function P3(e,n,r){return s;function s(o,c,d,f){const h=Array.isArray(d.children)?r:n;return f?h(c,d,f):h(c,d)}}function F3(e,n){return r;function r(s,o,c,d){const f=Array.isArray(c.children),m=Sp(s);return n(o,c,d,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function q3(e,n){const r={};let s,o;for(o in n.properties)if(o!=="children"&&jp.call(n.properties,o)){const c=G3(e,o,n.properties[o]);if(c){const[d,f]=c;e.tableCellAlignToStyle&&d==="align"&&typeof f=="string"&&L3.has(n.tagName)?s=f:r[d]=f}}if(s){const c=r.style||(r.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return r}function V3(e,n){const r={};for(const s of n.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const c=s.data.estree.body[0];c.type;const d=c.expression;d.type;const f=d.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else Co(e,n.position);else{const o=s.name;let c;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const f=s.value.data.estree.body[0];f.type,c=e.evaluater.evaluateExpression(f.expression)}else Co(e,n.position);else c=s.value===null?!0:s.value;r[o]=c}return r}function Cp(e,n){const r=[];let s=-1;const o=e.passKeys?new Map:R3;for(;++s<n.children.length;){const c=n.children[s];let d;if(e.passKeys){const m=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(m){const h=o.get(m)||0;d=m+"-"+h,o.set(m,h+1)}}const f=zk(e,c,d);f!==void 0&&r.push(f)}return r}function G3(e,n,r){const s=b3(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=s.commaSeparated?i3(r):S3(r)),s.property==="style"){let o=typeof r=="object"?r:W3(e,String(r));return e.stylePropertyNameCase==="css"&&(o=K3(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&s.space?g3[s.property]||s.property:s.attribute,r]}}function W3(e,n){try{return E3(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const s=r,o=new On("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=Dk+"#cannot-parse-style-attribute",o}}function $k(e,n,r){let s;if(!r)s={type:"Literal",value:n};else if(n.includes(".")){const o=n.split(".");let c=-1,d;for(;++c<o.length;){const f=o1(o[c])?{type:"Identifier",name:o[c]}:{type:"Literal",value:o[c]};d=d?{type:"MemberExpression",object:d,property:f,computed:!!(c&&f.type==="Literal"),optional:!1}:f}s=d}else s=o1(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(s.type==="Literal"){const o=s.value;return jp.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(s);Co(e)}function Co(e,n){const r=new On("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=Dk+"#cannot-handle-mdx-estrees-without-createevaluater",r}function K3(e){const n={};let r;for(r in e)jp.call(e,r)&&(n[Y3(r)]=e[r]);return n}function Y3(e){let n=e.replace(_3,Q3);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function Q3(e){return"-"+e.toLowerCase()}const Am={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"]},X3={};function Tp(e,n){const r=X3,s=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,o=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Bk(e,s,o)}function Bk(e,n,r){if(Z3(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return y1(e.children,n,r)}return Array.isArray(e)?y1(e,n,r):""}function y1(e,n,r){const s=[];let o=-1;for(;++o<e.length;)s[o]=Bk(e[o],n,r);return s.join("")}function Z3(e){return!!(e&&typeof e=="object")}const b1=document.createElement("i");function Mp(e){const n="&"+e+";";b1.innerHTML=n;const r=b1.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function fa(e,n,r,s){const o=e.length;let c=0,d;if(n<0?n=-n>o?0:o+n:n=n>o?o:n,r=r>0?r:0,s.length<1e4)d=Array.from(s),d.unshift(n,r),e.splice(...d);else for(r&&e.splice(n,r);c<s.length;)d=s.slice(c,c+1e4),d.unshift(n,0),e.splice(...d),c+=1e4,n+=1e4}function za(e,n){return e.length>0?(fa(e,e.length,0,n),e):n}const v1={}.hasOwnProperty;function Hk(e){const n={};let r=-1;for(;++r<e.length;)J3(n,e[r]);return n}function J3(e,n){let r;for(r in n){const o=(v1.call(e,r)?e[r]:void 0)||(e[r]={}),c=n[r];let d;if(c)for(d in c){v1.call(o,d)||(o[d]=[]);const f=c[d];eT(o[d],Array.isArray(f)?f:f?[f]:[])}}}function eT(e,n){let r=-1;const s=[];for(;++r<n.length;)(n[r].add==="after"?e:s).push(n[r]);fa(e,0,0,s)}function Pk(e,n){const r=Number.parseInt(e,n);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Qa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const $n=Ts(/[A-Za-z]/),In=Ts(/[\dA-Za-z]/),tT=Ts(/[#-'*+\--9=?A-Z^-~]/);function $u(e){return e!==null&&(e<32||e===127)}const Nh=Ts(/\d/),nT=Ts(/[\dA-Fa-f]/),aT=Ts(/[!-/:-@[-`{-~]/);function Le(e){return e!==null&&e<-2}function zt(e){return e!==null&&(e<0||e===32)}function nt(e){return e===-2||e===-1||e===32}const ld=Ts(new RegExp("\\p{P}|\\p{S}","u")),rl=Ts(/\s/);function Ts(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function ni(e){const n=[];let r=-1,s=0,o=0;for(;++r<e.length;){const c=e.charCodeAt(r);let d="";if(c===37&&In(e.charCodeAt(r+1))&&In(e.charCodeAt(r+2)))o=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(d=String.fromCharCode(c));else if(c>55295&&c<57344){const f=e.charCodeAt(r+1);c<56320&&f>56319&&f<57344?(d=String.fromCharCode(c,f),o=1):d="�"}else d=String.fromCharCode(c);d&&(n.push(e.slice(s,r),encodeURIComponent(d)),s=r+o+1,d=""),o&&(r+=o,o=0)}return n.join("")+e.slice(s)}function ut(e,n,r,s){const o=s?s-1:Number.POSITIVE_INFINITY;let c=0;return d;function d(m){return nt(m)?(e.enter(r),f(m)):n(m)}function f(m){return nt(m)&&c++<o?(e.consume(m),f):(e.exit(r),n(m))}}const rT={tokenize:sT};function sT(e){const n=e.attempt(this.parser.constructs.contentInitial,s,o);let r;return n;function s(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),ut(e,n,"linePrefix")}function o(f){return e.enter("paragraph"),c(f)}function c(f){const m=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=m),r=m,d(f)}function d(f){if(f===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(f);return}return Le(f)?(e.consume(f),e.exit("chunkText"),c):(e.consume(f),d)}}const lT={tokenize:iT},k1={tokenize:oT};function iT(e){const n=this,r=[];let s=0,o,c,d;return f;function f(I){if(s<r.length){const H=r[s];return n.containerState=H[1],e.attempt(H[0].continuation,m,h)(I)}return h(I)}function m(I){if(s++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,o&&R();const H=n.events.length;let D=H,L;for(;D--;)if(n.events[D][0]==="exit"&&n.events[D][1].type==="chunkFlow"){L=n.events[D][1].end;break}E(s);let $=H;for(;$<n.events.length;)n.events[$][1].end={...L},$++;return fa(n.events,D+1,0,n.events.slice(H)),n.events.length=$,h(I)}return f(I)}function h(I){if(s===r.length){if(!o)return k(I);if(o.currentConstruct&&o.currentConstruct.concrete)return S(I);n.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(k1,p,y)(I)}function p(I){return o&&R(),E(s),k(I)}function y(I){return n.parser.lazy[n.now().line]=s!==r.length,d=n.now().offset,S(I)}function k(I){return n.containerState={},e.attempt(k1,w,S)(I)}function w(I){return s++,r.push([n.currentConstruct,n.containerState]),k(I)}function S(I){if(I===null){o&&R(),E(0),e.consume(I);return}return o=o||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:c}),T(I)}function T(I){if(I===null){M(e.exit("chunkFlow"),!0),E(0),e.consume(I);return}return Le(I)?(e.consume(I),M(e.exit("chunkFlow")),s=0,n.interrupt=void 0,f):(e.consume(I),T)}function M(I,H){const D=n.sliceStream(I);if(H&&D.push(null),I.previous=c,c&&(c.next=I),c=I,o.defineSkip(I.start),o.write(D),n.parser.lazy[I.start.line]){let L=o.events.length;for(;L--;)if(o.events[L][1].start.offset<d&&(!o.events[L][1].end||o.events[L][1].end.offset>d))return;const $=n.events.length;let K=$,X,U;for(;K--;)if(n.events[K][0]==="exit"&&n.events[K][1].type==="chunkFlow"){if(X){U=n.events[K][1].end;break}X=!0}for(E(s),L=$;L<n.events.length;)n.events[L][1].end={...U},L++;fa(n.events,K+1,0,n.events.slice($)),n.events.length=L}}function E(I){let H=r.length;for(;H-- >I;){const D=r[H];n.containerState=D[1],D[0].exit.call(n,e)}r.length=I}function R(){o.write([null]),c=void 0,o=void 0,n.containerState._closeFlow=void 0}}function oT(e,n,r){return ut(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ql(e){if(e===null||zt(e)||rl(e))return 1;if(ld(e))return 2}function id(e,n,r){const s=[];let o=-1;for(;++o<e.length;){const c=e[o].resolveAll;c&&!s.includes(c)&&(n=c(n,r),s.push(c))}return n}const Ch={name:"attention",resolveAll:cT,tokenize:uT};function cT(e,n){let r=-1,s,o,c,d,f,m,h,p;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(s=r;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&n.sliceSerialize(e[s][1]).charCodeAt(0)===n.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[s][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;m=e[s][1].end.offset-e[s][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const y={...e[s][1].end},k={...e[r][1].start};w1(y,-m),w1(k,m),d={type:m>1?"strongSequence":"emphasisSequence",start:y,end:{...e[s][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:k},c={type:m>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[r][1].start}},o={type:m>1?"strong":"emphasis",start:{...d.start},end:{...f.end}},e[s][1].end={...d.start},e[r][1].start={...f.end},h=[],e[s][1].end.offset-e[s][1].start.offset&&(h=za(h,[["enter",e[s][1],n],["exit",e[s][1],n]])),h=za(h,[["enter",o,n],["enter",d,n],["exit",d,n],["enter",c,n]]),h=za(h,id(n.parser.constructs.insideSpan.null,e.slice(s+1,r),n)),h=za(h,[["exit",c,n],["enter",f,n],["exit",f,n],["exit",o,n]]),e[r][1].end.offset-e[r][1].start.offset?(p=2,h=za(h,[["enter",e[r][1],n],["exit",e[r][1],n]])):p=0,fa(e,s-1,r-s+3,h),r=s+h.length-p-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function uT(e,n){const r=this.parser.constructs.attentionMarkers.null,s=this.previous,o=Ql(s);let c;return d;function d(m){return c=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===c)return e.consume(m),f;const h=e.exit("attentionSequence"),p=Ql(m),y=!p||p===2&&o||r.includes(m),k=!o||o===2&&p||r.includes(s);return h._open=!!(c===42?y:y&&(o||!k)),h._close=!!(c===42?k:k&&(p||!y)),n(m)}}function w1(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const dT={name:"autolink",tokenize:fT};function fT(e,n,r){let s=0;return o;function o(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(w){return $n(w)?(e.consume(w),d):w===64?r(w):h(w)}function d(w){return w===43||w===45||w===46||In(w)?(s=1,f(w)):h(w)}function f(w){return w===58?(e.consume(w),s=0,m):(w===43||w===45||w===46||In(w))&&s++<32?(e.consume(w),f):(s=0,h(w))}function m(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),n):w===null||w===32||w===60||$u(w)?r(w):(e.consume(w),m)}function h(w){return w===64?(e.consume(w),p):tT(w)?(e.consume(w),h):r(w)}function p(w){return In(w)?y(w):r(w)}function y(w){return w===46?(e.consume(w),s=0,p):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),n):k(w)}function k(w){if((w===45||In(w))&&s++<63){const S=w===45?k:y;return e.consume(w),S}return r(w)}}const zo={partial:!0,tokenize:mT};function mT(e,n,r){return s;function s(c){return nt(c)?ut(e,o,"linePrefix")(c):o(c)}function o(c){return c===null||Le(c)?n(c):r(c)}}const Fk={continuation:{tokenize:pT},exit:gT,name:"blockQuote",tokenize:hT};function hT(e,n,r){const s=this;return o;function o(d){if(d===62){const f=s.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),c}return r(d)}function c(d){return nt(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(d))}}function pT(e,n,r){const s=this;return o;function o(d){return nt(d)?ut(e,c,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):c(d)}function c(d){return e.attempt(Fk,n,r)(d)}}function gT(e){e.exit("blockQuote")}const qk={name:"characterEscape",tokenize:xT};function xT(e,n,r){return s;function s(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),o}function o(c){return aT(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(c)}}const Vk={name:"characterReference",tokenize:yT};function yT(e,n,r){const s=this;let o=0,c,d;return f;function f(y){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),m}function m(y){return y===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(y),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),c=31,d=In,p(y))}function h(y){return y===88||y===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(y),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,d=nT,p):(e.enter("characterReferenceValue"),c=7,d=Nh,p(y))}function p(y){if(y===59&&o){const k=e.exit("characterReferenceValue");return d===In&&!Mp(s.sliceSerialize(k))?r(y):(e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return d(y)&&o++<c?(e.consume(y),p):r(y)}}const S1={partial:!0,tokenize:vT},j1={concrete:!0,name:"codeFenced",tokenize:bT};function bT(e,n,r){const s=this,o={partial:!0,tokenize:D};let c=0,d=0,f;return m;function m(L){return h(L)}function h(L){const $=s.events[s.events.length-1];return c=$&&$[1].type==="linePrefix"?$[2].sliceSerialize($[1],!0).length:0,f=L,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(L)}function p(L){return L===f?(d++,e.consume(L),p):d<3?r(L):(e.exit("codeFencedFenceSequence"),nt(L)?ut(e,y,"whitespace")(L):y(L))}function y(L){return L===null||Le(L)?(e.exit("codeFencedFence"),s.interrupt?n(L):e.check(S1,T,H)(L)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),k(L))}function k(L){return L===null||Le(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),y(L)):nt(L)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),ut(e,w,"whitespace")(L)):L===96&&L===f?r(L):(e.consume(L),k)}function w(L){return L===null||Le(L)?y(L):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(L))}function S(L){return L===null||Le(L)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),y(L)):L===96&&L===f?r(L):(e.consume(L),S)}function T(L){return e.attempt(o,H,M)(L)}function M(L){return e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),E}function E(L){return c>0&&nt(L)?ut(e,R,"linePrefix",c+1)(L):R(L)}function R(L){return L===null||Le(L)?e.check(S1,T,H)(L):(e.enter("codeFlowValue"),I(L))}function I(L){return L===null||Le(L)?(e.exit("codeFlowValue"),R(L)):(e.consume(L),I)}function H(L){return e.exit("codeFenced"),n(L)}function D(L,$,K){let X=0;return U;function U(B){return L.enter("lineEnding"),L.consume(B),L.exit("lineEnding"),V}function V(B){return L.enter("codeFencedFence"),nt(B)?ut(L,O,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):O(B)}function O(B){return B===f?(L.enter("codeFencedFenceSequence"),W(B)):K(B)}function W(B){return B===f?(X++,L.consume(B),W):X>=d?(L.exit("codeFencedFenceSequence"),nt(B)?ut(L,Z,"whitespace")(B):Z(B)):K(B)}function Z(B){return B===null||Le(B)?(L.exit("codeFencedFence"),$(B)):K(B)}}}function vT(e,n,r){const s=this;return o;function o(d){return d===null?r(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c)}function c(d){return s.parser.lazy[s.now().line]?r(d):n(d)}}const Rm={name:"codeIndented",tokenize:wT},kT={partial:!0,tokenize:ST};function wT(e,n,r){const s=this;return o;function o(h){return e.enter("codeIndented"),ut(e,c,"linePrefix",5)(h)}function c(h){const p=s.events[s.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?d(h):r(h)}function d(h){return h===null?m(h):Le(h)?e.attempt(kT,d,m)(h):(e.enter("codeFlowValue"),f(h))}function f(h){return h===null||Le(h)?(e.exit("codeFlowValue"),d(h)):(e.consume(h),f)}function m(h){return e.exit("codeIndented"),n(h)}}function ST(e,n,r){const s=this;return o;function o(d){return s.parser.lazy[s.now().line]?r(d):Le(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),o):ut(e,c,"linePrefix",5)(d)}function c(d){const f=s.events[s.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(d):Le(d)?o(d):r(d)}}const jT={name:"codeText",previous:CT,resolve:NT,tokenize:TT};function NT(e){let n=e.length-4,r=3,s,o;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(s=r;++s<n;)if(e[s][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(s=r-1,n++;++s<=n;)o===void 0?s!==n&&e[s][1].type!=="lineEnding"&&(o=s):(s===n||e[s][1].type==="lineEnding")&&(e[o][1].type="codeTextData",s!==o+2&&(e[o][1].end=e[s-1][1].end,e.splice(o+2,s-o-2),n-=s-o-2,s=o+2),o=void 0);return e}function CT(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function TT(e,n,r){let s=0,o,c;return d;function d(y){return e.enter("codeText"),e.enter("codeTextSequence"),f(y)}function f(y){return y===96?(e.consume(y),s++,f):(e.exit("codeTextSequence"),m(y))}function m(y){return y===null?r(y):y===32?(e.enter("space"),e.consume(y),e.exit("space"),m):y===96?(c=e.enter("codeTextSequence"),o=0,p(y)):Le(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),m):(e.enter("codeTextData"),h(y))}function h(y){return y===null||y===32||y===96||Le(y)?(e.exit("codeTextData"),m(y)):(e.consume(y),h)}function p(y){return y===96?(e.consume(y),o++,p):o===s?(e.exit("codeTextSequence"),e.exit("codeText"),n(y)):(c.type="codeTextData",h(y))}}class MT{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,r){const s=r??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(n,s):n>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(n,r,s){const o=r||0;this.setCursor(Math.trunc(n));const c=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return s&&to(this.left,s),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),to(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),to(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){const r=this.left.splice(n,Number.POSITIVE_INFINITY);to(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);to(this.left,r.reverse())}}}function to(e,n){let r=0;if(n.length<1e4)e.push(...n);else for(;r<n.length;)e.push(...n.slice(r,r+1e4)),r+=1e4}function Gk(e){const n={};let r=-1,s,o,c,d,f,m,h;const p=new MT(e);for(;++r<p.length;){for(;r in n;)r=n[r];if(s=p.get(r),r&&s[1].type==="chunkFlow"&&p.get(r-1)[1].type==="listItemPrefix"&&(m=s[1]._tokenizer.events,c=0,c<m.length&&m[c][1].type==="lineEndingBlank"&&(c+=2),c<m.length&&m[c][1].type==="content"))for(;++c<m.length&&m[c][1].type!=="content";)m[c][1].type==="chunkText"&&(m[c][1]._isInFirstContentOfListItem=!0,c++);if(s[0]==="enter")s[1].contentType&&(Object.assign(n,ET(p,r)),r=n[r],h=!0);else if(s[1]._container){for(c=r,o=void 0;c--;)if(d=p.get(c),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(o&&(p.get(o)[1].type="lineEndingBlank"),d[1].type="lineEnding",o=c);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;o&&(s[1].end={...p.get(o)[1].start},f=p.slice(o,r),f.unshift(s),p.splice(o,r-o+1,f))}}return fa(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!h}function ET(e,n){const r=e.get(n)[1],s=e.get(n)[2];let o=n-1;const c=[];let d=r._tokenizer;d||(d=s.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const f=d.events,m=[],h={};let p,y,k=-1,w=r,S=0,T=0;const M=[T];for(;w;){for(;e.get(++o)[1]!==w;);c.push(o),w._tokenizer||(p=s.sliceStream(w),w.next||p.push(null),y&&d.defineSkip(w.start),w._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(p),w._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=void 0)),y=w,w=w.next}for(w=r;++k<f.length;)f[k][0]==="exit"&&f[k-1][0]==="enter"&&f[k][1].type===f[k-1][1].type&&f[k][1].start.line!==f[k][1].end.line&&(T=k+1,M.push(T),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(d.events=[],w?(w._tokenizer=void 0,w.previous=void 0):M.pop(),k=M.length;k--;){const E=f.slice(M[k],M[k+1]),R=c.pop();m.push([R,R+E.length-1]),e.splice(R,2,E)}for(m.reverse(),k=-1;++k<m.length;)h[S+m[k][0]]=S+m[k][1],S+=m[k][1]-m[k][0]-1;return h}const AT={resolve:_T,tokenize:IT},RT={partial:!0,tokenize:LT};function _T(e){return Gk(e),e}function IT(e,n){let r;return s;function s(f){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),o(f)}function o(f){return f===null?c(f):Le(f)?e.check(RT,d,c)(f):(e.consume(f),o)}function c(f){return e.exit("chunkContent"),e.exit("content"),n(f)}function d(f){return e.consume(f),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,o}}function LT(e,n,r){const s=this;return o;function o(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),ut(e,c,"linePrefix")}function c(d){if(d===null||Le(d))return r(d);const f=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(d):e.interrupt(s.parser.constructs.flow,r,n)(d)}}function Wk(e,n,r,s,o,c,d,f,m){const h=m||Number.POSITIVE_INFINITY;let p=0;return y;function y(E){return E===60?(e.enter(s),e.enter(o),e.enter(c),e.consume(E),e.exit(c),k):E===null||E===32||E===41||$u(E)?r(E):(e.enter(s),e.enter(d),e.enter(f),e.enter("chunkString",{contentType:"string"}),T(E))}function k(E){return E===62?(e.enter(c),e.consume(E),e.exit(c),e.exit(o),e.exit(s),n):(e.enter(f),e.enter("chunkString",{contentType:"string"}),w(E))}function w(E){return E===62?(e.exit("chunkString"),e.exit(f),k(E)):E===null||E===60||Le(E)?r(E):(e.consume(E),E===92?S:w)}function S(E){return E===60||E===62||E===92?(e.consume(E),w):w(E)}function T(E){return!p&&(E===null||E===41||zt(E))?(e.exit("chunkString"),e.exit(f),e.exit(d),e.exit(s),n(E)):p<h&&E===40?(e.consume(E),p++,T):E===41?(e.consume(E),p--,T):E===null||E===32||E===40||$u(E)?r(E):(e.consume(E),E===92?M:T)}function M(E){return E===40||E===41||E===92?(e.consume(E),T):T(E)}}function Kk(e,n,r,s,o,c){const d=this;let f=0,m;return h;function h(w){return e.enter(s),e.enter(o),e.consume(w),e.exit(o),e.enter(c),p}function p(w){return f>999||w===null||w===91||w===93&&!m||w===94&&!f&&"_hiddenFootnoteSupport"in d.parser.constructs?r(w):w===93?(e.exit(c),e.enter(o),e.consume(w),e.exit(o),e.exit(s),n):Le(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),y(w))}function y(w){return w===null||w===91||w===93||Le(w)||f++>999?(e.exit("chunkString"),p(w)):(e.consume(w),m||(m=!nt(w)),w===92?k:y)}function k(w){return w===91||w===92||w===93?(e.consume(w),f++,y):y(w)}}function Yk(e,n,r,s,o,c){let d;return f;function f(k){return k===34||k===39||k===40?(e.enter(s),e.enter(o),e.consume(k),e.exit(o),d=k===40?41:k,m):r(k)}function m(k){return k===d?(e.enter(o),e.consume(k),e.exit(o),e.exit(s),n):(e.enter(c),h(k))}function h(k){return k===d?(e.exit(c),m(d)):k===null?r(k):Le(k)?(e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),ut(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(k))}function p(k){return k===d||k===null||Le(k)?(e.exit("chunkString"),h(k)):(e.consume(k),k===92?y:p)}function y(k){return k===d||k===92?(e.consume(k),p):p(k)}}function go(e,n){let r;return s;function s(o){return Le(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r=!0,s):nt(o)?ut(e,s,r?"linePrefix":"lineSuffix")(o):n(o)}}const OT={name:"definition",tokenize:zT},DT={partial:!0,tokenize:UT};function zT(e,n,r){const s=this;let o;return c;function c(w){return e.enter("definition"),d(w)}function d(w){return Kk.call(s,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return o=Qa(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),m):r(w)}function m(w){return zt(w)?go(e,h)(w):h(w)}function h(w){return Wk(e,p,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function p(w){return e.attempt(DT,y,y)(w)}function y(w){return nt(w)?ut(e,k,"whitespace")(w):k(w)}function k(w){return w===null||Le(w)?(e.exit("definition"),s.parser.defined.push(o),n(w)):r(w)}}function UT(e,n,r){return s;function s(f){return zt(f)?go(e,o)(f):r(f)}function o(f){return Yk(e,c,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function c(f){return nt(f)?ut(e,d,"whitespace")(f):d(f)}function d(f){return f===null||Le(f)?n(f):r(f)}}const $T={name:"hardBreakEscape",tokenize:BT};function BT(e,n,r){return s;function s(c){return e.enter("hardBreakEscape"),e.consume(c),o}function o(c){return Le(c)?(e.exit("hardBreakEscape"),n(c)):r(c)}}const HT={name:"headingAtx",resolve:PT,tokenize:FT};function PT(e,n){let r=e.length-2,s=3,o,c;return e[s][1].type==="whitespace"&&(s+=2),r-2>s&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(s===r-1||r-4>s&&e[r-2][1].type==="whitespace")&&(r-=s+1===r?2:4),r>s&&(o={type:"atxHeadingText",start:e[s][1].start,end:e[r][1].end},c={type:"chunkText",start:e[s][1].start,end:e[r][1].end,contentType:"text"},fa(e,s,r-s+1,[["enter",o,n],["enter",c,n],["exit",c,n],["exit",o,n]])),e}function FT(e,n,r){let s=0;return o;function o(p){return e.enter("atxHeading"),c(p)}function c(p){return e.enter("atxHeadingSequence"),d(p)}function d(p){return p===35&&s++<6?(e.consume(p),d):p===null||zt(p)?(e.exit("atxHeadingSequence"),f(p)):r(p)}function f(p){return p===35?(e.enter("atxHeadingSequence"),m(p)):p===null||Le(p)?(e.exit("atxHeading"),n(p)):nt(p)?ut(e,f,"whitespace")(p):(e.enter("atxHeadingText"),h(p))}function m(p){return p===35?(e.consume(p),m):(e.exit("atxHeadingSequence"),f(p))}function h(p){return p===null||p===35||zt(p)?(e.exit("atxHeadingText"),f(p)):(e.consume(p),h)}}const qT=["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"],N1=["pre","script","style","textarea"],VT={concrete:!0,name:"htmlFlow",resolveTo:KT,tokenize:YT},GT={partial:!0,tokenize:XT},WT={partial:!0,tokenize:QT};function KT(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function YT(e,n,r){const s=this;let o,c,d,f,m;return h;function h(N){return p(N)}function p(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),y}function y(N){return N===33?(e.consume(N),k):N===47?(e.consume(N),c=!0,T):N===63?(e.consume(N),o=3,s.interrupt?n:A):$n(N)?(e.consume(N),d=String.fromCharCode(N),M):r(N)}function k(N){return N===45?(e.consume(N),o=2,w):N===91?(e.consume(N),o=5,f=0,S):$n(N)?(e.consume(N),o=4,s.interrupt?n:A):r(N)}function w(N){return N===45?(e.consume(N),s.interrupt?n:A):r(N)}function S(N){const Q="CDATA[";return N===Q.charCodeAt(f++)?(e.consume(N),f===Q.length?s.interrupt?n:O:S):r(N)}function T(N){return $n(N)?(e.consume(N),d=String.fromCharCode(N),M):r(N)}function M(N){if(N===null||N===47||N===62||zt(N)){const Q=N===47,se=d.toLowerCase();return!Q&&!c&&N1.includes(se)?(o=1,s.interrupt?n(N):O(N)):qT.includes(d.toLowerCase())?(o=6,Q?(e.consume(N),E):s.interrupt?n(N):O(N)):(o=7,s.interrupt&&!s.parser.lazy[s.now().line]?r(N):c?R(N):I(N))}return N===45||In(N)?(e.consume(N),d+=String.fromCharCode(N),M):r(N)}function E(N){return N===62?(e.consume(N),s.interrupt?n:O):r(N)}function R(N){return nt(N)?(e.consume(N),R):U(N)}function I(N){return N===47?(e.consume(N),U):N===58||N===95||$n(N)?(e.consume(N),H):nt(N)?(e.consume(N),I):U(N)}function H(N){return N===45||N===46||N===58||N===95||In(N)?(e.consume(N),H):D(N)}function D(N){return N===61?(e.consume(N),L):nt(N)?(e.consume(N),D):I(N)}function L(N){return N===null||N===60||N===61||N===62||N===96?r(N):N===34||N===39?(e.consume(N),m=N,$):nt(N)?(e.consume(N),L):K(N)}function $(N){return N===m?(e.consume(N),m=null,X):N===null||Le(N)?r(N):(e.consume(N),$)}function K(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||zt(N)?D(N):(e.consume(N),K)}function X(N){return N===47||N===62||nt(N)?I(N):r(N)}function U(N){return N===62?(e.consume(N),V):r(N)}function V(N){return N===null||Le(N)?O(N):nt(N)?(e.consume(N),V):r(N)}function O(N){return N===45&&o===2?(e.consume(N),F):N===60&&o===1?(e.consume(N),P):N===62&&o===4?(e.consume(N),C):N===63&&o===3?(e.consume(N),A):N===93&&o===5?(e.consume(N),oe):Le(N)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(GT,z,W)(N)):N===null||Le(N)?(e.exit("htmlFlowData"),W(N)):(e.consume(N),O)}function W(N){return e.check(WT,Z,z)(N)}function Z(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),B}function B(N){return N===null||Le(N)?W(N):(e.enter("htmlFlowData"),O(N))}function F(N){return N===45?(e.consume(N),A):O(N)}function P(N){return N===47?(e.consume(N),d="",ce):O(N)}function ce(N){if(N===62){const Q=d.toLowerCase();return N1.includes(Q)?(e.consume(N),C):O(N)}return $n(N)&&d.length<8?(e.consume(N),d+=String.fromCharCode(N),ce):O(N)}function oe(N){return N===93?(e.consume(N),A):O(N)}function A(N){return N===62?(e.consume(N),C):N===45&&o===2?(e.consume(N),A):O(N)}function C(N){return N===null||Le(N)?(e.exit("htmlFlowData"),z(N)):(e.consume(N),C)}function z(N){return e.exit("htmlFlow"),n(N)}}function QT(e,n,r){const s=this;return o;function o(d){return Le(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):r(d)}function c(d){return s.parser.lazy[s.now().line]?r(d):n(d)}}function XT(e,n,r){return s;function s(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(zo,n,r)}}const ZT={name:"htmlText",tokenize:JT};function JT(e,n,r){const s=this;let o,c,d;return f;function f(A){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(A),m}function m(A){return A===33?(e.consume(A),h):A===47?(e.consume(A),D):A===63?(e.consume(A),I):$n(A)?(e.consume(A),K):r(A)}function h(A){return A===45?(e.consume(A),p):A===91?(e.consume(A),c=0,S):$n(A)?(e.consume(A),R):r(A)}function p(A){return A===45?(e.consume(A),w):r(A)}function y(A){return A===null?r(A):A===45?(e.consume(A),k):Le(A)?(d=y,P(A)):(e.consume(A),y)}function k(A){return A===45?(e.consume(A),w):y(A)}function w(A){return A===62?F(A):A===45?k(A):y(A)}function S(A){const C="CDATA[";return A===C.charCodeAt(c++)?(e.consume(A),c===C.length?T:S):r(A)}function T(A){return A===null?r(A):A===93?(e.consume(A),M):Le(A)?(d=T,P(A)):(e.consume(A),T)}function M(A){return A===93?(e.consume(A),E):T(A)}function E(A){return A===62?F(A):A===93?(e.consume(A),E):T(A)}function R(A){return A===null||A===62?F(A):Le(A)?(d=R,P(A)):(e.consume(A),R)}function I(A){return A===null?r(A):A===63?(e.consume(A),H):Le(A)?(d=I,P(A)):(e.consume(A),I)}function H(A){return A===62?F(A):I(A)}function D(A){return $n(A)?(e.consume(A),L):r(A)}function L(A){return A===45||In(A)?(e.consume(A),L):$(A)}function $(A){return Le(A)?(d=$,P(A)):nt(A)?(e.consume(A),$):F(A)}function K(A){return A===45||In(A)?(e.consume(A),K):A===47||A===62||zt(A)?X(A):r(A)}function X(A){return A===47?(e.consume(A),F):A===58||A===95||$n(A)?(e.consume(A),U):Le(A)?(d=X,P(A)):nt(A)?(e.consume(A),X):F(A)}function U(A){return A===45||A===46||A===58||A===95||In(A)?(e.consume(A),U):V(A)}function V(A){return A===61?(e.consume(A),O):Le(A)?(d=V,P(A)):nt(A)?(e.consume(A),V):X(A)}function O(A){return A===null||A===60||A===61||A===62||A===96?r(A):A===34||A===39?(e.consume(A),o=A,W):Le(A)?(d=O,P(A)):nt(A)?(e.consume(A),O):(e.consume(A),Z)}function W(A){return A===o?(e.consume(A),o=void 0,B):A===null?r(A):Le(A)?(d=W,P(A)):(e.consume(A),W)}function Z(A){return A===null||A===34||A===39||A===60||A===61||A===96?r(A):A===47||A===62||zt(A)?X(A):(e.consume(A),Z)}function B(A){return A===47||A===62||zt(A)?X(A):r(A)}function F(A){return A===62?(e.consume(A),e.exit("htmlTextData"),e.exit("htmlText"),n):r(A)}function P(A){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),ce}function ce(A){return nt(A)?ut(e,oe,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):oe(A)}function oe(A){return e.enter("htmlTextData"),d(A)}}const Ep={name:"labelEnd",resolveAll:aM,resolveTo:rM,tokenize:sM},eM={tokenize:lM},tM={tokenize:iM},nM={tokenize:oM};function aM(e){let n=-1;const r=[];for(;++n<e.length;){const s=e[n][1];if(r.push(e[n]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const o=s.type==="labelImage"?4:2;s.type="data",n+=o}}return e.length!==r.length&&fa(e,0,e.length,r),e}function rM(e,n){let r=e.length,s=0,o,c,d,f;for(;r--;)if(o=e[r][1],c){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[r][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(d){if(e[r][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(c=r,o.type!=="labelLink")){s=2;break}}else o.type==="labelEnd"&&(d=r);const m={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[c][1].start},end:{...e[d][1].end}},p={type:"labelText",start:{...e[c+s+2][1].end},end:{...e[d-2][1].start}};return f=[["enter",m,n],["enter",h,n]],f=za(f,e.slice(c+1,c+s+3)),f=za(f,[["enter",p,n]]),f=za(f,id(n.parser.constructs.insideSpan.null,e.slice(c+s+4,d-3),n)),f=za(f,[["exit",p,n],e[d-2],e[d-1],["exit",h,n]]),f=za(f,e.slice(d+1)),f=za(f,[["exit",m,n]]),fa(e,c,e.length,f),e}function sM(e,n,r){const s=this;let o=s.events.length,c,d;for(;o--;)if((s.events[o][1].type==="labelImage"||s.events[o][1].type==="labelLink")&&!s.events[o][1]._balanced){c=s.events[o][1];break}return f;function f(k){return c?c._inactive?y(k):(d=s.parser.defined.includes(Qa(s.sliceSerialize({start:c.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(k),e.exit("labelMarker"),e.exit("labelEnd"),m):r(k)}function m(k){return k===40?e.attempt(eM,p,d?p:y)(k):k===91?e.attempt(tM,p,d?h:y)(k):d?p(k):y(k)}function h(k){return e.attempt(nM,p,y)(k)}function p(k){return n(k)}function y(k){return c._balanced=!0,r(k)}}function lM(e,n,r){return s;function s(y){return e.enter("resource"),e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),o}function o(y){return zt(y)?go(e,c)(y):c(y)}function c(y){return y===41?p(y):Wk(e,d,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function d(y){return zt(y)?go(e,m)(y):p(y)}function f(y){return r(y)}function m(y){return y===34||y===39||y===40?Yk(e,h,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):p(y)}function h(y){return zt(y)?go(e,p)(y):p(y)}function p(y){return y===41?(e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),e.exit("resource"),n):r(y)}}function iM(e,n,r){const s=this;return o;function o(f){return Kk.call(s,e,c,d,"reference","referenceMarker","referenceString")(f)}function c(f){return s.parser.defined.includes(Qa(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?n(f):r(f)}function d(f){return r(f)}}function oM(e,n,r){return s;function s(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),o}function o(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),n):r(c)}}const cM={name:"labelStartImage",resolveAll:Ep.resolveAll,tokenize:uM};function uM(e,n,r){const s=this;return o;function o(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),c}function c(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelImage"),d):r(f)}function d(f){return f===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(f):n(f)}}const dM={name:"labelStartLink",resolveAll:Ep.resolveAll,tokenize:fM};function fM(e,n,r){const s=this;return o;function o(d){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelLink"),c}function c(d){return d===94&&"_hiddenFootnoteSupport"in s.parser.constructs?r(d):n(d)}}const _m={name:"lineEnding",tokenize:mM};function mM(e,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),ut(e,n,"linePrefix")}}const Eu={name:"thematicBreak",tokenize:hM};function hM(e,n,r){let s=0,o;return c;function c(h){return e.enter("thematicBreak"),d(h)}function d(h){return o=h,f(h)}function f(h){return h===o?(e.enter("thematicBreakSequence"),m(h)):s>=3&&(h===null||Le(h))?(e.exit("thematicBreak"),n(h)):r(h)}function m(h){return h===o?(e.consume(h),s++,m):(e.exit("thematicBreakSequence"),nt(h)?ut(e,f,"whitespace")(h):f(h))}}const Zn={continuation:{tokenize:yM},exit:vM,name:"list",tokenize:xM},pM={partial:!0,tokenize:kM},gM={partial:!0,tokenize:bM};function xM(e,n,r){const s=this,o=s.events[s.events.length-1];let c=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,d=0;return f;function f(w){const S=s.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!s.containerState.marker||w===s.containerState.marker:Nh(w)){if(s.containerState.type||(s.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(Eu,r,h)(w):h(w);if(!s.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(w)}return r(w)}function m(w){return Nh(w)&&++d<10?(e.consume(w),m):(!s.interrupt||d<2)&&(s.containerState.marker?w===s.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),h(w)):r(w)}function h(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||w,e.check(zo,s.interrupt?r:p,e.attempt(pM,k,y))}function p(w){return s.containerState.initialBlankLine=!0,c++,k(w)}function y(w){return nt(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),k):r(w)}function k(w){return s.containerState.size=c+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(w)}}function yM(e,n,r){const s=this;return s.containerState._closeFlow=void 0,e.check(zo,o,c);function o(f){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,ut(e,n,"listItemIndent",s.containerState.size+1)(f)}function c(f){return s.containerState.furtherBlankLines||!nt(f)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,d(f)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(gM,n,d)(f))}function d(f){return s.containerState._closeFlow=!0,s.interrupt=void 0,ut(e,e.attempt(Zn,n,r),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function bM(e,n,r){const s=this;return ut(e,o,"listItemIndent",s.containerState.size+1);function o(c){const d=s.events[s.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===s.containerState.size?n(c):r(c)}}function vM(e){e.exit(this.containerState.type)}function kM(e,n,r){const s=this;return ut(e,o,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(c){const d=s.events[s.events.length-1];return!nt(c)&&d&&d[1].type==="listItemPrefixWhitespace"?n(c):r(c)}}const C1={name:"setextUnderline",resolveTo:wM,tokenize:SM};function wM(e,n){let r=e.length,s,o,c;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){s=r;break}e[r][1].type==="paragraph"&&(o=r)}else e[r][1].type==="content"&&e.splice(r,1),!c&&e[r][1].type==="definition"&&(c=r);const d={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",c?(e.splice(o,0,["enter",d,n]),e.splice(c+1,0,["exit",e[s][1],n]),e[s][1].end={...e[c][1].end}):e[s][1]=d,e.push(["exit",d,n]),e}function SM(e,n,r){const s=this;let o;return c;function c(h){let p=s.events.length,y;for(;p--;)if(s.events[p][1].type!=="lineEnding"&&s.events[p][1].type!=="linePrefix"&&s.events[p][1].type!=="content"){y=s.events[p][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||y)?(e.enter("setextHeadingLine"),o=h,d(h)):r(h)}function d(h){return e.enter("setextHeadingLineSequence"),f(h)}function f(h){return h===o?(e.consume(h),f):(e.exit("setextHeadingLineSequence"),nt(h)?ut(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Le(h)?(e.exit("setextHeadingLine"),n(h)):r(h)}}const jM={tokenize:NM};function NM(e){const n=this,r=e.attempt(zo,s,e.attempt(this.parser.constructs.flowInitial,o,ut(e,e.attempt(this.parser.constructs.flow,o,e.attempt(AT,o)),"linePrefix")));return r;function s(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function o(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),n.currentConstruct=void 0,r}}const CM={resolveAll:Xk()},TM=Qk("string"),MM=Qk("text");function Qk(e){return{resolveAll:Xk(e==="text"?EM:void 0),tokenize:n};function n(r){const s=this,o=this.parser.constructs[e],c=r.attempt(o,d,f);return d;function d(p){return h(p)?c(p):f(p)}function f(p){if(p===null){r.consume(p);return}return r.enter("data"),r.consume(p),m}function m(p){return h(p)?(r.exit("data"),c(p)):(r.consume(p),m)}function h(p){if(p===null)return!0;const y=o[p];let k=-1;if(y)for(;++k<y.length;){const w=y[k];if(!w.previous||w.previous.call(s,s.previous))return!0}return!1}}}function Xk(e){return n;function n(r,s){let o=-1,c;for(;++o<=r.length;)c===void 0?r[o]&&r[o][1].type==="data"&&(c=o,o++):(!r[o]||r[o][1].type!=="data")&&(o!==c+2&&(r[c][1].end=r[o-1][1].end,r.splice(c+2,o-c-2),o=c+2),c=void 0);return e?e(r,s):r}}function EM(e,n){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const s=e[r-1][1],o=n.sliceStream(s);let c=o.length,d=-1,f=0,m;for(;c--;){const h=o[c];if(typeof h=="string"){for(d=h.length;h.charCodeAt(d-1)===32;)f++,d--;if(d)break;d=-1}else if(h===-2)m=!0,f++;else if(h!==-1){c++;break}}if(n._contentTypeTextTrailing&&r===e.length&&(f=0),f){const h={type:r===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?d:s.start._bufferIndex+d,_index:s.start._index+c,line:s.end.line,column:s.end.column-f,offset:s.end.offset-f},end:{...s.end}};s.end={...h.start},s.start.offset===s.end.offset?Object.assign(s,h):(e.splice(r,0,["enter",h,n],["exit",h,n]),r+=2)}r++}return e}const AM={42:Zn,43:Zn,45:Zn,48:Zn,49:Zn,50:Zn,51:Zn,52:Zn,53:Zn,54:Zn,55:Zn,56:Zn,57:Zn,62:Fk},RM={91:OT},_M={[-2]:Rm,[-1]:Rm,32:Rm},IM={35:HT,42:Eu,45:[C1,Eu],60:VT,61:C1,95:Eu,96:j1,126:j1},LM={38:Vk,92:qk},OM={[-5]:_m,[-4]:_m,[-3]:_m,33:cM,38:Vk,42:Ch,60:[dT,ZT],91:dM,92:[$T,qk],93:Ep,95:Ch,96:jT},DM={null:[Ch,CM]},zM={null:[42,95]},UM={null:[]},$M=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:zM,contentInitial:RM,disable:UM,document:AM,flow:IM,flowInitial:_M,insideSpan:DM,string:LM,text:OM},Symbol.toStringTag,{value:"Module"}));function BM(e,n,r){let s={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const o={},c=[];let d=[],f=[];const m={attempt:$(D),check:$(L),consume:R,enter:I,exit:H,interrupt:$(L,{interrupt:!0})},h={code:null,containerState:{},defineSkip:T,events:[],now:S,parser:e,previous:null,sliceSerialize:k,sliceStream:w,write:y};let p=n.tokenize.call(h,m);return n.resolveAll&&c.push(n),h;function y(V){return d=za(d,V),M(),d[d.length-1]!==null?[]:(K(n,0),h.events=id(c,h.events,h),h.events)}function k(V,O){return PM(w(V),O)}function w(V){return HM(d,V)}function S(){const{_bufferIndex:V,_index:O,line:W,column:Z,offset:B}=s;return{_bufferIndex:V,_index:O,line:W,column:Z,offset:B}}function T(V){o[V.line]=V.column,U()}function M(){let V;for(;s._index<d.length;){const O=d[s._index];if(typeof O=="string")for(V=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===V&&s._bufferIndex<O.length;)E(O.charCodeAt(s._bufferIndex));else E(O)}}function E(V){p=p(V)}function R(V){Le(V)?(s.line++,s.column=1,s.offset+=V===-3?2:1,U()):V!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===d[s._index].length&&(s._bufferIndex=-1,s._index++)),h.previous=V}function I(V,O){const W=O||{};return W.type=V,W.start=S(),h.events.push(["enter",W,h]),f.push(W),W}function H(V){const O=f.pop();return O.end=S(),h.events.push(["exit",O,h]),O}function D(V,O){K(V,O.from)}function L(V,O){O.restore()}function $(V,O){return W;function W(Z,B,F){let P,ce,oe,A;return Array.isArray(Z)?z(Z):"tokenize"in Z?z([Z]):C(Z);function C(le){return he;function he(xe){const ne=xe!==null&&le[xe],pe=xe!==null&&le.null,be=[...Array.isArray(ne)?ne:ne?[ne]:[],...Array.isArray(pe)?pe:pe?[pe]:[]];return z(be)(xe)}}function z(le){return P=le,ce=0,le.length===0?F:N(le[ce])}function N(le){return he;function he(xe){return A=X(),oe=le,le.partial||(h.currentConstruct=le),le.name&&h.parser.constructs.disable.null.includes(le.name)?se():le.tokenize.call(O?Object.assign(Object.create(h),O):h,m,Q,se)(xe)}}function Q(le){return V(oe,A),B}function se(le){return A.restore(),++ce<P.length?N(P[ce]):F}}}function K(V,O){V.resolveAll&&!c.includes(V)&&c.push(V),V.resolve&&fa(h.events,O,h.events.length-O,V.resolve(h.events.slice(O),h)),V.resolveTo&&(h.events=V.resolveTo(h.events,h))}function X(){const V=S(),O=h.previous,W=h.currentConstruct,Z=h.events.length,B=Array.from(f);return{from:Z,restore:F};function F(){s=V,h.previous=O,h.currentConstruct=W,h.events.length=Z,f=B,U()}}function U(){s.line in o&&s.column<2&&(s.column=o[s.line],s.offset+=o[s.line]-1)}}function HM(e,n){const r=n.start._index,s=n.start._bufferIndex,o=n.end._index,c=n.end._bufferIndex;let d;if(r===o)d=[e[r].slice(s,c)];else{if(d=e.slice(r,o),s>-1){const f=d[0];typeof f=="string"?d[0]=f.slice(s):d.shift()}c>0&&d.push(e[o].slice(0,c))}return d}function PM(e,n){let r=-1;const s=[];let o;for(;++r<e.length;){const c=e[r];let d;if(typeof c=="string")d=c;else switch(c){case-5:{d="\r";break}case-4:{d=`
|
|
140
|
-
`;break}case-3:{d=`\r
|
|
141
|
-
`;break}case-2:{d=n?" ":" ";break}case-1:{if(!n&&o)continue;d=" ";break}default:d=String.fromCharCode(c)}o=c===-2,s.push(d)}return s.join("")}function FM(e){const s={constructs:Hk([$M,...(e||{}).extensions||[]]),content:o(rT),defined:[],document:o(lT),flow:o(jM),lazy:{},string:o(TM),text:o(MM)};return s;function o(c){return d;function d(f){return BM(s,c,f)}}}function qM(e){for(;!Gk(e););return e}const T1=/[\0\t\n\r]/g;function VM(){let e=1,n="",r=!0,s;return o;function o(c,d,f){const m=[];let h,p,y,k,w;for(c=n+(typeof c=="string"?c.toString():new TextDecoder(d||void 0).decode(c)),y=0,n="",r&&(c.charCodeAt(0)===65279&&y++,r=void 0);y<c.length;){if(T1.lastIndex=y,h=T1.exec(c),k=h&&h.index!==void 0?h.index:c.length,w=c.charCodeAt(k),!h){n=c.slice(y);break}if(w===10&&y===k&&s)m.push(-3),s=void 0;else switch(s&&(m.push(-5),s=void 0),y<k&&(m.push(c.slice(y,k)),e+=k-y),w){case 0:{m.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,m.push(-2);e++<p;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:s=!0,e=1}y=k+1}return f&&(s&&m.push(-5),n&&m.push(n),m.push(null)),m}}const GM=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function WM(e){return e.replace(GM,KM)}function KM(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const o=r.charCodeAt(1),c=o===120||o===88;return Pk(r.slice(c?2:1),c?16:10)}return Mp(r)||e}const Zk={}.hasOwnProperty;function YM(e,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),QM(r)(qM(FM(r).document().write(VM()(e,n,!0))))}function QM(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(We),autolinkProtocol:X,autolinkEmail:X,atxHeading:c(Ye),blockQuote:c(pe),characterEscape:X,characterReference:X,codeFenced:c(be),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:c(be,d),codeText:c(Fe,d),codeTextData:X,data:X,codeFlowValue:X,definition:c(qe),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:c($e),hardBreakEscape:c(Et),hardBreakTrailing:c(Et),htmlFlow:c(kn,d),htmlFlowData:X,htmlText:c(kn,d),htmlTextData:X,image:c(je),label:d,link:c(We),listItem:c(yt),listItemValue:k,listOrdered:c(jt,y),listUnordered:c(jt),paragraph:c(Qt),reference:N,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:c(Ye),strong:c(wn),thematicBreak:c(ba)},exit:{atxHeading:m(),atxHeadingSequence:D,autolink:m(),autolinkEmail:ne,autolinkProtocol:xe,blockQuote:m(),characterEscapeValue:U,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:le,characterReference:he,codeFenced:m(M),codeFencedFence:T,codeFencedFenceInfo:w,codeFencedFenceMeta:S,codeFlowValue:U,codeIndented:m(E),codeText:m(B),codeTextData:U,data:U,definition:m(),definitionDestinationString:H,definitionLabelString:R,definitionTitleString:I,emphasis:m(),hardBreakEscape:m(O),hardBreakTrailing:m(O),htmlFlow:m(W),htmlFlowData:U,htmlText:m(Z),htmlTextData:U,image:m(P),label:oe,labelText:ce,lineEnding:V,link:m(F),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:Q,resourceDestinationString:A,resourceTitleString:C,resource:z,setextHeading:m(K),setextHeadingLineSequence:$,setextHeadingText:L,strong:m(),thematicBreak:m()}};Jk(n,(e||{}).mdastExtensions||[]);const r={};return s;function s(ue){let ye={type:"root",children:[]};const Ne={stack:[ye],tokenStack:[],config:n,enter:f,exit:h,buffer:d,resume:p,data:r},He=[];let De=-1;for(;++De<ue.length;)if(ue[De][1].type==="listOrdered"||ue[De][1].type==="listUnordered")if(ue[De][0]==="enter")He.push(De);else{const At=He.pop();De=o(ue,At,De)}for(De=-1;++De<ue.length;){const At=n[ue[De][0]];Zk.call(At,ue[De][1].type)&&At[ue[De][1].type].call(Object.assign({sliceSerialize:ue[De][2].sliceSerialize},Ne),ue[De][1])}if(Ne.tokenStack.length>0){const At=Ne.tokenStack[Ne.tokenStack.length-1];(At[1]||M1).call(Ne,void 0,At[0])}for(ye.position={start:bs(ue.length>0?ue[0][1].start:{line:1,column:1,offset:0}),end:bs(ue.length>0?ue[ue.length-2][1].end:{line:1,column:1,offset:0})},De=-1;++De<n.transforms.length;)ye=n.transforms[De](ye)||ye;return ye}function o(ue,ye,Ne){let He=ye-1,De=-1,At=!1,Rt,$t,Ke,Wt;for(;++He<=Ne;){const Ze=ue[He];switch(Ze[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ze[0]==="enter"?De++:De--,Wt=void 0;break}case"lineEndingBlank":{Ze[0]==="enter"&&(Rt&&!Wt&&!De&&!Ke&&(Ke=He),Wt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Wt=void 0}if(!De&&Ze[0]==="enter"&&Ze[1].type==="listItemPrefix"||De===-1&&Ze[0]==="exit"&&(Ze[1].type==="listUnordered"||Ze[1].type==="listOrdered")){if(Rt){let dn=He;for($t=void 0;dn--;){const lt=ue[dn];if(lt[1].type==="lineEnding"||lt[1].type==="lineEndingBlank"){if(lt[0]==="exit")continue;$t&&(ue[$t][1].type="lineEndingBlank",At=!0),lt[1].type="lineEnding",$t=dn}else if(!(lt[1].type==="linePrefix"||lt[1].type==="blockQuotePrefix"||lt[1].type==="blockQuotePrefixWhitespace"||lt[1].type==="blockQuoteMarker"||lt[1].type==="listItemIndent"))break}Ke&&(!$t||Ke<$t)&&(Rt._spread=!0),Rt.end=Object.assign({},$t?ue[$t][1].start:Ze[1].end),ue.splice($t||He,0,["exit",Rt,Ze[2]]),He++,Ne++}if(Ze[1].type==="listItemPrefix"){const dn={type:"listItem",_spread:!1,start:Object.assign({},Ze[1].start),end:void 0};Rt=dn,ue.splice(He,0,["enter",dn,Ze[2]]),He++,Ne++,Ke=void 0,Wt=!0}}}return ue[ye][1]._spread=At,Ne}function c(ue,ye){return Ne;function Ne(He){f.call(this,ue(He),He),ye&&ye.call(this,He)}}function d(){this.stack.push({type:"fragment",children:[]})}function f(ue,ye,Ne){this.stack[this.stack.length-1].children.push(ue),this.stack.push(ue),this.tokenStack.push([ye,Ne||void 0]),ue.position={start:bs(ye.start),end:void 0}}function m(ue){return ye;function ye(Ne){ue&&ue.call(this,Ne),h.call(this,Ne)}}function h(ue,ye){const Ne=this.stack.pop(),He=this.tokenStack.pop();if(He)He[0].type!==ue.type&&(ye?ye.call(this,ue,He[0]):(He[1]||M1).call(this,ue,He[0]));else throw new Error("Cannot close `"+ue.type+"` ("+po({start:ue.start,end:ue.end})+"): it’s not open");Ne.position.end=bs(ue.end)}function p(){return Tp(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function k(ue){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(ue),10),this.data.expectingFirstListItemValue=void 0}}function w(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=ue}function S(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=ue}function T(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function M(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue.replace(/(\r?\n|\r)$/g,"")}function R(ue){const ye=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=ye,Ne.identifier=Qa(this.sliceSerialize(ue)).toLowerCase()}function I(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ue}function H(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ue}function D(ue){const ye=this.stack[this.stack.length-1];if(!ye.depth){const Ne=this.sliceSerialize(ue).length;ye.depth=Ne}}function L(){this.data.setextHeadingSlurpLineEnding=!0}function $(ue){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(ue).codePointAt(0)===61?1:2}function K(){this.data.setextHeadingSlurpLineEnding=void 0}function X(ue){const Ne=this.stack[this.stack.length-1].children;let He=Ne[Ne.length-1];(!He||He.type!=="text")&&(He=Xe(),He.position={start:bs(ue.start),end:void 0},Ne.push(He)),this.stack.push(He)}function U(ue){const ye=this.stack.pop();ye.value+=this.sliceSerialize(ue),ye.position.end=bs(ue.end)}function V(ue){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ne=ye.children[ye.children.length-1];Ne.position.end=bs(ue.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(ye.type)&&(X.call(this,ue),U.call(this,ue))}function O(){this.data.atHardBreak=!0}function W(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue}function Z(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue}function B(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ue}function F(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=ye,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function P(){const ue=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ue.type+="Reference",ue.referenceType=ye,delete ue.url,delete ue.title}else delete ue.identifier,delete ue.label;this.data.referenceType=void 0}function ce(ue){const ye=this.sliceSerialize(ue),Ne=this.stack[this.stack.length-2];Ne.label=WM(ye),Ne.identifier=Qa(ye).toLowerCase()}function oe(){const ue=this.stack[this.stack.length-1],ye=this.resume(),Ne=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ne.type==="link"){const He=ue.children;Ne.children=He}else Ne.alt=ye}function A(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ue}function C(){const ue=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ue}function z(){this.data.inReference=void 0}function N(){this.data.referenceType="collapsed"}function Q(ue){const ye=this.resume(),Ne=this.stack[this.stack.length-1];Ne.label=ye,Ne.identifier=Qa(this.sliceSerialize(ue)).toLowerCase(),this.data.referenceType="full"}function se(ue){this.data.characterReferenceType=ue.type}function le(ue){const ye=this.sliceSerialize(ue),Ne=this.data.characterReferenceType;let He;Ne?(He=Pk(ye,Ne==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):He=Mp(ye);const De=this.stack[this.stack.length-1];De.value+=He}function he(ue){const ye=this.stack.pop();ye.position.end=bs(ue.end)}function xe(ue){U.call(this,ue);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(ue)}function ne(ue){U.call(this,ue);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(ue)}function pe(){return{type:"blockquote",children:[]}}function be(){return{type:"code",lang:null,meta:null,value:""}}function Fe(){return{type:"inlineCode",value:""}}function qe(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function $e(){return{type:"emphasis",children:[]}}function Ye(){return{type:"heading",depth:0,children:[]}}function Et(){return{type:"break"}}function kn(){return{type:"html",value:""}}function je(){return{type:"image",title:null,url:"",alt:null}}function We(){return{type:"link",title:null,url:"",children:[]}}function jt(ue){return{type:"list",ordered:ue.type==="listOrdered",start:null,spread:ue._spread,children:[]}}function yt(ue){return{type:"listItem",spread:ue._spread,checked:null,children:[]}}function Qt(){return{type:"paragraph",children:[]}}function wn(){return{type:"strong",children:[]}}function Xe(){return{type:"text",value:""}}function ba(){return{type:"thematicBreak"}}}function bs(e){return{line:e.line,column:e.column,offset:e.offset}}function Jk(e,n){let r=-1;for(;++r<n.length;){const s=n[r];Array.isArray(s)?Jk(e,s):XM(e,s)}}function XM(e,n){let r;for(r in n)if(Zk.call(n,r))switch(r){case"canContainEols":{const s=n[r];s&&e[r].push(...s);break}case"transforms":{const s=n[r];s&&e[r].push(...s);break}case"enter":case"exit":{const s=n[r];s&&Object.assign(e[r],s);break}}}function M1(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+po({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+po({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+po({start:n.start,end:n.end})+") is still open")}function ZM(e){const n=this;n.parser=r;function r(s){return YM(s,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function JM(e,n){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,r),e.applyData(n,r)}function eE(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
|
|
142
|
-
`}]}function tE(e,n){const r=n.value?n.value+`
|
|
143
|
-
`:"",s={},o=n.lang?n.lang.split(/\s+/):[];o.length>0&&(s.className=["language-"+o[0]]);let c={type:"element",tagName:"code",properties:s,children:[{type:"text",value:r}]};return n.meta&&(c.data={meta:n.meta}),e.patch(n,c),c=e.applyData(n,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(n,c),c}function nE(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function aE(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function rE(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(n.identifier).toUpperCase(),o=ni(s.toLowerCase()),c=e.footnoteOrder.indexOf(s);let d,f=e.footnoteCounts.get(s);f===void 0?(f=0,e.footnoteOrder.push(s),d=e.footnoteOrder.length):d=c+1,f+=1,e.footnoteCounts.set(s,f);const m={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+o,id:r+"fnref-"+o+(f>1?"-"+f:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(d)}]};e.patch(n,m);const h={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(n,h),e.applyData(n,h)}function sE(e,n){const r={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function lE(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function e2(e,n){const r=n.referenceType;let s="]";if(r==="collapsed"?s+="[]":r==="full"&&(s+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+s}];const o=e.all(n),c=o[0];c&&c.type==="text"?c.value="["+c.value:o.unshift({type:"text",value:"["});const d=o[o.length-1];return d&&d.type==="text"?d.value+=s:o.push({type:"text",value:s}),o}function iE(e,n){const r=String(n.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return e2(e,n);const o={src:ni(s.url||""),alt:n.alt};s.title!==null&&s.title!==void 0&&(o.title=s.title);const c={type:"element",tagName:"img",properties:o,children:[]};return e.patch(n,c),e.applyData(n,c)}function oE(e,n){const r={src:ni(n.url)};n.alt!==null&&n.alt!==void 0&&(r.alt=n.alt),n.title!==null&&n.title!==void 0&&(r.title=n.title);const s={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,s),e.applyData(n,s)}function cE(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const s={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,s),e.applyData(n,s)}function uE(e,n){const r=String(n.identifier).toUpperCase(),s=e.definitionById.get(r);if(!s)return e2(e,n);const o={href:ni(s.url||"")};s.title!==null&&s.title!==void 0&&(o.title=s.title);const c={type:"element",tagName:"a",properties:o,children:e.all(n)};return e.patch(n,c),e.applyData(n,c)}function dE(e,n){const r={href:ni(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const s={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,s),e.applyData(n,s)}function fE(e,n,r){const s=e.all(n),o=r?mE(r):t2(n),c={},d=[];if(typeof n.checked=="boolean"){const p=s[0];let y;p&&p.type==="element"&&p.tagName==="p"?y=p:(y={type:"element",tagName:"p",properties:{},children:[]},s.unshift(y)),y.children.length>0&&y.children.unshift({type:"text",value:" "}),y.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let f=-1;for(;++f<s.length;){const p=s[f];(o||f!==0||p.type!=="element"||p.tagName!=="p")&&d.push({type:"text",value:`
|
|
144
|
-
`}),p.type==="element"&&p.tagName==="p"&&!o?d.push(...p.children):d.push(p)}const m=s[s.length-1];m&&(o||m.type!=="element"||m.tagName!=="p")&&d.push({type:"text",value:`
|
|
145
|
-
`});const h={type:"element",tagName:"li",properties:c,children:d};return e.patch(n,h),e.applyData(n,h)}function mE(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const r=e.children;let s=-1;for(;!n&&++s<r.length;)n=t2(r[s])}return n}function t2(e){const n=e.spread;return n??e.children.length>1}function hE(e,n){const r={},s=e.all(n);let o=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++o<s.length;){const d=s[o];if(d.type==="element"&&d.tagName==="li"&&d.properties&&Array.isArray(d.properties.className)&&d.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const c={type:"element",tagName:n.ordered?"ol":"ul",properties:r,children:e.wrap(s,!0)};return e.patch(n,c),e.applyData(n,c)}function pE(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function gE(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function xE(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function yE(e,n){const r=e.all(n),s=r.shift(),o=[];if(s){const d={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(n.children[0],d),o.push(d)}if(r.length>0){const d={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},f=Sp(n.children[1]),m=Lk(n.children[n.children.length-1]);f&&m&&(d.position={start:f,end:m}),o.push(d)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(n,c),e.applyData(n,c)}function bE(e,n,r){const s=r?r.children:void 0,c=(s?s.indexOf(n):1)===0?"th":"td",d=r&&r.type==="table"?r.align:void 0,f=d?d.length:n.children.length;let m=-1;const h=[];for(;++m<f;){const y=n.children[m],k={},w=d?d[m]:void 0;w&&(k.align=w);let S={type:"element",tagName:c,properties:k,children:[]};y&&(S.children=e.all(y),e.patch(y,S),S=e.applyData(y,S)),h.push(S)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(n,p),e.applyData(n,p)}function vE(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const E1=9,A1=32;function kE(e){const n=String(e),r=/\r?\n|\r/g;let s=r.exec(n),o=0;const c=[];for(;s;)c.push(R1(n.slice(o,s.index),o>0,!0),s[0]),o=s.index+s[0].length,s=r.exec(n);return c.push(R1(n.slice(o),o>0,!1)),c.join("")}function R1(e,n,r){let s=0,o=e.length;if(n){let c=e.codePointAt(s);for(;c===E1||c===A1;)s++,c=e.codePointAt(s)}if(r){let c=e.codePointAt(o-1);for(;c===E1||c===A1;)o--,c=e.codePointAt(o-1)}return o>s?e.slice(s,o):""}function wE(e,n){const r={type:"text",value:kE(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function SE(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const jE={blockquote:JM,break:eE,code:tE,delete:nE,emphasis:aE,footnoteReference:rE,heading:sE,html:lE,imageReference:iE,image:oE,inlineCode:cE,linkReference:uE,link:dE,listItem:fE,list:hE,paragraph:pE,root:gE,strong:xE,table:yE,tableCell:vE,tableRow:bE,text:wE,thematicBreak:SE,toml:nu,yaml:nu,definition:nu,footnoteDefinition:nu};function nu(){}const n2=-1,od=0,xo=1,Bu=2,Ap=3,Rp=4,_p=5,Ip=6,a2=7,r2=8,NE=typeof self=="object"?self:globalThis,_1=(e,n)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new NE[e](n)},CE=(e,n)=>{const r=(o,c)=>(e.set(c,o),o),s=o=>{if(e.has(o))return e.get(o);const[c,d]=n[o];switch(c){case od:case n2:return r(d,o);case xo:{const f=r([],o);for(const m of d)f.push(s(m));return f}case Bu:{const f=r({},o);for(const[m,h]of d)f[s(m)]=s(h);return f}case Ap:return r(new Date(d),o);case Rp:{const{source:f,flags:m}=d;return r(new RegExp(f,m),o)}case _p:{const f=r(new Map,o);for(const[m,h]of d)f.set(s(m),s(h));return f}case Ip:{const f=r(new Set,o);for(const m of d)f.add(s(m));return f}case a2:{const{name:f,message:m}=d;return r(_1(f,m),o)}case r2:return r(BigInt(d),o);case"BigInt":return r(Object(BigInt(d)),o);case"ArrayBuffer":return r(new Uint8Array(d).buffer,d);case"DataView":{const{buffer:f}=new Uint8Array(d);return r(new DataView(f),d)}}return r(_1(c,d),o)};return s},I1=e=>CE(new Map,e)(0),Qs="",{toString:TE}={},{keys:ME}=Object,no=e=>{const n=typeof e;if(n!=="object"||!e)return[od,n];const r=TE.call(e).slice(8,-1);switch(r){case"Array":return[xo,Qs];case"Object":return[Bu,Qs];case"Date":return[Ap,Qs];case"RegExp":return[Rp,Qs];case"Map":return[_p,Qs];case"Set":return[Ip,Qs];case"DataView":return[xo,r]}return r.includes("Array")?[xo,r]:r.includes("Error")?[a2,r]:[Bu,r]},au=([e,n])=>e===od&&(n==="function"||n==="symbol"),EE=(e,n,r,s)=>{const o=(d,f)=>{const m=s.push(d)-1;return r.set(f,m),m},c=d=>{if(r.has(d))return r.get(d);let[f,m]=no(d);switch(f){case od:{let p=d;switch(m){case"bigint":f=r2,p=d.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);p=null;break;case"undefined":return o([n2],d)}return o([f,p],d)}case xo:{if(m){let k=d;return m==="DataView"?k=new Uint8Array(d.buffer):m==="ArrayBuffer"&&(k=new Uint8Array(d)),o([m,[...k]],d)}const p=[],y=o([f,p],d);for(const k of d)p.push(c(k));return y}case Bu:{if(m)switch(m){case"BigInt":return o([m,d.toString()],d);case"Boolean":case"Number":case"String":return o([m,d.valueOf()],d)}if(n&&"toJSON"in d)return c(d.toJSON());const p=[],y=o([f,p],d);for(const k of ME(d))(e||!au(no(d[k])))&&p.push([c(k),c(d[k])]);return y}case Ap:return o([f,isNaN(d.getTime())?Qs:d.toISOString()],d);case Rp:{const{source:p,flags:y}=d;return o([f,{source:p,flags:y}],d)}case _p:{const p=[],y=o([f,p],d);for(const[k,w]of d)(e||!(au(no(k))||au(no(w))))&&p.push([c(k),c(w)]);return y}case Ip:{const p=[],y=o([f,p],d);for(const k of d)(e||!au(no(k)))&&p.push(c(k));return y}}const{message:h}=d;return o([f,{name:m,message:h}],d)};return c},L1=(e,{json:n,lossy:r}={})=>{const s=[];return EE(!(n||r),!!n,new Map,s)(e),s},Hu=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?I1(L1(e,n)):structuredClone(e):(e,n)=>I1(L1(e,n));function AE(e,n){const r=[{type:"text",value:"↩"}];return n>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),r}function RE(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function _E(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||AE,s=e.options.footnoteBackLabel||RE,o=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",d=e.options.footnoteLabelProperties||{className:["sr-only"]},f=[];let m=-1;for(;++m<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[m]);if(!h)continue;const p=e.all(h),y=String(h.identifier).toUpperCase(),k=ni(y.toLowerCase());let w=0;const S=[],T=e.footnoteCounts.get(y);for(;T!==void 0&&++w<=T;){S.length>0&&S.push({type:"text",value:" "});let R=typeof r=="string"?r:r(m,w);typeof R=="string"&&(R={type:"text",value:R}),S.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+k+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(m,w),className:["data-footnote-backref"]},children:Array.isArray(R)?R:[R]})}const M=p[p.length-1];if(M&&M.type==="element"&&M.tagName==="p"){const R=M.children[M.children.length-1];R&&R.type==="text"?R.value+=" ":M.children.push({type:"text",value:" "}),M.children.push(...S)}else p.push(...S);const E={type:"element",tagName:"li",properties:{id:n+"fn-"+k},children:e.wrap(p,!0)};e.patch(h,E),f.push(E)}if(f.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...Hu(d),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
146
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
147
|
-
`}]}}const cd=(function(e){if(e==null)return DE;if(typeof e=="function")return ud(e);if(typeof e=="object")return Array.isArray(e)?IE(e):LE(e);if(typeof e=="string")return OE(e);throw new Error("Expected function, string, or object as test")});function IE(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=cd(e[r]);return ud(s);function s(...o){let c=-1;for(;++c<n.length;)if(n[c].apply(this,o))return!0;return!1}}function LE(e){const n=e;return ud(r);function r(s){const o=s;let c;for(c in e)if(o[c]!==n[c])return!1;return!0}}function OE(e){return ud(n);function n(r){return r&&r.type===e}}function ud(e){return n;function n(r,s,o){return!!(zE(r)&&e.call(this,r,typeof s=="number"?s:void 0,o||void 0))}}function DE(){return!0}function zE(e){return e!==null&&typeof e=="object"&&"type"in e}const s2=[],UE=!0,Th=!1,$E="skip";function l2(e,n,r,s){let o;typeof n=="function"&&typeof r!="function"?(s=r,r=n):o=n;const c=cd(o),d=s?-1:1;f(e,void 0,[])();function f(m,h,p){const y=m&&typeof m=="object"?m:{};if(typeof y.type=="string"){const w=typeof y.tagName=="string"?y.tagName:typeof y.name=="string"?y.name:void 0;Object.defineProperty(k,"name",{value:"node ("+(m.type+(w?"<"+w+">":""))+")"})}return k;function k(){let w=s2,S,T,M;if((!n||c(m,h,p[p.length-1]||void 0))&&(w=BE(r(m,p)),w[0]===Th))return w;if("children"in m&&m.children){const E=m;if(E.children&&w[0]!==$E)for(T=(s?E.children.length:-1)+d,M=p.concat(E);T>-1&&T<E.children.length;){const R=E.children[T];if(S=f(R,T,M)(),S[0]===Th)return S;T=typeof S[1]=="number"?S[1]:T+d}}return w}}}function BE(e){return Array.isArray(e)?e:typeof e=="number"?[UE,e]:e==null?s2:[e]}function Lp(e,n,r,s){let o,c,d;typeof n=="function"&&typeof r!="function"?(c=void 0,d=n,o=r):(c=n,d=r,o=s),l2(e,c,f,o);function f(m,h){const p=h[h.length-1],y=p?p.children.indexOf(m):void 0;return d(m,y,p)}}const Mh={}.hasOwnProperty,HE={};function PE(e,n){const r=n||HE,s=new Map,o=new Map,c=new Map,d={...jE,...r.handlers},f={all:h,applyData:qE,definitionById:s,footnoteById:o,footnoteCounts:c,footnoteOrder:[],handlers:d,one:m,options:r,patch:FE,wrap:GE};return Lp(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const y=p.type==="definition"?s:o,k=String(p.identifier).toUpperCase();y.has(k)||y.set(k,p)}}),f;function m(p,y){const k=p.type,w=f.handlers[k];if(Mh.call(f.handlers,k)&&w)return w(f,p,y);if(f.options.passThrough&&f.options.passThrough.includes(k)){if("children"in p){const{children:T,...M}=p,E=Hu(M);return E.children=f.all(p),E}return Hu(p)}return(f.options.unknownHandler||VE)(f,p,y)}function h(p){const y=[];if("children"in p){const k=p.children;let w=-1;for(;++w<k.length;){const S=f.one(k[w],p);if(S){if(w&&k[w-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=O1(S.value)),!Array.isArray(S)&&S.type==="element")){const T=S.children[0];T&&T.type==="text"&&(T.value=O1(T.value))}Array.isArray(S)?y.push(...S):y.push(S)}}}return y}}function FE(e,n){e.position&&(n.position=A3(e))}function qE(e,n){let r=n;if(e&&e.data){const s=e.data.hName,o=e.data.hChildren,c=e.data.hProperties;if(typeof s=="string")if(r.type==="element")r.tagName=s;else{const d="children"in r?r.children:[r];r={type:"element",tagName:s,properties:{},children:d}}r.type==="element"&&c&&Object.assign(r.properties,Hu(c)),"children"in r&&r.children&&o!==null&&o!==void 0&&(r.children=o)}return r}function VE(e,n){const r=n.data||{},s="value"in n&&!(Mh.call(r,"hProperties")||Mh.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,s),e.applyData(n,s)}function GE(e,n){const r=[];let s=-1;for(n&&r.push({type:"text",value:`
|
|
148
|
-
`});++s<e.length;)s&&r.push({type:"text",value:`
|
|
149
|
-
`}),r.push(e[s]);return n&&e.length>0&&r.push({type:"text",value:`
|
|
150
|
-
`}),r}function O1(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function D1(e,n){const r=PE(e,n),s=r.one(e,void 0),o=_E(r),c=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return o&&c.children.push({type:"text",value:`
|
|
151
|
-
`},o),c}function WE(e,n){return e&&"run"in e?async function(r,s){const o=D1(r,{file:s,...n});await e.run(o,s)}:function(r,s){return D1(r,{file:s,...e||n})}}function z1(e){if(e)throw e}var Im,U1;function KE(){if(U1)return Im;U1=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,s=Object.getOwnPropertyDescriptor,o=function(h){return typeof Array.isArray=="function"?Array.isArray(h):n.call(h)==="[object Array]"},c=function(h){if(!h||n.call(h)!=="[object Object]")return!1;var p=e.call(h,"constructor"),y=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!p&&!y)return!1;var k;for(k in h);return typeof k>"u"||e.call(h,k)},d=function(h,p){r&&p.name==="__proto__"?r(h,p.name,{enumerable:!0,configurable:!0,value:p.newValue,writable:!0}):h[p.name]=p.newValue},f=function(h,p){if(p==="__proto__")if(e.call(h,p)){if(s)return s(h,p).value}else return;return h[p]};return Im=function m(){var h,p,y,k,w,S,T=arguments[0],M=1,E=arguments.length,R=!1;for(typeof T=="boolean"&&(R=T,T=arguments[1]||{},M=2),(T==null||typeof T!="object"&&typeof T!="function")&&(T={});M<E;++M)if(h=arguments[M],h!=null)for(p in h)y=f(T,p),k=f(h,p),T!==k&&(R&&k&&(c(k)||(w=o(k)))?(w?(w=!1,S=y&&o(y)?y:[]):S=y&&c(y)?y:{},d(T,{name:p,newValue:m(R,S,k)})):typeof k<"u"&&d(T,{name:p,newValue:k}));return T},Im}var YE=KE();const Lm=dv(YE);function Eh(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function QE(){const e=[],n={run:r,use:s};return n;function r(...o){let c=-1;const d=o.pop();if(typeof d!="function")throw new TypeError("Expected function as last argument, not "+d);f(null,...o);function f(m,...h){const p=e[++c];let y=-1;if(m){d(m);return}for(;++y<o.length;)(h[y]===null||h[y]===void 0)&&(h[y]=o[y]);o=h,p?XE(p,f)(...h):d(null,...h)}}function s(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),n}}function XE(e,n){let r;return s;function s(...d){const f=e.length>d.length;let m;f&&d.push(o);try{m=e.apply(this,d)}catch(h){const p=h;if(f&&r)throw p;return o(p)}f||(m&&m.then&&typeof m.then=="function"?m.then(c,o):m instanceof Error?o(m):c(m))}function o(d,...f){r||(r=!0,n(d,...f))}function c(d){o(null,d)}}const ur={basename:ZE,dirname:JE,extname:eA,join:tA,sep:"/"};function ZE(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');Uo(e);let r=0,s=-1,o=e.length,c;if(n===void 0||n.length===0||n.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(c){r=o+1;break}}else s<0&&(c=!0,s=o+1);return s<0?"":e.slice(r,s)}if(n===e)return"";let d=-1,f=n.length-1;for(;o--;)if(e.codePointAt(o)===47){if(c){r=o+1;break}}else d<0&&(c=!0,d=o+1),f>-1&&(e.codePointAt(o)===n.codePointAt(f--)?f<0&&(s=o):(f=-1,s=d));return r===s?s=d:s<0&&(s=e.length),e.slice(r,s)}function JE(e){if(Uo(e),e.length===0)return".";let n=-1,r=e.length,s;for(;--r;)if(e.codePointAt(r)===47){if(s){n=r;break}}else s||(s=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function eA(e){Uo(e);let n=e.length,r=-1,s=0,o=-1,c=0,d;for(;n--;){const f=e.codePointAt(n);if(f===47){if(d){s=n+1;break}continue}r<0&&(d=!0,r=n+1),f===46?o<0?o=n:c!==1&&(c=1):o>-1&&(c=-1)}return o<0||r<0||c===0||c===1&&o===r-1&&o===s+1?"":e.slice(o,r)}function tA(...e){let n=-1,r;for(;++n<e.length;)Uo(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":nA(r)}function nA(e){Uo(e);const n=e.codePointAt(0)===47;let r=aA(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function aA(e,n){let r="",s=0,o=-1,c=0,d=-1,f,m;for(;++d<=e.length;){if(d<e.length)f=e.codePointAt(d);else{if(f===47)break;f=47}if(f===47){if(!(o===d-1||c===1))if(o!==d-1&&c===2){if(r.length<2||s!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(m=r.lastIndexOf("/"),m!==r.length-1){m<0?(r="",s=0):(r=r.slice(0,m),s=r.length-1-r.lastIndexOf("/")),o=d,c=0;continue}}else if(r.length>0){r="",s=0,o=d,c=0;continue}}n&&(r=r.length>0?r+"/..":"..",s=2)}else r.length>0?r+="/"+e.slice(o+1,d):r=e.slice(o+1,d),s=d-o-1;o=d,c=0}else f===46&&c>-1?c++:c=-1}return r}function Uo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const rA={cwd:sA};function sA(){return"/"}function Ah(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function lA(e){if(typeof e=="string")e=new URL(e);else if(!Ah(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return iA(e)}function iA(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const n=e.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const s=n.codePointAt(r+2);if(s===70||s===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(n)}const Om=["history","path","basename","stem","extname","dirname"];class i2{constructor(n){let r;n?Ah(n)?r={path:n}:typeof n=="string"||oA(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":rA.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Om.length;){const c=Om[s];c in r&&r[c]!==void 0&&r[c]!==null&&(this[c]=c==="history"?[...r[c]]:r[c])}let o;for(o in r)Om.includes(o)||(this[o]=r[o])}get basename(){return typeof this.path=="string"?ur.basename(this.path):void 0}set basename(n){zm(n,"basename"),Dm(n,"basename"),this.path=ur.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?ur.dirname(this.path):void 0}set dirname(n){$1(this.basename,"dirname"),this.path=ur.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?ur.extname(this.path):void 0}set extname(n){if(Dm(n,"extname"),$1(this.dirname,"extname"),n){if(n.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ur.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){Ah(n)&&(n=lA(n)),zm(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?ur.basename(this.path,this.extname):void 0}set stem(n){zm(n,"stem"),Dm(n,"stem"),this.path=ur.join(this.dirname||"",n+(this.extname||""))}fail(n,r,s){const o=this.message(n,r,s);throw o.fatal=!0,o}info(n,r,s){const o=this.message(n,r,s);return o.fatal=void 0,o}message(n,r,s){const o=new On(n,r,s);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function Dm(e,n){if(e&&e.includes(ur.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+ur.sep+"`")}function zm(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function $1(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function oA(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const cA=(function(e){const s=this.constructor.prototype,o=s[e],c=function(){return o.apply(c,arguments)};return Object.setPrototypeOf(c,s),c}),uA={}.hasOwnProperty;class Op extends cA{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=QE()}copy(){const n=new Op;let r=-1;for(;++r<this.attachers.length;){const s=this.attachers[r];n.use(...s)}return n.data(Lm(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?(Bm("data",this.frozen),this.namespace[n]=r,this):uA.call(this.namespace,n)&&this.namespace[n]||void 0:n?(Bm("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const o=r.call(n,...s);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const r=ru(n),s=this.parser||this.Parser;return Um("parse",s),s(String(r),r)}process(n,r){const s=this;return this.freeze(),Um("process",this.parser||this.Parser),$m("process",this.compiler||this.Compiler),r?o(void 0,r):new Promise(o);function o(c,d){const f=ru(n),m=s.parse(f);s.run(m,f,function(p,y,k){if(p||!y||!k)return h(p);const w=y,S=s.stringify(w,k);mA(S)?k.value=S:k.result=S,h(p,k)});function h(p,y){p||!y?d(p):c?c(y):r(void 0,y)}}}processSync(n){let r=!1,s;return this.freeze(),Um("processSync",this.parser||this.Parser),$m("processSync",this.compiler||this.Compiler),this.process(n,o),H1("processSync","process",r),s;function o(c,d){r=!0,z1(c),s=d}}run(n,r,s){B1(n),this.freeze();const o=this.transformers;return!s&&typeof r=="function"&&(s=r,r=void 0),s?c(void 0,s):new Promise(c);function c(d,f){const m=ru(r);o.run(n,m,h);function h(p,y,k){const w=y||n;p?f(p):d?d(w):s(void 0,w,k)}}}runSync(n,r){let s=!1,o;return this.run(n,r,c),H1("runSync","run",s),o;function c(d,f){z1(d),o=f,s=!0}}stringify(n,r){this.freeze();const s=ru(r),o=this.compiler||this.Compiler;return $m("stringify",o),B1(n),o(n,s)}use(n,...r){const s=this.attachers,o=this.namespace;if(Bm("use",this.frozen),n!=null)if(typeof n=="function")m(n,r);else if(typeof n=="object")Array.isArray(n)?f(n):d(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function c(h){if(typeof h=="function")m(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[p,...y]=h;m(p,y)}else d(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function d(h){if(!("plugins"in h)&&!("settings"in h))throw new 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");f(h.plugins),h.settings&&(o.settings=Lm(!0,o.settings,h.settings))}function f(h){let p=-1;if(h!=null)if(Array.isArray(h))for(;++p<h.length;){const y=h[p];c(y)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function m(h,p){let y=-1,k=-1;for(;++y<s.length;)if(s[y][0]===h){k=y;break}if(k===-1)s.push([h,...p]);else if(p.length>0){let[w,...S]=p;const T=s[k][1];Eh(T)&&Eh(w)&&(w=Lm(!0,T,w)),s[k]=[h,w,...S]}}}}const dA=new Op().freeze();function Um(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function $m(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Bm(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function B1(e){if(!Eh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function H1(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function ru(e){return fA(e)?e:new i2(e)}function fA(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function mA(e){return typeof e=="string"||hA(e)}function hA(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const pA="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",P1=[],F1={allowDangerousHtml:!0},gA=/^(https?|ircs?|mailto|xmpp)$/i,xA=[{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 $o(e){const n=yA(e),r=bA(e);return vA(n.runSync(n.parse(r),r),e)}function yA(e){const n=e.rehypePlugins||P1,r=e.remarkPlugins||P1,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...F1}:F1;return dA().use(ZM).use(r).use(WE,s).use(n)}function bA(e){const n=e.children||"",r=new i2;return typeof n=="string"&&(r.value=n),r}function vA(e,n){const r=n.allowedElements,s=n.allowElement,o=n.components,c=n.disallowedElements,d=n.skipHtml,f=n.unwrapDisallowed,m=n.urlTransform||kA;for(const p of xA)Object.hasOwn(n,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+pA+p.id,void 0);return Lp(e,h),O3(e,{Fragment:l.Fragment,components:o,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function h(p,y,k){if(p.type==="raw"&&k&&typeof y=="number")return d?k.children.splice(y,1):k.children[y]={type:"text",value:p.value},y;if(p.type==="element"){let w;for(w in Am)if(Object.hasOwn(Am,w)&&Object.hasOwn(p.properties,w)){const S=p.properties[w],T=Am[w];(T===null||T.includes(p.tagName))&&(p.properties[w]=m(String(S||""),w,p))}}if(p.type==="element"){let w=r?!r.includes(p.tagName):c?c.includes(p.tagName):!1;if(!w&&s&&typeof y=="number"&&(w=!s(p,y,k)),w&&k&&typeof y=="number")return f&&p.children?k.children.splice(y,1,...p.children):k.children.splice(y,1),y}}}function kA(e){const n=e.indexOf(":"),r=e.indexOf("?"),s=e.indexOf("#"),o=e.indexOf("/");return n===-1||o!==-1&&n>o||r!==-1&&n>r||s!==-1&&n>s||gA.test(e.slice(0,n))?e:""}function q1(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let s=0,o=r.indexOf(n);for(;o!==-1;)s++,o=r.indexOf(n,o+n.length);return s}function wA(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function SA(e,n,r){const o=cd((r||{}).ignore||[]),c=jA(n);let d=-1;for(;++d<c.length;)l2(e,"text",f);function f(h,p){let y=-1,k;for(;++y<p.length;){const w=p[y],S=k?k.children:void 0;if(o(w,S?S.indexOf(w):void 0,k))return;k=w}if(k)return m(h,p)}function m(h,p){const y=p[p.length-1],k=c[d][0],w=c[d][1];let S=0;const M=y.children.indexOf(h);let E=!1,R=[];k.lastIndex=0;let I=k.exec(h.value);for(;I;){const H=I.index,D={index:I.index,input:I.input,stack:[...p,h]};let L=w(...I,D);if(typeof L=="string"&&(L=L.length>0?{type:"text",value:L}:void 0),L===!1?k.lastIndex=H+1:(S!==H&&R.push({type:"text",value:h.value.slice(S,H)}),Array.isArray(L)?R.push(...L):L&&R.push(L),S=H+I[0].length,E=!0),!k.global)break;I=k.exec(h.value)}return E?(S<h.value.length&&R.push({type:"text",value:h.value.slice(S)}),y.children.splice(M,1,...R)):R=[h],M+R.length}}function jA(e){const n=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<r.length;){const o=r[s];n.push([NA(o[0]),CA(o[1])])}return n}function NA(e){return typeof e=="string"?new RegExp(wA(e),"g"):e}function CA(e){return typeof e=="function"?e:function(){return e}}const Hm="phrasing",Pm=["autolink","link","image","label"];function TA(){return{transforms:[LA],enter:{literalAutolink:EA,literalAutolinkEmail:Fm,literalAutolinkHttp:Fm,literalAutolinkWww:Fm},exit:{literalAutolink:IA,literalAutolinkEmail:_A,literalAutolinkHttp:AA,literalAutolinkWww:RA}}}function MA(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Hm,notInConstruct:Pm},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Hm,notInConstruct:Pm},{character:":",before:"[ps]",after:"\\/",inConstruct:Hm,notInConstruct:Pm}]}}function EA(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Fm(e){this.config.enter.autolinkProtocol.call(this,e)}function AA(e){this.config.exit.autolinkProtocol.call(this,e)}function RA(e){this.config.exit.data.call(this,e);const n=this.stack[this.stack.length-1];n.type,n.url="http://"+this.sliceSerialize(e)}function _A(e){this.config.exit.autolinkEmail.call(this,e)}function IA(e){this.exit(e)}function LA(e){SA(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,OA],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),DA]],{ignore:["link","linkReference"]})}function OA(e,n,r,s,o){let c="";if(!o2(o)||(/^w/i.test(n)&&(r=n+r,n="",c="http://"),!zA(r)))return!1;const d=UA(r+s);if(!d[0])return!1;const f={type:"link",title:null,url:c+n+d[0],children:[{type:"text",value:n+d[0]}]};return d[1]?[f,{type:"text",value:d[1]}]:f}function DA(e,n,r,s){return!o2(s,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function zA(e){const n=e.split(".");return!(n.length<2||n[n.length-1]&&(/_/.test(n[n.length-1])||!/[a-zA-Z\d]/.test(n[n.length-1]))||n[n.length-2]&&(/_/.test(n[n.length-2])||!/[a-zA-Z\d]/.test(n[n.length-2])))}function UA(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],s=r.indexOf(")");const o=q1(e,"(");let c=q1(e,")");for(;s!==-1&&o>c;)e+=r.slice(0,s+1),r=r.slice(s+1),s=r.indexOf(")"),c++;return[e,r]}function o2(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||rl(r)||ld(r))&&(!n||r!==47)}c2.peek=WA;function $A(){this.buffer()}function BA(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function HA(){this.buffer()}function PA(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function FA(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Qa(this.sliceSerialize(e)).toLowerCase(),r.label=n}function qA(e){this.exit(e)}function VA(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Qa(this.sliceSerialize(e)).toLowerCase(),r.label=n}function GA(e){this.exit(e)}function WA(){return"["}function c2(e,n,r,s){const o=r.createTracker(s);let c=o.move("[^");const d=r.enter("footnoteReference"),f=r.enter("reference");return c+=o.move(r.safe(r.associationId(e),{after:"]",before:c})),f(),d(),c+=o.move("]"),c}function KA(){return{enter:{gfmFootnoteCallString:$A,gfmFootnoteCall:BA,gfmFootnoteDefinitionLabelString:HA,gfmFootnoteDefinition:PA},exit:{gfmFootnoteCallString:FA,gfmFootnoteCall:qA,gfmFootnoteDefinitionLabelString:VA,gfmFootnoteDefinition:GA}}}function YA(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:c2},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(s,o,c,d){const f=c.createTracker(d);let m=f.move("[^");const h=c.enter("footnoteDefinition"),p=c.enter("label");return m+=f.move(c.safe(c.associationId(s),{before:m,after:"]"})),p(),m+=f.move("]:"),s.children&&s.children.length>0&&(f.shift(4),m+=f.move((n?`
|
|
152
|
-
`:" ")+c.indentLines(c.containerFlow(s,f.current()),n?u2:QA))),h(),m}}function QA(e,n,r){return n===0?e:u2(e,n,r)}function u2(e,n,r){return(r?"":" ")+e}const XA=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];d2.peek=n6;function ZA(){return{canContainEols:["delete"],enter:{strikethrough:e6},exit:{strikethrough:t6}}}function JA(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:XA}],handlers:{delete:d2}}}function e6(e){this.enter({type:"delete",children:[]},e)}function t6(e){this.exit(e)}function d2(e,n,r,s){const o=r.createTracker(s),c=r.enter("strikethrough");let d=o.move("~~");return d+=r.containerPhrasing(e,{...o.current(),before:d,after:"~"}),d+=o.move("~~"),c(),d}function n6(){return"~"}function a6(e){return e.length}function r6(e,n){const r=n||{},s=(r.align||[]).concat(),o=r.stringLength||a6,c=[],d=[],f=[],m=[];let h=0,p=-1;for(;++p<e.length;){const T=[],M=[];let E=-1;for(e[p].length>h&&(h=e[p].length);++E<e[p].length;){const R=s6(e[p][E]);if(r.alignDelimiters!==!1){const I=o(R);M[E]=I,(m[E]===void 0||I>m[E])&&(m[E]=I)}T.push(R)}d[p]=T,f[p]=M}let y=-1;if(typeof s=="object"&&"length"in s)for(;++y<h;)c[y]=V1(s[y]);else{const T=V1(s);for(;++y<h;)c[y]=T}y=-1;const k=[],w=[];for(;++y<h;){const T=c[y];let M="",E="";T===99?(M=":",E=":"):T===108?M=":":T===114&&(E=":");let R=r.alignDelimiters===!1?1:Math.max(1,m[y]-M.length-E.length);const I=M+"-".repeat(R)+E;r.alignDelimiters!==!1&&(R=M.length+R+E.length,R>m[y]&&(m[y]=R),w[y]=R),k[y]=I}d.splice(1,0,k),f.splice(1,0,w),p=-1;const S=[];for(;++p<d.length;){const T=d[p],M=f[p];y=-1;const E=[];for(;++y<h;){const R=T[y]||"";let I="",H="";if(r.alignDelimiters!==!1){const D=m[y]-(M[y]||0),L=c[y];L===114?I=" ".repeat(D):L===99?D%2?(I=" ".repeat(D/2+.5),H=" ".repeat(D/2-.5)):(I=" ".repeat(D/2),H=I):H=" ".repeat(D)}r.delimiterStart!==!1&&!y&&E.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&R==="")&&(r.delimiterStart!==!1||y)&&E.push(" "),r.alignDelimiters!==!1&&E.push(I),E.push(R),r.alignDelimiters!==!1&&E.push(H),r.padding!==!1&&E.push(" "),(r.delimiterEnd!==!1||y!==h-1)&&E.push("|")}S.push(r.delimiterEnd===!1?E.join("").replace(/ +$/,""):E.join(""))}return S.join(`
|
|
153
|
-
`)}function s6(e){return e==null?"":String(e)}function V1(e){const n=typeof e=="string"?e.codePointAt(0):0;return n===67||n===99?99:n===76||n===108?108:n===82||n===114?114:0}function l6(e,n,r,s){const o=r.enter("blockquote"),c=r.createTracker(s);c.move("> "),c.shift(2);const d=r.indentLines(r.containerFlow(e,c.current()),i6);return o(),d}function i6(e,n,r){return">"+(r?"":" ")+e}function o6(e,n){return G1(e,n.inConstruct,!0)&&!G1(e,n.notInConstruct,!1)}function G1(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let s=-1;for(;++s<n.length;)if(e.includes(n[s]))return!0;return!1}function W1(e,n,r,s){let o=-1;for(;++o<r.unsafe.length;)if(r.unsafe[o].character===`
|
|
154
|
-
`&&o6(r.stack,r.unsafe[o]))return/[ \t]/.test(s.before)?"":" ";return`\\
|
|
155
|
-
`}function c6(e,n){const r=String(e);let s=r.indexOf(n),o=s,c=0,d=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===o?++c>d&&(d=c):c=1,o=s+n.length,s=r.indexOf(n,o);return d}function u6(e,n){return!!(n.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function d6(e){const n=e.options.fence||"`";if(n!=="`"&&n!=="~")throw new Error("Cannot serialize code with `"+n+"` for `options.fence`, expected `` ` `` or `~`");return n}function f6(e,n,r,s){const o=d6(r),c=e.value||"",d=o==="`"?"GraveAccent":"Tilde";if(u6(e,r)){const y=r.enter("codeIndented"),k=r.indentLines(c,m6);return y(),k}const f=r.createTracker(s),m=o.repeat(Math.max(c6(c,o)+1,3)),h=r.enter("codeFenced");let p=f.move(m);if(e.lang){const y=r.enter(`codeFencedLang${d}`);p+=f.move(r.safe(e.lang,{before:p,after:" ",encode:["`"],...f.current()})),y()}if(e.lang&&e.meta){const y=r.enter(`codeFencedMeta${d}`);p+=f.move(" "),p+=f.move(r.safe(e.meta,{before:p,after:`
|
|
156
|
-
`,encode:["`"],...f.current()})),y()}return p+=f.move(`
|
|
157
|
-
`),c&&(p+=f.move(c+`
|
|
158
|
-
`)),p+=f.move(m),h(),p}function m6(e,n,r){return(r?"":" ")+e}function Dp(e){const n=e.options.quote||'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize title with `"+n+"` for `options.quote`, expected `\"`, or `'`");return n}function h6(e,n,r,s){const o=Dp(r),c=o==='"'?"Quote":"Apostrophe",d=r.enter("definition");let f=r.enter("label");const m=r.createTracker(s);let h=m.move("[");return h+=m.move(r.safe(r.associationId(e),{before:h,after:"]",...m.current()})),h+=m.move("]: "),f(),!e.url||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(r.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=r.enter("destinationRaw"),h+=m.move(r.safe(e.url,{before:h,after:e.title?" ":`
|
|
159
|
-
`,...m.current()}))),f(),e.title&&(f=r.enter(`title${c}`),h+=m.move(" "+o),h+=m.move(r.safe(e.title,{before:h,after:o,...m.current()})),h+=m.move(o),f()),d(),h}function p6(e){const n=e.options.emphasis||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize emphasis with `"+n+"` for `options.emphasis`, expected `*`, or `_`");return n}function To(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Pu(e,n,r){const s=Ql(e),o=Ql(n);return s===void 0?o===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}f2.peek=g6;function f2(e,n,r,s){const o=p6(r),c=r.enter("emphasis"),d=r.createTracker(s),f=d.move(o);let m=d.move(r.containerPhrasing(e,{after:o,before:f,...d.current()}));const h=m.charCodeAt(0),p=Pu(s.before.charCodeAt(s.before.length-1),h,o);p.inside&&(m=To(h)+m.slice(1));const y=m.charCodeAt(m.length-1),k=Pu(s.after.charCodeAt(0),y,o);k.inside&&(m=m.slice(0,-1)+To(y));const w=d.move(o);return c(),r.attentionEncodeSurroundingInfo={after:k.outside,before:p.outside},f+m+w}function g6(e,n,r){return r.options.emphasis||"*"}function x6(e,n){let r=!1;return Lp(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return r=!0,Th}),!!((!e.depth||e.depth<3)&&Tp(e)&&(n.options.setext||r))}function y6(e,n,r,s){const o=Math.max(Math.min(6,e.depth||1),1),c=r.createTracker(s);if(x6(e,r)){const p=r.enter("headingSetext"),y=r.enter("phrasing"),k=r.containerPhrasing(e,{...c.current(),before:`
|
|
160
|
-
`,after:`
|
|
161
|
-
`});return y(),p(),k+`
|
|
162
|
-
`+(o===1?"=":"-").repeat(k.length-(Math.max(k.lastIndexOf("\r"),k.lastIndexOf(`
|
|
163
|
-
`))+1))}const d="#".repeat(o),f=r.enter("headingAtx"),m=r.enter("phrasing");c.move(d+" ");let h=r.containerPhrasing(e,{before:"# ",after:`
|
|
164
|
-
`,...c.current()});return/^[\t ]/.test(h)&&(h=To(h.charCodeAt(0))+h.slice(1)),h=h?d+" "+h:d,r.options.closeAtx&&(h+=" "+d),m(),f(),h}m2.peek=b6;function m2(e){return e.value||""}function b6(){return"<"}h2.peek=v6;function h2(e,n,r,s){const o=Dp(r),c=o==='"'?"Quote":"Apostrophe",d=r.enter("image");let f=r.enter("label");const m=r.createTracker(s);let h=m.move("![");return h+=m.move(r.safe(e.alt,{before:h,after:"]",...m.current()})),h+=m.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=r.enter("destinationLiteral"),h+=m.move("<"),h+=m.move(r.safe(e.url,{before:h,after:">",...m.current()})),h+=m.move(">")):(f=r.enter("destinationRaw"),h+=m.move(r.safe(e.url,{before:h,after:e.title?" ":")",...m.current()}))),f(),e.title&&(f=r.enter(`title${c}`),h+=m.move(" "+o),h+=m.move(r.safe(e.title,{before:h,after:o,...m.current()})),h+=m.move(o),f()),h+=m.move(")"),d(),h}function v6(){return"!"}p2.peek=k6;function p2(e,n,r,s){const o=e.referenceType,c=r.enter("imageReference");let d=r.enter("label");const f=r.createTracker(s);let m=f.move("![");const h=r.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),d();const p=r.stack;r.stack=[],d=r.enter("reference");const y=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return d(),r.stack=p,c(),o==="full"||!h||h!==y?m+=f.move(y+"]"):o==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function k6(){return"!"}g2.peek=w6;function g2(e,n,r){let s=e.value||"",o="`",c=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(s);)o+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++c<r.unsafe.length;){const d=r.unsafe[c],f=r.compilePattern(d);let m;if(d.atBreak)for(;m=f.exec(s);){let h=m.index;s.charCodeAt(h)===10&&s.charCodeAt(h-1)===13&&h--,s=s.slice(0,h)+" "+s.slice(m.index+1)}}return o+s+o}function w6(){return"`"}function x2(e,n){const r=Tp(e);return!!(!n.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}y2.peek=S6;function y2(e,n,r,s){const o=Dp(r),c=o==='"'?"Quote":"Apostrophe",d=r.createTracker(s);let f,m;if(x2(e,r)){const p=r.stack;r.stack=[],f=r.enter("autolink");let y=d.move("<");return y+=d.move(r.containerPhrasing(e,{before:y,after:">",...d.current()})),y+=d.move(">"),f(),r.stack=p,y}f=r.enter("link"),m=r.enter("label");let h=d.move("[");return h+=d.move(r.containerPhrasing(e,{before:h,after:"](",...d.current()})),h+=d.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=r.enter("destinationLiteral"),h+=d.move("<"),h+=d.move(r.safe(e.url,{before:h,after:">",...d.current()})),h+=d.move(">")):(m=r.enter("destinationRaw"),h+=d.move(r.safe(e.url,{before:h,after:e.title?" ":")",...d.current()}))),m(),e.title&&(m=r.enter(`title${c}`),h+=d.move(" "+o),h+=d.move(r.safe(e.title,{before:h,after:o,...d.current()})),h+=d.move(o),m()),h+=d.move(")"),f(),h}function S6(e,n,r){return x2(e,r)?"<":"["}b2.peek=j6;function b2(e,n,r,s){const o=e.referenceType,c=r.enter("linkReference");let d=r.enter("label");const f=r.createTracker(s);let m=f.move("[");const h=r.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),d();const p=r.stack;r.stack=[],d=r.enter("reference");const y=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return d(),r.stack=p,c(),o==="full"||!h||h!==y?m+=f.move(y+"]"):o==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function j6(){return"["}function zp(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function N6(e){const n=zp(e),r=e.options.bulletOther;if(!r)return n==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+r+"`) to be different");return r}function C6(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function v2(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function T6(e,n,r,s){const o=r.enter("list"),c=r.bulletCurrent;let d=e.ordered?C6(r):zp(r);const f=e.ordered?d==="."?")":".":N6(r);let m=n&&r.bulletLastUsed?d===r.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((d==="*"||d==="-")&&p&&(!p.children||!p.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(m=!0),v2(r)===d&&p){let y=-1;for(;++y<e.children.length;){const k=e.children[y];if(k&&k.type==="listItem"&&k.children&&k.children[0]&&k.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(d=f),r.bulletCurrent=d;const h=r.containerFlow(e,s);return r.bulletLastUsed=d,r.bulletCurrent=c,o(),h}function M6(e){const n=e.options.listItemIndent||"one";if(n!=="tab"&&n!=="one"&&n!=="mixed")throw new Error("Cannot serialize items with `"+n+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return n}function E6(e,n,r,s){const o=M6(r);let c=r.bulletCurrent||zp(r);n&&n.type==="list"&&n.ordered&&(c=(typeof n.start=="number"&&n.start>-1?n.start:1)+(r.options.incrementListMarker===!1?0:n.children.indexOf(e))+c);let d=c.length+1;(o==="tab"||o==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(d=Math.ceil(d/4)*4);const f=r.createTracker(s);f.move(c+" ".repeat(d-c.length)),f.shift(d);const m=r.enter("listItem"),h=r.indentLines(r.containerFlow(e,f.current()),p);return m(),h;function p(y,k,w){return k?(w?"":" ".repeat(d))+y:(w?c:c+" ".repeat(d-c.length))+y}}function A6(e,n,r,s){const o=r.enter("paragraph"),c=r.enter("phrasing"),d=r.containerPhrasing(e,s);return c(),o(),d}const R6=cd(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function _6(e,n,r,s){return(e.children.some(function(d){return R6(d)})?r.containerPhrasing:r.containerFlow).call(r,e,s)}function I6(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}k2.peek=L6;function k2(e,n,r,s){const o=I6(r),c=r.enter("strong"),d=r.createTracker(s),f=d.move(o+o);let m=d.move(r.containerPhrasing(e,{after:o,before:f,...d.current()}));const h=m.charCodeAt(0),p=Pu(s.before.charCodeAt(s.before.length-1),h,o);p.inside&&(m=To(h)+m.slice(1));const y=m.charCodeAt(m.length-1),k=Pu(s.after.charCodeAt(0),y,o);k.inside&&(m=m.slice(0,-1)+To(y));const w=d.move(o+o);return c(),r.attentionEncodeSurroundingInfo={after:k.outside,before:p.outside},f+m+w}function L6(e,n,r){return r.options.strong||"*"}function O6(e,n,r,s){return r.safe(e.value,s)}function D6(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function z6(e,n,r){const s=(v2(r)+(r.options.ruleSpaces?" ":"")).repeat(D6(r));return r.options.ruleSpaces?s.slice(0,-1):s}const w2={blockquote:l6,break:W1,code:f6,definition:h6,emphasis:f2,hardBreak:W1,heading:y6,html:m2,image:h2,imageReference:p2,inlineCode:g2,link:y2,linkReference:b2,list:T6,listItem:E6,paragraph:A6,root:_6,strong:k2,text:O6,thematicBreak:z6};function U6(){return{enter:{table:$6,tableData:K1,tableHeader:K1,tableRow:H6},exit:{codeText:P6,table:B6,tableData:qm,tableHeader:qm,tableRow:qm}}}function $6(e){const n=e._align;this.enter({type:"table",align:n.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function B6(e){this.exit(e),this.data.inTable=void 0}function H6(e){this.enter({type:"tableRow",children:[]},e)}function qm(e){this.exit(e)}function K1(e){this.enter({type:"tableCell",children:[]},e)}function P6(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,F6));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function F6(e,n){return n==="|"?n:e}function q6(e){const n=e||{},r=n.tableCellPadding,s=n.tablePipeAlign,o=n.stringLength,c=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
165
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:k,table:d,tableCell:m,tableRow:f}};function d(w,S,T,M){return h(p(w,T,M),w.align)}function f(w,S,T,M){const E=y(w,T,M),R=h([E]);return R.slice(0,R.indexOf(`
|
|
166
|
-
`))}function m(w,S,T,M){const E=T.enter("tableCell"),R=T.enter("phrasing"),I=T.containerPhrasing(w,{...M,before:c,after:c});return R(),E(),I}function h(w,S){return r6(w,{align:S,alignDelimiters:s,padding:r,stringLength:o})}function p(w,S,T){const M=w.children;let E=-1;const R=[],I=S.enter("table");for(;++E<M.length;)R[E]=y(M[E],S,T);return I(),R}function y(w,S,T){const M=w.children;let E=-1;const R=[],I=S.enter("tableRow");for(;++E<M.length;)R[E]=m(M[E],w,S,T);return I(),R}function k(w,S,T){let M=w2.inlineCode(w,S,T);return T.stack.includes("tableCell")&&(M=M.replace(/\|/g,"\\$&")),M}}function V6(){return{exit:{taskListCheckValueChecked:Y1,taskListCheckValueUnchecked:Y1,paragraph:W6}}}function G6(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:K6}}}function Y1(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function W6(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const s=r.children[0];if(s&&s.type==="text"){const o=n.children;let c=-1,d;for(;++c<o.length;){const f=o[c];if(f.type==="paragraph"){d=f;break}}d===r&&(s.value=s.value.slice(1),s.value.length===0?r.children.shift():r.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,r.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function K6(e,n,r,s){const o=e.children[0],c=typeof e.checked=="boolean"&&o&&o.type==="paragraph",d="["+(e.checked?"x":" ")+"] ",f=r.createTracker(s);c&&f.move(d);let m=w2.listItem(e,n,r,{...s,...f.current()});return c&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(p){return p+d}}function Y6(){return[TA(),KA(),ZA(),U6(),V6()]}function Q6(e){return{extensions:[MA(),YA(e),JA(),q6(e),G6()]}}const X6={tokenize:aR,partial:!0},S2={tokenize:rR,partial:!0},j2={tokenize:sR,partial:!0},N2={tokenize:lR,partial:!0},Z6={tokenize:iR,partial:!0},C2={name:"wwwAutolink",tokenize:tR,previous:M2},T2={name:"protocolAutolink",tokenize:nR,previous:E2},Hr={name:"emailAutolink",tokenize:eR,previous:A2},gr={};function J6(){return{text:gr}}let Ks=48;for(;Ks<123;)gr[Ks]=Hr,Ks++,Ks===58?Ks=65:Ks===91&&(Ks=97);gr[43]=Hr;gr[45]=Hr;gr[46]=Hr;gr[95]=Hr;gr[72]=[Hr,T2];gr[104]=[Hr,T2];gr[87]=[Hr,C2];gr[119]=[Hr,C2];function eR(e,n,r){const s=this;let o,c;return d;function d(y){return!Rh(y)||!A2.call(s,s.previous)||Up(s.events)?r(y):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(y))}function f(y){return Rh(y)?(e.consume(y),f):y===64?(e.consume(y),m):r(y)}function m(y){return y===46?e.check(Z6,p,h)(y):y===45||y===95||In(y)?(c=!0,e.consume(y),m):p(y)}function h(y){return e.consume(y),o=!0,m}function p(y){return c&&o&&$n(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(y)):r(y)}}function tR(e,n,r){const s=this;return o;function o(d){return d!==87&&d!==119||!M2.call(s,s.previous)||Up(s.events)?r(d):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(X6,e.attempt(S2,e.attempt(j2,c),r),r)(d))}function c(d){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(d)}}function nR(e,n,r){const s=this;let o="",c=!1;return d;function d(y){return(y===72||y===104)&&E2.call(s,s.previous)&&!Up(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(y),e.consume(y),f):r(y)}function f(y){if($n(y)&&o.length<5)return o+=String.fromCodePoint(y),e.consume(y),f;if(y===58){const k=o.toLowerCase();if(k==="http"||k==="https")return e.consume(y),m}return r(y)}function m(y){return y===47?(e.consume(y),c?h:(c=!0,m)):r(y)}function h(y){return y===null||$u(y)||zt(y)||rl(y)||ld(y)?r(y):e.attempt(S2,e.attempt(j2,p),r)(y)}function p(y){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(y)}}function aR(e,n,r){let s=0;return o;function o(d){return(d===87||d===119)&&s<3?(s++,e.consume(d),o):d===46&&s===3?(e.consume(d),c):r(d)}function c(d){return d===null?r(d):n(d)}}function rR(e,n,r){let s,o,c;return d;function d(h){return h===46||h===95?e.check(N2,m,f)(h):h===null||zt(h)||rl(h)||h!==45&&ld(h)?m(h):(c=!0,e.consume(h),d)}function f(h){return h===95?s=!0:(o=s,s=void 0),e.consume(h),d}function m(h){return o||s||!c?r(h):n(h)}}function sR(e,n){let r=0,s=0;return o;function o(d){return d===40?(r++,e.consume(d),o):d===41&&s<r?c(d):d===33||d===34||d===38||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===60||d===63||d===93||d===95||d===126?e.check(N2,n,c)(d):d===null||zt(d)||rl(d)?n(d):(e.consume(d),o)}function c(d){return d===41&&s++,e.consume(d),o}}function lR(e,n,r){return s;function s(f){return f===33||f===34||f===39||f===41||f===42||f===44||f===46||f===58||f===59||f===63||f===95||f===126?(e.consume(f),s):f===38?(e.consume(f),c):f===93?(e.consume(f),o):f===60||f===null||zt(f)||rl(f)?n(f):r(f)}function o(f){return f===null||f===40||f===91||zt(f)||rl(f)?n(f):s(f)}function c(f){return $n(f)?d(f):r(f)}function d(f){return f===59?(e.consume(f),s):$n(f)?(e.consume(f),d):r(f)}}function iR(e,n,r){return s;function s(c){return e.consume(c),o}function o(c){return In(c)?r(c):n(c)}}function M2(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||zt(e)}function E2(e){return!$n(e)}function A2(e){return!(e===47||Rh(e))}function Rh(e){return e===43||e===45||e===46||e===95||In(e)}function Up(e){let n=e.length,r=!1;for(;n--;){const s=e[n][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){r=!0;break}if(s._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const oR={tokenize:gR,partial:!0};function cR(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:mR,continuation:{tokenize:hR},exit:pR}},text:{91:{name:"gfmFootnoteCall",tokenize:fR},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:uR,resolveTo:dR}}}}function uR(e,n,r){const s=this;let o=s.events.length;const c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let d;for(;o--;){const m=s.events[o][1];if(m.type==="labelImage"){d=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return f;function f(m){if(!d||!d._balanced)return r(m);const h=Qa(s.sliceSerialize({start:d.end,end:s.now()}));return h.codePointAt(0)!==94||!c.includes(h.slice(1))?r(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),n(m))}}function dR(e,n){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},f=[e[r+1],e[r+2],["enter",s,n],e[r+3],e[r+4],["enter",o,n],["exit",o,n],["enter",c,n],["enter",d,n],["exit",d,n],["exit",c,n],e[e.length-2],e[e.length-1],["exit",s,n]];return e.splice(r,e.length-r+1,...f),e}function fR(e,n,r){const s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c=0,d;return f;function f(y){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),m}function m(y){return y!==94?r(y):(e.enter("gfmFootnoteCallMarker"),e.consume(y),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(y){if(c>999||y===93&&!d||y===null||y===91||zt(y))return r(y);if(y===93){e.exit("chunkString");const k=e.exit("gfmFootnoteCallString");return o.includes(Qa(s.sliceSerialize(k)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(y)}return zt(y)||(d=!0),c++,e.consume(y),y===92?p:h}function p(y){return y===91||y===92||y===93?(e.consume(y),c++,h):h(y)}}function mR(e,n,r){const s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c,d=0,f;return m;function m(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):r(S)}function p(S){if(d>999||S===93&&!f||S===null||S===91||zt(S))return r(S);if(S===93){e.exit("chunkString");const T=e.exit("gfmFootnoteDefinitionLabelString");return c=Qa(s.sliceSerialize(T)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),k}return zt(S)||(f=!0),d++,e.consume(S),S===92?y:p}function y(S){return S===91||S===92||S===93?(e.consume(S),d++,p):p(S)}function k(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),o.includes(c)||o.push(c),ut(e,w,"gfmFootnoteDefinitionWhitespace")):r(S)}function w(S){return n(S)}}function hR(e,n,r){return e.check(zo,n,e.attempt(oR,n,r))}function pR(e){e.exit("gfmFootnoteDefinition")}function gR(e,n,r){const s=this;return ut(e,o,"gfmFootnoteDefinitionIndent",5);function o(c){const d=s.events[s.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?n(c):r(c)}}function xR(e){let r=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:c,resolveAll:o};return r==null&&(r=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function o(d,f){let m=-1;for(;++m<d.length;)if(d[m][0]==="enter"&&d[m][1].type==="strikethroughSequenceTemporary"&&d[m][1]._close){let h=m;for(;h--;)if(d[h][0]==="exit"&&d[h][1].type==="strikethroughSequenceTemporary"&&d[h][1]._open&&d[m][1].end.offset-d[m][1].start.offset===d[h][1].end.offset-d[h][1].start.offset){d[m][1].type="strikethroughSequence",d[h][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},d[h][1].start),end:Object.assign({},d[m][1].end)},y={type:"strikethroughText",start:Object.assign({},d[h][1].end),end:Object.assign({},d[m][1].start)},k=[["enter",p,f],["enter",d[h][1],f],["exit",d[h][1],f],["enter",y,f]],w=f.parser.constructs.insideSpan.null;w&&fa(k,k.length,0,id(w,d.slice(h+1,m),f)),fa(k,k.length,0,[["exit",y,f],["enter",d[m][1],f],["exit",d[m][1],f],["exit",p,f]]),fa(d,h-1,m-h+3,k),m=h+k.length-2;break}}for(m=-1;++m<d.length;)d[m][1].type==="strikethroughSequenceTemporary"&&(d[m][1].type="data");return d}function c(d,f,m){const h=this.previous,p=this.events;let y=0;return k;function k(S){return h===126&&p[p.length-1][1].type!=="characterEscape"?m(S):(d.enter("strikethroughSequenceTemporary"),w(S))}function w(S){const T=Ql(h);if(S===126)return y>1?m(S):(d.consume(S),y++,w);if(y<2&&!r)return m(S);const M=d.exit("strikethroughSequenceTemporary"),E=Ql(S);return M._open=!E||E===2&&!!T,M._close=!T||T===2&&!!E,f(S)}}}class yR{constructor(){this.map=[]}add(n,r,s){bR(this,n,r,s)}consume(n){if(this.map.sort(function(c,d){return c[0]-d[0]}),this.map.length===0)return;let r=this.map.length;const s=[];for(;r>0;)r-=1,s.push(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];s.push(n.slice()),n.length=0;let o=s.pop();for(;o;){for(const c of o)n.push(c);o=s.pop()}this.map.length=0}}function bR(e,n,r,s){let o=0;if(!(r===0&&s.length===0)){for(;o<e.map.length;){if(e.map[o][0]===n){e.map[o][1]+=r,e.map[o][2].push(...s);return}o+=1}e.map.push([n,r,s])}}function vR(e,n){let r=!1;const s=[];for(;n<e.length;){const o=e[n];if(r){if(o[0]==="enter")o[1].type==="tableContent"&&s.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const c=s.length-1;s[c]=s[c]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(r=!0);n+=1}return s}function kR(){return{flow:{null:{name:"table",tokenize:wR,resolveAll:SR}}}}function wR(e,n,r){const s=this;let o=0,c=0,d;return f;function f(U){let V=s.events.length-1;for(;V>-1;){const Z=s.events[V][1].type;if(Z==="lineEnding"||Z==="linePrefix")V--;else break}const O=V>-1?s.events[V][1].type:null,W=O==="tableHead"||O==="tableRow"?L:m;return W===L&&s.parser.lazy[s.now().line]?r(U):W(U)}function m(U){return e.enter("tableHead"),e.enter("tableRow"),h(U)}function h(U){return U===124||(d=!0,c+=1),p(U)}function p(U){return U===null?r(U):Le(U)?c>1?(c=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),w):r(U):nt(U)?ut(e,p,"whitespace")(U):(c+=1,d&&(d=!1,o+=1),U===124?(e.enter("tableCellDivider"),e.consume(U),e.exit("tableCellDivider"),d=!0,p):(e.enter("data"),y(U)))}function y(U){return U===null||U===124||zt(U)?(e.exit("data"),p(U)):(e.consume(U),U===92?k:y)}function k(U){return U===92||U===124?(e.consume(U),y):y(U)}function w(U){return s.interrupt=!1,s.parser.lazy[s.now().line]?r(U):(e.enter("tableDelimiterRow"),d=!1,nt(U)?ut(e,S,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):S(U))}function S(U){return U===45||U===58?M(U):U===124?(d=!0,e.enter("tableCellDivider"),e.consume(U),e.exit("tableCellDivider"),T):D(U)}function T(U){return nt(U)?ut(e,M,"whitespace")(U):M(U)}function M(U){return U===58?(c+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume(U),e.exit("tableDelimiterMarker"),E):U===45?(c+=1,E(U)):U===null||Le(U)?H(U):D(U)}function E(U){return U===45?(e.enter("tableDelimiterFiller"),R(U)):D(U)}function R(U){return U===45?(e.consume(U),R):U===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(U),e.exit("tableDelimiterMarker"),I):(e.exit("tableDelimiterFiller"),I(U))}function I(U){return nt(U)?ut(e,H,"whitespace")(U):H(U)}function H(U){return U===124?S(U):U===null||Le(U)?!d||o!==c?D(U):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(U)):D(U)}function D(U){return r(U)}function L(U){return e.enter("tableRow"),$(U)}function $(U){return U===124?(e.enter("tableCellDivider"),e.consume(U),e.exit("tableCellDivider"),$):U===null||Le(U)?(e.exit("tableRow"),n(U)):nt(U)?ut(e,$,"whitespace")(U):(e.enter("data"),K(U))}function K(U){return U===null||U===124||zt(U)?(e.exit("data"),$(U)):(e.consume(U),U===92?X:K)}function X(U){return U===92||U===124?(e.consume(U),K):K(U)}}function SR(e,n){let r=-1,s=!0,o=0,c=[0,0,0,0],d=[0,0,0,0],f=!1,m=0,h,p,y;const k=new yR;for(;++r<e.length;){const w=e[r],S=w[1];w[0]==="enter"?S.type==="tableHead"?(f=!1,m!==0&&(Q1(k,n,m,h,p),p=void 0,m=0),h={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},k.add(r,0,[["enter",h,n]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(s=!0,y=void 0,c=[0,0,0,0],d=[0,r+1,0,0],f&&(f=!1,p={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},k.add(r,0,[["enter",p,n]])),o=S.type==="tableDelimiterRow"?2:p?3:1):o&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(s=!1,d[2]===0&&(c[1]!==0&&(d[0]=d[1],y=su(k,n,c,o,void 0,y),c=[0,0,0,0]),d[2]=r)):S.type==="tableCellDivider"&&(s?s=!1:(c[1]!==0&&(d[0]=d[1],y=su(k,n,c,o,void 0,y)),c=d,d=[c[1],r,0,0])):S.type==="tableHead"?(f=!0,m=r):S.type==="tableRow"||S.type==="tableDelimiterRow"?(m=r,c[1]!==0?(d[0]=d[1],y=su(k,n,c,o,r,y)):d[1]!==0&&(y=su(k,n,d,o,r,y)),o=0):o&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(d[3]=r)}for(m!==0&&Q1(k,n,m,h,p),k.consume(n.events),r=-1;++r<n.events.length;){const w=n.events[r];w[0]==="enter"&&w[1].type==="table"&&(w[1]._align=vR(n.events,r))}return e}function su(e,n,r,s,o,c){const d=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(c.end=Object.assign({},Hl(n.events,r[0])),e.add(r[0],0,[["exit",c,n]]));const m=Hl(n.events,r[1]);if(c={type:d,start:Object.assign({},m),end:Object.assign({},m)},e.add(r[1],0,[["enter",c,n]]),r[2]!==0){const h=Hl(n.events,r[2]),p=Hl(n.events,r[3]),y={type:f,start:Object.assign({},h),end:Object.assign({},p)};if(e.add(r[2],0,[["enter",y,n]]),s!==2){const k=n.events[r[2]],w=n.events[r[3]];if(k[1].end=Object.assign({},w[1].end),k[1].type="chunkText",k[1].contentType="text",r[3]>r[2]+1){const S=r[2]+1,T=r[3]-r[2]-1;e.add(S,T,[])}}e.add(r[3]+1,0,[["exit",y,n]])}return o!==void 0&&(c.end=Object.assign({},Hl(n.events,o)),e.add(o,0,[["exit",c,n]]),c=void 0),c}function Q1(e,n,r,s,o){const c=[],d=Hl(n.events,r);o&&(o.end=Object.assign({},d),c.push(["exit",o,n])),s.end=Object.assign({},d),c.push(["exit",s,n]),e.add(r+1,0,c)}function Hl(e,n){const r=e[n],s=r[0]==="enter"?"start":"end";return r[1][s]}const jR={name:"tasklistCheck",tokenize:CR};function NR(){return{text:{91:jR}}}function CR(e,n,r){const s=this;return o;function o(m){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?r(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),c)}function c(m){return zt(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),d):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),d):r(m)}function d(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),f):r(m)}function f(m){return Le(m)?n(m):nt(m)?e.check({tokenize:TR},n,r)(m):r(m)}}function TR(e,n,r){return ut(e,s,"whitespace");function s(o){return o===null?r(o):n(o)}}function MR(e){return Hk([J6(),cR(),xR(e),kR(),NR()])}const ER={};function Bo(e){const n=this,r=e||ER,s=n.data(),o=s.micromarkExtensions||(s.micromarkExtensions=[]),c=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),d=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);o.push(MR(r)),c.push(Y6()),d.push(Q6(r))}const AR="modulepreload",RR=function(e){return"/"+e},X1={},_R=function(n,r,s){let o=Promise.resolve();if(r&&r.length>0){let m=function(h){return Promise.all(h.map(p=>Promise.resolve(p).then(y=>({status:"fulfilled",value:y}),y=>({status:"rejected",reason:y}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),f=d?.nonce||d?.getAttribute("nonce");o=m(r.map(h=>{if(h=RR(h),h in X1)return;X1[h]=!0;const p=h.endsWith(".css"),y=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${y}`))return;const k=document.createElement("link");if(k.rel=p?"stylesheet":AR,p||(k.as="script"),k.crossOrigin="",k.href=h,f&&k.setAttribute("nonce",f),document.head.appendChild(k),p)return new Promise((w,S)=>{k.addEventListener("load",w),k.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${h}`)))})}))}function c(d){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=d,window.dispatchEvent(f),!f.defaultPrevented)throw d}return o.then(d=>{for(const f of d||[])f.status==="rejected"&&c(f.reason);return n().catch(c)})},IR=1500;function LR({code:e}){const[n,r]=v.useState(!1),s=()=>{navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),IR)};return l.jsx("button",{type:"button",title:n?g.common.copied:g.chat.copyCode,"aria-label":g.chat.copyCode,onClick:s,className:"rounded p-0.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:l.jsx(Ue,{d:n?un.check:un.copy})})}function $p({language:e,code:n,highlight:r=!0}){const[s,o]=v.useState(null);return v.useEffect(()=>{if(!r){o(null);return}let c=!0;return _R(()=>import("./index-BgHHHLga.js"),[]).then(d=>d.codeToHtml(n,{lang:e||"text",themes:{light:"github-light",dark:"github-dark"}})).then(d=>{c&&o(d)}).catch(()=>{c&&o(null)}),()=>{c=!1}},[n,e,r]),l.jsxs("div",{className:"code-block my-2 overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800",children:[l.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 bg-gray-50 px-3 py-1 dark:border-gray-800 dark:bg-gray-900",children:[l.jsx("span",{className:"font-mono text-xs lowercase text-gray-500 dark:text-gray-400",children:e||"text"}),l.jsx(LR,{code:n})]}),l.jsx("div",{className:"overflow-x-auto bg-white text-[13px] leading-relaxed dark:bg-gray-950",children:s?l.jsx("div",{dangerouslySetInnerHTML:{__html:s}}):l.jsx("pre",{className:"m-0 px-3 py-2.5 font-mono text-gray-800 dark:text-gray-200",children:l.jsx("code",{children:n})})})]})}function OR(e){return typeof e=="string"?e:Array.isArray(e)?e.filter(n=>typeof n=="string").join(""):""}function R2({children:e,streaming:n}){if(v.isValidElement(e)){const r=e.props,s=/language-([\w+-]+)/.exec(r.className??"")?.[1]??"";return l.jsx($p,{language:s,code:OR(r.children).replace(/\n$/,""),highlight:!n})}return l.jsx("pre",{children:e})}function _2({node:e,children:n,...r}){return l.jsx("a",{...r,target:"_blank",rel:"noreferrer",children:n})}const DR={pre:e=>l.jsx(R2,{streaming:!0,children:e.children}),a:_2},zR={pre:e=>l.jsx(R2,{streaming:!1,children:e.children}),a:_2},I2=v.memo(function({text:n,streaming:r=!1}){return l.jsx($o,{remarkPlugins:[Bo],components:r?DR:zR,children:n})});function $r({src:e,alt:n,className:r}){const[s,o]=v.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsx("button",{type:"button",className:"block cursor-zoom-in",onClick:()=>o(!0),children:l.jsx("img",{src:e,alt:n,className:r})}),s&&l.jsx(UR,{src:e,alt:n,onClose:()=>o(!1)})]})}function UR({src:e,alt:n,onClose:r}){return v.useEffect(()=>{const s=o=>{o.key==="Escape"&&r()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[r]),ei.createPortal(l.jsx("div",{className:"anim-fade fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-10",onMouseDown:s=>{s.target===s.currentTarget&&r()},children:l.jsxs("div",{className:"anim-pop relative",children:[l.jsx("button",{type:"button","aria-label":g.common.close,onClick:r,className:"absolute right-2 top-2 flex h-7 w-7 items-center justify-center rounded-full bg-black/50 text-white transition-colors duration-150 hover:bg-black/70",children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",children:l.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})}),l.jsx("img",{src:e,alt:n,className:"max-h-[85vh] max-w-[88vw] rounded-lg border border-gray-200 bg-white dark:border-gray-700 dark:bg-gray-900"})]})}),document.body)}const $R=new Set(["txt","md","json","js","mjs","cjs","ts","tsx","jsx","py","sh","bash","yaml","yml","toml","css","html","htm","csv","log","xml","ini","conf","rs","go","java","c","h","cpp","hpp","sql","rb","php","png","jpg","jpeg","gif","webp","svg","pdf","doc","docx","xls","xlsx","ppt","pptx","zip","tar","gz","mp4","mp3","wav"]),BR=/^[a-z][a-z0-9+.-]*:\/\//i;function HR(e){const n=e.trim();if(n.length===0||n.length>200||/\s/.test(n)||BR.test(n)||n.startsWith("www."))return!1;const r=/\.([A-Za-z0-9]{1,8})$/.exec(n);if(!r)return!1;const s=r[1].toLowerCase();return/^\d+$/.test(s)?!1:$R.has(s)}const PR=512;function FR(e,n){const r=e.trim();if(r.length===0||r.length>PR||r.startsWith("~"))return null;const s=n!==null&&n.length>0?n:null,o=s!==null&&(s.includes("\\")||/^[A-Za-z]:/.test(s)),c=y=>{if(!o)return y;const k=y.replaceAll("\\","/");return/^[A-Za-z]:/.test(k)?k[0].toLowerCase()+k.slice(1):k},d=c(r),f=s===null?null:c(s),m=d.startsWith("/")||o&&/^[a-z]:/.test(d);let h=d;if(m){if(f===null||!d.startsWith(`${f}/`))return null;h=d.slice(f.length+1)}const p=[];for(const y of h.split("/"))if(!(y===""||y===".")){if(y===".."){if(p.length===0)return null;p.pop();continue}p.push(y)}return p.length>0?p.join("/"):null}const Z1=3;function qR(e){const n=[],r=new Set;for(const s of e.matchAll(/`([^`\n]+)`/g)){const o=s[1].trim();!HR(o)||r.has(o)||(r.add(o),n.push(o))}return n}function VR({path:e}){const n=e.lastIndexOf("/"),r=n>=0?e.slice(0,n+1):"",s=n>=0?e.slice(n+1):e;return l.jsxs("span",{className:"flex min-w-0 items-baseline font-mono text-sm",children:[r&&l.jsx("span",{className:"min-w-0 shrink-[9999] truncate text-gray-400 dark:text-gray-500",children:r}),l.jsx("span",{className:"min-w-0 truncate font-semibold text-gray-800 dark:text-gray-100",children:s})]})}function J1({text:e,workspace:n,statFiles:r,onOpenFile:s}){const o=v.useMemo(()=>{const y=[],k=new Set;for(const w of qR(e)){const S=FR(w,n);S===null||k.has(S)||(k.add(S),y.push(S))}return y},[e,n]),[c,d]=v.useState(null);v.useEffect(()=>{if(d(null),o.length===0)return;let y=!1;return r(o).then(k=>{y||d(o.filter(w=>k.has(w)))}).catch(()=>{}),()=>{y=!0}},[o,r]);const[f,m]=v.useState(!1);if(c===null||c.length===0)return null;const h=f?c:c.slice(0,Z1),p=c.length-h.length;return l.jsxs("div",{className:"anim-msg my-3 overflow-hidden rounded-xl border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[l.jsxs("div",{className:"flex items-center gap-2 border-b border-gray-100 bg-gray-50 px-3 py-2 dark:border-gray-800/60 dark:bg-gray-800/40",children:[l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":!0,className:"shrink-0 text-gray-400",children:l.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:g.chat.filesInMessage(c.length)})]}),l.jsxs("div",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:[h.map(y=>l.jsxs("button",{type:"button",title:y,onClick:()=>s(y),className:"group flex w-full cursor-pointer items-center gap-2 px-3 py-2 text-left transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":!0,className:"shrink-0 text-gray-400",children:l.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})}),l.jsx(VR,{path:y}),l.jsx("span",{className:"min-w-0 flex-1"}),l.jsx("span",{"aria-hidden":!0,className:"shrink-0 text-xs text-gray-400 transition-colors duration-150 group-hover:text-gray-600 dark:text-gray-500 dark:group-hover:text-gray-300",children:g.chat.openPreview})]},y)),(p>0||f)&&c.length>Z1&&l.jsxs("button",{type:"button",onClick:()=>m(y=>!y),className:"flex w-full items-center gap-1.5 px-3 py-2 text-left text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-50 dark:text-gray-400 dark:hover:bg-gray-800/50",children:[f?g.chat.showLess:g.chat.showMoreFiles(p),l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:`transition-transform duration-200 ${f?"rotate-180":""}`,children:l.jsx("path",{d:"m6 9 6 6 6-6"})})]})]})]})}const GR={waiting:"M6 3h12M6 21h12M8 3v3.5L12 10l4-3.5V3M8 21v-3.5L12 14l4 3.5V21",done:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm-3.5-9.2 2.4 2.5 4.6-4.8",failed:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM9 9l6 6m0-6-6 6"},eb={running:"text-emerald-500 dark:text-emerald-400",waiting:"text-amber-500 dark:text-amber-400",done:"text-gray-400 dark:text-gray-500",failed:"text-red-500 dark:text-red-400"};function Ho({state:e,size:n=13,label:r}){return e==="running"?l.jsx("span",{...r?{title:r,"aria-label":r,role:"status"}:{"aria-hidden":!0},style:{width:n,height:n},className:`inline-block shrink-0 animate-spin rounded-full border-[1.5px] border-current border-t-transparent ${eb.running}`}):l.jsxs("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",...r?{role:"img","aria-label":r}:{"aria-hidden":!0},className:`block shrink-0 ${eb[e]}`,children:[r&&l.jsx("title",{children:r}),l.jsx("path",{d:GR[e]})]})}function Mo({sinceMs:e,offsetMs:n=0}){const[r,s]=v.useState(()=>Date.now());return v.useEffect(()=>{const o=setInterval(()=>s(Date.now()),1e3);return()=>clearInterval(o)},[]),e===void 0?l.jsx("span",{className:"animate-pulse",children:"…"}):l.jsx(l.Fragment,{children:ak(Math.max(0,n)+Math.max(0,r-e))})}function WR({item:e}){const[n,r]=v.useState(!1),s=v.useRef(null),o=e.stopReason!==void 0&&e.stopReason!=="completed",c=e.streaming?"running":o?"failed":"done",d=e.streaming?g.chat.workRunning:o?e.stopReason:g.chat.workDone;return l.jsxs("div",{ref:s,children:[l.jsxs("button",{type:"button",onClick:()=>{const f=n;r(m=>!m),f&&requestAnimationFrame(()=>s.current?.scrollIntoView({block:"nearest"}))},"aria-expanded":n,className:"sticky top-4 z-[4] flex w-full items-center gap-2 bg-white px-3 py-1.5 text-left transition-colors duration-150 hover:bg-gray-50 dark:bg-gray-900 dark:hover:bg-gray-800",children:[l.jsx(Ho,{state:c,label:d}),l.jsx("span",{className:"shrink-0 text-xs text-gray-500 dark:text-gray-400",children:g.chat.thinking}),l.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-500 dark:text-gray-400",children:e.streaming?l.jsx(Mo,{sinceMs:e.startedAtMs}):e.durationMs!==void 0?vn(e.durationMs):null}),o&&l.jsxs("span",{className:"font-mono text-xs text-gray-400",children:["[",e.stopReason,"]"]}),l.jsx("span",{className:"min-w-0 flex-1"}),l.jsx(Ln,{open:n,className:"text-gray-400"})]}),n&&l.jsx("div",{className:"md-body anim-fade mx-3 mb-2 rounded-md bg-gray-50 px-3 py-2 text-sm leading-relaxed text-gray-600 dark:bg-gray-900/60 dark:text-gray-400",children:l.jsx(I2,{text:e.thinking,streaming:e.streaming})})]})}function KR({onDecide:e}){const[n,r]=v.useState(!1),s=async o=>{r(!0);try{await e(o)}finally{r(!1)}};return l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Se,{size:"sm",variant:"primary",disabled:n,onClick:()=>{s("allow")},children:g.chat.approve}),l.jsx(Se,{size:"sm",disabled:n,onClick:()=>{s("deny")},children:g.chat.deny})]})}function L2(e){for(let n=e.length-1;n>=0;n--){const r=e[n].kind;if(r==="user_text"||r==="user_image")return n}return 0}function YR(e){let n=0;for(const r of e)(r.kind==="user_text"||r.kind==="user_image")&&(n+=1);return n}function O2(e,n){try{const r=JSON.parse(e);if(r!==null&&typeof r=="object"){const s=r[n];if(typeof s=="string"&&s.length>0)return s}}catch{}return null}function D2(e){return O2(e,"agent_id")}function QR(e){return O2(e,"description")}function XR(e,n,r){return z2(e.items.slice(L2(e.items)),n,{running:r})}function ZR(e,n,r,s){const o=e.items,c=o.findIndex(m=>m.kind==="tool_call"&&m.subagentSessionId===s||m.kind==="subagent"&&m.sessionId===s);if(c===-1)return null;let d=0;for(let m=c;m>=0;m--){const h=o[m].kind;if(h==="user_text"||h==="user_image"){d=m;break}}let f=o.length;for(let m=c+1;m<o.length;m++){const h=o[m].kind;if(h==="user_text"||h==="user_image"){f=m;break}}return z2(o.slice(d,f),n,{running:f===o.length&&r})}function z2(e,n,r){const s=[{sessionId:n,agentId:null,description:null,running:r.running,depth:0,origin:[],parentId:null}],o=new Set([n]),c=(f,m,h,p,y,k,w)=>{if(o.has(f))return;o.add(f);const S=[...y,f],T=m.firstTsMs??m.firstSeenLocalMs,M=m.firstTsMs!==void 0&&m.lastActivityTsMs!==void 0?Math.max(0,m.lastActivityTsMs-m.firstTsMs):m.firstSeenLocalMs!==void 0&&m.lastActivityLocalMs!==void 0?Math.max(0,m.lastActivityLocalMs-m.firstSeenLocalMs):void 0;s.push({sessionId:f,agentId:m.meta?.agentId??k,description:w,running:h,depth:S.length,origin:S,parentId:p,...T!==void 0?{startedMs:T}:{},...M!==void 0?{elapsedMs:M}:{}}),d(m.items,f,S)},d=(f,m,h)=>{for(const p of f)p.kind==="tool_call"&&p.subagent&&p.subagentSessionId?c(p.subagentSessionId,p.subagent,!p.outputComplete,m,h,D2(p.argumentsText),QR(p.argumentsText)):p.kind==="subagent"&&c(p.sessionId,p.model,!1,m,h,null,null)};return d(e,n,[]),s}function JR(e){const n=e.items;for(let r=L2(n);r<n.length;r++){const s=n[r];if(s.kind==="tool_call"&&s.subagent!==void 0||s.kind==="subagent")return!0}return!1}function e8(e,n){if(n.length===0)return null;let r=e;for(const s of n){const o=r.subagents.get(s);if(!o)return null;r=o}return r}const Au=200,fo=46,Vm=32,tb=10,lu=6;function t8(e){const n=new Map;for(const p of e){if(p.parentId===null)continue;const y=n.get(p.parentId);y?y.push(p):n.set(p.parentId,[p])}const r=new Map;let s=0;const o=p=>{const y=n.get(p.sessionId)??[];let k;if(y.length===0)k=s++;else{const w=y.map(o);k=(w[0]+w[w.length-1])/2}return r.set(p.sessionId,k),k};for(const p of e)p.parentId===null&&o(p);const c=e.map(p=>({node:p,x:lu+p.depth*(Au+Vm),y:lu+(r.get(p.sessionId)??0)*(fo+tb)})),d=new Map(c.map(p=>[p.node.sessionId,p])),f=[];for(const p of c){if(p.node.parentId===null)continue;const y=d.get(p.node.parentId);if(!y)continue;const k=y.x+Au,w=y.y+fo/2,S=p.x,T=p.y+fo/2,M=k+Vm/2;f.push({fromId:y.node.sessionId,toId:p.node.sessionId,path:w===T?`M ${k} ${w} H ${S}`:`M ${k} ${w} H ${M} V ${T} H ${S}`})}const m=e.reduce((p,y)=>Math.max(p,y.depth),0),h=Math.max(1,s);return{width:lu*2+(m+1)*Au+m*Vm,height:lu*2+h*fo+(h-1)*tb,nodes:c,edges:f}}function _h(e,n,r){const s=r.find(c=>c.sessionId===e.sessionId),o=e.agentId??s?.agentId??null;if(o!==null){const c=n.find(d=>d.agentId===o);return c?c.name?.length?c.name:c.agentId:o}return s?.title??null}function Ih(e){return e.length>8?e.slice(-8):e}function U2({sessionId:e,model:n,running:r,ctx:s,agentId:o=null}){const{agents:c}=gn(),{sessions:d}=ll(),f=_h({sessionId:e,agentId:n.meta?.agentId??o},c,d)??g.chat.subagent,m=q4(s.pendingApprovals.keys(),[...s.origin,e]),h=`${g.chat.subagent} ${f}${m?` · ${g.chat.approvalWaiting}`:""}`;return l.jsxs("button",{type:"button","aria-label":h,title:h,onClick:()=>s.onOpenSubagent?.(e,s.origin),className:"flex w-full items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-left transition-colors duration-150 hover:bg-gray-100 dark:border-gray-800 dark:bg-gray-900/60 dark:hover:bg-gray-800/60",children:[l.jsx(pa,{id:n.meta?.agentId??o??e,name:f,size:16}),l.jsx("span",{className:"min-w-0 truncate text-xs font-medium text-gray-700 dark:text-gray-300",children:f}),e&&l.jsx("span",{className:"shrink-0 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:Ih(e)}),r&&l.jsx("span",{"aria-hidden":!0,className:"inline-block h-2.5 w-2.5 shrink-0 animate-spin rounded-full border border-gray-400 border-t-transparent"}),m&&l.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500"}),l.jsx("span",{className:"min-w-0 flex-1"})]})}const nb=new Set(["exec_command","input_command","run_subagent","input_subagent"]),Fu=new Set(["read_file","edit_file","write_file"]);function n8(e){return e==="aborted"?"text-amber-600 dark:text-amber-400":"text-red-600 dark:text-red-400"}function $2(e){const n=e.split("/").filter(r=>r.length>0);return n.length<=2?e:`…/${n[n.length-2]}/${n[n.length-1]}`}function a8(e,n){if(e==="exec_command"){const r=qu(n,"cmd");if(r!==null)return`$ ${r.value.replace(/\s+/g," ").trim()}`}if(Fu.has(e)){const r=qu(n,"file_path");if(r!==null)return $2(r.value.replace(/\s+/g," ").trim())}return n.replace(/\s+/g," ").trim()}function r8(e,n,r=!0){if(nb.has(e)||Fu.has(e)){const s=qu(n,"description");if(s!==null){if(!s.complete&&!r)return null;const o=s.value.replace(/\s+/g," ").trim();if(o)return o}if(nb.has(e))return null}if(Fu.has(e)){const s=qu(n,"file_path");if(s!==null){if(!s.complete&&!r)return null;const o=s.value.replace(/\s+/g," ").trim();if(o)return $2(o)}}return null}function s8(e,n){if(!Fu.has(e))return null;let r;try{r=JSON.parse(n)}catch{return null}if(r===null||typeof r!="object")return null;const s=r,o=[],c=(d,f)=>{f!==void 0&&(typeof f=="string"&&f.includes(`
|
|
167
|
-
`)?o.push(`${d}:
|
|
168
|
-
${f}`):o.push(`${d}: ${typeof f=="string"?f:JSON.stringify(f)}`))};return c("file_path",s.file_path),e==="read_file"?(c("offset",s.offset),c("limit",s.limit)):e==="edit_file"?(c("old_string",s.old_string),c("new_string",s.new_string),s.replace_all===!0&&c("replace_all",!0)):e==="write_file"&&c("content",s.content),o.join(`
|
|
169
|
-
`)}function qu(e,n){const r=`"${n}"`,s=e.indexOf(r);if(s===-1)return null;let o=s+r.length;for(;/\s/.test(e[o]??"");)o+=1;if(e[o]!==":")return null;for(o+=1;/\s/.test(e[o]??"");)o+=1;if(e[o]!=='"')return null;o+=1;let c="",d=!1;for(;o<e.length;o+=1){const f=e[o];if(d){c+=f==="n"?`
|
|
170
|
-
`:f==="t"?" ":f,d=!1;continue}if(f==="\\"){d=!0;continue}if(f==='"')return{value:c,complete:!0};c+=f}return{value:c,complete:!1}}function l8({item:e,ctx:n}){const[r,s]=v.useState(!1),o=v.useRef(!1),c=v.useRef(null),d=n.pendingApprovals.get(Yl(n.origin,e.toolCallId)),f=a8(e.name,e.argumentsText),m=r8(e.name,e.argumentsText,!e.callStreaming),h=e.callComplete&&!e.outputComplete&&!d,p=e.argStartedAtMs!==void 0&&e.callStartedAtMs!==void 0?Math.max(0,e.callStartedAtMs-e.argStartedAtMs):0,y=e.callStopReason!==void 0&&e.callStopReason!=="completed"||e.outputStopReason!==void 0&&e.outputStopReason!=="completed",k=d?"waiting":h||e.callStreaming?"running":y?"failed":"done",w=e.decision?`${e.decision==="allow"?g.chat.decisionAllow:g.chat.decisionDeny} · ${e.decisionSource==="manual"?g.chat.decisionManual:g.chat.decisionAuto}`:null,S=e.decision==="deny"&&e.outputStopReason==="aborted",T=d?g.chat.approvalWaiting:k==="running"?g.chat.workRunning:k==="done"?w??g.chat.workDone:S?w??void 0:e.outputStopReason??e.callStopReason,M=[...new Set([e.callStopReason,S?void 0:e.outputStopReason].filter(E=>E!==void 0&&E!=="completed"))];return l.jsxs("div",{ref:c,children:[l.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>{o.current=!0;const E=r;s(R=>!R),E&&requestAnimationFrame(()=>c.current?.scrollIntoView({block:"nearest"}))},className:"sticky top-4 z-[4] flex w-full items-center gap-2 bg-white px-3 py-1.5 text-left transition-colors duration-150 hover:bg-gray-50 dark:bg-gray-900 dark:hover:bg-gray-800",children:[l.jsx(Ho,{state:k,label:T}),l.jsx("span",{className:"shrink-0 truncate font-mono text-xs font-semibold text-gray-700 dark:text-gray-300",children:e.name||g.chat.unknownTool}),m&&l.jsx("span",{className:"min-w-0 shrink truncate text-xs text-gray-500 dark:text-gray-400",children:m}),l.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-500 dark:text-gray-400",children:e.durationMs!==void 0?vn(e.durationMs):h?l.jsx(Mo,{sinceMs:e.approvalAtMs??e.callStartedAtMs,offsetMs:p}):d?p>0?vn(p):null:e.callStreaming?e.argStartedAtMs!==void 0?l.jsx(Mo,{sinceMs:e.argStartedAtMs}):l.jsx("span",{className:"animate-pulse",children:"…"}):null}),M.map(E=>l.jsxs("span",{className:`shrink-0 font-mono text-xs ${n8(E)}`,children:["[",E,"]"]},E)),l.jsx("span",{className:"min-w-0 flex-1"}),l.jsx(Ln,{open:r,className:"text-gray-400"})]}),d&&l.jsxs("div",{className:"border-t border-gray-100 bg-amber-50 px-3 py-2 dark:border-gray-800 dark:bg-amber-950/30",children:[l.jsxs("div",{className:"mb-2 flex items-start gap-2 sm:items-center",children:[l.jsx("span",{className:"shrink-0 rounded-md bg-white px-1.5 py-0.5 font-mono text-xs font-semibold text-gray-700 dark:bg-gray-900 dark:text-gray-300",children:e.name||g.chat.unknownTool}),l.jsx("span",{className:"min-w-0 flex-1 whitespace-pre-wrap break-all font-mono text-xs text-gray-600 sm:truncate dark:text-gray-400",children:f})]}),(()=>{const E=s8(e.name,e.argumentsText);return E!==null?l.jsx("pre",{className:"mb-2 max-h-72 overflow-auto whitespace-pre-wrap break-all rounded-md bg-white/70 px-2 py-1.5 text-xs leading-5 text-gray-700 dark:bg-gray-950/40 dark:text-gray-300",children:E}):null})(),l.jsx(KR,{onDecide:E=>n.onApprove(e.toolCallId,E,n.origin)})]}),r&&l.jsxs("div",{className:"anim-fade",children:[e.argumentsText&&l.jsx("pre",{className:"whitespace-pre-wrap break-all border-t border-gray-100 bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:border-gray-800 dark:bg-gray-950/60 dark:text-gray-400",children:e.argumentsText}),(e.output||e.outputStreaming)&&l.jsxs("pre",{className:"max-h-72 overflow-auto whitespace-pre-wrap border-t border-gray-100 px-3 py-2 text-xs leading-5 text-gray-600 dark:border-gray-800 dark:text-gray-300",children:[e.output,e.outputStreaming&&l.jsx("span",{className:"animate-pulse",children:"▌"})]}),e.images&&e.images.length>0&&l.jsx("div",{className:"flex flex-wrap gap-2 border-t border-gray-100 px-3 py-2 dark:border-gray-800",children:e.images.map((E,R)=>l.jsx($r,{src:E,alt:g.chat.toolImageAlt,className:"max-h-40 max-w-full rounded-md border border-gray-200 dark:border-gray-700"},R))})]}),e.subagent&&l.jsx("div",{className:"px-3 pb-2 pt-2",children:l.jsx(U2,{sessionId:e.subagentSessionId??"",model:e.subagent,running:!e.outputComplete,agentId:D2(e.argumentsText),ctx:n})})]})}function i8({item:e}){if(e.running)return l.jsxs("div",{className:"anim-msg my-2 flex items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-700 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-300",children:[l.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-gray-400 border-t-transparent"}),g.chat.compactionRunning(e.mode)]});const n=e.status==="completed"?g.chat.compactionDone(e.mode):g.chat.compactionFailed(e.status??"failed");return l.jsx("p",{className:"my-1 font-mono text-xs text-gray-500 dark:text-gray-400",children:n})}const Bp=-1,Eo="M21 12A9 9 0 1 1 12 3M17 12A5 5 0 1 1 12 7M12 12L15 9V5L18 2V6H22L19 9H15";function iu(e){const n=e.trim();if(n==="")return Bp;const r=/^(\d+(?:\.\d+)?)([km])?$/i.exec(n);if(!r)return null;const s=r[2]?.toLowerCase()==="m"?1e6:r[2]?.toLowerCase()==="k"?1e3:1,o=Math.round(Number(r[1])*s);return o>0?o:null}const o8="M3 5h18v14H3zM3 16l5-5 4 4 3-3 6 6M15.5 8.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0";function c8({images:e,showFull:n,onExpand:r}){return e.length===0?null:n?l.jsx("div",{className:"mt-1.5 flex max-w-[88%] flex-wrap justify-end gap-1.5 md:max-w-[75%]",children:e.map((s,o)=>l.jsx($r,{src:s,alt:g.chat.imageAlt,className:"max-h-40 max-w-full rounded-md"},o))}):l.jsxs("button",{type:"button",onClick:r,className:"mt-1.5 flex items-center gap-1.5 rounded-md border border-gray-200 bg-gray-50 px-2 py-1 text-xs text-gray-500 hover:bg-gray-100 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-400 dark:hover:bg-gray-800",children:[l.jsx(Ue,{d:o8,size:12,className:"shrink-0"}),g.chat.goalRoundImages(e.length)]})}function u8({round:e,objective:n,images:r=[]}){const[s,o]=v.useState(!1),c=r.length>0&&(e===1||s);return n!==void 0&&n!==""?l.jsxs("div",{className:"anim-msg my-4 flex flex-col items-end",children:[l.jsx("div",{className:"max-w-[88%] rounded-lg bg-gray-100 px-4 py-2.5 md:max-w-[75%] dark:bg-gray-800",children:l.jsx("p",{className:"wrap-anywhere whitespace-pre-wrap text-base leading-relaxed text-gray-900 dark:text-gray-100",children:n})}),l.jsx(c8,{images:r,showFull:c,onExpand:()=>o(!0)}),l.jsxs("p",{className:"mt-1 flex items-center gap-1.5 px-0.5 text-xs text-gray-400 dark:text-gray-500",children:[l.jsx(Ue,{d:Eo,size:12,className:"shrink-0"}),g.chat.goalRoundBanner(e)]})]}):l.jsxs("p",{className:"anim-msg my-2 flex w-fit items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400",children:[l.jsx(Ue,{d:Eo,className:"text-gray-400 dark:text-gray-500"}),g.chat.goalRoundBanner(e)]})}function d8({goal:e}){const n=e.budget>0&&e.budget!==Bp?`${ft(e.used)}/${ft(e.budget)}`:ft(e.used),r=e.status!=="active";return l.jsxs("div",{className:"anim-fade mb-2 flex items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400",children:[l.jsx(Ue,{d:Eo,className:"shrink-0 text-gray-400 dark:text-gray-500"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",title:e.objective,children:e.objective}),l.jsx("span",{className:"shrink-0 text-gray-400 dark:text-gray-500",children:g.chat.goalProgress(e.rounds,n)}),l.jsx("span",{className:`shrink-0 rounded px-1.5 py-0.5 ${r?e.status==="complete"?"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-400":"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-400":"bg-gray-200 text-gray-600 dark:bg-gray-800 dark:text-gray-300"}`,children:g.chat.goalStatus[e.status]})]})}function f8(e){return e.agentName&&e.agentName!==e.agentId?`${e.agentName} (${e.agentId})`:e.agentId}const Lh="anim-msg my-2 flex w-fit items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400";function m8({origin:e}){const n=ya(),r=g.chat.handoffFrom(f8(e));if(!e.sessionId)return l.jsx("p",{className:Lh,children:r});const s=e.sessionId;return l.jsxs("button",{type:"button",title:g.chat.handoffBack(e.sessionTitle),onClick:()=>n(`/chat/${s}`),className:`${Lh} transition-colors hover:bg-gray-100 hover:text-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-200`,children:[r,l.jsx("span",{"aria-hidden":!0,className:"text-gray-400 dark:text-gray-500",children:"→"})]})}function h8({origin:e}){const n=ya(),r=e.sessionId;return l.jsxs("button",{type:"button",title:g.chat.handoffBack(e.sessionTitle),onClick:()=>n(`/chat/${r}`),className:`${Lh} transition-colors hover:bg-gray-100 hover:text-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-200`,children:[g.chat.modelSwitchFrom(e.prevModelId),l.jsx("span",{"aria-hidden":!0,className:"text-gray-400 dark:text-gray-500",children:"→"})]})}function p8({origin:e}){return l.jsxs("p",{className:"anim-msg my-2 flex w-fit items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400",children:[g.chat.scheduledFrom(e.name),e.firedAt&&l.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:ma(e.firedAt)})]})}const Hp="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2zM22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z";function g8(e,n,r){return e==="zh"&&r?r:n}function Po(e,n){return e==="zh"?n.shortDescriptionZh||n.shortDescription||n.description:n.shortDescription||n.description}function x8(e,n,r){const s=r.trim().toLowerCase();return s?e.filter(o=>o.name.toLowerCase().includes(s)||Po(n,o).toLowerCase().includes(s)):e}function y8(e,n){return e.map(r=>({name:r.name,cmd:`/${r.name}`,desc:Po(n,r)}))}function ab({names:e}){return l.jsxs("p",{className:"anim-msg my-2 flex w-fit items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400",children:[l.jsx(Ue,{d:Hp,className:"text-gray-400 dark:text-gray-500"}),g.chat.skillsBanner(e)]})}const Oh="M21.4 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.2-9.19a4 4 0 0 1 5.65 5.66l-9.19 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48";function b8({files:e}){const n=g.chat.attachedFilesBanner(e.map(l3));return l.jsxs("p",{title:n,className:"anim-msg my-2 flex w-fit max-w-full items-center gap-2 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-400",children:[l.jsx(Ue,{d:Oh,className:"shrink-0 text-gray-400 dark:text-gray-500"}),l.jsx("span",{className:"min-w-0 truncate",children:n})]})}const v8=w4,k8=N4;function w8(e,n){const r=n.trim().toLowerCase();return r?e.filter(s=>s.agentId.toLowerCase().includes(r)||(s.name??"").toLowerCase().includes(r)):e}function S8({handoffTarget:e,pendingModel:n,canSwitchModel:r,sessionBusy:s}){return e?"handoff":!n||!r?"post":s?"blocked":"model"}function ao({icon:e,value:n,compactValue:r,label:s,display:o="flex"}){return l.jsxs("span",{title:s,"aria-label":s,className:`${o} items-center gap-1`,children:[l.jsx(Ue,{d:e}),r!==void 0&&r!==n?l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"sm:hidden",children:r}),l.jsx("span",{className:"hidden sm:inline",children:n})]}):n]})}function j8({stats:e,assistantText:n,cost:r,atMs:s}){const[o,c]=v.useState(!1),{currency:d}=Ns(),{locale:f}=Ja(),m=e?.tokensByBucket,h=m?m.cacheRead+m.cacheWrite:0,p=()=>{const y=n?.trim()||e===null?n??"":$4(e,{stats:g.chat.statsLabel,input:g.chat.statInput,cached:g.chat.statCached,output:g.chat.statOutput,parenOpen:g.chat.statParenOpen,parenClose:g.chat.statParenClose});navigator.clipboard?.writeText(y).then(()=>{c(!0),setTimeout(()=>c(!1),1500)})};return l.jsxs("div",{className:"-mt-2 flex h-5 items-center justify-start gap-x-2 overflow-hidden whitespace-nowrap text-[11px] text-gray-400 transition-opacity duration-150 group-hover:opacity-100 focus-within:opacity-100 sm:gap-x-3 sm:opacity-0 dark:text-gray-500",children:[l.jsxs("span",{className:"no-scrollbar flex min-w-0 items-center gap-x-2 overflow-x-auto sm:gap-x-3",children:[s!==void 0&&l.jsx("span",{children:lk(s,f)}),e&&m&&l.jsxs(l.Fragment,{children:[l.jsx(ao,{icon:un.input,value:ft(h),label:g.chat.statInput}),l.jsx(ao,{icon:un.output,value:ft(m.output),label:g.chat.statOutput}),l.jsx(ao,{icon:un.tps,value:Lu(e.outputTps),label:g.chat.statTps,display:"hidden sm:flex"}),r!=null&&l.jsx(ao,{icon:un.cost,value:Za(r,d),compactValue:Za(r,d,{compact:!0}),label:`${g.common.cost}(${d})`}),l.jsx(ao,{icon:un.elapsed,value:vn(e.elapsedDeltaMs),compactValue:vn(e.elapsedDeltaMs,{compact:!0}),label:g.chat.statElapsed})]})]}),l.jsx("button",{type:"button",title:o?g.common.copied:g.chat.copyReply,"aria-label":g.chat.copyReply,onClick:p,className:"flex h-5 w-5 shrink-0 items-center justify-center rounded transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:l.jsx(Ue,{d:o?un.check:un.copy})})]})}const N8=1200,C8="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0";function ou({atMs:e,text:n,align:r="left"}){const{locale:s}=Ja(),[o,c]=v.useState(!1),d=()=>{n!==void 0&&(navigator.clipboard.writeText(n),c(!0),setTimeout(()=>c(!1),N8))};return l.jsxs("div",{className:`flex h-5 items-center gap-2 transition-opacity duration-150 group-hover:opacity-100 focus-within:opacity-100 sm:opacity-0 ${r==="right"?"justify-end":"justify-start"}`,children:[e!==void 0&&l.jsx("span",{className:"text-[11px] text-gray-400",children:lk(e,s)}),n!==void 0&&l.jsx("button",{type:"button",title:o?g.common.copied:g.chat.copyMessage,"aria-label":g.chat.copyMessage,onClick:d,className:"rounded p-0.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:l.jsx(Ue,{d:o?un.check:un.copy})})]})}const T8=2e3;function M8({item:e,ctx:n}){const r=e.gaveUp?"gaveUp":e.retrying?"retried":"waiting",s=r==="waiting"&&e.plannedDelayMs!==void 0&&e.plannedDelayMs>=T8&&e.arrivedAtMs!==void 0?e.arrivedAtMs+e.plannedDelayMs:null,[o,c]=v.useState(()=>Date.now()),[d,f]=v.useState(!1);v.useEffect(()=>{if(s===null||Date.now()>=s)return;const k=setInterval(()=>{c(Date.now()),Date.now()>=s&&clearInterval(k)},250);return()=>clearInterval(k)},[s]);const m=s!==null?s-o:0,h=s!==null&&m>0,p=h?Math.ceil(m/1e3):void 0,y=h&&n.origin.length===0&&(n.onRetryNow!==void 0||n.onGiveUp!==void 0);return l.jsxs("p",{className:"anim-msg my-1 flex flex-wrap items-center gap-x-2 gap-y-1 font-mono text-xs text-amber-600 dark:text-amber-500",children:[l.jsx("span",{children:g.chat.reconnect(e.status,r,e.attempt,p)}),y&&l.jsxs("span",{className:"flex shrink-0 items-center gap-1.5",children:[n.onRetryNow&&l.jsx("button",{type:"button",disabled:d,onClick:()=>{f(!0),n.onRetryNow()},className:"rounded border border-amber-300 px-1.5 py-0.5 text-[11px] font-medium text-amber-700 transition-colors duration-150 hover:bg-amber-50 disabled:cursor-not-allowed disabled:opacity-50 dark:border-amber-700 dark:text-amber-400 dark:hover:bg-amber-950/40",children:g.chat.reconnectRetryNow}),n.onGiveUp&&l.jsx("button",{type:"button",disabled:d,onClick:()=>{f(!0),n.onGiveUp()},className:"rounded border border-gray-300 px-1.5 py-0.5 text-[11px] text-gray-500 transition-colors duration-150 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-600 dark:text-gray-400 dark:hover:bg-gray-800",children:g.chat.reconnectGiveUp})]})]})}function B2({item:e,ctx:n}){switch(e.kind){case"user_text":{const r=gk(e.text);if(r)return l.jsx(m8,{origin:r});const s=yk(e.text);if(s)return l.jsx(h8,{origin:s});const o=bk(e.text),c=o?o.rest:e.text,d=xk(c),f=d?d.rest:c,m=hk(f),{text:h,images:p,files:y}=Uu(m?m.rest:f);return o?l.jsxs(l.Fragment,{children:[m&&l.jsx(ab,{names:m.skills}),l.jsx(u8,{round:o.round,objective:h,images:p})]}):l.jsxs(l.Fragment,{children:[d&&l.jsx(p8,{origin:d.origin}),m&&l.jsx(ab,{names:m.skills}),y.length>0&&l.jsx(b8,{files:y}),h&&l.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[l.jsx("div",{className:"max-w-[88%] rounded-lg bg-gray-100 px-4 py-2.5 md:max-w-[75%] dark:bg-gray-800",children:l.jsx("p",{className:"wrap-anywhere whitespace-pre-wrap text-base leading-relaxed text-gray-900 dark:text-gray-100",children:h})}),l.jsx(ou,{...e.atMs!==void 0?{atMs:e.atMs}:{},text:h,align:"right"})]}),p.map((k,w)=>l.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[l.jsx("div",{className:"max-w-[88%] rounded-lg bg-gray-100 p-1.5 md:max-w-[75%] dark:bg-gray-800",children:l.jsx($r,{src:k,alt:g.chat.imageAlt,className:"max-h-48 max-w-full rounded-md"})}),l.jsx(ou,{...e.atMs!==void 0?{atMs:e.atMs}:{},align:"right"})]},w))]})}case"user_steering":{const{text:r,images:s}=Uu(e.text),o=[...s,...e.images??[]];return l.jsxs("div",{className:"anim-msg group my-2 flex flex-col items-end",children:[l.jsxs("div",{className:"flex max-w-[88%] flex-col gap-1.5 rounded-md border border-gray-200 bg-gray-100 px-3 py-1.5 md:max-w-[75%] dark:border-gray-700 dark:bg-gray-800",children:[l.jsxs("div",{className:"flex items-start gap-1.5",children:[l.jsx(Ue,{d:C8,className:"mt-1 shrink-0 text-gray-400 dark:text-gray-500"}),l.jsxs("p",{className:"wrap-anywhere whitespace-pre-wrap text-sm leading-relaxed text-gray-800 dark:text-gray-100",children:[l.jsx("span",{className:"mr-1.5 text-xs font-semibold text-gray-500 dark:text-gray-400",children:g.chat.userSteering}),r]})]}),o.length>0&&l.jsx("div",{className:"flex flex-wrap justify-end gap-1.5",children:o.map((c,d)=>l.jsx($r,{src:c,alt:g.chat.imageAlt,className:"max-h-28 max-w-full rounded-md"},d))})]}),l.jsx(ou,{...e.atMs!==void 0?{atMs:e.atMs}:{},text:r,align:"right"})]})}case"user_image":return l.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[l.jsx("div",{className:"max-w-[88%] rounded-lg bg-gray-100 p-1.5 md:max-w-[75%] dark:bg-gray-800",children:l.jsx($r,{src:e.imageUrl,alt:g.chat.imageAlt,className:"max-h-48 max-w-full rounded-md"})}),l.jsx(ou,{...e.atMs!==void 0?{atMs:e.atMs}:{},align:"right"})]});case"assistant_text":return l.jsxs("div",{className:"md-body anim-msg my-3 text-base leading-relaxed text-gray-800 dark:text-gray-100",children:[l.jsx(I2,{text:e.text,streaming:e.streaming}),e.streaming&&l.jsx("span",{className:"animate-pulse text-gray-400",children:"▌"}),e.stopReason&&e.stopReason!=="completed"&&l.jsxs("span",{className:"ml-1 font-mono text-xs text-gray-400",children:["[",e.stopReason,"]"]}),n.origin.length>0&&!e.streaming&&n.onOpenFile&&n.statFiles&&l.jsx(J1,{text:e.text,workspace:n.workspace??null,statFiles:n.statFiles,onOpenFile:n.onOpenFile})]});case"thinking":return l.jsx(WR,{item:e});case"tool_call":return l.jsx(l8,{item:e,ctx:n});case"subagent":return l.jsx("div",{className:"anim-msg my-2",children:l.jsx(U2,{sessionId:e.sessionId,model:e.model,running:!1,ctx:n})});case"abort":return l.jsx("p",{className:"anim-msg my-1 font-mono text-xs text-gray-500 dark:text-gray-400",children:g.chat.aborted(e.reason)});case"reconnect":return l.jsx(M8,{item:e,ctx:n});case"compaction":return l.jsx(i8,{item:e});case"task_stats":return l.jsxs(l.Fragment,{children:[n.origin.length===0&&n.onOpenFile&&n.statFiles&&e.assistantText.trim()!==""&&l.jsx(J1,{text:e.assistantText,workspace:n.workspace??null,statFiles:n.statFiles,onOpenFile:n.onOpenFile}),l.jsx(j8,{stats:e.stats,assistantText:e.assistantText,cost:e.stats?n.taskCost?.(e.stats)??null:null,...e.atMs!==void 0?{atMs:e.atMs}:{}})]})}}function E8(e){let n=0,r=0,s,o;const c=m=>{m!==void 0&&(s===void 0||m<s)&&(s=m)},d=(m,h)=>{if(h<=0)return;if(m===void 0){r+=h;return}c(m);const p=m+h;(o===void 0||p>o)&&(o=p)};for(const m of e){if(m.kind==="thinking"){c(m.startedAtMs),m.durationMs!==void 0&&d(m.startedAtMs,m.durationMs);continue}if(m.kind!=="tool_call"||(n+=1,c(m.argStartedAtMs??m.callStartedAtMs??m.approvalAtMs),m.durationMs===void 0))continue;const h=m.argStartedAtMs!==void 0&&m.callStartedAtMs!==void 0?Math.min(m.durationMs,Math.max(0,m.callStartedAtMs-m.argStartedAtMs)):0;d(m.argStartedAtMs,h),d(m.approvalAtMs??m.callStartedAtMs,m.durationMs-h)}const f=s!==void 0&&o!==void 0?o-s:0;return{steps:n,durationMs:f+r,...s!==void 0?{startMs:s}:{}}}function A8(e){return e.kind==="thinking"||e.kind==="tool_call"}function R8(e,n){return e.kind==="thinking"?e.streaming:e.kind==="tool_call"?e.callStreaming||e.outputStreaming||e.callComplete&&!e.outputComplete?!0:n.pendingApprovals.has(Yl(n.origin,e.toolCallId)):!1}function _8(e,n){return e.some(r=>r.kind==="tool_call"&&n.pendingApprovals.has(Yl(n.origin,r.toolCallId)))}function I8({items:e,ctx:n,isLast:r}){const s=e.some(S=>R8(S,n)),o=r&&n.taskRunning||s,c=_8(e,n),[d,f]=v.useState(r),m=v.useRef(!1),h=v.useRef(null);v.useEffect(()=>{m.current||f(r)},[r]);const p=d||c,{steps:y,durationMs:k,startMs:w}=E8(e);return l.jsxs("div",{ref:h,className:"anim-msg my-2 overflow-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[l.jsxs("button",{type:"button","data-group-header":!0,"aria-expanded":p,onClick:()=>{m.current=!0;const S=d&&!c;f(T=>!T),S&&requestAnimationFrame(()=>h.current?.scrollIntoView({block:"nearest"}))},className:"sticky -top-4 z-[5] flex w-full items-center gap-2 bg-gray-50 px-3 py-2 text-left transition-colors duration-150 hover:bg-gray-100 dark:bg-gray-900 dark:hover:bg-gray-800",children:[l.jsx(Ho,{state:o?"running":"done",size:12}),l.jsx("span",{className:`shrink-0 text-[11px] font-semibold uppercase tracking-wide ${o?"text-emerald-600 dark:text-emerald-400":"text-gray-500 dark:text-gray-400"}`,children:o?g.chat.workRunning:g.chat.workDone}),y>0&&l.jsx("span",{className:"hidden shrink-0 font-mono text-xs text-gray-400 sm:inline",children:g.chat.workGroupSteps(y)}),s?w!==void 0&&l.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400",children:l.jsx(Mo,{sinceMs:w})}):k>0&&l.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400",children:vn(k)}),c&&!p&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"hidden shrink-0 rounded bg-amber-100 px-1 text-[10px] font-medium text-amber-700 sm:inline dark:bg-amber-950/50 dark:text-amber-300",children:g.chat.approvalWaiting}),l.jsx("span",{role:"img",title:g.chat.approvalWaiting,"aria-label":g.chat.approvalWaiting,className:"h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500 sm:hidden"})]}),l.jsx("span",{className:"min-w-0 flex-1"}),l.jsx(Ln,{open:p,className:"text-gray-400"})]}),p&&l.jsx("div",{className:"anim-fade divide-y divide-gray-100 border-t border-gray-200 dark:divide-gray-800/60 dark:border-gray-800",children:e.map(S=>l.jsx(B2,{item:S,ctx:n},S.id))})]})}function L8(){let e=!0,n=null,r=null;return{get stick(){return e},wheel(s){s<0&&(e=!1)},touchStart(s){r=s},touchMove(s){r!==null&&s>r&&(e=!1),r=s},touchEnd(){r=null},scrolled(s){const o=s.scrollHeight-s.scrollTop-s.clientHeight,c=n;if(n=s.scrollTop,c===null){e=o<80;return}if(s.scrollTop<c&&o>1){e=!1;return}o<80&&(e=!0)},resume(){e=!0,n=null}}}function O8({items:e,ctx:n}){const r=[];let s=[];const o=()=>{s.length>0&&(r.push({type:"group",items:s}),s=[])};for(const h of e)A8(h)?s.push(h):(o(),r.push({type:"single",item:h}));o();const c=(h,p)=>h.type==="group"?l.jsx(I8,{items:h.items,ctx:n,isLast:p===r.length-1},`wg-${h.items[0].id}`):l.jsx(B2,{item:h.item,ctx:n},h.item.id),d=[];let f=[];const m=()=>{if(f.length===0)return;const h=f[0].seg,p=h.type==="group"?h.items[0].id:h.item.id,y=f;f=[],d.push(l.jsx("div",{className:"group",children:y.map(k=>c(k.seg,k.i))},`turn-${p}`))};for(let h=0;h<r.length;h++){const p=r[h];if(p.type==="single"&&(p.item.kind==="user_text"||p.item.kind==="user_image")){m(),d.push(n.origin.length===0?l.jsx("div",{"data-outline-anchor":p.item.id,children:c(p,h)},`anchor-${p.item.id}`):c(p,h));continue}f.push({seg:p,i:h}),p.type==="single"&&p.item.kind==="task_stats"&&m()}return m(),l.jsx(l.Fragment,{children:d})}function H2({items:e,version:n,ctx:r,scrollElRef:s,outline:o}){const c=v.useRef(null),d=v.useRef(null),f=d.current??=L8(),[m,h]=v.useState(!1),p=v.useRef(!1),y=v.useRef(null),k=()=>{y.current!==null&&(cancelAnimationFrame(y.current),y.current=null),p.current=!1};v.useEffect(()=>()=>k(),[]);const w=v.useRef(null),S=()=>{const E=c.current;h(!p.current&&!f.stick&&E!==null&&E.scrollHeight-E.scrollTop-E.clientHeight>1)},T=()=>{const E=c.current;if(!E)return;const R=w.current;w.current=E.scrollTop,p.current&&R!==null&&E.scrollTop<R-1&&k(),f.scrolled({scrollTop:E.scrollTop,scrollHeight:E.scrollHeight,clientHeight:E.clientHeight}),S()};v.useLayoutEffect(()=>{const E=c.current;E&&f.stick&&!p.current&&(E.scrollTop=E.scrollHeight),S()},[n,f]);const M=()=>{const E=c.current;if(!E)return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){f.resume(),E.scrollTop=E.scrollHeight,S();return}k(),p.current=!0,E.scrollHeight-E.clientHeight-E.scrollTop>3*E.clientHeight&&(E.scrollTop=E.scrollHeight-4*E.clientHeight);let I=performance.now();const H=D=>{y.current=null;const L=c.current;if(!L||!p.current)return;const $=Math.min(.05,Math.max(.001,(D-I)/1e3));I=D;const K=L.scrollHeight-L.clientHeight-L.scrollTop;if(K<=1){p.current=!1,f.resume(),L.scrollTop=L.scrollHeight,S();return}const X=Math.max(K*Math.min(1,$*10),3200*$);L.scrollTop+=Math.min(X,K),y.current=requestAnimationFrame(H)};y.current=requestAnimationFrame(H),S()};return l.jsxs("div",{className:"relative h-full min-h-0",children:[l.jsx("div",{ref:E=>{c.current=E,s&&(s.current=E)},onScroll:T,onWheel:E=>{f.wheel(E.deltaY),E.deltaY<0&&k(),S()},onTouchStart:E=>{const R=E.touches[0];R&&f.touchStart(R.clientY)},onTouchMove:E=>{const R=E.touches[0];R&&f.touchMove(R.clientY),p.current&&k(),S()},onTouchEnd:()=>f.touchEnd(),className:"anim-fade h-full overflow-y-auto px-4 py-4 md:px-6",children:l.jsx("div",{className:"mx-auto max-w-3xl",children:e.length===0?l.jsx(mr,{title:g.chat.emptyStream}):l.jsx(O8,{items:e,ctx:r})})}),o,m&&l.jsx("button",{type:"button","aria-label":g.chat.jumpToLatest,title:g.chat.jumpToLatest,onClick:M,className:"anim-pop absolute bottom-3 left-1/2 z-10 -translate-x-1/2 rounded-full border border-gray-300 bg-white p-1.5 text-gray-500 shadow-sm transition-colors duration-150 hover:bg-gray-50 hover:text-gray-900 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-100",children:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":!0,children:l.jsx("path",{d:"M12 5v14M6 13l6 6 6-6",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}const D8=128e3;function P2(e){const n=typeof e=="string"?Number(e):e;return typeof n=="number"&&Number.isFinite(n)&&n>0?n:D8}const z8=/[\s"'/]on[a-z]+\s*=/i,U8=/href\s*=/i;function $8(e){if(!e)return null;const n=e.trim();if(!/^<svg[\s>]/i.test(n))return null;const r=n.toLowerCase();return r.includes("<script")||r.includes("foreignobject")||U8.test(n)||z8.test(n)?null:n}const Gm=["bg-sky-50 text-sky-600 dark:bg-sky-950/60 dark:text-sky-400","bg-emerald-50 text-emerald-600 dark:bg-emerald-950/60 dark:text-emerald-400","bg-violet-50 text-violet-600 dark:bg-violet-950/60 dark:text-violet-400","bg-amber-50 text-amber-600 dark:bg-amber-950/60 dark:text-amber-400","bg-rose-50 text-rose-600 dark:bg-rose-950/60 dark:text-rose-400","bg-cyan-50 text-cyan-600 dark:bg-cyan-950/60 dark:text-cyan-400","bg-indigo-50 text-indigo-600 dark:bg-indigo-950/60 dark:text-indigo-400","bg-teal-50 text-teal-600 dark:bg-teal-950/60 dark:text-teal-400"],B8={firecrawl:3,"data-analysis":1,"web-design":2,"penguin-sdk":0};function H8(e){const n=B8[e];if(n!==void 0)return Gm[n];let r=0;for(let s=0;s<e.length;s++)r=r*31+e.charCodeAt(s)>>>0;return Gm[r%Gm.length]}function Pp({icon:e,size:n=20,className:r=""}){const s=$8(e);return s?l.jsx("span",{"aria-hidden":!0,style:{width:n,height:n},className:`block shrink-0 [&>svg]:block [&>svg]:h-full [&>svg]:w-full ${r}`,dangerouslySetInnerHTML:{__html:s}}):l.jsx(Ue,{d:Hp,size:n,className:r})}const rb={viewBox:"-0.76 -0.47 28.6 28.6",path:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M26.59,15.92L22.82,13.75C22.92,13.59,22.97,13.4,22.97,13.21L22.97,12.05C22.97,11.66,22.76,11.31,22.43,11.12L21.42,10.54C21.09,10.34,20.68,10.34,20.35,10.54L17.26,12.32C16.93,12.51,16.73,12.86,16.73,13.25L16.73,14.41C16.73,14.79,16.93,15.15,17.26,15.34L24.51,19.53C24.84,19.72,25.25,19.72,25.58,19.53L26.59,18.94C26.92,18.75,27.13,18.4,27.13,18.01L27.13,16.85C27.13,16.47,26.92,16.11,26.59,15.92L26.59,15.92Z"}),l.jsx("path",{d:"M21.88,3.58L18.11,5.75C18.02,5.59,17.89,5.46,17.72,5.36L16.71,4.78C16.38,4.59,15.97,4.59,15.64,4.78L14.63,5.36C14.3,5.55,14.09,5.9,14.09,6.29L14.09,9.86C14.09,10.24,14.3,10.59,14.63,10.78L15.64,11.37C15.97,11.56,16.38,11.56,16.71,11.37L23.96,7.18C24.29,6.99,24.5,6.64,24.5,6.25L24.5,5.09C24.5,4.71,24.29,4.35,23.96,4.16L22.95,3.58C22.62,3.39,22.21,3.39,21.88,3.58L21.88,3.58Z"}),l.jsx("path",{d:"M8.83,1.48L8.83,5.83C8.65,5.83,8.46,5.88,8.3,5.98L7.29,6.56C6.95,6.75,6.75,7.11,6.75,7.49L6.75,8.65C6.75,9.04,6.95,9.39,7.29,9.58L10.37,11.37C10.71,11.56,11.11,11.56,11.45,11.37L12.45,10.78C12.79,10.59,12.99,10.24,12.99,9.85L12.99,1.48C12.99,1.1,12.79,0.75,12.45,0.56L11.45,-0.03C11.11,-0.22,10.71,-0.22,10.37,-0.03L9.37,0.56C9.03,0.75,8.83,1.1,8.83,1.48L8.83,1.48Z"}),l.jsx("path",{d:"M0.5,11.74L4.26,13.91C4.17,14.07,4.12,14.26,4.12,14.45L4.12,15.61C4.12,16,4.32,16.35,4.65,16.54L5.66,17.13C6,17.32,6.4,17.32,6.73,17.13L9.82,15.34C10.15,15.15,10.36,14.8,10.36,14.41L10.36,13.25C10.36,12.87,10.15,12.51,9.82,12.32L2.57,8.14C2.24,7.94,1.84,7.94,1.5,8.14L0.5,8.72C0.16,8.91,-0.04,9.26,-0.04,9.65L-0.04,10.81C-0.04,11.19,0.16,11.55,0.5,11.74Z"}),l.jsx("path",{d:"M5.21,24.08L8.97,21.91C9.07,22.07,9.2,22.21,9.37,22.3L10.38,22.88C10.71,23.08,11.11,23.08,11.45,22.88L12.46,22.3C12.79,22.11,12.99,21.76,12.99,21.37L12.99,17.81C12.99,17.42,12.79,17.07,12.46,16.88L11.45,16.29C11.11,16.1,10.71,16.1,10.38,16.29L3.13,20.48C2.8,20.67,2.59,21.02,2.59,21.41L2.59,22.57C2.59,22.95,2.8,23.31,3.13,23.5L4.14,24.08C4.47,24.28,4.88,24.28,5.21,24.08L5.21,24.08Z"}),l.jsx("path",{d:"M18.26,26.18L18.26,21.83C18.44,21.83,18.63,21.78,18.79,21.68L19.8,21.1C20.13,20.91,20.34,20.56,20.34,20.17L20.34,19.01C20.34,18.62,20.13,18.27,19.8,18.08L16.71,16.3C16.38,16.1,15.97,16.1,15.64,16.3L14.63,16.88C14.3,17.07,14.1,17.42,14.1,17.81L14.1,26.18C14.1,26.56,14.3,26.91,14.63,27.11L15.64,27.69C15.97,27.88,16.38,27.88,16.71,27.69L17.72,27.11C18.05,26.91,18.26,26.56,18.26,26.18L18.26,26.18Z"})]})},P8={anthropic:{path:l.jsx("path",{d:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"})},openai:{path:l.jsx("path",{d:"M22.2819 9.8211a5.9847 5.9847 0 0 0-.5157-4.9108 6.0462 6.0462 0 0 0-6.5098-2.9A6.0651 6.0651 0 0 0 4.9807 4.1818a5.9847 5.9847 0 0 0-3.9977 2.9 6.0462 6.0462 0 0 0 .7427 7.0966 5.98 5.98 0 0 0 .511 4.9107 6.051 6.051 0 0 0 6.5146 2.9001A5.9847 5.9847 0 0 0 13.2599 24a6.0557 6.0557 0 0 0 5.7718-4.2058 5.9894 5.9894 0 0 0 3.9977-2.9001 6.0557 6.0557 0 0 0-.7475-7.0729zm-9.022 12.6081a4.4755 4.4755 0 0 1-2.8764-1.0408l.1419-.0804 4.7783-2.7582a.7948.7948 0 0 0 .3927-.6813v-6.7369l2.02 1.1686a.071.071 0 0 1 .038.052v5.5826a4.504 4.504 0 0 1-4.4945 4.4944zm-9.6607-4.1254a4.4708 4.4708 0 0 1-.5346-3.0137l.142.0852 4.783 2.7582a.7712.7712 0 0 0 .7806 0l5.8428-3.3685v2.3324a.0804.0804 0 0 1-.0332.0615L9.74 19.9502a4.4992 4.4992 0 0 1-6.1408-1.6464zM2.3408 7.8956a4.485 4.485 0 0 1 2.3655-1.9728V11.6a.7664.7664 0 0 0 .3879.6765l5.8144 3.3543-2.0201 1.1685a.0757.0757 0 0 1-.071 0l-4.8303-2.7865A4.504 4.504 0 0 1 2.3408 7.872zm16.5963 3.8558L13.1038 8.364 15.1192 7.2a.0757.0757 0 0 1 .071 0l4.8303 2.7913a4.4944 4.4944 0 0 1-.6765 8.1042v-5.6772a.79.79 0 0 0-.407-.667zm2.0107-3.0231l-.142-.0852-4.7735-2.7818a.7759.7759 0 0 0-.7854 0L9.409 9.2297V6.8974a.0662.0662 0 0 1 .0284-.0615l4.8303-2.7866a4.4992 4.4992 0 0 1 6.6802 4.66zM8.3065 12.863l-2.02-1.1638a.0804.0804 0 0 1-.038-.0567V6.0742a4.4992 4.4992 0 0 1 7.3757-3.4537l-.142.0805L8.704 5.459a.7948.7948 0 0 0-.3927.6813zm1.0976-2.3654l2.602-1.4998 2.6069 1.4998v2.9994l-2.5974 1.4997-2.6067-1.4997Z"})},google:{path:l.jsx("path",{d:"M12 24A14.304 14.304 0 0 0 0 12 14.304 14.304 0 0 0 12 0a14.305 14.305 0 0 0 12 12 14.305 14.305 0 0 0-12 12"})},deepseek:{path:l.jsx("path",{d:"M23.748 4.482c-.254-.124-.364.113-.512.234-.051.039-.094.09-.137.136-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.156-.708-.311-.955-.65-.172-.241-.219-.51-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.093.172.187.129.323-.082.28-.18.552-.266.833-.055.179-.137.217-.328.14a5.526 5.526 0 0 1-1.736-1.18c-.857-.828-1.631-1.742-2.597-2.458a11.365 11.365 0 0 0-.689-.471c-.985-.957.13-1.743.388-1.836.27-.098.093-.432-.779-.428-.872.004-1.67.295-2.687.684a3.055 3.055 0 0 1-.465.137 9.597 9.597 0 0 0-2.883-.102c-1.885.21-3.39 1.102-4.497 2.623C.082 8.606-.231 10.684.152 12.85c.403 2.284 1.569 4.175 3.36 5.653 1.858 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.133-.284 4.994-1.86.47.234.962.327 1.78.397.63.059 1.236-.03 1.705-.128.735-.156.684-.837.419-.961-2.155-1.004-1.682-.595-2.113-.926 1.096-1.296 2.746-2.642 3.392-7.003.05-.347.007-.565 0-.845-.004-.17.034-.237.23-.256a4.173 4.173 0 0 0 1.545-.475c1.396-.763 1.96-2.015 2.093-3.517.02-.23-.004-.467-.247-.588zM11.581 18c-2.089-1.642-3.102-2.183-3.52-2.16-.392.024-.321.471-.235.763.09.288.207.486.371.739.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.167-1.361-.802-2.5-1.86-3.301-3.307-.774-1.393-1.224-2.887-1.298-4.482-.02-.386.093-.522.477-.592a4.696 4.696 0 0 1 1.529-.039c2.132.312 3.946 1.265 5.468 2.774.868.86 1.525 1.887 2.202 2.891.72 1.066 1.494 2.082 2.48 2.914.348.292.625.514.891.677-.802.09-2.14.11-3.054-.615zm1-6.44a.306.306 0 0 1 .415-.287.302.302 0 0 1 .2.288.306.306 0 0 1-.31.307.303.303 0 0 1-.304-.308zm3.11 1.596c-.2.081-.399.151-.59.16a1.245 1.245 0 0 1-.798-.254c-.274-.23-.47-.358-.552-.758a1.73 1.73 0 0 1 .016-.588c.07-.327-.008-.537-.239-.727-.187-.156-.426-.199-.688-.199a.559.559 0 0 1-.254-.078c-.11-.054-.2-.19-.114-.358.028-.054.16-.186.191-.21.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.391.451.462.576.685.914.176.265.336.537.445.848.067.196-.02.354-.25.452z"})},zhipu:{path:l.jsx("path",{d:"M4.6 3.2h14.8a.9.9 0 0 1 .73 1.43L9.9 18.6h9.2a.9.9 0 0 1 0 1.8H4.6a.9.9 0 0 1-.73-1.43L14.1 5.4H4.6a1.1 1.1 0 0 1 0-2.2Z"})},moonshot:{path:l.jsx("path",{d:"m1.053 16.91 9.538 2.55a21 20.981 0 0 0 .06 2.031l5.956 1.592a12 11.99 0 0 1-15.554-6.172m-1.02-5.79 11.352 3.035a21 20.981 0 0 0-.469 2.01l10.817 2.89a12 11.99 0 0 1-1.845 2.004L.658 15.918a12 11.99 0 0 1-.625-4.796m1.593-5.146L13.573 9.17a21 20.981 0 0 0-1.01 1.874l11.297 3.02a21 20.981 0 0 1-.67 2.362l-11.55-3.087L.125 10.26a12 11.99 0 0 1 1.499-4.285ZM6.067 1.58l11.285 3.016a21 20.981 0 0 0-1.688 1.719l7.824 2.091a21 20.981 0 0 1 .513 2.664L2.107 5.218a12 11.99 0 0 1 3.96-3.638M21.68 4.866 7.222 1.003A12 11.99 0 0 1 21.68 4.866"})},openrouter:{path:l.jsx("path",{d:"M16.778 1.844v1.919q-.569-.026-1.138-.032-.708-.008-1.415.037c-1.93.126-4.023.728-6.149 2.237-2.911 2.066-2.731 1.95-4.14 2.75-.396.223-1.342.574-2.185.798-.841.225-1.753.333-1.751.333v4.229s.768.108 1.61.333c.842.224 1.789.575 2.185.799 1.41.798 1.228.683 4.14 2.75 2.126 1.509 4.22 2.11 6.148 2.236.88.058 1.716.041 2.555.005v1.918l7.222-4.168-7.222-4.17v2.176c-.86.038-1.611.065-2.278.021-1.364-.09-2.417-.357-3.979-1.465-2.244-1.593-2.866-2.027-3.68-2.508.889-.518 1.449-.906 3.822-2.59 1.56-1.109 2.614-1.377 3.978-1.466.667-.044 1.418-.017 2.278.02v2.176L24 6.014Z"})},siliconflow:{viewBox:"0 0 53.021 25.354",path:l.jsx("path",{d:"M50.7172 0H27.6622C26.3877 0 25.3586 1.03397 25.3586 2.30358V9.21911C25.3586 10.4935 24.3294 11.5227 23.055 11.5227H2.30357C1.02914 11.5227 0 12.5567 0 13.8263V23.0502C0 24.3246 1.03395 25.3538 2.30357 25.3538H25.3586C26.633 25.3538 27.6622 24.3198 27.6622 23.0502V16.1347C27.6622 14.8602 28.6913 13.8311 29.9657 13.8311H50.7172C51.9916 13.8311 53.0207 12.7971 53.0207 11.5275V2.30358C53.0207 1.02916 51.9868 0 50.7172 0Z"})},"qwen-token-plan":rb,"qwen-pay-as-you-go":rb,fireworks:{viewBox:"0 0 638 315",path:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M318.563 221.755C300.863 221.755 284.979 211.247 278.206 194.978L196.549 0H244.342L318.842 178.361L393.273 0H441.066L358.92 195.048C352.112 211.247 336.263 221.755 318.563 221.755Z"}),l.jsx("path",{d:"M425.111 314.933C407.481 314.933 391.667 304.494 384.824 288.366C377.947 272.097 381.507 253.524 393.936 240.921L542.657 90.2803L561.229 134.094L425.076 271.748L619.147 270.666L637.72 314.479L425.146 315.003L425.076 314.933H425.111Z"}),l.jsx("path",{d:"M0 314.408L18.5727 270.595L212.643 271.677L76.525 133.988L95.0977 90.1748L243.819 240.816C256.247 253.384 259.843 272.026 252.93 288.26C246.088 304.424 230.203 314.827 212.643 314.827L0.0698221 314.339L0 314.408Z"})]})},custom:{stroke:!0,path:l.jsxs(l.Fragment,{children:[l.jsx("path",{d:"M12 2.8 20.5 7.4v9.2L12 21.2 3.5 16.6V7.4L12 2.8Z"}),l.jsx("path",{d:"M3.5 7.4 12 12l8.5-4.6M12 12v9.2"})]})}};function Xl({provider:e,className:n}){const r=P8[e];if(!r){const s=ik(e);return l.jsxs("svg",{viewBox:"0 0 24 24",className:n,style:{"--tile-fg":s.fg,"--tile-fg-dark":s.fgDark},"aria-hidden":!0,children:[l.jsx("rect",{x:"0",y:"0",width:"24",height:"24",rx:"5",fill:s.bg}),l.jsx("text",{x:"12",y:"12",textAnchor:"middle",dominantBaseline:"central",fontSize:"13",fontWeight:"700",className:"[fill:var(--tile-fg)] dark:[fill:var(--tile-fg-dark)]",children:ok(e)})]})}return l.jsx("svg",{viewBox:r.viewBox??"0 0 24 24",className:n,"aria-hidden":!0,...r.stroke?{fill:"none",stroke:"currentColor",strokeWidth:1.8,strokeLinejoin:"round"}:{fill:"currentColor"},children:r.path})}var St="https://openrouter.ai/api/v1",zr="https://api.siliconflow.cn/v1",Pl="https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",Fl="https://dashscope.aliyuncs.com/compatible-mode/v1",Xs="https://api.fireworks.ai/inference/v1",js=[{id:"deepseek",label:"DeepSeek",envKey:"DEEPSEEK_API_KEY",envBaseUrlKey:"DEEPSEEK_BASE_URL",apiKeyUrl:"https://platform.deepseek.com/api_keys",modelsUrl:"https://api-docs.deepseek.com/quick_start/pricing"},{id:"openrouter",label:"OpenRouter",envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL",apiKeyUrl:"https://openrouter.ai/workspaces/default/keys",modelsUrl:"https://openrouter.ai/models",gatewayBaseUrl:St},{id:"fireworks",label:"Fireworks AI",envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL",apiKeyUrl:"https://app.fireworks.ai/settings/users/api-keys",modelsUrl:"https://app.fireworks.ai/models",gatewayBaseUrl:Xs},{id:"siliconflow",label:"SiliconFlow",envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL",apiKeyUrl:"https://cloud.siliconflow.cn/me/account/ak",modelsUrl:"https://cloud.siliconflow.cn/models",gatewayBaseUrl:zr},{id:"qwen-token-plan",label:"Qwen Token Plan",envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL",apiKeyUrl:"https://platform.qianwenai.com/pricing/token-plan",modelsUrl:"https://platform.qianwenai.com/docs/token-plan/personal/token-plan-personal-overview",gatewayBaseUrl:Pl},{id:"qwen-pay-as-you-go",label:"Qwen Pay-As-You-Go",envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL",apiKeyUrl:"https://platform.qianwenai.com/docs/api-reference/preparation/api-key",modelsUrl:"https://www.qianwenai.com/models",gatewayBaseUrl:Fl},{id:"google",label:"Google Gemini",envKey:"GEMINI_API_KEY",envBaseUrlKey:"GEMINI_BASE_URL",apiKeyUrl:"https://aistudio.google.com/api-keys",modelsUrl:"https://ai.google.dev/gemini-api/docs/models"},{id:"anthropic",label:"Anthropic",envKey:"ANTHROPIC_API_KEY",envBaseUrlKey:"ANTHROPIC_BASE_URL",apiKeyUrl:"https://platform.claude.com/settings/keys",modelsUrl:"https://docs.claude.com/en/docs/about-claude/models/overview"},{id:"openai",label:"OpenAI",envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL",apiKeyUrl:"https://platform.openai.com/api-keys",modelsUrl:"https://platform.openai.com/docs/models"},{id:"zhipu",label:"Z.AI (GLM)",envKey:"ZAI_API_KEY",envBaseUrlKey:"ZAI_BASE_URL",apiKeyUrl:"https://open.bigmodel.cn/apikey/platform",modelsUrl:"https://docs.z.ai/guides/overview/pricing"},{id:"moonshot",label:"Moonshot (Kimi)",envKey:"MOONSHOT_API_KEY",envBaseUrlKey:"MOONSHOT_BASE_URL",apiKeyUrl:"https://platform.kimi.com/console/api-keys",modelsUrl:"https://platform.kimi.com/docs/pricing"},{id:"custom",label:"Custom",envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL"}];function Yt(e,n,r){const s=o=>Math.round(o/7*1e6)/1e6;return _e(s(e),s(n),s(r))}function _e(e,n,r){return{unit:"usd_per_mtok",cache_read:e,cache_write:n,output:r}}var F2=[{modelId:"deepseek-v4-flash",displayName:"DeepSeek V4 Flash",provider:"deepseek",contextWindow:1e6,pricing:Yt(.02,1,2),supportsVision:!1},{modelId:"deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"deepseek",contextWindow:1e6,pricing:Yt(.025,3,6),supportsVision:!1},{modelId:"anthropic/claude-fable-5",displayName:"Claude Fable 5",provider:"openrouter",contextWindow:1e6,pricing:_e(1,12.5,50),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"anthropic/claude-opus-5",displayName:"Claude Opus 5",provider:"openrouter",contextWindow:1e6,pricing:_e(.5,6.25,25),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"anthropic/claude-opus-4.8",displayName:"Claude Opus 4.8",provider:"openrouter",contextWindow:1e6,pricing:_e(.5,6.25,25),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"anthropic/claude-opus-4.7",displayName:"Claude Opus 4.7",provider:"openrouter",contextWindow:1e6,pricing:_e(.5,6.25,25),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"anthropic/claude-sonnet-5",displayName:"Claude Sonnet 5",provider:"openrouter",contextWindow:1e6,pricing:_e(.2,2.5,10),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"deepseek/deepseek-v4-flash-0731",displayName:"DeepSeek V4 Flash 0731",provider:"openrouter",contextWindow:1e6,pricing:_e(.018,.09,.18),supportsVision:!1,clientType:"openai",baseUrl:St},{modelId:"deepseek/deepseek-v4-flash",displayName:"DeepSeek V4 Flash",provider:"openrouter",contextWindow:1e6,pricing:_e(.028,.14,.28),supportsVision:!1,clientType:"openai",baseUrl:St},{modelId:"deepseek/deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"openrouter",contextWindow:1e6,pricing:_e(.003625,.435,.87),supportsVision:!1,clientType:"openai",baseUrl:St},{modelId:"google/gemini-3.6-flash",displayName:"Gemini 3.6 Flash",provider:"openrouter",contextWindow:1048576,pricing:_e(.15,1.5,7.5),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"google/gemini-3.5-flash",displayName:"Gemini 3.5 Flash",provider:"openrouter",contextWindow:1048576,pricing:_e(.15,1.5,9),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"google/gemini-3.5-flash-lite",displayName:"Gemini 3.5 Flash-Lite",provider:"openrouter",contextWindow:1048576,pricing:_e(.03,.3,2.5),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"inclusionai/ling-3.0-flash:free",displayName:"Ling 3.0 Flash (free)",provider:"openrouter",contextWindow:262144,pricing:_e(0,0,0),supportsVision:!1,clientType:"openai",baseUrl:St},{modelId:"minimax/minimax-m3",displayName:"MiniMax M3",provider:"openrouter",contextWindow:1048576,pricing:_e(.06,.3,1.2),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"moonshotai/kimi-k3",displayName:"Kimi K3",provider:"openrouter",contextWindow:1e6,pricing:_e(.3,3,15),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"moonshotai/kimi-k2.6",displayName:"Kimi K2.6",provider:"openrouter",contextWindow:262144,pricing:_e(.2,.6,3.41),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"nvidia/nemotron-3-ultra-550b-a55b:free",displayName:"Nemotron 3 Ultra (free)",provider:"openrouter",contextWindow:1e6,pricing:_e(0,0,0),supportsVision:!1,clientType:"openai",baseUrl:St},{modelId:"openai/gpt-5.6-luna",displayName:"GPT-5.6 Luna",provider:"openrouter",contextWindow:1e6,pricing:_e(.01,.125,.6),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"openai/gpt-5.6-sol",displayName:"GPT-5.6 Sol",provider:"openrouter",contextWindow:1e6,pricing:_e(.5,6.25,30),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"openai/gpt-5.6-terra",displayName:"GPT-5.6 Terra",provider:"openrouter",contextWindow:1e6,pricing:_e(.1,1.25,6),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"openai/gpt-5.5",displayName:"GPT-5.5",provider:"openrouter",contextWindow:1e6,pricing:_e(.5,5,30),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"openrouter/free",displayName:"Free Models Router",provider:"openrouter",contextWindow:128e3,pricing:_e(0,0,0),supportsVision:!1,clientType:"openai",baseUrl:St},{modelId:"qwen/qwen3.6-35b-a3b",displayName:"Qwen 3.6 35B A3B",provider:"openrouter",contextWindow:262144,pricing:_e(.14,.14,1),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"stepfun/step-3.7-flash",displayName:"Step 3.7 Flash",provider:"openrouter",contextWindow:256e3,pricing:_e(.04,.2,1.15),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"tencent/hy3",displayName:"Hy3",provider:"openrouter",contextWindow:262144,pricing:_e(.033,.132,.528),supportsVision:!1,clientType:"openai",baseUrl:St},{modelId:"x-ai/grok-4.5",displayName:"Grok 4.5",provider:"openrouter",contextWindow:5e5,pricing:_e(.3,2,6),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"xiaomi/mimo-v2.5",displayName:"MiMo-V2.5",provider:"openrouter",contextWindow:1048576,pricing:_e(.0028,.14,.28),supportsVision:!0,clientType:"openai",baseUrl:St},{modelId:"z-ai/glm-5.2",displayName:"GLM-5.2",provider:"openrouter",contextWindow:1e6,pricing:_e(.221,1.19,3.74),supportsVision:!1,clientType:"openai",baseUrl:St},{modelId:"z-ai/glm-5.1",displayName:"GLM-5.1",provider:"openrouter",contextWindow:204800,pricing:_e(.1794,.966,3.036),supportsVision:!1,clientType:"openai",baseUrl:St},{modelId:"accounts/fireworks/models/deepseek-v4-flash",displayName:"DeepSeek V4 Flash",provider:"fireworks",contextWindow:1e6,pricing:_e(.03,.14,.28),supportsVision:!1,clientType:"openai",baseUrl:Xs},{modelId:"accounts/fireworks/models/deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"fireworks",contextWindow:1e6,pricing:_e(.15,1.74,3.48),supportsVision:!1,clientType:"openai",baseUrl:Xs},{modelId:"accounts/fireworks/models/glm-5p2",displayName:"GLM-5.2",provider:"fireworks",contextWindow:1e6,pricing:_e(.14,1.4,4.4),supportsVision:!1,clientType:"openai",baseUrl:Xs},{modelId:"accounts/fireworks/models/kimi-k3",displayName:"Kimi K3",provider:"fireworks",contextWindow:1e6,pricing:_e(.3,3,15),supportsVision:!0,clientType:"openai",baseUrl:Xs},{modelId:"accounts/fireworks/models/kimi-k2p7-code",displayName:"Kimi K2.7 Code",provider:"fireworks",contextWindow:262144,pricing:_e(.19,.95,4),supportsVision:!0,clientType:"openai",baseUrl:Xs},{modelId:"accounts/fireworks/models/minimax-m3",displayName:"MiniMax M3",provider:"fireworks",contextWindow:524288,pricing:_e(.06,.3,1.2),supportsVision:!0,clientType:"openai",baseUrl:Xs},{modelId:"deepseek-ai/DeepSeek-V4-Flash",displayName:"DeepSeek V4 Flash",provider:"siliconflow",contextWindow:1e6,pricing:Yt(.02,1,2),supportsVision:!1,clientType:"openai",baseUrl:zr},{modelId:"deepseek-ai/DeepSeek-V4-Pro",displayName:"DeepSeek V4 Pro",provider:"siliconflow",contextWindow:1e6,pricing:Yt(.1,12,24),supportsVision:!1,clientType:"openai",baseUrl:zr},{modelId:"meituan-longcat/LongCat-2.0",displayName:"LongCat 2.0",provider:"siliconflow",contextWindow:1e6,pricing:Yt(.1,5,20),supportsVision:!1,clientType:"openai",baseUrl:zr},{modelId:"moonshotai/Kimi-K2.7-Code",displayName:"Kimi K2.7 Code",provider:"siliconflow",contextWindow:262144,pricing:Yt(1.3,6.5,27),supportsVision:!0,clientType:"openai",baseUrl:zr},{modelId:"Pro/moonshotai/Kimi-K2.6",displayName:"Kimi K2.6",provider:"siliconflow",contextWindow:262144,pricing:Yt(1.1,6.5,27),supportsVision:!0,clientType:"openai",baseUrl:zr},{modelId:"Pro/zai-org/GLM-5.1",displayName:"GLM-5.1",provider:"siliconflow",contextWindow:2e5,pricing:Yt(1.3,6,24),supportsVision:!1,clientType:"openai",baseUrl:zr},{modelId:"Qwen/Qwen3.6-35B-A3B",displayName:"Qwen 3.6 35B A3B",provider:"siliconflow",contextWindow:262144,pricing:Yt(1.8,1.8,10.8),supportsVision:!0,clientType:"openai",baseUrl:zr},{modelId:"zai-org/GLM-5.2",displayName:"GLM-5.2",provider:"siliconflow",contextWindow:1e6,pricing:Yt(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:zr},{modelId:"deepseek-v4-flash-0731",displayName:"DeepSeek V4 Flash 0731",provider:"qwen-token-plan",contextWindow:1e6,pricing:Yt(.2,1,2),supportsVision:!1,clientType:"openai",baseUrl:Pl},{modelId:"deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"qwen-token-plan",contextWindow:1e6,pricing:Yt(1,12,24),supportsVision:!1,clientType:"openai",baseUrl:Pl},{modelId:"glm-5.2",displayName:"GLM-5.2",provider:"qwen-token-plan",contextWindow:1048576,pricing:Yt(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:Pl},{modelId:"qwen3.8-max",displayName:"Qwen 3.8 Max",provider:"qwen-token-plan",contextWindow:1e6,pricing:Yt(1.5,12,36),supportsVision:!0,clientType:"openai",baseUrl:Pl},{modelId:"qwen3.7-plus",displayName:"Qwen 3.7 Plus",provider:"qwen-token-plan",contextWindow:1e6,pricing:Yt(.4,2,8),supportsVision:!0,clientType:"openai",baseUrl:Pl},{modelId:"deepseek-v4-flash-0731",displayName:"DeepSeek V4 Flash 0731",provider:"qwen-pay-as-you-go",contextWindow:1e6,pricing:Yt(.2,1,2),supportsVision:!1,clientType:"openai",baseUrl:Fl},{modelId:"kimi/kimi-k3",displayName:"Kimi K3",provider:"qwen-pay-as-you-go",contextWindow:1048576,pricing:Yt(2,20,100),supportsVision:!0,clientType:"openai",baseUrl:Fl},{modelId:"qwen3.8-max",displayName:"Qwen 3.8 Max",provider:"qwen-pay-as-you-go",contextWindow:1e6,pricing:Yt(1.5,12,36),supportsVision:!0,clientType:"openai",baseUrl:Fl},{modelId:"qwen3.7-plus",displayName:"Qwen 3.7 Plus",provider:"qwen-pay-as-you-go",contextWindow:1e6,pricing:Yt(.4,2,8),supportsVision:!0,clientType:"openai",baseUrl:Fl},{modelId:"ZHIPU/GLM-5.2",displayName:"GLM-5.2",provider:"qwen-pay-as-you-go",contextWindow:1048576,pricing:Yt(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:Fl},{modelId:"gemini-3.6-flash",displayName:"Gemini 3.6 Flash",provider:"google",contextWindow:1048576,pricing:_e(.15,1.5,7.5),supportsVision:!0},{modelId:"gemini-3.5-flash",displayName:"Gemini 3.5 Flash",provider:"google",contextWindow:1048576,pricing:_e(.15,1.5,9),supportsVision:!0},{modelId:"gemini-3.5-flash-lite",displayName:"Gemini 3.5 Flash-Lite",provider:"google",contextWindow:1048576,pricing:_e(.03,.3,2.5),supportsVision:!0},{modelId:"gemini-3.1-flash-lite",displayName:"Gemini 3.1 Flash-Lite",provider:"google",contextWindow:1048576,pricing:_e(.025,.25,1.5),supportsVision:!0},{modelId:"gemini-3.1-pro-preview",displayName:"Gemini 3.1 Pro (Preview)",provider:"google",contextWindow:1048576,pricing:_e(.2,2,12),supportsVision:!0},{modelId:"gemini-3-flash-preview",displayName:"Gemini 3 Flash (Preview)",provider:"google",contextWindow:1048576,pricing:_e(.05,.5,3),supportsVision:!0},{modelId:"claude-fable-5",displayName:"Claude Fable 5",provider:"anthropic",contextWindow:1e6,pricing:_e(1,12.5,50),supportsVision:!0},{modelId:"claude-opus-4-8",displayName:"Claude Opus 4.8",provider:"anthropic",contextWindow:1e6,pricing:_e(.5,6.25,25),supportsVision:!0},{modelId:"claude-opus-4-7",displayName:"Claude Opus 4.7",provider:"anthropic",contextWindow:1e6,pricing:_e(.5,6.25,25),supportsVision:!0},{modelId:"claude-sonnet-5",displayName:"Claude Sonnet 5",provider:"anthropic",contextWindow:1e6,pricing:_e(.2,2.5,10),supportsVision:!0},{modelId:"claude-sonnet-4-6",displayName:"Claude Sonnet 4.6",provider:"anthropic",contextWindow:1e6,pricing:_e(.3,3.75,15),supportsVision:!0},{modelId:"gpt-5.5",displayName:"GPT-5.5",provider:"openai",contextWindow:105e4,pricing:_e(.5,5,30),supportsVision:!0},{modelId:"gpt-5.5-pro",displayName:"GPT-5.5 Pro",provider:"openai",contextWindow:105e4,pricing:_e(30,30,180),supportsVision:!0},{modelId:"gpt-5.4",displayName:"GPT-5.4",provider:"openai",contextWindow:105e4,pricing:_e(.25,2.5,15),supportsVision:!0},{modelId:"gpt-5.4-mini",displayName:"GPT-5.4 mini",provider:"openai",contextWindow:4e5,pricing:_e(.075,.75,4.5),supportsVision:!0},{modelId:"gpt-5.4-nano",displayName:"GPT-5.4 nano",provider:"openai",contextWindow:4e5,pricing:_e(.02,.2,1.25),supportsVision:!0},{modelId:"gpt-5.4-pro",displayName:"GPT-5.4 Pro",provider:"openai",contextWindow:105e4,pricing:_e(30,30,180),supportsVision:!0},{modelId:"glm-5.2",displayName:"GLM-5.2",provider:"zhipu",contextWindow:1e6,pricing:_e(.26,1.4,4.4),supportsVision:!1},{modelId:"glm-5.1",displayName:"GLM-5.1",provider:"zhipu",contextWindow:2e5,pricing:_e(.26,1.4,4.4),supportsVision:!1},{modelId:"glm-5",displayName:"GLM-5",provider:"zhipu",contextWindow:2e5,pricing:_e(.2,1,3.2),supportsVision:!1},{modelId:"kimi-k3",displayName:"Kimi K3",provider:"moonshot",contextWindow:1048576,pricing:Yt(2,20,100),supportsVision:!0},{modelId:"kimi-k2.6",displayName:"Kimi K2.6",provider:"moonshot",contextWindow:262144,pricing:Yt(1.1,6.5,27),supportsVision:!0},{modelId:"kimi-k2.5",displayName:"Kimi K2.5",provider:"moonshot",contextWindow:262144,pricing:Yt(.7,4,21),supportsVision:!0}];function Fp(e,n){return F2.find(r=>r.provider===e&&r.modelId===n)}function Br(e){return js.find(n=>n.id===e)}function F8(e,n){const r=(n||e).toLowerCase(),s=o=>({envKey:`${o}_API_KEY`,envBaseUrlKey:`${o}_BASE_URL`});if(r.includes("gemini-3")||r.includes("gemini-embedding"))return s("GEMINI");if(r.includes("claude")&&(r.includes("4-7")||r.includes("4-8")||r.includes("-5")||r.includes("4-6")))return s("ANTHROPIC");if(r.includes("gpt-5.4")||r.includes("gpt-5.5"))return s("OPENAI");if(r.includes("glm-5"))return s("ZAI");if(r.includes("kimi-k3")||r.includes("kimi-k2.5")||r.includes("kimi-k2.6"))return s("MOONSHOT");if(r.includes("deepseek-v4"))return s("DEEPSEEK");if(r.includes("openai"))return s("OPENAI")}function q8(){return F2.map(e=>({provider:e.provider,model_id:e.modelId,...e.contextWindow!==void 0?{context_window:e.contextWindow}:{},...e.clientType!==void 0?{client_type:e.clientType}:{},...e.pricing?{pricing:{...e.pricing}}:{},...e.supportsVision?{}:{vision:!1},...e.baseUrl!==void 0?{base_url:e.baseUrl}:{}}))}function sb(e,n){if(e==="openrouter")return`https://openrouter.ai/${n}`;if(e==="qwen-token-plan")return`https://www.qianwenai.com/models/${n}`;if(e==="fireworks"){const r=/^accounts\/([^/]+)\/models\/(.+)$/.exec(n);return r?`https://app.fireworks.ai/models/${r[1]}/${r[2]}`:Br(e)?.modelsUrl}if(e==="qwen-pay-as-you-go")return`https://www.qianwenai.com/models/${encodeURIComponent(n)}`;if(e==="zhipu")return`https://docs.z.ai/guides/llm/${n}`;if(e==="moonshot"){const r=/^kimi-k(\d+)\.(\d+)$/.exec(n);return r?`https://platform.kimi.com/docs/pricing/chat-k${r[1]}${r[2]}`:Br(e)?.modelsUrl}if(e!=="custom")return Br(e)?.modelsUrl}function vt(e,n){return!!e&&!!n&&e.provider===n.provider&&e.modelId===n.modelId}function q2(e){return{id:e,label:e,envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL"}}function V2(e,n){const r=n.trim().toLowerCase();if(!r)return!0;const s=js.find(o=>o.id===e.provider);return e.modelId.toLowerCase().includes(r)||(e.displayName??"").toLowerCase().includes(r)||e.provider.toLowerCase().includes(r)||(s?.label??"").toLowerCase().includes(r)}function G2(e,n){const r=n.trim()!=="",s=e.filter(f=>V2(f,n)),o=js.map(f=>({provider:f,rows:s.filter(m=>m.provider===f.id)})),d=[...new Set(s.map(f=>f.provider).filter(f=>!js.some(m=>m.id===f)))].sort().map(f=>({provider:q2(f),rows:s.filter(m=>m.provider===f)}));return[...o,...d].filter(f=>f.rows.length>0||!r&&f.provider.id==="custom")}function V8(e){return G2(e,"").flatMap(n=>n.rows)}function Dh(e){return!!e.credential?.apiKeyMasked}function W2(e){return e?[e.cacheRead,e.cacheWrite,e.output].every(n=>typeof n=="string"?n.trim()!==""&&Number(n)===0:n===0):!1}function lb(e,{showAll:n,query:r,selected:s,defaultModel:o}){const c=V8(e);return(n||!c.some(Dh)?c:c.filter(f=>Dh(f)||vt(f,s)||vt(f,o))).filter(f=>V2(f,r))}const G8=/^[\w-]*$/;function ib(e,n){const r=e.slice(0,n),s=r.lastIndexOf("/");if(s<0||s>0&&!/\s/.test(r[s-1]))return null;const o=r.slice(s+1);if(!G8.test(o))return null;const c=/^[\w-]*/.exec(e.slice(n))[0];return{start:s,end:n+c.length,query:o}}function W8(e,n){const r=e.slice(0,n.start),s=e.slice(n.end),o=r.endsWith(" ")&&s.startsWith(" ")?r+s.slice(1):r+s;return/^\s*$/.test(o)?"":o}const K8=["none","low","medium","high","xhigh"],Y8=["low","medium","high","xhigh"];function Q8(e,n){return n&&K8.includes(n)?e[n]??n:null}function X8(e,n,r){const s=e.filter(([o])=>o!=="").map(([o,c])=>({value:o,triggerLabel:o,label:o,description:c}));return r==="none"&&s.push({value:"none",triggerLabel:"none",label:"none",description:n}),s}function K2(e){if(gk(e)||yk(e))return null;const n=bk(e),r=n?n.rest:e,s=xk(r),o=s?s.rest:r,c=hk(o),{text:d}=Uu(c?c.rest:o);return{body:d.trim(),...n?{goalRound:n.round}:{},scheduled:s!==null}}function Z8(e){const n=[],r=s=>{s!==""&&n[n.length-1]!==s&&n.push(s)};for(const s of e)if(s.kind==="user_text"){const o=K2(s.text);if(!o||o.scheduled||o.goalRound!==void 0&&o.goalRound>1)continue;r(o.body)}else s.kind==="user_steering"&&r(Uu(s.text).text.trim());return n}function J8(e,n,r){if(e.length===0)return null;if(n===null){if(r.trim()!=="")return null;const c=e.length-1,d=e[c];return{nav:{index:c,stash:r,recalled:d},text:d}}if(r!==n.recalled)return null;if(n.index===0)return{nav:n,text:n.recalled};const s=n.index-1,o=e[s];return{nav:{...n,index:s,recalled:o},text:o}}function e_(e,n,r){if(n===null||r!==n.recalled)return null;if(n.index>=e.length-1)return{nav:null,text:n.stash};const s=n.index+1,o=e[s];return{nav:{...n,index:s,recalled:o},text:o}}function t_(e,n){return!e.slice(0,n).includes(`
|
|
171
|
-
`)}function n_(e,n){return!e.slice(n).includes(`
|
|
172
|
-
`)}function a_(e){if(e.sending)return"disabled";const n=!e.goalOn&&!e.modelAuthDead;return n&&e.canSteerChannel&&!e.hasHandoffTarget&&!e.hasPendingModel&&(e.hasText||e.hasImages||e.hasFiles)&&!e.followUpMode?"steer":n&&e.canQueueChannel&&e.stagedRoute!=="blocked"&&e.hasContent?"queue":"stop"}const r_=["always-ask","read-only","allow-all","deny-all"],ob={"allow-all":"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0zM12 9v4m0 4h.01","deny-all":"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM5.64 5.64l12.72 12.72","read-only":"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7zM15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0z","always-ask":"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM9.1 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3m.07 4h.01"};function s_({value:e,onChange:n,disabled:r,direction:s="up"}){const[o,c]=v.useState(!1);return l.jsx(ha,{open:o,setOpen:c,menuClass:"w-max",portal:{direction:s,align:"left"},button:l.jsxs("button",{type:"button","aria-label":g.chat.approvalMode,title:`${g.chat.approvalMode}:${g.chat.approvalModeNames[e]??e}`,disabled:r,onClick:()=>c(d=>!d),className:"flex h-8 max-w-44 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:[l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"shrink-0",children:l.jsx("path",{d:ob[e]})}),l.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:g.chat.approvalModeNames[e]??e}),l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:l.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:r_.map(d=>l.jsxs("button",{type:"button",onClick:()=>{n(d),c(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800 ${d===e?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"}`,children:[l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"shrink-0 text-gray-400 dark:text-gray-500",children:l.jsx("path",{d:ob[d]})}),l.jsx("span",{className:"min-w-0 flex-1 truncate whitespace-nowrap",children:g.chat.approvalModes[d]??d}),l.jsx("span",{className:"w-3 shrink-0 text-center",children:d===e?"✓":""})]},d))})}function yo(e){return e.displayName??e.modelId}const l_="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4M2 2l20 20";function Y2({items:e,itemKey:n,isCurrent:r,query:s,onQueryChange:o,searchPlaceholder:c,emptyText:d,onPick:f,renderRow:m,footer:h}){const[p,y]=v.useState(-1),k=p>=0&&p<e.length?n(e[p]):null,w=S=>{if(e.length!==0){if(S.key==="ArrowDown"){S.preventDefault(),y(T=>(T+1)%e.length);return}if(S.key==="ArrowUp"){S.preventDefault(),y(T=>T<=0?e.length-1:T-1);return}(S.key==="Enter"&&!S.shiftKey||S.key==="Tab")&&!S.nativeEvent.isComposing&&(S.preventDefault(),f(e[p>=0?p:0]))}};return l.jsxs("div",{className:"contents",onKeyDown:w,children:[l.jsx("div",{className:"border-b border-gray-100 px-2 pb-1.5 pt-0.5 dark:border-gray-800",children:l.jsx("input",{autoFocus:!0,value:s,onChange:S=>{o(S.target.value),y(-1)},placeholder:c,"aria-label":c,...rd,className:"w-full rounded border border-transparent bg-transparent px-1 py-0.5 text-xs text-gray-700 placeholder:text-gray-400 focus:outline-none dark:text-gray-200 dark:placeholder:text-gray-500"})}),l.jsxs("div",{className:"max-h-56 overflow-y-auto",children:[e.length===0&&l.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:d}),e.map(S=>{const T=n(S),M=r?.(S)??!1;return l.jsxs("button",{type:"button",ref:T===k?E=>E?.scrollIntoView({block:"nearest"}):void 0,onClick:()=>f(S),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800 ${M?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"}${T===k?" bg-gray-100 dark:bg-gray-800":""}`,children:[m(S),l.jsx("span",{className:"w-3 shrink-0 text-center text-xs",children:M?"✓":""})]},T)})]}),h]})}function Q2({models:e,value:n,defaultModel:r,onPick:s}){const[o,c]=v.useState(""),[d,f]=v.useState(!1),m=lb(e,{showAll:d,query:o,selected:n,defaultModel:r}),h=d?0:lb(e,{showAll:!0,query:o,selected:n,defaultModel:r}).length-m.length;return l.jsx(Y2,{items:m,itemKey:p=>`${p.provider}:${p.modelId}`,isCurrent:p=>vt(p,n),query:o,onQueryChange:c,searchPlaceholder:g.models.searchPlaceholder,emptyText:g.models.noSearchResults,onPick:s,renderRow:p=>l.jsxs(l.Fragment,{children:[l.jsx(Xl,{provider:p.provider,className:"h-4 w-4 shrink-0"}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:yo(p)}),W2(p.pricing)&&l.jsx("span",{className:"shrink-0",children:l.jsx(Jt,{tone:"yellow",children:g.models.freeBadge})}),!Dh(p)&&l.jsx("span",{role:"img",title:g.models.noKey,"aria-label":g.models.noKey,className:"shrink-0 text-gray-400 dark:text-gray-500",children:l.jsx(Ue,{d:l_,size:13})}),vt(p,r)&&l.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",children:g.models.default})]}),...h>0?{footer:l.jsx("div",{className:"border-t border-gray-100 dark:border-gray-800",children:l.jsx("button",{type:"button",onClick:()=>f(!0),className:"flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-600 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-300",children:g.models.showModelsWithoutKey(h)})})}:{}})}function i_({models:e,value:n,defaultModel:r,onChange:s,disabled:o}){const[c,d]=v.useState(!1),f=e.find(h=>vt(h,n)),m=f?yo(f):n?.modelId??"…";return l.jsx(ha,{open:c,setOpen:d,menuClass:"w-max min-w-56 origin-top-right",portal:{direction:"down",align:"right"},button:l.jsxs("button",{type:"button",title:`${g.chat.chooseModel}:${m}`,"aria-label":g.chat.chooseModel,disabled:o||e.length===0,onClick:()=>d(!c),className:"flex h-8 max-w-44 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:[l.jsx(Xl,{provider:f?.provider??n?.provider??"custom",className:"h-4 w-4 shrink-0"}),l.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:m}),l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:l.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:l.jsx(Q2,{models:e,value:n,...r!==void 0?{defaultModel:r}:{},onPick:h=>{s({provider:h.provider,modelId:h.modelId}),d(!1)}})})}function o_({agents:e,currentAgentId:n,onPick:r}){const[s,o]=v.useState("");return l.jsx(Y2,{items:w8(e,s),itemKey:c=>c.agentId,isCurrent:c=>c.agentId===n,query:s,onQueryChange:o,searchPlaceholder:g.chat.agentSearchPlaceholder,emptyText:g.chat.agentsNoMatch,onPick:r,renderRow:c=>l.jsxs(l.Fragment,{children:[l.jsx(pa,{id:c.agentId,name:hn(c),size:16,className:"shrink-0 rounded"}),l.jsx("span",{className:"shrink-0 font-mono text-gray-800 dark:text-gray-200",children:c.agentId}),c.name&&c.name!==c.agentId&&l.jsx("span",{className:"min-w-0 flex-1 truncate text-gray-400 dark:text-gray-500",children:c.name})]})})}function cb({panelRef:e,maxHeight:n,title:r,children:s}){return l.jsxs("div",{ref:e,style:{maxHeight:n},className:"anim-pop absolute bottom-full left-0 z-40 mb-1.5 flex w-80 max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900",children:[l.jsx("div",{className:"border-b border-gray-100 px-3 pb-1.5 pt-0.5 text-xs font-semibold text-gray-500 dark:border-gray-800 dark:text-gray-400",children:r}),s]})}const c_="M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z";function ub({value:e,onChange:n,disabled:r,direction:s="down"}){const[o,c]=v.useState(!1),d=e===null?"…":Q8(g.chat.thinkingLevelNames,e)??"—";return l.jsxs(ha,{open:o,setOpen:c,menuClass:"w-max min-w-36",portal:{direction:s,align:"right"},button:l.jsxs("button",{type:"button",title:`${g.chat.thinkingLevel}:${d}`,"aria-label":g.chat.thinkingLevel,disabled:r||e===null,onClick:()=>c(!o),className:"flex h-8 max-w-36 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:[l.jsx(Ue,{d:c_,size:14,className:"shrink-0"}),l.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:d}),l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:l.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:[l.jsx("div",{className:"border-b border-gray-100 px-3 pb-1.5 pt-0.5 text-xs font-semibold text-gray-500 dark:border-gray-800 dark:text-gray-400",children:g.chat.thinkingLevel}),Y8.map(f=>l.jsxs("button",{type:"button",onClick:()=>{n(f),c(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800 ${f===e?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"}`,children:[l.jsx("span",{className:"min-w-0 flex-1 truncate",children:g.chat.thinkingLevelNames[f]??f}),l.jsx("span",{className:"w-3 shrink-0 text-center",children:f===e?"✓":""})]},f))]})}const X2="penguin.steerMode";function u_(){return localStorage.getItem(X2)==="followup"?"followup":"steer"}const d_="M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6";function f_({steerMode:e,onChangeSteerMode:n}){const r=(s,o,c)=>l.jsx("button",{type:"button",title:c,"aria-pressed":e===s,onClick:()=>n(s),className:`h-5 rounded px-1.5 text-xs transition-colors duration-150 ${e===s?"bg-gray-200 font-medium text-gray-800 dark:bg-gray-700 dark:text-gray-100":"text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200"}`,children:o});return l.jsxs("div",{className:"flex w-full items-center gap-2 px-3 py-1 text-xs",children:[l.jsx(Ue,{d:d_,size:14,className:"shrink-0 text-gray-400 dark:text-gray-500"}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-gray-600 dark:text-gray-400",children:g.chat.steerModeLabel}),l.jsxs("div",{role:"group","aria-label":g.chat.steerModeLabel,className:"flex shrink-0 items-center gap-0.5",children:[r("steer",g.chat.steerModeSteer,g.chat.steerModeSteerHint),r("followup",g.chat.steerModeFollowUp,g.chat.steerModeFollowUpHint)]})]})}function m_({skills:e,selected:n,onToggle:r,disabled:s,direction:o="up"}){const{locale:c}=Ja(),[d,f]=v.useState(!1),[m,h]=v.useState(""),p=x8(e,c,m);return l.jsxs(ha,{open:d,setOpen:f,menuClass:"w-[26rem]",portal:{direction:o,align:"left"},button:l.jsxs("button",{type:"button","aria-label":g.chat.skillsSelect,title:g.chat.skillsSelect,disabled:s,onClick:()=>{const y=!d;f(y),y&&h("")},className:"flex h-8 max-w-44 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 disabled:cursor-not-allowed disabled:opacity-50 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:[l.jsx(Ue,{d:Hp,size:14,className:"shrink-0"}),l.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:g.chat.skillsSelect}),n.length>0&&l.jsx("span",{className:"shrink-0 rounded-full bg-gray-200/80 px-1.5 py-px font-mono text-[10px] font-semibold text-gray-700 dark:bg-gray-700/60 dark:text-gray-200",children:n.length}),l.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:l.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:[l.jsx("div",{className:"border-b border-gray-100 px-2 pb-1.5 pt-0.5 dark:border-gray-800",children:l.jsx("input",{autoFocus:!0,value:m,onChange:y=>h(y.target.value),placeholder:g.chat.skillsSearchPlaceholder,"aria-label":g.chat.skillsSearchPlaceholder,...rd,className:"w-full rounded border border-transparent bg-transparent px-1 py-0.5 text-xs text-gray-700 placeholder:text-gray-400 focus:outline-none dark:text-gray-200 dark:placeholder:text-gray-500"})}),l.jsx("div",{className:"max-h-56 overflow-y-auto",children:e.length===0?l.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:g.chat.skillsEmptyHint}):p.length===0?l.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:g.chat.skillsNoMatch}):p.map(y=>{const k=n.includes(y.name);return l.jsxs("button",{type:"button","aria-pressed":k,onClick:()=>r(y.name),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800 ${k?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"}`,children:[l.jsx(Pp,{icon:y.icon,size:14,className:"shrink-0 text-gray-400 dark:text-gray-500"}),l.jsx("span",{className:"shrink-0 font-mono",children:y.name}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-gray-400 dark:text-gray-500",children:Po(c,y)}),l.jsx("span",{className:"w-3 shrink-0 text-center",children:k?"✓":""})]},y.name)})})]})}const h_="M6 5h12a3 3 0 0 1 3 3v8a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V8a3 3 0 0 1 3-3zM3 15l5-5 4 4 3-3 6 6";function p_({items:e,footer:n,direction:r="up"}){const[s,o]=v.useState(!1);return l.jsxs(ha,{open:s,setOpen:o,menuClass:"w-72",portal:{direction:r,align:"left"},button:l.jsx("button",{type:"button","aria-label":g.chat.plusMenu,title:g.chat.plusMenu,onClick:()=>o(!s),className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:l.jsx(Ue,{d:"M12 5v14M5 12h14",size:15,className:"shrink-0"})}),children:[e.map(c=>l.jsxs("button",{type:"button","aria-pressed":c.active,disabled:c.disabled,onClick:()=>{o(!1),c.onSelect()},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-xs transition-colors duration-150 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent dark:hover:bg-gray-800 dark:disabled:hover:bg-transparent ${c.active?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"}`,children:[l.jsx(Ue,{d:c.icon,size:14,className:"shrink-0 text-gray-400 dark:text-gray-500"}),l.jsx("span",{className:"shrink-0",children:c.label}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-gray-400 dark:text-gray-500",children:c.desc}),l.jsx("span",{className:"w-3 shrink-0 text-center",children:c.active?"✓":""})]},c.key)),n&&l.jsx("div",{className:"mt-1 border-t border-gray-100 pt-1 dark:border-gray-800",children:n})]})}function g_({now:e,window:n,unknown:r=!1}){const s=P2(n),o=r?0:Math.min(1,e/s),c=r||o<=.8?"text-gray-400 dark:text-gray-500":o>.95?"text-red-500":"text-amber-500",d=5,f=2*Math.PI*d;return l.jsxs("span",{title:r?g.chat.contextUnknown:`${g.chat.contextUsage} ${Math.round(o*100)}%`,className:`flex shrink-0 items-center gap-1 font-mono ${c}`,children:[l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":!0,className:"block shrink-0",children:[l.jsx("circle",{cx:"7",cy:"7",r:d,fill:"none",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"2"}),l.jsx("circle",{cx:"7",cy:"7",r:d,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:`${f*o} ${f}`,transform:"rotate(-90 7 7)"})]}),l.jsxs("span",{className:"hidden @md:inline",children:[r?"—":ft(e),"/",ft(s)]})]})}const x_=10*1024*1024;function y_(e){return new Promise(n=>{const r=new FileReader;r.onload=()=>n(typeof r.result=="string"?r.result:null),r.onerror=()=>n(null),r.readAsDataURL(e)})}function b_(e){const n=[],r=e.text.replace(/\s+/g," ").trim();return r&&n.push(r),e.images>0&&n.push(g.chat.imagesInMessage(e.images)),e.files>0&&n.push(g.chat.filesInMessage(e.files)),n.join(" · ")}function v_(e,n,r){for(const s of n)e.push({type:"image_url",imageUrl:s});for(const s of r)e.push({type:"file",fileName:s.name,dataUrl:s.dataUrl})}function Z2({status:e,onSend:n,onSteer:r,steeringDeliveredCount:s,pendingSteering:o=[],onQueueFollowUp:c,queuedFollowUps:d=0,onStop:f,onCompact:m,modelRef:h,models:p,onChangeModel:y,onSwitchModel:k,defaultModel:w,thinkingLevel:S,onChangeThinkingLevel:T,turnThinkingLevel:M,onChangeTurnThinkingLevel:E,contextWindow:R,contextNow:I,contextStale:H=!1,vision:D,approvalMode:L,onChangeApprovalMode:$,modeSaving:K,autoFocus:X,agents:U,currentAgentId:V,skills:O,initialSkills:W,onSkillsChange:Z,onHandoff:B,initialText:F,onTextChange:P,history:ce=[],initialHandoffTargetId:oe,onHandoffTargetChange:A,initialPendingModelRef:C,onPendingModelChange:z,modelAuthDead:N=!1,onOpenModels:Q,onRetryModelAuth:se,onNewSession:le}){const{locale:he}=Ja(),[xe,ne]=v.useState(F??""),pe=v.useRef(xe);pe.current=xe;const[be,Fe]=v.useState([]),[qe,$e]=v.useState([]),[Ye,Et]=v.useState(!1),[kn,je]=v.useState(0),[We,jt]=v.useState(null),[yt,Qt]=v.useState(!1),wn=v.useRef(null),[Xe,ba]=v.useState(!1),ue=v.useRef(null),ye=v.useRef(null),[Ne,He]=v.useState(),[De,At]=v.useState(null),[Rt,$t]=v.useState(null),[Ke,Wt]=v.useState(W??[]),[Ze,dn]=v.useState(0),lt=v.useRef(null),na=v.useRef(null),[Hn]=v.useState(()=>window.matchMedia("(max-width: 767px)").matches),_t=e==="running",En=e==="compacting",Ut=xe.trim().length>0||be.length>0||qe.length>0||De!==null||Rt!==null||Ke.length>0,[Nt,Dn]=v.useState(!1),[va,Ha]=v.useState(""),[Pn,xn]=v.useState(!1),[Fn,ke]=v.useState(""),Ee=Nt?iu(va):null,Qe=iu(Fn)===null,Bt=Ee!==null&&Ee!==Bp?g.chat.goalBudgetValue(ft(Ee)):g.chat.goalBudgetUnlimited,pt=S8({handoffTarget:De!==null,pendingModel:Rt!==null,canSwitchModel:k!==void 0,sessionBusy:_t||En}),Sn=!_t&&!En&&!Ye&&!N&&(Nt?xe.trim().length>0&&qe.length===0&&Ee!==null&&!(Pn&&Qe):Ut),jn=v.useCallback(te=>{if(te){ke(va),xn(!0);return}iu(Fn)!==null&&(Ha(Fn.trim()),xn(!1))},[va,Fn]),bt=v.useCallback(()=>{xn(!1),lt.current?.focus()},[]),Kt=v.useCallback(()=>{iu(Fn)!==null&&(Ha(Fn.trim()),xn(!1),lt.current?.focus())},[Fn]),fn=v.useCallback(te=>{Dn(te),xn(!1),ke(""),te&&(Ha(""),At(null),A?.(null),$t(null),z?.(null),$e([]))},[A,z]),[Pr,ol]=v.useState(u_),ai=te=>{ol(te),localStorage.setItem(X2,te)},xr=Pr==="followup"&&c!==void 0,qn=a_({sending:Ye,goalOn:Nt,modelAuthDead:N,canSteerChannel:r!==void 0,canQueueChannel:c!==void 0,followUpMode:xr,stagedRoute:pt,hasHandoffTarget:De!==null,hasPendingModel:Rt!==null,hasText:xe.trim().length>0,hasImages:be.length>0,hasFiles:qe.length>0,hasContent:Ut}),yr=_t&&qn==="steer",Pa=_t&&qn==="queue",er=yr||Pa,tr=qn==="queue"?g.chat.followUpSend:g.chat.steerSend,An=_t&&qn==="stop",[It,Ms]=v.useState(!1),Es=v.useRef(0);v.useEffect(()=>{It&&(!_t||(s??0)>Es.current)&&Ms(!1)},[It,_t,s]);const zn=v.useCallback(te=>{const we=Ke.includes(te)?Ke.filter(ze=>ze!==te):[...Ke,te];Wt(we),Z?.(we)},[Ke,Z]),ka=v.useRef(null),ri=v.useMemo(()=>{const te=()=>{const we=ka.current,ze=we?W8(pe.current,we):"";ne(ze),P?.(ze)};return[{cmd:"/compact",desc:g.chat.compact,run:()=>{te(),m()}},{cmd:"/goal",desc:g.chat.goalModeDesc,run:()=>{te(),fn(!Nt)}},...k&&p&&p.length>0?[{cmd:"/model",desc:g.chat.switchModel,run:()=>{te(),Qt(!0)}}]:[],...B&&U.length>0?[{cmd:"/agent",desc:g.chat.switchAgent,run:()=>{te(),ba(!0)}}]:[],...y8(O,he).map(we=>({cmd:we.cmd,desc:we.desc,run:()=>{te(),zn(we.name)}}))]},[m,k,p,U,P,O,he,zn,fn,Nt]),nr=!_t&&!En&&!yt&&!Xe?ib(xe,Ze):null;ka.current=nr;const wa=nr&&nr.start!==We?ri.filter(te=>te.cmd.startsWith(`/${nr.query}`)):[],Fr=wa.length>0,ar=wa[Math.min(kn,wa.length-1)];v.useEffect(()=>{if(!yt&&!Xe)return;const te=()=>{Qt(!1),ba(!1),lt.current?.focus()},we=ct=>{const at=yt?wn.current:ue.current;at&&!at.contains(ct.target)&&te()},ze=ct=>{ct.key==="Escape"&&!ct.isComposing&&te()};return window.addEventListener("mousedown",we),window.addEventListener("keydown",ze),()=>{window.removeEventListener("mousedown",we),window.removeEventListener("keydown",ze)}},[yt,Xe]);const ae=te=>{$t(te),z?.(te?{provider:te.provider,modelId:te.modelId}:null)},ve=te=>{if(Qt(!1),lt.current?.focus(),vt(te,h)){ae(null);return}ae(te),At(null),A?.(null),Dn(!1)},Ie=te=>{ba(!1),At(te),A?.(te.agentId),ae(null),Dn(!1),lt.current?.focus()},it=()=>{De!==null&&(At(null),A?.(null)),ae(null)};v.useEffect(()=>{if(!Fr&&!yt&&!Xe)return;const te=()=>{const we=ye.current;if(!we)return;let ze=0;for(let at=we.parentElement;at;at=at.parentElement)if(getComputedStyle(at).overflowY!=="visible"){ze=at.getBoundingClientRect().top;break}const ct=we.getBoundingClientRect().top-ze-14;He(Math.max(96,Math.min(320,Math.round(ct))))};return te(),window.addEventListener("resize",te),()=>window.removeEventListener("resize",te)},[Fr,yt,Xe]);const qt=()=>{const te=lt.current;te&&(te.style.height="auto",te.style.height=`${Math.min(te.scrollHeight,176)}px`)};v.useLayoutEffect(qt,[xe]),v.useEffect(()=>{const te=na.current;te&&xe!==te.recalled&&(na.current=null)},[xe]),v.useEffect(()=>{const te=lt.current;if(te&&te.value.length>0){const we=te.value.length;te.setSelectionRange(we,we),te.scrollTop=te.scrollHeight,dn(we)}},[]);const Lt=v.useRef(!1);v.useEffect(()=>{if(!Lt.current&&(Lt.current=!0,O.length===0))return;const te=Ke.filter(we=>O.some(ze=>ze.name===we));te.length!==Ke.length&&(Wt(te),Z?.(te))},[O,Ke,Z]);const en=De!==null||Rt!==null||Nt,yn=v.useRef(!1);v.useEffect(()=>{if(yn.current||!oe||U.length===0||(yn.current=!0,en))return;const te=U.find(we=>we.agentId===oe);te&&At(te)},[U,oe,en]);const rr=v.useRef(!1);v.useEffect(()=>{if(rr.current||!C||!p||p.length===0||(rr.current=!0,en||!k))return;const te=p.find(we=>vt(we,C));te&&!vt(te,h)&&$t(te)},[p,C,h,k,en]);const an=async(te=n)=>{const we=xe.trim();if(Nt){Et(!0);try{const As=[{type:"text",text:gh(Ke,we)}];for(const Wr of be)As.push({type:"image_url",imageUrl:Wr});await n(As,{budget:Ee})&&(ne(""),Fe([]),Wt([]),fn(!1))}finally{Et(!1),lt.current?.focus()}return}if(pt==="blocked")return;const ze=pt==="model"?Rt:null,ct=we!==""?we:Ke.length>0?g.chat.skillsAutoMessage(Ke):ze?g.chat.modelSwitchAutoMessage:we,at=gh(Ke,ct),ja=[];at&&ja.push({type:"text",text:at}),v_(ja,be,qe),Et(!0);try{(De?await B(De,ja):ze?await k({provider:ze.provider,modelId:ze.modelId},ja):await te(ja,null))&&(ne(""),Fe([]),$e([]),At(null),$t(null),Wt([]))}finally{Et(!1),lt.current?.focus()}},Sa=async()=>{if(_t){if(Pa){await an(c);return}if(!yr)return;const te=xe.trim(),we=be,ze=qe.map(at=>({fileName:at.name,dataUrl:at.dataUrl}));Et(!0);let ct="failed";try{ct=await r(te,we,ze),ct==="queued"&&(Es.current=s??0,Ms(!0),ne(""),Fe([]),$e([]))}finally{Et(!1),lt.current?.focus()}ct==="not_running"&&await an();return}Sn&&await an()},qr=te=>{na.current=te.nav,ne(te.text),P?.(te.text),dn(te.text.length),requestAnimationFrame(()=>{const we=lt.current;we&&(we.setSelectionRange(we.value.length,we.value.length),we.scrollTop=we.scrollHeight)})},Vr=te=>{if(Fr){if(te.key==="ArrowDown"){te.preventDefault(),je(we=>(we+1)%wa.length);return}if(te.key==="ArrowUp"){te.preventDefault(),je(we=>(we-1+wa.length)%wa.length);return}if((te.key==="Enter"&&!te.shiftKey||te.key==="Tab")&&!te.nativeEvent.isComposing){te.preventDefault(),ar?.run();return}if(te.key==="Escape"){jt(nr?.start??null);return}}if((te.key==="ArrowUp"||te.key==="ArrowDown")&&!te.nativeEvent.isComposing){const we=te.currentTarget.selectionStart??0,ze=te.currentTarget.selectionEnd??we,ct=te.key==="ArrowUp"?t_(xe,we)?J8(ce,na.current,xe):null:n_(xe,ze)?e_(ce,na.current,xe):null;if(ct){te.preventDefault(),qr(ct);return}}if(te.key==="Backspace"&&(De!==null||Rt!==null)&&te.currentTarget.selectionStart===0&&te.currentTarget.selectionEnd===0){te.preventDefault(),it();return}te.key==="Enter"&&!te.shiftKey&&!te.nativeEvent.isComposing&&(te.preventDefault(),Sa())},Rn=te=>{for(const we of te){if(!we.type.startsWith("image/"))continue;const ze=new FileReader;ze.onload=()=>{typeof ze.result=="string"&&Fe(ct=>[...ct,ze.result])},ze.readAsDataURL(we)}},Fo=te=>{const we=[];for(const ze of te.clipboardData.items)if(ze.kind==="file"){const ct=ze.getAsFile();ct&&we.push(ct)}we.length>0&&(te.preventDefault(),Rn(we))},qo=te=>{te.target.files&&Rn(te.target.files),te.target.value=""},Gr=te=>{if(Nt)return;const we=[];for(const ze of te){if(ze.size>x_){xt(g.chat.attachmentTooLarge(ze.name));continue}we.push(ze)}we.length!==0&&Promise.all(we.map(y_)).then(ze=>{const ct=we.flatMap((at,ja)=>ze[ja]?[{name:at.name,size:at.size,dataUrl:ze[ja]}]:[]);ct.length>0&&$e(at=>[...at,...ct])})},hd=te=>{te.target.files&&Gr(te.target.files),te.target.value=""},si=v.useRef(null),li=v.useRef(null);return l.jsxs("div",{className:"relative",ref:ye,children:[Fr&&l.jsx("div",{style:{maxHeight:Ne},className:"anim-pop absolute bottom-full left-0 z-40 mb-1.5 w-80 max-w-[calc(100vw-2rem)] overflow-y-auto overscroll-contain rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900",children:wa.map((te,we)=>l.jsxs("button",{type:"button",ref:te===ar?ze=>ze?.scrollIntoView({block:"nearest"}):void 0,onMouseEnter:()=>je(we),onClick:()=>te.run(),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm ${te===ar?"bg-gray-100 dark:bg-gray-800":""}`,children:[l.jsx("span",{className:"shrink-0 font-mono text-gray-800 dark:text-gray-200",children:te.cmd}),l.jsx("span",{title:te.desc,className:"min-w-0 flex-1 truncate text-xs text-gray-500 dark:text-gray-400",children:te.desc})]},te.cmd))}),yt&&p&&l.jsx(cb,{panelRef:wn,maxHeight:Ne,title:g.chat.switchModelTitle,children:l.jsx(Q2,{models:p,value:h,...w!==void 0?{defaultModel:w}:{},onPick:ve})}),Xe&&l.jsx(cb,{panelRef:ue,maxHeight:Ne,title:g.chat.switchAgentTitle,children:l.jsx(o_,{agents:U,...V!==void 0?{currentAgentId:V}:{},onPick:Ie})}),be.length>0&&l.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:be.map((te,we)=>l.jsxs("div",{className:"anim-pop relative",children:[l.jsx($r,{src:te,alt:g.chat.imageAlt,className:"h-16 w-16 rounded-md border border-gray-200 object-cover dark:border-gray-700"}),l.jsx("button",{type:"button","aria-label":g.chat.removeImage,onClick:()=>Fe(ze=>ze.filter((ct,at)=>at!==we)),className:"absolute -right-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-full bg-gray-700 text-[10px] text-white transition-colors duration-150 hover:bg-gray-900",children:"×"})]},we))}),qe.length>0&&l.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:qe.map((te,we)=>l.jsxs("span",{title:te.name,className:"anim-pop flex max-w-56 items-center gap-1.5 rounded-md border border-gray-200 bg-gray-50 py-1 pl-2 pr-1 text-xs text-gray-700 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200",children:[l.jsx(Ue,{d:Oh,size:13,className:"shrink-0 text-gray-400 dark:text-gray-500"}),l.jsx("span",{className:"min-w-0 truncate",children:te.name}),l.jsx("span",{className:"shrink-0 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:No(te.size)}),l.jsx("button",{type:"button","aria-label":`${g.chat.removeFile} ${te.name}`,onClick:()=>$e(ze=>ze.filter((ct,at)=>at!==we)),className:"shrink-0 rounded p-0.5 text-gray-400 transition-colors duration-150 hover:text-gray-700 dark:hover:text-gray-200",children:"×"})]},we))}),!D&&be.length>0&&l.jsx("p",{className:"anim-fade mb-1 text-xs text-gray-400 dark:text-gray-500",children:g.chat.imagesAsPathHint}),pt==="blocked"&&l.jsx("p",{className:"anim-fade mb-1 text-xs text-gray-400 dark:text-gray-500",children:g.chat.modelSwitchBusyHint}),o.length>0?l.jsx("div",{className:"anim-fade mb-1",children:o.map((te,we)=>l.jsx("p",{className:"truncate text-xs text-gray-400 dark:text-gray-500",children:g.chat.steerQueuedItem(b_(te))},we))}):It&&l.jsx("p",{className:"anim-fade mb-1 text-xs text-gray-400 dark:text-gray-500",children:g.chat.steerQueuedIndicator}),d>0&&l.jsx("p",{className:"anim-fade mb-1 text-xs text-gray-400 dark:text-gray-500",children:g.chat.followUpQueuedChip(d)}),N&&l.jsxs("div",{className:"anim-fade mb-1.5 flex flex-wrap items-center justify-between gap-x-3 gap-y-1.5 rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-xs text-gray-600 dark:border-gray-700 dark:bg-gray-800/60 dark:text-gray-300",children:[l.jsx("span",{className:"min-w-0 flex-1 basis-56",children:g.chat.modelAuthDead}),l.jsxs("span",{className:"flex shrink-0 flex-wrap items-center gap-1.5",children:[Q&&l.jsx("button",{type:"button",onClick:Q,className:"shrink-0 rounded-md bg-gray-900 px-2.5 py-1 font-medium text-white transition-colors duration-150 hover:bg-gray-700 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-300",children:g.chat.modelAuthDeadOpenModels}),se&&l.jsx("button",{type:"button",onClick:se,className:"shrink-0 rounded-md border border-gray-300 bg-white px-2.5 py-1 font-medium text-gray-700 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-600 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-700",children:g.chat.modelAuthDeadRetry}),le&&l.jsx("button",{type:"button",onClick:le,className:"shrink-0 rounded-md border border-gray-300 bg-white px-2.5 py-1 font-medium text-gray-700 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-600 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-700",children:g.chat.modelAuthDeadCta})]})]}),l.jsxs("div",{className:`@container rounded-lg border border-gray-300 bg-white px-2.5 pb-2 pt-2 transition-[border-color,box-shadow] duration-200 focus-within:border-gray-500 focus-within:ring-2 focus-within:ring-gray-400/30 dark:border-gray-700 dark:bg-gray-900 dark:focus-within:border-gray-400${N?" opacity-50 grayscale":""}`,children:[(De!==null||Rt!==null||Ke.length>0||Nt)&&l.jsxs("div",{className:"mb-1 flex flex-wrap items-center gap-1",children:[Nt&&l.jsxs("span",{className:"anim-pop flex max-w-full items-center gap-1 rounded-md bg-gray-100 py-0.5 pl-2 pr-1 text-sm text-gray-800 dark:bg-gray-800 dark:text-gray-200",children:[l.jsxs("span",{className:"flex shrink-0 items-center gap-1",title:g.chat.goalModeDesc,children:[l.jsx(Ue,{d:Eo,size:13,className:"text-gray-500 dark:text-gray-400"}),l.jsx("span",{children:g.chat.goalMode})]}),l.jsx("span",{"aria-hidden":!0,className:"mx-0.5 h-4 w-px shrink-0 bg-gray-300 dark:bg-gray-600"}),l.jsx(ha,{open:Pn,setOpen:jn,onEscape:bt,className:"min-w-0",menuClass:"bottom-full left-1/2 -ml-32 mb-2 w-64 max-w-[calc(100vw-2rem)] origin-bottom",button:l.jsxs("button",{type:"button","aria-label":Bt,"aria-expanded":Pn,onClick:()=>jn(!Pn),className:"flex h-5 min-w-0 items-center gap-1 rounded px-1.5 text-xs text-gray-600 transition-colors duration-150 hover:bg-white/80 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white",children:[l.jsx("span",{className:"truncate",children:Bt}),l.jsx("svg",{width:"9",height:"9",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0","aria-hidden":!0,children:l.jsx("path",{d:"M3 4.5l3 3 3-3"})})]}),children:l.jsxs("div",{className:"px-3 py-2",children:[l.jsx("label",{htmlFor:"goal-budget-input",className:"block text-xs font-medium text-gray-700 dark:text-gray-200",children:g.chat.goalBudgetLabel}),l.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5",children:[l.jsx("input",{id:"goal-budget-input",autoFocus:!0,value:Fn,onChange:te=>ke(te.target.value),onFocus:te=>te.currentTarget.select(),onKeyDown:te=>{te.key==="Enter"&&(te.preventDefault(),te.stopPropagation(),Kt())},placeholder:g.chat.goalBudgetPlaceholder,"aria-invalid":Qe,"aria-describedby":"goal-budget-hint",...rd,title:Qe?g.chat.goalBudgetInvalid:g.chat.goalBudgetHint,className:`min-w-0 flex-1 rounded-md border bg-white px-2 py-1 font-mono text-sm leading-5 placeholder:text-gray-400 focus:outline-none focus:ring-2 dark:bg-gray-950 dark:placeholder:text-gray-500 ${Qe?"border-red-400 text-red-600 focus:border-red-500 focus:ring-red-400/20 dark:border-red-500 dark:text-red-400":"border-gray-300 text-gray-800 focus:border-gray-500 focus:ring-gray-400/20 dark:border-gray-700 dark:text-gray-100 dark:focus:border-gray-500"}`}),l.jsx("button",{type:"button","aria-label":g.chat.goalBudgetSave,title:g.chat.goalBudgetSave,disabled:Qe,onClick:Kt,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-gray-900 text-white transition-colors duration-150 hover:bg-gray-700 disabled:cursor-not-allowed disabled:opacity-35 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-white",children:l.jsx(Ue,{d:"M5 12l4 4L19 6",size:14})})]}),l.jsx("p",{id:"goal-budget-hint",className:`mt-1.5 text-[11px] leading-4 ${Qe?"text-red-500 dark:text-red-400":"text-gray-400 dark:text-gray-500"}`,children:Qe?g.chat.goalBudgetInvalid:g.chat.goalBudgetHint})]})}),l.jsx("button",{type:"button","aria-label":g.chat.goalRemove,onClick:()=>fn(!1),className:"shrink-0 rounded p-0.5 text-gray-400 transition-colors duration-150 hover:text-gray-700 dark:hover:text-gray-200",children:"×"})]}),De!==null&&l.jsxs("span",{title:g.chat.handoffTargetTitle(hn(De)),className:"anim-pop flex max-w-48 items-center gap-1 rounded-md bg-gray-100 py-0.5 pl-2 pr-1 font-mono text-sm text-gray-800 dark:bg-gray-800 dark:text-gray-200",children:[l.jsx(pa,{id:De.agentId,name:hn(De),size:13,className:"shrink-0 rounded-sm"}),l.jsx("span",{className:"truncate",children:De.agentId}),l.jsx("button",{type:"button","aria-label":g.chat.handoffRemove,onClick:()=>{At(null),A?.(null),lt.current?.focus()},className:"shrink-0 rounded p-0.5 text-gray-400 transition-colors duration-150 hover:text-gray-700 dark:hover:text-gray-200",children:"×"})]}),Rt!==null&&l.jsxs("span",{title:g.chat.modelSwitchTargetTitle(yo(Rt)),className:"anim-pop flex max-w-48 items-center gap-1 rounded-md bg-gray-100 py-0.5 pl-2 pr-1 text-sm text-gray-800 dark:bg-gray-800 dark:text-gray-200",children:[l.jsx(Xl,{provider:Rt.provider,className:"h-3.5 w-3.5 shrink-0"}),l.jsx("span",{className:"truncate",children:yo(Rt)}),l.jsx("button",{type:"button","aria-label":g.chat.modelSwitchRemove,onClick:()=>{ae(null),lt.current?.focus()},className:"shrink-0 rounded p-0.5 text-gray-400 transition-colors duration-150 hover:text-gray-700 dark:hover:text-gray-200",children:"×"})]}),Ke.map(te=>{const we=O.find(ze=>ze.name===te);return l.jsxs("span",{className:"anim-pop flex max-w-48 items-center gap-1 rounded-md bg-gray-100 py-0.5 pl-2 pr-1 font-mono text-sm text-gray-800 dark:bg-gray-800 dark:text-gray-200",...we?{title:Po(he,we)}:{},children:[l.jsx(Pp,{icon:we?.icon,size:13,className:"shrink-0 text-gray-500 dark:text-gray-400"}),l.jsx("span",{className:"truncate",children:te}),l.jsx("button",{type:"button","aria-label":`${g.chat.skillRemove} ${te}`,onClick:()=>zn(te),className:"shrink-0 rounded p-0.5 text-gray-400 transition-colors duration-150 hover:text-gray-700 dark:hover:text-gray-200",children:"×"})]},te)})]}),l.jsx("textarea",{ref:lt,rows:2,value:xe,autoFocus:X,onChange:te=>{const we=te.target.value,ze=te.target.selectionStart??we.length;ne(we),P?.(we),dn(ze),je(0),jt(ct=>{if(ct===null)return null;const at=ib(we,ze);return at&&at.start===ct?ct:null})},onSelect:te=>dn(te.currentTarget.selectionStart??0),onKeyDown:Vr,onPaste:Fo,disabled:N,placeholder:N?g.chat.modelAuthDeadPlaceholder:_t&&xr?Hn?g.chat.followUpPlaceholderShort:g.chat.followUpPlaceholder:_t&&r?Hn?g.chat.steerPlaceholderShort:g.chat.steerPlaceholder:Hn?g.chat.inputPlaceholderShort:g.chat.inputPlaceholder,className:"block max-h-44 min-h-[60px] w-full resize-none bg-transparent px-1 py-0.5 text-base leading-6 placeholder:text-gray-400 focus:outline-none disabled:cursor-not-allowed disabled:opacity-60 dark:placeholder:text-gray-500"}),l.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2 text-xs",children:[l.jsxs("div",{className:"no-scrollbar flex min-w-0 flex-1 items-center gap-2 overflow-x-auto",children:[l.jsx("input",{ref:si,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:qo}),l.jsx("input",{ref:li,type:"file",multiple:!0,disabled:Nt,className:"hidden",onChange:hd}),l.jsx(p_,{items:[{key:"image",icon:h_,label:g.chat.uploadImage,desc:D&&!Nt?g.chat.uploadImageDesc:g.chat.imagesAsPathHint,active:be.length>0,onSelect:()=>si.current?.click()},{key:"file",icon:Oh,label:g.chat.uploadFile,desc:g.chat.uploadFileDesc,active:qe.length>0,disabled:Nt,onSelect:()=>li.current?.click()},{key:"goal",icon:Eo,label:g.chat.goalMode,desc:g.chat.goalModeDesc,active:Nt,disabled:_t||En||Ye,onSelect:()=>fn(!Nt)}],footer:l.jsx(f_,{steerMode:Pr,onChangeSteerMode:ai}),direction:p&&y?"down":"up"}),l.jsx(s_,{value:L,onChange:$,disabled:K,direction:p&&y?"down":"up"}),l.jsx(m_,{skills:O,selected:Ke,onToggle:zn,disabled:_t||En||Ye,direction:p&&y?"down":"up"}),l.jsx("span",{title:g.chat.slashHint,className:"hidden min-w-0 truncate text-gray-300 @lg:block dark:text-gray-600",children:g.chat.slashHint})]}),l.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[!y&&l.jsx(g_,{now:I,unknown:H,...R!==void 0?{window:R}:{}}),p&&y&&T&&l.jsx(ub,{value:S??null,onChange:T,disabled:Ye}),!y&&E&&l.jsx(ub,{value:M??"",onChange:E,disabled:Ye,direction:"up"}),p&&y?l.jsx(i_,{models:p,value:h,...w!==void 0?{defaultModel:w}:{},onChange:y,disabled:Ye}):l.jsxs("span",{title:h?.modelId??"",className:"flex h-8 min-w-0 max-w-44 shrink items-center gap-1.5 px-1 text-gray-400 dark:text-gray-500",children:[l.jsx(Xl,{provider:h?.provider??"custom",className:"h-4 w-4 shrink-0"}),l.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:(()=>{const te=p?.find(we=>vt(we,h));return te?yo(te):h?.modelId??"…"})()})]}),l.jsx("button",{type:"button",title:An?g.chat.stop:_t?tr:g.chat.send,"aria-label":An?g.chat.stop:_t?tr:g.chat.send,disabled:An?!1:_t?!er:!Sn,onClick:()=>An?void f():void Sa(),className:An?"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-red-50 text-red-600 transition-colors duration-150 hover:bg-red-100 dark:bg-red-950/60 dark:text-red-400 dark:hover:bg-red-950":"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-gray-900 text-white transition-colors duration-150 hover:bg-gray-700 disabled:cursor-not-allowed disabled:bg-gray-200 disabled:text-gray-400 dark:bg-gray-100 dark:text-gray-900 dark:hover:bg-gray-300 dark:disabled:bg-gray-800 dark:disabled:text-gray-600",children:An?l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":!0,className:"block",children:l.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2",fill:"currentColor"})}):l.jsx("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"block",children:l.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})})})]})]})]})]})}const db=500;function k_(e){const n=[];let r=null,s=!1;for(const o of e){if(o.kind==="user_text"||o.kind==="user_image"){let c="";if(o.kind==="user_text"){const d=K2(o.text);if(!d||d.goalRound!==void 0&&d.goalRound>1){s=!1;continue}c=d.body}s&&r?r.question===""&&c!==""&&(r.question=c):(r={anchorId:o.id,question:c,answer:""},n.push(r)),s=!0;continue}if(s=!1,o.kind==="assistant_text"&&r&&r.answer.length<db){const c=o.text.trim();c!==""&&(r.answer=(r.answer===""?c:`${r.answer} ${c}`).slice(0,db))}}return n}function w_(e,n){let r=e.replace(/```[^\n]*/g,"").replace(/!\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/^[ \t]*(?:#{1,6}[ \t]+|>[ \t]?|[-*+][ \t]+|\d+[.)][ \t]+)/gm,"").replace(/[*_`~]/g,"").replace(/\s+/g," ").trim();return r.length>n&&(r=`${r.slice(0,n).trimEnd()}…`),r}const S_="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zm4 0v16M12 9h5m-5 4h5",j_=96,N_=1e3,C_=56,T_=768,fb="(hover: hover) and (pointer: fine)",M_=12,E_=5;function A_(e,n){const[r,s]=v.useState(()=>window.matchMedia(fb).matches),[o,c]=v.useState({gutterOk:!1,height:0});return v.useEffect(()=>{const d=window.matchMedia(fb),f=m=>s(m.matches);return d.addEventListener("change",f),()=>d.removeEventListener("change",f)},[]),v.useEffect(()=>{const d=e.current;if(!d)return;const f=()=>{const h=(d.clientWidth-T_)/2;c({gutterOk:h>=C_,height:d.clientHeight})};f();const m=new ResizeObserver(f);return m.observe(d),()=>m.disconnect()},[e,n]),{shown:r&&o.gutterOk,height:o.height}}function J2(e,n){const r=e.querySelectorAll("[data-outline-anchor]");if(r.length===0)return null;let s=null,o=null;const c=e.scrollTop+j_;for(const f of r){const m=Number(f.dataset.outlineAnchor);n.has(m)&&(s=m,f.offsetTop<=c&&(o=m))}return e.scrollHeight-e.scrollTop-e.clientHeight<2?s:o}let mb=null,hb;function ew(e,n){const r=e?.querySelector(`[data-outline-anchor="${n}"]`);!e||!r||(e.scrollTo({top:Math.max(0,r.offsetTop-8)}),window.clearTimeout(hb),mb?.classList.remove("outline-flash"),mb=r,r.classList.remove("outline-flash"),r.offsetWidth,r.classList.add("outline-flash"),hb=window.setTimeout(()=>r.classList.remove("outline-flash"),N_))}function tw(e,n,r,s){return e.answer?w_(e.answer,s):r&&e===n[n.length-1]?g.chat.outlineAnswering:""}function R_({entries:e,version:n,scrollRef:r,running:s,fit:o}){const[c,d]=v.useState(null),[f,m]=v.useState(null),h=v.useRef(null);if(v.useEffect(()=>{const S=r.current;if(!o.shown||!S||e.length===0)return;const T=new Set(e.map(I=>I.anchorId));let M=null;const E=()=>{M=null;const I=r.current;I&&d(J2(I,T))},R=()=>{M??=requestAnimationFrame(E)};return E(),S.addEventListener("scroll",R,{passive:!0}),()=>{S.removeEventListener("scroll",R),M!==null&&cancelAnimationFrame(M)}},[o.shown,r,e.length,n]),!o.shown||e.length===0)return null;const p=S=>{const T=S.currentTarget.getBoundingClientRect();return T.top+T.height/2-(h.current?.getBoundingClientRect().top??0)},y=Math.max(E_,Math.min(M_,Math.floor((o.height-32)/e.length))),k=f===null?null:e.find(S=>S.anchorId===f.id)??null,w=k===null?"":tw(k,e,s,160);return l.jsxs("nav",{ref:h,"aria-label":g.chat.outlineTitle,className:"pointer-events-none absolute inset-y-0 left-0 z-10 flex flex-col items-start justify-center",children:[l.jsx("div",{children:e.map((S,T)=>{const M=S.anchorId===c;return l.jsx("button",{type:"button","data-outline-tick":S.anchorId,"aria-current":M||void 0,"aria-label":g.chat.outlineTickLabel(T+1,S.question||g.chat.outlineNoText),style:{height:y},onMouseEnter:E=>m({id:S.anchorId,top:p(E)}),onMouseLeave:()=>m(null),onFocus:E=>m({id:S.anchorId,top:p(E)}),onBlur:()=>m(null),onClick:()=>{ew(r.current,S.anchorId),d(S.anchorId)},className:"group/tick pointer-events-auto flex w-10 items-center pl-2.5",children:l.jsx("span",{className:`h-[2px] rounded-full transition-all duration-150 ${M?"w-5 bg-gray-800 dark:bg-gray-200":"w-3.5 bg-gray-300 group-hover/tick:bg-gray-500 dark:bg-gray-700 dark:group-hover/tick:bg-gray-400"}`})},S.anchorId)})}),k&&l.jsxs("div",{"data-outline-card":!0,"aria-hidden":!0,className:"anim-pop pointer-events-none absolute left-10 w-80 -translate-y-1/2 rounded-xl border border-gray-200 bg-white px-4 py-3 shadow-lg dark:border-gray-700 dark:bg-gray-900",style:{top:Math.min(Math.max(f.top,56),Math.max(56,o.height-56))},children:[l.jsx("p",{className:`truncate text-sm ${k.question===""?"italic text-gray-500 dark:text-gray-400":"font-semibold text-gray-900 dark:text-gray-100"}`,children:k.question||g.chat.outlineNoText}),w!==""&&l.jsx("p",{className:`mt-1 line-clamp-3 text-sm leading-snug text-gray-500 dark:text-gray-400 ${k.answer===""?"animate-pulse":""}`,children:w})]})]})}function __({entries:e,scrollRef:n,running:r}){const[s,o]=v.useState(!1),[c,d]=v.useState(null);if(e.length===0)return null;const f=m=>{m&&n.current&&d(J2(n.current,new Set(e.map(h=>h.anchorId)))),o(m)};return l.jsx(ha,{open:s,setOpen:f,menuClass:"right-0 top-full mt-1 w-72 max-w-[calc(100vw-1.5rem)] origin-top-right",button:l.jsx("button",{type:"button",title:g.chat.outlineTitle,"aria-label":g.chat.outlineTitle,onClick:()=>f(!s),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:l.jsx(Ue,{d:S_,size:15})}),children:l.jsx("div",{className:"max-h-[60vh] overflow-y-auto py-1",children:e.map(m=>{const h=tw(m,e,r,80),p=m.anchorId===c;return l.jsxs("button",{type:"button","data-outline-menu-entry":m.anchorId,"aria-current":p||void 0,onClick:()=>{ew(n.current,m.anchorId),o(!1)},className:`block w-full px-3 py-1.5 text-left transition-colors duration-150 ${p?"bg-gray-100 dark:bg-gray-800":"hover:bg-gray-50 dark:hover:bg-gray-800/60"}`,children:[l.jsx("span",{className:`block truncate text-sm ${m.question===""?"italic text-gray-500 dark:text-gray-400":"font-medium text-gray-800 dark:text-gray-200"}`,children:m.question||g.chat.outlineNoText}),h!==""&&l.jsx("span",{className:`mt-0.5 block truncate text-xs text-gray-500 dark:text-gray-400 ${m.answer===""?"animate-pulse":""}`,children:h})]},m.anchorId)})})})}function nw({className:e}){return l.jsx("img",{src:"/penguin-logo.svg",alt:"","aria-hidden":!0,draggable:!1,className:`select-none ${e??"h-9 w-9 rounded-lg"}`})}let Wm=null,Km=null,Ru=null,Wl=null;const zh=new Set;function I_(e){return e.disabled===!0?{kind:"disabled"}:e.error!==void 0?{kind:"failed"}:e.updateAvailable&&e.latestVersion!==null?{kind:"found",latestVersion:e.latestVersion}:{kind:"up-to-date"}}function aw(e){const[n,r]=v.useState(Wm),[s,o]=v.useState(Ru);return v.useEffect(()=>{const c=()=>{r(Wm),o(Ru)};return zh.add(c),()=>{zh.delete(c)}},[]),v.useEffect(()=>{if(!e)return;let c=!1;return Km??=Q5().then(d=>(Wm=d,d)),Km.then(d=>{c||r(d)}).catch(()=>{Km=null}),Wl??=Mv().then(d=>(Ru=d,d)),Wl.then(d=>{c||o(d)}).catch(()=>{Wl=null}),()=>{c=!0}},[e]),{version:n,update:s}}async function pb(){const e=Mv(!0).then(n=>(Ru=n,n));Wl=e;try{return await e}catch(n){throw Wl===e&&(Wl=null),n}finally{for(const n of zh)n()}}const Uh=[{id:"webapps",tasks:[{id:"game",skills:["web-design"]},{id:"gamecenter",skills:["web-design"]},{id:"lol",skills:["web-design"]}]},{id:"agents",tasks:[{id:"rag",skills:["penguin-sdk","web-design"]},{id:"agentBenchmarkBuild",skills:[]},{id:"agentOptimization",skills:[]}]}];Uh.flatMap(e=>[...e.tasks]);const L_=["always-ask","read-only","allow-all","deny-all"],Vl=(e,n)=>`penguin.chatDraft.${e}.${n}`,rw=(e,n)=>`penguin.chatDraft.session.${e}.${n}`;function gb(e){if(typeof e!="object"||e===null)return;const n=e;if(!(typeof n.provider!="string"||typeof n.modelId!="string"))return{provider:n.provider,modelId:n.modelId}}function O_(e){if(!e)return{};try{const n=JSON.parse(e);if(typeof n!="object"||n===null)return{};const r=n,s={};typeof r.text=="string"&&(s.text=r.text),typeof r.agentId=="string"&&(s.agentId=r.agentId),typeof r.workspace=="string"&&(s.workspace=r.workspace);const o=gb(r.modelRef);o&&(s.modelRef=o),typeof r.handoffAgentId=="string"&&(s.handoffAgentId=r.handoffAgentId);const c=gb(r.switchModelRef);if(c&&(s.switchModelRef=c),Array.isArray(r.skills)){const d=r.skills.filter(f=>typeof f=="string");d.length>0&&(s.skills=d)}return typeof r.approvalMode=="string"&&L_.includes(r.approvalMode)&&(s.approvalMode=r.approvalMode),s}catch{return{}}}function dd(e,n=localStorage){try{return O_(n.getItem(e))}catch{return{}}}function Ao(e,n,r=localStorage){try{r.setItem(e,JSON.stringify(n))}catch{}}function Vu(e,n=localStorage){try{n.removeItem(e)}catch{}}const D_=300;function xb(e){try{return sessionStorage.getItem(`penguin.chatRouteApplied.${e}`)}catch{return null}}function yb(e,n){try{sessionStorage.setItem(`penguin.chatRouteApplied.${e}`,n)}catch{}}const z_={webapps:"M3 6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6zM3 9h18M6 6.5h.01M9 6.5h.01",agents:"M12 3v3m-6 4a6 6 0 0 1 12 0v5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-5zm3 3h.01M15 13h.01"};function U_({projectId:e,models:n}){const r=ya(),s=xa(),{agents:o,currentAgent:c,setCurrentAgentId:d}=gn(),{add:f}=ll(),m=Bn().user?.userId??null,[h]=v.useState(()=>m?dd(Vl(m,e)):{}),[p,y]=v.useState(h.agentId??c?.agentId??null),[k,w]=v.useState(h.workspace??""),[S,T]=v.useState(h.approvalMode??"allow-all"),[M,E]=v.useState(h.modelRef??null),R=v.useRef(h.text??""),I=v.useRef(h.skills??[]),H=s.state,D=H?.agentId,L=v.useRef(null);v.useEffect(()=>{if(o.length===0)return;const je=We=>!!We&&o.some(jt=>jt.agentId===We);if(D&&L.current!==s.key&&xb("agentId")!==s.key&&(L.current=s.key,yb("agentId",s.key),je(D))){y(D);return}je(p)||y((o.find(We=>We.agentId==="default_agent")??o[0])?.agentId??null)},[o,p,s.key,D]);const $=H?.workspace,K=v.useRef(null);v.useEffect(()=>{$===void 0||K.current===s.key||xb("workspace")===s.key||(K.current=s.key,yb("workspace",s.key),w($))},[s.key,$]),v.useEffect(()=>{if(!n||M&&n.models.some(We=>vt(We,M)))return;const je=n.models[0];E(n.defaultModel??(je?{provider:je.provider,modelId:je.modelId}:null))},[n,M]);const[X,U]=v.useState(null);v.useEffect(()=>{if(U(null),!p)return;let je=!1;return Kh(e,p).then(We=>{je||U(We.config.model?.thinkingLevel??"")}).catch(()=>{}),()=>{je=!0}},[e,p]);const V=v.useRef(null);V.current=X;const O=v.useCallback(je=>{if(!p||!je)return;const We=V.current;U(je),Nv(e,p,{config:{model:{thinkingLevel:je}}}).catch(jt=>{U(We),xt(Ae(jt))})},[e,p]),[W,Z]=v.useState([]),[B,F]=v.useState(!1);v.useEffect(()=>{if(Z(We=>We.length>0?[]:We),F(!1),!p)return;let je=!1;return Yh(e,p).then(We=>{je||Z(We.skills)}).catch(()=>{}).finally(()=>{je||F(!0)}),()=>{je=!0}},[e,p]);const P=v.useRef(null),ce=v.useCallback(()=>{P.current!==null&&(window.clearTimeout(P.current),P.current=null)},[]),oe=v.useCallback(()=>{if(ce(),!m)return;const je={text:R.current,workspace:k,approvalMode:S};p&&(je.agentId=p),M&&(je.modelRef=M),I.current.length>0&&(je.skills=I.current),Ao(Vl(m,e),je)},[ce,m,e,p,k,S,M]),A=v.useRef(oe);v.useEffect(()=>{A.current=oe,oe()},[oe]);const C=v.useCallback(je=>{R.current=je,ce(),P.current=window.setTimeout(()=>{P.current=null,A.current()},D_)},[ce]),z=v.useCallback(je=>{I.current=je,A.current()},[]);v.useEffect(()=>()=>{P.current!==null&&(window.clearTimeout(P.current),A.current())},[]);const N=v.useCallback(()=>{ce(),I.current=[],m&&(M?Ao(Vl(m,e),{modelRef:M}):Vu(Vl(m,e)))},[ce,m,e,M]),Q=je=>{y(je.agentId),d(je.agentId)},se=v.useRef(!1),[le,he]=v.useState(!1),xe=v.useCallback(async(je,We=!1,jt=null)=>{if(!p||se.current)return!1;se.current=!0,he(!0);let yt=null;try{const Qt={approvalMode:S};M&&(Qt.modelId=M.modelId,Qt.provider=M.provider),k.trim()&&(Qt.workspace=k.trim());const wn=await ih(e,p,Qt);yt=wn.session.sessionId;const Xe=await uo(yt,{input:je,...jt?{goal:jt}:{}});return f(wn.session),We||N(),r(`/chat/${Xe.sessionId}`,{replace:!0}),!0}catch(Qt){return yt&&_u(yt).catch(()=>{}),xt(Ae(Qt,M?{modelId:M.modelId}:{})),!1}finally{se.current=!1,he(!1)}},[e,p,S,M,k,f,N,r]),[ne,pe]=v.useState(null),be=v.useCallback(async je=>{if(ne===null){pe(je.id);try{const We=je.skills.filter(jt=>W.some(yt=>yt.name===jt));await xe([{type:"text",text:gh(We,g.chat.exampleTasks[je.id].prompt)}],!0)}finally{pe(null)}}},[ne,W,xe]),[Fe,qe]=v.useState(Uh[0].id),$e=o.find(je=>je.agentId===p)??null,Ye=n?.models.find(je=>vt(je,M)),Et=Ye?.contextWindow,kn=Ye?.vision!==!1;return l.jsxs("div",{className:"anim-fade flex min-h-0 flex-1 flex-col overflow-y-auto px-3 py-6 md:px-4",children:[l.jsx("div",{className:"flex-1"}),l.jsxs("div",{className:"mx-auto w-full max-w-3xl",children:[l.jsxs("div",{className:"mb-10 text-center",children:[l.jsx(nw,{className:"mx-auto mb-1 h-36 w-36 rounded-3xl"}),l.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-gray-900 dark:text-gray-100",children:g.appName}),l.jsx("p",{className:"mt-2 text-base text-gray-400 dark:text-gray-500",children:g.chat.draftSubtitle}),l.jsx($_,{})]}),l.jsx(Z2,{status:"idle",onSend:(je,We)=>xe(je,!1,We),onStop:async()=>{},onCompact:async()=>{},modelRef:M,models:n?.models??[],onChangeModel:E,thinkingLevel:X,onChangeThinkingLevel:O,...n?.defaultModel!==void 0?{defaultModel:n.defaultModel}:{},...Et!==void 0?{contextWindow:Et}:{},contextNow:0,vision:kn,approvalMode:S,onChangeApprovalMode:T,modeSaving:!1,autoFocus:!0,agents:o,...p?{currentAgentId:p}:{},skills:W,...h.skills&&h.skills.length>0?{initialSkills:h.skills}:{},onSkillsChange:z,initialText:h.text??"",onTextChange:C}),l.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[l.jsx(B_,{agents:o,selected:$e,onSelect:Q}),l.jsx(H_,{projectId:e,workspace:k,onChange:w})]}),l.jsx("div",{className:"mt-6 space-y-1",children:Uh.map(je=>{const We=je.id===Fe;return l.jsxs("div",{children:[l.jsxs("button",{type:"button","aria-expanded":We,onClick:()=>qe(je.id),className:`flex w-full items-center gap-2 rounded-lg px-2 py-2 text-left transition-colors duration-150 ${We?"bg-gray-100 dark:bg-gray-800/70":"hover:bg-gray-100 dark:hover:bg-gray-800/70"}`,children:[l.jsx("span",{className:"shrink-0 text-brand-500 dark:text-brand-400",children:l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:z_[je.id]})})}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-gray-700 dark:text-gray-300",children:g.chat.exampleFolders[je.id]}),l.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",children:je.tasks.length}),l.jsx(Ln,{open:We,size:14,className:"text-gray-400"})]}),We&&l.jsx("ul",{className:"mt-0.5 space-y-0.5 pl-4",children:je.tasks.map(jt=>{const yt=g.chat.exampleTasks[jt.id];return l.jsx("li",{children:l.jsxs("button",{type:"button",title:yt.desc,disabled:ne!==null||le||!B||!p||!n,onClick:()=>{be(jt)},className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-gray-600 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-900 disabled:cursor-default disabled:opacity-60 disabled:hover:bg-transparent dark:text-gray-400 dark:hover:bg-gray-800/70 dark:hover:text-gray-200",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate",children:yt.label}),ne===jt.id&&l.jsx("span",{className:"shrink-0 text-xs text-gray-400",children:g.common.loading})]})},jt.id)})})]},je.id)})})]}),l.jsx("div",{className:"flex-1"})]})}const bb="ml-1.5 inline-block rounded-full bg-[var(--accent-bg)] px-1.5 align-super text-[10px] font-medium leading-4 text-[var(--accent-fg)] transition-opacity duration-150 hover:opacity-80";function $_(){const{locale:e}=Ja(),{version:n,update:r}=aw(!0);if(n===null)return null;const s=n.buildDate;return l.jsxs("p",{className:"mt-1.5 text-xs text-gray-400 dark:text-gray-500",children:[`v${n.version}${s!==null?` · ${g.update.lastUpdated(sk(s,e))}`:""}`,r!==null&&r.updateAvailable&&r.latestVersion!==null&&(r.releaseUrl!==null?l.jsx("a",{href:r.releaseUrl,target:"_blank",rel:"noopener noreferrer",title:g.update.newVersion(r.latestVersion),"aria-label":g.update.newVersion(r.latestVersion),className:bb,children:g.update.newVersionBadge}):l.jsx("span",{className:bb,children:g.update.newVersionBadge}))]})}const sw="flex max-w-64 items-center gap-1.5 rounded-full border border-gray-300 bg-white py-1 pl-1.5 pr-2 text-xs text-gray-600 transition-colors duration-150 hover:bg-gray-50 hover:text-gray-900 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100";function B_({agents:e,selected:n,onSelect:r}){const[s,o]=v.useState(!1);return l.jsx(ha,{open:s,setOpen:o,menuClass:"left-0 top-full mt-1 w-72 max-w-[calc(100vw-2rem)] origin-top-left",button:l.jsxs("button",{type:"button",title:g.chat.chooseAgent,"aria-label":g.chat.chooseAgent,onClick:()=>o(!s),className:sw,children:[n?l.jsx(pa,{id:n.agentId,name:hn(n),size:16,className:"shrink-0 rounded"}):null,l.jsx("span",{className:"min-w-0 truncate",children:n?hn(n):g.common.loading}),l.jsx(Ln,{open:s,size:12,className:"shrink-0 text-gray-400"})]}),children:l.jsxs("div",{className:"max-h-56 overflow-y-auto",children:[e.length===0&&l.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:g.common.loading}),e.map(c=>{const d=c.agentId===n?.agentId;return l.jsxs("button",{type:"button","aria-pressed":d,onClick:()=>{r(c),o(!1)},className:"flex w-full items-center gap-2.5 px-3 py-1.5 text-left transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800",children:[l.jsx(pa,{id:c.agentId,name:hn(c),size:20,className:"shrink-0 rounded"}),l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:`block truncate text-xs ${d?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`,children:hn(c)}),c.description&&l.jsx("span",{className:"block truncate text-[11px] text-gray-400 dark:text-gray-500",children:c.description})]}),l.jsx("span",{className:"w-4 shrink-0 text-center text-xs text-gray-500 dark:text-gray-400",children:d?"✓":""})]},c.agentId)})]})})}function H_({projectId:e,workspace:n,onChange:r}){const[s,o]=v.useState(!1),[c,d]=v.useState({right:!1}),f=v.useRef(!1),[m,h]=v.useState(null),[p,y]=v.useState(!1),[k,w]=v.useState(null),[S,T]=v.useState("");v.useEffect(()=>{T(m?.path??"")},[m]);const M=v.useCallback($=>{y(!0),w(null),By(e,$).then(h).catch(K=>w(Ae(K))).finally(()=>y(!1))},[e]),E=$=>{const K=!s;if(K){const X=$.currentTarget.getBoundingClientRect(),U=parseFloat(getComputedStyle(document.documentElement).fontSize),V=12,O=Math.min(20*U,window.innerWidth-2*U),W=window.innerWidth-V-X.left,Z=X.right-V;W>=O?d({right:!1}):Z>W?d({right:!0,...Z<O?{maxWidth:Z}:{}}):d({right:!1,maxWidth:W})}if(o(K),K&&!f.current){f.current=!0;const X=n.trim();M(X.startsWith("/")?X:"")}},R=async()=>{const $=S.trim();if(!$||$===m?.path){T(m?.path??"");return}try{h(await By(e,$))}catch{xt(g.chat.workspaceDirInvalid),T(m?.path??"")}},I=n.trim(),H=I?I.split("/").filter(Boolean).pop()??"/":g.chat.workspaceAuto,D=m?.parent??null,L=(m?.entries??[]).filter($=>!$.name.startsWith("."));return l.jsx(ha,{open:s,setOpen:o,menuClass:`top-full mt-1 w-80 max-w-[calc(100vw-2rem)] ${c.right?"right-0 origin-top-right":"left-0 origin-top-left"}`,...c.maxWidth!==void 0?{menuStyle:{maxWidth:c.maxWidth}}:{},button:l.jsxs("button",{type:"button",title:I?`${g.chat.workspace}:${I}`:g.chat.workspaceHint,"aria-label":g.chat.workspace,onClick:E,className:sw,children:[l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"ml-0.5 shrink-0 text-gray-400","aria-hidden":!0,children:l.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z",strokeWidth:"1.6",strokeLinejoin:"round"})}),l.jsx("span",{className:`min-w-0 truncate ${I?"font-mono":""}`,children:H}),l.jsx(Ln,{open:s,size:12,className:"shrink-0 text-gray-400"})]}),children:l.jsxs("div",{className:"space-y-1.5 px-2.5 pb-2.5 pt-2",children:[l.jsxs("div",{className:"rounded-md border border-gray-200 dark:border-gray-800",children:[l.jsxs("div",{className:"flex items-center gap-1.5 border-b border-gray-100 px-1.5 py-1 dark:border-gray-800",children:[l.jsx("input",{value:S,placeholder:"…","aria-label":g.chat.workspace,...rd,onChange:$=>T($.target.value),onBlur:()=>{R()},onKeyDown:$=>{$.key==="Enter"&&!$.nativeEvent.isComposing?($.preventDefault(),R()):$.key==="Escape"&&T(m?.path??"")},className:"min-w-0 flex-1 rounded border border-transparent bg-transparent px-1 py-0.5 font-mono text-xs text-gray-600 focus:border-gray-300 focus:outline-none dark:text-gray-300 dark:focus:border-gray-600"}),l.jsx("button",{type:"button",disabled:!m,onClick:()=>{m&&(r(m.path),o(!1))},className:"shrink-0 rounded border border-gray-300 px-1.5 py-0.5 text-xs text-gray-700 transition-colors duration-150 hover:bg-gray-100 disabled:opacity-50 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800",children:g.chat.workspaceUseThis})]}),l.jsxs("ul",{className:"max-h-40 overflow-y-auto py-1",children:[D!==null&&l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>M(D),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800",children:["↰ ",g.chat.workspaceUp]})}),L.map($=>l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>M($.path),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left font-mono text-xs text-gray-700 transition-colors duration-150 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800",children:[l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"shrink-0 text-gray-400","aria-hidden":!0,children:l.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z",strokeWidth:"1.6",strokeLinejoin:"round"})}),l.jsx("span",{className:"min-w-0 flex-1 truncate",children:$.name})]})},$.path)),m&&L.length===0&&l.jsx("li",{className:"px-2.5 py-1.5 text-xs text-gray-400",children:g.chat.workspaceNoSubdirs}),p&&l.jsx("li",{className:"px-2.5 py-1.5 text-xs text-gray-400",children:g.common.loading}),k&&l.jsxs("li",{className:"flex items-center justify-between gap-2 px-2.5 py-1.5 text-xs text-red-500",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate",title:k,children:k}),l.jsx("button",{type:"button",onClick:()=>M(""),className:"shrink-0 rounded border border-gray-300 px-1.5 py-0.5 text-xs text-gray-700 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800",children:g.common.retry})]})]})]}),I&&l.jsx("button",{type:"button",onClick:()=>{r(""),o(!1)},className:"text-xs text-gray-500 underline decoration-gray-300 underline-offset-2 transition-colors duration-150 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200",children:g.chat.workspaceClear}),l.jsx("p",{className:"px-0.5 text-xs leading-5 text-gray-400 dark:text-gray-500",children:g.chat.workspaceHint})]})})}const $h={damping:1,response:.35},vb={damping:.8,response:.3};function P_(e,n,r,s,o){const c=2*Math.PI/s.response,d=c*c,f=2*s.damping*c;let m=e,h=n,p=Math.min(o,64);for(;p>0;){const y=Math.min(p,8)/1e3,k=-d*(m-r)-f*h;h+=k*y,m+=h*y,p-=8}return[m,h]}function kb(e,n,r){return Math.abs(e-r)<.5&&Math.abs(n)<5}function F_(e,n){let r=e,s=0,o=e,c=$h,d,f=0,m=0;const h=()=>{f&&cancelAnimationFrame(f),f=0,m=0,d=void 0},p=y=>{const k=m?y-m:16;if(m=y,[r,s]=P_(r,s,o,c,k),kb(r,s,o)){r=o,s=0,f=0,m=0,n(r);const w=d;d=void 0,w?.();return}n(r),f=requestAnimationFrame(p)};return{get value(){return r},get velocity(){return s},animateTo(y,k,w){if(o=y,c=k,w?.velocity!==void 0&&(s=w.velocity),d=w?.onSettle,kb(r,s,o)){r=o,s=0,n(r);const S=d;d=void 0,S?.();return}f||(f=requestAnimationFrame(p))},stop(){return h(),[r,s]},set(y){h(),r=y,s=0,n(r)},dispose:h}}function q_(e,n=.998){return e/1e3*n/(1-n)}function V_(e,n,r=.55){return e*n*r/(n+r*Math.abs(e))}function G_(e,n){let r=n[0];for(const s of n)Math.abs(s-e)<Math.abs(r-e)&&(r=s);return r}const W_=.92,K_=.6;function Y_(){const[e,n]=v.useState(()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches);return v.useEffect(()=>{const r=window.matchMedia("(prefers-reduced-motion: reduce)"),s=o=>n(o.matches);return r.addEventListener("change",s),()=>r.removeEventListener("change",s)},[]),e}function lw({open:e,snap:n,onSnapChange:r,onClose:s,title:o,children:c}){const[d,f]=v.useState(e),m=v.useRef(null),h=v.useRef(null),p=v.useRef(null),y=v.useRef(0),k=v.useRef(!1),w=v.useRef(!1),S=v.useRef(null),T=v.useRef([]),M=v.useRef({pointerY:0,sheetY:0}),E=v.useRef(e);E.current=e;const R=v.useRef(null),I=Y_(),H=v.useCallback(V=>{const O=y.current||1;m.current&&(m.current.style.transform=`translate3d(0, ${V}px, 0)`),h.current&&(h.current.style.opacity=String(Math.min(1,Math.max(0,1-V/O))))},[]),D=v.useCallback(V=>{const O=y.current;return V==="full"?0:O*(1-K_/W_)},[]);v.useEffect(()=>{e&&f(!0)},[e]),v.useLayoutEffect(()=>{if(!d)return;const V=m.current;V&&(y.current=V.offsetHeight,p.current||(p.current=F_(y.current,H),p.current.set(y.current)))},[d,H]),v.useEffect(()=>{if(!d)return;const V=p.current;if(V)if(e){if(w.current=!1,k.current)return;const O=D(n);if(S.current!==null&&Math.abs(S.current-O)<1)return;if(S.current=O,I){V.set(O);return}V.animateTo(O,$h)}else{if(w.current=!0,S.current=y.current,I){f(!1);return}V.animateTo(y.current,$h,{onSettle:()=>f(!1)})}},[d,e,n,I,D]),v.useEffect(()=>{d||(p.current?.dispose(),p.current=null,S.current=null,k.current=!1,w.current=!1)},[d]),v.useEffect(()=>()=>p.current?.dispose(),[]),v.useEffect(()=>{if(!d)return;const V=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=V}},[d]),v.useEffect(()=>{if(!d||!e)return;const V=O=>{O.key==="Escape"&&s()};return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[d,e,s]),v.useEffect(()=>{if(d)return R.current=document.activeElement instanceof HTMLElement?document.activeElement:null,()=>R.current?.focus()},[d]),v.useEffect(()=>{if(!d)return;const V=()=>{const O=m.current;if(!O||(y.current=O.offsetHeight,k.current||w.current))return;const W=D(n);S.current=W,p.current?.set(W)};return window.addEventListener("resize",V),()=>window.removeEventListener("resize",V)},[d,n,D]);const L=V=>{if(w.current)return;const O=p.current;if(!O)return;V.currentTarget.setPointerCapture(V.pointerId);const[W]=O.stop();k.current=!0,M.current={pointerY:V.clientY,sheetY:W},T.current=[{y:V.clientY,t:performance.now()}]},$=V=>{if(!k.current)return;const O=p.current;if(!O)return;const W=M.current.sheetY+(V.clientY-M.current.pointerY),Z=y.current,B=W<0?-V_(-W,Z):Math.min(W,Z);O.set(B);const F=performance.now(),P=T.current;for(P.push({y:V.clientY,t:F});P.length>2&&F-P[0].t>100;)P.shift()},K=V=>{k.current=!1;const O=p.current;if(!O)return;const W=y.current,Z=D("half"),B=E.current?O.value+q_(V):W,F=G_(B,[0,Z,W]);if(S.current=F,F===W){if(w.current=!0,I){f(!1),s();return}O.animateTo(W,vb,{velocity:V,onSettle:()=>{f(!1),s()}});return}O.animateTo(F,vb,{velocity:V});const P=F===0?"full":"half";P!==n&&r?.(P)},X=()=>{if(!k.current)return;const V=T.current,O=V[V.length-1],W=V[0],Z=O&&W?O.t-W.t:0;K(Z>0?(O.y-W.y)/Z*1e3:0)},U=()=>{k.current&&K(0)};return d?l.jsxs("div",{className:"fixed inset-0 z-50",role:"dialog","aria-modal":"true","aria-label":o,children:[l.jsx("div",{ref:h,className:`absolute inset-0 bg-black/45 ${I?"anim-fade":""}`,style:{opacity:0},onPointerDown:()=>s()}),l.jsxs("div",{ref:m,className:`absolute inset-x-0 bottom-0 flex h-[92dvh] flex-col overflow-hidden rounded-t-2xl border-t border-gray-200 bg-white shadow-2xl dark:border-gray-800 dark:bg-gray-900 ${I?"anim-fade":""}`,style:{transform:"translate3d(0, 100%, 0)"},children:[l.jsxs("div",{className:"shrink-0 cursor-grab touch-none select-none active:cursor-grabbing",onPointerDown:L,onPointerMove:$,onPointerUp:X,onPointerCancel:U,onLostPointerCapture:U,children:[l.jsx("div",{className:"mx-auto mt-2 h-1 w-9 rounded-full bg-gray-300 dark:bg-gray-600"}),l.jsxs("div",{className:"flex items-center justify-between px-4 pb-2 pt-1.5",children:[l.jsx("span",{className:"text-base font-semibold",children:o??""}),l.jsx(cp,{onClose:s,onPointerDown:V=>V.stopPropagation()})]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain pb-[env(safe-area-inset-bottom)]",children:c})]})]}):null}function qp(e){return l.jsx("span",{className:"relative",children:l.jsx("input",{type:"file",className:"sr-only",...e})})}const Q_=new Set(["txt","md","json","js","mjs","cjs","ts","tsx","jsx","py","sh","bash","yaml","yml","toml","css","html","htm","csv","log","xml","ini","conf","rs","go","java","c","h","cpp","hpp","sql","rb","php","gitignore","env"]),X_=new Set(["png","jpg","jpeg","gif","webp","svg"]),Z_=new Set(["html","htm"]),cu=256*1024,wb=64*1024,J_={html:"html",htm:"html",css:"css",js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",json:"json",md:"markdown",py:"python",rb:"ruby",php:"php",go:"go",rs:"rust",java:"java",c:"c",h:"c",cpp:"cpp",hpp:"cpp",sh:"shellscript",bash:"shellscript",yml:"yaml",yaml:"yaml",toml:"toml",ini:"ini",conf:"ini",xml:"xml",sql:"sql",log:"log"};function eI(e){return J_[e]??"text"}function Sb(e){const n=e.lastIndexOf(".");return n>=0?e.slice(n+1).toLowerCase():e.toLowerCase()}function uu(e,n){return e===""?n:`${e}/${n}`}function jb(e){return e.includes("/")?e.slice(0,e.lastIndexOf("/")):""}const Nb=/^[a-z][a-z0-9+.-]*:/i;function Cb(e,n){const r=n.startsWith("/")||e===""?[]:e.split("/");for(const s of n.split("/"))s===""||s==="."||(s===".."?r.pop():r.push(s));return r.join("/")}const Ym="<script>(function(){function mk(){var m={};return{getItem:function(k){return k in m?m[k]:null},setItem:function(k,v){m[k]=String(v)},removeItem:function(k){delete m[k]},clear:function(){m={}},key:function(i){return Object.keys(m)[i]||null},get length(){return Object.keys(m).length}}}['localStorage','sessionStorage'].forEach(function(n){try{window[n].length}catch(e){Object.defineProperty(window,n,{value:mk(),configurable:true})}})})();<\/script>";function tI(e){return/<head[^>]*>/i.test(e)?e.replace(/<head[^>]*>/i,n=>n+Ym):/<html[^>]*>/i.test(e)?e.replace(/<html[^>]*>/i,n=>n+Ym):Ym+e}let du=0;function Tb({session:e,openRequest:n,active:r,onPreviewOpen:s}){const{previewIsolated:o}=Bn(),[c,d]=v.useState(""),[f,m]=v.useState(null),[h,p]=v.useState(null),[y,k]=v.useState(null),[w,S]=v.useState(!1),[T,M]=v.useState(null),[E,R]=v.useState(0),[I,H]=v.useState(!1),[D,L]=v.useState("rendered"),[$,K]=v.useState(null),X=v.useRef(o);X.current=o,v.useEffect(()=>{let A=!1;return p(null),D5(e.sessionId,c).then(C=>{A||m(C)}).catch(C=>{A||p(C instanceof Xa?C.message:g.files.loadFailed)}),()=>{A=!0}},[e.sessionId,c,E]);const[U,V]=v.useState(e.sessionId);U!==e.sessionId&&(V(e.sessionId),d(""),k(null),m(null),K(null),du++);const O=v.useRef(r);v.useEffect(()=>{r&&!O.current&&R(A=>A+1),O.current=r},[r]);const W=v.useRef(s);W.current=s;const Z=v.useCallback(async A=>{W.current?.();const C=A.includes("/")?A.slice(A.lastIndexOf("/")+1):A,z=Sb(C),N=++du,Q=he=>{N===du&&k(he)};if(L("rendered"),K(null),X_.has(z)){Q({path:A,name:C,kind:"image",nonce:N});return}if(z==="pdf"){Q({path:A,name:C,kind:"pdf",nonce:N});return}const se=Z_.has(z),le=z==="md";if(!se&&!Q_.has(z)){Q({path:A,name:C,kind:"unsupported",nonce:N});return}if(se&&X.current){Q({path:A,name:C,kind:"html",nonce:N});return}try{const he=await fetch(xs(e.sessionId,A),{credentials:"same-origin"});if(!he.ok)throw new Error(String(he.status));const xe=await he.text(),ne=xe.length>cu;le&&xe.length>wb&&N===du&&L("source"),Q({path:A,name:C,kind:se?"html":le?"md":"text",content:ne?xe.slice(0,cu):xe,truncated:ne,nonce:N})}catch{Q({path:A,name:C,kind:"unsupported",nonce:N})}},[e.sessionId]);v.useEffect(()=>{if(y?.kind!=="html"||y.content!==void 0||D!=="source"&&o)return;const A=y.path;let C=!1;return K(null),(async()=>{try{const z=await fetch(xs(e.sessionId,A),{credentials:"same-origin"});if(!z.ok)throw new Error(String(z.status));const N=await z.text();if(C)return;const Q=N.length>cu;k(se=>se!==null&&se.kind==="html"&&se.path===A&&se.content===void 0?{...se,content:Q?N.slice(0,cu):N,truncated:Q}:se)}catch{C||K(g.files.loadFailed)}})(),()=>{C=!0}},[y,D,o,e.sessionId]);const B=v.useRef(null);v.useEffect(()=>{if(!n||B.current===n)return;B.current=n;const A=n.path,C=A.includes("/")?A.slice(0,A.lastIndexOf("/")):"";d(C),R(z=>z+1),Z(A)},[n,Z]);const F=A=>{Z(uu(c,A))},P=A=>{S(!0),p(null),(async()=>{try{for(const C of A){const z=await new Promise((N,Q)=>{const se=new FileReader;se.onload=()=>{const le=se.result;N(le.slice(le.indexOf(",")+1))},se.onerror=()=>Q(new Error("read failed")),se.readAsDataURL(C)});await z5(e.sessionId,uu(c,C.name),z)}ea(g.files.uploaded),R(C=>C+1)}catch(C){xt(Ae(C))}finally{S(!1)}})()},ce=A=>{const C=A.target.files?[...A.target.files]:[];if(A.target.value="",C.length===0)return;const z=new Set((f?.entries??[]).map(Q=>Q.name)),N=C.filter(Q=>z.has(Q.name)).map(Q=>Q.name);N.length>0?M({files:C,clashes:N}):P(C)},oe=c===""?[]:c.split("/");return y!==null?l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[l.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-gray-200 px-3 py-2 dark:border-gray-800",children:[l.jsxs("button",{type:"button",onClick:()=>{k(null),R(A=>A+1)},title:g.files.backToList,className:"flex shrink-0 items-center gap-1 rounded-md px-1.5 py-1 text-sm text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:[l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M15 18l-6-6 6-6"})}),g.files.backToList]}),l.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-sm font-semibold",title:y.path,children:y.name}),(y.kind==="html"||y.kind==="md")&&l.jsx("div",{className:"flex shrink-0 rounded-md bg-gray-100 p-0.5 dark:bg-gray-800",children:[["rendered",g.files.htmlRendered],["source",g.files.htmlSource]].map(([A,C])=>l.jsx("button",{type:"button",onClick:()=>L(A),className:`rounded px-2 py-0.5 text-xs transition-colors duration-150 ${D===A?"bg-white font-medium text-gray-900 shadow-sm dark:bg-gray-600 dark:text-gray-100":"text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200"}`,children:C},A))}),/\.html?$/i.test(y.name)&&l.jsxs("a",{href:Py(e.sessionId,y.path),target:"_blank",rel:"noopener noreferrer",title:o?void 0:g.files.previewNotIsolatedHint,className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-transparent bg-transparent px-2.5 py-1 text-xs font-medium text-gray-600 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100",children:[g.files.openInNewTab,!o&&l.jsx("span",{"aria-label":g.files.previewNotIsolatedHint,className:"text-amber-600 dark:text-amber-500",children:"⚠"})]}),l.jsx("a",{href:xs(e.sessionId,y.path,!0),download:y.name,className:"inline-flex shrink-0 items-center rounded-md border border-transparent bg-transparent px-2.5 py-1 text-xs font-medium text-gray-600 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100",children:g.files.download})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-3",children:y.kind==="image"?l.jsx("img",{src:xs(e.sessionId,y.path),alt:y.name,className:"max-w-full rounded-md border border-gray-200 dark:border-gray-800"}):y.kind==="pdf"?l.jsx("iframe",{src:xs(e.sessionId,y.path),title:y.name,className:"h-full min-h-[60vh] w-full rounded-md border border-gray-200 dark:border-gray-800"}):y.kind==="html"&&D==="rendered"?o?l.jsx("iframe",{src:Py(e.sessionId,y.path),title:y.name,sandbox:"allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-downloads",className:"h-full min-h-[60vh] w-full rounded-md border border-gray-200 bg-white dark:border-gray-800"},y.nonce):y.content===void 0?$!==null?l.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:$}):l.jsx(Ua,{rows:6}):l.jsx("iframe",{srcDoc:tI(y.content),title:y.name,sandbox:"allow-scripts",className:"h-full min-h-[60vh] w-full rounded-md border border-gray-200 bg-white dark:border-gray-800"}):y.kind==="md"&&D==="rendered"?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"md-body text-base leading-relaxed text-gray-800 dark:text-gray-100",children:l.jsx($o,{remarkPlugins:[Bo],components:{img:({src:A,alt:C})=>l.jsx("img",{src:typeof A=="string"&&!Nb.test(A)?xs(e.sessionId,Cb(jb(y.path),A)):A,alt:C??"",loading:"lazy",className:"max-w-full"}),a:({href:A,children:C})=>{if(typeof A!="string"||A.startsWith("#"))return l.jsx("a",{href:A,children:C});if(Nb.test(A))return l.jsx("a",{href:A,target:"_blank",rel:"noreferrer",children:C});const z=Cb(jb(y.path),A);return l.jsx("a",{href:xs(e.sessionId,z),onClick:N=>{N.preventDefault(),Z(z)},children:C})}},children:y.content??""})}),y.truncated&&l.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:["… ",g.files.previewTruncated]})]}):y.kind==="text"||y.kind==="html"||y.kind==="md"?y.content===void 0?$!==null?l.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:$}):l.jsx(Ua,{rows:6}):l.jsxs(l.Fragment,{children:[l.jsx($p,{language:eI(Sb(y.name)),code:y.content,highlight:y.content.length<=wb}),y.truncated&&l.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:["… ",g.files.previewTruncated]})]}):l.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:g.files.previewUnsupported})})]}):l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[l.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-1 border-b border-gray-200 px-3 py-2 dark:border-gray-800",children:[l.jsx("button",{type:"button",onClick:()=>{d("")},className:"rounded px-1.5 py-0.5 text-sm text-gray-600 transition-colors duration-150 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800",children:g.files.root}),oe.map((A,C)=>l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("span",{className:"text-gray-300 dark:text-gray-700",children:"/"}),l.jsx("button",{type:"button",onClick:()=>d(oe.slice(0,C+1).join("/")),className:"max-w-32 truncate rounded px-1 py-0.5 text-sm text-gray-600 transition-colors duration-150 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800",children:A})]},C)),l.jsx("span",{className:"flex-1"}),l.jsx(ha,{open:I,setOpen:H,menuClass:"right-0 top-full mt-1 w-max max-w-72 origin-top-right",button:l.jsx(Se,{size:"sm",variant:I?"primary":"ghost",onClick:()=>H(A=>!A),children:g.files.details}),children:l.jsxs("div",{className:"px-3.5 py-2.5",children:[l.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:g.files.workspacePath}),l.jsx("p",{className:"mt-1 break-all font-mono text-xs leading-5",children:e.workspace})]})}),l.jsx(Se,{size:"sm",variant:"ghost",onClick:()=>R(A=>A+1),children:g.files.refresh}),l.jsxs("label",{className:"inline-flex cursor-pointer items-center rounded-md border border-transparent bg-transparent px-2.5 py-1 text-xs font-medium text-gray-600 transition-colors duration-150 focus-within:ring-2 focus-within:ring-gray-400/30 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-800 dark:hover:text-gray-100",children:[l.jsx(qp,{multiple:!0,onChange:ce,disabled:w}),w?g.common.saving:g.files.upload]})]}),l.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:h?l.jsx("p",{className:"px-3 py-3 text-sm text-red-600 dark:text-red-400",children:h}):f===null?l.jsx(Ua,{rows:6}):f.entries.length===0?l.jsx("p",{className:"px-3 py-3 text-sm text-gray-400",children:g.files.empty}):l.jsx("ul",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:f.entries.map(A=>l.jsx("li",{children:l.jsxs("div",{className:"group flex items-center gap-2 px-3 py-1.5 transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[l.jsxs("button",{type:"button",onClick:()=>A.kind==="dir"?d(uu(c,A.name)):F(A.name),className:"flex min-w-0 flex-1 items-center gap-2 text-left",title:A.name,children:[l.jsx("span",{className:"shrink-0 text-gray-400","aria-hidden":!0,children:A.kind==="dir"?l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:l.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"})}):l.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:l.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})})}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:A.name})]}),l.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400 dark:text-gray-500",children:A.kind==="file"?No(A.sizeBytes):""}),l.jsx("span",{className:"hidden shrink-0 font-mono text-xs text-gray-400 sm:block dark:text-gray-500",children:A.mtime?ma(A.mtime):""}),A.kind==="file"&&l.jsx("a",{href:xs(e.sessionId,uu(c,A.name),!0),download:A.name,title:g.files.download,className:"shrink-0 rounded p-1 text-gray-300 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-700 group-hover:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:"M12 3v12m0 0l-4-4m4 4l4-4M4 21h16"})})})]})},A.name))})}),l.jsx(ga,{open:T!==null,title:g.files.overwriteTitle,tone:"primary",confirmLabel:g.files.upload,onClose:()=>M(null),onConfirm:()=>{T&&P(T.files),M(null)},children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:g.files.overwriteConfirm(T?.clashes.length??0)}),l.jsx("ul",{className:"max-h-40 overflow-y-auto rounded-md border border-gray-200 px-3 py-1.5 dark:border-gray-800",children:(T?.clashes??[]).map(A=>l.jsx("li",{className:"truncate py-0.5 font-mono text-xs",title:A,children:A},A))})]})})]})}function nI(){return l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor","aria-hidden":!0,children:l.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})}function aI({session:e,panel:n}){return n.isDocked?l.jsxs(l.Fragment,{children:[n.open&&l.jsx("div",{onMouseDown:n.startResize,onDoubleClick:n.resetWidth,title:g.files.resizeHandle,className:`w-1.5 shrink-0 cursor-col-resize transition-colors duration-150 hover:bg-brand-300/50 dark:hover:bg-brand-700/40 ${n.resizing?"bg-brand-400/60":"bg-transparent"}`}),l.jsx("div",{ref:n.panelRef,style:{width:n.open?n.width:0},inert:!n.open,className:`relative flex min-h-0 shrink-0 flex-col overflow-hidden ${n.open?"border-l border-gray-200 dark:border-gray-800":""} ${n.resizing?"pointer-events-none":"transition-[width] duration-200"}`,children:l.jsxs("div",{style:{width:n.width},className:"flex h-full min-h-0 flex-col",children:[l.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-3 pt-2",children:[l.jsx("h4",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:g.files.title}),l.jsx("button",{type:"button",onClick:()=>n.setOpen(!1),title:g.common.close,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:l.jsx(nI,{})})]}),l.jsx("div",{className:"min-h-0 flex-1",children:l.jsx(Tb,{session:e,openRequest:n.openRequest,active:n.open})})]})})]}):l.jsx(lw,{open:n.open,snap:n.sheetSnap,onSnapChange:n.setSheetSnap,onClose:()=>n.setOpen(!1),title:g.files.title,children:l.jsx("div",{className:"flex h-full min-h-0 flex-col",children:l.jsx("div",{className:"min-h-0 flex-1",children:l.jsx(Tb,{session:e,openRequest:n.openRequest,active:n.open,onPreviewOpen:()=>n.setSheetSnap("full")})})})})}const fd=320,Gu="penguin.panelWidth",rI=["penguin.filesPanelWidth","penguin.subagentsPanelWidth"];function Wu(e){return Math.max(fd,Math.min(720,Math.round(e*.5)))}function iw(e){return Math.min(Wu(e),Math.max(fd,Math.round(e*.4)))}function sI(){try{const e=Number(localStorage.getItem(Gu));if(Number.isFinite(e)&&e>0)return e;let n=null;for(const r of rI){const s=Number(localStorage.getItem(r));Number.isFinite(s)&&s>0&&(n=Math.max(n??0,s)),localStorage.removeItem(r)}return n!==null&&localStorage.setItem(Gu,String(Math.round(n))),n}catch{return null}}function lI(){const e=sI();return e===null?iw(window.innerWidth):Math.min(Wu(window.innerWidth),Math.max(fd,Math.round(e)))}let Ku=null;const Bh=new Set;function fu(){return Ku??=lI(),Ku}function Qm(e){if(e!==Ku){Ku=e;for(const n of Bh)n()}}function iI(e){return Bh.add(e),()=>Bh.delete(e)}function ow(){const e=v.useSyncExternalStore(iI,fu,fu),[n,r]=v.useState(!1),s=v.useRef(null);v.useEffect(()=>{if(!n)return;const d=m=>{const h=s.current?.getBoundingClientRect(),p=h?h.right:window.innerWidth;Qm(Math.min(Wu(window.innerWidth),Math.max(fd,p-m.clientX)))},f=()=>{r(!1);try{localStorage.setItem(Gu,String(Math.round(fu())))}catch{}};return document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",d),window.addEventListener("mouseup",f),()=>{document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",d),window.removeEventListener("mouseup",f)}},[n]);const o=v.useCallback(d=>{d.preventDefault(),r(!0)},[]),c=v.useCallback(()=>{Qm(iw(window.innerWidth));try{localStorage.removeItem(Gu)}catch{}},[]);return v.useEffect(()=>{const d=()=>Qm(Math.min(fu(),Wu(window.innerWidth)));return window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[]),{width:e,resizing:n,startResize:o,resetWidth:c,panelRef:s}}const Mb="(min-width: 1024px)";function oI(e){const[n,r]=v.useState(!1),[s,o]=v.useState("half"),[c,d]=v.useState(null),f=v.useCallback(k=>{k&&o("half"),r(k)},[]),m=ow(),[h,p]=v.useState(()=>window.matchMedia(Mb).matches);v.useEffect(()=>{d(null)},[e]),v.useEffect(()=>{const k=window.matchMedia(Mb),w=S=>p(S.matches);return k.addEventListener("change",w),()=>k.removeEventListener("change",w)},[]);const y=v.useCallback(k=>{o("full"),d({path:k})},[]);return{open:n,setOpen:f,sheetSnap:s,setSheetSnap:o,browsePath:y,openRequest:c,isDocked:h,...m}}function cI({nodes:e,selectedId:n,labelFor:r,onSelect:s}){const o=t8(e);return l.jsx("div",{role:"group","aria-label":g.subagentPanel.topologyLabel,className:"overflow-x-auto",children:l.jsxs("div",{className:"relative",style:{width:o.width,height:o.height},children:[l.jsx("svg",{width:o.width,height:o.height,className:"absolute inset-0 text-gray-300 dark:text-gray-700","aria-hidden":!0,children:o.edges.map(c=>l.jsx("path",{d:c.path,fill:"none",stroke:"currentColor",strokeWidth:"1.5"},`${c.fromId}>${c.toId}`))}),o.nodes.map(({node:c,x:d,y:f})=>{const m=r(c),h=c.sessionId===n,p=c.running?g.subagentPanel.nodeRunning:g.subagentPanel.nodeDone,y=c.description!==null?`${m} · ${p}
|
|
173
|
-
${c.description}`:`${m} · ${p}`;return l.jsxs("button",{type:"button","aria-label":`${m} · ${p}`,"aria-pressed":h,title:y,onClick:()=>s(c),style:{left:d,top:f,width:Au,height:fo},className:`absolute flex flex-col justify-center gap-0.5 rounded-md border bg-white px-2 text-left transition-colors duration-150 dark:bg-gray-900 ${h?"border-brand-500 ring-1 ring-brand-500":"border-gray-200 hover:border-gray-300 hover:bg-gray-50 dark:border-gray-700 dark:hover:border-gray-600 dark:hover:bg-gray-800/60"}`,children:[l.jsxs("span",{className:"flex w-full min-w-0 items-center gap-1.5",children:[l.jsx(pa,{id:c.agentId??c.sessionId,name:m,size:18}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-xs font-medium text-gray-700 dark:text-gray-300",children:m}),c.running?c.startedMs!==void 0&&l.jsx("span",{className:"shrink-0 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:l.jsx(Mo,{sinceMs:c.startedMs})}):c.elapsedMs!==void 0&&l.jsx("span",{className:"shrink-0 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:vn(c.elapsedMs)}),l.jsx(Ho,{state:c.running?"running":"done",size:10})]}),c.description!==null&&l.jsx("span",{className:"w-full truncate pl-[24px] text-[10px] leading-tight text-gray-400 dark:text-gray-500",children:c.description})]},c.sessionId)})]})})}function uI({session:e,model:n,version:r,taskRunning:s,ctx:o,focusRequest:c,taskScope:d}){const{agents:f}=gn(),{sessions:m}=ll(),[h,p]=v.useState(null);v.useEffect(()=>{c&&p({sessionId:c.sessionId,origin:c.origin})},[c]);const y=v.useMemo(()=>(d?ZR(n,e.sessionId,s,d.anchorSessionId):null)??XR(n,e.sessionId,s),[n,r,e.sessionId,s,d]),k=y.find(D=>D.depth>0)??null,w=h??(k?{sessionId:k.sessionId,origin:k.origin}:null),S=D=>{if(D.depth===0){const L=f.find($=>$.agentId===e.agentId);return L?L.name?.length?L.name:L.agentId:e.agentId}return _h(D,f,m)??Ih(D.sessionId)},T=w!==null&&w.origin.length===0,M=w?y.find(D=>D.sessionId===w.sessionId)??null:null,E=w&&!T?e8(n,w.origin):null,R=M?S(M):w?_h({sessionId:w.sessionId,agentId:E?.meta?.agentId??null},f,m)??g.chat.subagent:"",I=M?.running??!1,H=w?{...o,origin:w.origin,taskRunning:I}:null;return l.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[l.jsxs("div",{className:"shrink-0 border-b border-gray-200 px-3 pb-2 pt-1.5 dark:border-gray-800",children:[l.jsx("p",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:g.subagentPanel.topologyLabel}),y.length>1?l.jsx("div",{className:"max-h-48 overflow-y-auto",children:l.jsx(cI,{nodes:y,selectedId:w?.sessionId??null,labelFor:S,onSelect:D=>p({sessionId:D.sessionId,origin:D.origin})})}):l.jsx("p",{className:"py-1 text-xs text-gray-400 dark:text-gray-500",children:g.subagentPanel.empty})]}),w===null?l.jsx("div",{className:"min-h-0 flex-1",children:l.jsx(mr,{title:g.subagentPanel.empty})}):T?l.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center p-4",children:l.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500",children:g.subagentPanel.mainSessionNote})}):E===null?l.jsx("div",{className:"min-h-0 flex-1",children:l.jsx(mr,{title:g.subagentPanel.empty})}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-gray-100 px-3 py-1.5 dark:border-gray-800/60",children:[l.jsx(pa,{id:E.meta?.agentId??w.sessionId,name:R,size:16}),l.jsx("span",{className:"min-w-0 truncate text-xs font-semibold text-gray-700 dark:text-gray-300",children:R}),l.jsx("span",{title:w.sessionId,className:"shrink-0 font-mono text-[10px] text-gray-400 dark:text-gray-500",children:Ih(w.sessionId)}),I&&l.jsx(Ho,{state:"running",size:10,label:g.chat.subagentRunning})]}),l.jsx("div",{className:"min-h-0 flex-1",children:H&&l.jsx(H2,{items:E.items,version:r,ctx:H},w.sessionId)})]})]})}function dI(){return l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor","aria-hidden":!0,children:l.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})}function fI({session:e,panel:n,model:r,version:s,taskRunning:o,ctx:c}){const d=l.jsx(uI,{session:e,model:r,version:s,taskRunning:o,ctx:c,focusRequest:n.focusRequest,taskScope:n.taskScope},e.sessionId);return n.isDocked?l.jsxs(l.Fragment,{children:[n.open&&l.jsx("div",{onMouseDown:n.startResize,onDoubleClick:n.resetWidth,title:g.files.resizeHandle,className:`w-1.5 shrink-0 cursor-col-resize transition-colors duration-150 hover:bg-brand-300/50 dark:hover:bg-brand-700/40 ${n.resizing?"bg-brand-400/60":"bg-transparent"}`}),l.jsx("div",{ref:n.panelRef,style:{width:n.open?n.width:0},inert:!n.open,className:`relative flex min-h-0 shrink-0 flex-col overflow-hidden ${n.open?"border-l border-gray-200 dark:border-gray-800":""} ${n.resizing?"pointer-events-none":"transition-[width] duration-200"}`,children:l.jsxs("div",{style:{width:n.width},className:"flex h-full min-h-0 flex-col",children:[l.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-3 pt-2",children:[l.jsx("h4",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:g.subagentPanel.title}),l.jsx("button",{type:"button",onClick:()=>n.setOpen(!1),title:g.common.close,className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:l.jsx(dI,{})})]}),l.jsx("div",{className:"min-h-0 flex-1",children:d})]})})]}):l.jsx(lw,{open:n.open,snap:n.sheetSnap,onSnapChange:n.setSheetSnap,onClose:()=>n.setOpen(!1),title:g.subagentPanel.title,children:l.jsx("div",{className:"flex h-full min-h-0 flex-col",children:l.jsx("div",{className:"min-h-0 flex-1",children:d})})})}const Eb="(min-width: 1024px)";function mI(){return{sessionId:null,taskCount:0,autoOpenedAt:null}}function hI(e,n){const r=n.sessionId!==e.sessionId,s=!r&&n.taskCount<e.taskCount;return(r||n.taskCount!==e.taskCount)&&(e.sessionId=n.sessionId,e.taskCount=n.taskCount,e.autoOpenedAt=s?n.taskCount:null),n.liveSpawn&&e.autoOpenedAt!==e.taskCount?(e.autoOpenedAt=e.taskCount,"autoOpen"):null}function pI(e){const[n,r]=v.useState(!1),[s,o]=v.useState("half"),[c,d]=v.useState(null),[f,m]=v.useState(null),h=v.useCallback(S=>{S&&(o("half"),m(null)),r(S)},[]),p=ow(),[y,k]=v.useState(()=>window.matchMedia(Eb).matches);v.useEffect(()=>{d(null),m(null)},[e]),v.useEffect(()=>{const S=window.matchMedia(Eb),T=M=>k(M.matches);return S.addEventListener("change",T),()=>S.removeEventListener("change",T)},[]);const w=v.useCallback((S,T)=>{o("full"),m({anchorSessionId:T[0]??S}),d({sessionId:S,origin:T})},[]);return{open:n,setOpen:h,sheetSnap:s,setSheetSnap:o,focusSubagent:w,focusRequest:c,taskScope:f,isDocked:y,...p}}const gI=300;function xI(e){const n=Bn().user?.userId??null,r=n&&e?rw(n,e):null,s=v.useMemo(()=>r?dd(r):{},[r]),o=v.useRef(s.text??""),c=v.useRef(s.handoffAgentId??null),d=v.useRef(s.switchModelRef??null),f=v.useRef(s.skills??[]),m=v.useRef(null),h=v.useCallback(()=>{m.current!==null&&(window.clearTimeout(m.current),m.current=null)},[]),p=v.useCallback(()=>{if(h(),!r)return;const M=o.current,E=c.current,R=d.current,I=f.current;if(!M&&!E&&!R&&I.length===0){Vu(r);return}const H={text:M};E&&(H.handoffAgentId=E),R&&(H.switchModelRef=R),I.length>0&&(H.skills=I),Ao(r,H)},[h,r]);v.useEffect(()=>(o.current=s.text??"",c.current=s.handoffAgentId??null,d.current=s.switchModelRef??null,f.current=s.skills??[],()=>{m.current!==null&&(window.clearTimeout(m.current),m.current=null,p())}),[s,p]);const y=v.useCallback(M=>{o.current=M,h(),m.current=window.setTimeout(()=>{m.current=null,p()},gI)},[h,p]),k=v.useCallback(M=>{c.current=M,p()},[p]),w=v.useCallback(M=>{d.current=M,p()},[p]),S=v.useCallback(M=>{f.current=M,p()},[p]),T=v.useCallback(()=>{h(),o.current="",f.current=[],c.current=null,d.current=null,r&&Vu(r)},[h,r]);return{initial:s,onTextChange:y,onHandoffTargetChange:k,onPendingModelChange:w,onSkillsChange:S,discard:T}}function Xm(e){const n=e.lastIndexOf("-");if(n<=0)return null;const r=Number.parseInt(e.slice(n+1),10);return!Number.isInteger(r)||r<0?null:{epoch:e.slice(0,n),seq:r}}function yI(e){const n=e.now??(()=>Date.now()),r=new Set,s=new Map;let o=Mu(r),c=!1,d="buffering",f=[],m=null,h=null,p=0,y=!1;const k=()=>{s.size!==0&&(s.clear(),e.onPendingChange())},w=(R,I)=>{if(gp(R)&&R.payload.type==="approval_decision"&&s.delete(Yl(R.origin,R.payload.tool_call_id))&&e.onPendingChange(),I&&!Du(R.payload)&&r3(I,R)){Nk(o,R);return}zu(o,R,n())},S=R=>{switch(R.type){case"approval_request":{const I=R.toolCall.payload.tool_call_id,H={toolCall:R.toolCall};if(R.origin&&(H.origin=R.origin),s.set(Yl(R.origin,I),H),!Y4(o,R.origin,I)){const D={...R.toolCall};R.origin&&R.origin.length>0?D.origin=[...R.origin]:delete D.origin,zu(o,D,n()),e.onModelChange()}e.onPendingChange();return}case"task_state":{m=R.state,e.onTaskState(R.state),e.onQueuedFollowUps?.(R.queued??0),e.onPendingSteering?.(R.pendingSteering??[]),R.state==="idle"&&(G4(o),k(),e.onModelChange());return}case"resync_required":{T();return}case"credentials_updated":{o.lastAuthFailureMs=null,e.onModelChange();return}case"hello":return}},T=async()=>{p+=1,d="buffering",f=[],k(),await E(p,Mu(r))},M=(R,I)=>{const H=Xm(I.cursor);if(!H)return R;const D=h===null?null:Xm(h);if(D!==null&&D.epoch!==H.epoch)return R;const L=[],$=[];for(const X of R){const U=X.id===null?null:Xm(X.id);U!==null&&U.epoch===H.epoch&&U.seq<=H.seq?(X.kind!=="omni"||!Du(X.msg.payload))&&L.push(X):$.push(X)}const K=I.fragments.map(X=>({kind:"omni",msg:X,id:null,seeded:!0}));return[...L,...K,...$]},E=async(R,I)=>{try{const{messages:H,live:D,serverNowMs:L}=await e.loadMessages();if(c||R!==p)return;I&&(o=I);const $=o;V4($,H,n(),L??null);const K=a3(H,100),X=D!==void 0?M(f,D):f;f=[];for(let U=0;U<X.length;U+=1){const V=X[U];if(V.kind==="omni"?w(V.msg,K):S(V.ev),c)return;if(R!==p){f.push(...X.slice(U+1).filter(O=>O.kind!=="omni"||!O.seeded));return}}d="live",m==="idle"&&W4($),y=!1,e.onError(null),e.onLoading(!1),e.onModelChange()}catch(H){if(c||R!==p)return;y=!0,e.onLoading(!1),e.onError(H instanceof Error?H.message:String(H))}};return{get model(){return o},get pendingApprovals(){return s},load:()=>(p+=1,E(p)),retry:async()=>{c||!y||(e.onError(null),e.onLoading(!0),p+=1,await E(p,Mu(r)))},handleOmni:(R,I=null)=>{if(!c){if(I!==null&&(h=I),d==="buffering"){f.push({kind:"omni",msg:R,id:I});return}w(R,null),e.onModelChange()}},handleServer:(R,I=null)=>{if(!c){if(I!==null&&(h=I),R.type==="session_title"){e.onSessionTitle?.(R.sessionId,R.title);return}if(R.type==="session_created"){e.onSessionCreated?.(R.sessionId);return}if(R.type==="goal_started"||R.type==="goal_round"||R.type==="goal_finished"){e.onGoalEvent?.(R);return}if(d==="buffering"){R.type==="task_state"&&(m=R.state,e.onTaskState(R.state),e.onQueuedFollowUps?.(R.queued??0),e.onPendingSteering?.(R.pendingSteering??[])),f.push({kind:"server",ev:R,id:I});return}S(R)}},markLocalDecision:R=>{K4(o,R)},resolveApproval:R=>{s.delete(R)&&e.onPendingChange()},dispose:()=>{c=!0}}}const bI=120,vI=new Map;function kI(e,n,r,s){const[o,c]=v.useState(0),[d,f]=v.useState(!0),[m,h]=v.useState(n),[p,y]=v.useState(0),[k,w]=v.useState([]),[S,T]=v.useState(null),[M,E]=v.useState(0),[R,I]=v.useState(null),H=v.useCallback(P=>{I(ce=>P.type==="goal_started"?{objective:P.objective,status:"active",budget:P.budget,used:0,rounds:0}:P.type==="goal_round"?{objective:ce?.objective??"",status:"active",budget:P.budget,used:P.used,rounds:P.round}:{objective:ce?.objective??"",status:P.outcome,budget:ce?.budget??-1,used:P.used,rounds:P.rounds})},[]),D=v.useRef(r);D.current=r;const L=v.useRef(s);L.current=s;const $=v.useRef(null),K=v.useRef(null);K.current===null&&(K.current=Mu());const X=v.useRef(null),U=v.useRef(null),V=v.useRef(0),O=v.useCallback(()=>{if(X.current!==null||U.current!==null)return;const P=()=>{V.current=Date.now(),c(oe=>oe+1)},ce=V.current+bI-Date.now();if(ce>0){U.current=window.setTimeout(()=>{U.current=null,P()},ce);return}X.current=requestAnimationFrame(()=>{X.current=null,P()})},[]);v.useEffect(()=>{if(!e){$.current?.dispose(),$.current=null,h("idle"),y(0),w([]),f(!1),T(null),I(null),E(C=>C+1),c(C=>C+1);return}c(C=>C+1),f(!0),T(null),h(n),I(null),y(0),w([]),E(C=>C+1);let P=!1;const ce=()=>{j5(e).then(C=>{P||!C.goal||C.goal.status!=="active"||I(z=>z??C.goal)}).catch(()=>{})},oe=yI({loadMessages:()=>S5(e),onTaskState:h,onQueuedFollowUps:y,onPendingSteering:w,onLoading:f,onError:T,onModelChange:O,onPendingChange:()=>E(C=>C+1),onSessionTitle:(C,z)=>D.current?.(C,z),onSessionCreated:()=>L.current?.(),onGoalEvent:H});$.current=oe;const A=$C(e,{onOmniMessage:oe.handleOmni,onServerEvent:oe.handleServer,onOpen:ce,onError:C=>{C&&Cu().catch(()=>{})}});return oe.load(),()=>{P=!0,oe.dispose(),A.close(),X.current!==null&&(cancelAnimationFrame(X.current),X.current=null),U.current!==null&&(window.clearTimeout(U.current),U.current=null)}},[e]);const W=v.useCallback(P=>{$.current?.markLocalDecision(P)},[]),Z=v.useCallback(P=>{$.current?.resolveApproval(P)},[]),B=v.useCallback(()=>{$.current?.retry()},[]),F=v.useCallback(()=>{const P=$.current?.model;P&&P.lastAuthFailureMs!==null&&(P.lastAuthFailureMs=null,c(ce=>ce+1))},[]);return{model:$.current?.model??K.current,version:o,loading:d,taskState:m,queuedFollowUps:p,pendingSteering:k,lastAuthFailureMs:($.current?.model??K.current).lastAuthFailureMs,dismissModelAuthDead:F,pendingApprovals:$.current?.pendingApprovals??vI,markLocalDecision:W,resolveApproval:Z,error:S,retry:B,goal:R}}const mu={tokens:"M4 6c0-1.7 3.6-3 8-3s8 1.3 8 3-3.6 3-8 3-8-1.3-8-3zm0 0v12c0 1.7 3.6 3 8 3s8-1.3 8-3V6M4 12c0 1.7 3.6 3 8 3s8-1.3 8-3",cost:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-15v12m2.6-9.3c-.5-.8-1.5-1.2-2.6-1.2-1.5 0-2.7.8-2.7 2 0 2.7 5.4 1.3 5.4 4 0 1.2-1.2 2-2.7 2-1.2 0-2.2-.5-2.7-1.4",elapsed:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zm0-14v5l3 2",folder:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"};function Zm({icon:e,value:n,label:r}){return l.jsxs("span",{title:r,className:"flex shrink-0 items-center gap-1 font-mono text-xs text-gray-500 dark:text-gray-400",children:[l.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:e})}),n]})}function wI({stats:e,taskOpen:n,taskStartLocalMs:r}){const[s,o]=v.useState(()=>Date.now());return v.useEffect(()=>{if(!n)return;o(Date.now());const c=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(c)},[n]),n?l.jsx(l.Fragment,{children:ak(U4(e,n,r,s))}):l.jsx(l.Fragment,{children:vn(e.sessionElapsedMs)})}function SI(e,n,r,s,o){const c=e.stats,d=e.taskOpen?vk({cacheRead:c.taskCacheRead,cacheWrite:c.taskCacheWrite,output:c.taskOutput},s):null,f=d!=null&&(d>0||n!=null)?(n??0)+d:n;return{tokensText:ft(c.sessionTotal+c.subagentTotal),costText:f!=null?Za(f,o):null,costUncosted:r,elapsedNode:l.jsx(wI,{stats:c,taskOpen:e.taskOpen,taskStartLocalMs:e.taskStartLocalMs})}}const dr="new",Ab=100;function jI(){const e=ya(),n=Wv(),{currency:r}=Ns(),{currentProject:s,currentAgent:o,setCurrentAgentId:c,reloadAgents:d,agents:f}=gn(),m=s?.projectId??null,h=o?.agentId??null,{sessions:p,loading:y,reload:k,add:w,replace:S,setStatus:T,setTitle:M}=ll(),[E,R]=v.useState(null),[I,H]=v.useState(!1),[D,L]=v.useState(!1),[$,K]=v.useState(!1),[X,U]=v.useState(!1),[V,O]=v.useState(null),[W,Z]=v.useState(""),B=n.sessionId??null,F=oI(B),P=pI(B),ce={...F,setOpen:ke=>{ke&&P.setOpen(!1),F.setOpen(ke)}},oe={...P,setOpen:ke=>{ke&&F.setOpen(!1),P.setOpen(ke)}},A=B===dr,C=A?null:p.find(ke=>ke.sessionId===B)??null,z=C?{provider:C.provider,modelId:C.modelId}:null;pr(C?C.title??g.chat.defaultSessionTitle:g.nav.chat);const N=kI(C?.sessionId??null,C?.status??"idle",M,()=>{k()}),{initial:Q,onTextChange:se,onHandoffTargetChange:le,onPendingModelChange:he,onSkillsChange:xe,discard:ne}=xI(C?.sessionId??null),pe=v.useMemo(()=>Z8(N.model.items),[N.version,B]),be=v.useMemo(()=>k_(N.model.items),[N.version,B]),Fe=v.useRef(null),qe=A_(Fe,N.version),$e=C?.sessionId??null,Ye=C?.agentId??null;v.useEffect(()=>{$e&&Ye&&c(Ye)},[$e,Ye,c]),v.useEffect(()=>{A&&(F.setOpen(!1),P.setOpen(!1))},[A]);const Et=v.useRef(mI()),kn=YR(N.model.items),je=N.taskState!=="idle"&&JR(N.model);v.useEffect(()=>{hI(Et.current,{sessionId:$e,taskCount:kn,liveSpawn:je})==="autoOpen"&&P.isDocked&&!P.open&&!F.open&&P.setOpen(!0)},[$e,kn,je]);const[We,jt]=v.useState([]);v.useEffect(()=>{if(jt(Ee=>Ee.length>0?[]:Ee),!m||!Ye)return;let ke=!1;return Yh(m,Ye).then(Ee=>{ke||jt(Ee.skills)}).catch(()=>{}),()=>{ke=!0}},[m,Ye]);const[yt,Qt]=v.useState("");v.useEffect(()=>{if(Qt(""),!m||!Ye)return;let ke=!1;return Kh(m,Ye).then(Ee=>{ke||Qt(Ee.config.model?.thinkingLevel??"")}).catch(()=>{}),()=>{ke=!0}},[m,Ye]);const[wn,Xe]=v.useState(null);v.useEffect(()=>{if(A||!B||y||p.some(Ee=>Ee.sessionId===B))return;let ke=!1;return Hy(B).then(Ee=>{ke||w(Ee.session)},()=>{ke||Xe(B)}),()=>{ke=!0}},[A,B,y,p,w]),v.useEffect(()=>{if(y||A||B&&p.some(Ee=>Ee.sessionId===B)||B&&wn!==B)return;const ke=ek(p);e(ke?`/chat/${ke.sessionId}`:`/chat/${dr}`,{replace:!0})},[y,A,B,wn,p,e]),v.useEffect(()=>{C&&T(C.sessionId,N.taskState)},[N.taskState,C,T]);const ba=v.useRef(N.taskState);v.useEffect(()=>{const ke=ba.current;ba.current=N.taskState,ke!=="idle"&&N.taskState==="idle"&&(k(),d())},[N.taskState,k,d]);const ue=v.useRef(new Map);v.useEffect(()=>{R(null),H(!1),Z(""),ue.current=new Map},[B]);const ye=v.useCallback(async ke=>{const Ee=C?.sessionId??null,dt=ue.current,Qe=Ee===null?[]:ke.filter(pt=>!dt.has(pt));if(Ee!==null&&Qe.length>0)for(let pt=0;pt<Qe.length;pt+=Ab){const Sn=Qe.slice(pt,pt+Ab),jn=U5(Ee,Sn).then(bt=>new Set(bt.existing)).catch(()=>null);for(const bt of Sn){const Kt=jn.then(fn=>fn?.has(bt)??!1);dt.set(bt,Kt),Kt.then(fn=>{dt.get(bt)===Kt&&(fn?dt.set(bt,!0):dt.delete(bt))})}}const Bt=new Set;return await Promise.all(ke.map(async pt=>{const Sn=dt.get(pt);(Sn===!0||Sn instanceof Promise&&await Sn)&&Bt.add(pt)})),Bt},[C?.sessionId]);v.useEffect(()=>{if(!m||!C||N.taskState!=="idle")return;let ke=!1;return Cv(m,{groupBy:"session",agentId:C.agentId}).then(Ee=>{if(ke)return;const dt=Ee.groups.find(Qe=>Qe.key===C.sessionId);R(dt?.cost??null),H(dt?.hasUncosted??!1)}).catch(()=>{}),()=>{ke=!0}},[m,C,N.taskState]),v.useEffect(()=>{if(!m)return;let ke=!1;return O(null),(async()=>{try{const Ee=await Xu(m);if(ke)return;O(Ee);const{prefs:dt}=await Sv();if(ke||dt.credentialGuideSeen)return;const Qe=Ee.models.find(pt=>vt(pt,Ee.defaultModel));(!Ee.defaultModel||!Qe?.credential?.apiKeyMasked)&&L(!0),Wh({credentialGuideSeen:!0}).catch(()=>{})}catch{}})(),()=>{ke=!0}},[m]);const Ne=v.useCallback(async(ke,Ee)=>{Ee!==ke&&(await k(),e(`/chat/${Ee}`,{replace:!0}))},[k,e]),He=v.useCallback(async(ke,Ee)=>{if(!C)return!1;try{const dt=await uo(C.sessionId,{input:ke,...Ee?{goal:Ee}:{},...W?{thinkingLevel:W}:{}});return ne(),await Ne(C.sessionId,dt.sessionId),!0}catch(dt){return xt(Ae(dt,{modelId:C.modelId})),!1}},[C,W,ne,Ne]),De=v.useCallback(async(ke,Ee)=>{if(!m||!C)return!1;const dt=await Hy(C.sessionId).then(pt=>pt.session.tracePath).catch(()=>{}),Qe={type:"text",text:k8({sessionId:C.sessionId,...C.title!==void 0?{sessionTitle:C.title}:{},...dt!==void 0?{tracePath:dt}:{},workspace:C.workspace,prevProvider:C.provider,prevModelId:C.modelId})};let Bt=null;try{const pt=await ih(m,C.agentId,{provider:ke.provider,modelId:ke.modelId,workspace:C.workspace,approvalMode:C.approvalMode});Bt=pt.session.sessionId;const Sn=await uo(Bt,{input:[Qe,...Ee]});return w(pt.session),ne(),e(`/chat/${Sn.sessionId}`),!0}catch(pt){return Bt&&_u(Bt).catch(()=>{}),xt(Ae(pt,{modelId:ke.modelId})),!1}},[m,C,w,ne,e]),At=v.useCallback(async(ke,Ee)=>{if(!m||!o||!C)return!1;const dt={type:"text",text:v8({agentId:o.agentId,...o.name!==void 0?{agentName:o.name}:{},sessionId:C.sessionId,workspace:C.workspace,...C.title!==void 0?{sessionTitle:C.title}:{}})};let Qe=null;try{const Bt=await ih(m,ke.agentId,{approvalMode:C.approvalMode});Qe=Bt.session.sessionId;const pt=await uo(Qe,{input:[dt,...Ee]});return w(Bt.session),ne(),e(`/chat/${pt.sessionId}`),!0}catch(Bt){return Qe&&_u(Qe).catch(()=>{}),xt(Ae(Bt,V?.defaultModel?{modelId:V.defaultModel.modelId}:{})),!1}},[m,o,C,w,ne,e,V]),Rt=v.useCallback(async()=>{C&&await C5(C.sessionId).catch(()=>{})},[C]),$t=v.useCallback(async ke=>{if(!C)return!1;try{const Ee=await uo(C.sessionId,{input:ke,queueIfBusy:!0});return ne(),await Ne(C.sessionId,Ee.sessionId),!0}catch(Ee){return xt(Ae(Ee,{modelId:C.modelId})),!1}},[C,ne,Ne]),Ke=v.useCallback(async(ke,Ee=[],dt=[])=>{if(!C)return"failed";try{return await M5(C.sessionId,{text:ke,...Ee.length>0?{images:Ee}:{},...dt.length>0?{files:dt}:{}}),ne(),"queued"}catch(Qe){return Qe instanceof Xa&&Qe.status===409?"not_running":(xt(Ae(Qe,{modelId:C.modelId})),"failed")}},[C,ne]),Wt=v.useCallback(async(ke,Ee,dt)=>{if(!C)return;N.markLocalDecision(ke);const Qe=Yl(dt,ke);try{await N5(C.sessionId,ke,{decision:Ee}),N.resolveApproval(Qe)}catch(Bt){Bt instanceof Xa&&Bt.status===404&&N.resolveApproval(Qe)}},[C,N]),Ze=v.useCallback(ke=>{!C||X||(U(!0),oh(C.sessionId,{approvalMode:ke}).then(Ee=>S(Ee.session)).catch(Ee=>{xt(Ae(Ee))}).finally(()=>U(!1)))},[C,X,S]),dn=v.useCallback(async()=>{if(C)try{const ke=await E5(C.sessionId);await Ne(C.sessionId,ke.sessionId)}catch(ke){xt(Ae(ke,{modelId:C.modelId}))}},[C,Ne]),lt=v.useCallback(()=>{e(`/chat/${dr}`)},[e]),na=v.useCallback(()=>{e("/models")},[e]),Hn=V?.models.find(ke=>vt(ke,z))?.pricing,_t={pendingApprovals:N.pendingApprovals,onApprove:Wt,origin:[],taskRunning:N.taskState!=="idle",taskCost:ke=>vk(ke.tokensByBucket,Hn),onRetryNow:()=>{C&&T5(C.sessionId).catch(()=>{})},onGiveUp:()=>{Rt()},onOpenFile:ke=>{ce.setOpen(!0),ce.browsePath(ke)},onOpenSubagent:(ke,Ee)=>{oe.setOpen(!0),oe.focusSubagent(ke,[...Ee,ke])},workspace:C?.workspace??null,statFiles:ye},En=[...N.pendingApprovals.keys()].some(ke=>!ke.startsWith(" "));if(!m||!h)return l.jsx("div",{className:"p-6",children:l.jsx(Gt,{className:"h-6 w-64"})});const Ut=SI(N.model,E,I,Hn,r),Nt=V?.models.find(ke=>vt(ke,z)),Dn=Nt?.contextWindow,va=Nt?.vision!==!1,Ha=C!==null&&!N.loading&&!N.error&&N.model.items.length===0,Pn=V?.updatedAt!==void 0?Date.parse(V.updatedAt):NaN,xn=H4(N.lastAuthFailureMs,Number.isFinite(Pn)?Pn:null),Fn=C&&l.jsx(Z2,{status:N.taskState,modelAuthDead:xn,onOpenModels:na,onRetryModelAuth:N.dismissModelAuthDead,onNewSession:lt,onSend:He,onSteer:Ke,steeringDeliveredCount:N.model.items.filter(ke=>ke.kind==="user_steering").length,pendingSteering:N.pendingSteering,onQueueFollowUp:$t,queuedFollowUps:N.queuedFollowUps,onStop:Rt,onCompact:dn,modelRef:z,...V!==null?{models:V.models}:{},...V?.defaultModel!==void 0?{defaultModel:V.defaultModel}:{},onSwitchModel:De,turnThinkingLevel:W||yt,onChangeTurnThinkingLevel:Z,...Dn!==void 0?{contextWindow:Dn}:{},contextNow:N.model.stats.contextNow,contextStale:N.model.stats.contextStale,vision:va,approvalMode:C.approvalMode,onChangeApprovalMode:Ze,modeSaving:X,autoFocus:!0,agents:f,currentAgentId:C.agentId,skills:We,...Q.skills&&Q.skills.length>0?{initialSkills:Q.skills}:{},onSkillsChange:xe,onHandoff:At,initialText:Q.text??"",onTextChange:se,history:pe,...Q.handoffAgentId?{initialHandoffTargetId:Q.handoffAgentId}:{},onHandoffTargetChange:le,...Q.switchModelRef?{initialPendingModelRef:Q.switchModelRef}:{},onPendingModelChange:he});return l.jsxs("div",{className:"flex h-full flex-col bg-white dark:bg-gray-950",children:[C&&l.jsxs("div",{className:"flex shrink-0 items-center gap-2.5 border-b border-gray-200 px-3 py-2 md:px-4 dark:border-gray-800",children:[l.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[l.jsx("h1",{className:"flex min-w-0 text-[15px] font-semibold",children:l.jsx(td,{text:C.title??g.chat.defaultSessionTitle})}),N.taskState==="running"&&l.jsxs("span",{title:g.chat.statusRunning,className:"flex shrink-0 items-center gap-1.5 text-xs text-gray-500 dark:text-gray-400",children:[l.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-emerald-500"}),l.jsx("span",{className:"hidden sm:inline",children:g.chat.statusRunning})]})]}),l.jsxs("div",{className:"hidden items-center gap-3 sm:flex",children:[l.jsx(Zm,{icon:mu.tokens,value:Ut.tokensText,label:`${g.chat.statTokens}(Token)`}),Ut.costText!=null&&l.jsx(Zm,{icon:mu.cost,value:`${Ut.costText}${Ut.costUncosted?" *":""}`,label:`${g.common.cost}(${r})${Ut.costUncosted?` · ${g.usage.uncostedNote}`:""}`}),l.jsx(Zm,{icon:mu.elapsed,value:Ut.elapsedNode,label:g.chat.statElapsed})]}),l.jsxs("button",{type:"button","aria-expanded":oe.open,onClick:()=>oe.setOpen(!oe.open),title:g.chat.openAgents,"aria-label":g.chat.openAgents,className:`flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs font-medium transition-colors duration-150 ${oe.open?"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200":"text-gray-500 hover:bg-gray-100 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200"}`,children:[l.jsxs("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":!0,children:[l.jsx("circle",{cx:"5",cy:"12",r:"2.5"}),l.jsx("circle",{cx:"19",cy:"5.5",r:"2.5"}),l.jsx("circle",{cx:"19",cy:"18.5",r:"2.5"}),l.jsx("path",{d:"M7.4 11 16.7 6.6M7.4 13l9.3 4.4"})]}),l.jsx("span",{className:"hidden sm:inline",children:g.chat.openAgents}),En&&l.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 rounded-full bg-amber-500"})]}),l.jsxs("button",{type:"button","aria-expanded":ce.open,onClick:()=>ce.setOpen(!ce.open),title:g.chat.openWorkspace,"aria-label":g.chat.openWorkspace,className:`flex h-7 shrink-0 items-center gap-1.5 rounded-md px-2 text-xs font-medium transition-colors duration-150 ${ce.open?"bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-200":"text-gray-500 hover:bg-gray-100 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200"}`,children:[l.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":!0,children:l.jsx("path",{d:mu.folder})}),l.jsx("span",{className:"hidden sm:inline",children:g.chat.openWorkspace})]}),!qe.shown&&l.jsx(__,{entries:be,scrollRef:Fe,running:N.taskState!=="idle"}),l.jsx(ha,{open:$,setOpen:K,menuClass:"right-0 top-full mt-1 w-80 max-w-[calc(100vw-1.5rem)] origin-top-right",button:l.jsx("button",{type:"button",title:g.chat.infoPanel,onClick:()=>K(!$),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:l.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("circle",{cx:"12",cy:"12",r:"9"}),l.jsx("path",{d:"M12 11v5m0-8h.01"})]})}),children:l.jsxs("div",{className:"space-y-3 px-3.5 py-2.5 text-sm",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:g.chat.model}),l.jsxs("p",{className:"truncate text-xs",children:[l.jsx("span",{className:"font-mono",children:C.modelId}),l.jsx("span",{className:"ml-1.5 text-gray-400 dark:text-gray-500",children:Br(C.provider)?.label??C.provider})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:g.chat.workspace}),l.jsx("p",{className:"break-all font-mono text-xs leading-5",children:C.workspace})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:g.common.created}),l.jsx("p",{className:"font-mono text-xs",children:ma(C.createdAt)})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:g.chat.sessionStats}),l.jsxs("p",{className:"font-mono text-xs",children:[g.chat.statTokens," ",Ut.tokensText,Ut.costText!=null&&` · ${g.common.cost} ${Ut.costText}`," ·"," ",g.chat.statElapsed," ",Ut.elapsedNode]})]})]})})]}),l.jsxs("div",{className:"flex min-h-0 flex-1",children:[l.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:A?l.jsx(U_,{projectId:m,models:V},`draft:${m}`):l.jsx("div",{className:"anim-fade flex min-h-0 flex-1 flex-col",children:C?N.error?l.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-6",children:[l.jsxs("p",{className:"text-sm text-red-600 dark:text-red-400",children:[g.chat.historyLoadFailed,":",N.error]}),l.jsx(Se,{onClick:N.retry,children:g.common.retry})]}):N.loading?l.jsxs("div",{className:"space-y-3 p-6",children:[l.jsx(Gt,{className:"h-5 w-1/3"}),l.jsx(Gt,{className:"h-5 w-2/3"}),l.jsx(Gt,{className:"h-5 w-1/2"})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"min-h-0 flex-1",children:Ha?l.jsx("div",{className:"flex h-full items-center justify-center px-4",children:l.jsx("p",{className:"text-lg font-medium text-gray-400 dark:text-gray-500",children:g.chat.emptyGreeting})}):l.jsx(H2,{items:N.model.items,version:N.version,ctx:_t,scrollElRef:Fe,outline:l.jsx(R_,{entries:be,version:N.version,scrollRef:Fe,running:N.taskState!=="idle",fit:qe})})}),l.jsx("div",{className:"shrink-0 border-t border-gray-200 bg-white px-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] pt-3 md:pb-3 dark:border-gray-800 dark:bg-gray-950",children:l.jsxs("div",{className:"mx-auto max-w-3xl",children:[N.goal&&l.jsx(d8,{goal:N.goal}),Fn]})})]}):y?l.jsx("div",{className:"space-y-3 p-6",children:l.jsx(Gt,{className:"h-5 w-1/2"})}):l.jsx(mr,{title:g.chat.noSessions,action:l.jsx(Se,{onClick:lt,children:g.nav.newChat})})},C?.sessionId??"empty")}),C&&l.jsx(fI,{session:C,panel:oe,model:N.model,version:N.version,taskRunning:N.taskState!=="idle",ctx:_t}),C&&l.jsx(aI,{session:C,panel:ce})]}),l.jsx(pn,{open:D,title:g.project.noCredentialTitle,onClose:()=>L(!1),footer:l.jsxs(l.Fragment,{children:[l.jsx(Se,{onClick:()=>L(!1),children:g.project.later}),l.jsx(Se,{variant:"primary",onClick:()=>{L(!1),e("/models")},children:g.project.goToModels})]}),children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:g.project.noCredentialBody})})]})}const cw=/^[a-z][a-z0-9_]{1,63}$/,Rb=/^[a-z][a-z0-9_]{1,31}$/,NI=/^[a-z0-9_]+$/,CI=64;function TI({open:e,onClose:n,onCreated:r}){const{user:s}=Bn(),o=s&&!s.isAdmin?`${s.userId}-`:"",[c,d]=v.useState(""),[f,m]=v.useState(""),[h,p]=v.useState(void 0),[y,k]=v.useState(!1);v.useEffect(()=>{e&&(d(""),m(""),p(void 0))},[e]);const w=async()=>{const S=o+c.trim();if(!c.trim()){p(g.common.requiredField);return}if(!(o?NI.test(c.trim())&&S.length<=CI:cw.test(S))){p(o?g.project.idPrefixHint:g.project.idHint);return}k(!0),p(void 0);try{const M=await d5({projectId:S,...f.trim()?{name:f.trim()}:{}});r(M.project.projectId)}catch(M){p(Ae(M))}finally{k(!1)}};return l.jsx(pn,{open:e,title:g.project.createTitle,onClose:n,footer:l.jsxs(l.Fragment,{children:[l.jsx(Se,{onClick:n,children:g.common.cancel}),l.jsx(Se,{variant:"primary",disabled:y,onClick:()=>{w()},children:g.common.create})]}),children:l.jsxs("div",{className:"space-y-3",children:[o?l.jsxs("div",{children:[l.jsx(Gl,{required:!0,children:g.project.id}),l.jsxs("div",{className:"flex items-stretch",children:[l.jsx("span",{className:"flex shrink-0 items-center rounded-l-md border border-r-0 border-gray-300 bg-gray-100 px-2 font-mono text-xs text-gray-500 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-400",children:o}),l.jsx(tt,{size:"sm",className:"rounded-l-none",value:c,invalid:!!h,onChange:S=>{d(S.target.value),p(void 0)},autoFocus:!0})]}),h?l.jsx(ks,{children:h}):l.jsx(dk,{children:g.project.idPrefixHint})]}):l.jsx(tt,{label:g.project.id,required:!0,size:"sm",value:c,error:h,onChange:S=>{d(S.target.value),p(void 0)},hint:g.project.idHint,autoFocus:!0}),l.jsx(tt,{label:g.project.name,size:"sm",value:f,onChange:S=>m(S.target.value)})]})})}function MI({open:e,onClose:n}){const{user:r}=Bn(),{currentProject:s,setCurrentProjectId:o,projects:c,reloadProjects:d}=gn(),[f,m]=v.useState(null),[h,p]=v.useState(""),[y,k]=v.useState(null),[w,S]=v.useState(!1),[T,M]=v.useState(""),[E,R]=v.useState(!1),[I,H]=v.useState(void 0),D=s?.projectId,L=s?.role==="owner",$=s?fh(s):"";if(v.useEffect(()=>{!e||!D||(m(null),k(null),S(!1),M($),H(void 0),Sm(D).then(O=>m(O.members)).catch(O=>k(Ae(O))))},[e,D]),!s||!D)return null;const K=async()=>{const O=T.trim();if(!(!O||O===$||E)){R(!0),H(void 0);try{await f5(D,{name:O}),await d()}catch(W){H(Ae(W))}finally{R(!1)}}},X=async()=>{if(h.trim())try{await h5(D,{userId:h.trim()}),p("");const O=await Sm(D);m(O.members)}catch(O){xt(Ae(O))}},U=async O=>{try{await p5(D,O);const W=await Sm(D);m(W.members)}catch(W){xt(Ae(W))}},V=async()=>{try{await m5(D),n();const O=c.find(W=>W.projectId!==D);await d(),O&&o(O.projectId)}catch(O){xt(Ae(O))}};return l.jsxs(pn,{open:e,title:g.project.settingsTitle,onClose:n,children:[l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[L?l.jsxs(l.Fragment,{children:[l.jsx(Gl,{children:g.project.displayName}),l.jsxs("div",{className:"flex items-stretch gap-2",children:[l.jsx(tt,{size:"sm",className:"min-w-0 flex-1",value:T,invalid:!!I,maxLength:100,onChange:O=>{M(O.target.value),I&&H(void 0)},onKeyDown:O=>{O.key==="Enter"&&K()}}),l.jsx(Se,{size:"sm",disabled:E||!T.trim()||T.trim()===$,onClick:()=>{K()},children:g.common.save})]}),I!==void 0&&l.jsx(ks,{children:I})]}):l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:g.project.switcher}),l.jsx("p",{className:"text-sm",children:$})]}),l.jsx("p",{className:"mt-1 font-mono text-xs text-gray-400",children:D})]}),l.jsxs("div",{children:[l.jsx("p",{className:"mb-2 text-xs font-medium text-gray-500",children:g.project.members}),y?l.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:y}):f===null?l.jsx("p",{className:"text-xs text-gray-400",children:g.common.loading}):l.jsx("div",{className:"overflow-x-auto rounded-md border border-gray-200 dark:border-gray-800",children:l.jsxs("table",{className:"w-full text-xs",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-gray-100 bg-gray-50 text-left text-gray-500 dark:border-gray-800 dark:bg-gray-900/60 dark:text-gray-400",children:[l.jsx("th",{className:"whitespace-nowrap px-2.5 py-1.5 font-medium",children:g.common.username}),l.jsx("th",{className:"whitespace-nowrap px-2.5 py-1.5 font-medium",children:g.common.role}),l.jsx("th",{className:"w-20 whitespace-nowrap px-2.5 py-1.5 text-right font-medium",children:g.common.actions})]})}),l.jsxs("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:[f.map(O=>l.jsxs("tr",{children:[l.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:O.userId}),l.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:l.jsx(Jt,{tone:"gray",children:O.role})}),l.jsx("td",{className:"whitespace-nowrap px-2.5 py-1 text-right",children:L&&O.role!=="owner"&&O.userId!==r?.userId&&l.jsx(Se,{size:"sm",variant:"ghost",onClick:()=>{U(O.userId)},children:g.project.removeMember})})]},O.userId)),L&&l.jsxs("tr",{children:[l.jsx("td",{className:"px-2.5 py-1.5",children:l.jsx(tt,{placeholder:g.common.username,size:"sm",value:h,onChange:O=>p(O.target.value),onKeyDown:O=>{O.key==="Enter"&&X()}})}),l.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:l.jsx(Jt,{tone:"gray",children:"member"})}),l.jsx("td",{className:"whitespace-nowrap px-2.5 py-1 text-right",children:l.jsx(Se,{size:"sm",disabled:!h.trim(),onClick:()=>{X()},children:g.project.addMember})})]})]})]})})]}),L&&l.jsx("div",{className:"border-t border-gray-100 pt-3 dark:border-gray-800",children:D==="default_project"?l.jsx("p",{className:"text-xs text-gray-400",children:g.project.deleteDefaultForbidden}):c.length<=1?l.jsx("p",{className:"text-xs text-gray-400",children:g.project.deleteLastForbidden}):l.jsx(Se,{size:"sm",variant:"danger",onClick:()=>S(!0),children:g.project.deleteProject})})]}),l.jsx(ga,{open:w,title:g.project.deleteProject,onClose:()=>S(!1),onConfirm:()=>{V()},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:g.project.deleteConfirm})})]})}const EI="M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7-10-7-10-7zM12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6z",AI="M3 3l18 18M10.6 5.1A11 11 0 0 1 12 5c6.4 0 10 7 10 7a17.6 17.6 0 0 1-3.2 3.9M6.6 6.6C4 8.3 2 12 2 12s3.6 7 10 7a10 10 0 0 0 4.8-1.2M9.9 9.9a3 3 0 0 0 4.2 4.2";function ws({label:e,hint:n,error:r,invalid:s,required:o,size:c="base",className:d,...f}){const[m,h]=v.useState(!1),p=m?g.auth.hidePassword:g.auth.showPassword,y=v.useId();return l.jsx(Lo,{label:e,hint:n,error:r,errorId:y,required:o,children:l.jsxs("div",{className:"relative",children:[l.jsx(tt,{...f,required:o,size:c,type:m?"text":"password",invalid:!!r||!!s,"aria-describedby":r?y:void 0,className:`${c==="sm"?"pr-8":"pr-10"} ${d??""}`}),l.jsx("button",{type:"button","aria-label":p,title:p,tabIndex:-1,onClick:()=>h(k=>!k),className:`absolute inset-y-0 right-0 flex items-center justify-center text-gray-400 transition-colors duration-150 hover:text-gray-600 dark:hover:text-gray-300 ${c==="sm"?"w-8":"w-10"}`,children:l.jsx("svg",{width:c==="sm"?14:16,height:c==="sm"?14:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:m?AI:EI})})})]})})}function uw({open:e,onClose:n}){const{refresh:r}=Bn(),[s,o]=v.useState(""),[c,d]=v.useState(""),[f,m]=v.useState(""),[h,p]=v.useState({}),[y,k]=v.useState(!1),w=()=>p(T=>T.old||T.new||T.confirm?{}:T);v.useEffect(()=>{e&&(o(""),d(""),m(""),p({}))},[e]);const S=async()=>{const T={};if(s||(T.old=g.common.requiredField),c||(T.new=g.common.requiredField),f||(T.confirm=g.common.requiredField),!T.confirm&&c!==f&&(T.confirm=g.account.passwordMismatch),T.old||T.new||T.confirm){p(T);return}k(!0),p({});try{await s5({oldPassword:s,newPassword:c}),await r(),n()}catch(M){M instanceof Xa&&M.code==="invalid_password"?p({new:Ae(M)}):p({old:Ae(M)})}finally{k(!1)}};return l.jsx(pn,{open:e,title:g.account.changePassword,onClose:n,footer:l.jsxs(l.Fragment,{children:[l.jsx(Se,{onClick:n,disabled:y,children:g.common.cancel}),l.jsx(Se,{variant:"primary",disabled:y,onClick:()=>{S()},children:g.common.save})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(ws,{label:g.account.oldPassword,required:!0,size:"sm",value:s,onChange:T=>{o(T.target.value),w()},error:h.old,autoComplete:"current-password",hint:g.account.oldPasswordHint,autoFocus:!0}),l.jsx(ws,{label:g.account.newPassword,required:!0,size:"sm",value:c,onChange:T=>{d(T.target.value),w()},error:h.new,autoComplete:"new-password",hint:g.auth.passwordHint}),l.jsx(ws,{label:g.account.confirmPassword,required:!0,size:"sm",value:f,onChange:T=>{m(T.target.value),w()},error:h.confirm,autoComplete:"new-password"})]})})}function RI({open:e,onClose:n,latestVersion:r,releaseUrl:s=null,canUpdate:o,onRunFinished:c}){const[d,f]=v.useState("confirm"),[m,h]=v.useState(null);v.useEffect(()=>{e&&(f("confirm"),h(null))},[e]);const p=()=>{d==="done"&&c?.(),n()},y=async()=>{f("running");try{h(await X5())}catch(w){h({status:"failed",output:Ae(w),needsRestart:!1})}f("done")},k=m===null?null:m.status==="updated"?{text:g.update.updated,className:"text-green-600 dark:text-green-400"}:m.status==="unsupported"?{text:g.update.unsupported,className:"text-amber-600 dark:text-amber-400"}:{text:g.update.failed,className:"text-red-600 dark:text-red-400"};return l.jsx(pn,{open:e,title:o?g.update.updateNow:r!==null?g.update.newVersion(r):g.update.releaseNotes,onClose:d==="running"?()=>{}:p,footer:d==="done"||!o?l.jsx(Se,{onClick:p,children:g.common.close}):l.jsxs(l.Fragment,{children:[l.jsx(Se,{onClick:p,disabled:d==="running",children:g.common.cancel}),l.jsx(Se,{variant:"primary",disabled:d==="running",onClick:()=>{y()},children:d==="running"?g.update.updating:g.update.updateNow})]}),children:d==="done"&&m!==null&&k!==null?l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:`text-sm font-medium ${k.className}`,children:k.text}),m.status==="updated"&&l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:g.update.restartHint}),m.output!==""&&l.jsx("pre",{className:"max-h-56 overflow-auto rounded-md bg-gray-100 p-3 text-xs leading-relaxed whitespace-pre-wrap text-gray-700 dark:bg-gray-800 dark:text-gray-300",children:m.output})]}):l.jsxs("div",{className:"space-y-2",children:[r!==null&&l.jsx("p",{className:"text-sm font-medium",children:g.update.newVersion(r)}),s!==null&&l.jsx("p",{children:l.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-brand-600 underline-offset-2 hover:underline dark:text-brand-300",children:g.update.releaseNotes})}),l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:o?g.update.confirmBody:g.update.adminOnly}),d==="running"&&l.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:g.update.updating})]})})}function Da({d:e,size:n=16}){return l.jsx("svg",{width:n,height:n,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:l.jsx("path",{d:e})})}const da={agents:"M12 3v3m-6 4a6 6 0 0 1 12 0v5a3 3 0 0 1-3 3H9a3 3 0 0 1-3-3v-5zm3 3h.01M15 13h.01",skills:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2zM22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",models:"M7 7h10v10H7zM4 10h3m10 0h3M4 14h3m10 0h3M10 4v3m4-3v3m-4 10v3m4-3v3",usage:"M4 20V10m6 10V4m6 16v-7m4 7H2",traces:"M4 6h16M4 12h10M4 18h13",benchmark:"M7 4h10v5a5 5 0 0 1-10 0V4zM7 5H4v1a3 3 0 0 0 3 3m10-4h3v1a3 3 0 0 1-3 3M12 14v4m-4 0h8"},dw="M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z",_I="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2zM15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0z",_b="M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z",II="m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 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",LI="M12 17v5M9 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.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1z",ro="block w-full px-3.5 py-2 text-left text-sm transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800",fw="penguin.sidebarGroupMode";function OI(){return localStorage.getItem(fw)==="agent"?"agent":"workspace"}const DI=e=>`penguin.sidebarCollapsedGroups.${e}`,zI=e=>`penguin.sidebarPinnedGroups.${e}`;function hu(e){if(!e)return new Set;try{const n=JSON.parse(localStorage.getItem(e)??"[]");return new Set(Array.isArray(n)?n.filter(r=>typeof r=="string"):[])}catch{return new Set}}function Ib(e,n){if(e)try{localStorage.setItem(e,JSON.stringify([...n]))}catch{}}const pu=(e,n)=>`${n}\0${e}`;function UI({session:e}){return e.status==="running"?l.jsx("span",{title:g.chat.statusRunning,className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-emerald-500"}):e.status==="compacting"?l.jsx("span",{title:g.chat.statusCompacting,className:"h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500"}):null}function Lb({onNavigate:e,onCollapse:n}){const r=ya(),{user:s,logout:o}=Bn(),{mode:c,setMode:d,fontScale:f,setFontScale:m,accent:h,setAccent:p,currency:y,setCurrency:k}=Ns(),{lang:w,locale:S,setLang:T}=Ja(),{projects:M,currentProject:E,setCurrentProjectId:R,reloadProjects:I,agents:H,currentAgent:D,setCurrentAgentId:L}=gn(),{sessions:$,byAgent:K,countsByAgent:X,workspaceCountsByAgent:U,isLoadedFor:V,hasMoreFor:O,loadMoreFor:W,loading:Z,remove:B,replace:F,showCliSessions:P,setShowCliSessions:ce}=ll(),A=Vv("/chat/:sessionId")?.params.sessionId??null,[C,z]=v.useState(!1),[N,Q]=v.useState(!1),[se,le]=v.useState(!1),[he,xe]=v.useState(!1),[ne,pe]=v.useState(!1),[be,Fe]=v.useState(!1),{version:qe,update:$e}=aw(N),Ye=$e?.updateAvailable===!0,Et=Ye?$e?.latestVersion??null:null,kn=qe?.buildDate??null,[je,We]=v.useState(!1),jt=async()=>{if(!je){We(!0);try{const ae=I_(await pb());ae.kind==="disabled"?Cs(g.update.checkDisabled):ae.kind==="failed"?xt(g.update.checkFailed):ae.kind==="found"?ea(g.update.foundNew(ae.latestVersion)):ea(g.update.upToDate)}catch(ae){xt(Ae(ae))}finally{We(!1)}}},yt=E?.projectId??null,Qt=yt===null?null:DI(yt),wn=yt===null?null:zI(yt),[Xe,ba]=v.useState(OI),[ue,ye]=v.useState(()=>hu(Qt)),[Ne,He]=v.useState(()=>hu(wn));v.useEffect(()=>{ye(hu(Qt)),He(hu(wn)),dn(eu)},[Qt,wn]);const[De,At]=v.useState(new Set),[Rt,$t]=v.useState(new Set),[Ke,Wt]=v.useState(new Map),[Ze,dn]=v.useState(eu),[lt,na]=v.useState(null),[Hn,_t]=v.useState(!1),[En,Ut]=v.useState(null),[Nt,Dn]=v.useState(""),[va,Ha]=v.useState(!1),[Pn,xn]=v.useState(null),Fn=ae=>{localStorage.setItem(fw,ae),ba(ae),dn(eu)},ke=v.useMemo(()=>GC($),[$]),Ee=v.useMemo(()=>VC(U),[U]),dt=v.useMemo(()=>n1(H,ae=>ae.agentId,Ne),[H,Ne]),Qe=v.useMemo(()=>n1(ke,ae=>ae.key,Ne),[ke,Ne]),Bt=ae=>Xe==="agent"?ae.agentId:Iu(ae.workspace),pt=ae=>{const ve=new Set(ue);ve.has(ae)?ve.delete(ae):ve.add(ae),ye(ve),Ib(Qt,ve)},Sn=ae=>{const ve=new Set(Ne);ve.has(ae)?ve.delete(ae):ve.add(ae),He(ve),Ib(wn,ve)},jn=(ae,ve)=>`${ve}\0${ae}`,bt=(ae,ve,Ie)=>{const it=jn(ae,ve);$t(qt=>new Set(qt).add(it)),W(Ie,ve).finally(()=>{$t(qt=>{const Lt=new Set(qt);return Lt.delete(it),Lt})})},Kt=(ae,ve,Ie)=>{const it=pu(ae,ve),qt=!De.has(it);if(At(Lt=>{const en=new Set(Lt);return qt?en.add(it):en.delete(it),en}),qt){const Lt=Ie.filter(en=>!V(en,ve));Lt.length>0&&W(Lt,ve)}},fn=v.useRef(null);v.useEffect(()=>{if(!A)return;const ae=$.find(Lt=>Lt.sessionId===A);if(!ae)return;const ve=Ka(ae);if(ve==="active"||ve==="archived")return;const Ie=`${Xe}\0${A}`;if(fn.current===Ie)return;fn.current=Ie;const it=Xe==="agent"?ae.agentId:Iu(ae.workspace),qt=pu(it,ve);At(Lt=>Lt.has(qt)?Lt:new Set(Lt).add(qt)),V(ae.agentId,ve)||W([ae.agentId],ve)},[A,$,Xe,V,W]);const Pr=async ae=>{!ae.archived&&ae.sessionId===A&&At(ve=>new Set(ve).add(pu(Bt(ae),"archived")));try{const ve=await oh(ae.sessionId,{archived:!ae.archived});F(ve.session)}catch{}},ol=async()=>{if(!En)return;const ae=Nt.trim();if(ae){Ha(!0),xn(null);try{const ve=await oh(En.sessionId,{title:ae});F(ve.session),Ut(null)}catch(ve){xn(Ae(ve))}finally{Ha(!1)}}},ai=async()=>{if(!lt)return;_t(!0);const ae=lt;try{if(await _u(ae.sessionId),B(ae.sessionId),s&&Vu(rw(s.userId,ae.sessionId)),na(null),A===ae.sessionId){const ve=(K.get(ae.agentId)??[]).filter(Ie=>{const it=Ka(Ie);return Ie.sessionId!==ae.sessionId&&(it==="active"||it==="schedule")});r(ve[0]?`/chat/${ve[0].sessionId}`:"/chat")}}catch(ve){xt(Ae(ve))}finally{_t(!1)}},xr=ae=>{r(ae),e?.()},qn=(ae,ve)=>{ae&&L(ae);const Ie={...ae?{agentId:ae}:{},...ve!==void 0?{workspace:ve}:{}};r(`/chat/${dr}`,Object.keys(Ie).length>0?{state:Ie}:void 0),e?.()},yr=(H.find(ae=>ae.agentId==="default_agent")??H[0])?.agentId,Pa=D?.agentId??yr,er=ae=>{L(ae.agentId),xr(`/chat/${ae.sessionId}`)},tr=v.useMemo(()=>new Map(H.map(ae=>[ae.agentId,hn(ae)])),[H]),An=(ae,ve)=>l.jsx("ul",{className:"space-y-0.5",children:ae.map(Ie=>l.jsx($I,{s:Ie,active:Ie.sessionId===A,...ve?{agentHint:tr.get(Ie.agentId)??Ie.agentId}:{},onOpen:er,onRename:it=>{xn(null),Dn(it.title??""),Ut(it)},onDelete:it=>na(it),onToggleArchive:it=>{Pr(it)}},Ie.sessionId))}),It="flex w-full items-center gap-1 rounded px-1.5 py-1 text-left text-[11px] font-medium text-gray-400 transition-colors duration-150 hover:bg-gray-200/50 dark:text-gray-500 dark:hover:bg-gray-800/50",Ms=(ae,ve,Ie,it,qt,Lt)=>{const en=Ie[ve],yn=Math.max(Lt?.[ve]??0,en.length);if(yn===0)return null;const rr=De.has(pu(ae,ve)),an=en.length<yn&&qt.some(qr=>O(qr,ve)),Sa=Rt.has(jn(ae,ve));return l.jsxs("div",{className:"mt-1",children:[l.jsxs("button",{type:"button",onClick:()=>Kt(ae,ve,qt),className:It,children:[l.jsx(Ln,{open:rr,size:12}),g.chat.folderGroups[ve](yn)]}),rr&&An(en,it),rr&&an&&l.jsxs("button",{type:"button","aria-label":g.chat.loadMore,disabled:Sa,onClick:()=>bt(ae,ve,qt),className:`${It} disabled:opacity-60`,children:[l.jsx("span",{className:"w-3","aria-hidden":!0}),Sa?g.common.loading:g.chat.loadMore]})]},ve)},Es=(ae,ve)=>{Wt(Ie=>{const it=new Map(Ie);return it.set(ae,(Ie.get(ae)??Js)+Js),it}),ve.length>0&&bt(ae,"active",ve)},zn=(ae,ve,Ie,it,qt)=>{const Lt=Ke.get(ae)??Js,en=ve.active.slice(0,Lt),yn=qt("active"),rr=Math.max(it?.active??0,ve.active.length),an=ve.active.length>Lt||ve.active.length<rr&&yn.some(Rn=>O(Rn,"active")),Sa=ip.map(Rn=>Ms(ae,Rn,ve,Ie,qt(Rn),it)),qr=ve.active.length===0&&Sa.every(Rn=>Rn===null),Vr=Rt.has(jn(ae,"active"));return l.jsxs(l.Fragment,{children:[qr?l.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:g.chat.noSessions}):An(en,Ie),an&&l.jsxs("button",{type:"button","aria-label":g.chat.loadMore,disabled:Vr,onClick:()=>Es(ae,yn),className:`${It} mt-0.5 disabled:opacity-60`,children:[l.jsx("span",{className:"w-3","aria-hidden":!0}),Vr?g.common.loading:g.chat.loadMore]}),Sa]})},ka=ae=>l.jsxs("button",{type:"button",onClick:()=>dn(ve=>ve+eu),className:`${It} mt-1`,children:[l.jsx("span",{className:"w-3","aria-hidden":!0}),g.chat.moreGroups(ae-Ze)]}),ri=[{to:"/agents",label:g.nav.agents,icon:da.agents},{to:"/skills",label:g.nav.skills,icon:da.skills},{to:"/models",label:g.nav.models,icon:da.models},{to:"/usage",label:g.nav.usage,icon:da.usage},{to:"/traces",label:g.nav.traces,icon:da.traces},{to:"/benchmark",label:g.nav.benchmark,icon:da.benchmark}],nr=[{value:"light",label:g.settings.themeLight},{value:"dark",label:g.settings.themeDark},{value:"system",label:g.settings.followSystem}],wa=[{value:"en",label:g.settings.langEn},{value:"zh",label:g.settings.langZh},{value:"system",label:g.settings.followSystem}],Fr=[{value:"sm",label:g.settings.fontSmall},{value:"md",label:g.settings.fontMedium},{value:"lg",label:g.settings.fontLarge}],ar=[{value:"USD",label:g.models.currencyUsd},{value:"CNY",label:g.models.currencyCny}];return l.jsxs("div",{className:"flex h-full w-full flex-col",children:[l.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-2 pt-2",children:[n&&l.jsx("button",{type:"button",title:g.nav.collapseSidebar,"aria-label":g.nav.collapseSidebar,onClick:n,className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:l.jsx(Da,{d:"M15 6l-6 6 6 6M4 4v16",size:18})}),l.jsxs(ha,{open:C,setOpen:z,className:"min-w-0 flex-1",menuClass:"left-0 right-0 top-full mt-1 origin-top",button:l.jsxs("button",{type:"button",onClick:()=>z(!C),className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-base font-semibold transition-colors duration-150 hover:bg-gray-200/70 dark:hover:bg-gray-800",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:E?fh(E):g.common.loading}),l.jsx("span",{className:"text-gray-400",children:l.jsx(op,{})})]}),children:[M.map(ae=>l.jsxs("button",{type:"button",onClick:()=>{R(ae.projectId),z(!1)},className:`flex w-full items-center justify-between gap-2 px-3.5 py-2 text-left text-sm transition-colors duration-150 hover:bg-gray-100 dark:hover:bg-gray-800 ${ae.projectId===E?.projectId?"font-semibold":""}`,children:[l.jsx("span",{className:"truncate",children:fh(ae)}),l.jsx(Jt,{tone:"gray",children:ae.role})]},ae.projectId)),l.jsxs("div",{className:"mt-1.5 border-t border-gray-100 pt-1.5 dark:border-gray-800",children:[l.jsxs("button",{type:"button",className:ro,onClick:()=>{z(!1),le(!0)},children:["+ ",g.project.create]}),E&&l.jsx("button",{type:"button",className:ro,onClick:()=>{z(!1),xe(!0)},children:g.project.settings})]})]})]}),l.jsx("div",{className:"shrink-0 px-2 pb-2 pt-2",children:l.jsxs("button",{type:"button",onClick:()=>qn(yr),className:`flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-sm font-medium transition-colors duration-150 ${A===dr?"bg-gray-200/70 text-gray-900 dark:bg-gray-800 dark:text-gray-100":"text-gray-600 hover:bg-gray-200/50 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800/70 dark:hover:text-gray-200"}`,children:[l.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:l.jsx(Da,{d:dw})}),g.chat.newSessionMenu]})}),l.jsxs("div",{className:"relative min-h-0 flex-1 overflow-y-auto px-2 pb-2",children:[l.jsx("nav",{className:"space-y-0.5",children:ri.map(ae=>l.jsxs(sp,{to:ae.to,onClick:()=>e?.(),className:({isActive:ve})=>`flex items-center gap-2 rounded-md px-2.5 py-1.5 text-sm transition-colors duration-150 ${ve?"bg-gray-200/70 font-medium text-gray-900 dark:bg-gray-800 dark:text-gray-100":"text-gray-600 hover:bg-gray-200/50 hover:text-gray-900 dark:text-gray-400 dark:hover:bg-gray-800/70 dark:hover:text-gray-200"}`,children:[l.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:l.jsx(Da,{d:ae.icon})}),ae.label]},ae.to))}),l.jsxs("div",{className:"-mx-2 mt-3 flex items-center justify-between border-t border-gray-200 px-3 pt-2 dark:border-gray-800",children:[l.jsx("span",{className:"px-1 text-[11px] font-semibold uppercase tracking-wide text-gray-400 dark:text-gray-500",children:g.chat.sessionList}),l.jsx("div",{className:"flex items-center gap-0.5",children:[{value:"workspace",icon:_b,label:g.chat.groupByWorkspace},{value:"agent",icon:da.agents,label:g.chat.groupByAgent}].map(ae=>l.jsx("button",{type:"button",title:ae.label,"aria-label":ae.label,"aria-pressed":Xe===ae.value,onClick:()=>Fn(ae.value),className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md transition-colors duration-150 ${Xe===ae.value?"bg-gray-200/70 text-gray-700 dark:bg-gray-800 dark:text-gray-200":"text-gray-400 hover:bg-gray-200/50 hover:text-gray-700 dark:text-gray-500 dark:hover:bg-gray-800/70 dark:hover:text-gray-300"}`,children:l.jsx(Da,{d:ae.icon,size:14})},ae.value))})]}),Xe==="agent"?Z&&H.length===0?l.jsx(Ua,{rows:5}):dt.slice(0,Ze).map(ae=>{const ve=t1(K.get(ae.agentId)??[]),Ie=ue.has(ae.agentId),it=Ne.has(ae.agentId);return l.jsxs("div",{className:"pt-2.5",children:[l.jsxs("div",{className:"group/header flex items-center gap-0.5 px-1 pb-0.5",children:[l.jsxs("button",{type:"button",onClick:()=>pt(ae.agentId),"aria-expanded":!Ie,"aria-label":Ie?g.nav.expandGroup:g.nav.collapseGroup,className:"flex min-w-0 flex-1 items-center gap-1 self-stretch rounded px-1 py-0.5 text-left transition-colors duration-150 hover:bg-gray-200/50 dark:hover:bg-gray-800/50",children:[l.jsx(pa,{id:ae.agentId,name:hn(ae),size:18,className:"shrink-0 rounded"}),l.jsx("span",{className:"min-w-0 truncate text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:hn(ae)}),l.jsx(Ln,{open:!Ie,size:12,className:"text-gray-400"}),l.jsx("span",{className:"min-w-0 flex-1"})]}),l.jsx(Ob,{pinned:it,onToggle:()=>Sn(ae.agentId)}),l.jsx("button",{type:"button",title:g.chat.newSessionMenu,"aria-label":g.chat.newSessionMenu,onClick:()=>qn(ae.agentId),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:l.jsx(Da,{d:"M12 5v14M5 12h14",size:18})}),l.jsx("button",{type:"button",title:g.agent.settings,onClick:()=>xr(`/agents/${ae.agentId}`),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:l.jsx(Da,{d:_I,size:16})})]}),Ie?null:zn(ae.agentId,ve,!1,X.get(ae.agentId),()=>[ae.agentId])]},ae.agentId)}):null,Xe==="agent"&&dt.length>Ze?ka(dt.length):null,Xe==="agent"?null:Z&&$.length===0?l.jsx(Ua,{rows:5}):Qe.length===0?l.jsx("p",{className:"px-2.5 pt-3 text-xs text-gray-400 dark:text-gray-600",children:g.chat.noSessions}):Qe.slice(0,Ze).map(ae=>{const ve=t1(ae.sessions),Ie=ue.has(ae.key),it=Ne.has(ae.key),qt=Ee.get(ae.key),Lt=[...new Set(ae.sessions.map(yn=>yn.agentId))],en=yn=>[...new Set([...qt?.agents[yn]??[],...Lt])];return l.jsxs("div",{className:"pt-2.5",children:[l.jsxs("div",{className:"group/header flex items-center gap-0.5 px-1 pb-0.5",children:[l.jsxs("button",{type:"button",onClick:()=>pt(ae.key),"aria-expanded":!Ie,"aria-label":Ie?g.nav.expandGroup:g.nav.collapseGroup,...ae.fullPath!==null?{title:ae.fullPath}:{},className:"flex min-w-0 flex-1 items-center gap-1 self-stretch rounded px-1 py-0.5 text-left transition-colors duration-150 hover:bg-gray-200/50 dark:hover:bg-gray-800/50",children:[l.jsx("span",{className:"shrink-0 text-gray-400 dark:text-gray-500",children:l.jsx(Da,{d:Ie?_b:II,size:15})}),l.jsx("span",{className:"min-w-0 truncate text-xs font-semibold text-gray-500 dark:text-gray-400",children:ae.temp?g.chat.tempWorkspaces:ae.label}),l.jsx("span",{className:"shrink-0 text-[11px] text-gray-400 dark:text-gray-500",children:Math.max(qt?.totals.active??0,ve.active.length)}),l.jsx(Ln,{open:!Ie,size:12,className:"text-gray-400"}),l.jsx("span",{className:"min-w-0 flex-1"})]}),l.jsx(Ob,{pinned:it,onToggle:()=>Sn(ae.key)}),l.jsx("button",{type:"button",title:g.chat.newSessionInWorkspace,"aria-label":g.chat.newSessionInWorkspace,onClick:()=>qn(Pa,ae.fullPath??""),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-gray-400 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-500 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:l.jsx(Da,{d:"M12 5v14M5 12h14",size:18})})]}),Ie?null:zn(ae.key,ve,!0,qt?.totals,en)]},ae.key)}),Xe==="workspace"&&Qe.length>Ze?ka(Qe.length):null]}),l.jsx("div",{className:"shrink-0 border-t border-gray-200 p-2 dark:border-gray-800",children:l.jsxs(ha,{open:N,setOpen:Q,menuClass:"bottom-full left-0 right-0 mb-1 origin-bottom",button:l.jsxs("button",{type:"button",onClick:()=>Q(!N),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left transition-colors duration-150 hover:bg-gray-200/70 dark:hover:bg-gray-800",children:[l.jsxs("span",{className:"relative flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-gray-900 text-xs font-bold text-white dark:bg-gray-200 dark:text-gray-900",children:[(s?.userId??"?").slice(0,1).toUpperCase(),Ye&&l.jsx("span",{"aria-hidden":!0,className:"absolute -right-0.5 -top-0.5 h-2.5 w-2.5 rounded-full border-2 border-gray-50 bg-[var(--accent-bg)] dark:border-gray-900"})]}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:s?.userId}),s?.isAdmin&&l.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:g.auth.admin})]}),children:[l.jsxs("div",{className:"space-y-2.5 px-3 py-2",children:[l.jsx($l,{label:g.settings.theme,children:l.jsx(ql,{options:nr,value:c,onChange:d})}),l.jsx($l,{label:g.settings.fontSize,children:l.jsx(ql,{options:Fr,value:f,onChange:m})}),l.jsx($l,{label:g.settings.accent,children:l.jsx(BI,{value:h,onChange:p})}),l.jsx($l,{label:g.models.currency,children:l.jsx(ql,{options:ar,value:y,onChange:k,cols:2})}),l.jsx($l,{label:g.settings.language,children:l.jsx(ql,{options:wa,value:w,onChange:T})}),l.jsx($l,{label:g.settings.showCliSessions,children:l.jsx(dp,{checked:P,onChange:ce})})]}),l.jsxs("div",{className:"mt-1 border-t border-gray-100 pt-1 dark:border-gray-800",children:[l.jsx("button",{type:"button",className:ro,onClick:()=>{Q(!1),pe(!0)},children:g.account.changePassword}),l.jsxs("button",{type:"button",disabled:je,onClick:()=>{Et!==null?(Q(!1),Fe(!0)):jt()},...kn!==null?{title:g.update.lastUpdated(sk(kn,S))}:{},className:`${ro} flex items-center justify-between gap-2 disabled:cursor-default disabled:opacity-60`,children:[l.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[je&&l.jsx("span",{"aria-hidden":!0,className:"inline-block h-3 w-3 shrink-0 animate-spin rounded-full border-[1.5px] border-current border-t-transparent opacity-70"}),!je&&Et!==null&&l.jsx("span",{"aria-hidden":!0,className:"h-2 w-2 shrink-0 rounded-full bg-[var(--accent-bg)]"}),l.jsx("span",{className:"min-w-0 truncate",children:je?g.update.checking:Et!==null?g.update.newVersion(Et):g.update.checkNow})]}),qe!==null&&l.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",children:`v${qe.version}`})]}),s?.isAdmin&&l.jsx("button",{type:"button",className:ro,onClick:()=>{Q(!1),xr("/admin/users")},children:g.admin.users}),l.jsx("button",{type:"button",className:"block w-full px-3.5 py-2 text-left text-sm text-red-600 transition-colors duration-150 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40",onClick:()=>{Q(!1),o().then(()=>r("/login"))},children:g.auth.logout})]})]})}),l.jsx(uw,{open:ne,onClose:()=>pe(!1)}),l.jsx(RI,{open:be,onClose:()=>Fe(!1),latestVersion:Et,releaseUrl:$e?.releaseUrl??null,canUpdate:s?.isAdmin===!0,onRunFinished:()=>{pb().catch(()=>{})}}),l.jsx(TI,{open:se,onClose:()=>le(!1),onCreated:ae=>{le(!1),I().then(()=>R(ae))}}),E&&l.jsx(MI,{open:he,onClose:()=>xe(!1)}),l.jsx(pn,{open:En!==null,title:g.chat.renameSession,onClose:()=>va?void 0:Ut(null),footer:l.jsxs(l.Fragment,{children:[l.jsx(Se,{onClick:()=>Ut(null),disabled:va,children:g.common.cancel}),l.jsx(Se,{variant:"primary",disabled:va||!Nt.trim(),onClick:()=>{ol()},children:g.common.save})]}),children:l.jsx(tt,{label:g.chat.renameSessionLabel,value:Nt,error:Pn??void 0,autoFocus:!0,maxLength:120,onChange:ae=>{Dn(ae.target.value),Pn&&xn(null)},onKeyDown:ae=>{ae.key==="Enter"&&Nt.trim()&&!va&&ol()}})}),l.jsx(ga,{open:lt!==null,title:g.chat.deleteSession,confirmLabel:g.common.delete,busy:Hn,onClose:()=>Hn?void 0:na(null),onConfirm:()=>{ai()},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:lt?g.chat.deleteSessionConfirm(lt.title??g.chat.defaultSessionTitle):""})})]})}function Ob({pinned:e,onToggle:n}){return l.jsx("button",{type:"button",title:e?g.nav.unpinGroup:g.nav.pinGroup,"aria-label":g.nav.pinGroup,"aria-pressed":e,onClick:n,className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md transition-all duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-200 ${e?"text-gray-500 dark:text-gray-400":"text-gray-400 opacity-0 focus-visible:opacity-100 group-hover/header:opacity-100 dark:text-gray-500"}`,children:l.jsx(Da,{d:LI,size:15})})}function $I({s:e,active:n,agentHint:r,onOpen:s,onRename:o,onDelete:c,onToggleArchive:d}){const f="flex h-6 w-6 shrink-0 items-center justify-center rounded text-gray-400 opacity-0 transition-all duration-150 focus-visible:opacity-100 group-hover:opacity-100";return l.jsx("li",{children:l.jsxs("div",{className:`group flex items-center rounded-md pr-1 transition-colors duration-150 ${n?"bg-gray-200/70 dark:bg-gray-800":"hover:bg-gray-200/50 dark:hover:bg-gray-800/70"}`,children:[l.jsxs("button",{type:"button",onClick:()=>s(e),className:"flex min-w-0 flex-1 items-center gap-1.5 px-2.5 py-1.5 text-left",children:[r!==void 0&&l.jsxs("span",{title:r,className:"flex shrink-0 items-center",children:[l.jsx(pa,{id:e.agentId,name:r,size:14,className:"rounded"}),l.jsx("span",{className:"sr-only",children:r})]}),l.jsx(td,{text:e.title??g.chat.defaultSessionTitle,className:`min-w-0 flex-1 text-sm ${n?"font-medium text-gray-900 dark:text-gray-100":e.archived?"text-gray-400 dark:text-gray-500":"text-gray-700 dark:text-gray-300"}`}),l.jsx(UI,{session:e}),e.pendingApprovalCount>0&&l.jsx("span",{title:g.chat.pendingApprovals(e.pendingApprovalCount),children:l.jsx(Jt,{tone:"amber",children:e.pendingApprovalCount})})]}),l.jsxs("div",{className:"flex shrink-0 items-center",children:[l.jsx("button",{type:"button",title:g.chat.renameSession,"aria-label":g.chat.renameSession,onClick:()=>o(e),className:`${f} hover:bg-gray-300/60 hover:text-gray-700 dark:hover:bg-gray-700 dark:hover:text-gray-200`,children:l.jsx(Da,{d:"M4 20h4L18.5 9.5a2.1 2.1 0 0 0-3-3L5 17v3zM14 7l3 3",size:14})}),l.jsx("button",{type:"button",title:e.archived?g.chat.unarchiveSession:g.chat.archiveSession,"aria-label":e.archived?g.chat.unarchiveSession:g.chat.archiveSession,onClick:()=>d(e),className:`${f} hover:bg-gray-300/60 hover:text-gray-700 dark:hover:bg-gray-700 dark:hover:text-gray-200`,children:l.jsx(Da,{d:e.archived?"M3 8h18M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8M4 8l1.5-3h13L20 8M12 17v-5m-2.5 2L12 11l2.5 3":"M3 8h18M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8M4 8l1.5-3h13L20 8M9.5 13.5 12 16l2.5-2.5",size:14})}),l.jsx("button",{type:"button",title:g.chat.deleteSession,"aria-label":g.chat.deleteSession,onClick:()=>c(e),className:`${f} hover:bg-gray-300/60 hover:text-red-600 dark:hover:bg-gray-700 dark:hover:text-red-400`,children:l.jsx(Da,{d:"M4 6h16M9 6V4.5A1.5 1.5 0 0 1 10.5 3h3A1.5 1.5 0 0 1 15 4.5V6M6 6v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V6M10 10.5v6M14 10.5v6",size:14})})]})]})})}function $l({label:e,children:n}){return l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-[11px] font-medium text-gray-500 dark:text-gray-400",children:e}),n]})}function BI({value:e,onChange:n}){return l.jsx("div",{className:"flex items-center gap-1.5",children:t5.map(r=>l.jsx("button",{type:"button",title:g.settings.accentNames[r.value],"aria-label":g.settings.accentNames[r.value],"aria-pressed":e===r.value,onClick:()=>n(r.value),className:`h-5 w-5 rounded-full border transition-transform duration-150 hover:scale-110 ${e===r.value?"border-gray-500 ring-2 ring-gray-400/50 dark:border-gray-300":"border-transparent"}`,style:{backgroundColor:r.color}},r.value))})}const HI="M8 10h8M8 14h5M21 12a9 9 0 1 1-4.2-7.6L21 4v5h-5",Jm=e=>`flex h-8 w-8 items-center justify-center rounded-md transition-colors duration-150 ${e?"bg-gray-200/70 text-gray-900 dark:bg-gray-800 dark:text-gray-100":"text-gray-500 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200"}`;function PI({onExpand:e}){const{user:n}=Bn(),r=ya(),{agents:s,setCurrentAgentId:o}=gn(),{sessions:c,loading:d}=ll(),f=Vv("/chat/:sessionId")?.params.sessionId??null,m=f!==null&&f!==dr,h=v.useMemo(()=>ek(c),[c]),p=()=>{h&&(o(h.agentId),r(`/chat/${h.sessionId}`))},y=()=>{const w=(s.find(S=>S.agentId==="default_agent")??s[0])?.agentId;w&&o(w),r(`/chat/${dr}`,w?{state:{agentId:w}}:void 0)},k=[{to:"/agents",label:g.nav.agents,icon:da.agents},{to:"/skills",label:g.nav.skills,icon:da.skills},{to:"/models",label:g.nav.models,icon:da.models},{to:"/usage",label:g.nav.usage,icon:da.usage},{to:"/traces",label:g.nav.traces,icon:da.traces},{to:"/benchmark",label:g.nav.benchmark,icon:da.benchmark}];return l.jsxs("div",{className:"flex h-full flex-col items-center gap-1 py-2.5",children:[l.jsx("button",{type:"button",title:g.nav.expandSidebar,"aria-label":g.nav.expandSidebar,onClick:e,className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-gray-500 transition-colors duration-150 hover:bg-gray-200/70 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:l.jsx(Ue,{d:"M9 6l6 6-6 6M20 4v16",size:18})}),l.jsxs("nav",{className:"no-scrollbar mt-1 flex min-h-0 flex-1 flex-col items-center gap-1 overflow-y-auto",children:[l.jsx("button",{type:"button",title:g.nav.lastConversation,"aria-label":g.nav.lastConversation,disabled:!h&&!d,onClick:p,className:h||d?Jm(m):"flex h-8 w-8 cursor-not-allowed items-center justify-center rounded-md text-gray-300 dark:text-gray-700",children:l.jsx(Ue,{d:HI,size:18})}),l.jsx("button",{type:"button",title:g.chat.newSessionMenu,"aria-label":g.chat.newSessionMenu,onClick:y,className:Jm(f===dr),children:l.jsx(Ue,{d:dw,size:18})}),k.map(w=>l.jsx(sp,{to:w.to,title:w.label,"aria-label":w.label,className:({isActive:S})=>Jm(S),children:l.jsx(Ue,{d:w.icon,size:18})},w.to))]}),l.jsx("button",{type:"button",title:`${n?.userId??""} · ${g.nav.expandSidebar}`,"aria-label":n?.userId??g.auth.admin,onClick:e,className:"mt-auto flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-gray-900 text-xs font-bold text-white dark:bg-gray-200 dark:text-gray-900",children:(n?.userId??"?").slice(0,1).toUpperCase()})]})}function FI(){const{user:e}=Bn(),[n,r]=v.useState(!1),[s,o]=v.useState(!1),[c,d]=v.useState(()=>localStorage.getItem("penguin.sidebarCollapsed")==="1"),f=()=>d(m=>{const h=!m;return localStorage.setItem("penguin.sidebarCollapsed",h?"1":"0"),h});return l.jsxs("div",{className:"flex h-full",children:[l.jsx("aside",{className:`hidden shrink-0 border-r border-gray-200 bg-gray-50 md:block dark:border-gray-800 dark:bg-gray-900 ${c?"w-12":"w-64 lg:w-72"}`,children:c?l.jsx(PI,{onExpand:f}):l.jsx(Lb,{onCollapse:f})}),l.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[l.jsxs("header",{className:"flex h-12 shrink-0 items-center gap-2 border-b border-gray-200 bg-white px-2 md:hidden dark:border-gray-800 dark:bg-gray-950",children:[l.jsx("button",{type:"button","aria-label":g.chat.sessionList,onClick:()=>r(!0),className:"flex h-9 w-9 items-center justify-center rounded-md text-gray-500 transition-colors duration-150 hover:bg-gray-100 hover:text-gray-800 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200",children:l.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round","aria-hidden":!0,children:l.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})})}),l.jsx("span",{className:"text-sm font-semibold",children:g.appName})]}),e?.passwordIsInitial&&l.jsxs("div",{className:"flex shrink-0 items-center justify-center gap-3 border-b border-amber-200 bg-amber-50 px-3 py-1.5 text-xs text-amber-800 dark:border-amber-900/60 dark:bg-amber-950/40 dark:text-amber-300",children:[l.jsx("span",{children:g.account.initialPasswordBanner}),l.jsx("button",{type:"button",className:"shrink-0 font-medium underline underline-offset-2 hover:text-amber-950 dark:hover:text-amber-100",onClick:()=>o(!0),children:g.account.changeNow})]}),l.jsx("main",{className:"min-h-0 flex-1 overflow-hidden",children:l.jsx(tC,{})})]}),l.jsx(uw,{open:s,onClose:()=>o(!1)}),l.jsx(QC,{open:n,side:"left",title:g.appName,onClose:()=>r(!1),children:l.jsx("div",{className:"h-full bg-gray-50 dark:bg-gray-900",children:l.jsx(Lb,{onNavigate:()=>r(!1)})})})]})}const Vp=1440,Gp=900,Hh=3,qI=3,Db=Vp/Hh,zb=Gp/qI,gu=28,xu=14;function VI(e){return()=>{e|=0,e=e+1831565813|0;let n=Math.imul(e^e>>>15,1|e);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}function GI(e,n){return e.x1-xu<=n.x2&&e.x2+xu>=n.x1&&e.y1-xu<=n.y2&&e.y2+xu>=n.y1}function WI(e,n,r,s){return{x1:Math.min(e,r),y1:Math.min(n,s),x2:Math.max(e,r),y2:Math.max(n,s)}}const KI=[{cell:0,edge:"left"},{cell:1,edge:"top"},{cell:2,edge:"right"},{cell:3,edge:"left"},{cell:5,edge:"right"},{cell:6,edge:"bottom"},{cell:7,edge:"bottom"},{cell:8,edge:"right"}];function YI(){const e=VI(12696599),n=[];for(const{cell:r,edge:s}of KI){const o=r%Hh*Db+gu,c=Math.floor(r/Hh)*zb+gu,d=o+Db-2*gu,f=c+zb-2*gu,m=[],h=(I,H,D,L)=>{const $=D[0]>0?d-I:D[0]<0?I-o:D[1]>0?f-H:H-c;for(let K=Math.min(60+e()*150,$);K>=40;K/=2){const X=Math.round(I+D[0]*K),U=Math.round(H+D[1]*K),V=WI(I,H,X,U);if(m.every((O,W)=>L.has(W)||!GI(V,O)))return m.push(V),[X,U]}return null},p=(I,H,D)=>(D-I)*(.35+e()*.3)>I-H?1:-1,y=(I,H,D,L,$,K,X)=>{let[U,V]=[I,H],O=D;const W=[`M${Math.round(U)},${Math.round(V)}`],Z=[];for(let B=0;B<L;B+=1){const F=B===0?X:new Set([m.length-1]),P=h(U,V,O,F);if(!P)break;[U,V]=P,W.push(`L${U},${V}`),Z.push([U,V]),O=O[0]!==0?[0,p(V,c,f)]:[p(U,o,d),0]}return Z.length>=2&&n.push({d:W.join(" "),end:Z[Z.length-1],dur:$,delay:K}),Z},k=.15+e()*.7,w=s==="left"?0:s==="right"?Vp:Math.round(o+(d-o)*k),S=s==="top"?0:s==="bottom"?Gp:Math.round(c+(f-c)*k),T=s==="left"?[1,0]:s==="right"?[-1,0]:s==="top"?[0,1]:[0,-1],M=12+e()*8,E=e()*3.2,R=y(w,S,T,3+Math.floor(e()*3),M,E,new Set);if(r%2===0&&R.length>=3){const[I,H]=R[1],[D,L]=R[2],$=[-Math.sign(D-I),-Math.sign(L-H)];y(I,H,$,2,M,E+1.4,new Set([1,2]))}}return n}const QI=YI();function XI(){return l.jsx("svg",{"aria-hidden":!0,className:"pointer-events-none absolute inset-0 h-full w-full text-slate-500/25 dark:text-cyan-300/15",viewBox:`0 0 ${Vp} ${Gp}`,preserveAspectRatio:"xMidYMid slice",fill:"none",children:QI.map((e,n)=>l.jsxs("g",{style:{"--trace-dur":`${e.dur.toFixed(1)}s`},children:[l.jsx("path",{d:e.d,pathLength:1,stroke:"currentColor",strokeWidth:"1",strokeLinecap:"round",strokeLinejoin:"round",className:"login-trace",style:{animationDelay:`${e.delay.toFixed(1)}s`}}),l.jsx("circle",{cx:e.end[0],cy:e.end[1],r:"3",fill:"currentColor",className:"login-via",style:{animationDelay:`${e.delay.toFixed(1)}s`}})]},n))})}function ZI(){pr(g.auth.login);const{login:e}=Bn(),{mode:n,setMode:r}=Ns(),{lang:s,setLang:o}=Ja(),c=ya(),[d,f]=v.useState(""),[m,h]=v.useState(""),[p,y]=v.useState({}),[k,w]=v.useState(!1),S=()=>y(R=>R.userId||R.password||R.form?{}:R),T=async()=>{const R={};if(d.trim()||(R.userId=g.common.requiredField),m||(R.password=g.common.requiredField),R.userId||R.password){y(R);return}w(!0),y({});try{await e(d.trim(),m),c("/chat",{replace:!0})}catch(I){y({form:Ae(I)})}finally{w(!1)}},M=[{value:"light",label:g.settings.themeLight},{value:"dark",label:g.settings.themeDark},{value:"system",label:g.settings.followSystem}],E=[{value:"en",label:g.settings.langEn},{value:"zh",label:g.settings.langZh},{value:"system",label:g.settings.followSystem}];return l.jsxs("div",{className:"relative flex min-h-full items-center justify-center overflow-hidden p-4",children:[l.jsx(XI,{}),l.jsxs("div",{className:"absolute right-4 top-4 flex flex-col items-end gap-1.5 sm:flex-row sm:items-center sm:gap-2",children:[l.jsx("div",{"aria-label":g.settings.language,children:l.jsx(ql,{options:E,value:s,onChange:o})}),l.jsx("div",{"aria-label":g.settings.theme,children:l.jsx(ql,{options:M,value:n,onChange:r})})]}),l.jsxs("div",{className:"anim-rise relative w-full max-w-sm",children:[l.jsx(nw,{className:"mx-auto mb-3 h-16 w-16 rounded-2xl"}),l.jsx("h1",{className:"mb-6 text-center text-3xl font-semibold tracking-tight",children:g.appName}),l.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-6 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[l.jsxs("form",{className:"space-y-4",onSubmit:R=>{R.preventDefault(),T()},children:[l.jsx(tt,{label:g.common.username,required:!0,value:d,onChange:R=>{f(R.target.value),S()},error:p.userId,autoComplete:"username",autoFocus:!0}),l.jsx(ws,{label:g.auth.password,required:!0,value:m,onChange:R=>{h(R.target.value),S()},error:p.password,autoComplete:"current-password"}),p.form&&l.jsx("p",{className:"rounded-md border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-700 dark:border-red-900 dark:bg-red-950/50 dark:text-red-300",children:p.form}),l.jsx(Se,{type:"submit",variant:"primary",className:"w-full justify-center py-2.5 text-sm font-semibold",disabled:k,children:g.auth.login})]}),l.jsx("p",{className:"mt-4 text-center text-xs text-gray-400 dark:text-gray-500",children:g.auth.defaultAdminNote})]})]})]})}const so=100,vs=30,Ia=2;function JI({data:e,label:n,className:r=""}){const s=Math.max(1,...e),o=e.length>1?(so-2*Ia)/(e.length-1):0,c=e.map((h,p)=>[Ia+p*o,vs-Ia-h/s*(vs-2*Ia)]),d=`${Ia},${vs-Ia} ${so-Ia},${vs-Ia}`,f=c.length>1?c.map(([h,p])=>`${h},${p}`).join(" "):d,m=c.length>1?`${f} ${so-Ia},${vs-Ia} ${Ia},${vs-Ia}`:null;return l.jsxs("svg",{width:so,height:vs,viewBox:`0 0 ${so} ${vs}`,role:"img","aria-label":n,className:`text-emerald-600 dark:text-emerald-500 ${r}`,children:[l.jsx("title",{children:n}),m!==null&&l.jsx("polygon",{points:m,fill:"currentColor",fillOpacity:"0.12"}),l.jsx("polyline",{points:f,fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const eL=new Set(["default_agent"]),cr={newChat:"M12 5v14M5 12h14",settings:"M10.3 4.3a2 2 0 0 1 3.4 0l.5.8a2 2 0 0 0 1.8 1l1-.1a2 2 0 0 1 1.7 3l-.5.8a2 2 0 0 0 0 2l.5.8a2 2 0 0 1-1.7 3l-1-.1a2 2 0 0 0-1.8 1l-.5.8a2 2 0 0 1-3.4 0l-.5-.8a2 2 0 0 0-1.8-1l-1 .1a2 2 0 0 1-1.7-3l.5-.8a2 2 0 0 0 0-2l-.5-.8a2 2 0 0 1 1.7-3l1 .1a2 2 0 0 0 1.8-1zM12 10a2 2 0 1 0 0 4 2 2 0 0 0 0-4z",trash:"M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2m3 0l-1 13a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2L6 7m4 4v6m4-6v6",sessions:"M8 10h8M8 14h5M21 12a9 9 0 1 1-4-7.5",vaultKeys:"M15.5 7.5l3 3L22 7l-3-3M21 2l-9.6 9.6M13 15.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z",schedules:"M12 21a7 7 0 1 0 0-14 7 7 0 0 0 0 14zm0-10v3l2 1.5M5 3L2.5 5.5M19 3l2.5 2.5",skills:"M12 6.5C10.5 5 8 4.5 4 5v12c4-.5 6.5 0 8 1.5 1.5-1.5 4-2 8-1.5V5c-4-.5-6.5 0-8 1.5zm0 0V18",usage:"M4 20V10m6 10V4m6 16v-7m4 7H2",traces:"M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7-10-7-10-7zM12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6z"};function tL(){const e=ya();pr(g.nav.agents);const{locale:n}=Ja(),{currentProject:r,agents:s,agentsLoading:o,reloadAgents:c,setCurrentAgentId:d}=gn(),[f,m]=v.useState(!1),[h,p]=v.useState(""),[y,k]=v.useState(""),[w,S]=v.useState(""),[T,M]=v.useState(void 0),[E,R]=v.useState(!1),I=()=>{p(""),k(""),S(""),M(void 0),m(!0)},[H,D]=v.useState(null),[L,$]=v.useState(null),K=r?.projectId,X=async()=>{if(!K)return;const O=h.trim();if(!O){M(g.common.requiredField);return}if(!cw.test(O)){M(g.agent.idHint);return}R(!0),M(void 0);try{const W={agentId:O};y.trim()&&(W.name=y.trim()),w.trim()&&(W.description=w.trim());const Z=await v5(K,W);m(!1),await c(),d(Z.agent.agentId),e(`/agents/${Z.agent.agentId}`)}catch(W){M(Ae(W))}finally{R(!1)}},U=O=>{d(O),e(`/chat/${dr}`,{state:{agentId:O}})},V=async()=>{if(!(!K||!H)){R(!0),$(null);try{await O5(K,H.agentId),D(null),await c()}catch(O){$(Ae(O))}finally{R(!1)}}};return l.jsxs("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:[l.jsxs("div",{className:"mx-auto max-w-5xl",children:[l.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2",children:[l.jsx("h1",{className:"text-xl font-semibold",children:g.agent.listTitle}),l.jsx(Se,{variant:"primary",onClick:I,children:g.agent.create})]}),o?l.jsx("div",{className:"space-y-3",children:Array.from({length:4},(O,W)=>l.jsxs(mk,{className:"flex flex-wrap items-center gap-x-6 gap-y-2 px-5 py-4",children:[l.jsxs("div",{className:"min-w-[14rem] flex-1",children:[l.jsx(Gt,{className:"h-[18px] w-40"}),l.jsx(Gt,{className:"mt-1.5 h-4 w-2/3"}),l.jsx(Gt,{className:"mt-1.5 h-4 w-48"})]}),l.jsx(Gt,{className:"hidden h-9 w-40 md:block"}),l.jsx(Gt,{className:"h-8 w-52"})]},W))}):s.length===0?l.jsx(mr,{title:g.common.none}):l.jsx("div",{className:"space-y-3",children:s.map(O=>{const W=eL.has(O.agentId);return l.jsxs("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-2 rounded-md border border-gray-200 bg-white px-5 py-4 dark:border-gray-800 dark:bg-gray-900",children:[l.jsxs("div",{className:"min-w-[14rem] flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(pa,{id:O.agentId,name:hn(O),size:18,className:"shrink-0 rounded"}),l.jsx("span",{className:"min-w-0 truncate text-base font-bold",children:hn(O)}),l.jsx("span",{className:"hidden shrink-0 font-mono text-xs text-gray-400 md:inline dark:text-gray-500",children:O.agentId}),l.jsxs(Jt,{tone:"gray",children:["v",O.version]}),O.activeSessionCount>0&&l.jsxs(Jt,{tone:"brand",children:[g.agent.activeSessions," ",O.activeSessionCount]})]}),l.jsx("p",{className:"mt-1.5 min-h-4 truncate text-xs text-gray-500 dark:text-gray-400",children:O.description??""}),l.jsxs("div",{className:"mt-1.5 flex items-center gap-x-2.5 text-xs text-gray-500 dark:text-gray-400",children:[l.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:g.agent.sessionCount(O.sessionCount),children:[l.jsx(Ue,{d:cr.sessions,size:12}),O.sessionCount]}),l.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:g.agent.toolCount(O.toolCount),children:[l.jsx(Ue,{d:un.toolCalls,size:12}),O.toolCount]}),l.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:g.agent.vaultKeyCount(O.vaultKeyCount),children:[l.jsx(Ue,{d:cr.vaultKeys,size:12}),O.vaultKeyCount]}),l.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:g.agent.scheduleCount(O.scheduleCount),children:[l.jsx(Ue,{d:cr.schedules,size:12}),O.scheduleCount]}),l.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:g.skills.skillCount(O.skillCount),children:[l.jsx(Ue,{d:cr.skills,size:12}),O.skillCount]}),l.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",title:`${g.agent.updatedAt} ${O.updatedAt?ma(O.updatedAt):"—"}`,children:[l.jsx(Ue,{d:un.elapsed,size:12}),O.updatedAt?ZC(O.updatedAt,n):"—"]})]})]}),l.jsx(JI,{data:O.sessionActivity,label:g.agent.activity(O.sessionActivity.length||30),className:"hidden shrink-0 md:block"}),l.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[l.jsxs(Se,{size:"sm",variant:"primary",onClick:()=>U(O.agentId),children:[l.jsx(Ue,{d:cr.newChat}),g.chat.newSessionMenu]}),l.jsxs(Se,{size:"sm",onClick:()=>{d(O.agentId),e(`/agents/${O.agentId}`)},children:[l.jsx(Ue,{d:cr.settings,className:"text-gray-600 dark:text-gray-300"}),g.common.settings]}),l.jsx(Se,{size:"icon",title:g.nav.usage,"aria-label":g.nav.usage,onClick:()=>e(`/usage?agentId=${encodeURIComponent(O.agentId)}`),children:l.jsx(Ue,{d:cr.usage,size:15,className:"text-gray-600 dark:text-gray-300"})}),l.jsx(Se,{size:"icon",title:g.nav.traces,"aria-label":g.nav.traces,onClick:()=>e(`/traces?agentId=${encodeURIComponent(O.agentId)}`),children:l.jsx(Ue,{d:cr.traces,size:15,className:"text-gray-600 dark:text-gray-300"})}),W?l.jsx("span",{role:"img",title:g.agent.builtinUndeletable,"aria-label":g.agent.builtinUndeletable,className:"inline-flex cursor-not-allowed items-center justify-center rounded-md border border-transparent p-1.5 text-gray-300 dark:text-gray-600",children:l.jsx(Ue,{d:cr.trash,size:15})}):l.jsx(Se,{size:"icon",variant:"danger",title:g.agent.deleteAgent,"aria-label":g.agent.deleteAgent,onClick:()=>D({agentId:O.agentId,name:hn(O)}),children:l.jsx(Ue,{d:cr.trash,size:15})})]})]},O.agentId)})})]}),l.jsx(pn,{open:f,title:g.agent.createTitle,onClose:()=>m(!1),footer:l.jsxs(l.Fragment,{children:[l.jsx(Se,{onClick:()=>m(!1),children:g.common.cancel}),l.jsx(Se,{variant:"primary",disabled:E,onClick:()=>{X()},children:g.common.create})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(tt,{label:g.agent.id,required:!0,size:"sm",value:h,onChange:O=>{p(O.target.value),M(void 0)},error:T,hint:g.agent.idHint,autoFocus:!0}),l.jsx(tt,{label:g.common.name,size:"sm",value:y,onChange:O=>k(O.target.value),hint:g.agent.nameHint}),l.jsx(Kl,{label:g.agent.description,size:"sm",rows:3,value:w,onChange:O=>S(O.target.value)})]})}),l.jsxs(ga,{open:H!==null,title:g.agent.deleteAgent,busy:E,onClose:()=>{D(null),$(null)},onConfirm:()=>{V()},children:[l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:H?g.agent.deleteConfirm(H.name):""}),L&&l.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:L})]})]})}function nL({items:e,active:n,onChange:r}){return l.jsx("div",{role:"tablist",className:"flex max-w-full gap-1 overflow-x-auto overflow-y-hidden border-b border-gray-200 dark:border-gray-800",children:e.map(s=>l.jsx("button",{type:"button",role:"tab","aria-selected":s.key===n,onClick:()=>r(s.key),className:`-mb-px whitespace-nowrap border-b-2 px-3 py-2 text-sm transition-colors duration-150 ${s.key===n?"border-gray-900 font-semibold text-gray-900 dark:border-gray-100 dark:text-gray-100":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-800 dark:text-gray-400 dark:hover:border-gray-700 dark:hover:text-gray-200"}`,children:s.label},s.key))})}const Ub=4,$b=16;function mw({open:e,onClose:n,estimatedHeight:r,panelWidth:s}){const o=v.useRef(null),c=v.useRef(null),[d,f]=v.useState(null),m=v.useRef(n);return m.current=n,v.useLayoutEffect(()=>{if(!e||!o.current)return;const h=o.current.getBoundingClientRect(),p=window.innerHeight-h.bottom,y=h.top,k=Math.min(r,window.innerHeight*.7),w=p<k&&y>p,S=s??h.width,T=Math.max($b,Math.min(h.left,window.innerWidth-S-$b));f({topPx:w?void 0:h.bottom+Ub,bottomPx:w?window.innerHeight-h.top+Ub:void 0,left:T,triggerWidth:h.width})},[e,r,s]),v.useEffect(()=>{if(!e)return;const h=w=>{const S=w.target;o.current?.contains(S)||c.current?.contains(S)||m.current()},p=w=>{w.key==="Escape"&&(w.stopPropagation(),m.current())},y=w=>{c.current?.contains(w.target)||m.current()},k=()=>m.current();return window.addEventListener("mousedown",h),window.addEventListener("keydown",p,!0),window.addEventListener("scroll",y,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("mousedown",h),window.removeEventListener("keydown",p,!0),window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",k)}},[e]),{triggerRef:o,panelRef:c,position:d}}const aL=288,rL={base:"text-base",sm:"text-xs"},sL={base:"text-xs",sm:"text-[11px]"};function Ph({options:e,value:n,onChange:r,placeholder:s,mono:o,label:c,error:d,required:f,fullWidth:m,size:h="base","aria-label":p}){const[y,k]=v.useState(!1),{triggerRef:w,panelRef:S,position:T}=mw({open:y,onClose:()=>k(!1),estimatedHeight:e.length*48+16,panelWidth:aL}),M=n!=null?e.find(I=>I.value===n):void 0,E=v.useId(),R=l.jsxs(l.Fragment,{children:[l.jsxs("button",{ref:w,type:"button","aria-label":p,"aria-haspopup":"listbox","aria-expanded":y,"aria-required":f||void 0,"aria-invalid":d?!0:void 0,"aria-describedby":d?E:void 0,onClick:()=>k(I=>!I),className:`flex items-center gap-2 ${mp} ${hp[h]} ${d?ad:""}`+(m?" w-full justify-between":""),children:[l.jsx("span",{className:`min-w-0 truncate ${o?"font-mono":""}`,children:M?.triggerLabel??s??"—"}),l.jsx(op,{className:"text-gray-400"})]}),y&&T&&ei.createPortal(l.jsx("div",{ref:S,role:"listbox",style:{position:"fixed",top:T.topPx,bottom:T.bottomPx,left:T.left,minWidth:T.triggerWidth},className:"anim-pop z-[60] max-h-[70vh] w-72 max-w-[calc(100vw-2rem)] overflow-y-auto rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900",children:e.map(I=>l.jsxs("button",{type:"button",role:"option","aria-selected":I.value===n,onClick:()=>{r(I.value),k(!1)},className:`block ${uk} hover:bg-gray-100 dark:hover:bg-gray-800 ${I.value===n?"bg-gray-100 dark:bg-gray-800":""}`,children:[l.jsxs("span",{className:"flex items-center justify-between gap-2",children:[l.jsx("span",{className:`${rL[h]} ${I.value===n?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`,children:I.label}),I.value===n&&l.jsx(nk,{className:"text-gray-500 dark:text-gray-400"})]}),l.jsx("span",{className:`mt-0.5 block ${sL[h]} text-gray-500 dark:text-gray-400`,children:I.description})]},I.value))}),document.body)]});return l.jsx(Lo,{label:c,error:d,errorId:E,required:f,children:R})}const lL=/^[A-Za-z_][A-Za-z0-9_]*$/;function iL({agentId:e}){const{currentProject:n}=gn(),r=n?.projectId??null,s=n?.role==="owner",[o,c]=v.useState(null),[d,f]=v.useState(null),[m,h]=v.useState(!1),[p,y]=v.useState(!1),[k,w]=v.useState(""),[S,T]=v.useState(""),[M,E]=v.useState({}),R=()=>E(W=>W.key||W.value?{}:W),[I,H]=v.useState(null),[D,L]=v.useState(null),$=v.useCallback(async()=>{if(!(!r||!e)){c(null),f(null);try{const W=await x5(r,e);c(W.entries)}catch(W){f(Ae(W))}}},[r,e]);v.useEffect(()=>{$()},[$]);const K=async W=>{if(!r||!e)return g.common.unknownError;h(!0);try{const Z=await y5(r,e,W);return c(Z.entries),ea(g.common.saved),null}catch(Z){return Ae(Z)}finally{h(!1)}},X=W=>(o??[]).filter(Z=>Z.key!==W).map(Z=>({key:Z.key})),U=()=>{w(""),T(""),E({}),y(!0)},V=async()=>{const W=k.trim(),Z={};if(W?lL.test(W)||(Z.key=g.vault.keyInvalid):Z.key=g.common.requiredField,S||(Z.value=g.vault.valueRequired),Z.key||Z.value){E(Z);return}if(E({}),D!==W&&(o??[]).some(F=>F.key===W)){L(W);return}L(null);const B=await K({entries:[...X(W),{key:W,value:S}]});if(B!==null){E({key:B});return}y(!1)},O=async()=>{if(I===null)return;const W=await K({entries:X(I)});W!==null&&xt(W),H(null)};return r?l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:g.vault.desc}),!s&&l.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:g.vault.readOnlyHint})]}),o===null?l.jsx(Ua,{rows:4}):o.length===0?l.jsx("p",{className:"py-2 text-xs text-gray-400 dark:text-gray-500",children:g.vault.empty}):l.jsx("div",{className:"overflow-x-auto overflow-y-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:l.jsxs("table",{className:"w-full min-w-[420px] text-left text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-gray-200 bg-gray-50/80 text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900",children:[l.jsx("th",{className:"px-3 py-2.5",children:g.vault.key}),l.jsx("th",{className:"px-3 py-2.5",children:g.vault.valueMasked}),l.jsx("th",{className:"px-3 py-2.5"})]})}),l.jsx("tbody",{children:o.map(W=>l.jsxs("tr",{className:"border-b border-gray-100 transition-colors duration-150 last:border-b-0 hover:bg-gray-50 dark:border-gray-800/60 dark:hover:bg-gray-800/40",children:[l.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:W.key}),l.jsx("td",{className:"px-3 py-2 font-mono text-xs text-gray-500 dark:text-gray-400",children:W.valueMasked}),l.jsx("td",{className:"px-3 py-2 text-right",children:s&&l.jsx(Se,{size:"sm",variant:"ghost",disabled:m,onClick:()=>H(W.key),children:g.vault.remove})})]},W.key))})]})}),s&&o!==null&&l.jsx(Se,{size:"sm",variant:"primary",disabled:m,onClick:U,children:g.vault.add}),l.jsx(pn,{open:p,title:g.vault.addTitle,onClose:()=>y(!1),footer:l.jsxs(l.Fragment,{children:[l.jsx(Se,{onClick:()=>y(!1),children:g.common.cancel}),l.jsx(Se,{variant:"primary",disabled:m,onClick:()=>{V()},children:g.vault.add})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(tt,{size:"sm",label:g.vault.key,required:!0,hint:g.vault.keyHint,error:M.key,value:k,onChange:W=>{w(W.target.value),R()},className:"font-mono",placeholder:"OPENAI_API_KEY",autoComplete:"off"}),l.jsx(ws,{size:"sm",label:g.vault.value,required:!0,error:M.value,value:S,onChange:W=>{T(W.target.value),R()},className:"font-mono",autoComplete:"off",onKeyDown:W=>{W.key==="Enter"&&!m&&V()}})]})}),l.jsx(ga,{open:D!==null,title:g.vault.overwriteTitle,tone:"primary",confirmLabel:g.common.save,busy:m,onClose:()=>L(null),onConfirm:()=>{V()},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:D!==null?g.vault.overwriteConfirm(D):""})}),l.jsx(ga,{open:I!==null,title:g.vault.deleteTitle,busy:m,onClose:()=>H(null),onConfirm:()=>{O()},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:I!==null?g.vault.deleteConfirm(I):""})}),d&&l.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:d})]}):null}function oL(e){const n=[];return v.Children.forEach(e,r=>{if(!v.isValidElement(r)||r.type!=="option")return;const s=r.props;n.push({value:s.value!==void 0?String(s.value):"",label:s.children??"",...s.disabled?{disabled:!0}:{}})}),n}const cL=`flex w-full items-center gap-2 text-left ${mp} disabled:cursor-not-allowed disabled:opacity-60`,uL={base:"text-base",sm:"text-xs"};function Ro({label:e,hint:n,error:r,required:s,size:o="base",className:c,children:d,value:f,onChange:m,disabled:h}){const p=oL(d),y=String(f??""),k=p.find(D=>D.value===y),w=v.useId(),[S,T]=v.useState(!1),{triggerRef:M,panelRef:E,position:R}=mw({open:S,onClose:()=>T(!1),estimatedHeight:p.length*36+8}),I=D=>{T(!1),m?.({target:{value:D}}),M.current?.focus()},H=l.jsxs(l.Fragment,{children:[l.jsxs("button",{ref:M,type:"button",disabled:h,"aria-haspopup":"listbox","aria-expanded":S,"aria-required":s||void 0,"aria-invalid":r?!0:void 0,"aria-describedby":r?w:void 0,onClick:()=>T(D=>!D),className:`${cL} ${hp[o]} ${r?ad:""} ${c??""}`,children:[l.jsx("span",{className:"min-w-0 flex-1 truncate",children:k?.label??p[0]?.label??""}),l.jsx(op,{className:"text-gray-400"})]}),S&&R&&ei.createPortal(l.jsx("div",{ref:E,role:"listbox",className:"anim-pop fixed z-[60] max-h-60 overflow-y-auto rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900",style:{left:R.left,width:R.triggerWidth,top:R.topPx,bottom:R.bottomPx},children:p.map((D,L)=>l.jsxs("button",{type:"button",role:"option","aria-selected":D.value===y,disabled:D.disabled,onClick:()=>I(D.value),className:`flex items-center ${uk} ${uL[o]} disabled:opacity-50 ${D.value===y?"bg-gray-100 font-medium text-gray-900 dark:bg-gray-800 dark:text-gray-100":"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800"}`,children:[l.jsx("span",{className:"min-w-0 flex-1 truncate",children:D.label}),D.value===y&&l.jsx(nk,{className:"text-gray-500 dark:text-gray-400"})]},`${D.value}-${L}`))}),document.body)]});return l.jsx(Lo,{label:e,hint:n,error:r,errorId:w,required:s,children:H})}const dL={active:"green",disabled:"gray",expired:"amber",done:"brand",missed:"amber",invalid:"red"};function Bb(e){if(!e)return"";const n=new Date(e);if(Number.isNaN(n.getTime()))return"";const r=s=>s<10?`0${s}`:`${s}`;return`${n.getFullYear()}-${r(n.getMonth()+1)}-${r(n.getDate())}T${r(n.getHours())}:${r(n.getMinutes())}`}const eh=e=>JSON.stringify([e.provider,e.modelId]),fL=e=>{if(!e)return null;const[n,r]=JSON.parse(e);return{provider:n,modelId:r}},Hb=e=>`${e.modelId} · ${Br(e.provider)?.label??e.provider}`,Pb=e=>e.modelId&&e.provider?{provider:e.provider,modelId:e.modelId}:null,mL={editing:null,name:"",prompt:"",enabled:!0,startAt:"",endAt:"",period:"",target:"new",sessionId:"",workspace:"",model:null};function hL({agentId:e}){const{currentProject:n}=gn(),r=n?.projectId??null,s=n?.role==="owner",[o,c]=v.useState(null),[d,f]=v.useState(null),[m,h]=v.useState(!1),[p,y]=v.useState(null),[k,w]=v.useState(null),[S,T]=v.useState({}),[M,E]=v.useState(null),[R,I]=v.useState(null),[H,D]=v.useState([]),L=v.useCallback(async()=>{if(!(!r||!e)){c(null),f(null);try{c(await $5(r,e))}catch(B){f(Ae(B))}}},[r,e]);v.useEffect(()=>{L()},[L]),v.useEffect(()=>{!r||!s||Xu(r).then(B=>D(B.models)).catch(()=>D([]))},[r,s]);const $=B=>{T(F=>F.name||F.prompt||F.startAt||F.sessionId?{}:F),E(F=>F&&null),y(F=>F===null?F:{...F,...B})},K=B=>{T({}),E(null),y(B),w(B)},X=async()=>{if(!r||p===null)return;E(null);const B=p.editing??p.name.trim(),F={};if(B||(F.name=g.common.requiredField),p.prompt.trim()||(F.prompt=g.common.requiredField),p.startAt||(F.startAt=g.common.requiredField),p.target==="session"&&!p.sessionId.trim()&&(F.sessionId=g.common.requiredField),F.name||F.prompt||F.startAt||F.sessionId){T(F);return}if(T({}),p.editing!==null&&JSON.stringify(p)===JSON.stringify(k)){Cs(g.common.noChangesToSave);return}const P={prompt:p.prompt,enabled:p.enabled,startAt:new Date(p.startAt).toISOString(),...p.period.trim()?{period:p.period.trim()}:{},...p.endAt?{endAt:new Date(p.endAt).toISOString()}:{},...p.target==="session"&&p.sessionId.trim()?{sessionId:p.sessionId.trim()}:{},...p.target==="new"&&p.workspace.trim()?{workspace:p.workspace.trim()}:{},...p.target==="new"&&p.model?{modelId:p.model.modelId,provider:p.model.provider}:{}};h(!0);try{p.editing!==null?await Fy(r,e,p.editing,P):await B5(r,e,{name:B,...P}),y(null),ea(g.common.saved),await L()}catch(ce){E(Ae(ce))}finally{h(!1)}},U=async B=>{if(!r)return;h(!0);const F=Pb(B);try{await Fy(r,e,B.name,{prompt:B.prompt,enabled:!B.enabled,startAt:B.startAt,...B.period!==void 0?{period:B.period}:{},...B.endAt!==void 0?{endAt:B.endAt}:{},...B.sessionId!==void 0?{sessionId:B.sessionId}:{},...B.workspace!==void 0?{workspace:B.workspace}:{},...F?{modelId:F.modelId,provider:F.provider}:{}}),ea(g.common.saved),await L()}catch(P){xt(Ae(P))}finally{h(!1)}},V=B=>{K({editing:B.name,name:B.name,prompt:B.prompt,enabled:B.enabled,startAt:Bb(B.startAt),endAt:Bb(B.endAt),period:B.period??"",target:B.sessionId?"session":"new",sessionId:B.sessionId??"",workspace:B.workspace??"",model:Pb(B)})},O=async()=>{if(!(!r||R===null)){h(!0);try{await H5(r,e,R),p?.editing===R&&y(null),await L()}catch(B){xt(Ae(B))}finally{h(!1),I(null)}}};if(!r)return null;const W=o?.schedules??[],Z=o?.invalidFiles??[];return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:g.schedule.desc}),!s&&l.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:g.schedule.readOnlyHint})]}),o===null?l.jsx(Ua,{rows:4}):W.length===0?l.jsx("p",{className:"py-2 text-xs text-gray-400 dark:text-gray-500",children:g.schedule.empty}):l.jsx("div",{className:"overflow-x-auto overflow-y-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:l.jsxs("table",{className:"w-full min-w-[640px] text-left text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-gray-200 bg-gray-50/80 text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900",children:[l.jsx("th",{className:"px-3 py-2.5",children:g.common.name}),l.jsx("th",{className:"px-3 py-2.5",children:g.schedule.colStatus}),l.jsx("th",{className:"px-3 py-2.5",children:g.schedule.colPeriod}),l.jsx("th",{className:"px-3 py-2.5",children:g.schedule.colTarget}),l.jsx("th",{className:"px-3 py-2.5",children:g.schedule.colFireTimes}),l.jsx("th",{className:"px-3 py-2.5",children:g.schedule.colQueued}),s&&l.jsx("th",{className:"px-3 py-2.5"})]})}),l.jsx("tbody",{children:W.map(B=>l.jsxs("tr",{className:"border-b border-gray-100 transition-colors duration-150 last:border-b-0 hover:bg-gray-50 dark:border-gray-800/60 dark:hover:bg-gray-800/40",children:[l.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:B.name}),l.jsx("td",{className:"px-3 py-2",children:l.jsx("span",{title:B.invalidReason,children:l.jsx(Jt,{tone:dL[B.status],children:g.schedule.statusNames[B.status]??B.status})})}),l.jsx("td",{className:"px-3 py-2 text-xs text-gray-500 dark:text-gray-400",children:B.period!==void 0?l.jsx("span",{className:"font-mono",children:B.period}):g.schedule.once}),l.jsx("td",{className:"max-w-36 truncate px-3 py-2 text-xs text-gray-500 dark:text-gray-400",title:B.sessionId,children:B.sessionId!==void 0?l.jsx("span",{className:"font-mono",children:B.sessionId}):g.schedule.newSession}),l.jsxs("td",{className:"px-3 py-2 text-xs",children:[l.jsx("span",{className:"block text-gray-600 dark:text-gray-300",children:B.nextFireAt?ma(B.nextFireAt):"—"}),l.jsx("span",{className:"block text-gray-400 dark:text-gray-500",children:B.lastFiredAt?ma(B.lastFiredAt):"—"})]}),l.jsx("td",{className:"px-3 py-2",children:B.queued&&l.jsx(Jt,{tone:"brand",children:g.schedule.queued})}),s&&l.jsxs("td",{className:"whitespace-nowrap px-3 py-2 text-right",children:[l.jsx(Se,{size:"sm",variant:"ghost",disabled:m,onClick:()=>{U(B)},children:B.enabled?g.schedule.disable:g.schedule.enable}),l.jsx(Se,{size:"sm",variant:"ghost",disabled:m,onClick:()=>V(B),children:g.common.edit}),l.jsx(Se,{size:"sm",variant:"ghost",disabled:m,onClick:()=>I(B.name),children:g.common.delete})]})]},B.name))})]})}),Z.length>0&&l.jsxs("div",{className:"text-xs text-red-600 dark:text-red-400",children:[l.jsx("p",{className:"font-medium",children:g.schedule.invalidFiles}),l.jsx("ul",{className:"mt-0.5 space-y-0.5 font-mono",children:Z.map(B=>l.jsxs("li",{children:[B.name,": ",B.error]},B.name))})]}),s&&o!==null&&l.jsx(Se,{size:"sm",variant:"primary",disabled:m,onClick:()=>K(mL),children:g.schedule.addTitle}),l.jsx(pn,{open:p!==null,title:p?.editing!=null?g.schedule.editTitle(p.editing):g.schedule.addTitle,onClose:()=>y(null),widthClass:"sm:max-w-lg",footer:l.jsxs(l.Fragment,{children:[l.jsx(Se,{onClick:()=>y(null),children:g.common.cancel}),l.jsx(Se,{variant:"primary",disabled:m,onClick:()=>{X()},children:p?.editing!=null?g.common.save:g.common.create})]}),children:p!==null&&l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[l.jsx(tt,{size:"sm",label:g.common.name,required:!0,hint:g.schedule.nameHint,error:S.name,value:p.name,disabled:p.editing!==null,onChange:B=>$({name:B.target.value}),className:"font-mono",placeholder:"daily_report",autoComplete:"off"}),l.jsx(tt,{size:"sm",label:g.schedule.period,value:p.period,onChange:B=>$({period:B.target.value}),className:"font-mono",placeholder:g.schedule.periodPlaceholder,autoComplete:"off"}),l.jsx(tt,{size:"sm",label:g.schedule.startAt,required:!0,type:"datetime-local",error:S.startAt,value:p.startAt,onChange:B=>$({startAt:B.target.value}),className:"font-mono"}),l.jsx(tt,{size:"sm",label:g.schedule.endAt,type:"datetime-local",value:p.endAt,onChange:B=>$({endAt:B.target.value}),className:"font-mono"}),l.jsxs(Ro,{size:"sm",label:g.schedule.target,value:p.target,onChange:B=>$({target:B.target.value}),children:[l.jsx("option",{value:"new",children:g.schedule.targetNew}),l.jsx("option",{value:"session",children:g.schedule.targetSession})]}),p.target==="session"?l.jsx(tt,{size:"sm",label:g.schedule.sessionId,required:!0,error:S.sessionId,value:p.sessionId,onChange:B=>$({sessionId:B.target.value}),className:"font-mono",autoComplete:"off"}):l.jsxs(l.Fragment,{children:[l.jsxs(Ro,{size:"sm",label:g.schedule.model,value:p.model?eh(p.model):"",onChange:B=>$({model:fL(B.target.value)}),children:[l.jsx("option",{value:"",children:g.schedule.modelDefault}),p.model&&!H.some(B=>B.modelId===p.model.modelId&&B.provider===p.model.provider)&&l.jsx("option",{value:eh(p.model),children:Hb(p.model)}),H.map(B=>l.jsx("option",{value:eh({provider:B.provider,modelId:B.modelId}),children:Hb({provider:B.provider,modelId:B.modelId})},`${B.provider}:${B.modelId}`))]}),l.jsx(tt,{size:"sm",label:g.schedule.workspace,value:p.workspace,onChange:B=>$({workspace:B.target.value}),className:"font-mono",autoComplete:"off"})]})]}),l.jsx(Kl,{label:g.schedule.prompt,required:!0,size:"sm",rows:4,error:S.prompt,value:p.prompt,onChange:B=>$({prompt:B.target.value})}),l.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-600 dark:text-gray-300",children:[l.jsx("input",{type:"checkbox",checked:p.enabled,onChange:B=>$({enabled:B.target.checked})}),g.schedule.enabled]}),M&&l.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:M})]})}),l.jsx(ga,{open:R!==null,title:g.schedule.deleteTitle,busy:m,onClose:()=>I(null),onConfirm:()=>{O()},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:R!==null?g.schedule.deleteConfirm(R):""})}),d&&l.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:d})]})}function pL(e){return e.filter(([n])=>n!=="").map(([n,r])=>({value:n,triggerLabel:n,label:n,description:r}))}function lo(e){const n=e.trim();if(!n)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function Zs(e){return e===void 0?"":String(e)}function gL(){const e=[{key:"overview",label:g.agent.tabOverview},{key:"prompt",label:g.agent.tabPrompt},{key:"runtime",label:g.agent.tabRuntime},{key:"tools",label:g.agent.tabTools},{key:"vault",label:g.agent.tabVault},{key:"schedules",label:g.agent.tabSchedules}],n=ya(),s=Wv().agentId??"";pr(g.agent.settings);const{currentProject:o,reloadAgents:c}=gn(),d=o?.projectId??null,[f,m]=v.useState(null),[h,p]=v.useState("overview"),[y,k]=v.useState(null),w=v.useCallback(()=>{!d||!s||(m(null),k(null),Kh(d,s).then(m).catch(E=>k(Ae(E))))},[d,s]);v.useEffect(()=>{w()},[w]);const S=v.useCallback(E=>{ea(g.agent.importDone(E)),w(),c()},[w,c]),T=v.useCallback(()=>{ea(g.agent.resetConfigDone),w(),c()},[w,c]),M=v.useCallback(async E=>{if(!(!d||!s))try{const R=await Nv(d,s,E);m(R),ea(g.common.saved),(E.config?.name!==void 0||E.config?.description!==void 0)&&c()}catch(R){xt(Ae(R))}},[d,s,c]);return d?y&&!f?l.jsx("p",{className:"p-6 text-sm text-red-600 dark:text-red-400",children:y}):f?l.jsx("div",{className:"no-scrollbar relative h-full overflow-y-auto p-4 md:p-6",children:l.jsxs("div",{className:"mx-auto max-w-3xl",children:[l.jsxs(Se,{variant:"ghost",size:"sm",onClick:()=>n("/agents"),className:"-ml-2 mb-3 text-gray-500 dark:text-gray-400",children:[l.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[l.jsx("path",{d:"M15 18l-6-6 6-6"}),l.jsx("path",{d:"M9 12h12"})]}),g.agent.backToList]}),l.jsx("h1",{className:"mb-1 text-xl font-semibold",children:f.config.name??s}),l.jsx("p",{className:"mb-4 font-mono text-xs text-gray-400",children:s}),l.jsx(nL,{items:e,active:h,onChange:p}),l.jsxs("div",{className:"py-4",children:[h==="overview"&&l.jsx(xL,{data:f,agentId:s,onSave:M,onImported:S,onConfigReset:T}),h==="prompt"&&l.jsx(yL,{data:f,onSave:M}),h==="runtime"&&l.jsx(bL,{data:f,onSave:M}),h==="tools"&&l.jsx(vL,{data:f,onSave:M}),h==="vault"&&l.jsx(iL,{agentId:s}),h==="schedules"&&l.jsx(hL,{agentId:s})]})]})}):l.jsxs("div",{className:"space-y-3 p-6",children:[l.jsx(Gt,{className:"h-6 w-64"}),l.jsx(Gt,{className:"h-32 w-full"})]}):null}const Fb="inline-flex cursor-pointer items-center justify-center gap-1 rounded-md border border-gray-300 bg-white px-2.5 py-1 text-xs font-medium text-gray-800 transition-colors duration-150 hover:bg-gray-50 focus-within:ring-2 focus-within:ring-gray-400/30 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800";function xL({data:e,agentId:n,onSave:r,onImported:s,onConfigReset:o}){const{currentProject:c}=gn(),d=c?.projectId??null,f=c?.role==="owner",[m,h]=v.useState(e.config.name??""),[p,y]=v.useState(e.config.description??""),[k,w]=v.useState(!1),[S,T]=v.useState(null),[M,E]=v.useState(null),[R,I]=v.useState(!1),[H,D]=v.useState(!1),{requestSave:L,element:$}=nd(),K=async()=>{if(d){D(!0);try{await k5(d,n),I(!1),o()}catch(O){xt(Ae(O))}finally{D(!1)}}},X=()=>{const O={};if(m.trim()!==(e.config.name??"")&&(O.name=m.trim()),p.trim()!==(e.config.description??"")&&(O.description=p.trim()),Object.keys(O).length===0){Cs(g.common.noChangesToSave);return}L(()=>{r({config:O})})},U=async(O,W)=>{if(d){w(!0),T(null);try{const Z=await Y5(d,n,{dataBase64:O,...W?{confirm:!0}:{}});E(null),s(Z.version)}catch(Z){Z instanceof Xa&&Z.status===409&&Z.code==="version_conflict"?E(O):(E(null),T(Ae(Z)))}finally{w(!1)}}},V=O=>{const W=O.target.files?.[0];if(O.target.value="",!W)return;T(null);const Z=new FileReader;Z.onload=()=>{const B=Z.result;U(B.slice(B.indexOf(",")+1),!1)},Z.onerror=()=>T(g.common.unknownError),Z.readAsDataURL(W)};return l.jsxs("div",{className:"space-y-4",children:[l.jsx(tt,{size:"sm",label:g.common.name,value:m,onChange:O=>h(O.target.value)}),l.jsx(Kl,{label:g.agent.description,size:"sm",rows:3,value:p,onChange:O=>y(O.target.value)}),l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:g.agent.stateDir}),l.jsx("p",{className:"break-all font-mono text-xs text-gray-500 dark:text-gray-400",children:e.stateDir})]}),l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:g.agent.activeSessions}),l.jsx("p",{className:"text-sm",children:e.activeSessionCount})]}),l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:g.agent.stateVersion}),l.jsxs("p",{className:"font-mono text-sm",children:["v",e.config.version]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:g.agent.transferTitle}),l.jsx("p",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400",children:g.agent.transferDesc}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d&&l.jsx("a",{href:K5(d,n),download:!0,className:Fb,children:g.agent.exportSnapshot}),f&&l.jsxs("label",{className:`${Fb} ${k?"pointer-events-none opacity-60":""}`,children:[l.jsx(qp,{accept:".tar.gz,.tgz",disabled:k,onChange:V}),k?g.agent.importing:g.agent.importSnapshot]})]}),S&&l.jsx("p",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:S})]}),l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:g.agent.resetConfigTitle}),l.jsx("p",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400",children:g.agent.resetConfigDesc}),l.jsx(Se,{size:"sm",disabled:H,onClick:()=>I(!0),children:g.agent.resetConfigAction})]}),l.jsx(Se,{size:"sm",variant:"primary",onClick:X,children:g.common.save}),$,l.jsx(ga,{open:M!==null,title:g.agent.importConflictTitle,busy:k,onClose:()=>E(null),onConfirm:()=>{M!==null&&U(M,!0)},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:g.agent.importConflictBody})}),l.jsx(ga,{open:R,title:g.agent.resetConfigTitle,busy:H,onClose:()=>I(!1),onConfirm:()=>{K()},confirmLabel:g.agent.resetConfigAction,children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:g.agent.resetConfigConfirmBody})})]})}function yL({data:e,onSave:n}){const[r,s]=v.useState(e.agentsMd),[o,c]=v.useState(e.config.systemPrompt),d=v.useRef(null),{requestSave:f,element:m}=nd(),h=()=>{const y={};if(r!==e.agentsMd&&(y.agentsMd=r),o!==e.config.systemPrompt&&(y.config={systemPrompt:o}),y.agentsMd===void 0&&y.config===void 0){Cs(g.common.noChangesToSave);return}f(()=>{n(y)})},p=y=>{const k=d.current;if(k&&(k.focus(),document.execCommand?.("insertText",!1,y)))return;const w=k?k.selectionStart:o.length,S=k?k.selectionEnd:o.length;c(o.slice(0,w)+y+o.slice(S)),requestAnimationFrame(()=>{if(!k)return;k.focus();const T=w+y.length;k.setSelectionRange(T,T)})};return l.jsxs("div",{className:"space-y-4",children:[l.jsx(Kl,{label:g.agent.agentsMd,mono:!0,size:"sm",rows:14,value:r,onChange:y=>s(y.target.value)}),l.jsx(Kl,{ref:d,label:g.agent.systemPrompt,mono:!0,size:"sm",rows:12,value:o,onChange:y=>c(y.target.value)}),l.jsxs("div",{className:"rounded-md border border-gray-200 bg-gray-50 p-3 dark:border-gray-800 dark:bg-gray-900",children:[l.jsx("p",{className:"mb-2 text-xs font-semibold text-gray-500",children:g.agent.placeholdersTitle}),l.jsx("ul",{className:"space-y-1",children:g.agent.placeholders.map(([y,k])=>l.jsxs("li",{className:"flex items-center gap-3 text-xs",children:[l.jsx("button",{type:"button",onClick:()=>p(y),title:g.agent.insertPlaceholder,className:"shrink-0 rounded border border-gray-200 bg-white px-1.5 py-0.5 font-mono font-semibold text-gray-800 transition-colors duration-150 hover:border-gray-400 hover:bg-gray-100 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-200 dark:hover:border-gray-500 dark:hover:bg-gray-700",children:y}),l.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:k})]},y))})]}),l.jsx(Se,{size:"sm",variant:"primary",onClick:h,children:g.common.save}),m]})}function bL({data:e,onSave:n}){const r=e.config,[s,o]=v.useState(Zs(r.maxTurns)),[c,d]=v.useState(Zs(r.model?.maxTokens)),[f,m]=v.useState(r.model?.thinkingLevel??""),[h,p]=v.useState(Zs(r.model?.timeoutMs)),[y,k]=v.useState(Zs(r.compaction?.maxContextLength)),[w,S]=v.useState(Zs(r.compaction?.maxSessionTurns)),[T,M]=v.useState(r.compaction?.mode??""),[E,R]=v.useState(r.compaction?.prompt??""),[I,H]=v.useState({}),D=()=>H(V=>V.maxTurns||V.timeoutMs?{}:V),{requestSave:L,element:$}=nd(),K=()=>{H({});const V={},O=lo(s);if(O!==void 0&&O!==r.maxTurns){if(O<=0&&O!==-1){H({maxTurns:g.agent.maxTurnsInvalid});return}V.maxTurns=O}const W={},Z=lo(c);Z!==void 0&&Z!==r.model?.maxTokens&&(W.maxTokens=Z),f&&f!==(r.model?.thinkingLevel??"")&&(W.thinkingLevel=f);const B=lo(h);if(B!==void 0&&B!==r.model?.timeoutMs){if(B<=0&&B!==-1){H({timeoutMs:g.agent.timeoutInvalid});return}W.timeoutMs=B}Object.keys(W).length>0&&(V.model=W);const F={},P=lo(y);P!==void 0&&P!==r.compaction?.maxContextLength&&(F.maxContextLength=P);const ce=lo(w);if(ce!==void 0&&ce!==r.compaction?.maxSessionTurns&&(F.maxSessionTurns=ce),T&&T!==(r.compaction?.mode??"")&&(F.mode=T),E!==(r.compaction?.prompt??"")&&(F.prompt=E),Object.keys(F).length>0&&(V.compaction=F),Object.keys(V).length===0){Cs(g.common.noChangesToSave);return}L(()=>{n({config:V})})},X=X8(g.agent.thinkingLevelOptions,g.agent.thinkingLevelNoneKept,r.model?.thinkingLevel),U=pL(g.agent.compactionModeOptions);return l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[l.jsx("div",{className:"p-3",children:l.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[l.jsx(tt,{label:g.agent.maxTurns,size:"sm",value:s,error:I.maxTurns,onChange:V=>{o(V.target.value),D()},inputMode:"numeric",className:"font-mono"}),l.jsx(tt,{label:g.agent.maxTokens,size:"sm",value:c,onChange:V=>d(V.target.value),inputMode:"numeric",className:"font-mono"}),l.jsx(Ph,{label:g.agent.thinkingLevel,fullWidth:!0,size:"sm",placeholder:g.agent.defaultValue,value:f,onChange:m,options:X}),l.jsx(tt,{label:g.agent.timeoutMs,hint:g.agent.timeoutMsHint,size:"sm",value:h,error:I.timeoutMs,onChange:V=>{p(V.target.value),D()},inputMode:"numeric",className:"font-mono"})]})}),l.jsx("div",{className:"border-t border-b border-gray-200 bg-gray-50/80 px-3 py-2 text-xs font-semibold text-gray-500 dark:border-gray-800 dark:bg-gray-900",children:g.agent.compaction}),l.jsx("div",{className:"p-3",children:l.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:[l.jsx(tt,{label:g.agent.maxContextLength,hint:g.agent.maxContextLengthHint,size:"sm",value:y,onChange:V=>k(V.target.value),inputMode:"numeric",className:"font-mono"}),l.jsx(tt,{label:g.agent.maxSessionTurns,hint:g.agent.maxSessionTurnsHint,size:"sm",value:w,onChange:V=>S(V.target.value),inputMode:"numeric",className:"font-mono"}),l.jsx(Ph,{label:g.agent.compactionMode,fullWidth:!0,size:"sm",placeholder:g.agent.defaultValue,value:T,onChange:M,options:U})]})}),l.jsx("div",{className:"border-t border-b border-gray-200 bg-gray-50/80 px-3 py-2 text-xs font-semibold text-gray-500 dark:border-gray-800 dark:bg-gray-900",children:g.agent.compactionPrompt}),l.jsx("div",{className:"p-3",children:l.jsx(Kl,{"aria-label":g.agent.compactionPrompt,mono:!0,size:"sm",rows:4,value:E,onChange:V=>R(V.target.value)})})]}),l.jsx(Se,{size:"sm",variant:"primary",onClick:K,children:g.common.save}),$]})}function vL({data:e,onSave:n}){const r=[{value:"r",triggerLabel:"r",label:g.agent.permissionReadLabel,description:g.agent.permissionReadDescription},{value:"rw",triggerLabel:"rw",label:g.agent.permissionReadWriteLabel,description:g.agent.permissionReadWriteDescription}],[s,o]=v.useState(()=>e.config.toolsBuiltin.map(k=>({base:{...k},timeoutMs:Zs(k.timeoutMs),maxOutputLength:Zs(k.maxOutputLength)}))),[c,d]=v.useState({}),{requestSave:f,element:m}=nd(),h=(k,w)=>{o(S=>S.map((T,M)=>M===k?{...T,...w}:T)),d(S=>{const T=`${k}-timeoutMs`,M=`${k}-maxOutputLength`;if(!S[T]&&!S[M])return S;const E={...S};return delete E[T],delete E[M],E})},p=()=>{const k={},w=[];for(const[M,E]of s.entries()){const R={...E.base};delete R.timeoutMs,delete R.maxOutputLength;const I=E.timeoutMs.trim();if(I){const L=Number(I);!Number.isInteger(L)||L<=0&&L!==-1?k[`${M}-timeoutMs`]=g.agent.toolFieldInvalid(E.base.name,"timeoutMs"):R.timeoutMs=L}const H=E.maxOutputLength.trim();if(H){const L=Number(H);!Number.isInteger(L)||L<=0&&L!==-1?k[`${M}-maxOutputLength`]=g.agent.toolFieldInvalid(E.base.name,"maxOutputLength"):R.maxOutputLength=L}const D=e.config.toolsBuiltin[M];R.call_description===!0&&D?.call_description===void 0&&delete R.call_description,w.push(R)}if(Object.keys(k).length>0){d(k);return}d({});const S=e.config.toolsBuiltin;if(!(w.length!==S.length||w.some((M,E)=>{const R=S[E];return M.permission!==R.permission||M.timeoutMs!==R.timeoutMs||M.maxOutputLength!==R.maxOutputLength||M.call_description!==R.call_description}))){Cs(g.common.noChangesToSave);return}f(()=>{n({config:{toolsBuiltin:w}})})},y=k=>{const w=k.parameters?.properties;return w!=null&&w.description!==void 0};return l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"overflow-x-auto overflow-y-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:l.jsxs("table",{className:"w-full min-w-[640px] text-left text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-gray-200 bg-gray-50/80 text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900",children:[l.jsx("th",{className:"px-3 py-2",children:g.common.name}),l.jsx("th",{className:"px-3 py-2",children:g.agent.toolPermission}),l.jsx("th",{className:"px-3 py-2",children:g.agent.toolTimeout}),l.jsx("th",{className:"px-3 py-2",children:g.agent.toolMaxOutput}),l.jsx("th",{className:"px-3 py-2",children:g.agent.toolCallDescription})]})}),l.jsx("tbody",{children:s.map((k,w)=>l.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800/60",children:[l.jsx("td",{className:"px-3 py-2 align-top font-mono text-xs",children:k.base.name}),l.jsx("td",{className:"px-3 py-2 align-top",children:l.jsx(Ph,{mono:!0,size:"sm","aria-label":g.agent.toolPermission,placeholder:g.agent.defaultValue,options:r,value:k.base.permission,onChange:S=>h(w,{base:{...k.base,permission:S}})})}),l.jsx("td",{className:"px-3 py-2 align-top",children:l.jsx(tt,{size:"sm",value:k.timeoutMs,error:c[`${w}-timeoutMs`],inputMode:"numeric",className:"font-mono",onChange:S=>h(w,{timeoutMs:S.target.value})})}),l.jsx("td",{className:"px-3 py-2 align-top",children:l.jsx(tt,{size:"sm",value:k.maxOutputLength,error:c[`${w}-maxOutputLength`],inputMode:"numeric",className:"font-mono",onChange:S=>h(w,{maxOutputLength:S.target.value})})}),l.jsx("td",{className:"px-3 py-2 align-top",children:y(k.base)?l.jsx(dp,{checked:k.base.call_description!==!1,onChange:S=>h(w,{base:{...k.base,call_description:S}}),"aria-label":`${k.base.name} ${g.agent.toolCallDescription}`}):l.jsx("span",{className:"text-xs text-gray-300 dark:text-gray-600",children:"—"})})]},k.base.name))})]})}),l.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:g.agent.callDescriptionHint}),l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:g.agent.mcpServers}),l.jsx("pre",{className:"max-h-64 overflow-auto rounded-md border border-gray-200 bg-gray-50 p-3 text-xs dark:border-gray-800 dark:bg-gray-900",children:JSON.stringify(e.config.mcpServers,null,2)})]}),l.jsx(Se,{size:"sm",variant:"primary",onClick:p,children:g.common.save}),m]})}const kL="M22 2 11 13M22 2 15 22 11 13 2 9 22 2",wL="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3",SL="M23 4v6h-6M20.49 15a9 9 0 1 1-2.12-9.36L23 10";function jL(e,n,r,s){return e.filter(o=>{const c=n.get(o)?.get(r);return c!==void 0&&c<s})}function NL(){pr(g.nav.skills);const e=ya(),{locale:n}=Ja(),r=Bn().user?.userId??null,{currentProject:s,agents:o,setCurrentAgentId:c}=gn(),d=s?.projectId??null,[f,m]=v.useState(null),[h,p]=v.useState(null),[y,k]=v.useState(new Map),[w,S]=v.useState(new Set);v.useEffect(()=>{let D=!1;return p(null),P5().then(L=>{D||m(L.groups)}).catch(L=>{D||p(Ae(L))}),()=>{D=!0}},[]);const T=o.map(D=>D.agentId).join(",");v.useEffect(()=>{if(k(new Map),!d||T==="")return;let D=!1;const L=T.split(",");return Promise.all(L.map(async $=>{try{const K=await Yh(d,$);return[$,new Map(K.skills.map(X=>[X.name,X.version]))]}catch{return[$,new Map]}})).then($=>{D||k(K=>{const X=new Map($);for(const[U,V]of K)X.set(U,V);return X})}),()=>{D=!0}},[d,T]);const M=(D,L,$)=>k(K=>{const X=new Map(K),U=new Map(X.get(D)??[]);return $!==void 0?U.set(L,$):U.delete(L),X.set(D,U),X}),E=(D,L)=>k($=>new Map($).set(D,new Map(L.map(K=>[K.name,K.version])))),R=async(D,L,$,K)=>{if(!d)return;const X=y.get(D)?.get(L);M(D,L,$?K:void 0);const U=o.find(O=>O.agentId===D),V=U?hn(U):D;try{if($){const O=await qy(d,D,[L]);E(D,O.skills),ea(g.skills.installedToast(L,V))}else await F5(d,D,L),ea(g.skills.uninstalledToast(L,V))}catch(O){if(!$&&O instanceof Xa&&O.status===404)return;M(D,L,X),xt(Ae(O))}},I=async(D,L)=>{if(!d||L.length===0)return;const K=(await Promise.allSettled(L.map(async X=>{const U=await qy(d,X,[D]);E(X,U.skills)}))).find(X=>X.status==="rejected");K?xt(Ae(K.reason)):ea(g.skills.updatedToast(D,L.length))},H=D=>{if(r&&d){const L=Vl(r,d);Ao(L,{...dd(L),agentId:"default_agent",text:g.skills.quickInvokeText(D),skills:[D],handoffAgentId:void 0})}c("default_agent"),e(`/chat/${dr}`,{state:{agentId:"default_agent"}})};return l.jsx("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:l.jsxs("div",{className:"mx-auto max-w-5xl",children:[l.jsx("h1",{className:"text-xl font-semibold",children:g.skills.pageTitle}),l.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:g.skills.pageDesc}),h?l.jsxs("div",{className:"mt-6 flex items-center gap-3",children:[l.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:h}),l.jsx(Se,{size:"sm",onClick:()=>window.location.reload(),children:g.common.retry})]}):f===null?l.jsx("div",{className:"mt-6 grid gap-2.5 sm:grid-cols-2",children:Array.from({length:4},(D,L)=>l.jsxs(mk,{className:"p-4",children:[l.jsx(Gt,{className:"h-4 w-32"}),l.jsx(Gt,{className:"mt-2 h-4 w-3/4"}),l.jsx(Gt,{className:"mt-3 h-6 w-36"})]},L))}):l.jsx("div",{className:"mt-6 space-y-3",children:f.map(D=>{const L=!w.has(D.id);return l.jsxs("section",{className:"overflow-hidden rounded-md bg-white dark:bg-gray-900",children:[l.jsxs("button",{type:"button","aria-expanded":L,onClick:()=>S($=>{const K=new Set($);return K.has(D.id)?K.delete(D.id):K.add(D.id),K}),className:"flex w-full items-center gap-2.5 bg-gray-50 px-3 py-2.5 text-left transition-colors duration-150 hover:bg-gray-100 dark:bg-gray-900/60 dark:hover:bg-gray-800/60",children:[l.jsx("span",{className:"min-w-0 truncate text-sm font-semibold",children:g8(n,D.title,D.titleZh)}),l.jsx("span",{className:"shrink-0 whitespace-nowrap font-mono text-xs text-gray-400",children:g.skills.skillCount(D.skills.length)}),l.jsx("span",{className:"min-w-0 flex-1"}),l.jsx(Ln,{open:L,className:"text-gray-400"})]}),l.jsx("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${L?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:l.jsx("div",{className:"overflow-hidden",inert:!L,children:l.jsx("div",{className:`grid gap-2.5 p-2.5 transition-opacity duration-200 sm:grid-cols-2 ${L?"opacity-100":"opacity-0"}`,children:D.skills.map($=>l.jsx(CL,{skill:$,installed:y,onQuickInvoke:H,onToggleInstall:R,onUpdateOutdated:I},$.name))})})})]},D.id)})})]})})}function CL({skill:e,installed:n,onQuickInvoke:r,onToggleInstall:s,onUpdateOutdated:o}){const{locale:c}=Ja(),{agents:d}=gn(),[f,m]=v.useState(!1),[h,p]=v.useState(null),[y,k]=v.useState(!1),[w,S]=v.useState(null),T=async()=>{h&&(k(!0),await o(e.name,h),k(!1),p(null))},M=w!==null?d.find($=>$.agentId===w):void 0,E=M?hn(M):void 0;let R=0;for(const $ of n.values())$.has(e.name)&&(R+=1);const I=jL(d.map($=>$.agentId),n,e.name,e.version),H=Po(c,e),D=e.description,L=[`v${e.version}`,e.updated?JC(e.updated,c):null,g.skills.usedByAgents(R)].filter($=>$!==null).join(" · ");return l.jsxs("div",{className:"flex h-full items-center gap-3 rounded-md p-4 transition-colors hover:bg-gray-100/70 dark:hover:bg-gray-800/60",children:[l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx("span",{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg ${H8(e.name)}`,children:l.jsx(Pp,{icon:e.icon,size:20})}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block truncate font-mono text-[13px] font-semibold",title:e.name,children:e.name}),l.jsx("p",{className:"mt-0.5 truncate text-xs leading-5 text-gray-500 dark:text-gray-400",title:D,children:H})]})]}),l.jsx("p",{className:"mt-2.5 truncate text-[11px] text-gray-400 dark:text-gray-500",title:L,children:L})]}),l.jsxs("div",{className:"flex shrink-0 items-center justify-center gap-1.5",children:[I.length>0&&l.jsx(Se,{size:"sm",variant:"secondary",className:"h-8 w-8 shrink-0 justify-center p-0","aria-label":`${g.skills.updateOutdated(I.length)} ${e.name}`,title:g.skills.updateOutdated(I.length),onClick:()=>p(I),children:l.jsx(Ue,{d:SL,size:13})}),l.jsx(Se,{size:"sm",className:"h-8 w-8 shrink-0 justify-center p-0","aria-label":`${g.skills.quickInvoke} ${e.name}`,title:g.skills.quickInvoke,onClick:()=>r(e.name),children:l.jsx(Ue,{d:kL,size:15})}),l.jsx(Se,{size:"sm",className:"h-8 w-8 shrink-0 justify-center p-0","aria-label":`${g.skills.manageInstall} ${e.name}`,title:g.skills.manageInstall,onClick:()=>m(!0),children:l.jsx(Ue,{d:wL,size:15})})]}),f&&l.jsx(pn,{open:!0,title:g.skills.manageInstallTitle(e.name),onClose:()=>m(!1),children:l.jsxs("div",{className:"space-y-0.5",children:[d.length===0&&l.jsx("p",{className:"py-1.5 text-xs text-gray-400",children:g.common.loading}),d.map($=>l.jsx(TL,{agentId:$.agentId,name:hn($),installed:n.get($.agentId)?.has(e.name)??!1,outdated:I.includes($.agentId),onToggle:K=>{K?s($.agentId,e.name,!0,e.version):S($.agentId)},onUpdate:()=>p([$.agentId])},$.agentId))]})}),h&&l.jsx(ga,{open:!0,title:g.skills.updateConfirmTitle(e.name),tone:"primary",confirmLabel:g.skills.updateAction,busy:y,onClose:()=>p(null),onConfirm:()=>{T()},children:l.jsxs("div",{className:"space-y-3",children:[l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:g.skills.updateConfirmWarning(e.name)}),l.jsx("ul",{className:"divide-y divide-gray-100 overflow-hidden rounded-md border border-gray-200 dark:divide-gray-800 dark:border-gray-800",children:h.map($=>{const K=n.get($)?.get(e.name),X=d.find(U=>U.agentId===$);return l.jsxs("li",{className:"flex items-center justify-between gap-3 px-3 py-1.5 text-xs",children:[l.jsx("span",{className:"min-w-0 truncate",children:X?hn(X):$}),l.jsxs("span",{className:"shrink-0 font-mono text-gray-500 dark:text-gray-400",children:["v",K??"?"," → v",e.version]})]},$)})})]})}),w!==null&&l.jsx(ga,{open:!0,title:g.skills.uninstallConfirmTitle(e.name),confirmLabel:g.skills.uninstall,onClose:()=>S(null),onConfirm:()=>{const $=w;S(null),s($,e.name,!1,e.version)},children:l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:g.skills.uninstallConfirmBody(e.name,E??w)})})]})}function TL({agentId:e,name:n,installed:r,outdated:s,onToggle:o,onUpdate:c}){return l.jsxs("div",{className:"flex items-center gap-2 rounded-md px-1.5 py-1.5 transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-gray-800/60",children:[l.jsx(pa,{id:e,name:n,size:22,className:"shrink-0 rounded"}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",title:e,children:n}),r&&s&&l.jsx(Se,{size:"sm",variant:"secondary",className:"shrink-0","aria-label":`${g.skills.updateAction} ${e}`,onClick:c,children:g.skills.updateAction}),r?l.jsxs(Se,{size:"sm",variant:"ghost",className:"group shrink-0","aria-label":`${g.skills.uninstall} ${e}`,onClick:()=>o(!1),children:[l.jsx("span",{className:"group-hover:hidden",children:g.skills.installed}),l.jsx("span",{className:"hidden text-red-600 group-hover:inline dark:text-red-400",children:g.skills.uninstall})]}):l.jsx(Se,{size:"sm",className:"shrink-0","aria-label":`${g.skills.install} ${e}`,onClick:()=>o(!0),children:g.skills.install})]})}function hw(e){return{vision:e.vision!==!1,contextWindow:e.context_window!==void 0?String(e.context_window):"",clientType:e.client_type??"",cacheRead:e.pricing?String(e.pricing.cache_read):"",cacheWrite:e.pricing?String(e.pricing.cache_write):"",output:e.pricing?String(e.pricing.output):"",baseUrl:e.base_url??""}}function ML(e){return{provider:e.provider,modelId:e.model_id,original:null,...hw(e),maxTokens:"",originalBaseUrl:"",apiKeyInput:"",clearApiKey:!1}}function EL(e,n=q8()){const r=(f,m)=>`${f}\0${m}`,s=new Map(e.map((f,m)=>[r(f.provider,f.modelId),m])),o=[...e];let c=0,d=0;for(const f of n){const m=s.get(r(f.provider,f.model_id));if(m===void 0){o.push(ML(f)),c+=1;continue}const h=o[m],p=hw(f);Object.keys(p).some(k=>h[k]!==p[k])&&(o[m]={...h,...p},d+=1)}return{rows:o,added:c,updated:d}}function AL(e){return e<1e3?"green":e<=3e3?"yellow":"red"}function RL(e){return e>=40?"green":e>=15?"yellow":"red"}const pw={USD:"$",CNY:"¥"};function qb(e){return Number.isFinite(e)?String(Math.round(e*1e6)/1e6):"0"}function Fh(e){return Number.isFinite(e)?String(Math.round(e*1e4)/1e4):"0"}function th(e,n){const r=Number(e||"0"),s=n==="CNY"?r*Gh:r;return`${pw[n]}${Fh(s)}`}function Bl(e,n){const r=e.trim();if(!r)return"";const s=Number(r);return Number.isFinite(s)?Fh(n==="CNY"?s*Gh:s):r}function nh(e,n){const r=e.trim();if(!r)return"";const s=Number(r);return Number.isFinite(s)?qb(n==="CNY"?s/Gh:s):r}const _L="M12 5v14M5 12h14",IL="M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4",LL="M12 14l3.5-3.5M20.49 17A10 10 0 1 0 3.5 17",OL="M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20ZM12 7v5l3.5 2",DL="M13 2 3 14h9l-1 8 10-12h-9l1-8Z",Vb={green:"text-green-600 dark:text-green-400",yellow:"text-amber-600 dark:text-amber-400",red:"text-red-600 dark:text-red-400"},Gb=(e,n)=>`${e}\0${n}`,ah=128e3;function Wb(e){return e.replace(/[^\d]/g,"")}function zL(e){const n=e.replace(/[^\d.]/g,""),r=n.indexOf(".");return r===-1?n:n.slice(0,r+1)+n.slice(r+1).replace(/\./g,"")}function La(e){return{provider:e.provider,modelId:e.modelId}}function UL(e){const{editing:n,ref:r,action:s,defaultModel:o,visionModel:c}=e,d=n===null,f=!d&&!vt(n,r)?n:null,m=h=>vt(h,f)?r:h;return{defaultModel:s==="setDefault"||d&&!o?r:m(o),visionModel:s==="setVisionModel"?r:m(c)}}function $L(e){return e.original!==null&&Fp(e.original.provider,e.original.modelId)!==void 0}function BL(e){return!e.clearApiKey&&(!!e.apiKeyInput.trim()||!!e.credential?.apiKeyMasked)}function Kb(e){const n={provider:e.provider,modelId:e.modelId,original:{provider:e.provider,modelId:e.modelId},vision:e.vision!==!1,contextWindow:e.contextWindow!==void 0?String(e.contextWindow):"",maxTokens:e.maxTokens!==void 0?String(e.maxTokens):"",clientType:e.clientType??"",cacheRead:e.pricing?String(e.pricing.cacheRead):"",cacheWrite:e.pricing?String(e.pricing.cacheWrite):"",output:e.pricing?String(e.pricing.output):"",baseUrl:e.credential?.baseUrl??"",originalBaseUrl:e.credential?.baseUrl??"",apiKeyInput:"",clearApiKey:!1};return e.displayName!==void 0&&(n.displayName=e.displayName),e.envKey!==void 0&&(n.envKey=e.envKey),e.credential&&(n.credential=e.credential),n}function HL(e){const n={provider:e.provider,modelId:e.modelId};e.original&&!vt(e.original,La(e))&&(n.renamedFrom=e.original),e.displayName?.trim()&&(n.displayName=e.displayName.trim());const r=Number(e.contextWindow.trim());e.contextWindow.trim()&&Number.isFinite(r)&&(n.contextWindow=r),e.clientType.trim()&&(n.clientType=e.clientType.trim()),e.vision||(n.vision=!1);const s=Number(e.maxTokens.trim());e.maxTokens.trim()&&Number.isFinite(s)&&s>0&&(n.maxTokens=s);const o=Number(e.cacheRead.trim()),c=Number(e.cacheWrite.trim()),d=Number(e.output.trim());e.cacheRead.trim()&&e.cacheWrite.trim()&&e.output.trim()&&Number.isFinite(o)&&Number.isFinite(c)&&Number.isFinite(d)&&(n.pricing={cacheRead:o,cacheWrite:c,output:d}),e.apiKeyInput.trim()&&(n.apiKey=e.apiKeyInput.trim()),e.clearApiKey&&(n.clearApiKey=!0);const f=e.baseUrl.trim();return f!==e.originalBaseUrl&&(n.baseUrl=f||null),n}function PL(){pr(g.models.title);const{currentProject:e}=gn(),n=e?.projectId??null,r=e?.role==="owner",s=Bn().user?.userId??null,[o,c]=v.useState(new Map),[d,f]=v.useState(null),[m,h]=v.useState(null),[p,y]=v.useState(null),[k,w]=v.useState(void 0),[S,T]=v.useState(void 0),[M,E]=v.useState(null),[R,I]=v.useState(null),[H,D]=v.useState(""),[L,$]=v.useState(new Set),[K,X]=v.useState(null),[U,V]=v.useState(!1),[O,W]=v.useState(""),[Z,B]=v.useState(null),[F,P]=v.useState(null),[ce,oe]=v.useState(!1),{currency:A}=Ns(),C=v.useCallback(async()=>{if(n){y(null),P(null),c(new Map);try{const ne=await Xu(n);y(ne.models.map(Kb)),w(ne.defaultModel),T(ne.visionModel)}catch(ne){P(Ae(ne))}}},[n]);v.useEffect(()=>{C()},[C]);const z=async(ne,pe,be,Fe)=>{if(!n)return!1;oe(!0);const qe=be&&ne.some($e=>vt(La($e),be)&&$e.vision)?be:void 0;try{const $e={models:ne.map(HL)};pe&&($e.defaultModel=pe),qe&&($e.visionModel=qe);const Ye=await g5(n,$e);if(y(Ye.models.map(Kb)),w(Ye.defaultModel),T(Ye.visionModel),s&&Ye.defaultModel&&!vt(Ye.defaultModel,k)){const Et=Vl(s,n),kn=dd(Et);kn.modelRef&&Ao(Et,{...kn,modelRef:void 0})}return ea(Fe??g.common.saved),!0}catch($e){return y(ne),pe!==void 0&&w(pe),qe!==void 0&&T(qe),xt(Ae($e)),!1}finally{oe(!1)}},N=v.useMemo(()=>p?G2(p,H):[],[p,H]),Q=async()=>{if(!p)return;const ne=EL(p);if(ne.added===0&&ne.updated===0){Cs(g.models.syncUpToDate);return}await z(ne.rows,k,S,g.models.syncDone(ne.added,ne.updated))},se=async ne=>{if(!n||!p)return;const pe=p.filter(be=>be.provider===ne);h(ne);try{for(const be of pe){const Fe=Gb(be.provider,be.modelId);c(qe=>new Map(qe).set(Fe,"pending"));try{const qe=await jv(n,{provider:be.provider,modelId:be.modelId,speed:!0});c($e=>new Map($e).set(Fe,qe))}catch(qe){c($e=>new Map($e).set(Fe,{ok:!1,message:Ae(qe)}))}}}finally{h(null)}},le=()=>{const ne=O.trim();if(!/^[a-z0-9][a-z0-9_-]{0,31}$/.test(ne)){B(g.models.groupNameInvalid);return}if(js.some(pe=>pe.id===ne)||p?.some(pe=>pe.provider===ne)){B(g.models.groupNameExists);return}V(!1),W(""),I(ne)},he=M!==null?p?.find(ne=>vt(La(ne),M)):void 0;if(!n)return null;const xe=ne=>$(pe=>{const be=new Set(pe);return be.has(ne)?be.delete(ne):be.add(ne),be});return l.jsxs("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:[l.jsxs("div",{className:"mx-auto max-w-5xl",children:[l.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-2",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl font-semibold",children:g.models.title}),!r&&l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:g.models.readOnlyHint})]}),l.jsxs("div",{className:"flex min-w-0 max-w-full grow items-center gap-2 sm:grow-0",children:[l.jsx("div",{className:"min-w-0 flex-1 sm:w-56 sm:flex-none",children:l.jsx(tt,{size:"sm",value:H,onChange:ne=>D(ne.target.value),placeholder:g.models.searchPlaceholder})}),r&&l.jsx(Se,{size:"sm",onClick:()=>{Q()},disabled:ce||p===null,title:g.models.syncCatalogHint,children:g.models.syncCatalog})]})]}),p===null?l.jsx(Ua,{rows:4}):p.length===0?l.jsx(mr,{title:g.models.empty,action:r&&l.jsx(Se,{onClick:()=>I("custom"),children:g.models.addCustom})}):N.length===0?l.jsx(mr,{title:g.models.noSearchResults}):l.jsxs("div",{className:"space-y-3",children:[N.map(ne=>{const pe=!L.has(ne.provider.id);return l.jsxs("section",{className:"overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[l.jsxs("div",{className:"flex items-center gap-2 bg-gray-50 pr-2 transition-colors duration-150 hover:bg-gray-100 dark:bg-gray-900/60 dark:hover:bg-gray-800/60",children:[l.jsxs("button",{type:"button","aria-expanded":pe,onClick:()=>xe(ne.provider.id),className:"flex min-w-0 flex-1 items-center gap-2.5 px-3 py-2.5 text-left",children:[l.jsx(Xl,{provider:ne.provider.id,className:"h-5 w-5 shrink-0 text-gray-700 dark:text-gray-300"}),l.jsx("span",{className:"min-w-0 truncate text-sm font-semibold",children:ne.provider.label}),l.jsx("span",{className:"shrink-0 whitespace-nowrap font-mono text-xs text-gray-400",children:g.models.modelCount(ne.rows.length)})]}),r&&l.jsx("span",{className:"shrink-0",children:l.jsxs(Se,{size:"sm",variant:"ghost",disabled:ce,onClick:()=>I(ne.provider.id),children:[l.jsx(Ue,{d:_L,size:13}),g.models.addToGroup]})}),r&&ne.provider.id!=="custom"&&l.jsx("span",{className:"hidden shrink-0 sm:block",children:l.jsxs(Se,{size:"sm",variant:"ghost",disabled:ce,onClick:()=>X(ne.provider.id),children:[l.jsx(Ue,{d:IL,size:13}),g.models.groupApiKey]})}),r&&l.jsxs(Se,{size:"sm",variant:"ghost",className:"shrink-0",disabled:ce||m!==null,"aria-label":`${g.models.speedTest} ${ne.provider.label}`,title:m===ne.provider.id?g.models.speedPending:g.models.speedTest,onClick:()=>f(ne.provider.id),children:[l.jsx(Ue,{d:LL,size:13}),l.jsx("span",{className:"hidden sm:inline",children:m===ne.provider.id?g.models.speedPending:g.models.speedTest})]}),ne.provider.apiKeyUrl&&l.jsxs("a",{href:ne.provider.apiKeyUrl,target:"_blank",rel:"noreferrer noopener",className:"hidden shrink-0 whitespace-nowrap text-xs text-brand-600 underline-offset-2 hover:underline sm:inline dark:text-brand-300",children:[g.models.getApiKey," ↗"]}),l.jsx("button",{type:"button","aria-expanded":pe,"aria-label":ne.provider.label,onClick:()=>xe(ne.provider.id),className:"shrink-0 p-1.5",children:l.jsx(Ln,{open:pe,className:"text-gray-400"})})]}),l.jsx("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${pe?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:l.jsx("div",{className:"overflow-hidden",inert:!pe,children:l.jsx("div",{className:`grid gap-2 border-t border-gray-200 p-2.5 transition-opacity duration-200 sm:grid-cols-2 lg:grid-cols-3 dark:border-gray-800 ${pe?"opacity-100":"opacity-0"}`,children:ne.rows.length===0?l.jsx("p",{className:"col-span-full py-1 text-center text-xs text-gray-400 dark:text-gray-500",children:g.models.groupEmptyHint}):ne.rows.map(be=>l.jsx(FL,{row:be,currency:A,isDefault:vt(La(be),k),isVisionModel:vt(La(be),S),speed:o.get(Gb(be.provider,be.modelId)),onOpen:()=>E(La(be))},`${be.provider}:${be.modelId}`))})})})]},ne.provider.id)}),r&&H.trim()===""&&l.jsxs("button",{type:"button",onClick:()=>{W(""),B(null),V(!0)},className:"w-full rounded-md border border-dashed border-gray-300 px-3 py-2.5 text-sm text-gray-500 transition-colors hover:border-gray-400 hover:text-gray-700 dark:border-gray-700 dark:text-gray-400 dark:hover:border-gray-600 dark:hover:text-gray-200",children:["+ ",g.models.addGroup]})]}),F&&l.jsx("p",{className:"mt-3 text-xs text-red-600 dark:text-red-400",children:F})]}),p&&K&&l.jsx(WL,{provider:js.find(ne=>ne.id===K)??q2(K),count:p.filter(ne=>ne.provider===K).length,onClose:()=>X(null),onSubmit:ne=>{const pe=K;X(null);const be=p.filter(qe=>qe.provider===pe);if(be.length===0)return;const Fe=p.map(qe=>qe.provider===pe?{...qe,apiKeyInput:ne,clearApiKey:!1}:qe);z(Fe,k,S,g.models.groupKeyApplied(be.length))}}),d!==null&&l.jsxs(pn,{open:!0,title:g.models.speedTestTitle,onClose:()=>f(null),children:[l.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:g.models.speedTestConfirm(p?.filter(ne=>ne.provider===d).length??0)}),l.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[l.jsx(Se,{onClick:()=>f(null),children:g.common.cancel}),l.jsx(Se,{variant:"primary",onClick:()=>{const ne=d;f(null),ne&&se(ne)},children:g.models.speedTestStart})]})]}),U&&l.jsxs(pn,{open:!0,title:g.models.addGroupTitle,onClose:()=>V(!1),widthClass:"sm:max-w-sm",footer:l.jsxs(l.Fragment,{children:[l.jsx(Se,{onClick:()=>V(!1),children:g.common.cancel}),l.jsx(Se,{variant:"primary",onClick:le,children:g.common.confirm})]}),children:[l.jsxs("label",{className:"block",children:[l.jsx(tt,{size:"sm",label:g.models.groupNameLabel,required:!0,value:O,invalid:!!Z,onChange:ne=>{W(ne.target.value),B(null)},onKeyDown:ne=>{ne.key==="Enter"&&le()},placeholder:g.models.groupNameHint,className:"font-mono",autoFocus:!0}),Z&&l.jsx(ks,{children:Z})]}),l.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:g.models.addGroupDesc})]}),p&&(R!==null||he)&&l.jsx(GL,{projectId:n,row:R!==null?null:he??null,addProvider:R??"custom",existingRefs:p.map(La),currency:A,canEdit:r,isDefault:he!==void 0&&vt(La(he),k),isVisionModel:he!==void 0&&vt(La(he),S),onClose:()=>{E(null),I(null)},onSubmit:(ne,pe)=>{const be=R!==null;if(E(null),I(null),pe==="remove"){const $e=ne.original;z(p.filter(Ye=>!vt(La(Ye),$e)),vt($e,k)?void 0:k,vt($e,S)?void 0:S);return}const Fe=be?[...p,ne]:p.map($e=>vt(La($e),M)?ne:$e),qe=UL({editing:be?null:M,ref:La(ne),action:pe,defaultModel:k,visionModel:S});z(Fe,qe.defaultModel,qe.visionModel)}})]})}function FL({row:e,currency:n,isDefault:r,isVisionModel:s,speed:o,onOpen:c}){const d=e.cacheRead||e.cacheWrite||e.output,f=[e.contextWindow?ft(Number(e.contextWindow)):null,d?`${th(e.cacheRead,n)} / ${th(e.cacheWrite,n)} / ${th(e.output,n)}`:null,e.credential?.apiKeyMasked&&!e.clearApiKey?e.credential.apiKeyMasked:BL(e)?g.models.keyConfigured:g.models.noKey].filter(h=>h!==null),m=o==="pending"?l.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:g.models.speedPending}):o?o.ok?l.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[11px] font-medium",children:[o.ttftMs!==void 0&&l.jsxs("span",{className:`flex items-center gap-0.5 ${Vb[AL(o.ttftMs)]}`,title:g.models.ttftTitle,children:[l.jsx(Ue,{d:OL,size:11}),Math.round(o.ttftMs),"ms"]}),o.tps!==void 0&&l.jsxs("span",{className:`flex items-center gap-0.5 ${Vb[RL(o.tps)]}`,title:g.models.tpsTitle,children:[l.jsx(Ue,{d:DL,size:11}),o.tps," tok/s"]})]}):l.jsx("span",{className:"shrink-0 text-[11px] font-medium text-red-600 dark:text-red-400",title:o.message,children:g.models.speedFailed}):null;return l.jsxs("button",{type:"button",onClick:c,className:"flex w-full flex-col gap-0.5 rounded-md border border-gray-200 px-3 py-2.5 text-left transition-colors duration-150 hover:border-gray-300 hover:bg-gray-50 dark:border-gray-800 dark:hover:border-gray-700 dark:hover:bg-gray-800/40",children:[l.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[l.jsx("span",{className:"text-sm font-medium",children:e.displayName??e.modelId}),r&&l.jsx(Jt,{tone:"brand",children:g.models.default}),W2(e)&&l.jsx(Jt,{tone:"yellow",children:g.models.freeBadge}),e.vision&&l.jsx(Jt,{tone:"green",children:g.models.visionBadge}),s&&l.jsx(Jt,{tone:"amber",children:g.models.visionModelBadge})]}),e.displayName!==void 0&&l.jsx("span",{className:"truncate font-mono text-[11px] text-gray-500 dark:text-gray-400",children:e.modelId}),l.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[l.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] text-gray-400 dark:text-gray-500",children:f.join(" · ")}),m]})]})}const qL={save:()=>g.models.confirmSaveTitle,setDefault:()=>g.models.confirmDefaultTitle,setVisionModel:()=>g.models.confirmVisionModelTitle,remove:()=>g.models.confirmDeleteTitle},VL={save:e=>g.models.confirmSave(e),setDefault:e=>g.models.confirmDefault(e),setVisionModel:e=>g.models.confirmVisionModel(e),remove:e=>g.models.confirmDelete(e)};function GL({projectId:e,row:n,addProvider:r,existingRefs:s,currency:o,canEdit:c,isDefault:d,isVisionModel:f,onClose:m,onSubmit:h}){const[p,y]=v.useState(()=>{if(n)return{...n,cacheRead:Bl(n.cacheRead,o),cacheWrite:Bl(n.cacheWrite,o),output:Bl(n.output,o)};const P=Br(r),ce=P!==void 0&&P.id!=="custom"&&P.gatewayBaseUrl===void 0;return{provider:r,modelId:"",original:null,vision:!0,contextWindow:"",maxTokens:"",clientType:ce?"":"openai",cacheRead:"",cacheWrite:"",output:"",baseUrl:P?.gatewayBaseUrl??"",originalBaseUrl:"",apiKeyInput:"",clearApiKey:!1}}),[k,w]=v.useState({}),[S,T]=v.useState(!1),[M,E]=v.useState(null),R=n===null,I=n!==null&&$L(n),H=P=>{y(ce=>({...ce,...P})),w(ce=>{const oe={...ce};for(const A of Object.keys(P))delete oe[A];return oe})},D=async()=>{T(!0);try{const P=p.apiKeyInput.trim(),ce=p.baseUrl.trim(),oe={provider:p.provider,modelId:p.modelId.trim(),baseUrl:ce||null};P?oe.apiKey=P:p.clearApiKey&&(oe.clearApiKey=!0),p.clientType.trim()&&(oe.clientType=p.clientType.trim());const A=await jv(e,oe);A.ok?ea(g.models.testOk(A.latencyMs??0)):xt(g.models.testFailed(A.message??""))}catch(P){xt(g.models.testFailed(Ae(P)))}finally{T(!1)}},L=p.clientType.trim().toLowerCase().includes("openai")||p.provider==="custom"||Br(p.provider)===void 0,$=!I&&L,K=()=>{const P=p.modelId.trim(),ce={provider:p.provider,modelId:P},oe=p.baseUrl.trim(),A={};P?!vt(ce,p.original)&&s.some(se=>vt(se,ce))&&(A.modelId=g.models.modelIdExists):A.modelId=g.common.requiredField,$&&!oe&&(A.baseUrl=g.models.baseUrlRequired);const C=[["cacheRead",p.cacheRead.trim()],["cacheWrite",p.cacheWrite.trim()],["output",p.output.trim()]],z=C.filter(([,se])=>se!=="").length;for(const[se,le]of C)le===""&&z>0?A[se]=g.models.pricingAllOrNone:le!==""&&!Number.isFinite(Number(le))&&(A[se]=g.models.pricingInvalid);const N=p.contextWindow.trim();N&&!Number.isFinite(Number(N))&&(A.contextWindow=g.models.contextWindowInvalid);const Q=p.maxTokens.trim();return Q&&!(Number.isInteger(Number(Q))&&Number(Q)>0)&&(A.maxTokens=g.models.maxTokensInvalid),Object.keys(A).length>0?(w(A),null):(w({}),{...p,modelId:P,contextWindow:!I&&!N?String(ah):p.contextWindow,cacheRead:nh(p.cacheRead,o),cacheWrite:nh(p.cacheWrite,o),output:nh(p.output,o)})},X=P=>{const ce=K();ce&&h(ce,P)},U=Br(p.provider),V=F8(p.modelId.trim(),p.clientType.trim()||void 0)?.envKey,O=U!==void 0&&U.id!=="custom"&&U.gatewayBaseUrl===void 0,W=R&&O&&!p.clientType.trim()&&p.modelId.trim()!==""&&V===void 0,Z=l.jsxs(l.Fragment,{children:[l.jsxs("label",{className:"block",children:[l.jsxs("span",{className:"mb-1 flex items-baseline justify-between gap-2",children:[l.jsxs("span",{className:"text-xs font-semibold text-gray-600 dark:text-gray-400",children:[g.models.modelId,l.jsx("span",{className:"ml-0.5 text-red-500 dark:text-red-400","aria-hidden":!0,children:"*"})]}),l.jsx("span",{className:"flex shrink-0 items-baseline gap-2.5",children:U?.modelsUrl&&l.jsxs("a",{href:U.modelsUrl,target:"_blank",rel:"noreferrer noopener",className:"shrink-0 text-xs text-brand-600 underline-offset-2 hover:underline dark:text-brand-300",children:[g.models.getModelIds," ↗"]})})]}),l.jsx(tt,{size:"sm",required:!0,value:p.modelId,disabled:!c,invalid:!!k.modelId,onChange:P=>H({modelId:P.target.value}),className:"font-mono",autoFocus:R,placeholder:g.models.modelIdHint}),k.modelId&&l.jsx(ks,{children:k.modelId}),W&&l.jsx("span",{className:"mt-1 block text-xs text-amber-600 dark:text-amber-400",children:g.models.autoRouteNone})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[l.jsx(tt,{size:"sm",label:g.models.displayName,value:p.displayName??"",disabled:!c,onChange:P=>H({displayName:P.target.value}),placeholder:g.models.displayNameHint}),l.jsxs(Ro,{size:"sm",label:g.models.providerGroup,value:p.provider,disabled:!c,onChange:P=>H({provider:P.target.value}),children:[js.map(P=>l.jsx("option",{value:P.id,children:P.label},P.id)),[...new Set(s.map(P=>P.provider).concat(p.provider))].filter(P=>!js.some(ce=>ce.id===P)).sort().map(P=>l.jsx("option",{value:P,children:P},P))]})]})]}),B=p.credential?.apiKeyMasked?g.models.apiKeyKeepHint:V?g.models.apiKeyEnvHint(V):g.models.apiKeyKeepHint,F=!p.credential?.apiKeyMasked&&V&&V===U?.envKey?g.models.providerEnvNotes[p.provider]:void 0;return l.jsxs(pn,{open:!0,title:R?O?g.models.addTitleVendor:g.models.addTitle:g.models.editTitle,onClose:m,widthClass:"sm:max-w-lg",footer:l.jsxs(l.Fragment,{children:[l.jsx(Se,{onClick:m,children:g.common.cancel}),c&&l.jsx(Se,{variant:"primary",onClick:()=>{if(!K())return;if(R||n===null){X("save");return}const P={...n,cacheRead:Bl(n.cacheRead,o),cacheWrite:Bl(n.cacheWrite,o),output:Bl(n.output,o)};if(JSON.stringify(p)===JSON.stringify(P)){Cs(g.common.noChangesToSave);return}E("save")},children:g.common.confirm})]}),children:[l.jsxs("div",{className:"space-y-3",children:[!R&&l.jsxs("div",{className:"flex items-center gap-2.5 rounded-md bg-gray-50 px-3 py-2 dark:bg-gray-800/60",children:[l.jsx(Xl,{provider:p.provider,className:"h-6 w-6 shrink-0 text-gray-700 dark:text-gray-300"}),l.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[l.jsxs("span",{className:"flex flex-wrap items-center gap-1.5 text-sm font-medium",children:[p.displayName??p.modelId,d&&l.jsx(Jt,{tone:"brand",children:g.models.default}),p.vision&&l.jsx(Jt,{tone:"green",children:g.models.visionBadge}),f&&l.jsx(Jt,{tone:"amber",children:g.models.visionModelBadge})]}),p.displayName!==void 0&&l.jsx("span",{className:"truncate font-mono text-xs text-gray-500 dark:text-gray-400",children:p.modelId})]}),n&&sb(n.provider,n.modelId)&&l.jsxs("a",{href:sb(n.provider,n.modelId),target:"_blank",rel:"noreferrer noopener",className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-gray-300 bg-white px-2.5 py-1 text-xs font-medium text-gray-800 transition-colors duration-150 hover:bg-gray-50 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-200 dark:hover:bg-gray-800",children:[g.models.homepage,l.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"shrink-0",children:l.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14 21 3"})})]})]}),R&&l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:O?g.models.addAutoRouteHint:g.models.addProtocolHint}),Z]}),c&&l.jsx("div",{className:"space-y-1.5",children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(Se,{size:"sm",disabled:S||!p.modelId.trim(),onClick:()=>{D()},children:S?g.models.testing:g.models.testConnection}),!R&&!d&&l.jsx(Se,{size:"sm",onClick:()=>E("setDefault"),children:g.models.setDefault}),!R&&p.vision&&!f&&l.jsx(Se,{size:"sm",title:g.models.visionModelHint,onClick:()=>E("setVisionModel"),children:g.models.setVisionModel}),!R&&l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"min-w-0 flex-1"}),l.jsx(Se,{size:"sm",variant:"danger",onClick:()=>E("remove"),children:g.models.remove})]})]})}),l.jsxs("div",{className:"block",children:[l.jsxs("span",{className:"mb-1 flex items-baseline justify-between gap-2",children:[l.jsx("span",{className:"text-xs font-semibold text-gray-600 dark:text-gray-400",children:g.models.apiKey}),U?.apiKeyUrl&&l.jsxs("a",{href:U.apiKeyUrl,target:"_blank",rel:"noreferrer noopener",className:"shrink-0 text-xs text-brand-600 underline-offset-2 hover:underline dark:text-brand-300",children:[g.models.getApiKey," ↗"]})]}),l.jsx(ws,{size:"sm",value:p.apiKeyInput,disabled:!c,onChange:P=>H({apiKeyInput:P.target.value,clearApiKey:!1}),className:"font-mono",autoComplete:"off",autoFocus:!R,placeholder:B})]}),F&&l.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:F}),p.credential?.apiKeyMasked&&!p.apiKeyInput&&l.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-gray-500 dark:text-gray-400",children:[l.jsx("span",{className:"font-mono",children:p.credential.apiKeyMasked}),p.credential.createdAt&&l.jsxs("span",{className:"text-gray-400",children:[g.common.created," ",ma(p.credential.createdAt)]}),c&&l.jsxs("label",{className:"flex items-center gap-1.5",children:[l.jsx("input",{type:"checkbox",checked:p.clearApiKey,onChange:P=>H({clearApiKey:P.target.checked})}),g.models.clearApiKey]})]}),l.jsx(tt,{size:"sm",label:g.models.baseUrl,required:$,value:p.baseUrl,disabled:!c,onChange:P=>H({baseUrl:P.target.value}),className:"font-mono",placeholder:I?g.models.baseUrlHint:"https://…",...k.baseUrl?{error:k.baseUrl}:{},...L?{}:{hint:g.models.baseUrlOfficialNote}}),l.jsxs("div",{className:"grid grid-cols-2 items-start gap-2",children:[l.jsxs("label",{className:"block",children:[l.jsx(Gl,{children:g.models.contextWindow}),l.jsxs("span",{className:"relative block",children:[l.jsx(tt,{size:"sm",value:p.contextWindow,inputMode:"numeric",disabled:!c,invalid:!!k.contextWindow,onChange:P=>H({contextWindow:Wb(P.target.value)}),className:"pr-12 font-mono",title:I?g.models.contextWindowHint:g.models.contextWindowDefaultHint(ah),placeholder:I?g.models.contextWindowHint:g.models.contextWindowDefaultHint(ah)}),l.jsx("span",{className:"pointer-events-none absolute inset-y-0 right-2 flex items-center text-xs text-gray-400",children:g.models.tokenUnit})]}),k.contextWindow&&l.jsx(ks,{children:k.contextWindow})]}),l.jsxs("label",{className:"block",children:[l.jsx(Gl,{children:g.models.maxTokens}),l.jsxs("span",{className:"relative block",children:[l.jsx(tt,{size:"sm",value:p.maxTokens,inputMode:"numeric",disabled:!c,invalid:!!k.maxTokens,onChange:P=>H({maxTokens:Wb(P.target.value)}),className:"pr-12 font-mono",title:g.models.maxTokensTitle,placeholder:g.models.maxTokensHint}),l.jsx("span",{className:"pointer-events-none absolute inset-y-0 right-2 flex items-center text-xs text-gray-400",children:g.models.tokenUnit})]}),k.maxTokens&&l.jsx(ks,{children:k.maxTokens})]})]}),l.jsx("div",{className:"grid grid-cols-3 items-start gap-2",children:[["cacheRead",g.models.priceCacheRead,p.cacheRead],["cacheWrite",g.models.priceCacheWrite,p.cacheWrite],["output",g.models.priceOutput,p.output]].map(([P,ce,oe])=>l.jsxs("label",{className:"block",children:[l.jsx(Gl,{children:ce}),l.jsxs("span",{className:"relative block",children:[l.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-2 flex items-center text-xs text-gray-400",children:pw[o]}),l.jsx(tt,{size:"sm",value:oe,inputMode:"decimal",disabled:!c,invalid:!!k[P],onChange:A=>H({[P]:zL(A.target.value)}),className:"pl-4 pr-11 text-right font-mono"}),l.jsx("span",{className:"pointer-events-none absolute inset-y-0 right-2 flex items-center text-xs text-gray-400",children:g.models.priceUnitShort})]}),k[P]&&l.jsx(ks,{children:k[P]})]},P))}),!R&&Z,!R&&!I&&p.clientType&&p.clientType!=="openai"&&l.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:g.models.clientTypeLocked(p.clientType)}),!I&&l.jsxs("div",{children:[l.jsxs("label",{className:`inline-flex items-center gap-2 ${c?"cursor-pointer":"cursor-not-allowed"}`,children:[l.jsx("span",{className:"text-xs font-semibold text-gray-600 dark:text-gray-400",children:g.models.vision}),l.jsx(dp,{checked:p.vision,disabled:!c,onChange:P=>H({vision:P}),"aria-label":g.models.vision})]}),!p.vision&&l.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:g.models.visionOffProxyHint})]})]}),M&&l.jsx(ga,{open:!0,title:qL[M](),tone:M==="remove"?"danger":"primary",onClose:()=>E(null),onConfirm:()=>{const P=M;E(null),X(P)},children:l.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:VL[M](p.displayName??p.modelId)})})]})}function WL({provider:e,count:n,onClose:r,onSubmit:s}){const[o,c]=v.useState("");return l.jsx(pn,{open:!0,title:g.models.groupApiKeyTitle(e.label),onClose:r,footer:l.jsxs(l.Fragment,{children:[l.jsx(Se,{onClick:r,children:g.common.cancel}),l.jsx(Se,{variant:"primary",disabled:!o.trim(),onClick:()=>s(o.trim()),children:g.common.confirm})]}),children:l.jsxs("div",{className:"space-y-2",children:[l.jsx(tt,{size:"sm",label:g.models.apiKey,required:!0,type:"password",value:o,onChange:d=>c(d.target.value),className:"font-mono",autoComplete:"off",autoFocus:!0,placeholder:g.models.apiKeyEnvHint(e.envKey)}),l.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:g.models.groupApiKeyHint(n)}),g.models.providerEnvNotes[e.id]&&l.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:g.models.providerEnvNotes[e.id]}),e.apiKeyUrl&&l.jsxs("a",{href:e.apiKeyUrl,target:"_blank",rel:"noreferrer noopener",className:"inline-block text-xs text-brand-600 underline-offset-2 hover:underline dark:text-brand-300",children:[g.models.getApiKey," ↗"]})]})})}const mo=200,al=46,Yu=8,bo=10,KL=22;function gw(e,n,r){return xw(e,0,n,r)}function xw(e,n,r,s){const o=Math.max(0,s-al-Yu),c=mo-bo-KL,d=e>0?o/e:o,f=r-n;return{n:e,min:n,max:r,w:s,innerW:o,innerH:c,step:d,x:m=>al+d*m+d/2,y:m=>bo+c*(1-(f>0?(m-n)/f:0))}}function YL(e,n){return n.map((r,s)=>`${s===0?"M":"L"}${e.x(s)},${e.y(r)}`).join(" ")}function QL(e,n){const r=n.length;if(r===0)return"";const s=e.y(0),o=[];for(let c=0;c<r;c++)o.push(`${c===0?"M":"L"}${e.x(c)},${e.y(n[c])}`);return o.push(`L${e.x(r-1)},${s}`),o.push(`L${e.x(0)},${s}`),o.push("Z"),o.join(" ")}function XL(e){return e<=0?[]:e===1?[0]:e===2?[0,1]:[0,Math.floor((e-1)/2),e-1]}const ZL=40;function JL(e,n){if(e<=0)return[];const r=n>0?Math.max(1,Math.ceil(ZL/n)):e,s=[];for(let o=0;o<e;o+=r)s.push(o);return s}function e7(e,n){return n>0?e/n:1}const yu=12;function t7(e,n,r,s,o){let c=e+yu;c+r>o.right&&(c=e-yu-r);let d=n+yu;return d+s>o.bottom&&(d=n-yu-s),{left:Math.max(o.left,Math.min(c,o.right-r)),top:Math.max(0,Math.min(d,o.bottom-s))}}const rh=25,n7=8;function a7(e,n){const r=Math.max(0,e-al-Yu),s=2*rh*n;return s<=r?{barW:rh,chartW:e,scroll:!1}:{barW:rh,chartW:al+s+Yu,scroll:!0}}function r7(e,n,r){const s=e.length;if(s===0)return[];if(n<=s*r)return e.map(()=>n/s);const o=new Set;for(;;){const c=n-o.size*r,d=e.reduce((h,p,y)=>o.has(y)?h:h+p,0),f=h=>d>0?e[h]/d*c:c/(s-o.size),m=e.findIndex((h,p)=>!o.has(p)&&f(p)<r);if(m<0)return e.map((h,p)=>o.has(p)?r:f(p));o.add(m)}}const s7=["output","cacheWrite","cacheRead"];function l7(e,n){const r=s7.map(m=>({key:m,value:n[m]})).filter(m=>m.value>0);if(r.length===0)return[];const s=[];let o=0;for(const m of r){const h=e.y(o);o+=m.value;const p=e.y(o);s.push({y:p,h:h-p})}const c=e.y(0),d=r7(s.map(m=>m.h),c-e.y(o),n7);let f=c;return r.map((m,h)=>{const p=d[h],y={key:m.key,value:m.value,y:s[h].y,h:s[h].h,hitY:f-p,hitH:p};return f-=p,y})}const yw=Math.PI*2,Qu=e=>Math.round(e*100)/100;function bu(e,n,r,s){const o=s-Math.PI/2;return[Qu(e+r*Math.cos(o)),Qu(n+r*Math.sin(o))]}function i7(e,n,r,s,o){if(o-s>=yw-1e-9){const[p,y]=bu(e,n,r,0),[k,w]=bu(e,n,r,Math.PI);return`M${p},${y} A${r},${r} 0 1 1 ${k},${w} A${r},${r} 0 1 1 ${p},${y} Z`}const[c,d]=bu(e,n,r,s),[f,m]=bu(e,n,r,o),h=o-s>Math.PI?1:0;return`M${Qu(e)},${Qu(n)} L${c},${d} A${r},${r} 0 ${h} 1 ${f},${m} Z`}function o7(e,n,r,s){const o=e.reduce((f,m)=>f+Math.max(0,m),0);if(o<=0)return[];const c=[];let d=0;return e.forEach((f,m)=>{if(f<=0)return;const h=f/o,p=d+h*yw;c.push({index:m,value:f,frac:h,start:d,end:p,path:i7(n,r,s,d,p)}),d=p}),c}function Wp(){const e=v.useRef(null),[n,r]=v.useState(0);return v.useLayoutEffect(()=>{const s=e.current;if(!s)return;const o=()=>r(Math.floor(s.getBoundingClientRect().width));o();const c=new ResizeObserver(o);return c.observe(s),()=>c.disconnect()},[]),[e,n]}function Kp({geom:e,fmtY:n,dates:r,hover:s,onHover:o,bubble:c,hitLayer:d,labels:f,yTicks:m,hoverLine:h=!0,scrollToEnd:p=!1,children:y}){const{x:k,y:w,w:S,innerH:T,step:M,min:E,max:R}=e,I=m??[0,.25,.5,.75,1].map(O=>E+(R-E)*O),H=f??XL(r.length),D=v.useRef(null);v.useLayoutEffect(()=>{const O=D.current;!p||!O||(O.scrollLeft=O.scrollWidth-O.clientWidth)},[p,S,r.length]);const L=v.useRef(null),$=v.useRef(null),K=v.useRef(null),X=v.useRef(0),U=()=>{const O=$.current,W=L.current,Z=D.current,B=K.current;if(!O||!W||!Z||!B)return;const F=W.getBoundingClientRect(),P=t7(B.cx-F.left,B.cy-F.top,O.offsetWidth,O.offsetHeight,{left:Z.scrollLeft,right:Z.scrollLeft+Z.clientWidth,bottom:mo});O.style.left=`${P.left}px`,O.style.top=`${P.top}px`,O.style.visibility="visible"},V=()=>{X.current||(X.current=requestAnimationFrame(()=>{X.current=0,U()}))};return v.useEffect(()=>()=>cancelAnimationFrame(X.current),[]),v.useLayoutEffect(U,[c,s]),l.jsxs("div",{ref:D,className:"relative overflow-x-auto",children:[l.jsxs("svg",{ref:L,viewBox:`0 0 ${S} ${mo}`,width:S,height:mo,className:"text-gray-600 dark:text-gray-400",role:"img",onMouseLeave:()=>{o(null),K.current=null},onMouseMove:O=>{K.current={cx:O.clientX,cy:O.clientY},V()},children:[I.map((O,W)=>l.jsxs("g",{children:[l.jsx("line",{x1:al,x2:S-Yu,y1:w(O),y2:w(O),className:"stroke-gray-200 dark:stroke-gray-800",strokeWidth:1}),l.jsx("text",{x:al-6,y:w(O)+3,textAnchor:"end",className:"fill-gray-400 dark:fill-gray-500",fontSize:9,children:n(O)})]},W)),h&&s!==null&&r[s]&&l.jsx("line",{x1:k(s),x2:k(s),y1:bo,y2:bo+T,className:"stroke-gray-300 dark:stroke-gray-700",strokeWidth:1}),y,H.map(O=>{const W=r[O];return W?l.jsx("text",{x:k(O),y:mo-6,textAnchor:"middle",className:"fill-gray-400 dark:fill-gray-500",fontSize:9,children:W.slice(5)},O):null}),d??r.map((O,W)=>l.jsx("rect",{x:al+M*W,y:bo,width:M,height:T,fill:"transparent",className:"cursor-crosshair",onMouseEnter:()=>o(W)},`hit-${W}`))]}),c&&s!==null&&r[s]&&l.jsx("div",{ref:$,className:"pointer-events-none absolute rounded border border-gray-200 bg-white px-2 py-1 text-xs whitespace-nowrap shadow-sm dark:border-gray-700 dark:bg-gray-900",style:{left:0,top:0,visibility:"hidden"},children:c(s)})]})}function c7({points:e,currency:n="USD"}){const[r,s]=v.useState(null),[o,c]=Wp(),d=e.map(p=>p.cost??0),f=Math.max(1e-9,...d),m=gw(e.length,f,c),h=e.map(p=>p.date);return l.jsx("div",{ref:o,children:c>0&&l.jsx(Kp,{geom:m,fmtY:p=>Za(p,n),dates:h,hover:r,onHover:s,bubble:p=>{const y=e[p];return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-gray-400",children:y.date}),l.jsx("p",{className:"font-mono",children:Za(y.cost,n)})]})},children:l.jsxs("g",{children:[l.jsx("path",{d:QL(m,d),className:"fill-current",stroke:"none",opacity:r!==null?.06:.1}),l.jsx("path",{d:YL(m,d),fill:"none",stroke:"currentColor",strokeWidth:2,opacity:r!==null?.35:1}),e.map((p,y)=>l.jsx("circle",{cx:m.x(y),cy:m.y(p.cost??0),r:r===y?4:2.5,className:"fill-current",opacity:r!==null&&r!==y?.25:1},p.date))]})})})}const vo={cacheRead:"#7dd3fc",cacheWrite:"#0ea5e9",output:"#0369a1"},Yb=[{fill:"fill-violet-500 dark:fill-violet-400",swatch:"bg-violet-500 dark:bg-violet-400"},{fill:"fill-sky-500 dark:fill-sky-400",swatch:"bg-sky-500 dark:bg-sky-400"},{fill:"fill-amber-500 dark:fill-amber-400",swatch:"bg-amber-500 dark:bg-amber-400"},{fill:"fill-rose-500 dark:fill-rose-400",swatch:"bg-rose-500 dark:bg-rose-400"},{fill:"fill-emerald-500 dark:fill-emerald-400",swatch:"bg-emerald-500 dark:bg-emerald-400"},{fill:"fill-cyan-500 dark:fill-cyan-400",swatch:"bg-cyan-500 dark:bg-cyan-400"},{fill:"fill-fuchsia-500 dark:fill-fuchsia-400",swatch:"bg-fuchsia-500 dark:bg-fuchsia-400"}];function Qb(e){return Yb[e%Yb.length]}const Xb=[{text:"text-violet-500",swatch:"bg-violet-500"},{text:"text-amber-500 dark:text-amber-600",swatch:"bg-amber-500 dark:bg-amber-600"},{text:"text-sky-500 dark:text-sky-600",swatch:"bg-sky-500 dark:bg-sky-600"},{text:"text-rose-500",swatch:"bg-rose-500"}];function bw(e){return Xb[e%Xb.length]}function md({text:e}){return l.jsx("p",{className:"py-6 text-center text-xs text-gray-400",children:e??g.usage.empty})}function u7(e){return e==="cacheRead"?g.usage.colCacheRead:e==="cacheWrite"?g.usage.colCacheWrite:g.usage.colOutput}const vw="opacity-25",vu=160,d7=75;function f7({data:e}){const[n,r]=v.useState(null),s=e.reduce((m,h)=>m+h.requests,0);if(e.length===0||s<=0)return l.jsx(md,{});const o=[...e].sort((m,h)=>h.requests-m.requests),c=o7(o.map(m=>m.requests),vu/2,vu/2,d7),d=m=>`${Math.round(m/s*100)}%`,f=m=>n!==null&&n!==m?vw:"";return l.jsxs("div",{className:"flex items-center gap-3",onMouseLeave:()=>r(null),children:[l.jsx("svg",{viewBox:`0 0 ${vu} ${vu}`,className:"h-40 w-40 shrink-0",role:"img","aria-label":g.usage.chartAgentCalls,children:c.map(m=>{const h=o[m.index];return l.jsx("path",{d:m.path,onMouseEnter:()=>r(m.index),className:`cursor-pointer ${Qb(m.index).fill} transition-opacity duration-150 ${f(m.index)}`,children:l.jsx("title",{children:`${h.agentId} · ${h.requests} ${g.usage.requests} · ${d(h.requests)}`})},h.agentId)})}),l.jsx("ul",{className:"flex max-h-40 min-w-0 flex-1 flex-col gap-1 overflow-y-auto",children:o.map((m,h)=>l.jsxs("li",{onMouseEnter:()=>r(m.requests>0?h:null),title:`${m.agentId} · ${m.requests} ${g.usage.requests} · ${ft(m.total)}`,className:`flex cursor-pointer items-center gap-1.5 text-[10px] transition-opacity duration-150 ${f(h)}`,children:[l.jsx("span",{className:`inline-block h-2 w-2 shrink-0 rounded-sm ${Qb(h).swatch}`}),l.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-gray-500 dark:text-gray-400",children:m.agentId}),l.jsx("span",{className:"shrink-0 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:m.requests}),l.jsx("span",{className:"w-8 shrink-0 text-right font-mono tabular-nums text-gray-400 dark:text-gray-500",children:d(m.requests)})]},m.agentId))})]})}function m7({dimmed:e,onEnter:n,title:r,label:s,value:o,children:c}){return l.jsxs("div",{onMouseEnter:n,className:`flex cursor-pointer items-center gap-2 transition-opacity duration-150 ${e?vw:""}`,title:r,children:[l.jsx("span",{className:"w-24 shrink-0 truncate font-mono text-[10px] text-gray-500 dark:text-gray-400",children:s}),c,l.jsx("span",{className:"w-10 shrink-0 text-right font-mono text-[10px] tabular-nums text-gray-500 dark:text-gray-400",children:o})]})}function h7(e){return Fp(e.provider,e.modelId)?.displayName??e.modelId}function p7(e){const n=[`${e.completed}/${e.total}`];e.failed>0&&n.push(`failed ${e.failed}`),e.timeout>0&&n.push(`timeout ${e.timeout}`),e.malformed>0&&n.push(`malformed ${e.malformed}`),e.aborted>0&&n.push(`${g.usage.successAborted} ${e.aborted}`);const r=Br(e.provider)?.label??e.provider;return`${e.modelId} · ${r} · ${n.join(" · ")}`}function g7({data:e}){const[n,r]=v.useState(null);return e.length===0?l.jsx(md,{}):l.jsx("div",{className:"flex flex-col gap-1.5",onMouseLeave:()=>r(null),children:e.map((s,o)=>{const c=e7(s.completed,s.total),d=Math.round(c*100);return l.jsx(m7,{dimmed:n!==null&&n!==o,onEnter:()=>r(o),title:p7(s),label:h7(s),value:`${d}%`,children:l.jsx("div",{className:"h-3 min-w-0 flex-1 overflow-hidden rounded-sm bg-gray-200 dark:bg-gray-800",children:l.jsx("div",{className:"h-full rounded-sm bg-sky-500 dark:bg-sky-400",style:{width:`${c*100}%`}})})},`${s.provider}:${s.modelId}`)})})}function x7({trend:e,legend:n}){const[r,s]=v.useState(null),[o,c]=Wp();if(e.length===0)return l.jsx(md,{});const d=e.map(T=>T.cacheRead+T.cacheWrite+T.output),f=Math.max(1,...d),{barW:m,chartW:h,scroll:p}=a7(c,e.length),y=gw(e.length,f,h),k=e.map(T=>T.date),w=e.map(T=>l7(y,T)),S=(T,M)=>r!==null&&!(r.i===T&&r.key===M)||n!=null&&n!==M;return l.jsx("div",{ref:o,children:c>0&&l.jsx(Kp,{geom:y,fmtY:T=>ft(Math.round(T)),dates:k,hover:r?.i??null,labels:JL(e.length,y.step),hoverLine:!1,scrollToEnd:p,onHover:T=>{T===null&&s(null)},bubble:T=>{const M=e[T],E=r?.key;if(!E)return null;const R=E==="cacheRead"?rk(M.cacheRead,M.cacheWrite):null;return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-gray-400",children:M.date}),l.jsxs("p",{className:"font-mono",children:[u7(E)," ",ft(M[E])]}),R!==null&&l.jsxs("p",{className:"font-mono",children:[g.traces.hitRate," ",up(R)]})]})},hitLayer:e.map((T,M)=>w[M].map(E=>l.jsx("rect",{x:y.x(M)-m/2,y:E.hitY,width:m,height:E.hitH,fill:"transparent",className:"cursor-pointer",onMouseEnter:()=>s({i:M,key:E.key}),onMouseLeave:()=>s(null)},`hit-${T.date}-${E.key}`))),children:e.map((T,M)=>w[M].map(E=>l.jsx("rect",{x:y.x(M)-m/2,y:E.y,width:m,height:E.h,fill:vo[E.key],className:"transition-opacity duration-150",opacity:S(M,E.key)?.2:1},`${T.date}-${E.key}`)))})})}function y7({active:e,onHover:n}){const r=[["cacheRead",g.usage.colCacheRead],["cacheWrite",g.usage.colCacheWrite],["output",g.usage.colOutput]];return l.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:r.map(([s,o])=>l.jsxs("button",{type:"button",onMouseEnter:()=>n?.(s),onMouseLeave:()=>n?.(null),className:`flex items-center gap-1 text-[10px] text-gray-500 transition-opacity duration-150 dark:text-gray-400 ${e!=null&&e!==s?"opacity-30":""}`,children:[l.jsx("span",{className:"inline-block h-2 w-3 rounded-sm",style:{backgroundColor:vo[s]}}),o]},s))})}function b7(e){return e==="unexpected"?g.usage.errorsUnexpected:g.usage.errorsExpected}function v7(e){return e==="unexpected"?"unexpected":"expected"}const k7={environment:"env"};function Zb(e,n){return`[${k7[e]??e}] ${n}`}function ku({label:e,value:n,alert:r,muted:s}){const o=r?"text-rose-600 dark:text-rose-400":s?"text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100";return l.jsxs("div",{className:"flex items-baseline gap-1.5",children:[l.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:e}),l.jsx("span",{className:`font-mono text-sm font-semibold tabular-nums ${o}`,children:n})]})}function wu({children:e,className:n=""}){return l.jsx("th",{className:`py-1.5 pr-2 font-medium ${n}`,children:e})}function w7({errors:e,projectId:n,filters:r}){const{total:s,unexpected:o,topCode:c,recent:d}=e,f=Math.max(1,d.length),[m,h]=v.useState(0),[p,y]=v.useState(d),[k,w]=v.useState(s),[S,T]=v.useState(null),[M,E]=v.useState(!1);v.useEffect(()=>h(0),[d]),v.useEffect(()=>{if(m===0){y(d),w(s),T(null);return}let L=!1;return E(!0),T(null),L5(n,{offset:m*f,limit:f,...r}).then($=>{L||(y($.items),w($.total))}).catch($=>{L||T(Ae($))}).finally(()=>{L||E(!1)}),()=>{L=!0}},[m,f,n,r,d,s]);const R=Math.max(1,Math.ceil(k/f)),[I,H]=v.useState(new Set);v.useEffect(()=>H(new Set),[p]);const D=L=>H($=>{const K=new Set($);return K.has(L)?K.delete(L):K.add(L),K});return l.jsxs("div",{children:[l.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-6 gap-y-1.5",children:[l.jsx(ku,{label:g.usage.errorsTotal,value:String(s)}),l.jsx(ku,{label:g.usage.errorsUnexpected,value:String(o),alert:o>0,muted:o===0}),l.jsx(ku,{label:g.usage.errorsExpected,value:String(s-o),muted:!0}),c&&l.jsx(ku,{label:g.usage.errorsTopCode,value:`${Zb(c.source,c.code)} ×${c.count}`})]}),p.length===0?l.jsx(md,{text:g.usage.errorsEmpty}):l.jsx("div",{className:"mt-2.5 max-h-72 overflow-y-auto border-t border-gray-200 dark:border-gray-800",children:l.jsxs("table",{className:"w-full table-fixed text-xs",children:[l.jsx("thead",{className:"sticky top-0 bg-white text-left text-gray-400 dark:bg-gray-900 dark:text-gray-500",children:l.jsxs("tr",{children:[l.jsx(wu,{className:"w-32",children:g.common.time}),l.jsx(wu,{className:"w-72",children:g.usage.errorsColCode}),l.jsx(wu,{className:"w-20",children:g.usage.errorsColKind}),l.jsx(wu,{children:g.usage.errorsColMessage})]})}),l.jsx("tbody",{children:p.map((L,$)=>{const K=v7(L.kind);return l.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800/60",children:[l.jsx("td",{className:"py-1.5 pr-2 align-top font-mono tabular-nums text-gray-400",children:ma(L.ts)}),l.jsx("td",{className:"py-1.5 pr-2 align-top font-mono text-gray-500 dark:text-gray-400",children:l.jsx("span",{className:"block break-words",children:Zb(L.source,L.code)})}),l.jsx("td",{className:"py-1.5 pr-2 align-top",children:l.jsx(Jt,{tone:K==="unexpected"?"red":"gray",children:b7(K)})}),l.jsx("td",{className:"py-1.5 align-top text-gray-500 dark:text-gray-400",children:l.jsx("button",{type:"button",title:L.message,onClick:()=>D($),className:`block w-full cursor-pointer text-left transition-colors hover:text-gray-700 dark:hover:text-gray-300 ${I.has($)?"whitespace-pre-wrap break-words":"truncate"}`,children:L.message})})]},`${L.ts}-${$}`)})})]})}),(R>1||m>0)&&l.jsxs("div",{className:"mt-2 flex items-center justify-end gap-2 text-xs text-gray-500 dark:text-gray-400",children:[S!==null&&l.jsx("span",{className:"mr-auto text-rose-500",children:S}),l.jsx("span",{className:"tabular-nums",children:g.usage.errorsPageOf(m+1,R,k)}),l.jsx(Jb,{label:g.usage.errorsNewer,disabled:m===0||M,onClick:()=>h(L=>Math.max(0,L-1))}),l.jsx(Jb,{label:g.usage.errorsOlder,disabled:m+1>=R||M,onClick:()=>h(L=>L+1)})]})]})}function Jb({label:e,disabled:n,onClick:r}){return l.jsx("button",{type:"button",disabled:n,onClick:r,className:"rounded-md border border-gray-200 px-2 py-0.5 transition-colors duration-150 hover:bg-gray-100 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent dark:border-gray-800 dark:hover:bg-gray-800/60 dark:disabled:hover:bg-transparent",children:e})}function ev(e){const n=r=>r<10?`0${r}`:`${r}`;return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`}function sh({label:e,value:n,muted:r,sup:s}){const o=r?"text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100";return l.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[l.jsxs("span",{className:"shrink-0 text-xs text-gray-500 dark:text-gray-400",children:[e,s&&l.jsx("sup",{className:"ml-px",children:"*"})]}),l.jsx("span",{className:`min-w-0 truncate font-mono text-sm font-semibold tabular-nums ${o}`,children:n})]})}function lh({title:e,bucket:n,currency:r}){return l.jsxs("div",{className:"rounded-md border border-gray-200 bg-white p-3 dark:border-gray-800 dark:bg-gray-900",children:[l.jsx("p",{className:"mb-1.5 text-xs font-medium text-gray-500 dark:text-gray-400",children:e}),l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(sh,{label:g.usage.tokens,value:ft(n.total)}),l.jsx(sh,{label:g.usage.requests,value:String(n.requests),muted:!0}),l.jsx(sh,{label:g.common.cost,value:Za(n.cost,r),sup:n.hasUncosted})]})]})}function io({title:e,extra:n,children:r}){return l.jsxs("div",{className:"rounded-md border border-gray-200 bg-white p-3 dark:border-gray-800 dark:bg-gray-900",children:[l.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-x-2 gap-y-1",children:[l.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:e}),n]}),r]})}function S7(){pr(g.usage.title);const{currency:e}=Ns(),{currentProject:n}=gn(),r=n?.projectId??null,[s]=lp(),o=s.get("agentId"),[c,d]=v.useState(o??""),[f,m]=v.useState(null);v.useEffect(()=>{d(o??"")},[o]);const[h,p]=v.useState(()=>{const U=new Date;return U.setDate(U.getDate()-29),ev(U)}),[y,k]=v.useState(()=>ev(new Date)),[w,S]=v.useState(null),[T,M]=v.useState(null),[E,R]=v.useState(null),I=v.useCallback(async()=>{if(r){M(null);try{const U=await Cv(r,{from:h,to:y,groupBy:"date",...c?{agentId:c}:{},...f?{provider:f.provider,modelId:f.modelId}:{}});S(U)}catch(U){M(Ae(U))}}},[r,h,y,c,f?.provider,f?.modelId]);v.useEffect(()=>{S(null),I()},[I]);const H=v.useMemo(()=>({from:h,to:y,...c?{agentId:c}:{}}),[h,y,c]);if(!r)return null;const D=w?.models??[],L=f?D.findIndex(U=>U.provider===f.provider&&U.modelId===f.modelId):-1,$=L>=0?String(L):"",K=w?.summary,X=(K?.today.hasUncosted??!1)||(K?.last7d.hasUncosted??!1)||(K?.total.hasUncosted??!1);return l.jsx("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:l.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[l.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[l.jsx("h1",{className:"text-xl font-semibold",children:g.usage.title}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("div",{className:"w-32",children:l.jsxs(Ro,{size:"sm",value:c,onChange:U=>d(U.target.value),children:[l.jsx("option",{value:"",children:g.usage.filterAllAgents}),c&&!(w?.agentIds??[]).includes(c)&&l.jsx("option",{value:c,children:c}),(w?.agentIds??[]).map(U=>l.jsx("option",{value:U,children:U},U))]})}),l.jsx("div",{className:"w-32",children:l.jsxs(Ro,{size:"sm",value:$,onChange:U=>{const V=U.target.value;m(V===""?null:D[Number(V)]??null)},children:[l.jsx("option",{value:"",children:g.usage.filterAllModels}),D.map((U,V)=>l.jsx("option",{value:String(V),children:Fp(U.provider,U.modelId)?.displayName??U.modelId},`${U.provider}:${U.modelId}`))]})}),l.jsxs("div",{className:"flex items-center gap-1.5",children:[l.jsx(tt,{size:"sm",type:"date","aria-label":g.usage.from,value:h,onChange:U=>p(U.target.value)}),l.jsx("span",{className:"shrink-0 text-gray-400","aria-hidden":!0,children:"–"}),l.jsx(tt,{size:"sm",type:"date","aria-label":g.usage.to,value:y,onChange:U=>k(U.target.value)})]})]})]}),w?l.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[l.jsx(lh,{title:g.usage.today,bucket:w.summary.today,currency:e}),l.jsx(lh,{title:g.usage.last7d,bucket:w.summary.last7d,currency:e}),l.jsx(lh,{title:g.usage.total,bucket:w.summary.total,currency:e})]}):l.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[l.jsx(Gt,{className:"h-24"}),l.jsx(Gt,{className:"h-24"}),l.jsx(Gt,{className:"h-24"})]}),w?l.jsxs("div",{className:"grid grid-cols-1 gap-3 lg:grid-cols-2",children:[l.jsx(io,{title:g.usage.chartAgentCalls,children:l.jsx(f7,{data:w.byAgent})}),l.jsx(io,{title:g.usage.chartSuccessRate,children:l.jsx(g7,{data:w.success})}),l.jsx(io,{title:g.usage.chartTokenTrend,extra:l.jsx(y7,{active:E,onHover:R}),children:l.jsx(x7,{trend:w.trend,legend:E})}),l.jsx(io,{title:g.usage.chartCostTrend,children:l.jsx(c7,{points:w.trend,currency:e})})]}):l.jsx(Gt,{className:"h-64"}),w&&l.jsx(io,{title:g.usage.errors,children:l.jsx(w7,{errors:w.errors,projectId:r,filters:H})}),X&&l.jsx("p",{className:"text-xs text-gray-400",children:g.usage.uncostedNote}),T&&l.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:T})]})})}function j7({cacheRead:e,cacheWrite:n,output:r,max:s,size:o=44}){const c=e+n+r,d=Math.max(2,Math.round(o*.16)),f=o/2,m=(o-d)/2,h=2*Math.PI*m,p=Math.max(s,c,1),y=s>0?c/s:0,k=y>.95?"text-red-500":y>.8?"text-amber-500":"text-gray-300 dark:text-gray-700",w=[{key:"cacheRead",value:e,color:vo.cacheRead,label:g.usage.colCacheRead},{key:"cacheWrite",value:n,color:vo.cacheWrite,label:g.usage.colCacheWrite},{key:"output",value:r,color:vo.output,label:g.usage.colOutput}],S=`${g.chat.contextUsage} ${ft(c)}/${ft(s)}`+w.map(M=>` · ${M.label} ${ft(M.value)}`).join("");let T=0;return l.jsxs("svg",{width:o,height:o,viewBox:`0 0 ${o} ${o}`,className:`block shrink-0 ${k}`,role:"img","aria-label":S,children:[l.jsx("title",{children:S}),l.jsx("circle",{cx:f,cy:f,r:m,fill:"none",stroke:"currentColor",strokeOpacity:.35,strokeWidth:d}),w.map(M=>{if(M.value<=0)return null;const E=M.value/p*h,R=-(T/p)*h;return T+=M.value,l.jsx("circle",{cx:f,cy:f,r:m,fill:"none",stroke:M.color,strokeWidth:d,strokeDasharray:`${E} ${h}`,strokeDashoffset:R,transform:`rotate(-90 ${f} ${f})`},M.key)})]})}const Wa={thinking:"bg-violet-500 dark:bg-violet-400",text:"bg-sky-500 dark:bg-sky-400",toolgen:"bg-amber-500 dark:bg-amber-400",approvalWait:"bg-rose-400 dark:bg-rose-300",exec:"bg-emerald-500 dark:bg-emerald-400"},Yp="sticky left-0 z-10 flex h-4 w-[5.5rem] shrink-0 items-center justify-end bg-white pr-2 dark:bg-gray-950",kw="truncate font-mono text-[11px]",tv=.25,qh=24,N7=1/qh,Or=(e,n,r)=>Math.min(r,Math.max(n,e));function C7(e){return e==="thinking"?Wa.thinking:e==="text"?Wa.text:Wa.toolgen}function T7(e){return e==="thinking"?g.traces.kindThinking:e==="text"?g.traces.kindModelReply:g.traces.kindToolGen}function M7(e){return e==="thinking"?"thinking":e==="text"?"text":"toolgen"}function oo(e){if(e===void 0)return null;const n=Date.parse(e);return Number.isFinite(n)?n:null}function E7(e,n){const r=new Map,s=c=>{let d=r.get(c);return d||(d={segs:[],spans:[]},r.set(c,d)),d};for(const c of e){const d=oo(c.startTs),f=oo(c.endTs);d===null||f===null||s(c.taskIndex).segs.push({kind:c.kind,...c.name!==void 0?{name:c.name}:{},ts:c.endTs,startMs:d,endMs:f})}for(const c of n){const d=oo(c.callTs);d!==null&&s(c.taskIndex).spans.push({name:c.name||c.toolCallId,toolCallId:c.toolCallId,callTs:c.callTs,...c.approvalTs!==void 0?{approvalTsRaw:c.approvalTs}:{},...c.outputTs!==void 0?{outputTsRaw:c.outputTs}:{},callMs:d,approvalMs:oo(c.approvalTs),outputMs:oo(c.outputTs),failed:c.stopReason!==void 0&&c.stopReason!=="completed",...c.stopReason!==void 0?{status:c.stopReason}:{},...c.decision!==void 0?{decision:c.decision}:{}})}const o=[];for(const[c,{segs:d,spans:f}]of[...r.entries()].sort((m,h)=>m[0]-h[0])){if(d.length===0&&f.length===0)continue;const m=[...d.map(S=>S.startMs),...f.map(S=>S.callMs)],h=[...d.map(S=>S.endMs),...f.map(S=>S.outputMs??S.approvalMs??S.callMs)],p=Math.min(...m),y=Math.max(...h,...m),k=Math.max(1,y-p);f.sort((S,T)=>S.callMs-T.callMs);const w=[...new Set(f.map(S=>S.name))];o.push({taskIndex:c,segs:d,spans:f,t0:p,total:k,toolNames:w})}return o}function ww({children:e}){return l.jsx("div",{className:"relative h-4 min-w-0 flex-1 overflow-hidden bg-gray-100 dark:bg-gray-800/60",children:e})}function A7({label:e,children:n}){return l.jsxs("div",{className:"flex items-center",children:[l.jsx("span",{className:`${Yp} text-gray-400 dark:text-gray-500`,title:e,children:l.jsx("span",{className:kw,children:e})}),l.jsx(ww,{children:n})]})}function R7({total:e}){const n=[0,.25,.5,.75,1];return l.jsxs("div",{className:"flex items-center",children:[l.jsx("span",{className:Yp}),l.jsx("div",{className:"relative h-4 min-w-0 flex-1",children:n.map((r,s)=>l.jsx("span",{className:`absolute top-0 font-mono text-[11px] text-gray-400 dark:text-gray-500 ${s===0?"":s===n.length-1?"-translate-x-full":"-translate-x-1/2"}`,style:{left:`${r*100}%`},children:vn(r*e)},s))})]})}function _7({segments:e,toolSpans:n,highlight:r,onHighlight:s,onJump:o,hideTaskLabel:c=!1}){const d=v.useMemo(()=>E7(e,n),[e,n]),{firstBarKeyByTs:f,barKeys:m}=v.useMemo(()=>{const z=new Map,N=new Set,Q=(se,le)=>{N.add(le),z.has(se)||z.set(se,le)};for(const se of d){se.segs.forEach((le,he)=>Q(le.ts,`s-${se.taskIndex}-${he}`));for(const le of se.spans)le.approvalMs!==null&&le.approvalMs>le.callMs&&Q(le.approvalTsRaw??le.callTs,`w-${le.toolCallId}`),le.approvalMs===null&&le.outputMs===null?Q(le.callTs,`p-${le.toolCallId}`):Q(le.outputTsRaw??le.callTs,`e-${le.toolCallId}`)}return{firstBarKeyByTs:z,barKeys:N}},[d]),[h,p]=v.useState(null),[y,k]=v.useState(1),[w,S]=v.useState({left:0,width:1}),T=v.useRef(null),M=v.useRef(null),E=v.useRef(w);E.current=w;const R=v.useRef(y);R.current=y;const I=v.useRef(null),H=v.useRef(null),D=v.useCallback(()=>{const z=T.current;if(!z)return;const N=z.scrollWidth||1;S({left:z.scrollLeft/N,width:Math.min(1,z.clientWidth/N)})},[]);if(v.useLayoutEffect(()=>{const z=T.current;if(z){if(I.current){const N=z.scrollWidth-z.clientWidth;z.scrollLeft=Or(I.current(z),0,Math.max(0,N)),I.current=null}D()}},[y,d,D]),v.useLayoutEffect(()=>{const z=T.current;if(!z||typeof ResizeObserver>"u")return;const N=new ResizeObserver(()=>D());return N.observe(z),()=>N.disconnect()},[D]),v.useLayoutEffect(()=>()=>H.current?.(),[]),d.length===0)return l.jsx("p",{className:"text-xs text-gray-400",children:g.common.none});const L=r?.ts,$=r?.key,K=(z,N)=>s?.(N?{ts:N,key:z}:null),X=()=>s?.(null),U=$??(L!==void 0?f.get(L):void 0),V=U!==void 0&&m.has(U)?U:void 0,O=V!==void 0,W=z=>V===z,Z=(z,N)=>h!==null&&!N||O&&!z?"opacity-15":"",B=(z,N,Q,se)=>{const le=Or((z-Q)/se*100,0,100),he=Or((N-z)/se*100,0,100-le);return le>=100?{left:"100%",width:"0%",marginLeft:"-2px"}:{left:`${le}%`,width:`${he}%`}},F=[{key:"thinking",className:Wa.thinking,label:g.traces.kindThinking},{key:"text",className:Wa.text,label:g.traces.kindModelReply},{key:"toolgen",className:Wa.toolgen,label:g.traces.kindToolGen},{key:"approvalWait",className:Wa.approvalWait,label:g.traces.legendApprovalWait},{key:"exec",className:Wa.exec,label:g.traces.legendToolExec}],P=(z,N)=>{const Q=Or(N,N7,1),se=Or(1/Q,tv,qh),le=Or(z,0,1-Q);I.current=he=>le*he.scrollWidth,k(se)},ce=z=>{z.preventDefault();const N=M.current,Q=T.current;if(!N||!Q)return;const se=N.getBoundingClientRect().width||1,le=z.clientX,he=Q.scrollLeft,xe=Math.max(0,Q.scrollWidth-Q.clientWidth),ne=be=>{const Fe=(be.clientX-le)/se;Q.scrollLeft=Or(he+Fe*Q.scrollWidth,0,xe),D()},pe=()=>{window.removeEventListener("pointermove",ne),window.removeEventListener("pointerup",pe),window.removeEventListener("pointercancel",pe),H.current=null};window.addEventListener("pointermove",ne),window.addEventListener("pointerup",pe),window.addEventListener("pointercancel",pe),H.current=pe},oe=z=>N=>{N.preventDefault(),N.stopPropagation();const Q=M.current;if(!Q)return;const se=Q.getBoundingClientRect(),le=xe=>{const ne=Or((xe.clientX-se.left)/(se.width||1),0,1),pe=E.current;if(z==="right")P(pe.left,ne-pe.left);else{const be=pe.left+pe.width;P(ne,be-ne)}},he=()=>{window.removeEventListener("pointermove",le),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",he),H.current=null};window.addEventListener("pointermove",le),window.addEventListener("pointerup",he),window.addEventListener("pointercancel",he),H.current=he},A=()=>{I.current=()=>0,k(1)},C=z=>{const N=T.current,Q=Or(R.current*z,tv,qh);if(Q!==R.current){if(N){const se=N.clientWidth/2,le=(N.scrollLeft+se)/(N.scrollWidth||1);I.current=he=>le*he.scrollWidth-se}k(Q)}};return l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{ref:T,className:"no-scrollbar overflow-x-auto overflow-y-hidden",children:l.jsx("div",{className:"space-y-4",style:{width:`${y*100}%`},children:d.map(z=>l.jsxs("div",{className:"space-y-1",children:[!c&&l.jsxs("div",{className:"flex items-center gap-2 pl-[5.5rem]",children:[l.jsx("span",{className:"rounded bg-gray-100 px-1.5 py-0.5 text-[11px] font-medium text-gray-500 dark:bg-gray-800 dark:text-gray-400",children:g.traces.task(z.taskIndex+1)}),l.jsx("span",{className:"font-mono text-[11px] text-gray-400",children:vn(z.total)})]}),l.jsx(A7,{label:g.traces.laneLLM,children:z.segs.map((N,Q)=>{const se=M7(N.kind),le=h===null||h===se,he=`s-${z.taskIndex}-${Q}`,xe=W(he);return l.jsx("span",{onMouseEnter:()=>K(he,N.ts),onMouseLeave:X,onClick:()=>o?.(N.ts),title:`${T7(N.kind)}${N.name?` ${N.name}`:""} · ${vn(N.endMs-N.startMs)}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${C7(N.kind)} ${Z(xe,le)}`,style:B(N.startMs,N.endMs,z.t0,z.total)},Q)})}),z.spans.map(N=>{const Q=N.approvalMs??N.callMs,se=N.outputMs===null,le=N.outputMs??z.t0+z.total,he=N.approvalTsRaw??N.callTs,xe=N.outputTsRaw??N.callTs;return l.jsxs("div",{className:"flex items-center",children:[l.jsx("span",{className:`${Yp} text-gray-500 dark:text-gray-400`,title:N.name,children:l.jsx("span",{className:kw,children:N.name})}),l.jsxs(ww,{children:[N.approvalMs!==null&&N.approvalMs>N.callMs&&l.jsx("span",{onMouseEnter:()=>K(`w-${N.toolCallId}`,he),onMouseLeave:X,onClick:()=>o?.(he),title:`${N.name} · ${g.traces.legendApprovalWait}${N.decision?` (${N.decision})`:""} · ${vn(N.approvalMs-N.callMs)}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${Wa.approvalWait} ${Z(W(`w-${N.toolCallId}`),h===null||h==="approvalWait")}`,style:B(N.callMs,N.approvalMs,z.t0,z.total)}),N.approvalMs===null&&se?(()=>{const ne=Z(W(`p-${N.toolCallId}`),h===null||h==="approvalWait");return l.jsx("span",{onMouseEnter:()=>K(`p-${N.toolCallId}`,N.callTs),onMouseLeave:X,onClick:()=>o?.(N.callTs),title:`${N.name} · ${g.traces.legendApprovalWait} · ${g.traces.inProgress}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${Wa.approvalWait} ${ne||"animate-pulse"}`,style:B(N.callMs,le,z.t0,z.total)})})():(()=>{const ne=Z(W(`e-${N.toolCallId}`),h===null||h==="exec"),pe=se&&!ne;return l.jsx("span",{onMouseEnter:()=>K(`e-${N.toolCallId}`,xe),onMouseLeave:X,onClick:()=>o?.(xe),title:`${N.name} · ${g.traces.legendToolExec} · ${se?g.traces.inProgress:vn(le-Q)}${N.failed?` · ${N.status}`:""}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${Wa.exec} ${N.failed?"ring-1 ring-red-500":""} ${pe?"animate-pulse opacity-70":ne}`,style:B(Q,le,z.t0,z.total)})})()]})]},N.toolCallId)}),l.jsx(R7,{total:z.total})]},z.taskIndex))})}),l.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-gray-100 pt-2.5 dark:border-gray-800",children:F.map(z=>l.jsxs("button",{type:"button",onMouseEnter:()=>p(z.key),onMouseLeave:()=>p(null),className:`flex items-center gap-1 px-1 font-mono text-[11px] text-gray-500 transition-opacity duration-150 dark:text-gray-400 ${h!==null&&h!==z.key?"opacity-30":""}`,children:[l.jsx("span",{className:`inline-block h-2 w-3 rounded-sm ${z.className}`}),z.label]},z.key))}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:g.traces.zoom}),l.jsx("button",{type:"button","aria-label":g.traces.zoomOut,title:g.traces.zoomOut,onClick:()=>C(1/1.4),className:"flex h-4 w-4 shrink-0 items-center justify-center rounded border border-gray-200 text-gray-500 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800",children:l.jsx("span",{className:"text-[11px] leading-none",children:"−"})}),l.jsx("div",{ref:M,onDoubleClick:A,title:g.traces.zoomReset,className:"relative h-3 min-w-0 flex-1 rounded bg-gray-100 dark:bg-gray-800",children:l.jsxs("div",{role:"scrollbar","aria-label":g.traces.zoom,onPointerDown:ce,className:"absolute inset-y-0 flex cursor-grab items-center justify-between rounded bg-gray-400/70 active:cursor-grabbing dark:bg-gray-500/70",style:{left:`${w.left*100}%`,width:`${Math.max(w.width*100,3)}%`},children:[l.jsx("span",{onPointerDown:oe("left"),className:"h-full w-1.5 shrink-0 cursor-ew-resize rounded-l bg-gray-500/80 dark:bg-gray-400/80"}),l.jsx("span",{onPointerDown:oe("right"),className:"h-full w-1.5 shrink-0 cursor-ew-resize rounded-r bg-gray-500/80 dark:bg-gray-400/80"})]})}),l.jsx("button",{type:"button","aria-label":g.traces.zoomIn,title:g.traces.zoomIn,onClick:()=>C(1.4),className:"flex h-4 w-4 shrink-0 items-center justify-center rounded border border-gray-200 text-gray-500 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800",children:l.jsx("span",{className:"text-[11px] leading-none",children:"+"})}),l.jsxs("span",{className:"w-9 shrink-0 text-right font-mono text-[11px] tabular-nums text-gray-400",children:[y.toFixed(2),"×"]})]}),s&&l.jsx("p",{className:"text-[11px] text-gray-400 dark:text-gray-600",children:g.traces.linkHint})]})}function I7(e){return e==="session_meta"?"brand":e==="model_msg"?"gray":"amber"}const L7={text:"M8 10h8M8 14h5M21 12a9 9 0 1 1-4-7.5",thinking:"M9 18h6M10 21h4M12 3a6 6 0 0 0-3 11v2h6v-2a6 6 0 0 0-3-11z",image_url:"M3 5h18v14H3zM3 15l5-5 4 4 3-3 6 6",inline_data:"M3 5h18v14H3zM3 15l5-5 4 4 3-3 6 6",tool_call:"M14.7 6.3a4 4 0 0 0-5 5L4 17v3h3l5.7-5.7a4 4 0 0 0 5-5l-2.5 2.5-2-2 2.5-2.5z",tool_call_output:"M4 6l4 4-4 4M12 18h8",token_usage:"M4 20V10m6 10V4m6 16v-7m4 7H2",request_begin:"M5 12h14M13 6l6 6-6 6",request_end:"M19 12H5M11 6l-6 6 6 6",approval_decision:"M9 12l2 2 4-4M12 3l7 3v6c0 4.5-3 7.5-7 9-4-1.5-7-4.5-7-9V6z",compaction_begin:"M8 3H4v4M16 3h4v4M8 21H4v-4M16 21h4v-4M9 12h6",compaction_end:"M8 3H4v4M16 3h4v4M8 21H4v-4M16 21h4v-4M9 12h6",abort:"M6 6h12v12H6z",subagent:"M12 3v6m0 0l-5 4v8m5-12l5 4v8M4 21h16"},O7="M12 8v5m0 3h.01M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18z";function D7({type:e}){return l.jsx("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0 text-gray-400 dark:text-gray-500","aria-hidden":!0,children:l.jsx("path",{d:L7[e]??O7})})}function z7(e){const n=e.payload;switch(n.type){case void 0:return"";case"text":return`${String(n.role)}: ${String(n.text??"").slice(0,120)}`;case"thinking":return String(n.thinking??"").slice(0,120);case"image_url":return"[image]";case"inline_data":return`[image] ${String(n.mime_type??"")}`;case"tool_call":return`${String(n.name)} ${String(n.arguments??"").slice(0,100)}`;case"tool_call_output":{const r=String(n.output??"").slice(0,120);return Array.isArray(n.images)&&n.images.length>0?`[image] ${r}`:r}case"token_usage":{const r=n.request,s=n.session;return`request.total=${r?.total??0} session.total=${s?.total??0}`}case"request_end":return`status=${String(n.status)}`;case"approval_decision":return`${String(n.decision)} · ${String(n.tool_call_id)}`;case"compaction_begin":case"compaction_end":return`${String(n.mode)} (${String(n.reason)})${n.status?` · ${String(n.status)}`:""}`;case"abort":return n.reason!=null?String(n.reason):"";case"goal_finished":return`${String(n.outcome)} · rounds=${String(n.rounds)} · tokens=${String(n.tokens_used)}`;case"subagent":return String(n.session_id??"");default:return e.type==="session_meta"?`${String(n.session_id??"")} · ${String(n.model_id??"")}`:""}}function U7(e){const n=e.payload;return n.stop_reason??n.status}const Su="max-h-72 overflow-auto whitespace-pre-wrap break-words rounded bg-gray-100 px-2.5 py-2 text-xs dark:bg-gray-800/70";function $7({p:e}){const n=e.request??{},r=e.session??{},s=(o,c)=>l.jsxs("tr",{children:[l.jsx("td",{className:"pr-3 text-gray-400",children:o}),l.jsx("td",{className:"pr-3 text-right font-mono",children:ft(c.cache_read??0)}),l.jsx("td",{className:"pr-3 text-right font-mono",children:ft(c.cache_write??0)}),l.jsx("td",{className:"pr-3 text-right font-mono",children:ft(c.output??0)}),l.jsx("td",{className:"text-right font-mono",children:ft(c.total??0)})]});return l.jsxs("table",{className:"text-xs",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"text-gray-400",children:[l.jsx("th",{}),l.jsx("th",{className:"pr-3 text-right font-normal",children:"cacheRead"}),l.jsx("th",{className:"pr-3 text-right font-normal",children:"cacheWrite"}),l.jsx("th",{className:"pr-3 text-right font-normal",children:"output"}),l.jsx("th",{className:"text-right font-normal",children:"total"})]})}),l.jsxs("tbody",{children:[s("request",n),s("session",r)]})]})}const nv="cursor-pointer text-xs font-medium text-gray-500 marker:text-gray-400 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200";function B7({p:e}){const n=[["session_id",String(e.session_id??"")],["source",String(e.source??"")],["model_id",String(e.model_id??"")],["context_window",String(e.model_context_window??"")],...typeof e.thinking_level=="string"&&e.thinking_level?[["thinking_level",e.thinking_level]]:[],["agent_state",String(e.agent_state??"")],["workspace",String(e.workspace??"")]],r=String(e.system_prompt??""),s=Array.isArray(e.tools)?e.tools:[];return l.jsxs("div",{className:"space-y-2.5",children:[l.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5 text-xs",children:n.map(([o,c])=>l.jsxs(v.Fragment,{children:[l.jsx("dt",{className:"text-gray-400",children:o}),l.jsx("dd",{className:"min-w-0 break-all font-mono text-gray-700 dark:text-gray-300",children:c||"—"})]},o))}),r.trim()&&l.jsxs("details",{children:[l.jsx("summary",{className:nv,children:g.traces.systemPrompt}),l.jsx("div",{className:"md-body mt-1.5 max-h-96 overflow-auto rounded bg-gray-100 px-2.5 py-2 text-sm leading-relaxed text-gray-700 dark:bg-gray-800/70 dark:text-gray-300",children:l.jsx($o,{remarkPlugins:[Bo],children:r})})]}),s.length>0&&l.jsxs("details",{children:[l.jsx("summary",{className:nv,children:g.traces.toolDefs(s.length)}),l.jsx("ul",{className:"mt-1.5 space-y-1",children:s.map((o,c)=>l.jsxs("li",{className:"text-xs",children:[l.jsx("span",{className:"font-mono font-semibold text-gray-700 dark:text-gray-300",children:o.name??"—"}),o.description&&l.jsx("span",{className:"ml-2 text-gray-500 dark:text-gray-400",children:o.description})]},c))})]})]})}function H7({msg:e}){const n=e.payload;if(e.type==="session_meta")return l.jsx(B7,{p:n});switch(n.type){case"text":case"thinking":{const r=String(n.text??n.thinking??"");return r.trim()?l.jsx("div",{className:"md-body text-sm leading-relaxed text-gray-700 dark:text-gray-300",children:l.jsx($o,{remarkPlugins:[Bo],children:r})}):l.jsx("p",{className:"text-xs text-gray-400",children:"—"})}case"image_url":return l.jsx($r,{src:String(n.image_url??""),alt:"trace",className:"max-h-48 max-w-full rounded-md"});case"inline_data":return l.jsx($r,{src:`data:${String(n.mime_type??"")};base64,${String(n.data??"")}`,alt:"trace",className:"max-h-48 max-w-full rounded-md"});case"tool_call":return l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"font-mono text-xs font-semibold text-gray-700 dark:text-gray-300",children:String(n.name??"")}),l.jsx("pre",{className:Su,children:String(n.arguments??"")})]});case"tool_call_output":{const r=Array.isArray(n.images)?n.images:[];return r.length===0?l.jsx("pre",{className:Su,children:String(n.output??"")}):l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("pre",{className:Su,children:String(n.output??"")}),l.jsx("div",{className:"flex flex-wrap gap-2",children:r.map((s,o)=>l.jsx($r,{src:s,alt:"trace",className:"max-h-48 max-w-full rounded-md"},o))})]})}case"token_usage":return l.jsx($7,{p:n});default:return l.jsx("pre",{className:Su,children:JSON.stringify(n,null,2)})}}function P7({msg:e,rowKey:n,matched:r,onHighlight:s}){const[o,c]=v.useState(!1),d=e.payload.type??e.type,f=U7(e);return l.jsxs("li",{"data-trace-row":n,children:[l.jsxs("button",{type:"button",onClick:()=>c(m=>!m),onMouseEnter:()=>s?.({ts:e.timestamp,rowKey:n}),onMouseLeave:()=>s?.(null),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors duration-150 ${r?"bg-amber-50 dark:bg-amber-950/40":"hover:bg-gray-50 dark:hover:bg-gray-800/50"}`,children:[l.jsx("span",{className:"shrink-0 font-mono text-[11px] text-gray-400",children:e4(e.timestamp)}),l.jsx(D7,{type:d}),l.jsx(Jt,{tone:I7(e.type),children:d}),e.origin&&e.origin.length>0&&l.jsx(Jt,{tone:"brand",children:"origin"}),l.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-gray-500 dark:text-gray-400",children:z7(e)})]}),o&&l.jsxs("div",{className:"border-t border-gray-100 bg-gray-50/60 px-3 py-2 dark:border-gray-800 dark:bg-gray-900/40",children:[l.jsx(H7,{msg:e}),f&&l.jsx("div",{className:"mt-1.5 flex justify-end",children:l.jsx(Jt,{tone:c4(f),children:f})})]})]})}const av=()=>({cacheRead:0,cacheWrite:0,output:0}),F7=2500,rv=(e,n)=>`${e}-${n}`;function Dr({label:e,value:n}){return l.jsxs("div",{className:"flex items-baseline justify-between gap-3 py-0.5",children:[l.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:e}),l.jsx("span",{className:"truncate font-mono text-sm font-semibold tabular-nums",children:n})]})}const Sw=e=>e.cacheRead+e.cacheWrite,jw=e=>rk(e.cacheRead,e.cacheWrite),Nw="flex shrink-0 items-center font-mono text-[11px] tabular-nums text-gray-500 dark:text-gray-400";function co({icon:e,value:n,label:r}){return l.jsxs("span",{title:r,"aria-label":r,className:`${Nw} gap-1`,children:[l.jsx(Ue,{d:e,className:"text-gray-400"}),n]})}function q7({buckets:e}){const n=Sw(e),r=`${g.traces.cacheHit} ${ft(e.cacheRead)} · ${g.traces.hitRate} ${up(jw(e))}`;return l.jsxs("span",{"aria-label":`${g.traces.taskInput} ${ft(n)} · ${r}`,className:Nw,children:[l.jsxs("span",{title:g.traces.taskInput,className:"flex items-center gap-1",children:[l.jsx(Ue,{d:un.input,className:"text-gray-400"}),ft(n)]}),l.jsxs("span",{title:r,className:"ml-1 flex items-center gap-0.5 text-gray-400",children:[l.jsx("span",{children:"("}),l.jsx(Ue,{d:un.cacheHit}),l.jsx("span",{children:ft(e.cacheRead)}),l.jsx("span",{children:")"})]})]})}function V7({projectId:e,agentId:n,sessionId:r,index:s,highlight:o,onHighlight:c}){const{currency:d}=Ns(),[f,m]=v.useState(null),[h,p]=v.useState([]),[y,k]=v.useState(0),[w,S]=v.useState(0),[T,M]=v.useState(null),[E,R]=v.useState(null),[I,H]=v.useState(new Set),[D,L]=v.useState(null),$=v.useRef(null),K=v.useRef(null);v.useEffect(()=>()=>{K.current&&clearTimeout(K.current)},[]),v.useEffect(()=>{m(null),p([]),R(null),H(new Set),L(null);let C=!1;return Promise.all([R5(e,n,r,s),A5(e,n,r,s,0,1e3),Xu(e).catch(()=>null)]).then(([z,N,Q])=>{C||(m(z),p(N.events),k(N.offset),S(N.total),M(Q))}).catch(z=>{C||R(Ae(z))}),()=>{C=!0}},[e,n,r,s]);const X=v.useMemo(()=>{const C=h.find(N=>N.type==="session_meta"),z=C?C.payload:void 0;if(!(!z?.model_id||!z.provider))return T?.models.find(N=>N.modelId===z.model_id&&N.provider===z.provider)?.pricing},[h,T]),U=C=>X?(C.cacheRead*X.cacheRead+C.cacheWrite*X.cacheWrite+C.output*X.output)/1e6:null,V=v.useMemo(()=>{const C=h.find(z=>z.type==="session_meta");return P2(C?C.payload.model_context_window:void 0)},[h]),{tasks:O,global:W,statsByTask:Z,globalLlmMs:B}=v.useMemo(()=>{const C={buckets:av(),toolCalls:0},z=new Map;if(!f)return{tasks:[],global:C,statsByTask:z,globalLlmMs:0};const N=new Map;for(const pe of f.tasks){const be=Date.parse(pe.startTs),Fe=Date.parse(pe.endTs);Number.isFinite(be)&&Number.isFinite(Fe)&&N.set(pe.taskIndex,{min:be,max:Fe})}const Q=new Map,se=pe=>{let be=Q.get(pe);if(!be){const Fe=N.get(pe);be={taskIndex:pe,segments:[],spans:[],messages:[],toolCalls:0,durationMs:Fe?Math.max(0,Fe.max-Fe.min):0},Q.set(pe,be)}return be};for(const pe of f.tasks)se(pe.taskIndex);for(const pe of f.modelSegments)se(pe.taskIndex).segments.push(pe);for(const pe of f.toolSpans){const be=se(pe.taskIndex);be.spans.push(pe),be.toolCalls+=1}const le=pe=>{for(const be of f.tasks)if(pe>=be.messageFrom&&pe<=be.messageTo)return be.taskIndex;return null};for(let pe=0;pe<h.length;pe++){const be=h[pe];if(be.origin&&be.origin.length>0)continue;const Fe=le(y+pe);Fe!==null&&se(Fe).messages.push(be)}C.toolCalls=f.toolSpans.length;const he=new Map(f.tasks.map(pe=>[pe.taskIndex,pe]));for(const pe of f.tasks)C.buckets.cacheRead+=pe.tokens.cacheRead,C.buckets.cacheWrite+=pe.tokens.cacheWrite,C.buckets.output+=pe.tokens.output;const xe=f.tasks.reduce((pe,be)=>pe+be.llmMs,0);return{tasks:[...Q.values()].sort((pe,be)=>pe.taskIndex-be.taskIndex),global:C,statsByTask:he,globalLlmMs:xe}},[f,h,y]);if(E)return l.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:E});if(!f)return l.jsx(Gt,{className:"h-40"});const F=f.elapsedMs,P=C=>H(z=>{const N=new Set(z);return N.has(C)?N.delete(C):N.add(C),N}),ce=C=>{for(const z of O){const N=z.messages.findIndex(Q=>Q.timestamp===C);if(N>=0)return rv(z.taskIndex,N)}return null},oe=o?.rowKey??(o?.ts!==void 0?ce(o.ts):null),A=C=>{const z=ce(C);z!==null&&(L(z),requestAnimationFrame(()=>{$.current?.querySelector(`[data-trace-row="${z}"]`)?.scrollIntoView({block:"center",behavior:"smooth"})}),K.current&&clearTimeout(K.current),K.current=setTimeout(()=>L(null),F7))};return l.jsxs("div",{ref:$,className:"space-y-4",children:[l.jsxs("div",{className:"rounded-md border border-gray-200 p-3 dark:border-gray-800",children:[l.jsx("p",{className:"mb-2 text-xs font-semibold text-gray-500",children:g.traces.globalSummary}),l.jsxs("div",{className:"grid grid-cols-1 gap-x-8 gap-y-4 sm:grid-cols-3",children:[l.jsxs("div",{children:[l.jsx(Dr,{label:g.traces.tasksLabel,value:String(f.tasks.length)}),l.jsx(Dr,{label:g.traces.toolCalls,value:String(W.toolCalls)}),l.jsx(Dr,{label:g.traces.compactions,value:String(f.compactionCount)})]}),l.jsxs("div",{children:[l.jsx(Dr,{label:g.chat.statInput,value:ft(Sw(W.buckets))}),l.jsx(Dr,{label:g.traces.cacheHit,value:`${ft(W.buckets.cacheRead)} · ${up(jw(W.buckets))}`}),l.jsx(Dr,{label:g.chat.statOutput,value:ft(W.buckets.output)})]}),l.jsxs("div",{children:[l.jsx(Dr,{label:g.common.cost,value:Za(U(W.buckets),d)}),l.jsx(Dr,{label:g.chat.statElapsed,value:vn(Math.max(0,F))}),l.jsx(Dr,{label:g.chat.statTps,value:Lu(mh(W.buckets.output,B))})]})]})]}),O.map(C=>{const z=!I.has(C.taskIndex),N=Z.get(C.taskIndex),Q=N?.context,se=N?.tokens??av();return l.jsxs("div",{className:"overflow-hidden rounded-md border border-gray-200 dark:border-gray-800",children:[l.jsxs("button",{type:"button",onClick:()=>P(C.taskIndex),"aria-expanded":z,className:"flex w-full items-center gap-2 bg-gray-50 px-3 py-2 text-left transition-colors duration-150 hover:bg-gray-100 dark:bg-gray-900 dark:hover:bg-gray-800/60",children:[l.jsx(Ln,{open:z,size:13,className:"text-gray-400"}),l.jsx("span",{className:"shrink-0 text-sm font-semibold",children:g.traces.task(C.taskIndex+1)}),N?.compaction===!0&&l.jsx("span",{className:"shrink-0 rounded bg-gray-100 px-1.5 py-0.5 text-[10px] font-medium text-gray-500 dark:bg-gray-800 dark:text-gray-400",children:g.traces.compactionRound}),l.jsx("span",{className:"min-w-0 flex-1"}),l.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-x-3 gap-y-1",children:[l.jsx(co,{icon:un.toolCalls,value:String(C.toolCalls),label:g.traces.toolCalls}),l.jsx(q7,{buckets:se}),l.jsx(co,{icon:un.output,value:ft(se.output),label:g.traces.taskOutput}),l.jsx(co,{icon:un.cost,value:Za(U(se),d),label:`${g.common.cost}(${d})`}),l.jsx(co,{icon:un.elapsed,value:vn(C.durationMs),label:g.chat.statElapsed}),l.jsx(co,{icon:un.tps,value:Lu(mh(se.output,N?.llmMs??0)),label:g.chat.statTps})]}),Q&&l.jsx(j7,{cacheRead:Q.cacheRead,cacheWrite:Q.cacheWrite,output:Q.output,max:V,size:22})]}),z&&l.jsxs("div",{className:"space-y-3 p-3",children:[(C.segments.length>0||C.spans.length>0)&&l.jsxs("div",{className:"rounded-md border border-gray-100 p-2 dark:border-gray-800/60",children:[l.jsx("p",{className:"mb-1.5 text-[11px] font-medium text-gray-500",children:g.traces.timeline}),l.jsx(_7,{segments:C.segments,toolSpans:C.spans,highlight:o,onHighlight:c,onJump:A,hideTaskLabel:!0})]}),l.jsxs("div",{children:[l.jsxs("p",{className:"mb-1.5 text-[11px] font-medium text-gray-500",children:[g.traces.messages,"(",C.messages.length,")"]}),C.messages.length===0?l.jsx("p",{className:"text-xs text-gray-400",children:g.common.none}):l.jsx("ul",{className:"divide-y divide-gray-100 rounded-md border border-gray-200 dark:divide-gray-800/60 dark:border-gray-800",children:C.messages.map((le,he)=>{const xe=rv(C.taskIndex,he);return l.jsx(P7,{msg:le,rowKey:xe,matched:xe===oe||xe===D,onHighlight:ne=>c(ne)},he)})})]})]})]},C.taskIndex)}),h.length<w&&l.jsx("p",{className:"text-xs text-gray-400",children:g.traces.truncatedNote(h.length,w)})]})}const G7=14*1024*1024;function W7(e){const n=new Map;for(const r of e.dates)for(const s of r.sessions){const o=n.get(s.sessionId)??[];for(const c of s.files)o.push({index:c.index,date:r.date,sizeBytes:c.sizeBytes});n.set(s.sessionId,o)}return[...n.entries()].sort((r,s)=>s[0].localeCompare(r[0])).map(([r,s])=>({sessionId:r,files:s.sort((o,c)=>c.index-o.index)}))}function K7({projectId:e,agentId:n,name:r,defaultOpen:s,focusSessionId:o,canImport:c,titleOf:d,selection:f,onSelect:m}){const[h,p]=v.useState(s),[y,k]=v.useState(null),[w,S]=v.useState(null),[T,M]=v.useState(!1),E=v.useRef(null);v.useEffect(()=>{!h||y||w5(e,n).then(D=>k(W7(D))).catch(D=>S(Ae(D)))},[h,y,e,n]);const R=v.useRef(!1);v.useEffect(()=>{if(R.current||!o||!y)return;R.current=!0;const D=y.find(L=>L.sessionId===o);D&&m({agentId:n,sessionId:D.sessionId,files:D.files})},[y,o,n,m]),v.useEffect(()=>{const D=E.current;if(D===null||!y)return;E.current=null;const L=y.find($=>$.sessionId===D);L&&m({agentId:n,sessionId:L.sessionId,files:L.files})},[y,n,m]);const I=async D=>{M(!0);try{const L=await I5(e,n,{dataBase64:D});E.current=L.sessionId,k(null),p(!0)}catch(L){xt(Ae(L))}finally{M(!1)}},H=D=>{const L=D.target.files?.[0];if(D.target.value="",!L)return;if(L.size>G7){xt(g.traces.fileTooLarge);return}const $=new FileReader;$.onload=()=>{const K=$.result;I(K.slice(K.indexOf(",")+1))},$.onerror=()=>xt(g.common.unknownError),$.readAsDataURL(L)};return l.jsxs("li",{className:"pt-2.5",children:[l.jsxs("div",{className:"flex items-center px-1 pb-0.5",children:[l.jsxs("button",{type:"button",onClick:()=>p(D=>!D),"aria-label":h?g.nav.collapseGroup:g.nav.expandGroup,className:"flex min-w-0 flex-1 items-center gap-1 rounded px-1 py-0.5 text-left transition-colors duration-150 hover:bg-gray-200/50 dark:hover:bg-gray-800/50",children:[l.jsx(pa,{id:n,name:r,size:18,className:"shrink-0 rounded"}),l.jsx("span",{className:"min-w-0 truncate text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:r}),l.jsx(Ln,{open:h,size:12,className:"text-gray-400"}),l.jsx("span",{className:"min-w-0 flex-1"})]}),c&&l.jsxs("label",{title:T?g.traces.importing:g.traces.importTrace,className:`shrink-0 cursor-pointer rounded p-1 text-gray-400 transition-colors duration-150 hover:bg-gray-200/50 hover:text-gray-600 dark:hover:bg-gray-800/50 dark:hover:text-gray-300 ${T?"pointer-events-none opacity-60":""}`,children:[l.jsx(qp,{accept:".jsonl",disabled:T,onChange:H}),l.jsx(YC,{size:13}),l.jsx("span",{className:"sr-only",children:T?g.traces.importing:g.traces.importTrace})]})]}),h&&l.jsxs("div",{className:"anim-fade",children:[w&&l.jsx("p",{className:"px-2.5 py-1 text-xs text-red-500",children:w}),!y&&!w&&l.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400",children:g.common.loading}),y&&y.length===0&&l.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:g.traces.empty}),l.jsx("ul",{className:"space-y-0.5",children:y?.map(D=>{const L=f?.agentId===n&&f.sessionId===D.sessionId,$=d(n,D.sessionId);return l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>m({agentId:n,sessionId:D.sessionId,files:D.files}),className:`flex w-full items-center gap-1.5 rounded-md px-2.5 py-1.5 text-left transition-colors duration-150 ${L?"bg-gray-200/70 dark:bg-gray-800":"hover:bg-gray-200/50 dark:hover:bg-gray-800/70"}`,children:[l.jsx(td,{text:$??D.sessionId,className:`min-w-0 flex-1 ${$?"text-sm":"font-mono text-xs"} ${L?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`}),l.jsx("span",{className:"shrink-0 font-mono text-[11px] text-gray-400",children:D.files.length})]})},D.sessionId)})})]})]})}function Y7(){pr(g.traces.title);const{currentProject:e,agents:n,agentsLoading:r}=gn(),{byAgent:s}=ll(),o=e?.projectId??null,[c]=lp(),d=c.get("agentId"),f=c.get("sessionId"),[m,h]=v.useState(null),[p,y]=v.useState(null),[k,w]=v.useState(null);v.useEffect(()=>{h(null),y(null)},[o]),v.useEffect(()=>{w(null)},[m,p]);const S=(M,E)=>s.get(M)?.find(R=>R.sessionId===E)?.title;if(!o)return null;const T=m===null?null:m.files.find(M=>M.index===p)??m.files[0]??null;return l.jsxs("div",{className:"flex h-full flex-col md:flex-row",children:[l.jsxs("aside",{className:"relative max-h-52 shrink-0 overflow-y-auto border-b border-gray-200 bg-gray-50 px-1 py-2 md:max-h-none md:w-72 md:border-b-0 md:border-r dark:border-gray-800 dark:bg-gray-900",children:[l.jsx("p",{className:"px-3 pb-1 text-xs font-bold uppercase tracking-wide text-gray-500",children:g.traces.title}),r?l.jsx(Ua,{rows:4}):l.jsx("ul",{children:n.map(M=>l.jsx(K7,{projectId:o,agentId:M.agentId,name:hn(M),defaultOpen:d===null||d===M.agentId,...f!==null&&d===M.agentId?{focusSessionId:f}:{},canImport:e?.role==="owner",titleOf:S,selection:m,onSelect:E=>{h(E),y(E.files[0]?.index??null)}},M.agentId))})]}),l.jsx("section",{className:"min-w-0 flex-1 overflow-y-auto p-3 md:p-4",children:m&&T?l.jsxs("div",{className:"mx-auto max-w-4xl space-y-4",children:[l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx("p",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:S(m.agentId,m.sessionId)??l.jsx("span",{className:"font-mono text-xs font-normal text-gray-500",children:m.sessionId})}),l.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[l.jsx("span",{className:"mr-1 text-xs text-gray-400",children:g.traces.filesTitle}),m.files.map(M=>l.jsxs("button",{type:"button",onClick:()=>y(M.index),title:`${M.date} · ${No(M.sizeBytes)}`,className:`rounded-md border px-2 py-0.5 font-mono text-xs transition-colors duration-150 ${M.index===T.index?"border-gray-400 bg-gray-200/70 font-semibold text-gray-900 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100":"border-gray-200 text-gray-500 hover:bg-gray-100 dark:border-gray-800 dark:text-gray-400 dark:hover:bg-gray-800/60"}`,children:["#",String(M.index).padStart(3,"0")]},M.index))]})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsxs("p",{className:"min-w-0 flex-1 truncate font-mono text-xs text-gray-400",children:[m.sessionId," · ",T.date," · ",No(T.sizeBytes)]}),l.jsxs("a",{href:_5(o,m.agentId,m.sessionId,T.index),download:!0,className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-gray-200 px-2 py-0.5 text-xs text-gray-500 transition-colors duration-150 hover:bg-gray-100 dark:border-gray-800 dark:text-gray-400 dark:hover:bg-gray-800/60",children:[l.jsx(KC,{size:12}),g.traces.exportFile]})]}),l.jsx(V7,{projectId:o,agentId:m.agentId,sessionId:m.sessionId,index:T.index,highlight:k,onHighlight:w})]}):l.jsx(mr,{title:g.traces.selectSession})})]})}function Cw(e){return e.map(n=>typeof n.score=="number"&&Number.isFinite(n.score)?n.score:null)}const ju=0,Nu=100,sv=10,Q7=[1,2,2.5,5,10,20];function X7(e){const n=e.filter(p=>p!==null&&p>=ju&&p<=Nu);if(n.length===0)return{min:ju,max:Nu,ticks:[0,20,40,60,80,100]};const r=Math.min(...n),s=Math.max(...n),o=Math.max(ju,r-sv),c=Math.min(Nu,s+sv),d=Q7.find(p=>(c-o)/p<=5),f=Math.max(ju,Math.floor(o/d)*d),m=Math.min(Nu,Math.ceil(c/d)*d),h=Array.from({length:Math.round((m-f)/d)+1},(p,y)=>f+y*d);return{min:f,max:m,ticks:h}}function Z7(e){const n=[];let r=[];return e.forEach((s,o)=>{if(s===null){r.length>0&&n.push(r),r=[];return}r.push({index:o,value:s})}),r.length>0&&n.push(r),n}function J7(e){const n=new Map;e.forEach((s,o)=>{const c=s.modelId!==void 0&&s.modelId!=="",d=c?`${s.modelId}\0${s.thinkingLevel??""}`:"";let f=n.get(d);f||(f={key:d,...c&&s.modelId!==void 0?{modelId:s.modelId}:{},...c&&s.thinkingLevel!==void 0?{thinkingLevel:s.thinkingLevel}:{},indices:[]},n.set(d,f)),f.indices.push(o)});const r=[...n.values()];return[...r.filter(s=>s.key!==""),...r.filter(s=>s.key==="")]}function e9(e,n){const r=new Set(n.indices);return Cw(e).map((s,o)=>r.has(o)?s:null)}const t9=new Set(["txt","md","json","js","mjs","cjs","ts","tsx","jsx","py","sh","bash","yaml","yml","toml","css","html","htm","csv","log","xml","ini","conf","sql","svg"]),n9=new Set(["png","jpg","jpeg","gif","webp"]),lv=/^[a-z][a-z0-9+.-]*:/i,a9=64*1024;function Tw(e){const n=e.lastIndexOf(".");return n>=0?e.slice(n+1).toLowerCase():e.toLowerCase()}function iv(e,n){return e===""?n:`${e}/${n}`}function ov(e){return e.includes("/")?e.slice(0,e.lastIndexOf("/")):""}function cv(e,n){const r=n.startsWith("/")||e===""?[]:e.split("/");for(const s of n.split("/"))s===""||s==="."||(s===".."?r.pop():r.push(s));return r.join("/")}function r9(e){const n=Tw(e);return{json:"json",md:"markdown",js:"javascript",mjs:"javascript",cjs:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",sh:"shellscript",bash:"shellscript",yaml:"yaml",yml:"yaml",toml:"toml",css:"css",html:"html",htm:"html",xml:"xml",sql:"sql",svg:"xml"}[n]??"text"}function uv({projectId:e,agentId:n,benchmarkId:r,caseSummary:s,material:o,label:c,hiddenLabel:d,defaultOpen:f=!1,onPreview:m}){const[h,p]=v.useState(f),[y,k]=v.useState(""),[w,S]=v.useState(null),[T,M]=v.useState(null),E=v.useRef(!1);v.useEffect(()=>{if(!h)return;S(null),M(null);let H=!1;return G5(e,n,r,s.id,y,o).then(D=>{if(!H&&(S(D),y===""&&!E.current)){E.current=!0;const L=D.entries.find($=>$.kind==="file"&&$.name.toLowerCase()==="readme.md");L&&m(o,L.name)}}).catch(D=>{H||M(Ae(D))}),()=>{H=!0}},[e,n,r,s.id,o,m,h,y]);const R=y===""?[]:y.split("/"),I=H=>{if(H.kind==="dir"){k(iv(y,H.name));return}m(o,iv(y,H.name))};return l.jsxs("div",{className:"border-b border-gray-200 last:border-b-0 dark:border-gray-800",children:[l.jsxs("button",{type:"button","aria-expanded":h,onClick:()=>p(H=>!H),className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-gray-100 dark:hover:bg-gray-800/60",children:[l.jsx("span",{className:"text-xs text-gray-400",children:h?"▾":"▸"}),l.jsx("span",{className:"min-w-0 flex-1 text-sm font-medium",children:c}),d&&l.jsx("span",{className:"shrink-0 rounded bg-gray-200/70 px-1.5 py-0.5 text-[10px] text-gray-500 dark:bg-gray-800 dark:text-gray-400",children:d})]}),h&&l.jsxs("div",{children:[R.length>0&&l.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-t border-gray-100 px-5 py-1.5 dark:border-gray-800/70",children:[l.jsx("button",{type:"button",onClick:()=>k(""),className:"rounded px-1 py-0.5 text-xs text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800",children:c}),R.map((H,D)=>l.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[l.jsx("span",{className:"text-gray-300 dark:text-gray-700",children:"/"}),l.jsx("button",{type:"button",onClick:()=>k(R.slice(0,D+1).join("/")),className:"max-w-24 truncate rounded px-1 py-0.5 text-xs text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800",children:H})]},`${H}-${D}`))]}),T&&l.jsx("p",{className:"px-6 py-2 text-xs text-red-500",children:T}),!w&&!T&&l.jsx(Ua,{rows:3}),w?.entries.length===0&&l.jsx("p",{className:"px-6 py-2 text-xs text-gray-400",children:g.files.empty}),w?.entries.map(H=>l.jsxs("button",{type:"button",onClick:()=>I(H),className:"flex w-full items-center gap-2 border-t border-gray-100 px-6 py-2 text-left hover:bg-gray-100 dark:border-gray-800/70 dark:hover:bg-gray-800/60",children:[l.jsx("span",{className:"text-sm text-gray-400",children:H.kind==="dir"?"▸":"·"}),l.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:H.name}),H.kind==="file"&&l.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:No(H.sizeBytes)})]},`${H.kind}/${H.name}`))]})]})}function s9({projectId:e,agentId:n,benchmarkId:r,caseSummary:s}){const[o,c]=v.useState(null),d=v.useRef(0),f=v.useCallback((k,w,S)=>W5(e,n,r,s.id,w,k,S),[e,n,r,s.id]),m=v.useCallback(async(k,w)=>{const S=++d.current,T=w.includes("/")?w.slice(w.lastIndexOf("/")+1):w,M=Tw(T);if(n9.has(M)){c({material:k,path:w,name:T,kind:"image"});return}if(M==="pdf"){c({material:k,path:w,name:T,kind:"pdf"});return}const E=M==="md";if(!t9.has(M)){c({material:k,path:w,name:T,kind:"unsupported"});return}c({material:k,path:w,name:T,kind:E?"md":"text",loading:!0});try{const R=await fetch(f(k,w,{preview:!0}),{credentials:"same-origin"});if(!R.ok)throw new Error(String(R.status));const I=await R.text();if(S!==d.current)return;c({material:k,path:w,name:T,kind:E?"md":"text",content:I,truncated:R.headers.get("x-content-truncated")==="1"})}catch(R){if(S!==d.current)return;c({material:k,path:w,name:T,kind:E?"md":"text",error:Ae(R)})}},[f]),h=o?f(o.material,o.path,{download:!0}):null,p=o?.material==="rubric"?g.benchmark.rubric:g.benchmark.taskMaterials,y={img:({src:k,alt:w})=>l.jsx("img",{src:typeof k=="string"&&!lv.test(k)?f(o?.material??"statement",cv(ov(o?.path??""),k)):k,alt:w??"",loading:"lazy",className:"max-w-full"}),a:({href:k,children:w})=>{if(typeof k!="string"||k.startsWith("#"))return l.jsx("a",{href:k,children:w});if(lv.test(k))return l.jsx("a",{href:k,target:"_blank",rel:"noreferrer",children:w});const S=cv(ov(o?.path??""),k),T=o?.material??"statement";return l.jsx("a",{href:f(T,S),onClick:M=>{M.preventDefault(),m(T,S)},children:w})}};return l.jsxs("div",{className:"grid min-h-[58vh] overflow-hidden rounded-md border border-gray-200 md:grid-cols-[240px_minmax(0,1fr)] dark:border-gray-800",children:[l.jsx("aside",{className:"border-b border-gray-200 bg-gray-50/60 md:border-b-0 md:border-r dark:border-gray-800 dark:bg-gray-950/30",children:l.jsxs("div",{className:"max-h-44 overflow-y-auto md:max-h-[53vh]",children:[l.jsx(uv,{projectId:e,agentId:n,benchmarkId:r,caseSummary:s,material:"statement",label:g.benchmark.taskMaterials,defaultOpen:!0,onPreview:m}),l.jsx(uv,{projectId:e,agentId:n,benchmarkId:r,caseSummary:s,material:"rubric",label:g.benchmark.rubric,hiddenLabel:g.benchmark.agentHidden,onPreview:m})]})}),l.jsxs("section",{className:"min-w-0",children:[l.jsxs("div",{className:"flex min-h-11 flex-wrap items-center gap-2 border-b border-gray-200 px-3 py-2 dark:border-gray-800",children:[l.jsx("div",{className:"min-w-0 flex-1",children:l.jsx("p",{className:"truncate font-mono text-xs text-gray-500",children:o?`${p} / ${o.path}`:s.id})}),h&&o&&l.jsx("a",{href:h,download:o.name,className:"rounded-md px-2.5 py-1 text-xs font-medium text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-800",children:g.files.download})]}),l.jsx("div",{className:"max-h-[52vh] min-h-[52vh] overflow-auto p-3",children:o?o.loading?l.jsx(Ua,{rows:8}):o.error?l.jsx("p",{className:"text-sm text-red-500",children:o.error}):o.kind==="image"?l.jsx("img",{src:f(o.material,o.path),alt:o.name,loading:"lazy",className:"max-w-full rounded-md border border-gray-200 dark:border-gray-800"}):o.kind==="pdf"?l.jsx("iframe",{src:f(o.material,o.path),title:o.name,className:"h-[50vh] w-full rounded-md border border-gray-200 dark:border-gray-800"}):o.kind==="md"?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"md-body text-sm text-gray-800 dark:text-gray-100",children:l.jsx($o,{remarkPlugins:[Bo],components:y,children:o.content??""})}),o.truncated&&l.jsx("p",{className:"mt-2 text-xs text-gray-400",children:g.files.previewTruncated})]}):o.kind==="text"?l.jsxs(l.Fragment,{children:[l.jsx($p,{language:r9(o.name),code:o.content??"",highlight:(o.content?.length??0)<=a9}),o.truncated&&l.jsx("p",{className:"mt-2 text-xs text-gray-400",children:g.files.previewTruncated})]}):l.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:g.files.previewUnsupported}):l.jsx("p",{className:"text-sm text-gray-400",children:g.benchmark.caseFileUnavailable})})]})]})}function l9({projectId:e,agentId:n,name:r,defaultOpen:s,selection:o,onSelect:c}){const[d,f]=v.useState(s),[m,h]=v.useState(null),[p,y]=v.useState(null);return v.useEffect(()=>{!d||m||q5(e,n).then(k=>h(k.benchmarks)).catch(k=>y(Ae(k)))},[d,m,e,n]),l.jsxs("li",{className:"pt-2.5",children:[l.jsx("div",{className:"flex items-center px-1 pb-0.5",children:l.jsxs("button",{type:"button",onClick:()=>f(k=>!k),"aria-label":d?g.nav.collapseGroup:g.nav.expandGroup,className:"flex min-w-0 flex-1 items-center gap-1 rounded px-1 py-0.5 text-left transition-colors duration-150 hover:bg-gray-200/50 dark:hover:bg-gray-800/50",children:[l.jsx(pa,{id:n,name:r,size:18,className:"shrink-0 rounded"}),l.jsx("span",{className:"min-w-0 truncate text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:r}),l.jsx(Ln,{open:d,size:12,className:"text-gray-400"}),l.jsx("span",{className:"min-w-0 flex-1"})]})}),d&&l.jsxs("div",{className:"anim-fade",children:[p&&l.jsx("p",{className:"px-2.5 py-1 text-xs text-red-500",children:p}),!m&&!p&&l.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400",children:g.common.loading}),m&&m.length===0&&l.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:g.benchmark.emptyAgent}),l.jsx("ul",{className:"space-y-0.5",children:m?.map(k=>{const w=o?.agentId===n&&o.benchmark.id===k.id;return l.jsx("li",{children:l.jsxs("button",{type:"button",onClick:()=>c({agentId:n,benchmark:k}),className:`flex w-full items-center gap-1.5 rounded-md px-2.5 py-1.5 text-left transition-colors duration-150 ${w?"bg-gray-200/70 dark:bg-gray-800":"hover:bg-gray-200/50 dark:hover:bg-gray-800/70"}`,children:[l.jsx(td,{text:k.title,className:`min-w-0 flex-1 text-sm ${w?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`}),l.jsx("span",{className:"shrink-0 font-mono text-[11px] text-gray-400",children:k.caseCount})]})},k.id)})})]})]})}function i9({evaluations:e,series:n}){const[r,s]=v.useState(null),[o,c]=Wp(),d=Cw(e),f=X7(d),m=xw(e.length,f.min,f.max,c),h=e.map(p=>ma(p.time));return l.jsx("div",{ref:o,children:c>0&&l.jsx(Kp,{geom:m,fmtY:jo,dates:h,hover:r,onHover:s,yTicks:f.ticks,bubble:p=>{const y=e[p],k=d[p]??null;return l.jsxs(l.Fragment,{children:[l.jsx("p",{className:"text-gray-400",children:ma(y.time)}),l.jsxs("p",{className:"font-mono",children:[k===null?"—":jo(k),y.version!==void 0&&l.jsxs("span",{className:"ml-1.5 text-gray-400",children:["v",y.version]})]}),l.jsxs("p",{className:"font-mono text-gray-400",children:[y.modelId," · ",y.thinkingLevel]})]})},children:n.map((p,y)=>{const k=Z7(e9(e,p));return l.jsx("g",{className:p.modelId?bw(y).text:"text-gray-400 dark:text-gray-500",children:k.map((w,S)=>{const T=w.map((M,E)=>`${E===0?"M":"L"}${m.x(M.index)},${m.y(M.value)}`).join(" ");return l.jsxs("g",{children:[w.length>1&&l.jsx("path",{d:T,fill:"none",stroke:"currentColor",strokeWidth:2,opacity:r!==null?.35:1}),w.map(M=>l.jsx("circle",{cx:m.x(M.index),cy:m.y(M.value),r:r===M.index?4:2.5,className:"fill-current",opacity:r!==null&&r!==M.index?.25:1},M.index))]},S)})},p.key===""?"unlabeled":p.key)})})})}function o9({evaluations:e}){const n=J7(e),r=s=>s.modelId?s.thinkingLevel?`${s.modelId} · ${s.thinkingLevel}`:s.modelId:g.benchmark.legendUnlabeled;return l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-semibold text-gray-500",children:g.benchmark.trendTitle(g.benchmark.colScore)}),n.length>=2&&l.jsx("div",{className:"mb-1.5 flex flex-wrap items-center gap-x-3 gap-y-1",children:n.map((s,o)=>l.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-gray-500 dark:text-gray-400",children:[l.jsx("span",{className:`inline-block h-2 w-2 shrink-0 rounded-sm ${s.modelId?bw(o).swatch:"bg-gray-400 dark:bg-gray-500"}`}),l.jsx("span",{className:"font-mono",children:r(s)})]},s.key===""?"unlabeled":s.key))}),l.jsx(i9,{evaluations:e,series:n})]})}const Ys="px-3 py-2";function c9({agentId:e,evaluation:n,caseTitles:r,onOpenCase:s,currency:o}){const[c,d]=v.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsxs("tr",{onClick:()=>d(f=>!f),className:"cursor-pointer border-b border-gray-100 transition-colors duration-150 last:border-b-0 hover:bg-gray-50 dark:border-gray-800/60 dark:hover:bg-gray-800/40",children:[l.jsx("td",{className:Ys,children:l.jsxs("span",{className:"flex items-center gap-1.5 text-xs",children:[l.jsx(Ln,{open:c,size:12,className:"text-gray-400"}),ma(n.time)]})}),l.jsx("td",{className:`${Ys} font-mono text-xs text-gray-500 dark:text-gray-400`,children:n.version!==void 0?`v${n.version}`:"—"}),l.jsx("td",{className:`${Ys} max-w-40 truncate font-mono text-xs text-gray-500 dark:text-gray-400`,title:n.provider,children:n.modelId}),l.jsx("td",{className:`${Ys} font-mono text-xs text-gray-500 dark:text-gray-400`,children:n.thinkingLevel}),l.jsx("td",{className:`${Ys} font-mono text-xs font-semibold tabular-nums`,children:jo(n.score)}),l.jsx("td",{className:`${Ys} font-mono text-xs tabular-nums text-gray-500 dark:text-gray-400`,children:Za(n.cost,o)}),l.jsx("td",{className:`${Ys} font-mono text-xs tabular-nums text-gray-500 dark:text-gray-400`,children:n.durationMs!==void 0?vn(n.durationMs):"—"})]}),c&&l.jsx("tr",{className:"border-b border-gray-100 last:border-b-0 dark:border-gray-800/60",children:l.jsxs("td",{colSpan:7,className:"bg-gray-50/80 px-3 py-2 dark:bg-gray-950/40",children:[(n.summaryTitle||n.summary)&&l.jsxs("div",{className:"mb-2",children:[n.summaryTitle?l.jsx("p",{className:"text-xs font-semibold text-gray-700 dark:text-gray-200",children:n.summaryTitle}):l.jsx("p",{className:"text-xs font-semibold text-gray-500",children:g.benchmark.summaryLabel}),n.summary&&l.jsx("p",{className:"mt-0.5 whitespace-pre-wrap text-xs text-gray-600 dark:text-gray-300",children:n.summary})]}),l.jsxs("table",{className:"w-full text-left",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"text-xs text-gray-500",children:[l.jsx("th",{className:"px-2 py-1 font-medium",children:g.benchmark.colCase}),l.jsx("th",{className:"px-2 py-1 font-medium",children:g.benchmark.colScore}),l.jsx("th",{className:"px-2 py-1 font-medium",children:g.common.cost}),l.jsx("th",{className:"px-2 py-1 font-medium",children:g.benchmark.colDuration}),l.jsx("th",{className:"px-2 py-1 font-medium",children:g.benchmark.colSession})]})}),l.jsx("tbody",{children:n.cases.map(f=>l.jsx(d9,{agentId:e,caseScore:f,title:r.get(f.case),onOpenCase:r.has(f.case)?s:void 0,currency:o},f.case))})]})]})})]})}function u9({agentId:e,sessionId:n}){return n?l.jsx(rp,{to:`/traces?agentId=${encodeURIComponent(e)}&sessionId=${encodeURIComponent(n)}`,className:"font-mono text-gray-600 underline decoration-gray-300 underline-offset-2 hover:text-gray-900 dark:text-gray-300 dark:decoration-gray-600 dark:hover:text-gray-100",title:n,children:n}):l.jsx("span",{className:"text-gray-400",children:"—"})}function d9({agentId:e,caseScore:n,title:r,onOpenCase:s,currency:o}){const[c,d]=v.useState(!1),f=n.runs;return l.jsxs(l.Fragment,{children:[l.jsxs("tr",{onClick:()=>d(m=>!m),className:"cursor-pointer text-xs transition-colors duration-150 hover:bg-gray-100/70 dark:hover:bg-gray-800/40",children:[l.jsx("td",{className:"px-2 py-1",children:l.jsxs("span",{className:"flex items-start gap-1.5",children:[l.jsx(Ln,{open:c,size:12,className:"text-gray-400"}),l.jsxs("span",{className:"min-w-0",children:[s?l.jsx("button",{type:"button",className:"block text-left font-medium text-gray-800 hover:underline dark:text-gray-200",onClick:m=>{m.stopPropagation(),s(n.case)},children:r??n.case}):l.jsx("span",{className:"block font-medium text-gray-800 dark:text-gray-200",children:r??n.case}),r&&r!==n.case&&l.jsx("span",{className:"block font-mono text-[11px] text-gray-400",children:n.case})]})]})}),l.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:jo(n.score)}),l.jsx("td",{className:"px-2 py-1 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:Za(n.cost,o)}),l.jsx("td",{className:"px-2 py-1 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:n.durationMs!==void 0?vn(n.durationMs):"—"}),l.jsx("td",{className:"px-2 py-1",children:l.jsx("span",{className:"text-gray-400",children:"—"})})]}),c&&f.map((m,h)=>l.jsxs("tr",{className:"text-xs text-gray-500 dark:text-gray-400",children:[l.jsxs("td",{className:"py-1 pl-7 pr-2 font-mono",children:[g.benchmark.colRun," #",h+1]}),l.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:jo(m.score)}),l.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:Za(m.cost,o)}),l.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:m.durationMs!==void 0?vn(m.durationMs):"—"}),l.jsx("td",{className:"px-2 py-1",children:l.jsx(u9,{agentId:e,...m.sessionId?{sessionId:m.sessionId}:{}})})]},h))]})}function f9({cases:e,error:n,onOpenCase:r}){return l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-semibold text-gray-500",children:g.benchmark.cases}),l.jsxs("div",{className:"overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[n&&l.jsx("p",{className:"px-3 py-2 text-xs text-red-500",children:n}),!e&&!n&&l.jsx("p",{className:"px-3 py-2 text-xs text-gray-400",children:g.common.loading}),e?.map(s=>l.jsxs("button",{type:"button",onClick:()=>r(s.id),className:"flex w-full items-center gap-3 border-b border-gray-100 px-3 py-2 text-left transition-colors last:border-b-0 hover:bg-gray-50 dark:border-gray-800/70 dark:hover:bg-gray-800/50",children:[l.jsxs("span",{className:"min-w-0 flex-1",children:[l.jsx("span",{className:"block text-sm font-medium text-gray-800 dark:text-gray-200",children:s.title}),l.jsx("span",{className:"block truncate font-mono text-[11px] text-gray-400",children:s.id})]}),l.jsx("span",{className:"shrink-0 rounded-md px-2.5 py-1 text-xs font-medium text-gray-600 dark:text-gray-300",children:g.benchmark.viewCase})]},s.id))]})]})}function m9(){pr(g.benchmark.title);const{currentProject:e,agents:n,agentsLoading:r}=gn(),{currency:s}=Ns(),o=e?.projectId??null,[c]=lp(),d=c.get("agentId"),[f,m]=v.useState(null),[h,p]=v.useState(null),[y,k]=v.useState(null),[w,S]=v.useState(null);if(v.useEffect(()=>{m(null)},[o]),v.useEffect(()=>{if(p(null),k(null),S(null),!o||!f)return;let I=!1;return V5(o,f.agentId,f.benchmark.id).then(H=>{I||p(H.cases)}).catch(H=>{I||k(Ae(H))}),()=>{I=!0}},[o,f]),!o)return null;const T=f?.benchmark??null,M=T?[...T.evaluations]:[],E=new Map(h?.map(I=>[I.id,I.title])??[]),R=h?.find(I=>I.id===w)??null;return l.jsxs("div",{className:"flex h-full flex-col md:flex-row",children:[l.jsxs("aside",{className:"max-h-52 shrink-0 overflow-y-auto border-b border-gray-200 bg-gray-50 px-1 py-2 md:max-h-none md:w-72 md:border-b-0 md:border-r dark:border-gray-800 dark:bg-gray-900",children:[l.jsx("p",{className:"px-3 pb-1 text-xs font-bold uppercase tracking-wide text-gray-500",children:g.benchmark.title}),r?l.jsx(Ua,{rows:4}):l.jsx("ul",{children:n.map(I=>l.jsx(l9,{projectId:o,agentId:I.agentId,name:hn(I),defaultOpen:d===null||d===I.agentId,selection:f,onSelect:m},I.agentId))})]}),l.jsx("section",{className:"min-w-0 flex-1 overflow-y-auto p-3 md:p-4",children:f&&T?l.jsxs("div",{className:"mx-auto max-w-4xl space-y-4",children:[l.jsxs("div",{children:[l.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[l.jsx("h1",{className:"min-w-0 truncate text-lg font-semibold",children:T.title}),l.jsx("span",{className:"text-xs text-gray-500",children:g.benchmark.caseCount(T.caseCount)})]}),T.description&&l.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:T.description})]}),l.jsx(f9,{cases:h,error:y,onOpenCase:S}),M.length===0?l.jsx(mr,{title:g.benchmark.noEvaluations}):l.jsxs(l.Fragment,{children:[l.jsx(o9,{evaluations:M}),l.jsxs("div",{children:[l.jsx("p",{className:"mb-1 text-xs font-semibold text-gray-500",children:g.benchmark.evaluations}),l.jsx("div",{className:"overflow-x-auto overflow-y-clip rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:l.jsxs("table",{className:"w-full min-w-[720px] text-left text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-gray-200 bg-gray-50/80 text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900",children:[l.jsx("th",{className:"px-3 py-2.5",children:g.common.time}),l.jsx("th",{className:"px-3 py-2.5",children:g.benchmark.colVersion}),l.jsx("th",{className:"px-3 py-2.5",children:g.benchmark.colModel}),l.jsx("th",{className:"px-3 py-2.5",children:g.benchmark.colThinkingLevel}),l.jsx("th",{className:"px-3 py-2.5",children:g.benchmark.colScore}),l.jsx("th",{className:"px-3 py-2.5",children:g.common.cost}),l.jsx("th",{className:"px-3 py-2.5",children:g.benchmark.colDuration})]})}),l.jsx("tbody",{children:[...M].reverse().map((I,H)=>l.jsx(c9,{agentId:f.agentId,evaluation:I,caseTitles:E,onOpenCase:S,currency:s},H))})]})})]})]}),R&&l.jsx(pn,{open:!0,title:R.title,widthClass:"sm:max-w-6xl",onClose:()=>S(null),children:l.jsx(s9,{projectId:o,agentId:f.agentId,benchmarkId:T.id,caseSummary:R})})]},`${f.agentId}/${T.id}`):l.jsx(mr,{title:g.benchmark.selectBenchmark})})]})}function h9(){pr(g.admin.users);const{user:e}=Bn(),[n,r]=v.useState(null),[s,o]=v.useState(null),[c,d]=v.useState(!1),[f,m]=v.useState(null),[h,p]=v.useState(null),y=v.useCallback(async()=>{try{r((await l5()).users),o(null)}catch(k){o(Ae(k))}},[]);return v.useEffect(()=>{e?.isAdmin&&y()},[e?.isAdmin,y]),e&&!e.isAdmin?l.jsx(So,{to:"/chat",replace:!0}):l.jsxs("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:[l.jsxs("div",{className:"mx-auto max-w-3xl",children:[l.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[l.jsx("h1",{className:"text-xl font-semibold",children:g.admin.users}),l.jsx(Se,{variant:"primary",onClick:()=>d(!0),children:g.admin.createUser})]}),n===null?l.jsx("p",{className:"text-sm text-gray-400",children:g.common.loading}):l.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-800",children:l.jsxs("table",{className:"w-full text-sm",children:[l.jsx("thead",{children:l.jsxs("tr",{className:"border-b border-gray-100 bg-gray-50 text-left text-xs text-gray-500 dark:border-gray-800 dark:bg-gray-900/60 dark:text-gray-400",children:[l.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-medium",children:g.common.username}),l.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-medium",children:g.common.role}),l.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-medium",children:g.common.created}),l.jsx("th",{className:"whitespace-nowrap px-3 py-2 text-right font-medium",children:g.common.actions})]})}),l.jsx("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:n.map(k=>l.jsxs("tr",{children:[l.jsxs("td",{className:"whitespace-nowrap px-3 py-2 font-medium",children:[k.userId,k.passwordIsInitial&&l.jsx("span",{className:"ml-2 align-middle",children:l.jsx(Jt,{tone:"gray",children:g.admin.initialPasswordFlag})})]}),l.jsx("td",{className:"whitespace-nowrap px-3 py-2",children:l.jsx(Jt,{tone:"gray",children:k.isAdmin?g.admin.roleAdmin:g.admin.roleUser})}),l.jsx("td",{className:"whitespace-nowrap px-3 py-2 text-gray-500 dark:text-gray-400",children:ma(k.createdAt)}),l.jsxs("td",{className:"whitespace-nowrap px-3 py-1.5 text-right",children:[l.jsx(Se,{size:"sm",variant:"ghost",onClick:()=>m(k),children:g.admin.resetPassword}),!k.isAdmin&&l.jsx(Se,{size:"sm",variant:"ghost",onClick:()=>p(k),children:g.common.delete})]})]},k.userId))})]})}),s&&l.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:s})]}),l.jsx(p9,{open:c,onClose:()=>d(!1),onDone:()=>{d(!1),y()}}),l.jsx(g9,{user:f,onClose:()=>m(null)}),l.jsx(x9,{user:h,onClose:()=>p(null),onDone:()=>{p(null),y()}})]})}function p9({open:e,onClose:n,onDone:r}){const[s,o]=v.useState(""),[c,d]=v.useState(""),[f,m]=v.useState({}),[h,p]=v.useState(!1),y=()=>m(w=>w.userId||w.password?{}:w);v.useEffect(()=>{e&&(o(""),d(""),m({}))},[e]);const k=async()=>{const w=s.trim(),S={};if(w?Rb.test(w)||(S.userId=g.auth.usernameHint):S.userId=g.common.requiredField,c||(S.password=g.common.requiredField),S.userId||S.password){m(S);return}p(!0),m({});try{await i5({userId:w,password:c}),r()}catch(T){T instanceof Xa&&T.code==="invalid_password"?m({password:Ae(T)}):m({userId:Ae(T)})}finally{p(!1)}};return l.jsx(pn,{open:e,title:g.admin.createUser,onClose:n,footer:l.jsxs(l.Fragment,{children:[l.jsx(Se,{onClick:n,disabled:h,children:g.common.cancel}),l.jsx(Se,{variant:"primary",disabled:h,onClick:()=>{k()},children:g.common.create})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(tt,{label:g.common.username,required:!0,size:"sm",value:s,onChange:w=>{o(w.target.value),y()},error:f.userId,hint:g.auth.usernameHint,autoFocus:!0}),l.jsx(ws,{label:g.admin.initialPassword,required:!0,size:"sm",value:c,onChange:w=>{d(w.target.value),y()},error:f.password,autoComplete:"new-password",hint:g.auth.passwordHint}),Rb.test(s.trim())&&l.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:g.admin.defaultProjectNote(`${s.trim()}-default_project`)})]})})}function g9({user:e,onClose:n}){const[r,s]=v.useState(""),[o,c]=v.useState(void 0),[d,f]=v.useState(!1);v.useEffect(()=>{e&&(s(""),c(void 0))},[e]);const m=async()=>{if(e){if(!r){c(g.common.requiredField);return}f(!0),c(void 0);try{await o5(e.userId,{password:r}),n()}catch(h){c(Ae(h))}finally{f(!1)}}};return l.jsx(pn,{open:e!==null,title:e?g.admin.resetPasswordTitle(e.userId):"",onClose:n,footer:l.jsxs(l.Fragment,{children:[l.jsx(Se,{onClick:n,disabled:d,children:g.common.cancel}),l.jsx(Se,{variant:"primary",disabled:d,onClick:()=>{m()},children:g.common.save})]}),children:l.jsxs("div",{className:"space-y-3",children:[l.jsx(ws,{label:g.admin.initialPassword,required:!0,size:"sm",value:r,onChange:h=>{s(h.target.value),c(void 0)},error:o,autoComplete:"new-password",hint:g.auth.passwordHint,autoFocus:!0}),l.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:g.admin.resetPasswordNote})]})})}function x9({user:e,onClose:n,onDone:r}){const[s,o]=v.useState(!1),[c,d]=v.useState(null),[f,m]=v.useState(!1);v.useEffect(()=>{e&&(o(!1),d(null))},[e]);const h=async()=>{if(e){m(!0),d(null);try{await c5(e.userId),r()}catch(p){d(Ae(p))}finally{m(!1)}}};return l.jsx(pn,{open:e!==null,title:e?g.admin.deleteUserTitle(e.userId):"",onClose:n,footer:l.jsxs(l.Fragment,{children:[l.jsx(Se,{onClick:n,disabled:f,children:g.common.cancel}),s?l.jsx(Se,{variant:"danger",disabled:f,onClick:()=>{h()},children:g.common.confirm}):l.jsx(Se,{variant:"danger",onClick:()=>o(!0),children:g.common.delete})]}),children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:e?g.admin.deleteUserConfirm(e.userId):""}),c&&l.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:c})]})})}function y9(){const{user:e}=Bn();return e===void 0?null:e===null?l.jsx(So,{to:"/login",replace:!0}):l.jsx(UC,{children:l.jsx(WC,{children:l.jsx(FI,{})})})}function b9(){const{user:e}=Bn();return e?l.jsx(So,{to:"/chat",replace:!0}):l.jsx(ZI,{})}function v9(){return l.jsx(EC,{children:l.jsxs(aC,{children:[l.jsx(Xn,{path:"/login",element:l.jsx(b9,{})}),l.jsxs(Xn,{element:l.jsx(y9,{}),children:[l.jsx(Xn,{index:!0,element:l.jsx(So,{to:"/chat",replace:!0})}),l.jsx(Xn,{path:"/chat/:sessionId?",element:l.jsx(jI,{})}),l.jsx(Xn,{path:"/agents",element:l.jsx(tL,{})}),l.jsx(Xn,{path:"/agents/:agentId",element:l.jsx(gL,{})}),l.jsx(Xn,{path:"/skills",element:l.jsx(NL,{})}),l.jsx(Xn,{path:"/models",element:l.jsx(PL,{})}),l.jsx(Xn,{path:"/usage",element:l.jsx(S7,{})}),l.jsx(Xn,{path:"/traces",element:l.jsx(Y7,{})}),l.jsx(Xn,{path:"/benchmark",element:l.jsx(m9,{})}),l.jsx(Xn,{path:"/admin/users",element:l.jsx(h9,{})}),l.jsx(Xn,{path:"*",element:l.jsx(So,{to:"/chat",replace:!0})})]})]})})}function k9(){return l.jsx(Gj,{children:l.jsx(e5,{children:l.jsx(Z5,{children:l.jsxs(Wj,{children:[l.jsx(v9,{}),l.jsx(i4,{})]})})})})}const Mw=document.getElementById("root");if(!Mw)throw new Error("#root mount point not found");$j.createRoot(Mw).render(l.jsx(v.StrictMode,{children:l.jsx(k9,{})}));export{_R as _,i3 as a,S3 as b,q1 as c,b3 as f,w3 as h,wp as s,f3 as w};
|