@prismshadow/penguin-server 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/types.d.ts +168 -2
- package/dist/index.js +864 -26
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/web-dist/assets/{index-zCEa-kcQ.js → index-7gbWDtby.js} +1 -1
- package/web-dist/assets/index-Bnva9EYm.js +102 -0
- package/web-dist/assets/index-DMcMNwnl.css +1 -0
- package/web-dist/index.html +2 -2
- package/web-dist/assets/index-BwOLjdOw.css +0 -1
- package/web-dist/assets/index-Ddrpqgqu.js +0 -104
|
@@ -1,104 +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"]'))l(o);new MutationObserver(o=>{for(const u of o)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function r(o){const u={};return o.integrity&&(u.integrity=o.integrity),o.referrerPolicy&&(u.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?u.credentials="include":o.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function l(o){if(o.ep)return;o.ep=!0;const u=r(o);fetch(o.href,u)}})();function hv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pf={exports:{}},Si={};var Xx;function yS(){if(Xx)return Si;Xx=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(l,o,u){var d=null;if(u!==void 0&&(d=""+u),o.key!==void 0&&(d=""+o.key),"key"in o){u={};for(var f in o)f!=="key"&&(u[f]=o[f])}else u=o;return o=u.ref,{$$typeof:e,type:l,key:d,ref:o!==void 0?o:null,props:u}}return Si.Fragment=n,Si.jsx=r,Si.jsxs=r,Si}var Zx;function vS(){return Zx||(Zx=1,Pf.exports=yS()),Pf.exports}var i=vS(),qf={exports:{}},$e={};var Jx;function bS(){if(Jx)return $e;Jx=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),u=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"),g=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),k=Symbol.iterator;function w(R){return R===null||typeof R!="object"?null:(R=k&&R[k]||R["@@iterator"],typeof R=="function"?R:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,j={};function E(R,O,T){this.props=R,this.context=O,this.refs=j,this.updater=T||N}E.prototype.isReactComponent={},E.prototype.setState=function(R,O){if(typeof R!="object"&&typeof R!="function"&&R!=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,R,O,"setState")},E.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function L(){}L.prototype=E.prototype;function _(R,O,T){this.props=R,this.context=O,this.refs=j,this.updater=T||N}var q=_.prototype=new L;q.constructor=_,C(q,E.prototype),q.isPureReactComponent=!0;var H=Array.isArray;function I(){}var P={H:null,A:null,T:null,S:null},ee=Object.prototype.hasOwnProperty;function Z(R,O,T){var X=T.ref;return{$$typeof:e,type:R,key:O,ref:X!==void 0?X:null,props:T}}function D(R,O){return Z(R.type,O,R.props)}function V(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function B(R){var O={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(T){return O[T]})}var Y=/\/+/g;function ne(R,O){return typeof R=="object"&&R!==null&&R.key!=null?B(""+R.key):O.toString(36)}function U(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(I,I):(R.status="pending",R.then(function(O){R.status==="pending"&&(R.status="fulfilled",R.value=O)},function(O){R.status==="pending"&&(R.status="rejected",R.reason=O)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function z(R,O,T,X,ae){var oe=typeof R;(oe==="undefined"||oe==="boolean")&&(R=null);var ge=!1;if(R===null)ge=!0;else switch(oe){case"bigint":case"string":case"number":ge=!0;break;case"object":switch(R.$$typeof){case e:case n:ge=!0;break;case g:return ge=R._init,z(ge(R._payload),O,T,X,ae)}}if(ge)return ae=ae(R),ge=X===""?"."+ne(R,0):X,H(ae)?(T="",ge!=null&&(T=ge.replace(Y,"$&/")+"/"),z(ae,O,T,"",function(pe){return pe})):ae!=null&&(V(ae)&&(ae=D(ae,T+(ae.key==null||R&&R.key===ae.key?"":(""+ae.key).replace(Y,"$&/")+"/")+ge)),O.push(ae)),1;ge=0;var Te=X===""?".":X+":";if(H(R))for(var se=0;se<R.length;se++)X=R[se],oe=Te+ne(X,se),ge+=z(X,O,T,oe,ae);else if(se=w(R),typeof se=="function")for(R=se.call(R),se=0;!(X=R.next()).done;)X=X.value,oe=Te+ne(X,se++),ge+=z(X,O,T,oe,ae);else if(oe==="object"){if(typeof R.then=="function")return z(U(R),O,T,X,ae);throw O=String(R),Error("Objects are not valid as a React child (found: "+(O==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":O)+"). If you meant to render a collection of children, use an array instead.")}return ge}function $(R,O,T){if(R==null)return R;var X=[],ae=0;return z(R,X,"","",function(oe){return O.call(T,oe,ae++)}),X}function G(R){if(R._status===-1){var O=R._result;O=O(),O.then(function(T){(R._status===0||R._status===-1)&&(R._status=1,R._result=T)},function(T){(R._status===0||R._status===-1)&&(R._status=2,R._result=T)}),R._status===-1&&(R._status=0,R._result=O)}if(R._status===1)return R._result.default;throw R._result}var me=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var O=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(O))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},M={map:$,forEach:function(R,O,T){$(R,function(){O.apply(this,arguments)},T)},count:function(R){var O=0;return $(R,function(){O++}),O},toArray:function(R){return $(R,function(O){return O})||[]},only:function(R){if(!V(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return $e.Activity=y,$e.Children=M,$e.Component=E,$e.Fragment=r,$e.Profiler=o,$e.PureComponent=_,$e.StrictMode=l,$e.Suspense=m,$e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=P,$e.__COMPILER_RUNTIME={__proto__:null,c:function(R){return P.H.useMemoCache(R)}},$e.cache=function(R){return function(){return R.apply(null,arguments)}},$e.cacheSignal=function(){return null},$e.cloneElement=function(R,O,T){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var X=C({},R.props),ae=R.key;if(O!=null)for(oe in O.key!==void 0&&(ae=""+O.key),O)!ee.call(O,oe)||oe==="key"||oe==="__self"||oe==="__source"||oe==="ref"&&O.ref===void 0||(X[oe]=O[oe]);var oe=arguments.length-2;if(oe===1)X.children=T;else if(1<oe){for(var ge=Array(oe),Te=0;Te<oe;Te++)ge[Te]=arguments[Te+2];X.children=ge}return Z(R.type,ae,X)},$e.createContext=function(R){return R={$$typeof:d,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:u,_context:R},R},$e.createElement=function(R,O,T){var X,ae={},oe=null;if(O!=null)for(X in O.key!==void 0&&(oe=""+O.key),O)ee.call(O,X)&&X!=="key"&&X!=="__self"&&X!=="__source"&&(ae[X]=O[X]);var ge=arguments.length-2;if(ge===1)ae.children=T;else if(1<ge){for(var Te=Array(ge),se=0;se<ge;se++)Te[se]=arguments[se+2];ae.children=Te}if(R&&R.defaultProps)for(X in ge=R.defaultProps,ge)ae[X]===void 0&&(ae[X]=ge[X]);return Z(R,oe,ae)},$e.createRef=function(){return{current:null}},$e.forwardRef=function(R){return{$$typeof:f,render:R}},$e.isValidElement=V,$e.lazy=function(R){return{$$typeof:g,_payload:{_status:-1,_result:R},_init:G}},$e.memo=function(R,O){return{$$typeof:h,type:R,compare:O===void 0?null:O}},$e.startTransition=function(R){var O=P.T,T={};P.T=T;try{var X=R(),ae=P.S;ae!==null&&ae(T,X),typeof X=="object"&&X!==null&&typeof X.then=="function"&&X.then(I,me)}catch(oe){me(oe)}finally{O!==null&&T.types!==null&&(O.types=T.types),P.T=O}},$e.unstable_useCacheRefresh=function(){return P.H.useCacheRefresh()},$e.use=function(R){return P.H.use(R)},$e.useActionState=function(R,O,T){return P.H.useActionState(R,O,T)},$e.useCallback=function(R,O){return P.H.useCallback(R,O)},$e.useContext=function(R){return P.H.useContext(R)},$e.useDebugValue=function(){},$e.useDeferredValue=function(R,O){return P.H.useDeferredValue(R,O)},$e.useEffect=function(R,O){return P.H.useEffect(R,O)},$e.useEffectEvent=function(R){return P.H.useEffectEvent(R)},$e.useId=function(){return P.H.useId()},$e.useImperativeHandle=function(R,O,T){return P.H.useImperativeHandle(R,O,T)},$e.useInsertionEffect=function(R,O){return P.H.useInsertionEffect(R,O)},$e.useLayoutEffect=function(R,O){return P.H.useLayoutEffect(R,O)},$e.useMemo=function(R,O){return P.H.useMemo(R,O)},$e.useOptimistic=function(R,O){return P.H.useOptimistic(R,O)},$e.useReducer=function(R,O,T){return P.H.useReducer(R,O,T)},$e.useRef=function(R){return P.H.useRef(R)},$e.useState=function(R){return P.H.useState(R)},$e.useSyncExternalStore=function(R,O,T){return P.H.useSyncExternalStore(R,O,T)},$e.useTransition=function(){return P.H.useTransition()},$e.version="19.2.7",$e}var ey;function oh(){return ey||(ey=1,qf.exports=bS()),qf.exports}var b=oh(),Ff={exports:{}},ji={},Vf={exports:{}},Gf={};var ty;function kS(){return ty||(ty=1,(function(e){function n(z,$){var G=z.length;z.push($);e:for(;0<G;){var me=G-1>>>1,M=z[me];if(0<o(M,$))z[me]=$,z[G]=M,G=me;else break e}}function r(z){return z.length===0?null:z[0]}function l(z){if(z.length===0)return null;var $=z[0],G=z.pop();if(G!==$){z[0]=G;e:for(var me=0,M=z.length,R=M>>>1;me<R;){var O=2*(me+1)-1,T=z[O],X=O+1,ae=z[X];if(0>o(T,G))X<M&&0>o(ae,T)?(z[me]=ae,z[X]=G,me=X):(z[me]=T,z[O]=G,me=O);else if(X<M&&0>o(ae,G))z[me]=ae,z[X]=G,me=X;else break e}}return $}function o(z,$){var G=z.sortIndex-$.sortIndex;return G!==0?G:z.id-$.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var m=[],h=[],g=1,y=null,k=3,w=!1,N=!1,C=!1,j=!1,E=typeof setTimeout=="function"?setTimeout:null,L=typeof clearTimeout=="function"?clearTimeout:null,_=typeof setImmediate<"u"?setImmediate:null;function q(z){for(var $=r(h);$!==null;){if($.callback===null)l(h);else if($.startTime<=z)l(h),$.sortIndex=$.expirationTime,n(m,$);else break;$=r(h)}}function H(z){if(C=!1,q(z),!N)if(r(m)!==null)N=!0,I||(I=!0,B());else{var $=r(h);$!==null&&U(H,$.startTime-z)}}var I=!1,P=-1,ee=5,Z=-1;function D(){return j?!0:!(e.unstable_now()-Z<ee)}function V(){if(j=!1,I){var z=e.unstable_now();Z=z;var $=!0;try{e:{N=!1,C&&(C=!1,L(P),P=-1),w=!0;var G=k;try{t:{for(q(z),y=r(m);y!==null&&!(y.expirationTime>z&&D());){var me=y.callback;if(typeof me=="function"){y.callback=null,k=y.priorityLevel;var M=me(y.expirationTime<=z);if(z=e.unstable_now(),typeof M=="function"){y.callback=M,q(z),$=!0;break t}y===r(m)&&l(m),q(z)}else l(m);y=r(m)}if(y!==null)$=!0;else{var R=r(h);R!==null&&U(H,R.startTime-z),$=!1}}break e}finally{y=null,k=G,w=!1}$=void 0}}finally{$?B():I=!1}}}var B;if(typeof _=="function")B=function(){_(V)};else if(typeof MessageChannel<"u"){var Y=new MessageChannel,ne=Y.port2;Y.port1.onmessage=V,B=function(){ne.postMessage(null)}}else B=function(){E(V,0)};function U(z,$){P=E(function(){z(e.unstable_now())},$)}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(z){z.callback=null},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ee=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return k},e.unstable_next=function(z){switch(k){case 1:case 2:case 3:var $=3;break;default:$=k}var G=k;k=$;try{return z()}finally{k=G}},e.unstable_requestPaint=function(){j=!0},e.unstable_runWithPriority=function(z,$){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var G=k;k=z;try{return $()}finally{k=G}},e.unstable_scheduleCallback=function(z,$,G){var me=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?me+G:me):G=me,z){case 1:var M=-1;break;case 2:M=250;break;case 5:M=1073741823;break;case 4:M=1e4;break;default:M=5e3}return M=G+M,z={id:g++,callback:$,priorityLevel:z,startTime:G,expirationTime:M,sortIndex:-1},G>me?(z.sortIndex=G,n(h,z),r(m)===null&&z===r(h)&&(C?(L(P),P=-1):C=!0,U(H,G-me))):(z.sortIndex=M,n(m,z),N||w||(N=!0,I||(I=!0,B()))),z},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(z){var $=k;return function(){var G=k;k=$;try{return z.apply(this,arguments)}finally{k=G}}}})(Gf)),Gf}var ny;function wS(){return ny||(ny=1,Vf.exports=kS()),Vf.exports}var Kf={exports:{}},mn={};var ay;function SS(){if(ay)return mn;ay=1;var e=oh();function n(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}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 l={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 u(m,h,g){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:g}}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 mn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,mn.createPortal=function(m,h){var g=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 u(m,h,null,g)},mn.flushSync=function(m){var h=d.T,g=l.p;try{if(d.T=null,l.p=2,m)return m()}finally{d.T=h,l.p=g,l.d.f()}},mn.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,l.d.C(m,h))},mn.prefetchDNS=function(m){typeof m=="string"&&l.d.D(m)},mn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var g=h.as,y=f(g,h.crossOrigin),k=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?l.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:y,integrity:k,fetchPriority:w}):g==="script"&&l.d.X(m,{crossOrigin:y,integrity:k,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},mn.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=f(h.as,h.crossOrigin);l.d.M(m,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&l.d.M(m)},mn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,y=f(g,h.crossOrigin);l.d.L(m,g,{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})}},mn.preloadModule=function(m,h){if(typeof m=="string")if(h){var g=f(h.as,h.crossOrigin);l.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else l.d.m(m)},mn.requestFormReset=function(m){l.d.r(m)},mn.unstable_batchedUpdates=function(m,h){return m(h)},mn.useFormState=function(m,h,g){return d.H.useFormState(m,h,g)},mn.useFormStatus=function(){return d.H.useHostTransitionStatus()},mn.version="19.2.7",mn}var ry;function pv(){if(ry)return Kf.exports;ry=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(),Kf.exports=SS(),Kf.exports}var ly;function jS(){if(ly)return ji;ly=1;var e=wS(),n=oh(),r=pv();function l(t){var a="https://react.dev/errors/"+t;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)a+="&args[]="+encodeURIComponent(arguments[s])}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 u(t){var a=t,s=t;if(t.alternate)for(;a.return;)a=a.return;else{t=a;do a=t,(a.flags&4098)!==0&&(s=a.return),t=a.return;while(t)}return a.tag===3?s: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(u(t)!==t)throw Error(l(188))}function h(t){var a=t.alternate;if(!a){if(a=u(t),a===null)throw Error(l(188));return a!==t?null:t}for(var s=t,c=a;;){var p=s.return;if(p===null)break;var v=p.alternate;if(v===null){if(c=p.return,c!==null){s=c;continue}break}if(p.child===v.child){for(v=p.child;v;){if(v===s)return m(p),t;if(v===c)return m(p),a;v=v.sibling}throw Error(l(188))}if(s.return!==c.return)s=p,c=v;else{for(var S=!1,A=p.child;A;){if(A===s){S=!0,s=p,c=v;break}if(A===c){S=!0,c=p,s=v;break}A=A.sibling}if(!S){for(A=v.child;A;){if(A===s){S=!0,s=v,c=p;break}if(A===c){S=!0,c=v,s=p;break}A=A.sibling}if(!S)throw Error(l(189))}}if(s.alternate!==c)throw Error(l(190))}if(s.tag!==3)throw Error(l(188));return s.stateNode.current===s?t:a}function g(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t;for(t=t.child;t!==null;){if(a=g(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"),N=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),L=Symbol.for("react.consumer"),_=Symbol.for("react.context"),q=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),ee=Symbol.for("react.lazy"),Z=Symbol.for("react.activity"),D=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function B(t){return t===null||typeof t!="object"?null:(t=V&&t[V]||t["@@iterator"],typeof t=="function"?t:null)}var Y=Symbol.for("react.client.reference");function ne(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Y?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case C:return"Fragment";case E:return"Profiler";case j:return"StrictMode";case H:return"Suspense";case I:return"SuspenseList";case Z:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case N:return"Portal";case _:return t.displayName||"Context";case L:return(t._context.displayName||"Context")+".Consumer";case q:var a=t.render;return t=t.displayName,t||(t=a.displayName||a.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case P:return a=t.displayName||null,a!==null?a:ne(t.type)||"Memo";case ee:a=t._payload,t=t._init;try{return ne(t(a))}catch{}}return null}var U=Array.isArray,z=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,G={pending:!1,data:null,method:null,action:null},me=[],M=-1;function R(t){return{current:t}}function O(t){0>M||(t.current=me[M],me[M]=null,M--)}function T(t,a){M++,me[M]=t.current,t.current=a}var X=R(null),ae=R(null),oe=R(null),ge=R(null);function Te(t,a){switch(T(oe,a),T(ae,t),T(X,null),a.nodeType){case 9:case 11:t=(t=a.documentElement)&&(t=t.namespaceURI)?bx(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=bx(a),t=kx(a,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}O(X),T(X,t)}function se(){O(X),O(ae),O(oe)}function pe(t){t.memoizedState!==null&&T(ge,t);var a=X.current,s=kx(a,t.type);a!==s&&(T(ae,t),T(X,s))}function be(t){ae.current===t&&(O(X),O(ae)),ge.current===t&&(O(ge),vi._currentValue=G)}var Pe,Ze;function De(t){if(Pe===void 0)try{throw Error()}catch(s){var a=s.stack.trim().match(/\n( *(at )?)/);Pe=a&&a[1]||"",Ze=-1<s.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+Pe+t+Ze}var dt=!1;function at(t,a){if(!t||dt)return"";dt=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(a){var he=function(){throw Error()};if(Object.defineProperty(he.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(he,[])}catch(le){var re=le}Reflect.construct(t,[],he)}else{try{he.call()}catch(le){re=le}t.call(he.prototype)}}else{try{throw Error()}catch(le){re=le}(he=t())&&typeof he.catch=="function"&&he.catch(function(){})}}catch(le){if(le&&re&&typeof le.stack=="string")return[le.stack,re.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var p=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");p&&p.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=c.DetermineComponentFrameRoot(),S=v[0],A=v[1];if(S&&A){var F=S.split(`
|
|
4
|
-
`),te=A.split(`
|
|
5
|
-
`);for(p=c=0;c<F.length&&!F[c].includes("DetermineComponentFrameRoot");)c++;for(;p<te.length&&!te[p].includes("DetermineComponentFrameRoot");)p++;if(c===F.length||p===te.length)for(c=F.length-1,p=te.length-1;1<=c&&0<=p&&F[c]!==te[p];)p--;for(;1<=c&&0<=p;c--,p--)if(F[c]!==te[p]){if(c!==1||p!==1)do if(c--,p--,0>p||F[c]!==te[p]){var ue=`
|
|
6
|
-
`+F[c].replace(" at new "," at ");return t.displayName&&ue.includes("<anonymous>")&&(ue=ue.replace("<anonymous>",t.displayName)),ue}while(1<=c&&0<=p);break}}}finally{dt=!1,Error.prepareStackTrace=s}return(s=t?t.displayName||t.name:"")?De(s):""}function Mt(t,a){switch(t.tag){case 26:case 27:case 5:return De(t.type);case 16:return De("Lazy");case 13:return t.child!==a&&a!==null?De("Suspense Fallback"):De("Suspense");case 19:return De("SuspenseList");case 0:case 15:return at(t.type,!1);case 11:return at(t.type.render,!1);case 1:return at(t.type,!0);case 31:return De("Activity");default:return""}}function rt(t){try{var a="",s=null;do a+=Mt(t,s),s=t,t=t.return;while(t);return a}catch(c){return`
|
|
7
|
-
Error generating stack: `+c.message+`
|
|
8
|
-
`+c.stack}}var je=Object.prototype.hasOwnProperty,qe=e.unstable_scheduleCallback,wt=e.unstable_cancelCallback,$t=e.unstable_shouldYield,At=e.unstable_requestPaint,St=e.unstable_now,ba=e.unstable_getCurrentPriorityLevel,ie=e.unstable_ImmediatePriority,ye=e.unstable_UserBlockingPriority,we=e.unstable_NormalPriority,Oe=e.unstable_LowPriority,Fe=e.unstable_IdlePriority,Ot=e.log,nn=e.unstable_setDisableYieldValue,Pt=null,gt=null;function zt(t){if(typeof Ot=="function"&&nn(t),gt&&typeof gt.setStrictMode=="function")try{gt.setStrictMode(Pt,t)}catch{}}var xe=Math.clz32?Math.clz32:ft,Ce=Math.log,tt=Math.LN2;function ft(t){return t>>>=0,t===0?32:31-(Ce(t)/tt|0)|0}var jt=256,xt=262144,Bt=4194304;function en(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 _n(t,a,s){var c=t.pendingLanes;if(c===0)return 0;var p=0,v=t.suspendedLanes,S=t.pingedLanes;t=t.warmLanes;var A=c&134217727;return A!==0?(c=A&~v,c!==0?p=en(c):(S&=A,S!==0?p=en(S):s||(s=A&~t,s!==0&&(p=en(s))))):(A=c&~v,A!==0?p=en(A):S!==0?p=en(S):s||(s=c&~t,s!==0&&(p=en(s)))),p===0?0:a!==0&&a!==p&&(a&v)===0&&(v=p&-p,s=a&-a,v>=s||v===32&&(s&4194048)!==0)?a:p}function Ya(t,a){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&a)===0}function La(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 Xn(){var t=Bt;return Bt<<=1,(Bt&62914560)===0&&(Bt=4194304),t}function Zn(t){for(var a=[],s=0;31>s;s++)a.push(t);return a}function ka(t,a){t.pendingLanes|=a,a!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function Jn(t,a,s,c,p,v){var S=t.pendingLanes;t.pendingLanes=s,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=s,t.entangledLanes&=s,t.errorRecoveryDisabledLanes&=s,t.shellSuspendCounter=0;var A=t.entanglements,F=t.expirationTimes,te=t.hiddenUpdates;for(s=S&~s;0<s;){var ue=31-xe(s),he=1<<ue;A[ue]=0,F[ue]=-1;var re=te[ue];if(re!==null)for(te[ue]=null,ue=0;ue<re.length;ue++){var le=re[ue];le!==null&&(le.lane&=-536870913)}s&=~he}c!==0&&kn(t,c,0),v!==0&&p===0&&t.tag!==0&&(t.suspendedLanes|=v&~(S&~a))}function kn(t,a,s){t.pendingLanes|=a,t.suspendedLanes&=~a;var c=31-xe(a);t.entangledLanes|=a,t.entanglements[c]=t.entanglements[c]|1073741824|s&261930}function Ia(t,a){var s=t.entangledLanes|=a;for(t=t.entanglements;s;){var c=31-xe(s),p=1<<c;p&a|t[c]&a&&(t[c]|=a),s&=~p}}function wr(t,a){var s=a&-a;return s=(s&42)!==0?1:ll(s),(s&(t.suspendedLanes|a))!==0?0:s}function ll(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 Ln(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Sr(){var t=$.p;return t!==0?t:(t=window.event,t===void 0?32:Fx(t.type))}function Qa(t,a){var s=$.p;try{return $.p=t,a()}finally{$.p=s}}var In=Math.random().toString(36).slice(2),Ht="__reactFiber$"+In,Kt="__reactProps$"+In,Oa="__reactContainer$"+In,jr="__reactEvents$"+In,_s="__reactListeners$"+In,Ls="__reactHandles$"+In,ce="__reactResources$"+In,K="__reactMarker$"+In;function de(t){delete t[Ht],delete t[Kt],delete t[jr],delete t[_s],delete t[Ls]}function Se(t){var a=t[Ht];if(a)return a;for(var s=t.parentNode;s;){if(a=s[Oa]||s[Ht]){if(s=a.alternate,a.child!==null||s!==null&&s.child!==null)for(t=Mx(t);t!==null;){if(s=t[Ht])return s;t=Mx(t)}return a}t=s,s=t.parentNode}return null}function Ee(t){if(t=t[Ht]||t[Oa]){var a=t.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return t}return null}function lt(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t.stateNode;throw Error(l(33))}function st(t){var a=t[ce];return a||(a=t[ce]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Je(t){t[K]=!0}var On=new Set,Cr={};function wa(t,a){ea(t,a),ea(t+"Capture",a)}function ea(t,a){for(Cr[t]=a,t=0;t<a.length;t++)On.add(a[t])}var Is=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]*$"),Os={},Xa={};function u2(t){return je.call(Xa,t)?!0:je.call(Os,t)?!1:Is.test(t)?Xa[t]=!0:(Os[t]=!0,!1)}function fo(t,a,s){if(u2(a))if(s===null)t.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":t.removeAttribute(a);return;case"boolean":var c=a.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){t.removeAttribute(a);return}}t.setAttribute(a,""+s)}}function mo(t,a,s){if(s===null)t.removeAttribute(a);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttribute(a,""+s)}}function Za(t,a,s,c){if(c===null)t.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(s);return}t.setAttributeNS(a,s,""+c)}}function ta(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function fp(t){var a=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function d2(t,a,s){var c=Object.getOwnPropertyDescriptor(t.constructor.prototype,a);if(!t.hasOwnProperty(a)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var p=c.get,v=c.set;return Object.defineProperty(t,a,{configurable:!0,get:function(){return p.call(this)},set:function(S){s=""+S,v.call(this,S)}}),Object.defineProperty(t,a,{enumerable:c.enumerable}),{getValue:function(){return s},setValue:function(S){s=""+S},stopTracking:function(){t._valueTracker=null,delete t[a]}}}}function Iu(t){if(!t._valueTracker){var a=fp(t)?"checked":"value";t._valueTracker=d2(t,a,""+t[a])}}function mp(t){if(!t)return!1;var a=t._valueTracker;if(!a)return!0;var s=a.getValue(),c="";return t&&(c=fp(t)?t.checked?"true":"false":t.value),t=c,t!==s?(a.setValue(t),!0):!1}function ho(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 f2=/[\n"\\]/g;function na(t){return t.replace(f2,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Ou(t,a,s,c,p,v,S,A){t.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?t.type=S:t.removeAttribute("type"),a!=null?S==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+ta(a)):t.value!==""+ta(a)&&(t.value=""+ta(a)):S!=="submit"&&S!=="reset"||t.removeAttribute("value"),a!=null?zu(t,S,ta(a)):s!=null?zu(t,S,ta(s)):c!=null&&t.removeAttribute("value"),p==null&&v!=null&&(t.defaultChecked=!!v),p!=null&&(t.checked=p&&typeof p!="function"&&typeof p!="symbol"),A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?t.name=""+ta(A):t.removeAttribute("name")}function hp(t,a,s,c,p,v,S,A){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(t.type=v),a!=null||s!=null){if(!(v!=="submit"&&v!=="reset"||a!=null)){Iu(t);return}s=s!=null?""+ta(s):"",a=a!=null?""+ta(a):s,A||a===t.value||(t.value=a),t.defaultValue=a}c=c??p,c=typeof c!="function"&&typeof c!="symbol"&&!!c,t.checked=A?t.checked:!!c,t.defaultChecked=!!c,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(t.name=S),Iu(t)}function zu(t,a,s){a==="number"&&ho(t.ownerDocument)===t||t.defaultValue===""+s||(t.defaultValue=""+s)}function Dl(t,a,s,c){if(t=t.options,a){a={};for(var p=0;p<s.length;p++)a["$"+s[p]]=!0;for(s=0;s<t.length;s++)p=a.hasOwnProperty("$"+t[s].value),t[s].selected!==p&&(t[s].selected=p),p&&c&&(t[s].defaultSelected=!0)}else{for(s=""+ta(s),a=null,p=0;p<t.length;p++){if(t[p].value===s){t[p].selected=!0,c&&(t[p].defaultSelected=!0);return}a!==null||t[p].disabled||(a=t[p])}a!==null&&(a.selected=!0)}}function pp(t,a,s){if(a!=null&&(a=""+ta(a),a!==t.value&&(t.value=a),s==null)){t.defaultValue!==a&&(t.defaultValue=a);return}t.defaultValue=s!=null?""+ta(s):""}function gp(t,a,s,c){if(a==null){if(c!=null){if(s!=null)throw Error(l(92));if(U(c)){if(1<c.length)throw Error(l(93));c=c[0]}s=c}s==null&&(s=""),a=s}s=ta(a),t.defaultValue=s,c=t.textContent,c===s&&c!==""&&c!==null&&(t.value=c),Iu(t)}function Ul(t,a){if(a){var s=t.firstChild;if(s&&s===t.lastChild&&s.nodeType===3){s.nodeValue=a;return}}t.textContent=a}var m2=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 xp(t,a,s){var c=a.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?c?t.setProperty(a,""):a==="float"?t.cssFloat="":t[a]="":c?t.setProperty(a,s):typeof s!="number"||s===0||m2.has(a)?a==="float"?t.cssFloat=s:t[a]=(""+s).trim():t[a]=s+"px"}function yp(t,a,s){if(a!=null&&typeof a!="object")throw Error(l(62));if(t=t.style,s!=null){for(var c in s)!s.hasOwnProperty(c)||a!=null&&a.hasOwnProperty(c)||(c.indexOf("--")===0?t.setProperty(c,""):c==="float"?t.cssFloat="":t[c]="");for(var p in a)c=a[p],a.hasOwnProperty(p)&&s[p]!==c&&xp(t,p,c)}else for(var v in a)a.hasOwnProperty(v)&&xp(t,v,a[v])}function Du(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 h2=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"]]),p2=/^[\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 po(t){return p2.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function Ja(){}var Uu=null;function $u(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var $l=null,Bl=null;function vp(t){var a=Ee(t);if(a&&(t=a.stateNode)){var s=t[Kt]||null;e:switch(t=a.stateNode,a.type){case"input":if(Ou(t,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),a=s.name,s.type==="radio"&&a!=null){for(s=t;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+na(""+a)+'"][type="radio"]'),a=0;a<s.length;a++){var c=s[a];if(c!==t&&c.form===t.form){var p=c[Kt]||null;if(!p)throw Error(l(90));Ou(c,p.value,p.defaultValue,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name)}}for(a=0;a<s.length;a++)c=s[a],c.form===t.form&&mp(c)}break e;case"textarea":pp(t,s.value,s.defaultValue);break e;case"select":a=s.value,a!=null&&Dl(t,!!s.multiple,a,!1)}}}var Bu=!1;function bp(t,a,s){if(Bu)return t(a,s);Bu=!0;try{var c=t(a);return c}finally{if(Bu=!1,($l!==null||Bl!==null)&&(nc(),$l&&(a=$l,t=Bl,Bl=$l=null,vp(a),t)))for(a=0;a<t.length;a++)vp(t[a])}}function zs(t,a){var s=t.stateNode;if(s===null)return null;var c=s[Kt]||null;if(c===null)return null;s=c[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":(c=!c.disabled)||(t=t.type,c=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!c;break e;default:t=!1}if(t)return null;if(s&&typeof s!="function")throw Error(l(231,a,typeof s));return s}var er=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hu=!1;if(er)try{var Ds={};Object.defineProperty(Ds,"passive",{get:function(){Hu=!0}}),window.addEventListener("test",Ds,Ds),window.removeEventListener("test",Ds,Ds)}catch{Hu=!1}var Nr=null,Pu=null,go=null;function kp(){if(go)return go;var t,a=Pu,s=a.length,c,p="value"in Nr?Nr.value:Nr.textContent,v=p.length;for(t=0;t<s&&a[t]===p[t];t++);var S=s-t;for(c=1;c<=S&&a[s-c]===p[v-c];c++);return go=p.slice(t,1<c?1-c:void 0)}function xo(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 yo(){return!0}function wp(){return!1}function wn(t){function a(s,c,p,v,S){this._reactName=s,this._targetInst=p,this.type=c,this.nativeEvent=v,this.target=S,this.currentTarget=null;for(var A in t)t.hasOwnProperty(A)&&(s=t[A],this[A]=s?s(v):v[A]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?yo:wp,this.isPropagationStopped=wp,this}return y(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=yo)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=yo)},persist:function(){},isPersistent:yo}),a}var sl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vo=wn(sl),Us=y({},sl,{view:0,detail:0}),g2=wn(Us),qu,Fu,$s,bo=y({},Us,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gu,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!==$s&&($s&&t.type==="mousemove"?(qu=t.screenX-$s.screenX,Fu=t.screenY-$s.screenY):Fu=qu=0,$s=t),qu)},movementY:function(t){return"movementY"in t?t.movementY:Fu}}),Sp=wn(bo),x2=y({},bo,{dataTransfer:0}),y2=wn(x2),v2=y({},Us,{relatedTarget:0}),Vu=wn(v2),b2=y({},sl,{animationName:0,elapsedTime:0,pseudoElement:0}),k2=wn(b2),w2=y({},sl,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),S2=wn(w2),j2=y({},sl,{data:0}),jp=wn(j2),C2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},N2={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"},T2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function M2(t){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(t):(t=T2[t])?!!a[t]:!1}function Gu(){return M2}var E2=y({},Us,{key:function(t){if(t.key){var a=C2[t.key]||t.key;if(a!=="Unidentified")return a}return t.type==="keypress"?(t=xo(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?N2[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gu,charCode:function(t){return t.type==="keypress"?xo(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?xo(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),A2=wn(E2),R2=y({},bo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Cp=wn(R2),_2=y({},Us,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gu}),L2=wn(_2),I2=y({},sl,{propertyName:0,elapsedTime:0,pseudoElement:0}),O2=wn(I2),z2=y({},bo,{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}),D2=wn(z2),U2=y({},sl,{newState:0,oldState:0}),$2=wn(U2),B2=[9,13,27,32],Ku=er&&"CompositionEvent"in window,Bs=null;er&&"documentMode"in document&&(Bs=document.documentMode);var H2=er&&"TextEvent"in window&&!Bs,Np=er&&(!Ku||Bs&&8<Bs&&11>=Bs),Tp=" ",Mp=!1;function Ep(t,a){switch(t){case"keyup":return B2.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ap(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Hl=!1;function P2(t,a){switch(t){case"compositionend":return Ap(a);case"keypress":return a.which!==32?null:(Mp=!0,Tp);case"textInput":return t=a.data,t===Tp&&Mp?null:t;default:return null}}function q2(t,a){if(Hl)return t==="compositionend"||!Ku&&Ep(t,a)?(t=kp(),go=Pu=Nr=null,Hl=!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 Np&&a.locale!=="ko"?null:a.data;default:return null}}var F2={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 Rp(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a==="input"?!!F2[t.type]:a==="textarea"}function _p(t,a,s,c){$l?Bl?Bl.push(c):Bl=[c]:$l=c,a=cc(a,"onChange"),0<a.length&&(s=new vo("onChange","change",null,s,c),t.push({event:s,listeners:a}))}var Hs=null,Ps=null;function V2(t){hx(t,0)}function ko(t){var a=lt(t);if(mp(a))return t}function Lp(t,a){if(t==="change")return a}var Ip=!1;if(er){var Wu;if(er){var Yu="oninput"in document;if(!Yu){var Op=document.createElement("div");Op.setAttribute("oninput","return;"),Yu=typeof Op.oninput=="function"}Wu=Yu}else Wu=!1;Ip=Wu&&(!document.documentMode||9<document.documentMode)}function zp(){Hs&&(Hs.detachEvent("onpropertychange",Dp),Ps=Hs=null)}function Dp(t){if(t.propertyName==="value"&&ko(Ps)){var a=[];_p(a,Ps,t,$u(t)),bp(V2,a)}}function G2(t,a,s){t==="focusin"?(zp(),Hs=a,Ps=s,Hs.attachEvent("onpropertychange",Dp)):t==="focusout"&&zp()}function K2(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return ko(Ps)}function W2(t,a){if(t==="click")return ko(a)}function Y2(t,a){if(t==="input"||t==="change")return ko(a)}function Q2(t,a){return t===a&&(t!==0||1/t===1/a)||t!==t&&a!==a}var zn=typeof Object.is=="function"?Object.is:Q2;function qs(t,a){if(zn(t,a))return!0;if(typeof t!="object"||t===null||typeof a!="object"||a===null)return!1;var s=Object.keys(t),c=Object.keys(a);if(s.length!==c.length)return!1;for(c=0;c<s.length;c++){var p=s[c];if(!je.call(a,p)||!zn(t[p],a[p]))return!1}return!0}function Up(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function $p(t,a){var s=Up(t);t=0;for(var c;s;){if(s.nodeType===3){if(c=t+s.textContent.length,t<=a&&c>=a)return{node:s,offset:a-t};t=c}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Up(s)}}function Bp(t,a){return t&&a?t===a?!0:t&&t.nodeType===3?!1:a&&a.nodeType===3?Bp(t,a.parentNode):"contains"in t?t.contains(a):t.compareDocumentPosition?!!(t.compareDocumentPosition(a)&16):!1:!1}function Hp(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var a=ho(t.document);a instanceof t.HTMLIFrameElement;){try{var s=typeof a.contentWindow.location.href=="string"}catch{s=!1}if(s)t=a.contentWindow;else break;a=ho(t.document)}return a}function Qu(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 X2=er&&"documentMode"in document&&11>=document.documentMode,Pl=null,Xu=null,Fs=null,Zu=!1;function Pp(t,a,s){var c=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;Zu||Pl==null||Pl!==ho(c)||(c=Pl,"selectionStart"in c&&Qu(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),Fs&&qs(Fs,c)||(Fs=c,c=cc(Xu,"onSelect"),0<c.length&&(a=new vo("onSelect","select",null,a,s),t.push({event:a,listeners:c}),a.target=Pl)))}function il(t,a){var s={};return s[t.toLowerCase()]=a.toLowerCase(),s["Webkit"+t]="webkit"+a,s["Moz"+t]="moz"+a,s}var ql={animationend:il("Animation","AnimationEnd"),animationiteration:il("Animation","AnimationIteration"),animationstart:il("Animation","AnimationStart"),transitionrun:il("Transition","TransitionRun"),transitionstart:il("Transition","TransitionStart"),transitioncancel:il("Transition","TransitionCancel"),transitionend:il("Transition","TransitionEnd")},Ju={},qp={};er&&(qp=document.createElement("div").style,"AnimationEvent"in window||(delete ql.animationend.animation,delete ql.animationiteration.animation,delete ql.animationstart.animation),"TransitionEvent"in window||delete ql.transitionend.transition);function ol(t){if(Ju[t])return Ju[t];if(!ql[t])return t;var a=ql[t],s;for(s in a)if(a.hasOwnProperty(s)&&s in qp)return Ju[t]=a[s];return t}var Fp=ol("animationend"),Vp=ol("animationiteration"),Gp=ol("animationstart"),Z2=ol("transitionrun"),J2=ol("transitionstart"),ew=ol("transitioncancel"),Kp=ol("transitionend"),Wp=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 Sa(t,a){Wp.set(t,a),wa(a,[t])}var wo=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)},aa=[],Fl=0,td=0;function So(){for(var t=Fl,a=td=Fl=0;a<t;){var s=aa[a];aa[a++]=null;var c=aa[a];aa[a++]=null;var p=aa[a];aa[a++]=null;var v=aa[a];if(aa[a++]=null,c!==null&&p!==null){var S=c.pending;S===null?p.next=p:(p.next=S.next,S.next=p),c.pending=p}v!==0&&Yp(s,p,v)}}function jo(t,a,s,c){aa[Fl++]=t,aa[Fl++]=a,aa[Fl++]=s,aa[Fl++]=c,td|=c,t.lanes|=c,t=t.alternate,t!==null&&(t.lanes|=c)}function nd(t,a,s,c){return jo(t,a,s,c),Co(t)}function cl(t,a){return jo(t,null,null,a),Co(t)}function Yp(t,a,s){t.lanes|=s;var c=t.alternate;c!==null&&(c.lanes|=s);for(var p=!1,v=t.return;v!==null;)v.childLanes|=s,c=v.alternate,c!==null&&(c.childLanes|=s),v.tag===22&&(t=v.stateNode,t===null||t._visibility&1||(p=!0)),t=v,v=v.return;return t.tag===3?(v=t.stateNode,p&&a!==null&&(p=31-xe(s),t=v.hiddenUpdates,c=t[p],c===null?t[p]=[a]:c.push(a),a.lane=s|536870912),v):null}function Co(t){if(50<fi)throw fi=0,ff=null,Error(l(185));for(var a=t.return;a!==null;)t=a,a=t.return;return t.tag===3?t.stateNode:null}var Vl={};function tw(t,a,s,c){this.tag=t,this.key=s,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=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Dn(t,a,s,c){return new tw(t,a,s,c)}function ad(t){return t=t.prototype,!(!t||!t.isReactComponent)}function tr(t,a){var s=t.alternate;return s===null?(s=Dn(t.tag,a,t.key,t.mode),s.elementType=t.elementType,s.type=t.type,s.stateNode=t.stateNode,s.alternate=t,t.alternate=s):(s.pendingProps=a,s.type=t.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=t.flags&65011712,s.childLanes=t.childLanes,s.lanes=t.lanes,s.child=t.child,s.memoizedProps=t.memoizedProps,s.memoizedState=t.memoizedState,s.updateQueue=t.updateQueue,a=t.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},s.sibling=t.sibling,s.index=t.index,s.ref=t.ref,s.refCleanup=t.refCleanup,s}function Qp(t,a){t.flags&=65011714;var s=t.alternate;return s===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=s.childLanes,t.lanes=s.lanes,t.child=s.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=s.memoizedProps,t.memoizedState=s.memoizedState,t.updateQueue=s.updateQueue,t.type=s.type,a=s.dependencies,t.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),t}function No(t,a,s,c,p,v){var S=0;if(c=t,typeof t=="function")ad(t)&&(S=1);else if(typeof t=="string")S=sS(t,s,X.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case Z:return t=Dn(31,s,a,p),t.elementType=Z,t.lanes=v,t;case C:return ul(s.children,p,v,a);case j:S=8,p|=24;break;case E:return t=Dn(12,s,a,p|2),t.elementType=E,t.lanes=v,t;case H:return t=Dn(13,s,a,p),t.elementType=H,t.lanes=v,t;case I:return t=Dn(19,s,a,p),t.elementType=I,t.lanes=v,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case _:S=10;break e;case L:S=9;break e;case q:S=11;break e;case P:S=14;break e;case ee:S=16,c=null;break e}S=29,s=Error(l(130,t===null?"null":typeof t,"")),c=null}return a=Dn(S,s,a,p),a.elementType=t,a.type=c,a.lanes=v,a}function ul(t,a,s,c){return t=Dn(7,t,c,a),t.lanes=s,t}function rd(t,a,s){return t=Dn(6,t,null,a),t.lanes=s,t}function Xp(t){var a=Dn(18,null,null,0);return a.stateNode=t,a}function ld(t,a,s){return a=Dn(4,t.children!==null?t.children:[],t.key,a),a.lanes=s,a.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},a}var Zp=new WeakMap;function ra(t,a){if(typeof t=="object"&&t!==null){var s=Zp.get(t);return s!==void 0?s:(a={value:t,source:a,stack:rt(a)},Zp.set(t,a),a)}return{value:t,source:a,stack:rt(a)}}var Gl=[],Kl=0,To=null,Vs=0,la=[],sa=0,Tr=null,za=1,Da="";function nr(t,a){Gl[Kl++]=Vs,Gl[Kl++]=To,To=t,Vs=a}function Jp(t,a,s){la[sa++]=za,la[sa++]=Da,la[sa++]=Tr,Tr=t;var c=za;t=Da;var p=32-xe(c)-1;c&=~(1<<p),s+=1;var v=32-xe(a)+p;if(30<v){var S=p-p%5;v=(c&(1<<S)-1).toString(32),c>>=S,p-=S,za=1<<32-xe(a)+p|s<<p|c,Da=v+t}else za=1<<v|s<<p|c,Da=t}function sd(t){t.return!==null&&(nr(t,1),Jp(t,1,0))}function id(t){for(;t===To;)To=Gl[--Kl],Gl[Kl]=null,Vs=Gl[--Kl],Gl[Kl]=null;for(;t===Tr;)Tr=la[--sa],la[sa]=null,Da=la[--sa],la[sa]=null,za=la[--sa],la[sa]=null}function e0(t,a){la[sa++]=za,la[sa++]=Da,la[sa++]=Tr,za=a.id,Da=a.overflow,Tr=t}var sn=null,Rt=null,et=!1,Mr=null,ia=!1,od=Error(l(519));function Er(t){var a=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Gs(ra(a,t)),od}function t0(t){var a=t.stateNode,s=t.type,c=t.memoizedProps;switch(a[Ht]=t,a[Kt]=c,s){case"dialog":Ke("cancel",a),Ke("close",a);break;case"iframe":case"object":case"embed":Ke("load",a);break;case"video":case"audio":for(s=0;s<hi.length;s++)Ke(hi[s],a);break;case"source":Ke("error",a);break;case"img":case"image":case"link":Ke("error",a),Ke("load",a);break;case"details":Ke("toggle",a);break;case"input":Ke("invalid",a),hp(a,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":Ke("invalid",a);break;case"textarea":Ke("invalid",a),gp(a,c.value,c.defaultValue,c.children)}s=c.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||a.textContent===""+s||c.suppressHydrationWarning===!0||yx(a.textContent,s)?(c.popover!=null&&(Ke("beforetoggle",a),Ke("toggle",a)),c.onScroll!=null&&Ke("scroll",a),c.onScrollEnd!=null&&Ke("scrollend",a),c.onClick!=null&&(a.onclick=Ja),a=!0):a=!1,a||Er(t,!0)}function n0(t){for(sn=t.return;sn;)switch(sn.tag){case 5:case 31:case 13:ia=!1;return;case 27:case 3:ia=!0;return;default:sn=sn.return}}function Wl(t){if(t!==sn)return!1;if(!et)return n0(t),et=!0,!1;var a=t.tag,s;if((s=a!==3&&a!==27)&&((s=a===5)&&(s=t.type,s=!(s!=="form"&&s!=="button")||Tf(t.type,t.memoizedProps)),s=!s),s&&Rt&&Er(t),n0(t),a===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(317));Rt=Tx(t)}else if(a===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(317));Rt=Tx(t)}else a===27?(a=Rt,qr(t.type)?(t=_f,_f=null,Rt=t):Rt=a):Rt=sn?ca(t.stateNode.nextSibling):null;return!0}function dl(){Rt=sn=null,et=!1}function cd(){var t=Mr;return t!==null&&(Nn===null?Nn=t:Nn.push.apply(Nn,t),Mr=null),t}function Gs(t){Mr===null?Mr=[t]:Mr.push(t)}var ud=R(null),fl=null,ar=null;function Ar(t,a,s){T(ud,a._currentValue),a._currentValue=s}function rr(t){t._currentValue=ud.current,O(ud)}function dd(t,a,s){for(;t!==null;){var c=t.alternate;if((t.childLanes&a)!==a?(t.childLanes|=a,c!==null&&(c.childLanes|=a)):c!==null&&(c.childLanes&a)!==a&&(c.childLanes|=a),t===s)break;t=t.return}}function fd(t,a,s,c){var p=t.child;for(p!==null&&(p.return=t);p!==null;){var v=p.dependencies;if(v!==null){var S=p.child;v=v.firstContext;e:for(;v!==null;){var A=v;v=p;for(var F=0;F<a.length;F++)if(A.context===a[F]){v.lanes|=s,A=v.alternate,A!==null&&(A.lanes|=s),dd(v.return,s,t),c||(S=null);break e}v=A.next}}else if(p.tag===18){if(S=p.return,S===null)throw Error(l(341));S.lanes|=s,v=S.alternate,v!==null&&(v.lanes|=s),dd(S,s,t),S=null}else S=p.child;if(S!==null)S.return=p;else for(S=p;S!==null;){if(S===t){S=null;break}if(p=S.sibling,p!==null){p.return=S.return,S=p;break}S=S.return}p=S}}function Yl(t,a,s,c){t=null;for(var p=a,v=!1;p!==null;){if(!v){if((p.flags&524288)!==0)v=!0;else if((p.flags&262144)!==0)break}if(p.tag===10){var S=p.alternate;if(S===null)throw Error(l(387));if(S=S.memoizedProps,S!==null){var A=p.type;zn(p.pendingProps.value,S.value)||(t!==null?t.push(A):t=[A])}}else if(p===ge.current){if(S=p.alternate,S===null)throw Error(l(387));S.memoizedState.memoizedState!==p.memoizedState.memoizedState&&(t!==null?t.push(vi):t=[vi])}p=p.return}t!==null&&fd(a,t,s,c),a.flags|=262144}function Mo(t){for(t=t.firstContext;t!==null;){if(!zn(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function ml(t){fl=t,ar=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function on(t){return a0(fl,t)}function Eo(t,a){return fl===null&&ml(t),a0(t,a)}function a0(t,a){var s=a._currentValue;if(a={context:a,memoizedValue:s,next:null},ar===null){if(t===null)throw Error(l(308));ar=a,t.dependencies={lanes:0,firstContext:a},t.flags|=524288}else ar=ar.next=a;return s}var nw=typeof AbortController<"u"?AbortController:function(){var t=[],a=this.signal={aborted:!1,addEventListener:function(s,c){t.push(c)}};this.abort=function(){a.aborted=!0,t.forEach(function(s){return s()})}},aw=e.unstable_scheduleCallback,rw=e.unstable_NormalPriority,Wt={$$typeof:_,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function md(){return{controller:new nw,data:new Map,refCount:0}}function Ks(t){t.refCount--,t.refCount===0&&aw(rw,function(){t.controller.abort()})}var Ws=null,hd=0,Ql=0,Xl=null;function lw(t,a){if(Ws===null){var s=Ws=[];hd=0,Ql=yf(),Xl={status:"pending",value:void 0,then:function(c){s.push(c)}}}return hd++,a.then(r0,r0),a}function r0(){if(--hd===0&&Ws!==null){Xl!==null&&(Xl.status="fulfilled");var t=Ws;Ws=null,Ql=0,Xl=null;for(var a=0;a<t.length;a++)(0,t[a])()}}function sw(t,a){var s=[],c={status:"pending",value:null,reason:null,then:function(p){s.push(p)}};return t.then(function(){c.status="fulfilled",c.value=a;for(var p=0;p<s.length;p++)(0,s[p])(a)},function(p){for(c.status="rejected",c.reason=p,p=0;p<s.length;p++)(0,s[p])(void 0)}),c}var l0=z.S;z.S=function(t,a){Pg=St(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&lw(t,a),l0!==null&&l0(t,a)};var hl=R(null);function pd(){var t=hl.current;return t!==null?t:Ct.pooledCache}function Ao(t,a){a===null?T(hl,hl.current):T(hl,a.pool)}function s0(){var t=pd();return t===null?null:{parent:Wt._currentValue,pool:t}}var Zl=Error(l(460)),gd=Error(l(474)),Ro=Error(l(542)),_o={then:function(){}};function i0(t){return t=t.status,t==="fulfilled"||t==="rejected"}function o0(t,a,s){switch(s=t[s],s===void 0?t.push(a):s!==a&&(a.then(Ja,Ja),a=s),a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,u0(t),t;default:if(typeof a.status=="string")a.then(Ja,Ja);else{if(t=Ct,t!==null&&100<t.shellSuspendCounter)throw Error(l(482));t=a,t.status="pending",t.then(function(c){if(a.status==="pending"){var p=a;p.status="fulfilled",p.value=c}},function(c){if(a.status==="pending"){var p=a;p.status="rejected",p.reason=c}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,u0(t),t}throw gl=a,Zl}}function pl(t){try{var a=t._init;return a(t._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(gl=s,Zl):s}}var gl=null;function c0(){if(gl===null)throw Error(l(459));var t=gl;return gl=null,t}function u0(t){if(t===Zl||t===Ro)throw Error(l(483))}var Jl=null,Ys=0;function Lo(t){var a=Ys;return Ys+=1,Jl===null&&(Jl=[]),o0(Jl,t,a)}function Qs(t,a){a=a.props.ref,t.ref=a!==void 0?a:null}function Io(t,a){throw a.$$typeof===k?Error(l(525)):(t=Object.prototype.toString.call(a),Error(l(31,t==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":t)))}function d0(t){function a(Q,W){if(t){var J=Q.deletions;J===null?(Q.deletions=[W],Q.flags|=16):J.push(W)}}function s(Q,W){if(!t)return null;for(;W!==null;)a(Q,W),W=W.sibling;return null}function c(Q){for(var W=new Map;Q!==null;)Q.key!==null?W.set(Q.key,Q):W.set(Q.index,Q),Q=Q.sibling;return W}function p(Q,W){return Q=tr(Q,W),Q.index=0,Q.sibling=null,Q}function v(Q,W,J){return Q.index=J,t?(J=Q.alternate,J!==null?(J=J.index,J<W?(Q.flags|=67108866,W):J):(Q.flags|=67108866,W)):(Q.flags|=1048576,W)}function S(Q){return t&&Q.alternate===null&&(Q.flags|=67108866),Q}function A(Q,W,J,fe){return W===null||W.tag!==6?(W=rd(J,Q.mode,fe),W.return=Q,W):(W=p(W,J),W.return=Q,W)}function F(Q,W,J,fe){var Re=J.type;return Re===C?ue(Q,W,J.props.children,fe,J.key):W!==null&&(W.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===ee&&pl(Re)===W.type)?(W=p(W,J.props),Qs(W,J),W.return=Q,W):(W=No(J.type,J.key,J.props,null,Q.mode,fe),Qs(W,J),W.return=Q,W)}function te(Q,W,J,fe){return W===null||W.tag!==4||W.stateNode.containerInfo!==J.containerInfo||W.stateNode.implementation!==J.implementation?(W=ld(J,Q.mode,fe),W.return=Q,W):(W=p(W,J.children||[]),W.return=Q,W)}function ue(Q,W,J,fe,Re){return W===null||W.tag!==7?(W=ul(J,Q.mode,fe,Re),W.return=Q,W):(W=p(W,J),W.return=Q,W)}function he(Q,W,J){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return W=rd(""+W,Q.mode,J),W.return=Q,W;if(typeof W=="object"&&W!==null){switch(W.$$typeof){case w:return J=No(W.type,W.key,W.props,null,Q.mode,J),Qs(J,W),J.return=Q,J;case N:return W=ld(W,Q.mode,J),W.return=Q,W;case ee:return W=pl(W),he(Q,W,J)}if(U(W)||B(W))return W=ul(W,Q.mode,J,null),W.return=Q,W;if(typeof W.then=="function")return he(Q,Lo(W),J);if(W.$$typeof===_)return he(Q,Eo(Q,W),J);Io(Q,W)}return null}function re(Q,W,J,fe){var Re=W!==null?W.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Re!==null?null:A(Q,W,""+J,fe);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case w:return J.key===Re?F(Q,W,J,fe):null;case N:return J.key===Re?te(Q,W,J,fe):null;case ee:return J=pl(J),re(Q,W,J,fe)}if(U(J)||B(J))return Re!==null?null:ue(Q,W,J,fe,null);if(typeof J.then=="function")return re(Q,W,Lo(J),fe);if(J.$$typeof===_)return re(Q,W,Eo(Q,J),fe);Io(Q,J)}return null}function le(Q,W,J,fe,Re){if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return Q=Q.get(J)||null,A(W,Q,""+fe,Re);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case w:return Q=Q.get(fe.key===null?J:fe.key)||null,F(W,Q,fe,Re);case N:return Q=Q.get(fe.key===null?J:fe.key)||null,te(W,Q,fe,Re);case ee:return fe=pl(fe),le(Q,W,J,fe,Re)}if(U(fe)||B(fe))return Q=Q.get(J)||null,ue(W,Q,fe,Re,null);if(typeof fe.then=="function")return le(Q,W,J,Lo(fe),Re);if(fe.$$typeof===_)return le(Q,W,J,Eo(W,fe),Re);Io(W,fe)}return null}function Ne(Q,W,J,fe){for(var Re=null,it=null,Me=W,He=W=0,Qe=null;Me!==null&&He<J.length;He++){Me.index>He?(Qe=Me,Me=null):Qe=Me.sibling;var ot=re(Q,Me,J[He],fe);if(ot===null){Me===null&&(Me=Qe);break}t&&Me&&ot.alternate===null&&a(Q,Me),W=v(ot,W,He),it===null?Re=ot:it.sibling=ot,it=ot,Me=Qe}if(He===J.length)return s(Q,Me),et&&nr(Q,He),Re;if(Me===null){for(;He<J.length;He++)Me=he(Q,J[He],fe),Me!==null&&(W=v(Me,W,He),it===null?Re=Me:it.sibling=Me,it=Me);return et&&nr(Q,He),Re}for(Me=c(Me);He<J.length;He++)Qe=le(Me,Q,He,J[He],fe),Qe!==null&&(t&&Qe.alternate!==null&&Me.delete(Qe.key===null?He:Qe.key),W=v(Qe,W,He),it===null?Re=Qe:it.sibling=Qe,it=Qe);return t&&Me.forEach(function(Wr){return a(Q,Wr)}),et&&nr(Q,He),Re}function Ie(Q,W,J,fe){if(J==null)throw Error(l(151));for(var Re=null,it=null,Me=W,He=W=0,Qe=null,ot=J.next();Me!==null&&!ot.done;He++,ot=J.next()){Me.index>He?(Qe=Me,Me=null):Qe=Me.sibling;var Wr=re(Q,Me,ot.value,fe);if(Wr===null){Me===null&&(Me=Qe);break}t&&Me&&Wr.alternate===null&&a(Q,Me),W=v(Wr,W,He),it===null?Re=Wr:it.sibling=Wr,it=Wr,Me=Qe}if(ot.done)return s(Q,Me),et&&nr(Q,He),Re;if(Me===null){for(;!ot.done;He++,ot=J.next())ot=he(Q,ot.value,fe),ot!==null&&(W=v(ot,W,He),it===null?Re=ot:it.sibling=ot,it=ot);return et&&nr(Q,He),Re}for(Me=c(Me);!ot.done;He++,ot=J.next())ot=le(Me,Q,He,ot.value,fe),ot!==null&&(t&&ot.alternate!==null&&Me.delete(ot.key===null?He:ot.key),W=v(ot,W,He),it===null?Re=ot:it.sibling=ot,it=ot);return t&&Me.forEach(function(xS){return a(Q,xS)}),et&&nr(Q,He),Re}function bt(Q,W,J,fe){if(typeof J=="object"&&J!==null&&J.type===C&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case w:e:{for(var Re=J.key;W!==null;){if(W.key===Re){if(Re=J.type,Re===C){if(W.tag===7){s(Q,W.sibling),fe=p(W,J.props.children),fe.return=Q,Q=fe;break e}}else if(W.elementType===Re||typeof Re=="object"&&Re!==null&&Re.$$typeof===ee&&pl(Re)===W.type){s(Q,W.sibling),fe=p(W,J.props),Qs(fe,J),fe.return=Q,Q=fe;break e}s(Q,W);break}else a(Q,W);W=W.sibling}J.type===C?(fe=ul(J.props.children,Q.mode,fe,J.key),fe.return=Q,Q=fe):(fe=No(J.type,J.key,J.props,null,Q.mode,fe),Qs(fe,J),fe.return=Q,Q=fe)}return S(Q);case N:e:{for(Re=J.key;W!==null;){if(W.key===Re)if(W.tag===4&&W.stateNode.containerInfo===J.containerInfo&&W.stateNode.implementation===J.implementation){s(Q,W.sibling),fe=p(W,J.children||[]),fe.return=Q,Q=fe;break e}else{s(Q,W);break}else a(Q,W);W=W.sibling}fe=ld(J,Q.mode,fe),fe.return=Q,Q=fe}return S(Q);case ee:return J=pl(J),bt(Q,W,J,fe)}if(U(J))return Ne(Q,W,J,fe);if(B(J)){if(Re=B(J),typeof Re!="function")throw Error(l(150));return J=Re.call(J),Ie(Q,W,J,fe)}if(typeof J.then=="function")return bt(Q,W,Lo(J),fe);if(J.$$typeof===_)return bt(Q,W,Eo(Q,J),fe);Io(Q,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,W!==null&&W.tag===6?(s(Q,W.sibling),fe=p(W,J),fe.return=Q,Q=fe):(s(Q,W),fe=rd(J,Q.mode,fe),fe.return=Q,Q=fe),S(Q)):s(Q,W)}return function(Q,W,J,fe){try{Ys=0;var Re=bt(Q,W,J,fe);return Jl=null,Re}catch(Me){if(Me===Zl||Me===Ro)throw Me;var it=Dn(29,Me,null,Q.mode);return it.lanes=fe,it.return=Q,it}}}var xl=d0(!0),f0=d0(!1),Rr=!1;function xd(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function yd(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 _r(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Lr(t,a,s){var c=t.updateQueue;if(c===null)return null;if(c=c.shared,(ct&2)!==0){var p=c.pending;return p===null?a.next=a:(a.next=p.next,p.next=a),c.pending=a,a=Co(t),Yp(t,null,s),a}return jo(t,c,a,s),Co(t)}function Xs(t,a,s){if(a=a.updateQueue,a!==null&&(a=a.shared,(s&4194048)!==0)){var c=a.lanes;c&=t.pendingLanes,s|=c,a.lanes=s,Ia(t,s)}}function vd(t,a){var s=t.updateQueue,c=t.alternate;if(c!==null&&(c=c.updateQueue,s===c)){var p=null,v=null;if(s=s.firstBaseUpdate,s!==null){do{var S={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};v===null?p=v=S:v=v.next=S,s=s.next}while(s!==null);v===null?p=v=a:v=v.next=a}else p=v=a;s={baseState:c.baseState,firstBaseUpdate:p,lastBaseUpdate:v,shared:c.shared,callbacks:c.callbacks},t.updateQueue=s;return}t=s.lastBaseUpdate,t===null?s.firstBaseUpdate=a:t.next=a,s.lastBaseUpdate=a}var bd=!1;function Zs(){if(bd){var t=Xl;if(t!==null)throw t}}function Js(t,a,s,c){bd=!1;var p=t.updateQueue;Rr=!1;var v=p.firstBaseUpdate,S=p.lastBaseUpdate,A=p.shared.pending;if(A!==null){p.shared.pending=null;var F=A,te=F.next;F.next=null,S===null?v=te:S.next=te,S=F;var ue=t.alternate;ue!==null&&(ue=ue.updateQueue,A=ue.lastBaseUpdate,A!==S&&(A===null?ue.firstBaseUpdate=te:A.next=te,ue.lastBaseUpdate=F))}if(v!==null){var he=p.baseState;S=0,ue=te=F=null,A=v;do{var re=A.lane&-536870913,le=re!==A.lane;if(le?(Ye&re)===re:(c&re)===re){re!==0&&re===Ql&&(bd=!0),ue!==null&&(ue=ue.next={lane:0,tag:A.tag,payload:A.payload,callback:null,next:null});e:{var Ne=t,Ie=A;re=a;var bt=s;switch(Ie.tag){case 1:if(Ne=Ie.payload,typeof Ne=="function"){he=Ne.call(bt,he,re);break e}he=Ne;break e;case 3:Ne.flags=Ne.flags&-65537|128;case 0:if(Ne=Ie.payload,re=typeof Ne=="function"?Ne.call(bt,he,re):Ne,re==null)break e;he=y({},he,re);break e;case 2:Rr=!0}}re=A.callback,re!==null&&(t.flags|=64,le&&(t.flags|=8192),le=p.callbacks,le===null?p.callbacks=[re]:le.push(re))}else le={lane:re,tag:A.tag,payload:A.payload,callback:A.callback,next:null},ue===null?(te=ue=le,F=he):ue=ue.next=le,S|=re;if(A=A.next,A===null){if(A=p.shared.pending,A===null)break;le=A,A=le.next,le.next=null,p.lastBaseUpdate=le,p.shared.pending=null}}while(!0);ue===null&&(F=he),p.baseState=F,p.firstBaseUpdate=te,p.lastBaseUpdate=ue,v===null&&(p.shared.lanes=0),Ur|=S,t.lanes=S,t.memoizedState=he}}function m0(t,a){if(typeof t!="function")throw Error(l(191,t));t.call(a)}function h0(t,a){var s=t.callbacks;if(s!==null)for(t.callbacks=null,t=0;t<s.length;t++)m0(s[t],a)}var es=R(null),Oo=R(0);function p0(t,a){t=mr,T(Oo,t),T(es,a),mr=t|a.baseLanes}function kd(){T(Oo,mr),T(es,es.current)}function wd(){mr=Oo.current,O(es),O(Oo)}var Un=R(null),oa=null;function Ir(t){var a=t.alternate;T(Vt,Vt.current&1),T(Un,t),oa===null&&(a===null||es.current!==null||a.memoizedState!==null)&&(oa=t)}function Sd(t){T(Vt,Vt.current),T(Un,t),oa===null&&(oa=t)}function g0(t){t.tag===22?(T(Vt,Vt.current),T(Un,t),oa===null&&(oa=t)):Or()}function Or(){T(Vt,Vt.current),T(Un,Un.current)}function $n(t){O(Un),oa===t&&(oa=null),O(Vt)}var Vt=R(0);function zo(t){for(var a=t;a!==null;){if(a.tag===13){var s=a.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||Af(s)||Rf(s)))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 lr=0,Be=null,yt=null,Yt=null,Do=!1,ts=!1,yl=!1,Uo=0,ei=0,ns=null,iw=0;function qt(){throw Error(l(321))}function jd(t,a){if(a===null)return!1;for(var s=0;s<a.length&&s<t.length;s++)if(!zn(t[s],a[s]))return!1;return!0}function Cd(t,a,s,c,p,v){return lr=v,Be=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,z.H=t===null||t.memoizedState===null?J0:Bd,yl=!1,v=s(c,p),yl=!1,ts&&(v=y0(a,s,c,p)),x0(t),v}function x0(t){z.H=ai;var a=yt!==null&&yt.next!==null;if(lr=0,Yt=yt=Be=null,Do=!1,ei=0,ns=null,a)throw Error(l(300));t===null||Qt||(t=t.dependencies,t!==null&&Mo(t)&&(Qt=!0))}function y0(t,a,s,c){Be=t;var p=0;do{if(ts&&(ns=null),ei=0,ts=!1,25<=p)throw Error(l(301));if(p+=1,Yt=yt=null,t.updateQueue!=null){var v=t.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}z.H=eg,v=a(s,c)}while(ts);return v}function ow(){var t=z.H,a=t.useState()[0];return a=typeof a.then=="function"?ti(a):a,t=t.useState()[0],(yt!==null?yt.memoizedState:null)!==t&&(Be.flags|=1024),a}function Nd(){var t=Uo!==0;return Uo=0,t}function Td(t,a,s){a.updateQueue=t.updateQueue,a.flags&=-2053,t.lanes&=~s}function Md(t){if(Do){for(t=t.memoizedState;t!==null;){var a=t.queue;a!==null&&(a.pending=null),t=t.next}Do=!1}lr=0,Yt=yt=Be=null,ts=!1,ei=Uo=0,ns=null}function yn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Yt===null?Be.memoizedState=Yt=t:Yt=Yt.next=t,Yt}function Gt(){if(yt===null){var t=Be.alternate;t=t!==null?t.memoizedState:null}else t=yt.next;var a=Yt===null?Be.memoizedState:Yt.next;if(a!==null)Yt=a,yt=t;else{if(t===null)throw Be.alternate===null?Error(l(467)):Error(l(310));yt=t,t={memoizedState:yt.memoizedState,baseState:yt.baseState,baseQueue:yt.baseQueue,queue:yt.queue,next:null},Yt===null?Be.memoizedState=Yt=t:Yt=Yt.next=t}return Yt}function $o(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ti(t){var a=ei;return ei+=1,ns===null&&(ns=[]),t=o0(ns,t,a),a=Be,(Yt===null?a.memoizedState:Yt.next)===null&&(a=a.alternate,z.H=a===null||a.memoizedState===null?J0:Bd),t}function Bo(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return ti(t);if(t.$$typeof===_)return on(t)}throw Error(l(438,String(t)))}function Ed(t){var a=null,s=Be.updateQueue;if(s!==null&&(a=s.memoCache),a==null){var c=Be.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(a={data:c.data.map(function(p){return p.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),s===null&&(s=$o(),Be.updateQueue=s),s.memoCache=a,s=a.data[a.index],s===void 0)for(s=a.data[a.index]=Array(t),c=0;c<t;c++)s[c]=D;return a.index++,s}function sr(t,a){return typeof a=="function"?a(t):a}function Ho(t){var a=Gt();return Ad(a,yt,t)}function Ad(t,a,s){var c=t.queue;if(c===null)throw Error(l(311));c.lastRenderedReducer=s;var p=t.baseQueue,v=c.pending;if(v!==null){if(p!==null){var S=p.next;p.next=v.next,v.next=S}a.baseQueue=p=v,c.pending=null}if(v=t.baseState,p===null)t.memoizedState=v;else{a=p.next;var A=S=null,F=null,te=a,ue=!1;do{var he=te.lane&-536870913;if(he!==te.lane?(Ye&he)===he:(lr&he)===he){var re=te.revertLane;if(re===0)F!==null&&(F=F.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),he===Ql&&(ue=!0);else if((lr&re)===re){te=te.next,re===Ql&&(ue=!0);continue}else he={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},F===null?(A=F=he,S=v):F=F.next=he,Be.lanes|=re,Ur|=re;he=te.action,yl&&s(v,he),v=te.hasEagerState?te.eagerState:s(v,he)}else re={lane:he,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},F===null?(A=F=re,S=v):F=F.next=re,Be.lanes|=he,Ur|=he;te=te.next}while(te!==null&&te!==a);if(F===null?S=v:F.next=A,!zn(v,t.memoizedState)&&(Qt=!0,ue&&(s=Xl,s!==null)))throw s;t.memoizedState=v,t.baseState=S,t.baseQueue=F,c.lastRenderedState=v}return p===null&&(c.lanes=0),[t.memoizedState,c.dispatch]}function Rd(t){var a=Gt(),s=a.queue;if(s===null)throw Error(l(311));s.lastRenderedReducer=t;var c=s.dispatch,p=s.pending,v=a.memoizedState;if(p!==null){s.pending=null;var S=p=p.next;do v=t(v,S.action),S=S.next;while(S!==p);zn(v,a.memoizedState)||(Qt=!0),a.memoizedState=v,a.baseQueue===null&&(a.baseState=v),s.lastRenderedState=v}return[v,c]}function v0(t,a,s){var c=Be,p=Gt(),v=et;if(v){if(s===void 0)throw Error(l(407));s=s()}else s=a();var S=!zn((yt||p).memoizedState,s);if(S&&(p.memoizedState=s,Qt=!0),p=p.queue,Id(w0.bind(null,c,p,t),[t]),p.getSnapshot!==a||S||Yt!==null&&Yt.memoizedState.tag&1){if(c.flags|=2048,as(9,{destroy:void 0},k0.bind(null,c,p,s,a),null),Ct===null)throw Error(l(349));v||(lr&127)!==0||b0(c,a,s)}return s}function b0(t,a,s){t.flags|=16384,t={getSnapshot:a,value:s},a=Be.updateQueue,a===null?(a=$o(),Be.updateQueue=a,a.stores=[t]):(s=a.stores,s===null?a.stores=[t]:s.push(t))}function k0(t,a,s,c){a.value=s,a.getSnapshot=c,S0(a)&&j0(t)}function w0(t,a,s){return s(function(){S0(a)&&j0(t)})}function S0(t){var a=t.getSnapshot;t=t.value;try{var s=a();return!zn(t,s)}catch{return!0}}function j0(t){var a=cl(t,2);a!==null&&Tn(a,t,2)}function _d(t){var a=yn();if(typeof t=="function"){var s=t;if(t=s(),yl){zt(!0);try{s()}finally{zt(!1)}}}return a.memoizedState=a.baseState=t,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sr,lastRenderedState:t},a}function C0(t,a,s,c){return t.baseState=s,Ad(t,yt,typeof c=="function"?c:sr)}function cw(t,a,s,c,p){if(Fo(t))throw Error(l(485));if(t=a.action,t!==null){var v={payload:p,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){v.listeners.push(S)}};z.T!==null?s(!0):v.isTransition=!1,c(v),s=a.pending,s===null?(v.next=a.pending=v,N0(a,v)):(v.next=s.next,a.pending=s.next=v)}}function N0(t,a){var s=a.action,c=a.payload,p=t.state;if(a.isTransition){var v=z.T,S={};z.T=S;try{var A=s(p,c),F=z.S;F!==null&&F(S,A),T0(t,a,A)}catch(te){Ld(t,a,te)}finally{v!==null&&S.types!==null&&(v.types=S.types),z.T=v}}else try{v=s(p,c),T0(t,a,v)}catch(te){Ld(t,a,te)}}function T0(t,a,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(c){M0(t,a,c)},function(c){return Ld(t,a,c)}):M0(t,a,s)}function M0(t,a,s){a.status="fulfilled",a.value=s,E0(a),t.state=s,a=t.pending,a!==null&&(s=a.next,s===a?t.pending=null:(s=s.next,a.next=s,N0(t,s)))}function Ld(t,a,s){var c=t.pending;if(t.pending=null,c!==null){c=c.next;do a.status="rejected",a.reason=s,E0(a),a=a.next;while(a!==c)}t.action=null}function E0(t){t=t.listeners;for(var a=0;a<t.length;a++)(0,t[a])()}function A0(t,a){return a}function R0(t,a){if(et){var s=Ct.formState;if(s!==null){e:{var c=Be;if(et){if(Rt){t:{for(var p=Rt,v=ia;p.nodeType!==8;){if(!v){p=null;break t}if(p=ca(p.nextSibling),p===null){p=null;break t}}v=p.data,p=v==="F!"||v==="F"?p:null}if(p){Rt=ca(p.nextSibling),c=p.data==="F!";break e}}Er(c)}c=!1}c&&(a=s[0])}}return s=yn(),s.memoizedState=s.baseState=a,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:A0,lastRenderedState:a},s.queue=c,s=Q0.bind(null,Be,c),c.dispatch=s,c=_d(!1),v=$d.bind(null,Be,!1,c.queue),c=yn(),p={state:a,dispatch:null,action:t,pending:null},c.queue=p,s=cw.bind(null,Be,p,v,s),p.dispatch=s,c.memoizedState=t,[a,s,!1]}function _0(t){var a=Gt();return L0(a,yt,t)}function L0(t,a,s){if(a=Ad(t,a,A0)[0],t=Ho(sr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var c=ti(a)}catch(S){throw S===Zl?Ro:S}else c=a;a=Gt();var p=a.queue,v=p.dispatch;return s!==a.memoizedState&&(Be.flags|=2048,as(9,{destroy:void 0},uw.bind(null,p,s),null)),[c,v,t]}function uw(t,a){t.action=a}function I0(t){var a=Gt(),s=yt;if(s!==null)return L0(a,s,t);Gt(),a=a.memoizedState,s=Gt();var c=s.queue.dispatch;return s.memoizedState=t,[a,c,!1]}function as(t,a,s,c){return t={tag:t,create:s,deps:c,inst:a,next:null},a=Be.updateQueue,a===null&&(a=$o(),Be.updateQueue=a),s=a.lastEffect,s===null?a.lastEffect=t.next=t:(c=s.next,s.next=t,t.next=c,a.lastEffect=t),t}function O0(){return Gt().memoizedState}function Po(t,a,s,c){var p=yn();Be.flags|=t,p.memoizedState=as(1|a,{destroy:void 0},s,c===void 0?null:c)}function qo(t,a,s,c){var p=Gt();c=c===void 0?null:c;var v=p.memoizedState.inst;yt!==null&&c!==null&&jd(c,yt.memoizedState.deps)?p.memoizedState=as(a,v,s,c):(Be.flags|=t,p.memoizedState=as(1|a,v,s,c))}function z0(t,a){Po(8390656,8,t,a)}function Id(t,a){qo(2048,8,t,a)}function dw(t){Be.flags|=4;var a=Be.updateQueue;if(a===null)a=$o(),Be.updateQueue=a,a.events=[t];else{var s=a.events;s===null?a.events=[t]:s.push(t)}}function D0(t){var a=Gt().memoizedState;return dw({ref:a,nextImpl:t}),function(){if((ct&2)!==0)throw Error(l(440));return a.impl.apply(void 0,arguments)}}function U0(t,a){return qo(4,2,t,a)}function $0(t,a){return qo(4,4,t,a)}function B0(t,a){if(typeof a=="function"){t=t();var s=a(t);return function(){typeof s=="function"?s():a(null)}}if(a!=null)return t=t(),a.current=t,function(){a.current=null}}function H0(t,a,s){s=s!=null?s.concat([t]):null,qo(4,4,B0.bind(null,a,t),s)}function Od(){}function P0(t,a){var s=Gt();a=a===void 0?null:a;var c=s.memoizedState;return a!==null&&jd(a,c[1])?c[0]:(s.memoizedState=[t,a],t)}function q0(t,a){var s=Gt();a=a===void 0?null:a;var c=s.memoizedState;if(a!==null&&jd(a,c[1]))return c[0];if(c=t(),yl){zt(!0);try{t()}finally{zt(!1)}}return s.memoizedState=[c,a],c}function zd(t,a,s){return s===void 0||(lr&1073741824)!==0&&(Ye&261930)===0?t.memoizedState=a:(t.memoizedState=s,t=Fg(),Be.lanes|=t,Ur|=t,s)}function F0(t,a,s,c){return zn(s,a)?s:es.current!==null?(t=zd(t,s,c),zn(t,a)||(Qt=!0),t):(lr&42)===0||(lr&1073741824)!==0&&(Ye&261930)===0?(Qt=!0,t.memoizedState=s):(t=Fg(),Be.lanes|=t,Ur|=t,a)}function V0(t,a,s,c,p){var v=$.p;$.p=v!==0&&8>v?v:8;var S=z.T,A={};z.T=A,$d(t,!1,a,s);try{var F=p(),te=z.S;if(te!==null&&te(A,F),F!==null&&typeof F=="object"&&typeof F.then=="function"){var ue=sw(F,c);ni(t,a,ue,Pn(t))}else ni(t,a,c,Pn(t))}catch(he){ni(t,a,{then:function(){},status:"rejected",reason:he},Pn())}finally{$.p=v,S!==null&&A.types!==null&&(S.types=A.types),z.T=S}}function fw(){}function Dd(t,a,s,c){if(t.tag!==5)throw Error(l(476));var p=G0(t).queue;V0(t,p,a,G,s===null?fw:function(){return K0(t),s(c)})}function G0(t){var a=t.memoizedState;if(a!==null)return a;a={memoizedState:G,baseState:G,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sr,lastRenderedState:G},next:null};var s={};return a.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:sr,lastRenderedState:s},next:null},t.memoizedState=a,t=t.alternate,t!==null&&(t.memoizedState=a),a}function K0(t){var a=G0(t);a.next===null&&(a=t.alternate.memoizedState),ni(t,a.next.queue,{},Pn())}function Ud(){return on(vi)}function W0(){return Gt().memoizedState}function Y0(){return Gt().memoizedState}function mw(t){for(var a=t.return;a!==null;){switch(a.tag){case 24:case 3:var s=Pn();t=_r(s);var c=Lr(a,t,s);c!==null&&(Tn(c,a,s),Xs(c,a,s)),a={cache:md()},t.payload=a;return}a=a.return}}function hw(t,a,s){var c=Pn();s={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},Fo(t)?X0(a,s):(s=nd(t,a,s,c),s!==null&&(Tn(s,t,c),Z0(s,a,c)))}function Q0(t,a,s){var c=Pn();ni(t,a,s,c)}function ni(t,a,s,c){var p={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(Fo(t))X0(a,p);else{var v=t.alternate;if(t.lanes===0&&(v===null||v.lanes===0)&&(v=a.lastRenderedReducer,v!==null))try{var S=a.lastRenderedState,A=v(S,s);if(p.hasEagerState=!0,p.eagerState=A,zn(A,S))return jo(t,a,p,0),Ct===null&&So(),!1}catch{}if(s=nd(t,a,p,c),s!==null)return Tn(s,t,c),Z0(s,a,c),!0}return!1}function $d(t,a,s,c){if(c={lane:2,revertLane:yf(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Fo(t)){if(a)throw Error(l(479))}else a=nd(t,s,c,2),a!==null&&Tn(a,t,2)}function Fo(t){var a=t.alternate;return t===Be||a!==null&&a===Be}function X0(t,a){ts=Do=!0;var s=t.pending;s===null?a.next=a:(a.next=s.next,s.next=a),t.pending=a}function Z0(t,a,s){if((s&4194048)!==0){var c=a.lanes;c&=t.pendingLanes,s|=c,a.lanes=s,Ia(t,s)}}var ai={readContext:on,use:Bo,useCallback:qt,useContext:qt,useEffect:qt,useImperativeHandle:qt,useLayoutEffect:qt,useInsertionEffect:qt,useMemo:qt,useReducer:qt,useRef:qt,useState:qt,useDebugValue:qt,useDeferredValue:qt,useTransition:qt,useSyncExternalStore:qt,useId:qt,useHostTransitionStatus:qt,useFormState:qt,useActionState:qt,useOptimistic:qt,useMemoCache:qt,useCacheRefresh:qt};ai.useEffectEvent=qt;var J0={readContext:on,use:Bo,useCallback:function(t,a){return yn().memoizedState=[t,a===void 0?null:a],t},useContext:on,useEffect:z0,useImperativeHandle:function(t,a,s){s=s!=null?s.concat([t]):null,Po(4194308,4,B0.bind(null,a,t),s)},useLayoutEffect:function(t,a){return Po(4194308,4,t,a)},useInsertionEffect:function(t,a){Po(4,2,t,a)},useMemo:function(t,a){var s=yn();a=a===void 0?null:a;var c=t();if(yl){zt(!0);try{t()}finally{zt(!1)}}return s.memoizedState=[c,a],c},useReducer:function(t,a,s){var c=yn();if(s!==void 0){var p=s(a);if(yl){zt(!0);try{s(a)}finally{zt(!1)}}}else p=a;return c.memoizedState=c.baseState=p,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:p},c.queue=t,t=t.dispatch=hw.bind(null,Be,t),[c.memoizedState,t]},useRef:function(t){var a=yn();return t={current:t},a.memoizedState=t},useState:function(t){t=_d(t);var a=t.queue,s=Q0.bind(null,Be,a);return a.dispatch=s,[t.memoizedState,s]},useDebugValue:Od,useDeferredValue:function(t,a){var s=yn();return zd(s,t,a)},useTransition:function(){var t=_d(!1);return t=V0.bind(null,Be,t.queue,!0,!1),yn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,a,s){var c=Be,p=yn();if(et){if(s===void 0)throw Error(l(407));s=s()}else{if(s=a(),Ct===null)throw Error(l(349));(Ye&127)!==0||b0(c,a,s)}p.memoizedState=s;var v={value:s,getSnapshot:a};return p.queue=v,z0(w0.bind(null,c,v,t),[t]),c.flags|=2048,as(9,{destroy:void 0},k0.bind(null,c,v,s,a),null),s},useId:function(){var t=yn(),a=Ct.identifierPrefix;if(et){var s=Da,c=za;s=(c&~(1<<32-xe(c)-1)).toString(32)+s,a="_"+a+"R_"+s,s=Uo++,0<s&&(a+="H"+s.toString(32)),a+="_"}else s=iw++,a="_"+a+"r_"+s.toString(32)+"_";return t.memoizedState=a},useHostTransitionStatus:Ud,useFormState:R0,useActionState:R0,useOptimistic:function(t){var a=yn();a.memoizedState=a.baseState=t;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=s,a=$d.bind(null,Be,!0,s),s.dispatch=a,[t,a]},useMemoCache:Ed,useCacheRefresh:function(){return yn().memoizedState=mw.bind(null,Be)},useEffectEvent:function(t){var a=yn(),s={impl:t};return a.memoizedState=s,function(){if((ct&2)!==0)throw Error(l(440));return s.impl.apply(void 0,arguments)}}},Bd={readContext:on,use:Bo,useCallback:P0,useContext:on,useEffect:Id,useImperativeHandle:H0,useInsertionEffect:U0,useLayoutEffect:$0,useMemo:q0,useReducer:Ho,useRef:O0,useState:function(){return Ho(sr)},useDebugValue:Od,useDeferredValue:function(t,a){var s=Gt();return F0(s,yt.memoizedState,t,a)},useTransition:function(){var t=Ho(sr)[0],a=Gt().memoizedState;return[typeof t=="boolean"?t:ti(t),a]},useSyncExternalStore:v0,useId:W0,useHostTransitionStatus:Ud,useFormState:_0,useActionState:_0,useOptimistic:function(t,a){var s=Gt();return C0(s,yt,t,a)},useMemoCache:Ed,useCacheRefresh:Y0};Bd.useEffectEvent=D0;var eg={readContext:on,use:Bo,useCallback:P0,useContext:on,useEffect:Id,useImperativeHandle:H0,useInsertionEffect:U0,useLayoutEffect:$0,useMemo:q0,useReducer:Rd,useRef:O0,useState:function(){return Rd(sr)},useDebugValue:Od,useDeferredValue:function(t,a){var s=Gt();return yt===null?zd(s,t,a):F0(s,yt.memoizedState,t,a)},useTransition:function(){var t=Rd(sr)[0],a=Gt().memoizedState;return[typeof t=="boolean"?t:ti(t),a]},useSyncExternalStore:v0,useId:W0,useHostTransitionStatus:Ud,useFormState:I0,useActionState:I0,useOptimistic:function(t,a){var s=Gt();return yt!==null?C0(s,yt,t,a):(s.baseState=t,[t,s.queue.dispatch])},useMemoCache:Ed,useCacheRefresh:Y0};eg.useEffectEvent=D0;function Hd(t,a,s,c){a=t.memoizedState,s=s(c,a),s=s==null?a:y({},a,s),t.memoizedState=s,t.lanes===0&&(t.updateQueue.baseState=s)}var Pd={enqueueSetState:function(t,a,s){t=t._reactInternals;var c=Pn(),p=_r(c);p.payload=a,s!=null&&(p.callback=s),a=Lr(t,p,c),a!==null&&(Tn(a,t,c),Xs(a,t,c))},enqueueReplaceState:function(t,a,s){t=t._reactInternals;var c=Pn(),p=_r(c);p.tag=1,p.payload=a,s!=null&&(p.callback=s),a=Lr(t,p,c),a!==null&&(Tn(a,t,c),Xs(a,t,c))},enqueueForceUpdate:function(t,a){t=t._reactInternals;var s=Pn(),c=_r(s);c.tag=2,a!=null&&(c.callback=a),a=Lr(t,c,s),a!==null&&(Tn(a,t,s),Xs(a,t,s))}};function tg(t,a,s,c,p,v,S){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(c,v,S):a.prototype&&a.prototype.isPureReactComponent?!qs(s,c)||!qs(p,v):!0}function ng(t,a,s,c){t=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(s,c),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(s,c),a.state!==t&&Pd.enqueueReplaceState(a,a.state,null)}function vl(t,a){var s=a;if("ref"in a){s={};for(var c in a)c!=="ref"&&(s[c]=a[c])}if(t=t.defaultProps){s===a&&(s=y({},s));for(var p in t)s[p]===void 0&&(s[p]=t[p])}return s}function ag(t){wo(t)}function rg(t){console.error(t)}function lg(t){wo(t)}function Vo(t,a){try{var s=t.onUncaughtError;s(a.value,{componentStack:a.stack})}catch(c){setTimeout(function(){throw c})}}function sg(t,a,s){try{var c=t.onCaughtError;c(s.value,{componentStack:s.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(p){setTimeout(function(){throw p})}}function qd(t,a,s){return s=_r(s),s.tag=3,s.payload={element:null},s.callback=function(){Vo(t,a)},s}function ig(t){return t=_r(t),t.tag=3,t}function og(t,a,s,c){var p=s.type.getDerivedStateFromError;if(typeof p=="function"){var v=c.value;t.payload=function(){return p(v)},t.callback=function(){sg(a,s,c)}}var S=s.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(t.callback=function(){sg(a,s,c),typeof p!="function"&&($r===null?$r=new Set([this]):$r.add(this));var A=c.stack;this.componentDidCatch(c.value,{componentStack:A!==null?A:""})})}function pw(t,a,s,c,p){if(s.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(a=s.alternate,a!==null&&Yl(a,s,p,!0),s=Un.current,s!==null){switch(s.tag){case 31:case 13:return oa===null?ac():s.alternate===null&&Ft===0&&(Ft=3),s.flags&=-257,s.flags|=65536,s.lanes=p,c===_o?s.flags|=16384:(a=s.updateQueue,a===null?s.updateQueue=new Set([c]):a.add(c),pf(t,c,p)),!1;case 22:return s.flags|=65536,c===_o?s.flags|=16384:(a=s.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([c])},s.updateQueue=a):(s=a.retryQueue,s===null?a.retryQueue=new Set([c]):s.add(c)),pf(t,c,p)),!1}throw Error(l(435,s.tag))}return pf(t,c,p),ac(),!1}if(et)return a=Un.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=p,c!==od&&(t=Error(l(422),{cause:c}),Gs(ra(t,s)))):(c!==od&&(a=Error(l(423),{cause:c}),Gs(ra(a,s))),t=t.current.alternate,t.flags|=65536,p&=-p,t.lanes|=p,c=ra(c,s),p=qd(t.stateNode,c,p),vd(t,p),Ft!==4&&(Ft=2)),!1;var v=Error(l(520),{cause:c});if(v=ra(v,s),di===null?di=[v]:di.push(v),Ft!==4&&(Ft=2),a===null)return!0;c=ra(c,s),s=a;do{switch(s.tag){case 3:return s.flags|=65536,t=p&-p,s.lanes|=t,t=qd(s.stateNode,c,t),vd(s,t),!1;case 1:if(a=s.type,v=s.stateNode,(s.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&($r===null||!$r.has(v))))return s.flags|=65536,p&=-p,s.lanes|=p,p=ig(p),og(p,t,s,c),vd(s,p),!1}s=s.return}while(s!==null);return!1}var Fd=Error(l(461)),Qt=!1;function cn(t,a,s,c){a.child=t===null?f0(a,null,s,c):xl(a,t.child,s,c)}function cg(t,a,s,c,p){s=s.render;var v=a.ref;if("ref"in c){var S={};for(var A in c)A!=="ref"&&(S[A]=c[A])}else S=c;return ml(a),c=Cd(t,a,s,S,v,p),A=Nd(),t!==null&&!Qt?(Td(t,a,p),ir(t,a,p)):(et&&A&&sd(a),a.flags|=1,cn(t,a,c,p),a.child)}function ug(t,a,s,c,p){if(t===null){var v=s.type;return typeof v=="function"&&!ad(v)&&v.defaultProps===void 0&&s.compare===null?(a.tag=15,a.type=v,dg(t,a,v,c,p)):(t=No(s.type,null,c,a,a.mode,p),t.ref=a.ref,t.return=a,a.child=t)}if(v=t.child,!Zd(t,p)){var S=v.memoizedProps;if(s=s.compare,s=s!==null?s:qs,s(S,c)&&t.ref===a.ref)return ir(t,a,p)}return a.flags|=1,t=tr(v,c),t.ref=a.ref,t.return=a,a.child=t}function dg(t,a,s,c,p){if(t!==null){var v=t.memoizedProps;if(qs(v,c)&&t.ref===a.ref)if(Qt=!1,a.pendingProps=c=v,Zd(t,p))(t.flags&131072)!==0&&(Qt=!0);else return a.lanes=t.lanes,ir(t,a,p)}return Vd(t,a,s,c,p)}function fg(t,a,s,c){var p=c.children,v=t!==null?t.memoizedState:null;if(t===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((a.flags&128)!==0){if(v=v!==null?v.baseLanes|s:s,t!==null){for(c=a.child=t.child,p=0;c!==null;)p=p|c.lanes|c.childLanes,c=c.sibling;c=p&~v}else c=0,a.child=null;return mg(t,a,v,s,c)}if((s&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},t!==null&&Ao(a,v!==null?v.cachePool:null),v!==null?p0(a,v):kd(),g0(a);else return c=a.lanes=536870912,mg(t,a,v!==null?v.baseLanes|s:s,s,c)}else v!==null?(Ao(a,v.cachePool),p0(a,v),Or(),a.memoizedState=null):(t!==null&&Ao(a,null),kd(),Or());return cn(t,a,p,s),a.child}function ri(t,a){return t!==null&&t.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function mg(t,a,s,c,p){var v=pd();return v=v===null?null:{parent:Wt._currentValue,pool:v},a.memoizedState={baseLanes:s,cachePool:v},t!==null&&Ao(a,null),kd(),g0(a),t!==null&&Yl(t,a,c,!0),a.childLanes=p,null}function Go(t,a){return a=Wo({mode:a.mode,children:a.children},t.mode),a.ref=t.ref,t.child=a,a.return=t,a}function hg(t,a,s){return xl(a,t.child,null,s),t=Go(a,a.pendingProps),t.flags|=2,$n(a),a.memoizedState=null,t}function gw(t,a,s){var c=a.pendingProps,p=(a.flags&128)!==0;if(a.flags&=-129,t===null){if(et){if(c.mode==="hidden")return t=Go(a,c),a.lanes=536870912,ri(null,t);if(Sd(a),(t=Rt)?(t=Nx(t,ia),t=t!==null&&t.data==="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:Tr!==null?{id:za,overflow:Da}:null,retryLane:536870912,hydrationErrors:null},s=Xp(t),s.return=a,a.child=s,sn=a,Rt=null)):t=null,t===null)throw Er(a);return a.lanes=536870912,null}return Go(a,c)}var v=t.memoizedState;if(v!==null){var S=v.dehydrated;if(Sd(a),p)if(a.flags&256)a.flags&=-257,a=hg(t,a,s);else if(a.memoizedState!==null)a.child=t.child,a.flags|=128,a=null;else throw Error(l(558));else if(Qt||Yl(t,a,s,!1),p=(s&t.childLanes)!==0,Qt||p){if(c=Ct,c!==null&&(S=wr(c,s),S!==0&&S!==v.retryLane))throw v.retryLane=S,cl(t,S),Tn(c,t,S),Fd;ac(),a=hg(t,a,s)}else t=v.treeContext,Rt=ca(S.nextSibling),sn=a,et=!0,Mr=null,ia=!1,t!==null&&e0(a,t),a=Go(a,c),a.flags|=4096;return a}return t=tr(t.child,{mode:c.mode,children:c.children}),t.ref=a.ref,a.child=t,t.return=a,t}function Ko(t,a){var s=a.ref;if(s===null)t!==null&&t.ref!==null&&(a.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(l(284));(t===null||t.ref!==s)&&(a.flags|=4194816)}}function Vd(t,a,s,c,p){return ml(a),s=Cd(t,a,s,c,void 0,p),c=Nd(),t!==null&&!Qt?(Td(t,a,p),ir(t,a,p)):(et&&c&&sd(a),a.flags|=1,cn(t,a,s,p),a.child)}function pg(t,a,s,c,p,v){return ml(a),a.updateQueue=null,s=y0(a,c,s,p),x0(t),c=Nd(),t!==null&&!Qt?(Td(t,a,v),ir(t,a,v)):(et&&c&&sd(a),a.flags|=1,cn(t,a,s,v),a.child)}function gg(t,a,s,c,p){if(ml(a),a.stateNode===null){var v=Vl,S=s.contextType;typeof S=="object"&&S!==null&&(v=on(S)),v=new s(c,v),a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Pd,a.stateNode=v,v._reactInternals=a,v=a.stateNode,v.props=c,v.state=a.memoizedState,v.refs={},xd(a),S=s.contextType,v.context=typeof S=="object"&&S!==null?on(S):Vl,v.state=a.memoizedState,S=s.getDerivedStateFromProps,typeof S=="function"&&(Hd(a,s,S,c),v.state=a.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(S=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),S!==v.state&&Pd.enqueueReplaceState(v,v.state,null),Js(a,c,v,p),Zs(),v.state=a.memoizedState),typeof v.componentDidMount=="function"&&(a.flags|=4194308),c=!0}else if(t===null){v=a.stateNode;var A=a.memoizedProps,F=vl(s,A);v.props=F;var te=v.context,ue=s.contextType;S=Vl,typeof ue=="object"&&ue!==null&&(S=on(ue));var he=s.getDerivedStateFromProps;ue=typeof he=="function"||typeof v.getSnapshotBeforeUpdate=="function",A=a.pendingProps!==A,ue||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(A||te!==S)&&ng(a,v,c,S),Rr=!1;var re=a.memoizedState;v.state=re,Js(a,c,v,p),Zs(),te=a.memoizedState,A||re!==te||Rr?(typeof he=="function"&&(Hd(a,s,he,c),te=a.memoizedState),(F=Rr||tg(a,s,F,c,re,te,S))?(ue||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(a.flags|=4194308)):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=c,a.memoizedState=te),v.props=c,v.state=te,v.context=S,c=F):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),c=!1)}else{v=a.stateNode,yd(t,a),S=a.memoizedProps,ue=vl(s,S),v.props=ue,he=a.pendingProps,re=v.context,te=s.contextType,F=Vl,typeof te=="object"&&te!==null&&(F=on(te)),A=s.getDerivedStateFromProps,(te=typeof A=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(S!==he||re!==F)&&ng(a,v,c,F),Rr=!1,re=a.memoizedState,v.state=re,Js(a,c,v,p),Zs();var le=a.memoizedState;S!==he||re!==le||Rr||t!==null&&t.dependencies!==null&&Mo(t.dependencies)?(typeof A=="function"&&(Hd(a,s,A,c),le=a.memoizedState),(ue=Rr||tg(a,s,ue,c,re,le,F)||t!==null&&t.dependencies!==null&&Mo(t.dependencies))?(te||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(c,le,F),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(c,le,F)),typeof v.componentDidUpdate=="function"&&(a.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof v.componentDidUpdate!="function"||S===t.memoizedProps&&re===t.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===t.memoizedProps&&re===t.memoizedState||(a.flags|=1024),a.memoizedProps=c,a.memoizedState=le),v.props=c,v.state=le,v.context=F,c=ue):(typeof v.componentDidUpdate!="function"||S===t.memoizedProps&&re===t.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===t.memoizedProps&&re===t.memoizedState||(a.flags|=1024),c=!1)}return v=c,Ko(t,a),c=(a.flags&128)!==0,v||c?(v=a.stateNode,s=c&&typeof s.getDerivedStateFromError!="function"?null:v.render(),a.flags|=1,t!==null&&c?(a.child=xl(a,t.child,null,p),a.child=xl(a,null,s,p)):cn(t,a,s,p),a.memoizedState=v.state,t=a.child):t=ir(t,a,p),t}function xg(t,a,s,c){return dl(),a.flags|=256,cn(t,a,s,c),a.child}var Gd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Kd(t){return{baseLanes:t,cachePool:s0()}}function Wd(t,a,s){return t=t!==null?t.childLanes&~s:0,a&&(t|=Hn),t}function yg(t,a,s){var c=a.pendingProps,p=!1,v=(a.flags&128)!==0,S;if((S=v)||(S=t!==null&&t.memoizedState===null?!1:(Vt.current&2)!==0),S&&(p=!0,a.flags&=-129),S=(a.flags&32)!==0,a.flags&=-33,t===null){if(et){if(p?Ir(a):Or(),(t=Rt)?(t=Nx(t,ia),t=t!==null&&t.data!=="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:Tr!==null?{id:za,overflow:Da}:null,retryLane:536870912,hydrationErrors:null},s=Xp(t),s.return=a,a.child=s,sn=a,Rt=null)):t=null,t===null)throw Er(a);return Rf(t)?a.lanes=32:a.lanes=536870912,null}var A=c.children;return c=c.fallback,p?(Or(),p=a.mode,A=Wo({mode:"hidden",children:A},p),c=ul(c,p,s,null),A.return=a,c.return=a,A.sibling=c,a.child=A,c=a.child,c.memoizedState=Kd(s),c.childLanes=Wd(t,S,s),a.memoizedState=Gd,ri(null,c)):(Ir(a),Yd(a,A))}var F=t.memoizedState;if(F!==null&&(A=F.dehydrated,A!==null)){if(v)a.flags&256?(Ir(a),a.flags&=-257,a=Qd(t,a,s)):a.memoizedState!==null?(Or(),a.child=t.child,a.flags|=128,a=null):(Or(),A=c.fallback,p=a.mode,c=Wo({mode:"visible",children:c.children},p),A=ul(A,p,s,null),A.flags|=2,c.return=a,A.return=a,c.sibling=A,a.child=c,xl(a,t.child,null,s),c=a.child,c.memoizedState=Kd(s),c.childLanes=Wd(t,S,s),a.memoizedState=Gd,a=ri(null,c));else if(Ir(a),Rf(A)){if(S=A.nextSibling&&A.nextSibling.dataset,S)var te=S.dgst;S=te,c=Error(l(419)),c.stack="",c.digest=S,Gs({value:c,source:null,stack:null}),a=Qd(t,a,s)}else if(Qt||Yl(t,a,s,!1),S=(s&t.childLanes)!==0,Qt||S){if(S=Ct,S!==null&&(c=wr(S,s),c!==0&&c!==F.retryLane))throw F.retryLane=c,cl(t,c),Tn(S,t,c),Fd;Af(A)||ac(),a=Qd(t,a,s)}else Af(A)?(a.flags|=192,a.child=t.child,a=null):(t=F.treeContext,Rt=ca(A.nextSibling),sn=a,et=!0,Mr=null,ia=!1,t!==null&&e0(a,t),a=Yd(a,c.children),a.flags|=4096);return a}return p?(Or(),A=c.fallback,p=a.mode,F=t.child,te=F.sibling,c=tr(F,{mode:"hidden",children:c.children}),c.subtreeFlags=F.subtreeFlags&65011712,te!==null?A=tr(te,A):(A=ul(A,p,s,null),A.flags|=2),A.return=a,c.return=a,c.sibling=A,a.child=c,ri(null,c),c=a.child,A=t.child.memoizedState,A===null?A=Kd(s):(p=A.cachePool,p!==null?(F=Wt._currentValue,p=p.parent!==F?{parent:F,pool:F}:p):p=s0(),A={baseLanes:A.baseLanes|s,cachePool:p}),c.memoizedState=A,c.childLanes=Wd(t,S,s),a.memoizedState=Gd,ri(t.child,c)):(Ir(a),s=t.child,t=s.sibling,s=tr(s,{mode:"visible",children:c.children}),s.return=a,s.sibling=null,t!==null&&(S=a.deletions,S===null?(a.deletions=[t],a.flags|=16):S.push(t)),a.child=s,a.memoizedState=null,s)}function Yd(t,a){return a=Wo({mode:"visible",children:a},t.mode),a.return=t,t.child=a}function Wo(t,a){return t=Dn(22,t,null,a),t.lanes=0,t}function Qd(t,a,s){return xl(a,t.child,null,s),t=Yd(a,a.pendingProps.children),t.flags|=2,a.memoizedState=null,t}function vg(t,a,s){t.lanes|=a;var c=t.alternate;c!==null&&(c.lanes|=a),dd(t.return,a,s)}function Xd(t,a,s,c,p,v){var S=t.memoizedState;S===null?t.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:c,tail:s,tailMode:p,treeForkCount:v}:(S.isBackwards=a,S.rendering=null,S.renderingStartTime=0,S.last=c,S.tail=s,S.tailMode=p,S.treeForkCount=v)}function bg(t,a,s){var c=a.pendingProps,p=c.revealOrder,v=c.tail;c=c.children;var S=Vt.current,A=(S&2)!==0;if(A?(S=S&1|2,a.flags|=128):S&=1,T(Vt,S),cn(t,a,c,s),c=et?Vs:0,!A&&t!==null&&(t.flags&128)!==0)e:for(t=a.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&vg(t,s,a);else if(t.tag===19)vg(t,s,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(p){case"forwards":for(s=a.child,p=null;s!==null;)t=s.alternate,t!==null&&zo(t)===null&&(p=s),s=s.sibling;s=p,s===null?(p=a.child,a.child=null):(p=s.sibling,s.sibling=null),Xd(a,!1,p,s,v,c);break;case"backwards":case"unstable_legacy-backwards":for(s=null,p=a.child,a.child=null;p!==null;){if(t=p.alternate,t!==null&&zo(t)===null){a.child=p;break}t=p.sibling,p.sibling=s,s=p,p=t}Xd(a,!0,s,null,v,c);break;case"together":Xd(a,!1,null,null,void 0,c);break;default:a.memoizedState=null}return a.child}function ir(t,a,s){if(t!==null&&(a.dependencies=t.dependencies),Ur|=a.lanes,(s&a.childLanes)===0)if(t!==null){if(Yl(t,a,s,!1),(s&a.childLanes)===0)return null}else return null;if(t!==null&&a.child!==t.child)throw Error(l(153));if(a.child!==null){for(t=a.child,s=tr(t,t.pendingProps),a.child=s,s.return=a;t.sibling!==null;)t=t.sibling,s=s.sibling=tr(t,t.pendingProps),s.return=a;s.sibling=null}return a.child}function Zd(t,a){return(t.lanes&a)!==0?!0:(t=t.dependencies,!!(t!==null&&Mo(t)))}function xw(t,a,s){switch(a.tag){case 3:Te(a,a.stateNode.containerInfo),Ar(a,Wt,t.memoizedState.cache),dl();break;case 27:case 5:pe(a);break;case 4:Te(a,a.stateNode.containerInfo);break;case 10:Ar(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Sd(a),null;break;case 13:var c=a.memoizedState;if(c!==null)return c.dehydrated!==null?(Ir(a),a.flags|=128,null):(s&a.child.childLanes)!==0?yg(t,a,s):(Ir(a),t=ir(t,a,s),t!==null?t.sibling:null);Ir(a);break;case 19:var p=(t.flags&128)!==0;if(c=(s&a.childLanes)!==0,c||(Yl(t,a,s,!1),c=(s&a.childLanes)!==0),p){if(c)return bg(t,a,s);a.flags|=128}if(p=a.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),T(Vt,Vt.current),c)break;return null;case 22:return a.lanes=0,fg(t,a,s,a.pendingProps);case 24:Ar(a,Wt,t.memoizedState.cache)}return ir(t,a,s)}function kg(t,a,s){if(t!==null)if(t.memoizedProps!==a.pendingProps)Qt=!0;else{if(!Zd(t,s)&&(a.flags&128)===0)return Qt=!1,xw(t,a,s);Qt=(t.flags&131072)!==0}else Qt=!1,et&&(a.flags&1048576)!==0&&Jp(a,Vs,a.index);switch(a.lanes=0,a.tag){case 16:e:{var c=a.pendingProps;if(t=pl(a.elementType),a.type=t,typeof t=="function")ad(t)?(c=vl(t,c),a.tag=1,a=gg(null,a,t,c,s)):(a.tag=0,a=Vd(null,a,t,c,s));else{if(t!=null){var p=t.$$typeof;if(p===q){a.tag=11,a=cg(null,a,t,c,s);break e}else if(p===P){a.tag=14,a=ug(null,a,t,c,s);break e}}throw a=ne(t)||t,Error(l(306,a,""))}}return a;case 0:return Vd(t,a,a.type,a.pendingProps,s);case 1:return c=a.type,p=vl(c,a.pendingProps),gg(t,a,c,p,s);case 3:e:{if(Te(a,a.stateNode.containerInfo),t===null)throw Error(l(387));c=a.pendingProps;var v=a.memoizedState;p=v.element,yd(t,a),Js(a,c,null,s);var S=a.memoizedState;if(c=S.cache,Ar(a,Wt,c),c!==v.cache&&fd(a,[Wt],s,!0),Zs(),c=S.element,v.isDehydrated)if(v={element:c,isDehydrated:!1,cache:S.cache},a.updateQueue.baseState=v,a.memoizedState=v,a.flags&256){a=xg(t,a,c,s);break e}else if(c!==p){p=ra(Error(l(424)),a),Gs(p),a=xg(t,a,c,s);break e}else for(t=a.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,Rt=ca(t.firstChild),sn=a,et=!0,Mr=null,ia=!0,s=f0(a,null,c,s),a.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(dl(),c===p){a=ir(t,a,s);break e}cn(t,a,c,s)}a=a.child}return a;case 26:return Ko(t,a),t===null?(s=_x(a.type,null,a.pendingProps,null))?a.memoizedState=s:et||(s=a.type,t=a.pendingProps,c=uc(oe.current).createElement(s),c[Ht]=a,c[Kt]=t,un(c,s,t),Je(c),a.stateNode=c):a.memoizedState=_x(a.type,t.memoizedProps,a.pendingProps,t.memoizedState),null;case 27:return pe(a),t===null&&et&&(c=a.stateNode=Ex(a.type,a.pendingProps,oe.current),sn=a,ia=!0,p=Rt,qr(a.type)?(_f=p,Rt=ca(c.firstChild)):Rt=p),cn(t,a,a.pendingProps.children,s),Ko(t,a),t===null&&(a.flags|=4194304),a.child;case 5:return t===null&&et&&((p=c=Rt)&&(c=Kw(c,a.type,a.pendingProps,ia),c!==null?(a.stateNode=c,sn=a,Rt=ca(c.firstChild),ia=!1,p=!0):p=!1),p||Er(a)),pe(a),p=a.type,v=a.pendingProps,S=t!==null?t.memoizedProps:null,c=v.children,Tf(p,v)?c=null:S!==null&&Tf(p,S)&&(a.flags|=32),a.memoizedState!==null&&(p=Cd(t,a,ow,null,null,s),vi._currentValue=p),Ko(t,a),cn(t,a,c,s),a.child;case 6:return t===null&&et&&((t=s=Rt)&&(s=Ww(s,a.pendingProps,ia),s!==null?(a.stateNode=s,sn=a,Rt=null,t=!0):t=!1),t||Er(a)),null;case 13:return yg(t,a,s);case 4:return Te(a,a.stateNode.containerInfo),c=a.pendingProps,t===null?a.child=xl(a,null,c,s):cn(t,a,c,s),a.child;case 11:return cg(t,a,a.type,a.pendingProps,s);case 7:return cn(t,a,a.pendingProps,s),a.child;case 8:return cn(t,a,a.pendingProps.children,s),a.child;case 12:return cn(t,a,a.pendingProps.children,s),a.child;case 10:return c=a.pendingProps,Ar(a,a.type,c.value),cn(t,a,c.children,s),a.child;case 9:return p=a.type._context,c=a.pendingProps.children,ml(a),p=on(p),c=c(p),a.flags|=1,cn(t,a,c,s),a.child;case 14:return ug(t,a,a.type,a.pendingProps,s);case 15:return dg(t,a,a.type,a.pendingProps,s);case 19:return bg(t,a,s);case 31:return gw(t,a,s);case 22:return fg(t,a,s,a.pendingProps);case 24:return ml(a),c=on(Wt),t===null?(p=pd(),p===null&&(p=Ct,v=md(),p.pooledCache=v,v.refCount++,v!==null&&(p.pooledCacheLanes|=s),p=v),a.memoizedState={parent:c,cache:p},xd(a),Ar(a,Wt,p)):((t.lanes&s)!==0&&(yd(t,a),Js(a,null,null,s),Zs()),p=t.memoizedState,v=a.memoizedState,p.parent!==c?(p={parent:c,cache:c},a.memoizedState=p,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=p),Ar(a,Wt,c)):(c=v.cache,Ar(a,Wt,c),c!==p.cache&&fd(a,[Wt],s,!0))),cn(t,a,a.pendingProps.children,s),a.child;case 29:throw a.pendingProps}throw Error(l(156,a.tag))}function or(t){t.flags|=4}function Jd(t,a,s,c,p){if((a=(t.mode&32)!==0)&&(a=!1),a){if(t.flags|=16777216,(p&335544128)===p)if(t.stateNode.complete)t.flags|=8192;else if(Wg())t.flags|=8192;else throw gl=_o,gd}else t.flags&=-16777217}function wg(t,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!Dx(a))if(Wg())t.flags|=8192;else throw gl=_o,gd}function Yo(t,a){a!==null&&(t.flags|=4),t.flags&16384&&(a=t.tag!==22?Xn():536870912,t.lanes|=a,is|=a)}function li(t,a){if(!et)switch(t.tailMode){case"hidden":a=t.tail;for(var s=null;a!==null;)a.alternate!==null&&(s=a),a=a.sibling;s===null?t.tail=null:s.sibling=null;break;case"collapsed":s=t.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?a||t.tail===null?t.tail=null:t.tail.sibling=null:c.sibling=null}}function _t(t){var a=t.alternate!==null&&t.alternate.child===t.child,s=0,c=0;if(a)for(var p=t.child;p!==null;)s|=p.lanes|p.childLanes,c|=p.subtreeFlags&65011712,c|=p.flags&65011712,p.return=t,p=p.sibling;else for(p=t.child;p!==null;)s|=p.lanes|p.childLanes,c|=p.subtreeFlags,c|=p.flags,p.return=t,p=p.sibling;return t.subtreeFlags|=c,t.childLanes=s,a}function yw(t,a,s){var c=a.pendingProps;switch(id(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(a),null;case 1:return _t(a),null;case 3:return s=a.stateNode,c=null,t!==null&&(c=t.memoizedState.cache),a.memoizedState.cache!==c&&(a.flags|=2048),rr(Wt),se(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(t===null||t.child===null)&&(Wl(a)?or(a):t===null||t.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,cd())),_t(a),null;case 26:var p=a.type,v=a.memoizedState;return t===null?(or(a),v!==null?(_t(a),wg(a,v)):(_t(a),Jd(a,p,null,c,s))):v?v!==t.memoizedState?(or(a),_t(a),wg(a,v)):(_t(a),a.flags&=-16777217):(t=t.memoizedProps,t!==c&&or(a),_t(a),Jd(a,p,t,c,s)),null;case 27:if(be(a),s=oe.current,p=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==c&&or(a);else{if(!c){if(a.stateNode===null)throw Error(l(166));return _t(a),null}t=X.current,Wl(a)?t0(a):(t=Ex(p,c,s),a.stateNode=t,or(a))}return _t(a),null;case 5:if(be(a),p=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==c&&or(a);else{if(!c){if(a.stateNode===null)throw Error(l(166));return _t(a),null}if(v=X.current,Wl(a))t0(a);else{var S=uc(oe.current);switch(v){case 1:v=S.createElementNS("http://www.w3.org/2000/svg",p);break;case 2:v=S.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;default:switch(p){case"svg":v=S.createElementNS("http://www.w3.org/2000/svg",p);break;case"math":v=S.createElementNS("http://www.w3.org/1998/Math/MathML",p);break;case"script":v=S.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof c.is=="string"?S.createElement("select",{is:c.is}):S.createElement("select"),c.multiple?v.multiple=!0:c.size&&(v.size=c.size);break;default:v=typeof c.is=="string"?S.createElement(p,{is:c.is}):S.createElement(p)}}v[Ht]=a,v[Kt]=c;e:for(S=a.child;S!==null;){if(S.tag===5||S.tag===6)v.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===a)break e;for(;S.sibling===null;){if(S.return===null||S.return===a)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}a.stateNode=v;e:switch(un(v,p,c),p){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&or(a)}}return _t(a),Jd(a,a.type,t===null?null:t.memoizedProps,a.pendingProps,s),null;case 6:if(t&&a.stateNode!=null)t.memoizedProps!==c&&or(a);else{if(typeof c!="string"&&a.stateNode===null)throw Error(l(166));if(t=oe.current,Wl(a)){if(t=a.stateNode,s=a.memoizedProps,c=null,p=sn,p!==null)switch(p.tag){case 27:case 5:c=p.memoizedProps}t[Ht]=a,t=!!(t.nodeValue===s||c!==null&&c.suppressHydrationWarning===!0||yx(t.nodeValue,s)),t||Er(a,!0)}else t=uc(t).createTextNode(c),t[Ht]=a,a.stateNode=t}return _t(a),null;case 31:if(s=a.memoizedState,t===null||t.memoizedState!==null){if(c=Wl(a),s!==null){if(t===null){if(!c)throw Error(l(318));if(t=a.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(l(557));t[Ht]=a}else dl(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;_t(a),t=!1}else s=cd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=s),t=!0;if(!t)return a.flags&256?($n(a),a):($n(a),null);if((a.flags&128)!==0)throw Error(l(558))}return _t(a),null;case 13:if(c=a.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(p=Wl(a),c!==null&&c.dehydrated!==null){if(t===null){if(!p)throw Error(l(318));if(p=a.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(l(317));p[Ht]=a}else dl(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;_t(a),p=!1}else p=cd(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=p),p=!0;if(!p)return a.flags&256?($n(a),a):($n(a),null)}return $n(a),(a.flags&128)!==0?(a.lanes=s,a):(s=c!==null,t=t!==null&&t.memoizedState!==null,s&&(c=a.child,p=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(p=c.alternate.memoizedState.cachePool.pool),v=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(v=c.memoizedState.cachePool.pool),v!==p&&(c.flags|=2048)),s!==t&&s&&(a.child.flags|=8192),Yo(a,a.updateQueue),_t(a),null);case 4:return se(),t===null&&wf(a.stateNode.containerInfo),_t(a),null;case 10:return rr(a.type),_t(a),null;case 19:if(O(Vt),c=a.memoizedState,c===null)return _t(a),null;if(p=(a.flags&128)!==0,v=c.rendering,v===null)if(p)li(c,!1);else{if(Ft!==0||t!==null&&(t.flags&128)!==0)for(t=a.child;t!==null;){if(v=zo(t),v!==null){for(a.flags|=128,li(c,!1),t=v.updateQueue,a.updateQueue=t,Yo(a,t),a.subtreeFlags=0,t=s,s=a.child;s!==null;)Qp(s,t),s=s.sibling;return T(Vt,Vt.current&1|2),et&&nr(a,c.treeForkCount),a.child}t=t.sibling}c.tail!==null&&St()>ec&&(a.flags|=128,p=!0,li(c,!1),a.lanes=4194304)}else{if(!p)if(t=zo(v),t!==null){if(a.flags|=128,p=!0,t=t.updateQueue,a.updateQueue=t,Yo(a,t),li(c,!0),c.tail===null&&c.tailMode==="hidden"&&!v.alternate&&!et)return _t(a),null}else 2*St()-c.renderingStartTime>ec&&s!==536870912&&(a.flags|=128,p=!0,li(c,!1),a.lanes=4194304);c.isBackwards?(v.sibling=a.child,a.child=v):(t=c.last,t!==null?t.sibling=v:a.child=v,c.last=v)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=St(),t.sibling=null,s=Vt.current,T(Vt,p?s&1|2:s&1),et&&nr(a,c.treeForkCount),t):(_t(a),null);case 22:case 23:return $n(a),wd(),c=a.memoizedState!==null,t!==null?t.memoizedState!==null!==c&&(a.flags|=8192):c&&(a.flags|=8192),c?(s&536870912)!==0&&(a.flags&128)===0&&(_t(a),a.subtreeFlags&6&&(a.flags|=8192)):_t(a),s=a.updateQueue,s!==null&&Yo(a,s.retryQueue),s=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),c=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(c=a.memoizedState.cachePool.pool),c!==s&&(a.flags|=2048),t!==null&&O(hl),null;case 24:return s=null,t!==null&&(s=t.memoizedState.cache),a.memoizedState.cache!==s&&(a.flags|=2048),rr(Wt),_t(a),null;case 25:return null;case 30:return null}throw Error(l(156,a.tag))}function vw(t,a){switch(id(a),a.tag){case 1:return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 3:return rr(Wt),se(),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($n(a),a.alternate===null)throw Error(l(340));dl()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 13:if($n(a),t=a.memoizedState,t!==null&&t.dehydrated!==null){if(a.alternate===null)throw Error(l(340));dl()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 19:return O(Vt),null;case 4:return se(),null;case 10:return rr(a.type),null;case 22:case 23:return $n(a),wd(),t!==null&&O(hl),t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 24:return rr(Wt),null;case 25:return null;default:return null}}function Sg(t,a){switch(id(a),a.tag){case 3:rr(Wt),se();break;case 26:case 27:case 5:be(a);break;case 4:se();break;case 31:a.memoizedState!==null&&$n(a);break;case 13:$n(a);break;case 19:O(Vt);break;case 10:rr(a.type);break;case 22:case 23:$n(a),wd(),t!==null&&O(hl);break;case 24:rr(Wt)}}function si(t,a){try{var s=a.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var p=c.next;s=p;do{if((s.tag&t)===t){c=void 0;var v=s.create,S=s.inst;c=v(),S.destroy=c}s=s.next}while(s!==p)}}catch(A){ht(a,a.return,A)}}function zr(t,a,s){try{var c=a.updateQueue,p=c!==null?c.lastEffect:null;if(p!==null){var v=p.next;c=v;do{if((c.tag&t)===t){var S=c.inst,A=S.destroy;if(A!==void 0){S.destroy=void 0,p=a;var F=s,te=A;try{te()}catch(ue){ht(p,F,ue)}}}c=c.next}while(c!==v)}}catch(ue){ht(a,a.return,ue)}}function jg(t){var a=t.updateQueue;if(a!==null){var s=t.stateNode;try{h0(a,s)}catch(c){ht(t,t.return,c)}}}function Cg(t,a,s){s.props=vl(t.type,t.memoizedProps),s.state=t.memoizedState;try{s.componentWillUnmount()}catch(c){ht(t,a,c)}}function ii(t,a){try{var s=t.ref;if(s!==null){switch(t.tag){case 26:case 27:case 5:var c=t.stateNode;break;case 30:c=t.stateNode;break;default:c=t.stateNode}typeof s=="function"?t.refCleanup=s(c):s.current=c}}catch(p){ht(t,a,p)}}function Ua(t,a){var s=t.ref,c=t.refCleanup;if(s!==null)if(typeof c=="function")try{c()}catch(p){ht(t,a,p)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(p){ht(t,a,p)}else s.current=null}function Ng(t){var a=t.type,s=t.memoizedProps,c=t.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":s.autoFocus&&c.focus();break e;case"img":s.src?c.src=s.src:s.srcSet&&(c.srcset=s.srcSet)}}catch(p){ht(t,t.return,p)}}function ef(t,a,s){try{var c=t.stateNode;Hw(c,t.type,s,a),c[Kt]=a}catch(p){ht(t,t.return,p)}}function Tg(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&qr(t.type)||t.tag===4}function tf(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Tg(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&&qr(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 nf(t,a,s){var c=t.tag;if(c===5||c===6)t=t.stateNode,a?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(t,a):(a=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,a.appendChild(t),s=s._reactRootContainer,s!=null||a.onclick!==null||(a.onclick=Ja));else if(c!==4&&(c===27&&qr(t.type)&&(s=t.stateNode,a=null),t=t.child,t!==null))for(nf(t,a,s),t=t.sibling;t!==null;)nf(t,a,s),t=t.sibling}function Qo(t,a,s){var c=t.tag;if(c===5||c===6)t=t.stateNode,a?s.insertBefore(t,a):s.appendChild(t);else if(c!==4&&(c===27&&qr(t.type)&&(s=t.stateNode),t=t.child,t!==null))for(Qo(t,a,s),t=t.sibling;t!==null;)Qo(t,a,s),t=t.sibling}function Mg(t){var a=t.stateNode,s=t.memoizedProps;try{for(var c=t.type,p=a.attributes;p.length;)a.removeAttributeNode(p[0]);un(a,c,s),a[Ht]=t,a[Kt]=s}catch(v){ht(t,t.return,v)}}var cr=!1,Xt=!1,af=!1,Eg=typeof WeakSet=="function"?WeakSet:Set,an=null;function bw(t,a){if(t=t.containerInfo,Cf=xc,t=Hp(t),Qu(t)){if("selectionStart"in t)var s={start:t.selectionStart,end:t.selectionEnd};else e:{s=(s=t.ownerDocument)&&s.defaultView||window;var c=s.getSelection&&s.getSelection();if(c&&c.rangeCount!==0){s=c.anchorNode;var p=c.anchorOffset,v=c.focusNode;c=c.focusOffset;try{s.nodeType,v.nodeType}catch{s=null;break e}var S=0,A=-1,F=-1,te=0,ue=0,he=t,re=null;t:for(;;){for(var le;he!==s||p!==0&&he.nodeType!==3||(A=S+p),he!==v||c!==0&&he.nodeType!==3||(F=S+c),he.nodeType===3&&(S+=he.nodeValue.length),(le=he.firstChild)!==null;)re=he,he=le;for(;;){if(he===t)break t;if(re===s&&++te===p&&(A=S),re===v&&++ue===c&&(F=S),(le=he.nextSibling)!==null)break;he=re,re=he.parentNode}he=le}s=A===-1||F===-1?null:{start:A,end:F}}else s=null}s=s||{start:0,end:0}}else s=null;for(Nf={focusedElem:t,selectionRange:s},xc=!1,an=a;an!==null;)if(a=an,t=a.child,(a.subtreeFlags&1028)!==0&&t!==null)t.return=a,an=t;else for(;an!==null;){switch(a=an,v=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(s=0;s<t.length;s++)p=t[s],p.ref.impl=p.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&v!==null){t=void 0,s=a,p=v.memoizedProps,v=v.memoizedState,c=s.stateNode;try{var Ne=vl(s.type,p);t=c.getSnapshotBeforeUpdate(Ne,v),c.__reactInternalSnapshotBeforeUpdate=t}catch(Ie){ht(s,s.return,Ie)}}break;case 3:if((t&1024)!==0){if(t=a.stateNode.containerInfo,s=t.nodeType,s===9)Ef(t);else if(s===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Ef(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(l(163))}if(t=a.sibling,t!==null){t.return=a.return,an=t;break}an=a.return}}function Ag(t,a,s){var c=s.flags;switch(s.tag){case 0:case 11:case 15:dr(t,s),c&4&&si(5,s);break;case 1:if(dr(t,s),c&4)if(t=s.stateNode,a===null)try{t.componentDidMount()}catch(S){ht(s,s.return,S)}else{var p=vl(s.type,a.memoizedProps);a=a.memoizedState;try{t.componentDidUpdate(p,a,t.__reactInternalSnapshotBeforeUpdate)}catch(S){ht(s,s.return,S)}}c&64&&jg(s),c&512&&ii(s,s.return);break;case 3:if(dr(t,s),c&64&&(t=s.updateQueue,t!==null)){if(a=null,s.child!==null)switch(s.child.tag){case 27:case 5:a=s.child.stateNode;break;case 1:a=s.child.stateNode}try{h0(t,a)}catch(S){ht(s,s.return,S)}}break;case 27:a===null&&c&4&&Mg(s);case 26:case 5:dr(t,s),a===null&&c&4&&Ng(s),c&512&&ii(s,s.return);break;case 12:dr(t,s);break;case 31:dr(t,s),c&4&&Lg(t,s);break;case 13:dr(t,s),c&4&&Ig(t,s),c&64&&(t=s.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(s=Ew.bind(null,s),Yw(t,s))));break;case 22:if(c=s.memoizedState!==null||cr,!c){a=a!==null&&a.memoizedState!==null||Xt,p=cr;var v=Xt;cr=c,(Xt=a)&&!v?fr(t,s,(s.subtreeFlags&8772)!==0):dr(t,s),cr=p,Xt=v}break;case 30:break;default:dr(t,s)}}function Rg(t){var a=t.alternate;a!==null&&(t.alternate=null,Rg(a)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(a=t.stateNode,a!==null&&de(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 Dt=null,Sn=!1;function ur(t,a,s){for(s=s.child;s!==null;)_g(t,a,s),s=s.sibling}function _g(t,a,s){if(gt&&typeof gt.onCommitFiberUnmount=="function")try{gt.onCommitFiberUnmount(Pt,s)}catch{}switch(s.tag){case 26:Xt||Ua(s,a),ur(t,a,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Xt||Ua(s,a);var c=Dt,p=Sn;qr(s.type)&&(Dt=s.stateNode,Sn=!1),ur(t,a,s),gi(s.stateNode),Dt=c,Sn=p;break;case 5:Xt||Ua(s,a);case 6:if(c=Dt,p=Sn,Dt=null,ur(t,a,s),Dt=c,Sn=p,Dt!==null)if(Sn)try{(Dt.nodeType===9?Dt.body:Dt.nodeName==="HTML"?Dt.ownerDocument.body:Dt).removeChild(s.stateNode)}catch(v){ht(s,a,v)}else try{Dt.removeChild(s.stateNode)}catch(v){ht(s,a,v)}break;case 18:Dt!==null&&(Sn?(t=Dt,jx(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,s.stateNode),ps(t)):jx(Dt,s.stateNode));break;case 4:c=Dt,p=Sn,Dt=s.stateNode.containerInfo,Sn=!0,ur(t,a,s),Dt=c,Sn=p;break;case 0:case 11:case 14:case 15:zr(2,s,a),Xt||zr(4,s,a),ur(t,a,s);break;case 1:Xt||(Ua(s,a),c=s.stateNode,typeof c.componentWillUnmount=="function"&&Cg(s,a,c)),ur(t,a,s);break;case 21:ur(t,a,s);break;case 22:Xt=(c=Xt)||s.memoizedState!==null,ur(t,a,s),Xt=c;break;default:ur(t,a,s)}}function Lg(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{ps(t)}catch(s){ht(a,a.return,s)}}}function Ig(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{ps(t)}catch(s){ht(a,a.return,s)}}function kw(t){switch(t.tag){case 31:case 13:case 19:var a=t.stateNode;return a===null&&(a=t.stateNode=new Eg),a;case 22:return t=t.stateNode,a=t._retryCache,a===null&&(a=t._retryCache=new Eg),a;default:throw Error(l(435,t.tag))}}function Xo(t,a){var s=kw(t);a.forEach(function(c){if(!s.has(c)){s.add(c);var p=Aw.bind(null,t,c);c.then(p,p)}})}function jn(t,a){var s=a.deletions;if(s!==null)for(var c=0;c<s.length;c++){var p=s[c],v=t,S=a,A=S;e:for(;A!==null;){switch(A.tag){case 27:if(qr(A.type)){Dt=A.stateNode,Sn=!1;break e}break;case 5:Dt=A.stateNode,Sn=!1;break e;case 3:case 4:Dt=A.stateNode.containerInfo,Sn=!0;break e}A=A.return}if(Dt===null)throw Error(l(160));_g(v,S,p),Dt=null,Sn=!1,v=p.alternate,v!==null&&(v.return=null),p.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)Og(a,t),a=a.sibling}var ja=null;function Og(t,a){var s=t.alternate,c=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:jn(a,t),Cn(t),c&4&&(zr(3,t,t.return),si(3,t),zr(5,t,t.return));break;case 1:jn(a,t),Cn(t),c&512&&(Xt||s===null||Ua(s,s.return)),c&64&&cr&&(t=t.updateQueue,t!==null&&(c=t.callbacks,c!==null&&(s=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=s===null?c:s.concat(c))));break;case 26:var p=ja;if(jn(a,t),Cn(t),c&512&&(Xt||s===null||Ua(s,s.return)),c&4){var v=s!==null?s.memoizedState:null;if(c=t.memoizedState,s===null)if(c===null)if(t.stateNode===null){e:{c=t.type,s=t.memoizedProps,p=p.ownerDocument||p;t:switch(c){case"title":v=p.getElementsByTagName("title")[0],(!v||v[K]||v[Ht]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=p.createElement(c),p.head.insertBefore(v,p.querySelector("head > title"))),un(v,c,s),v[Ht]=t,Je(v),c=v;break e;case"link":var S=Ox("link","href",p).get(c+(s.href||""));if(S){for(var A=0;A<S.length;A++)if(v=S[A],v.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&v.getAttribute("rel")===(s.rel==null?null:s.rel)&&v.getAttribute("title")===(s.title==null?null:s.title)&&v.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){S.splice(A,1);break t}}v=p.createElement(c),un(v,c,s),p.head.appendChild(v);break;case"meta":if(S=Ox("meta","content",p).get(c+(s.content||""))){for(A=0;A<S.length;A++)if(v=S[A],v.getAttribute("content")===(s.content==null?null:""+s.content)&&v.getAttribute("name")===(s.name==null?null:s.name)&&v.getAttribute("property")===(s.property==null?null:s.property)&&v.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&v.getAttribute("charset")===(s.charSet==null?null:s.charSet)){S.splice(A,1);break t}}v=p.createElement(c),un(v,c,s),p.head.appendChild(v);break;default:throw Error(l(468,c))}v[Ht]=t,Je(v),c=v}t.stateNode=c}else zx(p,t.type,t.stateNode);else t.stateNode=Ix(p,c,t.memoizedProps);else v!==c?(v===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):v.count--,c===null?zx(p,t.type,t.stateNode):Ix(p,c,t.memoizedProps)):c===null&&t.stateNode!==null&&ef(t,t.memoizedProps,s.memoizedProps)}break;case 27:jn(a,t),Cn(t),c&512&&(Xt||s===null||Ua(s,s.return)),s!==null&&c&4&&ef(t,t.memoizedProps,s.memoizedProps);break;case 5:if(jn(a,t),Cn(t),c&512&&(Xt||s===null||Ua(s,s.return)),t.flags&32){p=t.stateNode;try{Ul(p,"")}catch(Ne){ht(t,t.return,Ne)}}c&4&&t.stateNode!=null&&(p=t.memoizedProps,ef(t,p,s!==null?s.memoizedProps:p)),c&1024&&(af=!0);break;case 6:if(jn(a,t),Cn(t),c&4){if(t.stateNode===null)throw Error(l(162));c=t.memoizedProps,s=t.stateNode;try{s.nodeValue=c}catch(Ne){ht(t,t.return,Ne)}}break;case 3:if(mc=null,p=ja,ja=dc(a.containerInfo),jn(a,t),ja=p,Cn(t),c&4&&s!==null&&s.memoizedState.isDehydrated)try{ps(a.containerInfo)}catch(Ne){ht(t,t.return,Ne)}af&&(af=!1,zg(t));break;case 4:c=ja,ja=dc(t.stateNode.containerInfo),jn(a,t),Cn(t),ja=c;break;case 12:jn(a,t),Cn(t);break;case 31:jn(a,t),Cn(t),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,Xo(t,c)));break;case 13:jn(a,t),Cn(t),t.child.flags&8192&&t.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(Jo=St()),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,Xo(t,c)));break;case 22:p=t.memoizedState!==null;var F=s!==null&&s.memoizedState!==null,te=cr,ue=Xt;if(cr=te||p,Xt=ue||F,jn(a,t),Xt=ue,cr=te,Cn(t),c&8192)e:for(a=t.stateNode,a._visibility=p?a._visibility&-2:a._visibility|1,p&&(s===null||F||cr||Xt||bl(t)),s=null,a=t;;){if(a.tag===5||a.tag===26){if(s===null){F=s=a;try{if(v=F.stateNode,p)S=v.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{A=F.stateNode;var he=F.memoizedProps.style,re=he!=null&&he.hasOwnProperty("display")?he.display:null;A.style.display=re==null||typeof re=="boolean"?"":(""+re).trim()}}catch(Ne){ht(F,F.return,Ne)}}}else if(a.tag===6){if(s===null){F=a;try{F.stateNode.nodeValue=p?"":F.memoizedProps}catch(Ne){ht(F,F.return,Ne)}}}else if(a.tag===18){if(s===null){F=a;try{var le=F.stateNode;p?Cx(le,!0):Cx(F.stateNode,!1)}catch(Ne){ht(F,F.return,Ne)}}}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;s===a&&(s=null),a=a.return}s===a&&(s=null),a.sibling.return=a.return,a=a.sibling}c&4&&(c=t.updateQueue,c!==null&&(s=c.retryQueue,s!==null&&(c.retryQueue=null,Xo(t,s))));break;case 19:jn(a,t),Cn(t),c&4&&(c=t.updateQueue,c!==null&&(t.updateQueue=null,Xo(t,c)));break;case 30:break;case 21:break;default:jn(a,t),Cn(t)}}function Cn(t){var a=t.flags;if(a&2){try{for(var s,c=t.return;c!==null;){if(Tg(c)){s=c;break}c=c.return}if(s==null)throw Error(l(160));switch(s.tag){case 27:var p=s.stateNode,v=tf(t);Qo(t,v,p);break;case 5:var S=s.stateNode;s.flags&32&&(Ul(S,""),s.flags&=-33);var A=tf(t);Qo(t,A,S);break;case 3:case 4:var F=s.stateNode.containerInfo,te=tf(t);nf(t,te,F);break;default:throw Error(l(161))}}catch(ue){ht(t,t.return,ue)}t.flags&=-3}a&4096&&(t.flags&=-4097)}function zg(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var a=t;zg(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),t=t.sibling}}function dr(t,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)Ag(t,a.alternate,a),a=a.sibling}function bl(t){for(t=t.child;t!==null;){var a=t;switch(a.tag){case 0:case 11:case 14:case 15:zr(4,a,a.return),bl(a);break;case 1:Ua(a,a.return);var s=a.stateNode;typeof s.componentWillUnmount=="function"&&Cg(a,a.return,s),bl(a);break;case 27:gi(a.stateNode);case 26:case 5:Ua(a,a.return),bl(a);break;case 22:a.memoizedState===null&&bl(a);break;case 30:bl(a);break;default:bl(a)}t=t.sibling}}function fr(t,a,s){for(s=s&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var c=a.alternate,p=t,v=a,S=v.flags;switch(v.tag){case 0:case 11:case 15:fr(p,v,s),si(4,v);break;case 1:if(fr(p,v,s),c=v,p=c.stateNode,typeof p.componentDidMount=="function")try{p.componentDidMount()}catch(te){ht(c,c.return,te)}if(c=v,p=c.updateQueue,p!==null){var A=c.stateNode;try{var F=p.shared.hiddenCallbacks;if(F!==null)for(p.shared.hiddenCallbacks=null,p=0;p<F.length;p++)m0(F[p],A)}catch(te){ht(c,c.return,te)}}s&&S&64&&jg(v),ii(v,v.return);break;case 27:Mg(v);case 26:case 5:fr(p,v,s),s&&c===null&&S&4&&Ng(v),ii(v,v.return);break;case 12:fr(p,v,s);break;case 31:fr(p,v,s),s&&S&4&&Lg(p,v);break;case 13:fr(p,v,s),s&&S&4&&Ig(p,v);break;case 22:v.memoizedState===null&&fr(p,v,s),ii(v,v.return);break;case 30:break;default:fr(p,v,s)}a=a.sibling}}function rf(t,a){var s=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(s=t.memoizedState.cachePool.pool),t=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(t=a.memoizedState.cachePool.pool),t!==s&&(t!=null&&t.refCount++,s!=null&&Ks(s))}function lf(t,a){t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&Ks(t))}function Ca(t,a,s,c){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)Dg(t,a,s,c),a=a.sibling}function Dg(t,a,s,c){var p=a.flags;switch(a.tag){case 0:case 11:case 15:Ca(t,a,s,c),p&2048&&si(9,a);break;case 1:Ca(t,a,s,c);break;case 3:Ca(t,a,s,c),p&2048&&(t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&Ks(t)));break;case 12:if(p&2048){Ca(t,a,s,c),t=a.stateNode;try{var v=a.memoizedProps,S=v.id,A=v.onPostCommit;typeof A=="function"&&A(S,a.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(F){ht(a,a.return,F)}}else Ca(t,a,s,c);break;case 31:Ca(t,a,s,c);break;case 13:Ca(t,a,s,c);break;case 23:break;case 22:v=a.stateNode,S=a.alternate,a.memoizedState!==null?v._visibility&2?Ca(t,a,s,c):oi(t,a):v._visibility&2?Ca(t,a,s,c):(v._visibility|=2,rs(t,a,s,c,(a.subtreeFlags&10256)!==0||!1)),p&2048&&rf(S,a);break;case 24:Ca(t,a,s,c),p&2048&&lf(a.alternate,a);break;default:Ca(t,a,s,c)}}function rs(t,a,s,c,p){for(p=p&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var v=t,S=a,A=s,F=c,te=S.flags;switch(S.tag){case 0:case 11:case 15:rs(v,S,A,F,p),si(8,S);break;case 23:break;case 22:var ue=S.stateNode;S.memoizedState!==null?ue._visibility&2?rs(v,S,A,F,p):oi(v,S):(ue._visibility|=2,rs(v,S,A,F,p)),p&&te&2048&&rf(S.alternate,S);break;case 24:rs(v,S,A,F,p),p&&te&2048&&lf(S.alternate,S);break;default:rs(v,S,A,F,p)}a=a.sibling}}function oi(t,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var s=t,c=a,p=c.flags;switch(c.tag){case 22:oi(s,c),p&2048&&rf(c.alternate,c);break;case 24:oi(s,c),p&2048&&lf(c.alternate,c);break;default:oi(s,c)}a=a.sibling}}var ci=8192;function ls(t,a,s){if(t.subtreeFlags&ci)for(t=t.child;t!==null;)Ug(t,a,s),t=t.sibling}function Ug(t,a,s){switch(t.tag){case 26:ls(t,a,s),t.flags&ci&&t.memoizedState!==null&&iS(s,ja,t.memoizedState,t.memoizedProps);break;case 5:ls(t,a,s);break;case 3:case 4:var c=ja;ja=dc(t.stateNode.containerInfo),ls(t,a,s),ja=c;break;case 22:t.memoizedState===null&&(c=t.alternate,c!==null&&c.memoizedState!==null?(c=ci,ci=16777216,ls(t,a,s),ci=c):ls(t,a,s));break;default:ls(t,a,s)}}function $g(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 ui(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var s=0;s<a.length;s++){var c=a[s];an=c,Hg(c,t)}$g(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Bg(t),t=t.sibling}function Bg(t){switch(t.tag){case 0:case 11:case 15:ui(t),t.flags&2048&&zr(9,t,t.return);break;case 3:ui(t);break;case 12:ui(t);break;case 22:var a=t.stateNode;t.memoizedState!==null&&a._visibility&2&&(t.return===null||t.return.tag!==13)?(a._visibility&=-3,Zo(t)):ui(t);break;default:ui(t)}}function Zo(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var s=0;s<a.length;s++){var c=a[s];an=c,Hg(c,t)}$g(t)}for(t=t.child;t!==null;){switch(a=t,a.tag){case 0:case 11:case 15:zr(8,a,a.return),Zo(a);break;case 22:s=a.stateNode,s._visibility&2&&(s._visibility&=-3,Zo(a));break;default:Zo(a)}t=t.sibling}}function Hg(t,a){for(;an!==null;){var s=an;switch(s.tag){case 0:case 11:case 15:zr(8,s,a);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var c=s.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:Ks(s.memoizedState.cache)}if(c=s.child,c!==null)c.return=s,an=c;else e:for(s=t;an!==null;){c=an;var p=c.sibling,v=c.return;if(Rg(c),c===s){an=null;break e}if(p!==null){p.return=v,an=p;break e}an=v}}}var ww={getCacheForType:function(t){var a=on(Wt),s=a.data.get(t);return s===void 0&&(s=t(),a.data.set(t,s)),s},cacheSignal:function(){return on(Wt).controller.signal}},Sw=typeof WeakMap=="function"?WeakMap:Map,ct=0,Ct=null,Ge=null,Ye=0,mt=0,Bn=null,Dr=!1,ss=!1,sf=!1,mr=0,Ft=0,Ur=0,kl=0,of=0,Hn=0,is=0,di=null,Nn=null,cf=!1,Jo=0,Pg=0,ec=1/0,tc=null,$r=null,tn=0,Br=null,os=null,hr=0,uf=0,df=null,qg=null,fi=0,ff=null;function Pn(){return(ct&2)!==0&&Ye!==0?Ye&-Ye:z.T!==null?yf():Sr()}function Fg(){if(Hn===0)if((Ye&536870912)===0||et){var t=xt;xt<<=1,(xt&3932160)===0&&(xt=262144),Hn=t}else Hn=536870912;return t=Un.current,t!==null&&(t.flags|=32),Hn}function Tn(t,a,s){(t===Ct&&(mt===2||mt===9)||t.cancelPendingCommit!==null)&&(cs(t,0),Hr(t,Ye,Hn,!1)),ka(t,s),((ct&2)===0||t!==Ct)&&(t===Ct&&((ct&2)===0&&(kl|=s),Ft===4&&Hr(t,Ye,Hn,!1)),$a(t))}function Vg(t,a,s){if((ct&6)!==0)throw Error(l(327));var c=!s&&(a&127)===0&&(a&t.expiredLanes)===0||Ya(t,a),p=c?Nw(t,a):hf(t,a,!0),v=c;do{if(p===0){ss&&!c&&Hr(t,a,0,!1);break}else{if(s=t.current.alternate,v&&!jw(s)){p=hf(t,a,!1),v=!1;continue}if(p===2){if(v=a,t.errorRecoveryDisabledLanes&v)var S=0;else S=t.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){a=S;e:{var A=t;p=di;var F=A.current.memoizedState.isDehydrated;if(F&&(cs(A,S).flags|=256),S=hf(A,S,!1),S!==2){if(sf&&!F){A.errorRecoveryDisabledLanes|=v,kl|=v,p=4;break e}v=Nn,Nn=p,v!==null&&(Nn===null?Nn=v:Nn.push.apply(Nn,v))}p=S}if(v=!1,p!==2)continue}}if(p===1){cs(t,0),Hr(t,a,0,!0);break}e:{switch(c=t,v=p,v){case 0:case 1:throw Error(l(345));case 4:if((a&4194048)!==a)break;case 6:Hr(c,a,Hn,!Dr);break e;case 2:Nn=null;break;case 3:case 5:break;default:throw Error(l(329))}if((a&62914560)===a&&(p=Jo+300-St(),10<p)){if(Hr(c,a,Hn,!Dr),_n(c,0,!0)!==0)break e;hr=a,c.timeoutHandle=wx(Gg.bind(null,c,s,Nn,tc,cf,a,Hn,kl,is,Dr,v,"Throttled",-0,0),p);break e}Gg(c,s,Nn,tc,cf,a,Hn,kl,is,Dr,v,null,-0,0)}}break}while(!0);$a(t)}function Gg(t,a,s,c,p,v,S,A,F,te,ue,he,re,le){if(t.timeoutHandle=-1,he=a.subtreeFlags,he&8192||(he&16785408)===16785408){he={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ja},Ug(a,v,he);var Ne=(v&62914560)===v?Jo-St():(v&4194048)===v?Pg-St():0;if(Ne=oS(he,Ne),Ne!==null){hr=v,t.cancelPendingCommit=Ne(ex.bind(null,t,a,v,s,c,p,S,A,F,ue,he,null,re,le)),Hr(t,v,S,!te);return}}ex(t,a,v,s,c,p,S,A,F)}function jw(t){for(var a=t;;){var s=a.tag;if((s===0||s===11||s===15)&&a.flags&16384&&(s=a.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var c=0;c<s.length;c++){var p=s[c],v=p.getSnapshot;p=p.value;try{if(!zn(v(),p))return!1}catch{return!1}}if(s=a.child,a.subtreeFlags&16384&&s!==null)s.return=a,a=s;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 Hr(t,a,s,c){a&=~of,a&=~kl,t.suspendedLanes|=a,t.pingedLanes&=~a,c&&(t.warmLanes|=a),c=t.expirationTimes;for(var p=a;0<p;){var v=31-xe(p),S=1<<v;c[v]=-1,p&=~S}s!==0&&kn(t,s,a)}function nc(){return(ct&6)===0?(mi(0),!1):!0}function mf(){if(Ge!==null){if(mt===0)var t=Ge.return;else t=Ge,ar=fl=null,Md(t),Jl=null,Ys=0,t=Ge;for(;t!==null;)Sg(t.alternate,t),t=t.return;Ge=null}}function cs(t,a){var s=t.timeoutHandle;s!==-1&&(t.timeoutHandle=-1,Fw(s)),s=t.cancelPendingCommit,s!==null&&(t.cancelPendingCommit=null,s()),hr=0,mf(),Ct=t,Ge=s=tr(t.current,null),Ye=a,mt=0,Bn=null,Dr=!1,ss=Ya(t,a),sf=!1,is=Hn=of=kl=Ur=Ft=0,Nn=di=null,cf=!1,(a&8)!==0&&(a|=a&32);var c=t.entangledLanes;if(c!==0)for(t=t.entanglements,c&=a;0<c;){var p=31-xe(c),v=1<<p;a|=t[p],c&=~v}return mr=a,So(),s}function Kg(t,a){Be=null,z.H=ai,a===Zl||a===Ro?(a=c0(),mt=3):a===gd?(a=c0(),mt=4):mt=a===Fd?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Bn=a,Ge===null&&(Ft=1,Vo(t,ra(a,t.current)))}function Wg(){var t=Un.current;return t===null?!0:(Ye&4194048)===Ye?oa===null:(Ye&62914560)===Ye||(Ye&536870912)!==0?t===oa:!1}function Yg(){var t=z.H;return z.H=ai,t===null?ai:t}function Qg(){var t=z.A;return z.A=ww,t}function ac(){Ft=4,Dr||(Ye&4194048)!==Ye&&Un.current!==null||(ss=!0),(Ur&134217727)===0&&(kl&134217727)===0||Ct===null||Hr(Ct,Ye,Hn,!1)}function hf(t,a,s){var c=ct;ct|=2;var p=Yg(),v=Qg();(Ct!==t||Ye!==a)&&(tc=null,cs(t,a)),a=!1;var S=Ft;e:do try{if(mt!==0&&Ge!==null){var A=Ge,F=Bn;switch(mt){case 8:mf(),S=6;break e;case 3:case 2:case 9:case 6:Un.current===null&&(a=!0);var te=mt;if(mt=0,Bn=null,us(t,A,F,te),s&&ss){S=0;break e}break;default:te=mt,mt=0,Bn=null,us(t,A,F,te)}}Cw(),S=Ft;break}catch(ue){Kg(t,ue)}while(!0);return a&&t.shellSuspendCounter++,ar=fl=null,ct=c,z.H=p,z.A=v,Ge===null&&(Ct=null,Ye=0,So()),S}function Cw(){for(;Ge!==null;)Xg(Ge)}function Nw(t,a){var s=ct;ct|=2;var c=Yg(),p=Qg();Ct!==t||Ye!==a?(tc=null,ec=St()+500,cs(t,a)):ss=Ya(t,a);e:do try{if(mt!==0&&Ge!==null){a=Ge;var v=Bn;t:switch(mt){case 1:mt=0,Bn=null,us(t,a,v,1);break;case 2:case 9:if(i0(v)){mt=0,Bn=null,Zg(a);break}a=function(){mt!==2&&mt!==9||Ct!==t||(mt=7),$a(t)},v.then(a,a);break e;case 3:mt=7;break e;case 4:mt=5;break e;case 7:i0(v)?(mt=0,Bn=null,Zg(a)):(mt=0,Bn=null,us(t,a,v,7));break;case 5:var S=null;switch(Ge.tag){case 26:S=Ge.memoizedState;case 5:case 27:var A=Ge;if(S?Dx(S):A.stateNode.complete){mt=0,Bn=null;var F=A.sibling;if(F!==null)Ge=F;else{var te=A.return;te!==null?(Ge=te,rc(te)):Ge=null}break t}}mt=0,Bn=null,us(t,a,v,5);break;case 6:mt=0,Bn=null,us(t,a,v,6);break;case 8:mf(),Ft=6;break e;default:throw Error(l(462))}}Tw();break}catch(ue){Kg(t,ue)}while(!0);return ar=fl=null,z.H=c,z.A=p,ct=s,Ge!==null?0:(Ct=null,Ye=0,So(),Ft)}function Tw(){for(;Ge!==null&&!$t();)Xg(Ge)}function Xg(t){var a=kg(t.alternate,t,mr);t.memoizedProps=t.pendingProps,a===null?rc(t):Ge=a}function Zg(t){var a=t,s=a.alternate;switch(a.tag){case 15:case 0:a=pg(s,a,a.pendingProps,a.type,void 0,Ye);break;case 11:a=pg(s,a,a.pendingProps,a.type.render,a.ref,Ye);break;case 5:Md(a);default:Sg(s,a),a=Ge=Qp(a,mr),a=kg(s,a,mr)}t.memoizedProps=t.pendingProps,a===null?rc(t):Ge=a}function us(t,a,s,c){ar=fl=null,Md(a),Jl=null,Ys=0;var p=a.return;try{if(pw(t,p,a,s,Ye)){Ft=1,Vo(t,ra(s,t.current)),Ge=null;return}}catch(v){if(p!==null)throw Ge=p,v;Ft=1,Vo(t,ra(s,t.current)),Ge=null;return}a.flags&32768?(et||c===1?t=!0:ss||(Ye&536870912)!==0?t=!1:(Dr=t=!0,(c===2||c===9||c===3||c===6)&&(c=Un.current,c!==null&&c.tag===13&&(c.flags|=16384))),Jg(a,t)):rc(a)}function rc(t){var a=t;do{if((a.flags&32768)!==0){Jg(a,Dr);return}t=a.return;var s=yw(a.alternate,a,mr);if(s!==null){Ge=s;return}if(a=a.sibling,a!==null){Ge=a;return}Ge=a=t}while(a!==null);Ft===0&&(Ft=5)}function Jg(t,a){do{var s=vw(t.alternate,t);if(s!==null){s.flags&=32767,Ge=s;return}if(s=t.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!a&&(t=t.sibling,t!==null)){Ge=t;return}Ge=t=s}while(t!==null);Ft=6,Ge=null}function ex(t,a,s,c,p,v,S,A,F){t.cancelPendingCommit=null;do lc();while(tn!==0);if((ct&6)!==0)throw Error(l(327));if(a!==null){if(a===t.current)throw Error(l(177));if(v=a.lanes|a.childLanes,v|=td,Jn(t,s,v,S,A,F),t===Ct&&(Ge=Ct=null,Ye=0),os=a,Br=t,hr=s,uf=v,df=p,qg=c,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,Rw(we,function(){return lx(),null})):(t.callbackNode=null,t.callbackPriority=0),c=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||c){c=z.T,z.T=null,p=$.p,$.p=2,S=ct,ct|=4;try{bw(t,a,s)}finally{ct=S,$.p=p,z.T=c}}tn=1,tx(),nx(),ax()}}function tx(){if(tn===1){tn=0;var t=Br,a=os,s=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||s){s=z.T,z.T=null;var c=$.p;$.p=2;var p=ct;ct|=4;try{Og(a,t);var v=Nf,S=Hp(t.containerInfo),A=v.focusedElem,F=v.selectionRange;if(S!==A&&A&&A.ownerDocument&&Bp(A.ownerDocument.documentElement,A)){if(F!==null&&Qu(A)){var te=F.start,ue=F.end;if(ue===void 0&&(ue=te),"selectionStart"in A)A.selectionStart=te,A.selectionEnd=Math.min(ue,A.value.length);else{var he=A.ownerDocument||document,re=he&&he.defaultView||window;if(re.getSelection){var le=re.getSelection(),Ne=A.textContent.length,Ie=Math.min(F.start,Ne),bt=F.end===void 0?Ie:Math.min(F.end,Ne);!le.extend&&Ie>bt&&(S=bt,bt=Ie,Ie=S);var Q=$p(A,Ie),W=$p(A,bt);if(Q&&W&&(le.rangeCount!==1||le.anchorNode!==Q.node||le.anchorOffset!==Q.offset||le.focusNode!==W.node||le.focusOffset!==W.offset)){var J=he.createRange();J.setStart(Q.node,Q.offset),le.removeAllRanges(),Ie>bt?(le.addRange(J),le.extend(W.node,W.offset)):(J.setEnd(W.node,W.offset),le.addRange(J))}}}}for(he=[],le=A;le=le.parentNode;)le.nodeType===1&&he.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof A.focus=="function"&&A.focus(),A=0;A<he.length;A++){var fe=he[A];fe.element.scrollLeft=fe.left,fe.element.scrollTop=fe.top}}xc=!!Cf,Nf=Cf=null}finally{ct=p,$.p=c,z.T=s}}t.current=a,tn=2}}function nx(){if(tn===2){tn=0;var t=Br,a=os,s=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||s){s=z.T,z.T=null;var c=$.p;$.p=2;var p=ct;ct|=4;try{Ag(t,a.alternate,a)}finally{ct=p,$.p=c,z.T=s}}tn=3}}function ax(){if(tn===4||tn===3){tn=0,At();var t=Br,a=os,s=hr,c=qg;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?tn=5:(tn=0,os=Br=null,rx(t,t.pendingLanes));var p=t.pendingLanes;if(p===0&&($r=null),Ln(s),a=a.stateNode,gt&&typeof gt.onCommitFiberRoot=="function")try{gt.onCommitFiberRoot(Pt,a,void 0,(a.current.flags&128)===128)}catch{}if(c!==null){a=z.T,p=$.p,$.p=2,z.T=null;try{for(var v=t.onRecoverableError,S=0;S<c.length;S++){var A=c[S];v(A.value,{componentStack:A.stack})}}finally{z.T=a,$.p=p}}(hr&3)!==0&&lc(),$a(t),p=t.pendingLanes,(s&261930)!==0&&(p&42)!==0?t===ff?fi++:(fi=0,ff=t):fi=0,mi(0)}}function rx(t,a){(t.pooledCacheLanes&=a)===0&&(a=t.pooledCache,a!=null&&(t.pooledCache=null,Ks(a)))}function lc(){return tx(),nx(),ax(),lx()}function lx(){if(tn!==5)return!1;var t=Br,a=uf;uf=0;var s=Ln(hr),c=z.T,p=$.p;try{$.p=32>s?32:s,z.T=null,s=df,df=null;var v=Br,S=hr;if(tn=0,os=Br=null,hr=0,(ct&6)!==0)throw Error(l(331));var A=ct;if(ct|=4,Bg(v.current),Dg(v,v.current,S,s),ct=A,mi(0,!1),gt&&typeof gt.onPostCommitFiberRoot=="function")try{gt.onPostCommitFiberRoot(Pt,v)}catch{}return!0}finally{$.p=p,z.T=c,rx(t,a)}}function sx(t,a,s){a=ra(s,a),a=qd(t.stateNode,a,2),t=Lr(t,a,2),t!==null&&(ka(t,2),$a(t))}function ht(t,a,s){if(t.tag===3)sx(t,t,s);else for(;a!==null;){if(a.tag===3){sx(a,t,s);break}else if(a.tag===1){var c=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&($r===null||!$r.has(c))){t=ra(s,t),s=ig(2),c=Lr(a,s,2),c!==null&&(og(s,c,a,t),ka(c,2),$a(c));break}}a=a.return}}function pf(t,a,s){var c=t.pingCache;if(c===null){c=t.pingCache=new Sw;var p=new Set;c.set(a,p)}else p=c.get(a),p===void 0&&(p=new Set,c.set(a,p));p.has(s)||(sf=!0,p.add(s),t=Mw.bind(null,t,a,s),a.then(t,t))}function Mw(t,a,s){var c=t.pingCache;c!==null&&c.delete(a),t.pingedLanes|=t.suspendedLanes&s,t.warmLanes&=~s,Ct===t&&(Ye&s)===s&&(Ft===4||Ft===3&&(Ye&62914560)===Ye&&300>St()-Jo?(ct&2)===0&&cs(t,0):of|=s,is===Ye&&(is=0)),$a(t)}function ix(t,a){a===0&&(a=Xn()),t=cl(t,a),t!==null&&(ka(t,a),$a(t))}function Ew(t){var a=t.memoizedState,s=0;a!==null&&(s=a.retryLane),ix(t,s)}function Aw(t,a){var s=0;switch(t.tag){case 31:case 13:var c=t.stateNode,p=t.memoizedState;p!==null&&(s=p.retryLane);break;case 19:c=t.stateNode;break;case 22:c=t.stateNode._retryCache;break;default:throw Error(l(314))}c!==null&&c.delete(a),ix(t,s)}function Rw(t,a){return qe(t,a)}var sc=null,ds=null,gf=!1,ic=!1,xf=!1,Pr=0;function $a(t){t!==ds&&t.next===null&&(ds===null?sc=ds=t:ds=ds.next=t),ic=!0,gf||(gf=!0,Lw())}function mi(t,a){if(!xf&&ic){xf=!0;do for(var s=!1,c=sc;c!==null;){if(t!==0){var p=c.pendingLanes;if(p===0)var v=0;else{var S=c.suspendedLanes,A=c.pingedLanes;v=(1<<31-xe(42|t)+1)-1,v&=p&~(S&~A),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(s=!0,dx(c,v))}else v=Ye,v=_n(c,c===Ct?v:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(v&3)===0||Ya(c,v)||(s=!0,dx(c,v));c=c.next}while(s);xf=!1}}function _w(){ox()}function ox(){ic=gf=!1;var t=0;Pr!==0&&qw()&&(t=Pr);for(var a=St(),s=null,c=sc;c!==null;){var p=c.next,v=cx(c,a);v===0?(c.next=null,s===null?sc=p:s.next=p,p===null&&(ds=s)):(s=c,(t!==0||(v&3)!==0)&&(ic=!0)),c=p}tn!==0&&tn!==5||mi(t),Pr!==0&&(Pr=0)}function cx(t,a){for(var s=t.suspendedLanes,c=t.pingedLanes,p=t.expirationTimes,v=t.pendingLanes&-62914561;0<v;){var S=31-xe(v),A=1<<S,F=p[S];F===-1?((A&s)===0||(A&c)!==0)&&(p[S]=La(A,a)):F<=a&&(t.expiredLanes|=A),v&=~A}if(a=Ct,s=Ye,s=_n(t,t===a?s:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c=t.callbackNode,s===0||t===a&&(mt===2||mt===9)||t.cancelPendingCommit!==null)return c!==null&&c!==null&&wt(c),t.callbackNode=null,t.callbackPriority=0;if((s&3)===0||Ya(t,s)){if(a=s&-s,a===t.callbackPriority)return a;switch(c!==null&&wt(c),Ln(s)){case 2:case 8:s=ye;break;case 32:s=we;break;case 268435456:s=Fe;break;default:s=we}return c=ux.bind(null,t),s=qe(s,c),t.callbackPriority=a,t.callbackNode=s,a}return c!==null&&c!==null&&wt(c),t.callbackPriority=2,t.callbackNode=null,2}function ux(t,a){if(tn!==0&&tn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var s=t.callbackNode;if(lc()&&t.callbackNode!==s)return null;var c=Ye;return c=_n(t,t===Ct?c:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),c===0?null:(Vg(t,c,a),cx(t,St()),t.callbackNode!=null&&t.callbackNode===s?ux.bind(null,t):null)}function dx(t,a){if(lc())return null;Vg(t,a,!0)}function Lw(){Vw(function(){(ct&6)!==0?qe(ie,_w):ox()})}function yf(){if(Pr===0){var t=Ql;t===0&&(t=jt,jt<<=1,(jt&261888)===0&&(jt=256)),Pr=t}return Pr}function fx(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:po(""+t)}function mx(t,a){var s=a.ownerDocument.createElement("input");return s.name=a.name,s.value=a.value,t.id&&s.setAttribute("form",t.id),a.parentNode.insertBefore(s,a),t=new FormData(t),s.parentNode.removeChild(s),t}function Iw(t,a,s,c,p){if(a==="submit"&&s&&s.stateNode===p){var v=fx((p[Kt]||null).action),S=c.submitter;S&&(a=(a=S[Kt]||null)?fx(a.formAction):S.getAttribute("formAction"),a!==null&&(v=a,S=null));var A=new vo("action","action",null,c,p);t.push({event:A,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(Pr!==0){var F=S?mx(p,S):new FormData(p);Dd(s,{pending:!0,data:F,method:p.method,action:v},null,F)}}else typeof v=="function"&&(A.preventDefault(),F=S?mx(p,S):new FormData(p),Dd(s,{pending:!0,data:F,method:p.method,action:v},v,F))},currentTarget:p}]})}}for(var vf=0;vf<ed.length;vf++){var bf=ed[vf],Ow=bf.toLowerCase(),zw=bf[0].toUpperCase()+bf.slice(1);Sa(Ow,"on"+zw)}Sa(Fp,"onAnimationEnd"),Sa(Vp,"onAnimationIteration"),Sa(Gp,"onAnimationStart"),Sa("dblclick","onDoubleClick"),Sa("focusin","onFocus"),Sa("focusout","onBlur"),Sa(Z2,"onTransitionRun"),Sa(J2,"onTransitionStart"),Sa(ew,"onTransitionCancel"),Sa(Kp,"onTransitionEnd"),ea("onMouseEnter",["mouseout","mouseover"]),ea("onMouseLeave",["mouseout","mouseover"]),ea("onPointerEnter",["pointerout","pointerover"]),ea("onPointerLeave",["pointerout","pointerover"]),wa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),wa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),wa("onBeforeInput",["compositionend","keypress","textInput","paste"]),wa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),wa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),wa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var hi="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(" "),Dw=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(hi));function hx(t,a){a=(a&4)!==0;for(var s=0;s<t.length;s++){var c=t[s],p=c.event;c=c.listeners;e:{var v=void 0;if(a)for(var S=c.length-1;0<=S;S--){var A=c[S],F=A.instance,te=A.currentTarget;if(A=A.listener,F!==v&&p.isPropagationStopped())break e;v=A,p.currentTarget=te;try{v(p)}catch(ue){wo(ue)}p.currentTarget=null,v=F}else for(S=0;S<c.length;S++){if(A=c[S],F=A.instance,te=A.currentTarget,A=A.listener,F!==v&&p.isPropagationStopped())break e;v=A,p.currentTarget=te;try{v(p)}catch(ue){wo(ue)}p.currentTarget=null,v=F}}}}function Ke(t,a){var s=a[jr];s===void 0&&(s=a[jr]=new Set);var c=t+"__bubble";s.has(c)||(px(a,t,2,!1),s.add(c))}function kf(t,a,s){var c=0;a&&(c|=4),px(s,t,c,a)}var oc="_reactListening"+Math.random().toString(36).slice(2);function wf(t){if(!t[oc]){t[oc]=!0,On.forEach(function(s){s!=="selectionchange"&&(Dw.has(s)||kf(s,!1,t),kf(s,!0,t))});var a=t.nodeType===9?t:t.ownerDocument;a===null||a[oc]||(a[oc]=!0,kf("selectionchange",!1,a))}}function px(t,a,s,c){switch(Fx(a)){case 2:var p=dS;break;case 8:p=fS;break;default:p=Df}s=p.bind(null,a,s,t),p=void 0,!Hu||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(p=!0),c?p!==void 0?t.addEventListener(a,s,{capture:!0,passive:p}):t.addEventListener(a,s,!0):p!==void 0?t.addEventListener(a,s,{passive:p}):t.addEventListener(a,s,!1)}function Sf(t,a,s,c,p){var v=c;if((a&1)===0&&(a&2)===0&&c!==null)e:for(;;){if(c===null)return;var S=c.tag;if(S===3||S===4){var A=c.stateNode.containerInfo;if(A===p)break;if(S===4)for(S=c.return;S!==null;){var F=S.tag;if((F===3||F===4)&&S.stateNode.containerInfo===p)return;S=S.return}for(;A!==null;){if(S=Se(A),S===null)return;if(F=S.tag,F===5||F===6||F===26||F===27){c=v=S;continue e}A=A.parentNode}}c=c.return}bp(function(){var te=v,ue=$u(s),he=[];e:{var re=Wp.get(t);if(re!==void 0){var le=vo,Ne=t;switch(t){case"keypress":if(xo(s)===0)break e;case"keydown":case"keyup":le=A2;break;case"focusin":Ne="focus",le=Vu;break;case"focusout":Ne="blur",le=Vu;break;case"beforeblur":case"afterblur":le=Vu;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=Sp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=y2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=L2;break;case Fp:case Vp:case Gp:le=k2;break;case Kp:le=O2;break;case"scroll":case"scrollend":le=g2;break;case"wheel":le=D2;break;case"copy":case"cut":case"paste":le=S2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=Cp;break;case"toggle":case"beforetoggle":le=$2}var Ie=(a&4)!==0,bt=!Ie&&(t==="scroll"||t==="scrollend"),Q=Ie?re!==null?re+"Capture":null:re;Ie=[];for(var W=te,J;W!==null;){var fe=W;if(J=fe.stateNode,fe=fe.tag,fe!==5&&fe!==26&&fe!==27||J===null||Q===null||(fe=zs(W,Q),fe!=null&&Ie.push(pi(W,fe,J))),bt)break;W=W.return}0<Ie.length&&(re=new le(re,Ne,null,s,ue),he.push({event:re,listeners:Ie}))}}if((a&7)===0){e:{if(re=t==="mouseover"||t==="pointerover",le=t==="mouseout"||t==="pointerout",re&&s!==Uu&&(Ne=s.relatedTarget||s.fromElement)&&(Se(Ne)||Ne[Oa]))break e;if((le||re)&&(re=ue.window===ue?ue:(re=ue.ownerDocument)?re.defaultView||re.parentWindow:window,le?(Ne=s.relatedTarget||s.toElement,le=te,Ne=Ne?Se(Ne):null,Ne!==null&&(bt=u(Ne),Ie=Ne.tag,Ne!==bt||Ie!==5&&Ie!==27&&Ie!==6)&&(Ne=null)):(le=null,Ne=te),le!==Ne)){if(Ie=Sp,fe="onMouseLeave",Q="onMouseEnter",W="mouse",(t==="pointerout"||t==="pointerover")&&(Ie=Cp,fe="onPointerLeave",Q="onPointerEnter",W="pointer"),bt=le==null?re:lt(le),J=Ne==null?re:lt(Ne),re=new Ie(fe,W+"leave",le,s,ue),re.target=bt,re.relatedTarget=J,fe=null,Se(ue)===te&&(Ie=new Ie(Q,W+"enter",Ne,s,ue),Ie.target=J,Ie.relatedTarget=bt,fe=Ie),bt=fe,le&&Ne)t:{for(Ie=Uw,Q=le,W=Ne,J=0,fe=Q;fe;fe=Ie(fe))J++;fe=0;for(var Re=W;Re;Re=Ie(Re))fe++;for(;0<J-fe;)Q=Ie(Q),J--;for(;0<fe-J;)W=Ie(W),fe--;for(;J--;){if(Q===W||W!==null&&Q===W.alternate){Ie=Q;break t}Q=Ie(Q),W=Ie(W)}Ie=null}else Ie=null;le!==null&&gx(he,re,le,Ie,!1),Ne!==null&&bt!==null&&gx(he,bt,Ne,Ie,!0)}}e:{if(re=te?lt(te):window,le=re.nodeName&&re.nodeName.toLowerCase(),le==="select"||le==="input"&&re.type==="file")var it=Lp;else if(Rp(re))if(Ip)it=Y2;else{it=K2;var Me=G2}else le=re.nodeName,!le||le.toLowerCase()!=="input"||re.type!=="checkbox"&&re.type!=="radio"?te&&Du(te.elementType)&&(it=Lp):it=W2;if(it&&(it=it(t,te))){_p(he,it,s,ue);break e}Me&&Me(t,re,te),t==="focusout"&&te&&re.type==="number"&&te.memoizedProps.value!=null&&zu(re,"number",re.value)}switch(Me=te?lt(te):window,t){case"focusin":(Rp(Me)||Me.contentEditable==="true")&&(Pl=Me,Xu=te,Fs=null);break;case"focusout":Fs=Xu=Pl=null;break;case"mousedown":Zu=!0;break;case"contextmenu":case"mouseup":case"dragend":Zu=!1,Pp(he,s,ue);break;case"selectionchange":if(X2)break;case"keydown":case"keyup":Pp(he,s,ue)}var He;if(Ku)e:{switch(t){case"compositionstart":var Qe="onCompositionStart";break e;case"compositionend":Qe="onCompositionEnd";break e;case"compositionupdate":Qe="onCompositionUpdate";break e}Qe=void 0}else Hl?Ep(t,s)&&(Qe="onCompositionEnd"):t==="keydown"&&s.keyCode===229&&(Qe="onCompositionStart");Qe&&(Np&&s.locale!=="ko"&&(Hl||Qe!=="onCompositionStart"?Qe==="onCompositionEnd"&&Hl&&(He=kp()):(Nr=ue,Pu="value"in Nr?Nr.value:Nr.textContent,Hl=!0)),Me=cc(te,Qe),0<Me.length&&(Qe=new jp(Qe,t,null,s,ue),he.push({event:Qe,listeners:Me}),He?Qe.data=He:(He=Ap(s),He!==null&&(Qe.data=He)))),(He=H2?P2(t,s):q2(t,s))&&(Qe=cc(te,"onBeforeInput"),0<Qe.length&&(Me=new jp("onBeforeInput","beforeinput",null,s,ue),he.push({event:Me,listeners:Qe}),Me.data=He)),Iw(he,t,te,s,ue)}hx(he,a)})}function pi(t,a,s){return{instance:t,listener:a,currentTarget:s}}function cc(t,a){for(var s=a+"Capture",c=[];t!==null;){var p=t,v=p.stateNode;if(p=p.tag,p!==5&&p!==26&&p!==27||v===null||(p=zs(t,s),p!=null&&c.unshift(pi(t,p,v)),p=zs(t,a),p!=null&&c.push(pi(t,p,v))),t.tag===3)return c;t=t.return}return[]}function Uw(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function gx(t,a,s,c,p){for(var v=a._reactName,S=[];s!==null&&s!==c;){var A=s,F=A.alternate,te=A.stateNode;if(A=A.tag,F!==null&&F===c)break;A!==5&&A!==26&&A!==27||te===null||(F=te,p?(te=zs(s,v),te!=null&&S.unshift(pi(s,te,F))):p||(te=zs(s,v),te!=null&&S.push(pi(s,te,F)))),s=s.return}S.length!==0&&t.push({event:a,listeners:S})}var $w=/\r\n?/g,Bw=/\u0000|\uFFFD/g;function xx(t){return(typeof t=="string"?t:""+t).replace($w,`
|
|
9
|
-
`).replace(Bw,"")}function yx(t,a){return a=xx(a),xx(t)===a}function vt(t,a,s,c,p,v){switch(s){case"children":typeof c=="string"?a==="body"||a==="textarea"&&c===""||Ul(t,c):(typeof c=="number"||typeof c=="bigint")&&a!=="body"&&Ul(t,""+c);break;case"className":mo(t,"class",c);break;case"tabIndex":mo(t,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":mo(t,s,c);break;case"style":yp(t,c,v);break;case"data":if(a!=="object"){mo(t,"data",c);break}case"src":case"href":if(c===""&&(a!=="a"||s!=="href")){t.removeAttribute(s);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(s);break}c=po(""+c),t.setAttribute(s,c);break;case"action":case"formAction":if(typeof c=="function"){t.setAttribute(s,"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 v=="function"&&(s==="formAction"?(a!=="input"&&vt(t,a,"name",p.name,p,null),vt(t,a,"formEncType",p.formEncType,p,null),vt(t,a,"formMethod",p.formMethod,p,null),vt(t,a,"formTarget",p.formTarget,p,null)):(vt(t,a,"encType",p.encType,p,null),vt(t,a,"method",p.method,p,null),vt(t,a,"target",p.target,p,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){t.removeAttribute(s);break}c=po(""+c),t.setAttribute(s,c);break;case"onClick":c!=null&&(t.onclick=Ja);break;case"onScroll":c!=null&&Ke("scroll",t);break;case"onScrollEnd":c!=null&&Ke("scrollend",t);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(l(61));if(s=c.__html,s!=null){if(p.children!=null)throw Error(l(60));t.innerHTML=s}}break;case"multiple":t.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":t.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){t.removeAttribute("xlink:href");break}s=po(""+c),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,""+c):t.removeAttribute(s);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":c&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,""):t.removeAttribute(s);break;case"capture":case"download":c===!0?t.setAttribute(s,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?t.setAttribute(s,c):t.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?t.setAttribute(s,c):t.removeAttribute(s);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?t.removeAttribute(s):t.setAttribute(s,c);break;case"popover":Ke("beforetoggle",t),Ke("toggle",t),fo(t,"popover",c);break;case"xlinkActuate":Za(t,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Za(t,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Za(t,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Za(t,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Za(t,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Za(t,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Za(t,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Za(t,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Za(t,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":fo(t,"is",c);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=h2.get(s)||s,fo(t,s,c))}}function jf(t,a,s,c,p,v){switch(s){case"style":yp(t,c,v);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(l(61));if(s=c.__html,s!=null){if(p.children!=null)throw Error(l(60));t.innerHTML=s}}break;case"children":typeof c=="string"?Ul(t,c):(typeof c=="number"||typeof c=="bigint")&&Ul(t,""+c);break;case"onScroll":c!=null&&Ke("scroll",t);break;case"onScrollEnd":c!=null&&Ke("scrollend",t);break;case"onClick":c!=null&&(t.onclick=Ja);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Cr.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(p=s.endsWith("Capture"),a=s.slice(2,p?s.length-7:void 0),v=t[Kt]||null,v=v!=null?v[s]:null,typeof v=="function"&&t.removeEventListener(a,v,p),typeof c=="function")){typeof v!="function"&&v!==null&&(s in t?t[s]=null:t.hasAttribute(s)&&t.removeAttribute(s)),t.addEventListener(a,c,p);break e}s in t?t[s]=c:c===!0?t.setAttribute(s,""):fo(t,s,c)}}}function un(t,a,s){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ke("error",t),Ke("load",t);var c=!1,p=!1,v;for(v in s)if(s.hasOwnProperty(v)){var S=s[v];if(S!=null)switch(v){case"src":c=!0;break;case"srcSet":p=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,a));default:vt(t,a,v,S,s,null)}}p&&vt(t,a,"srcSet",s.srcSet,s,null),c&&vt(t,a,"src",s.src,s,null);return;case"input":Ke("invalid",t);var A=v=S=p=null,F=null,te=null;for(c in s)if(s.hasOwnProperty(c)){var ue=s[c];if(ue!=null)switch(c){case"name":p=ue;break;case"type":S=ue;break;case"checked":F=ue;break;case"defaultChecked":te=ue;break;case"value":v=ue;break;case"defaultValue":A=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(l(137,a));break;default:vt(t,a,c,ue,s,null)}}hp(t,v,A,F,te,S,p,!1);return;case"select":Ke("invalid",t),c=S=v=null;for(p in s)if(s.hasOwnProperty(p)&&(A=s[p],A!=null))switch(p){case"value":v=A;break;case"defaultValue":S=A;break;case"multiple":c=A;default:vt(t,a,p,A,s,null)}a=v,s=S,t.multiple=!!c,a!=null?Dl(t,!!c,a,!1):s!=null&&Dl(t,!!c,s,!0);return;case"textarea":Ke("invalid",t),v=p=c=null;for(S in s)if(s.hasOwnProperty(S)&&(A=s[S],A!=null))switch(S){case"value":c=A;break;case"defaultValue":p=A;break;case"children":v=A;break;case"dangerouslySetInnerHTML":if(A!=null)throw Error(l(91));break;default:vt(t,a,S,A,s,null)}gp(t,c,p,v);return;case"option":for(F in s)s.hasOwnProperty(F)&&(c=s[F],c!=null)&&(F==="selected"?t.selected=c&&typeof c!="function"&&typeof c!="symbol":vt(t,a,F,c,s,null));return;case"dialog":Ke("beforetoggle",t),Ke("toggle",t),Ke("cancel",t),Ke("close",t);break;case"iframe":case"object":Ke("load",t);break;case"video":case"audio":for(c=0;c<hi.length;c++)Ke(hi[c],t);break;case"image":Ke("error",t),Ke("load",t);break;case"details":Ke("toggle",t);break;case"embed":case"source":case"link":Ke("error",t),Ke("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(te in s)if(s.hasOwnProperty(te)&&(c=s[te],c!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,a));default:vt(t,a,te,c,s,null)}return;default:if(Du(a)){for(ue in s)s.hasOwnProperty(ue)&&(c=s[ue],c!==void 0&&jf(t,a,ue,c,s,void 0));return}}for(A in s)s.hasOwnProperty(A)&&(c=s[A],c!=null&&vt(t,a,A,c,s,null))}function Hw(t,a,s,c){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var p=null,v=null,S=null,A=null,F=null,te=null,ue=null;for(le in s){var he=s[le];if(s.hasOwnProperty(le)&&he!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":F=he;default:c.hasOwnProperty(le)||vt(t,a,le,null,c,he)}}for(var re in c){var le=c[re];if(he=s[re],c.hasOwnProperty(re)&&(le!=null||he!=null))switch(re){case"type":v=le;break;case"name":p=le;break;case"checked":te=le;break;case"defaultChecked":ue=le;break;case"value":S=le;break;case"defaultValue":A=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(l(137,a));break;default:le!==he&&vt(t,a,re,le,c,he)}}Ou(t,S,A,F,te,ue,v,p);return;case"select":le=S=A=re=null;for(v in s)if(F=s[v],s.hasOwnProperty(v)&&F!=null)switch(v){case"value":break;case"multiple":le=F;default:c.hasOwnProperty(v)||vt(t,a,v,null,c,F)}for(p in c)if(v=c[p],F=s[p],c.hasOwnProperty(p)&&(v!=null||F!=null))switch(p){case"value":re=v;break;case"defaultValue":A=v;break;case"multiple":S=v;default:v!==F&&vt(t,a,p,v,c,F)}a=A,s=S,c=le,re!=null?Dl(t,!!s,re,!1):!!c!=!!s&&(a!=null?Dl(t,!!s,a,!0):Dl(t,!!s,s?[]:"",!1));return;case"textarea":le=re=null;for(A in s)if(p=s[A],s.hasOwnProperty(A)&&p!=null&&!c.hasOwnProperty(A))switch(A){case"value":break;case"children":break;default:vt(t,a,A,null,c,p)}for(S in c)if(p=c[S],v=s[S],c.hasOwnProperty(S)&&(p!=null||v!=null))switch(S){case"value":re=p;break;case"defaultValue":le=p;break;case"children":break;case"dangerouslySetInnerHTML":if(p!=null)throw Error(l(91));break;default:p!==v&&vt(t,a,S,p,c,v)}pp(t,re,le);return;case"option":for(var Ne in s)re=s[Ne],s.hasOwnProperty(Ne)&&re!=null&&!c.hasOwnProperty(Ne)&&(Ne==="selected"?t.selected=!1:vt(t,a,Ne,null,c,re));for(F in c)re=c[F],le=s[F],c.hasOwnProperty(F)&&re!==le&&(re!=null||le!=null)&&(F==="selected"?t.selected=re&&typeof re!="function"&&typeof re!="symbol":vt(t,a,F,re,c,le));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 Ie in s)re=s[Ie],s.hasOwnProperty(Ie)&&re!=null&&!c.hasOwnProperty(Ie)&&vt(t,a,Ie,null,c,re);for(te in c)if(re=c[te],le=s[te],c.hasOwnProperty(te)&&re!==le&&(re!=null||le!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(l(137,a));break;default:vt(t,a,te,re,c,le)}return;default:if(Du(a)){for(var bt in s)re=s[bt],s.hasOwnProperty(bt)&&re!==void 0&&!c.hasOwnProperty(bt)&&jf(t,a,bt,void 0,c,re);for(ue in c)re=c[ue],le=s[ue],!c.hasOwnProperty(ue)||re===le||re===void 0&&le===void 0||jf(t,a,ue,re,c,le);return}}for(var Q in s)re=s[Q],s.hasOwnProperty(Q)&&re!=null&&!c.hasOwnProperty(Q)&&vt(t,a,Q,null,c,re);for(he in c)re=c[he],le=s[he],!c.hasOwnProperty(he)||re===le||re==null&&le==null||vt(t,a,he,re,c,le)}function vx(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Pw(){if(typeof performance.getEntriesByType=="function"){for(var t=0,a=0,s=performance.getEntriesByType("resource"),c=0;c<s.length;c++){var p=s[c],v=p.transferSize,S=p.initiatorType,A=p.duration;if(v&&A&&vx(S)){for(S=0,A=p.responseEnd,c+=1;c<s.length;c++){var F=s[c],te=F.startTime;if(te>A)break;var ue=F.transferSize,he=F.initiatorType;ue&&vx(he)&&(F=F.responseEnd,S+=ue*(F<A?1:(A-te)/(F-te)))}if(--c,a+=8*(v+S)/(p.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 Cf=null,Nf=null;function uc(t){return t.nodeType===9?t:t.ownerDocument}function bx(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 kx(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 Tf(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 Mf=null;function qw(){var t=window.event;return t&&t.type==="popstate"?t===Mf?!1:(Mf=t,!0):(Mf=null,!1)}var wx=typeof setTimeout=="function"?setTimeout:void 0,Fw=typeof clearTimeout=="function"?clearTimeout:void 0,Sx=typeof Promise=="function"?Promise:void 0,Vw=typeof queueMicrotask=="function"?queueMicrotask:typeof Sx<"u"?function(t){return Sx.resolve(null).then(t).catch(Gw)}:wx;function Gw(t){setTimeout(function(){throw t})}function qr(t){return t==="head"}function jx(t,a){var s=a,c=0;do{var p=s.nextSibling;if(t.removeChild(s),p&&p.nodeType===8)if(s=p.data,s==="/$"||s==="/&"){if(c===0){t.removeChild(p),ps(a);return}c--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")c++;else if(s==="html")gi(t.ownerDocument.documentElement);else if(s==="head"){s=t.ownerDocument.head,gi(s);for(var v=s.firstChild;v;){var S=v.nextSibling,A=v.nodeName;v[K]||A==="SCRIPT"||A==="STYLE"||A==="LINK"&&v.rel.toLowerCase()==="stylesheet"||s.removeChild(v),v=S}}else s==="body"&&gi(t.ownerDocument.body);s=p}while(s);ps(a)}function Cx(t,a){var s=t;t=0;do{var c=s.nextSibling;if(s.nodeType===1?a?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(a?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),c&&c.nodeType===8)if(s=c.data,s==="/$"){if(t===0)break;t--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||t++;s=c}while(s)}function Ef(t){var a=t.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var s=a;switch(a=a.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":Ef(s),de(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}t.removeChild(s)}}function Kw(t,a,s,c){for(;t.nodeType===1;){var p=s;if(t.nodeName.toLowerCase()!==a.toLowerCase()){if(!c&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(c){if(!t[K])switch(a){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(v=t.getAttribute("rel"),v==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(v!==p.rel||t.getAttribute("href")!==(p.href==null||p.href===""?null:p.href)||t.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin)||t.getAttribute("title")!==(p.title==null?null:p.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(v=t.getAttribute("src"),(v!==(p.src==null?null:p.src)||t.getAttribute("type")!==(p.type==null?null:p.type)||t.getAttribute("crossorigin")!==(p.crossOrigin==null?null:p.crossOrigin))&&v&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(a==="input"&&t.type==="hidden"){var v=p.name==null?null:""+p.name;if(p.type==="hidden"&&t.getAttribute("name")===v)return t}else return t;if(t=ca(t.nextSibling),t===null)break}return null}function Ww(t,a,s){if(a==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!s||(t=ca(t.nextSibling),t===null))return null;return t}function Nx(t,a){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=ca(t.nextSibling),t===null))return null;return t}function Af(t){return t.data==="$?"||t.data==="$~"}function Rf(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Yw(t,a){var s=t.ownerDocument;if(t.data==="$~")t._reactRetry=a;else if(t.data!=="$?"||s.readyState!=="loading")a();else{var c=function(){a(),s.removeEventListener("DOMContentLoaded",c)};s.addEventListener("DOMContentLoaded",c),t._reactRetry=c}}function ca(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 _f=null;function Tx(t){t=t.nextSibling;for(var a=0;t;){if(t.nodeType===8){var s=t.data;if(s==="/$"||s==="/&"){if(a===0)return ca(t.nextSibling);a--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||a++}t=t.nextSibling}return null}function Mx(t){t=t.previousSibling;for(var a=0;t;){if(t.nodeType===8){var s=t.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(a===0)return t;a--}else s!=="/$"&&s!=="/&"||a++}t=t.previousSibling}return null}function Ex(t,a,s){switch(a=uc(s),t){case"html":if(t=a.documentElement,!t)throw Error(l(452));return t;case"head":if(t=a.head,!t)throw Error(l(453));return t;case"body":if(t=a.body,!t)throw Error(l(454));return t;default:throw Error(l(451))}}function gi(t){for(var a=t.attributes;a.length;)t.removeAttributeNode(a[0]);de(t)}var ua=new Map,Ax=new Set;function dc(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var pr=$.d;$.d={f:Qw,r:Xw,D:Zw,C:Jw,L:eS,m:tS,X:aS,S:nS,M:rS};function Qw(){var t=pr.f(),a=nc();return t||a}function Xw(t){var a=Ee(t);a!==null&&a.tag===5&&a.type==="form"?K0(a):pr.r(t)}var fs=typeof document>"u"?null:document;function Rx(t,a,s){var c=fs;if(c&&typeof a=="string"&&a){var p=na(a);p='link[rel="'+t+'"][href="'+p+'"]',typeof s=="string"&&(p+='[crossorigin="'+s+'"]'),Ax.has(p)||(Ax.add(p),t={rel:t,crossOrigin:s,href:a},c.querySelector(p)===null&&(a=c.createElement("link"),un(a,"link",t),Je(a),c.head.appendChild(a)))}}function Zw(t){pr.D(t),Rx("dns-prefetch",t,null)}function Jw(t,a){pr.C(t,a),Rx("preconnect",t,a)}function eS(t,a,s){pr.L(t,a,s);var c=fs;if(c&&t&&a){var p='link[rel="preload"][as="'+na(a)+'"]';a==="image"&&s&&s.imageSrcSet?(p+='[imagesrcset="'+na(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(p+='[imagesizes="'+na(s.imageSizes)+'"]')):p+='[href="'+na(t)+'"]';var v=p;switch(a){case"style":v=ms(t);break;case"script":v=hs(t)}ua.has(v)||(t=y({rel:"preload",href:a==="image"&&s&&s.imageSrcSet?void 0:t,as:a},s),ua.set(v,t),c.querySelector(p)!==null||a==="style"&&c.querySelector(xi(v))||a==="script"&&c.querySelector(yi(v))||(a=c.createElement("link"),un(a,"link",t),Je(a),c.head.appendChild(a)))}}function tS(t,a){pr.m(t,a);var s=fs;if(s&&t){var c=a&&typeof a.as=="string"?a.as:"script",p='link[rel="modulepreload"][as="'+na(c)+'"][href="'+na(t)+'"]',v=p;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=hs(t)}if(!ua.has(v)&&(t=y({rel:"modulepreload",href:t},a),ua.set(v,t),s.querySelector(p)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(yi(v)))return}c=s.createElement("link"),un(c,"link",t),Je(c),s.head.appendChild(c)}}}function nS(t,a,s){pr.S(t,a,s);var c=fs;if(c&&t){var p=st(c).hoistableStyles,v=ms(t);a=a||"default";var S=p.get(v);if(!S){var A={loading:0,preload:null};if(S=c.querySelector(xi(v)))A.loading=5;else{t=y({rel:"stylesheet",href:t,"data-precedence":a},s),(s=ua.get(v))&&Lf(t,s);var F=S=c.createElement("link");Je(F),un(F,"link",t),F._p=new Promise(function(te,ue){F.onload=te,F.onerror=ue}),F.addEventListener("load",function(){A.loading|=1}),F.addEventListener("error",function(){A.loading|=2}),A.loading|=4,fc(S,a,c)}S={type:"stylesheet",instance:S,count:1,state:A},p.set(v,S)}}}function aS(t,a){pr.X(t,a);var s=fs;if(s&&t){var c=st(s).hoistableScripts,p=hs(t),v=c.get(p);v||(v=s.querySelector(yi(p)),v||(t=y({src:t,async:!0},a),(a=ua.get(p))&&If(t,a),v=s.createElement("script"),Je(v),un(v,"link",t),s.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},c.set(p,v))}}function rS(t,a){pr.M(t,a);var s=fs;if(s&&t){var c=st(s).hoistableScripts,p=hs(t),v=c.get(p);v||(v=s.querySelector(yi(p)),v||(t=y({src:t,async:!0,type:"module"},a),(a=ua.get(p))&&If(t,a),v=s.createElement("script"),Je(v),un(v,"link",t),s.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},c.set(p,v))}}function _x(t,a,s,c){var p=(p=oe.current)?dc(p):null;if(!p)throw Error(l(446));switch(t){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(a=ms(s.href),s=st(p).hoistableStyles,c=s.get(a),c||(c={type:"style",instance:null,count:0,state:null},s.set(a,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){t=ms(s.href);var v=st(p).hoistableStyles,S=v.get(t);if(S||(p=p.ownerDocument||p,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(t,S),(v=p.querySelector(xi(t)))&&!v._p&&(S.instance=v,S.state.loading=5),ua.has(t)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},ua.set(t,s),v||lS(p,t,s,S.state))),a&&c===null)throw Error(l(528,""));return S}if(a&&c!==null)throw Error(l(529,""));return null;case"script":return a=s.async,s=s.src,typeof s=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=hs(s),s=st(p).hoistableScripts,c=s.get(a),c||(c={type:"script",instance:null,count:0,state:null},s.set(a,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,t))}}function ms(t){return'href="'+na(t)+'"'}function xi(t){return'link[rel="stylesheet"]['+t+"]"}function Lx(t){return y({},t,{"data-precedence":t.precedence,precedence:null})}function lS(t,a,s,c){t.querySelector('link[rel="preload"][as="style"]['+a+"]")?c.loading=1:(a=t.createElement("link"),c.preload=a,a.addEventListener("load",function(){return c.loading|=1}),a.addEventListener("error",function(){return c.loading|=2}),un(a,"link",s),Je(a),t.head.appendChild(a))}function hs(t){return'[src="'+na(t)+'"]'}function yi(t){return"script[async]"+t}function Ix(t,a,s){if(a.count++,a.instance===null)switch(a.type){case"style":var c=t.querySelector('style[data-href~="'+na(s.href)+'"]');if(c)return a.instance=c,Je(c),c;var p=y({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return c=(t.ownerDocument||t).createElement("style"),Je(c),un(c,"style",p),fc(c,s.precedence,t),a.instance=c;case"stylesheet":p=ms(s.href);var v=t.querySelector(xi(p));if(v)return a.state.loading|=4,a.instance=v,Je(v),v;c=Lx(s),(p=ua.get(p))&&Lf(c,p),v=(t.ownerDocument||t).createElement("link"),Je(v);var S=v;return S._p=new Promise(function(A,F){S.onload=A,S.onerror=F}),un(v,"link",c),a.state.loading|=4,fc(v,s.precedence,t),a.instance=v;case"script":return v=hs(s.src),(p=t.querySelector(yi(v)))?(a.instance=p,Je(p),p):(c=s,(p=ua.get(v))&&(c=y({},s),If(c,p)),t=t.ownerDocument||t,p=t.createElement("script"),Je(p),un(p,"link",c),t.head.appendChild(p),a.instance=p);case"void":return null;default:throw Error(l(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(c=a.instance,a.state.loading|=4,fc(c,s.precedence,t));return a.instance}function fc(t,a,s){for(var c=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=c.length?c[c.length-1]:null,v=p,S=0;S<c.length;S++){var A=c[S];if(A.dataset.precedence===a)v=A;else if(v!==p)break}v?v.parentNode.insertBefore(t,v.nextSibling):(a=s.nodeType===9?s.head:s,a.insertBefore(t,a.firstChild))}function Lf(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.title==null&&(t.title=a.title)}function If(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.integrity==null&&(t.integrity=a.integrity)}var mc=null;function Ox(t,a,s){if(mc===null){var c=new Map,p=mc=new Map;p.set(s,c)}else p=mc,c=p.get(s),c||(c=new Map,p.set(s,c));if(c.has(t))return c;for(c.set(t,null),s=s.getElementsByTagName(t),p=0;p<s.length;p++){var v=s[p];if(!(v[K]||v[Ht]||t==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var S=v.getAttribute(a)||"";S=t+S;var A=c.get(S);A?A.push(v):c.set(S,[v])}}return c}function zx(t,a,s){t=t.ownerDocument||t,t.head.insertBefore(s,a==="title"?t.querySelector("head > title"):null)}function sS(t,a,s){if(s===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 Dx(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function iS(t,a,s,c){if(s.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var p=ms(c.href),v=a.querySelector(xi(p));if(v){a=v._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(t.count++,t=hc.bind(t),a.then(t,t)),s.state.loading|=4,s.instance=v,Je(v);return}v=a.ownerDocument||a,c=Lx(c),(p=ua.get(p))&&Lf(c,p),v=v.createElement("link"),Je(v);var S=v;S._p=new Promise(function(A,F){S.onload=A,S.onerror=F}),un(v,"link",c),s.instance=v}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(s,a),(a=s.state.preload)&&(s.state.loading&3)===0&&(t.count++,s=hc.bind(t),a.addEventListener("load",s),a.addEventListener("error",s))}}var Of=0;function oS(t,a){return t.stylesheets&&t.count===0&&gc(t,t.stylesheets),0<t.count||0<t.imgCount?function(s){var c=setTimeout(function(){if(t.stylesheets&&gc(t,t.stylesheets),t.unsuspend){var v=t.unsuspend;t.unsuspend=null,v()}},6e4+a);0<t.imgBytes&&Of===0&&(Of=62500*Pw());var p=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&gc(t,t.stylesheets),t.unsuspend)){var v=t.unsuspend;t.unsuspend=null,v()}},(t.imgBytes>Of?50:800)+a);return t.unsuspend=s,function(){t.unsuspend=null,clearTimeout(c),clearTimeout(p)}}:null}function hc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)gc(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var pc=null;function gc(t,a){t.stylesheets=null,t.unsuspend!==null&&(t.count++,pc=new Map,a.forEach(cS,t),pc=null,hc.call(t))}function cS(t,a){if(!(a.state.loading&4)){var s=pc.get(t);if(s)var c=s.get(null);else{s=new Map,pc.set(t,s);for(var p=t.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<p.length;v++){var S=p[v];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(s.set(S.dataset.precedence,S),c=S)}c&&s.set(null,c)}p=a.instance,S=p.getAttribute("data-precedence"),v=s.get(S)||c,v===c&&s.set(null,p),s.set(S,p),this.count++,c=hc.bind(this),p.addEventListener("load",c),p.addEventListener("error",c),v?v.parentNode.insertBefore(p,v.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(p,t.firstChild)),a.state.loading|=4}}var vi={$$typeof:_,Provider:null,Consumer:null,_currentValue:G,_currentValue2:G,_threadCount:0};function uS(t,a,s,c,p,v,S,A,F){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=Zn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Zn(0),this.hiddenUpdates=Zn(null),this.identifierPrefix=c,this.onUncaughtError=p,this.onCaughtError=v,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=F,this.incompleteTransitions=new Map}function Ux(t,a,s,c,p,v,S,A,F,te,ue,he){return t=new uS(t,a,s,S,F,te,ue,he,A),a=1,v===!0&&(a|=24),v=Dn(3,null,null,a),t.current=v,v.stateNode=t,a=md(),a.refCount++,t.pooledCache=a,a.refCount++,v.memoizedState={element:c,isDehydrated:s,cache:a},xd(v),t}function $x(t){return t?(t=Vl,t):Vl}function Bx(t,a,s,c,p,v){p=$x(p),c.context===null?c.context=p:c.pendingContext=p,c=_r(a),c.payload={element:s},v=v===void 0?null:v,v!==null&&(c.callback=v),s=Lr(t,c,a),s!==null&&(Tn(s,t,a),Xs(s,t,a))}function Hx(t,a){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var s=t.retryLane;t.retryLane=s!==0&&s<a?s:a}}function zf(t,a){Hx(t,a),(t=t.alternate)&&Hx(t,a)}function Px(t){if(t.tag===13||t.tag===31){var a=cl(t,67108864);a!==null&&Tn(a,t,67108864),zf(t,67108864)}}function qx(t){if(t.tag===13||t.tag===31){var a=Pn();a=ll(a);var s=cl(t,a);s!==null&&Tn(s,t,a),zf(t,a)}}var xc=!0;function dS(t,a,s,c){var p=z.T;z.T=null;var v=$.p;try{$.p=2,Df(t,a,s,c)}finally{$.p=v,z.T=p}}function fS(t,a,s,c){var p=z.T;z.T=null;var v=$.p;try{$.p=8,Df(t,a,s,c)}finally{$.p=v,z.T=p}}function Df(t,a,s,c){if(xc){var p=Uf(c);if(p===null)Sf(t,a,c,yc,s),Vx(t,c);else if(hS(p,t,a,s,c))c.stopPropagation();else if(Vx(t,c),a&4&&-1<mS.indexOf(t)){for(;p!==null;){var v=Ee(p);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var S=en(v.pendingLanes);if(S!==0){var A=v;for(A.pendingLanes|=2,A.entangledLanes|=2;S;){var F=1<<31-xe(S);A.entanglements[1]|=F,S&=~F}$a(v),(ct&6)===0&&(ec=St()+500,mi(0))}}break;case 31:case 13:A=cl(v,2),A!==null&&Tn(A,v,2),nc(),zf(v,2)}if(v=Uf(c),v===null&&Sf(t,a,c,yc,s),v===p)break;p=v}p!==null&&c.stopPropagation()}else Sf(t,a,c,null,s)}}function Uf(t){return t=$u(t),$f(t)}var yc=null;function $f(t){if(yc=null,t=Se(t),t!==null){var a=u(t);if(a===null)t=null;else{var s=a.tag;if(s===13){if(t=d(a),t!==null)return t;t=null}else if(s===31){if(t=f(a),t!==null)return t;t=null}else if(s===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;t=null}else a!==t&&(t=null)}}return yc=t,null}function Fx(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 ie:return 2;case ye:return 8;case we:case Oe:return 32;case Fe:return 268435456;default:return 32}default:return 32}}var Bf=!1,Fr=null,Vr=null,Gr=null,bi=new Map,ki=new Map,Kr=[],mS="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 Vx(t,a){switch(t){case"focusin":case"focusout":Fr=null;break;case"dragenter":case"dragleave":Vr=null;break;case"mouseover":case"mouseout":Gr=null;break;case"pointerover":case"pointerout":bi.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":ki.delete(a.pointerId)}}function wi(t,a,s,c,p,v){return t===null||t.nativeEvent!==v?(t={blockedOn:a,domEventName:s,eventSystemFlags:c,nativeEvent:v,targetContainers:[p]},a!==null&&(a=Ee(a),a!==null&&Px(a)),t):(t.eventSystemFlags|=c,a=t.targetContainers,p!==null&&a.indexOf(p)===-1&&a.push(p),t)}function hS(t,a,s,c,p){switch(a){case"focusin":return Fr=wi(Fr,t,a,s,c,p),!0;case"dragenter":return Vr=wi(Vr,t,a,s,c,p),!0;case"mouseover":return Gr=wi(Gr,t,a,s,c,p),!0;case"pointerover":var v=p.pointerId;return bi.set(v,wi(bi.get(v)||null,t,a,s,c,p)),!0;case"gotpointercapture":return v=p.pointerId,ki.set(v,wi(ki.get(v)||null,t,a,s,c,p)),!0}return!1}function Gx(t){var a=Se(t.target);if(a!==null){var s=u(a);if(s!==null){if(a=s.tag,a===13){if(a=d(s),a!==null){t.blockedOn=a,Qa(t.priority,function(){qx(s)});return}}else if(a===31){if(a=f(s),a!==null){t.blockedOn=a,Qa(t.priority,function(){qx(s)});return}}else if(a===3&&s.stateNode.current.memoizedState.isDehydrated){t.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}t.blockedOn=null}function vc(t){if(t.blockedOn!==null)return!1;for(var a=t.targetContainers;0<a.length;){var s=Uf(t.nativeEvent);if(s===null){s=t.nativeEvent;var c=new s.constructor(s.type,s);Uu=c,s.target.dispatchEvent(c),Uu=null}else return a=Ee(s),a!==null&&Px(a),t.blockedOn=s,!1;a.shift()}return!0}function Kx(t,a,s){vc(t)&&s.delete(a)}function pS(){Bf=!1,Fr!==null&&vc(Fr)&&(Fr=null),Vr!==null&&vc(Vr)&&(Vr=null),Gr!==null&&vc(Gr)&&(Gr=null),bi.forEach(Kx),ki.forEach(Kx)}function bc(t,a){t.blockedOn===a&&(t.blockedOn=null,Bf||(Bf=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,pS)))}var kc=null;function Wx(t){kc!==t&&(kc=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){kc===t&&(kc=null);for(var a=0;a<t.length;a+=3){var s=t[a],c=t[a+1],p=t[a+2];if(typeof c!="function"){if($f(c||s)===null)continue;break}var v=Ee(s);v!==null&&(t.splice(a,3),a-=3,Dd(v,{pending:!0,data:p,method:s.method,action:c},c,p))}}))}function ps(t){function a(F){return bc(F,t)}Fr!==null&&bc(Fr,t),Vr!==null&&bc(Vr,t),Gr!==null&&bc(Gr,t),bi.forEach(a),ki.forEach(a);for(var s=0;s<Kr.length;s++){var c=Kr[s];c.blockedOn===t&&(c.blockedOn=null)}for(;0<Kr.length&&(s=Kr[0],s.blockedOn===null);)Gx(s),s.blockedOn===null&&Kr.shift();if(s=(t.ownerDocument||t).$$reactFormReplay,s!=null)for(c=0;c<s.length;c+=3){var p=s[c],v=s[c+1],S=p[Kt]||null;if(typeof v=="function")S||Wx(s);else if(S){var A=null;if(v&&v.hasAttribute("formAction")){if(p=v,S=v[Kt]||null)A=S.formAction;else if($f(p)!==null)continue}else A=S.action;typeof A=="function"?s[c+1]=A:(s.splice(c,3),c-=3),Wx(s)}}}function Yx(){function t(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(S){return p=S})},focusReset:"manual",scroll:"manual"})}function a(){p!==null&&(p(),p=null),c||setTimeout(s,20)}function s(){if(!c&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,p=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(s,100),function(){c=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),p!==null&&(p(),p=null)}}}function Hf(t){this._internalRoot=t}wc.prototype.render=Hf.prototype.render=function(t){var a=this._internalRoot;if(a===null)throw Error(l(409));var s=a.current,c=Pn();Bx(s,c,t,a,null,null)},wc.prototype.unmount=Hf.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var a=t.containerInfo;Bx(t.current,2,null,t,null,null),nc(),a[Oa]=null}};function wc(t){this._internalRoot=t}wc.prototype.unstable_scheduleHydration=function(t){if(t){var a=Sr();t={blockedOn:null,target:t,priority:a};for(var s=0;s<Kr.length&&a!==0&&a<Kr[s].priority;s++);Kr.splice(s,0,t),s===0&&Gx(t)}};var Qx=n.version;if(Qx!=="19.2.7")throw Error(l(527,Qx,"19.2.7"));$.findDOMNode=function(t){var a=t._reactInternals;if(a===void 0)throw typeof t.render=="function"?Error(l(188)):(t=Object.keys(t).join(","),Error(l(268,t)));return t=h(a),t=t!==null?g(t):null,t=t===null?null:t.stateNode,t};var gS={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Sc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Sc.isDisabled&&Sc.supportsFiber)try{Pt=Sc.inject(gS),gt=Sc}catch{}}return ji.createRoot=function(t,a){if(!o(t))throw Error(l(299));var s=!1,c="",p=ag,v=rg,S=lg;return a!=null&&(a.unstable_strictMode===!0&&(s=!0),a.identifierPrefix!==void 0&&(c=a.identifierPrefix),a.onUncaughtError!==void 0&&(p=a.onUncaughtError),a.onCaughtError!==void 0&&(v=a.onCaughtError),a.onRecoverableError!==void 0&&(S=a.onRecoverableError)),a=Ux(t,1,!1,null,null,s,c,null,p,v,S,Yx),t[Oa]=a.current,wf(t),new Hf(a)},ji.hydrateRoot=function(t,a,s){if(!o(t))throw Error(l(299));var c=!1,p="",v=ag,S=rg,A=lg,F=null;return s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(p=s.identifierPrefix),s.onUncaughtError!==void 0&&(v=s.onUncaughtError),s.onCaughtError!==void 0&&(S=s.onCaughtError),s.onRecoverableError!==void 0&&(A=s.onRecoverableError),s.formState!==void 0&&(F=s.formState)),a=Ux(t,1,!0,a,s??null,c,p,F,v,S,A,Yx),a.context=$x(null),s=a.current,c=Pn(),c=ll(c),p=_r(c),p.callback=null,Lr(s,p,c),s=c,a.current.lanes=s,ka(a,s),$a(a),t[Oa]=a.current,wf(t),new wc(a)},ji.version="19.2.7",ji}var sy;function CS(){if(sy)return Ff.exports;sy=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(),Ff.exports=jS(),Ff.exports}var NS=CS();const gv={appName:"PenguinHarness",nav:{chat:"对话",newChat:"新对话",agents:"智能体仓库",skills:"技能库",models:"模型仓库",usage:"成本中心",traces:"轨迹观测",benchmark:"评估中心",lastConversation:"最近一次对话",railAgents:"智能体",collapseSidebar:"收起侧栏",expandSidebar:"展开侧栏",collapseGroup:"折叠",expandGroup:"展开",pinGroup:"置顶分组",unpinGroup:"取消置顶"},settings:{language:"语言",theme:"主题",themeLight:"浅色",themeDark:"深色",followSystem:"跟随系统",langZh:"中文",langEn:"English",fontSize:"字号",fontSmall:"小",fontMedium:"中",fontLarge:"大",accent:"主题色",accentNames:{neutral:"灰白",blue:"蓝",green:"绿",violet:"紫",rose:"红",amber:"橙"}},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)",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",exampleTasks:{game:{label:"示例:2D 企鹅雪橇越野小游戏",desc:"可爱南极企鹅滑雪橇跳石头,难度由易到难的 2D 纯前端小游戏",prompt:"做一个可爱的南极企鹅滑雪橇越野 2D 小游戏:按空格键起跳,跃过冰面上迎面而来的石头;开局要足够简单、上手无压力,滑行速度与障碍密度随时间平滑、循序渐进地上升,避免突然变难,实时计分,撞上石头即结束并可一键重新开始。2D 横版画面、可爱卡通风,纯前端实现(单个 HTML 文件即可),界面遵循 web-design 技能。完成后在浏览器里自测一次,确认开局能轻松玩过几秒,并告诉我怎么打开和怎么玩。"},lol:{label:"示例:英雄联盟音乐播放器",desc:"用 SoundCloud Widget API 播放历届 Worlds 主题曲,单文件即开即用",prompt:`用 SoundCloud Widget API(见 https://developers.soundcloud.com/docs/api/html5-widget)做一个英雄联盟 Worlds 主题曲播放器,单文件 index.html,file:// 打开即用。
|
|
10
|
-
|
|
11
|
-
## 技术约束
|
|
12
|
-
- 使用 SC.Widget JS API(widget.load / widget.toggle / widget.setVolume / widget.seekTo),引入 https://w.soundcloud.com/player/api.js
|
|
13
|
-
- iframe 必须可见(180px 高),visual=true color=f0b90b single_active=true
|
|
14
|
-
- 仅包含以下 8 首已确认可播曲目(oEmbed 验证通过),不要添加未经 oEmbed 验证的曲目:
|
|
15
|
-
- Warriors (S4) — soundcloud.com/leagueoflegends/warriors
|
|
16
|
-
- Worlds Collide (S5) — soundcloud.com/leagueoflegends/worlds-collide
|
|
17
|
-
- Legends Never Die (S7) — soundcloud.com/leagueoflegends/legends-never-die
|
|
18
|
-
- Phoenix (S9) — soundcloud.com/leagueoflegends/phoenix
|
|
19
|
-
- Burn It All Down (S11) — soundcloud.com/leagueoflegends/burn-it-all-down
|
|
20
|
-
- GODS (S13) — soundcloud.com/leagueoflegends/gods
|
|
21
|
-
- Heavy Is The Crown (S14) — soundcloud.com/linkinpark/heavy-is-the-crown
|
|
22
|
-
- Sacrifice (S15) — soundcloud.com/leagueoflegends/sacrifice
|
|
23
|
-
|
|
24
|
-
## 布局
|
|
25
|
-
- 左侧 260px 粘性侧边栏:曲目列表(S4/S5/… 标签 + emoji + 曲名 + 年份),点击高亮金色边框,SC.Widget.load() 切歌 + auto_play
|
|
26
|
-
- 右侧主区域:Hero 标题 + 桌面时钟(80px 等宽金色 HH:MM:SS,每秒刷新,冒号闪烁)+ 心情标签
|
|
27
|
-
- 播放器卡片:SoundCloud iframe + 自定义控制栏(⏮ ▶/⏸ ⏭ + 曲目信息 + 音量滑块,点击喇叭图标静音切换)
|
|
28
|
-
- 心情波动区:15 根金色动画柱,切歌时重新随机生成
|
|
29
|
-
- 键盘快捷键:空格播放暂停、← → 切歌、↑ ↓ 调音量
|
|
30
|
-
|
|
31
|
-
## 设计
|
|
32
|
-
Penguin 视觉风格(见 web-design 技能),深色/浅色主题(<html data-theme>),默认深色,localStorage 记忆。响应式:手机端侧边栏变为顶部横向滚动。
|
|
33
|
-
|
|
34
|
-
完成后在浏览器打开 index.html 自测一次。`},rag:{label:"示例:构建 Claude Code 文档专家",desc:"收集 claude-code-docs 仓库,生成可对话、带来源引用的 RAG 知识应用",prompt:"收集 https://github.com/ericbuess/claude-code-docs 的文档,构建一个 RAG 知识应用:克隆仓库并整理语料,建立检索索引;应用化身 Claude Code 配置专家,检索增强回答 Claude Code 相关问题并标注可点击的来源引用——引用要能展示命中的原文片段,并链接到真实文档;按 web-design 技能提供美观的 Web 聊天界面,空态展示几个示例问题。完成后运行应用、自测一个问题验证流式回答,并告诉我访问方式。"}},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:"回到最新消息",inputPlaceholder:"输入消息,Enter 发送,Shift+Enter 换行,可粘贴图片",inputPlaceholderShort:"输入消息…",steerPlaceholder:"给运行中的 Agent 留言,随下一轮对话送达",steerPlaceholderShort:"给运行中的 Agent 留言…",steerSend:"发送给运行中的 Agent",steerQueuedIndicator:"插话已排队,将随下一轮送达",userSteering:"用户插话",moreSettings:"更多设置",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}`:""}`,reconnect:(e,n,r)=>{const l=e==="timeout"?"连接超时或网络中断":"响应不完整或无法解析",o=n==="gaveUp"?"已停止重试":n==="retried"?`已发起第 ${r} 次重试`:`正在发起第 ${r} 次重试…`;return`[重试] ${l},${o}`},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:"打开工作区",filesInMessage:e=>`${e} 个文件`,openPreview:"点击预览",showMoreFiles:e=>`显示其余 ${e} 个文件`,showLess:"收起",contextUsage:"上下文占用",contextUnknown:"上下文占用:压缩后待下次请求回报",slashHint:"输入 / 使用命令",mentionHint:"@ handoff 给其他 Agent",mentionRemove:"移除 @ 目标",skillsSelect:"技能",skillRemove:"移除技能",skillsSearchPlaceholder:"搜索技能",skillsNoMatch:"没有匹配的技能",skillsEmptyHint:"暂无已装技能,去技能库添加",skillsAutoMessage:e=>`使用 ${e.join("、")} 技能`,handoffFrom:e=>`由 ${e} 的对话交接而来`,handoffBack:e=>e?`回到原对话:${e}`:"回到原对话",switchModel:"切换模型开启新会话延续本对话",switchModelTitle:"切换模型",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("、")}`},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:"暂无异常"},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})`},benchmark:{title:"评估中心",selectBenchmark:"在左侧选择一个 Benchmark",emptyAgent:"该 Agent 暂无 Benchmark",caseCount:e=>`${e} 题`,trendTitle:e=>`${e}随时间变化`,evaluations:"评估明细",noEvaluations:"暂无评估记录",summaryLabel:"评估说明",legendUnlabeled:"未标注模型",colVersion:"版本",colModel:"模型",colScore:"总分",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:"文件过大。",payload_too_large:"请求体过大。",dir_not_absolute:"目录必须是绝对路径。",not_a_dir:"该路径不是目录。",path_not_found:"该路径不存在。",workspace_missing:"该 Session 的 Workspace 已不存在。",task_in_progress:"该 Session 已有任务在运行。",version_conflict:"快照版本不高于当前版本。",invalid_title:"标题无效。"}}};let x=gv;function TS(e){x=e}const MS={appName:"PenguinHarness",nav:{chat:"Chat",newChat:"New chat",agents:"Agents",skills:"Skills",models:"Models",usage:"Costs",traces:"Trajectory",benchmark:"Evaluation Center",lastConversation:"Last conversation",railAgents:"Agents",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",collapseGroup:"Collapse",expandGroup:"Expand",pinGroup:"Pin group",unpinGroup:"Unpin group"},settings:{language:"Language",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"}},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)",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",exampleTasks:{game:{label:"Example: 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."},lol:{label:"Example: 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://.
|
|
35
|
-
|
|
36
|
-
## Technical constraints
|
|
37
|
-
- Use the SC.Widget JS API (widget.load / widget.toggle / widget.setVolume / widget.seekTo), loading https://w.soundcloud.com/player/api.js
|
|
38
|
-
- The iframe must stay visible (180px tall), with visual=true color=f0b90b single_active=true
|
|
39
|
-
- Include ONLY these 8 tracks confirmed playable (oEmbed-verified); do not add tracks that are not oEmbed-verified:
|
|
40
|
-
- Warriors (S4) — soundcloud.com/leagueoflegends/warriors
|
|
41
|
-
- Worlds Collide (S5) — soundcloud.com/leagueoflegends/worlds-collide
|
|
42
|
-
- Legends Never Die (S7) — soundcloud.com/leagueoflegends/legends-never-die
|
|
43
|
-
- Phoenix (S9) — soundcloud.com/leagueoflegends/phoenix
|
|
44
|
-
- Burn It All Down (S11) — soundcloud.com/leagueoflegends/burn-it-all-down
|
|
45
|
-
- GODS (S13) — soundcloud.com/leagueoflegends/gods
|
|
46
|
-
- Heavy Is The Crown (S14) — soundcloud.com/linkinpark/heavy-is-the-crown
|
|
47
|
-
- Sacrifice (S15) — soundcloud.com/leagueoflegends/sacrifice
|
|
48
|
-
|
|
49
|
-
## Layout
|
|
50
|
-
- 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
|
|
51
|
-
- Right main area: hero title + a desktop clock (80px monospace gold HH:MM:SS, refreshed every second, blinking colons) + a mood tag
|
|
52
|
-
- Player card: the SoundCloud iframe + a custom control bar (⏮ ▶/⏸ ⏭ + track info + a volume slider; clicking the speaker icon toggles mute)
|
|
53
|
-
- Mood-wave section: 15 gold animated bars, re-randomized on every track switch
|
|
54
|
-
- Keyboard shortcuts: Space play/pause, ← → previous/next, ↑ ↓ volume
|
|
55
|
-
|
|
56
|
-
## Design
|
|
57
|
-
Penguin visual style (see the web-design skill), dark/light themes via <html data-theme>, dark by default, remembered in localStorage. Responsive: on phones the sidebar becomes a horizontally scrolling top bar.
|
|
58
|
-
|
|
59
|
-
When done, open index.html in a browser and self-test once.`},rag:{label:"Example: build a Claude Code docs expert",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, with a few example questions in the empty state. When done, run the app, verify one streamed answer yourself, and tell me how to access it."}},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",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",userSteering:"User steering",moreSettings:"More settings",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}`:""}`,reconnect:(e,n,r)=>{const l=e==="timeout"?"Connection timed out":"Response incomplete or unparseable",o=n==="gaveUp"?"no further retries":n==="retried"?`retry #${r} sent`:`starting retry #${r}…`;return`[Retry] ${l}; ${o}`},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",filesInMessage:e=>`${e} ${e===1?"file":"files"}`,openPreview:"Click to preview",showMoreFiles:e=>`Show ${e} more ${e===1?"file":"files"}`,showLess:"Show less",contextUsage:"Context usage",contextUnknown:"Context usage: unknown until the next request reports it",slashHint:"Type / for commands",mentionHint:"@ to handoff to another agent",mentionRemove:"Remove @ 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 — continue this conversation in a new session",switchModelTitle:"Switch model",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(", ")}`},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"},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})`},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`,evaluations:"Evaluations",noEvaluations:"No evaluations yet",summaryLabel:"Summary",legendUnlabeled:"unlabeled model",colVersion:"Version",colModel:"Model",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.",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."}}},xv="penguin.lang",yv=b.createContext(null);function ES(e){return e?.toLowerCase().startsWith("zh")?"zh":"en"}function AS(){return ES(navigator.language)}function RS(e){return e==="system"?AS():e}function _S(){const e=localStorage.getItem(xv);return e==="zh"||e==="en"||e==="system"?e:"system"}function LS({children:e}){const[n,r]=b.useState(_S),[,l]=b.useState(0),o=RS(n);TS(o==="en"?MS:gv),b.useEffect(()=>{if(n!=="system")return;const d=()=>l(f=>f+1);return window.addEventListener("languagechange",d),()=>window.removeEventListener("languagechange",d)},[n]);const u=b.useCallback(d=>{localStorage.setItem(xv,d),r(d)},[]);return i.jsx(yv.Provider,{value:{lang:n,locale:o,setLang:u},children:e})}function IS({children:e}){const{locale:n}=Ga();return i.jsx("div",{className:"contents",children:e},n)}function Ga(){const e=b.useContext(yv);if(!e)throw new Error("useLocale must be used within a LocaleProvider");return e}const ch=7,vv="penguin.theme",bv="penguin.fontScale",kv="penguin.accent",wv="penguin.currency",OS={sm:"16px",md:"18px",lg:"20px"},Sv=b.createContext(null);function zS(){const e=localStorage.getItem(vv);return e==="light"||e==="dark"||e==="system"?e:"system"}function DS(){const e=localStorage.getItem(bv);return e==="sm"||e==="md"||e==="lg"?e:"md"}function US(){const e=localStorage.getItem(kv);return e==="neutral"||e==="blue"||e==="green"||e==="violet"||e==="rose"||e==="amber"?e:"neutral"}function $S(){return localStorage.getItem(wv)==="CNY"?"CNY":"USD"}function BS(){return window.matchMedia("(prefers-color-scheme: dark)").matches}function HS({children:e}){const[n,r]=b.useState(zS),[l,o]=b.useState(BS),[u,d]=b.useState(DS),[f,m]=b.useState(US),[h,g]=b.useState($S),y=n==="system"?l:n==="dark";b.useEffect(()=>{document.documentElement.classList.toggle("dark",y)},[y]),b.useEffect(()=>{document.documentElement.style.fontSize=OS[u]},[u]),b.useEffect(()=>{f==="neutral"?delete document.documentElement.dataset.accent:document.documentElement.dataset.accent=f},[f]),b.useEffect(()=>{if(n!=="system")return;const j=window.matchMedia("(prefers-color-scheme: dark)"),E=L=>o(L.matches);return o(j.matches),j.addEventListener("change",E),()=>j.removeEventListener("change",E)},[n]);const k=b.useCallback(j=>{localStorage.setItem(vv,j),r(j)},[]),w=b.useCallback(j=>{localStorage.setItem(bv,j),d(j)},[]),N=b.useCallback(j=>{localStorage.setItem(kv,j),m(j)},[]),C=b.useCallback(j=>{localStorage.setItem(wv,j),g(j)},[]);return i.jsx(Sv.Provider,{value:{mode:n,dark:y,setMode:k,fontScale:u,setFontScale:w,accent:f,setAccent:N,currency:h,setCurrency:C},children:e})}function Ll(){const e=b.useContext(Sv);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e}const PS=[{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 Ra extends Error{status;code;constructor(n,r,l){super(l),this.name="ApiError",this.status=n,this.code=r}}let jv=null;function iy(e){jv=e}function qS(e){return e.startsWith("/api/auth/")}async function Ae(e,n={}){let r=e;if(n.query){const u=new URLSearchParams;for(const[f,m]of Object.entries(n.query))m!==void 0&&u.set(f,String(m));const d=u.toString();d&&(r+=`?${d}`)}let l;try{l=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 Ra(0,"network_error",x.errors.networkError)}if(!l.ok){let u="http_error",d=x.common.unknownError;try{const f=await l.json();f.error?.code&&(u=f.error.code),f.error?.message&&(d=f.error.message)}catch{}throw l.status===401&&!qS(e)&&jv?.(),new Ra(l.status,u,d)}if(l.status===204)return;const o=await l.text();if(o)return JSON.parse(o)}const FS=e=>Ae("/api/auth/login",{method:"POST",body:e}),VS=()=>Ae("/api/auth/logout",{method:"POST",body:{}}),Kc=()=>Ae("/api/me"),GS=e=>Ae("/api/me/password",{method:"PUT",body:e}),KS=()=>Ae("/api/me/prefs"),Cv=e=>Ae("/api/me/prefs",{method:"PUT",body:e}),WS=()=>Ae("/api/admin/users"),YS=e=>Ae("/api/admin/users",{method:"POST",body:e}),QS=(e,n)=>Ae(`/api/admin/users/${encodeURIComponent(e)}/password`,{method:"POST",body:n}),XS=e=>Ae(`/api/admin/users/${encodeURIComponent(e)}`,{method:"DELETE"}),ZS=()=>Ae("/api/projects"),JS=e=>Ae("/api/projects",{method:"POST",body:e}),ej=e=>Ae(`/api/projects/${encodeURIComponent(e)}`,{method:"DELETE"}),Wf=e=>Ae(`/api/projects/${encodeURIComponent(e)}/members`),tj=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/members`,{method:"POST",body:n}),nj=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/members/${encodeURIComponent(n)}`,{method:"DELETE"}),pu=e=>Ae(`/api/projects/${encodeURIComponent(e)}/models`),aj=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/models`,{method:"PUT",body:n}),Nv=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/models/test`,{method:"POST",body:n}),rj=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/vault`),lj=(e,n,r)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/vault`,{method:"PUT",body:r}),sj=e=>Ae(`/api/projects/${encodeURIComponent(e)}/agents`),ij=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents`,{method:"POST",body:n}),uh=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/config`),Tv=(e,n,r)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/config`,{method:"PUT",body:r}),oj=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/config/reset`,{method:"POST"}),cj=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces`),oy=(e,n,r)=>{const l=r?`?limit=${r.limit}&offset=${r.offset}`+(r.category?`&category=${r.category}`:"")+(r.withCounts?"&counts=1":""):"";return Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/sessions${l}`)},cy=(e,n="")=>Ae(`/api/projects/${encodeURIComponent(e)}/dirs?path=${encodeURIComponent(n)}`),Zc=(e,n,r)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/sessions`,{method:"POST",body:r}),uy=e=>Ae(`/api/sessions/${encodeURIComponent(e)}`),Mm=(e,n)=>Ae(`/api/sessions/${encodeURIComponent(e)}`,{method:"PATCH",body:n}),Ki=e=>Ae(`/api/sessions/${encodeURIComponent(e)}`,{method:"DELETE"}),uj=e=>Ae(`/api/sessions/${encodeURIComponent(e)}/messages`),ws=(e,n)=>Ae(`/api/sessions/${encodeURIComponent(e)}/tasks`,{method:"POST",body:n}),dj=(e,n,r)=>Ae(`/api/sessions/${encodeURIComponent(e)}/approvals/${encodeURIComponent(n)}`,{method:"POST",body:r}),fj=e=>Ae(`/api/sessions/${encodeURIComponent(e)}/abort`,{method:"POST",body:{}}),mj=(e,n)=>Ae(`/api/sessions/${encodeURIComponent(e)}/steer`,{method:"POST",body:n}),hj=e=>Ae(`/api/sessions/${encodeURIComponent(e)}/compact`,{method:"POST",body:{}}),pj=(e,n,r,l,o,u)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/${encodeURIComponent(r)}/${l}`,{query:{offset:o,limit:u}}),gj=(e,n,r,l)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/traces/${encodeURIComponent(r)}/${l}/analysis`),Mv=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/usage`,{query:{from:n.from,to:n.to,groupBy:n.groupBy,agentId:n.agentId,provider:n.provider,modelId:n.modelId}}),xj=(e,n)=>Ae(`/api/projects/${e}/agents/${n}`,{method:"DELETE"}),yj=(e,n)=>Ae(`/api/sessions/${e}/files`,{query:{path:n}}),Yr=(e,n,r=!1)=>`/api/sessions/${e}/files/content?path=${encodeURIComponent(n)}${r?"&download=1":""}`,dy=(e,n)=>`/api/sessions/${e}/files/preview-redirect?path=${encodeURIComponent(n)}`,vj=(e,n,r)=>Ae(`/api/sessions/${e}/files/content`,{method:"PUT",body:{dataBase64:r},query:{path:n}}),bj=(e,n)=>Ae(`/api/sessions/${e}/files/stat`,{method:"POST",body:{paths:n}}),kj=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules`),wj=(e,n,r)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules`,{method:"POST",body:r}),fy=(e,n,r,l)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules/${encodeURIComponent(r)}`,{method:"PUT",body:l}),Sj=(e,n,r)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/schedules/${encodeURIComponent(r)}`,{method:"DELETE"}),jj=()=>Ae("/api/skills"),dh=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills`),my=(e,n,r)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills`,{method:"POST",body:{names:r}}),Cj=(e,n,r)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/skills/${encodeURIComponent(r)}`,{method:"DELETE"}),Nj=(e,n)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/benchmarks`),Tj=(e,n)=>`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/export`,Mj=(e,n,r)=>Ae(`/api/projects/${encodeURIComponent(e)}/agents/${encodeURIComponent(n)}/import`,{method:"POST",body:r}),Ev=b.createContext(null);function Ej({children:e}){const[n,r]=b.useState(void 0),[l,o]=b.useState(!0);b.useEffect(()=>(iy(()=>r(null)),()=>iy(null)),[]),b.useEffect(()=>{let m=!1;return Kc().then(h=>{m||(r(h.user),o(h.previewIsolated))}).catch(h=>{m||(h instanceof Ra&&h.status,r(null))}),()=>{m=!0}},[]);const u=b.useCallback(async(m,h)=>{const g=await FS({userId:m,password:h});r(g.user);try{const y=await Kc();r(y.user),o(y.previewIsolated)}catch{}},[]),d=b.useCallback(async()=>{try{await VS()}finally{r(null)}},[]),f=b.useCallback(async()=>{const m=await Kc();r(m.user),o(m.previewIsolated)},[]);return i.jsx(Ev.Provider,{value:{user:n,previewIsolated:l,login:u,logout:d,refresh:f},children:e})}function bn(){const e=b.useContext(Ev);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}var fh=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Av=/^[\\/]{2}/;function Aj(e,n){return n+e.replace(/\\/g,"/")}var hy="popstate";function py(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function Rj(e={}){function n(l,o){let u=o.state?.masked,{pathname:d,search:f,hash:m}=u||l.location;return Em("",{pathname:d,search:f,hash:m},o.state&&o.state.usr||null,o.state&&o.state.key||"default",u?{pathname:l.location.pathname,search:l.location.search,hash:l.location.hash}:void 0)}function r(l,o){return typeof o=="string"?o:Wi(o)}return Lj(n,r,null,e)}function It(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function xa(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function _j(){return Math.random().toString(36).substring(2,10)}function gy(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 Em(e,n,r=null,l,o){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?Ts(n):n,state:r,key:n&&n.key||l||_j(),mask:o}}function Wi({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 Ts(e){let n={};if(e){let r=e.indexOf("#");r>=0&&(n.hash=e.substring(r),e=e.substring(0,r));let l=e.indexOf("?");l>=0&&(n.search=e.substring(l),e=e.substring(0,l)),e&&(n.pathname=e)}return n}function Lj(e,n,r,l={}){let{window:o=document.defaultView,v5Compat:u=!1}=l,d=o.history,f="POP",m=null,h=g();h==null&&(h=0,d.replaceState({...d.state,idx:h},""));function g(){return(d.state||{idx:null}).idx}function y(){f="POP";let j=g(),E=j==null?null:j-h;h=j,m&&m({action:f,location:C.location,delta:E})}function k(j,E){f="PUSH";let L=py(j)?j:Em(C.location,j,E);h=g()+1;let _=gy(L,h),q=C.createHref(L.mask||L);try{d.pushState(_,"",q)}catch(H){if(H instanceof DOMException&&H.name==="DataCloneError")throw H;o.location.assign(q)}u&&m&&m({action:f,location:C.location,delta:1})}function w(j,E){f="REPLACE";let L=py(j)?j:Em(C.location,j,E);h=g();let _=gy(L,h),q=C.createHref(L.mask||L);d.replaceState(_,"",q),u&&m&&m({action:f,location:C.location,delta:0})}function N(j){return Ij(o,j)}let C={get action(){return f},get location(){return e(o,d)},listen(j){if(m)throw new Error("A history only accepts one active listener");return o.addEventListener(hy,y),m=j,()=>{o.removeEventListener(hy,y),m=null}},createHref(j){return n(o,j)},createURL:N,encodeLocation(j){let E=N(j);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:k,replace:w,go(j){return d.go(j)}};return C}function Ij(e,n,r=!1){let l="http://localhost";e&&(l=e.location.origin!=="null"?e.location.origin:e.location.href),It(l,"No window.location.(origin|href) available to create URL");let o=typeof n=="string"?n:Wi(n);return o=o.replace(/ $/,"%20"),!r&&Av.test(o)&&(o=l+o),new URL(o,l)}function Rv(e,n,r="/"){return Oj(e,n,r,!1)}function Oj(e,n,r,l,o){let u=typeof n=="string"?Ts(n):n,d=br(u.pathname||"/",r);if(d==null)return null;let f=zj(e),m=null,h=zv(d);for(let g=0;m==null&&g<f.length;++g)m=Gj(f[g],h,l);return m}function zj(e){let n=_v(e);return Dj(n),n}function _v(e,n=[],r=[],l="",o=!1){let u=(d,f,m=o,h)=>{let g={relativePath:h===void 0?d.path||"":h,caseSensitive:d.caseSensitive===!0,childrenIndex:f,route:d};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(l)&&m)return;It(g.relativePath.startsWith(l),`Absolute route path "${g.relativePath}" nested under path "${l}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(l.length)}let y=Ea([l,g.relativePath]),k=r.concat(g);d.children&&d.children.length>0&&(It(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:Fj(y,d.index),routesMeta:k.map((w,N)=>{let[C,j]=Ov(w.relativePath,w.caseSensitive,N===k.length-1);return{...w,matcher:C,compiledParams:j}})})};return e.forEach((d,f)=>{if(d.path===""||!d.path?.includes("?"))u(d,f);else for(let m of Lv(d.path))u(d,f,!0,m)}),n}function Lv(e){let n=e.split("/");if(n.length===0)return[];let[r,...l]=n,o=r.endsWith("?"),u=r.replace(/\?$/,"");if(l.length===0)return o?[u,""]:[u];let d=Lv(l.join("/")),f=[];return f.push(...d.map(m=>m===""?u:[u,m].join("/"))),o&&f.push(...d),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function Dj(e){e.sort((n,r)=>n.score!==r.score?r.score-n.score:Vj(n.routesMeta.map(l=>l.childrenIndex),r.routesMeta.map(l=>l.childrenIndex)))}var Uj=/^:[\w-]+$/,$j=3,Bj=2,Hj=1,Pj=10,qj=-2,xy=e=>e==="*";function Fj(e,n){let r=e.split("/"),l=r.length;return r.some(xy)&&(l+=qj),n&&(l+=Bj),r.filter(o=>!xy(o)).reduce((o,u)=>o+(Uj.test(u)?$j:u===""?Hj:Pj),l)}function Vj(e,n){return e.length===n.length&&e.slice(0,-1).every((l,o)=>l===n[o])?e[e.length-1]-n[n.length-1]:0}function Gj(e,n,r=!1){let{routesMeta:l}=e,o={},u="/",d=[];for(let f=0;f<l.length;++f){let m=l[f],h=f===l.length-1,g=u==="/"?n:n.slice(u.length)||"/",y={path:m.relativePath,caseSensitive:m.caseSensitive,end:h},k=m.matcher&&m.compiledParams?Iv(y,g,m.matcher,m.compiledParams):Yi(y,g),w=m.route;if(!k&&h&&r&&!l[l.length-1].route.index&&(k=Yi({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},g)),!k)return null;Object.assign(o,k.params),d.push({params:o,pathname:Ea([u,k.pathname]),pathnameBase:Yj(Ea([u,k.pathnameBase])),route:w}),k.pathnameBase!=="/"&&(u=Ea([u,k.pathnameBase]))}return d}function Yi(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,l]=Ov(e.path,e.caseSensitive,e.end);return Iv(e,n,r,l)}function Iv(e,n,r,l){let o=n.match(r);if(!o)return null;let u=o[0],d=u.replace(/(.)\/+$/,"$1"),f=o.slice(1);return{params:l.reduce((h,{paramName:g,isOptional:y},k)=>{if(g==="*"){let N=f[k]||"";d=u.slice(0,u.length-N.length).replace(/(.)\/+$/,"$1")}const w=f[k];return y&&!w?h[g]=void 0:h[g]=(w||"").replace(/%2F/g,"/"),h},{}),pathname:u,pathnameBase:d,pattern:e}}function Ov(e,n=!1,r=!0){xa(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 l=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,f,m,h,g)=>{if(l.push({paramName:f,isOptional:m!=null}),m){let y=g.charAt(h+d.length);return y&&y!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(l.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,n?void 0:"i"),l]}function zv(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return xa(!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 br(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,l=e.charAt(r);return l&&l!=="/"?null:e.slice(r)||"/"}function Kj(e,n="/"){let{pathname:r,search:l="",hash:o=""}=typeof e=="string"?Ts(e):e,u;return r?(r=Dv(r),r.startsWith("/")?u=yy(r.substring(1),"/"):u=yy(r,n)):u=n,{pathname:u,search:Qj(l),hash:Xj(o)}}function yy(e,n){let r=Jc(n).split("/");return e.split("/").forEach(o=>{o===".."?r.length>1&&r.pop():o!=="."&&r.push(o)}),r.length>1?r.join("/"):"/"}function Yf(e,n,r,l){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(l)}]. 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 Wj(e){return e.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function mh(e){let n=Wj(e);return n.map((r,l)=>l===n.length-1?r.pathname:r.pathnameBase)}function gu(e,n,r,l=!1){let o;typeof e=="string"?o=Ts(e):(o={...e},It(!o.pathname||!o.pathname.includes("?"),Yf("?","pathname","search",o)),It(!o.pathname||!o.pathname.includes("#"),Yf("#","pathname","hash",o)),It(!o.search||!o.search.includes("#"),Yf("#","search","hash",o)));let u=e===""||o.pathname==="",d=u?"/":o.pathname,f;if(d==null)f=r;else{let y=n.length-1;if(!l&&d.startsWith("..")){let k=d.split("/");for(;k[0]==="..";)k.shift(),y-=1;o.pathname=k.join("/")}f=y>=0?n[y]:"/"}let m=Kj(o,f),h=d&&d!=="/"&&d.endsWith("/"),g=(u||d===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(h||g)&&(m.pathname+="/"),m}var Dv=e=>e.replace(/[\\/]{2,}/g,"/"),Ea=e=>Dv(e.join("/")),Jc=e=>e.replace(/\/+$/,""),Yj=e=>Jc(e).replace(/^\/*/,"/"),Qj=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Xj=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Zj=class{constructor(e,n,r,l=!1){this.status=e,this.statusText=n||"",this.internal=l,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Jj(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function e5(e){let n=e.map(r=>r.route.path).filter(Boolean);return Ea(n)||"/"}var Uv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function $v(e,n){let r=e;if(typeof r!="string"||!fh.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let l=r,o=!1;if(Uv)try{let u=new URL(window.location.href),d=Av.test(r)?new URL(Aj(r,u.protocol)):new URL(r),f=br(d.pathname,n);d.origin===u.origin&&f!=null?r=f+d.search+d.hash:o=!0}catch{xa(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:l,isExternal:o,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Bv=["POST","PUT","PATCH","DELETE"];new Set(Bv);var t5=["GET",...Bv];new Set(t5);var n5=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function a5(e){try{return n5.includes(new URL(e).protocol)}catch{return!1}}var Ms=b.createContext(null);Ms.displayName="DataRouter";var xu=b.createContext(null);xu.displayName="DataRouterState";var Hv=b.createContext(!1);function r5(){return b.useContext(Hv)}var Pv=b.createContext({isTransitioning:!1});Pv.displayName="ViewTransition";var l5=b.createContext(new Map);l5.displayName="Fetchers";var s5=b.createContext(null);s5.displayName="Await";var Wn=b.createContext(null);Wn.displayName="Navigation";var to=b.createContext(null);to.displayName="Location";var va=b.createContext({outlet:null,matches:[],isDataRoute:!1});va.displayName="Route";var hh=b.createContext(null);hh.displayName="RouteError";var qv="REACT_ROUTER_ERROR",i5="REDIRECT",o5="ROUTE_ERROR_RESPONSE";function c5(e){if(e.startsWith(`${qv}:${i5}:{`))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 u5(e){if(e.startsWith(`${qv}:${o5}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new Zj(n.status,n.statusText,n.data)}catch{}}function d5(e,{relative:n}={}){It(Il(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:l}=b.useContext(Wn),{hash:o,pathname:u,search:d}=no(e,{relative:n}),f=u;return r!=="/"&&(f=u==="/"?r:Ea([r,u])),l.createHref({pathname:f,search:d,hash:o})}function Il(){return b.useContext(to)!=null}function Yn(){return It(Il(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(to).location}function Fv(e){It(Il(),"useMatch() may be used only in the context of a <Router> component.");let{pathname:n}=Yn();return b.useMemo(()=>Yi(e,zv(n)),[n,e])}var Vv="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Gv(e){b.useContext(Wn).static||b.useLayoutEffect(e)}function Qn(){let{isDataRoute:e}=b.useContext(va);return e?N5():f5()}function f5(){It(Il(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(Ms),{basename:n,navigator:r}=b.useContext(Wn),{matches:l}=b.useContext(va),{pathname:o}=Yn(),u=JSON.stringify(mh(l)),d=b.useRef(!1);return Gv(()=>{d.current=!0}),b.useCallback((m,h={})=>{if(xa(d.current,Vv),!d.current)return;if(typeof m=="number"){r.go(m);return}let g=gu(m,JSON.parse(u),o,h.relative==="path");e==null&&n!=="/"&&(g.pathname=g.pathname==="/"?n:Ea([n,g.pathname])),(h.replace?r.replace:r.push)(g,h.state,h)},[n,r,u,o,e])}var m5=b.createContext(null);function h5(e){let n=b.useContext(va).outlet;return b.useMemo(()=>n&&b.createElement(m5.Provider,{value:e},n),[n,e])}function Kv(){let{matches:e}=b.useContext(va);return e[e.length-1]?.params??{}}function no(e,{relative:n}={}){let{matches:r}=b.useContext(va),{pathname:l}=Yn(),o=JSON.stringify(mh(r));return b.useMemo(()=>gu(e,JSON.parse(o),l,n==="path"),[e,o,l,n])}function p5(e,n){return Wv(e,n)}function Wv(e,n,r){It(Il(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:l}=b.useContext(Wn),{matches:o}=b.useContext(va),u=o[o.length-1],d=u?u.params:{},f=u?u.pathname:"/",m=u?u.pathnameBase:"/",h=u&&u.route;{let j=h&&h.path||"";Qv(f,!h||j.endsWith("*")||j.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${j}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
60
|
-
|
|
61
|
-
Please change the parent <Route path="${j}"> to <Route path="${j==="/"?"*":`${j}/*`}">.`)}let g=Yn(),y;if(n){let j=typeof n=="string"?Ts(n):n;It(m==="/"||j.pathname?.startsWith(m),`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 "${m}" but pathname "${j.pathname}" was given in the \`location\` prop.`),y=j}else y=g;let k=y.pathname||"/",w=k;if(m!=="/"){let j=m.replace(/^\//,"").split("/");w="/"+k.replace(/^\//,"").split("/").slice(j.length).join("/")}let N=r&&r.state.matches.length?r.state.matches.map(j=>Object.assign(j,{route:r.manifest[j.route.id]||j.route})):Rv(e,{pathname:w});xa(h||N!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),xa(N==null||N[N.length-1].route.element!==void 0||N[N.length-1].route.Component!==void 0||N[N.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let C=b5(N&&N.map(j=>Object.assign({},j,{params:Object.assign({},d,j.params),pathname:Ea([m,l.encodeLocation?l.encodeLocation(j.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?m:Ea([m,l.encodeLocation?l.encodeLocation(j.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathnameBase])})),o,r);return n&&C?b.createElement(to.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...y},navigationType:"POP"}},C):C}function g5(){let e=C5(),n=Jj(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,l="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:l},u={padding:"2px 4px",backgroundColor:l},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:u},"ErrorBoundary")," or"," ",b.createElement("code",{style:u},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},n),r?b.createElement("pre",{style:o},r):null,d)}var x5=b.createElement(g5,null),Yv=class extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}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=u5(e.digest);r&&(e=r)}let n=e!==void 0?b.createElement(va.Provider,{value:this.props.routeContext},b.createElement(hh.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(y5,{error:e},n):n}};Yv.contextType=Hv;var Qf=new WeakMap;function y5({children:e,error:n}){let{basename:r}=b.useContext(Wn);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let l=c5(n.digest);if(l){let o=Qf.get(n);if(o)throw o;let u=$v(l.location,r),d=u.absoluteURL||u.to;if(a5(d))throw new Error("Invalid redirect location");if(Uv&&!Qf.get(n))if(u.isExternal||l.reloadDocument)window.location.href=d;else{const f=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(u.to,{replace:l.replace}));throw Qf.set(n,f),f}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d}`})}}return e}function v5({routeContext:e,match:n,children:r}){let l=b.useContext(Ms);return l&&l.static&&l.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(va.Provider,{value:e},r)}function b5(e,n=[],r){let l=r?.state;if(e==null){if(!l)return null;if(l.errors)e=l.matches;else if(n.length===0&&!l.initialized&&l.matches.length>0)e=l.matches;else return null}let o=e,u=l?.errors;if(u!=null){let g=o.findIndex(y=>y.route.id&&u?.[y.route.id]!==void 0);It(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),o=o.slice(0,Math.min(o.length,g+1))}let d=!1,f=-1;if(r&&l){d=l.renderFallback;for(let g=0;g<o.length;g++){let y=o[g];if((y.route.HydrateFallback||y.route.hydrateFallbackElement)&&(f=g),y.route.id){let{loaderData:k,errors:w}=l,N=y.route.loader&&!k.hasOwnProperty(y.route.id)&&(!w||w[y.route.id]===void 0);if(y.route.lazy||N){r.isStatic&&(d=!0),f>=0?o=o.slice(0,f+1):o=[o[0]];break}}}}let m=r?.onError,h=l&&m?(g,y)=>{m(g,{location:l.location,params:l.matches?.[0]?.params??{},pattern:e5(l.matches),errorInfo:y})}:void 0;return o.reduceRight((g,y,k)=>{let w,N=!1,C=null,j=null;l&&(w=u&&y.route.id?u[y.route.id]:void 0,C=y.route.errorElement||x5,d&&(f<0&&k===0?(Qv("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),N=!0,j=null):f===k&&(N=!0,j=y.route.hydrateFallbackElement||null)));let E=n.concat(o.slice(0,k+1)),L=()=>{let _;return w?_=C:N?_=j:y.route.Component?_=b.createElement(y.route.Component,null):y.route.element?_=y.route.element:_=g,b.createElement(v5,{match:y,routeContext:{outlet:g,matches:E,isDataRoute:l!=null},children:_})};return l&&(y.route.ErrorBoundary||y.route.errorElement||k===0)?b.createElement(Yv,{location:l.location,revalidation:l.revalidation,component:C,error:w,children:L(),routeContext:{outlet:null,matches:E,isDataRoute:!0},onError:h}):L()},null)}function ph(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function k5(e){let n=b.useContext(Ms);return It(n,ph(e)),n}function w5(e){let n=b.useContext(xu);return It(n,ph(e)),n}function S5(e){let n=b.useContext(va);return It(n,ph(e)),n}function gh(e){let n=S5(e),r=n.matches[n.matches.length-1];return It(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function j5(){return gh("useRouteId")}function C5(){let e=b.useContext(hh),n=w5("useRouteError"),r=gh("useRouteError");return e!==void 0?e:n.errors?.[r]}function N5(){let{router:e}=k5("useNavigate"),n=gh("useNavigate"),r=b.useRef(!1);return Gv(()=>{r.current=!0}),b.useCallback(async(o,u={})=>{xa(r.current,Vv),r.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:n,...u}))},[e,n])}var vy={};function Qv(e,n,r){!n&&!vy[e]&&(vy[e]=!0,xa(!1,r))}b.memo(T5);function T5({routes:e,manifest:n,future:r,state:l,isStatic:o,onError:u}){return Wv(e,void 0,{manifest:n,state:l,isStatic:o,onError:u})}function Qi({to:e,replace:n,state:r,relative:l}){It(Il(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=b.useContext(Wn);xa(!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:u}=b.useContext(va),{pathname:d}=Yn(),f=Qn(),m=gu(e,mh(u),d,l==="path"),h=JSON.stringify(m);return b.useEffect(()=>{f(JSON.parse(h),{replace:n,state:r,relative:l})},[f,h,l,n,r]),null}function M5(e){return h5(e.context)}function Mn(e){It(!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 E5({basename:e="/",children:n=null,location:r,navigationType:l="POP",navigator:o,static:u=!1,useTransitions:d}){It(!Il(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=b.useMemo(()=>({basename:f,navigator:o,static:u,useTransitions:d,future:{}}),[f,o,u,d]);typeof r=="string"&&(r=Ts(r));let{pathname:h="/",search:g="",hash:y="",state:k=null,key:w="default",mask:N}=r,C=b.useMemo(()=>{let j=br(h,f);return j==null?null:{location:{pathname:j,search:g,hash:y,state:k,key:w,mask:N},navigationType:l}},[f,h,g,y,k,w,l,N]);return xa(C!=null,`<Router basename="${f}"> is not able to match the URL "${h}${g}${y}" because it does not start with the basename, so the <Router> won't render anything.`),C==null?null:b.createElement(Wn.Provider,{value:m},b.createElement(to.Provider,{children:n,value:C}))}function A5({children:e,location:n}){return p5(Am(e),n)}function Am(e,n=[]){let r=[];return b.Children.forEach(e,(l,o)=>{if(!b.isValidElement(l))return;let u=[...n,o];if(l.type===b.Fragment){r.push.apply(r,Am(l.props.children,u));return}It(l.type===Mn,`[${typeof l.type=="string"?l.type:l.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),It(!l.props.index||!l.props.children,"An index route cannot have child routes.");let d={id:l.props.id||u.join("-"),caseSensitive:l.props.caseSensitive,element:l.props.element,Component:l.props.Component,index:l.props.index,path:l.props.path,middleware:l.props.middleware,loader:l.props.loader,action:l.props.action,hydrateFallbackElement:l.props.hydrateFallbackElement,HydrateFallback:l.props.HydrateFallback,errorElement:l.props.errorElement,ErrorBoundary:l.props.ErrorBoundary,hasErrorBoundary:l.props.hasErrorBoundary===!0||l.props.ErrorBoundary!=null||l.props.errorElement!=null,shouldRevalidate:l.props.shouldRevalidate,handle:l.props.handle,lazy:l.props.lazy};l.props.children&&(d.children=Am(l.props.children,u)),r.push(d)}),r}var Wc="get",Yc="application/x-www-form-urlencoded";function yu(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function R5(e){return yu(e)&&e.tagName.toLowerCase()==="button"}function _5(e){return yu(e)&&e.tagName.toLowerCase()==="form"}function L5(e){return yu(e)&&e.tagName.toLowerCase()==="input"}function I5(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function O5(e,n){return e.button===0&&(!n||n==="_self")&&!I5(e)}function Rm(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,r)=>{let l=e[r];return n.concat(Array.isArray(l)?l.map(o=>[r,o]):[[r,l]])},[]))}function z5(e,n){let r=Rm(e);return n&&n.forEach((l,o)=>{r.has(o)||n.getAll(o).forEach(u=>{r.append(o,u)})}),r}var jc=null;function D5(){if(jc===null)try{new FormData(document.createElement("form"),0),jc=!1}catch{jc=!0}return jc}var U5=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Xf(e){return e!=null&&!U5.has(e)?(xa(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Yc}"`),null):e}function $5(e,n){let r,l,o,u,d;if(_5(e)){let f=e.getAttribute("action");l=f?br(f,n):null,r=e.getAttribute("method")||Wc,o=Xf(e.getAttribute("enctype"))||Yc,u=new FormData(e)}else if(R5(e)||L5(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(l=m?br(m,n):null,r=e.getAttribute("formmethod")||f.getAttribute("method")||Wc,o=Xf(e.getAttribute("formenctype"))||Xf(f.getAttribute("enctype"))||Yc,u=new FormData(f,e),!D5()){let{name:h,type:g,value:y}=e;if(g==="image"){let k=h?`${h}.`:"";u.append(`${k}x`,"0"),u.append(`${k}y`,"0")}else h&&u.append(h,y)}}else{if(yu(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Wc,l=null,o=Yc,d=e}return u&&o==="text/plain"&&(d=u,u=void 0),{action:l,method:r.toLowerCase(),encType:o,formData:u,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function xh(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Xv(e,n,r,l){let o=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?o.pathname.endsWith("/")?o.pathname=`${o.pathname}_.${l}`:o.pathname=`${o.pathname}.${l}`:o.pathname==="/"?o.pathname=`_root.${l}`:n&&br(o.pathname,n)==="/"?o.pathname=`${Jc(n)}/_root.${l}`:o.pathname=`${Jc(o.pathname)}.${l}`,o}async function B5(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 H5(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 P5(e,n,r){let l=await Promise.all(e.map(async o=>{let u=n.routes[o.route.id];if(u){let d=await B5(u,r);return d.links?d.links():[]}return[]}));return G5(l.flat(1).filter(H5).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function by(e,n,r,l,o,u){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 u==="assets"?n.filter((m,h)=>d(m,h)||f(m,h)):u==="data"?n.filter((m,h)=>{let g=l.routes[m.route.id];if(!g||!g.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 q5(e,n,{includeHydrateFallback:r}={}){return F5(e.map(l=>{let o=n.routes[l.route.id];if(!o)return[];let u=[o.module];return o.clientActionModule&&(u=u.concat(o.clientActionModule)),o.clientLoaderModule&&(u=u.concat(o.clientLoaderModule)),r&&o.hydrateFallbackModule&&(u=u.concat(o.hydrateFallbackModule)),o.imports&&(u=u.concat(o.imports)),u}).flat(1))}function F5(e){return[...new Set(e)]}function V5(e){let n={},r=Object.keys(e).sort();for(let l of r)n[l]=e[l];return n}function G5(e,n){let r=new Set;return new Set(n),e.reduce((l,o)=>{let u=JSON.stringify(V5(o));return r.has(u)||(r.add(u),l.push({key:u,link:o})),l},[])}function yh(){let e=b.useContext(Ms);return xh(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function K5(){let e=b.useContext(xu);return xh(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var vh=b.createContext(void 0);vh.displayName="FrameworkContext";function vu(){let e=b.useContext(vh);return xh(e,"You must render this element inside a <HydratedRouter> element"),e}function W5(e,n){let r=b.useContext(vh),[l,o]=b.useState(!1),[u,d]=b.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:h,onMouseLeave:g,onTouchStart:y}=n,k=b.useRef(null);b.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let C=E=>{E.forEach(L=>{d(L.isIntersecting)})},j=new IntersectionObserver(C,{threshold:.5});return k.current&&j.observe(k.current),()=>{j.disconnect()}}},[e]),b.useEffect(()=>{if(l){let C=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(C)}}},[l]);let w=()=>{o(!0)},N=()=>{o(!1),d(!1)};return r?e!=="intent"?[u,k,{}]:[u,k,{onFocus:Ci(f,w),onBlur:Ci(m,N),onMouseEnter:Ci(h,w),onMouseLeave:Ci(g,N),onTouchStart:Ci(y,w)}]:[!1,k,{}]}function Ci(e,n){return r=>{e&&e(r),r.defaultPrevented||n(r)}}function Y5({page:e,...n}){let r=r5(),{nonce:l}=vu(),{router:o}=yh(),u=b.useMemo(()=>Rv(o.routes,e,o.basename),[o.routes,e,o.basename]);return u?(n.nonce==null&&l&&(n={...n,nonce:l}),r?b.createElement(X5,{page:e,matches:u,...n}):b.createElement(Z5,{page:e,matches:u,...n})):null}function Q5(e){let{manifest:n,routeModules:r}=vu(),[l,o]=b.useState([]);return b.useEffect(()=>{let u=!1;return P5(e,n,r).then(d=>{u||o(d)}),()=>{u=!0}},[e,n,r]),l}function X5({page:e,matches:n,...r}){let l=Yn(),{future:o}=vu(),{basename:u}=yh(),d=b.useMemo(()=>{if(e===l.pathname+l.search+l.hash)return[];let f=Xv(e,u,o.v8_trailingSlashAwareDataRequests,"rsc"),m=!1,h=[];for(let g of n)typeof g.route.shouldRevalidate=="function"?m=!0:h.push(g.route.id);return m&&h.length>0&&f.searchParams.set("_routes",h.join(",")),[f.pathname+f.search]},[u,o.v8_trailingSlashAwareDataRequests,e,l,n]);return b.createElement(b.Fragment,null,d.map(f=>b.createElement("link",{key:f,rel:"prefetch",as:"fetch",href:f,...r})))}function Z5({page:e,matches:n,...r}){let l=Yn(),{future:o,manifest:u,routeModules:d}=vu(),{basename:f}=yh(),{loaderData:m,matches:h}=K5(),g=b.useMemo(()=>by(e,n,h,u,l,"data"),[e,n,h,u,l]),y=b.useMemo(()=>by(e,n,h,u,l,"assets"),[e,n,h,u,l]),k=b.useMemo(()=>{if(e===l.pathname+l.search+l.hash)return[];let C=new Set,j=!1;if(n.forEach(L=>{let _=u.routes[L.route.id];!_||!_.hasLoader||(!g.some(q=>q.route.id===L.route.id)&&L.route.id in m&&d[L.route.id]?.shouldRevalidate||_.hasClientLoader?j=!0:C.add(L.route.id))}),C.size===0)return[];let E=Xv(e,f,o.v8_trailingSlashAwareDataRequests,"data");return j&&C.size>0&&E.searchParams.set("_routes",n.filter(L=>C.has(L.route.id)).map(L=>L.route.id).join(",")),[E.pathname+E.search]},[f,o.v8_trailingSlashAwareDataRequests,m,l,u,g,n,e,d]),w=b.useMemo(()=>q5(y,u),[y,u]),N=Q5(y);return b.createElement(b.Fragment,null,k.map(C=>b.createElement("link",{key:C,rel:"prefetch",as:"fetch",href:C,...r})),w.map(C=>b.createElement("link",{key:C,rel:"modulepreload",href:C,...r})),N.map(({key:C,link:j})=>b.createElement("link",{key:C,nonce:r.nonce,...j,crossOrigin:j.crossOrigin??r.crossOrigin})))}function J5(...e){return n=>{e.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}var e4=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{e4&&(window.__reactRouterVersion="7.18.1")}catch{}function t4({basename:e,children:n,useTransitions:r,window:l}){let o=b.useRef();o.current==null&&(o.current=Rj({window:l,v5Compat:!0}));let u=o.current,[d,f]=b.useState({action:u.action,location:u.location}),m=b.useCallback(h=>{r===!1?f(h):b.startTransition(()=>f(h))},[r]);return b.useLayoutEffect(()=>u.listen(m),[u,m]),b.createElement(E5,{basename:e,children:n,location:d.location,navigationType:d.action,navigator:u,useTransitions:r})}var bh=b.forwardRef(function({onClick:n,discover:r="render",prefetch:l="none",relative:o,reloadDocument:u,replace:d,mask:f,state:m,target:h,to:g,preventScrollReset:y,viewTransition:k,defaultShouldRevalidate:w,...N},C){let{basename:j,navigator:E,useTransitions:L}=b.useContext(Wn),_=typeof g=="string"&&fh.test(g),q=$v(g,j);g=q.to;let H=d5(g,{relative:o}),I=Yn(),P=null;if(f){let U=gu(f,[],I.mask?I.mask.pathname:"/",!0);j!=="/"&&(U.pathname=U.pathname==="/"?j:Ea([j,U.pathname])),P=E.createHref(U)}let[ee,Z,D]=W5(l,N),V=r4(g,{replace:d,mask:f,state:m,target:h,preventScrollReset:y,relative:o,viewTransition:k,defaultShouldRevalidate:w,useTransitions:L});function B(U){n&&n(U),U.defaultPrevented||V(U)}let Y=!(q.isExternal||u),ne=b.createElement("a",{...N,...D,href:(Y?P:void 0)||q.absoluteURL||H,onClick:Y?B:n,ref:J5(C,Z),target:h,"data-discover":!_&&r==="render"?"true":void 0});return ee&&!_?b.createElement(b.Fragment,null,ne,b.createElement(Y5,{page:H})):ne});bh.displayName="Link";var kh=b.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:l="",end:o=!1,style:u,to:d,viewTransition:f,children:m,...h},g){let y=no(d,{relative:h.relative}),k=Yn(),w=b.useContext(xu),{navigator:N,basename:C}=b.useContext(Wn),j=w!=null&&c4(y)&&f===!0,E=N.encodeLocation?N.encodeLocation(y).pathname:y.pathname,L=k.pathname,_=w&&w.navigation&&w.navigation.location?w.navigation.location.pathname:null;r||(L=L.toLowerCase(),_=_?_.toLowerCase():null,E=E.toLowerCase()),_&&C&&(_=br(_,C)||_);const q=E!=="/"&&E.endsWith("/")?E.length-1:E.length;let H=L===E||!o&&L.startsWith(E)&&L.charAt(q)==="/",I=_!=null&&(_===E||!o&&_.startsWith(E)&&_.charAt(E.length)==="/"),P={isActive:H,isPending:I,isTransitioning:j},ee=H?n:void 0,Z;typeof l=="function"?Z=l(P):Z=[l,H?"active":null,I?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let D=typeof u=="function"?u(P):u;return b.createElement(bh,{...h,"aria-current":ee,className:Z,ref:g,style:D,to:d,viewTransition:f},typeof m=="function"?m(P):m)});kh.displayName="NavLink";var n4=b.forwardRef(({discover:e="render",fetcherKey:n,navigate:r,reloadDocument:l,replace:o,state:u,method:d=Wc,action:f,onSubmit:m,relative:h,preventScrollReset:g,viewTransition:y,defaultShouldRevalidate:k,...w},N)=>{let{useTransitions:C}=b.useContext(Wn),j=i4(),E=o4(f,{relative:h}),L=d.toLowerCase()==="get"?"get":"post",_=typeof f=="string"&&fh.test(f),q=H=>{if(m&&m(H),H.defaultPrevented)return;H.preventDefault();let I=H.nativeEvent.submitter,P=I?.getAttribute("formmethod")||d,ee=()=>j(I||H.currentTarget,{fetcherKey:n,method:P,navigate:r,replace:o,state:u,relative:h,preventScrollReset:g,viewTransition:y,defaultShouldRevalidate:k});C&&r!==!1?b.startTransition(()=>ee()):ee()};return b.createElement("form",{ref:N,method:L,action:E,onSubmit:l?m:q,...w,"data-discover":!_&&e==="render"?"true":void 0})});n4.displayName="Form";function a4(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Zv(e){let n=b.useContext(Ms);return It(n,a4(e)),n}function r4(e,{target:n,replace:r,mask:l,state:o,preventScrollReset:u,relative:d,viewTransition:f,defaultShouldRevalidate:m,useTransitions:h}={}){let g=Qn(),y=Yn(),k=no(e,{relative:d});return b.useCallback(w=>{if(O5(w,n)){w.preventDefault();let N=r!==void 0?r:Wi(y)===Wi(k),C=()=>g(e,{replace:N,mask:l,state:o,preventScrollReset:u,relative:d,viewTransition:f,defaultShouldRevalidate:m});h?b.startTransition(()=>C()):C()}},[y,g,k,r,l,o,n,e,u,d,f,m,h])}function wh(e){xa(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=b.useRef(Rm(e)),r=b.useRef(!1),l=Yn(),o=b.useMemo(()=>z5(l.search,r.current?null:n.current),[l.search]),u=Qn(),d=b.useCallback((f,m)=>{const h=Rm(typeof f=="function"?f(new URLSearchParams(o)):f);r.current=!0,u("?"+h,m)},[u,o]);return[o,d]}var l4=0,s4=()=>`__${String(++l4)}__`;function i4(){let{router:e}=Zv("useSubmit"),{basename:n}=b.useContext(Wn),r=j5(),l=e.fetch,o=e.navigate;return b.useCallback(async(u,d={})=>{let{action:f,method:m,encType:h,formData:g,body:y}=$5(u,n);if(d.navigate===!1){let k=d.fetcherKey||s4();await l(k,r,d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:g,body:y,formMethod:d.method||m,formEncType:d.encType||h,flushSync:d.flushSync})}else await o(d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:g,body:y,formMethod:d.method||m,formEncType:d.encType||h,replace:d.replace,state:d.state,fromRouteId:r,flushSync:d.flushSync,viewTransition:d.viewTransition})},[l,o,n,r])}function o4(e,{relative:n}={}){let{basename:r}=b.useContext(Wn),l=b.useContext(va);It(l,"useFormAction must be used inside a RouteContext");let[o]=l.matches.slice(-1),u={...no(e||".",{relative:n})},d=Yn();if(e==null){u.search=d.search;let f=new URLSearchParams(u.search),m=f.getAll("index");if(m.some(g=>g==="")){f.delete("index"),m.filter(y=>y).forEach(y=>f.append("index",y));let g=f.toString();u.search=g?`?${g}`:""}}return(!e||e===".")&&o.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(u.pathname=u.pathname==="/"?r:Ea([r,u.pathname])),Wi(u)}function c4(e,{relative:n}={}){let r=b.useContext(Pv);It(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:l}=Zv("useViewTransitionState"),o=no(e,{relative:n});if(!r.isTransitioning)return!1;let u=br(r.currentLocation.pathname,l)||r.currentLocation.pathname,d=br(r.nextLocation.pathname,l)||r.nextLocation.pathname;return Yi(o.pathname,d)!=null||Yi(o.pathname,u)!=null}const ky="penguin.lastProjectId",wy=e=>`penguin.lastAgentId.${e}`,Jv=b.createContext(null);function _m(e){return e.name??e.projectId}function hn(e){return e.name??e.agentId}function u4({children:e}){const[n,r]=b.useState([]),[l,o]=b.useState(!0),[u,d]=b.useState(null),[f,m]=b.useState([]),[h,g]=b.useState(!0),[y,k]=b.useState(null),w=b.useCallback(async()=>{o(!0);try{const L=await ZS();r(L.projects),d(_=>{const q=_??localStorage.getItem(ky);return(L.projects.find(I=>I.projectId===q)??L.projects[0])?.projectId??null})}finally{o(!1)}},[]);b.useEffect(()=>{w()},[w]);const N=b.useCallback(L=>{L!==u&&(localStorage.setItem(ky,L),d(L),k(null),m([]),g(!0),Cv({lastProjectId:L}).catch(()=>{}))},[u]),C=b.useCallback(async()=>{if(u){g(!0);try{const L=await sj(u);m(L.agents),k(_=>{const q=_??localStorage.getItem(wy(u)),H=L.agents.find(P=>P.agentId===q),I=L.agents.find(P=>P.agentId==="default_agent")??L.agents[0]??null;return(H??I)?.agentId??null})}finally{g(!1)}}},[u]);b.useEffect(()=>{m([]),C()},[C]);const j=b.useCallback(L=>{u&&localStorage.setItem(wy(u),L),k(L)},[u]),E=b.useMemo(()=>{const L=n.find(q=>q.projectId===u)??null,_=f.find(q=>q.agentId===y)??null;return{projects:n,projectsLoading:l,currentProject:L,setCurrentProjectId:N,reloadProjects:w,agents:f,agentsLoading:h,currentAgent:_,setCurrentAgentId:j,reloadAgents:C}},[n,l,u,N,w,f,h,y,j,C]);return i.jsx(Jv.Provider,{value:E,children:e})}function fn(){const e=b.useContext(Jv);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e}function eb(e,n){const r=new EventSource(e);r.onmessage=o=>{try{n.onOmniMessage(JSON.parse(o.data))}catch{}},r.addEventListener("server_event",o=>{try{n.onServerEvent(JSON.parse(o.data))}catch{}}),n.onOpen&&(r.onopen=n.onOpen);const{onError:l}=n;return l&&(r.onerror=()=>l(r.readyState===EventSource.CLOSED)),{close:()=>r.close()}}function d4(e,n){return eb(`/api/sessions/${encodeURIComponent(e)}/stream`,n)}function f4(e){return eb("/api/events",e)}const tb="\0temp-workspaces",m4=/[/\\]workspaces[/\\]tmp-[0-9a-f]{8}$/;function h4(e){const n=e.trim();return n===""||m4.test(n)}function eu(e){return h4(e)?tb:e.trim()}function p4(e){const n=e.trim().split(/[/\\]+/).filter(Boolean);return n[n.length-1]??"/"}const Cl=10;function Sy(e,n){return e.length>n?{items:e.slice(0,n),hasMore:!0}:{items:e,hasMore:!1}}function Ta(e){return e.archived?"archived":e.source==="subagent"||e.source==="schedule"?e.source:"active"}const Sh=["subagent","schedule","archived"];function jy(e){const n={active:[],subagent:[],schedule:[],archived:[]};for(const r of e)n[Ta(r)].push(r);return n}const g4=["active",...Sh];function x4(e){const n=new Map;for(const[r,l]of e)for(const[o,u]of Object.entries(l)){const d=eu(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 g4){const h=u[m];h>0&&(f.totals[m]+=h,f.agents[m].includes(r)||f.agents[m].push(r))}}return n}function nb(e){let n=null;for(const r of e){const l=Ta(r);l!=="active"&&l!=="schedule"||(!n||r.createdAt>n.createdAt||r.createdAt===n.createdAt&&r.sessionId>n.sessionId)&&(n=r)}return n}function y4(e){const n=new Map;for(const o of e){const u=eu(o.workspace);let d=n.get(u);if(!d){const f=u===tb;d={key:u,label:f?"":p4(o.workspace),fullPath:f?null:o.workspace.trim(),temp:f,sessions:[]},n.set(u,d)}d.sessions.push(o)}const r=(o,u)=>o<u?1:o>u?-1:0,l=[...n.values()];for(const o of l)o.sessions.sort((u,d)=>r(u.createdAt,d.createdAt));return l.sort((o,u)=>o.temp!==u.temp?o.temp?1:-1:r(o.sessions[0]?.createdAt??"",u.sessions[0]?.createdAt??"")),l}function Cy(e,n,r){if(r.size===0)return[...e];const l=[],o=[];for(const u of e)(r.has(n(u))?l:o).push(u);return[...l,...o]}const ab=b.createContext(null),Qr=(e,n)=>`${e}\0${n}`;function v4({children:e}){const{currentProject:n,agents:r}=fn(),l=n?.projectId??null,o=r.map(z=>z.agentId).join(","),[u,d]=b.useState([]),[f,m]=b.useState(new Map),[h,g]=b.useState(new Map),[y,k]=b.useState(new Map),[w,N]=b.useState(!0),C=b.useRef(0),j=b.useRef([]);j.current=u;const E=b.useRef(f);E.current=f;const L=b.useRef(h);L.current=h;const _=b.useCallback(async()=>{const z=o===""?[]:o.split(",");if(!l||z.length===0)return;const $=++C.current;N(!0);try{const G=await Promise.all(z.map(async X=>{const ae=["active",...Sh.filter(oe=>E.current.has(Qr(X,oe)))];try{const oe=await Promise.all(ae.map(async ge=>{const Te=await oy(l,X,{offset:0,limit:Cl+1,category:ge,...ge==="active"?{withCounts:!0}:{}});return{category:ge,counts:Te.counts,workspaceCounts:Te.workspaceCounts,...Sy(Te.sessions,Cl)}}));return{agentId:X,pages:oe}}catch{return{agentId:X,pages:[]}}}));if($!==C.current)return;const me=[],M=new Set,R=new Map,O=new Map,T=new Map;for(const X of G)for(const ae of X.pages){R.set(Qr(X.agentId,ae.category),{hasMore:ae.hasMore,fetched:ae.items.length}),ae.counts&&O.set(X.agentId,ae.counts),ae.workspaceCounts&&T.set(X.agentId,ae.workspaceCounts);for(const oe of ae.items)M.has(oe.sessionId)||(M.add(oe.sessionId),me.push(oe))}d(me),m(R),g(O),k(T)}finally{$===C.current&&N(!1)}},[l,o]);b.useEffect(()=>{d([]),E.current=new Map,m(E.current),g(new Map),k(new Map),_()},[_]);const q=b.useCallback(async(z,$)=>{if(!l)return;const G=[...new Set(z)].filter(O=>{const T=E.current.get(Qr(O,$));return T===void 0?(L.current.get(O)?.[$]??0)>0:T.hasMore});if(G.length===0)return;const me=C.current,M=await Promise.all(G.map(async O=>{const T=E.current.get(Qr(O,$))?.fetched??0;try{const X=(await oy(l,O,{offset:T,limit:Cl+1,category:$})).sessions;return{agentId:O,...Sy(X,Cl)}}catch{return null}}));if(me!==C.current)return;const R=M.filter(O=>O!==null);d(O=>{const T=new Set(O.map(ae=>ae.sessionId)),X=R.flatMap(ae=>ae.items.filter(oe=>!T.has(oe.sessionId)));return X.length>0?[...O,...X]:O}),m(O=>{const T=new Map(O);for(const X of R){const ae=Qr(X.agentId,$);T.set(ae,{hasMore:X.hasMore,fetched:(O.get(ae)?.fetched??0)+X.items.length})}return T})},[l]),H=b.useCallback((z,$)=>f.has(Qr(z,$)),[f]),I=b.useCallback((z,$)=>{const G=f.get(Qr(z,$));return G!==void 0?G.hasMore:(h.get(z)?.[$]??0)>0},[f,h]),P=b.useCallback((z,$,G)=>{const{agentId:me,workspace:M}=z;g(R=>{const O=R.get(me);if(!O)return R;const T=new Map(R);return T.set(me,{...O,[$]:Math.max(0,O[$]+G)}),T}),k(R=>{const O=R.get(me);if(!O)return R;const T=O[M]??{active:0,subagent:0,schedule:0,archived:0},X=new Map(R);return X.set(me,{...O,[M]:{...T,[$]:Math.max(0,T[$]+G)}}),X})},[]),ee=b.useRef(_);ee.current=_;const Z=b.useRef(l);Z.current=l,b.useEffect(()=>{const z=f4({onOmniMessage:()=>{},onServerEvent:$=>{$.type==="schedule_fired"&&$.projectId===Z.current&&ee.current()}});return()=>z.close()},[]);const D=b.useCallback(z=>{C.current+=1,!j.current.some(G=>G.sessionId===z.sessionId)&&E.current.get(Qr(z.agentId,Ta(z)))?.hasMore===!1&&P(z,Ta(z),1),d(G=>[z,...G.filter(me=>me.sessionId!==z.sessionId)])},[P]),V=b.useCallback(z=>{C.current+=1;const $=j.current.find(G=>G.sessionId===z);$&&P($,Ta($),-1),d(G=>G.filter(me=>me.sessionId!==z))},[P]),B=b.useCallback(z=>{const $=j.current.find(G=>G.sessionId===z.sessionId);$&&Ta($)!==Ta(z)&&(P(z,Ta($),-1),P(z,Ta(z),1)),d(G=>G.map(me=>me.sessionId===z.sessionId?z:me))},[P]),Y=b.useCallback((z,$)=>{d(G=>{const me=G.find(M=>M.sessionId===z);return!me||me.status===$?G:G.map(M=>M.sessionId===z?{...M,status:$}:M)})},[]),ne=b.useCallback((z,$)=>{d(G=>G.map(me=>me.sessionId===z?{...me,title:$}:me))},[]),U=b.useMemo(()=>{const z=new Map;for(const $ of u){const G=z.get($.agentId);G?G.push($):z.set($.agentId,[$])}for(const $ of z.values())$.sort((G,me)=>me.createdAt.localeCompare(G.createdAt)||me.sessionId.localeCompare(G.sessionId));return{sessions:u,byAgent:z,countsByAgent:h,workspaceCountsByAgent:y,isLoadedFor:H,hasMoreFor:I,loading:w,reload:_,loadMoreFor:q,add:D,remove:V,replace:B,setStatus:Y,setTitle:ne}},[u,h,y,H,I,w,_,q,D,V,B,Y,ne]);return i.jsx(ab.Provider,{value:U,children:e})}function ao(){const e=b.useContext(ab);if(!e)throw new Error("useSessions must be used within a SessionsProvider");return e}function jh({size:e=12,className:n=""}){return i.jsx("svg",{width:e,height:e,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor","aria-hidden":!0,className:`shrink-0 ${n}`,children:i.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function rb({size:e=13,className:n=""}){return i.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":!0,className:`shrink-0 ${n}`,children:i.jsx("path",{d:"M5 12l4 4L19 6",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ch({onClose:e,className:n="",...r}){return i.jsx("button",{type:"button","aria-label":x.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:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor","aria-hidden":!0,children:i.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})})}function b4({open:e,side:n="left",title:r,onClose:l,children:o,widthClass:u}){return b.useEffect(()=>{if(!e)return;const d=f=>{f.key==="Escape"&&l()};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[e,l]),e?i.jsxs("div",{className:"fixed inset-0 z-50",children:[i.jsx("div",{className:"anim-fade absolute inset-0 bg-black/45",onMouseDown:l}),i.jsxs("div",{className:`absolute inset-y-0 flex w-[80vw] flex-col bg-white shadow-xl dark:bg-gray-900 ${u??"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:[i.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-gray-200 px-4 py-3 dark:border-gray-800",children:[i.jsx("span",{className:"text-base font-semibold",children:r??""}),i.jsx(Ch,{onClose:l})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto pb-[env(safe-area-inset-bottom)]",children:o})]})]}):null}function Ve({d:e,size:n=13,className:r=""}){return i.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:i.jsx("path",{d:e})})}function ze(e,n){return e instanceof Ra?e.code==="model_credential_missing"?n?.modelId?x.errors.modelCredentialMissing(n.modelId):e.message:e.code==="no_default_model"?x.errors.noDefaultModel:x.errors.byCode[e.code]??e.message:x.common.unknownError}var Es=pv();const Cc=4,Ni=8;function _a({button:e,open:n,setOpen:r,children:l,menuClass:o,menuStyle:u,className:d,portal:f}){const m=b.useRef(null),h=b.useRef(null),[g,y]=b.useState(null);b.useEffect(()=>{if(!n)return;const N=j=>{const E=j.target;m.current?.contains(E)||h.current?.contains(E)||r(!1)},C=j=>{j.key==="Escape"&&r(!1)};return window.addEventListener("mousedown",N),window.addEventListener("keydown",C),()=>{window.removeEventListener("mousedown",N),window.removeEventListener("keydown",C)}},[n,r]);const k=b.useCallback(()=>{if(!n||!f||!m.current){y(null);return}const N=m.current.getBoundingClientRect(),C=h.current,j=C?.offsetWidth??0,E=C?.offsetHeight??0,L=f.align==="right"?N.right-j:N.left,_=Math.max(Ni,Math.min(L,window.innerWidth-j-Ni)),q=window.innerHeight-N.bottom-Cc-Ni,H=N.top-Cc-Ni,I=f.direction==="up",ee=(I?E<=H:E<=q)?I:H>q;y({left:_,maxHeight:Math.max(0,ee?H:q),...ee?{bottom:window.innerHeight-N.top+Cc}:{top:N.bottom+Cc}})},[n,f?.direction,f?.align,l]);b.useLayoutEffect(k,[k]),b.useEffect(()=>{if(!n||!f)return;const N=C=>{h.current?.contains(C.target)||k()};return window.addEventListener("scroll",N,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",k)}},[n,f,k]);const w=`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 i.jsxs("div",{className:`relative ${d??""}`,ref:m,children:[e,n&&(f?Es.createPortal(i.jsx("div",{ref:h,style:{position:"fixed",...g?{left:g.left,maxHeight:g.maxHeight,...g.top!==void 0?{top:g.top}:{},...g.bottom!==void 0?{bottom:g.bottom}:{}}:{left:0,top:0,visibility:"hidden"},maxWidth:`calc(100vw - ${Ni*2}px)`,...u},className:w,children:l}),document.body):i.jsx("div",{ref:h,...u!==void 0?{style:u}:{},className:`absolute ${w}`,children:l}))]})}function k4(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 w4(e){return k4(e)%360}function lb(e){const n=w4(e);return{bg:`hsl(${n} 55% 50% / 0.14)`,fg:`hsl(${n} 55% 28%)`,fgDark:`hsl(${n} 55% 73%)`}}const Ny=typeof Intl<"u"&&typeof Intl.Segmenter=="function"?new Intl.Segmenter(void 0,{granularity:"grapheme"}):void 0;function Ty(e){if(e){if(!Ny)return Array.from(e)[0];for(const n of Ny.segment(e))return n.segment}}function sb(e,n){const r=Ty(e.trim())??Ty((n??"").trim());return r?r.toUpperCase():"?"}function tl({id:e,name:n,size:r=18,className:l}){const o=lb(e);return i.jsxs("svg",{width:r,height:r,viewBox:"0 0 24 24",className:l,style:{"--tile-fg":o.fg,"--tile-fg-dark":o.fgDark},"aria-hidden":!0,role:"img",children:[i.jsx("rect",{x:"0",y:"0",width:"24",height:"24",rx:"5",fill:o.bg}),i.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:sb(n??"",e)})]})}function gn({open:e,size:n=14,className:r=""}){return i.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:i.jsx("path",{d:"M9 5l7 7-7 7"})})}const S4={success:2500,info:4e3,error:6e3};let vr=[],j4=1;const Lm=new Set;function Im(){for(const e of Lm)e(vr)}const C4=160;function ib(e){const n=vr.find(r=>r.id===e);!n||n.leaving||(vr=vr.map(r=>r.id===e?{...r,leaving:!0}:r),Im(),setTimeout(()=>{vr=vr.filter(r=>r.id!==e),Im()},C4))}function Nh(e,n){if(!n)return;const r=j4++;vr=[...vr,{id:r,kind:e,text:n}],Im(),setTimeout(()=>ib(r),S4[e])}const ga=e=>Nh("success",e),Et=e=>Nh("error",e),Ol=e=>Nh("info",e),N4={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 T4(){const[e,n]=b.useState(vr);return b.useEffect(()=>(Lm.add(n),()=>{Lm.delete(n)}),[]),e.length===0?null:Es.createPortal(i.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=>i.jsx("button",{type:"button",onClick:()=>ib(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"} ${N4[r.kind]}`,children:r.text},r.id))}),document.body)}function bu({text:e,className:n=""}){const r=b.useRef(null),[l,o]=b.useState(!1);return b.useLayoutEffect(()=>{const u=r.current;if(!u)return;const d=()=>o(u.scrollWidth>u.clientWidth+1);if(d(),typeof ResizeObserver>"u")return;const f=new ResizeObserver(d);return f.observe(u),()=>f.disconnect()},[e,n]),i.jsx("span",{ref:r,className:`truncate ${n}`,...l?{title:e}:{},children:e})}const M4={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 Lt({tone:e="gray",children:n}){return i.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-semibold ${M4[e]}`,children:n})}function Om(e){switch(e){case"completed":return"green";case"aborted":return"amber";default:return"red"}}const Ti=[];function dn({open:e,title:n,onClose:r,children:l,footer:o,widthClass:u,headerless:d}){return b.useEffect(()=>{if(!e)return;const f=Symbol("modal");Ti.push(f);const m=h=>{h.key==="Escape"&&Ti[Ti.length-1]===f&&r()};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m);const h=Ti.lastIndexOf(f);h!==-1&&Ti.splice(h,1)}},[e,r]),e?Es.createPortal(i.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:i.jsxs("div",{...d?{role:"dialog","aria-label":n}:{},className:`anim-pop w-full ${u??"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&&i.jsxs("div",{className:"flex items-center justify-between border-b border-gray-200 px-4 py-3 dark:border-gray-800",children:[i.jsx("h2",{className:"text-base font-semibold",children:n}),i.jsx(Ch,{onClose:r})]}),i.jsx("div",{className:"max-h-[70vh] overflow-y-auto px-4 py-4",children:l}),o&&i.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 E4={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"},A4={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 ke({variant:e="secondary",size:n="md",className:r,...l}){return i.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 ${E4[e]} ${A4[n]} ${r??""}`,...l})}function R4({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 i.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:i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:n})})})}function Gn({open:e,title:n,onClose:r,onConfirm:l,confirmLabel:o,tone:u="danger",busy:d=!1,children:f}){return i.jsxs(dn,{open:e,title:n,onClose:r,headerless:!0,widthClass:"sm:max-w-sm",children:[i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(R4,{tone:u}),i.jsx("div",{className:"min-w-0 flex-1 pt-1.5",children:f})]}),i.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[i.jsx(ke,{size:"sm",onClick:r,disabled:d,children:x.common.cancel}),i.jsx(ke,{size:"sm",variant:u,disabled:d,onClick:l,children:o??x.common.confirm})]})]})}function ku(){const[e,n]=b.useState(null),r=i.jsx(Gn,{open:e!==null,title:x.common.confirmSaveTitle,tone:"primary",confirmLabel:x.common.save,onClose:()=>n(null),onConfirm:()=>{e?.(),n(null)},children:i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.common.confirmSaveBody})});return{requestSave:l=>n(()=>l),element:r}}const Th="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",ob="w-full px-3 py-1.5 text-left transition-colors duration-150";function Hi({children:e,required:n}){return i.jsxs("span",{className:"mb-1 block text-xs font-semibold text-gray-600 dark:text-gray-400",children:[e,n&&i.jsx("span",{className:"ml-0.5 text-red-500 dark:text-red-400","aria-hidden":!0,children:"*"})]})}function cb({children:e}){return i.jsx("span",{className:"mt-1 block text-xs text-gray-500 dark:text-gray-500",children:e})}function Nl({id:e,children:n}){return i.jsx("span",{id:e,role:"alert",className:"mt-1 block text-xs text-red-600 dark:text-red-400",children:n})}function ro({label:e,hint:n,error:r,errorId:l,required:o,children:u}){return!e&&!n&&!r?i.jsx(i.Fragment,{children:u}):i.jsxs("label",{className:"block",children:[e!=null&&e!==""&&i.jsx(Hi,{required:o,children:e}),u,r?i.jsx(Nl,{id:l,children:r}):n?i.jsx(cb,{children:n}):null]})}const ub=`w-full ${Th} placeholder:text-gray-400 disabled:cursor-not-allowed disabled:opacity-60 dark:placeholder:text-gray-500`,Mh={base:"px-3 py-2 text-base",sm:"px-2 py-1 text-xs"},wu="!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 Xe({label:e,hint:n,error:r,invalid:l,required:o,size:u="base",className:d,...f}){const m=!!r||!!l,h=b.useId();return i.jsx(ro,{label:e,hint:n,error:r,errorId:h,required:o,children:i.jsx("input",{className:`${ub} ${Mh[u]} ${m?wu:""} ${d??""}`,"aria-invalid":m?!0:void 0,"aria-required":o||void 0,"aria-describedby":r?h:void 0,...f})})}const js=b.forwardRef(function({label:n,hint:r,error:l,invalid:o,required:u,mono:d,size:f="base",className:m,...h},g){const y=!!l||!!o,k=b.useId();return i.jsx(ro,{label:n,hint:r,error:l,errorId:k,required:u,children:i.jsx("textarea",{ref:g,className:`${ub} px-3 py-2 ${f==="sm"?"text-xs leading-relaxed":"text-base"} ${d?"font-mono":""} ${y?wu:""} ${m??""}`,"aria-invalid":y?!0:void 0,"aria-required":u||void 0,"aria-describedby":l?k:void 0,...h})})});function Tl({options:e,value:n,onChange:r,cols:l=3}){return i.jsx("div",{className:`grid ${l===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=>i.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 Ut({className:e}){return i.jsx("div",{className:`animate-pulse rounded bg-gray-200 dark:bg-gray-800 ${e??"h-4 w-full"}`})}function qa({rows:e=3}){return i.jsx("div",{className:"space-y-2 p-2",children:Array.from({length:e},(n,r)=>i.jsx(Ut,{className:"h-8 w-full"},r))})}function db({className:e,children:n}){return i.jsx("div",{className:`rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900 ${e??"p-4"}`,children:n??i.jsxs(i.Fragment,{children:[i.jsx(Ut,{className:"h-3 w-20"}),i.jsx(Ut,{className:"mt-2.5 h-6 w-28"}),i.jsx(Ut,{className:"mt-2.5 h-3 w-24"})]})})}function Ka(e){b.useEffect(()=>{document.title=e?`${e} · ${x.appName}`:x.appName},[e])}function Jr(e){const n=e.toFixed(1);return n.endsWith(".0")?n.slice(0,-2):n}function ut(e){const n=Math.abs(e);return n<1e3?`${e}`:n<1e6?`${Jr(e/1e3)}k`:`${Jr(e/1e6)}M`}function ln(e){if(e<1e3)return`${Math.round(e)}ms`;const n=e/1e3;return n<60?`${Jr(n)}s`:`${Math.floor(n/60)}m${Math.round(n%60)}s`}function _4(e){const n=Math.max(0,Math.floor(e/1e3));return n<60?`${n}s`:`${Math.floor(n/60)}m${n%60}s`}function zm(e,n){return n>0?e/(n/1e3):null}function tu(e){return e==null||!Number.isFinite(e)?"—":`${Math.abs(e)<1e3?Jr(e):ut(e)} tok/s`}function fb(e,n){const r=e+n;return r>0?e/r:null}function Eh(e){return e==null||!Number.isFinite(e)?"—":`${Math.round(e*100)}%`}function ya(e,n="USD"){if(e==null)return"—";const r=n==="CNY"?"¥":"$",l=n==="CNY"?e*7:e;if(l===0)return`${r}0`;const o=Math.abs(l),u=o>=100?0:o>=1?2:4;return`${r}${l.toFixed(u)}`}function nu(e){return Number.isInteger(e)?`${e}`:Jr(e)}function Dm(e){return e<1024?`${e}B`:e<1024*1024?`${Jr(e/1024)}KB`:e<1024*1024*1024?`${Jr(e/(1024*1024))}MB`:`${Jr(e/(1024*1024*1024))}GB`}function Ml(e){return e<10?`0${e}`:`${e}`}function Kn(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:`${n.getFullYear()}-${Ml(n.getMonth()+1)}-${Ml(n.getDate())} ${Ml(n.getHours())}:${Ml(n.getMinutes())}`}function mb(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 au(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime()}function L4(e,n){const r=new Date(e);if(Number.isNaN(r.getTime()))return e;const l=Math.round((au(new Date)-au(r))/864e5);return l<0?Kn(e):l===0?n==="en"?"today":"今天":l===1?n==="en"?"yesterday":"昨天":n==="en"?`${l} days ago`:`${l} 天前`}function I4(e,n){const r=new Date(e);if(Number.isNaN(r.getTime()))return e;const l=Math.round((au(new Date)-au(r))/864e5);return l<0?e:l===0?n==="en"?"updated today":"今天更新":l===1?n==="en"?"updated yesterday":"昨天更新":n==="en"?`updated ${l} days ago`:`${l} 天前更新`}function O4(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:`${Ml(n.getHours())}:${Ml(n.getMinutes())}:${Ml(n.getSeconds())}`}var z4=["partial_text","partial_thinking","partial_tool_call","partial_tool_call_output"];function Ah(e){return z4.includes(e.type??"")}function Rh(e){return e.type==="event_msg"}function D4(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _h(e,n){return`[${e}]
|
|
62
|
-
${n}
|
|
63
|
-
[/${e}]`}function lo(e,n,r=""){const l=D4(e);return[new RegExp(`\\[${l}\\]${n}\\[/${l}\\]`,r),new RegExp(`<${l}>${n}</${l}>`,r)]}function Su(e,n){return e[0].exec(n)??e[1].exec(n)}var Va={summary:"summary",userSteering:"user_steering",useSkills:"use_skills",handoffFrom:"handoff_from",scheduledTask:"scheduled_task",modelSwitchFrom:"model_switch_from"};lo(Va.summary,"([\\s\\S]*?)");function Um(e,n){if(e.length===0)return n;const r=_h(Va.useSkills,`skills: ${e.join(", ")}`);return n?`${r}
|
|
64
|
-
|
|
65
|
-
${n}`:r}var U4=lo(Va.useSkills,"\\nskills: ([^\\n]+)\\n");function $4(e){const n=Su(U4,e);if(!n||n.index!==0)return null;const r=n[1].split(",").map(l=>l.trim()).filter(l=>l.length>0);return r.length===0?null:{skills:r,rest:e.slice(n[0].length).replace(/^\n+/,"")}}function hb(e){const n=/^([\w-]+) \((.*)\)$/.exec(e);return n?{id:n[1],label:n[2]}:{id:e}}function Lh(e,n){const r=new RegExp(`^(${n.join("|")}): (.+)$`),l=[];for(const o of e.split(`
|
|
66
|
-
`)){const u=r.exec(o);u&&l.push([u[1],u[2]])}return l}function B4(e){const n=e.agentName&&e.agentName!==e.agentId?` (${e.agentName})`:"",r=[`agent: ${e.agentId}${n}`];if(e.sessionId){const l=e.sessionTitle?` (${e.sessionTitle})`:"";r.push(`session: ${e.sessionId}${l}`)}return e.workspace&&r.push(`workspace: ${e.workspace}`),_h(Va.handoffFrom,["This conversation was opened by @-mentioning you from another conversation; 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(`
|
|
67
|
-
`))}var H4=lo(Va.handoffFrom,"\\n([\\s\\S]*)\\n","");function P4(e){const n=e.trim(),r=Su(H4,n);if(!r||r.index!==0||r[0].length!==n.length)return null;const l={agentId:""};for(const[o,u]of Lh(r[1],["agent","session","workspace"])){if(o==="workspace"){l.workspace=u;continue}const{id:d,label:f}=hb(u);o==="agent"?(l.agentId=d,f!==void 0&&(l.agentName=f)):(l.sessionId=d,f!==void 0&&(l.sessionTitle=f))}return l.agentId?l:null}var q4=lo(Va.scheduledTask,"\\n([\\s\\S]*?)\\n");function F4(e){const n=Su(q4,e);if(!n||n.index!==0)return null;const r={name:"",firedAt:""};for(const[l,o]of Lh(n[1],["schedule","fired_at"]))l==="schedule"?r.name=o:r.firedAt=o;return r.name?{origin:r,rest:e.slice(n[0].length).replace(/^\n+/,"")}:null}function V4(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}`),_h(Va.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(`
|
|
68
|
-
`))}var G4=lo(Va.modelSwitchFrom,"\\n([\\s\\S]*)\\n");function K4(e){const n=e.trim(),r=Su(G4,n);if(!r||r.index!==0||r[0].length!==n.length)return null;const l={sessionId:""},o=["session","trace","workspace","previous_model","previous_provider"];for(const[u,d]of Lh(r[1],o))if(u==="session"){const{id:f,label:m}=hb(d);l.sessionId=f,m!==void 0&&(l.sessionTitle=m)}else u==="trace"?l.tracePath=d:u==="workspace"?l.workspace=d:u==="previous_model"?l.prevModelId=d:l.prevProvider=d;return l.sessionId?l:null}var W4=new RegExp(`^\\[${Va.userSteering}\\]\\n([\\s\\S]*?)\\n\\[/${Va.userSteering}\\]\\s*$`);function Y4(e){const n=W4.exec(e);return n?n[1]:null}function Q4(){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 pb(e,n){e.taskCacheRead+=n.request.cache_read,e.taskCacheWrite+=n.request.cache_write,e.taskOutput+=n.request.output}function X4(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,pb(e,n),e.contextNow=n.request.total,e.contextStale=!1,e.taskMainOutput+=n.request.output,e.hasUsage=!0}function Z4(e){e.pendingCompactionTokens!==0&&(e.taskTokens+=e.pendingCompactionTokens,e.taskCacheRead+=e.pendingCompactionCacheRead,e.taskCacheWrite+=e.pendingCompactionCacheWrite,e.taskOutput+=e.pendingCompactionOutput,e.hasUsage=!0,Ih(e))}function Ih(e){e.pendingCompactionTokens=0,e.pendingCompactionCacheRead=0,e.pendingCompactionCacheWrite=0,e.pendingCompactionOutput=0}function J4(e,n){n>0&&(e.taskLlmMs+=n)}function eC(e,n){e.taskTokens+=n.request.total,pb(e,n),e.subagentTotal+=n.request.total,e.hasUsage=!0}function tC(e){e.compactionActive=!0}function nC(e,n){e.compactionActive=!1,n==="completed"&&(e.contextStale=!0)}function aC(e){e.taskTokens=0,e.taskCacheRead=0,e.taskCacheWrite=0,e.taskOutput=0,e.taskMainOutput=0,e.taskLlmMs=0,Ih(e),e.hasUsage=!1,e.compactionActive=!1}function rC(e,n){if(e.sessionElapsedMs+=n,Ih(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:zm(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 lC(e,n){const r=e.tokensByBucket;return`[${n.stats}] ${n.input} ${ut(r.cacheRead+r.cacheWrite)}${n.parenOpen}${n.cached} ${ut(r.cacheRead)}${n.parenClose} · ${n.output} ${ut(r.output)} · ${tu(e.outputTps)}`}function gb(e,n){return{items:[],nested:e,stats:Q4(),openText:null,openThinking:null,pendingText:null,pendingThinking:null,toolCards:new Map,subagents:new Map,localDecisions:n,pendingDecisions:new Map,pendingDecisionTs:new Map,lastTsMs:0,openRequestBeginMs:null,openApprovalWaitMs:0,reconnectRun:0,taskOpen:!1,taskStartLocalMs:0,taskFirstTsMs:0,taskLastTsMs:0,taskLastReqEndMs:null,nextItemId:1}}function Qc(e=new Set){return gb(!1,e)}function An(e){return e.nextItemId++}function ru(e,n,r=Date.now()){if(n.origin&&n.origin.length>0){gC(e,n,r);return}if(n.type==="model_msg"){if(e.stats.compactionActive){Ma(e,n.timestamp),Zf(e,n.timestamp);return}if(Ah(n.payload)){Ma(e,n.timestamp),fC(e,n.payload,Ha(n.timestamp));return}mC(e,n.payload,n.timestamp,r),Zf(e,n.timestamp);return}if(Rh(n)){Ma(e,n.timestamp),hC(e,n.payload,Ha(n.timestamp)),Zf(e,n.timestamp);return}}function Ha(e){const n=Date.parse(e);return Number.isFinite(n)?n:void 0}function Zf(e,n){const r=Date.parse(n);Number.isFinite(r)&&(e.lastTsMs=r)}function sC(e,n,r=Date.now()){for(const l of n)ru(e,l,r)}function iC(e,n=Date.now()){Oh(e,"live",n)}function oC(e){Oh(e,"history")}function cC(e,n){e.localDecisions.add(n)}function Cs(e,n){return`${e?.join("/")??""} ${n}`}function uC(e,n,r){let l=e;for(const o of n??[])if(l=l.subagents.get(o),!l)return null;return l.toolCards.get(r)??null}function Ma(e,n){if(!e.taskOpen||e.stats.compactionActive)return;const r=Date.parse(n);!Number.isFinite(r)||r<=e.taskLastTsMs||(e.taskLastTsMs=r)}function My(e,n,r){Oh(e,"history");const l=Pm(e);l&&(l.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,aC(e.stats)}function Oh(e,n,r){if(!e.taskOpen)return;e.taskOpen=!1,xb(e);const l=e.taskLastReqEndMs??e.taskLastTsMs,o=Math.max(0,l-e.taskFirstTsMs);let u;e.taskLastReqEndMs!==null?u=o:n==="live"?u=Math.max((r??Date.now())-e.taskStartLocalMs,o):u=o;const d=rC(e.stats,u);if(e.nested)return;const f=dC(e);if(d===null&&f.text==="")return;const m={kind:"task_stats",id:An(e),stats:d,assistantText:f.text,...f.atMs!==void 0?{atMs:f.atMs}:{}};let h=e.items.length;for(;h>0&&e.items[h-1].kind==="compaction";)h--;e.items.splice(h,0,m)}function dC(e){const n=[];let r;for(let l=e.items.length-1;l>=0;l--){const o=e.items[l];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(`
|
|
69
|
-
|
|
70
|
-
`),...r!==void 0?{atMs:r}:{}}}function fC(e,n,r){switch(n.type){case"partial_text":{if(n.event_type==="start"){e.pendingText=null;const o={kind:"assistant_text",id:An(e),text:n.text??"",streaming:!0,...r!==void 0?{atMs:r}:{}};e.openText=o,e.items.push(o);return}const l=e.openText;if(!l)return;n.text&&(l.text+=n.text),n.event_type==="stop"&&(l.streaming=!1,n.stop_reason!==void 0&&(l.stopReason=n.stop_reason),e.pendingText=l,e.openText=null);return}case"partial_thinking":{if(n.event_type==="start"){e.pendingThinking=null;const o={kind:"thinking",id:An(e),thinking:n.thinking??"",streaming:!0};r!==void 0&&(o.startedAtMs=r),e.openThinking=o,e.items.push(o);return}const l=e.openThinking;if(!l)return;n.thinking&&(l.thinking+=n.thinking),n.event_type==="stop"&&(l.streaming=!1,n.stop_reason!==void 0&&(l.stopReason=n.stop_reason),$m(l,r),e.pendingThinking=l,e.openThinking=null);return}case"partial_tool_call":{const l=e.toolCards.get(n.tool_call_id);if(l?.callComplete)return;if(n.event_type==="start"){if(l){l.name=n.name||l.name,l.argumentsText=n.arguments??"",l.callStreaming=!0,r!==void 0&&l.argStartedAtMs===void 0&&(l.argStartedAtMs=r);return}const o=Hm(e,{toolCallId:n.tool_call_id,name:n.name,argumentsText:n.arguments??"",callStreaming:!0});r!==void 0&&(o.argStartedAtMs=r);return}if(!l)return;n.name&&!l.name&&(l.name=n.name),n.arguments&&(l.argumentsText+=n.arguments),n.event_type==="stop"&&(l.callStreaming=!1,n.stop_reason!==void 0&&(l.callStopReason=n.stop_reason),r!==void 0&&(l.callStartedAtMs=r));return}case"partial_tool_call_output":{const l=e.toolCards.get(n.tool_call_id);if(!l||l.outputComplete)return;if(n.event_type==="start"){l.outputStreaming=!0,n.output&&(l.output+=n.output);return}if(!l.outputStreaming)return;n.output&&(l.output+=n.output),n.images&&n.images.length>0&&(l.images=n.images),n.event_type==="stop"&&(l.outputStreaming=!1,n.stop_reason!==void 0&&(l.outputStopReason=n.stop_reason),yb(l,r));return}}}function mC(e,n,r,l){switch(n.type){case"text":{if(n.role==="user"){if(n.text.startsWith("[context_summary]")||n.text.startsWith("<context_summary>")){Ma(e,r);return}const f=Y4(n.text);if(f!==null){Ma(e,r);const h=Ha(r);e.items.push({kind:"user_steering",id:An(e),text:f,...h!==void 0?{atMs:h}:{}});return}My(e,r,l);const m=Ha(r);e.items.push({kind:"user_text",id:An(e),text:n.text,...m!==void 0?{atMs:m}:{}});return}Ma(e,r);const o=e.pendingText??e.openText;if(o){o.text=n.text,o.streaming=!1;const f=Ha(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}const u=Ha(r),d={kind:"assistant_text",id:An(e),text:n.text,streaming:!1,...u!==void 0?{atMs:u}:{}};n.stop_reason!==void 0&&(d.stopReason=n.stop_reason),e.items.push(d);return}case"image_url":{My(e,r,l);const o=Ha(r);e.items.push({kind:"user_image",id:An(e),imageUrl:n.image_url,...o!==void 0?{atMs:o}:{}});return}case"thinking":{Ma(e,r);const o=Ha(r),u=e.pendingThinking??e.openThinking;if(u){u.thinking=n.thinking,u.streaming=!1,n.stop_reason!==void 0&&(u.stopReason=n.stop_reason),$m(u,o),u===e.openThinking&&(e.openThinking=null),e.pendingThinking=null;return}const d={kind:"thinking",id:An(e),thinking:n.thinking,streaming:!1};n.stop_reason!==void 0&&(d.stopReason=n.stop_reason),e.lastTsMs>0&&(d.startedAtMs=e.lastTsMs),$m(d,o),e.items.push(d);return}case"tool_call":{Ma(e,r);const o=Ha(r),u=e.toolCards.get(n.tool_call_id),d=u?.callComplete?void 0:u;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),Bm(e,d),Ey(d);return}u&&!u.outputComplete&&(u.outputComplete=!0,u.outputStreaming=!1,u.outputStopReason??="aborted");const f=Hm(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),Bm(e,f),e.lastTsMs>0&&(f.argStartedAtMs=e.lastTsMs),Ey(f);return}case"tool_call_output":{Ma(e,r);let o=e.toolCards.get(n.tool_call_id);o||(o=Hm(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),yb(o,Ha(r));return}case"inline_data":case"inline_thinking":Ma(e,r);return}}function xb(e){for(const n of e.toolCards.values())n.callComplete&&!n.outputComplete&&(n.outputComplete=!0,n.outputStreaming=!1,n.outputStopReason??="aborted")}function Ey(e){!e.callStopReason||e.callStopReason==="completed"||e.outputComplete||(e.outputComplete=!0,e.outputStreaming=!1,e.outputStopReason??=e.callStopReason)}function $m(e,n){n===void 0||e.startedAtMs===void 0||(e.durationMs=Math.max(0,n-e.startedAtMs))}function yb(e,n){if(n===void 0)return;const r=e.approvalAtMs??e.callStartedAtMs;if(r===void 0)return;const l=e.argStartedAtMs!==void 0&&e.callStartedAtMs!==void 0?Math.max(0,e.callStartedAtMs-e.argStartedAtMs):0;e.durationMs=l+Math.max(0,n-r)}function Bm(e,n){if(n.approvalWaitCounted)return;const{callStartedAtMs:r,approvalAtMs:l}=n;if(r===void 0||l===void 0)return;n.approvalWaitCounted=!0;const o=l-r;o>0&&(e.openApprovalWaitMs+=o)}function Hm(e,n){const r={kind:"tool_call",id:An(e),toolCallId:n.toolCallId,name:n.name,argumentsText:n.argumentsText,callStreaming:n.callStreaming,callComplete:!1,output:"",outputStreaming:!1,outputComplete:!1},l=e.pendingDecisions.get(n.toolCallId);if(l!==void 0){r.decision=l,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 hC(e,n,r){switch(n.type){case"approval_decision":{const l=e.toolCards.get(n.tool_call_id);l?(l.decision=n.decision,l.decisionSource=e.localDecisions.has(n.tool_call_id)?"manual":"remote",r!==void 0&&l.approvalAtMs===void 0&&(l.approvalAtMs=r),Bm(e,l)):(e.pendingDecisions.set(n.tool_call_id,n.decision),r!==void 0&&e.pendingDecisionTs.set(n.tool_call_id,r));return}case"abort":{xb(e);const l=Pm(e);l&&(l.gaveUp=!0),e.reconnectRun=0;const o={kind:"abort",id:An(e)};n.reason!=null&&(o.reason=n.reason),e.items.push(o);return}case"token_usage":X4(e.stats,n);return;case"compaction_begin":{tC(e.stats),e.items.push({kind:"compaction",id:An(e),reason:n.reason,mode:n.mode,running:!0});return}case"compaction_end":{nC(e.stats,n.status);const l=pC(e);if(l)l.running=!1,l.status=n.status;else{const o={kind:"compaction",id:An(e),reason:n.reason,mode:n.mode,running:!1,status:n.status};e.items.push(o)}return}case"request_begin":{const l=Pm(e);l&&(l.retrying=!0),e.stats.compactionActive||(e.openRequestBeginMs=r??null,e.openApprovalWaitMs=0);return}case"request_end":{if(e.stats.compactionActive)return;e.openRequestBeginMs!==null&&r!==void 0&&J4(e.stats,r-e.openRequestBeginMs-e.openApprovalWaitMs),e.openRequestBeginMs=null,e.openApprovalWaitMs=0,r!==void 0&&(e.taskLastReqEndMs=r),Z4(e.stats),n.status==="timeout"||n.status==="malformed"?(e.reconnectRun+=1,e.items.push({kind:"reconnect",id:An(e),status:n.status,attempt:e.reconnectRun,retrying:!1})):e.reconnectRun=0;return}}}function pC(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 Pm(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 gC(e,n,r){const l=n.origin[0];Rh(n)&&n.payload.type==="token_usage"&&eC(e.stats,n.payload),Ma(e,n.timestamp);let o=e.subagents.get(l);o||(o=gb(!0,e.localDecisions),e.subagents.set(l,o),xC(e,l,o));const u=n.origin.slice(1),d={...n};u.length>0?d.origin=u:delete d.origin,ru(o,d,r)}function xC(e,n,r){for(let l=e.items.length-1;l>=0;l--){const o=e.items[l];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:An(e),sessionId:n,model:r})}function yC(e,n=100){const r=new Set;for(let l=Math.max(0,e.length-n);l<e.length;l++)r.add(JSON.stringify(e[l]));return r}function vC(e,n){return e.has(JSON.stringify(n))}function vb(e,n){if(n.origin&&n.origin.length>0){const l=e.subagents.get(n.origin[0]);if(!l)return;const o=n.origin.slice(1),u={...n};o.length>0?u.origin=o:delete u.origin,vb(l,u);return}if(n.type!=="model_msg"||Ah(n.payload))return;const r=n.payload;switch(r.type){case"text":{if(r.role!=="assistant")return;const l=e.pendingText??e.openText;l&&(Jf(e,l),l===e.openText&&(e.openText=null),e.pendingText=null);return}case"thinking":{const l=e.pendingThinking??e.openThinking;l&&(Jf(e,l),l===e.openThinking&&(e.openThinking=null),e.pendingThinking=null);return}case"tool_call":{const l=e.toolCards.get(r.tool_call_id);l&&!l.callComplete&&(Jf(e,l),e.toolCards.delete(r.tool_call_id));return}case"tool_call_output":{const l=e.toolCards.get(r.tool_call_id);l&&!l.outputComplete&&(l.output="",l.outputStreaming=!1);return}default:return}}function Jf(e,n){const r=e.items.indexOf(n);r>=0&&e.items.splice(r,1)}function nl({title:e,description:n,action:r}){return i.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-12 text-center",children:[i.jsx("p",{className:"text-sm font-medium text-gray-600 dark:text-gray-300",children:e}),n&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-500",children:n}),r&&i.jsx("div",{className:"mt-2",children:r})]})}const Jt={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"},bC=/^\[attached image: (.+)\]$/,kC=/[/\\]scratchpad[/\\]([^/\\]+)[/\\]([A-Za-z0-9._-]+)$/;function wC(e){if(/^https?:\/\//i.test(e))return e;const n=kC.exec(e);return n?`/api/sessions/${encodeURIComponent(n[1])}/scratchpad/${encodeURIComponent(n[2])}`:null}function SC(e){if(!e.includes("[attached image: "))return{text:e,images:[]};const n=[],r=[];for(const l of e.split(`
|
|
71
|
-
`)){const o=bC.exec(l.trim()),u=o?wC(o[1]):null;u?r.push(u):n.push(l)}return{text:n.join(`
|
|
72
|
-
`).replace(/\n+$/,""),images:r}}function jC(e,n){const r=n||{};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const CC=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,NC=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TC={};function Ay(e,n){return(TC.jsx?NC:CC).test(e)}const MC=/[ \t\n\f\r]/g;function EC(e){return typeof e=="object"?e.type==="text"?Ry(e.value):!1:Ry(e)}function Ry(e){return e.replace(MC,"")===""}class so{constructor(n,r,l){this.normal=r,this.property=n,l&&(this.space=l)}}so.prototype.normal={};so.prototype.property={};so.prototype.space=void 0;function bb(e,n){const r={},l={};for(const o of e)Object.assign(r,o.property),Object.assign(l,o.normal);return new so(r,l,n)}function qm(e){return e.toLowerCase()}class Rn{constructor(n,r){this.attribute=r,this.property=n}}Rn.prototype.attribute="";Rn.prototype.booleanish=!1;Rn.prototype.boolean=!1;Rn.prototype.commaOrSpaceSeparated=!1;Rn.prototype.commaSeparated=!1;Rn.prototype.defined=!1;Rn.prototype.mustUseProperty=!1;Rn.prototype.number=!1;Rn.prototype.overloadedBoolean=!1;Rn.prototype.property="";Rn.prototype.spaceSeparated=!1;Rn.prototype.space=void 0;let AC=0;const Ue=zl(),Zt=zl(),Fm=zl(),ve=zl(),Nt=zl(),El=zl(),qn=zl();function zl(){return 2**++AC}const Vm=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ue,booleanish:Zt,commaOrSpaceSeparated:qn,commaSeparated:El,number:ve,overloadedBoolean:Fm,spaceSeparated:Nt},Symbol.toStringTag,{value:"Module"})),em=Object.keys(Vm);class zh extends Rn{constructor(n,r,l,o){let u=-1;if(super(n,r),_y(this,"space",o),typeof l=="number")for(;++u<em.length;){const d=em[u];_y(this,em[u],(l&Vm[d])===Vm[d])}}}zh.prototype.defined=!0;function _y(e,n,r){r&&(e[n]=r)}function As(e){const n={},r={};for(const[l,o]of Object.entries(e.properties)){const u=new zh(l,e.transform(e.attributes||{},l),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(l)&&(u.mustUseProperty=!0),n[l]=u,r[qm(l)]=l,r[qm(u.attribute)]=l}return new so(n,r,e.space)}const kb=As({properties:{ariaActiveDescendant:null,ariaAtomic:Zt,ariaAutoComplete:null,ariaBusy:Zt,ariaChecked:Zt,ariaColCount:ve,ariaColIndex:ve,ariaColSpan:ve,ariaControls:Nt,ariaCurrent:null,ariaDescribedBy:Nt,ariaDetails:null,ariaDisabled:Zt,ariaDropEffect:Nt,ariaErrorMessage:null,ariaExpanded:Zt,ariaFlowTo:Nt,ariaGrabbed:Zt,ariaHasPopup:null,ariaHidden:Zt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Nt,ariaLevel:ve,ariaLive:null,ariaModal:Zt,ariaMultiLine:Zt,ariaMultiSelectable:Zt,ariaOrientation:null,ariaOwns:Nt,ariaPlaceholder:null,ariaPosInSet:ve,ariaPressed:Zt,ariaReadOnly:Zt,ariaRelevant:null,ariaRequired:Zt,ariaRoleDescription:Nt,ariaRowCount:ve,ariaRowIndex:ve,ariaRowSpan:ve,ariaSelected:Zt,ariaSetSize:ve,ariaSort:null,ariaValueMax:ve,ariaValueMin:ve,ariaValueNow:ve,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function wb(e,n){return n in e?e[n]:n}function Sb(e,n){return wb(e,n.toLowerCase())}const RC=As({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:El,acceptCharset:Nt,accessKey:Nt,action:null,allow:null,allowFullScreen:Ue,allowPaymentRequest:Ue,allowUserMedia:Ue,alpha:Ue,alt:null,as:null,async:Ue,autoCapitalize:null,autoComplete:Nt,autoFocus:Ue,autoPlay:Ue,blocking:Nt,capture:null,charSet:null,checked:Ue,cite:null,className:Nt,closedBy:null,colorSpace:null,cols:ve,colSpan:ve,command:null,commandFor:null,content:null,contentEditable:Zt,controls:Ue,controlsList:Nt,coords:ve|El,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ue,defer:Ue,dir:null,dirName:null,disabled:Ue,download:Fm,draggable:Zt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ue,formTarget:null,headers:Nt,height:ve,hidden:Fm,high:ve,href:null,hrefLang:null,htmlFor:Nt,httpEquiv:Nt,id:null,imageSizes:null,imageSrcSet:null,inert:Ue,inputMode:null,integrity:null,is:null,isMap:Ue,itemId:null,itemProp:Nt,itemRef:Nt,itemScope:Ue,itemType:Nt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ue,low:ve,manifest:null,max:null,maxLength:ve,media:null,method:null,min:null,minLength:ve,multiple:Ue,muted:Ue,name:null,nonce:null,noModule:Ue,noValidate:Ue,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:Ue,optimum:ve,pattern:null,ping:Nt,placeholder:null,playsInline:Ue,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ue,referrerPolicy:null,rel:Nt,required:Ue,reversed:Ue,rows:ve,rowSpan:ve,sandbox:Nt,scope:null,scoped:Ue,seamless:Ue,selected:Ue,shadowRootClonable:Ue,shadowRootCustomElementRegistry:Ue,shadowRootDelegatesFocus:Ue,shadowRootMode:null,shadowRootSerializable:Ue,shape:null,size:ve,sizes:null,slot:null,span:ve,spellCheck:Zt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ve,step:null,style:null,tabIndex:ve,target:null,title:null,translate:null,type:null,typeMustMatch:Ue,useMap:null,value:Zt,width:ve,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Nt,axis:null,background:null,bgColor:null,border:ve,borderColor:null,bottomMargin:ve,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ue,declare:Ue,event:null,face:null,frame:null,frameBorder:null,hSpace:ve,leftMargin:ve,link:null,longDesc:null,lowSrc:null,marginHeight:ve,marginWidth:ve,noResize:Ue,noHref:Ue,noShade:Ue,noWrap:Ue,object:null,profile:null,prompt:null,rev:null,rightMargin:ve,rules:null,scheme:null,scrolling:Zt,standby:null,summary:null,text:null,topMargin:ve,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ve,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ue,disablePictureInPicture:Ue,disableRemotePlayback:Ue,exportParts:El,part:Nt,prefix:null,property:null,results:ve,security:null,unselectable:null},space:"html",transform:Sb}),_C=As({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:qn,accentHeight:ve,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ve,amplitude:ve,arabicForm:null,ascent:ve,attributeName:null,attributeType:null,azimuth:ve,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ve,by:null,calcMode:null,capHeight:ve,className:Nt,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:ve,diffuseConstant:ve,direction:null,display:null,dur:null,divisor:ve,dominantBaseline:null,download:Ue,dx:null,dy:null,edgeMode:null,editable:null,elevation:ve,enableBackground:null,end:null,event:null,exponent:ve,externalResourcesRequired:null,fill:null,fillOpacity:ve,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:El,g2:El,glyphName:El,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ve,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ve,horizOriginX:ve,horizOriginY:ve,id:null,ideographic:ve,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ve,k:ve,k1:ve,k2:ve,k3:ve,k4:ve,kernelMatrix:qn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ve,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:ve,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:ve,overlineThickness:ve,paintOrder:null,panose1:null,path:null,pathLength:ve,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Nt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ve,pointsAtY:ve,pointsAtZ:ve,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:qn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:qn,rev:qn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:qn,requiredFeatures:qn,requiredFonts:qn,requiredFormats:qn,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:ve,specularExponent:ve,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ve,strikethroughThickness:ve,string:null,stroke:null,strokeDashArray:qn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ve,strokeOpacity:ve,strokeWidth:null,style:null,surfaceScale:ve,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:qn,tabIndex:ve,tableValues:null,target:null,targetX:ve,targetY:ve,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:qn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ve,underlineThickness:ve,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ve,values:null,vAlphabetic:ve,vMathematical:ve,vectorEffect:null,vHanging:ve,vIdeographic:ve,version:null,vertAdvY:ve,vertOriginX:ve,vertOriginY:ve,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ve,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:wb}),jb=As({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()}}),Cb=As({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Sb}),Nb=As({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),LC={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"},IC=/[A-Z]/g,Ly=/-[a-z]/g,OC=/^data[-\w.:]+$/i;function zC(e,n){const r=qm(n);let l=n,o=Rn;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&OC.test(n)){if(n.charAt(4)==="-"){const u=n.slice(5).replace(Ly,UC);l="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=n.slice(4);if(!Ly.test(u)){let d=u.replace(IC,DC);d.charAt(0)!=="-"&&(d="-"+d),n="data"+d}}o=zh}return new o(l,n)}function DC(e){return"-"+e.toLowerCase()}function UC(e){return e.charAt(1).toUpperCase()}const $C=bb([kb,RC,jb,Cb,Nb],"html"),Dh=bb([kb,_C,jb,Cb,Nb],"svg");function BC(e){return e.join(" ").trim()}var gs={},tm,Iy;function HC(){if(Iy)return tm;Iy=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,r=/^\s*/,l=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,d=/^[;\s]*/,f=/^\s+|\s+$/g,m=`
|
|
73
|
-
`,h="/",g="*",y="",k="comment",w="declaration";function N(j,E){if(typeof j!="string")throw new TypeError("First argument must be a string");if(!j)return[];E=E||{};var L=1,_=1;function q(ne){var U=ne.match(n);U&&(L+=U.length);var z=ne.lastIndexOf(m);_=~z?ne.length-z:_+ne.length}function H(){var ne={line:L,column:_};return function(U){return U.position=new I(ne),Z(),U}}function I(ne){this.start=ne,this.end={line:L,column:_},this.source=E.source}I.prototype.content=j;function P(ne){var U=new Error(E.source+":"+L+":"+_+": "+ne);if(U.reason=ne,U.filename=E.source,U.line=L,U.column=_,U.source=j,!E.silent)throw U}function ee(ne){var U=ne.exec(j);if(U){var z=U[0];return q(z),j=j.slice(z.length),U}}function Z(){ee(r)}function D(ne){var U;for(ne=ne||[];U=V();)U!==!1&&ne.push(U);return ne}function V(){var ne=H();if(!(h!=j.charAt(0)||g!=j.charAt(1))){for(var U=2;y!=j.charAt(U)&&(g!=j.charAt(U)||h!=j.charAt(U+1));)++U;if(U+=2,y===j.charAt(U-1))return P("End of comment missing");var z=j.slice(2,U-2);return _+=2,q(z),j=j.slice(U),_+=2,ne({type:k,comment:z})}}function B(){var ne=H(),U=ee(l);if(U){if(V(),!ee(o))return P("property missing ':'");var z=ee(u),$=ne({type:w,property:C(U[0].replace(e,y)),value:z?C(z[0].replace(e,y)):y});return ee(d),$}}function Y(){var ne=[];D(ne);for(var U;U=B();)U!==!1&&(ne.push(U),D(ne));return ne}return Z(),Y()}function C(j){return j?j.replace(f,y):y}return tm=N,tm}var Oy;function PC(){if(Oy)return gs;Oy=1;var e=gs&&gs.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(gs,"__esModule",{value:!0}),gs.default=r;const n=e(HC());function r(l,o){let u=null;if(!l||typeof l!="string")return u;const d=(0,n.default)(l),f=typeof o=="function";return d.forEach(m=>{if(m.type!=="declaration")return;const{property:h,value:g}=m;f?o(h,g,m):g&&(u=u||{},u[h]=g)}),u}return gs}var Mi={},zy;function qC(){if(zy)return Mi;zy=1,Object.defineProperty(Mi,"__esModule",{value:!0}),Mi.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,u=function(h){return!h||r.test(h)||e.test(h)},d=function(h,g){return g.toUpperCase()},f=function(h,g){return"".concat(g,"-")},m=function(h,g){return g===void 0&&(g={}),u(h)?h:(h=h.toLowerCase(),g.reactCompat?h=h.replace(o,f):h=h.replace(l,f),h.replace(n,d))};return Mi.camelCase=m,Mi}var Ei,Dy;function FC(){if(Dy)return Ei;Dy=1;var e=Ei&&Ei.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},n=e(PC()),r=qC();function l(o,u){var d={};return!o||typeof o!="string"||(0,n.default)(o,function(f,m){f&&m&&(d[(0,r.camelCase)(f,u)]=m)}),d}return l.default=l,Ei=l,Ei}var VC=FC();const GC=hv(VC),Tb=Mb("end"),Uh=Mb("start");function Mb(e){return n;function n(r){const l=r&&r.position&&r.position[e]||{};if(typeof l.line=="number"&&l.line>0&&typeof l.column=="number"&&l.column>0)return{line:l.line,column:l.column,offset:typeof l.offset=="number"&&l.offset>-1?l.offset:void 0}}}function KC(e){const n=Uh(e),r=Tb(e);if(n&&r)return{start:n,end:r}}function Pi(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Uy(e.position):"start"in e||"end"in e?Uy(e):"line"in e||"column"in e?Gm(e):""}function Gm(e){return $y(e&&e.line)+":"+$y(e&&e.column)}function Uy(e){return Gm(e&&e.start)+"-"+Gm(e&&e.end)}function $y(e){return e&&typeof e=="number"?e:1}class xn extends Error{constructor(n,r,l){super(),typeof r=="string"&&(l=r,r=void 0);let o="",u={},d=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof n=="string"?o=n:!u.cause&&n&&(d=!0,o=n.message,u.cause=n),!u.ruleId&&!u.source&&typeof l=="string"){const m=l.indexOf(":");m===-1?u.ruleId=l:(u.source=l.slice(0,m),u.ruleId=l.slice(m+1))}if(!u.place&&u.ancestors&&u.ancestors){const m=u.ancestors[u.ancestors.length-1];m&&(u.place=m.position)}const f=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.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=Pi(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=d&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}xn.prototype.file="";xn.prototype.name="";xn.prototype.reason="";xn.prototype.message="";xn.prototype.stack="";xn.prototype.column=void 0;xn.prototype.line=void 0;xn.prototype.ancestors=void 0;xn.prototype.cause=void 0;xn.prototype.fatal=void 0;xn.prototype.place=void 0;xn.prototype.ruleId=void 0;xn.prototype.source=void 0;const $h={}.hasOwnProperty,WC=new Map,YC=/[A-Z]/g,QC=new Set(["table","tbody","thead","tfoot","tr"]),XC=new Set(["td","th"]),Eb="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function ZC(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=n.filePath||void 0;let l;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");l=sN(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");l=lN(r,n.jsx,n.jsxs)}const o={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:l,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"?Dh:$C,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},u=Ab(o,e,void 0);return u&&typeof u!="string"?u:o.create(e,o.Fragment,{children:u||void 0},void 0)}function Ab(e,n,r){if(n.type==="element")return JC(e,n,r);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return eN(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return nN(e,n,r);if(n.type==="mdxjsEsm")return tN(e,n);if(n.type==="root")return aN(e,n,r);if(n.type==="text")return rN(e,n)}function JC(e,n,r){const l=e.schema;let o=l;n.tagName.toLowerCase()==="svg"&&l.space==="html"&&(o=Dh,e.schema=o),e.ancestors.push(n);const u=_b(e,n.tagName,!1),d=iN(e,n);let f=Hh(e,n);return QC.has(n.tagName)&&(f=f.filter(function(m){return typeof m=="string"?!EC(m):!0})),Rb(e,d,u,n),Bh(d,f),e.ancestors.pop(),e.schema=l,e.create(n,u,d,r)}function eN(e,n){if(n.data&&n.data.estree&&e.evaluater){const l=n.data.estree.body[0];return l.type,e.evaluater.evaluateExpression(l.expression)}Xi(e,n.position)}function tN(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);Xi(e,n.position)}function nN(e,n,r){const l=e.schema;let o=l;n.name==="svg"&&l.space==="html"&&(o=Dh,e.schema=o),e.ancestors.push(n);const u=n.name===null?e.Fragment:_b(e,n.name,!0),d=oN(e,n),f=Hh(e,n);return Rb(e,d,u,n),Bh(d,f),e.ancestors.pop(),e.schema=l,e.create(n,u,d,r)}function aN(e,n,r){const l={};return Bh(l,Hh(e,n)),e.create(n,e.Fragment,l,r)}function rN(e,n){return n.value}function Rb(e,n,r,l){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(n.node=l)}function Bh(e,n){if(n.length>0){const r=n.length>1?n:n[0];r&&(e.children=r)}}function lN(e,n,r){return l;function l(o,u,d,f){const h=Array.isArray(d.children)?r:n;return f?h(u,d,f):h(u,d)}}function sN(e,n){return r;function r(l,o,u,d){const f=Array.isArray(u.children),m=Uh(l);return n(o,u,d,f,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function iN(e,n){const r={};let l,o;for(o in n.properties)if(o!=="children"&&$h.call(n.properties,o)){const u=cN(e,o,n.properties[o]);if(u){const[d,f]=u;e.tableCellAlignToStyle&&d==="align"&&typeof f=="string"&&XC.has(n.tagName)?l=f:r[d]=f}}if(l){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=l}return r}function oN(e,n){const r={};for(const l of n.attributes)if(l.type==="mdxJsxExpressionAttribute")if(l.data&&l.data.estree&&e.evaluater){const u=l.data.estree.body[0];u.type;const d=u.expression;d.type;const f=d.properties[0];f.type,Object.assign(r,e.evaluater.evaluateExpression(f.argument))}else Xi(e,n.position);else{const o=l.name;let u;if(l.value&&typeof l.value=="object")if(l.value.data&&l.value.data.estree&&e.evaluater){const f=l.value.data.estree.body[0];f.type,u=e.evaluater.evaluateExpression(f.expression)}else Xi(e,n.position);else u=l.value===null?!0:l.value;r[o]=u}return r}function Hh(e,n){const r=[];let l=-1;const o=e.passKeys?new Map:WC;for(;++l<n.children.length;){const u=n.children[l];let d;if(e.passKeys){const m=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(m){const h=o.get(m)||0;d=m+"-"+h,o.set(m,h+1)}}const f=Ab(e,u,d);f!==void 0&&r.push(f)}return r}function cN(e,n,r){const l=zC(e.schema,n);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=l.commaSeparated?jC(r):BC(r)),l.property==="style"){let o=typeof r=="object"?r:uN(e,String(r));return e.stylePropertyNameCase==="css"&&(o=dN(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&l.space?LC[l.property]||l.property:l.attribute,r]}}function uN(e,n){try{return GC(n,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const l=r,o=new xn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:l,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=Eb+"#cannot-parse-style-attribute",o}}function _b(e,n,r){let l;if(!r)l={type:"Literal",value:n};else if(n.includes(".")){const o=n.split(".");let u=-1,d;for(;++u<o.length;){const f=Ay(o[u])?{type:"Identifier",name:o[u]}:{type:"Literal",value:o[u]};d=d?{type:"MemberExpression",object:d,property:f,computed:!!(u&&f.type==="Literal"),optional:!1}:f}l=d}else l=Ay(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(l.type==="Literal"){const o=l.value;return $h.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(l);Xi(e)}function Xi(e,n){const r=new xn("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=Eb+"#cannot-handle-mdx-estrees-without-createevaluater",r}function dN(e){const n={};let r;for(r in e)$h.call(e,r)&&(n[fN(r)]=e[r]);return n}function fN(e){let n=e.replace(YC,mN);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function mN(e){return"-"+e.toLowerCase()}const nm={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"]},hN={};function Ph(e,n){const r=hN,l=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,o=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return Lb(e,l,o)}function Lb(e,n,r){if(pN(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 By(e.children,n,r)}return Array.isArray(e)?By(e,n,r):""}function By(e,n,r){const l=[];let o=-1;for(;++o<e.length;)l[o]=Lb(e[o],n,r);return l.join("")}function pN(e){return!!(e&&typeof e=="object")}const Hy=document.createElement("i");function qh(e){const n="&"+e+";";Hy.innerHTML=n;const r=Hy.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===n?!1:r}function Vn(e,n,r,l){const o=e.length;let u=0,d;if(n<0?n=-n>o?0:o+n:n=n>o?o:n,r=r>0?r:0,l.length<1e4)d=Array.from(l),d.unshift(n,r),e.splice(...d);else for(r&&e.splice(n,r);u<l.length;)d=l.slice(u,u+1e4),d.unshift(n,0),e.splice(...d),u+=1e4,n+=1e4}function ha(e,n){return e.length>0?(Vn(e,e.length,0,n),e):n}const Py={}.hasOwnProperty;function Ib(e){const n={};let r=-1;for(;++r<e.length;)gN(n,e[r]);return n}function gN(e,n){let r;for(r in n){const o=(Py.call(e,r)?e[r]:void 0)||(e[r]={}),u=n[r];let d;if(u)for(d in u){Py.call(o,d)||(o[d]=[]);const f=u[d];xN(o[d],Array.isArray(f)?f:f?[f]:[])}}}function xN(e,n){let r=-1;const l=[];for(;++r<n.length;)(n[r].add==="after"?e:l).push(n[r]);Vn(e,0,0,l)}function Ob(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 Aa(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const vn=rl(/[A-Za-z]/),pn=rl(/[\dA-Za-z]/),yN=rl(/[#-'*+\--9=?A-Z^-~]/);function lu(e){return e!==null&&(e<32||e===127)}const Km=rl(/\d/),vN=rl(/[\dA-Fa-f]/),bN=rl(/[!-/:-@[-`{-~]/);function Le(e){return e!==null&&e<-2}function Tt(e){return e!==null&&(e<0||e===32)}function We(e){return e===-2||e===-1||e===32}const ju=rl(new RegExp("\\p{P}|\\p{S}","u")),_l=rl(/\s/);function rl(e){return n;function n(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Rs(e){const n=[];let r=-1,l=0,o=0;for(;++r<e.length;){const u=e.charCodeAt(r);let d="";if(u===37&&pn(e.charCodeAt(r+1))&&pn(e.charCodeAt(r+2)))o=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(d=String.fromCharCode(u));else if(u>55295&&u<57344){const f=e.charCodeAt(r+1);u<56320&&f>56319&&f<57344?(d=String.fromCharCode(u,f),o=1):d="�"}else d=String.fromCharCode(u);d&&(n.push(e.slice(l,r),encodeURIComponent(d)),l=r+o+1,d=""),o&&(r+=o,o=0)}return n.join("")+e.slice(l)}function nt(e,n,r,l){const o=l?l-1:Number.POSITIVE_INFINITY;let u=0;return d;function d(m){return We(m)?(e.enter(r),f(m)):n(m)}function f(m){return We(m)&&u++<o?(e.consume(m),f):(e.exit(r),n(m))}}const kN={tokenize:wN};function wN(e){const n=e.attempt(this.parser.constructs.contentInitial,l,o);let r;return n;function l(f){if(f===null){e.consume(f);return}return e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),nt(e,n,"linePrefix")}function o(f){return e.enter("paragraph"),u(f)}function u(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"),u):(e.consume(f),d)}}const SN={tokenize:jN},qy={tokenize:CN};function jN(e){const n=this,r=[];let l=0,o,u,d;return f;function f(_){if(l<r.length){const q=r[l];return n.containerState=q[1],e.attempt(q[0].continuation,m,h)(_)}return h(_)}function m(_){if(l++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,o&&L();const q=n.events.length;let H=q,I;for(;H--;)if(n.events[H][0]==="exit"&&n.events[H][1].type==="chunkFlow"){I=n.events[H][1].end;break}E(l);let P=q;for(;P<n.events.length;)n.events[P][1].end={...I},P++;return Vn(n.events,H+1,0,n.events.slice(q)),n.events.length=P,h(_)}return f(_)}function h(_){if(l===r.length){if(!o)return k(_);if(o.currentConstruct&&o.currentConstruct.concrete)return N(_);n.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(qy,g,y)(_)}function g(_){return o&&L(),E(l),k(_)}function y(_){return n.parser.lazy[n.now().line]=l!==r.length,d=n.now().offset,N(_)}function k(_){return n.containerState={},e.attempt(qy,w,N)(_)}function w(_){return l++,r.push([n.currentConstruct,n.containerState]),k(_)}function N(_){if(_===null){o&&L(),E(0),e.consume(_);return}return o=o||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:u}),C(_)}function C(_){if(_===null){j(e.exit("chunkFlow"),!0),E(0),e.consume(_);return}return Le(_)?(e.consume(_),j(e.exit("chunkFlow")),l=0,n.interrupt=void 0,f):(e.consume(_),C)}function j(_,q){const H=n.sliceStream(_);if(q&&H.push(null),_.previous=u,u&&(u.next=_),u=_,o.defineSkip(_.start),o.write(H),n.parser.lazy[_.start.line]){let I=o.events.length;for(;I--;)if(o.events[I][1].start.offset<d&&(!o.events[I][1].end||o.events[I][1].end.offset>d))return;const P=n.events.length;let ee=P,Z,D;for(;ee--;)if(n.events[ee][0]==="exit"&&n.events[ee][1].type==="chunkFlow"){if(Z){D=n.events[ee][1].end;break}Z=!0}for(E(l),I=P;I<n.events.length;)n.events[I][1].end={...D},I++;Vn(n.events,ee+1,0,n.events.slice(P)),n.events.length=I}}function E(_){let q=r.length;for(;q-- >_;){const H=r[q];n.containerState=H[1],H[0].exit.call(n,e)}r.length=_}function L(){o.write([null]),u=void 0,o=void 0,n.containerState._closeFlow=void 0}}function CN(e,n,r){return nt(e,e.attempt(this.parser.constructs.document,n,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ns(e){if(e===null||Tt(e)||_l(e))return 1;if(ju(e))return 2}function Cu(e,n,r){const l=[];let o=-1;for(;++o<e.length;){const u=e[o].resolveAll;u&&!l.includes(u)&&(n=u(n,r),l.push(u))}return n}const Wm={name:"attention",resolveAll:NN,tokenize:TN};function NN(e,n){let r=-1,l,o,u,d,f,m,h,g;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(l=r;l--;)if(e[l][0]==="exit"&&e[l][1].type==="attentionSequence"&&e[l][1]._open&&n.sliceSerialize(e[l][1]).charCodeAt(0)===n.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[l][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[l][1].end.offset-e[l][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;m=e[l][1].end.offset-e[l][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const y={...e[l][1].end},k={...e[r][1].start};Fy(y,-m),Fy(k,m),d={type:m>1?"strongSequence":"emphasisSequence",start:y,end:{...e[l][1].end}},f={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:k},u={type:m>1?"strongText":"emphasisText",start:{...e[l][1].end},end:{...e[r][1].start}},o={type:m>1?"strong":"emphasis",start:{...d.start},end:{...f.end}},e[l][1].end={...d.start},e[r][1].start={...f.end},h=[],e[l][1].end.offset-e[l][1].start.offset&&(h=ha(h,[["enter",e[l][1],n],["exit",e[l][1],n]])),h=ha(h,[["enter",o,n],["enter",d,n],["exit",d,n],["enter",u,n]]),h=ha(h,Cu(n.parser.constructs.insideSpan.null,e.slice(l+1,r),n)),h=ha(h,[["exit",u,n],["enter",f,n],["exit",f,n],["exit",o,n]]),e[r][1].end.offset-e[r][1].start.offset?(g=2,h=ha(h,[["enter",e[r][1],n],["exit",e[r][1],n]])):g=0,Vn(e,l-1,r-l+3,h),r=l+h.length-g-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function TN(e,n){const r=this.parser.constructs.attentionMarkers.null,l=this.previous,o=Ns(l);let u;return d;function d(m){return u=m,e.enter("attentionSequence"),f(m)}function f(m){if(m===u)return e.consume(m),f;const h=e.exit("attentionSequence"),g=Ns(m),y=!g||g===2&&o||r.includes(m),k=!o||o===2&&g||r.includes(l);return h._open=!!(u===42?y:y&&(o||!k)),h._close=!!(u===42?k:k&&(g||!y)),n(m)}}function Fy(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const MN={name:"autolink",tokenize:EN};function EN(e,n,r){let l=0;return o;function o(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),u}function u(w){return vn(w)?(e.consume(w),d):w===64?r(w):h(w)}function d(w){return w===43||w===45||w===46||pn(w)?(l=1,f(w)):h(w)}function f(w){return w===58?(e.consume(w),l=0,m):(w===43||w===45||w===46||pn(w))&&l++<32?(e.consume(w),f):(l=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||lu(w)?r(w):(e.consume(w),m)}function h(w){return w===64?(e.consume(w),g):yN(w)?(e.consume(w),h):r(w)}function g(w){return pn(w)?y(w):r(w)}function y(w){return w===46?(e.consume(w),l=0,g):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||pn(w))&&l++<63){const N=w===45?k:y;return e.consume(w),N}return r(w)}}const io={partial:!0,tokenize:AN};function AN(e,n,r){return l;function l(u){return We(u)?nt(e,o,"linePrefix")(u):o(u)}function o(u){return u===null||Le(u)?n(u):r(u)}}const zb={continuation:{tokenize:_N},exit:LN,name:"blockQuote",tokenize:RN};function RN(e,n,r){const l=this;return o;function o(d){if(d===62){const f=l.containerState;return f.open||(e.enter("blockQuote",{_container:!0}),f.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(d),e.exit("blockQuoteMarker"),u}return r(d)}function u(d){return We(d)?(e.enter("blockQuotePrefixWhitespace"),e.consume(d),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(d))}}function _N(e,n,r){const l=this;return o;function o(d){return We(d)?nt(e,u,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d):u(d)}function u(d){return e.attempt(zb,n,r)(d)}}function LN(e){e.exit("blockQuote")}const Db={name:"characterEscape",tokenize:IN};function IN(e,n,r){return l;function l(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),o}function o(u){return bN(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):r(u)}}const Ub={name:"characterReference",tokenize:ON};function ON(e,n,r){const l=this;let o=0,u,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"),u=31,d=pn,g(y))}function h(y){return y===88||y===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(y),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,d=vN,g):(e.enter("characterReferenceValue"),u=7,d=Km,g(y))}function g(y){if(y===59&&o){const k=e.exit("characterReferenceValue");return d===pn&&!qh(l.sliceSerialize(k))?r(y):(e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return d(y)&&o++<u?(e.consume(y),g):r(y)}}const Vy={partial:!0,tokenize:DN},Gy={concrete:!0,name:"codeFenced",tokenize:zN};function zN(e,n,r){const l=this,o={partial:!0,tokenize:H};let u=0,d=0,f;return m;function m(I){return h(I)}function h(I){const P=l.events[l.events.length-1];return u=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,f=I,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(I)}function g(I){return I===f?(d++,e.consume(I),g):d<3?r(I):(e.exit("codeFencedFenceSequence"),We(I)?nt(e,y,"whitespace")(I):y(I))}function y(I){return I===null||Le(I)?(e.exit("codeFencedFence"),l.interrupt?n(I):e.check(Vy,C,q)(I)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),k(I))}function k(I){return I===null||Le(I)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),y(I)):We(I)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),nt(e,w,"whitespace")(I)):I===96&&I===f?r(I):(e.consume(I),k)}function w(I){return I===null||Le(I)?y(I):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),N(I))}function N(I){return I===null||Le(I)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),y(I)):I===96&&I===f?r(I):(e.consume(I),N)}function C(I){return e.attempt(o,q,j)(I)}function j(I){return e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),E}function E(I){return u>0&&We(I)?nt(e,L,"linePrefix",u+1)(I):L(I)}function L(I){return I===null||Le(I)?e.check(Vy,C,q)(I):(e.enter("codeFlowValue"),_(I))}function _(I){return I===null||Le(I)?(e.exit("codeFlowValue"),L(I)):(e.consume(I),_)}function q(I){return e.exit("codeFenced"),n(I)}function H(I,P,ee){let Z=0;return D;function D(U){return I.enter("lineEnding"),I.consume(U),I.exit("lineEnding"),V}function V(U){return I.enter("codeFencedFence"),We(U)?nt(I,B,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):B(U)}function B(U){return U===f?(I.enter("codeFencedFenceSequence"),Y(U)):ee(U)}function Y(U){return U===f?(Z++,I.consume(U),Y):Z>=d?(I.exit("codeFencedFenceSequence"),We(U)?nt(I,ne,"whitespace")(U):ne(U)):ee(U)}function ne(U){return U===null||Le(U)?(I.exit("codeFencedFence"),P(U)):ee(U)}}}function DN(e,n,r){const l=this;return o;function o(d){return d===null?r(d):(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u)}function u(d){return l.parser.lazy[l.now().line]?r(d):n(d)}}const am={name:"codeIndented",tokenize:$N},UN={partial:!0,tokenize:BN};function $N(e,n,r){const l=this;return o;function o(h){return e.enter("codeIndented"),nt(e,u,"linePrefix",5)(h)}function u(h){const g=l.events[l.events.length-1];return g&&g[1].type==="linePrefix"&&g[2].sliceSerialize(g[1],!0).length>=4?d(h):r(h)}function d(h){return h===null?m(h):Le(h)?e.attempt(UN,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 BN(e,n,r){const l=this;return o;function o(d){return l.parser.lazy[l.now().line]?r(d):Le(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),o):nt(e,u,"linePrefix",5)(d)}function u(d){const f=l.events[l.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 HN={name:"codeText",previous:qN,resolve:PN,tokenize:FN};function PN(e){let n=e.length-4,r=3,l,o;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(l=r;++l<n;)if(e[l][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[n][1].type="codeTextPadding",r+=2,n-=2;break}}for(l=r-1,n++;++l<=n;)o===void 0?l!==n&&e[l][1].type!=="lineEnding"&&(o=l):(l===n||e[l][1].type==="lineEnding")&&(e[o][1].type="codeTextData",l!==o+2&&(e[o][1].end=e[l-1][1].end,e.splice(o+2,l-o-2),n-=l-o-2,l=o+2),o=void 0);return e}function qN(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function FN(e,n,r){let l=0,o,u;return d;function d(y){return e.enter("codeText"),e.enter("codeTextSequence"),f(y)}function f(y){return y===96?(e.consume(y),l++,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?(u=e.enter("codeTextSequence"),o=0,g(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 g(y){return y===96?(e.consume(y),o++,g):o===l?(e.exit("codeTextSequence"),e.exit("codeText"),n(y)):(u.type="codeTextData",h(y))}}class VN{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 l=r??Number.POSITIVE_INFINITY;return l<this.left.length?this.left.slice(n,l):n>this.left.length?this.right.slice(this.right.length-l+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-l+this.left.length).reverse())}splice(n,r,l){const o=r||0;this.setCursor(Math.trunc(n));const u=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return l&&Ai(this.left,l),u.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),Ai(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),Ai(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);Ai(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);Ai(this.left,r.reverse())}}}function Ai(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 $b(e){const n={};let r=-1,l,o,u,d,f,m,h;const g=new VN(e);for(;++r<g.length;){for(;r in n;)r=n[r];if(l=g.get(r),r&&l[1].type==="chunkFlow"&&g.get(r-1)[1].type==="listItemPrefix"&&(m=l[1]._tokenizer.events,u=0,u<m.length&&m[u][1].type==="lineEndingBlank"&&(u+=2),u<m.length&&m[u][1].type==="content"))for(;++u<m.length&&m[u][1].type!=="content";)m[u][1].type==="chunkText"&&(m[u][1]._isInFirstContentOfListItem=!0,u++);if(l[0]==="enter")l[1].contentType&&(Object.assign(n,GN(g,r)),r=n[r],h=!0);else if(l[1]._container){for(u=r,o=void 0;u--;)if(d=g.get(u),d[1].type==="lineEnding"||d[1].type==="lineEndingBlank")d[0]==="enter"&&(o&&(g.get(o)[1].type="lineEndingBlank"),d[1].type="lineEnding",o=u);else if(!(d[1].type==="linePrefix"||d[1].type==="listItemIndent"))break;o&&(l[1].end={...g.get(o)[1].start},f=g.slice(o,r),f.unshift(l),g.splice(o,r-o+1,f))}}return Vn(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function GN(e,n){const r=e.get(n)[1],l=e.get(n)[2];let o=n-1;const u=[];let d=r._tokenizer;d||(d=l.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(d._contentTypeTextTrailing=!0));const f=d.events,m=[],h={};let g,y,k=-1,w=r,N=0,C=0;const j=[C];for(;w;){for(;e.get(++o)[1]!==w;);u.push(o),w._tokenizer||(g=l.sliceStream(w),w.next||g.push(null),y&&d.defineSkip(w.start),w._isInFirstContentOfListItem&&(d._gfmTasklistFirstContentOfListItem=!0),d.write(g),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&&(C=k+1,j.push(C),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(d.events=[],w?(w._tokenizer=void 0,w.previous=void 0):j.pop(),k=j.length;k--;){const E=f.slice(j[k],j[k+1]),L=u.pop();m.push([L,L+E.length-1]),e.splice(L,2,E)}for(m.reverse(),k=-1;++k<m.length;)h[N+m[k][0]]=N+m[k][1],N+=m[k][1]-m[k][0]-1;return h}const KN={resolve:YN,tokenize:QN},WN={partial:!0,tokenize:XN};function YN(e){return $b(e),e}function QN(e,n){let r;return l;function l(f){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),o(f)}function o(f){return f===null?u(f):Le(f)?e.check(WN,d,u)(f):(e.consume(f),o)}function u(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 XN(e,n,r){const l=this;return o;function o(d){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),nt(e,u,"linePrefix")}function u(d){if(d===null||Le(d))return r(d);const f=l.events[l.events.length-1];return!l.parser.constructs.disable.null.includes("codeIndented")&&f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?n(d):e.interrupt(l.parser.constructs.flow,r,n)(d)}}function Bb(e,n,r,l,o,u,d,f,m){const h=m||Number.POSITIVE_INFINITY;let g=0;return y;function y(E){return E===60?(e.enter(l),e.enter(o),e.enter(u),e.consume(E),e.exit(u),k):E===null||E===32||E===41||lu(E)?r(E):(e.enter(l),e.enter(d),e.enter(f),e.enter("chunkString",{contentType:"string"}),C(E))}function k(E){return E===62?(e.enter(u),e.consume(E),e.exit(u),e.exit(o),e.exit(l),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?N:w)}function N(E){return E===60||E===62||E===92?(e.consume(E),w):w(E)}function C(E){return!g&&(E===null||E===41||Tt(E))?(e.exit("chunkString"),e.exit(f),e.exit(d),e.exit(l),n(E)):g<h&&E===40?(e.consume(E),g++,C):E===41?(e.consume(E),g--,C):E===null||E===32||E===40||lu(E)?r(E):(e.consume(E),E===92?j:C)}function j(E){return E===40||E===41||E===92?(e.consume(E),C):C(E)}}function Hb(e,n,r,l,o,u){const d=this;let f=0,m;return h;function h(w){return e.enter(l),e.enter(o),e.consume(w),e.exit(o),e.enter(u),g}function g(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(u),e.enter(o),e.consume(w),e.exit(o),e.exit(l),n):Le(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),y(w))}function y(w){return w===null||w===91||w===93||Le(w)||f++>999?(e.exit("chunkString"),g(w)):(e.consume(w),m||(m=!We(w)),w===92?k:y)}function k(w){return w===91||w===92||w===93?(e.consume(w),f++,y):y(w)}}function Pb(e,n,r,l,o,u){let d;return f;function f(k){return k===34||k===39||k===40?(e.enter(l),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(l),n):(e.enter(u),h(k))}function h(k){return k===d?(e.exit(u),m(d)):k===null?r(k):Le(k)?(e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),nt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(k))}function g(k){return k===d||k===null||Le(k)?(e.exit("chunkString"),h(k)):(e.consume(k),k===92?y:g)}function y(k){return k===d||k===92?(e.consume(k),g):g(k)}}function qi(e,n){let r;return l;function l(o){return Le(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),r=!0,l):We(o)?nt(e,l,r?"linePrefix":"lineSuffix")(o):n(o)}}const ZN={name:"definition",tokenize:e3},JN={partial:!0,tokenize:t3};function e3(e,n,r){const l=this;let o;return u;function u(w){return e.enter("definition"),d(w)}function d(w){return Hb.call(l,e,f,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function f(w){return o=Aa(l.sliceSerialize(l.events[l.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 Tt(w)?qi(e,h)(w):h(w)}function h(w){return Bb(e,g,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function g(w){return e.attempt(JN,y,y)(w)}function y(w){return We(w)?nt(e,k,"whitespace")(w):k(w)}function k(w){return w===null||Le(w)?(e.exit("definition"),l.parser.defined.push(o),n(w)):r(w)}}function t3(e,n,r){return l;function l(f){return Tt(f)?qi(e,o)(f):r(f)}function o(f){return Pb(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(f)}function u(f){return We(f)?nt(e,d,"whitespace")(f):d(f)}function d(f){return f===null||Le(f)?n(f):r(f)}}const n3={name:"hardBreakEscape",tokenize:a3};function a3(e,n,r){return l;function l(u){return e.enter("hardBreakEscape"),e.consume(u),o}function o(u){return Le(u)?(e.exit("hardBreakEscape"),n(u)):r(u)}}const r3={name:"headingAtx",resolve:l3,tokenize:s3};function l3(e,n){let r=e.length-2,l=3,o,u;return e[l][1].type==="whitespace"&&(l+=2),r-2>l&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(l===r-1||r-4>l&&e[r-2][1].type==="whitespace")&&(r-=l+1===r?2:4),r>l&&(o={type:"atxHeadingText",start:e[l][1].start,end:e[r][1].end},u={type:"chunkText",start:e[l][1].start,end:e[r][1].end,contentType:"text"},Vn(e,l,r-l+1,[["enter",o,n],["enter",u,n],["exit",u,n],["exit",o,n]])),e}function s3(e,n,r){let l=0;return o;function o(g){return e.enter("atxHeading"),u(g)}function u(g){return e.enter("atxHeadingSequence"),d(g)}function d(g){return g===35&&l++<6?(e.consume(g),d):g===null||Tt(g)?(e.exit("atxHeadingSequence"),f(g)):r(g)}function f(g){return g===35?(e.enter("atxHeadingSequence"),m(g)):g===null||Le(g)?(e.exit("atxHeading"),n(g)):We(g)?nt(e,f,"whitespace")(g):(e.enter("atxHeadingText"),h(g))}function m(g){return g===35?(e.consume(g),m):(e.exit("atxHeadingSequence"),f(g))}function h(g){return g===null||g===35||Tt(g)?(e.exit("atxHeadingText"),f(g)):(e.consume(g),h)}}const i3=["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"],Ky=["pre","script","style","textarea"],o3={concrete:!0,name:"htmlFlow",resolveTo:d3,tokenize:f3},c3={partial:!0,tokenize:h3},u3={partial:!0,tokenize:m3};function d3(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 f3(e,n,r){const l=this;let o,u,d,f,m;return h;function h(T){return g(T)}function g(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),y}function y(T){return T===33?(e.consume(T),k):T===47?(e.consume(T),u=!0,C):T===63?(e.consume(T),o=3,l.interrupt?n:M):vn(T)?(e.consume(T),d=String.fromCharCode(T),j):r(T)}function k(T){return T===45?(e.consume(T),o=2,w):T===91?(e.consume(T),o=5,f=0,N):vn(T)?(e.consume(T),o=4,l.interrupt?n:M):r(T)}function w(T){return T===45?(e.consume(T),l.interrupt?n:M):r(T)}function N(T){const X="CDATA[";return T===X.charCodeAt(f++)?(e.consume(T),f===X.length?l.interrupt?n:B:N):r(T)}function C(T){return vn(T)?(e.consume(T),d=String.fromCharCode(T),j):r(T)}function j(T){if(T===null||T===47||T===62||Tt(T)){const X=T===47,ae=d.toLowerCase();return!X&&!u&&Ky.includes(ae)?(o=1,l.interrupt?n(T):B(T)):i3.includes(d.toLowerCase())?(o=6,X?(e.consume(T),E):l.interrupt?n(T):B(T)):(o=7,l.interrupt&&!l.parser.lazy[l.now().line]?r(T):u?L(T):_(T))}return T===45||pn(T)?(e.consume(T),d+=String.fromCharCode(T),j):r(T)}function E(T){return T===62?(e.consume(T),l.interrupt?n:B):r(T)}function L(T){return We(T)?(e.consume(T),L):D(T)}function _(T){return T===47?(e.consume(T),D):T===58||T===95||vn(T)?(e.consume(T),q):We(T)?(e.consume(T),_):D(T)}function q(T){return T===45||T===46||T===58||T===95||pn(T)?(e.consume(T),q):H(T)}function H(T){return T===61?(e.consume(T),I):We(T)?(e.consume(T),H):_(T)}function I(T){return T===null||T===60||T===61||T===62||T===96?r(T):T===34||T===39?(e.consume(T),m=T,P):We(T)?(e.consume(T),I):ee(T)}function P(T){return T===m?(e.consume(T),m=null,Z):T===null||Le(T)?r(T):(e.consume(T),P)}function ee(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||Tt(T)?H(T):(e.consume(T),ee)}function Z(T){return T===47||T===62||We(T)?_(T):r(T)}function D(T){return T===62?(e.consume(T),V):r(T)}function V(T){return T===null||Le(T)?B(T):We(T)?(e.consume(T),V):r(T)}function B(T){return T===45&&o===2?(e.consume(T),z):T===60&&o===1?(e.consume(T),$):T===62&&o===4?(e.consume(T),R):T===63&&o===3?(e.consume(T),M):T===93&&o===5?(e.consume(T),me):Le(T)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(c3,O,Y)(T)):T===null||Le(T)?(e.exit("htmlFlowData"),Y(T)):(e.consume(T),B)}function Y(T){return e.check(u3,ne,O)(T)}function ne(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),U}function U(T){return T===null||Le(T)?Y(T):(e.enter("htmlFlowData"),B(T))}function z(T){return T===45?(e.consume(T),M):B(T)}function $(T){return T===47?(e.consume(T),d="",G):B(T)}function G(T){if(T===62){const X=d.toLowerCase();return Ky.includes(X)?(e.consume(T),R):B(T)}return vn(T)&&d.length<8?(e.consume(T),d+=String.fromCharCode(T),G):B(T)}function me(T){return T===93?(e.consume(T),M):B(T)}function M(T){return T===62?(e.consume(T),R):T===45&&o===2?(e.consume(T),M):B(T)}function R(T){return T===null||Le(T)?(e.exit("htmlFlowData"),O(T)):(e.consume(T),R)}function O(T){return e.exit("htmlFlow"),n(T)}}function m3(e,n,r){const l=this;return o;function o(d){return Le(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),u):r(d)}function u(d){return l.parser.lazy[l.now().line]?r(d):n(d)}}function h3(e,n,r){return l;function l(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(io,n,r)}}const p3={name:"htmlText",tokenize:g3};function g3(e,n,r){const l=this;let o,u,d;return f;function f(M){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(M),m}function m(M){return M===33?(e.consume(M),h):M===47?(e.consume(M),H):M===63?(e.consume(M),_):vn(M)?(e.consume(M),ee):r(M)}function h(M){return M===45?(e.consume(M),g):M===91?(e.consume(M),u=0,N):vn(M)?(e.consume(M),L):r(M)}function g(M){return M===45?(e.consume(M),w):r(M)}function y(M){return M===null?r(M):M===45?(e.consume(M),k):Le(M)?(d=y,$(M)):(e.consume(M),y)}function k(M){return M===45?(e.consume(M),w):y(M)}function w(M){return M===62?z(M):M===45?k(M):y(M)}function N(M){const R="CDATA[";return M===R.charCodeAt(u++)?(e.consume(M),u===R.length?C:N):r(M)}function C(M){return M===null?r(M):M===93?(e.consume(M),j):Le(M)?(d=C,$(M)):(e.consume(M),C)}function j(M){return M===93?(e.consume(M),E):C(M)}function E(M){return M===62?z(M):M===93?(e.consume(M),E):C(M)}function L(M){return M===null||M===62?z(M):Le(M)?(d=L,$(M)):(e.consume(M),L)}function _(M){return M===null?r(M):M===63?(e.consume(M),q):Le(M)?(d=_,$(M)):(e.consume(M),_)}function q(M){return M===62?z(M):_(M)}function H(M){return vn(M)?(e.consume(M),I):r(M)}function I(M){return M===45||pn(M)?(e.consume(M),I):P(M)}function P(M){return Le(M)?(d=P,$(M)):We(M)?(e.consume(M),P):z(M)}function ee(M){return M===45||pn(M)?(e.consume(M),ee):M===47||M===62||Tt(M)?Z(M):r(M)}function Z(M){return M===47?(e.consume(M),z):M===58||M===95||vn(M)?(e.consume(M),D):Le(M)?(d=Z,$(M)):We(M)?(e.consume(M),Z):z(M)}function D(M){return M===45||M===46||M===58||M===95||pn(M)?(e.consume(M),D):V(M)}function V(M){return M===61?(e.consume(M),B):Le(M)?(d=V,$(M)):We(M)?(e.consume(M),V):Z(M)}function B(M){return M===null||M===60||M===61||M===62||M===96?r(M):M===34||M===39?(e.consume(M),o=M,Y):Le(M)?(d=B,$(M)):We(M)?(e.consume(M),B):(e.consume(M),ne)}function Y(M){return M===o?(e.consume(M),o=void 0,U):M===null?r(M):Le(M)?(d=Y,$(M)):(e.consume(M),Y)}function ne(M){return M===null||M===34||M===39||M===60||M===61||M===96?r(M):M===47||M===62||Tt(M)?Z(M):(e.consume(M),ne)}function U(M){return M===47||M===62||Tt(M)?Z(M):r(M)}function z(M){return M===62?(e.consume(M),e.exit("htmlTextData"),e.exit("htmlText"),n):r(M)}function $(M){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),G}function G(M){return We(M)?nt(e,me,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(M):me(M)}function me(M){return e.enter("htmlTextData"),d(M)}}const Fh={name:"labelEnd",resolveAll:b3,resolveTo:k3,tokenize:w3},x3={tokenize:S3},y3={tokenize:j3},v3={tokenize:C3};function b3(e){let n=-1;const r=[];for(;++n<e.length;){const l=e[n][1];if(r.push(e[n]),l.type==="labelImage"||l.type==="labelLink"||l.type==="labelEnd"){const o=l.type==="labelImage"?4:2;l.type="data",n+=o}}return e.length!==r.length&&Vn(e,0,e.length,r),e}function k3(e,n){let r=e.length,l=0,o,u,d,f;for(;r--;)if(o=e[r][1],u){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&&(u=r,o.type!=="labelLink")){l=2;break}}else o.type==="labelEnd"&&(d=r);const m={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},h={type:"label",start:{...e[u][1].start},end:{...e[d][1].end}},g={type:"labelText",start:{...e[u+l+2][1].end},end:{...e[d-2][1].start}};return f=[["enter",m,n],["enter",h,n]],f=ha(f,e.slice(u+1,u+l+3)),f=ha(f,[["enter",g,n]]),f=ha(f,Cu(n.parser.constructs.insideSpan.null,e.slice(u+l+4,d-3),n)),f=ha(f,[["exit",g,n],e[d-2],e[d-1],["exit",h,n]]),f=ha(f,e.slice(d+1)),f=ha(f,[["exit",m,n]]),Vn(e,u,e.length,f),e}function w3(e,n,r){const l=this;let o=l.events.length,u,d;for(;o--;)if((l.events[o][1].type==="labelImage"||l.events[o][1].type==="labelLink")&&!l.events[o][1]._balanced){u=l.events[o][1];break}return f;function f(k){return u?u._inactive?y(k):(d=l.parser.defined.includes(Aa(l.sliceSerialize({start:u.end,end:l.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(x3,g,d?g:y)(k):k===91?e.attempt(y3,g,d?h:y)(k):d?g(k):y(k)}function h(k){return e.attempt(v3,g,y)(k)}function g(k){return n(k)}function y(k){return u._balanced=!0,r(k)}}function S3(e,n,r){return l;function l(y){return e.enter("resource"),e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),o}function o(y){return Tt(y)?qi(e,u)(y):u(y)}function u(y){return y===41?g(y):Bb(e,d,f,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function d(y){return Tt(y)?qi(e,m)(y):g(y)}function f(y){return r(y)}function m(y){return y===34||y===39||y===40?Pb(e,h,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):g(y)}function h(y){return Tt(y)?qi(e,g)(y):g(y)}function g(y){return y===41?(e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),e.exit("resource"),n):r(y)}}function j3(e,n,r){const l=this;return o;function o(f){return Hb.call(l,e,u,d,"reference","referenceMarker","referenceString")(f)}function u(f){return l.parser.defined.includes(Aa(l.sliceSerialize(l.events[l.events.length-1][1]).slice(1,-1)))?n(f):r(f)}function d(f){return r(f)}}function C3(e,n,r){return l;function l(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),o}function o(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),n):r(u)}}const N3={name:"labelStartImage",resolveAll:Fh.resolveAll,tokenize:T3};function T3(e,n,r){const l=this;return o;function o(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),u}function u(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 l.parser.constructs?r(f):n(f)}}const M3={name:"labelStartLink",resolveAll:Fh.resolveAll,tokenize:E3};function E3(e,n,r){const l=this;return o;function o(d){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelLink"),u}function u(d){return d===94&&"_hiddenFootnoteSupport"in l.parser.constructs?r(d):n(d)}}const rm={name:"lineEnding",tokenize:A3};function A3(e,n){return r;function r(l){return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),nt(e,n,"linePrefix")}}const Xc={name:"thematicBreak",tokenize:R3};function R3(e,n,r){let l=0,o;return u;function u(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)):l>=3&&(h===null||Le(h))?(e.exit("thematicBreak"),n(h)):r(h)}function m(h){return h===o?(e.consume(h),l++,m):(e.exit("thematicBreakSequence"),We(h)?nt(e,f,"whitespace")(h):f(h))}}const En={continuation:{tokenize:O3},exit:D3,name:"list",tokenize:I3},_3={partial:!0,tokenize:U3},L3={partial:!0,tokenize:z3};function I3(e,n,r){const l=this,o=l.events[l.events.length-1];let u=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,d=0;return f;function f(w){const N=l.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(N==="listUnordered"?!l.containerState.marker||w===l.containerState.marker:Km(w)){if(l.containerState.type||(l.containerState.type=N,e.enter(N,{_container:!0})),N==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(Xc,r,h)(w):h(w);if(!l.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(w)}return r(w)}function m(w){return Km(w)&&++d<10?(e.consume(w),m):(!l.interrupt||d<2)&&(l.containerState.marker?w===l.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"),l.containerState.marker=l.containerState.marker||w,e.check(io,l.interrupt?r:g,e.attempt(_3,k,y))}function g(w){return l.containerState.initialBlankLine=!0,u++,k(w)}function y(w){return We(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),k):r(w)}function k(w){return l.containerState.size=u+l.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(w)}}function O3(e,n,r){const l=this;return l.containerState._closeFlow=void 0,e.check(io,o,u);function o(f){return l.containerState.furtherBlankLines=l.containerState.furtherBlankLines||l.containerState.initialBlankLine,nt(e,n,"listItemIndent",l.containerState.size+1)(f)}function u(f){return l.containerState.furtherBlankLines||!We(f)?(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,d(f)):(l.containerState.furtherBlankLines=void 0,l.containerState.initialBlankLine=void 0,e.attempt(L3,n,d)(f))}function d(f){return l.containerState._closeFlow=!0,l.interrupt=void 0,nt(e,e.attempt(En,n,r),"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(f)}}function z3(e,n,r){const l=this;return nt(e,o,"listItemIndent",l.containerState.size+1);function o(u){const d=l.events[l.events.length-1];return d&&d[1].type==="listItemIndent"&&d[2].sliceSerialize(d[1],!0).length===l.containerState.size?n(u):r(u)}}function D3(e){e.exit(this.containerState.type)}function U3(e,n,r){const l=this;return nt(e,o,"listItemPrefixWhitespace",l.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(u){const d=l.events[l.events.length-1];return!We(u)&&d&&d[1].type==="listItemPrefixWhitespace"?n(u):r(u)}}const Wy={name:"setextUnderline",resolveTo:$3,tokenize:B3};function $3(e,n){let r=e.length,l,o,u;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){l=r;break}e[r][1].type==="paragraph"&&(o=r)}else e[r][1].type==="content"&&e.splice(r,1),!u&&e[r][1].type==="definition"&&(u=r);const d={type:"setextHeading",start:{...e[l][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",u?(e.splice(o,0,["enter",d,n]),e.splice(u+1,0,["exit",e[l][1],n]),e[l][1].end={...e[u][1].end}):e[l][1]=d,e.push(["exit",d,n]),e}function B3(e,n,r){const l=this;let o;return u;function u(h){let g=l.events.length,y;for(;g--;)if(l.events[g][1].type!=="lineEnding"&&l.events[g][1].type!=="linePrefix"&&l.events[g][1].type!=="content"){y=l.events[g][1].type==="paragraph";break}return!l.parser.lazy[l.now().line]&&(l.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"),We(h)?nt(e,m,"lineSuffix")(h):m(h))}function m(h){return h===null||Le(h)?(e.exit("setextHeadingLine"),n(h)):r(h)}}const H3={tokenize:P3};function P3(e){const n=this,r=e.attempt(io,l,e.attempt(this.parser.constructs.flowInitial,o,nt(e,e.attempt(this.parser.constructs.flow,o,e.attempt(KN,o)),"linePrefix")));return r;function l(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),n.currentConstruct=void 0,r}function o(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),n.currentConstruct=void 0,r}}const q3={resolveAll:Fb()},F3=qb("string"),V3=qb("text");function qb(e){return{resolveAll:Fb(e==="text"?G3:void 0),tokenize:n};function n(r){const l=this,o=this.parser.constructs[e],u=r.attempt(o,d,f);return d;function d(g){return h(g)?u(g):f(g)}function f(g){if(g===null){r.consume(g);return}return r.enter("data"),r.consume(g),m}function m(g){return h(g)?(r.exit("data"),u(g)):(r.consume(g),m)}function h(g){if(g===null)return!0;const y=o[g];let k=-1;if(y)for(;++k<y.length;){const w=y[k];if(!w.previous||w.previous.call(l,l.previous))return!0}return!1}}}function Fb(e){return n;function n(r,l){let o=-1,u;for(;++o<=r.length;)u===void 0?r[o]&&r[o][1].type==="data"&&(u=o,o++):(!r[o]||r[o][1].type!=="data")&&(o!==u+2&&(r[u][1].end=r[o-1][1].end,r.splice(u+2,o-u-2),o=u+2),u=void 0);return e?e(r,l):r}}function G3(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 l=e[r-1][1],o=n.sliceStream(l);let u=o.length,d=-1,f=0,m;for(;u--;){const h=o[u];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){u++;break}}if(n._contentTypeTextTrailing&&r===e.length&&(f=0),f){const h={type:r===e.length||m||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?d:l.start._bufferIndex+d,_index:l.start._index+u,line:l.end.line,column:l.end.column-f,offset:l.end.offset-f},end:{...l.end}};l.end={...h.start},l.start.offset===l.end.offset?Object.assign(l,h):(e.splice(r,0,["enter",h,n],["exit",h,n]),r+=2)}r++}return e}const K3={42:En,43:En,45:En,48:En,49:En,50:En,51:En,52:En,53:En,54:En,55:En,56:En,57:En,62:zb},W3={91:ZN},Y3={[-2]:am,[-1]:am,32:am},Q3={35:r3,42:Xc,45:[Wy,Xc],60:o3,61:Wy,95:Xc,96:Gy,126:Gy},X3={38:Ub,92:Db},Z3={[-5]:rm,[-4]:rm,[-3]:rm,33:N3,38:Ub,42:Wm,60:[MN,p3],91:M3,92:[n3,Db],93:Fh,95:Wm,96:HN},J3={null:[Wm,q3]},eT={null:[42,95]},tT={null:[]},nT=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:eT,contentInitial:W3,disable:tT,document:K3,flow:Q3,flowInitial:Y3,insideSpan:J3,string:X3,text:Z3},Symbol.toStringTag,{value:"Module"}));function aT(e,n,r){let l={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const o={},u=[];let d=[],f=[];const m={attempt:P(H),check:P(I),consume:L,enter:_,exit:q,interrupt:P(I,{interrupt:!0})},h={code:null,containerState:{},defineSkip:C,events:[],now:N,parser:e,previous:null,sliceSerialize:k,sliceStream:w,write:y};let g=n.tokenize.call(h,m);return n.resolveAll&&u.push(n),h;function y(V){return d=ha(d,V),j(),d[d.length-1]!==null?[]:(ee(n,0),h.events=Cu(u,h.events,h),h.events)}function k(V,B){return lT(w(V),B)}function w(V){return rT(d,V)}function N(){const{_bufferIndex:V,_index:B,line:Y,column:ne,offset:U}=l;return{_bufferIndex:V,_index:B,line:Y,column:ne,offset:U}}function C(V){o[V.line]=V.column,D()}function j(){let V;for(;l._index<d.length;){const B=d[l._index];if(typeof B=="string")for(V=l._index,l._bufferIndex<0&&(l._bufferIndex=0);l._index===V&&l._bufferIndex<B.length;)E(B.charCodeAt(l._bufferIndex));else E(B)}}function E(V){g=g(V)}function L(V){Le(V)?(l.line++,l.column=1,l.offset+=V===-3?2:1,D()):V!==-1&&(l.column++,l.offset++),l._bufferIndex<0?l._index++:(l._bufferIndex++,l._bufferIndex===d[l._index].length&&(l._bufferIndex=-1,l._index++)),h.previous=V}function _(V,B){const Y=B||{};return Y.type=V,Y.start=N(),h.events.push(["enter",Y,h]),f.push(Y),Y}function q(V){const B=f.pop();return B.end=N(),h.events.push(["exit",B,h]),B}function H(V,B){ee(V,B.from)}function I(V,B){B.restore()}function P(V,B){return Y;function Y(ne,U,z){let $,G,me,M;return Array.isArray(ne)?O(ne):"tokenize"in ne?O([ne]):R(ne);function R(oe){return ge;function ge(Te){const se=Te!==null&&oe[Te],pe=Te!==null&&oe.null,be=[...Array.isArray(se)?se:se?[se]:[],...Array.isArray(pe)?pe:pe?[pe]:[]];return O(be)(Te)}}function O(oe){return $=oe,G=0,oe.length===0?z:T(oe[G])}function T(oe){return ge;function ge(Te){return M=Z(),me=oe,oe.partial||(h.currentConstruct=oe),oe.name&&h.parser.constructs.disable.null.includes(oe.name)?ae():oe.tokenize.call(B?Object.assign(Object.create(h),B):h,m,X,ae)(Te)}}function X(oe){return V(me,M),U}function ae(oe){return M.restore(),++G<$.length?T($[G]):z}}}function ee(V,B){V.resolveAll&&!u.includes(V)&&u.push(V),V.resolve&&Vn(h.events,B,h.events.length-B,V.resolve(h.events.slice(B),h)),V.resolveTo&&(h.events=V.resolveTo(h.events,h))}function Z(){const V=N(),B=h.previous,Y=h.currentConstruct,ne=h.events.length,U=Array.from(f);return{from:ne,restore:z};function z(){l=V,h.previous=B,h.currentConstruct=Y,h.events.length=ne,f=U,D()}}function D(){l.line in o&&l.column<2&&(l.column=o[l.line],l.offset+=o[l.line]-1)}}function rT(e,n){const r=n.start._index,l=n.start._bufferIndex,o=n.end._index,u=n.end._bufferIndex;let d;if(r===o)d=[e[r].slice(l,u)];else{if(d=e.slice(r,o),l>-1){const f=d[0];typeof f=="string"?d[0]=f.slice(l):d.shift()}u>0&&d.push(e[o].slice(0,u))}return d}function lT(e,n){let r=-1;const l=[];let o;for(;++r<e.length;){const u=e[r];let d;if(typeof u=="string")d=u;else switch(u){case-5:{d="\r";break}case-4:{d=`
|
|
74
|
-
`;break}case-3:{d=`\r
|
|
75
|
-
`;break}case-2:{d=n?" ":" ";break}case-1:{if(!n&&o)continue;d=" ";break}default:d=String.fromCharCode(u)}o=u===-2,l.push(d)}return l.join("")}function sT(e){const l={constructs:Ib([nT,...(e||{}).extensions||[]]),content:o(kN),defined:[],document:o(SN),flow:o(H3),lazy:{},string:o(F3),text:o(V3)};return l;function o(u){return d;function d(f){return aT(l,u,f)}}}function iT(e){for(;!$b(e););return e}const Yy=/[\0\t\n\r]/g;function oT(){let e=1,n="",r=!0,l;return o;function o(u,d,f){const m=[];let h,g,y,k,w;for(u=n+(typeof u=="string"?u.toString():new TextDecoder(d||void 0).decode(u)),y=0,n="",r&&(u.charCodeAt(0)===65279&&y++,r=void 0);y<u.length;){if(Yy.lastIndex=y,h=Yy.exec(u),k=h&&h.index!==void 0?h.index:u.length,w=u.charCodeAt(k),!h){n=u.slice(y);break}if(w===10&&y===k&&l)m.push(-3),l=void 0;else switch(l&&(m.push(-5),l=void 0),y<k&&(m.push(u.slice(y,k)),e+=k-y),w){case 0:{m.push(65533),e++;break}case 9:{for(g=Math.ceil(e/4)*4,m.push(-2);e++<g;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:l=!0,e=1}y=k+1}return f&&(l&&m.push(-5),n&&m.push(n),m.push(null)),m}}const cT=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function uT(e){return e.replace(cT,dT)}function dT(e,n,r){if(n)return n;if(r.charCodeAt(0)===35){const o=r.charCodeAt(1),u=o===120||o===88;return Ob(r.slice(u?2:1),u?16:10)}return qh(r)||e}const Vb={}.hasOwnProperty;function fT(e,n,r){return n&&typeof n=="object"&&(r=n,n=void 0),mT(r)(iT(sT(r).document().write(oT()(e,n,!0))))}function mT(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(je),autolinkProtocol:Z,autolinkEmail:Z,atxHeading:u(dt),blockQuote:u(pe),characterEscape:Z,characterReference:Z,codeFenced:u(be),codeFencedFenceInfo:d,codeFencedFenceMeta:d,codeIndented:u(be,d),codeText:u(Pe,d),codeTextData:Z,data:Z,codeFlowValue:Z,definition:u(Ze),definitionDestinationString:d,definitionLabelString:d,definitionTitleString:d,emphasis:u(De),hardBreakEscape:u(at),hardBreakTrailing:u(at),htmlFlow:u(Mt,d),htmlFlowData:Z,htmlText:u(Mt,d),htmlTextData:Z,image:u(rt),label:d,link:u(je),listItem:u(wt),listItemValue:k,listOrdered:u(qe,y),listUnordered:u(qe),paragraph:u($t),reference:T,referenceString:d,resourceDestinationString:d,resourceTitleString:d,setextHeading:u(dt),strong:u(At),thematicBreak:u(ba)},exit:{atxHeading:m(),atxHeadingSequence:H,autolink:m(),autolinkEmail:se,autolinkProtocol:Te,blockQuote:m(),characterEscapeValue:D,characterReferenceMarkerHexadecimal:ae,characterReferenceMarkerNumeric:ae,characterReferenceValue:oe,characterReference:ge,codeFenced:m(j),codeFencedFence:C,codeFencedFenceInfo:w,codeFencedFenceMeta:N,codeFlowValue:D,codeIndented:m(E),codeText:m(U),codeTextData:D,data:D,definition:m(),definitionDestinationString:q,definitionLabelString:L,definitionTitleString:_,emphasis:m(),hardBreakEscape:m(B),hardBreakTrailing:m(B),htmlFlow:m(Y),htmlFlowData:D,htmlText:m(ne),htmlTextData:D,image:m($),label:me,labelText:G,lineEnding:V,link:m(z),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:X,resourceDestinationString:M,resourceTitleString:R,resource:O,setextHeading:m(ee),setextHeadingLineSequence:P,setextHeadingText:I,strong:m(),thematicBreak:m()}};Gb(n,(e||{}).mdastExtensions||[]);const r={};return l;function l(ie){let ye={type:"root",children:[]};const we={stack:[ye],tokenStack:[],config:n,enter:f,exit:h,buffer:d,resume:g,data:r},Oe=[];let Fe=-1;for(;++Fe<ie.length;)if(ie[Fe][1].type==="listOrdered"||ie[Fe][1].type==="listUnordered")if(ie[Fe][0]==="enter")Oe.push(Fe);else{const Ot=Oe.pop();Fe=o(ie,Ot,Fe)}for(Fe=-1;++Fe<ie.length;){const Ot=n[ie[Fe][0]];Vb.call(Ot,ie[Fe][1].type)&&Ot[ie[Fe][1].type].call(Object.assign({sliceSerialize:ie[Fe][2].sliceSerialize},we),ie[Fe][1])}if(we.tokenStack.length>0){const Ot=we.tokenStack[we.tokenStack.length-1];(Ot[1]||Qy).call(we,void 0,Ot[0])}for(ye.position={start:Xr(ie.length>0?ie[0][1].start:{line:1,column:1,offset:0}),end:Xr(ie.length>0?ie[ie.length-2][1].end:{line:1,column:1,offset:0})},Fe=-1;++Fe<n.transforms.length;)ye=n.transforms[Fe](ye)||ye;return ye}function o(ie,ye,we){let Oe=ye-1,Fe=-1,Ot=!1,nn,Pt,gt,zt;for(;++Oe<=we;){const xe=ie[Oe];switch(xe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{xe[0]==="enter"?Fe++:Fe--,zt=void 0;break}case"lineEndingBlank":{xe[0]==="enter"&&(nn&&!zt&&!Fe&&!gt&&(gt=Oe),zt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:zt=void 0}if(!Fe&&xe[0]==="enter"&&xe[1].type==="listItemPrefix"||Fe===-1&&xe[0]==="exit"&&(xe[1].type==="listUnordered"||xe[1].type==="listOrdered")){if(nn){let Ce=Oe;for(Pt=void 0;Ce--;){const tt=ie[Ce];if(tt[1].type==="lineEnding"||tt[1].type==="lineEndingBlank"){if(tt[0]==="exit")continue;Pt&&(ie[Pt][1].type="lineEndingBlank",Ot=!0),tt[1].type="lineEnding",Pt=Ce}else if(!(tt[1].type==="linePrefix"||tt[1].type==="blockQuotePrefix"||tt[1].type==="blockQuotePrefixWhitespace"||tt[1].type==="blockQuoteMarker"||tt[1].type==="listItemIndent"))break}gt&&(!Pt||gt<Pt)&&(nn._spread=!0),nn.end=Object.assign({},Pt?ie[Pt][1].start:xe[1].end),ie.splice(Pt||Oe,0,["exit",nn,xe[2]]),Oe++,we++}if(xe[1].type==="listItemPrefix"){const Ce={type:"listItem",_spread:!1,start:Object.assign({},xe[1].start),end:void 0};nn=Ce,ie.splice(Oe,0,["enter",Ce,xe[2]]),Oe++,we++,gt=void 0,zt=!0}}}return ie[ye][1]._spread=Ot,we}function u(ie,ye){return we;function we(Oe){f.call(this,ie(Oe),Oe),ye&&ye.call(this,Oe)}}function d(){this.stack.push({type:"fragment",children:[]})}function f(ie,ye,we){this.stack[this.stack.length-1].children.push(ie),this.stack.push(ie),this.tokenStack.push([ye,we||void 0]),ie.position={start:Xr(ye.start),end:void 0}}function m(ie){return ye;function ye(we){ie&&ie.call(this,we),h.call(this,we)}}function h(ie,ye){const we=this.stack.pop(),Oe=this.tokenStack.pop();if(Oe)Oe[0].type!==ie.type&&(ye?ye.call(this,ie,Oe[0]):(Oe[1]||Qy).call(this,ie,Oe[0]));else throw new Error("Cannot close `"+ie.type+"` ("+Pi({start:ie.start,end:ie.end})+"): it’s not open");we.position.end=Xr(ie.end)}function g(){return Ph(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function k(ie){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(ie),10),this.data.expectingFirstListItemValue=void 0}}function w(){const ie=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=ie}function N(){const ie=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=ie}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function j(){const ie=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ie.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function E(){const ie=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ie.replace(/(\r?\n|\r)$/g,"")}function L(ie){const ye=this.resume(),we=this.stack[this.stack.length-1];we.label=ye,we.identifier=Aa(this.sliceSerialize(ie)).toLowerCase()}function _(){const ie=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ie}function q(){const ie=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ie}function H(ie){const ye=this.stack[this.stack.length-1];if(!ye.depth){const we=this.sliceSerialize(ie).length;ye.depth=we}}function I(){this.data.setextHeadingSlurpLineEnding=!0}function P(ie){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(ie).codePointAt(0)===61?1:2}function ee(){this.data.setextHeadingSlurpLineEnding=void 0}function Z(ie){const we=this.stack[this.stack.length-1].children;let Oe=we[we.length-1];(!Oe||Oe.type!=="text")&&(Oe=St(),Oe.position={start:Xr(ie.start),end:void 0},we.push(Oe)),this.stack.push(Oe)}function D(ie){const ye=this.stack.pop();ye.value+=this.sliceSerialize(ie),ye.position.end=Xr(ie.end)}function V(ie){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const we=ye.children[ye.children.length-1];we.position.end=Xr(ie.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(ye.type)&&(Z.call(this,ie),D.call(this,ie))}function B(){this.data.atHardBreak=!0}function Y(){const ie=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ie}function ne(){const ie=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ie}function U(){const ie=this.resume(),ye=this.stack[this.stack.length-1];ye.value=ie}function z(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=ye,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function $(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=ye,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function G(ie){const ye=this.sliceSerialize(ie),we=this.stack[this.stack.length-2];we.label=uT(ye),we.identifier=Aa(ye).toLowerCase()}function me(){const ie=this.stack[this.stack.length-1],ye=this.resume(),we=this.stack[this.stack.length-1];if(this.data.inReference=!0,we.type==="link"){const Oe=ie.children;we.children=Oe}else we.alt=ye}function M(){const ie=this.resume(),ye=this.stack[this.stack.length-1];ye.url=ie}function R(){const ie=this.resume(),ye=this.stack[this.stack.length-1];ye.title=ie}function O(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function X(ie){const ye=this.resume(),we=this.stack[this.stack.length-1];we.label=ye,we.identifier=Aa(this.sliceSerialize(ie)).toLowerCase(),this.data.referenceType="full"}function ae(ie){this.data.characterReferenceType=ie.type}function oe(ie){const ye=this.sliceSerialize(ie),we=this.data.characterReferenceType;let Oe;we?(Oe=Ob(ye,we==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Oe=qh(ye);const Fe=this.stack[this.stack.length-1];Fe.value+=Oe}function ge(ie){const ye=this.stack.pop();ye.position.end=Xr(ie.end)}function Te(ie){D.call(this,ie);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(ie)}function se(ie){D.call(this,ie);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(ie)}function pe(){return{type:"blockquote",children:[]}}function be(){return{type:"code",lang:null,meta:null,value:""}}function Pe(){return{type:"inlineCode",value:""}}function Ze(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function De(){return{type:"emphasis",children:[]}}function dt(){return{type:"heading",depth:0,children:[]}}function at(){return{type:"break"}}function Mt(){return{type:"html",value:""}}function rt(){return{type:"image",title:null,url:"",alt:null}}function je(){return{type:"link",title:null,url:"",children:[]}}function qe(ie){return{type:"list",ordered:ie.type==="listOrdered",start:null,spread:ie._spread,children:[]}}function wt(ie){return{type:"listItem",spread:ie._spread,checked:null,children:[]}}function $t(){return{type:"paragraph",children:[]}}function At(){return{type:"strong",children:[]}}function St(){return{type:"text",value:""}}function ba(){return{type:"thematicBreak"}}}function Xr(e){return{line:e.line,column:e.column,offset:e.offset}}function Gb(e,n){let r=-1;for(;++r<n.length;){const l=n[r];Array.isArray(l)?Gb(e,l):hT(e,l)}}function hT(e,n){let r;for(r in n)if(Vb.call(n,r))switch(r){case"canContainEols":{const l=n[r];l&&e[r].push(...l);break}case"transforms":{const l=n[r];l&&e[r].push(...l);break}case"enter":case"exit":{const l=n[r];l&&Object.assign(e[r],l);break}}}function Qy(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+Pi({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+Pi({start:n.start,end:n.end})+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+Pi({start:n.start,end:n.end})+") is still open")}function pT(e){const n=this;n.parser=r;function r(l){return fT(l,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function gT(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 xT(e,n){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,r),[e.applyData(n,r),{type:"text",value:`
|
|
76
|
-
`}]}function yT(e,n){const r=n.value?n.value+`
|
|
77
|
-
`:"",l={},o=n.lang?n.lang.split(/\s+/):[];o.length>0&&(l.className=["language-"+o[0]]);let u={type:"element",tagName:"code",properties:l,children:[{type:"text",value:r}]};return n.meta&&(u.data={meta:n.meta}),e.patch(n,u),u=e.applyData(n,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(n,u),u}function vT(e,n){const r={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function bT(e,n){const r={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function kT(e,n){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",l=String(n.identifier).toUpperCase(),o=Rs(l.toLowerCase()),u=e.footnoteOrder.indexOf(l);let d,f=e.footnoteCounts.get(l);f===void 0?(f=0,e.footnoteOrder.push(l),d=e.footnoteOrder.length):d=u+1,f+=1,e.footnoteCounts.set(l,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 wT(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 ST(e,n){if(e.options.allowDangerousHtml){const r={type:"raw",value:n.value};return e.patch(n,r),e.applyData(n,r)}}function Kb(e,n){const r=n.referenceType;let l="]";if(r==="collapsed"?l+="[]":r==="full"&&(l+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+l}];const o=e.all(n),u=o[0];u&&u.type==="text"?u.value="["+u.value:o.unshift({type:"text",value:"["});const d=o[o.length-1];return d&&d.type==="text"?d.value+=l:o.push({type:"text",value:l}),o}function jT(e,n){const r=String(n.identifier).toUpperCase(),l=e.definitionById.get(r);if(!l)return Kb(e,n);const o={src:Rs(l.url||""),alt:n.alt};l.title!==null&&l.title!==void 0&&(o.title=l.title);const u={type:"element",tagName:"img",properties:o,children:[]};return e.patch(n,u),e.applyData(n,u)}function CT(e,n){const r={src:Rs(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 l={type:"element",tagName:"img",properties:r,children:[]};return e.patch(n,l),e.applyData(n,l)}function NT(e,n){const r={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,r);const l={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(n,l),e.applyData(n,l)}function TT(e,n){const r=String(n.identifier).toUpperCase(),l=e.definitionById.get(r);if(!l)return Kb(e,n);const o={href:Rs(l.url||"")};l.title!==null&&l.title!==void 0&&(o.title=l.title);const u={type:"element",tagName:"a",properties:o,children:e.all(n)};return e.patch(n,u),e.applyData(n,u)}function MT(e,n){const r={href:Rs(n.url)};n.title!==null&&n.title!==void 0&&(r.title=n.title);const l={type:"element",tagName:"a",properties:r,children:e.all(n)};return e.patch(n,l),e.applyData(n,l)}function ET(e,n,r){const l=e.all(n),o=r?AT(r):Wb(n),u={},d=[];if(typeof n.checked=="boolean"){const g=l[0];let y;g&&g.type==="element"&&g.tagName==="p"?y=g:(y={type:"element",tagName:"p",properties:{},children:[]},l.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:[]}),u.className=["task-list-item"]}let f=-1;for(;++f<l.length;){const g=l[f];(o||f!==0||g.type!=="element"||g.tagName!=="p")&&d.push({type:"text",value:`
|
|
78
|
-
`}),g.type==="element"&&g.tagName==="p"&&!o?d.push(...g.children):d.push(g)}const m=l[l.length-1];m&&(o||m.type!=="element"||m.tagName!=="p")&&d.push({type:"text",value:`
|
|
79
|
-
`});const h={type:"element",tagName:"li",properties:u,children:d};return e.patch(n,h),e.applyData(n,h)}function AT(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const r=e.children;let l=-1;for(;!n&&++l<r.length;)n=Wb(r[l])}return n}function Wb(e){const n=e.spread;return n??e.children.length>1}function RT(e,n){const r={},l=e.all(n);let o=-1;for(typeof n.start=="number"&&n.start!==1&&(r.start=n.start);++o<l.length;){const d=l[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 u={type:"element",tagName:n.ordered?"ol":"ul",properties:r,children:e.wrap(l,!0)};return e.patch(n,u),e.applyData(n,u)}function _T(e,n){const r={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function LT(e,n){const r={type:"root",children:e.wrap(e.all(n))};return e.patch(n,r),e.applyData(n,r)}function IT(e,n){const r={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function OT(e,n){const r=e.all(n),l=r.shift(),o=[];if(l){const d={type:"element",tagName:"thead",properties:{},children:e.wrap([l],!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=Uh(n.children[1]),m=Tb(n.children[n.children.length-1]);f&&m&&(d.position={start:f,end:m}),o.push(d)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(n,u),e.applyData(n,u)}function zT(e,n,r){const l=r?r.children:void 0,u=(l?l.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 N={type:"element",tagName:u,properties:k,children:[]};y&&(N.children=e.all(y),e.patch(y,N),N=e.applyData(y,N)),h.push(N)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(n,g),e.applyData(n,g)}function DT(e,n){const r={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}const Xy=9,Zy=32;function UT(e){const n=String(e),r=/\r?\n|\r/g;let l=r.exec(n),o=0;const u=[];for(;l;)u.push(Jy(n.slice(o,l.index),o>0,!0),l[0]),o=l.index+l[0].length,l=r.exec(n);return u.push(Jy(n.slice(o),o>0,!1)),u.join("")}function Jy(e,n,r){let l=0,o=e.length;if(n){let u=e.codePointAt(l);for(;u===Xy||u===Zy;)l++,u=e.codePointAt(l)}if(r){let u=e.codePointAt(o-1);for(;u===Xy||u===Zy;)o--,u=e.codePointAt(o-1)}return o>l?e.slice(l,o):""}function $T(e,n){const r={type:"text",value:UT(String(n.value))};return e.patch(n,r),e.applyData(n,r)}function BT(e,n){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,r),e.applyData(n,r)}const HT={blockquote:gT,break:xT,code:yT,delete:vT,emphasis:bT,footnoteReference:kT,heading:wT,html:ST,imageReference:jT,image:CT,inlineCode:NT,linkReference:TT,link:MT,listItem:ET,list:RT,paragraph:_T,root:LT,strong:IT,table:OT,tableCell:DT,tableRow:zT,text:$T,thematicBreak:BT,toml:Nc,yaml:Nc,definition:Nc,footnoteDefinition:Nc};function Nc(){}const Yb=-1,Nu=0,Fi=1,su=2,Vh=3,Gh=4,Kh=5,Wh=6,Qb=7,Xb=8,PT=typeof self=="object"?self:globalThis,e1=(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 PT[e](n)},qT=(e,n)=>{const r=(o,u)=>(e.set(u,o),o),l=o=>{if(e.has(o))return e.get(o);const[u,d]=n[o];switch(u){case Nu:case Yb:return r(d,o);case Fi:{const f=r([],o);for(const m of d)f.push(l(m));return f}case su:{const f=r({},o);for(const[m,h]of d)f[l(m)]=l(h);return f}case Vh:return r(new Date(d),o);case Gh:{const{source:f,flags:m}=d;return r(new RegExp(f,m),o)}case Kh:{const f=r(new Map,o);for(const[m,h]of d)f.set(l(m),l(h));return f}case Wh:{const f=r(new Set,o);for(const m of d)f.add(l(m));return f}case Qb:{const{name:f,message:m}=d;return r(e1(f,m),o)}case Xb: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(e1(u,d),o)};return l},t1=e=>qT(new Map,e)(0),Sl="",{toString:FT}={},{keys:VT}=Object,Ri=e=>{const n=typeof e;if(n!=="object"||!e)return[Nu,n];const r=FT.call(e).slice(8,-1);switch(r){case"Array":return[Fi,Sl];case"Object":return[su,Sl];case"Date":return[Vh,Sl];case"RegExp":return[Gh,Sl];case"Map":return[Kh,Sl];case"Set":return[Wh,Sl];case"DataView":return[Fi,r]}return r.includes("Array")?[Fi,r]:r.includes("Error")?[Qb,r]:[su,r]},Tc=([e,n])=>e===Nu&&(n==="function"||n==="symbol"),GT=(e,n,r,l)=>{const o=(d,f)=>{const m=l.push(d)-1;return r.set(f,m),m},u=d=>{if(r.has(d))return r.get(d);let[f,m]=Ri(d);switch(f){case Nu:{let g=d;switch(m){case"bigint":f=Xb,g=d.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);g=null;break;case"undefined":return o([Yb],d)}return o([f,g],d)}case Fi:{if(m){let k=d;return m==="DataView"?k=new Uint8Array(d.buffer):m==="ArrayBuffer"&&(k=new Uint8Array(d)),o([m,[...k]],d)}const g=[],y=o([f,g],d);for(const k of d)g.push(u(k));return y}case su:{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 u(d.toJSON());const g=[],y=o([f,g],d);for(const k of VT(d))(e||!Tc(Ri(d[k])))&&g.push([u(k),u(d[k])]);return y}case Vh:return o([f,isNaN(d.getTime())?Sl:d.toISOString()],d);case Gh:{const{source:g,flags:y}=d;return o([f,{source:g,flags:y}],d)}case Kh:{const g=[],y=o([f,g],d);for(const[k,w]of d)(e||!(Tc(Ri(k))||Tc(Ri(w))))&&g.push([u(k),u(w)]);return y}case Wh:{const g=[],y=o([f,g],d);for(const k of d)(e||!Tc(Ri(k)))&&g.push(u(k));return y}}const{message:h}=d;return o([f,{name:m,message:h}],d)};return u},n1=(e,{json:n,lossy:r}={})=>{const l=[];return GT(!(n||r),!!n,new Map,l)(e),l},iu=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?t1(n1(e,n)):structuredClone(e):(e,n)=>t1(n1(e,n));function KT(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 WT(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function YT(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||KT,l=e.options.footnoteBackLabel||WT,o=e.options.footnoteLabel||"Footnotes",u=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 g=e.all(h),y=String(h.identifier).toUpperCase(),k=Rs(y.toLowerCase());let w=0;const N=[],C=e.footnoteCounts.get(y);for(;C!==void 0&&++w<=C;){N.length>0&&N.push({type:"text",value:" "});let L=typeof r=="string"?r:r(m,w);typeof L=="string"&&(L={type:"text",value:L}),N.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+k+(w>1?"-"+w:""),dataFootnoteBackref:"",ariaLabel:typeof l=="string"?l:l(m,w),className:["data-footnote-backref"]},children:Array.isArray(L)?L:[L]})}const j=g[g.length-1];if(j&&j.type==="element"&&j.tagName==="p"){const L=j.children[j.children.length-1];L&&L.type==="text"?L.value+=" ":j.children.push({type:"text",value:" "}),j.children.push(...N)}else g.push(...N);const E={type:"element",tagName:"li",properties:{id:n+"fn-"+k},children:e.wrap(g,!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:u,properties:{...iu(d),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
|
|
80
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(f,!0)},{type:"text",value:`
|
|
81
|
-
`}]}}const Tu=(function(e){if(e==null)return JT;if(typeof e=="function")return Mu(e);if(typeof e=="object")return Array.isArray(e)?QT(e):XT(e);if(typeof e=="string")return ZT(e);throw new Error("Expected function, string, or object as test")});function QT(e){const n=[];let r=-1;for(;++r<e.length;)n[r]=Tu(e[r]);return Mu(l);function l(...o){let u=-1;for(;++u<n.length;)if(n[u].apply(this,o))return!0;return!1}}function XT(e){const n=e;return Mu(r);function r(l){const o=l;let u;for(u in e)if(o[u]!==n[u])return!1;return!0}}function ZT(e){return Mu(n);function n(r){return r&&r.type===e}}function Mu(e){return n;function n(r,l,o){return!!(eM(r)&&e.call(this,r,typeof l=="number"?l:void 0,o||void 0))}}function JT(){return!0}function eM(e){return e!==null&&typeof e=="object"&&"type"in e}const Zb=[],tM=!0,Ym=!1,nM="skip";function Jb(e,n,r,l){let o;typeof n=="function"&&typeof r!="function"?(l=r,r=n):o=n;const u=Tu(o),d=l?-1:1;f(e,void 0,[])();function f(m,h,g){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=Zb,N,C,j;if((!n||u(m,h,g[g.length-1]||void 0))&&(w=aM(r(m,g)),w[0]===Ym))return w;if("children"in m&&m.children){const E=m;if(E.children&&w[0]!==nM)for(C=(l?E.children.length:-1)+d,j=g.concat(E);C>-1&&C<E.children.length;){const L=E.children[C];if(N=f(L,C,j)(),N[0]===Ym)return N;C=typeof N[1]=="number"?N[1]:C+d}}return w}}}function aM(e){return Array.isArray(e)?e:typeof e=="number"?[tM,e]:e==null?Zb:[e]}function Yh(e,n,r,l){let o,u,d;typeof n=="function"&&typeof r!="function"?(u=void 0,d=n,o=r):(u=n,d=r,o=l),Jb(e,u,f,o);function f(m,h){const g=h[h.length-1],y=g?g.children.indexOf(m):void 0;return d(m,y,g)}}const Qm={}.hasOwnProperty,rM={};function lM(e,n){const r=n||rM,l=new Map,o=new Map,u=new Map,d={...HT,...r.handlers},f={all:h,applyData:iM,definitionById:l,footnoteById:o,footnoteCounts:u,footnoteOrder:[],handlers:d,one:m,options:r,patch:sM,wrap:cM};return Yh(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const y=g.type==="definition"?l:o,k=String(g.identifier).toUpperCase();y.has(k)||y.set(k,g)}}),f;function m(g,y){const k=g.type,w=f.handlers[k];if(Qm.call(f.handlers,k)&&w)return w(f,g,y);if(f.options.passThrough&&f.options.passThrough.includes(k)){if("children"in g){const{children:C,...j}=g,E=iu(j);return E.children=f.all(g),E}return iu(g)}return(f.options.unknownHandler||oM)(f,g,y)}function h(g){const y=[];if("children"in g){const k=g.children;let w=-1;for(;++w<k.length;){const N=f.one(k[w],g);if(N){if(w&&k[w-1].type==="break"&&(!Array.isArray(N)&&N.type==="text"&&(N.value=a1(N.value)),!Array.isArray(N)&&N.type==="element")){const C=N.children[0];C&&C.type==="text"&&(C.value=a1(C.value))}Array.isArray(N)?y.push(...N):y.push(N)}}}return y}}function sM(e,n){e.position&&(n.position=KC(e))}function iM(e,n){let r=n;if(e&&e.data){const l=e.data.hName,o=e.data.hChildren,u=e.data.hProperties;if(typeof l=="string")if(r.type==="element")r.tagName=l;else{const d="children"in r?r.children:[r];r={type:"element",tagName:l,properties:{},children:d}}r.type==="element"&&u&&Object.assign(r.properties,iu(u)),"children"in r&&r.children&&o!==null&&o!==void 0&&(r.children=o)}return r}function oM(e,n){const r=n.data||{},l="value"in n&&!(Qm.call(r,"hProperties")||Qm.call(r,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,l),e.applyData(n,l)}function cM(e,n){const r=[];let l=-1;for(n&&r.push({type:"text",value:`
|
|
82
|
-
`});++l<e.length;)l&&r.push({type:"text",value:`
|
|
83
|
-
`}),r.push(e[l]);return n&&e.length>0&&r.push({type:"text",value:`
|
|
84
|
-
`}),r}function a1(e){let n=0,r=e.charCodeAt(n);for(;r===9||r===32;)n++,r=e.charCodeAt(n);return e.slice(n)}function r1(e,n){const r=lM(e,n),l=r.one(e,void 0),o=YT(r),u=Array.isArray(l)?{type:"root",children:l}:l||{type:"root",children:[]};return o&&u.children.push({type:"text",value:`
|
|
85
|
-
`},o),u}function uM(e,n){return e&&"run"in e?async function(r,l){const o=r1(r,{file:l,...n});await e.run(o,l)}:function(r,l){return r1(r,{file:l,...e||n})}}function l1(e){if(e)throw e}var lm,s1;function dM(){if(s1)return lm;s1=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=Object.defineProperty,l=Object.getOwnPropertyDescriptor,o=function(h){return typeof Array.isArray=="function"?Array.isArray(h):n.call(h)==="[object Array]"},u=function(h){if(!h||n.call(h)!=="[object Object]")return!1;var g=e.call(h,"constructor"),y=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!y)return!1;var k;for(k in h);return typeof k>"u"||e.call(h,k)},d=function(h,g){r&&g.name==="__proto__"?r(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},f=function(h,g){if(g==="__proto__")if(e.call(h,g)){if(l)return l(h,g).value}else return;return h[g]};return lm=function m(){var h,g,y,k,w,N,C=arguments[0],j=1,E=arguments.length,L=!1;for(typeof C=="boolean"&&(L=C,C=arguments[1]||{},j=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});j<E;++j)if(h=arguments[j],h!=null)for(g in h)y=f(C,g),k=f(h,g),C!==k&&(L&&k&&(u(k)||(w=o(k)))?(w?(w=!1,N=y&&o(y)?y:[]):N=y&&u(y)?y:{},d(C,{name:g,newValue:m(L,N,k)})):typeof k<"u"&&d(C,{name:g,newValue:k}));return C},lm}var fM=dM();const sm=hv(fM);function Xm(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 mM(){const e=[],n={run:r,use:l};return n;function r(...o){let u=-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 g=e[++u];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,g?hM(g,f)(...h):d(null,...h)}}function l(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),n}}function hM(e,n){let r;return l;function l(...d){const f=e.length>d.length;let m;f&&d.push(o);try{m=e.apply(this,d)}catch(h){const g=h;if(f&&r)throw g;return o(g)}f||(m&&m.then&&typeof m.then=="function"?m.then(u,o):m instanceof Error?o(m):u(m))}function o(d,...f){r||(r=!0,n(d,...f))}function u(d){o(null,d)}}const Pa={basename:pM,dirname:gM,extname:xM,join:yM,sep:"/"};function pM(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');oo(e);let r=0,l=-1,o=e.length,u;if(n===void 0||n.length===0||n.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(u){r=o+1;break}}else l<0&&(u=!0,l=o+1);return l<0?"":e.slice(r,l)}if(n===e)return"";let d=-1,f=n.length-1;for(;o--;)if(e.codePointAt(o)===47){if(u){r=o+1;break}}else d<0&&(u=!0,d=o+1),f>-1&&(e.codePointAt(o)===n.codePointAt(f--)?f<0&&(l=o):(f=-1,l=d));return r===l?l=d:l<0&&(l=e.length),e.slice(r,l)}function gM(e){if(oo(e),e.length===0)return".";let n=-1,r=e.length,l;for(;--r;)if(e.codePointAt(r)===47){if(l){n=r;break}}else l||(l=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function xM(e){oo(e);let n=e.length,r=-1,l=0,o=-1,u=0,d;for(;n--;){const f=e.codePointAt(n);if(f===47){if(d){l=n+1;break}continue}r<0&&(d=!0,r=n+1),f===46?o<0?o=n:u!==1&&(u=1):o>-1&&(u=-1)}return o<0||r<0||u===0||u===1&&o===r-1&&o===l+1?"":e.slice(o,r)}function yM(...e){let n=-1,r;for(;++n<e.length;)oo(e[n]),e[n]&&(r=r===void 0?e[n]:r+"/"+e[n]);return r===void 0?".":vM(r)}function vM(e){oo(e);const n=e.codePointAt(0)===47;let r=bM(e,!n);return r.length===0&&!n&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),n?"/"+r:r}function bM(e,n){let r="",l=0,o=-1,u=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||u===1))if(o!==d-1&&u===2){if(r.length<2||l!==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="",l=0):(r=r.slice(0,m),l=r.length-1-r.lastIndexOf("/")),o=d,u=0;continue}}else if(r.length>0){r="",l=0,o=d,u=0;continue}}n&&(r=r.length>0?r+"/..":"..",l=2)}else r.length>0?r+="/"+e.slice(o+1,d):r=e.slice(o+1,d),l=d-o-1;o=d,u=0}else f===46&&u>-1?u++:u=-1}return r}function oo(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const kM={cwd:wM};function wM(){return"/"}function Zm(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function SM(e){if(typeof e=="string")e=new URL(e);else if(!Zm(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 jM(e)}function jM(e){if(e.hostname!==""){const l=new TypeError('File URL host must be "localhost" or empty on darwin');throw l.code="ERR_INVALID_FILE_URL_HOST",l}const n=e.pathname;let r=-1;for(;++r<n.length;)if(n.codePointAt(r)===37&&n.codePointAt(r+1)===50){const l=n.codePointAt(r+2);if(l===70||l===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 im=["history","path","basename","stem","extname","dirname"];class ek{constructor(n){let r;n?Zm(n)?r={path:n}:typeof n=="string"||CM(n)?r={value:n}:r=n:r={},this.cwd="cwd"in r?"":kM.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let l=-1;for(;++l<im.length;){const u=im[l];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let o;for(o in r)im.includes(o)||(this[o]=r[o])}get basename(){return typeof this.path=="string"?Pa.basename(this.path):void 0}set basename(n){cm(n,"basename"),om(n,"basename"),this.path=Pa.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?Pa.dirname(this.path):void 0}set dirname(n){i1(this.basename,"dirname"),this.path=Pa.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?Pa.extname(this.path):void 0}set extname(n){if(om(n,"extname"),i1(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=Pa.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){Zm(n)&&(n=SM(n)),cm(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?Pa.basename(this.path,this.extname):void 0}set stem(n){cm(n,"stem"),om(n,"stem"),this.path=Pa.join(this.dirname||"",n+(this.extname||""))}fail(n,r,l){const o=this.message(n,r,l);throw o.fatal=!0,o}info(n,r,l){const o=this.message(n,r,l);return o.fatal=void 0,o}message(n,r,l){const o=new xn(n,r,l);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 om(e,n){if(e&&e.includes(Pa.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+Pa.sep+"`")}function cm(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function i1(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function CM(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const NM=(function(e){const l=this.constructor.prototype,o=l[e],u=function(){return o.apply(u,arguments)};return Object.setPrototypeOf(u,l),u}),TM={}.hasOwnProperty;class Qh extends NM{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=mM()}copy(){const n=new Qh;let r=-1;for(;++r<this.attachers.length;){const l=this.attachers[r];n.use(...l)}return n.data(sm(!0,{},this.namespace)),n}data(n,r){return typeof n=="string"?arguments.length===2?(fm("data",this.frozen),this.namespace[n]=r,this):TM.call(this.namespace,n)&&this.namespace[n]||void 0:n?(fm("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,...l]=this.attachers[this.freezeIndex];if(l[0]===!1)continue;l[0]===!0&&(l[0]=void 0);const o=r.call(n,...l);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const r=Mc(n),l=this.parser||this.Parser;return um("parse",l),l(String(r),r)}process(n,r){const l=this;return this.freeze(),um("process",this.parser||this.Parser),dm("process",this.compiler||this.Compiler),r?o(void 0,r):new Promise(o);function o(u,d){const f=Mc(n),m=l.parse(f);l.run(m,f,function(g,y,k){if(g||!y||!k)return h(g);const w=y,N=l.stringify(w,k);AM(N)?k.value=N:k.result=N,h(g,k)});function h(g,y){g||!y?d(g):u?u(y):r(void 0,y)}}}processSync(n){let r=!1,l;return this.freeze(),um("processSync",this.parser||this.Parser),dm("processSync",this.compiler||this.Compiler),this.process(n,o),c1("processSync","process",r),l;function o(u,d){r=!0,l1(u),l=d}}run(n,r,l){o1(n),this.freeze();const o=this.transformers;return!l&&typeof r=="function"&&(l=r,r=void 0),l?u(void 0,l):new Promise(u);function u(d,f){const m=Mc(r);o.run(n,m,h);function h(g,y,k){const w=y||n;g?f(g):d?d(w):l(void 0,w,k)}}}runSync(n,r){let l=!1,o;return this.run(n,r,u),c1("runSync","run",l),o;function u(d,f){l1(d),o=f,l=!0}}stringify(n,r){this.freeze();const l=Mc(r),o=this.compiler||this.Compiler;return dm("stringify",o),o1(n),o(n,l)}use(n,...r){const l=this.attachers,o=this.namespace;if(fm("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 u(h){if(typeof h=="function")m(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...y]=h;m(g,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=sm(!0,o.settings,h.settings))}function f(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const y=h[g];u(y)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function m(h,g){let y=-1,k=-1;for(;++y<l.length;)if(l[y][0]===h){k=y;break}if(k===-1)l.push([h,...g]);else if(g.length>0){let[w,...N]=g;const C=l[k][1];Xm(C)&&Xm(w)&&(w=sm(!0,C,w)),l[k]=[h,w,...N]}}}}const MM=new Qh().freeze();function um(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function dm(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function fm(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 o1(e){if(!Xm(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function c1(e,n,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function Mc(e){return EM(e)?e:new ek(e)}function EM(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function AM(e){return typeof e=="string"||RM(e)}function RM(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const _M="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",u1=[],d1={allowDangerousHtml:!0},LM=/^(https?|ircs?|mailto|xmpp)$/i,IM=[{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 Eu(e){const n=OM(e),r=zM(e);return DM(n.runSync(n.parse(r),r),e)}function OM(e){const n=e.rehypePlugins||u1,r=e.remarkPlugins||u1,l=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...d1}:d1;return MM().use(pT).use(r).use(uM,l).use(n)}function zM(e){const n=e.children||"",r=new ek;return typeof n=="string"&&(r.value=n),r}function DM(e,n){const r=n.allowedElements,l=n.allowElement,o=n.components,u=n.disallowedElements,d=n.skipHtml,f=n.unwrapDisallowed,m=n.urlTransform||UM;for(const g of IM)Object.hasOwn(n,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+_M+g.id,void 0);return Yh(e,h),ZC(e,{Fragment:i.Fragment,components:o,ignoreInvalidStyle:!0,jsx:i.jsx,jsxs:i.jsxs,passKeys:!0,passNode:!0});function h(g,y,k){if(g.type==="raw"&&k&&typeof y=="number")return d?k.children.splice(y,1):k.children[y]={type:"text",value:g.value},y;if(g.type==="element"){let w;for(w in nm)if(Object.hasOwn(nm,w)&&Object.hasOwn(g.properties,w)){const N=g.properties[w],C=nm[w];(C===null||C.includes(g.tagName))&&(g.properties[w]=m(String(N||""),w,g))}}if(g.type==="element"){let w=r?!r.includes(g.tagName):u?u.includes(g.tagName):!1;if(!w&&l&&typeof y=="number"&&(w=!l(g,y,k)),w&&k&&typeof y=="number")return f&&g.children?k.children.splice(y,1,...g.children):k.children.splice(y,1),y}}}function UM(e){const n=e.indexOf(":"),r=e.indexOf("?"),l=e.indexOf("#"),o=e.indexOf("/");return n===-1||o!==-1&&n>o||r!==-1&&n>r||l!==-1&&n>l||LM.test(e.slice(0,n))?e:""}function f1(e,n){const r=String(e);if(typeof n!="string")throw new TypeError("Expected character");let l=0,o=r.indexOf(n);for(;o!==-1;)l++,o=r.indexOf(n,o+n.length);return l}function $M(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function BM(e,n,r){const o=Tu((r||{}).ignore||[]),u=HM(n);let d=-1;for(;++d<u.length;)Jb(e,"text",f);function f(h,g){let y=-1,k;for(;++y<g.length;){const w=g[y],N=k?k.children:void 0;if(o(w,N?N.indexOf(w):void 0,k))return;k=w}if(k)return m(h,g)}function m(h,g){const y=g[g.length-1],k=u[d][0],w=u[d][1];let N=0;const j=y.children.indexOf(h);let E=!1,L=[];k.lastIndex=0;let _=k.exec(h.value);for(;_;){const q=_.index,H={index:_.index,input:_.input,stack:[...g,h]};let I=w(..._,H);if(typeof I=="string"&&(I=I.length>0?{type:"text",value:I}:void 0),I===!1?k.lastIndex=q+1:(N!==q&&L.push({type:"text",value:h.value.slice(N,q)}),Array.isArray(I)?L.push(...I):I&&L.push(I),N=q+_[0].length,E=!0),!k.global)break;_=k.exec(h.value)}return E?(N<h.value.length&&L.push({type:"text",value:h.value.slice(N)}),y.children.splice(j,1,...L)):L=[h],j+L.length}}function HM(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 l=-1;for(;++l<r.length;){const o=r[l];n.push([PM(o[0]),qM(o[1])])}return n}function PM(e){return typeof e=="string"?new RegExp($M(e),"g"):e}function qM(e){return typeof e=="function"?e:function(){return e}}const mm="phrasing",hm=["autolink","link","image","label"];function FM(){return{transforms:[XM],enter:{literalAutolink:GM,literalAutolinkEmail:pm,literalAutolinkHttp:pm,literalAutolinkWww:pm},exit:{literalAutolink:QM,literalAutolinkEmail:YM,literalAutolinkHttp:KM,literalAutolinkWww:WM}}}function VM(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:mm,notInConstruct:hm},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:mm,notInConstruct:hm},{character:":",before:"[ps]",after:"\\/",inConstruct:mm,notInConstruct:hm}]}}function GM(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function pm(e){this.config.enter.autolinkProtocol.call(this,e)}function KM(e){this.config.exit.autolinkProtocol.call(this,e)}function WM(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 YM(e){this.config.exit.autolinkEmail.call(this,e)}function QM(e){this.exit(e)}function XM(e){BM(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,ZM],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),JM]],{ignore:["link","linkReference"]})}function ZM(e,n,r,l,o){let u="";if(!tk(o)||(/^w/i.test(n)&&(r=n+r,n="",u="http://"),!eE(r)))return!1;const d=tE(r+l);if(!d[0])return!1;const f={type:"link",title:null,url:u+n+d[0],children:[{type:"text",value:n+d[0]}]};return d[1]?[f,{type:"text",value:d[1]}]:f}function JM(e,n,r,l){return!tk(l,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+r,children:[{type:"text",value:n+"@"+r}]}}function eE(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 tE(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let r=n[0],l=r.indexOf(")");const o=f1(e,"(");let u=f1(e,")");for(;l!==-1&&o>u;)e+=r.slice(0,l+1),r=r.slice(l+1),l=r.indexOf(")"),u++;return[e,r]}function tk(e,n){const r=e.input.charCodeAt(e.index-1);return(e.index===0||_l(r)||ju(r))&&(!n||r!==47)}nk.peek=uE;function nE(){this.buffer()}function aE(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function rE(){this.buffer()}function lE(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function sE(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Aa(this.sliceSerialize(e)).toLowerCase(),r.label=n}function iE(e){this.exit(e)}function oE(e){const n=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Aa(this.sliceSerialize(e)).toLowerCase(),r.label=n}function cE(e){this.exit(e)}function uE(){return"["}function nk(e,n,r,l){const o=r.createTracker(l);let u=o.move("[^");const d=r.enter("footnoteReference"),f=r.enter("reference");return u+=o.move(r.safe(r.associationId(e),{after:"]",before:u})),f(),d(),u+=o.move("]"),u}function dE(){return{enter:{gfmFootnoteCallString:nE,gfmFootnoteCall:aE,gfmFootnoteDefinitionLabelString:rE,gfmFootnoteDefinition:lE},exit:{gfmFootnoteCallString:sE,gfmFootnoteCall:iE,gfmFootnoteDefinitionLabelString:oE,gfmFootnoteDefinition:cE}}}function fE(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:r,footnoteReference:nk},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(l,o,u,d){const f=u.createTracker(d);let m=f.move("[^");const h=u.enter("footnoteDefinition"),g=u.enter("label");return m+=f.move(u.safe(u.associationId(l),{before:m,after:"]"})),g(),m+=f.move("]:"),l.children&&l.children.length>0&&(f.shift(4),m+=f.move((n?`
|
|
86
|
-
`:" ")+u.indentLines(u.containerFlow(l,f.current()),n?ak:mE))),h(),m}}function mE(e,n,r){return n===0?e:ak(e,n,r)}function ak(e,n,r){return(r?"":" ")+e}const hE=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];rk.peek=vE;function pE(){return{canContainEols:["delete"],enter:{strikethrough:xE},exit:{strikethrough:yE}}}function gE(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:hE}],handlers:{delete:rk}}}function xE(e){this.enter({type:"delete",children:[]},e)}function yE(e){this.exit(e)}function rk(e,n,r,l){const o=r.createTracker(l),u=r.enter("strikethrough");let d=o.move("~~");return d+=r.containerPhrasing(e,{...o.current(),before:d,after:"~"}),d+=o.move("~~"),u(),d}function vE(){return"~"}function bE(e){return e.length}function kE(e,n){const r=n||{},l=(r.align||[]).concat(),o=r.stringLength||bE,u=[],d=[],f=[],m=[];let h=0,g=-1;for(;++g<e.length;){const C=[],j=[];let E=-1;for(e[g].length>h&&(h=e[g].length);++E<e[g].length;){const L=wE(e[g][E]);if(r.alignDelimiters!==!1){const _=o(L);j[E]=_,(m[E]===void 0||_>m[E])&&(m[E]=_)}C.push(L)}d[g]=C,f[g]=j}let y=-1;if(typeof l=="object"&&"length"in l)for(;++y<h;)u[y]=m1(l[y]);else{const C=m1(l);for(;++y<h;)u[y]=C}y=-1;const k=[],w=[];for(;++y<h;){const C=u[y];let j="",E="";C===99?(j=":",E=":"):C===108?j=":":C===114&&(E=":");let L=r.alignDelimiters===!1?1:Math.max(1,m[y]-j.length-E.length);const _=j+"-".repeat(L)+E;r.alignDelimiters!==!1&&(L=j.length+L+E.length,L>m[y]&&(m[y]=L),w[y]=L),k[y]=_}d.splice(1,0,k),f.splice(1,0,w),g=-1;const N=[];for(;++g<d.length;){const C=d[g],j=f[g];y=-1;const E=[];for(;++y<h;){const L=C[y]||"";let _="",q="";if(r.alignDelimiters!==!1){const H=m[y]-(j[y]||0),I=u[y];I===114?_=" ".repeat(H):I===99?H%2?(_=" ".repeat(H/2+.5),q=" ".repeat(H/2-.5)):(_=" ".repeat(H/2),q=_):q=" ".repeat(H)}r.delimiterStart!==!1&&!y&&E.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&L==="")&&(r.delimiterStart!==!1||y)&&E.push(" "),r.alignDelimiters!==!1&&E.push(_),E.push(L),r.alignDelimiters!==!1&&E.push(q),r.padding!==!1&&E.push(" "),(r.delimiterEnd!==!1||y!==h-1)&&E.push("|")}N.push(r.delimiterEnd===!1?E.join("").replace(/ +$/,""):E.join(""))}return N.join(`
|
|
87
|
-
`)}function wE(e){return e==null?"":String(e)}function m1(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 SE(e,n,r,l){const o=r.enter("blockquote"),u=r.createTracker(l);u.move("> "),u.shift(2);const d=r.indentLines(r.containerFlow(e,u.current()),jE);return o(),d}function jE(e,n,r){return">"+(r?"":" ")+e}function CE(e,n){return h1(e,n.inConstruct,!0)&&!h1(e,n.notInConstruct,!1)}function h1(e,n,r){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return r;let l=-1;for(;++l<n.length;)if(e.includes(n[l]))return!0;return!1}function p1(e,n,r,l){let o=-1;for(;++o<r.unsafe.length;)if(r.unsafe[o].character===`
|
|
88
|
-
`&&CE(r.stack,r.unsafe[o]))return/[ \t]/.test(l.before)?"":" ";return`\\
|
|
89
|
-
`}function NE(e,n){const r=String(e);let l=r.indexOf(n),o=l,u=0,d=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;l!==-1;)l===o?++u>d&&(d=u):u=1,o=l+n.length,l=r.indexOf(n,o);return d}function TE(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 ME(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 EE(e,n,r,l){const o=ME(r),u=e.value||"",d=o==="`"?"GraveAccent":"Tilde";if(TE(e,r)){const y=r.enter("codeIndented"),k=r.indentLines(u,AE);return y(),k}const f=r.createTracker(l),m=o.repeat(Math.max(NE(u,o)+1,3)),h=r.enter("codeFenced");let g=f.move(m);if(e.lang){const y=r.enter(`codeFencedLang${d}`);g+=f.move(r.safe(e.lang,{before:g,after:" ",encode:["`"],...f.current()})),y()}if(e.lang&&e.meta){const y=r.enter(`codeFencedMeta${d}`);g+=f.move(" "),g+=f.move(r.safe(e.meta,{before:g,after:`
|
|
90
|
-
`,encode:["`"],...f.current()})),y()}return g+=f.move(`
|
|
91
|
-
`),u&&(g+=f.move(u+`
|
|
92
|
-
`)),g+=f.move(m),h(),g}function AE(e,n,r){return(r?"":" ")+e}function Xh(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 RE(e,n,r,l){const o=Xh(r),u=o==='"'?"Quote":"Apostrophe",d=r.enter("definition");let f=r.enter("label");const m=r.createTracker(l);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?" ":`
|
|
93
|
-
`,...m.current()}))),f(),e.title&&(f=r.enter(`title${u}`),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 _E(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 Zi(e){return"&#x"+e.toString(16).toUpperCase()+";"}function ou(e,n,r){const l=Ns(e),o=Ns(n);return l===void 0?o===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:l===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}}lk.peek=LE;function lk(e,n,r,l){const o=_E(r),u=r.enter("emphasis"),d=r.createTracker(l),f=d.move(o);let m=d.move(r.containerPhrasing(e,{after:o,before:f,...d.current()}));const h=m.charCodeAt(0),g=ou(l.before.charCodeAt(l.before.length-1),h,o);g.inside&&(m=Zi(h)+m.slice(1));const y=m.charCodeAt(m.length-1),k=ou(l.after.charCodeAt(0),y,o);k.inside&&(m=m.slice(0,-1)+Zi(y));const w=d.move(o);return u(),r.attentionEncodeSurroundingInfo={after:k.outside,before:g.outside},f+m+w}function LE(e,n,r){return r.options.emphasis||"*"}function IE(e,n){let r=!1;return Yh(e,function(l){if("value"in l&&/\r?\n|\r/.test(l.value)||l.type==="break")return r=!0,Ym}),!!((!e.depth||e.depth<3)&&Ph(e)&&(n.options.setext||r))}function OE(e,n,r,l){const o=Math.max(Math.min(6,e.depth||1),1),u=r.createTracker(l);if(IE(e,r)){const g=r.enter("headingSetext"),y=r.enter("phrasing"),k=r.containerPhrasing(e,{...u.current(),before:`
|
|
94
|
-
`,after:`
|
|
95
|
-
`});return y(),g(),k+`
|
|
96
|
-
`+(o===1?"=":"-").repeat(k.length-(Math.max(k.lastIndexOf("\r"),k.lastIndexOf(`
|
|
97
|
-
`))+1))}const d="#".repeat(o),f=r.enter("headingAtx"),m=r.enter("phrasing");u.move(d+" ");let h=r.containerPhrasing(e,{before:"# ",after:`
|
|
98
|
-
`,...u.current()});return/^[\t ]/.test(h)&&(h=Zi(h.charCodeAt(0))+h.slice(1)),h=h?d+" "+h:d,r.options.closeAtx&&(h+=" "+d),m(),f(),h}sk.peek=zE;function sk(e){return e.value||""}function zE(){return"<"}ik.peek=DE;function ik(e,n,r,l){const o=Xh(r),u=o==='"'?"Quote":"Apostrophe",d=r.enter("image");let f=r.enter("label");const m=r.createTracker(l);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${u}`),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 DE(){return"!"}ok.peek=UE;function ok(e,n,r,l){const o=e.referenceType,u=r.enter("imageReference");let d=r.enter("label");const f=r.createTracker(l);let m=f.move("![");const h=r.safe(e.alt,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),d();const g=r.stack;r.stack=[],d=r.enter("reference");const y=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return d(),r.stack=g,u(),o==="full"||!h||h!==y?m+=f.move(y+"]"):o==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function UE(){return"!"}ck.peek=$E;function ck(e,n,r){let l=e.value||"",o="`",u=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(l);)o+="`";for(/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^`|`$/.test(l))&&(l=" "+l+" ");++u<r.unsafe.length;){const d=r.unsafe[u],f=r.compilePattern(d);let m;if(d.atBreak)for(;m=f.exec(l);){let h=m.index;l.charCodeAt(h)===10&&l.charCodeAt(h-1)===13&&h--,l=l.slice(0,h)+" "+l.slice(m.index+1)}}return o+l+o}function $E(){return"`"}function uk(e,n){const r=Ph(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))}dk.peek=BE;function dk(e,n,r,l){const o=Xh(r),u=o==='"'?"Quote":"Apostrophe",d=r.createTracker(l);let f,m;if(uk(e,r)){const g=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=g,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${u}`),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 BE(e,n,r){return uk(e,r)?"<":"["}fk.peek=HE;function fk(e,n,r,l){const o=e.referenceType,u=r.enter("linkReference");let d=r.enter("label");const f=r.createTracker(l);let m=f.move("[");const h=r.containerPhrasing(e,{before:m,after:"]",...f.current()});m+=f.move(h+"]["),d();const g=r.stack;r.stack=[],d=r.enter("reference");const y=r.safe(r.associationId(e),{before:m,after:"]",...f.current()});return d(),r.stack=g,u(),o==="full"||!h||h!==y?m+=f.move(y+"]"):o==="shortcut"?m=m.slice(0,-1):m+=f.move("]"),m}function HE(){return"["}function Zh(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 PE(e){const n=Zh(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 qE(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 mk(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 FE(e,n,r,l){const o=r.enter("list"),u=r.bulletCurrent;let d=e.ordered?qE(r):Zh(r);const f=e.ordered?d==="."?")":".":PE(r);let m=n&&r.bulletLastUsed?d===r.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((d==="*"||d==="-")&&g&&(!g.children||!g.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),mk(r)===d&&g){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,l);return r.bulletLastUsed=d,r.bulletCurrent=u,o(),h}function VE(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 GE(e,n,r,l){const o=VE(r);let u=r.bulletCurrent||Zh(r);n&&n.type==="list"&&n.ordered&&(u=(typeof n.start=="number"&&n.start>-1?n.start:1)+(r.options.incrementListMarker===!1?0:n.children.indexOf(e))+u);let d=u.length+1;(o==="tab"||o==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(d=Math.ceil(d/4)*4);const f=r.createTracker(l);f.move(u+" ".repeat(d-u.length)),f.shift(d);const m=r.enter("listItem"),h=r.indentLines(r.containerFlow(e,f.current()),g);return m(),h;function g(y,k,w){return k?(w?"":" ".repeat(d))+y:(w?u:u+" ".repeat(d-u.length))+y}}function KE(e,n,r,l){const o=r.enter("paragraph"),u=r.enter("phrasing"),d=r.containerPhrasing(e,l);return u(),o(),d}const WE=Tu(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function YE(e,n,r,l){return(e.children.some(function(d){return WE(d)})?r.containerPhrasing:r.containerFlow).call(r,e,l)}function QE(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}hk.peek=XE;function hk(e,n,r,l){const o=QE(r),u=r.enter("strong"),d=r.createTracker(l),f=d.move(o+o);let m=d.move(r.containerPhrasing(e,{after:o,before:f,...d.current()}));const h=m.charCodeAt(0),g=ou(l.before.charCodeAt(l.before.length-1),h,o);g.inside&&(m=Zi(h)+m.slice(1));const y=m.charCodeAt(m.length-1),k=ou(l.after.charCodeAt(0),y,o);k.inside&&(m=m.slice(0,-1)+Zi(y));const w=d.move(o+o);return u(),r.attentionEncodeSurroundingInfo={after:k.outside,before:g.outside},f+m+w}function XE(e,n,r){return r.options.strong||"*"}function ZE(e,n,r,l){return r.safe(e.value,l)}function JE(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 e6(e,n,r){const l=(mk(r)+(r.options.ruleSpaces?" ":"")).repeat(JE(r));return r.options.ruleSpaces?l.slice(0,-1):l}const pk={blockquote:SE,break:p1,code:EE,definition:RE,emphasis:lk,hardBreak:p1,heading:OE,html:sk,image:ik,imageReference:ok,inlineCode:ck,link:dk,linkReference:fk,list:FE,listItem:GE,paragraph:KE,root:YE,strong:hk,text:ZE,thematicBreak:e6};function t6(){return{enter:{table:n6,tableData:g1,tableHeader:g1,tableRow:r6},exit:{codeText:l6,table:a6,tableData:gm,tableHeader:gm,tableRow:gm}}}function n6(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 a6(e){this.exit(e),this.data.inTable=void 0}function r6(e){this.enter({type:"tableRow",children:[]},e)}function gm(e){this.exit(e)}function g1(e){this.enter({type:"tableCell",children:[]},e)}function l6(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,s6));const r=this.stack[this.stack.length-1];r.type,r.value=n,this.exit(e)}function s6(e,n){return n==="|"?n:e}function i6(e){const n=e||{},r=n.tableCellPadding,l=n.tablePipeAlign,o=n.stringLength,u=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
99
|
-
`,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,N,C,j){return h(g(w,C,j),w.align)}function f(w,N,C,j){const E=y(w,C,j),L=h([E]);return L.slice(0,L.indexOf(`
|
|
100
|
-
`))}function m(w,N,C,j){const E=C.enter("tableCell"),L=C.enter("phrasing"),_=C.containerPhrasing(w,{...j,before:u,after:u});return L(),E(),_}function h(w,N){return kE(w,{align:N,alignDelimiters:l,padding:r,stringLength:o})}function g(w,N,C){const j=w.children;let E=-1;const L=[],_=N.enter("table");for(;++E<j.length;)L[E]=y(j[E],N,C);return _(),L}function y(w,N,C){const j=w.children;let E=-1;const L=[],_=N.enter("tableRow");for(;++E<j.length;)L[E]=m(j[E],w,N,C);return _(),L}function k(w,N,C){let j=pk.inlineCode(w,N,C);return C.stack.includes("tableCell")&&(j=j.replace(/\|/g,"\\$&")),j}}function o6(){return{exit:{taskListCheckValueChecked:x1,taskListCheckValueUnchecked:x1,paragraph:u6}}}function c6(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:d6}}}function x1(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function u6(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 l=r.children[0];if(l&&l.type==="text"){const o=n.children;let u=-1,d;for(;++u<o.length;){const f=o[u];if(f.type==="paragraph"){d=f;break}}d===r&&(l.value=l.value.slice(1),l.value.length===0?r.children.shift():r.position&&l.position&&typeof l.position.start.offset=="number"&&(l.position.start.column++,l.position.start.offset++,r.position.start=Object.assign({},l.position.start)))}}this.exit(e)}function d6(e,n,r,l){const o=e.children[0],u=typeof e.checked=="boolean"&&o&&o.type==="paragraph",d="["+(e.checked?"x":" ")+"] ",f=r.createTracker(l);u&&f.move(d);let m=pk.listItem(e,n,r,{...l,...f.current()});return u&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),m;function h(g){return g+d}}function f6(){return[FM(),dE(),pE(),t6(),o6()]}function m6(e){return{extensions:[VM(),fE(e),gE(),i6(e),c6()]}}const h6={tokenize:b6,partial:!0},gk={tokenize:k6,partial:!0},xk={tokenize:w6,partial:!0},yk={tokenize:S6,partial:!0},p6={tokenize:j6,partial:!0},vk={name:"wwwAutolink",tokenize:y6,previous:kk},bk={name:"protocolAutolink",tokenize:v6,previous:wk},kr={name:"emailAutolink",tokenize:x6,previous:Sk},Wa={};function g6(){return{text:Wa}}let wl=48;for(;wl<123;)Wa[wl]=kr,wl++,wl===58?wl=65:wl===91&&(wl=97);Wa[43]=kr;Wa[45]=kr;Wa[46]=kr;Wa[95]=kr;Wa[72]=[kr,bk];Wa[104]=[kr,bk];Wa[87]=[kr,vk];Wa[119]=[kr,vk];function x6(e,n,r){const l=this;let o,u;return d;function d(y){return!Jm(y)||!Sk.call(l,l.previous)||Jh(l.events)?r(y):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),f(y))}function f(y){return Jm(y)?(e.consume(y),f):y===64?(e.consume(y),m):r(y)}function m(y){return y===46?e.check(p6,g,h)(y):y===45||y===95||pn(y)?(u=!0,e.consume(y),m):g(y)}function h(y){return e.consume(y),o=!0,m}function g(y){return u&&o&&vn(l.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(y)):r(y)}}function y6(e,n,r){const l=this;return o;function o(d){return d!==87&&d!==119||!kk.call(l,l.previous)||Jh(l.events)?r(d):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(h6,e.attempt(gk,e.attempt(xk,u),r),r)(d))}function u(d){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(d)}}function v6(e,n,r){const l=this;let o="",u=!1;return d;function d(y){return(y===72||y===104)&&wk.call(l,l.previous)&&!Jh(l.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(y),e.consume(y),f):r(y)}function f(y){if(vn(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),u?h:(u=!0,m)):r(y)}function h(y){return y===null||lu(y)||Tt(y)||_l(y)||ju(y)?r(y):e.attempt(gk,e.attempt(xk,g),r)(y)}function g(y){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(y)}}function b6(e,n,r){let l=0;return o;function o(d){return(d===87||d===119)&&l<3?(l++,e.consume(d),o):d===46&&l===3?(e.consume(d),u):r(d)}function u(d){return d===null?r(d):n(d)}}function k6(e,n,r){let l,o,u;return d;function d(h){return h===46||h===95?e.check(yk,m,f)(h):h===null||Tt(h)||_l(h)||h!==45&&ju(h)?m(h):(u=!0,e.consume(h),d)}function f(h){return h===95?l=!0:(o=l,l=void 0),e.consume(h),d}function m(h){return o||l||!u?r(h):n(h)}}function w6(e,n){let r=0,l=0;return o;function o(d){return d===40?(r++,e.consume(d),o):d===41&&l<r?u(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(yk,n,u)(d):d===null||Tt(d)||_l(d)?n(d):(e.consume(d),o)}function u(d){return d===41&&l++,e.consume(d),o}}function S6(e,n,r){return l;function l(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),l):f===38?(e.consume(f),u):f===93?(e.consume(f),o):f===60||f===null||Tt(f)||_l(f)?n(f):r(f)}function o(f){return f===null||f===40||f===91||Tt(f)||_l(f)?n(f):l(f)}function u(f){return vn(f)?d(f):r(f)}function d(f){return f===59?(e.consume(f),l):vn(f)?(e.consume(f),d):r(f)}}function j6(e,n,r){return l;function l(u){return e.consume(u),o}function o(u){return pn(u)?r(u):n(u)}}function kk(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Tt(e)}function wk(e){return!vn(e)}function Sk(e){return!(e===47||Jm(e))}function Jm(e){return e===43||e===45||e===46||e===95||pn(e)}function Jh(e){let n=e.length,r=!1;for(;n--;){const l=e[n][1];if((l.type==="labelLink"||l.type==="labelImage")&&!l._balanced){r=!0;break}if(l._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const C6={tokenize:L6,partial:!0};function N6(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:A6,continuation:{tokenize:R6},exit:_6}},text:{91:{name:"gfmFootnoteCall",tokenize:E6},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:T6,resolveTo:M6}}}}function T6(e,n,r){const l=this;let o=l.events.length;const u=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let d;for(;o--;){const m=l.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=Aa(l.sliceSerialize({start:d.end,end:l.now()}));return h.codePointAt(0)!==94||!u.includes(h.slice(1))?r(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),n(m))}}function M6(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 l={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 u={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},d={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},f=[e[r+1],e[r+2],["enter",l,n],e[r+3],e[r+4],["enter",o,n],["exit",o,n],["enter",u,n],["enter",d,n],["exit",d,n],["exit",u,n],e[e.length-2],e[e.length-1],["exit",l,n]];return e.splice(r,e.length-r+1,...f),e}function E6(e,n,r){const l=this,o=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u=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(u>999||y===93&&!d||y===null||y===91||Tt(y))return r(y);if(y===93){e.exit("chunkString");const k=e.exit("gfmFootnoteCallString");return o.includes(Aa(l.sliceSerialize(k)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(y),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):r(y)}return Tt(y)||(d=!0),u++,e.consume(y),y===92?g:h}function g(y){return y===91||y===92||y===93?(e.consume(y),u++,h):h(y)}}function A6(e,n,r){const l=this,o=l.parser.gfmFootnotes||(l.parser.gfmFootnotes=[]);let u,d=0,f;return m;function m(N){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(N),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(N){return N===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(N),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):r(N)}function g(N){if(d>999||N===93&&!f||N===null||N===91||Tt(N))return r(N);if(N===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return u=Aa(l.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(N),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),k}return Tt(N)||(f=!0),d++,e.consume(N),N===92?y:g}function y(N){return N===91||N===92||N===93?(e.consume(N),d++,g):g(N)}function k(N){return N===58?(e.enter("definitionMarker"),e.consume(N),e.exit("definitionMarker"),o.includes(u)||o.push(u),nt(e,w,"gfmFootnoteDefinitionWhitespace")):r(N)}function w(N){return n(N)}}function R6(e,n,r){return e.check(io,n,e.attempt(C6,n,r))}function _6(e){e.exit("gfmFootnoteDefinition")}function L6(e,n,r){const l=this;return nt(e,o,"gfmFootnoteDefinitionIndent",5);function o(u){const d=l.events[l.events.length-1];return d&&d[1].type==="gfmFootnoteDefinitionIndent"&&d[2].sliceSerialize(d[1],!0).length===4?n(u):r(u)}}function I6(e){let r=(e||{}).singleTilde;const l={name:"strikethrough",tokenize:u,resolveAll:o};return r==null&&(r=!0),{text:{126:l},insideSpan:{null:[l]},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 g={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",g,f],["enter",d[h][1],f],["exit",d[h][1],f],["enter",y,f]],w=f.parser.constructs.insideSpan.null;w&&Vn(k,k.length,0,Cu(w,d.slice(h+1,m),f)),Vn(k,k.length,0,[["exit",y,f],["enter",d[m][1],f],["exit",d[m][1],f],["exit",g,f]]),Vn(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 u(d,f,m){const h=this.previous,g=this.events;let y=0;return k;function k(N){return h===126&&g[g.length-1][1].type!=="characterEscape"?m(N):(d.enter("strikethroughSequenceTemporary"),w(N))}function w(N){const C=Ns(h);if(N===126)return y>1?m(N):(d.consume(N),y++,w);if(y<2&&!r)return m(N);const j=d.exit("strikethroughSequenceTemporary"),E=Ns(N);return j._open=!E||E===2&&!!C,j._close=!C||C===2&&!!E,f(N)}}}class O6{constructor(){this.map=[]}add(n,r,l){z6(this,n,r,l)}consume(n){if(this.map.sort(function(u,d){return u[0]-d[0]}),this.map.length===0)return;let r=this.map.length;const l=[];for(;r>0;)r-=1,l.push(n.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),n.length=this.map[r][0];l.push(n.slice()),n.length=0;let o=l.pop();for(;o;){for(const u of o)n.push(u);o=l.pop()}this.map.length=0}}function z6(e,n,r,l){let o=0;if(!(r===0&&l.length===0)){for(;o<e.map.length;){if(e.map[o][0]===n){e.map[o][1]+=r,e.map[o][2].push(...l);return}o+=1}e.map.push([n,r,l])}}function D6(e,n){let r=!1;const l=[];for(;n<e.length;){const o=e[n];if(r){if(o[0]==="enter")o[1].type==="tableContent"&&l.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const u=l.length-1;l[u]=l[u]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(r=!0);n+=1}return l}function U6(){return{flow:{null:{name:"table",tokenize:$6,resolveAll:B6}}}}function $6(e,n,r){const l=this;let o=0,u=0,d;return f;function f(D){let V=l.events.length-1;for(;V>-1;){const ne=l.events[V][1].type;if(ne==="lineEnding"||ne==="linePrefix")V--;else break}const B=V>-1?l.events[V][1].type:null,Y=B==="tableHead"||B==="tableRow"?I:m;return Y===I&&l.parser.lazy[l.now().line]?r(D):Y(D)}function m(D){return e.enter("tableHead"),e.enter("tableRow"),h(D)}function h(D){return D===124||(d=!0,u+=1),g(D)}function g(D){return D===null?r(D):Le(D)?u>1?(u=0,l.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),w):r(D):We(D)?nt(e,g,"whitespace")(D):(u+=1,d&&(d=!1,o+=1),D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),d=!0,g):(e.enter("data"),y(D)))}function y(D){return D===null||D===124||Tt(D)?(e.exit("data"),g(D)):(e.consume(D),D===92?k:y)}function k(D){return D===92||D===124?(e.consume(D),y):y(D)}function w(D){return l.interrupt=!1,l.parser.lazy[l.now().line]?r(D):(e.enter("tableDelimiterRow"),d=!1,We(D)?nt(e,N,"linePrefix",l.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(D):N(D))}function N(D){return D===45||D===58?j(D):D===124?(d=!0,e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),C):H(D)}function C(D){return We(D)?nt(e,j,"whitespace")(D):j(D)}function j(D){return D===58?(u+=1,d=!0,e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),E):D===45?(u+=1,E(D)):D===null||Le(D)?q(D):H(D)}function E(D){return D===45?(e.enter("tableDelimiterFiller"),L(D)):H(D)}function L(D){return D===45?(e.consume(D),L):D===58?(d=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(D),e.exit("tableDelimiterMarker"),_):(e.exit("tableDelimiterFiller"),_(D))}function _(D){return We(D)?nt(e,q,"whitespace")(D):q(D)}function q(D){return D===124?N(D):D===null||Le(D)?!d||o!==u?H(D):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(D)):H(D)}function H(D){return r(D)}function I(D){return e.enter("tableRow"),P(D)}function P(D){return D===124?(e.enter("tableCellDivider"),e.consume(D),e.exit("tableCellDivider"),P):D===null||Le(D)?(e.exit("tableRow"),n(D)):We(D)?nt(e,P,"whitespace")(D):(e.enter("data"),ee(D))}function ee(D){return D===null||D===124||Tt(D)?(e.exit("data"),P(D)):(e.consume(D),D===92?Z:ee)}function Z(D){return D===92||D===124?(e.consume(D),ee):ee(D)}}function B6(e,n){let r=-1,l=!0,o=0,u=[0,0,0,0],d=[0,0,0,0],f=!1,m=0,h,g,y;const k=new O6;for(;++r<e.length;){const w=e[r],N=w[1];w[0]==="enter"?N.type==="tableHead"?(f=!1,m!==0&&(y1(k,n,m,h,g),g=void 0,m=0),h={type:"table",start:Object.assign({},N.start),end:Object.assign({},N.end)},k.add(r,0,[["enter",h,n]])):N.type==="tableRow"||N.type==="tableDelimiterRow"?(l=!0,y=void 0,u=[0,0,0,0],d=[0,r+1,0,0],f&&(f=!1,g={type:"tableBody",start:Object.assign({},N.start),end:Object.assign({},N.end)},k.add(r,0,[["enter",g,n]])),o=N.type==="tableDelimiterRow"?2:g?3:1):o&&(N.type==="data"||N.type==="tableDelimiterMarker"||N.type==="tableDelimiterFiller")?(l=!1,d[2]===0&&(u[1]!==0&&(d[0]=d[1],y=Ec(k,n,u,o,void 0,y),u=[0,0,0,0]),d[2]=r)):N.type==="tableCellDivider"&&(l?l=!1:(u[1]!==0&&(d[0]=d[1],y=Ec(k,n,u,o,void 0,y)),u=d,d=[u[1],r,0,0])):N.type==="tableHead"?(f=!0,m=r):N.type==="tableRow"||N.type==="tableDelimiterRow"?(m=r,u[1]!==0?(d[0]=d[1],y=Ec(k,n,u,o,r,y)):d[1]!==0&&(y=Ec(k,n,d,o,r,y)),o=0):o&&(N.type==="data"||N.type==="tableDelimiterMarker"||N.type==="tableDelimiterFiller")&&(d[3]=r)}for(m!==0&&y1(k,n,m,h,g),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=D6(n.events,r))}return e}function Ec(e,n,r,l,o,u){const d=l===1?"tableHeader":l===2?"tableDelimiter":"tableData",f="tableContent";r[0]!==0&&(u.end=Object.assign({},vs(n.events,r[0])),e.add(r[0],0,[["exit",u,n]]));const m=vs(n.events,r[1]);if(u={type:d,start:Object.assign({},m),end:Object.assign({},m)},e.add(r[1],0,[["enter",u,n]]),r[2]!==0){const h=vs(n.events,r[2]),g=vs(n.events,r[3]),y={type:f,start:Object.assign({},h),end:Object.assign({},g)};if(e.add(r[2],0,[["enter",y,n]]),l!==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 N=r[2]+1,C=r[3]-r[2]-1;e.add(N,C,[])}}e.add(r[3]+1,0,[["exit",y,n]])}return o!==void 0&&(u.end=Object.assign({},vs(n.events,o)),e.add(o,0,[["exit",u,n]]),u=void 0),u}function y1(e,n,r,l,o){const u=[],d=vs(n.events,r);o&&(o.end=Object.assign({},d),u.push(["exit",o,n])),l.end=Object.assign({},d),u.push(["exit",l,n]),e.add(r+1,0,u)}function vs(e,n){const r=e[n],l=r[0]==="enter"?"start":"end";return r[1][l]}const H6={name:"tasklistCheck",tokenize:q6};function P6(){return{text:{91:H6}}}function q6(e,n,r){const l=this;return o;function o(m){return l.previous!==null||!l._gfmTasklistFirstContentOfListItem?r(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),u)}function u(m){return Tt(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):We(m)?e.check({tokenize:F6},n,r)(m):r(m)}}function F6(e,n,r){return nt(e,l,"whitespace");function l(o){return o===null?r(o):n(o)}}function V6(e){return Ib([g6(),N6(),I6(e),U6(),P6()])}const G6={};function Au(e){const n=this,r=e||G6,l=n.data(),o=l.micromarkExtensions||(l.micromarkExtensions=[]),u=l.fromMarkdownExtensions||(l.fromMarkdownExtensions=[]),d=l.toMarkdownExtensions||(l.toMarkdownExtensions=[]);o.push(V6(r)),u.push(f6()),d.push(m6(r))}const K6="modulepreload",W6=function(e){return"/"+e},v1={},Y6=function(n,r,l){let o=Promise.resolve();if(r&&r.length>0){let m=function(h){return Promise.all(h.map(g=>Promise.resolve(g).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=W6(h),h in v1)return;v1[h]=!0;const g=h.endsWith(".css"),y=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${y}`))return;const k=document.createElement("link");if(k.rel=g?"stylesheet":K6,g||(k.as="script"),k.crossOrigin="",k.href=h,f&&k.setAttribute("nonce",f),document.head.appendChild(k),g)return new Promise((w,N)=>{k.addEventListener("load",w),k.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${h}`)))})}))}function u(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"&&u(f.reason);return n().catch(u)})},Q6=1500;function X6({code:e}){const[n,r]=b.useState(!1),l=()=>{navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),Q6)};return i.jsx("button",{type:"button",title:n?x.common.copied:x.chat.copyCode,"aria-label":x.chat.copyCode,onClick:l,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:i.jsx(Ve,{d:n?Jt.check:Jt.copy})})}function jk({language:e,code:n,highlight:r=!0}){const[l,o]=b.useState(null);return b.useEffect(()=>{if(!r){o(null);return}let u=!0;return Y6(()=>import("./index-zCEa-kcQ.js"),[]).then(d=>d.codeToHtml(n,{lang:e||"text",themes:{light:"github-light",dark:"github-dark"}})).then(d=>{u&&o(d)}).catch(()=>{u&&o(null)}),()=>{u=!1}},[n,e,r]),i.jsxs("div",{className:"code-block my-2 overflow-hidden rounded-lg border border-gray-200 dark:border-gray-800",children:[i.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:[i.jsx("span",{className:"font-mono text-xs lowercase text-gray-500 dark:text-gray-400",children:e||"text"}),i.jsx(X6,{code:n})]}),i.jsx("div",{className:"overflow-x-auto bg-white text-[13px] leading-relaxed dark:bg-gray-950",children:l?i.jsx("div",{dangerouslySetInnerHTML:{__html:l}}):i.jsx("pre",{className:"m-0 px-3 py-2.5 font-mono text-gray-800 dark:text-gray-200",children:i.jsx("code",{children:n})})})]})}function Z6(e){return typeof e=="string"?e:Array.isArray(e)?e.filter(n=>typeof n=="string").join(""):""}function Ck({children:e,streaming:n}){if(b.isValidElement(e)){const r=e.props,l=/language-([\w+-]+)/.exec(r.className??"")?.[1]??"";return i.jsx(jk,{language:l,code:Z6(r.children).replace(/\n$/,""),highlight:!n})}return i.jsx("pre",{children:e})}function Nk({node:e,children:n,...r}){return i.jsx("a",{...r,target:"_blank",rel:"noreferrer",children:n})}const J6={pre:e=>i.jsx(Ck,{streaming:!0,children:e.children}),a:Nk},eA={pre:e=>i.jsx(Ck,{streaming:!1,children:e.children}),a:Nk},Tk=b.memo(function({text:n,streaming:r=!1}){return i.jsx(Eu,{remarkPlugins:[Au],components:r?J6:eA,children:n})});function Al({src:e,alt:n,className:r}){const[l,o]=b.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"block cursor-zoom-in",onClick:()=>o(!0),children:i.jsx("img",{src:e,alt:n,className:r})}),l&&i.jsx(tA,{src:e,alt:n,onClose:()=>o(!1)})]})}function tA({src:e,alt:n,onClose:r}){return b.useEffect(()=>{const l=o=>{o.key==="Escape"&&r()};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[r]),Es.createPortal(i.jsx("div",{className:"anim-fade fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-10",onMouseDown:l=>{l.target===l.currentTarget&&r()},children:i.jsxs("div",{className:"anim-pop relative",children:[i.jsx("button",{type:"button","aria-label":x.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:i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",children:i.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})}),i.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 nA=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"]),aA=/^[a-z][a-z0-9+.-]*:\/\//i;function rA(e){const n=e.trim();if(n.length===0||n.length>200||/\s/.test(n)||aA.test(n)||n.startsWith("www."))return!1;const r=/\.([A-Za-z0-9]{1,8})$/.exec(n);if(!r)return!1;const l=r[1].toLowerCase();return/^\d+$/.test(l)?!1:nA.has(l)}const lA=512;function sA(e,n){const r=e.trim();if(r.length===0||r.length>lA||r.startsWith("~"))return null;const l=n!==null&&n.length>0?n:null,o=l?.includes("\\")??!1,u=o?"\\":"/",d=r.startsWith("/")||o&&(/^[A-Za-z]:/.test(r)||r.startsWith("\\"));let f=r;if(d){if(l===null||!r.startsWith(`${l}${u}`))return null;f=r.slice(l.length+u.length),u==="\\"&&(f=f.replaceAll("\\","/"))}const m=[];for(const h of f.split("/"))if(!(h===""||h===".")){if(h===".."){if(m.length===0)return null;m.pop();continue}m.push(h)}return m.length>0?m.join("/"):null}const b1=3;function iA(e){const n=[],r=new Set;for(const l of e.matchAll(/`([^`\n]+)`/g)){const o=l[1].trim();!rA(o)||r.has(o)||(r.add(o),n.push(o))}return n}function oA({path:e}){const n=e.lastIndexOf("/"),r=n>=0?e.slice(0,n+1):"",l=n>=0?e.slice(n+1):e;return i.jsxs("span",{className:"flex min-w-0 items-baseline font-mono text-sm",children:[r&&i.jsx("span",{className:"min-w-0 shrink-[9999] truncate text-gray-400 dark:text-gray-500",children:r}),i.jsx("span",{className:"min-w-0 truncate font-semibold text-gray-800 dark:text-gray-100",children:l})]})}function cA({text:e,workspace:n,statFiles:r,onOpenFile:l}){const o=b.useMemo(()=>{const y=[],k=new Set;for(const w of iA(e)){const N=sA(w,n);N===null||k.has(N)||(k.add(N),y.push(N))}return y},[e,n]),[u,d]=b.useState(null);b.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]=b.useState(!1);if(u===null||u.length===0)return null;const h=f?u:u.slice(0,b1),g=u.length-h.length;return i.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:[i.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:[i.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:i.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:x.chat.filesInMessage(u.length)})]}),i.jsxs("div",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:[h.map(y=>i.jsxs("button",{type:"button",title:y,onClick:()=>l(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:[i.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:i.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})}),i.jsx(oA,{path:y}),i.jsx("span",{className:"min-w-0 flex-1"}),i.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:x.chat.openPreview})]},y)),(g>0||f)&&u.length>b1&&i.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?x.chat.showLess:x.chat.showMoreFiles(g),i.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:i.jsx("path",{d:"m6 9 6 6 6-6"})})]})]})]})}const uA={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"},k1={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 ep({state:e,size:n=13,label:r}){return e==="running"?i.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 ${k1.running}`}):i.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 ${k1[e]}`,children:[r&&i.jsx("title",{children:r}),i.jsx("path",{d:uA[e]})]})}function cu({sinceMs:e,offsetMs:n=0}){const[r,l]=b.useState(()=>Date.now());return b.useEffect(()=>{const o=setInterval(()=>l(Date.now()),1e3);return()=>clearInterval(o)},[]),e===void 0?i.jsx("span",{className:"animate-pulse",children:"…"}):i.jsx(i.Fragment,{children:_4(Math.max(0,n)+Math.max(0,r-e))})}function dA({item:e}){const[n,r]=b.useState(!1),l=e.stopReason!==void 0&&e.stopReason!=="completed",o=e.streaming?"running":l?"failed":"done",u=e.streaming?x.chat.workRunning:l?e.stopReason:x.chat.workDone;return i.jsxs("div",{children:[i.jsxs("button",{type:"button",onClick:()=>r(d=>!d),"aria-expanded":n,className:"flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[i.jsx(ep,{state:o,label:u}),i.jsx("span",{className:"shrink-0 text-xs text-gray-500 dark:text-gray-400",children:x.chat.thinking}),i.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-500 dark:text-gray-400",children:e.streaming?i.jsx(cu,{sinceMs:e.startedAtMs}):e.durationMs!==void 0?ln(e.durationMs):null}),l&&i.jsxs("span",{className:"font-mono text-xs text-gray-400",children:["[",e.stopReason,"]"]}),i.jsx("span",{className:"min-w-0 flex-1"}),i.jsx(gn,{open:n,className:"text-gray-400"})]}),n&&i.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:i.jsx(Tk,{text:e.thinking,streaming:e.streaming})})]})}function fA({onDecide:e}){const[n,r]=b.useState(!1),l=async o=>{r(!0);try{await e(o)}finally{r(!1)}};return i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(ke,{size:"sm",variant:"primary",disabled:n,onClick:()=>{l("allow")},children:x.chat.approve}),i.jsx(ke,{size:"sm",disabled:n,onClick:()=>{l("deny")},children:x.chat.deny})]})}function Mk({sessionId:e,model:n,running:r,ctx:l}){const[o,u]=b.useState(r),d=b.useRef(!1),f=b.useRef(r),m={...l,...e?{origin:[...l.origin,e]}:{},taskRunning:r};return b.useEffect(()=>{f.current&&!r&&!d.current&&u(!1),f.current=r},[r]),i.jsxs("div",{className:"rounded-md border border-dashed border-gray-300 bg-gray-50/60 dark:border-gray-700 dark:bg-gray-900/40",children:[i.jsxs("button",{type:"button",onClick:()=>{d.current=!0,u(h=>!h)},className:"flex w-full items-center gap-2 rounded-t-md px-3 py-1.5 text-left text-xs text-gray-500 transition-colors duration-200 hover:bg-gray-100/70 dark:text-gray-400 dark:hover:bg-gray-800/50",children:[i.jsx(gn,{open:o}),i.jsx("span",{className:"font-semibold text-gray-700 dark:text-gray-300",children:x.chat.subagent}),e&&i.jsx("span",{className:"truncate font-mono text-gray-400",children:e}),r&&i.jsxs("span",{className:"ml-auto flex items-center gap-1 text-gray-500 dark:text-gray-400",children:[i.jsx("span",{className:"inline-block h-2.5 w-2.5 animate-spin rounded-full border border-gray-400 border-t-transparent"}),x.chat.subagentRunning]})]}),o&&i.jsx("div",{className:"anim-fade border-t border-dashed border-gray-200 px-3 py-1 dark:border-gray-800",children:i.jsx(_k,{items:n.items,ctx:m})})]})}const mA=new Set(["exec_command","input_command","run_subagent","input_subagent"]),tp=new Set(["read_file","edit_file","write_file"]);function Ek(e){const n=e.split("/").filter(r=>r.length>0);return n.length<=2?e:`…/${n[n.length-2]}/${n[n.length-1]}`}function hA(e,n){if(e==="exec_command"){const r=uu(n,"cmd");if(r!==null)return`$ ${r.replace(/\s+/g," ").trim()}`}if(tp.has(e)){const r=uu(n,"file_path");if(r!==null)return Ek(r.replace(/\s+/g," ").trim())}return n.replace(/\s+/g," ").trim()}function pA(e,n){if(mA.has(e)){const r=uu(n,"description");if(r!==null){const l=r.replace(/\s+/g," ").trim();if(l)return l}return null}if(tp.has(e)){const r=uu(n,"file_path");if(r!==null){const l=r.replace(/\s+/g," ").trim();if(l)return Ek(l)}}return null}function gA(e,n){if(!tp.has(e))return null;let r;try{r=JSON.parse(n)}catch{return null}if(r===null||typeof r!="object")return null;const l=r,o=[],u=(d,f)=>{f!==void 0&&(typeof f=="string"&&f.includes(`
|
|
101
|
-
`)?o.push(`${d}:
|
|
102
|
-
${f}`):o.push(`${d}: ${typeof f=="string"?f:JSON.stringify(f)}`))};return u("file_path",l.file_path),e==="read_file"?(u("offset",l.offset),u("limit",l.limit)):e==="edit_file"?(u("old_string",l.old_string),u("new_string",l.new_string),l.replace_all===!0&&u("replace_all",!0)):e==="write_file"&&u("content",l.content),o.join(`
|
|
103
|
-
`)}function uu(e,n){const r=`"${n}"`,l=e.indexOf(r);if(l===-1)return null;let o=l+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 u="",d=!1;for(;o<e.length;o+=1){const f=e[o];if(d){u+=f==="n"?`
|
|
104
|
-
`:f==="t"?" ":f,d=!1;continue}if(f==="\\"){d=!0;continue}if(f==='"')return u;u+=f}return u}function xA({item:e,ctx:n}){const[r,l]=b.useState(!1),o=b.useRef(!1),u=n.pendingApprovals.get(Cs(n.origin,e.toolCallId)),d=e.subagentSessionId?[...n.origin,e.subagentSessionId].join("/"):null,f=d!==null&&[...n.pendingApprovals.keys()].some(C=>C.startsWith(`${d} `)||C.startsWith(`${d}/`));b.useEffect(()=>{f&&!o.current&&l(!0)},[f]);const m=hA(e.name,e.argumentsText),h=pA(e.name,e.argumentsText),g=e.callComplete&&!e.outputComplete&&!u,y=e.argStartedAtMs!==void 0&&e.callStartedAtMs!==void 0?Math.max(0,e.callStartedAtMs-e.argStartedAtMs):0,k=e.callStopReason!==void 0&&e.callStopReason!=="completed"||e.outputStopReason!==void 0&&e.outputStopReason!=="completed",w=u?"waiting":g||e.callStreaming?"running":k?"failed":"done",N=u?x.chat.approvalWaiting:w==="running"?x.chat.workRunning:w==="done"?x.chat.workDone:e.outputStopReason??e.callStopReason;return i.jsxs("div",{children:[i.jsxs("button",{type:"button","aria-expanded":r,onClick:()=>{o.current=!0,l(C=>!C)},className:"flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors duration-150 hover:bg-gray-50 dark:hover:bg-gray-800/50",children:[i.jsx(ep,{state:w,label:N}),i.jsx("span",{className:"shrink-0 truncate font-mono text-xs font-semibold text-gray-700 dark:text-gray-300",children:e.name||x.chat.unknownTool}),h&&i.jsx("span",{className:"min-w-0 shrink truncate text-xs text-gray-500 dark:text-gray-400",children:h}),i.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-500 dark:text-gray-400",children:e.durationMs!==void 0?ln(e.durationMs):g?i.jsx(cu,{sinceMs:e.approvalAtMs??e.callStartedAtMs,offsetMs:y}):u?y>0?ln(y):null:e.callStreaming?e.argStartedAtMs!==void 0?i.jsx(cu,{sinceMs:e.argStartedAtMs}):i.jsx("span",{className:"animate-pulse",children:"…"}):null}),u&&i.jsx("span",{className:"shrink-0 font-mono text-xs text-amber-600 dark:text-amber-400",children:x.chat.approvalWaiting}),e.callStopReason&&e.callStopReason!=="completed"&&i.jsx(Lt,{tone:Om(e.callStopReason),children:e.callStopReason}),e.outputStopReason&&e.outputStopReason!=="completed"&&i.jsx(Lt,{tone:Om(e.outputStopReason),children:e.outputStopReason}),e.decision&&i.jsxs(Lt,{tone:e.decision==="allow"?"green":"red",children:[e.decision==="allow"?x.chat.decisionAllow:x.chat.decisionDeny," · ",e.decisionSource==="manual"?x.chat.decisionManual:x.chat.decisionAuto]}),i.jsx("span",{className:"min-w-0 flex-1"}),i.jsx(gn,{open:r,className:"text-gray-400"})]}),u&&i.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:[i.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[i.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||x.chat.unknownTool}),i.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-gray-600 dark:text-gray-400",children:m})]}),(()=>{const C=gA(e.name,e.argumentsText);return C!==null?i.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:C}):null})(),i.jsx(fA,{onDecide:C=>n.onApprove(e.toolCallId,C,n.origin)})]}),r&&i.jsxs("div",{className:"anim-fade",children:[e.argumentsText&&i.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)&&i.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&&i.jsx("span",{className:"animate-pulse",children:"▌"})]}),e.images&&e.images.length>0&&i.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((C,j)=>i.jsx(Al,{src:C,alt:x.chat.toolImageAlt,className:"max-h-40 max-w-full rounded-md border border-gray-200 dark:border-gray-700"},j))})]}),e.subagent&&i.jsx("div",{className:"px-3 pb-2 pt-2",children:i.jsx(Mk,{sessionId:e.subagentSessionId??"",model:e.subagent,running:!e.outputComplete,ctx:n})})]})}function yA({item:e}){if(e.running)return i.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:[i.jsx("span",{className:"inline-block h-3 w-3 animate-spin rounded-full border-2 border-gray-400 border-t-transparent"}),x.chat.compactionRunning(e.mode)]});const n=e.status==="completed"?x.chat.compactionDone(e.mode):x.chat.compactionFailed(e.status??"failed");return i.jsx("p",{className:"my-1 font-mono text-xs text-gray-500 dark:text-gray-400",children:n})}function vA(e){return e.agentName&&e.agentName!==e.agentId?`${e.agentName} (@${e.agentId})`:`@${e.agentId}`}const eh="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 bA({origin:e}){const n=Qn(),r=x.chat.handoffFrom(vA(e));if(!e.sessionId)return i.jsx("p",{className:eh,children:r});const l=e.sessionId;return i.jsxs("button",{type:"button",title:x.chat.handoffBack(e.sessionTitle),onClick:()=>n(`/chat/${l}`),className:`${eh} transition-colors hover:bg-gray-100 hover:text-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-200`,children:[r,i.jsx("span",{"aria-hidden":!0,className:"text-gray-400 dark:text-gray-500",children:"→"})]})}function kA({origin:e}){const n=Qn(),r=e.sessionId;return i.jsxs("button",{type:"button",title:x.chat.handoffBack(e.sessionTitle),onClick:()=>n(`/chat/${r}`),className:`${eh} transition-colors hover:bg-gray-100 hover:text-gray-800 dark:hover:bg-gray-800 dark:hover:text-gray-200`,children:[x.chat.modelSwitchFrom(e.prevModelId),i.jsx("span",{"aria-hidden":!0,className:"text-gray-400 dark:text-gray-500",children:"→"})]})}function wA({origin:e}){return i.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:[x.chat.scheduledFrom(e.name),e.firedAt&&i.jsx("span",{className:"text-gray-400 dark:text-gray-500",children:Kn(e.firedAt)})]})}const np="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 SA(e,n,r){return e==="zh"&&r?r:n}function co(e,n){return e==="zh"?n.shortDescriptionZh||n.shortDescription||n.description:n.shortDescription||n.description}function jA(e,n,r){const l=r.trim().toLowerCase();return l?e.filter(o=>o.name.toLowerCase().includes(l)||co(n,o).toLowerCase().includes(l)):e}function CA(e,n){return e.map(r=>({name:r.name,cmd:`/${r.name}`,desc:co(n,r)}))}function NA({names:e}){return i.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:[i.jsx(Ve,{d:np,className:"text-gray-400 dark:text-gray-500"}),x.chat.skillsBanner(e)]})}const Ak=B4,TA=V4,MA=/^[\w-]*$/;function w1(e,n){const r=e.slice(0,n),l=r.lastIndexOf("@");if(l<0||l>0&&!/\s/.test(r[l-1]))return null;const o=r.slice(l+1);if(!MA.test(o))return null;const u=/^[\w-]*/.exec(e.slice(n))[0];return{start:l,end:n+u.length,query:o}}function EA(e,n){const r=n.toLowerCase();return e.filter(l=>l.agentId.toLowerCase().startsWith(r)||(l.name??"").toLowerCase().startsWith(r))}function AA(e,n){const r=/^@([\w-]+)([\s\S]*)$/.exec(e);if(!r)return null;const l=n.find(o=>o.agentId===r[1]);return l?{agent:l,rest:r[2].trimStart()}:null}function _i({icon:e,value:n,label:r}){return i.jsxs("span",{title:r,"aria-label":r,className:"flex items-center gap-1",children:[i.jsx(Ve,{d:e}),n]})}function RA({stats:e,assistantText:n,cost:r,atMs:l}){const[o,u]=b.useState(!1),{currency:d}=Ll(),{locale:f}=Ga(),m=e?.tokensByBucket,h=m?m.cacheRead+m.cacheWrite:0,g=()=>{const y=n?.trim()||e===null?n??"":lC(e,{stats:x.chat.statsLabel,input:x.chat.statInput,cached:x.chat.statCached,output:x.chat.statOutput,parenOpen:x.chat.statParenOpen,parenClose:x.chat.statParenClose});navigator.clipboard?.writeText(y).then(()=>{u(!0),setTimeout(()=>u(!1),1500)})};return i.jsxs("div",{className:"-mt-2 flex h-5 flex-wrap items-center justify-start gap-x-3 text-[11px] text-gray-400 opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-within:opacity-100 dark:text-gray-500",children:[l!==void 0&&i.jsx("span",{children:mb(l,f)}),e&&m&&i.jsxs(i.Fragment,{children:[i.jsx(_i,{icon:Jt.input,value:ut(h),label:x.chat.statInput}),i.jsx(_i,{icon:Jt.output,value:ut(m.output),label:x.chat.statOutput}),i.jsx(_i,{icon:Jt.tps,value:tu(e.outputTps),label:x.chat.statTps}),r!=null&&i.jsx(_i,{icon:Jt.cost,value:ya(r,d),label:`${x.common.cost}(${d})`}),i.jsx(_i,{icon:Jt.elapsed,value:ln(e.elapsedDeltaMs),label:x.chat.statElapsed})]}),i.jsx("button",{type:"button",title:o?x.common.copied:x.chat.copyReply,"aria-label":x.chat.copyReply,onClick:g,className:"flex h-5 w-5 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:i.jsx(Ve,{d:o?Jt.check:Jt.copy})})]})}const _A=1200,LA="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 Ac({atMs:e,text:n,align:r="left"}){const{locale:l}=Ga(),[o,u]=b.useState(!1),d=()=>{n!==void 0&&(navigator.clipboard.writeText(n),u(!0),setTimeout(()=>u(!1),_A))};return i.jsxs("div",{className:`flex h-5 items-center gap-2 opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-within:opacity-100 ${r==="right"?"justify-end":"justify-start"}`,children:[e!==void 0&&i.jsx("span",{className:"text-[11px] text-gray-400",children:mb(e,l)}),n!==void 0&&i.jsx("button",{type:"button",title:o?x.common.copied:x.chat.copyMessage,"aria-label":x.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:i.jsx(Ve,{d:o?Jt.check:Jt.copy})})]})}function Rk({item:e,ctx:n}){switch(e.kind){case"user_text":{const r=P4(e.text);if(r)return i.jsx(bA,{origin:r});const l=K4(e.text);if(l)return i.jsx(kA,{origin:l});const o=F4(e.text),u=o?o.rest:e.text,d=$4(u),{text:f,images:m}=SC(d?d.rest:u);return i.jsxs(i.Fragment,{children:[o&&i.jsx(wA,{origin:o.origin}),d&&i.jsx(NA,{names:d.skills}),f&&i.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[i.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:i.jsx("p",{className:"wrap-anywhere whitespace-pre-wrap text-base leading-relaxed text-gray-900 dark:text-gray-100",children:f})}),i.jsx(Ac,{...e.atMs!==void 0?{atMs:e.atMs}:{},text:f,align:"right"})]}),m.map((h,g)=>i.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[i.jsx("div",{className:"max-w-[88%] rounded-lg bg-gray-100 p-1.5 md:max-w-[75%] dark:bg-gray-800",children:i.jsx(Al,{src:h,alt:x.chat.imageAlt,className:"max-h-48 max-w-full rounded-md"})}),i.jsx(Ac,{...e.atMs!==void 0?{atMs:e.atMs}:{},align:"right"})]},g))]})}case"user_steering":return i.jsxs("div",{className:"anim-msg group my-2 flex flex-col items-end",children:[i.jsxs("div",{className:"flex max-w-[88%] items-start 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:[i.jsx(Ve,{d:LA,className:"mt-1 shrink-0 text-gray-400 dark:text-gray-500"}),i.jsxs("p",{className:"wrap-anywhere whitespace-pre-wrap text-sm leading-relaxed text-gray-800 dark:text-gray-100",children:[i.jsx("span",{className:"mr-1.5 text-xs font-semibold text-gray-500 dark:text-gray-400",children:x.chat.userSteering}),e.text]})]}),i.jsx(Ac,{...e.atMs!==void 0?{atMs:e.atMs}:{},text:e.text,align:"right"})]});case"user_image":return i.jsxs("div",{className:"anim-msg group my-4 flex flex-col items-end",children:[i.jsx("div",{className:"max-w-[88%] rounded-lg bg-gray-100 p-1.5 md:max-w-[75%] dark:bg-gray-800",children:i.jsx(Al,{src:e.imageUrl,alt:x.chat.imageAlt,className:"max-h-48 max-w-full rounded-md"})}),i.jsx(Ac,{...e.atMs!==void 0?{atMs:e.atMs}:{},align:"right"})]});case"assistant_text":return i.jsxs("div",{className:"md-body anim-msg my-3 text-base leading-relaxed text-gray-800 dark:text-gray-100",children:[i.jsx(Tk,{text:e.text,streaming:e.streaming}),e.streaming&&i.jsx("span",{className:"animate-pulse text-gray-400",children:"▌"}),e.stopReason&&e.stopReason!=="completed"&&i.jsxs("span",{className:"ml-1 font-mono text-xs text-gray-400",children:["[",e.stopReason,"]"]}),!e.streaming&&n.onOpenFile&&n.statFiles&&i.jsx(cA,{text:e.text,workspace:n.workspace??null,statFiles:n.statFiles,onOpenFile:n.onOpenFile})]});case"thinking":return i.jsx(dA,{item:e});case"tool_call":return i.jsx(xA,{item:e,ctx:n});case"subagent":return i.jsx("div",{className:"anim-msg my-2",children:i.jsx(Mk,{sessionId:e.sessionId,model:e.model,running:!1,ctx:n})});case"abort":return i.jsx("p",{className:"anim-msg my-1 font-mono text-xs text-gray-500 dark:text-gray-400",children:x.chat.aborted(e.reason)});case"reconnect":return i.jsx("p",{className:"anim-msg my-1 font-mono text-xs text-amber-600 dark:text-amber-500",children:x.chat.reconnect(e.status,e.gaveUp?"gaveUp":e.retrying?"retried":"waiting",e.attempt)});case"compaction":return i.jsx(yA,{item:e});case"task_stats":return i.jsx(RA,{stats:e.stats,assistantText:e.assistantText,cost:e.stats?n.taskCost?.(e.stats)??null:null,...e.atMs!==void 0?{atMs:e.atMs}:{}})}}function IA(e){let n=0,r=0,l,o;const u=m=>{m!==void 0&&(l===void 0||m<l)&&(l=m)},d=(m,h)=>{if(h<=0)return;if(m===void 0){r+=h;return}u(m);const g=m+h;(o===void 0||g>o)&&(o=g)};for(const m of e){if(m.kind==="thinking"){u(m.startedAtMs),m.durationMs!==void 0&&d(m.startedAtMs,m.durationMs);continue}if(m.kind!=="tool_call"||(n+=1,u(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=l!==void 0&&o!==void 0?o-l:0;return{steps:n,durationMs:f+r,...l!==void 0?{startMs:l}:{}}}function OA(e){return e.kind==="thinking"||e.kind==="tool_call"}function zA(e,n){return e.kind==="thinking"?e.streaming:e.kind==="tool_call"?e.callStreaming||e.outputStreaming||e.callComplete&&!e.outputComplete?!0:n.pendingApprovals.has(Cs(n.origin,e.toolCallId)):!1}function DA(e,n){return e.some(r=>r.kind==="tool_call"&&n.pendingApprovals.has(Cs(n.origin,r.toolCallId)))}function UA({items:e,ctx:n,isLast:r}){const l=e.some(w=>zA(w,n)),o=r&&n.taskRunning||l,u=DA(e,n),[d,f]=b.useState(r),m=b.useRef(!1);b.useEffect(()=>{m.current||f(r)},[r]);const h=d||u,{steps:g,durationMs:y,startMs:k}=IA(e);return i.jsxs("div",{className:"anim-msg my-2 overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("button",{type:"button","aria-expanded":h,onClick:()=>{m.current=!0,f(w=>!w)},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/60 dark:hover:bg-gray-800/60",children:[i.jsx(ep,{state:o?"running":"done",size:12}),i.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?x.chat.workRunning:x.chat.workDone}),g>0&&i.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400",children:x.chat.workGroupSteps(g)}),l?k!==void 0&&i.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400",children:i.jsx(cu,{sinceMs:k})}):y>0&&i.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400",children:ln(y)}),u&&!h&&i.jsx("span",{className:"shrink-0 rounded bg-amber-100 px-1 text-[10px] font-medium text-amber-700 dark:bg-amber-950/50 dark:text-amber-300",children:x.chat.approvalWaiting}),i.jsx("span",{className:"min-w-0 flex-1"}),i.jsx(gn,{open:h,className:"text-gray-400"})]}),h&&i.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(w=>i.jsx(Rk,{item:w,ctx:n},w.id))})]})}function $A(){let e=!0,n=null,r=null;return{get stick(){return e},wheel(l){l<0&&(e=!1)},touchStart(l){r=l},touchMove(l){r!==null&&l>r&&(e=!1),r=l},touchEnd(){r=null},scrolled(l){const o=l.scrollHeight-l.scrollTop-l.clientHeight,u=n;if(n=l.scrollTop,u===null){e=o<80;return}if(l.scrollTop<u&&o>1){e=!1;return}o<80&&(e=!0)},resume(){e=!0,n=null}}}function _k({items:e,ctx:n}){const r=[];let l=[];const o=()=>{l.length>0&&(r.push({type:"group",items:l}),l=[])};for(const h of e)OA(h)?l.push(h):(o(),r.push({type:"single",item:h}));o();const u=(h,g)=>h.type==="group"?i.jsx(UA,{items:h.items,ctx:n,isLast:g===r.length-1},`wg-${h.items[0].id}`):i.jsx(Rk,{item:h.item,ctx:n},h.item.id),d=[];let f=[];const m=()=>{if(f.length===0)return;const h=f[0].seg,g=h.type==="group"?h.items[0].id:h.item.id,y=f;f=[],d.push(i.jsx("div",{className:"group",children:y.map(k=>u(k.seg,k.i))},`turn-${g}`))};for(let h=0;h<r.length;h++){const g=r[h];if(g.type==="single"&&(g.item.kind==="user_text"||g.item.kind==="user_image")){m(),d.push(u(g,h));continue}f.push({seg:g,i:h}),g.type==="single"&&g.item.kind==="task_stats"&&m()}return m(),i.jsx(i.Fragment,{children:d})}function BA({items:e,version:n,ctx:r}){const l=b.useRef(null),o=b.useRef(null),u=o.current??=$A(),[d,f]=b.useState(!1),m=b.useRef(!1),h=b.useRef(null),g=()=>{h.current!==null&&(cancelAnimationFrame(h.current),h.current=null),m.current=!1};b.useEffect(()=>()=>g(),[]);const y=b.useRef(null),k=()=>{const C=l.current;f(!m.current&&!u.stick&&C!==null&&C.scrollHeight-C.scrollTop-C.clientHeight>1)},w=()=>{const C=l.current;if(!C)return;const j=y.current;y.current=C.scrollTop,m.current&&j!==null&&C.scrollTop<j-1&&g(),u.scrolled({scrollTop:C.scrollTop,scrollHeight:C.scrollHeight,clientHeight:C.clientHeight}),k()};b.useLayoutEffect(()=>{const C=l.current;C&&u.stick&&!m.current&&(C.scrollTop=C.scrollHeight),k()},[n,u]);const N=()=>{const C=l.current;if(!C)return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){u.resume(),C.scrollTop=C.scrollHeight,k();return}g(),m.current=!0,C.scrollHeight-C.clientHeight-C.scrollTop>3*C.clientHeight&&(C.scrollTop=C.scrollHeight-4*C.clientHeight);let E=performance.now();const L=_=>{h.current=null;const q=l.current;if(!q||!m.current)return;const H=Math.min(.05,Math.max(.001,(_-E)/1e3));E=_;const I=q.scrollHeight-q.clientHeight-q.scrollTop;if(I<=1){m.current=!1,u.resume(),q.scrollTop=q.scrollHeight,k();return}const P=Math.max(I*Math.min(1,H*10),3200*H);q.scrollTop+=Math.min(P,I),h.current=requestAnimationFrame(L)};h.current=requestAnimationFrame(L),k()};return i.jsxs("div",{className:"relative h-full min-h-0",children:[i.jsx("div",{ref:l,onScroll:w,onWheel:C=>{u.wheel(C.deltaY),C.deltaY<0&&g(),k()},onTouchStart:C=>{const j=C.touches[0];j&&u.touchStart(j.clientY)},onTouchMove:C=>{const j=C.touches[0];j&&u.touchMove(j.clientY),m.current&&g(),k()},onTouchEnd:()=>u.touchEnd(),className:"anim-fade h-full overflow-y-auto px-4 py-4 md:px-6",children:i.jsx("div",{className:"mx-auto max-w-3xl",children:e.length===0?i.jsx(nl,{title:x.chat.emptyStream}):i.jsx(_k,{items:e,ctx:r})})}),d&&i.jsx("button",{type:"button","aria-label":x.chat.jumpToLatest,title:x.chat.jumpToLatest,onClick:N,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:i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":!0,children:i.jsx("path",{d:"M12 5v14M6 13l6 6 6-6",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}const HA=128e3;function Lk(e){const n=typeof e=="string"?Number(e):e;return typeof n=="number"&&Number.isFinite(n)&&n>0?n:HA}const PA=/[\s"'/]on[a-z]+\s*=/i,qA=/href\s*=/i;function FA(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")||qA.test(n)||PA.test(n)?null:n}const xm=["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"],VA={firecrawl:3,"data-analysis":1,"web-design":2,"penguin-sdk":0};function GA(e){const n=VA[e];if(n!==void 0)return xm[n];let r=0;for(let l=0;l<e.length;l++)r=r*31+e.charCodeAt(l)>>>0;return xm[r%xm.length]}function ap({icon:e,size:n=20,className:r=""}){const l=FA(e);return l?i.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:l}}):i.jsx(Ve,{d:np,size:n,className:r})}const S1={viewBox:"-0.76 -0.47 28.6 28.6",path:i.jsxs(i.Fragment,{children:[i.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"}),i.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"}),i.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"}),i.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"}),i.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"}),i.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"})]})},KA={anthropic:{path:i.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:i.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:i.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:i.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:i.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:i.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:i.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:i.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":S1,"qwen-pay-as-you-go":S1,fireworks:{viewBox:"0 0 638 315",path:i.jsxs(i.Fragment,{children:[i.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"}),i.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"}),i.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:i.jsxs(i.Fragment,{children:[i.jsx("path",{d:"M12 2.8 20.5 7.4v9.2L12 21.2 3.5 16.6V7.4L12 2.8Z"}),i.jsx("path",{d:"M3.5 7.4 12 12l8.5-4.6M12 12v9.2"})]})}};function uo({provider:e,className:n}){const r=KA[e];if(!r){const l=lb(e);return i.jsxs("svg",{viewBox:"0 0 24 24",className:n,style:{"--tile-fg":l.fg,"--tile-fg-dark":l.fgDark},"aria-hidden":!0,children:[i.jsx("rect",{x:"0",y:"0",width:"24",height:"24",rx:"5",fill:l.bg}),i.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:sb(e)})]})}return i.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 kt="https://openrouter.ai/api/v1",yr="https://api.siliconflow.cn/v1",bs="https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",$i="https://dashscope.aliyuncs.com/compatible-mode/v1",ks="https://api.fireworks.ai/inference/v1",al=[{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:kt},{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:ks},{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:yr},{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:bs},{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:$i},{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 rn(e,n,r){const l=o=>Math.round(o/7*1e6)/1e6;return _e(l(e),l(n),l(r))}function _e(e,n,r){return{unit:"usd_per_mtok",cache_read:e,cache_write:n,output:r}}var Ik=[{modelId:"deepseek-v4-flash",displayName:"DeepSeek V4 Flash",provider:"deepseek",contextWindow:1e6,pricing:rn(.02,1,2),supportsVision:!1},{modelId:"deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"deepseek",contextWindow:1e6,pricing:rn(.025,3,6),supportsVision:!1},{modelId:"anthropic/claude-fable-5",displayName:"Claude Fable 5",provider:"openrouter",contextWindow:1e6,pricing:_e(10,10,50),supportsVision:!0,clientType:"openai",baseUrl:kt},{modelId:"anthropic/claude-opus-5",displayName:"Claude Opus 5",provider:"openrouter",contextWindow:1e6,pricing:_e(.5,6.25,25),supportsVision:!0,clientType:"openai",baseUrl:kt},{modelId:"anthropic/claude-opus-4.8",displayName:"Claude Opus 4.8",provider:"openrouter",contextWindow:1e6,pricing:_e(5,5,25),supportsVision:!0,clientType:"openai",baseUrl:kt},{modelId:"anthropic/claude-opus-4.7",displayName:"Claude Opus 4.7",provider:"openrouter",contextWindow:1e6,pricing:_e(5,5,25),supportsVision:!0,clientType:"openai",baseUrl:kt},{modelId:"anthropic/claude-sonnet-5",displayName:"Claude Sonnet 5",provider:"openrouter",contextWindow:1e6,pricing:_e(2,2,10),supportsVision:!0,clientType:"openai",baseUrl:kt},{modelId:"deepseek/deepseek-v4-flash",displayName:"DeepSeek V4 Flash",provider:"openrouter",contextWindow:1e6,pricing:_e(.09,.09,.18),supportsVision:!1,clientType:"openai",baseUrl:kt},{modelId:"deepseek/deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"openrouter",contextWindow:1e6,pricing:_e(.435,.435,.87),supportsVision:!1,clientType:"openai",baseUrl:kt},{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:kt},{modelId:"google/gemini-3.5-flash",displayName:"Gemini 3.5 Flash",provider:"openrouter",contextWindow:1048576,pricing:_e(1.5,1.5,9),supportsVision:!0,clientType:"openai",baseUrl:kt},{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:kt},{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:kt},{modelId:"minimax/minimax-m3",displayName:"MiniMax M3",provider:"openrouter",contextWindow:1048576,pricing:_e(.06,.3,1.2),supportsVision:!0,clientType:"openai",baseUrl:kt},{modelId:"moonshotai/kimi-k3",displayName:"Kimi K3",provider:"openrouter",contextWindow:1e6,pricing:_e(3,3,15),supportsVision:!0,clientType:"openai",baseUrl:kt},{modelId:"moonshotai/kimi-k2.6",displayName:"Kimi K2.6",provider:"openrouter",contextWindow:262144,pricing:_e(.144,.684,3.42),supportsVision:!0,clientType:"openai",baseUrl:kt},{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:kt},{modelId:"openai/gpt-5.6-sol",displayName:"GPT-5.6 Sol",provider:"openrouter",contextWindow:1e6,pricing:_e(5,5,30),supportsVision:!0,clientType:"openai",baseUrl:kt},{modelId:"openai/gpt-5.6-terra",displayName:"GPT-5.6 Terra",provider:"openrouter",contextWindow:1e6,pricing:_e(2.5,2.5,15),supportsVision:!0,clientType:"openai",baseUrl:kt},{modelId:"openai/gpt-5.5",displayName:"GPT-5.5",provider:"openrouter",contextWindow:1e6,pricing:_e(5,5,30),supportsVision:!0,clientType:"openai",baseUrl:kt},{modelId:"openrouter/free",displayName:"Free Models Router",provider:"openrouter",contextWindow:128e3,pricing:_e(0,0,0),supportsVision:!1,clientType:"openai",baseUrl:kt},{modelId:"poolside/laguna-m.1:free",displayName:"Laguna M.1 (free)",provider:"openrouter",contextWindow:262144,pricing:_e(0,0,0),supportsVision:!1,clientType:"openai",baseUrl:kt},{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:kt},{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:kt},{modelId:"tencent/hy3",displayName:"Hy3",provider:"openrouter",contextWindow:262144,pricing:_e(.035,.14,.58),supportsVision:!1,clientType:"openai",baseUrl:kt},{modelId:"x-ai/grok-4.5",displayName:"Grok 4.5",provider:"openrouter",contextWindow:5e5,pricing:_e(2,2,6),supportsVision:!0,clientType:"openai",baseUrl:kt},{modelId:"xiaomi/mimo-v2.5",displayName:"MiMo-V2.5",provider:"openrouter",contextWindow:1048576,pricing:_e(.0028,.14,.28),supportsVision:!0,clientType:"openai",baseUrl:kt},{modelId:"z-ai/glm-5.2",displayName:"GLM-5.2",provider:"openrouter",contextWindow:1e6,pricing:_e(.93,.93,3),supportsVision:!1,clientType:"openai",baseUrl:kt},{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:kt},{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:ks},{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:ks},{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:ks},{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:ks},{modelId:"accounts/fireworks/models/minimax-m3",displayName:"MiniMax M3",provider:"fireworks",contextWindow:524288,pricing:_e(.06,.3,1.2),supportsVision:!0,clientType:"openai",baseUrl:ks},{modelId:"deepseek-ai/DeepSeek-V4-Flash",displayName:"DeepSeek V4 Flash",provider:"siliconflow",contextWindow:1e6,pricing:rn(.02,1,2),supportsVision:!1,clientType:"openai",baseUrl:yr},{modelId:"deepseek-ai/DeepSeek-V4-Pro",displayName:"DeepSeek V4 Pro",provider:"siliconflow",contextWindow:1e6,pricing:rn(.1,12,24),supportsVision:!1,clientType:"openai",baseUrl:yr},{modelId:"meituan-longcat/LongCat-2.0",displayName:"LongCat 2.0",provider:"siliconflow",contextWindow:1e6,pricing:rn(.1,5,20),supportsVision:!1,clientType:"openai",baseUrl:yr},{modelId:"moonshotai/Kimi-K2.7-Code",displayName:"Kimi K2.7 Code",provider:"siliconflow",contextWindow:262144,pricing:rn(1.3,6.5,27),supportsVision:!0,clientType:"openai",baseUrl:yr},{modelId:"Pro/moonshotai/Kimi-K2.6",displayName:"Kimi K2.6",provider:"siliconflow",contextWindow:262144,supportsVision:!0,clientType:"openai",baseUrl:yr},{modelId:"Pro/zai-org/GLM-5.1",displayName:"GLM-5.1",provider:"siliconflow",contextWindow:2e5,supportsVision:!1,clientType:"openai",baseUrl:yr},{modelId:"Qwen/Qwen3.6-35B-A3B",displayName:"Qwen 3.6 35B A3B",provider:"siliconflow",contextWindow:262144,supportsVision:!0,clientType:"openai",baseUrl:yr},{modelId:"zai-org/GLM-5.2",displayName:"GLM-5.2",provider:"siliconflow",contextWindow:1e6,pricing:rn(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:yr},{modelId:"deepseek-v4-pro",displayName:"DeepSeek V4 Pro",provider:"qwen-token-plan",contextWindow:1e6,pricing:rn(1,12,24),supportsVision:!1,clientType:"openai",baseUrl:bs},{modelId:"glm-5.2",displayName:"GLM-5.2",provider:"qwen-token-plan",contextWindow:1048576,pricing:rn(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:bs},{modelId:"qwen3.8-max-preview",displayName:"Qwen 3.8 Max Preview",provider:"qwen-token-plan",contextWindow:1e6,supportsVision:!0,clientType:"openai",baseUrl:bs},{modelId:"qwen3.7-max",displayName:"Qwen 3.7 Max",provider:"qwen-token-plan",contextWindow:1e6,pricing:rn(2.4,12,36),supportsVision:!1,clientType:"openai",baseUrl:bs},{modelId:"qwen3.7-plus",displayName:"Qwen 3.7 Plus",provider:"qwen-token-plan",contextWindow:1e6,pricing:rn(.4,2,8),supportsVision:!0,clientType:"openai",baseUrl:bs},{modelId:"kimi/kimi-k3",displayName:"Kimi K3",provider:"qwen-pay-as-you-go",contextWindow:1048576,pricing:rn(2,20,100),supportsVision:!0,clientType:"openai",baseUrl:$i},{modelId:"qwen3.7-max",displayName:"Qwen 3.7 Max",provider:"qwen-pay-as-you-go",contextWindow:1e6,pricing:rn(2.4,12,36),supportsVision:!1,clientType:"openai",baseUrl:$i},{modelId:"qwen3.7-plus",displayName:"Qwen 3.7 Plus",provider:"qwen-pay-as-you-go",contextWindow:1e6,pricing:rn(.4,2,8),supportsVision:!0,clientType:"openai",baseUrl:$i},{modelId:"ZHIPU/GLM-5.2",displayName:"GLM-5.2",provider:"qwen-pay-as-you-go",contextWindow:1048576,pricing:rn(2,8,28),supportsVision:!1,clientType:"openai",baseUrl:$i},{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:rn(2,20,100),supportsVision:!0},{modelId:"kimi-k2.6",displayName:"Kimi K2.6",provider:"moonshot",contextWindow:262144,pricing:rn(1.1,6.5,27),supportsVision:!0},{modelId:"kimi-k2.5",displayName:"Kimi K2.5",provider:"moonshot",contextWindow:262144,pricing:rn(.7,4,21),supportsVision:!0}];function rp(e,n){return Ik.find(r=>r.provider===e&&r.modelId===n)}function pa(e){return al.find(n=>n.id===e)}function WA(e,n){const r=(n||e).toLowerCase(),l=o=>({envKey:`${o}_API_KEY`,envBaseUrlKey:`${o}_BASE_URL`});if(r.includes("gemini-3")||r.includes("gemini-embedding"))return l("GEMINI");if(r.includes("claude")&&(r.includes("4-7")||r.includes("4-8")||r.includes("-5")||r.includes("4-6")))return l("ANTHROPIC");if(r.includes("gpt-5.4")||r.includes("gpt-5.5"))return l("OPENAI");if(r.includes("glm-5"))return l("ZAI");if(r.includes("kimi-k3")||r.includes("kimi-k2.5")||r.includes("kimi-k2.6"))return l("MOONSHOT");if(r.includes("deepseek-v4"))return l("DEEPSEEK");if(r.includes("openai"))return l("OPENAI")}function YA(){return Ik.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 j1(e,n){if(e==="openrouter")return`https://openrouter.ai/${n}`;if(e==="qwen-token-plan")return n==="qwen3.8-max-preview"?pa(e)?.modelsUrl:`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]}`:pa(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]}`:pa(e)?.modelsUrl}if(e!=="custom")return pa(e)?.modelsUrl}function pt(e,n){return!!e&&!!n&&e.provider===n.provider&&e.modelId===n.modelId}function Ok(e){return{id:e,label:e,envKey:"OPENAI_API_KEY",envBaseUrlKey:"OPENAI_BASE_URL"}}function zk(e,n){const r=n.trim().toLowerCase();if(!r)return!0;const l=al.find(o=>o.id===e.provider);return e.modelId.toLowerCase().includes(r)||(e.displayName??"").toLowerCase().includes(r)||e.provider.toLowerCase().includes(r)||(l?.label??"").toLowerCase().includes(r)}function Dk(e,n){const r=n.trim()!=="",l=e.filter(f=>zk(f,n)),o=al.map(f=>({provider:f,rows:l.filter(m=>m.provider===f.id)})),d=[...new Set(l.map(f=>f.provider).filter(f=>!al.some(m=>m.id===f)))].sort().map(f=>({provider:Ok(f),rows:l.filter(m=>m.provider===f)}));return[...o,...d].filter(f=>f.rows.length>0||!r&&f.provider.id==="custom")}function QA(e){return Dk(e,"").flatMap(n=>n.rows)}function th(e){return!!e.credential?.apiKeyMasked}function Uk(e){return e?[e.cacheRead,e.cacheWrite,e.output].every(n=>typeof n=="string"?n.trim()!==""&&Number(n)===0:n===0):!1}function C1(e,{showAll:n,query:r,selected:l,defaultModel:o}){const u=QA(e);return(n||!u.some(th)?u:u.filter(f=>th(f)||pt(f,l)||pt(f,o))).filter(f=>zk(f,r))}const XA=/^[\w-]*$/;function N1(e,n){const r=e.slice(0,n),l=r.lastIndexOf("/");if(l<0||l>0&&!/\s/.test(r[l-1]))return null;const o=r.slice(l+1);if(!XA.test(o))return null;const u=/^[\w-]*/.exec(e.slice(n))[0];return{start:l,end:n+u.length,query:o}}function ZA(e,n){const r=e.slice(0,n.start),l=e.slice(n.end),o=r.endsWith(" ")&&l.startsWith(" ")?r+l.slice(1):r+l;return/^\s*$/.test(o)?"":o}const JA=["none","low","medium","high","xhigh"],e8=["low","medium","high","xhigh"];function t8(e,n){return n&&JA.includes(n)?e[n]??n:null}function n8(e,n,r){const l=e.filter(([o])=>o!=="").map(([o,u])=>({value:o,triggerLabel:o,label:o,description:u}));return r==="none"&&l.push({value:"none",triggerLabel:"none",label:"none",description:n}),l}const a8=["always-ask","read-only","allow-all","deny-all"],T1={"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 r8({value:e,onChange:n,disabled:r,direction:l="up"}){const[o,u]=b.useState(!1);return i.jsx(_a,{open:o,setOpen:u,menuClass:"w-max",portal:{direction:l,align:"left"},button:i.jsxs("button",{type:"button","aria-label":x.chat.approvalMode,title:`${x.chat.approvalMode}:${x.chat.approvalModeNames[e]??e}`,disabled:r,onClick:()=>u(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:[i.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:i.jsx("path",{d:T1[e]})}),i.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:x.chat.approvalModeNames[e]??e}),i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:i.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:a8.map(d=>i.jsxs("button",{type:"button",onClick:()=>{n(d),u(!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:[i.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:i.jsx("path",{d:T1[d]})}),i.jsx("span",{className:"min-w-0 flex-1 truncate whitespace-nowrap",children:x.chat.approvalModes[d]??d}),i.jsx("span",{className:"w-3 shrink-0 text-center",children:d===e?"✓":""})]},d))})}function lp(e){return e.displayName??e.modelId}const l8="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 $k({models:e,value:n,defaultModel:r,onPick:l}){const[o,u]=b.useState(""),[d,f]=b.useState(!1),m=C1(e,{showAll:d,query:o,selected:n,defaultModel:r}),h=d?0:C1(e,{showAll:!0,query:o,selected:n,defaultModel:r}).length-m.length;return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"border-b border-gray-100 px-2 pb-1.5 pt-0.5 dark:border-gray-800",children:i.jsx("input",{autoFocus:!0,value:o,onChange:g=>u(g.target.value),placeholder:x.models.searchPlaceholder,"aria-label":x.models.searchPlaceholder,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"})}),i.jsxs("div",{className:"max-h-56 overflow-y-auto",children:[m.length===0&&i.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:x.models.noSearchResults}),m.map(g=>i.jsxs("button",{type:"button",onClick:()=>l(g),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 ${pt(g,n)?"font-medium text-gray-900 dark:text-gray-100":"text-gray-600 dark:text-gray-400"}`,children:[i.jsx(uo,{provider:g.provider,className:"h-4 w-4 shrink-0"}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:lp(g)}),Uk(g.pricing)&&i.jsx("span",{className:"shrink-0",children:i.jsx(Lt,{tone:"yellow",children:x.models.freeBadge})}),!th(g)&&i.jsx("span",{role:"img",title:x.models.noKey,"aria-label":x.models.noKey,className:"shrink-0 text-gray-400 dark:text-gray-500",children:i.jsx(Ve,{d:l8,size:13})}),pt(g,r)&&i.jsx("span",{className:"shrink-0 text-xs text-gray-400 dark:text-gray-500",children:x.models.default}),i.jsx("span",{className:"w-3 shrink-0 text-center text-xs",children:pt(g,n)?"✓":""})]},`${g.provider}:${g.modelId}`))]}),h>0&&i.jsx("div",{className:"border-t border-gray-100 dark:border-gray-800",children:i.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:x.models.showModelsWithoutKey(h)})})]})}function s8({models:e,value:n,defaultModel:r,onChange:l,disabled:o}){const[u,d]=b.useState(!1),f=e.find(h=>pt(h,n)),m=f?lp(f):n?.modelId??"…";return i.jsx(_a,{open:u,setOpen:d,menuClass:"w-max min-w-56 origin-top-right",portal:{direction:"down",align:"right"},button:i.jsxs("button",{type:"button",title:`${x.chat.chooseModel}:${m}`,"aria-label":x.chat.chooseModel,disabled:o||e.length===0,onClick:()=>d(!u),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:[i.jsx(uo,{provider:f?.provider??n?.provider??"custom",className:"h-4 w-4 shrink-0"}),i.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:m}),i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:i.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:i.jsx($k,{models:e,value:n,...r!==void 0?{defaultModel:r}:{},onPick:h=>{l({provider:h.provider,modelId:h.modelId}),d(!1)}})})}const i8="M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z";function M1({value:e,onChange:n,disabled:r,direction:l="down"}){const[o,u]=b.useState(!1),d=e===null?"…":t8(x.chat.thinkingLevelNames,e)??"—";return i.jsxs(_a,{open:o,setOpen:u,menuClass:"w-max min-w-36",portal:{direction:l,align:"right"},button:i.jsxs("button",{type:"button",title:`${x.chat.thinkingLevel}:${d}`,"aria-label":x.chat.thinkingLevel,disabled:r||e===null,onClick:()=>u(!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:[i.jsx(Ve,{d:i8,size:14,className:"shrink-0"}),i.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:d}),i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:i.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:[i.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:x.chat.thinkingLevel}),e8.map(f=>i.jsxs("button",{type:"button",onClick:()=>{n(f),u(!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:[i.jsx("span",{className:"min-w-0 flex-1 truncate",children:x.chat.thinkingLevelNames[f]??f}),i.jsx("span",{className:"w-3 shrink-0 text-center",children:f===e?"✓":""})]},f))]})}const Bk="penguin.steerMode";function o8(){return localStorage.getItem(Bk)==="followup"?"followup":"steer"}const c8="M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6";function u8({steerMode:e,onChangeSteerMode:n,direction:r="up"}){const[l,o]=b.useState(!1),u=(d,f,m)=>i.jsx("button",{type:"button",title:m,"aria-pressed":e===d,onClick:()=>n(d),className:`h-6 rounded px-2 text-xs transition-colors duration-150 ${e===d?"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:f});return i.jsx(_a,{open:l,setOpen:o,menuClass:"w-max max-w-44",portal:{direction:r,align:"left"},button:i.jsx("button",{type:"button","aria-label":x.chat.moreSettings,title:x.chat.moreSettings,onClick:()=>o(d=>!d),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:i.jsx(Ve,{d:c8,size:15})}),children:i.jsxs("div",{className:"px-2.5 py-1.5",children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-gray-700 dark:text-gray-300",children:x.chat.steerModeLabel}),i.jsxs("div",{role:"group","aria-label":x.chat.steerModeLabel,className:"flex w-max items-center gap-0.5 rounded-md border border-gray-200 p-0.5 dark:border-gray-700",children:[u("steer",x.chat.steerModeSteer,x.chat.steerModeSteerHint),u("followup",x.chat.steerModeFollowUp,x.chat.steerModeFollowUpHint)]})]})})}function d8({skills:e,selected:n,onToggle:r,disabled:l,direction:o="up"}){const{locale:u}=Ga(),[d,f]=b.useState(!1),[m,h]=b.useState(""),g=jA(e,u,m);return i.jsxs(_a,{open:d,setOpen:f,menuClass:"w-[26rem]",portal:{direction:o,align:"left"},button:i.jsxs("button",{type:"button","aria-label":x.chat.skillsSelect,title:x.chat.skillsSelect,disabled:l,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:[i.jsx(Ve,{d:np,size:14,className:"shrink-0"}),i.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:x.chat.skillsSelect}),n.length>0&&i.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}),i.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",className:"shrink-0","aria-hidden":!0,children:i.jsx("path",{d:"M3 4.5l3 3 3-3",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),children:[i.jsx("div",{className:"border-b border-gray-100 px-2 pb-1.5 pt-0.5 dark:border-gray-800",children:i.jsx("input",{autoFocus:!0,value:m,onChange:y=>h(y.target.value),placeholder:x.chat.skillsSearchPlaceholder,"aria-label":x.chat.skillsSearchPlaceholder,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"})}),i.jsx("div",{className:"max-h-56 overflow-y-auto",children:e.length===0?i.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:x.chat.skillsEmptyHint}):g.length===0?i.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:x.chat.skillsNoMatch}):g.map(y=>{const k=n.includes(y.name);return i.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:[i.jsx(ap,{icon:y.icon,size:14,className:"shrink-0 text-gray-400 dark:text-gray-500"}),i.jsx("span",{className:"shrink-0 font-mono",children:y.name}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-gray-400 dark:text-gray-500",children:co(u,y)}),i.jsx("span",{className:"w-3 shrink-0 text-center",children:k?"✓":""})]},y.name)})})]})}function f8({now:e,window:n,unknown:r=!1}){const l=Lk(n),o=r?0:Math.min(1,e/l),u=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 i.jsxs("span",{title:r?x.chat.contextUnknown:`${x.chat.contextUsage} ${Math.round(o*100)}%`,className:`flex shrink-0 items-center gap-1 font-mono ${u}`,children:[i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":!0,className:"block shrink-0",children:[i.jsx("circle",{cx:"7",cy:"7",r:d,fill:"none",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"2"}),i.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)"})]}),i.jsxs("span",{className:"hidden @md:inline",children:[r?"—":ut(e),"/",ut(l)]})]})}function Hk({status:e,onSend:n,onSteer:r,steeringDeliveredCount:l,onQueueFollowUp:o,queuedFollowUps:u=0,onStop:d,onCompact:f,modelRef:m,models:h,onChangeModel:g,onSwitchModel:y,defaultModel:k,thinkingLevel:w,onChangeThinkingLevel:N,turnThinkingLevel:C,onChangeTurnThinkingLevel:j,contextWindow:E,contextNow:L,contextStale:_=!1,vision:q,approvalMode:H,onChangeApprovalMode:I,modeSaving:P,autoFocus:ee,agents:Z,skills:D,initialSkills:V,onSkillsChange:B,onHandoff:Y,initialText:ne,onTextChange:U,initialHandoffTargetId:z,onHandoffTargetChange:$}){const{locale:G}=Ga(),[me,M]=b.useState(ne??""),R=b.useRef(me);R.current=me;const[O,T]=b.useState([]),[X,ae]=b.useState(!1),[oe,ge]=b.useState(0),[Te,se]=b.useState(null),[pe,be]=b.useState(!1),Pe=b.useRef(null),Ze=b.useRef(null),[De,dt]=b.useState(),[at,Mt]=b.useState(null),[rt,je]=b.useState(V??[]),[qe,wt]=b.useState(0),[$t,At]=b.useState(0),[St,ba]=b.useState(null),ie=b.useRef(null),[ye]=b.useState(()=>window.matchMedia("(max-width: 767px)").matches),we=e==="running",Oe=e==="compacting",Fe=!we&&!Oe&&!X&&(me.trim().length>0||O.length>0||at!==null||rt.length>0),Ot=we&&!X&&r!==void 0&&at===null&&me.trim().length>0,[nn,Pt]=b.useState(o8),gt=ce=>{Pt(ce),localStorage.setItem(Bk,ce)},zt=nn==="followup"&&o!==void 0,xe=we&&!X&&zt&&(me.trim().length>0||O.length>0||at!==null||rt.length>0),Ce=zt?xe:Ot,tt=zt?x.chat.followUpSend:x.chat.steerSend,ft=we&&me.trim().length===0&&O.length===0&&at===null&&rt.length===0,[jt,xt]=b.useState(!1),Bt=b.useRef(0);b.useEffect(()=>{jt&&(!we||(l??0)>Bt.current)&&xt(!1)},[jt,we,l]);const en=b.useCallback(ce=>{const K=rt.includes(ce)?rt.filter(de=>de!==ce):[...rt,ce];je(K),B?.(K)},[rt,B]),_n=b.useRef(null),Ya=b.useMemo(()=>{const ce=()=>{const K=_n.current,de=K?ZA(R.current,K):"";M(de),U?.(de),requestAnimationFrame(Ln)};return[{cmd:"/compact",desc:x.chat.compact,run:()=>{ce(),f()}},...y&&h&&h.length>0?[{cmd:"/model",desc:x.chat.switchModel,run:()=>{ce(),be(!0)}}]:[],...CA(D,G).map(K=>({cmd:K.cmd,desc:K.desc,run:()=>{ce(),en(K.name)}}))]},[f,y,h,U,D,G,en]),La=!we&&!Oe&&!pe?N1(me,qe):null;_n.current=La;const Xn=La&&La.start!==Te?Ya.filter(ce=>ce.cmd.startsWith(`/${La.query}`)):[],Zn=Xn.length>0,ka=Xn[Math.min(oe,Xn.length-1)],Jn=!we&&!Oe&&!Zn&&!pe?w1(me,qe):null,kn=Jn&&Jn.start!==St?EA(Z,Jn.query):[],Ia=kn.length>0,wr=kn[Math.min($t,kn.length-1)];b.useEffect(()=>{if(!pe)return;const ce=de=>{Pe.current&&!Pe.current.contains(de.target)&&be(!1)},K=de=>{de.key==="Escape"&&be(!1)};return window.addEventListener("mousedown",ce),window.addEventListener("keydown",K),()=>{window.removeEventListener("mousedown",ce),window.removeEventListener("keydown",K)}},[pe]);const ll=async ce=>{if(be(!1),!y||X||we||Oe||pt(ce,m))return;const de=R.current.trim()||(rt.length>0?x.chat.skillsAutoMessage(rt):x.chat.modelSwitchAutoMessage),Ee=[{type:"text",text:Um(rt,de)}];for(const lt of O)Ee.push({type:"image_url",imageUrl:lt});ae(!0);try{await y({provider:ce.provider,modelId:ce.modelId},Ee)&&(M(""),T([]),je([]),requestAnimationFrame(Ln))}finally{ae(!1),ie.current?.focus()}};b.useEffect(()=>{if(!Zn&&!Ia&&!pe)return;const ce=()=>{const K=Ze.current;if(!K)return;let de=0;for(let Ee=K.parentElement;Ee;Ee=Ee.parentElement)if(getComputedStyle(Ee).overflowY!=="visible"){de=Ee.getBoundingClientRect().top;break}const Se=K.getBoundingClientRect().top-de-14;dt(Math.max(96,Math.min(320,Math.round(Se))))};return ce(),window.addEventListener("resize",ce),()=>window.removeEventListener("resize",ce)},[Zn,Ia,pe]);const Ln=()=>{const ce=ie.current;ce&&(ce.style.height="auto",ce.style.height=`${Math.min(ce.scrollHeight,176)}px`)};b.useEffect(()=>{Ln();const ce=ie.current;if(ce&&ce.value.length>0){const K=ce.value.length;ce.setSelectionRange(K,K),ce.scrollTop=ce.scrollHeight,wt(K)}},[]);const Sr=b.useRef(!1);b.useEffect(()=>{if(!Sr.current&&(Sr.current=!0,D.length===0))return;const ce=rt.filter(K=>D.some(de=>de.name===K));ce.length!==rt.length&&(je(ce),B?.(ce))},[D,rt,B]);const Qa=b.useRef(!1);b.useEffect(()=>{if(Qa.current||!z||Z.length===0)return;Qa.current=!0;const ce=Z.find(K=>K.agentId===z);ce&&Mt(ce)},[Z,z]);const In=ce=>{const K=ie.current;if(!Jn||!K)return;let{start:de,end:Se}=Jn;K.value[Se]===" "?Se++:de>0&&K.value[de-1]===" "&&de--;const Ee=K.value.slice(0,de)+K.value.slice(Se);K.value=Ee,K.setSelectionRange(de,de),K.focus(),Mt(ce),$?.(ce.agentId),M(Ee),U?.(Ee),wt(de),At(0),Ln()},Ht=async(ce=n)=>{const K=me.trim(),de=at?{agent:at,rest:K}:AA(K,Z),Se=de?de.rest:K,Ee=rt.length>0&&Se===""?x.chat.skillsAutoMessage(rt):Se,lt=Um(rt,Ee),st=[];lt&&st.push({type:"text",text:lt});for(const Je of O)st.push({type:"image_url",imageUrl:Je});ae(!0);try{(de?await Y(de.agent,st):await ce(st))&&(M(""),T([]),Mt(null),je([]),requestAnimationFrame(Ln))}finally{ae(!1),ie.current?.focus()}},Kt=async()=>{if(we){if(zt){if(!xe)return;await Ht(o);return}if(!Ot)return;const ce=me.trim();ae(!0);let K="failed";try{K=await r(ce),K==="queued"&&(Bt.current=l??0,xt(!0),M(""),requestAnimationFrame(Ln))}finally{ae(!1),ie.current?.focus()}K==="not_running"&&await Ht();return}Fe&&await Ht()},Oa=ce=>{if(Zn){if(ce.key==="ArrowDown"){ce.preventDefault(),ge(K=>(K+1)%Xn.length);return}if(ce.key==="ArrowUp"){ce.preventDefault(),ge(K=>(K-1+Xn.length)%Xn.length);return}if((ce.key==="Enter"&&!ce.shiftKey||ce.key==="Tab")&&!ce.nativeEvent.isComposing){ce.preventDefault(),ka?.run();return}if(ce.key==="Escape"){se(La?.start??null);return}}if(Ia){if(ce.key==="ArrowDown"){ce.preventDefault(),At(K=>(K+1)%kn.length);return}if(ce.key==="ArrowUp"){ce.preventDefault(),At(K=>(K-1+kn.length)%kn.length);return}if((ce.key==="Enter"&&!ce.shiftKey||ce.key==="Tab")&&!ce.nativeEvent.isComposing){ce.preventDefault(),wr&&In(wr);return}if(ce.key==="Escape"){ba(Jn?.start??null);return}}if(ce.key==="Backspace"&&at!==null&&ce.currentTarget.selectionStart===0&&ce.currentTarget.selectionEnd===0){ce.preventDefault(),Mt(null),$?.(null);return}ce.key==="Enter"&&!ce.shiftKey&&!ce.nativeEvent.isComposing&&(ce.preventDefault(),Kt())},jr=ce=>{for(const K of ce){if(!K.type.startsWith("image/"))continue;const de=new FileReader;de.onload=()=>{typeof de.result=="string"&&T(Se=>[...Se,de.result])},de.readAsDataURL(K)}},_s=ce=>{const K=[];for(const de of ce.clipboardData.items)if(de.kind==="file"){const Se=de.getAsFile();Se&&K.push(Se)}K.length>0&&(ce.preventDefault(),jr(K))},Ls=ce=>{ce.target.files&&jr(ce.target.files),ce.target.value=""};return i.jsxs("div",{className:"relative",ref:Ze,children:[Zn&&i.jsx("div",{style:{maxHeight:De},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:Xn.map((ce,K)=>i.jsxs("button",{type:"button",ref:ce===ka?de=>de?.scrollIntoView({block:"nearest"}):void 0,onMouseEnter:()=>ge(K),onClick:()=>ce.run(),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm ${ce===ka?"bg-gray-100 dark:bg-gray-800":""}`,children:[i.jsx("span",{className:"shrink-0 font-mono text-gray-800 dark:text-gray-200",children:ce.cmd}),i.jsx("span",{title:ce.desc,className:"min-w-0 flex-1 truncate text-xs text-gray-500 dark:text-gray-400",children:ce.desc})]},ce.cmd))}),pe&&h&&i.jsxs("div",{ref:Pe,style:{maxHeight:De},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:[i.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:x.chat.switchModelTitle}),i.jsx($k,{models:h,value:m,...k!==void 0?{defaultModel:k}:{},onPick:ce=>{ll(ce)}})]}),Ia&&i.jsx("div",{style:{maxHeight:Math.min(256,De??256)},className:"anim-pop absolute bottom-full left-0 z-40 mb-1.5 w-72 overflow-y-auto rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-900",children:kn.map((ce,K)=>i.jsxs("button",{type:"button",onMouseEnter:()=>At(K),onClick:()=>In(ce),className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm ${ce===wr?"bg-gray-100 dark:bg-gray-800":""}`,children:[i.jsxs("span",{className:"shrink-0 font-mono text-gray-800 dark:text-gray-200",children:["@",ce.agentId]}),ce.name&&ce.name!==ce.agentId&&i.jsx("span",{className:"min-w-0 truncate text-xs text-gray-500 dark:text-gray-400",children:ce.name})]},ce.agentId))}),O.length>0&&i.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:O.map((ce,K)=>i.jsxs("div",{className:"anim-pop relative",children:[i.jsx(Al,{src:ce,alt:x.chat.imageAlt,className:"h-16 w-16 rounded-md border border-gray-200 object-cover dark:border-gray-700"}),i.jsx("button",{type:"button","aria-label":x.chat.removeImage,onClick:()=>T(de=>de.filter((Se,Ee)=>Ee!==K)),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:"×"})]},K))}),!q&&O.length>0&&i.jsx("p",{className:"anim-fade mb-1 text-xs text-gray-400 dark:text-gray-500",children:x.chat.imagesAsPathHint}),jt&&i.jsx("p",{className:"anim-fade mb-1 text-xs text-gray-400 dark:text-gray-500",children:x.chat.steerQueuedIndicator}),u>0&&i.jsx("p",{className:"anim-fade mb-1 text-xs text-gray-400 dark:text-gray-500",children:x.chat.followUpQueuedChip(u)}),i.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",children:[(at!==null||rt.length>0)&&i.jsxs("div",{className:"mb-1 flex flex-wrap items-center gap-1",children:[at!==null&&i.jsxs("span",{className:"anim-pop flex max-w-48 items-center gap-0.5 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",...at.name&&at.name!==at.agentId?{title:at.name}:{},children:[i.jsxs("span",{className:"truncate",children:["@",at.agentId]}),i.jsx("button",{type:"button","aria-label":x.chat.mentionRemove,onClick:()=>{Mt(null),$?.(null),ie.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.map(ce=>{const K=D.find(de=>de.name===ce);return i.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",...K?{title:co(G,K)}:{},children:[i.jsx(ap,{icon:K?.icon,size:13,className:"shrink-0 text-gray-500 dark:text-gray-400"}),i.jsx("span",{className:"truncate",children:ce}),i.jsx("button",{type:"button","aria-label":`${x.chat.skillRemove} ${ce}`,onClick:()=>en(ce),className:"shrink-0 rounded p-0.5 text-gray-400 transition-colors duration-150 hover:text-gray-700 dark:hover:text-gray-200",children:"×"})]},ce)})]}),i.jsx("textarea",{ref:ie,rows:2,value:me,autoFocus:ee,onChange:ce=>{const K=ce.target.value,de=ce.target.selectionStart??K.length;M(K),U?.(K),wt(de),ge(0),At(0),se(Se=>{if(Se===null)return null;const Ee=N1(K,de);return Ee&&Ee.start===Se?Se:null}),ba(Se=>{if(Se===null)return null;const Ee=w1(K,de);return Ee&&Ee.start===Se?Se:null}),Ln()},onSelect:ce=>wt(ce.currentTarget.selectionStart??0),onKeyDown:Oa,onPaste:_s,placeholder:we&&zt?ye?x.chat.followUpPlaceholderShort:x.chat.followUpPlaceholder:we&&r?ye?x.chat.steerPlaceholderShort:x.chat.steerPlaceholder:ye?x.chat.inputPlaceholderShort:x.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"}),i.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2 text-xs",children:[i.jsxs("div",{className:"no-scrollbar flex min-w-0 flex-1 items-center gap-2 overflow-x-auto",children:[i.jsxs("label",{className:"flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-md 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",title:q?x.chat.imageAlt:x.chat.imagesAsPathHint,children:[i.jsx("input",{type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:Ls}),i.jsxs("svg",{width:"17",height:"17",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"block",children:[i.jsx("rect",{x:"3",y:"5",width:"18",height:"14",rx:"3"}),i.jsx("path",{d:"M3 15l5-5 4 4 3-3 6 6"})]})]}),i.jsx(r8,{value:H,onChange:I,disabled:P,direction:h&&g?"down":"up"}),i.jsx(d8,{skills:D,selected:rt,onToggle:en,disabled:we||Oe||X,direction:h&&g?"down":"up"}),i.jsx(u8,{steerMode:nn,onChangeSteerMode:gt,direction:h&&g?"down":"up"}),i.jsxs("span",{title:`${x.chat.slashHint} · ${x.chat.mentionHint}`,className:"hidden min-w-0 truncate text-gray-300 @lg:block dark:text-gray-600",children:[x.chat.slashHint," · ",x.chat.mentionHint]})]}),i.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[!g&&i.jsx(f8,{now:L,unknown:_,...E!==void 0?{window:E}:{}}),h&&g&&N&&i.jsx(M1,{value:w??null,onChange:N,disabled:X}),!g&&j&&i.jsx(M1,{value:C??"",onChange:j,disabled:X,direction:"up"}),h&&g?i.jsx(s8,{models:h,value:m,...k!==void 0?{defaultModel:k}:{},onChange:g,disabled:X}):i.jsxs("span",{title:m?.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:[i.jsx(uo,{provider:m?.provider??"custom",className:"h-4 w-4 shrink-0"}),i.jsx("span",{className:"hidden min-w-0 truncate @md:block",children:(()=>{const ce=h?.find(K=>pt(K,m));return ce?lp(ce):m?.modelId??"…"})()})]}),i.jsx("button",{type:"button",title:ft?x.chat.stop:we?tt:x.chat.send,"aria-label":ft?x.chat.stop:we?tt:x.chat.send,disabled:ft?!1:we?!Ce:!Fe,onClick:()=>ft?void d():void Kt(),className:ft?"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:ft?i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14","aria-hidden":!0,className:"block",children:i.jsx("rect",{x:"2",y:"2",width:"10",height:"10",rx:"2",fill:"currentColor"})}):i.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:i.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})})})]})]})]})]})}function Pk({className:e}){return i.jsx("img",{src:"/penguin-logo.svg",alt:"","aria-hidden":!0,draggable:!1,className:`select-none ${e??"h-9 w-9 rounded-lg"}`})}const m8=["always-ask","read-only","allow-all","deny-all"],Ss=(e,n)=>`penguin.chatDraft.${e}.${n}`,qk=(e,n)=>`penguin.chatDraft.session.${e}.${n}`;function h8(e){if(!e)return{};try{const n=JSON.parse(e);if(typeof n!="object"||n===null)return{};const r=n,l={};if(typeof r.text=="string"&&(l.text=r.text),typeof r.agentId=="string"&&(l.agentId=r.agentId),typeof r.workspace=="string"&&(l.workspace=r.workspace),typeof r.modelRef=="object"&&r.modelRef!==null){const o=r.modelRef;typeof o.provider=="string"&&typeof o.modelId=="string"&&(l.modelRef={provider:o.provider,modelId:o.modelId})}if(typeof r.handoffAgentId=="string"&&(l.handoffAgentId=r.handoffAgentId),Array.isArray(r.skills)){const o=r.skills.filter(u=>typeof u=="string");o.length>0&&(l.skills=o)}return typeof r.approvalMode=="string"&&m8.includes(r.approvalMode)&&(l.approvalMode=r.approvalMode),l}catch{return{}}}function Ru(e,n=localStorage){try{return h8(n.getItem(e))}catch{return{}}}function Ji(e,n,r=localStorage){try{r.setItem(e,JSON.stringify(n))}catch{}}function du(e,n=localStorage){try{n.removeItem(e)}catch{}}const p8=300;function E1(e){try{return sessionStorage.getItem(`penguin.chatRouteApplied.${e}`)}catch{return null}}function A1(e,n){try{sessionStorage.setItem(`penguin.chatRouteApplied.${e}`,n)}catch{}}const g8=[{id:"game",skills:["web-design"]},{id:"lol",skills:["web-design"]},{id:"rag",skills:["penguin-sdk","web-design"]}];function x8({projectId:e,models:n}){const r=Qn(),l=Yn(),{agents:o,currentAgent:u,setCurrentAgentId:d}=fn(),{add:f}=ao(),m=bn().user?.userId??null,[h]=b.useState(()=>m?Ru(Ss(m,e)):{}),[g,y]=b.useState(h.agentId??u?.agentId??null),[k,w]=b.useState(h.workspace??""),[N,C]=b.useState(h.approvalMode??"allow-all"),[j,E]=b.useState(h.modelRef??null),[L,_]=b.useState(h.handoffAgentId??null),q=b.useRef(h.text??""),H=b.useRef(h.skills??[]),I=l.state,P=I?.agentId,ee=b.useRef(null);b.useEffect(()=>{if(o.length===0)return;const je=qe=>!!qe&&o.some(wt=>wt.agentId===qe);if(P&&ee.current!==l.key&&E1("agentId")!==l.key&&(ee.current=l.key,A1("agentId",l.key),je(P))){y(P);return}je(g)||y((o.find(qe=>qe.agentId==="default_agent")??o[0])?.agentId??null)},[o,g,l.key,P]);const Z=I?.workspace,D=b.useRef(null);b.useEffect(()=>{Z===void 0||D.current===l.key||E1("workspace")===l.key||(D.current=l.key,A1("workspace",l.key),w(Z))},[l.key,Z]),b.useEffect(()=>{if(!n||j&&n.models.some(qe=>pt(qe,j)))return;const je=n.models[0];E(n.defaultModel??(je?{provider:je.provider,modelId:je.modelId}:null))},[n,j]);const[V,B]=b.useState(null);b.useEffect(()=>{if(B(null),!g)return;let je=!1;return uh(e,g).then(qe=>{je||B(qe.config.model?.thinkingLevel??"")}).catch(()=>{}),()=>{je=!0}},[e,g]);const Y=b.useRef(null);Y.current=V;const ne=b.useCallback(je=>{if(!g||!je)return;const qe=Y.current;B(je),Tv(e,g,{config:{model:{thinkingLevel:je}}}).catch(wt=>{B(qe),Et(ze(wt))})},[e,g]),[U,z]=b.useState([]),[$,G]=b.useState(!1);b.useEffect(()=>{if(z(qe=>qe.length>0?[]:qe),G(!1),!g)return;let je=!1;return dh(e,g).then(qe=>{je||z(qe.skills)}).catch(()=>{}).finally(()=>{je||G(!0)}),()=>{je=!0}},[e,g]);const me=b.useRef(null),M=b.useCallback(()=>{me.current!==null&&(window.clearTimeout(me.current),me.current=null)},[]),R=b.useCallback(()=>{if(M(),!m)return;const je={text:q.current,workspace:k,approvalMode:N};g&&(je.agentId=g),j&&(je.modelRef=j),L&&(je.handoffAgentId=L),H.current.length>0&&(je.skills=H.current),Ji(Ss(m,e),je)},[M,m,e,g,k,N,j,L]),O=b.useRef(R);b.useEffect(()=>{O.current=R,R()},[R]);const T=b.useCallback(je=>{q.current=je,M(),me.current=window.setTimeout(()=>{me.current=null,O.current()},p8)},[M]),X=b.useCallback(je=>{H.current=je,O.current()},[]);b.useEffect(()=>()=>{me.current!==null&&(window.clearTimeout(me.current),O.current())},[]);const ae=b.useCallback(()=>{M(),H.current=[],m&&(j?Ji(Ss(m,e),{modelRef:j}):du(Ss(m,e)))},[M,m,e,j]),oe=je=>{y(je.agentId),d(je.agentId)},ge=b.useRef(!1),[Te,se]=b.useState(!1),pe=b.useCallback(async(je,qe=!1)=>{if(!g||ge.current)return!1;ge.current=!0,se(!0);let wt=null;try{const $t={approvalMode:N};j&&($t.modelId=j.modelId,$t.provider=j.provider),k.trim()&&($t.workspace=k.trim());const At=await Zc(e,g,$t);wt=At.session.sessionId;const St=await ws(wt,{input:je});return f(At.session),qe||ae(),r(`/chat/${St.sessionId}`,{replace:!0}),!0}catch($t){return wt&&Ki(wt).catch(()=>{}),Et(ze($t,j?{modelId:j.modelId}:{})),!1}finally{ge.current=!1,se(!1)}},[e,g,N,j,k,f,ae,r]),[be,Pe]=b.useState(null),Ze=b.useCallback(async je=>{if(be===null){Pe(je.id);try{const qe=je.skills.filter(wt=>U.some($t=>$t.name===wt));await pe([{type:"text",text:Um(qe,x.chat.exampleTasks[je.id].prompt)}],!0)}finally{Pe(null)}}},[be,U,pe]),De=o.find(je=>je.agentId===g)??null,dt=b.useCallback(async(je,qe)=>{if(!De||ge.current)return!1;ge.current=!0,se(!0);const wt={type:"text",text:Ak({agentId:De.agentId,...De.name!==void 0?{agentName:De.name}:{}})};let $t=null;try{const At=await Zc(e,je.agentId,{approvalMode:N});$t=At.session.sessionId;const St=await ws($t,{input:[wt,...qe]});return f(At.session),ae(),r(`/chat/${St.sessionId}`),!0}catch(At){return $t&&Ki($t).catch(()=>{}),Et(ze(At,n?.defaultModel?{modelId:n.defaultModel.modelId}:{})),!1}finally{ge.current=!1,se(!1)}},[e,De,N,f,ae,r,n]),at=n?.models.find(je=>pt(je,j)),Mt=at?.contextWindow,rt=at?.vision!==!1;return i.jsxs("div",{className:"anim-fade flex min-h-0 flex-1 flex-col overflow-y-auto px-3 py-6 md:px-4",children:[i.jsx("div",{className:"flex-1"}),i.jsxs("div",{className:"mx-auto w-full max-w-3xl",children:[i.jsxs("div",{className:"mb-10 text-center",children:[i.jsx(Pk,{className:"mx-auto mb-1 h-36 w-36 rounded-3xl"}),i.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-gray-900 dark:text-gray-100",children:x.appName}),i.jsx("p",{className:"mt-2 text-base text-gray-400 dark:text-gray-500",children:x.chat.draftSubtitle})]}),i.jsx(Hk,{status:"idle",onSend:pe,onStop:async()=>{},onCompact:async()=>{},modelRef:j,models:n?.models??[],onChangeModel:E,thinkingLevel:V,onChangeThinkingLevel:ne,...n?.defaultModel!==void 0?{defaultModel:n.defaultModel}:{},...Mt!==void 0?{contextWindow:Mt}:{},contextNow:0,vision:rt,approvalMode:N,onChangeApprovalMode:C,modeSaving:!1,autoFocus:!0,agents:o,skills:U,...h.skills&&h.skills.length>0?{initialSkills:h.skills}:{},onSkillsChange:X,onHandoff:dt,initialText:h.text??"",onTextChange:T,...h.handoffAgentId?{initialHandoffTargetId:h.handoffAgentId}:{},onHandoffTargetChange:_}),i.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[i.jsx(y8,{agents:o,selected:De,onSelect:oe}),i.jsx(v8,{projectId:e,workspace:k,onChange:w})]}),i.jsx("div",{className:"mt-6 flex flex-col items-stretch gap-2",children:g8.map(je=>{const qe=x.chat.exampleTasks[je.id];return i.jsxs("button",{type:"button",disabled:be!==null||Te||!$||!g||!n,onClick:()=>{Ze(je)},className:"group flex min-w-0 items-center gap-3 rounded-xl border border-gray-200 bg-white px-4 py-3 text-left transition-colors duration-150 hover:border-gray-300 disabled:cursor-default disabled:opacity-60 dark:border-gray-800 dark:bg-gray-900 dark:hover:border-gray-700",children:[je.id==="lol"?i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"shrink-0 text-brand-500 dark:text-brand-400","aria-hidden":!0,children:[i.jsx("path",{d:"M9 18V6l11-2v12",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("circle",{cx:"6.5",cy:"18",r:"2.5",strokeWidth:"1.7"}),i.jsx("circle",{cx:"17.5",cy:"16",r:"2.5",strokeWidth:"1.7"})]}):je.id==="game"?i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"shrink-0 text-brand-500 dark:text-brand-400","aria-hidden":!0,children:[i.jsx("path",{d:"M6.7 6h10.6a4 4 0 0 1 3.97 3.56c.2 1.8.73 5.05.73 6.44a3 3 0 0 1-3 3c-1 0-1.5-.5-2-1l-1.4-1.4a2 2 0 0 0-1.42-.6H9.82a2 2 0 0 0-1.41.6L7 18c-.5.5-1 1-2 1a3 3 0 0 1-3-3c0-1.39.52-4.64.73-6.44A4 4 0 0 1 6.7 6z",strokeWidth:"1.7",strokeLinejoin:"round"}),i.jsx("path",{d:"M6.5 11h4M8.5 9v4M15 12h.01M18 10h.01",strokeWidth:"1.7",strokeLinecap:"round"})]}):i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"shrink-0 text-brand-500 dark:text-brand-400","aria-hidden":!0,children:[i.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z",strokeWidth:"1.7",strokeLinejoin:"round"}),i.jsx("path",{d:"M18.5 15.5l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1-2.1-.9 2.1-.9.9-2.1z",strokeWidth:"1.4",strokeLinejoin:"round"})]}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate text-sm font-medium text-gray-900 dark:text-gray-100",children:qe.label}),i.jsx("span",{className:"line-clamp-2 text-xs text-gray-500 dark:text-gray-400",children:qe.desc})]}),be===je.id?i.jsx("span",{className:"ml-1 shrink-0 text-xs text-gray-400",children:x.common.loading}):i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",className:"ml-1 shrink-0 text-gray-300 transition-colors duration-150 group-hover:text-gray-500 dark:text-gray-600 dark:group-hover:text-gray-400","aria-hidden":!0,children:i.jsx("path",{d:"M5 12h14M13 6l6 6-6 6",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round"})})]},je.id)})})]}),i.jsx("div",{className:"flex-1"})]})}const Fk="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 y8({agents:e,selected:n,onSelect:r}){const[l,o]=b.useState(!1);return i.jsx(_a,{open:l,setOpen:o,menuClass:"left-0 top-full mt-1 w-72 max-w-[calc(100vw-2rem)] origin-top-left",button:i.jsxs("button",{type:"button",title:x.chat.chooseAgent,"aria-label":x.chat.chooseAgent,onClick:()=>o(!l),className:Fk,children:[n?i.jsx(tl,{id:n.agentId,name:hn(n),size:16,className:"shrink-0 rounded"}):null,i.jsx("span",{className:"min-w-0 truncate",children:n?hn(n):x.common.loading}),i.jsx(gn,{open:l,size:12,className:"shrink-0 text-gray-400"})]}),children:i.jsxs("div",{className:"max-h-56 overflow-y-auto",children:[e.length===0&&i.jsx("p",{className:"px-3 py-1.5 text-xs text-gray-400",children:x.common.loading}),e.map(u=>{const d=u.agentId===n?.agentId;return i.jsxs("button",{type:"button","aria-pressed":d,onClick:()=>{r(u),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:[i.jsx(tl,{id:u.agentId,name:hn(u),size:20,className:"shrink-0 rounded"}),i.jsxs("span",{className:"min-w-0 flex-1",children:[i.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(u)}),u.description&&i.jsx("span",{className:"block truncate text-[11px] text-gray-400 dark:text-gray-500",children:u.description})]}),i.jsx("span",{className:"w-4 shrink-0 text-center text-xs text-gray-500 dark:text-gray-400",children:d?"✓":""})]},u.agentId)})]})})}function v8({projectId:e,workspace:n,onChange:r}){const[l,o]=b.useState(!1),[u,d]=b.useState({right:!1}),f=b.useRef(!1),[m,h]=b.useState(null),[g,y]=b.useState(!1),[k,w]=b.useState(null),[N,C]=b.useState("");b.useEffect(()=>{C(m?.path??"")},[m]);const j=b.useCallback(P=>{y(!0),w(null),cy(e,P).then(h).catch(ee=>w(ze(ee))).finally(()=>y(!1))},[e]),E=P=>{const ee=!l;if(ee){const Z=P.currentTarget.getBoundingClientRect(),D=parseFloat(getComputedStyle(document.documentElement).fontSize),V=12,B=Math.min(20*D,window.innerWidth-2*D),Y=window.innerWidth-V-Z.left,ne=Z.right-V;Y>=B?d({right:!1}):ne>Y?d({right:!0,...ne<B?{maxWidth:ne}:{}}):d({right:!1,maxWidth:Y})}if(o(ee),ee&&!f.current){f.current=!0;const Z=n.trim();j(Z.startsWith("/")?Z:"")}},L=async()=>{const P=N.trim();if(!P||P===m?.path){C(m?.path??"");return}try{h(await cy(e,P))}catch{Et(x.chat.workspaceDirInvalid),C(m?.path??"")}},_=n.trim(),q=_?_.split("/").filter(Boolean).pop()??"/":x.chat.workspaceAuto,H=m?.parent??null,I=(m?.entries??[]).filter(P=>!P.name.startsWith("."));return i.jsx(_a,{open:l,setOpen:o,menuClass:`top-full mt-1 w-80 max-w-[calc(100vw-2rem)] ${u.right?"right-0 origin-top-right":"left-0 origin-top-left"}`,...u.maxWidth!==void 0?{menuStyle:{maxWidth:u.maxWidth}}:{},button:i.jsxs("button",{type:"button",title:_?`${x.chat.workspace}:${_}`:x.chat.workspaceHint,"aria-label":x.chat.workspace,onClick:E,className:Fk,children:[i.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:i.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"})}),i.jsx("span",{className:`min-w-0 truncate ${_?"font-mono":""}`,children:q}),i.jsx(gn,{open:l,size:12,className:"shrink-0 text-gray-400"})]}),children:i.jsxs("div",{className:"space-y-1.5 px-2.5 pb-2.5 pt-2",children:[i.jsxs("div",{className:"rounded-md border border-gray-200 dark:border-gray-800",children:[i.jsxs("div",{className:"flex items-center gap-1.5 border-b border-gray-100 px-1.5 py-1 dark:border-gray-800",children:[i.jsx("input",{value:N,placeholder:"…","aria-label":x.chat.workspace,onChange:P=>C(P.target.value),onBlur:()=>{L()},onKeyDown:P=>{P.key==="Enter"&&!P.nativeEvent.isComposing?(P.preventDefault(),L()):P.key==="Escape"&&C(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"}),i.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:x.chat.workspaceUseThis})]}),i.jsxs("ul",{className:"max-h-40 overflow-y-auto py-1",children:[H!==null&&i.jsx("li",{children:i.jsxs("button",{type:"button",onClick:()=>j(H),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:["↰ ",x.chat.workspaceUp]})}),I.map(P=>i.jsx("li",{children:i.jsxs("button",{type:"button",onClick:()=>j(P.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:[i.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:i.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"})}),i.jsx("span",{className:"min-w-0 flex-1 truncate",children:P.name})]})},P.path)),m&&I.length===0&&i.jsx("li",{className:"px-2.5 py-1.5 text-xs text-gray-400",children:x.chat.workspaceNoSubdirs}),g&&i.jsx("li",{className:"px-2.5 py-1.5 text-xs text-gray-400",children:x.common.loading}),k&&i.jsxs("li",{className:"flex items-center justify-between gap-2 px-2.5 py-1.5 text-xs text-red-500",children:[i.jsx("span",{className:"min-w-0 flex-1 truncate",title:k,children:k}),i.jsx("button",{type:"button",onClick:()=>j(""),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:x.common.retry})]})]})]}),_&&i.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:x.chat.workspaceClear}),i.jsx("p",{className:"px-0.5 text-xs leading-5 text-gray-400 dark:text-gray-500",children:x.chat.workspaceHint})]})})}const nh={damping:1,response:.35},R1={damping:.8,response:.3};function b8(e,n,r,l,o){const u=2*Math.PI/l.response,d=u*u,f=2*l.damping*u;let m=e,h=n,g=Math.min(o,64);for(;g>0;){const y=Math.min(g,8)/1e3,k=-d*(m-r)-f*h;h+=k*y,m+=h*y,g-=8}return[m,h]}function _1(e,n,r){return Math.abs(e-r)<.5&&Math.abs(n)<5}function k8(e,n){let r=e,l=0,o=e,u=nh,d,f=0,m=0;const h=()=>{f&&cancelAnimationFrame(f),f=0,m=0,d=void 0},g=y=>{const k=m?y-m:16;if(m=y,[r,l]=b8(r,l,o,u,k),_1(r,l,o)){r=o,l=0,f=0,m=0,n(r);const w=d;d=void 0,w?.();return}n(r),f=requestAnimationFrame(g)};return{get value(){return r},get velocity(){return l},animateTo(y,k,w){if(o=y,u=k,w?.velocity!==void 0&&(l=w.velocity),d=w?.onSettle,_1(r,l,o)){r=o,l=0,n(r);const N=d;d=void 0,N?.();return}f||(f=requestAnimationFrame(g))},stop(){return h(),[r,l]},set(y){h(),r=y,l=0,n(r)},dispose:h}}function w8(e,n=.998){return e/1e3*n/(1-n)}function S8(e,n,r=.55){return e*n*r/(n+r*Math.abs(e))}function j8(e,n){let r=n[0];for(const l of n)Math.abs(l-e)<Math.abs(r-e)&&(r=l);return r}const C8=.92,N8=.6;function T8(){const[e,n]=b.useState(()=>window.matchMedia("(prefers-reduced-motion: reduce)").matches);return b.useEffect(()=>{const r=window.matchMedia("(prefers-reduced-motion: reduce)"),l=o=>n(o.matches);return r.addEventListener("change",l),()=>r.removeEventListener("change",l)},[]),e}function M8({open:e,snap:n,onSnapChange:r,onClose:l,title:o,children:u}){const[d,f]=b.useState(e),m=b.useRef(null),h=b.useRef(null),g=b.useRef(null),y=b.useRef(0),k=b.useRef(!1),w=b.useRef(!1),N=b.useRef(null),C=b.useRef([]),j=b.useRef({pointerY:0,sheetY:0}),E=b.useRef(e);E.current=e;const L=b.useRef(null),_=T8(),q=b.useCallback(V=>{const B=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/B))))},[]),H=b.useCallback(V=>{const B=y.current;return V==="full"?0:B*(1-N8/C8)},[]);b.useEffect(()=>{e&&f(!0)},[e]),b.useLayoutEffect(()=>{if(!d)return;const V=m.current;V&&(y.current=V.offsetHeight,g.current||(g.current=k8(y.current,q),g.current.set(y.current)))},[d,q]),b.useEffect(()=>{if(!d)return;const V=g.current;if(V)if(e){if(w.current=!1,k.current)return;const B=H(n);if(N.current!==null&&Math.abs(N.current-B)<1)return;if(N.current=B,_){V.set(B);return}V.animateTo(B,nh)}else{if(w.current=!0,N.current=y.current,_){f(!1);return}V.animateTo(y.current,nh,{onSettle:()=>f(!1)})}},[d,e,n,_,H]),b.useEffect(()=>{d||(g.current?.dispose(),g.current=null,N.current=null,k.current=!1,w.current=!1)},[d]),b.useEffect(()=>()=>g.current?.dispose(),[]),b.useEffect(()=>{if(!d)return;const V=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=V}},[d]),b.useEffect(()=>{if(!d||!e)return;const V=B=>{B.key==="Escape"&&l()};return window.addEventListener("keydown",V),()=>window.removeEventListener("keydown",V)},[d,e,l]),b.useEffect(()=>{if(d)return L.current=document.activeElement instanceof HTMLElement?document.activeElement:null,()=>L.current?.focus()},[d]),b.useEffect(()=>{if(!d)return;const V=()=>{const B=m.current;if(!B||(y.current=B.offsetHeight,k.current||w.current))return;const Y=H(n);N.current=Y,g.current?.set(Y)};return window.addEventListener("resize",V),()=>window.removeEventListener("resize",V)},[d,n,H]);const I=V=>{if(w.current)return;const B=g.current;if(!B)return;V.currentTarget.setPointerCapture(V.pointerId);const[Y]=B.stop();k.current=!0,j.current={pointerY:V.clientY,sheetY:Y},C.current=[{y:V.clientY,t:performance.now()}]},P=V=>{if(!k.current)return;const B=g.current;if(!B)return;const Y=j.current.sheetY+(V.clientY-j.current.pointerY),ne=y.current,U=Y<0?-S8(-Y,ne):Math.min(Y,ne);B.set(U);const z=performance.now(),$=C.current;for($.push({y:V.clientY,t:z});$.length>2&&z-$[0].t>100;)$.shift()},ee=V=>{k.current=!1;const B=g.current;if(!B)return;const Y=y.current,ne=H("half"),U=E.current?B.value+w8(V):Y,z=j8(U,[0,ne,Y]);if(N.current=z,z===Y){if(w.current=!0,_){f(!1),l();return}B.animateTo(Y,R1,{velocity:V,onSettle:()=>{f(!1),l()}});return}B.animateTo(z,R1,{velocity:V});const $=z===0?"full":"half";$!==n&&r?.($)},Z=()=>{if(!k.current)return;const V=C.current,B=V[V.length-1],Y=V[0],ne=B&&Y?B.t-Y.t:0;ee(ne>0?(B.y-Y.y)/ne*1e3:0)},D=()=>{k.current&&ee(0)};return d?i.jsxs("div",{className:"fixed inset-0 z-50",role:"dialog","aria-modal":"true","aria-label":o,children:[i.jsx("div",{ref:h,className:`absolute inset-0 bg-black/45 ${_?"anim-fade":""}`,style:{opacity:0},onPointerDown:()=>l()}),i.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 ${_?"anim-fade":""}`,style:{transform:"translate3d(0, 100%, 0)"},children:[i.jsxs("div",{className:"shrink-0 cursor-grab touch-none select-none active:cursor-grabbing",onPointerDown:I,onPointerMove:P,onPointerUp:Z,onPointerCancel:D,onLostPointerCapture:D,children:[i.jsx("div",{className:"mx-auto mt-2 h-1 w-9 rounded-full bg-gray-300 dark:bg-gray-600"}),i.jsxs("div",{className:"flex items-center justify-between px-4 pb-2 pt-1.5",children:[i.jsx("span",{className:"text-base font-semibold",children:o??""}),i.jsx(Ch,{onClose:l,onPointerDown:V=>V.stopPropagation()})]})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain pb-[env(safe-area-inset-bottom)]",children:u})]})]}):null}const E8=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"]),A8=new Set(["png","jpg","jpeg","gif","webp","svg"]),R8=new Set(["html","htm"]),Rc=256*1024,L1=64*1024,_8={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 L8(e){return _8[e]??"text"}function I1(e){const n=e.lastIndexOf(".");return n>=0?e.slice(n+1).toLowerCase():e.toLowerCase()}function _c(e,n){return e===""?n:`${e}/${n}`}function O1(e){return e.includes("/")?e.slice(0,e.lastIndexOf("/")):""}const z1=/^[a-z][a-z0-9+.-]*:/i;function D1(e,n){const r=n.startsWith("/")||e===""?[]:e.split("/");for(const l of n.split("/"))l===""||l==="."||(l===".."?r.pop():r.push(l));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 I8(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 Lc=0;function U1({session:e,openRequest:n,active:r,onPreviewOpen:l}){const{previewIsolated:o}=bn(),[u,d]=b.useState(""),[f,m]=b.useState(null),[h,g]=b.useState(null),[y,k]=b.useState(null),[w,N]=b.useState(!1),[C,j]=b.useState(null),[E,L]=b.useState(0),[_,q]=b.useState(!1),[H,I]=b.useState("rendered"),[P,ee]=b.useState(null),Z=b.useRef(o);Z.current=o,b.useEffect(()=>{let M=!1;return g(null),yj(e.sessionId,u).then(R=>{M||m(R)}).catch(R=>{M||g(R instanceof Ra?R.message:x.files.loadFailed)}),()=>{M=!0}},[e.sessionId,u,E]);const[D,V]=b.useState(e.sessionId);D!==e.sessionId&&(V(e.sessionId),d(""),k(null),m(null),ee(null),Lc++);const B=b.useRef(r);b.useEffect(()=>{r&&!B.current&&L(M=>M+1),B.current=r},[r]);const Y=b.useRef(l);Y.current=l;const ne=b.useCallback(async M=>{Y.current?.();const R=M.includes("/")?M.slice(M.lastIndexOf("/")+1):M,O=I1(R),T=++Lc,X=ge=>{T===Lc&&k(ge)};if(I("rendered"),ee(null),A8.has(O)){X({path:M,name:R,kind:"image",nonce:T});return}if(O==="pdf"){X({path:M,name:R,kind:"pdf",nonce:T});return}const ae=R8.has(O),oe=O==="md";if(!ae&&!E8.has(O)){X({path:M,name:R,kind:"unsupported",nonce:T});return}if(ae&&Z.current){X({path:M,name:R,kind:"html",nonce:T});return}try{const ge=await fetch(Yr(e.sessionId,M),{credentials:"same-origin"});if(!ge.ok)throw new Error(String(ge.status));const Te=await ge.text(),se=Te.length>Rc;oe&&Te.length>L1&&T===Lc&&I("source"),X({path:M,name:R,kind:ae?"html":oe?"md":"text",content:se?Te.slice(0,Rc):Te,truncated:se,nonce:T})}catch{X({path:M,name:R,kind:"unsupported",nonce:T})}},[e.sessionId]);b.useEffect(()=>{if(y?.kind!=="html"||y.content!==void 0||H!=="source"&&o)return;const M=y.path;let R=!1;return ee(null),(async()=>{try{const O=await fetch(Yr(e.sessionId,M),{credentials:"same-origin"});if(!O.ok)throw new Error(String(O.status));const T=await O.text();if(R)return;const X=T.length>Rc;k(ae=>ae!==null&&ae.kind==="html"&&ae.path===M&&ae.content===void 0?{...ae,content:X?T.slice(0,Rc):T,truncated:X}:ae)}catch{R||ee(x.files.loadFailed)}})(),()=>{R=!0}},[y,H,o,e.sessionId]);const U=b.useRef(null);b.useEffect(()=>{if(!n||U.current===n)return;U.current=n;const M=n.path,R=M.includes("/")?M.slice(0,M.lastIndexOf("/")):"";d(R),L(O=>O+1),ne(M)},[n,ne]);const z=M=>{ne(_c(u,M))},$=M=>{N(!0),g(null),(async()=>{try{for(const R of M){const O=await new Promise((T,X)=>{const ae=new FileReader;ae.onload=()=>{const oe=ae.result;T(oe.slice(oe.indexOf(",")+1))},ae.onerror=()=>X(new Error("read failed")),ae.readAsDataURL(R)});await vj(e.sessionId,_c(u,R.name),O)}ga(x.files.uploaded),L(R=>R+1)}catch(R){Et(ze(R))}finally{N(!1)}})()},G=M=>{const R=M.target.files?[...M.target.files]:[];if(M.target.value="",R.length===0)return;const O=new Set((f?.entries??[]).map(X=>X.name)),T=R.filter(X=>O.has(X.name)).map(X=>X.name);T.length>0?j({files:R,clashes:T}):$(R)},me=u===""?[]:u.split("/");return y!==null?i.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i.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:[i.jsxs("button",{type:"button",onClick:()=>{k(null),L(M=>M+1)},title:x.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:[i.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:i.jsx("path",{d:"M15 18l-6-6 6-6"})}),x.files.backToList]}),i.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")&&i.jsx("div",{className:"flex shrink-0 rounded-md bg-gray-100 p-0.5 dark:bg-gray-800",children:[["rendered",x.files.htmlRendered],["source",x.files.htmlSource]].map(([M,R])=>i.jsx("button",{type:"button",onClick:()=>I(M),className:`rounded px-2 py-0.5 text-xs transition-colors duration-150 ${H===M?"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:R},M))}),/\.html?$/i.test(y.name)&&i.jsxs("a",{href:dy(e.sessionId,y.path),target:"_blank",rel:"noopener noreferrer",title:o?void 0:x.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:[x.files.openInNewTab,!o&&i.jsx("span",{"aria-label":x.files.previewNotIsolatedHint,className:"text-amber-600 dark:text-amber-500",children:"⚠"})]}),i.jsx("a",{href:Yr(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:x.files.download})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-auto p-3",children:y.kind==="image"?i.jsx("img",{src:Yr(e.sessionId,y.path),alt:y.name,className:"max-w-full rounded-md border border-gray-200 dark:border-gray-800"}):y.kind==="pdf"?i.jsx("iframe",{src:Yr(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"&&H==="rendered"?o?i.jsx("iframe",{src:dy(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?P!==null?i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:P}):i.jsx(qa,{rows:6}):i.jsx("iframe",{srcDoc:I8(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"&&H==="rendered"?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"md-body text-base leading-relaxed text-gray-800 dark:text-gray-100",children:i.jsx(Eu,{remarkPlugins:[Au],components:{img:({src:M,alt:R})=>i.jsx("img",{src:typeof M=="string"&&!z1.test(M)?Yr(e.sessionId,D1(O1(y.path),M)):M,alt:R??"",loading:"lazy",className:"max-w-full"}),a:({href:M,children:R})=>{if(typeof M!="string"||M.startsWith("#"))return i.jsx("a",{href:M,children:R});if(z1.test(M))return i.jsx("a",{href:M,target:"_blank",rel:"noreferrer",children:R});const O=D1(O1(y.path),M);return i.jsx("a",{href:Yr(e.sessionId,O),onClick:T=>{T.preventDefault(),ne(O)},children:R})}},children:y.content??""})}),y.truncated&&i.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:["… ",x.files.previewTruncated]})]}):y.kind==="text"||y.kind==="html"||y.kind==="md"?y.content===void 0?P!==null?i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:P}):i.jsx(qa,{rows:6}):i.jsxs(i.Fragment,{children:[i.jsx(jk,{language:L8(I1(y.name)),code:y.content,highlight:y.content.length<=L1}),y.truncated&&i.jsxs("p",{className:"mt-1 text-xs text-gray-400",children:["… ",x.files.previewTruncated]})]}):i.jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:x.files.previewUnsupported})})]}):i.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[i.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:[i.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:x.files.root}),me.map((M,R)=>i.jsxs("span",{className:"flex items-center gap-1",children:[i.jsx("span",{className:"text-gray-300 dark:text-gray-700",children:"/"}),i.jsx("button",{type:"button",onClick:()=>d(me.slice(0,R+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:M})]},R)),i.jsx("span",{className:"flex-1"}),i.jsx(_a,{open:_,setOpen:q,menuClass:"right-0 top-full mt-1 w-max max-w-72 origin-top-right",button:i.jsx(ke,{size:"sm",variant:_?"primary":"ghost",onClick:()=>q(M=>!M),children:x.files.details}),children:i.jsxs("div",{className:"px-3.5 py-2.5",children:[i.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:x.files.workspacePath}),i.jsx("p",{className:"mt-1 break-all font-mono text-xs leading-5",children:e.workspace})]})}),i.jsx(ke,{size:"sm",variant:"ghost",onClick:()=>L(M=>M+1),children:x.files.refresh}),i.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:[i.jsx("input",{type:"file",multiple:!0,className:"sr-only",onChange:G,disabled:w}),w?x.common.saving:x.files.upload]})]}),i.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:h?i.jsx("p",{className:"px-3 py-3 text-sm text-red-600 dark:text-red-400",children:h}):f===null?i.jsx(qa,{rows:6}):f.entries.length===0?i.jsx("p",{className:"px-3 py-3 text-sm text-gray-400",children:x.files.empty}):i.jsx("ul",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:f.entries.map(M=>i.jsx("li",{children:i.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:[i.jsxs("button",{type:"button",onClick:()=>M.kind==="dir"?d(_c(u,M.name)):z(M.name),className:"flex min-w-0 flex-1 items-center gap-2 text-left",title:M.name,children:[i.jsx("span",{className:"shrink-0 text-gray-400","aria-hidden":!0,children:M.kind==="dir"?i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:i.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"})}):i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",children:i.jsx("path",{d:"M6 3h8l4 4v14H6zM14 3v4h4"})})}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:M.name})]}),i.jsx("span",{className:"shrink-0 font-mono text-xs text-gray-400 dark:text-gray-500",children:M.kind==="file"?Dm(M.sizeBytes):""}),i.jsx("span",{className:"hidden shrink-0 font-mono text-xs text-gray-400 sm:block dark:text-gray-500",children:M.mtime?Kn(M.mtime):""}),M.kind==="file"&&i.jsx("a",{href:Yr(e.sessionId,_c(u,M.name),!0),download:M.name,title:x.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:i.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:i.jsx("path",{d:"M12 3v12m0 0l-4-4m4 4l4-4M4 21h16"})})})]})},M.name))})}),i.jsx(Gn,{open:C!==null,title:x.files.overwriteTitle,tone:"primary",confirmLabel:x.files.upload,onClose:()=>j(null),onConfirm:()=>{C&&$(C.files),j(null)},children:i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.files.overwriteConfirm(C?.clashes.length??0)}),i.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:(C?.clashes??[]).map(M=>i.jsx("li",{className:"truncate py-0.5 font-mono text-xs",title:M,children:M},M))})]})})]})}function O8(){return i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor","aria-hidden":!0,children:i.jsx("path",{d:"M2 2l10 10M12 2L2 12",strokeWidth:"1.5",strokeLinecap:"round"})})}function z8({session:e,panel:n}){return n.isDocked?i.jsxs(i.Fragment,{children:[n.open&&i.jsx("div",{onMouseDown:n.startResize,onDoubleClick:n.resetWidth,title:x.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"}`}),i.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 border-l border-gray-200 dark:border-gray-800 ${n.resizing?"pointer-events-none":"transition-[width] duration-200"}`,children:i.jsxs("div",{style:{width:n.width},className:"flex h-full min-h-0 flex-col",children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-3 pt-2",children:[i.jsx("h4",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:x.files.title}),i.jsx("button",{type:"button",onClick:()=>n.setOpen(!1),title:x.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:i.jsx(O8,{})})]}),i.jsx("div",{className:"min-h-0 flex-1",children:i.jsx(U1,{session:e,openRequest:n.openRequest,active:n.open})})]})})]}):i.jsx(M8,{open:n.open,snap:n.sheetSnap,onSnapChange:n.setSheetSnap,onClose:()=>n.setOpen(!1),title:x.files.title,children:i.jsx("div",{className:"flex h-full min-h-0 flex-col",children:i.jsx("div",{className:"min-h-0 flex-1",children:i.jsx(U1,{session:e,openRequest:n.openRequest,active:n.open,onPreviewOpen:()=>n.setSheetSnap("full")})})})})}const _u=320,$1="(min-width: 1024px)",ah="penguin.filesPanelWidth";function fu(e){return Math.max(_u,Math.min(720,Math.round(e*.5)))}function Vk(e){return Math.min(fu(e),Math.max(_u,Math.round(e*.34)))}function D8(){const e=Number(localStorage.getItem(ah));return!Number.isFinite(e)||e<=0?Vk(window.innerWidth):Math.min(fu(window.innerWidth),Math.max(_u,Math.round(e)))}function U8(e){const[n,r]=b.useState(!1),[l,o]=b.useState("half"),[u,d]=b.useState(null),f=b.useCallback(_=>{_&&o("half"),r(_)},[]),[m,h]=b.useState(D8),g=b.useRef(m),[y,k]=b.useState(!1),[w,N]=b.useState(()=>window.matchMedia($1).matches),C=b.useRef(null);b.useEffect(()=>{d(null)},[e]),b.useEffect(()=>{const _=window.matchMedia($1),q=H=>N(H.matches);return _.addEventListener("change",q),()=>_.removeEventListener("change",q)},[]);const j=b.useCallback(_=>{o("full"),d({path:_})},[]);b.useEffect(()=>{if(!y)return;const _=H=>{const I=C.current?.getBoundingClientRect(),P=I?I.right:window.innerWidth,ee=Math.min(fu(window.innerWidth),Math.max(_u,P-H.clientX));g.current=ee,h(ee)},q=()=>{k(!1),localStorage.setItem(ah,String(Math.round(g.current)))};return document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("mousemove",_),window.addEventListener("mouseup",q),()=>{document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",q)}},[y]);const E=b.useCallback(_=>{_.preventDefault(),k(!0)},[]),L=b.useCallback(()=>{const _=Vk(window.innerWidth);g.current=_,h(_),localStorage.removeItem(ah)},[]);return b.useEffect(()=>{const _=()=>{h(q=>{const H=Math.min(q,fu(window.innerWidth));return H!==q&&(g.current=H),H})};return window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[]),{open:n,setOpen:f,sheetSnap:l,setSheetSnap:o,browsePath:j,openRequest:u,isDocked:w,width:m,resizing:y,startResize:E,resetWidth:L,panelRef:C}}const $8=300;function B8(e){const n=bn().user?.userId??null,r=n&&e?qk(n,e):null,l=b.useMemo(()=>r?Ru(r):{},[r]),o=b.useRef(l.text??""),u=b.useRef(l.handoffAgentId??null),d=b.useRef(l.skills??[]),f=b.useRef(null),m=b.useCallback(()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null)},[]),h=b.useCallback(()=>{if(m(),!r)return;const N=o.current,C=u.current,j=d.current;if(!N&&!C&&j.length===0){du(r);return}const E={text:N};C&&(E.handoffAgentId=C),j.length>0&&(E.skills=j),Ji(r,E)},[m,r]);b.useEffect(()=>(o.current=l.text??"",u.current=l.handoffAgentId??null,d.current=l.skills??[],()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null,h())}),[l,h]);const g=b.useCallback(N=>{o.current=N,m(),f.current=window.setTimeout(()=>{f.current=null,h()},$8)},[m,h]),y=b.useCallback(N=>{u.current=N,h()},[h]),k=b.useCallback(N=>{d.current=N,h()},[h]),w=b.useCallback(()=>{m(),d.current=[],r&&du(r)},[m,r]);return{initial:l,onTextChange:g,onHandoffTargetChange:y,onSkillsChange:k,discard:w}}function H8(e){const n=e.now??(()=>Date.now()),r=new Set,l=new Map;let o=Qc(r),u=!1,d="buffering",f=[],m=null,h=0,g=!1;const y=()=>{l.size!==0&&(l.clear(),e.onPendingChange())},k=(j,E)=>{if(Rh(j)&&j.payload.type==="approval_decision"&&l.delete(Cs(j.origin,j.payload.tool_call_id))&&e.onPendingChange(),E&&!Ah(j.payload)&&vC(E,j)){vb(o,j);return}ru(o,j,n())},w=j=>{switch(j.type){case"approval_request":{const E=j.toolCall.payload.tool_call_id,L={toolCall:j.toolCall};if(j.origin&&(L.origin=j.origin),l.set(Cs(j.origin,E),L),!uC(o,j.origin,E)){const _={...j.toolCall};j.origin&&j.origin.length>0?_.origin=[...j.origin]:delete _.origin,ru(o,_,n()),e.onModelChange()}e.onPendingChange();return}case"task_state":{m=j.state,e.onTaskState(j.state),e.onQueuedFollowUps?.(j.queued??0),j.state==="idle"&&(iC(o,n()),y(),e.onModelChange());return}case"resync_required":{N();return}case"hello":return}},N=async()=>{h+=1,d="buffering",f=[],y(),await C(h,Qc(r))},C=async(j,E)=>{try{const L=await e.loadMessages();if(u||j!==h)return;E&&(o=E);const _=o;sC(_,L,n());const q=yC(L,100),H=f;f=[];for(let I=0;I<H.length;I+=1){const P=H[I];if(P.kind==="omni"?k(P.msg,q):w(P.ev),u)return;if(j!==h){f.push(...H.slice(I+1));return}}d="live",m==="idle"&&oC(_),g=!1,e.onError(null),e.onLoading(!1),e.onModelChange()}catch(L){if(u||j!==h)return;g=!0,e.onLoading(!1),e.onError(L instanceof Error?L.message:String(L))}};return{get model(){return o},get pendingApprovals(){return l},load:()=>(h+=1,C(h)),retry:async()=>{u||!g||(e.onError(null),e.onLoading(!0),h+=1,await C(h,Qc(r)))},handleOmni:j=>{if(!u){if(d==="buffering"){f.push({kind:"omni",msg:j});return}k(j,null),e.onModelChange()}},handleServer:j=>{if(!u){if(j.type==="session_title"){e.onSessionTitle?.(j.sessionId,j.title);return}if(j.type==="session_created"){e.onSessionCreated?.(j.sessionId);return}if(d==="buffering"){j.type==="task_state"&&(m=j.state,e.onTaskState(j.state),e.onQueuedFollowUps?.(j.queued??0)),f.push({kind:"server",ev:j});return}w(j)}},markLocalDecision:j=>{cC(o,j)},resolveApproval:j=>{l.delete(j)&&e.onPendingChange()},dispose:()=>{u=!0}}}const P8=120,q8=new Map;function F8(e,n,r,l){const[o,u]=b.useState(0),[d,f]=b.useState(!0),[m,h]=b.useState(n),[g,y]=b.useState(0),[k,w]=b.useState(null),[N,C]=b.useState(0),j=b.useRef(r);j.current=r;const E=b.useRef(l);E.current=l;const L=b.useRef(null),_=b.useRef(null);_.current===null&&(_.current=Qc());const q=b.useRef(null),H=b.useRef(null),I=b.useRef(0),P=b.useCallback(()=>{if(q.current!==null||H.current!==null)return;const V=()=>{I.current=Date.now(),u(Y=>Y+1)},B=I.current+P8-Date.now();if(B>0){H.current=window.setTimeout(()=>{H.current=null,V()},B);return}q.current=requestAnimationFrame(()=>{q.current=null,V()})},[]);b.useEffect(()=>{if(!e){L.current?.dispose(),L.current=null,h("idle"),y(0),f(!1),w(null),C(Y=>Y+1),u(Y=>Y+1);return}u(Y=>Y+1),f(!0),w(null),h(n),y(0),C(Y=>Y+1);const V=H8({loadMessages:async()=>(await uj(e)).messages,onTaskState:h,onQueuedFollowUps:y,onLoading:f,onError:w,onModelChange:P,onPendingChange:()=>C(Y=>Y+1),onSessionTitle:(Y,ne)=>j.current?.(Y,ne),onSessionCreated:()=>E.current?.()});L.current=V;const B=d4(e,{onOmniMessage:V.handleOmni,onServerEvent:V.handleServer,onError:Y=>{Y&&Kc().catch(()=>{})}});return V.load(),()=>{V.dispose(),B.close(),q.current!==null&&(cancelAnimationFrame(q.current),q.current=null),H.current!==null&&(window.clearTimeout(H.current),H.current=null)}},[e]);const ee=b.useCallback(V=>{L.current?.markLocalDecision(V)},[]),Z=b.useCallback(V=>{L.current?.resolveApproval(V)},[]),D=b.useCallback(()=>{L.current?.retry()},[]);return{model:L.current?.model??_.current,version:o,loading:d,taskState:m,queuedFollowUps:g,pendingApprovals:L.current?.pendingApprovals??q8,markLocalDecision:ee,resolveApproval:Z,error:k,retry:D}}const Ic={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 vm({icon:e,value:n,label:r}){return i.jsxs("span",{title:r,className:"flex shrink-0 items-center gap-1 font-mono text-xs text-gray-500 dark:text-gray-400",children:[i.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:i.jsx("path",{d:e})}),n]})}const Fa="new";function V8(){const e=Qn(),n=Kv(),{currency:r}=Ll(),{currentProject:l,currentAgent:o,setCurrentAgentId:u,reloadAgents:d,agents:f}=fn(),m=l?.projectId??null,h=o?.agentId??null,{sessions:g,loading:y,reload:k,add:w,replace:N,setStatus:C,setTitle:j}=ao(),[E,L]=b.useState(null),[_,q]=b.useState(!1),[H,I]=b.useState(!1),[P,ee]=b.useState(!1),[Z,D]=b.useState(!1),[V,B]=b.useState(null),[Y,ne]=b.useState(""),U=n.sessionId??null,z=U8(U),$=U===Fa,G=$?null:g.find(xe=>xe.sessionId===U)??null,me=G?{provider:G.provider,modelId:G.modelId}:null;Ka(G?G.title??x.chat.defaultSessionTitle:x.nav.chat);const M=F8(G?.sessionId??null,G?.status??"idle",j,()=>{k()}),{initial:R,onTextChange:O,onHandoffTargetChange:T,onSkillsChange:X,discard:ae}=B8(G?.sessionId??null),oe=G?.sessionId??null,ge=G?.agentId??null;b.useEffect(()=>{oe&&ge&&u(ge)},[oe,ge,u]);const[Te,se]=b.useState([]);b.useEffect(()=>{if(se(Ce=>Ce.length>0?[]:Ce),!m||!ge)return;let xe=!1;return dh(m,ge).then(Ce=>{xe||se(Ce.skills)}).catch(()=>{}),()=>{xe=!0}},[m,ge]);const[pe,be]=b.useState("");b.useEffect(()=>{if(be(""),!m||!ge)return;let xe=!1;return uh(m,ge).then(Ce=>{xe||be(Ce.config.model?.thinkingLevel??"")}).catch(()=>{}),()=>{xe=!0}},[m,ge]);const[Pe,Ze]=b.useState(null);b.useEffect(()=>{if($||!U||y||g.some(Ce=>Ce.sessionId===U))return;let xe=!1;return uy(U).then(Ce=>{xe||w(Ce.session)},()=>{xe||Ze(U)}),()=>{xe=!0}},[$,U,y,g,w]),b.useEffect(()=>{if(y||$||U&&g.some(Ce=>Ce.sessionId===U)||U&&Pe!==U)return;const xe=nb(g);e(xe?`/chat/${xe.sessionId}`:`/chat/${Fa}`,{replace:!0})},[y,$,U,Pe,g,e]),b.useEffect(()=>{G&&C(G.sessionId,M.taskState)},[M.taskState,G,C]);const De=b.useRef(M.taskState);b.useEffect(()=>{const xe=De.current;De.current=M.taskState,xe!=="idle"&&M.taskState==="idle"&&(k(),d())},[M.taskState,k,d]);const dt=b.useRef(new Map);b.useEffect(()=>{L(null),q(!1),ne(""),dt.current=new Map},[U]);const at=b.useCallback(async xe=>{const Ce=G?.sessionId??null,tt=dt.current,ft=Ce===null?[]:xe.filter(xt=>!tt.has(xt));if(Ce!==null&&ft.length>0){const xt=bj(Ce,ft).then(Bt=>new Set(Bt.existing)).catch(()=>null);for(const Bt of ft)tt.set(Bt,xt.then(en=>{if(en===null)return tt.delete(Bt),!1;const _n=en.has(Bt);return tt.set(Bt,_n),_n}))}const jt=new Set;return await Promise.all(xe.map(async xt=>{const Bt=tt.get(xt);(Bt===!0||Bt instanceof Promise&&await Bt)&&jt.add(xt)})),jt},[G?.sessionId]);b.useEffect(()=>{if(!m||!G||M.taskState!=="idle")return;let xe=!1;return Mv(m,{groupBy:"session",agentId:G.agentId}).then(Ce=>{if(xe)return;const tt=Ce.groups.find(ft=>ft.key===G.sessionId);L(tt?.cost??null),q(tt?.hasUncosted??!1)}).catch(()=>{}),()=>{xe=!0}},[m,G,M.taskState]),b.useEffect(()=>{if(!m)return;let xe=!1;return B(null),(async()=>{try{const Ce=await pu(m);if(xe)return;B(Ce);const{prefs:tt}=await KS();if(xe||tt.credentialGuideSeen)return;const ft=Ce.models.find(xt=>pt(xt,Ce.defaultModel));(!Ce.defaultModel||!ft?.credential?.apiKeyMasked)&&I(!0),Cv({credentialGuideSeen:!0}).catch(()=>{})}catch{}})(),()=>{xe=!0}},[m]);const Mt=b.useCallback(async(xe,Ce)=>{Ce!==xe&&(await k(),e(`/chat/${Ce}`,{replace:!0}))},[k,e]),rt=b.useCallback(async xe=>{if(!G)return!1;try{const Ce=await ws(G.sessionId,{input:xe,...Y?{thinkingLevel:Y}:{}});return ae(),await Mt(G.sessionId,Ce.sessionId),!0}catch(Ce){return Et(ze(Ce,{modelId:G.modelId})),!1}},[G,Y,ae,Mt]),je=b.useCallback(async(xe,Ce)=>{if(!m||!G)return!1;const tt=await uy(G.sessionId).then(xt=>xt.session.tracePath).catch(()=>{}),ft={type:"text",text:TA({sessionId:G.sessionId,...G.title!==void 0?{sessionTitle:G.title}:{},...tt!==void 0?{tracePath:tt}:{},workspace:G.workspace,prevProvider:G.provider,prevModelId:G.modelId})};let jt=null;try{const xt=await Zc(m,G.agentId,{provider:xe.provider,modelId:xe.modelId,workspace:G.workspace,approvalMode:G.approvalMode});jt=xt.session.sessionId;const Bt=await ws(jt,{input:[ft,...Ce]});return w(xt.session),ae(),e(`/chat/${Bt.sessionId}`),!0}catch(xt){return jt&&Ki(jt).catch(()=>{}),Et(ze(xt,{modelId:xe.modelId})),!1}},[m,G,w,ae,e]),qe=b.useCallback(async(xe,Ce)=>{if(!m||!o||!G)return!1;const tt={type:"text",text:Ak({agentId:o.agentId,...o.name!==void 0?{agentName:o.name}:{},sessionId:G.sessionId,workspace:G.workspace,...G.title!==void 0?{sessionTitle:G.title}:{}})};let ft=null;try{const jt=await Zc(m,xe.agentId,{approvalMode:G.approvalMode});ft=jt.session.sessionId;const xt=await ws(ft,{input:[tt,...Ce]});return w(jt.session),ae(),e(`/chat/${xt.sessionId}`),!0}catch(jt){return ft&&Ki(ft).catch(()=>{}),Et(ze(jt,V?.defaultModel?{modelId:V.defaultModel.modelId}:{})),!1}},[m,o,G,w,ae,e,V]),wt=b.useCallback(async()=>{G&&await fj(G.sessionId).catch(()=>{})},[G]),$t=b.useCallback(async xe=>{if(!G)return!1;try{const Ce=await ws(G.sessionId,{input:xe,queueIfBusy:!0});return ae(),await Mt(G.sessionId,Ce.sessionId),!0}catch(Ce){return Et(ze(Ce,{modelId:G.modelId})),!1}},[G,ae,Mt]),At=b.useCallback(async xe=>{if(!G)return"failed";try{return await mj(G.sessionId,{text:xe}),"queued"}catch(Ce){return Ce instanceof Ra&&Ce.status===409?"not_running":(Et(ze(Ce,{modelId:G.modelId})),"failed")}},[G]),St=b.useCallback(async(xe,Ce,tt)=>{if(!G)return;M.markLocalDecision(xe);const ft=Cs(tt,xe);try{await dj(G.sessionId,xe,{decision:Ce}),M.resolveApproval(ft)}catch(jt){jt instanceof Ra&&jt.status===404&&M.resolveApproval(ft)}},[G,M]),ba=b.useCallback(xe=>{!G||Z||(D(!0),Mm(G.sessionId,{approvalMode:xe}).then(Ce=>N(Ce.session)).catch(Ce=>{Et(ze(Ce))}).finally(()=>D(!1)))},[G,Z,N]),ie=b.useCallback(async()=>{if(G)try{const xe=await hj(G.sessionId);await Mt(G.sessionId,xe.sessionId)}catch(xe){Et(ze(xe,{modelId:G.modelId}))}},[G,Mt]),ye=b.useCallback(()=>{e(`/chat/${Fa}`)},[e]),we=V?.models.find(xe=>pt(xe,me))?.pricing,Oe={pendingApprovals:M.pendingApprovals,onApprove:St,origin:[],taskRunning:M.taskState!=="idle",taskCost:xe=>{if(!we)return null;const Ce=xe.tokensByBucket;return(Ce.cacheRead*we.cacheRead+Ce.cacheWrite*we.cacheWrite+Ce.output*we.output)/1e6},onOpenFile:xe=>{z.setOpen(!0),z.browsePath(xe)},workspace:G?.workspace??null,statFiles:at};if(!m||!h)return i.jsx("div",{className:"p-6",children:i.jsx(Ut,{className:"h-6 w-64"})});const Fe=M.model.stats.sessionTotal+M.model.stats.subagentTotal,Ot=V?.models.find(xe=>pt(xe,me)),nn=Ot?.contextWindow,Pt=Ot?.vision!==!1,gt=G!==null&&!M.loading&&!M.error&&M.model.items.length===0,zt=G&&i.jsx(Hk,{status:M.taskState,onSend:rt,onSteer:At,steeringDeliveredCount:M.model.items.filter(xe=>xe.kind==="user_steering").length,onQueueFollowUp:$t,queuedFollowUps:M.queuedFollowUps,onStop:wt,onCompact:ie,modelRef:me,...V!==null?{models:V.models}:{},...V?.defaultModel!==void 0?{defaultModel:V.defaultModel}:{},onSwitchModel:je,turnThinkingLevel:Y||pe,onChangeTurnThinkingLevel:ne,...nn!==void 0?{contextWindow:nn}:{},contextNow:M.model.stats.contextNow,contextStale:M.model.stats.contextStale,vision:Pt,approvalMode:G.approvalMode,onChangeApprovalMode:ba,modeSaving:Z,autoFocus:!0,agents:f,skills:Te,...R.skills&&R.skills.length>0?{initialSkills:R.skills}:{},onSkillsChange:X,onHandoff:qe,initialText:R.text??"",onTextChange:O,...R.handoffAgentId?{initialHandoffTargetId:R.handoffAgentId}:{},onHandoffTargetChange:T});return i.jsxs("div",{className:"flex h-full flex-col bg-white dark:bg-gray-950",children:[G&&i.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:[i.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[i.jsx("h1",{className:"flex min-w-0 text-[15px] font-semibold",children:i.jsx(bu,{text:G.title??x.chat.defaultSessionTitle})}),M.taskState==="running"&&i.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-xs text-gray-500 dark:text-gray-400",children:[i.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-emerald-500"}),x.chat.statusRunning]})]}),i.jsxs("div",{className:"hidden items-center gap-3 sm:flex",children:[i.jsx(vm,{icon:Ic.tokens,value:ut(Fe),label:`${x.chat.statTokens}(Token)`}),E!=null&&i.jsx(vm,{icon:Ic.cost,value:`${ya(E,r)}${_?" *":""}`,label:`${x.common.cost}(${r})${_?` · ${x.usage.uncostedNote}`:""}`}),i.jsx(vm,{icon:Ic.elapsed,value:ln(M.model.stats.sessionElapsedMs),label:x.chat.statElapsed})]}),i.jsxs("button",{type:"button","aria-expanded":z.open,onClick:()=>z.setOpen(!z.open),title:x.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 ${z.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:[i.jsx("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":!0,children:i.jsx("path",{d:Ic.folder})}),x.chat.openWorkspace]}),i.jsx(_a,{open:P,setOpen:ee,menuClass:"right-0 top-full mt-1 w-80 max-w-[calc(100vw-1.5rem)] origin-top-right",button:i.jsx("button",{type:"button",title:x.chat.infoPanel,onClick:()=>ee(!P),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:i.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:[i.jsx("circle",{cx:"12",cy:"12",r:"9"}),i.jsx("path",{d:"M12 11v5m0-8h.01"})]})}),children:i.jsxs("div",{className:"space-y-3 px-3.5 py-2.5 text-sm",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:x.chat.model}),i.jsxs("p",{className:"truncate text-xs",children:[i.jsx("span",{className:"font-mono",children:G.modelId}),i.jsx("span",{className:"ml-1.5 text-gray-400 dark:text-gray-500",children:pa(G.provider)?.label??G.provider})]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:x.chat.workspace}),i.jsx("p",{className:"break-all font-mono text-xs leading-5",children:G.workspace})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:x.common.created}),i.jsx("p",{className:"font-mono text-xs",children:Kn(G.createdAt)})]}),i.jsxs("div",{children:[i.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:x.chat.sessionStats}),i.jsxs("p",{className:"font-mono text-xs",children:[x.chat.statTokens," ",ut(Fe),E!=null&&` · ${x.common.cost} ${ya(E,r)}`," ","· ",x.chat.statElapsed," ",ln(M.model.stats.sessionElapsedMs)]})]})]})})]}),i.jsxs("div",{className:"flex min-h-0 flex-1",children:[i.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:$?i.jsx(x8,{projectId:m,models:V},`draft:${m}`):i.jsx("div",{className:"anim-fade flex min-h-0 flex-1 flex-col",children:G?M.error?i.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-6",children:[i.jsxs("p",{className:"text-sm text-red-600 dark:text-red-400",children:[x.chat.historyLoadFailed,":",M.error]}),i.jsx(ke,{onClick:M.retry,children:x.common.retry})]}):M.loading?i.jsxs("div",{className:"space-y-3 p-6",children:[i.jsx(Ut,{className:"h-5 w-1/3"}),i.jsx(Ut,{className:"h-5 w-2/3"}),i.jsx(Ut,{className:"h-5 w-1/2"})]}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"min-h-0 flex-1",children:gt?i.jsx("div",{className:"flex h-full items-center justify-center px-4",children:i.jsx("p",{className:"text-lg font-medium text-gray-400 dark:text-gray-500",children:x.chat.emptyGreeting})}):i.jsx(BA,{items:M.model.items,version:M.version,ctx:Oe})}),i.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:i.jsx("div",{className:"mx-auto max-w-3xl",children:zt})})]}):y?i.jsx("div",{className:"space-y-3 p-6",children:i.jsx(Ut,{className:"h-5 w-1/2"})}):i.jsx(nl,{title:x.chat.noSessions,action:i.jsx(ke,{onClick:ye,children:x.nav.newChat})})},G?.sessionId??"empty")}),G&&i.jsx(z8,{session:G,panel:z})]}),i.jsx(dn,{open:H,title:x.project.noCredentialTitle,onClose:()=>I(!1),footer:i.jsxs(i.Fragment,{children:[i.jsx(ke,{onClick:()=>I(!1),children:x.project.later}),i.jsx(ke,{variant:"primary",onClick:()=>{I(!1),e("/models")},children:x.project.goToModels})]}),children:i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.project.noCredentialBody})})]})}const Gk=/^[a-z][a-z0-9_]{1,63}$/,B1=/^[a-z][a-z0-9_]{1,31}$/,G8=/^[a-z0-9_]+$/,K8=64;function W8({open:e,onClose:n,onCreated:r}){const{user:l}=bn(),o=l&&!l.isAdmin?`${l.userId}-`:"",[u,d]=b.useState(""),[f,m]=b.useState(""),[h,g]=b.useState(void 0),[y,k]=b.useState(!1);b.useEffect(()=>{e&&(d(""),m(""),g(void 0))},[e]);const w=async()=>{const N=o+u.trim();if(!u.trim()){g(x.common.requiredField);return}if(!(o?G8.test(u.trim())&&N.length<=K8:Gk.test(N))){g(o?x.project.idPrefixHint:x.project.idHint);return}k(!0),g(void 0);try{const j=await JS({projectId:N,...f.trim()?{name:f.trim()}:{}});r(j.project.projectId)}catch(j){g(ze(j))}finally{k(!1)}};return i.jsx(dn,{open:e,title:x.project.createTitle,onClose:n,footer:i.jsxs(i.Fragment,{children:[i.jsx(ke,{onClick:n,children:x.common.cancel}),i.jsx(ke,{variant:"primary",disabled:y,onClick:()=>{w()},children:x.common.create})]}),children:i.jsxs("div",{className:"space-y-3",children:[o?i.jsxs("div",{children:[i.jsx(Hi,{required:!0,children:x.project.id}),i.jsxs("div",{className:"flex items-stretch",children:[i.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}),i.jsx(Xe,{size:"sm",className:"rounded-l-none",value:u,invalid:!!h,onChange:N=>{d(N.target.value),g(void 0)},autoFocus:!0})]}),h?i.jsx(Nl,{children:h}):i.jsx(cb,{children:x.project.idPrefixHint})]}):i.jsx(Xe,{label:x.project.id,required:!0,size:"sm",value:u,error:h,onChange:N=>{d(N.target.value),g(void 0)},hint:x.project.idHint,autoFocus:!0}),i.jsx(Xe,{label:x.project.name,size:"sm",value:f,onChange:N=>m(N.target.value)})]})})}function Y8({open:e,onClose:n}){const{user:r}=bn(),{currentProject:l,setCurrentProjectId:o,projects:u,reloadProjects:d}=fn(),[f,m]=b.useState(null),[h,g]=b.useState(""),[y,k]=b.useState(null),[w,N]=b.useState(!1),C=l?.projectId,j=l?.role==="owner";if(b.useEffect(()=>{!e||!C||(m(null),k(null),N(!1),Wf(C).then(q=>m(q.members)).catch(q=>k(ze(q))))},[e,C]),!l||!C)return null;const E=async()=>{if(h.trim())try{await tj(C,{userId:h.trim()}),g("");const q=await Wf(C);m(q.members)}catch(q){Et(ze(q))}},L=async q=>{try{await nj(C,q);const H=await Wf(C);m(H.members)}catch(H){Et(ze(H))}},_=async()=>{try{await ej(C),n();const q=u.find(H=>H.projectId!==C);await d(),q&&o(q.projectId)}catch(q){Et(ze(q))}};return i.jsxs(dn,{open:e,title:x.project.settingsTitle,onClose:n,children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.project.switcher}),i.jsxs("p",{className:"text-sm",children:[_m(l)," ",i.jsx("span",{className:"font-mono text-xs text-gray-400",children:C})]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-2 text-xs font-medium text-gray-500",children:x.project.members}),y?i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:y}):f===null?i.jsx("p",{className:"text-xs text-gray-400",children:x.common.loading}):i.jsx("div",{className:"overflow-x-auto rounded-md border border-gray-200 dark:border-gray-800",children:i.jsxs("table",{className:"w-full text-xs",children:[i.jsx("thead",{children:i.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:[i.jsx("th",{className:"whitespace-nowrap px-2.5 py-1.5 font-medium",children:x.common.username}),i.jsx("th",{className:"whitespace-nowrap px-2.5 py-1.5 font-medium",children:x.common.role}),i.jsx("th",{className:"w-20 whitespace-nowrap px-2.5 py-1.5 text-right font-medium",children:x.common.actions})]})}),i.jsxs("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:[f.map(q=>i.jsxs("tr",{children:[i.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:q.userId}),i.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:i.jsx(Lt,{tone:"gray",children:q.role})}),i.jsx("td",{className:"whitespace-nowrap px-2.5 py-1 text-right",children:j&&q.role!=="owner"&&q.userId!==r?.userId&&i.jsx(ke,{size:"sm",variant:"ghost",onClick:()=>{L(q.userId)},children:x.project.removeMember})})]},q.userId)),j&&i.jsxs("tr",{children:[i.jsx("td",{className:"px-2.5 py-1.5",children:i.jsx(Xe,{placeholder:x.common.username,size:"sm",value:h,onChange:q=>g(q.target.value),onKeyDown:q=>{q.key==="Enter"&&E()}})}),i.jsx("td",{className:"whitespace-nowrap px-2.5 py-1.5",children:i.jsx(Lt,{tone:"gray",children:"member"})}),i.jsx("td",{className:"whitespace-nowrap px-2.5 py-1 text-right",children:i.jsx(ke,{size:"sm",disabled:!h.trim(),onClick:()=>{E()},children:x.project.addMember})})]})]})]})})]}),j&&i.jsx("div",{className:"border-t border-gray-100 pt-3 dark:border-gray-800",children:C==="default_project"?i.jsx("p",{className:"text-xs text-gray-400",children:x.project.deleteDefaultForbidden}):u.length<=1?i.jsx("p",{className:"text-xs text-gray-400",children:x.project.deleteLastForbidden}):i.jsx(ke,{size:"sm",variant:"danger",onClick:()=>N(!0),children:x.project.deleteProject})})]}),i.jsx(Gn,{open:w,title:x.project.deleteProject,onClose:()=>N(!1),onConfirm:()=>{_()},children:i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.project.deleteConfirm})})]})}const Q8="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",X8="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 el({label:e,hint:n,error:r,invalid:l,required:o,size:u="base",className:d,...f}){const[m,h]=b.useState(!1),g=m?x.auth.hidePassword:x.auth.showPassword,y=b.useId();return i.jsx(ro,{label:e,hint:n,error:r,errorId:y,required:o,children:i.jsxs("div",{className:"relative",children:[i.jsx(Xe,{...f,required:o,size:u,type:m?"text":"password",invalid:!!r||!!l,"aria-describedby":r?y:void 0,className:`${u==="sm"?"pr-8":"pr-10"} ${d??""}`}),i.jsx("button",{type:"button","aria-label":g,title:g,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 ${u==="sm"?"w-8":"w-10"}`,children:i.jsx("svg",{width:u==="sm"?14:16,height:u==="sm"?14:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:i.jsx("path",{d:m?X8:Q8})})})]})})}function Kk({open:e,onClose:n}){const{refresh:r}=bn(),[l,o]=b.useState(""),[u,d]=b.useState(""),[f,m]=b.useState(""),[h,g]=b.useState({}),[y,k]=b.useState(!1),w=()=>g(C=>C.old||C.new||C.confirm?{}:C);b.useEffect(()=>{e&&(o(""),d(""),m(""),g({}))},[e]);const N=async()=>{const C={};if(l||(C.old=x.common.requiredField),u||(C.new=x.common.requiredField),f||(C.confirm=x.common.requiredField),!C.confirm&&u!==f&&(C.confirm=x.account.passwordMismatch),C.old||C.new||C.confirm){g(C);return}k(!0),g({});try{await GS({oldPassword:l,newPassword:u}),await r(),n()}catch(j){j instanceof Ra&&j.code==="invalid_password"?g({new:ze(j)}):g({old:ze(j)})}finally{k(!1)}};return i.jsx(dn,{open:e,title:x.account.changePassword,onClose:n,footer:i.jsxs(i.Fragment,{children:[i.jsx(ke,{onClick:n,disabled:y,children:x.common.cancel}),i.jsx(ke,{variant:"primary",disabled:y,onClick:()=>{N()},children:x.common.save})]}),children:i.jsxs("div",{className:"space-y-3",children:[i.jsx(el,{label:x.account.oldPassword,required:!0,size:"sm",value:l,onChange:C=>{o(C.target.value),w()},error:h.old,autoComplete:"current-password",hint:x.account.oldPasswordHint,autoFocus:!0}),i.jsx(el,{label:x.account.newPassword,required:!0,size:"sm",value:u,onChange:C=>{d(C.target.value),w()},error:h.new,autoComplete:"new-password",hint:x.auth.passwordHint}),i.jsx(el,{label:x.account.confirmPassword,required:!0,size:"sm",value:f,onChange:C=>{m(C.target.value),w()},error:h.confirm,autoComplete:"new-password"})]})})}function ma({d:e,size:n=16}){return i.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:i.jsx("path",{d:e})})}const Fn={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"},Wk="M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z",Z8="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",H1="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",J8="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",eR="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",Oc="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",Yk="penguin.sidebarGroupMode";function tR(){return localStorage.getItem(Yk)==="agent"?"agent":"workspace"}const nR=e=>`penguin.sidebarCollapsedGroups.${e}`,aR=e=>`penguin.sidebarPinnedGroups.${e}`;function zc(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 P1(e,n){if(e)try{localStorage.setItem(e,JSON.stringify([...n]))}catch{}}const Dc=(e,n)=>`${n}\0${e}`;function rR({session:e}){return e.status==="running"?i.jsx("span",{title:x.chat.statusRunning,className:"h-1.5 w-1.5 shrink-0 animate-pulse rounded-full bg-emerald-500"}):e.status==="compacting"?i.jsx("span",{title:x.chat.statusCompacting,className:"h-1.5 w-1.5 shrink-0 rounded-full bg-amber-500"}):null}function q1({onNavigate:e,onCollapse:n}){const r=Qn(),{user:l,logout:o}=bn(),{mode:u,setMode:d,fontScale:f,setFontScale:m,accent:h,setAccent:g,currency:y,setCurrency:k}=Ll(),{lang:w,setLang:N}=Ga(),{projects:C,currentProject:j,setCurrentProjectId:E,reloadProjects:L,agents:_,currentAgent:q,setCurrentAgentId:H}=fn(),{sessions:I,byAgent:P,countsByAgent:ee,workspaceCountsByAgent:Z,isLoadedFor:D,hasMoreFor:V,loadMoreFor:B,loading:Y,remove:ne,replace:U}=ao(),$=Fv("/chat/:sessionId")?.params.sessionId??null,[G,me]=b.useState(!1),[M,R]=b.useState(!1),[O,T]=b.useState(!1),[X,ae]=b.useState(!1),[oe,ge]=b.useState(!1),Te=j?.projectId??null,se=Te===null?null:nR(Te),pe=Te===null?null:aR(Te),[be,Pe]=b.useState(tR),[Ze,De]=b.useState(()=>zc(se)),[dt,at]=b.useState(()=>zc(pe));b.useEffect(()=>{De(zc(se)),at(zc(pe))},[se,pe]);const[Mt,rt]=b.useState(new Set),[je,qe]=b.useState(new Set),[wt,$t]=b.useState(new Map),[At,St]=b.useState(null),[ba,ie]=b.useState(!1),[ye,we]=b.useState(null),[Oe,Fe]=b.useState(""),[Ot,nn]=b.useState(!1),[Pt,gt]=b.useState(null),zt=K=>{localStorage.setItem(Yk,K),Pe(K)},xe=b.useMemo(()=>y4(I),[I]),Ce=b.useMemo(()=>x4(Z),[Z]),tt=b.useMemo(()=>Cy(_,K=>K.agentId,dt),[_,dt]),ft=b.useMemo(()=>Cy(xe,K=>K.key,dt),[xe,dt]),jt=K=>be==="agent"?K.agentId:eu(K.workspace),xt=K=>{const de=new Set(Ze);de.has(K)?de.delete(K):de.add(K),De(de),P1(se,de)},Bt=K=>{const de=new Set(dt);de.has(K)?de.delete(K):de.add(K),at(de),P1(pe,de)},en=(K,de)=>`${de}\0${K}`,_n=(K,de,Se)=>{const Ee=en(K,de);qe(lt=>new Set(lt).add(Ee)),B(Se,de).finally(()=>{qe(lt=>{const st=new Set(lt);return st.delete(Ee),st})})},Ya=(K,de,Se)=>{const Ee=Dc(K,de),lt=!Mt.has(Ee);if(rt(st=>{const Je=new Set(st);return lt?Je.add(Ee):Je.delete(Ee),Je}),lt){const st=Se.filter(Je=>!D(Je,de));st.length>0&&B(st,de)}},La=b.useRef(null);b.useEffect(()=>{if(!$)return;const K=I.find(st=>st.sessionId===$);if(!K)return;const de=Ta(K);if(de==="active"||de==="archived")return;const Se=`${be}\0${$}`;if(La.current===Se)return;La.current=Se;const Ee=be==="agent"?K.agentId:eu(K.workspace),lt=Dc(Ee,de);rt(st=>st.has(lt)?st:new Set(st).add(lt)),D(K.agentId,de)||B([K.agentId],de)},[$,I,be,D,B]);const Xn=async K=>{!K.archived&&K.sessionId===$&&rt(de=>new Set(de).add(Dc(jt(K),"archived")));try{const de=await Mm(K.sessionId,{archived:!K.archived});U(de.session)}catch{}},Zn=async()=>{if(!ye)return;const K=Oe.trim();if(K){nn(!0),gt(null);try{const de=await Mm(ye.sessionId,{title:K});U(de.session),we(null)}catch(de){gt(ze(de))}finally{nn(!1)}}},ka=async()=>{if(!At)return;ie(!0);const K=At;try{if(await Ki(K.sessionId),ne(K.sessionId),l&&du(qk(l.userId,K.sessionId)),St(null),$===K.sessionId){const de=(P.get(K.agentId)??[]).filter(Se=>{const Ee=Ta(Se);return Se.sessionId!==K.sessionId&&(Ee==="active"||Ee==="schedule")});r(de[0]?`/chat/${de[0].sessionId}`:"/chat")}}catch(de){Et(ze(de))}finally{ie(!1)}},Jn=K=>{r(K),e?.()},kn=(K,de)=>{K&&H(K);const Se={...K?{agentId:K}:{},...de!==void 0?{workspace:de}:{}};r(`/chat/${Fa}`,Object.keys(Se).length>0?{state:Se}:void 0),e?.()},Ia=(_.find(K=>K.agentId==="default_agent")??_[0])?.agentId,wr=q?.agentId??Ia,ll=K=>{H(K.agentId),Jn(`/chat/${K.sessionId}`)},Ln=b.useMemo(()=>new Map(_.map(K=>[K.agentId,hn(K)])),[_]),Sr=(K,de)=>i.jsx("ul",{className:"space-y-0.5",children:K.map(Se=>i.jsx(lR,{s:Se,active:Se.sessionId===$,...de?{agentHint:Ln.get(Se.agentId)??Se.agentId}:{},onOpen:ll,onRename:Ee=>{gt(null),Fe(Ee.title??""),we(Ee)},onDelete:Ee=>St(Ee),onToggleArchive:Ee=>{Xn(Ee)}},Se.sessionId))}),Qa="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",In=(K,de,Se,Ee,lt,st)=>{const Je=Se[de],On=Math.max(st?.[de]??0,Je.length);if(On===0)return null;const Cr=Mt.has(Dc(K,de)),wa=Je.length<On&<.some(Is=>V(Is,de)),ea=je.has(en(K,de));return i.jsxs("div",{className:"mt-1",children:[i.jsxs("button",{type:"button",onClick:()=>Ya(K,de,lt),className:Qa,children:[i.jsx(gn,{open:Cr,size:12}),x.chat.folderGroups[de](On)]}),Cr&&Sr(Je,Ee),Cr&&wa&&i.jsxs("button",{type:"button","aria-label":x.chat.loadMore,disabled:ea,onClick:()=>_n(K,de,lt),className:`${Qa} disabled:opacity-60`,children:[i.jsx("span",{className:"w-3","aria-hidden":!0}),ea?x.common.loading:x.chat.loadMore]})]},de)},Ht=(K,de)=>{$t(Se=>{const Ee=new Map(Se);return Ee.set(K,(Se.get(K)??Cl)+Cl),Ee}),de.length>0&&_n(K,"active",de)},Kt=(K,de,Se,Ee,lt)=>{const st=wt.get(K)??Cl,Je=de.active.slice(0,st),On=lt("active"),Cr=Math.max(Ee?.active??0,de.active.length),wa=de.active.length>st||de.active.length<Cr&&On.some(Xa=>V(Xa,"active")),ea=Sh.map(Xa=>In(K,Xa,de,Se,lt(Xa),Ee)),Is=de.active.length===0&&ea.every(Xa=>Xa===null),Os=je.has(en(K,"active"));return i.jsxs(i.Fragment,{children:[Is?i.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:x.chat.noSessions}):Sr(Je,Se),wa&&i.jsxs("button",{type:"button","aria-label":x.chat.loadMore,disabled:Os,onClick:()=>Ht(K,On),className:`${Qa} mt-0.5 disabled:opacity-60`,children:[i.jsx("span",{className:"w-3","aria-hidden":!0}),Os?x.common.loading:x.chat.loadMore]}),ea]})},Oa=[{to:"/agents",label:x.nav.agents,icon:Fn.agents},{to:"/skills",label:x.nav.skills,icon:Fn.skills},{to:"/models",label:x.nav.models,icon:Fn.models},{to:"/usage",label:x.nav.usage,icon:Fn.usage},{to:"/traces",label:x.nav.traces,icon:Fn.traces},{to:"/benchmark",label:x.nav.benchmark,icon:Fn.benchmark}],jr=[{value:"light",label:x.settings.themeLight},{value:"dark",label:x.settings.themeDark},{value:"system",label:x.settings.followSystem}],_s=[{value:"en",label:x.settings.langEn},{value:"zh",label:x.settings.langZh},{value:"system",label:x.settings.followSystem}],Ls=[{value:"sm",label:x.settings.fontSmall},{value:"md",label:x.settings.fontMedium},{value:"lg",label:x.settings.fontLarge}],ce=[{value:"USD",label:x.models.currencyUsd},{value:"CNY",label:x.models.currencyCny}];return i.jsxs("div",{className:"flex h-full w-full flex-col",children:[i.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-2 pt-2",children:[n&&i.jsx("button",{type:"button",title:x.nav.collapseSidebar,"aria-label":x.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:i.jsx(ma,{d:"M15 6l-6 6 6 6M4 4v16",size:18})}),i.jsxs(_a,{open:G,setOpen:me,className:"min-w-0 flex-1",menuClass:"left-0 right-0 top-full mt-1 origin-top",button:i.jsxs("button",{type:"button",onClick:()=>me(!G),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:[i.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:j?_m(j):x.common.loading}),i.jsx("span",{className:"text-gray-400",children:i.jsx(jh,{})})]}),children:[C.map(K=>i.jsxs("button",{type:"button",onClick:()=>{E(K.projectId),me(!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 ${K.projectId===j?.projectId?"font-semibold":""}`,children:[i.jsx("span",{className:"truncate",children:_m(K)}),i.jsx(Lt,{tone:"gray",children:K.role})]},K.projectId)),i.jsxs("div",{className:"mt-1.5 border-t border-gray-100 pt-1.5 dark:border-gray-800",children:[i.jsxs("button",{type:"button",className:Oc,onClick:()=>{me(!1),T(!0)},children:["+ ",x.project.create]}),j&&i.jsx("button",{type:"button",className:Oc,onClick:()=>{me(!1),ae(!0)},children:x.project.settings})]})]})]}),i.jsxs("nav",{className:"shrink-0 space-y-0.5 px-2 pt-2",children:[i.jsxs("button",{type:"button",onClick:()=>kn(Ia),className:`flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-sm font-medium transition-colors duration-150 ${$===Fa?"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:[i.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:i.jsx(ma,{d:Wk})}),x.chat.newSessionMenu]}),Oa.map(K=>i.jsxs(kh,{to:K.to,onClick:()=>e?.(),className:({isActive:de})=>`flex items-center gap-2 rounded-md px-2.5 py-1.5 text-sm transition-colors duration-150 ${de?"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:[i.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:i.jsx(ma,{d:K.icon})}),K.label]},K.to))]}),i.jsxs("div",{className:"relative mt-3 min-h-0 flex-1 overflow-y-auto border-t border-gray-200 px-2 pb-2 dark:border-gray-800",children:[i.jsxs("div",{className:"flex items-center justify-between px-1 pt-2",children:[i.jsx("span",{className:"px-1 text-[11px] font-semibold uppercase tracking-wide text-gray-400 dark:text-gray-500",children:x.chat.sessionList}),i.jsx("div",{className:"flex items-center gap-0.5",children:[{value:"workspace",icon:H1,label:x.chat.groupByWorkspace},{value:"agent",icon:Fn.agents,label:x.chat.groupByAgent}].map(K=>i.jsx("button",{type:"button",title:K.label,"aria-label":K.label,"aria-pressed":be===K.value,onClick:()=>zt(K.value),className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md transition-colors duration-150 ${be===K.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:i.jsx(ma,{d:K.icon,size:14})},K.value))})]}),be==="agent"?Y&&_.length===0?i.jsx(qa,{rows:5}):tt.map(K=>{const de=jy(P.get(K.agentId)??[]),Se=Ze.has(K.agentId),Ee=dt.has(K.agentId);return i.jsxs("div",{className:"pt-2.5",children:[i.jsxs("div",{className:"group/header flex items-center gap-0.5 px-1 pb-0.5",children:[i.jsxs("button",{type:"button",onClick:()=>xt(K.agentId),"aria-expanded":!Se,"aria-label":Se?x.nav.expandGroup:x.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:[i.jsx(tl,{id:K.agentId,name:hn(K),size:18,className:"shrink-0 rounded"}),i.jsx("span",{className:"min-w-0 truncate text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:hn(K)}),i.jsx(gn,{open:!Se,size:12,className:"text-gray-400"}),i.jsx("span",{className:"min-w-0 flex-1"})]}),i.jsx(F1,{pinned:Ee,onToggle:()=>Bt(K.agentId)}),i.jsx("button",{type:"button",title:x.chat.newSessionMenu,"aria-label":x.chat.newSessionMenu,onClick:()=>kn(K.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:i.jsx(ma,{d:"M12 5v14M5 12h14",size:18})}),i.jsx("button",{type:"button",title:x.agent.settings,onClick:()=>Jn(`/agents/${K.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:i.jsx(ma,{d:Z8,size:16})})]}),Se?null:Kt(K.agentId,de,!1,ee.get(K.agentId),()=>[K.agentId])]},K.agentId)}):Y&&I.length===0?i.jsx(qa,{rows:5}):ft.length===0?i.jsx("p",{className:"px-2.5 pt-3 text-xs text-gray-400 dark:text-gray-600",children:x.chat.noSessions}):ft.map(K=>{const de=jy(K.sessions),Se=Ze.has(K.key),Ee=dt.has(K.key),lt=Ce.get(K.key),st=[...new Set(K.sessions.map(On=>On.agentId))],Je=On=>[...new Set([...lt?.agents[On]??[],...st])];return i.jsxs("div",{className:"pt-2.5",children:[i.jsxs("div",{className:"group/header flex items-center gap-0.5 px-1 pb-0.5",children:[i.jsxs("button",{type:"button",onClick:()=>xt(K.key),"aria-expanded":!Se,"aria-label":Se?x.nav.expandGroup:x.nav.collapseGroup,...K.fullPath!==null?{title:K.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:[i.jsx("span",{className:"shrink-0 text-gray-400 dark:text-gray-500",children:i.jsx(ma,{d:Se?H1:J8,size:15})}),i.jsx("span",{className:"min-w-0 truncate text-xs font-semibold text-gray-500 dark:text-gray-400",children:K.temp?x.chat.tempWorkspaces:K.label}),i.jsx("span",{className:"shrink-0 text-[11px] text-gray-400 dark:text-gray-500",children:Math.max(lt?.totals.active??0,de.active.length)}),i.jsx(gn,{open:!Se,size:12,className:"text-gray-400"}),i.jsx("span",{className:"min-w-0 flex-1"})]}),i.jsx(F1,{pinned:Ee,onToggle:()=>Bt(K.key)}),i.jsx("button",{type:"button",title:x.chat.newSessionInWorkspace,"aria-label":x.chat.newSessionInWorkspace,onClick:()=>kn(wr,K.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:i.jsx(ma,{d:"M12 5v14M5 12h14",size:18})})]}),Se?null:Kt(K.key,de,!0,lt?.totals,Je)]},K.key)})]}),i.jsx("div",{className:"shrink-0 border-t border-gray-200 p-2 dark:border-gray-800",children:i.jsxs(_a,{open:M,setOpen:R,menuClass:"bottom-full left-0 right-0 mb-1 origin-bottom",button:i.jsxs("button",{type:"button",onClick:()=>R(!M),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:[i.jsx("span",{className:"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:(l?.userId??"?").slice(0,1).toUpperCase()}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:l?.userId}),l?.isAdmin&&i.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:x.auth.admin})]}),children:[i.jsxs("div",{className:"space-y-2.5 px-3 py-2",children:[i.jsx(Li,{label:x.settings.theme,children:i.jsx(Tl,{options:jr,value:u,onChange:d})}),i.jsx(Li,{label:x.settings.fontSize,children:i.jsx(Tl,{options:Ls,value:f,onChange:m})}),i.jsx(Li,{label:x.settings.accent,children:i.jsx(sR,{value:h,onChange:g})}),i.jsx(Li,{label:x.models.currency,children:i.jsx(Tl,{options:ce,value:y,onChange:k,cols:2})}),i.jsx(Li,{label:x.settings.language,children:i.jsx(Tl,{options:_s,value:w,onChange:N})})]}),i.jsxs("div",{className:"mt-1 border-t border-gray-100 pt-1 dark:border-gray-800",children:[i.jsx("button",{type:"button",className:Oc,onClick:()=>{R(!1),ge(!0)},children:x.account.changePassword}),l?.isAdmin&&i.jsx("button",{type:"button",className:Oc,onClick:()=>{R(!1),Jn("/admin/users")},children:x.admin.users}),i.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:()=>{R(!1),o().then(()=>r("/login"))},children:x.auth.logout})]})]})}),i.jsx(Kk,{open:oe,onClose:()=>ge(!1)}),i.jsx(W8,{open:O,onClose:()=>T(!1),onCreated:K=>{T(!1),L().then(()=>E(K))}}),j&&i.jsx(Y8,{open:X,onClose:()=>ae(!1)}),i.jsx(dn,{open:ye!==null,title:x.chat.renameSession,onClose:()=>Ot?void 0:we(null),footer:i.jsxs(i.Fragment,{children:[i.jsx(ke,{onClick:()=>we(null),disabled:Ot,children:x.common.cancel}),i.jsx(ke,{variant:"primary",disabled:Ot||!Oe.trim(),onClick:()=>{Zn()},children:x.common.save})]}),children:i.jsx(Xe,{label:x.chat.renameSessionLabel,value:Oe,error:Pt??void 0,autoFocus:!0,maxLength:120,onChange:K=>{Fe(K.target.value),Pt&>(null)},onKeyDown:K=>{K.key==="Enter"&&Oe.trim()&&!Ot&&Zn()}})}),i.jsx(Gn,{open:At!==null,title:x.chat.deleteSession,confirmLabel:x.common.delete,busy:ba,onClose:()=>ba?void 0:St(null),onConfirm:()=>{ka()},children:i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:At?x.chat.deleteSessionConfirm(At.title??x.chat.defaultSessionTitle):""})})]})}function F1({pinned:e,onToggle:n}){return i.jsx("button",{type:"button",title:e?x.nav.unpinGroup:x.nav.pinGroup,"aria-label":x.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:i.jsx(ma,{d:eR,size:15})})}function lR({s:e,active:n,agentHint:r,onOpen:l,onRename:o,onDelete:u,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 i.jsx("li",{children:i.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:[i.jsxs("button",{type:"button",onClick:()=>l(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&&i.jsxs("span",{title:r,className:"flex shrink-0 items-center",children:[i.jsx(tl,{id:e.agentId,name:r,size:14,className:"rounded"}),i.jsx("span",{className:"sr-only",children:r})]}),i.jsx(bu,{text:e.title??x.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"}`}),i.jsx(rR,{session:e}),e.pendingApprovalCount>0&&i.jsx("span",{title:x.chat.pendingApprovals(e.pendingApprovalCount),children:i.jsx(Lt,{tone:"amber",children:e.pendingApprovalCount})})]}),i.jsxs("div",{className:"flex shrink-0 items-center",children:[i.jsx("button",{type:"button",title:x.chat.renameSession,"aria-label":x.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:i.jsx(ma,{d:"M4 20h4L18.5 9.5a2.1 2.1 0 0 0-3-3L5 17v3zM14 7l3 3",size:14})}),i.jsx("button",{type:"button",title:e.archived?x.chat.unarchiveSession:x.chat.archiveSession,"aria-label":e.archived?x.chat.unarchiveSession:x.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:i.jsx(ma,{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})}),i.jsx("button",{type:"button",title:x.chat.deleteSession,"aria-label":x.chat.deleteSession,onClick:()=>u(e),className:`${f} hover:bg-gray-300/60 hover:text-red-600 dark:hover:bg-gray-700 dark:hover:text-red-400`,children:i.jsx(ma,{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 Li({label:e,children:n}){return i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-[11px] font-medium text-gray-500 dark:text-gray-400",children:e}),n]})}function sR({value:e,onChange:n}){return i.jsx("div",{className:"flex items-center gap-1.5",children:PS.map(r=>i.jsx("button",{type:"button",title:x.settings.accentNames[r.value],"aria-label":x.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 iR="M8 10h8M8 14h5M21 12a9 9 0 1 1-4.2-7.6L21 4v5h-5",bm=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 oR({onExpand:e}){const{user:n}=bn(),r=Qn(),{agents:l,setCurrentAgentId:o}=fn(),{sessions:u,loading:d}=ao(),f=Fv("/chat/:sessionId")?.params.sessionId??null,m=f!==null&&f!==Fa,h=b.useMemo(()=>nb(u),[u]),g=()=>{h&&(o(h.agentId),r(`/chat/${h.sessionId}`))},y=()=>{const w=(l.find(N=>N.agentId==="default_agent")??l[0])?.agentId;w&&o(w),r(`/chat/${Fa}`,w?{state:{agentId:w}}:void 0)},k=[{to:"/agents",label:x.nav.railAgents,icon:Fn.agents},{to:"/skills",label:x.nav.skills,icon:Fn.skills},{to:"/models",label:x.nav.models,icon:Fn.models},{to:"/usage",label:x.nav.usage,icon:Fn.usage},{to:"/traces",label:x.nav.traces,icon:Fn.traces},{to:"/benchmark",label:x.nav.benchmark,icon:Fn.benchmark}];return i.jsxs("div",{className:"flex h-full flex-col items-center gap-1 py-2.5",children:[i.jsx("button",{type:"button",title:x.nav.expandSidebar,"aria-label":x.nav.expandSidebar,onClick:e,className:"flex h-8 w-8 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:i.jsx(Ve,{d:"M9 6l6 6-6 6M20 4v16",size:18})}),i.jsxs("nav",{className:"mt-1 flex flex-col items-center gap-1",children:[i.jsx("button",{type:"button",title:x.nav.lastConversation,"aria-label":x.nav.lastConversation,disabled:!h&&!d,onClick:g,className:h||d?bm(m):"flex h-8 w-8 cursor-not-allowed items-center justify-center rounded-md text-gray-300 dark:text-gray-700",children:i.jsx(Ve,{d:iR,size:18})}),i.jsx("button",{type:"button",title:x.chat.newSessionMenu,"aria-label":x.chat.newSessionMenu,onClick:y,className:bm(f===Fa),children:i.jsx(Ve,{d:Wk,size:18})}),k.map(w=>i.jsx(kh,{to:w.to,title:w.label,"aria-label":w.label,className:({isActive:N})=>bm(N),children:i.jsx(Ve,{d:w.icon,size:18})},w.to))]}),i.jsx("button",{type:"button",title:`${n?.userId??""} · ${x.nav.expandSidebar}`,"aria-label":n?.userId??x.auth.admin,onClick:e,className:"mt-auto flex h-8 w-8 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 cR(){const{user:e}=bn(),[n,r]=b.useState(!1),[l,o]=b.useState(!1),[u,d]=b.useState(()=>localStorage.getItem("penguin.sidebarCollapsed")==="1"),f=()=>d(m=>{const h=!m;return localStorage.setItem("penguin.sidebarCollapsed",h?"1":"0"),h});return i.jsxs("div",{className:"flex h-full",children:[i.jsx("aside",{className:`hidden shrink-0 border-r border-gray-200 bg-gray-50 md:block dark:border-gray-800 dark:bg-gray-900 ${u?"w-12":"w-64 lg:w-72"}`,children:u?i.jsx(oR,{onExpand:f}):i.jsx(q1,{onCollapse:f})}),i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[i.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:[i.jsx("button",{type:"button","aria-label":x.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:i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.7",strokeLinecap:"round","aria-hidden":!0,children:i.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})})}),i.jsx("span",{className:"text-sm font-semibold",children:x.appName})]}),e?.passwordIsInitial&&i.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:[i.jsx("span",{children:x.account.initialPasswordBanner}),i.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:x.account.changeNow})]}),i.jsx("main",{className:"min-h-0 flex-1 overflow-hidden",children:i.jsx(M5,{})})]}),i.jsx(Kk,{open:l,onClose:()=>o(!1)}),i.jsx(b4,{open:n,side:"left",title:x.appName,onClose:()=>r(!1),children:i.jsx("div",{className:"h-full bg-gray-50 dark:bg-gray-900",children:i.jsx(q1,{onNavigate:()=>r(!1)})})})]})}const sp=1440,ip=900,rh=3,uR=3,V1=sp/rh,G1=ip/uR,Uc=28,$c=14;function dR(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 fR(e,n){return e.x1-$c<=n.x2&&e.x2+$c>=n.x1&&e.y1-$c<=n.y2&&e.y2+$c>=n.y1}function mR(e,n,r,l){return{x1:Math.min(e,r),y1:Math.min(n,l),x2:Math.max(e,r),y2:Math.max(n,l)}}const hR=[{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 pR(){const e=dR(12696599),n=[];for(const{cell:r,edge:l}of hR){const o=r%rh*V1+Uc,u=Math.floor(r/rh)*G1+Uc,d=o+V1-2*Uc,f=u+G1-2*Uc,m=[],h=(_,q,H,I)=>{const P=H[0]>0?d-_:H[0]<0?_-o:H[1]>0?f-q:q-u;for(let ee=Math.min(60+e()*150,P);ee>=40;ee/=2){const Z=Math.round(_+H[0]*ee),D=Math.round(q+H[1]*ee),V=mR(_,q,Z,D);if(m.every((B,Y)=>I.has(Y)||!fR(V,B)))return m.push(V),[Z,D]}return null},g=(_,q,H)=>(H-_)*(.35+e()*.3)>_-q?1:-1,y=(_,q,H,I,P,ee,Z)=>{let[D,V]=[_,q],B=H;const Y=[`M${Math.round(D)},${Math.round(V)}`],ne=[];for(let U=0;U<I;U+=1){const z=U===0?Z:new Set([m.length-1]),$=h(D,V,B,z);if(!$)break;[D,V]=$,Y.push(`L${D},${V}`),ne.push([D,V]),B=B[0]!==0?[0,g(V,u,f)]:[g(D,o,d),0]}return ne.length>=2&&n.push({d:Y.join(" "),end:ne[ne.length-1],dur:P,delay:ee}),ne},k=.15+e()*.7,w=l==="left"?0:l==="right"?sp:Math.round(o+(d-o)*k),N=l==="top"?0:l==="bottom"?ip:Math.round(u+(f-u)*k),C=l==="left"?[1,0]:l==="right"?[-1,0]:l==="top"?[0,1]:[0,-1],j=12+e()*8,E=e()*3.2,L=y(w,N,C,3+Math.floor(e()*3),j,E,new Set);if(r%2===0&&L.length>=3){const[_,q]=L[1],[H,I]=L[2],P=[-Math.sign(H-_),-Math.sign(I-q)];y(_,q,P,2,j,E+1.4,new Set([1,2]))}}return n}const gR=pR();function xR(){return i.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 ${sp} ${ip}`,preserveAspectRatio:"xMidYMid slice",fill:"none",children:gR.map((e,n)=>i.jsxs("g",{style:{"--trace-dur":`${e.dur.toFixed(1)}s`},children:[i.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`}}),i.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 yR(){Ka(x.auth.login);const{login:e}=bn(),{mode:n,setMode:r}=Ll(),{lang:l,setLang:o}=Ga(),u=Qn(),[d,f]=b.useState(""),[m,h]=b.useState(""),[g,y]=b.useState({}),[k,w]=b.useState(!1),N=()=>y(L=>L.userId||L.password||L.form?{}:L),C=async()=>{const L={};if(d.trim()||(L.userId=x.common.requiredField),m||(L.password=x.common.requiredField),L.userId||L.password){y(L);return}w(!0),y({});try{await e(d.trim(),m),u("/chat",{replace:!0})}catch(_){y({form:ze(_)})}finally{w(!1)}},j=[{value:"light",label:x.settings.themeLight},{value:"dark",label:x.settings.themeDark},{value:"system",label:x.settings.followSystem}],E=[{value:"en",label:x.settings.langEn},{value:"zh",label:x.settings.langZh},{value:"system",label:x.settings.followSystem}];return i.jsxs("div",{className:"relative flex min-h-full items-center justify-center overflow-hidden p-4",children:[i.jsx(xR,{}),i.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:[i.jsx("div",{"aria-label":x.settings.language,children:i.jsx(Tl,{options:E,value:l,onChange:o})}),i.jsx("div",{"aria-label":x.settings.theme,children:i.jsx(Tl,{options:j,value:n,onChange:r})})]}),i.jsxs("div",{className:"anim-rise relative w-full max-w-sm",children:[i.jsx(Pk,{className:"mx-auto mb-3 h-16 w-16 rounded-2xl"}),i.jsx("h1",{className:"mb-6 text-center text-3xl font-semibold tracking-tight",children:x.appName}),i.jsxs("div",{className:"rounded-xl border border-gray-200 bg-white p-6 shadow-sm dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("form",{className:"space-y-4",onSubmit:L=>{L.preventDefault(),C()},children:[i.jsx(Xe,{label:x.common.username,required:!0,value:d,onChange:L=>{f(L.target.value),N()},error:g.userId,autoComplete:"username",autoFocus:!0}),i.jsx(el,{label:x.auth.password,required:!0,value:m,onChange:L=>{h(L.target.value),N()},error:g.password,autoComplete:"current-password"}),g.form&&i.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:g.form}),i.jsx(ke,{type:"submit",variant:"primary",className:"w-full justify-center py-2.5 text-sm font-semibold",disabled:k,children:x.auth.login})]}),i.jsx("p",{className:"mt-4 text-center text-xs text-gray-400 dark:text-gray-500",children:x.auth.defaultAdminNote})]})]})]})}const Ii=100,Zr=30,da=2;function vR({data:e,label:n,className:r=""}){const l=Math.max(1,...e),o=e.length>1?(Ii-2*da)/(e.length-1):0,u=e.map((h,g)=>[da+g*o,Zr-da-h/l*(Zr-2*da)]),d=`${da},${Zr-da} ${Ii-da},${Zr-da}`,f=u.length>1?u.map(([h,g])=>`${h},${g}`).join(" "):d,m=u.length>1?`${f} ${Ii-da},${Zr-da} ${da},${Zr-da}`:null;return i.jsxs("svg",{width:Ii,height:Zr,viewBox:`0 0 ${Ii} ${Zr}`,role:"img","aria-label":n,className:`text-emerald-600 dark:text-emerald-500 ${r}`,children:[i.jsx("title",{children:n}),m!==null&&i.jsx("polygon",{points:m,fill:"currentColor",fillOpacity:"0.12"}),i.jsx("polyline",{points:f,fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const bR=new Set(["default_agent"]),Ba={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 kR(){const e=Qn();Ka(x.nav.agents);const{locale:n}=Ga(),{currentProject:r,agents:l,agentsLoading:o,reloadAgents:u,setCurrentAgentId:d}=fn(),[f,m]=b.useState(!1),[h,g]=b.useState(""),[y,k]=b.useState(""),[w,N]=b.useState(""),[C,j]=b.useState(void 0),[E,L]=b.useState(!1),_=()=>{g(""),k(""),N(""),j(void 0),m(!0)},[q,H]=b.useState(null),[I,P]=b.useState(null),ee=r?.projectId,Z=async()=>{if(!ee)return;const B=h.trim();if(!B){j(x.common.requiredField);return}if(!Gk.test(B)){j(x.agent.idHint);return}L(!0),j(void 0);try{const Y={agentId:B};y.trim()&&(Y.name=y.trim()),w.trim()&&(Y.description=w.trim());const ne=await ij(ee,Y);m(!1),await u(),d(ne.agent.agentId),e(`/agents/${ne.agent.agentId}`)}catch(Y){j(ze(Y))}finally{L(!1)}},D=B=>{d(B),e(`/chat/${Fa}`,{state:{agentId:B}})},V=async()=>{if(!(!ee||!q)){L(!0),P(null);try{await xj(ee,q.agentId),H(null),await u()}catch(B){P(ze(B))}finally{L(!1)}}};return i.jsxs("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:[i.jsxs("div",{className:"mx-auto max-w-5xl",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2",children:[i.jsx("h1",{className:"text-xl font-semibold",children:x.agent.listTitle}),i.jsx(ke,{variant:"primary",onClick:_,children:x.agent.create})]}),o?i.jsx("div",{className:"space-y-3",children:Array.from({length:4},(B,Y)=>i.jsxs(db,{className:"flex flex-wrap items-center gap-x-6 gap-y-2 px-5 py-4",children:[i.jsxs("div",{className:"min-w-[14rem] flex-1",children:[i.jsx(Ut,{className:"h-[18px] w-40"}),i.jsx(Ut,{className:"mt-1.5 h-4 w-2/3"}),i.jsx(Ut,{className:"mt-1.5 h-4 w-48"})]}),i.jsx(Ut,{className:"hidden h-9 w-40 md:block"}),i.jsx(Ut,{className:"h-8 w-52"})]},Y))}):l.length===0?i.jsx(nl,{title:x.common.none}):i.jsx("div",{className:"space-y-3",children:l.map(B=>{const Y=bR.has(B.agentId);return i.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:[i.jsxs("div",{className:"min-w-[14rem] flex-1",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(tl,{id:B.agentId,name:hn(B),size:18,className:"shrink-0 rounded"}),i.jsx("span",{className:"min-w-0 truncate text-base font-bold",children:hn(B)}),i.jsx("span",{className:"hidden shrink-0 font-mono text-xs text-gray-400 md:inline dark:text-gray-500",children:B.agentId}),i.jsxs(Lt,{tone:"gray",children:["v",B.version]}),B.activeSessionCount>0&&i.jsxs(Lt,{tone:"brand",children:[x.agent.activeSessions," ",B.activeSessionCount]})]}),i.jsx("p",{className:"mt-1.5 min-h-4 truncate text-xs text-gray-500 dark:text-gray-400",children:B.description??""}),i.jsxs("div",{className:"mt-1.5 flex items-center gap-x-2.5 text-xs text-gray-500 dark:text-gray-400",children:[i.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.agent.sessionCount(B.sessionCount),children:[i.jsx(Ve,{d:Ba.sessions,size:12}),B.sessionCount]}),i.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.agent.toolCount(B.toolCount),children:[i.jsx(Ve,{d:Jt.toolCalls,size:12}),B.toolCount]}),i.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.agent.vaultKeyCount(B.vaultKeyCount),children:[i.jsx(Ve,{d:Ba.vaultKeys,size:12}),B.vaultKeyCount]}),i.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.agent.scheduleCount(B.scheduleCount),children:[i.jsx(Ve,{d:Ba.schedules,size:12}),B.scheduleCount]}),i.jsxs("span",{className:"inline-flex min-w-[2.25rem] shrink-0 items-center gap-1 tabular-nums",title:x.skills.skillCount(B.skillCount),children:[i.jsx(Ve,{d:Ba.skills,size:12}),B.skillCount]}),i.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",title:`${x.agent.updatedAt} ${B.updatedAt?Kn(B.updatedAt):"—"}`,children:[i.jsx(Ve,{d:Jt.elapsed,size:12}),B.updatedAt?L4(B.updatedAt,n):"—"]})]})]}),i.jsx(vR,{data:B.sessionActivity,label:x.agent.activity(B.sessionActivity.length||30),className:"hidden shrink-0 md:block"}),i.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[i.jsxs(ke,{size:"sm",variant:"primary",onClick:()=>D(B.agentId),children:[i.jsx(Ve,{d:Ba.newChat}),x.chat.newSessionMenu]}),i.jsxs(ke,{size:"sm",onClick:()=>{d(B.agentId),e(`/agents/${B.agentId}`)},children:[i.jsx(Ve,{d:Ba.settings,className:"text-gray-600 dark:text-gray-300"}),x.common.settings]}),i.jsx(ke,{size:"icon",title:x.nav.usage,"aria-label":x.nav.usage,onClick:()=>e(`/usage?agentId=${encodeURIComponent(B.agentId)}`),children:i.jsx(Ve,{d:Ba.usage,size:15,className:"text-gray-600 dark:text-gray-300"})}),i.jsx(ke,{size:"icon",title:x.nav.traces,"aria-label":x.nav.traces,onClick:()=>e(`/traces?agentId=${encodeURIComponent(B.agentId)}`),children:i.jsx(Ve,{d:Ba.traces,size:15,className:"text-gray-600 dark:text-gray-300"})}),Y?i.jsx("span",{role:"img",title:x.agent.builtinUndeletable,"aria-label":x.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:i.jsx(Ve,{d:Ba.trash,size:15})}):i.jsx(ke,{size:"icon",variant:"danger",title:x.agent.deleteAgent,"aria-label":x.agent.deleteAgent,onClick:()=>H({agentId:B.agentId,name:hn(B)}),children:i.jsx(Ve,{d:Ba.trash,size:15})})]})]},B.agentId)})})]}),i.jsx(dn,{open:f,title:x.agent.createTitle,onClose:()=>m(!1),footer:i.jsxs(i.Fragment,{children:[i.jsx(ke,{onClick:()=>m(!1),children:x.common.cancel}),i.jsx(ke,{variant:"primary",disabled:E,onClick:()=>{Z()},children:x.common.create})]}),children:i.jsxs("div",{className:"space-y-3",children:[i.jsx(Xe,{label:x.agent.id,required:!0,size:"sm",value:h,onChange:B=>{g(B.target.value),j(void 0)},error:C,hint:x.agent.idHint,autoFocus:!0}),i.jsx(Xe,{label:x.common.name,size:"sm",value:y,onChange:B=>k(B.target.value),hint:x.agent.nameHint}),i.jsx(js,{label:x.agent.description,size:"sm",rows:3,value:w,onChange:B=>N(B.target.value)})]})}),i.jsxs(Gn,{open:q!==null,title:x.agent.deleteAgent,busy:E,onClose:()=>{H(null),P(null)},onConfirm:()=>{V()},children:[i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:q?x.agent.deleteConfirm(q.name):""}),I&&i.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:I})]})]})}function wR({items:e,active:n,onChange:r}){return i.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(l=>i.jsx("button",{type:"button",role:"tab","aria-selected":l.key===n,onClick:()=>r(l.key),className:`-mb-px whitespace-nowrap border-b-2 px-3 py-2 text-sm transition-colors duration-150 ${l.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:l.label},l.key))})}const K1=4,W1=16;function Qk({open:e,onClose:n,estimatedHeight:r,panelWidth:l}){const o=b.useRef(null),u=b.useRef(null),[d,f]=b.useState(null),m=b.useRef(n);return m.current=n,b.useLayoutEffect(()=>{if(!e||!o.current)return;const h=o.current.getBoundingClientRect(),g=window.innerHeight-h.bottom,y=h.top,k=Math.min(r,window.innerHeight*.7),w=g<k&&y>g,N=l??h.width,C=Math.max(W1,Math.min(h.left,window.innerWidth-N-W1));f({topPx:w?void 0:h.bottom+K1,bottomPx:w?window.innerHeight-h.top+K1:void 0,left:C,triggerWidth:h.width})},[e,r,l]),b.useEffect(()=>{if(!e)return;const h=w=>{const N=w.target;o.current?.contains(N)||u.current?.contains(N)||m.current()},g=w=>{w.key==="Escape"&&(w.stopPropagation(),m.current())},y=w=>{u.current?.contains(w.target)||m.current()},k=()=>m.current();return window.addEventListener("mousedown",h),window.addEventListener("keydown",g,!0),window.addEventListener("scroll",y,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("mousedown",h),window.removeEventListener("keydown",g,!0),window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",k)}},[e]),{triggerRef:o,panelRef:u,position:d}}const SR=288,jR={base:"text-base",sm:"text-xs"},CR={base:"text-xs",sm:"text-[11px]"};function lh({options:e,value:n,onChange:r,placeholder:l,mono:o,label:u,error:d,required:f,fullWidth:m,size:h="base","aria-label":g}){const[y,k]=b.useState(!1),{triggerRef:w,panelRef:N,position:C}=Qk({open:y,onClose:()=>k(!1),estimatedHeight:e.length*48+16,panelWidth:SR}),j=n!=null?e.find(_=>_.value===n):void 0,E=b.useId(),L=i.jsxs(i.Fragment,{children:[i.jsxs("button",{ref:w,type:"button","aria-label":g,"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(_=>!_),className:`flex items-center gap-2 ${Th} ${Mh[h]} ${d?wu:""}`+(m?" w-full justify-between":""),children:[i.jsx("span",{className:`min-w-0 truncate ${o?"font-mono":""}`,children:j?.triggerLabel??l??"—"}),i.jsx(jh,{className:"text-gray-400"})]}),y&&C&&Es.createPortal(i.jsx("div",{ref:N,role:"listbox",style:{position:"fixed",top:C.topPx,bottom:C.bottomPx,left:C.left,minWidth:C.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.jsxs("button",{type:"button",role:"option","aria-selected":_.value===n,onClick:()=>{r(_.value),k(!1)},className:`block ${ob} hover:bg-gray-100 dark:hover:bg-gray-800 ${_.value===n?"bg-gray-100 dark:bg-gray-800":""}`,children:[i.jsxs("span",{className:"flex items-center justify-between gap-2",children:[i.jsx("span",{className:`${jR[h]} ${_.value===n?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`,children:_.label}),_.value===n&&i.jsx(rb,{className:"text-gray-500 dark:text-gray-400"})]}),i.jsx("span",{className:`mt-0.5 block ${CR[h]} text-gray-500 dark:text-gray-400`,children:_.description})]},_.value))}),document.body)]});return i.jsx(ro,{label:u,error:d,errorId:E,required:f,children:L})}function Xk({checked:e,onChange:n,disabled:r,className:l,...o}){return i.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")+` ${l??""}`,...o,children:i.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"}`})})}const NR=/^[A-Za-z_][A-Za-z0-9_]*$/;function TR({agentId:e}){const{currentProject:n}=fn(),r=n?.projectId??null,l=n?.role==="owner",[o,u]=b.useState(null),[d,f]=b.useState(null),[m,h]=b.useState(!1),[g,y]=b.useState(!1),[k,w]=b.useState(""),[N,C]=b.useState(""),[j,E]=b.useState({}),L=()=>E(Y=>Y.key||Y.value?{}:Y),[_,q]=b.useState(null),[H,I]=b.useState(null),P=b.useCallback(async()=>{if(!(!r||!e)){u(null),f(null);try{const Y=await rj(r,e);u(Y.entries)}catch(Y){f(ze(Y))}}},[r,e]);b.useEffect(()=>{P()},[P]);const ee=async Y=>{if(!r||!e)return x.common.unknownError;h(!0);try{const ne=await lj(r,e,Y);return u(ne.entries),ga(x.common.saved),null}catch(ne){return ze(ne)}finally{h(!1)}},Z=Y=>(o??[]).filter(ne=>ne.key!==Y).map(ne=>({key:ne.key})),D=()=>{w(""),C(""),E({}),y(!0)},V=async()=>{const Y=k.trim(),ne={};if(Y?NR.test(Y)||(ne.key=x.vault.keyInvalid):ne.key=x.common.requiredField,N||(ne.value=x.vault.valueRequired),ne.key||ne.value){E(ne);return}if(E({}),H!==Y&&(o??[]).some(z=>z.key===Y)){I(Y);return}I(null);const U=await ee({entries:[...Z(Y),{key:Y,value:N}]});if(U!==null){E({key:U});return}y(!1)},B=async()=>{if(_===null)return;const Y=await ee({entries:Z(_)});Y!==null&&Et(Y),q(null)};return r?i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:x.vault.desc}),!l&&i.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:x.vault.readOnlyHint})]}),o===null?i.jsx(qa,{rows:4}):o.length===0?i.jsx("p",{className:"py-2 text-xs text-gray-400 dark:text-gray-500",children:x.vault.empty}):i.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:i.jsxs("table",{className:"w-full min-w-[420px] text-left text-sm",children:[i.jsx("thead",{children:i.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:[i.jsx("th",{className:"px-3 py-2.5",children:x.vault.key}),i.jsx("th",{className:"px-3 py-2.5",children:x.vault.valueMasked}),i.jsx("th",{className:"px-3 py-2.5"})]})}),i.jsx("tbody",{children:o.map(Y=>i.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:[i.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:Y.key}),i.jsx("td",{className:"px-3 py-2 font-mono text-xs text-gray-500 dark:text-gray-400",children:Y.valueMasked}),i.jsx("td",{className:"px-3 py-2 text-right",children:l&&i.jsx(ke,{size:"sm",variant:"ghost",disabled:m,onClick:()=>q(Y.key),children:x.vault.remove})})]},Y.key))})]})}),l&&o!==null&&i.jsx(ke,{size:"sm",variant:"primary",disabled:m,onClick:D,children:x.vault.add}),i.jsx(dn,{open:g,title:x.vault.addTitle,onClose:()=>y(!1),footer:i.jsxs(i.Fragment,{children:[i.jsx(ke,{onClick:()=>y(!1),children:x.common.cancel}),i.jsx(ke,{variant:"primary",disabled:m,onClick:()=>{V()},children:x.vault.add})]}),children:i.jsxs("div",{className:"space-y-3",children:[i.jsx(Xe,{size:"sm",label:x.vault.key,required:!0,hint:x.vault.keyHint,error:j.key,value:k,onChange:Y=>{w(Y.target.value),L()},className:"font-mono",placeholder:"OPENAI_API_KEY",autoComplete:"off"}),i.jsx(el,{size:"sm",label:x.vault.value,required:!0,error:j.value,value:N,onChange:Y=>{C(Y.target.value),L()},className:"font-mono",autoComplete:"off",onKeyDown:Y=>{Y.key==="Enter"&&!m&&V()}})]})}),i.jsx(Gn,{open:H!==null,title:x.vault.overwriteTitle,tone:"primary",confirmLabel:x.common.save,busy:m,onClose:()=>I(null),onConfirm:()=>{V()},children:i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:H!==null?x.vault.overwriteConfirm(H):""})}),i.jsx(Gn,{open:_!==null,title:x.vault.deleteTitle,busy:m,onClose:()=>q(null),onConfirm:()=>{B()},children:i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:_!==null?x.vault.deleteConfirm(_):""})}),d&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:d})]}):null}function MR(e){const n=[];return b.Children.forEach(e,r=>{if(!b.isValidElement(r)||r.type!=="option")return;const l=r.props;n.push({value:l.value!==void 0?String(l.value):"",label:l.children??"",...l.disabled?{disabled:!0}:{}})}),n}const ER=`flex w-full items-center gap-2 text-left ${Th} disabled:cursor-not-allowed disabled:opacity-60`,AR={base:"text-base",sm:"text-xs"};function eo({label:e,hint:n,error:r,required:l,size:o="base",className:u,children:d,value:f,onChange:m,disabled:h}){const g=MR(d),y=String(f??""),k=g.find(H=>H.value===y),w=b.useId(),[N,C]=b.useState(!1),{triggerRef:j,panelRef:E,position:L}=Qk({open:N,onClose:()=>C(!1),estimatedHeight:g.length*36+8}),_=H=>{C(!1),m?.({target:{value:H}}),j.current?.focus()},q=i.jsxs(i.Fragment,{children:[i.jsxs("button",{ref:j,type:"button",disabled:h,"aria-haspopup":"listbox","aria-expanded":N,"aria-required":l||void 0,"aria-invalid":r?!0:void 0,"aria-describedby":r?w:void 0,onClick:()=>C(H=>!H),className:`${ER} ${Mh[o]} ${r?wu:""} ${u??""}`,children:[i.jsx("span",{className:"min-w-0 flex-1 truncate",children:k?.label??g[0]?.label??""}),i.jsx(jh,{className:"text-gray-400"})]}),N&&L&&Es.createPortal(i.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:L.left,width:L.triggerWidth,top:L.topPx,bottom:L.bottomPx},children:g.map((H,I)=>i.jsxs("button",{type:"button",role:"option","aria-selected":H.value===y,disabled:H.disabled,onClick:()=>_(H.value),className:`flex items-center ${ob} ${AR[o]} disabled:opacity-50 ${H.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:[i.jsx("span",{className:"min-w-0 flex-1 truncate",children:H.label}),H.value===y&&i.jsx(rb,{className:"text-gray-500 dark:text-gray-400"})]},`${H.value}-${I}`))}),document.body)]});return i.jsx(ro,{label:e,hint:n,error:r,errorId:w,required:l,children:q})}const RR={active:"green",disabled:"gray",expired:"amber",done:"brand",missed:"amber",invalid:"red"};function Y1(e){if(!e)return"";const n=new Date(e);if(Number.isNaN(n.getTime()))return"";const r=l=>l<10?`0${l}`:`${l}`;return`${n.getFullYear()}-${r(n.getMonth()+1)}-${r(n.getDate())}T${r(n.getHours())}:${r(n.getMinutes())}`}const km=e=>JSON.stringify([e.provider,e.modelId]),_R=e=>{if(!e)return null;const[n,r]=JSON.parse(e);return{provider:n,modelId:r}},Q1=e=>`${e.modelId} · ${pa(e.provider)?.label??e.provider}`,X1=e=>e.modelId&&e.provider?{provider:e.provider,modelId:e.modelId}:null,LR={editing:null,name:"",prompt:"",enabled:!0,startAt:"",endAt:"",period:"",target:"new",sessionId:"",workspace:"",model:null};function IR({agentId:e}){const{currentProject:n}=fn(),r=n?.projectId??null,l=n?.role==="owner",[o,u]=b.useState(null),[d,f]=b.useState(null),[m,h]=b.useState(!1),[g,y]=b.useState(null),[k,w]=b.useState(null),[N,C]=b.useState({}),[j,E]=b.useState(null),[L,_]=b.useState(null),[q,H]=b.useState([]),I=b.useCallback(async()=>{if(!(!r||!e)){u(null),f(null);try{u(await kj(r,e))}catch(U){f(ze(U))}}},[r,e]);b.useEffect(()=>{I()},[I]),b.useEffect(()=>{!r||!l||pu(r).then(U=>H(U.models)).catch(()=>H([]))},[r,l]);const P=U=>{C(z=>z.name||z.prompt||z.startAt||z.sessionId?{}:z),E(z=>z&&null),y(z=>z===null?z:{...z,...U})},ee=U=>{C({}),E(null),y(U),w(U)},Z=async()=>{if(!r||g===null)return;E(null);const U=g.editing??g.name.trim(),z={};if(U||(z.name=x.common.requiredField),g.prompt.trim()||(z.prompt=x.common.requiredField),g.startAt||(z.startAt=x.common.requiredField),g.target==="session"&&!g.sessionId.trim()&&(z.sessionId=x.common.requiredField),z.name||z.prompt||z.startAt||z.sessionId){C(z);return}if(C({}),g.editing!==null&&JSON.stringify(g)===JSON.stringify(k)){Ol(x.common.noChangesToSave);return}const $={prompt:g.prompt,enabled:g.enabled,startAt:new Date(g.startAt).toISOString(),...g.period.trim()?{period:g.period.trim()}:{},...g.endAt?{endAt:new Date(g.endAt).toISOString()}:{},...g.target==="session"&&g.sessionId.trim()?{sessionId:g.sessionId.trim()}:{},...g.target==="new"&&g.workspace.trim()?{workspace:g.workspace.trim()}:{},...g.target==="new"&&g.model?{modelId:g.model.modelId,provider:g.model.provider}:{}};h(!0);try{g.editing!==null?await fy(r,e,g.editing,$):await wj(r,e,{name:U,...$}),y(null),ga(x.common.saved),await I()}catch(G){E(ze(G))}finally{h(!1)}},D=async U=>{if(!r)return;h(!0);const z=X1(U);try{await fy(r,e,U.name,{prompt:U.prompt,enabled:!U.enabled,startAt:U.startAt,...U.period!==void 0?{period:U.period}:{},...U.endAt!==void 0?{endAt:U.endAt}:{},...U.sessionId!==void 0?{sessionId:U.sessionId}:{},...U.workspace!==void 0?{workspace:U.workspace}:{},...z?{modelId:z.modelId,provider:z.provider}:{}}),ga(x.common.saved),await I()}catch($){Et(ze($))}finally{h(!1)}},V=U=>{ee({editing:U.name,name:U.name,prompt:U.prompt,enabled:U.enabled,startAt:Y1(U.startAt),endAt:Y1(U.endAt),period:U.period??"",target:U.sessionId?"session":"new",sessionId:U.sessionId??"",workspace:U.workspace??"",model:X1(U)})},B=async()=>{if(!(!r||L===null)){h(!0);try{await Sj(r,e,L),g?.editing===L&&y(null),await I()}catch(U){Et(ze(U))}finally{h(!1),_(null)}}};if(!r)return null;const Y=o?.schedules??[],ne=o?.invalidFiles??[];return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:x.schedule.desc}),!l&&i.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:x.schedule.readOnlyHint})]}),o===null?i.jsx(qa,{rows:4}):Y.length===0?i.jsx("p",{className:"py-2 text-xs text-gray-400 dark:text-gray-500",children:x.schedule.empty}):i.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:i.jsxs("table",{className:"w-full min-w-[640px] text-left text-sm",children:[i.jsx("thead",{children:i.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:[i.jsx("th",{className:"px-3 py-2.5",children:x.common.name}),i.jsx("th",{className:"px-3 py-2.5",children:x.schedule.colStatus}),i.jsx("th",{className:"px-3 py-2.5",children:x.schedule.colPeriod}),i.jsx("th",{className:"px-3 py-2.5",children:x.schedule.colTarget}),i.jsx("th",{className:"px-3 py-2.5",children:x.schedule.colFireTimes}),i.jsx("th",{className:"px-3 py-2.5",children:x.schedule.colQueued}),l&&i.jsx("th",{className:"px-3 py-2.5"})]})}),i.jsx("tbody",{children:Y.map(U=>i.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:[i.jsx("td",{className:"px-3 py-2 font-mono text-xs",children:U.name}),i.jsx("td",{className:"px-3 py-2",children:i.jsx("span",{title:U.invalidReason,children:i.jsx(Lt,{tone:RR[U.status],children:x.schedule.statusNames[U.status]??U.status})})}),i.jsx("td",{className:"px-3 py-2 text-xs text-gray-500 dark:text-gray-400",children:U.period!==void 0?i.jsx("span",{className:"font-mono",children:U.period}):x.schedule.once}),i.jsx("td",{className:"max-w-36 truncate px-3 py-2 text-xs text-gray-500 dark:text-gray-400",title:U.sessionId,children:U.sessionId!==void 0?i.jsx("span",{className:"font-mono",children:U.sessionId}):x.schedule.newSession}),i.jsxs("td",{className:"px-3 py-2 text-xs",children:[i.jsx("span",{className:"block text-gray-600 dark:text-gray-300",children:U.nextFireAt?Kn(U.nextFireAt):"—"}),i.jsx("span",{className:"block text-gray-400 dark:text-gray-500",children:U.lastFiredAt?Kn(U.lastFiredAt):"—"})]}),i.jsx("td",{className:"px-3 py-2",children:U.queued&&i.jsx(Lt,{tone:"brand",children:x.schedule.queued})}),l&&i.jsxs("td",{className:"whitespace-nowrap px-3 py-2 text-right",children:[i.jsx(ke,{size:"sm",variant:"ghost",disabled:m,onClick:()=>{D(U)},children:U.enabled?x.schedule.disable:x.schedule.enable}),i.jsx(ke,{size:"sm",variant:"ghost",disabled:m,onClick:()=>V(U),children:x.common.edit}),i.jsx(ke,{size:"sm",variant:"ghost",disabled:m,onClick:()=>_(U.name),children:x.common.delete})]})]},U.name))})]})}),ne.length>0&&i.jsxs("div",{className:"text-xs text-red-600 dark:text-red-400",children:[i.jsx("p",{className:"font-medium",children:x.schedule.invalidFiles}),i.jsx("ul",{className:"mt-0.5 space-y-0.5 font-mono",children:ne.map(U=>i.jsxs("li",{children:[U.name,": ",U.error]},U.name))})]}),l&&o!==null&&i.jsx(ke,{size:"sm",variant:"primary",disabled:m,onClick:()=>ee(LR),children:x.schedule.addTitle}),i.jsx(dn,{open:g!==null,title:g?.editing!=null?x.schedule.editTitle(g.editing):x.schedule.addTitle,onClose:()=>y(null),widthClass:"sm:max-w-lg",footer:i.jsxs(i.Fragment,{children:[i.jsx(ke,{onClick:()=>y(null),children:x.common.cancel}),i.jsx(ke,{variant:"primary",disabled:m,onClick:()=>{Z()},children:g?.editing!=null?x.common.save:x.common.create})]}),children:g!==null&&i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[i.jsx(Xe,{size:"sm",label:x.common.name,required:!0,hint:x.schedule.nameHint,error:N.name,value:g.name,disabled:g.editing!==null,onChange:U=>P({name:U.target.value}),className:"font-mono",placeholder:"daily_report",autoComplete:"off"}),i.jsx(Xe,{size:"sm",label:x.schedule.period,value:g.period,onChange:U=>P({period:U.target.value}),className:"font-mono",placeholder:x.schedule.periodPlaceholder,autoComplete:"off"}),i.jsx(Xe,{size:"sm",label:x.schedule.startAt,required:!0,type:"datetime-local",error:N.startAt,value:g.startAt,onChange:U=>P({startAt:U.target.value}),className:"font-mono"}),i.jsx(Xe,{size:"sm",label:x.schedule.endAt,type:"datetime-local",value:g.endAt,onChange:U=>P({endAt:U.target.value}),className:"font-mono"}),i.jsxs(eo,{size:"sm",label:x.schedule.target,value:g.target,onChange:U=>P({target:U.target.value}),children:[i.jsx("option",{value:"new",children:x.schedule.targetNew}),i.jsx("option",{value:"session",children:x.schedule.targetSession})]}),g.target==="session"?i.jsx(Xe,{size:"sm",label:x.schedule.sessionId,required:!0,error:N.sessionId,value:g.sessionId,onChange:U=>P({sessionId:U.target.value}),className:"font-mono",autoComplete:"off"}):i.jsxs(i.Fragment,{children:[i.jsxs(eo,{size:"sm",label:x.schedule.model,value:g.model?km(g.model):"",onChange:U=>P({model:_R(U.target.value)}),children:[i.jsx("option",{value:"",children:x.schedule.modelDefault}),g.model&&!q.some(U=>U.modelId===g.model.modelId&&U.provider===g.model.provider)&&i.jsx("option",{value:km(g.model),children:Q1(g.model)}),q.map(U=>i.jsx("option",{value:km({provider:U.provider,modelId:U.modelId}),children:Q1({provider:U.provider,modelId:U.modelId})},`${U.provider}:${U.modelId}`))]}),i.jsx(Xe,{size:"sm",label:x.schedule.workspace,value:g.workspace,onChange:U=>P({workspace:U.target.value}),className:"font-mono",autoComplete:"off"})]})]}),i.jsx(js,{label:x.schedule.prompt,required:!0,size:"sm",rows:4,error:N.prompt,value:g.prompt,onChange:U=>P({prompt:U.target.value})}),i.jsxs("label",{className:"flex items-center gap-1.5 text-xs text-gray-600 dark:text-gray-300",children:[i.jsx("input",{type:"checkbox",checked:g.enabled,onChange:U=>P({enabled:U.target.checked})}),x.schedule.enabled]}),j&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:j})]})}),i.jsx(Gn,{open:L!==null,title:x.schedule.deleteTitle,busy:m,onClose:()=>_(null),onConfirm:()=>{B()},children:i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:L!==null?x.schedule.deleteConfirm(L):""})}),d&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:d})]})}function OR(e){return e.filter(([n])=>n!=="").map(([n,r])=>({value:n,triggerLabel:n,label:n,description:r}))}function Oi(e){const n=e.trim();if(!n)return;const r=Number(n);return Number.isFinite(r)?r:void 0}function jl(e){return e===void 0?"":String(e)}function zR(){const e=[{key:"overview",label:x.agent.tabOverview},{key:"prompt",label:x.agent.tabPrompt},{key:"runtime",label:x.agent.tabRuntime},{key:"tools",label:x.agent.tabTools},{key:"vault",label:x.agent.tabVault},{key:"schedules",label:x.agent.tabSchedules}],n=Qn(),l=Kv().agentId??"";Ka(x.agent.settings);const{currentProject:o,reloadAgents:u}=fn(),d=o?.projectId??null,[f,m]=b.useState(null),[h,g]=b.useState("overview"),[y,k]=b.useState(null),w=b.useCallback(()=>{!d||!l||(m(null),k(null),uh(d,l).then(m).catch(E=>k(ze(E))))},[d,l]);b.useEffect(()=>{w()},[w]);const N=b.useCallback(E=>{ga(x.agent.importDone(E)),w(),u()},[w,u]),C=b.useCallback(()=>{ga(x.agent.resetConfigDone),w(),u()},[w,u]),j=b.useCallback(async E=>{if(!(!d||!l))try{const L=await Tv(d,l,E);m(L),ga(x.common.saved),(E.config?.name!==void 0||E.config?.description!==void 0)&&u()}catch(L){Et(ze(L))}},[d,l,u]);return d?y&&!f?i.jsx("p",{className:"p-6 text-sm text-red-600 dark:text-red-400",children:y}):f?i.jsx("div",{className:"no-scrollbar h-full overflow-y-auto p-4 md:p-6",children:i.jsxs("div",{className:"mx-auto max-w-3xl",children:[i.jsxs(ke,{variant:"ghost",size:"sm",onClick:()=>n("/agents"),className:"-ml-2 mb-3 text-gray-500 dark:text-gray-400",children:[i.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:[i.jsx("path",{d:"M15 18l-6-6 6-6"}),i.jsx("path",{d:"M9 12h12"})]}),x.agent.backToList]}),i.jsx("h1",{className:"mb-1 text-xl font-semibold",children:f.config.name??l}),i.jsx("p",{className:"mb-4 font-mono text-xs text-gray-400",children:l}),i.jsx(wR,{items:e,active:h,onChange:g}),i.jsxs("div",{className:"py-4",children:[h==="overview"&&i.jsx(DR,{data:f,agentId:l,onSave:j,onImported:N,onConfigReset:C}),h==="prompt"&&i.jsx(UR,{data:f,onSave:j}),h==="runtime"&&i.jsx($R,{data:f,onSave:j}),h==="tools"&&i.jsx(BR,{data:f,onSave:j}),h==="vault"&&i.jsx(TR,{agentId:l}),h==="schedules"&&i.jsx(IR,{agentId:l})]})]})}):i.jsxs("div",{className:"space-y-3 p-6",children:[i.jsx(Ut,{className:"h-6 w-64"}),i.jsx(Ut,{className:"h-32 w-full"})]}):null}const Z1="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 DR({data:e,agentId:n,onSave:r,onImported:l,onConfigReset:o}){const{currentProject:u}=fn(),d=u?.projectId??null,f=u?.role==="owner",[m,h]=b.useState(e.config.name??""),[g,y]=b.useState(e.config.description??""),[k,w]=b.useState(!1),[N,C]=b.useState(null),[j,E]=b.useState(null),[L,_]=b.useState(!1),[q,H]=b.useState(!1),{requestSave:I,element:P}=ku(),ee=async()=>{if(d){H(!0);try{await oj(d,n),_(!1),o()}catch(B){Et(ze(B))}finally{H(!1)}}},Z=()=>{const B={};if(m.trim()!==(e.config.name??"")&&(B.name=m.trim()),g.trim()!==(e.config.description??"")&&(B.description=g.trim()),Object.keys(B).length===0){Ol(x.common.noChangesToSave);return}I(()=>{r({config:B})})},D=async(B,Y)=>{if(d){w(!0),C(null);try{const ne=await Mj(d,n,{dataBase64:B,...Y?{confirm:!0}:{}});E(null),l(ne.version)}catch(ne){ne instanceof Ra&&ne.status===409&&ne.code==="version_conflict"?E(B):(E(null),C(ze(ne)))}finally{w(!1)}}},V=B=>{const Y=B.target.files?.[0];if(B.target.value="",!Y)return;C(null);const ne=new FileReader;ne.onload=()=>{const U=ne.result;D(U.slice(U.indexOf(",")+1),!1)},ne.onerror=()=>C(x.common.unknownError),ne.readAsDataURL(Y)};return i.jsxs("div",{className:"space-y-4",children:[i.jsx(Xe,{size:"sm",label:x.common.name,value:m,onChange:B=>h(B.target.value)}),i.jsx(js,{label:x.agent.description,size:"sm",rows:3,value:g,onChange:B=>y(B.target.value)}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.agent.stateDir}),i.jsx("p",{className:"break-all font-mono text-xs text-gray-500 dark:text-gray-400",children:e.stateDir})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.agent.activeSessions}),i.jsx("p",{className:"text-sm",children:e.activeSessionCount})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.agent.stateVersion}),i.jsxs("p",{className:"font-mono text-sm",children:["v",e.config.version]})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.agent.transferTitle}),i.jsx("p",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400",children:x.agent.transferDesc}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[d&&i.jsx("a",{href:Tj(d,n),download:!0,className:Z1,children:x.agent.exportSnapshot}),f&&i.jsxs("label",{className:`${Z1} ${k?"pointer-events-none opacity-60":""}`,children:[i.jsx("input",{type:"file",accept:".tar.gz,.tgz",className:"sr-only",disabled:k,onChange:V}),k?x.agent.importing:x.agent.importSnapshot]})]}),N&&i.jsx("p",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400",children:N})]}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.agent.resetConfigTitle}),i.jsx("p",{className:"mb-2 text-xs text-gray-500 dark:text-gray-400",children:x.agent.resetConfigDesc}),i.jsx(ke,{size:"sm",disabled:q,onClick:()=>_(!0),children:x.agent.resetConfigAction})]}),i.jsx(ke,{size:"sm",variant:"primary",onClick:Z,children:x.common.save}),P,i.jsx(Gn,{open:j!==null,title:x.agent.importConflictTitle,busy:k,onClose:()=>E(null),onConfirm:()=>{j!==null&&D(j,!0)},children:i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.agent.importConflictBody})}),i.jsx(Gn,{open:L,title:x.agent.resetConfigTitle,busy:q,onClose:()=>_(!1),onConfirm:()=>{ee()},confirmLabel:x.agent.resetConfigAction,children:i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.agent.resetConfigConfirmBody})})]})}function UR({data:e,onSave:n}){const[r,l]=b.useState(e.agentsMd),[o,u]=b.useState(e.config.systemPrompt),d=b.useRef(null),{requestSave:f,element:m}=ku(),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){Ol(x.common.noChangesToSave);return}f(()=>{n(y)})},g=y=>{const k=d.current;if(k&&(k.focus(),document.execCommand?.("insertText",!1,y)))return;const w=k?k.selectionStart:o.length,N=k?k.selectionEnd:o.length;u(o.slice(0,w)+y+o.slice(N)),requestAnimationFrame(()=>{if(!k)return;k.focus();const C=w+y.length;k.setSelectionRange(C,C)})};return i.jsxs("div",{className:"space-y-4",children:[i.jsx(js,{label:x.agent.agentsMd,mono:!0,size:"sm",rows:14,value:r,onChange:y=>l(y.target.value)}),i.jsx(js,{ref:d,label:x.agent.systemPrompt,mono:!0,size:"sm",rows:12,value:o,onChange:y=>u(y.target.value)}),i.jsxs("div",{className:"rounded-md border border-gray-200 bg-gray-50 p-3 dark:border-gray-800 dark:bg-gray-900",children:[i.jsx("p",{className:"mb-2 text-xs font-semibold text-gray-500",children:x.agent.placeholdersTitle}),i.jsx("ul",{className:"space-y-1",children:x.agent.placeholders.map(([y,k])=>i.jsxs("li",{className:"flex items-center gap-3 text-xs",children:[i.jsx("button",{type:"button",onClick:()=>g(y),title:x.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}),i.jsx("span",{className:"text-gray-500 dark:text-gray-400",children:k})]},y))})]}),i.jsx(ke,{size:"sm",variant:"primary",onClick:h,children:x.common.save}),m]})}function $R({data:e,onSave:n}){const r=e.config,[l,o]=b.useState(jl(r.maxTurns)),[u,d]=b.useState(jl(r.model?.maxTokens)),[f,m]=b.useState(r.model?.thinkingLevel??""),[h,g]=b.useState(jl(r.model?.timeoutMs)),[y,k]=b.useState(jl(r.compaction?.maxContextLength)),[w,N]=b.useState(jl(r.compaction?.maxSessionTurns)),[C,j]=b.useState(r.compaction?.mode??""),[E,L]=b.useState(r.compaction?.prompt??""),[_,q]=b.useState({}),H=()=>q(V=>V.maxTurns||V.timeoutMs?{}:V),{requestSave:I,element:P}=ku(),ee=()=>{q({});const V={},B=Oi(l);if(B!==void 0&&B!==r.maxTurns){if(B<=0&&B!==-1){q({maxTurns:x.agent.maxTurnsInvalid});return}V.maxTurns=B}const Y={},ne=Oi(u);ne!==void 0&&ne!==r.model?.maxTokens&&(Y.maxTokens=ne),f&&f!==(r.model?.thinkingLevel??"")&&(Y.thinkingLevel=f);const U=Oi(h);if(U!==void 0&&U!==r.model?.timeoutMs){if(U<=0&&U!==-1){q({timeoutMs:x.agent.timeoutInvalid});return}Y.timeoutMs=U}Object.keys(Y).length>0&&(V.model=Y);const z={},$=Oi(y);$!==void 0&&$!==r.compaction?.maxContextLength&&(z.maxContextLength=$);const G=Oi(w);if(G!==void 0&&G!==r.compaction?.maxSessionTurns&&(z.maxSessionTurns=G),C&&C!==(r.compaction?.mode??"")&&(z.mode=C),E!==(r.compaction?.prompt??"")&&(z.prompt=E),Object.keys(z).length>0&&(V.compaction=z),Object.keys(V).length===0){Ol(x.common.noChangesToSave);return}I(()=>{n({config:V})})},Z=n8(x.agent.thinkingLevelOptions,x.agent.thinkingLevelNoneKept,r.model?.thinkingLevel),D=OR(x.agent.compactionModeOptions);return i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[i.jsx("div",{className:"p-3",children:i.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[i.jsx(Xe,{label:x.agent.maxTurns,size:"sm",value:l,error:_.maxTurns,onChange:V=>{o(V.target.value),H()},inputMode:"numeric",className:"font-mono"}),i.jsx(Xe,{label:x.agent.maxTokens,size:"sm",value:u,onChange:V=>d(V.target.value),inputMode:"numeric",className:"font-mono"}),i.jsx(lh,{label:x.agent.thinkingLevel,fullWidth:!0,size:"sm",placeholder:x.agent.defaultValue,value:f,onChange:m,options:Z}),i.jsx(Xe,{label:x.agent.timeoutMs,hint:x.agent.timeoutMsHint,size:"sm",value:h,error:_.timeoutMs,onChange:V=>{g(V.target.value),H()},inputMode:"numeric",className:"font-mono"})]})}),i.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:x.agent.compaction}),i.jsx("div",{className:"p-3",children:i.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:[i.jsx(Xe,{label:x.agent.maxContextLength,hint:x.agent.maxContextLengthHint,size:"sm",value:y,onChange:V=>k(V.target.value),inputMode:"numeric",className:"font-mono"}),i.jsx(Xe,{label:x.agent.maxSessionTurns,hint:x.agent.maxSessionTurnsHint,size:"sm",value:w,onChange:V=>N(V.target.value),inputMode:"numeric",className:"font-mono"}),i.jsx(lh,{label:x.agent.compactionMode,fullWidth:!0,size:"sm",placeholder:x.agent.defaultValue,value:C,onChange:j,options:D})]})}),i.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:x.agent.compactionPrompt}),i.jsx("div",{className:"p-3",children:i.jsx(js,{"aria-label":x.agent.compactionPrompt,mono:!0,size:"sm",rows:4,value:E,onChange:V=>L(V.target.value)})})]}),i.jsx(ke,{size:"sm",variant:"primary",onClick:ee,children:x.common.save}),P]})}function BR({data:e,onSave:n}){const r=[{value:"r",triggerLabel:"r",label:x.agent.permissionReadLabel,description:x.agent.permissionReadDescription},{value:"rw",triggerLabel:"rw",label:x.agent.permissionReadWriteLabel,description:x.agent.permissionReadWriteDescription}],[l,o]=b.useState(()=>e.config.toolsBuiltin.map(k=>({base:{...k},timeoutMs:jl(k.timeoutMs),maxOutputLength:jl(k.maxOutputLength)}))),[u,d]=b.useState({}),{requestSave:f,element:m}=ku(),h=(k,w)=>{o(N=>N.map((C,j)=>j===k?{...C,...w}:C)),d(N=>{const C=`${k}-timeoutMs`,j=`${k}-maxOutputLength`;if(!N[C]&&!N[j])return N;const E={...N};return delete E[C],delete E[j],E})},g=()=>{const k={},w=[];for(const[j,E]of l.entries()){const L={...E.base};delete L.timeoutMs,delete L.maxOutputLength;const _=E.timeoutMs.trim();if(_){const I=Number(_);!Number.isInteger(I)||I<=0&&I!==-1?k[`${j}-timeoutMs`]=x.agent.toolFieldInvalid(E.base.name,"timeoutMs"):L.timeoutMs=I}const q=E.maxOutputLength.trim();if(q){const I=Number(q);!Number.isInteger(I)||I<=0&&I!==-1?k[`${j}-maxOutputLength`]=x.agent.toolFieldInvalid(E.base.name,"maxOutputLength"):L.maxOutputLength=I}const H=e.config.toolsBuiltin[j];L.call_description===!0&&H?.call_description===void 0&&delete L.call_description,w.push(L)}if(Object.keys(k).length>0){d(k);return}d({});const N=e.config.toolsBuiltin;if(!(w.length!==N.length||w.some((j,E)=>{const L=N[E];return j.permission!==L.permission||j.timeoutMs!==L.timeoutMs||j.maxOutputLength!==L.maxOutputLength||j.call_description!==L.call_description}))){Ol(x.common.noChangesToSave);return}f(()=>{n({config:{toolsBuiltin:w}})})},y=k=>{const w=k.parameters?.properties;return w!=null&&w.description!==void 0};return i.jsxs("div",{className:"space-y-4",children:[i.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:i.jsxs("table",{className:"w-full min-w-[640px] text-left text-sm",children:[i.jsx("thead",{children:i.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:[i.jsx("th",{className:"px-3 py-2",children:x.common.name}),i.jsx("th",{className:"px-3 py-2",children:x.agent.toolPermission}),i.jsx("th",{className:"px-3 py-2",children:x.agent.toolTimeout}),i.jsx("th",{className:"px-3 py-2",children:x.agent.toolMaxOutput}),i.jsx("th",{className:"px-3 py-2",children:x.agent.toolCallDescription})]})}),i.jsx("tbody",{children:l.map((k,w)=>i.jsxs("tr",{className:"border-b border-gray-100 dark:border-gray-800/60",children:[i.jsx("td",{className:"px-3 py-2 align-top font-mono text-xs",children:k.base.name}),i.jsx("td",{className:"px-3 py-2 align-top",children:i.jsx(lh,{mono:!0,size:"sm","aria-label":x.agent.toolPermission,placeholder:x.agent.defaultValue,options:r,value:k.base.permission,onChange:N=>h(w,{base:{...k.base,permission:N}})})}),i.jsx("td",{className:"px-3 py-2 align-top",children:i.jsx(Xe,{size:"sm",value:k.timeoutMs,error:u[`${w}-timeoutMs`],inputMode:"numeric",className:"font-mono",onChange:N=>h(w,{timeoutMs:N.target.value})})}),i.jsx("td",{className:"px-3 py-2 align-top",children:i.jsx(Xe,{size:"sm",value:k.maxOutputLength,error:u[`${w}-maxOutputLength`],inputMode:"numeric",className:"font-mono",onChange:N=>h(w,{maxOutputLength:N.target.value})})}),i.jsx("td",{className:"px-3 py-2 align-top",children:y(k.base)?i.jsx(Xk,{checked:k.base.call_description!==!1,onChange:N=>h(w,{base:{...k.base,call_description:N}}),"aria-label":`${k.base.name} ${x.agent.toolCallDescription}`}):i.jsx("span",{className:"text-xs text-gray-300 dark:text-gray-600",children:"—"})})]},k.base.name))})]})}),i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:x.agent.callDescriptionHint}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-medium text-gray-500",children:x.agent.mcpServers}),i.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)})]}),i.jsx(ke,{size:"sm",variant:"primary",onClick:g,children:x.common.save}),m]})}const HR="M22 2 11 13M22 2 15 22 11 13 2 9 22 2",PR="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3",qR="M23 4v6h-6M20.49 15a9 9 0 1 1-2.12-9.36L23 10";function FR(e,n,r,l){return e.filter(o=>{const u=n.get(o)?.get(r);return u!==void 0&&u<l})}function VR(){Ka(x.nav.skills);const e=Qn(),{locale:n}=Ga(),r=bn().user?.userId??null,{currentProject:l,agents:o,setCurrentAgentId:u}=fn(),d=l?.projectId??null,[f,m]=b.useState(null),[h,g]=b.useState(null),[y,k]=b.useState(new Map),[w,N]=b.useState(new Set);b.useEffect(()=>{let H=!1;return g(null),jj().then(I=>{H||m(I.groups)}).catch(I=>{H||g(ze(I))}),()=>{H=!0}},[]);const C=o.map(H=>H.agentId).join(",");b.useEffect(()=>{if(k(new Map),!d||C==="")return;let H=!1;const I=C.split(",");return Promise.all(I.map(async P=>{try{const ee=await dh(d,P);return[P,new Map(ee.skills.map(Z=>[Z.name,Z.version]))]}catch{return[P,new Map]}})).then(P=>{H||k(ee=>{const Z=new Map(P);for(const[D,V]of ee)Z.set(D,V);return Z})}),()=>{H=!0}},[d,C]);const j=(H,I,P)=>k(ee=>{const Z=new Map(ee),D=new Map(Z.get(H)??[]);return P!==void 0?D.set(I,P):D.delete(I),Z.set(H,D),Z}),E=(H,I)=>k(P=>new Map(P).set(H,new Map(I.map(ee=>[ee.name,ee.version])))),L=async(H,I,P,ee)=>{if(!d)return;const Z=y.get(H)?.get(I);j(H,I,P?ee:void 0);const D=o.find(B=>B.agentId===H),V=D?hn(D):H;try{if(P){const B=await my(d,H,[I]);E(H,B.skills),ga(x.skills.installedToast(I,V))}else await Cj(d,H,I),ga(x.skills.uninstalledToast(I,V))}catch(B){if(!P&&B instanceof Ra&&B.status===404)return;j(H,I,Z),Et(ze(B))}},_=async(H,I)=>{if(!d||I.length===0)return;const ee=(await Promise.allSettled(I.map(async Z=>{const D=await my(d,Z,[H]);E(Z,D.skills)}))).find(Z=>Z.status==="rejected");ee?Et(ze(ee.reason)):ga(x.skills.updatedToast(H,I.length))},q=H=>{if(r&&d){const I=Ss(r,d);Ji(I,{...Ru(I),agentId:"default_agent",text:x.skills.quickInvokeText(H),skills:[H],handoffAgentId:void 0})}u("default_agent"),e(`/chat/${Fa}`,{state:{agentId:"default_agent"}})};return i.jsx("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:i.jsxs("div",{className:"mx-auto max-w-5xl",children:[i.jsx("h1",{className:"text-xl font-semibold",children:x.skills.pageTitle}),i.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:x.skills.pageDesc}),h?i.jsxs("div",{className:"mt-6 flex items-center gap-3",children:[i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:h}),i.jsx(ke,{size:"sm",onClick:()=>window.location.reload(),children:x.common.retry})]}):f===null?i.jsx("div",{className:"mt-6 grid gap-2.5 sm:grid-cols-2",children:Array.from({length:4},(H,I)=>i.jsxs(db,{className:"p-4",children:[i.jsx(Ut,{className:"h-4 w-32"}),i.jsx(Ut,{className:"mt-2 h-4 w-3/4"}),i.jsx(Ut,{className:"mt-3 h-6 w-36"})]},I))}):i.jsx("div",{className:"mt-6 space-y-3",children:f.map(H=>{const I=!w.has(H.id);return i.jsxs("section",{className:"overflow-hidden rounded-md bg-white dark:bg-gray-900",children:[i.jsxs("button",{type:"button","aria-expanded":I,onClick:()=>N(P=>{const ee=new Set(P);return ee.has(H.id)?ee.delete(H.id):ee.add(H.id),ee}),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:[i.jsx("span",{className:"min-w-0 truncate text-sm font-semibold",children:SA(n,H.title,H.titleZh)}),i.jsx("span",{className:"shrink-0 whitespace-nowrap font-mono text-xs text-gray-400",children:x.skills.skillCount(H.skills.length)}),i.jsx("span",{className:"min-w-0 flex-1"}),i.jsx(gn,{open:I,className:"text-gray-400"})]}),i.jsx("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${I?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:i.jsx("div",{className:"overflow-hidden",inert:!I,children:i.jsx("div",{className:`grid gap-2.5 p-2.5 transition-opacity duration-200 sm:grid-cols-2 ${I?"opacity-100":"opacity-0"}`,children:H.skills.map(P=>i.jsx(GR,{skill:P,installed:y,onQuickInvoke:q,onToggleInstall:L,onUpdateOutdated:_},P.name))})})})]},H.id)})})]})})}function GR({skill:e,installed:n,onQuickInvoke:r,onToggleInstall:l,onUpdateOutdated:o}){const{locale:u}=Ga(),{agents:d}=fn(),[f,m]=b.useState(!1),[h,g]=b.useState(null),[y,k]=b.useState(!1),[w,N]=b.useState(null),C=async()=>{h&&(k(!0),await o(e.name,h),k(!1),g(null))},j=w!==null?d.find(P=>P.agentId===w):void 0,E=j?hn(j):void 0;let L=0;for(const P of n.values())P.has(e.name)&&(L+=1);const _=FR(d.map(P=>P.agentId),n,e.name,e.version),q=co(u,e),H=e.description,I=[`v${e.version}`,e.updated?I4(e.updated,u):null,x.skills.usedByAgents(L)].filter(P=>P!==null).join(" · ");return i.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:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("span",{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg ${GA(e.name)}`,children:i.jsx(ap,{icon:e.icon,size:20})}),i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("span",{className:"block truncate font-mono text-[13px] font-semibold",title:e.name,children:e.name}),i.jsx("p",{className:"mt-0.5 truncate text-xs leading-5 text-gray-500 dark:text-gray-400",title:H,children:q})]})]}),i.jsx("p",{className:"mt-2.5 truncate text-[11px] text-gray-400 dark:text-gray-500",title:I,children:I})]}),i.jsxs("div",{className:"flex shrink-0 items-center justify-center gap-1.5",children:[_.length>0&&i.jsx(ke,{size:"sm",variant:"secondary",className:"h-8 w-8 shrink-0 justify-center p-0","aria-label":`${x.skills.updateOutdated(_.length)} ${e.name}`,title:x.skills.updateOutdated(_.length),onClick:()=>g(_),children:i.jsx(Ve,{d:qR,size:13})}),i.jsx(ke,{size:"sm",className:"h-8 w-8 shrink-0 justify-center p-0","aria-label":`${x.skills.quickInvoke} ${e.name}`,title:x.skills.quickInvoke,onClick:()=>r(e.name),children:i.jsx(Ve,{d:HR,size:15})}),i.jsx(ke,{size:"sm",className:"h-8 w-8 shrink-0 justify-center p-0","aria-label":`${x.skills.manageInstall} ${e.name}`,title:x.skills.manageInstall,onClick:()=>m(!0),children:i.jsx(Ve,{d:PR,size:15})})]}),f&&i.jsx(dn,{open:!0,title:x.skills.manageInstallTitle(e.name),onClose:()=>m(!1),children:i.jsxs("div",{className:"space-y-0.5",children:[d.length===0&&i.jsx("p",{className:"py-1.5 text-xs text-gray-400",children:x.common.loading}),d.map(P=>i.jsx(KR,{agentId:P.agentId,name:hn(P),installed:n.get(P.agentId)?.has(e.name)??!1,outdated:_.includes(P.agentId),onToggle:ee=>{ee?l(P.agentId,e.name,!0,e.version):N(P.agentId)},onUpdate:()=>g([P.agentId])},P.agentId))]})}),h&&i.jsx(Gn,{open:!0,title:x.skills.updateConfirmTitle(e.name),tone:"primary",confirmLabel:x.skills.updateAction,busy:y,onClose:()=>g(null),onConfirm:()=>{C()},children:i.jsxs("div",{className:"space-y-3",children:[i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.skills.updateConfirmWarning(e.name)}),i.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(P=>{const ee=n.get(P)?.get(e.name),Z=d.find(D=>D.agentId===P);return i.jsxs("li",{className:"flex items-center justify-between gap-3 px-3 py-1.5 text-xs",children:[i.jsx("span",{className:"min-w-0 truncate",children:Z?hn(Z):P}),i.jsxs("span",{className:"shrink-0 font-mono text-gray-500 dark:text-gray-400",children:["v",ee??"?"," → v",e.version]})]},P)})})]})}),w!==null&&i.jsx(Gn,{open:!0,title:x.skills.uninstallConfirmTitle(e.name),confirmLabel:x.skills.uninstall,onClose:()=>N(null),onConfirm:()=>{const P=w;N(null),l(P,e.name,!1,e.version)},children:i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.skills.uninstallConfirmBody(e.name,E??w)})})]})}function KR({agentId:e,name:n,installed:r,outdated:l,onToggle:o,onUpdate:u}){return i.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:[i.jsx(tl,{id:e,name:n,size:22,className:"shrink-0 rounded"}),i.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",title:e,children:n}),r&&l&&i.jsx(ke,{size:"sm",variant:"secondary",className:"shrink-0","aria-label":`${x.skills.updateAction} ${e}`,onClick:u,children:x.skills.updateAction}),r?i.jsxs(ke,{size:"sm",variant:"ghost",className:"group shrink-0","aria-label":`${x.skills.uninstall} ${e}`,onClick:()=>o(!1),children:[i.jsx("span",{className:"group-hover:hidden",children:x.skills.installed}),i.jsx("span",{className:"hidden text-red-600 group-hover:inline dark:text-red-400",children:x.skills.uninstall})]}):i.jsx(ke,{size:"sm",className:"shrink-0","aria-label":`${x.skills.install} ${e}`,onClick:()=>o(!0),children:x.skills.install})]})}function Zk(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 WR(e){return{provider:e.provider,modelId:e.model_id,original:null,...Zk(e),maxTokens:"",originalBaseUrl:"",apiKeyInput:"",clearApiKey:!1}}function YR(e,n=YA()){const r=(f,m)=>`${f}\0${m}`,l=new Map(e.map((f,m)=>[r(f.provider,f.modelId),m])),o=[...e];let u=0,d=0;for(const f of n){const m=l.get(r(f.provider,f.model_id));if(m===void 0){o.push(WR(f)),u+=1;continue}const h=o[m],g=Zk(f);Object.keys(g).some(k=>h[k]!==g[k])&&(o[m]={...h,...g},d+=1)}return{rows:o,added:u,updated:d}}function QR(e){return e<1e3?"green":e<=3e3?"yellow":"red"}function XR(e){return e>=40?"green":e>=15?"yellow":"red"}const Jk={USD:"$",CNY:"¥"};function J1(e){return Number.isFinite(e)?String(Math.round(e*1e6)/1e6):"0"}function sh(e){return Number.isFinite(e)?String(Math.round(e*1e4)/1e4):"0"}function wm(e,n){const r=Number(e||"0"),l=n==="CNY"?r*ch:r;return`${Jk[n]}${sh(l)}`}function xs(e,n){const r=e.trim();if(!r)return"";const l=Number(r);return Number.isFinite(l)?sh(n==="CNY"?l*ch:l):r}function Sm(e,n){const r=e.trim();if(!r)return"";const l=Number(r);return Number.isFinite(l)?J1(n==="CNY"?l/ch:l):r}const ZR="M12 5v14M5 12h14",JR="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",e_="M12 14l3.5-3.5M20.49 17A10 10 0 1 0 3.5 17",t_="M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20ZM12 7v5l3.5 2",n_="M13 2 3 14h9l-1 8 10-12h-9l1-8Z",ev={green:"text-green-600 dark:text-green-400",yellow:"text-amber-600 dark:text-amber-400",red:"text-red-600 dark:text-red-400"},tv=(e,n)=>`${e}\0${n}`,jm=128e3;function nv(e){return e.replace(/[^\d]/g,"")}function a_(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 fa(e){return{provider:e.provider,modelId:e.modelId}}function r_(e){const{editing:n,ref:r,action:l,defaultModel:o,visionModel:u}=e,d=n===null,f=!d&&!pt(n,r)?n:null,m=h=>pt(h,f)?r:h;return{defaultModel:l==="setDefault"||d&&!o?r:m(o),visionModel:l==="setVisionModel"?r:m(u)}}function l_(e){return e.original!==null&&rp(e.original.provider,e.original.modelId)!==void 0}function s_(e){return!e.clearApiKey&&(!!e.apiKeyInput.trim()||!!e.credential?.apiKeyMasked)}function av(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 i_(e){const n={provider:e.provider,modelId:e.modelId};e.original&&!pt(e.original,fa(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 l=Number(e.maxTokens.trim());e.maxTokens.trim()&&Number.isFinite(l)&&l>0&&(n.maxTokens=l);const o=Number(e.cacheRead.trim()),u=Number(e.cacheWrite.trim()),d=Number(e.output.trim());e.cacheRead.trim()&&e.cacheWrite.trim()&&e.output.trim()&&Number.isFinite(o)&&Number.isFinite(u)&&Number.isFinite(d)&&(n.pricing={cacheRead:o,cacheWrite:u,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 o_(){Ka(x.models.title);const{currentProject:e}=fn(),n=e?.projectId??null,r=e?.role==="owner",l=bn().user?.userId??null,[o,u]=b.useState(new Map),[d,f]=b.useState(null),[m,h]=b.useState(null),[g,y]=b.useState(null),[k,w]=b.useState(void 0),[N,C]=b.useState(void 0),[j,E]=b.useState(null),[L,_]=b.useState(null),[q,H]=b.useState(""),[I,P]=b.useState(new Set),[ee,Z]=b.useState(null),[D,V]=b.useState(!1),[B,Y]=b.useState(""),[ne,U]=b.useState(null),[z,$]=b.useState(null),[G,me]=b.useState(!1),{currency:M}=Ll(),R=b.useCallback(async()=>{if(n){y(null),$(null),u(new Map);try{const se=await pu(n);y(se.models.map(av)),w(se.defaultModel),C(se.visionModel)}catch(se){$(ze(se))}}},[n]);b.useEffect(()=>{R()},[R]);const O=async(se,pe,be,Pe)=>{if(!n)return!1;me(!0);const Ze=be&&se.some(De=>pt(fa(De),be)&&De.vision)?be:void 0;try{const De={models:se.map(i_)};pe&&(De.defaultModel=pe),Ze&&(De.visionModel=Ze);const dt=await aj(n,De);if(y(dt.models.map(av)),w(dt.defaultModel),C(dt.visionModel),l&&dt.defaultModel&&!pt(dt.defaultModel,k)){const at=Ss(l,n),Mt=Ru(at);Mt.modelRef&&Ji(at,{...Mt,modelRef:void 0})}return ga(Pe??x.common.saved),!0}catch(De){return y(se),pe!==void 0&&w(pe),Ze!==void 0&&C(Ze),Et(ze(De)),!1}finally{me(!1)}},T=b.useMemo(()=>g?Dk(g,q):[],[g,q]),X=async()=>{if(!g)return;const se=YR(g);if(se.added===0&&se.updated===0){Ol(x.models.syncUpToDate);return}await O(se.rows,k,N,x.models.syncDone(se.added,se.updated))},ae=async se=>{if(!n||!g)return;const pe=g.filter(be=>be.provider===se);h(se);try{for(const be of pe){const Pe=tv(be.provider,be.modelId);u(Ze=>new Map(Ze).set(Pe,"pending"));try{const Ze=await Nv(n,{provider:be.provider,modelId:be.modelId,speed:!0});u(De=>new Map(De).set(Pe,Ze))}catch(Ze){u(De=>new Map(De).set(Pe,{ok:!1,message:ze(Ze)}))}}}finally{h(null)}},oe=()=>{const se=B.trim();if(!/^[a-z0-9][a-z0-9_-]{0,31}$/.test(se)){U(x.models.groupNameInvalid);return}if(al.some(pe=>pe.id===se)||g?.some(pe=>pe.provider===se)){U(x.models.groupNameExists);return}V(!1),Y(""),_(se)},ge=j!==null?g?.find(se=>pt(fa(se),j)):void 0;if(!n)return null;const Te=se=>P(pe=>{const be=new Set(pe);return be.has(se)?be.delete(se):be.add(se),be});return i.jsxs("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:[i.jsxs("div",{className:"mx-auto max-w-5xl",children:[i.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-2",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"text-xl font-semibold",children:x.models.title}),!r&&i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:x.models.readOnlyHint})]}),i.jsxs("div",{className:"flex min-w-0 max-w-full grow items-center gap-2 sm:grow-0",children:[i.jsx("div",{className:"min-w-0 flex-1 sm:w-56 sm:flex-none",children:i.jsx(Xe,{size:"sm",value:q,onChange:se=>H(se.target.value),placeholder:x.models.searchPlaceholder})}),r&&i.jsx(ke,{size:"sm",onClick:()=>{X()},disabled:G||g===null,title:x.models.syncCatalogHint,children:x.models.syncCatalog})]})]}),g===null?i.jsx(qa,{rows:4}):g.length===0?i.jsx(nl,{title:x.models.empty,action:r&&i.jsx(ke,{onClick:()=>_("custom"),children:x.models.addCustom})}):T.length===0?i.jsx(nl,{title:x.models.noSearchResults}):i.jsxs("div",{className:"space-y-3",children:[T.map(se=>{const pe=!I.has(se.provider.id);return i.jsxs("section",{className:"overflow-hidden rounded-md border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900",children:[i.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:[i.jsxs("button",{type:"button","aria-expanded":pe,onClick:()=>Te(se.provider.id),className:"flex min-w-0 flex-1 items-center gap-2.5 px-3 py-2.5 text-left",children:[i.jsx(uo,{provider:se.provider.id,className:"h-5 w-5 shrink-0 text-gray-700 dark:text-gray-300"}),i.jsx("span",{className:"min-w-0 truncate text-sm font-semibold",children:se.provider.label}),i.jsx("span",{className:"shrink-0 whitespace-nowrap font-mono text-xs text-gray-400",children:x.models.modelCount(se.rows.length)})]}),r&&i.jsx("span",{className:"shrink-0",children:i.jsxs(ke,{size:"sm",variant:"ghost",disabled:G,onClick:()=>_(se.provider.id),children:[i.jsx(Ve,{d:ZR,size:13}),x.models.addToGroup]})}),r&&se.provider.id!=="custom"&&i.jsx("span",{className:"hidden shrink-0 sm:block",children:i.jsxs(ke,{size:"sm",variant:"ghost",disabled:G,onClick:()=>Z(se.provider.id),children:[i.jsx(Ve,{d:JR,size:13}),x.models.groupApiKey]})}),r&&i.jsxs(ke,{size:"sm",variant:"ghost",className:"shrink-0",disabled:G||m!==null,"aria-label":`${x.models.speedTest} ${se.provider.label}`,title:m===se.provider.id?x.models.speedPending:x.models.speedTest,onClick:()=>f(se.provider.id),children:[i.jsx(Ve,{d:e_,size:13}),i.jsx("span",{className:"hidden sm:inline",children:m===se.provider.id?x.models.speedPending:x.models.speedTest})]}),se.provider.apiKeyUrl&&i.jsxs("a",{href:se.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:[x.models.getApiKey," ↗"]}),i.jsx("button",{type:"button","aria-expanded":pe,"aria-label":se.provider.label,onClick:()=>Te(se.provider.id),className:"shrink-0 p-1.5",children:i.jsx(gn,{open:pe,className:"text-gray-400"})})]}),i.jsx("div",{className:`grid transition-[grid-template-rows] duration-200 ease-out ${pe?"grid-rows-[1fr]":"grid-rows-[0fr]"}`,children:i.jsx("div",{className:"overflow-hidden",inert:!pe,children:i.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:se.rows.length===0?i.jsx("p",{className:"col-span-full py-1 text-center text-xs text-gray-400 dark:text-gray-500",children:x.models.groupEmptyHint}):se.rows.map(be=>i.jsx(c_,{row:be,currency:M,isDefault:pt(fa(be),k),isVisionModel:pt(fa(be),N),speed:o.get(tv(be.provider,be.modelId)),onOpen:()=>E(fa(be))},`${be.provider}:${be.modelId}`))})})})]},se.provider.id)}),r&&q.trim()===""&&i.jsxs("button",{type:"button",onClick:()=>{Y(""),U(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:["+ ",x.models.addGroup]})]}),z&&i.jsx("p",{className:"mt-3 text-xs text-red-600 dark:text-red-400",children:z})]}),g&&ee&&i.jsx(m_,{provider:al.find(se=>se.id===ee)??Ok(ee),count:g.filter(se=>se.provider===ee).length,onClose:()=>Z(null),onSubmit:se=>{const pe=ee;Z(null);const be=g.filter(Ze=>Ze.provider===pe);if(be.length===0)return;const Pe=g.map(Ze=>Ze.provider===pe?{...Ze,apiKeyInput:se,clearApiKey:!1}:Ze);O(Pe,k,N,x.models.groupKeyApplied(be.length))}}),d!==null&&i.jsxs(dn,{open:!0,title:x.models.speedTestTitle,onClose:()=>f(null),children:[i.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:x.models.speedTestConfirm(g?.filter(se=>se.provider===d).length??0)}),i.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[i.jsx(ke,{onClick:()=>f(null),children:x.common.cancel}),i.jsx(ke,{variant:"primary",onClick:()=>{const se=d;f(null),se&&ae(se)},children:x.models.speedTestStart})]})]}),D&&i.jsxs(dn,{open:!0,title:x.models.addGroupTitle,onClose:()=>V(!1),widthClass:"sm:max-w-sm",footer:i.jsxs(i.Fragment,{children:[i.jsx(ke,{onClick:()=>V(!1),children:x.common.cancel}),i.jsx(ke,{variant:"primary",onClick:oe,children:x.common.confirm})]}),children:[i.jsxs("label",{className:"block",children:[i.jsx(Xe,{size:"sm",label:x.models.groupNameLabel,required:!0,value:B,invalid:!!ne,onChange:se=>{Y(se.target.value),U(null)},onKeyDown:se=>{se.key==="Enter"&&oe()},placeholder:x.models.groupNameHint,className:"font-mono",autoFocus:!0}),ne&&i.jsx(Nl,{children:ne})]}),i.jsx("p",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:x.models.addGroupDesc})]}),g&&(L!==null||ge)&&i.jsx(f_,{projectId:n,row:L!==null?null:ge??null,addProvider:L??"custom",existingRefs:g.map(fa),currency:M,canEdit:r,isDefault:ge!==void 0&&pt(fa(ge),k),isVisionModel:ge!==void 0&&pt(fa(ge),N),onClose:()=>{E(null),_(null)},onSubmit:(se,pe)=>{const be=L!==null;if(E(null),_(null),pe==="remove"){const De=se.original;O(g.filter(dt=>!pt(fa(dt),De)),pt(De,k)?void 0:k,pt(De,N)?void 0:N);return}const Pe=be?[...g,se]:g.map(De=>pt(fa(De),j)?se:De),Ze=r_({editing:be?null:j,ref:fa(se),action:pe,defaultModel:k,visionModel:N});O(Pe,Ze.defaultModel,Ze.visionModel)}})]})}function c_({row:e,currency:n,isDefault:r,isVisionModel:l,speed:o,onOpen:u}){const d=e.cacheRead||e.cacheWrite||e.output,f=[e.contextWindow?ut(Number(e.contextWindow)):null,d?`${wm(e.cacheRead,n)} / ${wm(e.cacheWrite,n)} / ${wm(e.output,n)}`:null,e.credential?.apiKeyMasked&&!e.clearApiKey?e.credential.apiKeyMasked:s_(e)?x.models.keyConfigured:x.models.noKey].filter(h=>h!==null),m=o==="pending"?i.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:x.models.speedPending}):o?o.ok?i.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 text-[11px] font-medium",children:[o.ttftMs!==void 0&&i.jsxs("span",{className:`flex items-center gap-0.5 ${ev[QR(o.ttftMs)]}`,title:x.models.ttftTitle,children:[i.jsx(Ve,{d:t_,size:11}),Math.round(o.ttftMs),"ms"]}),o.tps!==void 0&&i.jsxs("span",{className:`flex items-center gap-0.5 ${ev[XR(o.tps)]}`,title:x.models.tpsTitle,children:[i.jsx(Ve,{d:n_,size:11}),o.tps," tok/s"]})]}):i.jsx("span",{className:"shrink-0 text-[11px] font-medium text-red-600 dark:text-red-400",title:o.message,children:x.models.speedFailed}):null;return i.jsxs("button",{type:"button",onClick:u,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:[i.jsxs("span",{className:"flex flex-wrap items-center gap-1.5",children:[i.jsx("span",{className:"text-sm font-medium",children:e.displayName??e.modelId}),r&&i.jsx(Lt,{tone:"brand",children:x.models.default}),Uk(e)&&i.jsx(Lt,{tone:"yellow",children:x.models.freeBadge}),e.vision&&i.jsx(Lt,{tone:"green",children:x.models.visionBadge}),l&&i.jsx(Lt,{tone:"amber",children:x.models.visionModelBadge})]}),e.displayName!==void 0&&i.jsx("span",{className:"truncate font-mono text-[11px] text-gray-500 dark:text-gray-400",children:e.modelId}),i.jsxs("span",{className:"flex w-full items-center gap-1.5",children:[i.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] text-gray-400 dark:text-gray-500",children:f.join(" · ")}),m]})]})}const u_={save:()=>x.models.confirmSaveTitle,setDefault:()=>x.models.confirmDefaultTitle,setVisionModel:()=>x.models.confirmVisionModelTitle,remove:()=>x.models.confirmDeleteTitle},d_={save:e=>x.models.confirmSave(e),setDefault:e=>x.models.confirmDefault(e),setVisionModel:e=>x.models.confirmVisionModel(e),remove:e=>x.models.confirmDelete(e)};function f_({projectId:e,row:n,addProvider:r,existingRefs:l,currency:o,canEdit:u,isDefault:d,isVisionModel:f,onClose:m,onSubmit:h}){const[g,y]=b.useState(()=>{if(n)return{...n,cacheRead:xs(n.cacheRead,o),cacheWrite:xs(n.cacheWrite,o),output:xs(n.output,o)};const $=pa(r),G=$!==void 0&&$.id!=="custom"&&$.gatewayBaseUrl===void 0;return{provider:r,modelId:"",original:null,vision:!0,contextWindow:"",maxTokens:"",clientType:G?"":"openai",cacheRead:"",cacheWrite:"",output:"",baseUrl:$?.gatewayBaseUrl??"",originalBaseUrl:"",apiKeyInput:"",clearApiKey:!1}}),[k,w]=b.useState({}),[N,C]=b.useState(!1),[j,E]=b.useState(null),L=n===null,_=n!==null&&l_(n),q=$=>{y(G=>({...G,...$})),w(G=>{const me={...G};for(const M of Object.keys($))delete me[M];return me})},H=async()=>{C(!0);try{const $=g.apiKeyInput.trim(),G=g.baseUrl.trim(),me={provider:g.provider,modelId:g.modelId.trim(),baseUrl:G||null};$?me.apiKey=$:g.clearApiKey&&(me.clearApiKey=!0),g.clientType.trim()&&(me.clientType=g.clientType.trim());const M=await Nv(e,me);M.ok?ga(x.models.testOk(M.latencyMs??0)):Et(x.models.testFailed(M.message??""))}catch($){Et(x.models.testFailed(ze($)))}finally{C(!1)}},I=g.clientType.trim().toLowerCase().includes("openai")||g.provider==="custom"||pa(g.provider)===void 0,P=!_&&I,ee=()=>{const $=g.modelId.trim(),G={provider:g.provider,modelId:$},me=g.baseUrl.trim(),M={};$?!pt(G,g.original)&&l.some(ae=>pt(ae,G))&&(M.modelId=x.models.modelIdExists):M.modelId=x.common.requiredField,P&&!me&&(M.baseUrl=x.models.baseUrlRequired);const R=[["cacheRead",g.cacheRead.trim()],["cacheWrite",g.cacheWrite.trim()],["output",g.output.trim()]],O=R.filter(([,ae])=>ae!=="").length;for(const[ae,oe]of R)oe===""&&O>0?M[ae]=x.models.pricingAllOrNone:oe!==""&&!Number.isFinite(Number(oe))&&(M[ae]=x.models.pricingInvalid);const T=g.contextWindow.trim();T&&!Number.isFinite(Number(T))&&(M.contextWindow=x.models.contextWindowInvalid);const X=g.maxTokens.trim();return X&&!(Number.isInteger(Number(X))&&Number(X)>0)&&(M.maxTokens=x.models.maxTokensInvalid),Object.keys(M).length>0?(w(M),null):(w({}),{...g,modelId:$,contextWindow:!_&&!T?String(jm):g.contextWindow,cacheRead:Sm(g.cacheRead,o),cacheWrite:Sm(g.cacheWrite,o),output:Sm(g.output,o)})},Z=$=>{const G=ee();G&&h(G,$)},D=pa(g.provider),V=WA(g.modelId.trim(),g.clientType.trim()||void 0)?.envKey,B=D!==void 0&&D.id!=="custom"&&D.gatewayBaseUrl===void 0,Y=L&&B&&!g.clientType.trim()&&g.modelId.trim()!==""&&V===void 0,ne=i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"block",children:[i.jsxs("span",{className:"mb-1 flex items-baseline justify-between gap-2",children:[i.jsxs("span",{className:"text-xs font-semibold text-gray-600 dark:text-gray-400",children:[x.models.modelId,i.jsx("span",{className:"ml-0.5 text-red-500 dark:text-red-400","aria-hidden":!0,children:"*"})]}),i.jsx("span",{className:"flex shrink-0 items-baseline gap-2.5",children:D?.modelsUrl&&i.jsxs("a",{href:D.modelsUrl,target:"_blank",rel:"noreferrer noopener",className:"shrink-0 text-xs text-brand-600 underline-offset-2 hover:underline dark:text-brand-300",children:[x.models.getModelIds," ↗"]})})]}),i.jsx(Xe,{size:"sm",required:!0,value:g.modelId,disabled:!u,invalid:!!k.modelId,onChange:$=>q({modelId:$.target.value}),className:"font-mono",autoFocus:L,placeholder:x.models.modelIdHint}),k.modelId&&i.jsx(Nl,{children:k.modelId}),Y&&i.jsx("span",{className:"mt-1 block text-xs text-amber-600 dark:text-amber-400",children:x.models.autoRouteNone})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[i.jsx(Xe,{size:"sm",label:x.models.displayName,value:g.displayName??"",disabled:!u,onChange:$=>q({displayName:$.target.value}),placeholder:x.models.displayNameHint}),i.jsxs(eo,{size:"sm",label:x.models.providerGroup,value:g.provider,disabled:!u,onChange:$=>q({provider:$.target.value}),children:[al.map($=>i.jsx("option",{value:$.id,children:$.label},$.id)),[...new Set(l.map($=>$.provider).concat(g.provider))].filter($=>!al.some(G=>G.id===$)).sort().map($=>i.jsx("option",{value:$,children:$},$))]})]})]}),U=g.credential?.apiKeyMasked?x.models.apiKeyKeepHint:V?x.models.apiKeyEnvHint(V):x.models.apiKeyKeepHint,z=!g.credential?.apiKeyMasked&&V&&V===D?.envKey?x.models.providerEnvNotes[g.provider]:void 0;return i.jsxs(dn,{open:!0,title:L?B?x.models.addTitleVendor:x.models.addTitle:x.models.editTitle,onClose:m,widthClass:"sm:max-w-lg",footer:i.jsxs(i.Fragment,{children:[i.jsx(ke,{onClick:m,children:x.common.cancel}),u&&i.jsx(ke,{variant:"primary",onClick:()=>{if(!ee())return;if(L||n===null){Z("save");return}const $={...n,cacheRead:xs(n.cacheRead,o),cacheWrite:xs(n.cacheWrite,o),output:xs(n.output,o)};if(JSON.stringify(g)===JSON.stringify($)){Ol(x.common.noChangesToSave);return}E("save")},children:x.common.confirm})]}),children:[i.jsxs("div",{className:"space-y-3",children:[!L&&i.jsxs("div",{className:"flex items-center gap-2.5 rounded-md bg-gray-50 px-3 py-2 dark:bg-gray-800/60",children:[i.jsx(uo,{provider:g.provider,className:"h-6 w-6 shrink-0 text-gray-700 dark:text-gray-300"}),i.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[i.jsxs("span",{className:"flex flex-wrap items-center gap-1.5 text-sm font-medium",children:[g.displayName??g.modelId,d&&i.jsx(Lt,{tone:"brand",children:x.models.default}),g.vision&&i.jsx(Lt,{tone:"green",children:x.models.visionBadge}),f&&i.jsx(Lt,{tone:"amber",children:x.models.visionModelBadge})]}),g.displayName!==void 0&&i.jsx("span",{className:"truncate font-mono text-xs text-gray-500 dark:text-gray-400",children:g.modelId})]}),n&&j1(n.provider,n.modelId)&&i.jsxs("a",{href:j1(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:[x.models.homepage,i.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:i.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"})})]})]}),L&&i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:B?x.models.addAutoRouteHint:x.models.addProtocolHint}),ne]}),u&&i.jsx("div",{className:"space-y-1.5",children:i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx(ke,{size:"sm",disabled:N||!g.modelId.trim(),onClick:()=>{H()},children:N?x.models.testing:x.models.testConnection}),!L&&!d&&i.jsx(ke,{size:"sm",onClick:()=>E("setDefault"),children:x.models.setDefault}),!L&&g.vision&&!f&&i.jsx(ke,{size:"sm",title:x.models.visionModelHint,onClick:()=>E("setVisionModel"),children:x.models.setVisionModel}),!L&&i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"min-w-0 flex-1"}),i.jsx(ke,{size:"sm",variant:"danger",onClick:()=>E("remove"),children:x.models.remove})]})]})}),i.jsxs("div",{className:"block",children:[i.jsxs("span",{className:"mb-1 flex items-baseline justify-between gap-2",children:[i.jsx("span",{className:"text-xs font-semibold text-gray-600 dark:text-gray-400",children:x.models.apiKey}),D?.apiKeyUrl&&i.jsxs("a",{href:D.apiKeyUrl,target:"_blank",rel:"noreferrer noopener",className:"shrink-0 text-xs text-brand-600 underline-offset-2 hover:underline dark:text-brand-300",children:[x.models.getApiKey," ↗"]})]}),i.jsx(el,{size:"sm",value:g.apiKeyInput,disabled:!u,onChange:$=>q({apiKeyInput:$.target.value,clearApiKey:!1}),className:"font-mono",autoComplete:"off",autoFocus:!L,placeholder:U})]}),z&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:z}),g.credential?.apiKeyMasked&&!g.apiKeyInput&&i.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-gray-500 dark:text-gray-400",children:[i.jsx("span",{className:"font-mono",children:g.credential.apiKeyMasked}),g.credential.createdAt&&i.jsxs("span",{className:"text-gray-400",children:[x.common.created," ",Kn(g.credential.createdAt)]}),u&&i.jsxs("label",{className:"flex items-center gap-1.5",children:[i.jsx("input",{type:"checkbox",checked:g.clearApiKey,onChange:$=>q({clearApiKey:$.target.checked})}),x.models.clearApiKey]})]}),i.jsx(Xe,{size:"sm",label:x.models.baseUrl,required:P,value:g.baseUrl,disabled:!u,onChange:$=>q({baseUrl:$.target.value}),className:"font-mono",placeholder:_?x.models.baseUrlHint:"https://…",...k.baseUrl?{error:k.baseUrl}:{},...I?{}:{hint:x.models.baseUrlOfficialNote}}),i.jsxs("div",{className:"grid grid-cols-2 items-start gap-2",children:[i.jsxs("label",{className:"block",children:[i.jsx(Hi,{children:x.models.contextWindow}),i.jsxs("span",{className:"relative block",children:[i.jsx(Xe,{size:"sm",value:g.contextWindow,inputMode:"numeric",disabled:!u,invalid:!!k.contextWindow,onChange:$=>q({contextWindow:nv($.target.value)}),className:"pr-12 font-mono",title:_?x.models.contextWindowHint:x.models.contextWindowDefaultHint(jm),placeholder:_?x.models.contextWindowHint:x.models.contextWindowDefaultHint(jm)}),i.jsx("span",{className:"pointer-events-none absolute inset-y-0 right-2 flex items-center text-xs text-gray-400",children:x.models.tokenUnit})]}),k.contextWindow&&i.jsx(Nl,{children:k.contextWindow})]}),i.jsxs("label",{className:"block",children:[i.jsx(Hi,{children:x.models.maxTokens}),i.jsxs("span",{className:"relative block",children:[i.jsx(Xe,{size:"sm",value:g.maxTokens,inputMode:"numeric",disabled:!u,invalid:!!k.maxTokens,onChange:$=>q({maxTokens:nv($.target.value)}),className:"pr-12 font-mono",title:x.models.maxTokensTitle,placeholder:x.models.maxTokensHint}),i.jsx("span",{className:"pointer-events-none absolute inset-y-0 right-2 flex items-center text-xs text-gray-400",children:x.models.tokenUnit})]}),k.maxTokens&&i.jsx(Nl,{children:k.maxTokens})]})]}),i.jsx("div",{className:"grid grid-cols-3 items-start gap-2",children:[["cacheRead",x.models.priceCacheRead,g.cacheRead],["cacheWrite",x.models.priceCacheWrite,g.cacheWrite],["output",x.models.priceOutput,g.output]].map(([$,G,me])=>i.jsxs("label",{className:"block",children:[i.jsx(Hi,{children:G}),i.jsxs("span",{className:"relative block",children:[i.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-2 flex items-center text-xs text-gray-400",children:Jk[o]}),i.jsx(Xe,{size:"sm",value:me,inputMode:"decimal",disabled:!u,invalid:!!k[$],onChange:M=>q({[$]:a_(M.target.value)}),className:"pl-4 pr-11 text-right font-mono"}),i.jsx("span",{className:"pointer-events-none absolute inset-y-0 right-2 flex items-center text-xs text-gray-400",children:x.models.priceUnitShort})]}),k[$]&&i.jsx(Nl,{children:k[$]})]},$))}),!L&&ne,!L&&!_&&g.clientType&&g.clientType!=="openai"&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:x.models.clientTypeLocked(g.clientType)}),!_&&i.jsxs("div",{children:[i.jsxs("label",{className:`inline-flex items-center gap-2 ${u?"cursor-pointer":"cursor-not-allowed"}`,children:[i.jsx("span",{className:"text-xs font-semibold text-gray-600 dark:text-gray-400",children:x.models.vision}),i.jsx(Xk,{checked:g.vision,disabled:!u,onChange:$=>q({vision:$}),"aria-label":x.models.vision})]}),!g.vision&&i.jsx("p",{className:"mt-1 text-xs text-gray-400 dark:text-gray-500",children:x.models.visionOffProxyHint})]})]}),j&&i.jsx(Gn,{open:!0,title:u_[j](),tone:j==="remove"?"danger":"primary",onClose:()=>E(null),onConfirm:()=>{const $=j;E(null),Z($)},children:i.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:d_[j](g.displayName??g.modelId)})})]})}function m_({provider:e,count:n,onClose:r,onSubmit:l}){const[o,u]=b.useState("");return i.jsx(dn,{open:!0,title:x.models.groupApiKeyTitle(e.label),onClose:r,footer:i.jsxs(i.Fragment,{children:[i.jsx(ke,{onClick:r,children:x.common.cancel}),i.jsx(ke,{variant:"primary",disabled:!o.trim(),onClick:()=>l(o.trim()),children:x.common.confirm})]}),children:i.jsxs("div",{className:"space-y-2",children:[i.jsx(Xe,{size:"sm",label:x.models.apiKey,required:!0,type:"password",value:o,onChange:d=>u(d.target.value),className:"font-mono",autoComplete:"off",autoFocus:!0,placeholder:x.models.apiKeyEnvHint(e.envKey)}),i.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:x.models.groupApiKeyHint(n)}),x.models.providerEnvNotes[e.id]&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:x.models.providerEnvNotes[e.id]}),e.apiKeyUrl&&i.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:[x.models.getApiKey," ↗"]})]})})}const Bi=200,Rl=46,mu=8,Vi=10,h_=22;function op(e,n,r){const l=Math.max(0,r-Rl-mu),o=Bi-Vi-h_,u=e>0?l/e:l;return{n:e,max:n,w:r,innerW:l,innerH:o,step:u,x:d=>Rl+u*d+u/2,y:d=>Vi+o*(1-(n>0?d/n:0))}}function p_(e,n){return n.map((r,l)=>`${l===0?"M":"L"}${e.x(l)},${e.y(r)}`).join(" ")}function g_(e,n){const r=n.length;if(r===0)return"";const l=e.y(0),o=[];for(let u=0;u<r;u++)o.push(`${u===0?"M":"L"}${e.x(u)},${e.y(n[u])}`);return o.push(`L${e.x(r-1)},${l}`),o.push(`L${e.x(0)},${l}`),o.push("Z"),o.join(" ")}function x_(e){return e<=0?[]:e===1?[0]:e===2?[0,1]:[0,Math.floor((e-1)/2),e-1]}const y_=40;function v_(e,n){if(e<=0)return[];const r=n>0?Math.max(1,Math.ceil(y_/n)):e,l=[];for(let o=0;o<e;o+=r)l.push(o);return l}function b_(e,n){return n>0?e/n:1}const Bc=12;function k_(e,n,r,l,o){let u=e+Bc;u+r>o.right&&(u=e-Bc-r);let d=n+Bc;return d+l>o.bottom&&(d=n-Bc-l),{left:Math.max(o.left,Math.min(u,o.right-r)),top:Math.max(0,Math.min(d,o.bottom-l))}}const Cm=25,w_=8;function S_(e,n){const r=Math.max(0,e-Rl-mu),l=2*Cm*n;return l<=r?{barW:Cm,chartW:e,scroll:!1}:{barW:Cm,chartW:Rl+l+mu,scroll:!0}}function j_(e,n,r){const l=e.length;if(l===0)return[];if(n<=l*r)return e.map(()=>n/l);const o=new Set;for(;;){const u=n-o.size*r,d=e.reduce((h,g,y)=>o.has(y)?h:h+g,0),f=h=>d>0?e[h]/d*u:u/(l-o.size),m=e.findIndex((h,g)=>!o.has(g)&&f(g)<r);if(m<0)return e.map((h,g)=>o.has(g)?r:f(g));o.add(m)}}const C_=["output","cacheWrite","cacheRead"];function N_(e,n){const r=C_.map(m=>({key:m,value:n[m]})).filter(m=>m.value>0);if(r.length===0)return[];const l=[];let o=0;for(const m of r){const h=e.y(o);o+=m.value;const g=e.y(o);l.push({y:g,h:h-g})}const u=e.y(0),d=j_(l.map(m=>m.h),u-e.y(o),w_);let f=u;return r.map((m,h)=>{const g=d[h],y={key:m.key,value:m.value,y:l[h].y,h:l[h].h,hitY:f-g,hitH:g};return f-=g,y})}const e2=Math.PI*2,hu=e=>Math.round(e*100)/100;function Hc(e,n,r,l){const o=l-Math.PI/2;return[hu(e+r*Math.cos(o)),hu(n+r*Math.sin(o))]}function T_(e,n,r,l,o){if(o-l>=e2-1e-9){const[g,y]=Hc(e,n,r,0),[k,w]=Hc(e,n,r,Math.PI);return`M${g},${y} A${r},${r} 0 1 1 ${k},${w} A${r},${r} 0 1 1 ${g},${y} Z`}const[u,d]=Hc(e,n,r,l),[f,m]=Hc(e,n,r,o),h=o-l>Math.PI?1:0;return`M${hu(e)},${hu(n)} L${u},${d} A${r},${r} 0 ${h} 1 ${f},${m} Z`}function M_(e,n,r,l){const o=e.reduce((f,m)=>f+Math.max(0,m),0);if(o<=0)return[];const u=[];let d=0;return e.forEach((f,m)=>{if(f<=0)return;const h=f/o,g=d+h*e2;u.push({index:m,value:f,frac:h,start:d,end:g,path:T_(n,r,l,d,g)}),d=g}),u}function cp(){const e=b.useRef(null),[n,r]=b.useState(0);return b.useLayoutEffect(()=>{const l=e.current;if(!l)return;const o=()=>r(Math.floor(l.getBoundingClientRect().width));o();const u=new ResizeObserver(o);return u.observe(l),()=>u.disconnect()},[]),[e,n]}function up({geom:e,fmtY:n,dates:r,hover:l,onHover:o,bubble:u,hitLayer:d,labels:f,hoverLine:m=!0,scrollToEnd:h=!1,children:g}){const{x:y,y:k,w,innerH:N,step:C,max:j}=e,E=[0,.25,.5,.75,1].map(D=>j*D),L=f??x_(r.length),_=b.useRef(null);b.useLayoutEffect(()=>{const D=_.current;!h||!D||(D.scrollLeft=D.scrollWidth-D.clientWidth)},[h,w,r.length]);const q=b.useRef(null),H=b.useRef(null),I=b.useRef(null),P=b.useRef(0),ee=()=>{const D=H.current,V=q.current,B=_.current,Y=I.current;if(!D||!V||!B||!Y)return;const ne=V.getBoundingClientRect(),U=k_(Y.cx-ne.left,Y.cy-ne.top,D.offsetWidth,D.offsetHeight,{left:B.scrollLeft,right:B.scrollLeft+B.clientWidth,bottom:Bi});D.style.left=`${U.left}px`,D.style.top=`${U.top}px`,D.style.visibility="visible"},Z=()=>{P.current||(P.current=requestAnimationFrame(()=>{P.current=0,ee()}))};return b.useEffect(()=>()=>cancelAnimationFrame(P.current),[]),b.useLayoutEffect(ee,[u,l]),i.jsxs("div",{ref:_,className:"relative overflow-x-auto",children:[i.jsxs("svg",{ref:q,viewBox:`0 0 ${w} ${Bi}`,width:w,height:Bi,className:"text-gray-600 dark:text-gray-400",role:"img",onMouseLeave:()=>{o(null),I.current=null},onMouseMove:D=>{I.current={cx:D.clientX,cy:D.clientY},Z()},children:[E.map((D,V)=>i.jsxs("g",{children:[i.jsx("line",{x1:Rl,x2:w-mu,y1:k(D),y2:k(D),className:"stroke-gray-200 dark:stroke-gray-800",strokeWidth:1}),i.jsx("text",{x:Rl-6,y:k(D)+3,textAnchor:"end",className:"fill-gray-400 dark:fill-gray-500",fontSize:9,children:n(D)})]},V)),m&&l!==null&&r[l]&&i.jsx("line",{x1:y(l),x2:y(l),y1:Vi,y2:Vi+N,className:"stroke-gray-300 dark:stroke-gray-700",strokeWidth:1}),g,L.map(D=>{const V=r[D];return V?i.jsx("text",{x:y(D),y:Bi-6,textAnchor:"middle",className:"fill-gray-400 dark:fill-gray-500",fontSize:9,children:V.slice(5)},D):null}),d??r.map((D,V)=>i.jsx("rect",{x:Rl+C*V,y:Vi,width:C,height:N,fill:"transparent",className:"cursor-crosshair",onMouseEnter:()=>o(V)},`hit-${V}`))]}),u&&l!==null&&r[l]&&i.jsx("div",{ref:H,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:u(l)})]})}function E_({points:e,currency:n="USD"}){const[r,l]=b.useState(null),[o,u]=cp(),d=e.map(g=>g.cost??0),f=Math.max(1e-9,...d),m=op(e.length,f,u),h=e.map(g=>g.date);return i.jsx("div",{ref:o,children:u>0&&i.jsx(up,{geom:m,fmtY:g=>ya(g,n),dates:h,hover:r,onHover:l,bubble:g=>{const y=e[g];return i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-gray-400",children:y.date}),i.jsx("p",{className:"font-mono",children:ya(y.cost,n)})]})},children:i.jsxs("g",{children:[i.jsx("path",{d:g_(m,d),className:"fill-current",stroke:"none",opacity:r!==null?.06:.1}),i.jsx("path",{d:p_(m,d),fill:"none",stroke:"currentColor",strokeWidth:2,opacity:r!==null?.35:1}),e.map((g,y)=>i.jsx("circle",{cx:m.x(y),cy:m.y(g.cost??0),r:r===y?4:2.5,className:"fill-current",opacity:r!==null&&r!==y?.25:1},g.date))]})})})}const Gi={cacheRead:"#7dd3fc",cacheWrite:"#0ea5e9",output:"#0369a1"},rv=[{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 lv(e){return rv[e%rv.length]}const sv=[{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 t2(e){return sv[e%sv.length]}function Lu({text:e}){return i.jsx("p",{className:"py-6 text-center text-xs text-gray-400",children:e??x.usage.empty})}function A_(e){return e==="cacheRead"?x.usage.colCacheRead:e==="cacheWrite"?x.usage.colCacheWrite:x.usage.colOutput}const n2="opacity-25",Pc=160,R_=75;function __({data:e}){const[n,r]=b.useState(null),l=e.reduce((m,h)=>m+h.requests,0);if(e.length===0||l<=0)return i.jsx(Lu,{});const o=[...e].sort((m,h)=>h.requests-m.requests),u=M_(o.map(m=>m.requests),Pc/2,Pc/2,R_),d=m=>`${Math.round(m/l*100)}%`,f=m=>n!==null&&n!==m?n2:"";return i.jsxs("div",{className:"flex items-center gap-3",onMouseLeave:()=>r(null),children:[i.jsx("svg",{viewBox:`0 0 ${Pc} ${Pc}`,className:"h-40 w-40 shrink-0",role:"img","aria-label":x.usage.chartAgentCalls,children:u.map(m=>{const h=o[m.index];return i.jsx("path",{d:m.path,onMouseEnter:()=>r(m.index),className:`cursor-pointer ${lv(m.index).fill} transition-opacity duration-150 ${f(m.index)}`,children:i.jsx("title",{children:`${h.agentId} · ${h.requests} ${x.usage.requests} · ${d(h.requests)}`})},h.agentId)})}),i.jsx("ul",{className:"flex max-h-40 min-w-0 flex-1 flex-col gap-1 overflow-y-auto",children:o.map((m,h)=>i.jsxs("li",{onMouseEnter:()=>r(m.requests>0?h:null),title:`${m.agentId} · ${m.requests} ${x.usage.requests} · ${ut(m.total)}`,className:`flex cursor-pointer items-center gap-1.5 text-[10px] transition-opacity duration-150 ${f(h)}`,children:[i.jsx("span",{className:`inline-block h-2 w-2 shrink-0 rounded-sm ${lv(h).swatch}`}),i.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-gray-500 dark:text-gray-400",children:m.agentId}),i.jsx("span",{className:"shrink-0 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:m.requests}),i.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 L_({dimmed:e,onEnter:n,title:r,label:l,value:o,children:u}){return i.jsxs("div",{onMouseEnter:n,className:`flex cursor-pointer items-center gap-2 transition-opacity duration-150 ${e?n2:""}`,title:r,children:[i.jsx("span",{className:"w-24 shrink-0 truncate font-mono text-[10px] text-gray-500 dark:text-gray-400",children:l}),u,i.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 I_(e){return rp(e.provider,e.modelId)?.displayName??e.modelId}function O_(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(`${x.usage.successAborted} ${e.aborted}`);const r=pa(e.provider)?.label??e.provider;return`${e.modelId} · ${r} · ${n.join(" · ")}`}function z_({data:e}){const[n,r]=b.useState(null);return e.length===0?i.jsx(Lu,{}):i.jsx("div",{className:"flex flex-col gap-1.5",onMouseLeave:()=>r(null),children:e.map((l,o)=>{const u=b_(l.completed,l.total),d=Math.round(u*100);return i.jsx(L_,{dimmed:n!==null&&n!==o,onEnter:()=>r(o),title:O_(l),label:I_(l),value:`${d}%`,children:i.jsx("div",{className:"h-3 min-w-0 flex-1 overflow-hidden rounded-sm bg-gray-200 dark:bg-gray-800",children:i.jsx("div",{className:"h-full rounded-sm bg-sky-500 dark:bg-sky-400",style:{width:`${u*100}%`}})})},`${l.provider}:${l.modelId}`)})})}function D_({trend:e,legend:n}){const[r,l]=b.useState(null),[o,u]=cp();if(e.length===0)return i.jsx(Lu,{});const d=e.map(C=>C.cacheRead+C.cacheWrite+C.output),f=Math.max(1,...d),{barW:m,chartW:h,scroll:g}=S_(u,e.length),y=op(e.length,f,h),k=e.map(C=>C.date),w=e.map(C=>N_(y,C)),N=(C,j)=>r!==null&&!(r.i===C&&r.key===j)||n!=null&&n!==j;return i.jsx("div",{ref:o,children:u>0&&i.jsx(up,{geom:y,fmtY:C=>ut(Math.round(C)),dates:k,hover:r?.i??null,labels:v_(e.length,y.step),hoverLine:!1,scrollToEnd:g,onHover:C=>{C===null&&l(null)},bubble:C=>{const j=e[C],E=r?.key;if(!E)return null;const L=E==="cacheRead"?fb(j.cacheRead,j.cacheWrite):null;return i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-gray-400",children:j.date}),i.jsxs("p",{className:"font-mono",children:[A_(E)," ",ut(j[E])]}),L!==null&&i.jsxs("p",{className:"font-mono",children:[x.traces.hitRate," ",Eh(L)]})]})},hitLayer:e.map((C,j)=>w[j].map(E=>i.jsx("rect",{x:y.x(j)-m/2,y:E.hitY,width:m,height:E.hitH,fill:"transparent",className:"cursor-pointer",onMouseEnter:()=>l({i:j,key:E.key}),onMouseLeave:()=>l(null)},`hit-${C.date}-${E.key}`))),children:e.map((C,j)=>w[j].map(E=>i.jsx("rect",{x:y.x(j)-m/2,y:E.y,width:m,height:E.h,fill:Gi[E.key],className:"transition-opacity duration-150",opacity:N(j,E.key)?.2:1},`${C.date}-${E.key}`)))})})}function U_({active:e,onHover:n}){const r=[["cacheRead",x.usage.colCacheRead],["cacheWrite",x.usage.colCacheWrite],["output",x.usage.colOutput]];return i.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:r.map(([l,o])=>i.jsxs("button",{type:"button",onMouseEnter:()=>n?.(l),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!==l?"opacity-30":""}`,children:[i.jsx("span",{className:"inline-block h-2 w-3 rounded-sm",style:{backgroundColor:Gi[l]}}),o]},l))})}function $_(e){return e==="unexpected"?x.usage.errorsUnexpected:x.usage.errorsExpected}function B_(e){return e==="unexpected"?"unexpected":"expected"}function qc({label:e,value:n,alert:r,muted:l}){const o=r?"text-rose-600 dark:text-rose-400":l?"text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100";return i.jsxs("div",{className:"flex items-baseline gap-1.5",children:[i.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:e}),i.jsx("span",{className:`font-mono text-sm font-semibold tabular-nums ${o}`,children:n})]})}function Fc({children:e,className:n=""}){return i.jsx("th",{className:`py-1.5 pr-2 font-medium ${n}`,children:e})}function H_({errors:e}){const{total:n,unexpected:r,topCode:l,recent:o}=e,[u,d]=b.useState(new Set),f=m=>d(h=>{const g=new Set(h);return g.has(m)?g.delete(m):g.add(m),g});return i.jsxs("div",{children:[i.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-6 gap-y-1.5",children:[i.jsx(qc,{label:x.usage.errorsTotal,value:String(n)}),i.jsx(qc,{label:x.usage.errorsUnexpected,value:String(r),alert:r>0,muted:r===0}),i.jsx(qc,{label:x.usage.errorsExpected,value:String(n-r),muted:!0}),l&&i.jsx(qc,{label:x.usage.errorsTopCode,value:`${l.source} · ${l.code} ×${l.count}`})]}),o.length===0?i.jsx(Lu,{text:x.usage.errorsEmpty}):i.jsx("div",{className:"mt-2.5 max-h-72 overflow-y-auto border-t border-gray-200 dark:border-gray-800",children:i.jsxs("table",{className:"w-full table-fixed text-xs",children:[i.jsx("thead",{className:"sticky top-0 bg-white text-left text-gray-400 dark:bg-gray-900 dark:text-gray-500",children:i.jsxs("tr",{children:[i.jsx(Fc,{className:"w-32",children:x.common.time}),i.jsx(Fc,{className:"w-72",children:x.usage.errorsColCode}),i.jsx(Fc,{className:"w-20",children:x.usage.errorsColKind}),i.jsx(Fc,{children:x.usage.errorsColMessage})]})}),i.jsx("tbody",{children:o.map((m,h)=>{const g=B_(m.kind);return i.jsxs("tr",{className:"border-t border-gray-100 dark:border-gray-800/60",children:[i.jsx("td",{className:"py-1.5 pr-2 align-top font-mono tabular-nums text-gray-400",children:Kn(m.ts)}),i.jsx("td",{className:"py-1.5 pr-2 align-top font-mono text-gray-500 dark:text-gray-400",children:i.jsxs("span",{className:"block break-words",children:[m.source," · ",m.code]})}),i.jsx("td",{className:"py-1.5 pr-2 align-top",children:i.jsx(Lt,{tone:g==="unexpected"?"red":"gray",children:$_(g)})}),i.jsx("td",{className:"py-1.5 align-top text-gray-500 dark:text-gray-400",children:i.jsx("button",{type:"button",title:m.message,onClick:()=>f(h),className:`block w-full cursor-pointer text-left transition-colors hover:text-gray-700 dark:hover:text-gray-300 ${u.has(h)?"whitespace-pre-wrap break-words":"truncate"}`,children:m.message})})]},`${m.ts}-${h}`)})})]})})]})}function iv(e){const n=r=>r<10?`0${r}`:`${r}`;return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`}function Nm({label:e,value:n,muted:r,sup:l}){const o=r?"text-gray-500 dark:text-gray-400":"text-gray-900 dark:text-gray-100";return i.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[i.jsxs("span",{className:"shrink-0 text-xs text-gray-500 dark:text-gray-400",children:[e,l&&i.jsx("sup",{className:"ml-px",children:"*"})]}),i.jsx("span",{className:`min-w-0 truncate font-mono text-sm font-semibold tabular-nums ${o}`,children:n})]})}function Tm({title:e,bucket:n,currency:r}){return i.jsxs("div",{className:"rounded-md border border-gray-200 bg-white p-3 dark:border-gray-800 dark:bg-gray-900",children:[i.jsx("p",{className:"mb-1.5 text-xs font-medium text-gray-500 dark:text-gray-400",children:e}),i.jsxs("div",{className:"space-y-0.5",children:[i.jsx(Nm,{label:x.usage.tokens,value:ut(n.total)}),i.jsx(Nm,{label:x.usage.requests,value:String(n.requests),muted:!0}),i.jsx(Nm,{label:x.common.cost,value:ya(n.cost,r),sup:n.hasUncosted})]})]})}function zi({title:e,extra:n,children:r}){return i.jsxs("div",{className:"rounded-md border border-gray-200 bg-white p-3 dark:border-gray-800 dark:bg-gray-900",children:[i.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-x-2 gap-y-1",children:[i.jsx("p",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:e}),n]}),r]})}function P_(){Ka(x.usage.title);const{currency:e}=Ll(),{currentProject:n}=fn(),r=n?.projectId??null,[l]=wh(),o=l.get("agentId"),[u,d]=b.useState(o??""),[f,m]=b.useState(null);b.useEffect(()=>{d(o??"")},[o]);const[h,g]=b.useState(()=>{const Z=new Date;return Z.setDate(Z.getDate()-29),iv(Z)}),[y,k]=b.useState(()=>iv(new Date)),[w,N]=b.useState(null),[C,j]=b.useState(null),[E,L]=b.useState(null),_=b.useCallback(async()=>{if(r){j(null);try{const Z=await Mv(r,{from:h,to:y,groupBy:"date",...u?{agentId:u}:{},...f?{provider:f.provider,modelId:f.modelId}:{}});N(Z)}catch(Z){j(ze(Z))}}},[r,h,y,u,f?.provider,f?.modelId]);if(b.useEffect(()=>{N(null),_()},[_]),!r)return null;const q=w?.models??[],H=f?q.findIndex(Z=>Z.provider===f.provider&&Z.modelId===f.modelId):-1,I=H>=0?String(H):"",P=w?.summary,ee=(P?.today.hasUncosted??!1)||(P?.last7d.hasUncosted??!1)||(P?.total.hasUncosted??!1);return i.jsx("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:i.jsxs("div",{className:"mx-auto max-w-5xl space-y-4",children:[i.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[i.jsx("h1",{className:"text-xl font-semibold",children:x.usage.title}),i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("div",{className:"w-32",children:i.jsxs(eo,{size:"sm",value:u,onChange:Z=>d(Z.target.value),children:[i.jsx("option",{value:"",children:x.usage.filterAllAgents}),u&&!(w?.agentIds??[]).includes(u)&&i.jsx("option",{value:u,children:u}),(w?.agentIds??[]).map(Z=>i.jsx("option",{value:Z,children:Z},Z))]})}),i.jsx("div",{className:"w-32",children:i.jsxs(eo,{size:"sm",value:I,onChange:Z=>{const D=Z.target.value;m(D===""?null:q[Number(D)]??null)},children:[i.jsx("option",{value:"",children:x.usage.filterAllModels}),q.map((Z,D)=>i.jsx("option",{value:String(D),children:rp(Z.provider,Z.modelId)?.displayName??Z.modelId},`${Z.provider}:${Z.modelId}`))]})}),i.jsxs("div",{className:"flex items-center gap-1.5",children:[i.jsx(Xe,{size:"sm",type:"date","aria-label":x.usage.from,value:h,onChange:Z=>g(Z.target.value)}),i.jsx("span",{className:"shrink-0 text-gray-400","aria-hidden":!0,children:"–"}),i.jsx(Xe,{size:"sm",type:"date","aria-label":x.usage.to,value:y,onChange:Z=>k(Z.target.value)})]})]})]}),w?i.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[i.jsx(Tm,{title:x.usage.today,bucket:w.summary.today,currency:e}),i.jsx(Tm,{title:x.usage.last7d,bucket:w.summary.last7d,currency:e}),i.jsx(Tm,{title:x.usage.total,bucket:w.summary.total,currency:e})]}):i.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:[i.jsx(Ut,{className:"h-24"}),i.jsx(Ut,{className:"h-24"}),i.jsx(Ut,{className:"h-24"})]}),w?i.jsxs("div",{className:"grid grid-cols-1 gap-3 lg:grid-cols-2",children:[i.jsx(zi,{title:x.usage.chartAgentCalls,children:i.jsx(__,{data:w.byAgent})}),i.jsx(zi,{title:x.usage.chartSuccessRate,children:i.jsx(z_,{data:w.success})}),i.jsx(zi,{title:x.usage.chartTokenTrend,extra:i.jsx(U_,{active:E,onHover:L}),children:i.jsx(D_,{trend:w.trend,legend:E})}),i.jsx(zi,{title:x.usage.chartCostTrend,children:i.jsx(E_,{points:w.trend,currency:e})})]}):i.jsx(Ut,{className:"h-64"}),w&&i.jsx(zi,{title:x.usage.errors,children:i.jsx(H_,{errors:w.errors})}),ee&&i.jsx("p",{className:"text-xs text-gray-400",children:x.usage.uncostedNote}),C&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:C})]})})}function q_({cacheRead:e,cacheWrite:n,output:r,max:l,size:o=44}){const u=e+n+r,d=Math.max(2,Math.round(o*.16)),f=o/2,m=(o-d)/2,h=2*Math.PI*m,g=Math.max(l,u,1),y=l>0?u/l: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:Gi.cacheRead,label:x.usage.colCacheRead},{key:"cacheWrite",value:n,color:Gi.cacheWrite,label:x.usage.colCacheWrite},{key:"output",value:r,color:Gi.output,label:x.usage.colOutput}],N=`${x.chat.contextUsage} ${ut(u)}/${ut(l)}`+w.map(j=>` · ${j.label} ${ut(j.value)}`).join("");let C=0;return i.jsxs("svg",{width:o,height:o,viewBox:`0 0 ${o} ${o}`,className:`block shrink-0 ${k}`,role:"img","aria-label":N,children:[i.jsx("title",{children:N}),i.jsx("circle",{cx:f,cy:f,r:m,fill:"none",stroke:"currentColor",strokeOpacity:.35,strokeWidth:d}),w.map(j=>{if(j.value<=0)return null;const E=j.value/g*h,L=-(C/g)*h;return C+=j.value,i.jsx("circle",{cx:f,cy:f,r:m,fill:"none",stroke:j.color,strokeWidth:d,strokeDasharray:`${E} ${h}`,strokeDashoffset:L,transform:`rotate(-90 ${f} ${f})`},j.key)})]})}const Na={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"},dp="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",a2="truncate font-mono text-[11px]",ov=.25,ih=24,F_=1/ih,gr=(e,n,r)=>Math.min(r,Math.max(n,e));function V_(e){return e==="thinking"?Na.thinking:e==="text"?Na.text:Na.toolgen}function G_(e){return e==="thinking"?x.traces.kindThinking:e==="text"?x.traces.kindModelReply:x.traces.kindToolGen}function K_(e){return e==="thinking"?"thinking":e==="text"?"text":"toolgen"}function Di(e){if(e===void 0)return null;const n=Date.parse(e);return Number.isFinite(n)?n:null}function W_(e,n){const r=new Map,l=u=>{let d=r.get(u);return d||(d={segs:[],spans:[]},r.set(u,d)),d};for(const u of e){const d=Di(u.startTs),f=Di(u.endTs);d===null||f===null||l(u.taskIndex).segs.push({kind:u.kind,...u.name!==void 0?{name:u.name}:{},ts:u.endTs,startMs:d,endMs:f})}for(const u of n){const d=Di(u.callTs);d!==null&&l(u.taskIndex).spans.push({name:u.name||u.toolCallId,toolCallId:u.toolCallId,callTs:u.callTs,...u.approvalTs!==void 0?{approvalTsRaw:u.approvalTs}:{},...u.outputTs!==void 0?{outputTsRaw:u.outputTs}:{},callMs:d,approvalMs:Di(u.approvalTs),outputMs:Di(u.outputTs),failed:u.stopReason!==void 0&&u.stopReason!=="completed",...u.stopReason!==void 0?{status:u.stopReason}:{},...u.decision!==void 0?{decision:u.decision}:{}})}const o=[];for(const[u,{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(N=>N.startMs),...f.map(N=>N.callMs)],h=[...d.map(N=>N.endMs),...f.map(N=>N.outputMs??N.approvalMs??N.callMs)],g=Math.min(...m),y=Math.max(...h,...m),k=Math.max(1,y-g);f.sort((N,C)=>N.callMs-C.callMs);const w=[...new Set(f.map(N=>N.name))];o.push({taskIndex:u,segs:d,spans:f,t0:g,total:k,toolNames:w})}return o}function r2({children:e}){return i.jsx("div",{className:"relative h-4 min-w-0 flex-1 overflow-hidden bg-gray-100 dark:bg-gray-800/60",children:e})}function Y_({label:e,children:n}){return i.jsxs("div",{className:"flex items-center",children:[i.jsx("span",{className:`${dp} text-gray-400 dark:text-gray-500`,title:e,children:i.jsx("span",{className:a2,children:e})}),i.jsx(r2,{children:n})]})}function Q_({total:e}){const n=[0,.25,.5,.75,1];return i.jsxs("div",{className:"flex items-center",children:[i.jsx("span",{className:dp}),i.jsx("div",{className:"relative h-4 min-w-0 flex-1",children:n.map((r,l)=>i.jsx("span",{className:`absolute top-0 font-mono text-[11px] text-gray-400 dark:text-gray-500 ${l===0?"":l===n.length-1?"-translate-x-full":"-translate-x-1/2"}`,style:{left:`${r*100}%`},children:ln(r*e)},l))})]})}function X_({segments:e,toolSpans:n,highlight:r,onHighlight:l,onJump:o,hideTaskLabel:u=!1}){const d=b.useMemo(()=>W_(e,n),[e,n]),{firstBarKeyByTs:f,barKeys:m}=b.useMemo(()=>{const O=new Map,T=new Set,X=(ae,oe)=>{T.add(oe),O.has(ae)||O.set(ae,oe)};for(const ae of d){ae.segs.forEach((oe,ge)=>X(oe.ts,`s-${ae.taskIndex}-${ge}`));for(const oe of ae.spans)oe.approvalMs!==null&&oe.approvalMs>oe.callMs&&X(oe.approvalTsRaw??oe.callTs,`w-${oe.toolCallId}`),oe.approvalMs===null&&oe.outputMs===null?X(oe.callTs,`p-${oe.toolCallId}`):X(oe.outputTsRaw??oe.callTs,`e-${oe.toolCallId}`)}return{firstBarKeyByTs:O,barKeys:T}},[d]),[h,g]=b.useState(null),[y,k]=b.useState(1),[w,N]=b.useState({left:0,width:1}),C=b.useRef(null),j=b.useRef(null),E=b.useRef(w);E.current=w;const L=b.useRef(y);L.current=y;const _=b.useRef(null),q=b.useRef(null),H=b.useCallback(()=>{const O=C.current;if(!O)return;const T=O.scrollWidth||1;N({left:O.scrollLeft/T,width:Math.min(1,O.clientWidth/T)})},[]);if(b.useLayoutEffect(()=>{const O=C.current;if(O){if(_.current){const T=O.scrollWidth-O.clientWidth;O.scrollLeft=gr(_.current(O),0,Math.max(0,T)),_.current=null}H()}},[y,d,H]),b.useLayoutEffect(()=>{const O=C.current;if(!O||typeof ResizeObserver>"u")return;const T=new ResizeObserver(()=>H());return T.observe(O),()=>T.disconnect()},[H]),b.useLayoutEffect(()=>()=>q.current?.(),[]),d.length===0)return i.jsx("p",{className:"text-xs text-gray-400",children:x.common.none});const I=r?.ts,P=r?.key,ee=(O,T)=>l?.(T?{ts:T,key:O}:null),Z=()=>l?.(null),D=P??(I!==void 0?f.get(I):void 0),V=D!==void 0&&m.has(D)?D:void 0,B=V!==void 0,Y=O=>V===O,ne=(O,T)=>h!==null&&!T||B&&!O?"opacity-15":"",U=(O,T,X,ae)=>{const oe=gr((O-X)/ae*100,0,100),ge=gr((T-O)/ae*100,0,100-oe);return oe>=100?{left:"100%",width:"0%",marginLeft:"-2px"}:{left:`${oe}%`,width:`${ge}%`}},z=[{key:"thinking",className:Na.thinking,label:x.traces.kindThinking},{key:"text",className:Na.text,label:x.traces.kindModelReply},{key:"toolgen",className:Na.toolgen,label:x.traces.kindToolGen},{key:"approvalWait",className:Na.approvalWait,label:x.traces.legendApprovalWait},{key:"exec",className:Na.exec,label:x.traces.legendToolExec}],$=(O,T)=>{const X=gr(T,F_,1),ae=gr(1/X,ov,ih),oe=gr(O,0,1-X);_.current=ge=>oe*ge.scrollWidth,k(ae)},G=O=>{O.preventDefault();const T=j.current,X=C.current;if(!T||!X)return;const ae=T.getBoundingClientRect().width||1,oe=O.clientX,ge=X.scrollLeft,Te=Math.max(0,X.scrollWidth-X.clientWidth),se=be=>{const Pe=(be.clientX-oe)/ae;X.scrollLeft=gr(ge+Pe*X.scrollWidth,0,Te),H()},pe=()=>{window.removeEventListener("pointermove",se),window.removeEventListener("pointerup",pe),window.removeEventListener("pointercancel",pe),q.current=null};window.addEventListener("pointermove",se),window.addEventListener("pointerup",pe),window.addEventListener("pointercancel",pe),q.current=pe},me=O=>T=>{T.preventDefault(),T.stopPropagation();const X=j.current;if(!X)return;const ae=X.getBoundingClientRect(),oe=Te=>{const se=gr((Te.clientX-ae.left)/(ae.width||1),0,1),pe=E.current;if(O==="right")$(pe.left,se-pe.left);else{const be=pe.left+pe.width;$(se,be-se)}},ge=()=>{window.removeEventListener("pointermove",oe),window.removeEventListener("pointerup",ge),window.removeEventListener("pointercancel",ge),q.current=null};window.addEventListener("pointermove",oe),window.addEventListener("pointerup",ge),window.addEventListener("pointercancel",ge),q.current=ge},M=()=>{_.current=()=>0,k(1)},R=O=>{const T=C.current,X=gr(L.current*O,ov,ih);if(X!==L.current){if(T){const ae=T.clientWidth/2,oe=(T.scrollLeft+ae)/(T.scrollWidth||1);_.current=ge=>oe*ge.scrollWidth-ae}k(X)}};return i.jsxs("div",{className:"space-y-3",children:[i.jsx("div",{ref:C,className:"no-scrollbar overflow-x-auto overflow-y-hidden",children:i.jsx("div",{className:"space-y-4",style:{width:`${y*100}%`},children:d.map(O=>i.jsxs("div",{className:"space-y-1",children:[!u&&i.jsxs("div",{className:"flex items-center gap-2 pl-[5.5rem]",children:[i.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:x.traces.task(O.taskIndex+1)}),i.jsx("span",{className:"font-mono text-[11px] text-gray-400",children:ln(O.total)})]}),i.jsx(Y_,{label:x.traces.laneLLM,children:O.segs.map((T,X)=>{const ae=K_(T.kind),oe=h===null||h===ae,ge=`s-${O.taskIndex}-${X}`,Te=Y(ge);return i.jsx("span",{onMouseEnter:()=>ee(ge,T.ts),onMouseLeave:Z,onClick:()=>o?.(T.ts),title:`${G_(T.kind)}${T.name?` ${T.name}`:""} · ${ln(T.endMs-T.startMs)}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${V_(T.kind)} ${ne(Te,oe)}`,style:U(T.startMs,T.endMs,O.t0,O.total)},X)})}),O.spans.map(T=>{const X=T.approvalMs??T.callMs,ae=T.outputMs===null,oe=T.outputMs??O.t0+O.total,ge=T.approvalTsRaw??T.callTs,Te=T.outputTsRaw??T.callTs;return i.jsxs("div",{className:"flex items-center",children:[i.jsx("span",{className:`${dp} text-gray-500 dark:text-gray-400`,title:T.name,children:i.jsx("span",{className:a2,children:T.name})}),i.jsxs(r2,{children:[T.approvalMs!==null&&T.approvalMs>T.callMs&&i.jsx("span",{onMouseEnter:()=>ee(`w-${T.toolCallId}`,ge),onMouseLeave:Z,onClick:()=>o?.(ge),title:`${T.name} · ${x.traces.legendApprovalWait}${T.decision?` (${T.decision})`:""} · ${ln(T.approvalMs-T.callMs)}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${Na.approvalWait} ${ne(Y(`w-${T.toolCallId}`),h===null||h==="approvalWait")}`,style:U(T.callMs,T.approvalMs,O.t0,O.total)}),T.approvalMs===null&&ae?(()=>{const se=ne(Y(`p-${T.toolCallId}`),h===null||h==="approvalWait");return i.jsx("span",{onMouseEnter:()=>ee(`p-${T.toolCallId}`,T.callTs),onMouseLeave:Z,onClick:()=>o?.(T.callTs),title:`${T.name} · ${x.traces.legendApprovalWait} · ${x.traces.inProgress}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${Na.approvalWait} ${se||"animate-pulse"}`,style:U(T.callMs,oe,O.t0,O.total)})})():(()=>{const se=ne(Y(`e-${T.toolCallId}`),h===null||h==="exec"),pe=ae&&!se;return i.jsx("span",{onMouseEnter:()=>ee(`e-${T.toolCallId}`,Te),onMouseLeave:Z,onClick:()=>o?.(Te),title:`${T.name} · ${x.traces.legendToolExec} · ${ae?x.traces.inProgress:ln(oe-X)}${T.failed?` · ${T.status}`:""}`,className:`absolute inset-y-0 min-w-[2px] cursor-pointer ${Na.exec} ${T.failed?"ring-1 ring-red-500":""} ${pe?"animate-pulse opacity-70":se}`,style:U(X,oe,O.t0,O.total)})})()]})]},T.toolCallId)}),i.jsx(Q_,{total:O.total})]},O.taskIndex))})}),i.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:z.map(O=>i.jsxs("button",{type:"button",onMouseEnter:()=>g(O.key),onMouseLeave:()=>g(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!==O.key?"opacity-30":""}`,children:[i.jsx("span",{className:`inline-block h-2 w-3 rounded-sm ${O.className}`}),O.label]},O.key))}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:x.traces.zoom}),i.jsx("button",{type:"button","aria-label":x.traces.zoomOut,title:x.traces.zoomOut,onClick:()=>R(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:i.jsx("span",{className:"text-[11px] leading-none",children:"−"})}),i.jsx("div",{ref:j,onDoubleClick:M,title:x.traces.zoomReset,className:"relative h-3 min-w-0 flex-1 rounded bg-gray-100 dark:bg-gray-800",children:i.jsxs("div",{role:"scrollbar","aria-label":x.traces.zoom,onPointerDown:G,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:[i.jsx("span",{onPointerDown:me("left"),className:"h-full w-1.5 shrink-0 cursor-ew-resize rounded-l bg-gray-500/80 dark:bg-gray-400/80"}),i.jsx("span",{onPointerDown:me("right"),className:"h-full w-1.5 shrink-0 cursor-ew-resize rounded-r bg-gray-500/80 dark:bg-gray-400/80"})]})}),i.jsx("button",{type:"button","aria-label":x.traces.zoomIn,title:x.traces.zoomIn,onClick:()=>R(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:i.jsx("span",{className:"text-[11px] leading-none",children:"+"})}),i.jsxs("span",{className:"w-9 shrink-0 text-right font-mono text-[11px] tabular-nums text-gray-400",children:[y.toFixed(2),"×"]})]}),l&&i.jsx("p",{className:"text-[11px] text-gray-400 dark:text-gray-600",children:x.traces.linkHint})]})}function Z_(e){return e==="session_meta"?"brand":e==="model_msg"?"gray":"amber"}const J_={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"},e7="M12 8v5m0 3h.01M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18z";function t7({type:e}){return i.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:i.jsx("path",{d:J_[e]??e7})})}function n7(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,l=n.session;return`request.total=${r?.total??0} session.total=${l?.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"subagent":return String(n.session_id??"");default:return e.type==="session_meta"?`${String(n.session_id??"")} · ${String(n.model_id??"")}`:""}}function a7(e){const n=e.payload;return n.stop_reason??n.status}const Vc="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 r7({p:e}){const n=e.request??{},r=e.session??{},l=(o,u)=>i.jsxs("tr",{children:[i.jsx("td",{className:"pr-3 text-gray-400",children:o}),i.jsx("td",{className:"pr-3 text-right font-mono",children:ut(u.cache_read??0)}),i.jsx("td",{className:"pr-3 text-right font-mono",children:ut(u.cache_write??0)}),i.jsx("td",{className:"pr-3 text-right font-mono",children:ut(u.output??0)}),i.jsx("td",{className:"text-right font-mono",children:ut(u.total??0)})]});return i.jsxs("table",{className:"text-xs",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"text-gray-400",children:[i.jsx("th",{}),i.jsx("th",{className:"pr-3 text-right font-normal",children:"cacheRead"}),i.jsx("th",{className:"pr-3 text-right font-normal",children:"cacheWrite"}),i.jsx("th",{className:"pr-3 text-right font-normal",children:"output"}),i.jsx("th",{className:"text-right font-normal",children:"total"})]})}),i.jsxs("tbody",{children:[l("request",n),l("session",r)]})]})}const cv="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 l7({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??""),l=Array.isArray(e.tools)?e.tools:[];return i.jsxs("div",{className:"space-y-2.5",children:[i.jsx("dl",{className:"grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5 text-xs",children:n.map(([o,u])=>i.jsxs(b.Fragment,{children:[i.jsx("dt",{className:"text-gray-400",children:o}),i.jsx("dd",{className:"min-w-0 break-all font-mono text-gray-700 dark:text-gray-300",children:u||"—"})]},o))}),r.trim()&&i.jsxs("details",{children:[i.jsx("summary",{className:cv,children:x.traces.systemPrompt}),i.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:i.jsx(Eu,{remarkPlugins:[Au],children:r})})]}),l.length>0&&i.jsxs("details",{children:[i.jsx("summary",{className:cv,children:x.traces.toolDefs(l.length)}),i.jsx("ul",{className:"mt-1.5 space-y-1",children:l.map((o,u)=>i.jsxs("li",{className:"text-xs",children:[i.jsx("span",{className:"font-mono font-semibold text-gray-700 dark:text-gray-300",children:o.name??"—"}),o.description&&i.jsx("span",{className:"ml-2 text-gray-500 dark:text-gray-400",children:o.description})]},u))})]})]})}function s7({msg:e}){const n=e.payload;if(e.type==="session_meta")return i.jsx(l7,{p:n});switch(n.type){case"text":case"thinking":{const r=String(n.text??n.thinking??"");return r.trim()?i.jsx("div",{className:"md-body text-sm leading-relaxed text-gray-700 dark:text-gray-300",children:i.jsx(Eu,{remarkPlugins:[Au],children:r})}):i.jsx("p",{className:"text-xs text-gray-400",children:"—"})}case"image_url":return i.jsx(Al,{src:String(n.image_url??""),alt:"trace",className:"max-h-48 max-w-full rounded-md"});case"inline_data":return i.jsx(Al,{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 i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("p",{className:"font-mono text-xs font-semibold text-gray-700 dark:text-gray-300",children:String(n.name??"")}),i.jsx("pre",{className:Vc,children:String(n.arguments??"")})]});case"tool_call_output":{const r=Array.isArray(n.images)?n.images:[];return r.length===0?i.jsx("pre",{className:Vc,children:String(n.output??"")}):i.jsxs("div",{className:"space-y-1.5",children:[i.jsx("pre",{className:Vc,children:String(n.output??"")}),i.jsx("div",{className:"flex flex-wrap gap-2",children:r.map((l,o)=>i.jsx(Al,{src:l,alt:"trace",className:"max-h-48 max-w-full rounded-md"},o))})]})}case"token_usage":return i.jsx(r7,{p:n});default:return i.jsx("pre",{className:Vc,children:JSON.stringify(n,null,2)})}}function i7({msg:e,rowKey:n,matched:r,onHighlight:l}){const[o,u]=b.useState(!1),d=e.payload.type??e.type,f=a7(e);return i.jsxs("li",{"data-trace-row":n,children:[i.jsxs("button",{type:"button",onClick:()=>u(m=>!m),onMouseEnter:()=>l?.({ts:e.timestamp,rowKey:n}),onMouseLeave:()=>l?.(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:[i.jsx("span",{className:"shrink-0 font-mono text-[11px] text-gray-400",children:O4(e.timestamp)}),i.jsx(t7,{type:d}),i.jsx(Lt,{tone:Z_(e.type),children:d}),e.origin&&e.origin.length>0&&i.jsx(Lt,{tone:"brand",children:"origin"}),i.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-xs text-gray-500 dark:text-gray-400",children:n7(e)})]}),o&&i.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:[i.jsx(s7,{msg:e}),f&&i.jsx("div",{className:"mt-1.5 flex justify-end",children:i.jsx(Lt,{tone:Om(f),children:f})})]})]})}const uv=()=>({cacheRead:0,cacheWrite:0,output:0}),o7=2500,dv=(e,n)=>`${e}-${n}`;function xr({label:e,value:n}){return i.jsxs("div",{className:"flex items-baseline justify-between gap-3 py-0.5",children:[i.jsx("span",{className:"shrink-0 text-[11px] text-gray-400",children:e}),i.jsx("span",{className:"truncate font-mono text-sm font-semibold tabular-nums",children:n})]})}const l2=e=>e.cacheRead+e.cacheWrite,s2=e=>fb(e.cacheRead,e.cacheWrite),i2="flex shrink-0 items-center font-mono text-[11px] tabular-nums text-gray-500 dark:text-gray-400";function Ui({icon:e,value:n,label:r}){return i.jsxs("span",{title:r,"aria-label":r,className:`${i2} gap-1`,children:[i.jsx(Ve,{d:e,className:"text-gray-400"}),n]})}function c7({buckets:e}){const n=l2(e),r=`${x.traces.cacheHit} ${ut(e.cacheRead)} · ${x.traces.hitRate} ${Eh(s2(e))}`;return i.jsxs("span",{"aria-label":`${x.traces.taskInput} ${ut(n)} · ${r}`,className:i2,children:[i.jsxs("span",{title:x.traces.taskInput,className:"flex items-center gap-1",children:[i.jsx(Ve,{d:Jt.input,className:"text-gray-400"}),ut(n)]}),i.jsxs("span",{title:r,className:"ml-1 flex items-center gap-0.5 text-gray-400",children:[i.jsx("span",{children:"("}),i.jsx(Ve,{d:Jt.cacheHit}),i.jsx("span",{children:ut(e.cacheRead)}),i.jsx("span",{children:")"})]})]})}function u7({projectId:e,agentId:n,sessionId:r,index:l,highlight:o,onHighlight:u}){const{currency:d}=Ll(),[f,m]=b.useState(null),[h,g]=b.useState([]),[y,k]=b.useState(0),[w,N]=b.useState(0),[C,j]=b.useState(null),[E,L]=b.useState(null),[_,q]=b.useState(new Set),[H,I]=b.useState(null),P=b.useRef(null),ee=b.useRef(null);b.useEffect(()=>()=>{ee.current&&clearTimeout(ee.current)},[]),b.useEffect(()=>{m(null),g([]),L(null),q(new Set),I(null);let R=!1;return Promise.all([gj(e,n,r,l),pj(e,n,r,l,0,1e3),pu(e).catch(()=>null)]).then(([O,T,X])=>{R||(m(O),g(T.events),k(T.offset),N(T.total),j(X))}).catch(O=>{R||L(ze(O))}),()=>{R=!0}},[e,n,r,l]);const Z=b.useMemo(()=>{const R=h.find(T=>T.type==="session_meta"),O=R?R.payload:void 0;if(!(!O?.model_id||!O.provider))return C?.models.find(T=>T.modelId===O.model_id&&T.provider===O.provider)?.pricing},[h,C]),D=R=>Z?(R.cacheRead*Z.cacheRead+R.cacheWrite*Z.cacheWrite+R.output*Z.output)/1e6:null,V=b.useMemo(()=>{const R=h.find(O=>O.type==="session_meta");return Lk(R?R.payload.model_context_window:void 0)},[h]),{tasks:B,global:Y,statsByTask:ne,globalLlmMs:U}=b.useMemo(()=>{const R={buckets:uv(),toolCalls:0},O=new Map;if(!f)return{tasks:[],global:R,statsByTask:O,globalLlmMs:0};const T=new Map;for(const pe of f.tasks){const be=Date.parse(pe.startTs),Pe=Date.parse(pe.endTs);Number.isFinite(be)&&Number.isFinite(Pe)&&T.set(pe.taskIndex,{min:be,max:Pe})}const X=new Map,ae=pe=>{let be=X.get(pe);if(!be){const Pe=T.get(pe);be={taskIndex:pe,segments:[],spans:[],messages:[],toolCalls:0,durationMs:Pe?Math.max(0,Pe.max-Pe.min):0},X.set(pe,be)}return be};for(const pe of f.tasks)ae(pe.taskIndex);for(const pe of f.modelSegments)ae(pe.taskIndex).segments.push(pe);for(const pe of f.toolSpans){const be=ae(pe.taskIndex);be.spans.push(pe),be.toolCalls+=1}const oe=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 Pe=oe(y+pe);Pe!==null&&ae(Pe).messages.push(be)}R.toolCalls=f.toolSpans.length;const ge=new Map(f.tasks.map(pe=>[pe.taskIndex,pe]));for(const pe of f.tasks)R.buckets.cacheRead+=pe.tokens.cacheRead,R.buckets.cacheWrite+=pe.tokens.cacheWrite,R.buckets.output+=pe.tokens.output;const Te=f.tasks.reduce((pe,be)=>pe+be.llmMs,0);return{tasks:[...X.values()].sort((pe,be)=>pe.taskIndex-be.taskIndex),global:R,statsByTask:ge,globalLlmMs:Te}},[f,h,y]);if(E)return i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:E});if(!f)return i.jsx(Ut,{className:"h-40"});const z=f.elapsedMs,$=R=>q(O=>{const T=new Set(O);return T.has(R)?T.delete(R):T.add(R),T}),G=R=>{for(const O of B){const T=O.messages.findIndex(X=>X.timestamp===R);if(T>=0)return dv(O.taskIndex,T)}return null},me=o?.rowKey??(o?.ts!==void 0?G(o.ts):null),M=R=>{const O=G(R);O!==null&&(I(O),requestAnimationFrame(()=>{P.current?.querySelector(`[data-trace-row="${O}"]`)?.scrollIntoView({block:"center",behavior:"smooth"})}),ee.current&&clearTimeout(ee.current),ee.current=setTimeout(()=>I(null),o7))};return i.jsxs("div",{ref:P,className:"space-y-4",children:[i.jsxs("div",{className:"rounded-md border border-gray-200 p-3 dark:border-gray-800",children:[i.jsx("p",{className:"mb-2 text-xs font-semibold text-gray-500",children:x.traces.globalSummary}),i.jsxs("div",{className:"grid grid-cols-1 gap-x-8 gap-y-4 sm:grid-cols-3",children:[i.jsxs("div",{children:[i.jsx(xr,{label:x.traces.tasksLabel,value:String(f.tasks.length)}),i.jsx(xr,{label:x.traces.toolCalls,value:String(Y.toolCalls)}),i.jsx(xr,{label:x.traces.compactions,value:String(f.compactionCount)})]}),i.jsxs("div",{children:[i.jsx(xr,{label:x.chat.statInput,value:ut(l2(Y.buckets))}),i.jsx(xr,{label:x.traces.cacheHit,value:`${ut(Y.buckets.cacheRead)} · ${Eh(s2(Y.buckets))}`}),i.jsx(xr,{label:x.chat.statOutput,value:ut(Y.buckets.output)})]}),i.jsxs("div",{children:[i.jsx(xr,{label:x.common.cost,value:ya(D(Y.buckets),d)}),i.jsx(xr,{label:x.chat.statElapsed,value:ln(Math.max(0,z))}),i.jsx(xr,{label:x.chat.statTps,value:tu(zm(Y.buckets.output,U))})]})]})]}),B.map(R=>{const O=!_.has(R.taskIndex),T=ne.get(R.taskIndex),X=T?.context,ae=T?.tokens??uv();return i.jsxs("div",{className:"overflow-hidden rounded-md border border-gray-200 dark:border-gray-800",children:[i.jsxs("button",{type:"button",onClick:()=>$(R.taskIndex),"aria-expanded":O,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:[i.jsx(gn,{open:O,size:13,className:"text-gray-400"}),i.jsx("span",{className:"shrink-0 text-sm font-semibold",children:x.traces.task(R.taskIndex+1)}),T?.compaction===!0&&i.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:x.traces.compactionRound}),i.jsx("span",{className:"min-w-0 flex-1"}),i.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-x-3 gap-y-1",children:[i.jsx(Ui,{icon:Jt.toolCalls,value:String(R.toolCalls),label:x.traces.toolCalls}),i.jsx(c7,{buckets:ae}),i.jsx(Ui,{icon:Jt.output,value:ut(ae.output),label:x.traces.taskOutput}),i.jsx(Ui,{icon:Jt.cost,value:ya(D(ae),d),label:`${x.common.cost}(${d})`}),i.jsx(Ui,{icon:Jt.elapsed,value:ln(R.durationMs),label:x.chat.statElapsed}),i.jsx(Ui,{icon:Jt.tps,value:tu(zm(ae.output,T?.llmMs??0)),label:x.chat.statTps})]}),X&&i.jsx(q_,{cacheRead:X.cacheRead,cacheWrite:X.cacheWrite,output:X.output,max:V,size:22})]}),O&&i.jsxs("div",{className:"space-y-3 p-3",children:[(R.segments.length>0||R.spans.length>0)&&i.jsxs("div",{className:"rounded-md border border-gray-100 p-2 dark:border-gray-800/60",children:[i.jsx("p",{className:"mb-1.5 text-[11px] font-medium text-gray-500",children:x.traces.timeline}),i.jsx(X_,{segments:R.segments,toolSpans:R.spans,highlight:o,onHighlight:u,onJump:M,hideTaskLabel:!0})]}),i.jsxs("div",{children:[i.jsxs("p",{className:"mb-1.5 text-[11px] font-medium text-gray-500",children:[x.traces.messages,"(",R.messages.length,")"]}),R.messages.length===0?i.jsx("p",{className:"text-xs text-gray-400",children:x.common.none}):i.jsx("ul",{className:"divide-y divide-gray-100 rounded-md border border-gray-200 dark:divide-gray-800/60 dark:border-gray-800",children:R.messages.map((oe,ge)=>{const Te=dv(R.taskIndex,ge);return i.jsx(i7,{msg:oe,rowKey:Te,matched:Te===me||Te===H,onHighlight:se=>u(se)},ge)})})]})]})]},R.taskIndex)}),h.length<w&&i.jsx("p",{className:"text-xs text-gray-400",children:x.traces.truncatedNote(h.length,w)})]})}function d7(e){const n=new Map;for(const r of e.dates)for(const l of r.sessions){const o=n.get(l.sessionId)??[];for(const u of l.files)o.push({index:u.index,date:r.date,sizeBytes:u.sizeBytes});n.set(l.sessionId,o)}return[...n.entries()].sort((r,l)=>l[0].localeCompare(r[0])).map(([r,l])=>({sessionId:r,files:l.sort((o,u)=>u.index-o.index)}))}function f7({projectId:e,agentId:n,name:r,defaultOpen:l,focusSessionId:o,titleOf:u,selection:d,onSelect:f}){const[m,h]=b.useState(l),[g,y]=b.useState(null),[k,w]=b.useState(null);b.useEffect(()=>{!m||g||cj(e,n).then(C=>y(d7(C))).catch(C=>w(ze(C)))},[m,g,e,n]);const N=b.useRef(!1);return b.useEffect(()=>{if(N.current||!o||!g)return;N.current=!0;const C=g.find(j=>j.sessionId===o);C&&f({agentId:n,sessionId:C.sessionId,files:C.files})},[g,o,n,f]),i.jsxs("li",{className:"pt-2.5",children:[i.jsx("div",{className:"flex items-center px-1 pb-0.5",children:i.jsxs("button",{type:"button",onClick:()=>h(C=>!C),"aria-label":m?x.nav.collapseGroup:x.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:[i.jsx(tl,{id:n,name:r,size:18,className:"shrink-0 rounded"}),i.jsx("span",{className:"min-w-0 truncate text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:r}),i.jsx(gn,{open:m,size:12,className:"text-gray-400"}),i.jsx("span",{className:"min-w-0 flex-1"})]})}),m&&i.jsxs("div",{className:"anim-fade",children:[k&&i.jsx("p",{className:"px-2.5 py-1 text-xs text-red-500",children:k}),!g&&!k&&i.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400",children:x.common.loading}),g&&g.length===0&&i.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:x.traces.empty}),i.jsx("ul",{className:"space-y-0.5",children:g?.map(C=>{const j=d?.agentId===n&&d.sessionId===C.sessionId,E=u(n,C.sessionId);return i.jsx("li",{children:i.jsxs("button",{type:"button",onClick:()=>f({agentId:n,sessionId:C.sessionId,files:C.files}),className:`flex w-full items-center gap-1.5 rounded-md px-2.5 py-1.5 text-left transition-colors duration-150 ${j?"bg-gray-200/70 dark:bg-gray-800":"hover:bg-gray-200/50 dark:hover:bg-gray-800/70"}`,children:[i.jsx(bu,{text:E??C.sessionId,className:`min-w-0 flex-1 ${E?"text-sm":"font-mono text-xs"} ${j?"font-medium text-gray-900 dark:text-gray-100":"text-gray-700 dark:text-gray-300"}`}),i.jsx("span",{className:"shrink-0 font-mono text-[11px] text-gray-400",children:C.files.length})]})},C.sessionId)})})]})]})}function m7(){Ka(x.traces.title);const{currentProject:e,agents:n,agentsLoading:r}=fn(),{byAgent:l}=ao(),o=e?.projectId??null,[u]=wh(),d=u.get("agentId"),f=u.get("sessionId"),[m,h]=b.useState(null),[g,y]=b.useState(null),[k,w]=b.useState(null);b.useEffect(()=>{h(null),y(null)},[o]),b.useEffect(()=>{w(null)},[m,g]);const N=(j,E)=>l.get(j)?.find(L=>L.sessionId===E)?.title;if(!o)return null;const C=m===null?null:m.files.find(j=>j.index===g)??m.files[0]??null;return i.jsxs("div",{className:"flex h-full flex-col md:flex-row",children:[i.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:[i.jsx("p",{className:"px-3 pb-1 text-xs font-bold uppercase tracking-wide text-gray-500",children:x.traces.title}),r?i.jsx(qa,{rows:4}):i.jsx("ul",{children:n.map(j=>i.jsx(f7,{projectId:o,agentId:j.agentId,name:hn(j),defaultOpen:d===null||d===j.agentId,...f!==null&&d===j.agentId?{focusSessionId:f}:{},titleOf:N,selection:m,onSelect:E=>{h(E),y(E.files[0]?.index??null)}},j.agentId))})]}),i.jsx("section",{className:"min-w-0 flex-1 overflow-y-auto p-3 md:p-4",children:m&&C?i.jsxs("div",{className:"mx-auto max-w-4xl space-y-4",children:[i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsx("p",{className:"min-w-0 flex-1 truncate text-sm font-semibold",children:N(m.agentId,m.sessionId)??i.jsx("span",{className:"font-mono text-xs font-normal text-gray-500",children:m.sessionId})}),i.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[i.jsx("span",{className:"mr-1 text-xs text-gray-400",children:x.traces.filesTitle}),m.files.map(j=>i.jsxs("button",{type:"button",onClick:()=>y(j.index),title:`${j.date} · ${Dm(j.sizeBytes)}`,className:`rounded-md border px-2 py-0.5 font-mono text-xs transition-colors duration-150 ${j.index===C.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(j.index).padStart(3,"0")]},j.index))]})]}),i.jsxs("p",{className:"truncate font-mono text-xs text-gray-400",children:[m.sessionId," · ",C.date," · ",Dm(C.sizeBytes)]}),i.jsx(u7,{projectId:o,agentId:m.agentId,sessionId:m.sessionId,index:C.index,highlight:k,onHighlight:w})]}):i.jsx(nl,{title:x.traces.selectSession})})]})}function o2(e,n){return e.map(r=>{const l=n==="score"?r.score:n==="cost"?r.cost:r.durationMs;return typeof l=="number"&&Number.isFinite(l)?l:null})}function h7(e){const n=[];let r=[];return e.forEach((l,o)=>{if(l===null){r.length>0&&n.push(r),r=[];return}r.push({index:o,value:l})}),r.length>0&&n.push(r),n}function p7(e){return Math.max(1e-9,...e.filter(n=>n!==null))}function g7(e){const n=new Map;e.forEach((l,o)=>{const u=l.modelId!==void 0&&l.modelId!=="",d=u?`${l.provider??""}\0${l.modelId}`:"";let f=n.get(d);f||(f={key:d,...u&&l.provider!==void 0?{provider:l.provider}:{},...u&&l.modelId!==void 0?{modelId:l.modelId}:{},indices:[]},n.set(d,f)),f.indices.push(o)});const r=[...n.values()];return[...r.filter(l=>l.key!==""),...r.filter(l=>l.key==="")]}function x7(e,n,r){const l=new Set(n.indices);return o2(e,r).map((o,u)=>l.has(u)?o:null)}function y7({projectId:e,agentId:n,name:r,defaultOpen:l,selection:o,onSelect:u}){const[d,f]=b.useState(l),[m,h]=b.useState(null),[g,y]=b.useState(null);return b.useEffect(()=>{!d||m||Nj(e,n).then(k=>h(k.benchmarks)).catch(k=>y(ze(k)))},[d,m,e,n]),i.jsxs("li",{className:"pt-2.5",children:[i.jsx("div",{className:"flex items-center px-1 pb-0.5",children:i.jsxs("button",{type:"button",onClick:()=>f(k=>!k),"aria-label":d?x.nav.collapseGroup:x.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:[i.jsx(tl,{id:n,name:r,size:18,className:"shrink-0 rounded"}),i.jsx("span",{className:"min-w-0 truncate text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",children:r}),i.jsx(gn,{open:d,size:12,className:"text-gray-400"}),i.jsx("span",{className:"min-w-0 flex-1"})]})}),d&&i.jsxs("div",{className:"anim-fade",children:[g&&i.jsx("p",{className:"px-2.5 py-1 text-xs text-red-500",children:g}),!m&&!g&&i.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400",children:x.common.loading}),m&&m.length===0&&i.jsx("p",{className:"px-2.5 py-1 text-xs text-gray-400 dark:text-gray-600",children:x.benchmark.emptyAgent}),i.jsx("ul",{className:"space-y-0.5",children:m?.map(k=>{const w=o?.agentId===n&&o.benchmark.id===k.id;return i.jsx("li",{children:i.jsxs("button",{type:"button",onClick:()=>u({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:[i.jsx(bu,{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"}`}),i.jsx("span",{className:"shrink-0 font-mono text-[11px] text-gray-400",children:k.caseCount})]})},k.id)})})]})]})}function Gc(e){return e==="score"?x.benchmark.colScore:e==="cost"?x.common.cost:x.benchmark.colDuration}function fv(e,n){return e==="score"?nu(n):e==="cost"?ya(n):ln(n)}function v7({evaluations:e,series:n,metric:r}){const[l,o]=b.useState(null),[u,d]=cp(),f=o2(e,r),m=op(e.length,p7(f),d),h=e.map(y=>Kn(y.time)),g=m.y(0);return i.jsx("div",{ref:u,children:d>0&&i.jsx(up,{geom:m,fmtY:y=>fv(r,y),dates:h,hover:l,onHover:o,bubble:y=>{const k=e[y],w=f[y]??null;return i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-gray-400",children:Kn(k.time)}),i.jsxs("p",{className:"font-mono",children:[w===null?"—":fv(r,w),k.version!==void 0&&i.jsxs("span",{className:"ml-1.5 text-gray-400",children:["v",k.version]})]}),k.modelId&&i.jsx("p",{className:"font-mono text-gray-400",children:k.modelId})]})},children:n.map((y,k)=>{const w=h7(x7(e,y,r));return i.jsx("g",{className:y.modelId?t2(k).text:"text-gray-400 dark:text-gray-500",children:w.map((N,C)=>{const j=N.map((L,_)=>`${_===0?"M":"L"}${m.x(L.index)},${m.y(L.value)}`).join(" "),E=`${j} L${m.x(N[N.length-1].index)},${g} L${m.x(N[0].index)},${g} Z`;return i.jsxs("g",{children:[N.length>1&&i.jsx("path",{d:E,className:"fill-current",stroke:"none",opacity:l!==null?.06:.1}),N.length>1&&i.jsx("path",{d:j,fill:"none",stroke:"currentColor",strokeWidth:2,opacity:l!==null?.35:1}),N.map(L=>i.jsx("circle",{cx:m.x(L.index),cy:m.y(L.value),r:l===L.index?4:2.5,className:"fill-current",opacity:l!==null&&l!==L.index?.25:1},L.index))]},C)})},y.key===""?"unlabeled":y.key)})})})}function b7({evaluations:e}){const[n,r]=b.useState("score"),l=g7(e),o=l.map(f=>f.modelId).filter(f=>f!==void 0),u=new Set(o.filter((f,m)=>o.indexOf(f)!==m)),d=f=>{if(!f.modelId)return x.benchmark.legendUnlabeled;if(!u.has(f.modelId))return f.modelId;const m=f.provider?pa(f.provider)?.label??f.provider:"";return m?`${f.modelId} · ${m}`:f.modelId};return i.jsxs("div",{children:[i.jsxs("div",{className:"mb-1 flex items-center justify-between gap-2",children:[i.jsx("p",{className:"text-xs font-semibold text-gray-500",children:x.benchmark.trendTitle(Gc(n))}),i.jsx("div",{className:"w-44 shrink-0",children:i.jsx(Tl,{options:[{value:"score",label:Gc("score")},{value:"cost",label:Gc("cost")},{value:"duration",label:Gc("duration")}],value:n,onChange:r})})]}),l.length>=2&&i.jsx("div",{className:"mb-1.5 flex flex-wrap items-center gap-x-3 gap-y-1",children:l.map((f,m)=>i.jsxs("span",{className:"flex items-center gap-1.5 text-[11px] text-gray-500 dark:text-gray-400",title:f.provider?pa(f.provider)?.label??f.provider:void 0,children:[i.jsx("span",{className:`inline-block h-2 w-2 shrink-0 rounded-sm ${f.modelId?t2(m).swatch:"bg-gray-400 dark:bg-gray-500"}`}),i.jsx("span",{className:"font-mono",children:d(f)})]},f.key===""?"unlabeled":f.key))}),i.jsx(v7,{evaluations:e,series:l,metric:n})]})}const ys="px-3 py-2";function k7({agentId:e,evaluation:n}){const[r,l]=b.useState(!1);return i.jsxs(i.Fragment,{children:[i.jsxs("tr",{onClick:()=>l(o=>!o),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:[i.jsx("td",{className:ys,children:i.jsxs("span",{className:"flex items-center gap-1.5 text-xs",children:[i.jsx(gn,{open:r,size:12,className:"text-gray-400"}),Kn(n.time)]})}),i.jsx("td",{className:`${ys} font-mono text-xs text-gray-500 dark:text-gray-400`,children:n.version!==void 0?`v${n.version}`:"—"}),i.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??"—"}),i.jsx("td",{className:`${ys} font-mono text-xs font-semibold tabular-nums`,children:nu(n.score)}),i.jsx("td",{className:`${ys} font-mono text-xs tabular-nums text-gray-500 dark:text-gray-400`,children:ya(n.cost)}),i.jsx("td",{className:`${ys} font-mono text-xs tabular-nums text-gray-500 dark:text-gray-400`,children:n.durationMs!==void 0?ln(n.durationMs):"—"})]}),r&&i.jsx("tr",{className:"border-b border-gray-100 last:border-b-0 dark:border-gray-800/60",children:i.jsxs("td",{colSpan:6,className:"bg-gray-50/80 px-3 py-2 dark:bg-gray-950/40",children:[(n.summaryTitle||n.summary)&&i.jsxs("div",{className:"mb-2",children:[n.summaryTitle?i.jsx("p",{className:"text-xs font-semibold text-gray-700 dark:text-gray-200",children:n.summaryTitle}):i.jsx("p",{className:"text-xs font-semibold text-gray-500",children:x.benchmark.summaryLabel}),n.summary&&i.jsx("p",{className:"mt-0.5 whitespace-pre-wrap text-xs text-gray-600 dark:text-gray-300",children:n.summary})]}),i.jsxs("table",{className:"w-full text-left",children:[i.jsx("thead",{children:i.jsxs("tr",{className:"text-xs text-gray-500",children:[i.jsx("th",{className:"px-2 py-1 font-medium",children:x.benchmark.colCase}),i.jsx("th",{className:"px-2 py-1 font-medium",children:x.benchmark.colScore}),i.jsx("th",{className:"px-2 py-1 font-medium",children:x.common.cost}),i.jsx("th",{className:"px-2 py-1 font-medium",children:x.benchmark.colDuration}),i.jsx("th",{className:"px-2 py-1 font-medium",children:x.benchmark.colSession})]})}),i.jsx("tbody",{children:n.cases.map(o=>i.jsx(w7,{agentId:e,caseScore:o},o.case))})]})]})})]})}function mv({agentId:e,sessionId:n}){return n?i.jsx(bh,{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}):i.jsx("span",{className:"text-gray-400",children:"—"})}function w7({agentId:e,caseScore:n}){const[r,l]=b.useState(!1),o=n.runs??[],u=o.length>0;return i.jsxs(i.Fragment,{children:[i.jsxs("tr",{onClick:u?()=>l(d=>!d):void 0,className:`text-xs ${u?"cursor-pointer transition-colors duration-150 hover:bg-gray-100/70 dark:hover:bg-gray-800/40":""}`,children:[i.jsx("td",{className:"px-2 py-1 font-mono",children:i.jsxs("span",{className:"flex items-center gap-1.5",children:[u&&i.jsx(gn,{open:r,size:12,className:"text-gray-400"}),n.case]})}),i.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:nu(n.score)}),i.jsx("td",{className:"px-2 py-1 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:ya(n.cost)}),i.jsx("td",{className:"px-2 py-1 font-mono tabular-nums text-gray-500 dark:text-gray-400",children:n.durationMs!==void 0?ln(n.durationMs):"—"}),i.jsx("td",{className:"px-2 py-1",children:i.jsx(mv,{agentId:e,...n.sessionId?{sessionId:n.sessionId}:{}})})]}),r&&o.map((d,f)=>i.jsxs("tr",{className:"text-xs text-gray-500 dark:text-gray-400",children:[i.jsxs("td",{className:"py-1 pl-7 pr-2 font-mono",children:[x.benchmark.colRun," #",f+1]}),i.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:nu(d.score)}),i.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:ya(d.cost)}),i.jsx("td",{className:"px-2 py-1 font-mono tabular-nums",children:d.durationMs!==void 0?ln(d.durationMs):"—"}),i.jsx("td",{className:"px-2 py-1",children:i.jsx(mv,{agentId:e,...d.sessionId?{sessionId:d.sessionId}:{}})})]},f))]})}function S7(){Ka(x.benchmark.title);const{currentProject:e,agents:n,agentsLoading:r}=fn(),l=e?.projectId??null,[o]=wh(),u=o.get("agentId"),[d,f]=b.useState(null);if(b.useEffect(()=>{f(null)},[l]),!l)return null;const m=d?.benchmark??null,h=m?[...m.evaluations].sort((g,y)=>g.time.localeCompare(y.time)):[];return i.jsxs("div",{className:"flex h-full flex-col md:flex-row",children:[i.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:[i.jsx("p",{className:"px-3 pb-1 text-xs font-bold uppercase tracking-wide text-gray-500",children:x.benchmark.title}),r?i.jsx(qa,{rows:4}):i.jsx("ul",{children:n.map(g=>i.jsx(y7,{projectId:l,agentId:g.agentId,name:hn(g),defaultOpen:u===null||u===g.agentId,selection:d,onSelect:f},g.agentId))})]}),i.jsx("section",{className:"min-w-0 flex-1 overflow-y-auto p-3 md:p-4",children:d&&m?i.jsxs("div",{className:"mx-auto max-w-4xl space-y-4",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[i.jsx("h1",{className:"min-w-0 truncate text-lg font-semibold",children:m.title}),i.jsx("span",{className:"text-xs text-gray-500",children:x.benchmark.caseCount(m.caseCount)})]}),m.description&&i.jsx("p",{className:"mt-1 text-sm text-gray-500 dark:text-gray-400",children:m.description})]}),h.length===0?i.jsx(nl,{title:x.benchmark.noEvaluations}):i.jsxs(i.Fragment,{children:[i.jsx(b7,{evaluations:h}),i.jsxs("div",{children:[i.jsx("p",{className:"mb-1 text-xs font-semibold text-gray-500",children:x.benchmark.evaluations}),i.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:i.jsxs("table",{className:"w-full min-w-[600px] text-left text-sm",children:[i.jsx("thead",{children:i.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:[i.jsx("th",{className:"px-3 py-2.5",children:x.common.time}),i.jsx("th",{className:"px-3 py-2.5",children:x.benchmark.colVersion}),i.jsx("th",{className:"px-3 py-2.5",children:x.benchmark.colModel}),i.jsx("th",{className:"px-3 py-2.5",children:x.benchmark.colScore}),i.jsx("th",{className:"px-3 py-2.5",children:x.common.cost}),i.jsx("th",{className:"px-3 py-2.5",children:x.benchmark.colDuration})]})}),i.jsx("tbody",{children:[...h].reverse().map((g,y)=>i.jsx(k7,{agentId:d.agentId,evaluation:g},y))})]})})]})]})]},`${d.agentId}/${m.id}`):i.jsx(nl,{title:x.benchmark.selectBenchmark})})]})}function j7(){Ka(x.admin.users);const{user:e}=bn(),[n,r]=b.useState(null),[l,o]=b.useState(null),[u,d]=b.useState(!1),[f,m]=b.useState(null),[h,g]=b.useState(null),y=b.useCallback(async()=>{try{r((await WS()).users),o(null)}catch(k){o(ze(k))}},[]);return b.useEffect(()=>{e?.isAdmin&&y()},[e?.isAdmin,y]),e&&!e.isAdmin?i.jsx(Qi,{to:"/chat",replace:!0}):i.jsxs("div",{className:"h-full overflow-y-auto p-4 md:p-6",children:[i.jsxs("div",{className:"mx-auto max-w-3xl",children:[i.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[i.jsx("h1",{className:"text-xl font-semibold",children:x.admin.users}),i.jsx(ke,{variant:"primary",onClick:()=>d(!0),children:x.admin.createUser})]}),n===null?i.jsx("p",{className:"text-sm text-gray-400",children:x.common.loading}):i.jsx("div",{className:"overflow-x-auto rounded-lg border border-gray-200 dark:border-gray-800",children:i.jsxs("table",{className:"w-full text-sm",children:[i.jsx("thead",{children:i.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:[i.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-medium",children:x.common.username}),i.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-medium",children:x.common.role}),i.jsx("th",{className:"whitespace-nowrap px-3 py-2 font-medium",children:x.common.created}),i.jsx("th",{className:"whitespace-nowrap px-3 py-2 text-right font-medium",children:x.common.actions})]})}),i.jsx("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-800/60",children:n.map(k=>i.jsxs("tr",{children:[i.jsxs("td",{className:"whitespace-nowrap px-3 py-2 font-medium",children:[k.userId,k.passwordIsInitial&&i.jsx("span",{className:"ml-2 align-middle",children:i.jsx(Lt,{tone:"gray",children:x.admin.initialPasswordFlag})})]}),i.jsx("td",{className:"whitespace-nowrap px-3 py-2",children:i.jsx(Lt,{tone:"gray",children:k.isAdmin?x.admin.roleAdmin:x.admin.roleUser})}),i.jsx("td",{className:"whitespace-nowrap px-3 py-2 text-gray-500 dark:text-gray-400",children:Kn(k.createdAt)}),i.jsxs("td",{className:"whitespace-nowrap px-3 py-1.5 text-right",children:[i.jsx(ke,{size:"sm",variant:"ghost",onClick:()=>m(k),children:x.admin.resetPassword}),!k.isAdmin&&i.jsx(ke,{size:"sm",variant:"ghost",onClick:()=>g(k),children:x.common.delete})]})]},k.userId))})]})}),l&&i.jsx("p",{className:"mt-2 text-xs text-red-600 dark:text-red-400",children:l})]}),i.jsx(C7,{open:u,onClose:()=>d(!1),onDone:()=>{d(!1),y()}}),i.jsx(N7,{user:f,onClose:()=>m(null)}),i.jsx(T7,{user:h,onClose:()=>g(null),onDone:()=>{g(null),y()}})]})}function C7({open:e,onClose:n,onDone:r}){const[l,o]=b.useState(""),[u,d]=b.useState(""),[f,m]=b.useState({}),[h,g]=b.useState(!1),y=()=>m(w=>w.userId||w.password?{}:w);b.useEffect(()=>{e&&(o(""),d(""),m({}))},[e]);const k=async()=>{const w=l.trim(),N={};if(w?B1.test(w)||(N.userId=x.auth.usernameHint):N.userId=x.common.requiredField,u||(N.password=x.common.requiredField),N.userId||N.password){m(N);return}g(!0),m({});try{await YS({userId:w,password:u}),r()}catch(C){C instanceof Ra&&C.code==="invalid_password"?m({password:ze(C)}):m({userId:ze(C)})}finally{g(!1)}};return i.jsx(dn,{open:e,title:x.admin.createUser,onClose:n,footer:i.jsxs(i.Fragment,{children:[i.jsx(ke,{onClick:n,disabled:h,children:x.common.cancel}),i.jsx(ke,{variant:"primary",disabled:h,onClick:()=>{k()},children:x.common.create})]}),children:i.jsxs("div",{className:"space-y-3",children:[i.jsx(Xe,{label:x.common.username,required:!0,size:"sm",value:l,onChange:w=>{o(w.target.value),y()},error:f.userId,hint:x.auth.usernameHint,autoFocus:!0}),i.jsx(el,{label:x.admin.initialPassword,required:!0,size:"sm",value:u,onChange:w=>{d(w.target.value),y()},error:f.password,autoComplete:"new-password",hint:x.auth.passwordHint}),B1.test(l.trim())&&i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:x.admin.defaultProjectNote(`${l.trim()}-default_project`)})]})})}function N7({user:e,onClose:n}){const[r,l]=b.useState(""),[o,u]=b.useState(void 0),[d,f]=b.useState(!1);b.useEffect(()=>{e&&(l(""),u(void 0))},[e]);const m=async()=>{if(e){if(!r){u(x.common.requiredField);return}f(!0),u(void 0);try{await QS(e.userId,{password:r}),n()}catch(h){u(ze(h))}finally{f(!1)}}};return i.jsx(dn,{open:e!==null,title:e?x.admin.resetPasswordTitle(e.userId):"",onClose:n,footer:i.jsxs(i.Fragment,{children:[i.jsx(ke,{onClick:n,disabled:d,children:x.common.cancel}),i.jsx(ke,{variant:"primary",disabled:d,onClick:()=>{m()},children:x.common.save})]}),children:i.jsxs("div",{className:"space-y-3",children:[i.jsx(el,{label:x.admin.initialPassword,required:!0,size:"sm",value:r,onChange:h=>{l(h.target.value),u(void 0)},error:o,autoComplete:"new-password",hint:x.auth.passwordHint,autoFocus:!0}),i.jsx("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:x.admin.resetPasswordNote})]})})}function T7({user:e,onClose:n,onDone:r}){const[l,o]=b.useState(!1),[u,d]=b.useState(null),[f,m]=b.useState(!1);b.useEffect(()=>{e&&(o(!1),d(null))},[e]);const h=async()=>{if(e){m(!0),d(null);try{await XS(e.userId),r()}catch(g){d(ze(g))}finally{m(!1)}}};return i.jsx(dn,{open:e!==null,title:e?x.admin.deleteUserTitle(e.userId):"",onClose:n,footer:i.jsxs(i.Fragment,{children:[i.jsx(ke,{onClick:n,disabled:f,children:x.common.cancel}),l?i.jsx(ke,{variant:"danger",disabled:f,onClick:()=>{h()},children:x.common.confirm}):i.jsx(ke,{variant:"danger",onClick:()=>o(!0),children:x.common.delete})]}),children:i.jsxs("div",{className:"space-y-2",children:[i.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:e?x.admin.deleteUserConfirm(e.userId):""}),u&&i.jsx("p",{className:"text-xs text-red-600 dark:text-red-400",children:u})]})})}function M7(){const{user:e}=bn();return e===void 0?null:e===null?i.jsx(Qi,{to:"/login",replace:!0}):i.jsx(u4,{children:i.jsx(v4,{children:i.jsx(cR,{})})})}function E7(){const{user:e}=bn();return e?i.jsx(Qi,{to:"/chat",replace:!0}):i.jsx(yR,{})}function A7(){return i.jsx(t4,{children:i.jsxs(A5,{children:[i.jsx(Mn,{path:"/login",element:i.jsx(E7,{})}),i.jsxs(Mn,{element:i.jsx(M7,{}),children:[i.jsx(Mn,{index:!0,element:i.jsx(Qi,{to:"/chat",replace:!0})}),i.jsx(Mn,{path:"/chat/:sessionId?",element:i.jsx(V8,{})}),i.jsx(Mn,{path:"/agents",element:i.jsx(kR,{})}),i.jsx(Mn,{path:"/agents/:agentId",element:i.jsx(zR,{})}),i.jsx(Mn,{path:"/skills",element:i.jsx(VR,{})}),i.jsx(Mn,{path:"/models",element:i.jsx(o_,{})}),i.jsx(Mn,{path:"/usage",element:i.jsx(P_,{})}),i.jsx(Mn,{path:"/traces",element:i.jsx(m7,{})}),i.jsx(Mn,{path:"/benchmark",element:i.jsx(S7,{})}),i.jsx(Mn,{path:"/admin/users",element:i.jsx(j7,{})}),i.jsx(Mn,{path:"*",element:i.jsx(Qi,{to:"/chat",replace:!0})})]})]})})}function R7(){return i.jsx(LS,{children:i.jsx(HS,{children:i.jsx(Ej,{children:i.jsxs(IS,{children:[i.jsx(A7,{}),i.jsx(T4,{})]})})})})}const c2=document.getElementById("root");if(!c2)throw new Error("#root mount point not found");NS.createRoot(c2).render(i.jsx(b.StrictMode,{children:i.jsx(R7,{})}));export{Y6 as _,jC as a,BC as b,f1 as c,zC as f,$C as h,Dh as s,EC as w};
|