@taico/taico 0.2.15 → 0.2.16
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/executions/active/active-task-execution.controller.d.ts +1 -0
- package/dist/executions/active/active-task-execution.controller.js +32 -0
- package/dist/executions/active/active-task-execution.controller.js.map +1 -1
- package/dist/executions/active/active-task-execution.service.d.ts +5 -0
- package/dist/executions/active/active-task-execution.service.js +28 -0
- package/dist/executions/active/active-task-execution.service.js.map +1 -1
- package/dist/executions/errors/executions.errors.d.ts +3 -0
- package/dist/executions/errors/executions.errors.js +7 -1
- package/dist/executions/errors/executions.errors.js.map +1 -1
- package/dist/public/assets/index-Bqsni13H.css +1 -0
- package/dist/public/assets/index-CboWmVjp.js +73 -0
- package/dist/public/index.html +2 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/dist/public/assets/index-BDd_IOss.css +0 -1
- package/dist/public/assets/index-BwirgFmY.js +0 -73
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))o(c);new MutationObserver(c=>{for(const d of c)if(d.type==="childList")for(const f of d.addedNodes)f.tagName==="LINK"&&f.rel==="modulepreload"&&o(f)}).observe(document,{childList:!0,subtree:!0});function r(c){const d={};return c.integrity&&(d.integrity=c.integrity),c.referrerPolicy&&(d.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?d.credentials="include":c.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function o(c){if(c.ep)return;c.ep=!0;const d=r(c);fetch(c.href,d)}})();function tx(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var rd={exports:{}},zr={};var _m;function I_(){if(_m)return zr;_m=1;var s=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function r(o,c,d){var f=null;if(d!==void 0&&(f=""+d),c.key!==void 0&&(f=""+c.key),"key"in c){d={};for(var y in c)y!=="key"&&(d[y]=c[y])}else d=c;return c=d.ref,{$$typeof:s,type:o,key:f,ref:c!==void 0?c:null,props:d}}return zr.Fragment=n,zr.jsx=r,zr.jsxs=r,zr}var Sm;function U_(){return Sm||(Sm=1,rd.exports=I_()),rd.exports}var a=U_(),id={exports:{}},Ce={};var Tm;function $_(){if(Tm)return Ce;Tm=1;var s=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),d=Symbol.for("react.consumer"),f=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),v=Symbol.iterator;function T(D){return D===null||typeof D!="object"?null:(D=v&&D[v]||D["@@iterator"],typeof D=="function"?D:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,C={};function j(D,K,ce){this.props=D,this.context=K,this.refs=C,this.updater=ce||w}j.prototype.isReactComponent={},j.prototype.setState=function(D,K){if(typeof D!="object"&&typeof D!="function"&&D!=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,D,K,"setState")},j.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function R(){}R.prototype=j.prototype;function L(D,K,ce){this.props=D,this.context=K,this.refs=C,this.updater=ce||w}var N=L.prototype=new R;N.constructor=L,k(N,j.prototype),N.isPureReactComponent=!0;var M=Array.isArray;function A(){}var z={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function H(D,K,ce){var de=ce.ref;return{$$typeof:s,type:D,key:K,ref:de!==void 0?de:null,props:ce}}function P(D,K){return H(D.type,K,D.props)}function U(D){return typeof D=="object"&&D!==null&&D.$$typeof===s}function J(D){var K={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(ce){return K[ce]})}var X=/\/+/g;function te(D,K){return typeof D=="object"&&D!==null&&D.key!=null?J(""+D.key):K.toString(36)}function ue(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(A,A):(D.status="pending",D.then(function(K){D.status==="pending"&&(D.status="fulfilled",D.value=K)},function(K){D.status==="pending"&&(D.status="rejected",D.reason=K)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function B(D,K,ce,de,G){var ne=typeof D;(ne==="undefined"||ne==="boolean")&&(D=null);var le=!1;if(D===null)le=!0;else switch(ne){case"bigint":case"string":case"number":le=!0;break;case"object":switch(D.$$typeof){case s:case n:le=!0;break;case x:return le=D._init,B(le(D._payload),K,ce,de,G)}}if(le)return G=G(D),le=de===""?"."+te(D,0):de,M(G)?(ce="",le!=null&&(ce=le.replace(X,"$&/")+"/"),B(G,K,ce,"",function(mt){return mt})):G!=null&&(U(G)&&(G=P(G,ce+(G.key==null||D&&D.key===G.key?"":(""+G.key).replace(X,"$&/")+"/")+le)),K.push(G)),1;le=0;var _e=de===""?".":de+":";if(M(D))for(var ze=0;ze<D.length;ze++)de=D[ze],ne=_e+te(de,ze),le+=B(de,K,ce,ne,G);else if(ze=T(D),typeof ze=="function")for(D=ze.call(D),ze=0;!(de=D.next()).done;)de=de.value,ne=_e+te(de,ze++),le+=B(de,K,ce,ne,G);else if(ne==="object"){if(typeof D.then=="function")return B(ue(D),K,ce,de,G);throw K=String(D),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return le}function re(D,K,ce){if(D==null)return D;var de=[],G=0;return B(D,de,"","",function(ne){return K.call(ce,ne,G++)}),de}function he(D){if(D._status===-1){var K=D._result;K=K(),K.then(function(ce){(D._status===0||D._status===-1)&&(D._status=1,D._result=ce)},function(ce){(D._status===0||D._status===-1)&&(D._status=2,D._result=ce)}),D._status===-1&&(D._status=0,D._result=K)}if(D._status===1)return D._result.default;throw D._result}var ke=typeof reportError=="function"?reportError:function(D){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof D=="object"&&D!==null&&typeof D.message=="string"?String(D.message):String(D),error:D});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",D);return}console.error(D)},Te={map:re,forEach:function(D,K,ce){re(D,function(){K.apply(this,arguments)},ce)},count:function(D){var K=0;return re(D,function(){K++}),K},toArray:function(D){return re(D,function(K){return K})||[]},only:function(D){if(!U(D))throw Error("React.Children.only expected to receive a single React element child.");return D}};return Ce.Activity=S,Ce.Children=Te,Ce.Component=j,Ce.Fragment=r,Ce.Profiler=c,Ce.PureComponent=L,Ce.StrictMode=o,Ce.Suspense=g,Ce.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,Ce.__COMPILER_RUNTIME={__proto__:null,c:function(D){return z.H.useMemoCache(D)}},Ce.cache=function(D){return function(){return D.apply(null,arguments)}},Ce.cacheSignal=function(){return null},Ce.cloneElement=function(D,K,ce){if(D==null)throw Error("The argument must be a React element, but you passed "+D+".");var de=k({},D.props),G=D.key;if(K!=null)for(ne in K.key!==void 0&&(G=""+K.key),K)!I.call(K,ne)||ne==="key"||ne==="__self"||ne==="__source"||ne==="ref"&&K.ref===void 0||(de[ne]=K[ne]);var ne=arguments.length-2;if(ne===1)de.children=ce;else if(1<ne){for(var le=Array(ne),_e=0;_e<ne;_e++)le[_e]=arguments[_e+2];de.children=le}return H(D.type,G,de)},Ce.createContext=function(D){return D={$$typeof:f,_currentValue:D,_currentValue2:D,_threadCount:0,Provider:null,Consumer:null},D.Provider=D,D.Consumer={$$typeof:d,_context:D},D},Ce.createElement=function(D,K,ce){var de,G={},ne=null;if(K!=null)for(de in K.key!==void 0&&(ne=""+K.key),K)I.call(K,de)&&de!=="key"&&de!=="__self"&&de!=="__source"&&(G[de]=K[de]);var le=arguments.length-2;if(le===1)G.children=ce;else if(1<le){for(var _e=Array(le),ze=0;ze<le;ze++)_e[ze]=arguments[ze+2];G.children=_e}if(D&&D.defaultProps)for(de in le=D.defaultProps,le)G[de]===void 0&&(G[de]=le[de]);return H(D,ne,G)},Ce.createRef=function(){return{current:null}},Ce.forwardRef=function(D){return{$$typeof:y,render:D}},Ce.isValidElement=U,Ce.lazy=function(D){return{$$typeof:x,_payload:{_status:-1,_result:D},_init:he}},Ce.memo=function(D,K){return{$$typeof:m,type:D,compare:K===void 0?null:K}},Ce.startTransition=function(D){var K=z.T,ce={};z.T=ce;try{var de=D(),G=z.S;G!==null&&G(ce,de),typeof de=="object"&&de!==null&&typeof de.then=="function"&&de.then(A,ke)}catch(ne){ke(ne)}finally{K!==null&&ce.types!==null&&(K.types=ce.types),z.T=K}},Ce.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},Ce.use=function(D){return z.H.use(D)},Ce.useActionState=function(D,K,ce){return z.H.useActionState(D,K,ce)},Ce.useCallback=function(D,K){return z.H.useCallback(D,K)},Ce.useContext=function(D){return z.H.useContext(D)},Ce.useDebugValue=function(){},Ce.useDeferredValue=function(D,K){return z.H.useDeferredValue(D,K)},Ce.useEffect=function(D,K){return z.H.useEffect(D,K)},Ce.useEffectEvent=function(D){return z.H.useEffectEvent(D)},Ce.useId=function(){return z.H.useId()},Ce.useImperativeHandle=function(D,K,ce){return z.H.useImperativeHandle(D,K,ce)},Ce.useInsertionEffect=function(D,K){return z.H.useInsertionEffect(D,K)},Ce.useLayoutEffect=function(D,K){return z.H.useLayoutEffect(D,K)},Ce.useMemo=function(D,K){return z.H.useMemo(D,K)},Ce.useOptimistic=function(D,K){return z.H.useOptimistic(D,K)},Ce.useReducer=function(D,K,ce){return z.H.useReducer(D,K,ce)},Ce.useRef=function(D){return z.H.useRef(D)},Ce.useState=function(D){return z.H.useState(D)},Ce.useSyncExternalStore=function(D,K,ce){return z.H.useSyncExternalStore(D,K,ce)},Ce.useTransition=function(){return z.H.useTransition()},Ce.version="19.2.5",Ce}var jm;function Jd(){return jm||(jm=1,id.exports=$_()),id.exports}var p=Jd();const H_=tx(p);var od={exports:{}},Dr={},cd={exports:{}},ud={};var wm;function G_(){return wm||(wm=1,(function(s){function n(B,re){var he=B.length;B.push(re);e:for(;0<he;){var ke=he-1>>>1,Te=B[ke];if(0<c(Te,re))B[ke]=re,B[he]=Te,he=ke;else break e}}function r(B){return B.length===0?null:B[0]}function o(B){if(B.length===0)return null;var re=B[0],he=B.pop();if(he!==re){B[0]=he;e:for(var ke=0,Te=B.length,D=Te>>>1;ke<D;){var K=2*(ke+1)-1,ce=B[K],de=K+1,G=B[de];if(0>c(ce,he))de<Te&&0>c(G,ce)?(B[ke]=G,B[de]=he,ke=de):(B[ke]=ce,B[K]=he,ke=K);else if(de<Te&&0>c(G,he))B[ke]=G,B[de]=he,ke=de;else break e}}return re}function c(B,re){var he=B.sortIndex-re.sortIndex;return he!==0?he:B.id-re.id}if(s.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var d=performance;s.unstable_now=function(){return d.now()}}else{var f=Date,y=f.now();s.unstable_now=function(){return f.now()-y}}var g=[],m=[],x=1,S=null,v=3,T=!1,w=!1,k=!1,C=!1,j=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function N(B){for(var re=r(m);re!==null;){if(re.callback===null)o(m);else if(re.startTime<=B)o(m),re.sortIndex=re.expirationTime,n(g,re);else break;re=r(m)}}function M(B){if(k=!1,N(B),!w)if(r(g)!==null)w=!0,A||(A=!0,J());else{var re=r(m);re!==null&&ue(M,re.startTime-B)}}var A=!1,z=-1,I=5,H=-1;function P(){return C?!0:!(s.unstable_now()-H<I)}function U(){if(C=!1,A){var B=s.unstable_now();H=B;var re=!0;try{e:{w=!1,k&&(k=!1,R(z),z=-1),T=!0;var he=v;try{t:{for(N(B),S=r(g);S!==null&&!(S.expirationTime>B&&P());){var ke=S.callback;if(typeof ke=="function"){S.callback=null,v=S.priorityLevel;var Te=ke(S.expirationTime<=B);if(B=s.unstable_now(),typeof Te=="function"){S.callback=Te,N(B),re=!0;break t}S===r(g)&&o(g),N(B)}else o(g);S=r(g)}if(S!==null)re=!0;else{var D=r(m);D!==null&&ue(M,D.startTime-B),re=!1}}break e}finally{S=null,v=he,T=!1}re=void 0}}finally{re?J():A=!1}}}var J;if(typeof L=="function")J=function(){L(U)};else if(typeof MessageChannel<"u"){var X=new MessageChannel,te=X.port2;X.port1.onmessage=U,J=function(){te.postMessage(null)}}else J=function(){j(U,0)};function ue(B,re){z=j(function(){B(s.unstable_now())},re)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(B){B.callback=null},s.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<B?Math.floor(1e3/B):5},s.unstable_getCurrentPriorityLevel=function(){return v},s.unstable_next=function(B){switch(v){case 1:case 2:case 3:var re=3;break;default:re=v}var he=v;v=re;try{return B()}finally{v=he}},s.unstable_requestPaint=function(){C=!0},s.unstable_runWithPriority=function(B,re){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var he=v;v=B;try{return re()}finally{v=he}},s.unstable_scheduleCallback=function(B,re,he){var ke=s.unstable_now();switch(typeof he=="object"&&he!==null?(he=he.delay,he=typeof he=="number"&&0<he?ke+he:ke):he=ke,B){case 1:var Te=-1;break;case 2:Te=250;break;case 5:Te=1073741823;break;case 4:Te=1e4;break;default:Te=5e3}return Te=he+Te,B={id:x++,callback:re,priorityLevel:B,startTime:he,expirationTime:Te,sortIndex:-1},he>ke?(B.sortIndex=he,n(m,B),r(g)===null&&B===r(m)&&(k?(R(z),z=-1):k=!0,ue(M,he-ke))):(B.sortIndex=Te,n(g,B),w||T||(w=!0,A||(A=!0,J()))),B},s.unstable_shouldYield=P,s.unstable_wrapCallback=function(B){var re=v;return function(){var he=v;v=re;try{return B.apply(this,arguments)}finally{v=he}}}})(ud)),ud}var km;function P_(){return km||(km=1,cd.exports=G_()),cd.exports}var dd={exports:{}},Gt={};var Em;function V_(){if(Em)return Gt;Em=1;var s=Jd();function n(g){var m="https://react.dev/errors/"+g;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)m+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+g+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var o={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},c=Symbol.for("react.portal");function d(g,m,x){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:S==null?null:""+S,children:g,containerInfo:m,implementation:x}}var f=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function y(g,m){if(g==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Gt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Gt.createPortal=function(g,m){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(n(299));return d(g,m,null,x)},Gt.flushSync=function(g){var m=f.T,x=o.p;try{if(f.T=null,o.p=2,g)return g()}finally{f.T=m,o.p=x,o.d.f()}},Gt.preconnect=function(g,m){typeof g=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,o.d.C(g,m))},Gt.prefetchDNS=function(g){typeof g=="string"&&o.d.D(g)},Gt.preinit=function(g,m){if(typeof g=="string"&&m&&typeof m.as=="string"){var x=m.as,S=y(x,m.crossOrigin),v=typeof m.integrity=="string"?m.integrity:void 0,T=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;x==="style"?o.d.S(g,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:S,integrity:v,fetchPriority:T}):x==="script"&&o.d.X(g,{crossOrigin:S,integrity:v,fetchPriority:T,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Gt.preinitModule=function(g,m){if(typeof g=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var x=y(m.as,m.crossOrigin);o.d.M(g,{crossOrigin:x,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&o.d.M(g)},Gt.preload=function(g,m){if(typeof g=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var x=m.as,S=y(x,m.crossOrigin);o.d.L(g,x,{crossOrigin:S,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Gt.preloadModule=function(g,m){if(typeof g=="string")if(m){var x=y(m.as,m.crossOrigin);o.d.m(g,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:x,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else o.d.m(g)},Gt.requestFormReset=function(g){o.d.r(g)},Gt.unstable_batchedUpdates=function(g,m){return g(m)},Gt.useFormState=function(g,m,x){return f.H.useFormState(g,m,x)},Gt.useFormStatus=function(){return f.H.useHostTransitionStatus()},Gt.version="19.2.5",Gt}var Cm;function Y_(){if(Cm)return dd.exports;Cm=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(n){console.error(n)}}return s(),dd.exports=V_(),dd.exports}var Nm;function F_(){if(Nm)return Dr;Nm=1;var s=P_(),n=Jd(),r=Y_();function o(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)t+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function d(e){var t=e,l=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(l=t.return),e=t.return;while(e)}return t.tag===3?l:null}function f(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function y(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(d(e)!==e)throw Error(o(188))}function m(e){var t=e.alternate;if(!t){if(t=d(e),t===null)throw Error(o(188));return t!==e?null:e}for(var l=e,i=t;;){var u=l.return;if(u===null)break;var h=u.alternate;if(h===null){if(i=u.return,i!==null){l=i;continue}break}if(u.child===h.child){for(h=u.child;h;){if(h===l)return g(u),e;if(h===i)return g(u),t;h=h.sibling}throw Error(o(188))}if(l.return!==i.return)l=u,i=h;else{for(var b=!1,E=u.child;E;){if(E===l){b=!0,l=u,i=h;break}if(E===i){b=!0,i=u,l=h;break}E=E.sibling}if(!b){for(E=h.child;E;){if(E===l){b=!0,l=h,i=u;break}if(E===i){b=!0,i=h,l=u;break}E=E.sibling}if(!b)throw Error(o(189))}}if(l.alternate!==i)throw Error(o(190))}if(l.tag!==3)throw Error(o(188));return l.stateNode.current===l?e:t}function x(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=x(e),t!==null)return t;e=e.sibling}return null}var S=Object.assign,v=Symbol.for("react.element"),T=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),L=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),H=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function J(e){return e===null||typeof e!="object"?null:(e=U&&e[U]||e["@@iterator"],typeof e=="function"?e:null)}var X=Symbol.for("react.client.reference");function te(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===X?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case k:return"Fragment";case j:return"Profiler";case C:return"StrictMode";case M:return"Suspense";case A:return"SuspenseList";case H:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case L:return e.displayName||"Context";case R:return(e._context.displayName||"Context")+".Consumer";case N:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case z:return t=e.displayName||null,t!==null?t:te(e.type)||"Memo";case I:t=e._payload,e=e._init;try{return te(e(t))}catch{}}return null}var ue=Array.isArray,B=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he={pending:!1,data:null,method:null,action:null},ke=[],Te=-1;function D(e){return{current:e}}function K(e){0>Te||(e.current=ke[Te],ke[Te]=null,Te--)}function ce(e,t){Te++,ke[Te]=e.current,e.current=t}var de=D(null),G=D(null),ne=D(null),le=D(null);function _e(e,t){switch(ce(ne,t),ce(G,e),ce(de,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Pg(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Pg(t),e=Vg(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}K(de),ce(de,e)}function ze(){K(de),K(G),K(ne)}function mt(e){e.memoizedState!==null&&ce(le,e);var t=de.current,l=Vg(t,e.type);t!==l&&(ce(G,e),ce(de,l))}function fn(e){G.current===e&&(K(de),K(G)),le.current===e&&(K(le),Cr._currentValue=he)}var pn,Kn;function yt(e){if(pn===void 0)try{throw Error()}catch(l){var t=l.stack.trim().match(/\n( *(at )?)/);pn=t&&t[1]||"",Kn=-1<l.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+pn+e+Kn}var je=!1;function Ee(e,t){if(!e||je)return"";je=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var ae=function(){throw Error()};if(Object.defineProperty(ae.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ae,[])}catch(Q){var F=Q}Reflect.construct(e,[],ae)}else{try{ae.call()}catch(Q){F=Q}e.call(ae.prototype)}}else{try{throw Error()}catch(Q){F=Q}(ae=e())&&typeof ae.catch=="function"&&ae.catch(function(){})}}catch(Q){if(Q&&F&&typeof Q.stack=="string")return[Q.stack,F.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var u=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");u&&u.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var h=i.DetermineComponentFrameRoot(),b=h[0],E=h[1];if(b&&E){var O=b.split(`
|
|
4
|
-
`),Y=E.split(`
|
|
5
|
-
`);for(u=i=0;i<O.length&&!O[i].includes("DetermineComponentFrameRoot");)i++;for(;u<Y.length&&!Y[u].includes("DetermineComponentFrameRoot");)u++;if(i===O.length||u===Y.length)for(i=O.length-1,u=Y.length-1;1<=i&&0<=u&&O[i]!==Y[u];)u--;for(;1<=i&&0<=u;i--,u--)if(O[i]!==Y[u]){if(i!==1||u!==1)do if(i--,u--,0>u||O[i]!==Y[u]){var Z=`
|
|
6
|
-
`+O[i].replace(" at new "," at ");return e.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",e.displayName)),Z}while(1<=i&&0<=u);break}}}finally{je=!1,Error.prepareStackTrace=l}return(l=e?e.displayName||e.name:"")?yt(l):""}function ft(e,t){switch(e.tag){case 26:case 27:case 5:return yt(e.type);case 16:return yt("Lazy");case 13:return e.child!==t&&t!==null?yt("Suspense Fallback"):yt("Suspense");case 19:return yt("SuspenseList");case 0:case 15:return Ee(e.type,!1);case 11:return Ee(e.type.render,!1);case 1:return Ee(e.type,!0);case 31:return yt("Activity");default:return""}}function kt(e){try{var t="",l=null;do t+=ft(e,l),l=e,e=e.return;while(e);return t}catch(i){return`
|
|
7
|
-
Error generating stack: `+i.message+`
|
|
8
|
-
`+i.stack}}var On=Object.prototype.hasOwnProperty,en=s.unstable_scheduleCallback,qt=s.unstable_cancelCallback,os=s.unstable_shouldYield,gn=s.unstable_requestPaint,xt=s.unstable_now,cs=s.unstable_getCurrentPriorityLevel,us=s.unstable_ImmediatePriority,pa=s.unstable_UserBlockingPriority,qs=s.unstable_NormalPriority,Ul=s.unstable_LowPriority,Ga=s.unstable_IdlePriority,$l=s.log,Hl=s.unstable_setDisableYieldValue,ds=null,Mt=null;function mn(e){if(typeof $l=="function"&&Hl(e),Mt&&typeof Mt.setStrictMode=="function")try{Mt.setStrictMode(ds,e)}catch{}}var Bt=Math.clz32?Math.clz32:hs,Ln=Math.log,Ms=Math.LN2;function hs(e){return e>>>=0,e===0?32:31-(Ln(e)/Ms|0)|0}var Bs=256,fs=262144,Xn=4194304;function qn(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Is(e,t,l){var i=e.pendingLanes;if(i===0)return 0;var u=0,h=e.suspendedLanes,b=e.pingedLanes;e=e.warmLanes;var E=i&134217727;return E!==0?(i=E&~h,i!==0?u=qn(i):(b&=E,b!==0?u=qn(b):l||(l=E&~e,l!==0&&(u=qn(l))))):(E=i&~h,E!==0?u=qn(E):b!==0?u=qn(b):l||(l=i&~e,l!==0&&(u=qn(l)))),u===0?0:t!==0&&t!==u&&(t&h)===0&&(h=u&-u,l=t&-t,h>=l||h===32&&(l&4194048)!==0)?t:u}function se(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function pe(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ke(){var e=Xn;return Xn<<=1,(Xn&62914560)===0&&(Xn=4194304),e}function nt(e){for(var t=[],l=0;31>l;l++)t.push(e);return t}function ut(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Zn(e,t,l,i,u,h){var b=e.pendingLanes;e.pendingLanes=l,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=l,e.entangledLanes&=l,e.errorRecoveryDisabledLanes&=l,e.shellSuspendCounter=0;var E=e.entanglements,O=e.expirationTimes,Y=e.hiddenUpdates;for(l=b&~l;0<l;){var Z=31-Bt(l),ae=1<<Z;E[Z]=0,O[Z]=-1;var F=Y[Z];if(F!==null)for(Y[Z]=null,Z=0;Z<F.length;Z++){var Q=F[Z];Q!==null&&(Q.lane&=-536870913)}l&=~ae}i!==0&&Me(e,i,0),h!==0&&u===0&&e.tag!==0&&(e.suspendedLanes|=h&~(b&~t))}function Me(e,t,l){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-Bt(t);e.entangledLanes|=t,e.entanglements[i]=e.entanglements[i]|1073741824|l&261930}function ie(e,t){var l=e.entangledLanes|=t;for(e=e.entanglements;l;){var i=31-Bt(l),u=1<<i;u&t|e[i]&t&&(e[i]|=t),l&=~u}}function ye(e,t){var l=t&-t;return l=(l&42)!==0?1:At(l),(l&(e.suspendedLanes|t))!==0?0:l}function At(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function ga(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function si(){var e=re.p;return e!==0?e:(e=window.event,e===void 0?32:pm(e.type))}function tn(e,t){var l=re.p;try{return re.p=e,t()}finally{re.p=l}}var Mn=Math.random().toString(36).slice(2),Et="__reactFiber$"+Mn,Yt="__reactProps$"+Mn,Pa="__reactContainer$"+Mn,Zo="__reactEvents$"+Mn,Cv="__reactListeners$"+Mn,Nv="__reactHandles$"+Mn,Ah="__reactResources$"+Mn,Gl="__reactMarker$"+Mn;function Jo(e){delete e[Et],delete e[Yt],delete e[Zo],delete e[Cv],delete e[Nv]}function Va(e){var t=e[Et];if(t)return t;for(var l=e.parentNode;l;){if(t=l[Pa]||l[Et]){if(l=t.alternate,t.child!==null||l!==null&&l.child!==null)for(e=Jg(e);e!==null;){if(l=e[Et])return l;e=Jg(e)}return t}e=l,l=e.parentNode}return null}function Ya(e){if(e=e[Et]||e[Pa]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Pl(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function Fa(e){var t=e[Ah];return t||(t=e[Ah]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function Rt(e){e[Gl]=!0}var Rh=new Set,zh={};function ma(e,t){Qa(e,t),Qa(e+"Capture",t)}function Qa(e,t){for(zh[e]=t,e=0;e<t.length;e++)Rh.add(t[e])}var Av=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]*$"),Dh={},Oh={};function Rv(e){return On.call(Oh,e)?!0:On.call(Dh,e)?!1:Av.test(e)?Oh[e]=!0:(Dh[e]=!0,!1)}function ai(e,t,l){if(Rv(t))if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var i=t.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+l)}}function li(e,t,l){if(l===null)e.removeAttribute(t);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+l)}}function ps(e,t,l,i){if(i===null)e.removeAttribute(l);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(l);return}e.setAttributeNS(t,l,""+i)}}function yn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Lh(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function zv(e,t,l){var i=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var u=i.get,h=i.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return u.call(this)},set:function(b){l=""+b,h.call(this,b)}}),Object.defineProperty(e,t,{enumerable:i.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Wo(e){if(!e._valueTracker){var t=Lh(e)?"checked":"value";e._valueTracker=zv(e,t,""+e[t])}}function qh(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var l=t.getValue(),i="";return e&&(i=Lh(e)?e.checked?"true":"false":e.value),e=i,e!==l?(t.setValue(e),!0):!1}function ri(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Dv=/[\n"\\]/g;function xn(e){return e.replace(Dv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function ec(e,t,l,i,u,h,b,E){e.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?e.type=b:e.removeAttribute("type"),t!=null?b==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+yn(t)):e.value!==""+yn(t)&&(e.value=""+yn(t)):b!=="submit"&&b!=="reset"||e.removeAttribute("value"),t!=null?tc(e,b,yn(t)):l!=null?tc(e,b,yn(l)):i!=null&&e.removeAttribute("value"),u==null&&h!=null&&(e.defaultChecked=!!h),u!=null&&(e.checked=u&&typeof u!="function"&&typeof u!="symbol"),E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?e.name=""+yn(E):e.removeAttribute("name")}function Mh(e,t,l,i,u,h,b,E){if(h!=null&&typeof h!="function"&&typeof h!="symbol"&&typeof h!="boolean"&&(e.type=h),t!=null||l!=null){if(!(h!=="submit"&&h!=="reset"||t!=null)){Wo(e);return}l=l!=null?""+yn(l):"",t=t!=null?""+yn(t):l,E||t===e.value||(e.value=t),e.defaultValue=t}i=i??u,i=typeof i!="function"&&typeof i!="symbol"&&!!i,e.checked=E?e.checked:!!i,e.defaultChecked=!!i,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(e.name=b),Wo(e)}function tc(e,t,l){t==="number"&&ri(e.ownerDocument)===e||e.defaultValue===""+l||(e.defaultValue=""+l)}function Ka(e,t,l,i){if(e=e.options,t){t={};for(var u=0;u<l.length;u++)t["$"+l[u]]=!0;for(l=0;l<e.length;l++)u=t.hasOwnProperty("$"+e[l].value),e[l].selected!==u&&(e[l].selected=u),u&&i&&(e[l].defaultSelected=!0)}else{for(l=""+yn(l),t=null,u=0;u<e.length;u++){if(e[u].value===l){e[u].selected=!0,i&&(e[u].defaultSelected=!0);return}t!==null||e[u].disabled||(t=e[u])}t!==null&&(t.selected=!0)}}function Bh(e,t,l){if(t!=null&&(t=""+yn(t),t!==e.value&&(e.value=t),l==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=l!=null?""+yn(l):""}function Ih(e,t,l,i){if(t==null){if(i!=null){if(l!=null)throw Error(o(92));if(ue(i)){if(1<i.length)throw Error(o(93));i=i[0]}l=i}l==null&&(l=""),t=l}l=yn(t),e.defaultValue=l,i=e.textContent,i===l&&i!==""&&i!==null&&(e.value=i),Wo(e)}function Xa(e,t){if(t){var l=e.firstChild;if(l&&l===e.lastChild&&l.nodeType===3){l.nodeValue=t;return}}e.textContent=t}var Ov=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 Uh(e,t,l){var i=t.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?i?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":i?e.setProperty(t,l):typeof l!="number"||l===0||Ov.has(t)?t==="float"?e.cssFloat=l:e[t]=(""+l).trim():e[t]=l+"px"}function $h(e,t,l){if(t!=null&&typeof t!="object")throw Error(o(62));if(e=e.style,l!=null){for(var i in l)!l.hasOwnProperty(i)||t!=null&&t.hasOwnProperty(i)||(i.indexOf("--")===0?e.setProperty(i,""):i==="float"?e.cssFloat="":e[i]="");for(var u in t)i=t[u],t.hasOwnProperty(u)&&l[u]!==i&&Uh(e,u,i)}else for(var h in t)t.hasOwnProperty(h)&&Uh(e,h,t[h])}function nc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Lv=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"]]),qv=/^[\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 ii(e){return qv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function gs(){}var sc=null;function ac(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Za=null,Ja=null;function Hh(e){var t=Ya(e);if(t&&(e=t.stateNode)){var l=e[Yt]||null;e:switch(e=t.stateNode,t.type){case"input":if(ec(e,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),t=l.name,l.type==="radio"&&t!=null){for(l=e;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+xn(""+t)+'"][type="radio"]'),t=0;t<l.length;t++){var i=l[t];if(i!==e&&i.form===e.form){var u=i[Yt]||null;if(!u)throw Error(o(90));ec(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name)}}for(t=0;t<l.length;t++)i=l[t],i.form===e.form&&qh(i)}break e;case"textarea":Bh(e,l.value,l.defaultValue);break e;case"select":t=l.value,t!=null&&Ka(e,!!l.multiple,t,!1)}}}var lc=!1;function Gh(e,t,l){if(lc)return e(t,l);lc=!0;try{var i=e(t);return i}finally{if(lc=!1,(Za!==null||Ja!==null)&&(Qi(),Za&&(t=Za,e=Ja,Ja=Za=null,Hh(t),e)))for(t=0;t<e.length;t++)Hh(e[t])}}function Vl(e,t){var l=e.stateNode;if(l===null)return null;var i=l[Yt]||null;if(i===null)return null;l=i[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(e=e.type,i=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!i;break e;default:e=!1}if(e)return null;if(l&&typeof l!="function")throw Error(o(231,t,typeof l));return l}var ms=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rc=!1;if(ms)try{var Yl={};Object.defineProperty(Yl,"passive",{get:function(){rc=!0}}),window.addEventListener("test",Yl,Yl),window.removeEventListener("test",Yl,Yl)}catch{rc=!1}var Us=null,ic=null,oi=null;function Ph(){if(oi)return oi;var e,t=ic,l=t.length,i,u="value"in Us?Us.value:Us.textContent,h=u.length;for(e=0;e<l&&t[e]===u[e];e++);var b=l-e;for(i=1;i<=b&&t[l-i]===u[h-i];i++);return oi=u.slice(e,1<i?1-i:void 0)}function ci(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function ui(){return!0}function Vh(){return!1}function Ft(e){function t(l,i,u,h,b){this._reactName=l,this._targetInst=u,this.type=i,this.nativeEvent=h,this.target=b,this.currentTarget=null;for(var E in e)e.hasOwnProperty(E)&&(l=e[E],this[E]=l?l(h):h[E]);return this.isDefaultPrevented=(h.defaultPrevented!=null?h.defaultPrevented:h.returnValue===!1)?ui:Vh,this.isPropagationStopped=Vh,this}return S(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=ui)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=ui)},persist:function(){},isPersistent:ui}),t}var ya={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},di=Ft(ya),Fl=S({},ya,{view:0,detail:0}),Mv=Ft(Fl),oc,cc,Ql,hi=S({},Fl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:dc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Ql&&(Ql&&e.type==="mousemove"?(oc=e.screenX-Ql.screenX,cc=e.screenY-Ql.screenY):cc=oc=0,Ql=e),oc)},movementY:function(e){return"movementY"in e?e.movementY:cc}}),Yh=Ft(hi),Bv=S({},hi,{dataTransfer:0}),Iv=Ft(Bv),Uv=S({},Fl,{relatedTarget:0}),uc=Ft(Uv),$v=S({},ya,{animationName:0,elapsedTime:0,pseudoElement:0}),Hv=Ft($v),Gv=S({},ya,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Pv=Ft(Gv),Vv=S({},ya,{data:0}),Fh=Ft(Vv),Yv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Fv={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"},Qv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Kv(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Qv[e])?!!t[e]:!1}function dc(){return Kv}var Xv=S({},Fl,{key:function(e){if(e.key){var t=Yv[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ci(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Fv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:dc,charCode:function(e){return e.type==="keypress"?ci(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ci(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Zv=Ft(Xv),Jv=S({},hi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Qh=Ft(Jv),Wv=S({},Fl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:dc}),eb=Ft(Wv),tb=S({},ya,{propertyName:0,elapsedTime:0,pseudoElement:0}),nb=Ft(tb),sb=S({},hi,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),ab=Ft(sb),lb=S({},ya,{newState:0,oldState:0}),rb=Ft(lb),ib=[9,13,27,32],hc=ms&&"CompositionEvent"in window,Kl=null;ms&&"documentMode"in document&&(Kl=document.documentMode);var ob=ms&&"TextEvent"in window&&!Kl,Kh=ms&&(!hc||Kl&&8<Kl&&11>=Kl),Xh=" ",Zh=!1;function Jh(e,t){switch(e){case"keyup":return ib.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Wh(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Wa=!1;function cb(e,t){switch(e){case"compositionend":return Wh(t);case"keypress":return t.which!==32?null:(Zh=!0,Xh);case"textInput":return e=t.data,e===Xh&&Zh?null:e;default:return null}}function ub(e,t){if(Wa)return e==="compositionend"||!hc&&Jh(e,t)?(e=Ph(),oi=ic=Us=null,Wa=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Kh&&t.locale!=="ko"?null:t.data;default:return null}}var db={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 ef(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!db[e.type]:t==="textarea"}function tf(e,t,l,i){Za?Ja?Ja.push(i):Ja=[i]:Za=i,t=to(t,"onChange"),0<t.length&&(l=new di("onChange","change",null,l,i),e.push({event:l,listeners:t}))}var Xl=null,Zl=null;function hb(e){Bg(e,0)}function fi(e){var t=Pl(e);if(qh(t))return e}function nf(e,t){if(e==="change")return t}var sf=!1;if(ms){var fc;if(ms){var pc="oninput"in document;if(!pc){var af=document.createElement("div");af.setAttribute("oninput","return;"),pc=typeof af.oninput=="function"}fc=pc}else fc=!1;sf=fc&&(!document.documentMode||9<document.documentMode)}function lf(){Xl&&(Xl.detachEvent("onpropertychange",rf),Zl=Xl=null)}function rf(e){if(e.propertyName==="value"&&fi(Zl)){var t=[];tf(t,Zl,e,ac(e)),Gh(hb,t)}}function fb(e,t,l){e==="focusin"?(lf(),Xl=t,Zl=l,Xl.attachEvent("onpropertychange",rf)):e==="focusout"&&lf()}function pb(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return fi(Zl)}function gb(e,t){if(e==="click")return fi(t)}function mb(e,t){if(e==="input"||e==="change")return fi(t)}function yb(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var nn=typeof Object.is=="function"?Object.is:yb;function Jl(e,t){if(nn(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var l=Object.keys(e),i=Object.keys(t);if(l.length!==i.length)return!1;for(i=0;i<l.length;i++){var u=l[i];if(!On.call(t,u)||!nn(e[u],t[u]))return!1}return!0}function of(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function cf(e,t){var l=of(e);e=0;for(var i;l;){if(l.nodeType===3){if(i=e+l.textContent.length,e<=t&&i>=t)return{node:l,offset:t-e};e=i}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=of(l)}}function uf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?uf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function df(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=ri(e.document);t instanceof e.HTMLIFrameElement;){try{var l=typeof t.contentWindow.location.href=="string"}catch{l=!1}if(l)e=t.contentWindow;else break;t=ri(e.document)}return t}function gc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var xb=ms&&"documentMode"in document&&11>=document.documentMode,el=null,mc=null,Wl=null,yc=!1;function hf(e,t,l){var i=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;yc||el==null||el!==ri(i)||(i=el,"selectionStart"in i&&gc(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),Wl&&Jl(Wl,i)||(Wl=i,i=to(mc,"onSelect"),0<i.length&&(t=new di("onSelect","select",null,t,l),e.push({event:t,listeners:i}),t.target=el)))}function xa(e,t){var l={};return l[e.toLowerCase()]=t.toLowerCase(),l["Webkit"+e]="webkit"+t,l["Moz"+e]="moz"+t,l}var tl={animationend:xa("Animation","AnimationEnd"),animationiteration:xa("Animation","AnimationIteration"),animationstart:xa("Animation","AnimationStart"),transitionrun:xa("Transition","TransitionRun"),transitionstart:xa("Transition","TransitionStart"),transitioncancel:xa("Transition","TransitionCancel"),transitionend:xa("Transition","TransitionEnd")},xc={},ff={};ms&&(ff=document.createElement("div").style,"AnimationEvent"in window||(delete tl.animationend.animation,delete tl.animationiteration.animation,delete tl.animationstart.animation),"TransitionEvent"in window||delete tl.transitionend.transition);function va(e){if(xc[e])return xc[e];if(!tl[e])return e;var t=tl[e],l;for(l in t)if(t.hasOwnProperty(l)&&l in ff)return xc[e]=t[l];return e}var pf=va("animationend"),gf=va("animationiteration"),mf=va("animationstart"),vb=va("transitionrun"),bb=va("transitionstart"),_b=va("transitioncancel"),yf=va("transitionend"),xf=new Map,vc="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(" ");vc.push("scrollEnd");function Bn(e,t){xf.set(e,t),ma(t,[e])}var pi=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},vn=[],nl=0,bc=0;function gi(){for(var e=nl,t=bc=nl=0;t<e;){var l=vn[t];vn[t++]=null;var i=vn[t];vn[t++]=null;var u=vn[t];vn[t++]=null;var h=vn[t];if(vn[t++]=null,i!==null&&u!==null){var b=i.pending;b===null?u.next=u:(u.next=b.next,b.next=u),i.pending=u}h!==0&&vf(l,u,h)}}function mi(e,t,l,i){vn[nl++]=e,vn[nl++]=t,vn[nl++]=l,vn[nl++]=i,bc|=i,e.lanes|=i,e=e.alternate,e!==null&&(e.lanes|=i)}function _c(e,t,l,i){return mi(e,t,l,i),yi(e)}function ba(e,t){return mi(e,null,null,t),yi(e)}function vf(e,t,l){e.lanes|=l;var i=e.alternate;i!==null&&(i.lanes|=l);for(var u=!1,h=e.return;h!==null;)h.childLanes|=l,i=h.alternate,i!==null&&(i.childLanes|=l),h.tag===22&&(e=h.stateNode,e===null||e._visibility&1||(u=!0)),e=h,h=h.return;return e.tag===3?(h=e.stateNode,u&&t!==null&&(u=31-Bt(l),e=h.hiddenUpdates,i=e[u],i===null?e[u]=[t]:i.push(t),t.lane=l|536870912),h):null}function yi(e){if(50<_r)throw _r=0,Au=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var sl={};function Sb(e,t,l,i){this.tag=e,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function sn(e,t,l,i){return new Sb(e,t,l,i)}function Sc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ys(e,t){var l=e.alternate;return l===null?(l=sn(e.tag,t,e.key,e.mode),l.elementType=e.elementType,l.type=e.type,l.stateNode=e.stateNode,l.alternate=e,e.alternate=l):(l.pendingProps=t,l.type=e.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=e.flags&65011712,l.childLanes=e.childLanes,l.lanes=e.lanes,l.child=e.child,l.memoizedProps=e.memoizedProps,l.memoizedState=e.memoizedState,l.updateQueue=e.updateQueue,t=e.dependencies,l.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},l.sibling=e.sibling,l.index=e.index,l.ref=e.ref,l.refCleanup=e.refCleanup,l}function bf(e,t){e.flags&=65011714;var l=e.alternate;return l===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=l.childLanes,e.lanes=l.lanes,e.child=l.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=l.memoizedProps,e.memoizedState=l.memoizedState,e.updateQueue=l.updateQueue,e.type=l.type,t=l.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function xi(e,t,l,i,u,h){var b=0;if(i=e,typeof e=="function")Sc(e)&&(b=1);else if(typeof e=="string")b=E_(e,l,de.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case H:return e=sn(31,l,t,u),e.elementType=H,e.lanes=h,e;case k:return _a(l.children,u,h,t);case C:b=8,u|=24;break;case j:return e=sn(12,l,t,u|2),e.elementType=j,e.lanes=h,e;case M:return e=sn(13,l,t,u),e.elementType=M,e.lanes=h,e;case A:return e=sn(19,l,t,u),e.elementType=A,e.lanes=h,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case L:b=10;break e;case R:b=9;break e;case N:b=11;break e;case z:b=14;break e;case I:b=16,i=null;break e}b=29,l=Error(o(130,e===null?"null":typeof e,"")),i=null}return t=sn(b,l,t,u),t.elementType=e,t.type=i,t.lanes=h,t}function _a(e,t,l,i){return e=sn(7,e,i,t),e.lanes=l,e}function Tc(e,t,l){return e=sn(6,e,null,t),e.lanes=l,e}function _f(e){var t=sn(18,null,null,0);return t.stateNode=e,t}function jc(e,t,l){return t=sn(4,e.children!==null?e.children:[],e.key,t),t.lanes=l,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Sf=new WeakMap;function bn(e,t){if(typeof e=="object"&&e!==null){var l=Sf.get(e);return l!==void 0?l:(t={value:e,source:t,stack:kt(t)},Sf.set(e,t),t)}return{value:e,source:t,stack:kt(t)}}var al=[],ll=0,vi=null,er=0,_n=[],Sn=0,$s=null,Jn=1,Wn="";function xs(e,t){al[ll++]=er,al[ll++]=vi,vi=e,er=t}function Tf(e,t,l){_n[Sn++]=Jn,_n[Sn++]=Wn,_n[Sn++]=$s,$s=e;var i=Jn;e=Wn;var u=32-Bt(i)-1;i&=~(1<<u),l+=1;var h=32-Bt(t)+u;if(30<h){var b=u-u%5;h=(i&(1<<b)-1).toString(32),i>>=b,u-=b,Jn=1<<32-Bt(t)+u|l<<u|i,Wn=h+e}else Jn=1<<h|l<<u|i,Wn=e}function wc(e){e.return!==null&&(xs(e,1),Tf(e,1,0))}function kc(e){for(;e===vi;)vi=al[--ll],al[ll]=null,er=al[--ll],al[ll]=null;for(;e===$s;)$s=_n[--Sn],_n[Sn]=null,Wn=_n[--Sn],_n[Sn]=null,Jn=_n[--Sn],_n[Sn]=null}function jf(e,t){_n[Sn++]=Jn,_n[Sn++]=Wn,_n[Sn++]=$s,Jn=t.id,Wn=t.overflow,$s=e}var It=null,st=null,Be=!1,Hs=null,Tn=!1,Ec=Error(o(519));function Gs(e){var t=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw tr(bn(t,e)),Ec}function wf(e){var t=e.stateNode,l=e.type,i=e.memoizedProps;switch(t[Et]=e,t[Yt]=i,l){case"dialog":Oe("cancel",t),Oe("close",t);break;case"iframe":case"object":case"embed":Oe("load",t);break;case"video":case"audio":for(l=0;l<Tr.length;l++)Oe(Tr[l],t);break;case"source":Oe("error",t);break;case"img":case"image":case"link":Oe("error",t),Oe("load",t);break;case"details":Oe("toggle",t);break;case"input":Oe("invalid",t),Mh(t,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":Oe("invalid",t);break;case"textarea":Oe("invalid",t),Ih(t,i.value,i.defaultValue,i.children)}l=i.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||t.textContent===""+l||i.suppressHydrationWarning===!0||Hg(t.textContent,l)?(i.popover!=null&&(Oe("beforetoggle",t),Oe("toggle",t)),i.onScroll!=null&&Oe("scroll",t),i.onScrollEnd!=null&&Oe("scrollend",t),i.onClick!=null&&(t.onclick=gs),t=!0):t=!1,t||Gs(e,!0)}function kf(e){for(It=e.return;It;)switch(It.tag){case 5:case 31:case 13:Tn=!1;return;case 27:case 3:Tn=!0;return;default:It=It.return}}function rl(e){if(e!==It)return!1;if(!Be)return kf(e),Be=!0,!1;var t=e.tag,l;if((l=t!==3&&t!==27)&&((l=t===5)&&(l=e.type,l=!(l!=="form"&&l!=="button")||Vu(e.type,e.memoizedProps)),l=!l),l&&st&&Gs(e),kf(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));st=Zg(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(317));st=Zg(e)}else t===27?(t=st,sa(e.type)?(e=Xu,Xu=null,st=e):st=t):st=It?wn(e.stateNode.nextSibling):null;return!0}function Sa(){st=It=null,Be=!1}function Cc(){var e=Hs;return e!==null&&(Zt===null?Zt=e:Zt.push.apply(Zt,e),Hs=null),e}function tr(e){Hs===null?Hs=[e]:Hs.push(e)}var Nc=D(null),Ta=null,vs=null;function Ps(e,t,l){ce(Nc,t._currentValue),t._currentValue=l}function bs(e){e._currentValue=Nc.current,K(Nc)}function Ac(e,t,l){for(;e!==null;){var i=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,i!==null&&(i.childLanes|=t)):i!==null&&(i.childLanes&t)!==t&&(i.childLanes|=t),e===l)break;e=e.return}}function Rc(e,t,l,i){var u=e.child;for(u!==null&&(u.return=e);u!==null;){var h=u.dependencies;if(h!==null){var b=u.child;h=h.firstContext;e:for(;h!==null;){var E=h;h=u;for(var O=0;O<t.length;O++)if(E.context===t[O]){h.lanes|=l,E=h.alternate,E!==null&&(E.lanes|=l),Ac(h.return,l,e),i||(b=null);break e}h=E.next}}else if(u.tag===18){if(b=u.return,b===null)throw Error(o(341));b.lanes|=l,h=b.alternate,h!==null&&(h.lanes|=l),Ac(b,l,e),b=null}else b=u.child;if(b!==null)b.return=u;else for(b=u;b!==null;){if(b===e){b=null;break}if(u=b.sibling,u!==null){u.return=b.return,b=u;break}b=b.return}u=b}}function il(e,t,l,i){e=null;for(var u=t,h=!1;u!==null;){if(!h){if((u.flags&524288)!==0)h=!0;else if((u.flags&262144)!==0)break}if(u.tag===10){var b=u.alternate;if(b===null)throw Error(o(387));if(b=b.memoizedProps,b!==null){var E=u.type;nn(u.pendingProps.value,b.value)||(e!==null?e.push(E):e=[E])}}else if(u===le.current){if(b=u.alternate,b===null)throw Error(o(387));b.memoizedState.memoizedState!==u.memoizedState.memoizedState&&(e!==null?e.push(Cr):e=[Cr])}u=u.return}e!==null&&Rc(t,e,l,i),t.flags|=262144}function bi(e){for(e=e.firstContext;e!==null;){if(!nn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ja(e){Ta=e,vs=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ut(e){return Ef(Ta,e)}function _i(e,t){return Ta===null&&ja(e),Ef(e,t)}function Ef(e,t){var l=t._currentValue;if(t={context:t,memoizedValue:l,next:null},vs===null){if(e===null)throw Error(o(308));vs=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else vs=vs.next=t;return l}var Tb=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(l,i){e.push(i)}};this.abort=function(){t.aborted=!0,e.forEach(function(l){return l()})}},jb=s.unstable_scheduleCallback,wb=s.unstable_NormalPriority,vt={$$typeof:L,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function zc(){return{controller:new Tb,data:new Map,refCount:0}}function nr(e){e.refCount--,e.refCount===0&&jb(wb,function(){e.controller.abort()})}var sr=null,Dc=0,ol=0,cl=null;function kb(e,t){if(sr===null){var l=sr=[];Dc=0,ol=qu(),cl={status:"pending",value:void 0,then:function(i){l.push(i)}}}return Dc++,t.then(Cf,Cf),t}function Cf(){if(--Dc===0&&sr!==null){cl!==null&&(cl.status="fulfilled");var e=sr;sr=null,ol=0,cl=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Eb(e,t){var l=[],i={status:"pending",value:null,reason:null,then:function(u){l.push(u)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var u=0;u<l.length;u++)(0,l[u])(t)},function(u){for(i.status="rejected",i.reason=u,u=0;u<l.length;u++)(0,l[u])(void 0)}),i}var Nf=B.S;B.S=function(e,t){hg=xt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&kb(e,t),Nf!==null&&Nf(e,t)};var wa=D(null);function Oc(){var e=wa.current;return e!==null?e:tt.pooledCache}function Si(e,t){t===null?ce(wa,wa.current):ce(wa,t.pool)}function Af(){var e=Oc();return e===null?null:{parent:vt._currentValue,pool:e}}var ul=Error(o(460)),Lc=Error(o(474)),Ti=Error(o(542)),ji={then:function(){}};function Rf(e){return e=e.status,e==="fulfilled"||e==="rejected"}function zf(e,t,l){switch(l=e[l],l===void 0?e.push(t):l!==t&&(t.then(gs,gs),t=l),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Of(e),e;default:if(typeof t.status=="string")t.then(gs,gs);else{if(e=tt,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status="pending",e.then(function(i){if(t.status==="pending"){var u=t;u.status="fulfilled",u.value=i}},function(i){if(t.status==="pending"){var u=t;u.status="rejected",u.reason=i}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Of(e),e}throw Ea=t,ul}}function ka(e){try{var t=e._init;return t(e._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Ea=l,ul):l}}var Ea=null;function Df(){if(Ea===null)throw Error(o(459));var e=Ea;return Ea=null,e}function Of(e){if(e===ul||e===Ti)throw Error(o(483))}var dl=null,ar=0;function wi(e){var t=ar;return ar+=1,dl===null&&(dl=[]),zf(dl,e,t)}function lr(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function ki(e,t){throw t.$$typeof===v?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Lf(e){function t($,q){if(e){var V=$.deletions;V===null?($.deletions=[q],$.flags|=16):V.push(q)}}function l($,q){if(!e)return null;for(;q!==null;)t($,q),q=q.sibling;return null}function i($){for(var q=new Map;$!==null;)$.key!==null?q.set($.key,$):q.set($.index,$),$=$.sibling;return q}function u($,q){return $=ys($,q),$.index=0,$.sibling=null,$}function h($,q,V){return $.index=V,e?(V=$.alternate,V!==null?(V=V.index,V<q?($.flags|=67108866,q):V):($.flags|=67108866,q)):($.flags|=1048576,q)}function b($){return e&&$.alternate===null&&($.flags|=67108866),$}function E($,q,V,ee){return q===null||q.tag!==6?(q=Tc(V,$.mode,ee),q.return=$,q):(q=u(q,V),q.return=$,q)}function O($,q,V,ee){var Se=V.type;return Se===k?Z($,q,V.props.children,ee,V.key):q!==null&&(q.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===I&&ka(Se)===q.type)?(q=u(q,V.props),lr(q,V),q.return=$,q):(q=xi(V.type,V.key,V.props,null,$.mode,ee),lr(q,V),q.return=$,q)}function Y($,q,V,ee){return q===null||q.tag!==4||q.stateNode.containerInfo!==V.containerInfo||q.stateNode.implementation!==V.implementation?(q=jc(V,$.mode,ee),q.return=$,q):(q=u(q,V.children||[]),q.return=$,q)}function Z($,q,V,ee,Se){return q===null||q.tag!==7?(q=_a(V,$.mode,ee,Se),q.return=$,q):(q=u(q,V),q.return=$,q)}function ae($,q,V){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Tc(""+q,$.mode,V),q.return=$,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case T:return V=xi(q.type,q.key,q.props,null,$.mode,V),lr(V,q),V.return=$,V;case w:return q=jc(q,$.mode,V),q.return=$,q;case I:return q=ka(q),ae($,q,V)}if(ue(q)||J(q))return q=_a(q,$.mode,V,null),q.return=$,q;if(typeof q.then=="function")return ae($,wi(q),V);if(q.$$typeof===L)return ae($,_i($,q),V);ki($,q)}return null}function F($,q,V,ee){var Se=q!==null?q.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return Se!==null?null:E($,q,""+V,ee);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case T:return V.key===Se?O($,q,V,ee):null;case w:return V.key===Se?Y($,q,V,ee):null;case I:return V=ka(V),F($,q,V,ee)}if(ue(V)||J(V))return Se!==null?null:Z($,q,V,ee,null);if(typeof V.then=="function")return F($,q,wi(V),ee);if(V.$$typeof===L)return F($,q,_i($,V),ee);ki($,V)}return null}function Q($,q,V,ee,Se){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return $=$.get(V)||null,E(q,$,""+ee,Se);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case T:return $=$.get(ee.key===null?V:ee.key)||null,O(q,$,ee,Se);case w:return $=$.get(ee.key===null?V:ee.key)||null,Y(q,$,ee,Se);case I:return ee=ka(ee),Q($,q,V,ee,Se)}if(ue(ee)||J(ee))return $=$.get(V)||null,Z(q,$,ee,Se,null);if(typeof ee.then=="function")return Q($,q,V,wi(ee),Se);if(ee.$$typeof===L)return Q($,q,V,_i(q,ee),Se);ki(q,ee)}return null}function me($,q,V,ee){for(var Se=null,Pe=null,be=q,Ae=q=0,qe=null;be!==null&&Ae<V.length;Ae++){be.index>Ae?(qe=be,be=null):qe=be.sibling;var Ve=F($,be,V[Ae],ee);if(Ve===null){be===null&&(be=qe);break}e&&be&&Ve.alternate===null&&t($,be),q=h(Ve,q,Ae),Pe===null?Se=Ve:Pe.sibling=Ve,Pe=Ve,be=qe}if(Ae===V.length)return l($,be),Be&&xs($,Ae),Se;if(be===null){for(;Ae<V.length;Ae++)be=ae($,V[Ae],ee),be!==null&&(q=h(be,q,Ae),Pe===null?Se=be:Pe.sibling=be,Pe=be);return Be&&xs($,Ae),Se}for(be=i(be);Ae<V.length;Ae++)qe=Q(be,$,Ae,V[Ae],ee),qe!==null&&(e&&qe.alternate!==null&&be.delete(qe.key===null?Ae:qe.key),q=h(qe,q,Ae),Pe===null?Se=qe:Pe.sibling=qe,Pe=qe);return e&&be.forEach(function(oa){return t($,oa)}),Be&&xs($,Ae),Se}function we($,q,V,ee){if(V==null)throw Error(o(151));for(var Se=null,Pe=null,be=q,Ae=q=0,qe=null,Ve=V.next();be!==null&&!Ve.done;Ae++,Ve=V.next()){be.index>Ae?(qe=be,be=null):qe=be.sibling;var oa=F($,be,Ve.value,ee);if(oa===null){be===null&&(be=qe);break}e&&be&&oa.alternate===null&&t($,be),q=h(oa,q,Ae),Pe===null?Se=oa:Pe.sibling=oa,Pe=oa,be=qe}if(Ve.done)return l($,be),Be&&xs($,Ae),Se;if(be===null){for(;!Ve.done;Ae++,Ve=V.next())Ve=ae($,Ve.value,ee),Ve!==null&&(q=h(Ve,q,Ae),Pe===null?Se=Ve:Pe.sibling=Ve,Pe=Ve);return Be&&xs($,Ae),Se}for(be=i(be);!Ve.done;Ae++,Ve=V.next())Ve=Q(be,$,Ae,Ve.value,ee),Ve!==null&&(e&&Ve.alternate!==null&&be.delete(Ve.key===null?Ae:Ve.key),q=h(Ve,q,Ae),Pe===null?Se=Ve:Pe.sibling=Ve,Pe=Ve);return e&&be.forEach(function(B_){return t($,B_)}),Be&&xs($,Ae),Se}function Je($,q,V,ee){if(typeof V=="object"&&V!==null&&V.type===k&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case T:e:{for(var Se=V.key;q!==null;){if(q.key===Se){if(Se=V.type,Se===k){if(q.tag===7){l($,q.sibling),ee=u(q,V.props.children),ee.return=$,$=ee;break e}}else if(q.elementType===Se||typeof Se=="object"&&Se!==null&&Se.$$typeof===I&&ka(Se)===q.type){l($,q.sibling),ee=u(q,V.props),lr(ee,V),ee.return=$,$=ee;break e}l($,q);break}else t($,q);q=q.sibling}V.type===k?(ee=_a(V.props.children,$.mode,ee,V.key),ee.return=$,$=ee):(ee=xi(V.type,V.key,V.props,null,$.mode,ee),lr(ee,V),ee.return=$,$=ee)}return b($);case w:e:{for(Se=V.key;q!==null;){if(q.key===Se)if(q.tag===4&&q.stateNode.containerInfo===V.containerInfo&&q.stateNode.implementation===V.implementation){l($,q.sibling),ee=u(q,V.children||[]),ee.return=$,$=ee;break e}else{l($,q);break}else t($,q);q=q.sibling}ee=jc(V,$.mode,ee),ee.return=$,$=ee}return b($);case I:return V=ka(V),Je($,q,V,ee)}if(ue(V))return me($,q,V,ee);if(J(V)){if(Se=J(V),typeof Se!="function")throw Error(o(150));return V=Se.call(V),we($,q,V,ee)}if(typeof V.then=="function")return Je($,q,wi(V),ee);if(V.$$typeof===L)return Je($,q,_i($,V),ee);ki($,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,q!==null&&q.tag===6?(l($,q.sibling),ee=u(q,V),ee.return=$,$=ee):(l($,q),ee=Tc(V,$.mode,ee),ee.return=$,$=ee),b($)):l($,q)}return function($,q,V,ee){try{ar=0;var Se=Je($,q,V,ee);return dl=null,Se}catch(be){if(be===ul||be===Ti)throw be;var Pe=sn(29,be,null,$.mode);return Pe.lanes=ee,Pe.return=$,Pe}finally{}}}var Ca=Lf(!0),qf=Lf(!1),Vs=!1;function qc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Mc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ys(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Fs(e,t,l){var i=e.updateQueue;if(i===null)return null;if(i=i.shared,(Ye&2)!==0){var u=i.pending;return u===null?t.next=t:(t.next=u.next,u.next=t),i.pending=t,t=yi(e),vf(e,null,l),t}return mi(e,i,t,l),yi(e)}function rr(e,t,l){if(t=t.updateQueue,t!==null&&(t=t.shared,(l&4194048)!==0)){var i=t.lanes;i&=e.pendingLanes,l|=i,t.lanes=l,ie(e,l)}}function Bc(e,t){var l=e.updateQueue,i=e.alternate;if(i!==null&&(i=i.updateQueue,l===i)){var u=null,h=null;if(l=l.firstBaseUpdate,l!==null){do{var b={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};h===null?u=h=b:h=h.next=b,l=l.next}while(l!==null);h===null?u=h=t:h=h.next=t}else u=h=t;l={baseState:i.baseState,firstBaseUpdate:u,lastBaseUpdate:h,shared:i.shared,callbacks:i.callbacks},e.updateQueue=l;return}e=l.lastBaseUpdate,e===null?l.firstBaseUpdate=t:e.next=t,l.lastBaseUpdate=t}var Ic=!1;function ir(){if(Ic){var e=cl;if(e!==null)throw e}}function or(e,t,l,i){Ic=!1;var u=e.updateQueue;Vs=!1;var h=u.firstBaseUpdate,b=u.lastBaseUpdate,E=u.shared.pending;if(E!==null){u.shared.pending=null;var O=E,Y=O.next;O.next=null,b===null?h=Y:b.next=Y,b=O;var Z=e.alternate;Z!==null&&(Z=Z.updateQueue,E=Z.lastBaseUpdate,E!==b&&(E===null?Z.firstBaseUpdate=Y:E.next=Y,Z.lastBaseUpdate=O))}if(h!==null){var ae=u.baseState;b=0,Z=Y=O=null,E=h;do{var F=E.lane&-536870913,Q=F!==E.lane;if(Q?(Le&F)===F:(i&F)===F){F!==0&&F===ol&&(Ic=!0),Z!==null&&(Z=Z.next={lane:0,tag:E.tag,payload:E.payload,callback:null,next:null});e:{var me=e,we=E;F=t;var Je=l;switch(we.tag){case 1:if(me=we.payload,typeof me=="function"){ae=me.call(Je,ae,F);break e}ae=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=we.payload,F=typeof me=="function"?me.call(Je,ae,F):me,F==null)break e;ae=S({},ae,F);break e;case 2:Vs=!0}}F=E.callback,F!==null&&(e.flags|=64,Q&&(e.flags|=8192),Q=u.callbacks,Q===null?u.callbacks=[F]:Q.push(F))}else Q={lane:F,tag:E.tag,payload:E.payload,callback:E.callback,next:null},Z===null?(Y=Z=Q,O=ae):Z=Z.next=Q,b|=F;if(E=E.next,E===null){if(E=u.shared.pending,E===null)break;Q=E,E=Q.next,Q.next=null,u.lastBaseUpdate=Q,u.shared.pending=null}}while(!0);Z===null&&(O=ae),u.baseState=O,u.firstBaseUpdate=Y,u.lastBaseUpdate=Z,h===null&&(u.shared.lanes=0),Js|=b,e.lanes=b,e.memoizedState=ae}}function Mf(e,t){if(typeof e!="function")throw Error(o(191,e));e.call(t)}function Bf(e,t){var l=e.callbacks;if(l!==null)for(e.callbacks=null,e=0;e<l.length;e++)Mf(l[e],t)}var hl=D(null),Ei=D(0);function If(e,t){e=Ns,ce(Ei,e),ce(hl,t),Ns=e|t.baseLanes}function Uc(){ce(Ei,Ns),ce(hl,hl.current)}function $c(){Ns=Ei.current,K(hl),K(Ei)}var an=D(null),jn=null;function Qs(e){var t=e.alternate;ce(pt,pt.current&1),ce(an,e),jn===null&&(t===null||hl.current!==null||t.memoizedState!==null)&&(jn=e)}function Hc(e){ce(pt,pt.current),ce(an,e),jn===null&&(jn=e)}function Uf(e){e.tag===22?(ce(pt,pt.current),ce(an,e),jn===null&&(jn=e)):Ks()}function Ks(){ce(pt,pt.current),ce(an,an.current)}function ln(e){K(an),jn===e&&(jn=null),K(pt)}var pt=D(0);function Ci(e){for(var t=e;t!==null;){if(t.tag===13){var l=t.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Qu(l)||Ku(l)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var _s=0,Ne=null,Xe=null,bt=null,Ni=!1,fl=!1,Na=!1,Ai=0,cr=0,pl=null,Cb=0;function dt(){throw Error(o(321))}function Gc(e,t){if(t===null)return!1;for(var l=0;l<t.length&&l<e.length;l++)if(!nn(e[l],t[l]))return!1;return!0}function Pc(e,t,l,i,u,h){return _s=h,Ne=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,B.H=e===null||e.memoizedState===null?Tp:lu,Na=!1,h=l(i,u),Na=!1,fl&&(h=Hf(t,l,i,u)),$f(e),h}function $f(e){B.H=hr;var t=Xe!==null&&Xe.next!==null;if(_s=0,bt=Xe=Ne=null,Ni=!1,cr=0,pl=null,t)throw Error(o(300));e===null||_t||(e=e.dependencies,e!==null&&bi(e)&&(_t=!0))}function Hf(e,t,l,i){Ne=e;var u=0;do{if(fl&&(pl=null),cr=0,fl=!1,25<=u)throw Error(o(301));if(u+=1,bt=Xe=null,e.updateQueue!=null){var h=e.updateQueue;h.lastEffect=null,h.events=null,h.stores=null,h.memoCache!=null&&(h.memoCache.index=0)}B.H=jp,h=t(l,i)}while(fl);return h}function Nb(){var e=B.H,t=e.useState()[0];return t=typeof t.then=="function"?ur(t):t,e=e.useState()[0],(Xe!==null?Xe.memoizedState:null)!==e&&(Ne.flags|=1024),t}function Vc(){var e=Ai!==0;return Ai=0,e}function Yc(e,t,l){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l}function Fc(e){if(Ni){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ni=!1}_s=0,bt=Xe=Ne=null,fl=!1,cr=Ai=0,pl=null}function Pt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bt===null?Ne.memoizedState=bt=e:bt=bt.next=e,bt}function gt(){if(Xe===null){var e=Ne.alternate;e=e!==null?e.memoizedState:null}else e=Xe.next;var t=bt===null?Ne.memoizedState:bt.next;if(t!==null)bt=t,Xe=e;else{if(e===null)throw Ne.alternate===null?Error(o(467)):Error(o(310));Xe=e,e={memoizedState:Xe.memoizedState,baseState:Xe.baseState,baseQueue:Xe.baseQueue,queue:Xe.queue,next:null},bt===null?Ne.memoizedState=bt=e:bt=bt.next=e}return bt}function Ri(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ur(e){var t=cr;return cr+=1,pl===null&&(pl=[]),e=zf(pl,e,t),t=Ne,(bt===null?t.memoizedState:bt.next)===null&&(t=t.alternate,B.H=t===null||t.memoizedState===null?Tp:lu),e}function zi(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return ur(e);if(e.$$typeof===L)return Ut(e)}throw Error(o(438,String(e)))}function Qc(e){var t=null,l=Ne.updateQueue;if(l!==null&&(t=l.memoCache),t==null){var i=Ne.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(t={data:i.data.map(function(u){return u.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),l===null&&(l=Ri(),Ne.updateQueue=l),l.memoCache=t,l=t.data[t.index],l===void 0)for(l=t.data[t.index]=Array(e),i=0;i<e;i++)l[i]=P;return t.index++,l}function Ss(e,t){return typeof t=="function"?t(e):t}function Di(e){var t=gt();return Kc(t,Xe,e)}function Kc(e,t,l){var i=e.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=l;var u=e.baseQueue,h=i.pending;if(h!==null){if(u!==null){var b=u.next;u.next=h.next,h.next=b}t.baseQueue=u=h,i.pending=null}if(h=e.baseState,u===null)e.memoizedState=h;else{t=u.next;var E=b=null,O=null,Y=t,Z=!1;do{var ae=Y.lane&-536870913;if(ae!==Y.lane?(Le&ae)===ae:(_s&ae)===ae){var F=Y.revertLane;if(F===0)O!==null&&(O=O.next={lane:0,revertLane:0,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null}),ae===ol&&(Z=!0);else if((_s&F)===F){Y=Y.next,F===ol&&(Z=!0);continue}else ae={lane:0,revertLane:Y.revertLane,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},O===null?(E=O=ae,b=h):O=O.next=ae,Ne.lanes|=F,Js|=F;ae=Y.action,Na&&l(h,ae),h=Y.hasEagerState?Y.eagerState:l(h,ae)}else F={lane:ae,revertLane:Y.revertLane,gesture:Y.gesture,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},O===null?(E=O=F,b=h):O=O.next=F,Ne.lanes|=ae,Js|=ae;Y=Y.next}while(Y!==null&&Y!==t);if(O===null?b=h:O.next=E,!nn(h,e.memoizedState)&&(_t=!0,Z&&(l=cl,l!==null)))throw l;e.memoizedState=h,e.baseState=b,e.baseQueue=O,i.lastRenderedState=h}return u===null&&(i.lanes=0),[e.memoizedState,i.dispatch]}function Xc(e){var t=gt(),l=t.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=e;var i=l.dispatch,u=l.pending,h=t.memoizedState;if(u!==null){l.pending=null;var b=u=u.next;do h=e(h,b.action),b=b.next;while(b!==u);nn(h,t.memoizedState)||(_t=!0),t.memoizedState=h,t.baseQueue===null&&(t.baseState=h),l.lastRenderedState=h}return[h,i]}function Gf(e,t,l){var i=Ne,u=gt(),h=Be;if(h){if(l===void 0)throw Error(o(407));l=l()}else l=t();var b=!nn((Xe||u).memoizedState,l);if(b&&(u.memoizedState=l,_t=!0),u=u.queue,Wc(Yf.bind(null,i,u,e),[e]),u.getSnapshot!==t||b||bt!==null&&bt.memoizedState.tag&1){if(i.flags|=2048,gl(9,{destroy:void 0},Vf.bind(null,i,u,l,t),null),tt===null)throw Error(o(349));h||(_s&127)!==0||Pf(i,t,l)}return l}function Pf(e,t,l){e.flags|=16384,e={getSnapshot:t,value:l},t=Ne.updateQueue,t===null?(t=Ri(),Ne.updateQueue=t,t.stores=[e]):(l=t.stores,l===null?t.stores=[e]:l.push(e))}function Vf(e,t,l,i){t.value=l,t.getSnapshot=i,Ff(t)&&Qf(e)}function Yf(e,t,l){return l(function(){Ff(t)&&Qf(e)})}function Ff(e){var t=e.getSnapshot;e=e.value;try{var l=t();return!nn(e,l)}catch{return!0}}function Qf(e){var t=ba(e,2);t!==null&&Jt(t,e,2)}function Zc(e){var t=Pt();if(typeof e=="function"){var l=e;if(e=l(),Na){mn(!0);try{l()}finally{mn(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ss,lastRenderedState:e},t}function Kf(e,t,l,i){return e.baseState=l,Kc(e,Xe,typeof i=="function"?i:Ss)}function Ab(e,t,l,i,u){if(qi(e))throw Error(o(485));if(e=t.action,e!==null){var h={payload:u,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){h.listeners.push(b)}};B.T!==null?l(!0):h.isTransition=!1,i(h),l=t.pending,l===null?(h.next=t.pending=h,Xf(t,h)):(h.next=l.next,t.pending=l.next=h)}}function Xf(e,t){var l=t.action,i=t.payload,u=e.state;if(t.isTransition){var h=B.T,b={};B.T=b;try{var E=l(u,i),O=B.S;O!==null&&O(b,E),Zf(e,t,E)}catch(Y){Jc(e,t,Y)}finally{h!==null&&b.types!==null&&(h.types=b.types),B.T=h}}else try{h=l(u,i),Zf(e,t,h)}catch(Y){Jc(e,t,Y)}}function Zf(e,t,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(i){Jf(e,t,i)},function(i){return Jc(e,t,i)}):Jf(e,t,l)}function Jf(e,t,l){t.status="fulfilled",t.value=l,Wf(t),e.state=l,t=e.pending,t!==null&&(l=t.next,l===t?e.pending=null:(l=l.next,t.next=l,Xf(e,l)))}function Jc(e,t,l){var i=e.pending;if(e.pending=null,i!==null){i=i.next;do t.status="rejected",t.reason=l,Wf(t),t=t.next;while(t!==i)}e.action=null}function Wf(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function ep(e,t){return t}function tp(e,t){if(Be){var l=tt.formState;if(l!==null){e:{var i=Ne;if(Be){if(st){t:{for(var u=st,h=Tn;u.nodeType!==8;){if(!h){u=null;break t}if(u=wn(u.nextSibling),u===null){u=null;break t}}h=u.data,u=h==="F!"||h==="F"?u:null}if(u){st=wn(u.nextSibling),i=u.data==="F!";break e}}Gs(i)}i=!1}i&&(t=l[0])}}return l=Pt(),l.memoizedState=l.baseState=t,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ep,lastRenderedState:t},l.queue=i,l=bp.bind(null,Ne,i),i.dispatch=l,i=Zc(!1),h=au.bind(null,Ne,!1,i.queue),i=Pt(),u={state:t,dispatch:null,action:e,pending:null},i.queue=u,l=Ab.bind(null,Ne,u,h,l),u.dispatch=l,i.memoizedState=e,[t,l,!1]}function np(e){var t=gt();return sp(t,Xe,e)}function sp(e,t,l){if(t=Kc(e,t,ep)[0],e=Di(Ss)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var i=ur(t)}catch(b){throw b===ul?Ti:b}else i=t;t=gt();var u=t.queue,h=u.dispatch;return l!==t.memoizedState&&(Ne.flags|=2048,gl(9,{destroy:void 0},Rb.bind(null,u,l),null)),[i,h,e]}function Rb(e,t){e.action=t}function ap(e){var t=gt(),l=Xe;if(l!==null)return sp(t,l,e);gt(),t=t.memoizedState,l=gt();var i=l.queue.dispatch;return l.memoizedState=e,[t,i,!1]}function gl(e,t,l,i){return e={tag:e,create:l,deps:i,inst:t,next:null},t=Ne.updateQueue,t===null&&(t=Ri(),Ne.updateQueue=t),l=t.lastEffect,l===null?t.lastEffect=e.next=e:(i=l.next,l.next=e,e.next=i,t.lastEffect=e),e}function lp(){return gt().memoizedState}function Oi(e,t,l,i){var u=Pt();Ne.flags|=e,u.memoizedState=gl(1|t,{destroy:void 0},l,i===void 0?null:i)}function Li(e,t,l,i){var u=gt();i=i===void 0?null:i;var h=u.memoizedState.inst;Xe!==null&&i!==null&&Gc(i,Xe.memoizedState.deps)?u.memoizedState=gl(t,h,l,i):(Ne.flags|=e,u.memoizedState=gl(1|t,h,l,i))}function rp(e,t){Oi(8390656,8,e,t)}function Wc(e,t){Li(2048,8,e,t)}function zb(e){Ne.flags|=4;var t=Ne.updateQueue;if(t===null)t=Ri(),Ne.updateQueue=t,t.events=[e];else{var l=t.events;l===null?t.events=[e]:l.push(e)}}function ip(e){var t=gt().memoizedState;return zb({ref:t,nextImpl:e}),function(){if((Ye&2)!==0)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function op(e,t){return Li(4,2,e,t)}function cp(e,t){return Li(4,4,e,t)}function up(e,t){if(typeof t=="function"){e=e();var l=t(e);return function(){typeof l=="function"?l():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function dp(e,t,l){l=l!=null?l.concat([e]):null,Li(4,4,up.bind(null,t,e),l)}function eu(){}function hp(e,t){var l=gt();t=t===void 0?null:t;var i=l.memoizedState;return t!==null&&Gc(t,i[1])?i[0]:(l.memoizedState=[e,t],e)}function fp(e,t){var l=gt();t=t===void 0?null:t;var i=l.memoizedState;if(t!==null&&Gc(t,i[1]))return i[0];if(i=e(),Na){mn(!0);try{e()}finally{mn(!1)}}return l.memoizedState=[i,t],i}function tu(e,t,l){return l===void 0||(_s&1073741824)!==0&&(Le&261930)===0?e.memoizedState=t:(e.memoizedState=l,e=pg(),Ne.lanes|=e,Js|=e,l)}function pp(e,t,l,i){return nn(l,t)?l:hl.current!==null?(e=tu(e,l,i),nn(e,t)||(_t=!0),e):(_s&42)===0||(_s&1073741824)!==0&&(Le&261930)===0?(_t=!0,e.memoizedState=l):(e=pg(),Ne.lanes|=e,Js|=e,t)}function gp(e,t,l,i,u){var h=re.p;re.p=h!==0&&8>h?h:8;var b=B.T,E={};B.T=E,au(e,!1,t,l);try{var O=u(),Y=B.S;if(Y!==null&&Y(E,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var Z=Eb(O,i);dr(e,t,Z,cn(e))}else dr(e,t,i,cn(e))}catch(ae){dr(e,t,{then:function(){},status:"rejected",reason:ae},cn())}finally{re.p=h,b!==null&&E.types!==null&&(b.types=E.types),B.T=b}}function Db(){}function nu(e,t,l,i){if(e.tag!==5)throw Error(o(476));var u=mp(e).queue;gp(e,u,t,he,l===null?Db:function(){return yp(e),l(i)})}function mp(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:he,baseState:he,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ss,lastRenderedState:he},next:null};var l={};return t.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ss,lastRenderedState:l},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function yp(e){var t=mp(e);t.next===null&&(t=e.alternate.memoizedState),dr(e,t.next.queue,{},cn())}function su(){return Ut(Cr)}function xp(){return gt().memoizedState}function vp(){return gt().memoizedState}function Ob(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var l=cn();e=Ys(l);var i=Fs(t,e,l);i!==null&&(Jt(i,t,l),rr(i,t,l)),t={cache:zc()},e.payload=t;return}t=t.return}}function Lb(e,t,l){var i=cn();l={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},qi(e)?_p(t,l):(l=_c(e,t,l,i),l!==null&&(Jt(l,e,i),Sp(l,t,i)))}function bp(e,t,l){var i=cn();dr(e,t,l,i)}function dr(e,t,l,i){var u={lane:i,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(qi(e))_p(t,u);else{var h=e.alternate;if(e.lanes===0&&(h===null||h.lanes===0)&&(h=t.lastRenderedReducer,h!==null))try{var b=t.lastRenderedState,E=h(b,l);if(u.hasEagerState=!0,u.eagerState=E,nn(E,b))return mi(e,t,u,0),tt===null&&gi(),!1}catch{}finally{}if(l=_c(e,t,u,i),l!==null)return Jt(l,e,i),Sp(l,t,i),!0}return!1}function au(e,t,l,i){if(i={lane:2,revertLane:qu(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},qi(e)){if(t)throw Error(o(479))}else t=_c(e,l,i,2),t!==null&&Jt(t,e,2)}function qi(e){var t=e.alternate;return e===Ne||t!==null&&t===Ne}function _p(e,t){fl=Ni=!0;var l=e.pending;l===null?t.next=t:(t.next=l.next,l.next=t),e.pending=t}function Sp(e,t,l){if((l&4194048)!==0){var i=t.lanes;i&=e.pendingLanes,l|=i,t.lanes=l,ie(e,l)}}var hr={readContext:Ut,use:zi,useCallback:dt,useContext:dt,useEffect:dt,useImperativeHandle:dt,useLayoutEffect:dt,useInsertionEffect:dt,useMemo:dt,useReducer:dt,useRef:dt,useState:dt,useDebugValue:dt,useDeferredValue:dt,useTransition:dt,useSyncExternalStore:dt,useId:dt,useHostTransitionStatus:dt,useFormState:dt,useActionState:dt,useOptimistic:dt,useMemoCache:dt,useCacheRefresh:dt};hr.useEffectEvent=dt;var Tp={readContext:Ut,use:zi,useCallback:function(e,t){return Pt().memoizedState=[e,t===void 0?null:t],e},useContext:Ut,useEffect:rp,useImperativeHandle:function(e,t,l){l=l!=null?l.concat([e]):null,Oi(4194308,4,up.bind(null,t,e),l)},useLayoutEffect:function(e,t){return Oi(4194308,4,e,t)},useInsertionEffect:function(e,t){Oi(4,2,e,t)},useMemo:function(e,t){var l=Pt();t=t===void 0?null:t;var i=e();if(Na){mn(!0);try{e()}finally{mn(!1)}}return l.memoizedState=[i,t],i},useReducer:function(e,t,l){var i=Pt();if(l!==void 0){var u=l(t);if(Na){mn(!0);try{l(t)}finally{mn(!1)}}}else u=t;return i.memoizedState=i.baseState=u,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:u},i.queue=e,e=e.dispatch=Lb.bind(null,Ne,e),[i.memoizedState,e]},useRef:function(e){var t=Pt();return e={current:e},t.memoizedState=e},useState:function(e){e=Zc(e);var t=e.queue,l=bp.bind(null,Ne,t);return t.dispatch=l,[e.memoizedState,l]},useDebugValue:eu,useDeferredValue:function(e,t){var l=Pt();return tu(l,e,t)},useTransition:function(){var e=Zc(!1);return e=gp.bind(null,Ne,e.queue,!0,!1),Pt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,l){var i=Ne,u=Pt();if(Be){if(l===void 0)throw Error(o(407));l=l()}else{if(l=t(),tt===null)throw Error(o(349));(Le&127)!==0||Pf(i,t,l)}u.memoizedState=l;var h={value:l,getSnapshot:t};return u.queue=h,rp(Yf.bind(null,i,h,e),[e]),i.flags|=2048,gl(9,{destroy:void 0},Vf.bind(null,i,h,l,t),null),l},useId:function(){var e=Pt(),t=tt.identifierPrefix;if(Be){var l=Wn,i=Jn;l=(i&~(1<<32-Bt(i)-1)).toString(32)+l,t="_"+t+"R_"+l,l=Ai++,0<l&&(t+="H"+l.toString(32)),t+="_"}else l=Cb++,t="_"+t+"r_"+l.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:su,useFormState:tp,useActionState:tp,useOptimistic:function(e){var t=Pt();t.memoizedState=t.baseState=e;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=l,t=au.bind(null,Ne,!0,l),l.dispatch=t,[e,t]},useMemoCache:Qc,useCacheRefresh:function(){return Pt().memoizedState=Ob.bind(null,Ne)},useEffectEvent:function(e){var t=Pt(),l={impl:e};return t.memoizedState=l,function(){if((Ye&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},lu={readContext:Ut,use:zi,useCallback:hp,useContext:Ut,useEffect:Wc,useImperativeHandle:dp,useInsertionEffect:op,useLayoutEffect:cp,useMemo:fp,useReducer:Di,useRef:lp,useState:function(){return Di(Ss)},useDebugValue:eu,useDeferredValue:function(e,t){var l=gt();return pp(l,Xe.memoizedState,e,t)},useTransition:function(){var e=Di(Ss)[0],t=gt().memoizedState;return[typeof e=="boolean"?e:ur(e),t]},useSyncExternalStore:Gf,useId:xp,useHostTransitionStatus:su,useFormState:np,useActionState:np,useOptimistic:function(e,t){var l=gt();return Kf(l,Xe,e,t)},useMemoCache:Qc,useCacheRefresh:vp};lu.useEffectEvent=ip;var jp={readContext:Ut,use:zi,useCallback:hp,useContext:Ut,useEffect:Wc,useImperativeHandle:dp,useInsertionEffect:op,useLayoutEffect:cp,useMemo:fp,useReducer:Xc,useRef:lp,useState:function(){return Xc(Ss)},useDebugValue:eu,useDeferredValue:function(e,t){var l=gt();return Xe===null?tu(l,e,t):pp(l,Xe.memoizedState,e,t)},useTransition:function(){var e=Xc(Ss)[0],t=gt().memoizedState;return[typeof e=="boolean"?e:ur(e),t]},useSyncExternalStore:Gf,useId:xp,useHostTransitionStatus:su,useFormState:ap,useActionState:ap,useOptimistic:function(e,t){var l=gt();return Xe!==null?Kf(l,Xe,e,t):(l.baseState=e,[e,l.queue.dispatch])},useMemoCache:Qc,useCacheRefresh:vp};jp.useEffectEvent=ip;function ru(e,t,l,i){t=e.memoizedState,l=l(i,t),l=l==null?t:S({},t,l),e.memoizedState=l,e.lanes===0&&(e.updateQueue.baseState=l)}var iu={enqueueSetState:function(e,t,l){e=e._reactInternals;var i=cn(),u=Ys(i);u.payload=t,l!=null&&(u.callback=l),t=Fs(e,u,i),t!==null&&(Jt(t,e,i),rr(t,e,i))},enqueueReplaceState:function(e,t,l){e=e._reactInternals;var i=cn(),u=Ys(i);u.tag=1,u.payload=t,l!=null&&(u.callback=l),t=Fs(e,u,i),t!==null&&(Jt(t,e,i),rr(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var l=cn(),i=Ys(l);i.tag=2,t!=null&&(i.callback=t),t=Fs(e,i,l),t!==null&&(Jt(t,e,l),rr(t,e,l))}};function wp(e,t,l,i,u,h,b){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(i,h,b):t.prototype&&t.prototype.isPureReactComponent?!Jl(l,i)||!Jl(u,h):!0}function kp(e,t,l,i){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(l,i),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(l,i),t.state!==e&&iu.enqueueReplaceState(t,t.state,null)}function Aa(e,t){var l=t;if("ref"in t){l={};for(var i in t)i!=="ref"&&(l[i]=t[i])}if(e=e.defaultProps){l===t&&(l=S({},l));for(var u in e)l[u]===void 0&&(l[u]=e[u])}return l}function Ep(e){pi(e)}function Cp(e){console.error(e)}function Np(e){pi(e)}function Mi(e,t){try{var l=e.onUncaughtError;l(t.value,{componentStack:t.stack})}catch(i){setTimeout(function(){throw i})}}function Ap(e,t,l){try{var i=e.onCaughtError;i(l.value,{componentStack:l.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(u){setTimeout(function(){throw u})}}function ou(e,t,l){return l=Ys(l),l.tag=3,l.payload={element:null},l.callback=function(){Mi(e,t)},l}function Rp(e){return e=Ys(e),e.tag=3,e}function zp(e,t,l,i){var u=l.type.getDerivedStateFromError;if(typeof u=="function"){var h=i.value;e.payload=function(){return u(h)},e.callback=function(){Ap(t,l,i)}}var b=l.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(e.callback=function(){Ap(t,l,i),typeof u!="function"&&(Ws===null?Ws=new Set([this]):Ws.add(this));var E=i.stack;this.componentDidCatch(i.value,{componentStack:E!==null?E:""})})}function qb(e,t,l,i,u){if(l.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(t=l.alternate,t!==null&&il(t,l,u,!0),l=an.current,l!==null){switch(l.tag){case 31:case 13:return jn===null?Ki():l.alternate===null&&ht===0&&(ht=3),l.flags&=-257,l.flags|=65536,l.lanes=u,i===ji?l.flags|=16384:(t=l.updateQueue,t===null?l.updateQueue=new Set([i]):t.add(i),Du(e,i,u)),!1;case 22:return l.flags|=65536,i===ji?l.flags|=16384:(t=l.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([i])},l.updateQueue=t):(l=t.retryQueue,l===null?t.retryQueue=new Set([i]):l.add(i)),Du(e,i,u)),!1}throw Error(o(435,l.tag))}return Du(e,i,u),Ki(),!1}if(Be)return t=an.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=u,i!==Ec&&(e=Error(o(422),{cause:i}),tr(bn(e,l)))):(i!==Ec&&(t=Error(o(423),{cause:i}),tr(bn(t,l))),e=e.current.alternate,e.flags|=65536,u&=-u,e.lanes|=u,i=bn(i,l),u=ou(e.stateNode,i,u),Bc(e,u),ht!==4&&(ht=2)),!1;var h=Error(o(520),{cause:i});if(h=bn(h,l),br===null?br=[h]:br.push(h),ht!==4&&(ht=2),t===null)return!0;i=bn(i,l),l=t;do{switch(l.tag){case 3:return l.flags|=65536,e=u&-u,l.lanes|=e,e=ou(l.stateNode,i,e),Bc(l,e),!1;case 1:if(t=l.type,h=l.stateNode,(l.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||h!==null&&typeof h.componentDidCatch=="function"&&(Ws===null||!Ws.has(h))))return l.flags|=65536,u&=-u,l.lanes|=u,u=Rp(u),zp(u,e,l,i),Bc(l,u),!1}l=l.return}while(l!==null);return!1}var cu=Error(o(461)),_t=!1;function $t(e,t,l,i){t.child=e===null?qf(t,null,l,i):Ca(t,e.child,l,i)}function Dp(e,t,l,i,u){l=l.render;var h=t.ref;if("ref"in i){var b={};for(var E in i)E!=="ref"&&(b[E]=i[E])}else b=i;return ja(t),i=Pc(e,t,l,b,h,u),E=Vc(),e!==null&&!_t?(Yc(e,t,u),Ts(e,t,u)):(Be&&E&&wc(t),t.flags|=1,$t(e,t,i,u),t.child)}function Op(e,t,l,i,u){if(e===null){var h=l.type;return typeof h=="function"&&!Sc(h)&&h.defaultProps===void 0&&l.compare===null?(t.tag=15,t.type=h,Lp(e,t,h,i,u)):(e=xi(l.type,null,i,t,t.mode,u),e.ref=t.ref,e.return=t,t.child=e)}if(h=e.child,!yu(e,u)){var b=h.memoizedProps;if(l=l.compare,l=l!==null?l:Jl,l(b,i)&&e.ref===t.ref)return Ts(e,t,u)}return t.flags|=1,e=ys(h,i),e.ref=t.ref,e.return=t,t.child=e}function Lp(e,t,l,i,u){if(e!==null){var h=e.memoizedProps;if(Jl(h,i)&&e.ref===t.ref)if(_t=!1,t.pendingProps=i=h,yu(e,u))(e.flags&131072)!==0&&(_t=!0);else return t.lanes=e.lanes,Ts(e,t,u)}return uu(e,t,l,i,u)}function qp(e,t,l,i){var u=i.children,h=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((t.flags&128)!==0){if(h=h!==null?h.baseLanes|l:l,e!==null){for(i=t.child=e.child,u=0;i!==null;)u=u|i.lanes|i.childLanes,i=i.sibling;i=u&~h}else i=0,t.child=null;return Mp(e,t,h,l,i)}if((l&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Si(t,h!==null?h.cachePool:null),h!==null?If(t,h):Uc(),Uf(t);else return i=t.lanes=536870912,Mp(e,t,h!==null?h.baseLanes|l:l,l,i)}else h!==null?(Si(t,h.cachePool),If(t,h),Ks(),t.memoizedState=null):(e!==null&&Si(t,null),Uc(),Ks());return $t(e,t,u,l),t.child}function fr(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Mp(e,t,l,i,u){var h=Oc();return h=h===null?null:{parent:vt._currentValue,pool:h},t.memoizedState={baseLanes:l,cachePool:h},e!==null&&Si(t,null),Uc(),Uf(t),e!==null&&il(e,t,i,!0),t.childLanes=u,null}function Bi(e,t){return t=Ui({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Bp(e,t,l){return Ca(t,e.child,null,l),e=Bi(t,t.pendingProps),e.flags|=2,ln(t),t.memoizedState=null,e}function Mb(e,t,l){var i=t.pendingProps,u=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Be){if(i.mode==="hidden")return e=Bi(t,i),t.lanes=536870912,fr(null,e);if(Hc(t),(e=st)?(e=Xg(e,Tn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:$s!==null?{id:Jn,overflow:Wn}:null,retryLane:536870912,hydrationErrors:null},l=_f(e),l.return=t,t.child=l,It=t,st=null)):e=null,e===null)throw Gs(t);return t.lanes=536870912,null}return Bi(t,i)}var h=e.memoizedState;if(h!==null){var b=h.dehydrated;if(Hc(t),u)if(t.flags&256)t.flags&=-257,t=Bp(e,t,l);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(_t||il(e,t,l,!1),u=(l&e.childLanes)!==0,_t||u){if(i=tt,i!==null&&(b=ye(i,l),b!==0&&b!==h.retryLane))throw h.retryLane=b,ba(e,b),Jt(i,e,b),cu;Ki(),t=Bp(e,t,l)}else e=h.treeContext,st=wn(b.nextSibling),It=t,Be=!0,Hs=null,Tn=!1,e!==null&&jf(t,e),t=Bi(t,i),t.flags|=4096;return t}return e=ys(e.child,{mode:i.mode,children:i.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Ii(e,t){var l=t.ref;if(l===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(o(284));(e===null||e.ref!==l)&&(t.flags|=4194816)}}function uu(e,t,l,i,u){return ja(t),l=Pc(e,t,l,i,void 0,u),i=Vc(),e!==null&&!_t?(Yc(e,t,u),Ts(e,t,u)):(Be&&i&&wc(t),t.flags|=1,$t(e,t,l,u),t.child)}function Ip(e,t,l,i,u,h){return ja(t),t.updateQueue=null,l=Hf(t,i,l,u),$f(e),i=Vc(),e!==null&&!_t?(Yc(e,t,h),Ts(e,t,h)):(Be&&i&&wc(t),t.flags|=1,$t(e,t,l,h),t.child)}function Up(e,t,l,i,u){if(ja(t),t.stateNode===null){var h=sl,b=l.contextType;typeof b=="object"&&b!==null&&(h=Ut(b)),h=new l(i,h),t.memoizedState=h.state!==null&&h.state!==void 0?h.state:null,h.updater=iu,t.stateNode=h,h._reactInternals=t,h=t.stateNode,h.props=i,h.state=t.memoizedState,h.refs={},qc(t),b=l.contextType,h.context=typeof b=="object"&&b!==null?Ut(b):sl,h.state=t.memoizedState,b=l.getDerivedStateFromProps,typeof b=="function"&&(ru(t,l,b,i),h.state=t.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof h.getSnapshotBeforeUpdate=="function"||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(b=h.state,typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount(),b!==h.state&&iu.enqueueReplaceState(h,h.state,null),or(t,i,h,u),ir(),h.state=t.memoizedState),typeof h.componentDidMount=="function"&&(t.flags|=4194308),i=!0}else if(e===null){h=t.stateNode;var E=t.memoizedProps,O=Aa(l,E);h.props=O;var Y=h.context,Z=l.contextType;b=sl,typeof Z=="object"&&Z!==null&&(b=Ut(Z));var ae=l.getDerivedStateFromProps;Z=typeof ae=="function"||typeof h.getSnapshotBeforeUpdate=="function",E=t.pendingProps!==E,Z||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(E||Y!==b)&&kp(t,h,i,b),Vs=!1;var F=t.memoizedState;h.state=F,or(t,i,h,u),ir(),Y=t.memoizedState,E||F!==Y||Vs?(typeof ae=="function"&&(ru(t,l,ae,i),Y=t.memoizedState),(O=Vs||wp(t,l,O,i,F,Y,b))?(Z||typeof h.UNSAFE_componentWillMount!="function"&&typeof h.componentWillMount!="function"||(typeof h.componentWillMount=="function"&&h.componentWillMount(),typeof h.UNSAFE_componentWillMount=="function"&&h.UNSAFE_componentWillMount()),typeof h.componentDidMount=="function"&&(t.flags|=4194308)):(typeof h.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=i,t.memoizedState=Y),h.props=i,h.state=Y,h.context=b,i=O):(typeof h.componentDidMount=="function"&&(t.flags|=4194308),i=!1)}else{h=t.stateNode,Mc(e,t),b=t.memoizedProps,Z=Aa(l,b),h.props=Z,ae=t.pendingProps,F=h.context,Y=l.contextType,O=sl,typeof Y=="object"&&Y!==null&&(O=Ut(Y)),E=l.getDerivedStateFromProps,(Y=typeof E=="function"||typeof h.getSnapshotBeforeUpdate=="function")||typeof h.UNSAFE_componentWillReceiveProps!="function"&&typeof h.componentWillReceiveProps!="function"||(b!==ae||F!==O)&&kp(t,h,i,O),Vs=!1,F=t.memoizedState,h.state=F,or(t,i,h,u),ir();var Q=t.memoizedState;b!==ae||F!==Q||Vs||e!==null&&e.dependencies!==null&&bi(e.dependencies)?(typeof E=="function"&&(ru(t,l,E,i),Q=t.memoizedState),(Z=Vs||wp(t,l,Z,i,F,Q,O)||e!==null&&e.dependencies!==null&&bi(e.dependencies))?(Y||typeof h.UNSAFE_componentWillUpdate!="function"&&typeof h.componentWillUpdate!="function"||(typeof h.componentWillUpdate=="function"&&h.componentWillUpdate(i,Q,O),typeof h.UNSAFE_componentWillUpdate=="function"&&h.UNSAFE_componentWillUpdate(i,Q,O)),typeof h.componentDidUpdate=="function"&&(t.flags|=4),typeof h.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof h.componentDidUpdate!="function"||b===e.memoizedProps&&F===e.memoizedState||(t.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&F===e.memoizedState||(t.flags|=1024),t.memoizedProps=i,t.memoizedState=Q),h.props=i,h.state=Q,h.context=O,i=Z):(typeof h.componentDidUpdate!="function"||b===e.memoizedProps&&F===e.memoizedState||(t.flags|=4),typeof h.getSnapshotBeforeUpdate!="function"||b===e.memoizedProps&&F===e.memoizedState||(t.flags|=1024),i=!1)}return h=i,Ii(e,t),i=(t.flags&128)!==0,h||i?(h=t.stateNode,l=i&&typeof l.getDerivedStateFromError!="function"?null:h.render(),t.flags|=1,e!==null&&i?(t.child=Ca(t,e.child,null,u),t.child=Ca(t,null,l,u)):$t(e,t,l,u),t.memoizedState=h.state,e=t.child):e=Ts(e,t,u),e}function $p(e,t,l,i){return Sa(),t.flags|=256,$t(e,t,l,i),t.child}var du={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hu(e){return{baseLanes:e,cachePool:Af()}}function fu(e,t,l){return e=e!==null?e.childLanes&~l:0,t&&(e|=on),e}function Hp(e,t,l){var i=t.pendingProps,u=!1,h=(t.flags&128)!==0,b;if((b=h)||(b=e!==null&&e.memoizedState===null?!1:(pt.current&2)!==0),b&&(u=!0,t.flags&=-129),b=(t.flags&32)!==0,t.flags&=-33,e===null){if(Be){if(u?Qs(t):Ks(),(e=st)?(e=Xg(e,Tn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:$s!==null?{id:Jn,overflow:Wn}:null,retryLane:536870912,hydrationErrors:null},l=_f(e),l.return=t,t.child=l,It=t,st=null)):e=null,e===null)throw Gs(t);return Ku(e)?t.lanes=32:t.lanes=536870912,null}var E=i.children;return i=i.fallback,u?(Ks(),u=t.mode,E=Ui({mode:"hidden",children:E},u),i=_a(i,u,l,null),E.return=t,i.return=t,E.sibling=i,t.child=E,i=t.child,i.memoizedState=hu(l),i.childLanes=fu(e,b,l),t.memoizedState=du,fr(null,i)):(Qs(t),pu(t,E))}var O=e.memoizedState;if(O!==null&&(E=O.dehydrated,E!==null)){if(h)t.flags&256?(Qs(t),t.flags&=-257,t=gu(e,t,l)):t.memoizedState!==null?(Ks(),t.child=e.child,t.flags|=128,t=null):(Ks(),E=i.fallback,u=t.mode,i=Ui({mode:"visible",children:i.children},u),E=_a(E,u,l,null),E.flags|=2,i.return=t,E.return=t,i.sibling=E,t.child=i,Ca(t,e.child,null,l),i=t.child,i.memoizedState=hu(l),i.childLanes=fu(e,b,l),t.memoizedState=du,t=fr(null,i));else if(Qs(t),Ku(E)){if(b=E.nextSibling&&E.nextSibling.dataset,b)var Y=b.dgst;b=Y,i=Error(o(419)),i.stack="",i.digest=b,tr({value:i,source:null,stack:null}),t=gu(e,t,l)}else if(_t||il(e,t,l,!1),b=(l&e.childLanes)!==0,_t||b){if(b=tt,b!==null&&(i=ye(b,l),i!==0&&i!==O.retryLane))throw O.retryLane=i,ba(e,i),Jt(b,e,i),cu;Qu(E)||Ki(),t=gu(e,t,l)}else Qu(E)?(t.flags|=192,t.child=e.child,t=null):(e=O.treeContext,st=wn(E.nextSibling),It=t,Be=!0,Hs=null,Tn=!1,e!==null&&jf(t,e),t=pu(t,i.children),t.flags|=4096);return t}return u?(Ks(),E=i.fallback,u=t.mode,O=e.child,Y=O.sibling,i=ys(O,{mode:"hidden",children:i.children}),i.subtreeFlags=O.subtreeFlags&65011712,Y!==null?E=ys(Y,E):(E=_a(E,u,l,null),E.flags|=2),E.return=t,i.return=t,i.sibling=E,t.child=i,fr(null,i),i=t.child,E=e.child.memoizedState,E===null?E=hu(l):(u=E.cachePool,u!==null?(O=vt._currentValue,u=u.parent!==O?{parent:O,pool:O}:u):u=Af(),E={baseLanes:E.baseLanes|l,cachePool:u}),i.memoizedState=E,i.childLanes=fu(e,b,l),t.memoizedState=du,fr(e.child,i)):(Qs(t),l=e.child,e=l.sibling,l=ys(l,{mode:"visible",children:i.children}),l.return=t,l.sibling=null,e!==null&&(b=t.deletions,b===null?(t.deletions=[e],t.flags|=16):b.push(e)),t.child=l,t.memoizedState=null,l)}function pu(e,t){return t=Ui({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function Ui(e,t){return e=sn(22,e,null,t),e.lanes=0,e}function gu(e,t,l){return Ca(t,e.child,null,l),e=pu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Gp(e,t,l){e.lanes|=t;var i=e.alternate;i!==null&&(i.lanes|=t),Ac(e.return,t,l)}function mu(e,t,l,i,u,h){var b=e.memoizedState;b===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:i,tail:l,tailMode:u,treeForkCount:h}:(b.isBackwards=t,b.rendering=null,b.renderingStartTime=0,b.last=i,b.tail=l,b.tailMode=u,b.treeForkCount=h)}function Pp(e,t,l){var i=t.pendingProps,u=i.revealOrder,h=i.tail;i=i.children;var b=pt.current,E=(b&2)!==0;if(E?(b=b&1|2,t.flags|=128):b&=1,ce(pt,b),$t(e,t,i,l),i=Be?er:0,!E&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Gp(e,l,t);else if(e.tag===19)Gp(e,l,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(u){case"forwards":for(l=t.child,u=null;l!==null;)e=l.alternate,e!==null&&Ci(e)===null&&(u=l),l=l.sibling;l=u,l===null?(u=t.child,t.child=null):(u=l.sibling,l.sibling=null),mu(t,!1,u,l,h,i);break;case"backwards":case"unstable_legacy-backwards":for(l=null,u=t.child,t.child=null;u!==null;){if(e=u.alternate,e!==null&&Ci(e)===null){t.child=u;break}e=u.sibling,u.sibling=l,l=u,u=e}mu(t,!0,l,null,h,i);break;case"together":mu(t,!1,null,null,void 0,i);break;default:t.memoizedState=null}return t.child}function Ts(e,t,l){if(e!==null&&(t.dependencies=e.dependencies),Js|=t.lanes,(l&t.childLanes)===0)if(e!==null){if(il(e,t,l,!1),(l&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,l=ys(e,e.pendingProps),t.child=l,l.return=t;e.sibling!==null;)e=e.sibling,l=l.sibling=ys(e,e.pendingProps),l.return=t;l.sibling=null}return t.child}function yu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&bi(e)))}function Bb(e,t,l){switch(t.tag){case 3:_e(t,t.stateNode.containerInfo),Ps(t,vt,e.memoizedState.cache),Sa();break;case 27:case 5:mt(t);break;case 4:_e(t,t.stateNode.containerInfo);break;case 10:Ps(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,Hc(t),null;break;case 13:var i=t.memoizedState;if(i!==null)return i.dehydrated!==null?(Qs(t),t.flags|=128,null):(l&t.child.childLanes)!==0?Hp(e,t,l):(Qs(t),e=Ts(e,t,l),e!==null?e.sibling:null);Qs(t);break;case 19:var u=(e.flags&128)!==0;if(i=(l&t.childLanes)!==0,i||(il(e,t,l,!1),i=(l&t.childLanes)!==0),u){if(i)return Pp(e,t,l);t.flags|=128}if(u=t.memoizedState,u!==null&&(u.rendering=null,u.tail=null,u.lastEffect=null),ce(pt,pt.current),i)break;return null;case 22:return t.lanes=0,qp(e,t,l,t.pendingProps);case 24:Ps(t,vt,e.memoizedState.cache)}return Ts(e,t,l)}function Vp(e,t,l){if(e!==null)if(e.memoizedProps!==t.pendingProps)_t=!0;else{if(!yu(e,l)&&(t.flags&128)===0)return _t=!1,Bb(e,t,l);_t=(e.flags&131072)!==0}else _t=!1,Be&&(t.flags&1048576)!==0&&Tf(t,er,t.index);switch(t.lanes=0,t.tag){case 16:e:{var i=t.pendingProps;if(e=ka(t.elementType),t.type=e,typeof e=="function")Sc(e)?(i=Aa(e,i),t.tag=1,t=Up(null,t,e,i,l)):(t.tag=0,t=uu(null,t,e,i,l));else{if(e!=null){var u=e.$$typeof;if(u===N){t.tag=11,t=Dp(null,t,e,i,l);break e}else if(u===z){t.tag=14,t=Op(null,t,e,i,l);break e}}throw t=te(e)||e,Error(o(306,t,""))}}return t;case 0:return uu(e,t,t.type,t.pendingProps,l);case 1:return i=t.type,u=Aa(i,t.pendingProps),Up(e,t,i,u,l);case 3:e:{if(_e(t,t.stateNode.containerInfo),e===null)throw Error(o(387));i=t.pendingProps;var h=t.memoizedState;u=h.element,Mc(e,t),or(t,i,null,l);var b=t.memoizedState;if(i=b.cache,Ps(t,vt,i),i!==h.cache&&Rc(t,[vt],l,!0),ir(),i=b.element,h.isDehydrated)if(h={element:i,isDehydrated:!1,cache:b.cache},t.updateQueue.baseState=h,t.memoizedState=h,t.flags&256){t=$p(e,t,i,l);break e}else if(i!==u){u=bn(Error(o(424)),t),tr(u),t=$p(e,t,i,l);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(st=wn(e.firstChild),It=t,Be=!0,Hs=null,Tn=!0,l=qf(t,null,i,l),t.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Sa(),i===u){t=Ts(e,t,l);break e}$t(e,t,i,l)}t=t.child}return t;case 26:return Ii(e,t),e===null?(l=nm(t.type,null,t.pendingProps,null))?t.memoizedState=l:Be||(l=t.type,e=t.pendingProps,i=no(ne.current).createElement(l),i[Et]=t,i[Yt]=e,Ht(i,l,e),Rt(i),t.stateNode=i):t.memoizedState=nm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return mt(t),e===null&&Be&&(i=t.stateNode=Wg(t.type,t.pendingProps,ne.current),It=t,Tn=!0,u=st,sa(t.type)?(Xu=u,st=wn(i.firstChild)):st=u),$t(e,t,t.pendingProps.children,l),Ii(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Be&&((u=i=st)&&(i=p_(i,t.type,t.pendingProps,Tn),i!==null?(t.stateNode=i,It=t,st=wn(i.firstChild),Tn=!1,u=!0):u=!1),u||Gs(t)),mt(t),u=t.type,h=t.pendingProps,b=e!==null?e.memoizedProps:null,i=h.children,Vu(u,h)?i=null:b!==null&&Vu(u,b)&&(t.flags|=32),t.memoizedState!==null&&(u=Pc(e,t,Nb,null,null,l),Cr._currentValue=u),Ii(e,t),$t(e,t,i,l),t.child;case 6:return e===null&&Be&&((e=l=st)&&(l=g_(l,t.pendingProps,Tn),l!==null?(t.stateNode=l,It=t,st=null,e=!0):e=!1),e||Gs(t)),null;case 13:return Hp(e,t,l);case 4:return _e(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Ca(t,null,i,l):$t(e,t,i,l),t.child;case 11:return Dp(e,t,t.type,t.pendingProps,l);case 7:return $t(e,t,t.pendingProps,l),t.child;case 8:return $t(e,t,t.pendingProps.children,l),t.child;case 12:return $t(e,t,t.pendingProps.children,l),t.child;case 10:return i=t.pendingProps,Ps(t,t.type,i.value),$t(e,t,i.children,l),t.child;case 9:return u=t.type._context,i=t.pendingProps.children,ja(t),u=Ut(u),i=i(u),t.flags|=1,$t(e,t,i,l),t.child;case 14:return Op(e,t,t.type,t.pendingProps,l);case 15:return Lp(e,t,t.type,t.pendingProps,l);case 19:return Pp(e,t,l);case 31:return Mb(e,t,l);case 22:return qp(e,t,l,t.pendingProps);case 24:return ja(t),i=Ut(vt),e===null?(u=Oc(),u===null&&(u=tt,h=zc(),u.pooledCache=h,h.refCount++,h!==null&&(u.pooledCacheLanes|=l),u=h),t.memoizedState={parent:i,cache:u},qc(t),Ps(t,vt,u)):((e.lanes&l)!==0&&(Mc(e,t),or(t,null,null,l),ir()),u=e.memoizedState,h=t.memoizedState,u.parent!==i?(u={parent:i,cache:i},t.memoizedState=u,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=u),Ps(t,vt,i)):(i=h.cache,Ps(t,vt,i),i!==u.cache&&Rc(t,[vt],l,!0))),$t(e,t,t.pendingProps.children,l),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function js(e){e.flags|=4}function xu(e,t,l,i,u){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(u&335544128)===u)if(e.stateNode.complete)e.flags|=8192;else if(xg())e.flags|=8192;else throw Ea=ji,Lc}else e.flags&=-16777217}function Yp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!im(t))if(xg())e.flags|=8192;else throw Ea=ji,Lc}function $i(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Ke():536870912,e.lanes|=t,vl|=t)}function pr(e,t){if(!Be)switch(e.tailMode){case"hidden":t=e.tail;for(var l=null;t!==null;)t.alternate!==null&&(l=t),t=t.sibling;l===null?e.tail=null:l.sibling=null;break;case"collapsed":l=e.tail;for(var i=null;l!==null;)l.alternate!==null&&(i=l),l=l.sibling;i===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:i.sibling=null}}function at(e){var t=e.alternate!==null&&e.alternate.child===e.child,l=0,i=0;if(t)for(var u=e.child;u!==null;)l|=u.lanes|u.childLanes,i|=u.subtreeFlags&65011712,i|=u.flags&65011712,u.return=e,u=u.sibling;else for(u=e.child;u!==null;)l|=u.lanes|u.childLanes,i|=u.subtreeFlags,i|=u.flags,u.return=e,u=u.sibling;return e.subtreeFlags|=i,e.childLanes=l,t}function Ib(e,t,l){var i=t.pendingProps;switch(kc(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return at(t),null;case 1:return at(t),null;case 3:return l=t.stateNode,i=null,e!==null&&(i=e.memoizedState.cache),t.memoizedState.cache!==i&&(t.flags|=2048),bs(vt),ze(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(rl(t)?js(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Cc())),at(t),null;case 26:var u=t.type,h=t.memoizedState;return e===null?(js(t),h!==null?(at(t),Yp(t,h)):(at(t),xu(t,u,null,i,l))):h?h!==e.memoizedState?(js(t),at(t),Yp(t,h)):(at(t),t.flags&=-16777217):(e=e.memoizedProps,e!==i&&js(t),at(t),xu(t,u,e,i,l)),null;case 27:if(fn(t),l=ne.current,u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&js(t);else{if(!i){if(t.stateNode===null)throw Error(o(166));return at(t),null}e=de.current,rl(t)?wf(t):(e=Wg(u,i,l),t.stateNode=e,js(t))}return at(t),null;case 5:if(fn(t),u=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==i&&js(t);else{if(!i){if(t.stateNode===null)throw Error(o(166));return at(t),null}if(h=de.current,rl(t))wf(t);else{var b=no(ne.current);switch(h){case 1:h=b.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:h=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":h=b.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":h=b.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":h=b.createElement("div"),h.innerHTML="<script><\/script>",h=h.removeChild(h.firstChild);break;case"select":h=typeof i.is=="string"?b.createElement("select",{is:i.is}):b.createElement("select"),i.multiple?h.multiple=!0:i.size&&(h.size=i.size);break;default:h=typeof i.is=="string"?b.createElement(u,{is:i.is}):b.createElement(u)}}h[Et]=t,h[Yt]=i;e:for(b=t.child;b!==null;){if(b.tag===5||b.tag===6)h.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===t)break e;for(;b.sibling===null;){if(b.return===null||b.return===t)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}t.stateNode=h;e:switch(Ht(h,u,i),u){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&js(t)}}return at(t),xu(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,l),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==i&&js(t);else{if(typeof i!="string"&&t.stateNode===null)throw Error(o(166));if(e=ne.current,rl(t)){if(e=t.stateNode,l=t.memoizedProps,i=null,u=It,u!==null)switch(u.tag){case 27:case 5:i=u.memoizedProps}e[Et]=t,e=!!(e.nodeValue===l||i!==null&&i.suppressHydrationWarning===!0||Hg(e.nodeValue,l)),e||Gs(t,!0)}else e=no(e).createTextNode(i),e[Et]=t,t.stateNode=e}return at(t),null;case 31:if(l=t.memoizedState,e===null||e.memoizedState!==null){if(i=rl(t),l!==null){if(e===null){if(!i)throw Error(o(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(o(557));e[Et]=t}else Sa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;at(t),e=!1}else l=Cc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=l),e=!0;if(!e)return t.flags&256?(ln(t),t):(ln(t),null);if((t.flags&128)!==0)throw Error(o(558))}return at(t),null;case 13:if(i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(u=rl(t),i!==null&&i.dehydrated!==null){if(e===null){if(!u)throw Error(o(318));if(u=t.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(o(317));u[Et]=t}else Sa(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;at(t),u=!1}else u=Cc(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=u),u=!0;if(!u)return t.flags&256?(ln(t),t):(ln(t),null)}return ln(t),(t.flags&128)!==0?(t.lanes=l,t):(l=i!==null,e=e!==null&&e.memoizedState!==null,l&&(i=t.child,u=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(u=i.alternate.memoizedState.cachePool.pool),h=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(h=i.memoizedState.cachePool.pool),h!==u&&(i.flags|=2048)),l!==e&&l&&(t.child.flags|=8192),$i(t,t.updateQueue),at(t),null);case 4:return ze(),e===null&&Uu(t.stateNode.containerInfo),at(t),null;case 10:return bs(t.type),at(t),null;case 19:if(K(pt),i=t.memoizedState,i===null)return at(t),null;if(u=(t.flags&128)!==0,h=i.rendering,h===null)if(u)pr(i,!1);else{if(ht!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(h=Ci(e),h!==null){for(t.flags|=128,pr(i,!1),e=h.updateQueue,t.updateQueue=e,$i(t,e),t.subtreeFlags=0,e=l,l=t.child;l!==null;)bf(l,e),l=l.sibling;return ce(pt,pt.current&1|2),Be&&xs(t,i.treeForkCount),t.child}e=e.sibling}i.tail!==null&&xt()>Yi&&(t.flags|=128,u=!0,pr(i,!1),t.lanes=4194304)}else{if(!u)if(e=Ci(h),e!==null){if(t.flags|=128,u=!0,e=e.updateQueue,t.updateQueue=e,$i(t,e),pr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!h.alternate&&!Be)return at(t),null}else 2*xt()-i.renderingStartTime>Yi&&l!==536870912&&(t.flags|=128,u=!0,pr(i,!1),t.lanes=4194304);i.isBackwards?(h.sibling=t.child,t.child=h):(e=i.last,e!==null?e.sibling=h:t.child=h,i.last=h)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=xt(),e.sibling=null,l=pt.current,ce(pt,u?l&1|2:l&1),Be&&xs(t,i.treeForkCount),e):(at(t),null);case 22:case 23:return ln(t),$c(),i=t.memoizedState!==null,e!==null?e.memoizedState!==null!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?(l&536870912)!==0&&(t.flags&128)===0&&(at(t),t.subtreeFlags&6&&(t.flags|=8192)):at(t),l=t.updateQueue,l!==null&&$i(t,l.retryQueue),l=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),i=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),i!==l&&(t.flags|=2048),e!==null&&K(wa),null;case 24:return l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),bs(vt),at(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Ub(e,t){switch(kc(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return bs(vt),ze(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return fn(t),null;case 31:if(t.memoizedState!==null){if(ln(t),t.alternate===null)throw Error(o(340));Sa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ln(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Sa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return K(pt),null;case 4:return ze(),null;case 10:return bs(t.type),null;case 22:case 23:return ln(t),$c(),e!==null&&K(wa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return bs(vt),null;case 25:return null;default:return null}}function Fp(e,t){switch(kc(t),t.tag){case 3:bs(vt),ze();break;case 26:case 27:case 5:fn(t);break;case 4:ze();break;case 31:t.memoizedState!==null&&ln(t);break;case 13:ln(t);break;case 19:K(pt);break;case 10:bs(t.type);break;case 22:case 23:ln(t),$c(),e!==null&&K(wa);break;case 24:bs(vt)}}function gr(e,t){try{var l=t.updateQueue,i=l!==null?l.lastEffect:null;if(i!==null){var u=i.next;l=u;do{if((l.tag&e)===e){i=void 0;var h=l.create,b=l.inst;i=h(),b.destroy=i}l=l.next}while(l!==u)}}catch(E){Qe(t,t.return,E)}}function Xs(e,t,l){try{var i=t.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var h=u.next;i=h;do{if((i.tag&e)===e){var b=i.inst,E=b.destroy;if(E!==void 0){b.destroy=void 0,u=t;var O=l,Y=E;try{Y()}catch(Z){Qe(u,O,Z)}}}i=i.next}while(i!==h)}}catch(Z){Qe(t,t.return,Z)}}function Qp(e){var t=e.updateQueue;if(t!==null){var l=e.stateNode;try{Bf(t,l)}catch(i){Qe(e,e.return,i)}}}function Kp(e,t,l){l.props=Aa(e.type,e.memoizedProps),l.state=e.memoizedState;try{l.componentWillUnmount()}catch(i){Qe(e,t,i)}}function mr(e,t){try{var l=e.ref;if(l!==null){switch(e.tag){case 26:case 27:case 5:var i=e.stateNode;break;case 30:i=e.stateNode;break;default:i=e.stateNode}typeof l=="function"?e.refCleanup=l(i):l.current=i}}catch(u){Qe(e,t,u)}}function es(e,t){var l=e.ref,i=e.refCleanup;if(l!==null)if(typeof i=="function")try{i()}catch(u){Qe(e,t,u)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(u){Qe(e,t,u)}else l.current=null}function Xp(e){var t=e.type,l=e.memoizedProps,i=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":l.autoFocus&&i.focus();break e;case"img":l.src?i.src=l.src:l.srcSet&&(i.srcset=l.srcSet)}}catch(u){Qe(e,e.return,u)}}function vu(e,t,l){try{var i=e.stateNode;o_(i,e.type,l,t),i[Yt]=t}catch(u){Qe(e,e.return,u)}}function Zp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&sa(e.type)||e.tag===4}function bu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Zp(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&sa(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function _u(e,t,l){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(e,t):(t=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,t.appendChild(e),l=l._reactRootContainer,l!=null||t.onclick!==null||(t.onclick=gs));else if(i!==4&&(i===27&&sa(e.type)&&(l=e.stateNode,t=null),e=e.child,e!==null))for(_u(e,t,l),e=e.sibling;e!==null;)_u(e,t,l),e=e.sibling}function Hi(e,t,l){var i=e.tag;if(i===5||i===6)e=e.stateNode,t?l.insertBefore(e,t):l.appendChild(e);else if(i!==4&&(i===27&&sa(e.type)&&(l=e.stateNode),e=e.child,e!==null))for(Hi(e,t,l),e=e.sibling;e!==null;)Hi(e,t,l),e=e.sibling}function Jp(e){var t=e.stateNode,l=e.memoizedProps;try{for(var i=e.type,u=t.attributes;u.length;)t.removeAttributeNode(u[0]);Ht(t,i,l),t[Et]=e,t[Yt]=l}catch(h){Qe(e,e.return,h)}}var ws=!1,St=!1,Su=!1,Wp=typeof WeakSet=="function"?WeakSet:Set,zt=null;function $b(e,t){if(e=e.containerInfo,Gu=co,e=df(e),gc(e)){if("selectionStart"in e)var l={start:e.selectionStart,end:e.selectionEnd};else e:{l=(l=e.ownerDocument)&&l.defaultView||window;var i=l.getSelection&&l.getSelection();if(i&&i.rangeCount!==0){l=i.anchorNode;var u=i.anchorOffset,h=i.focusNode;i=i.focusOffset;try{l.nodeType,h.nodeType}catch{l=null;break e}var b=0,E=-1,O=-1,Y=0,Z=0,ae=e,F=null;t:for(;;){for(var Q;ae!==l||u!==0&&ae.nodeType!==3||(E=b+u),ae!==h||i!==0&&ae.nodeType!==3||(O=b+i),ae.nodeType===3&&(b+=ae.nodeValue.length),(Q=ae.firstChild)!==null;)F=ae,ae=Q;for(;;){if(ae===e)break t;if(F===l&&++Y===u&&(E=b),F===h&&++Z===i&&(O=b),(Q=ae.nextSibling)!==null)break;ae=F,F=ae.parentNode}ae=Q}l=E===-1||O===-1?null:{start:E,end:O}}else l=null}l=l||{start:0,end:0}}else l=null;for(Pu={focusedElem:e,selectionRange:l},co=!1,zt=t;zt!==null;)if(t=zt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,zt=e;else for(;zt!==null;){switch(t=zt,h=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(l=0;l<e.length;l++)u=e[l],u.ref.impl=u.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&h!==null){e=void 0,l=t,u=h.memoizedProps,h=h.memoizedState,i=l.stateNode;try{var me=Aa(l.type,u);e=i.getSnapshotBeforeUpdate(me,h),i.__reactInternalSnapshotBeforeUpdate=e}catch(we){Qe(l,l.return,we)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,l=e.nodeType,l===9)Fu(e);else if(l===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Fu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,zt=e;break}zt=t.return}}function eg(e,t,l){var i=l.flags;switch(l.tag){case 0:case 11:case 15:Es(e,l),i&4&&gr(5,l);break;case 1:if(Es(e,l),i&4)if(e=l.stateNode,t===null)try{e.componentDidMount()}catch(b){Qe(l,l.return,b)}else{var u=Aa(l.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(u,t,e.__reactInternalSnapshotBeforeUpdate)}catch(b){Qe(l,l.return,b)}}i&64&&Qp(l),i&512&&mr(l,l.return);break;case 3:if(Es(e,l),i&64&&(e=l.updateQueue,e!==null)){if(t=null,l.child!==null)switch(l.child.tag){case 27:case 5:t=l.child.stateNode;break;case 1:t=l.child.stateNode}try{Bf(e,t)}catch(b){Qe(l,l.return,b)}}break;case 27:t===null&&i&4&&Jp(l);case 26:case 5:Es(e,l),t===null&&i&4&&Xp(l),i&512&&mr(l,l.return);break;case 12:Es(e,l);break;case 31:Es(e,l),i&4&&sg(e,l);break;case 13:Es(e,l),i&4&&ag(e,l),i&64&&(e=l.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(l=Xb.bind(null,l),m_(e,l))));break;case 22:if(i=l.memoizedState!==null||ws,!i){t=t!==null&&t.memoizedState!==null||St,u=ws;var h=St;ws=i,(St=t)&&!h?Cs(e,l,(l.subtreeFlags&8772)!==0):Es(e,l),ws=u,St=h}break;case 30:break;default:Es(e,l)}}function tg(e){var t=e.alternate;t!==null&&(e.alternate=null,tg(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&Jo(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var it=null,Qt=!1;function ks(e,t,l){for(l=l.child;l!==null;)ng(e,t,l),l=l.sibling}function ng(e,t,l){if(Mt&&typeof Mt.onCommitFiberUnmount=="function")try{Mt.onCommitFiberUnmount(ds,l)}catch{}switch(l.tag){case 26:St||es(l,t),ks(e,t,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:St||es(l,t);var i=it,u=Qt;sa(l.type)&&(it=l.stateNode,Qt=!1),ks(e,t,l),wr(l.stateNode),it=i,Qt=u;break;case 5:St||es(l,t);case 6:if(i=it,u=Qt,it=null,ks(e,t,l),it=i,Qt=u,it!==null)if(Qt)try{(it.nodeType===9?it.body:it.nodeName==="HTML"?it.ownerDocument.body:it).removeChild(l.stateNode)}catch(h){Qe(l,t,h)}else try{it.removeChild(l.stateNode)}catch(h){Qe(l,t,h)}break;case 18:it!==null&&(Qt?(e=it,Qg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,l.stateNode),El(e)):Qg(it,l.stateNode));break;case 4:i=it,u=Qt,it=l.stateNode.containerInfo,Qt=!0,ks(e,t,l),it=i,Qt=u;break;case 0:case 11:case 14:case 15:Xs(2,l,t),St||Xs(4,l,t),ks(e,t,l);break;case 1:St||(es(l,t),i=l.stateNode,typeof i.componentWillUnmount=="function"&&Kp(l,t,i)),ks(e,t,l);break;case 21:ks(e,t,l);break;case 22:St=(i=St)||l.memoizedState!==null,ks(e,t,l),St=i;break;default:ks(e,t,l)}}function sg(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{El(e)}catch(l){Qe(t,t.return,l)}}}function ag(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{El(e)}catch(l){Qe(t,t.return,l)}}function Hb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Wp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Wp),t;default:throw Error(o(435,e.tag))}}function Gi(e,t){var l=Hb(e);t.forEach(function(i){if(!l.has(i)){l.add(i);var u=Zb.bind(null,e,i);i.then(u,u)}})}function Kt(e,t){var l=t.deletions;if(l!==null)for(var i=0;i<l.length;i++){var u=l[i],h=e,b=t,E=b;e:for(;E!==null;){switch(E.tag){case 27:if(sa(E.type)){it=E.stateNode,Qt=!1;break e}break;case 5:it=E.stateNode,Qt=!1;break e;case 3:case 4:it=E.stateNode.containerInfo,Qt=!0;break e}E=E.return}if(it===null)throw Error(o(160));ng(h,b,u),it=null,Qt=!1,h=u.alternate,h!==null&&(h.return=null),u.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)lg(t,e),t=t.sibling}var In=null;function lg(e,t){var l=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Kt(t,e),Xt(e),i&4&&(Xs(3,e,e.return),gr(3,e),Xs(5,e,e.return));break;case 1:Kt(t,e),Xt(e),i&512&&(St||l===null||es(l,l.return)),i&64&&ws&&(e=e.updateQueue,e!==null&&(i=e.callbacks,i!==null&&(l=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=l===null?i:l.concat(i))));break;case 26:var u=In;if(Kt(t,e),Xt(e),i&512&&(St||l===null||es(l,l.return)),i&4){var h=l!==null?l.memoizedState:null;if(i=e.memoizedState,l===null)if(i===null)if(e.stateNode===null){e:{i=e.type,l=e.memoizedProps,u=u.ownerDocument||u;t:switch(i){case"title":h=u.getElementsByTagName("title")[0],(!h||h[Gl]||h[Et]||h.namespaceURI==="http://www.w3.org/2000/svg"||h.hasAttribute("itemprop"))&&(h=u.createElement(i),u.head.insertBefore(h,u.querySelector("head > title"))),Ht(h,i,l),h[Et]=e,Rt(h),i=h;break e;case"link":var b=lm("link","href",u).get(i+(l.href||""));if(b){for(var E=0;E<b.length;E++)if(h=b[E],h.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&h.getAttribute("rel")===(l.rel==null?null:l.rel)&&h.getAttribute("title")===(l.title==null?null:l.title)&&h.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){b.splice(E,1);break t}}h=u.createElement(i),Ht(h,i,l),u.head.appendChild(h);break;case"meta":if(b=lm("meta","content",u).get(i+(l.content||""))){for(E=0;E<b.length;E++)if(h=b[E],h.getAttribute("content")===(l.content==null?null:""+l.content)&&h.getAttribute("name")===(l.name==null?null:l.name)&&h.getAttribute("property")===(l.property==null?null:l.property)&&h.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&h.getAttribute("charset")===(l.charSet==null?null:l.charSet)){b.splice(E,1);break t}}h=u.createElement(i),Ht(h,i,l),u.head.appendChild(h);break;default:throw Error(o(468,i))}h[Et]=e,Rt(h),i=h}e.stateNode=i}else rm(u,e.type,e.stateNode);else e.stateNode=am(u,i,e.memoizedProps);else h!==i?(h===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):h.count--,i===null?rm(u,e.type,e.stateNode):am(u,i,e.memoizedProps)):i===null&&e.stateNode!==null&&vu(e,e.memoizedProps,l.memoizedProps)}break;case 27:Kt(t,e),Xt(e),i&512&&(St||l===null||es(l,l.return)),l!==null&&i&4&&vu(e,e.memoizedProps,l.memoizedProps);break;case 5:if(Kt(t,e),Xt(e),i&512&&(St||l===null||es(l,l.return)),e.flags&32){u=e.stateNode;try{Xa(u,"")}catch(me){Qe(e,e.return,me)}}i&4&&e.stateNode!=null&&(u=e.memoizedProps,vu(e,u,l!==null?l.memoizedProps:u)),i&1024&&(Su=!0);break;case 6:if(Kt(t,e),Xt(e),i&4){if(e.stateNode===null)throw Error(o(162));i=e.memoizedProps,l=e.stateNode;try{l.nodeValue=i}catch(me){Qe(e,e.return,me)}}break;case 3:if(lo=null,u=In,In=so(t.containerInfo),Kt(t,e),In=u,Xt(e),i&4&&l!==null&&l.memoizedState.isDehydrated)try{El(t.containerInfo)}catch(me){Qe(e,e.return,me)}Su&&(Su=!1,rg(e));break;case 4:i=In,In=so(e.stateNode.containerInfo),Kt(t,e),Xt(e),In=i;break;case 12:Kt(t,e),Xt(e);break;case 31:Kt(t,e),Xt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Gi(e,i)));break;case 13:Kt(t,e),Xt(e),e.child.flags&8192&&e.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Vi=xt()),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Gi(e,i)));break;case 22:u=e.memoizedState!==null;var O=l!==null&&l.memoizedState!==null,Y=ws,Z=St;if(ws=Y||u,St=Z||O,Kt(t,e),St=Z,ws=Y,Xt(e),i&8192)e:for(t=e.stateNode,t._visibility=u?t._visibility&-2:t._visibility|1,u&&(l===null||O||ws||St||Ra(e)),l=null,t=e;;){if(t.tag===5||t.tag===26){if(l===null){O=l=t;try{if(h=O.stateNode,u)b=h.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{E=O.stateNode;var ae=O.memoizedProps.style,F=ae!=null&&ae.hasOwnProperty("display")?ae.display:null;E.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(me){Qe(O,O.return,me)}}}else if(t.tag===6){if(l===null){O=t;try{O.stateNode.nodeValue=u?"":O.memoizedProps}catch(me){Qe(O,O.return,me)}}}else if(t.tag===18){if(l===null){O=t;try{var Q=O.stateNode;u?Kg(Q,!0):Kg(O.stateNode,!1)}catch(me){Qe(O,O.return,me)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;l===t&&(l=null),t=t.return}l===t&&(l=null),t.sibling.return=t.return,t=t.sibling}i&4&&(i=e.updateQueue,i!==null&&(l=i.retryQueue,l!==null&&(i.retryQueue=null,Gi(e,l))));break;case 19:Kt(t,e),Xt(e),i&4&&(i=e.updateQueue,i!==null&&(e.updateQueue=null,Gi(e,i)));break;case 30:break;case 21:break;default:Kt(t,e),Xt(e)}}function Xt(e){var t=e.flags;if(t&2){try{for(var l,i=e.return;i!==null;){if(Zp(i)){l=i;break}i=i.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var u=l.stateNode,h=bu(e);Hi(e,h,u);break;case 5:var b=l.stateNode;l.flags&32&&(Xa(b,""),l.flags&=-33);var E=bu(e);Hi(e,E,b);break;case 3:case 4:var O=l.stateNode.containerInfo,Y=bu(e);_u(e,Y,O);break;default:throw Error(o(161))}}catch(Z){Qe(e,e.return,Z)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function rg(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;rg(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Es(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)eg(e,t.alternate,t),t=t.sibling}function Ra(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Xs(4,t,t.return),Ra(t);break;case 1:es(t,t.return);var l=t.stateNode;typeof l.componentWillUnmount=="function"&&Kp(t,t.return,l),Ra(t);break;case 27:wr(t.stateNode);case 26:case 5:es(t,t.return),Ra(t);break;case 22:t.memoizedState===null&&Ra(t);break;case 30:Ra(t);break;default:Ra(t)}e=e.sibling}}function Cs(e,t,l){for(l=l&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var i=t.alternate,u=e,h=t,b=h.flags;switch(h.tag){case 0:case 11:case 15:Cs(u,h,l),gr(4,h);break;case 1:if(Cs(u,h,l),i=h,u=i.stateNode,typeof u.componentDidMount=="function")try{u.componentDidMount()}catch(Y){Qe(i,i.return,Y)}if(i=h,u=i.updateQueue,u!==null){var E=i.stateNode;try{var O=u.shared.hiddenCallbacks;if(O!==null)for(u.shared.hiddenCallbacks=null,u=0;u<O.length;u++)Mf(O[u],E)}catch(Y){Qe(i,i.return,Y)}}l&&b&64&&Qp(h),mr(h,h.return);break;case 27:Jp(h);case 26:case 5:Cs(u,h,l),l&&i===null&&b&4&&Xp(h),mr(h,h.return);break;case 12:Cs(u,h,l);break;case 31:Cs(u,h,l),l&&b&4&&sg(u,h);break;case 13:Cs(u,h,l),l&&b&4&&ag(u,h);break;case 22:h.memoizedState===null&&Cs(u,h,l),mr(h,h.return);break;case 30:break;default:Cs(u,h,l)}t=t.sibling}}function Tu(e,t){var l=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(l=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==l&&(e!=null&&e.refCount++,l!=null&&nr(l))}function ju(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&nr(e))}function Un(e,t,l,i){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)ig(e,t,l,i),t=t.sibling}function ig(e,t,l,i){var u=t.flags;switch(t.tag){case 0:case 11:case 15:Un(e,t,l,i),u&2048&&gr(9,t);break;case 1:Un(e,t,l,i);break;case 3:Un(e,t,l,i),u&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&nr(e)));break;case 12:if(u&2048){Un(e,t,l,i),e=t.stateNode;try{var h=t.memoizedProps,b=h.id,E=h.onPostCommit;typeof E=="function"&&E(b,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){Qe(t,t.return,O)}}else Un(e,t,l,i);break;case 31:Un(e,t,l,i);break;case 13:Un(e,t,l,i);break;case 23:break;case 22:h=t.stateNode,b=t.alternate,t.memoizedState!==null?h._visibility&2?Un(e,t,l,i):yr(e,t):h._visibility&2?Un(e,t,l,i):(h._visibility|=2,ml(e,t,l,i,(t.subtreeFlags&10256)!==0||!1)),u&2048&&Tu(b,t);break;case 24:Un(e,t,l,i),u&2048&&ju(t.alternate,t);break;default:Un(e,t,l,i)}}function ml(e,t,l,i,u){for(u=u&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var h=e,b=t,E=l,O=i,Y=b.flags;switch(b.tag){case 0:case 11:case 15:ml(h,b,E,O,u),gr(8,b);break;case 23:break;case 22:var Z=b.stateNode;b.memoizedState!==null?Z._visibility&2?ml(h,b,E,O,u):yr(h,b):(Z._visibility|=2,ml(h,b,E,O,u)),u&&Y&2048&&Tu(b.alternate,b);break;case 24:ml(h,b,E,O,u),u&&Y&2048&&ju(b.alternate,b);break;default:ml(h,b,E,O,u)}t=t.sibling}}function yr(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var l=e,i=t,u=i.flags;switch(i.tag){case 22:yr(l,i),u&2048&&Tu(i.alternate,i);break;case 24:yr(l,i),u&2048&&ju(i.alternate,i);break;default:yr(l,i)}t=t.sibling}}var xr=8192;function yl(e,t,l){if(e.subtreeFlags&xr)for(e=e.child;e!==null;)og(e,t,l),e=e.sibling}function og(e,t,l){switch(e.tag){case 26:yl(e,t,l),e.flags&xr&&e.memoizedState!==null&&C_(l,In,e.memoizedState,e.memoizedProps);break;case 5:yl(e,t,l);break;case 3:case 4:var i=In;In=so(e.stateNode.containerInfo),yl(e,t,l),In=i;break;case 22:e.memoizedState===null&&(i=e.alternate,i!==null&&i.memoizedState!==null?(i=xr,xr=16777216,yl(e,t,l),xr=i):yl(e,t,l));break;default:yl(e,t,l)}}function cg(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function vr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var i=t[l];zt=i,dg(i,e)}cg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)ug(e),e=e.sibling}function ug(e){switch(e.tag){case 0:case 11:case 15:vr(e),e.flags&2048&&Xs(9,e,e.return);break;case 3:vr(e);break;case 12:vr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Pi(e)):vr(e);break;default:vr(e)}}function Pi(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var l=0;l<t.length;l++){var i=t[l];zt=i,dg(i,e)}cg(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Xs(8,t,t.return),Pi(t);break;case 22:l=t.stateNode,l._visibility&2&&(l._visibility&=-3,Pi(t));break;default:Pi(t)}e=e.sibling}}function dg(e,t){for(;zt!==null;){var l=zt;switch(l.tag){case 0:case 11:case 15:Xs(8,l,t);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var i=l.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:nr(l.memoizedState.cache)}if(i=l.child,i!==null)i.return=l,zt=i;else e:for(l=e;zt!==null;){i=zt;var u=i.sibling,h=i.return;if(tg(i),i===l){zt=null;break e}if(u!==null){u.return=h,zt=u;break e}zt=h}}}var Gb={getCacheForType:function(e){var t=Ut(vt),l=t.data.get(e);return l===void 0&&(l=e(),t.data.set(e,l)),l},cacheSignal:function(){return Ut(vt).controller.signal}},Pb=typeof WeakMap=="function"?WeakMap:Map,Ye=0,tt=null,De=null,Le=0,Fe=0,rn=null,Zs=!1,xl=!1,wu=!1,Ns=0,ht=0,Js=0,za=0,ku=0,on=0,vl=0,br=null,Zt=null,Eu=!1,Vi=0,hg=0,Yi=1/0,Fi=null,Ws=null,Ct=0,ea=null,bl=null,As=0,Cu=0,Nu=null,fg=null,_r=0,Au=null;function cn(){return(Ye&2)!==0&&Le!==0?Le&-Le:B.T!==null?qu():si()}function pg(){if(on===0)if((Le&536870912)===0||Be){var e=fs;fs<<=1,(fs&3932160)===0&&(fs=262144),on=e}else on=536870912;return e=an.current,e!==null&&(e.flags|=32),on}function Jt(e,t,l){(e===tt&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)&&(_l(e,0),ta(e,Le,on,!1)),ut(e,l),((Ye&2)===0||e!==tt)&&(e===tt&&((Ye&2)===0&&(za|=l),ht===4&&ta(e,Le,on,!1)),ts(e))}function gg(e,t,l){if((Ye&6)!==0)throw Error(o(327));var i=!l&&(t&127)===0&&(t&e.expiredLanes)===0||se(e,t),u=i?Fb(e,t):zu(e,t,!0),h=i;do{if(u===0){xl&&!i&&ta(e,t,0,!1);break}else{if(l=e.current.alternate,h&&!Vb(l)){u=zu(e,t,!1),h=!1;continue}if(u===2){if(h=t,e.errorRecoveryDisabledLanes&h)var b=0;else b=e.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){t=b;e:{var E=e;u=br;var O=E.current.memoizedState.isDehydrated;if(O&&(_l(E,b).flags|=256),b=zu(E,b,!1),b!==2){if(wu&&!O){E.errorRecoveryDisabledLanes|=h,za|=h,u=4;break e}h=Zt,Zt=u,h!==null&&(Zt===null?Zt=h:Zt.push.apply(Zt,h))}u=b}if(h=!1,u!==2)continue}}if(u===1){_l(e,0),ta(e,t,0,!0);break}e:{switch(i=e,h=u,h){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:ta(i,t,on,!Zs);break e;case 2:Zt=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(u=Vi+300-xt(),10<u)){if(ta(i,t,on,!Zs),Is(i,0,!0)!==0)break e;As=t,i.timeoutHandle=Yg(mg.bind(null,i,l,Zt,Fi,Eu,t,on,za,vl,Zs,h,"Throttled",-0,0),u);break e}mg(i,l,Zt,Fi,Eu,t,on,za,vl,Zs,h,null,-0,0)}}break}while(!0);ts(e)}function mg(e,t,l,i,u,h,b,E,O,Y,Z,ae,F,Q){if(e.timeoutHandle=-1,ae=t.subtreeFlags,ae&8192||(ae&16785408)===16785408){ae={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:gs},og(t,h,ae);var me=(h&62914560)===h?Vi-xt():(h&4194048)===h?hg-xt():0;if(me=N_(ae,me),me!==null){As=h,e.cancelPendingCommit=me(jg.bind(null,e,t,h,l,i,u,b,E,O,Z,ae,null,F,Q)),ta(e,h,b,!Y);return}}jg(e,t,h,l,i,u,b,E,O)}function Vb(e){for(var t=e;;){var l=t.tag;if((l===0||l===11||l===15)&&t.flags&16384&&(l=t.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var i=0;i<l.length;i++){var u=l[i],h=u.getSnapshot;u=u.value;try{if(!nn(h(),u))return!1}catch{return!1}}if(l=t.child,t.subtreeFlags&16384&&l!==null)l.return=t,t=l;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function ta(e,t,l,i){t&=~ku,t&=~za,e.suspendedLanes|=t,e.pingedLanes&=~t,i&&(e.warmLanes|=t),i=e.expirationTimes;for(var u=t;0<u;){var h=31-Bt(u),b=1<<h;i[h]=-1,u&=~b}l!==0&&Me(e,l,t)}function Qi(){return(Ye&6)===0?(Sr(0),!1):!0}function Ru(){if(De!==null){if(Fe===0)var e=De.return;else e=De,vs=Ta=null,Fc(e),dl=null,ar=0,e=De;for(;e!==null;)Fp(e.alternate,e),e=e.return;De=null}}function _l(e,t){var l=e.timeoutHandle;l!==-1&&(e.timeoutHandle=-1,d_(l)),l=e.cancelPendingCommit,l!==null&&(e.cancelPendingCommit=null,l()),As=0,Ru(),tt=e,De=l=ys(e.current,null),Le=t,Fe=0,rn=null,Zs=!1,xl=se(e,t),wu=!1,vl=on=ku=za=Js=ht=0,Zt=br=null,Eu=!1,(t&8)!==0&&(t|=t&32);var i=e.entangledLanes;if(i!==0)for(e=e.entanglements,i&=t;0<i;){var u=31-Bt(i),h=1<<u;t|=e[u],i&=~h}return Ns=t,gi(),l}function yg(e,t){Ne=null,B.H=hr,t===ul||t===Ti?(t=Df(),Fe=3):t===Lc?(t=Df(),Fe=4):Fe=t===cu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,rn=t,De===null&&(ht=1,Mi(e,bn(t,e.current)))}function xg(){var e=an.current;return e===null?!0:(Le&4194048)===Le?jn===null:(Le&62914560)===Le||(Le&536870912)!==0?e===jn:!1}function vg(){var e=B.H;return B.H=hr,e===null?hr:e}function bg(){var e=B.A;return B.A=Gb,e}function Ki(){ht=4,Zs||(Le&4194048)!==Le&&an.current!==null||(xl=!0),(Js&134217727)===0&&(za&134217727)===0||tt===null||ta(tt,Le,on,!1)}function zu(e,t,l){var i=Ye;Ye|=2;var u=vg(),h=bg();(tt!==e||Le!==t)&&(Fi=null,_l(e,t)),t=!1;var b=ht;e:do try{if(Fe!==0&&De!==null){var E=De,O=rn;switch(Fe){case 8:Ru(),b=6;break e;case 3:case 2:case 9:case 6:an.current===null&&(t=!0);var Y=Fe;if(Fe=0,rn=null,Sl(e,E,O,Y),l&&xl){b=0;break e}break;default:Y=Fe,Fe=0,rn=null,Sl(e,E,O,Y)}}Yb(),b=ht;break}catch(Z){yg(e,Z)}while(!0);return t&&e.shellSuspendCounter++,vs=Ta=null,Ye=i,B.H=u,B.A=h,De===null&&(tt=null,Le=0,gi()),b}function Yb(){for(;De!==null;)_g(De)}function Fb(e,t){var l=Ye;Ye|=2;var i=vg(),u=bg();tt!==e||Le!==t?(Fi=null,Yi=xt()+500,_l(e,t)):xl=se(e,t);e:do try{if(Fe!==0&&De!==null){t=De;var h=rn;t:switch(Fe){case 1:Fe=0,rn=null,Sl(e,t,h,1);break;case 2:case 9:if(Rf(h)){Fe=0,rn=null,Sg(t);break}t=function(){Fe!==2&&Fe!==9||tt!==e||(Fe=7),ts(e)},h.then(t,t);break e;case 3:Fe=7;break e;case 4:Fe=5;break e;case 7:Rf(h)?(Fe=0,rn=null,Sg(t)):(Fe=0,rn=null,Sl(e,t,h,7));break;case 5:var b=null;switch(De.tag){case 26:b=De.memoizedState;case 5:case 27:var E=De;if(b?im(b):E.stateNode.complete){Fe=0,rn=null;var O=E.sibling;if(O!==null)De=O;else{var Y=E.return;Y!==null?(De=Y,Xi(Y)):De=null}break t}}Fe=0,rn=null,Sl(e,t,h,5);break;case 6:Fe=0,rn=null,Sl(e,t,h,6);break;case 8:Ru(),ht=6;break e;default:throw Error(o(462))}}Qb();break}catch(Z){yg(e,Z)}while(!0);return vs=Ta=null,B.H=i,B.A=u,Ye=l,De!==null?0:(tt=null,Le=0,gi(),ht)}function Qb(){for(;De!==null&&!os();)_g(De)}function _g(e){var t=Vp(e.alternate,e,Ns);e.memoizedProps=e.pendingProps,t===null?Xi(e):De=t}function Sg(e){var t=e,l=t.alternate;switch(t.tag){case 15:case 0:t=Ip(l,t,t.pendingProps,t.type,void 0,Le);break;case 11:t=Ip(l,t,t.pendingProps,t.type.render,t.ref,Le);break;case 5:Fc(t);default:Fp(l,t),t=De=bf(t,Ns),t=Vp(l,t,Ns)}e.memoizedProps=e.pendingProps,t===null?Xi(e):De=t}function Sl(e,t,l,i){vs=Ta=null,Fc(t),dl=null,ar=0;var u=t.return;try{if(qb(e,u,t,l,Le)){ht=1,Mi(e,bn(l,e.current)),De=null;return}}catch(h){if(u!==null)throw De=u,h;ht=1,Mi(e,bn(l,e.current)),De=null;return}t.flags&32768?(Be||i===1?e=!0:xl||(Le&536870912)!==0?e=!1:(Zs=e=!0,(i===2||i===9||i===3||i===6)&&(i=an.current,i!==null&&i.tag===13&&(i.flags|=16384))),Tg(t,e)):Xi(t)}function Xi(e){var t=e;do{if((t.flags&32768)!==0){Tg(t,Zs);return}e=t.return;var l=Ib(t.alternate,t,Ns);if(l!==null){De=l;return}if(t=t.sibling,t!==null){De=t;return}De=t=e}while(t!==null);ht===0&&(ht=5)}function Tg(e,t){do{var l=Ub(e.alternate,e);if(l!==null){l.flags&=32767,De=l;return}if(l=e.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!t&&(e=e.sibling,e!==null)){De=e;return}De=e=l}while(e!==null);ht=6,De=null}function jg(e,t,l,i,u,h,b,E,O){e.cancelPendingCommit=null;do Zi();while(Ct!==0);if((Ye&6)!==0)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(h=t.lanes|t.childLanes,h|=bc,Zn(e,l,h,b,E,O),e===tt&&(De=tt=null,Le=0),bl=t,ea=e,As=l,Cu=h,Nu=u,fg=i,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Jb(qs,function(){return Ng(),null})):(e.callbackNode=null,e.callbackPriority=0),i=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||i){i=B.T,B.T=null,u=re.p,re.p=2,b=Ye,Ye|=4;try{$b(e,t,l)}finally{Ye=b,re.p=u,B.T=i}}Ct=1,wg(),kg(),Eg()}}function wg(){if(Ct===1){Ct=0;var e=ea,t=bl,l=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||l){l=B.T,B.T=null;var i=re.p;re.p=2;var u=Ye;Ye|=4;try{lg(t,e);var h=Pu,b=df(e.containerInfo),E=h.focusedElem,O=h.selectionRange;if(b!==E&&E&&E.ownerDocument&&uf(E.ownerDocument.documentElement,E)){if(O!==null&&gc(E)){var Y=O.start,Z=O.end;if(Z===void 0&&(Z=Y),"selectionStart"in E)E.selectionStart=Y,E.selectionEnd=Math.min(Z,E.value.length);else{var ae=E.ownerDocument||document,F=ae&&ae.defaultView||window;if(F.getSelection){var Q=F.getSelection(),me=E.textContent.length,we=Math.min(O.start,me),Je=O.end===void 0?we:Math.min(O.end,me);!Q.extend&&we>Je&&(b=Je,Je=we,we=b);var $=cf(E,we),q=cf(E,Je);if($&&q&&(Q.rangeCount!==1||Q.anchorNode!==$.node||Q.anchorOffset!==$.offset||Q.focusNode!==q.node||Q.focusOffset!==q.offset)){var V=ae.createRange();V.setStart($.node,$.offset),Q.removeAllRanges(),we>Je?(Q.addRange(V),Q.extend(q.node,q.offset)):(V.setEnd(q.node,q.offset),Q.addRange(V))}}}}for(ae=[],Q=E;Q=Q.parentNode;)Q.nodeType===1&&ae.push({element:Q,left:Q.scrollLeft,top:Q.scrollTop});for(typeof E.focus=="function"&&E.focus(),E=0;E<ae.length;E++){var ee=ae[E];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}co=!!Gu,Pu=Gu=null}finally{Ye=u,re.p=i,B.T=l}}e.current=t,Ct=2}}function kg(){if(Ct===2){Ct=0;var e=ea,t=bl,l=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||l){l=B.T,B.T=null;var i=re.p;re.p=2;var u=Ye;Ye|=4;try{eg(e,t.alternate,t)}finally{Ye=u,re.p=i,B.T=l}}Ct=3}}function Eg(){if(Ct===4||Ct===3){Ct=0,gn();var e=ea,t=bl,l=As,i=fg;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Ct=5:(Ct=0,bl=ea=null,Cg(e,e.pendingLanes));var u=e.pendingLanes;if(u===0&&(Ws=null),ga(l),t=t.stateNode,Mt&&typeof Mt.onCommitFiberRoot=="function")try{Mt.onCommitFiberRoot(ds,t,void 0,(t.current.flags&128)===128)}catch{}if(i!==null){t=B.T,u=re.p,re.p=2,B.T=null;try{for(var h=e.onRecoverableError,b=0;b<i.length;b++){var E=i[b];h(E.value,{componentStack:E.stack})}}finally{B.T=t,re.p=u}}(As&3)!==0&&Zi(),ts(e),u=e.pendingLanes,(l&261930)!==0&&(u&42)!==0?e===Au?_r++:(_r=0,Au=e):_r=0,Sr(0)}}function Cg(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,nr(t)))}function Zi(){return wg(),kg(),Eg(),Ng()}function Ng(){if(Ct!==5)return!1;var e=ea,t=Cu;Cu=0;var l=ga(As),i=B.T,u=re.p;try{re.p=32>l?32:l,B.T=null,l=Nu,Nu=null;var h=ea,b=As;if(Ct=0,bl=ea=null,As=0,(Ye&6)!==0)throw Error(o(331));var E=Ye;if(Ye|=4,ug(h.current),ig(h,h.current,b,l),Ye=E,Sr(0,!1),Mt&&typeof Mt.onPostCommitFiberRoot=="function")try{Mt.onPostCommitFiberRoot(ds,h)}catch{}return!0}finally{re.p=u,B.T=i,Cg(e,t)}}function Ag(e,t,l){t=bn(l,t),t=ou(e.stateNode,t,2),e=Fs(e,t,2),e!==null&&(ut(e,2),ts(e))}function Qe(e,t,l){if(e.tag===3)Ag(e,e,l);else for(;t!==null;){if(t.tag===3){Ag(t,e,l);break}else if(t.tag===1){var i=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(Ws===null||!Ws.has(i))){e=bn(l,e),l=Rp(2),i=Fs(t,l,2),i!==null&&(zp(l,i,t,e),ut(i,2),ts(i));break}}t=t.return}}function Du(e,t,l){var i=e.pingCache;if(i===null){i=e.pingCache=new Pb;var u=new Set;i.set(t,u)}else u=i.get(t),u===void 0&&(u=new Set,i.set(t,u));u.has(l)||(wu=!0,u.add(l),e=Kb.bind(null,e,t,l),t.then(e,e))}function Kb(e,t,l){var i=e.pingCache;i!==null&&i.delete(t),e.pingedLanes|=e.suspendedLanes&l,e.warmLanes&=~l,tt===e&&(Le&l)===l&&(ht===4||ht===3&&(Le&62914560)===Le&&300>xt()-Vi?(Ye&2)===0&&_l(e,0):ku|=l,vl===Le&&(vl=0)),ts(e)}function Rg(e,t){t===0&&(t=Ke()),e=ba(e,t),e!==null&&(ut(e,t),ts(e))}function Xb(e){var t=e.memoizedState,l=0;t!==null&&(l=t.retryLane),Rg(e,l)}function Zb(e,t){var l=0;switch(e.tag){case 31:case 13:var i=e.stateNode,u=e.memoizedState;u!==null&&(l=u.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(o(314))}i!==null&&i.delete(t),Rg(e,l)}function Jb(e,t){return en(e,t)}var Ji=null,Tl=null,Ou=!1,Wi=!1,Lu=!1,na=0;function ts(e){e!==Tl&&e.next===null&&(Tl===null?Ji=Tl=e:Tl=Tl.next=e),Wi=!0,Ou||(Ou=!0,e_())}function Sr(e,t){if(!Lu&&Wi){Lu=!0;do for(var l=!1,i=Ji;i!==null;){if(e!==0){var u=i.pendingLanes;if(u===0)var h=0;else{var b=i.suspendedLanes,E=i.pingedLanes;h=(1<<31-Bt(42|e)+1)-1,h&=u&~(b&~E),h=h&201326741?h&201326741|1:h?h|2:0}h!==0&&(l=!0,Lg(i,h))}else h=Le,h=Is(i,i===tt?h:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(h&3)===0||se(i,h)||(l=!0,Lg(i,h));i=i.next}while(l);Lu=!1}}function Wb(){zg()}function zg(){Wi=Ou=!1;var e=0;na!==0&&u_()&&(e=na);for(var t=xt(),l=null,i=Ji;i!==null;){var u=i.next,h=Dg(i,t);h===0?(i.next=null,l===null?Ji=u:l.next=u,u===null&&(Tl=l)):(l=i,(e!==0||(h&3)!==0)&&(Wi=!0)),i=u}Ct!==0&&Ct!==5||Sr(e),na!==0&&(na=0)}function Dg(e,t){for(var l=e.suspendedLanes,i=e.pingedLanes,u=e.expirationTimes,h=e.pendingLanes&-62914561;0<h;){var b=31-Bt(h),E=1<<b,O=u[b];O===-1?((E&l)===0||(E&i)!==0)&&(u[b]=pe(E,t)):O<=t&&(e.expiredLanes|=E),h&=~E}if(t=tt,l=Le,l=Is(e,e===t?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i=e.callbackNode,l===0||e===t&&(Fe===2||Fe===9)||e.cancelPendingCommit!==null)return i!==null&&i!==null&&qt(i),e.callbackNode=null,e.callbackPriority=0;if((l&3)===0||se(e,l)){if(t=l&-l,t===e.callbackPriority)return t;switch(i!==null&&qt(i),ga(l)){case 2:case 8:l=pa;break;case 32:l=qs;break;case 268435456:l=Ga;break;default:l=qs}return i=Og.bind(null,e),l=en(l,i),e.callbackPriority=t,e.callbackNode=l,t}return i!==null&&i!==null&&qt(i),e.callbackPriority=2,e.callbackNode=null,2}function Og(e,t){if(Ct!==0&&Ct!==5)return e.callbackNode=null,e.callbackPriority=0,null;var l=e.callbackNode;if(Zi()&&e.callbackNode!==l)return null;var i=Le;return i=Is(e,e===tt?i:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),i===0?null:(gg(e,i,t),Dg(e,xt()),e.callbackNode!=null&&e.callbackNode===l?Og.bind(null,e):null)}function Lg(e,t){if(Zi())return null;gg(e,t,!0)}function e_(){h_(function(){(Ye&6)!==0?en(us,Wb):zg()})}function qu(){if(na===0){var e=ol;e===0&&(e=Bs,Bs<<=1,(Bs&261888)===0&&(Bs=256)),na=e}return na}function qg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ii(""+e)}function Mg(e,t){var l=t.ownerDocument.createElement("input");return l.name=t.name,l.value=t.value,e.id&&l.setAttribute("form",e.id),t.parentNode.insertBefore(l,t),e=new FormData(e),l.parentNode.removeChild(l),e}function t_(e,t,l,i,u){if(t==="submit"&&l&&l.stateNode===u){var h=qg((u[Yt]||null).action),b=i.submitter;b&&(t=(t=b[Yt]||null)?qg(t.formAction):b.getAttribute("formAction"),t!==null&&(h=t,b=null));var E=new di("action","action",null,i,u);e.push({event:E,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(na!==0){var O=b?Mg(u,b):new FormData(u);nu(l,{pending:!0,data:O,method:u.method,action:h},null,O)}}else typeof h=="function"&&(E.preventDefault(),O=b?Mg(u,b):new FormData(u),nu(l,{pending:!0,data:O,method:u.method,action:h},h,O))},currentTarget:u}]})}}for(var Mu=0;Mu<vc.length;Mu++){var Bu=vc[Mu],n_=Bu.toLowerCase(),s_=Bu[0].toUpperCase()+Bu.slice(1);Bn(n_,"on"+s_)}Bn(pf,"onAnimationEnd"),Bn(gf,"onAnimationIteration"),Bn(mf,"onAnimationStart"),Bn("dblclick","onDoubleClick"),Bn("focusin","onFocus"),Bn("focusout","onBlur"),Bn(vb,"onTransitionRun"),Bn(bb,"onTransitionStart"),Bn(_b,"onTransitionCancel"),Bn(yf,"onTransitionEnd"),Qa("onMouseEnter",["mouseout","mouseover"]),Qa("onMouseLeave",["mouseout","mouseover"]),Qa("onPointerEnter",["pointerout","pointerover"]),Qa("onPointerLeave",["pointerout","pointerover"]),ma("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ma("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ma("onBeforeInput",["compositionend","keypress","textInput","paste"]),ma("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ma("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ma("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Tr="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(" "),a_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Tr));function Bg(e,t){t=(t&4)!==0;for(var l=0;l<e.length;l++){var i=e[l],u=i.event;i=i.listeners;e:{var h=void 0;if(t)for(var b=i.length-1;0<=b;b--){var E=i[b],O=E.instance,Y=E.currentTarget;if(E=E.listener,O!==h&&u.isPropagationStopped())break e;h=E,u.currentTarget=Y;try{h(u)}catch(Z){pi(Z)}u.currentTarget=null,h=O}else for(b=0;b<i.length;b++){if(E=i[b],O=E.instance,Y=E.currentTarget,E=E.listener,O!==h&&u.isPropagationStopped())break e;h=E,u.currentTarget=Y;try{h(u)}catch(Z){pi(Z)}u.currentTarget=null,h=O}}}}function Oe(e,t){var l=t[Zo];l===void 0&&(l=t[Zo]=new Set);var i=e+"__bubble";l.has(i)||(Ig(t,e,2,!1),l.add(i))}function Iu(e,t,l){var i=0;t&&(i|=4),Ig(l,e,i,t)}var eo="_reactListening"+Math.random().toString(36).slice(2);function Uu(e){if(!e[eo]){e[eo]=!0,Rh.forEach(function(l){l!=="selectionchange"&&(a_.has(l)||Iu(l,!1,e),Iu(l,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[eo]||(t[eo]=!0,Iu("selectionchange",!1,t))}}function Ig(e,t,l,i){switch(pm(t)){case 2:var u=z_;break;case 8:u=D_;break;default:u=td}l=u.bind(null,t,l,e),u=void 0,!rc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(u=!0),i?u!==void 0?e.addEventListener(t,l,{capture:!0,passive:u}):e.addEventListener(t,l,!0):u!==void 0?e.addEventListener(t,l,{passive:u}):e.addEventListener(t,l,!1)}function $u(e,t,l,i,u){var h=i;if((t&1)===0&&(t&2)===0&&i!==null)e:for(;;){if(i===null)return;var b=i.tag;if(b===3||b===4){var E=i.stateNode.containerInfo;if(E===u)break;if(b===4)for(b=i.return;b!==null;){var O=b.tag;if((O===3||O===4)&&b.stateNode.containerInfo===u)return;b=b.return}for(;E!==null;){if(b=Va(E),b===null)return;if(O=b.tag,O===5||O===6||O===26||O===27){i=h=b;continue e}E=E.parentNode}}i=i.return}Gh(function(){var Y=h,Z=ac(l),ae=[];e:{var F=xf.get(e);if(F!==void 0){var Q=di,me=e;switch(e){case"keypress":if(ci(l)===0)break e;case"keydown":case"keyup":Q=Zv;break;case"focusin":me="focus",Q=uc;break;case"focusout":me="blur",Q=uc;break;case"beforeblur":case"afterblur":Q=uc;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Q=Yh;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Q=Iv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Q=eb;break;case pf:case gf:case mf:Q=Hv;break;case yf:Q=nb;break;case"scroll":case"scrollend":Q=Mv;break;case"wheel":Q=ab;break;case"copy":case"cut":case"paste":Q=Pv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Q=Qh;break;case"toggle":case"beforetoggle":Q=rb}var we=(t&4)!==0,Je=!we&&(e==="scroll"||e==="scrollend"),$=we?F!==null?F+"Capture":null:F;we=[];for(var q=Y,V;q!==null;){var ee=q;if(V=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||V===null||$===null||(ee=Vl(q,$),ee!=null&&we.push(jr(q,ee,V))),Je)break;q=q.return}0<we.length&&(F=new Q(F,me,null,l,Z),ae.push({event:F,listeners:we}))}}if((t&7)===0){e:{if(F=e==="mouseover"||e==="pointerover",Q=e==="mouseout"||e==="pointerout",F&&l!==sc&&(me=l.relatedTarget||l.fromElement)&&(Va(me)||me[Pa]))break e;if((Q||F)&&(F=Z.window===Z?Z:(F=Z.ownerDocument)?F.defaultView||F.parentWindow:window,Q?(me=l.relatedTarget||l.toElement,Q=Y,me=me?Va(me):null,me!==null&&(Je=d(me),we=me.tag,me!==Je||we!==5&&we!==27&&we!==6)&&(me=null)):(Q=null,me=Y),Q!==me)){if(we=Yh,ee="onMouseLeave",$="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(we=Qh,ee="onPointerLeave",$="onPointerEnter",q="pointer"),Je=Q==null?F:Pl(Q),V=me==null?F:Pl(me),F=new we(ee,q+"leave",Q,l,Z),F.target=Je,F.relatedTarget=V,ee=null,Va(Z)===Y&&(we=new we($,q+"enter",me,l,Z),we.target=V,we.relatedTarget=Je,ee=we),Je=ee,Q&&me)t:{for(we=l_,$=Q,q=me,V=0,ee=$;ee;ee=we(ee))V++;ee=0;for(var Se=q;Se;Se=we(Se))ee++;for(;0<V-ee;)$=we($),V--;for(;0<ee-V;)q=we(q),ee--;for(;V--;){if($===q||q!==null&&$===q.alternate){we=$;break t}$=we($),q=we(q)}we=null}else we=null;Q!==null&&Ug(ae,F,Q,we,!1),me!==null&&Je!==null&&Ug(ae,Je,me,we,!0)}}e:{if(F=Y?Pl(Y):window,Q=F.nodeName&&F.nodeName.toLowerCase(),Q==="select"||Q==="input"&&F.type==="file")var Pe=nf;else if(ef(F))if(sf)Pe=mb;else{Pe=pb;var be=fb}else Q=F.nodeName,!Q||Q.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?Y&&nc(Y.elementType)&&(Pe=nf):Pe=gb;if(Pe&&(Pe=Pe(e,Y))){tf(ae,Pe,l,Z);break e}be&&be(e,F,Y),e==="focusout"&&Y&&F.type==="number"&&Y.memoizedProps.value!=null&&tc(F,"number",F.value)}switch(be=Y?Pl(Y):window,e){case"focusin":(ef(be)||be.contentEditable==="true")&&(el=be,mc=Y,Wl=null);break;case"focusout":Wl=mc=el=null;break;case"mousedown":yc=!0;break;case"contextmenu":case"mouseup":case"dragend":yc=!1,hf(ae,l,Z);break;case"selectionchange":if(xb)break;case"keydown":case"keyup":hf(ae,l,Z)}var Ae;if(hc)e:{switch(e){case"compositionstart":var qe="onCompositionStart";break e;case"compositionend":qe="onCompositionEnd";break e;case"compositionupdate":qe="onCompositionUpdate";break e}qe=void 0}else Wa?Jh(e,l)&&(qe="onCompositionEnd"):e==="keydown"&&l.keyCode===229&&(qe="onCompositionStart");qe&&(Kh&&l.locale!=="ko"&&(Wa||qe!=="onCompositionStart"?qe==="onCompositionEnd"&&Wa&&(Ae=Ph()):(Us=Z,ic="value"in Us?Us.value:Us.textContent,Wa=!0)),be=to(Y,qe),0<be.length&&(qe=new Fh(qe,e,null,l,Z),ae.push({event:qe,listeners:be}),Ae?qe.data=Ae:(Ae=Wh(l),Ae!==null&&(qe.data=Ae)))),(Ae=ob?cb(e,l):ub(e,l))&&(qe=to(Y,"onBeforeInput"),0<qe.length&&(be=new Fh("onBeforeInput","beforeinput",null,l,Z),ae.push({event:be,listeners:qe}),be.data=Ae)),t_(ae,e,Y,l,Z)}Bg(ae,t)})}function jr(e,t,l){return{instance:e,listener:t,currentTarget:l}}function to(e,t){for(var l=t+"Capture",i=[];e!==null;){var u=e,h=u.stateNode;if(u=u.tag,u!==5&&u!==26&&u!==27||h===null||(u=Vl(e,l),u!=null&&i.unshift(jr(e,u,h)),u=Vl(e,t),u!=null&&i.push(jr(e,u,h))),e.tag===3)return i;e=e.return}return[]}function l_(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Ug(e,t,l,i,u){for(var h=t._reactName,b=[];l!==null&&l!==i;){var E=l,O=E.alternate,Y=E.stateNode;if(E=E.tag,O!==null&&O===i)break;E!==5&&E!==26&&E!==27||Y===null||(O=Y,u?(Y=Vl(l,h),Y!=null&&b.unshift(jr(l,Y,O))):u||(Y=Vl(l,h),Y!=null&&b.push(jr(l,Y,O)))),l=l.return}b.length!==0&&e.push({event:t,listeners:b})}var r_=/\r\n?/g,i_=/\u0000|\uFFFD/g;function $g(e){return(typeof e=="string"?e:""+e).replace(r_,`
|
|
9
|
-
`).replace(i_,"")}function Hg(e,t){return t=$g(t),$g(e)===t}function Ze(e,t,l,i,u,h){switch(l){case"children":typeof i=="string"?t==="body"||t==="textarea"&&i===""||Xa(e,i):(typeof i=="number"||typeof i=="bigint")&&t!=="body"&&Xa(e,""+i);break;case"className":li(e,"class",i);break;case"tabIndex":li(e,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":li(e,l,i);break;case"style":$h(e,i,h);break;case"data":if(t!=="object"){li(e,"data",i);break}case"src":case"href":if(i===""&&(t!=="a"||l!=="href")){e.removeAttribute(l);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(l);break}i=ii(""+i),e.setAttribute(l,i);break;case"action":case"formAction":if(typeof i=="function"){e.setAttribute(l,"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 h=="function"&&(l==="formAction"?(t!=="input"&&Ze(e,t,"name",u.name,u,null),Ze(e,t,"formEncType",u.formEncType,u,null),Ze(e,t,"formMethod",u.formMethod,u,null),Ze(e,t,"formTarget",u.formTarget,u,null)):(Ze(e,t,"encType",u.encType,u,null),Ze(e,t,"method",u.method,u,null),Ze(e,t,"target",u.target,u,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){e.removeAttribute(l);break}i=ii(""+i),e.setAttribute(l,i);break;case"onClick":i!=null&&(e.onclick=gs);break;case"onScroll":i!=null&&Oe("scroll",e);break;case"onScrollEnd":i!=null&&Oe("scrollend",e);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(o(61));if(l=i.__html,l!=null){if(u.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"multiple":e.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":e.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){e.removeAttribute("xlink:href");break}l=ii(""+i),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,""+i):e.removeAttribute(l);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":i&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,""):e.removeAttribute(l);break;case"capture":case"download":i===!0?e.setAttribute(l,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?e.setAttribute(l,i):e.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?e.setAttribute(l,i):e.removeAttribute(l);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?e.removeAttribute(l):e.setAttribute(l,i);break;case"popover":Oe("beforetoggle",e),Oe("toggle",e),ai(e,"popover",i);break;case"xlinkActuate":ps(e,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":ps(e,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":ps(e,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":ps(e,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":ps(e,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":ps(e,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":ps(e,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":ps(e,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":ps(e,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":ai(e,"is",i);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Lv.get(l)||l,ai(e,l,i))}}function Hu(e,t,l,i,u,h){switch(l){case"style":$h(e,i,h);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(o(61));if(l=i.__html,l!=null){if(u.children!=null)throw Error(o(60));e.innerHTML=l}}break;case"children":typeof i=="string"?Xa(e,i):(typeof i=="number"||typeof i=="bigint")&&Xa(e,""+i);break;case"onScroll":i!=null&&Oe("scroll",e);break;case"onScrollEnd":i!=null&&Oe("scrollend",e);break;case"onClick":i!=null&&(e.onclick=gs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!zh.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(u=l.endsWith("Capture"),t=l.slice(2,u?l.length-7:void 0),h=e[Yt]||null,h=h!=null?h[l]:null,typeof h=="function"&&e.removeEventListener(t,h,u),typeof i=="function")){typeof h!="function"&&h!==null&&(l in e?e[l]=null:e.hasAttribute(l)&&e.removeAttribute(l)),e.addEventListener(t,i,u);break e}l in e?e[l]=i:i===!0?e.setAttribute(l,""):ai(e,l,i)}}}function Ht(e,t,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Oe("error",e),Oe("load",e);var i=!1,u=!1,h;for(h in l)if(l.hasOwnProperty(h)){var b=l[h];if(b!=null)switch(h){case"src":i=!0;break;case"srcSet":u=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Ze(e,t,h,b,l,null)}}u&&Ze(e,t,"srcSet",l.srcSet,l,null),i&&Ze(e,t,"src",l.src,l,null);return;case"input":Oe("invalid",e);var E=h=b=u=null,O=null,Y=null;for(i in l)if(l.hasOwnProperty(i)){var Z=l[i];if(Z!=null)switch(i){case"name":u=Z;break;case"type":b=Z;break;case"checked":O=Z;break;case"defaultChecked":Y=Z;break;case"value":h=Z;break;case"defaultValue":E=Z;break;case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(o(137,t));break;default:Ze(e,t,i,Z,l,null)}}Mh(e,h,E,O,Y,b,u,!1);return;case"select":Oe("invalid",e),i=b=h=null;for(u in l)if(l.hasOwnProperty(u)&&(E=l[u],E!=null))switch(u){case"value":h=E;break;case"defaultValue":b=E;break;case"multiple":i=E;default:Ze(e,t,u,E,l,null)}t=h,l=b,e.multiple=!!i,t!=null?Ka(e,!!i,t,!1):l!=null&&Ka(e,!!i,l,!0);return;case"textarea":Oe("invalid",e),h=u=i=null;for(b in l)if(l.hasOwnProperty(b)&&(E=l[b],E!=null))switch(b){case"value":i=E;break;case"defaultValue":u=E;break;case"children":h=E;break;case"dangerouslySetInnerHTML":if(E!=null)throw Error(o(91));break;default:Ze(e,t,b,E,l,null)}Ih(e,i,u,h);return;case"option":for(O in l)if(l.hasOwnProperty(O)&&(i=l[O],i!=null))switch(O){case"selected":e.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:Ze(e,t,O,i,l,null)}return;case"dialog":Oe("beforetoggle",e),Oe("toggle",e),Oe("cancel",e),Oe("close",e);break;case"iframe":case"object":Oe("load",e);break;case"video":case"audio":for(i=0;i<Tr.length;i++)Oe(Tr[i],e);break;case"image":Oe("error",e),Oe("load",e);break;case"details":Oe("toggle",e);break;case"embed":case"source":case"link":Oe("error",e),Oe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Y in l)if(l.hasOwnProperty(Y)&&(i=l[Y],i!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,t));default:Ze(e,t,Y,i,l,null)}return;default:if(nc(t)){for(Z in l)l.hasOwnProperty(Z)&&(i=l[Z],i!==void 0&&Hu(e,t,Z,i,l,void 0));return}}for(E in l)l.hasOwnProperty(E)&&(i=l[E],i!=null&&Ze(e,t,E,i,l,null))}function o_(e,t,l,i){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var u=null,h=null,b=null,E=null,O=null,Y=null,Z=null;for(Q in l){var ae=l[Q];if(l.hasOwnProperty(Q)&&ae!=null)switch(Q){case"checked":break;case"value":break;case"defaultValue":O=ae;default:i.hasOwnProperty(Q)||Ze(e,t,Q,null,i,ae)}}for(var F in i){var Q=i[F];if(ae=l[F],i.hasOwnProperty(F)&&(Q!=null||ae!=null))switch(F){case"type":h=Q;break;case"name":u=Q;break;case"checked":Y=Q;break;case"defaultChecked":Z=Q;break;case"value":b=Q;break;case"defaultValue":E=Q;break;case"children":case"dangerouslySetInnerHTML":if(Q!=null)throw Error(o(137,t));break;default:Q!==ae&&Ze(e,t,F,Q,i,ae)}}ec(e,b,E,O,Y,Z,h,u);return;case"select":Q=b=E=F=null;for(h in l)if(O=l[h],l.hasOwnProperty(h)&&O!=null)switch(h){case"value":break;case"multiple":Q=O;default:i.hasOwnProperty(h)||Ze(e,t,h,null,i,O)}for(u in i)if(h=i[u],O=l[u],i.hasOwnProperty(u)&&(h!=null||O!=null))switch(u){case"value":F=h;break;case"defaultValue":E=h;break;case"multiple":b=h;default:h!==O&&Ze(e,t,u,h,i,O)}t=E,l=b,i=Q,F!=null?Ka(e,!!l,F,!1):!!i!=!!l&&(t!=null?Ka(e,!!l,t,!0):Ka(e,!!l,l?[]:"",!1));return;case"textarea":Q=F=null;for(E in l)if(u=l[E],l.hasOwnProperty(E)&&u!=null&&!i.hasOwnProperty(E))switch(E){case"value":break;case"children":break;default:Ze(e,t,E,null,i,u)}for(b in i)if(u=i[b],h=l[b],i.hasOwnProperty(b)&&(u!=null||h!=null))switch(b){case"value":F=u;break;case"defaultValue":Q=u;break;case"children":break;case"dangerouslySetInnerHTML":if(u!=null)throw Error(o(91));break;default:u!==h&&Ze(e,t,b,u,i,h)}Bh(e,F,Q);return;case"option":for(var me in l)if(F=l[me],l.hasOwnProperty(me)&&F!=null&&!i.hasOwnProperty(me))switch(me){case"selected":e.selected=!1;break;default:Ze(e,t,me,null,i,F)}for(O in i)if(F=i[O],Q=l[O],i.hasOwnProperty(O)&&F!==Q&&(F!=null||Q!=null))switch(O){case"selected":e.selected=F&&typeof F!="function"&&typeof F!="symbol";break;default:Ze(e,t,O,F,i,Q)}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 we in l)F=l[we],l.hasOwnProperty(we)&&F!=null&&!i.hasOwnProperty(we)&&Ze(e,t,we,null,i,F);for(Y in i)if(F=i[Y],Q=l[Y],i.hasOwnProperty(Y)&&F!==Q&&(F!=null||Q!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(o(137,t));break;default:Ze(e,t,Y,F,i,Q)}return;default:if(nc(t)){for(var Je in l)F=l[Je],l.hasOwnProperty(Je)&&F!==void 0&&!i.hasOwnProperty(Je)&&Hu(e,t,Je,void 0,i,F);for(Z in i)F=i[Z],Q=l[Z],!i.hasOwnProperty(Z)||F===Q||F===void 0&&Q===void 0||Hu(e,t,Z,F,i,Q);return}}for(var $ in l)F=l[$],l.hasOwnProperty($)&&F!=null&&!i.hasOwnProperty($)&&Ze(e,t,$,null,i,F);for(ae in i)F=i[ae],Q=l[ae],!i.hasOwnProperty(ae)||F===Q||F==null&&Q==null||Ze(e,t,ae,F,i,Q)}function Gg(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function c_(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,l=performance.getEntriesByType("resource"),i=0;i<l.length;i++){var u=l[i],h=u.transferSize,b=u.initiatorType,E=u.duration;if(h&&E&&Gg(b)){for(b=0,E=u.responseEnd,i+=1;i<l.length;i++){var O=l[i],Y=O.startTime;if(Y>E)break;var Z=O.transferSize,ae=O.initiatorType;Z&&Gg(ae)&&(O=O.responseEnd,b+=Z*(O<E?1:(E-Y)/(O-Y)))}if(--i,t+=8*(h+b)/(u.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Gu=null,Pu=null;function no(e){return e.nodeType===9?e:e.ownerDocument}function Pg(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Vg(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Vu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Yu=null;function u_(){var e=window.event;return e&&e.type==="popstate"?e===Yu?!1:(Yu=e,!0):(Yu=null,!1)}var Yg=typeof setTimeout=="function"?setTimeout:void 0,d_=typeof clearTimeout=="function"?clearTimeout:void 0,Fg=typeof Promise=="function"?Promise:void 0,h_=typeof queueMicrotask=="function"?queueMicrotask:typeof Fg<"u"?function(e){return Fg.resolve(null).then(e).catch(f_)}:Yg;function f_(e){setTimeout(function(){throw e})}function sa(e){return e==="head"}function Qg(e,t){var l=t,i=0;do{var u=l.nextSibling;if(e.removeChild(l),u&&u.nodeType===8)if(l=u.data,l==="/$"||l==="/&"){if(i===0){e.removeChild(u),El(t);return}i--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")i++;else if(l==="html")wr(e.ownerDocument.documentElement);else if(l==="head"){l=e.ownerDocument.head,wr(l);for(var h=l.firstChild;h;){var b=h.nextSibling,E=h.nodeName;h[Gl]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&h.rel.toLowerCase()==="stylesheet"||l.removeChild(h),h=b}}else l==="body"&&wr(e.ownerDocument.body);l=u}while(l);El(t)}function Kg(e,t){var l=e;e=0;do{var i=l.nextSibling;if(l.nodeType===1?t?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(t?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),i&&i.nodeType===8)if(l=i.data,l==="/$"){if(e===0)break;e--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||e++;l=i}while(l)}function Fu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var l=t;switch(t=t.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Fu(l),Jo(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}e.removeChild(l)}}function p_(e,t,l,i){for(;e.nodeType===1;){var u=l;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!i&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(i){if(!e[Gl])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(h=e.getAttribute("rel"),h==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(h!==u.rel||e.getAttribute("href")!==(u.href==null||u.href===""?null:u.href)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin)||e.getAttribute("title")!==(u.title==null?null:u.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(h=e.getAttribute("src"),(h!==(u.src==null?null:u.src)||e.getAttribute("type")!==(u.type==null?null:u.type)||e.getAttribute("crossorigin")!==(u.crossOrigin==null?null:u.crossOrigin))&&h&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var h=u.name==null?null:""+u.name;if(u.type==="hidden"&&e.getAttribute("name")===h)return e}else return e;if(e=wn(e.nextSibling),e===null)break}return null}function g_(e,t,l){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!l||(e=wn(e.nextSibling),e===null))return null;return e}function Xg(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=wn(e.nextSibling),e===null))return null;return e}function Qu(e){return e.data==="$?"||e.data==="$~"}function Ku(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function m_(e,t){var l=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||l.readyState!=="loading")t();else{var i=function(){t(),l.removeEventListener("DOMContentLoaded",i)};l.addEventListener("DOMContentLoaded",i),e._reactRetry=i}}function wn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var Xu=null;function Zg(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="/$"||l==="/&"){if(t===0)return wn(e.nextSibling);t--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||t++}e=e.nextSibling}return null}function Jg(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var l=e.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(t===0)return e;t--}else l!=="/$"&&l!=="/&"||t++}e=e.previousSibling}return null}function Wg(e,t,l){switch(t=no(l),e){case"html":if(e=t.documentElement,!e)throw Error(o(452));return e;case"head":if(e=t.head,!e)throw Error(o(453));return e;case"body":if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function wr(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);Jo(e)}var kn=new Map,em=new Set;function so(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Rs=re.d;re.d={f:y_,r:x_,D:v_,C:b_,L:__,m:S_,X:j_,S:T_,M:w_};function y_(){var e=Rs.f(),t=Qi();return e||t}function x_(e){var t=Ya(e);t!==null&&t.tag===5&&t.type==="form"?yp(t):Rs.r(e)}var jl=typeof document>"u"?null:document;function tm(e,t,l){var i=jl;if(i&&typeof t=="string"&&t){var u=xn(t);u='link[rel="'+e+'"][href="'+u+'"]',typeof l=="string"&&(u+='[crossorigin="'+l+'"]'),em.has(u)||(em.add(u),e={rel:e,crossOrigin:l,href:t},i.querySelector(u)===null&&(t=i.createElement("link"),Ht(t,"link",e),Rt(t),i.head.appendChild(t)))}}function v_(e){Rs.D(e),tm("dns-prefetch",e,null)}function b_(e,t){Rs.C(e,t),tm("preconnect",e,t)}function __(e,t,l){Rs.L(e,t,l);var i=jl;if(i&&e&&t){var u='link[rel="preload"][as="'+xn(t)+'"]';t==="image"&&l&&l.imageSrcSet?(u+='[imagesrcset="'+xn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(u+='[imagesizes="'+xn(l.imageSizes)+'"]')):u+='[href="'+xn(e)+'"]';var h=u;switch(t){case"style":h=wl(e);break;case"script":h=kl(e)}kn.has(h)||(e=S({rel:"preload",href:t==="image"&&l&&l.imageSrcSet?void 0:e,as:t},l),kn.set(h,e),i.querySelector(u)!==null||t==="style"&&i.querySelector(kr(h))||t==="script"&&i.querySelector(Er(h))||(t=i.createElement("link"),Ht(t,"link",e),Rt(t),i.head.appendChild(t)))}}function S_(e,t){Rs.m(e,t);var l=jl;if(l&&e){var i=t&&typeof t.as=="string"?t.as:"script",u='link[rel="modulepreload"][as="'+xn(i)+'"][href="'+xn(e)+'"]',h=u;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":h=kl(e)}if(!kn.has(h)&&(e=S({rel:"modulepreload",href:e},t),kn.set(h,e),l.querySelector(u)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Er(h)))return}i=l.createElement("link"),Ht(i,"link",e),Rt(i),l.head.appendChild(i)}}}function T_(e,t,l){Rs.S(e,t,l);var i=jl;if(i&&e){var u=Fa(i).hoistableStyles,h=wl(e);t=t||"default";var b=u.get(h);if(!b){var E={loading:0,preload:null};if(b=i.querySelector(kr(h)))E.loading=5;else{e=S({rel:"stylesheet",href:e,"data-precedence":t},l),(l=kn.get(h))&&Zu(e,l);var O=b=i.createElement("link");Rt(O),Ht(O,"link",e),O._p=new Promise(function(Y,Z){O.onload=Y,O.onerror=Z}),O.addEventListener("load",function(){E.loading|=1}),O.addEventListener("error",function(){E.loading|=2}),E.loading|=4,ao(b,t,i)}b={type:"stylesheet",instance:b,count:1,state:E},u.set(h,b)}}}function j_(e,t){Rs.X(e,t);var l=jl;if(l&&e){var i=Fa(l).hoistableScripts,u=kl(e),h=i.get(u);h||(h=l.querySelector(Er(u)),h||(e=S({src:e,async:!0},t),(t=kn.get(u))&&Ju(e,t),h=l.createElement("script"),Rt(h),Ht(h,"link",e),l.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},i.set(u,h))}}function w_(e,t){Rs.M(e,t);var l=jl;if(l&&e){var i=Fa(l).hoistableScripts,u=kl(e),h=i.get(u);h||(h=l.querySelector(Er(u)),h||(e=S({src:e,async:!0,type:"module"},t),(t=kn.get(u))&&Ju(e,t),h=l.createElement("script"),Rt(h),Ht(h,"link",e),l.head.appendChild(h)),h={type:"script",instance:h,count:1,state:null},i.set(u,h))}}function nm(e,t,l,i){var u=(u=ne.current)?so(u):null;if(!u)throw Error(o(446));switch(e){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(t=wl(l.href),l=Fa(u).hoistableStyles,i=l.get(t),i||(i={type:"style",instance:null,count:0,state:null},l.set(t,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){e=wl(l.href);var h=Fa(u).hoistableStyles,b=h.get(e);if(b||(u=u.ownerDocument||u,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},h.set(e,b),(h=u.querySelector(kr(e)))&&!h._p&&(b.instance=h,b.state.loading=5),kn.has(e)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},kn.set(e,l),h||k_(u,e,l,b.state))),t&&i===null)throw Error(o(528,""));return b}if(t&&i!==null)throw Error(o(529,""));return null;case"script":return t=l.async,l=l.src,typeof l=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=kl(l),l=Fa(u).hoistableScripts,i=l.get(t),i||(i={type:"script",instance:null,count:0,state:null},l.set(t,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,e))}}function wl(e){return'href="'+xn(e)+'"'}function kr(e){return'link[rel="stylesheet"]['+e+"]"}function sm(e){return S({},e,{"data-precedence":e.precedence,precedence:null})}function k_(e,t,l,i){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?i.loading=1:(t=e.createElement("link"),i.preload=t,t.addEventListener("load",function(){return i.loading|=1}),t.addEventListener("error",function(){return i.loading|=2}),Ht(t,"link",l),Rt(t),e.head.appendChild(t))}function kl(e){return'[src="'+xn(e)+'"]'}function Er(e){return"script[async]"+e}function am(e,t,l){if(t.count++,t.instance===null)switch(t.type){case"style":var i=e.querySelector('style[data-href~="'+xn(l.href)+'"]');if(i)return t.instance=i,Rt(i),i;var u=S({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return i=(e.ownerDocument||e).createElement("style"),Rt(i),Ht(i,"style",u),ao(i,l.precedence,e),t.instance=i;case"stylesheet":u=wl(l.href);var h=e.querySelector(kr(u));if(h)return t.state.loading|=4,t.instance=h,Rt(h),h;i=sm(l),(u=kn.get(u))&&Zu(i,u),h=(e.ownerDocument||e).createElement("link"),Rt(h);var b=h;return b._p=new Promise(function(E,O){b.onload=E,b.onerror=O}),Ht(h,"link",i),t.state.loading|=4,ao(h,l.precedence,e),t.instance=h;case"script":return h=kl(l.src),(u=e.querySelector(Er(h)))?(t.instance=u,Rt(u),u):(i=l,(u=kn.get(h))&&(i=S({},l),Ju(i,u)),e=e.ownerDocument||e,u=e.createElement("script"),Rt(u),Ht(u,"link",i),e.head.appendChild(u),t.instance=u);case"void":return null;default:throw Error(o(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(i=t.instance,t.state.loading|=4,ao(i,l.precedence,e));return t.instance}function ao(e,t,l){for(var i=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),u=i.length?i[i.length-1]:null,h=u,b=0;b<i.length;b++){var E=i[b];if(E.dataset.precedence===t)h=E;else if(h!==u)break}h?h.parentNode.insertBefore(e,h.nextSibling):(t=l.nodeType===9?l.head:l,t.insertBefore(e,t.firstChild))}function Zu(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Ju(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var lo=null;function lm(e,t,l){if(lo===null){var i=new Map,u=lo=new Map;u.set(l,i)}else u=lo,i=u.get(l),i||(i=new Map,u.set(l,i));if(i.has(e))return i;for(i.set(e,null),l=l.getElementsByTagName(e),u=0;u<l.length;u++){var h=l[u];if(!(h[Gl]||h[Et]||e==="link"&&h.getAttribute("rel")==="stylesheet")&&h.namespaceURI!=="http://www.w3.org/2000/svg"){var b=h.getAttribute(t)||"";b=e+b;var E=i.get(b);E?E.push(h):i.set(b,[h])}}return i}function rm(e,t,l){e=e.ownerDocument||e,e.head.insertBefore(l,t==="title"?e.querySelector("head > title"):null)}function E_(e,t,l){if(l===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function im(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function C_(e,t,l,i){if(l.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var u=wl(i.href),h=t.querySelector(kr(u));if(h){t=h._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=ro.bind(e),t.then(e,e)),l.state.loading|=4,l.instance=h,Rt(h);return}h=t.ownerDocument||t,i=sm(i),(u=kn.get(u))&&Zu(i,u),h=h.createElement("link"),Rt(h);var b=h;b._p=new Promise(function(E,O){b.onload=E,b.onerror=O}),Ht(h,"link",i),l.instance=h}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(l,t),(t=l.state.preload)&&(l.state.loading&3)===0&&(e.count++,l=ro.bind(e),t.addEventListener("load",l),t.addEventListener("error",l))}}var Wu=0;function N_(e,t){return e.stylesheets&&e.count===0&&oo(e,e.stylesheets),0<e.count||0<e.imgCount?function(l){var i=setTimeout(function(){if(e.stylesheets&&oo(e,e.stylesheets),e.unsuspend){var h=e.unsuspend;e.unsuspend=null,h()}},6e4+t);0<e.imgBytes&&Wu===0&&(Wu=62500*c_());var u=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&oo(e,e.stylesheets),e.unsuspend)){var h=e.unsuspend;e.unsuspend=null,h()}},(e.imgBytes>Wu?50:800)+t);return e.unsuspend=l,function(){e.unsuspend=null,clearTimeout(i),clearTimeout(u)}}:null}function ro(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)oo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var io=null;function oo(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,io=new Map,t.forEach(A_,e),io=null,ro.call(e))}function A_(e,t){if(!(t.state.loading&4)){var l=io.get(e);if(l)var i=l.get(null);else{l=new Map,io.set(e,l);for(var u=e.querySelectorAll("link[data-precedence],style[data-precedence]"),h=0;h<u.length;h++){var b=u[h];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(l.set(b.dataset.precedence,b),i=b)}i&&l.set(null,i)}u=t.instance,b=u.getAttribute("data-precedence"),h=l.get(b)||i,h===i&&l.set(null,u),l.set(b,u),this.count++,i=ro.bind(this),u.addEventListener("load",i),u.addEventListener("error",i),h?h.parentNode.insertBefore(u,h.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(u,e.firstChild)),t.state.loading|=4}}var Cr={$$typeof:L,Provider:null,Consumer:null,_currentValue:he,_currentValue2:he,_threadCount:0};function R_(e,t,l,i,u,h,b,E,O){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=nt(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=nt(0),this.hiddenUpdates=nt(null),this.identifierPrefix=i,this.onUncaughtError=u,this.onCaughtError=h,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=O,this.incompleteTransitions=new Map}function om(e,t,l,i,u,h,b,E,O,Y,Z,ae){return e=new R_(e,t,l,b,O,Y,Z,ae,E),t=1,h===!0&&(t|=24),h=sn(3,null,null,t),e.current=h,h.stateNode=e,t=zc(),t.refCount++,e.pooledCache=t,t.refCount++,h.memoizedState={element:i,isDehydrated:l,cache:t},qc(h),e}function cm(e){return e?(e=sl,e):sl}function um(e,t,l,i,u,h){u=cm(u),i.context===null?i.context=u:i.pendingContext=u,i=Ys(t),i.payload={element:l},h=h===void 0?null:h,h!==null&&(i.callback=h),l=Fs(e,i,t),l!==null&&(Jt(l,e,t),rr(l,e,t))}function dm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var l=e.retryLane;e.retryLane=l!==0&&l<t?l:t}}function ed(e,t){dm(e,t),(e=e.alternate)&&dm(e,t)}function hm(e){if(e.tag===13||e.tag===31){var t=ba(e,67108864);t!==null&&Jt(t,e,67108864),ed(e,67108864)}}function fm(e){if(e.tag===13||e.tag===31){var t=cn();t=At(t);var l=ba(e,t);l!==null&&Jt(l,e,t),ed(e,t)}}var co=!0;function z_(e,t,l,i){var u=B.T;B.T=null;var h=re.p;try{re.p=2,td(e,t,l,i)}finally{re.p=h,B.T=u}}function D_(e,t,l,i){var u=B.T;B.T=null;var h=re.p;try{re.p=8,td(e,t,l,i)}finally{re.p=h,B.T=u}}function td(e,t,l,i){if(co){var u=nd(i);if(u===null)$u(e,t,i,uo,l),gm(e,i);else if(L_(u,e,t,l,i))i.stopPropagation();else if(gm(e,i),t&4&&-1<O_.indexOf(e)){for(;u!==null;){var h=Ya(u);if(h!==null)switch(h.tag){case 3:if(h=h.stateNode,h.current.memoizedState.isDehydrated){var b=qn(h.pendingLanes);if(b!==0){var E=h;for(E.pendingLanes|=2,E.entangledLanes|=2;b;){var O=1<<31-Bt(b);E.entanglements[1]|=O,b&=~O}ts(h),(Ye&6)===0&&(Yi=xt()+500,Sr(0))}}break;case 31:case 13:E=ba(h,2),E!==null&&Jt(E,h,2),Qi(),ed(h,2)}if(h=nd(i),h===null&&$u(e,t,i,uo,l),h===u)break;u=h}u!==null&&i.stopPropagation()}else $u(e,t,i,null,l)}}function nd(e){return e=ac(e),sd(e)}var uo=null;function sd(e){if(uo=null,e=Va(e),e!==null){var t=d(e);if(t===null)e=null;else{var l=t.tag;if(l===13){if(e=f(t),e!==null)return e;e=null}else if(l===31){if(e=y(t),e!==null)return e;e=null}else if(l===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return uo=e,null}function pm(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"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(cs()){case us:return 2;case pa:return 8;case qs:case Ul:return 32;case Ga:return 268435456;default:return 32}default:return 32}}var ad=!1,aa=null,la=null,ra=null,Nr=new Map,Ar=new Map,ia=[],O_="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 gm(e,t){switch(e){case"focusin":case"focusout":aa=null;break;case"dragenter":case"dragleave":la=null;break;case"mouseover":case"mouseout":ra=null;break;case"pointerover":case"pointerout":Nr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ar.delete(t.pointerId)}}function Rr(e,t,l,i,u,h){return e===null||e.nativeEvent!==h?(e={blockedOn:t,domEventName:l,eventSystemFlags:i,nativeEvent:h,targetContainers:[u]},t!==null&&(t=Ya(t),t!==null&&hm(t)),e):(e.eventSystemFlags|=i,t=e.targetContainers,u!==null&&t.indexOf(u)===-1&&t.push(u),e)}function L_(e,t,l,i,u){switch(t){case"focusin":return aa=Rr(aa,e,t,l,i,u),!0;case"dragenter":return la=Rr(la,e,t,l,i,u),!0;case"mouseover":return ra=Rr(ra,e,t,l,i,u),!0;case"pointerover":var h=u.pointerId;return Nr.set(h,Rr(Nr.get(h)||null,e,t,l,i,u)),!0;case"gotpointercapture":return h=u.pointerId,Ar.set(h,Rr(Ar.get(h)||null,e,t,l,i,u)),!0}return!1}function mm(e){var t=Va(e.target);if(t!==null){var l=d(t);if(l!==null){if(t=l.tag,t===13){if(t=f(l),t!==null){e.blockedOn=t,tn(e.priority,function(){fm(l)});return}}else if(t===31){if(t=y(l),t!==null){e.blockedOn=t,tn(e.priority,function(){fm(l)});return}}else if(t===3&&l.stateNode.current.memoizedState.isDehydrated){e.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ho(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var l=nd(e.nativeEvent);if(l===null){l=e.nativeEvent;var i=new l.constructor(l.type,l);sc=i,l.target.dispatchEvent(i),sc=null}else return t=Ya(l),t!==null&&hm(t),e.blockedOn=l,!1;t.shift()}return!0}function ym(e,t,l){ho(e)&&l.delete(t)}function q_(){ad=!1,aa!==null&&ho(aa)&&(aa=null),la!==null&&ho(la)&&(la=null),ra!==null&&ho(ra)&&(ra=null),Nr.forEach(ym),Ar.forEach(ym)}function fo(e,t){e.blockedOn===t&&(e.blockedOn=null,ad||(ad=!0,s.unstable_scheduleCallback(s.unstable_NormalPriority,q_)))}var po=null;function xm(e){po!==e&&(po=e,s.unstable_scheduleCallback(s.unstable_NormalPriority,function(){po===e&&(po=null);for(var t=0;t<e.length;t+=3){var l=e[t],i=e[t+1],u=e[t+2];if(typeof i!="function"){if(sd(i||l)===null)continue;break}var h=Ya(l);h!==null&&(e.splice(t,3),t-=3,nu(h,{pending:!0,data:u,method:l.method,action:i},i,u))}}))}function El(e){function t(O){return fo(O,e)}aa!==null&&fo(aa,e),la!==null&&fo(la,e),ra!==null&&fo(ra,e),Nr.forEach(t),Ar.forEach(t);for(var l=0;l<ia.length;l++){var i=ia[l];i.blockedOn===e&&(i.blockedOn=null)}for(;0<ia.length&&(l=ia[0],l.blockedOn===null);)mm(l),l.blockedOn===null&&ia.shift();if(l=(e.ownerDocument||e).$$reactFormReplay,l!=null)for(i=0;i<l.length;i+=3){var u=l[i],h=l[i+1],b=u[Yt]||null;if(typeof h=="function")b||xm(l);else if(b){var E=null;if(h&&h.hasAttribute("formAction")){if(u=h,b=h[Yt]||null)E=b.formAction;else if(sd(u)!==null)continue}else E=b.action;typeof E=="function"?l[i+1]=E:(l.splice(i,3),i-=3),xm(l)}}}function vm(){function e(h){h.canIntercept&&h.info==="react-transition"&&h.intercept({handler:function(){return new Promise(function(b){return u=b})},focusReset:"manual",scroll:"manual"})}function t(){u!==null&&(u(),u=null),i||setTimeout(l,20)}function l(){if(!i&&!navigation.transition){var h=navigation.currentEntry;h&&h.url!=null&&navigation.navigate(h.url,{state:h.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,u=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(l,100),function(){i=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),u!==null&&(u(),u=null)}}}function ld(e){this._internalRoot=e}go.prototype.render=ld.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var l=t.current,i=cn();um(l,i,e,t,null,null)},go.prototype.unmount=ld.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;um(e.current,2,null,e,null,null),Qi(),t[Pa]=null}};function go(e){this._internalRoot=e}go.prototype.unstable_scheduleHydration=function(e){if(e){var t=si();e={blockedOn:null,target:e,priority:t};for(var l=0;l<ia.length&&t!==0&&t<ia[l].priority;l++);ia.splice(l,0,e),l===0&&mm(e)}};var bm=n.version;if(bm!=="19.2.5")throw Error(o(527,bm,"19.2.5"));re.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(o(188)):(e=Object.keys(e).join(","),Error(o(268,e)));return e=m(t),e=e!==null?x(e):null,e=e===null?null:e.stateNode,e};var M_={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.5"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var mo=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!mo.isDisabled&&mo.supportsFiber)try{ds=mo.inject(M_),Mt=mo}catch{}}return Dr.createRoot=function(e,t){if(!c(e))throw Error(o(299));var l=!1,i="",u=Ep,h=Cp,b=Np;return t!=null&&(t.unstable_strictMode===!0&&(l=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onUncaughtError!==void 0&&(u=t.onUncaughtError),t.onCaughtError!==void 0&&(h=t.onCaughtError),t.onRecoverableError!==void 0&&(b=t.onRecoverableError)),t=om(e,1,!1,null,null,l,i,null,u,h,b,vm),e[Pa]=t.current,Uu(e),new ld(t)},Dr.hydrateRoot=function(e,t,l){if(!c(e))throw Error(o(299));var i=!1,u="",h=Ep,b=Cp,E=Np,O=null;return l!=null&&(l.unstable_strictMode===!0&&(i=!0),l.identifierPrefix!==void 0&&(u=l.identifierPrefix),l.onUncaughtError!==void 0&&(h=l.onUncaughtError),l.onCaughtError!==void 0&&(b=l.onCaughtError),l.onRecoverableError!==void 0&&(E=l.onRecoverableError),l.formState!==void 0&&(O=l.formState)),t=om(e,1,!0,t,l??null,i,u,O,h,b,E,vm),t.context=cm(null),l=t.current,i=cn(),i=At(i),u=Ys(i),u.callback=null,Fs(l,u,i),l=i,t.current.lanes=l,ut(t,l),ts(t),e[Pa]=t.current,Uu(e),new go(t)},Dr.version="19.2.5",Dr}var Am;function Q_(){if(Am)return od.exports;Am=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(n){console.error(n)}}return s(),od.exports=F_(),od.exports}var K_=Q_();const X_=tx(K_);var Rm="popstate";function zm(s){return typeof s=="object"&&s!=null&&"pathname"in s&&"search"in s&&"hash"in s&&"state"in s&&"key"in s}function Z_(s={}){function n(o,c){let d=c.state?.masked,{pathname:f,search:y,hash:g}=d||o.location;return Md("",{pathname:f,search:y,hash:g},c.state&&c.state.usr||null,c.state&&c.state.key||"default",d?{pathname:o.location.pathname,search:o.location.search,hash:o.location.hash}:void 0)}function r(o,c){return typeof c=="string"?c:Qr(c)}return W_(n,r,null,s)}function ot(s,n){if(s===!1||s===null||typeof s>"u")throw new Error(n)}function An(s,n){if(!s){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function J_(){return Math.random().toString(36).substring(2,10)}function Dm(s,n){return{usr:s.state,key:s.key,idx:n,masked:s.unstable_mask?{pathname:s.pathname,search:s.search,hash:s.hash}:void 0}}function Md(s,n,r=null,o,c){return{pathname:typeof s=="string"?s:s.pathname,search:"",hash:"",...typeof n=="string"?Ol(n):n,state:r,key:n&&n.key||o||J_(),unstable_mask:c}}function Qr({pathname:s="/",search:n="",hash:r=""}){return n&&n!=="?"&&(s+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(s+=r.charAt(0)==="#"?r:"#"+r),s}function Ol(s){let n={};if(s){let r=s.indexOf("#");r>=0&&(n.hash=s.substring(r),s=s.substring(0,r));let o=s.indexOf("?");o>=0&&(n.search=s.substring(o),s=s.substring(0,o)),s&&(n.pathname=s)}return n}function W_(s,n,r,o={}){let{window:c=document.defaultView,v5Compat:d=!1}=o,f=c.history,y="POP",g=null,m=x();m==null&&(m=0,f.replaceState({...f.state,idx:m},""));function x(){return(f.state||{idx:null}).idx}function S(){y="POP";let C=x(),j=C==null?null:C-m;m=C,g&&g({action:y,location:k.location,delta:j})}function v(C,j){y="PUSH";let R=zm(C)?C:Md(k.location,C,j);m=x()+1;let L=Dm(R,m),N=k.createHref(R.unstable_mask||R);try{f.pushState(L,"",N)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;c.location.assign(N)}d&&g&&g({action:y,location:k.location,delta:1})}function T(C,j){y="REPLACE";let R=zm(C)?C:Md(k.location,C,j);m=x();let L=Dm(R,m),N=k.createHref(R.unstable_mask||R);f.replaceState(L,"",N),d&&g&&g({action:y,location:k.location,delta:0})}function w(C){return eS(C)}let k={get action(){return y},get location(){return s(c,f)},listen(C){if(g)throw new Error("A history only accepts one active listener");return c.addEventListener(Rm,S),g=C,()=>{c.removeEventListener(Rm,S),g=null}},createHref(C){return n(c,C)},createURL:w,encodeLocation(C){let j=w(C);return{pathname:j.pathname,search:j.search,hash:j.hash}},push:v,replace:T,go(C){return f.go(C)}};return k}function eS(s,n=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),ot(r,"No window.location.(origin|href) available to create URL");let o=typeof s=="string"?s:Qr(s);return o=o.replace(/ $/,"%20"),!n&&o.startsWith("//")&&(o=r+o),new URL(o,r)}function nx(s,n,r="/"){return tS(s,n,r,!1)}function tS(s,n,r,o){let c=typeof n=="string"?Ol(n):n,d=Os(c.pathname||"/",r);if(d==null)return null;let f=sx(s);nS(f);let y=null;for(let g=0;y==null&&g<f.length;++g){let m=fS(d);y=dS(f[g],m,o)}return y}function sx(s,n=[],r=[],o="",c=!1){let d=(f,y,g=c,m)=>{let x={relativePath:m===void 0?f.path||"":m,caseSensitive:f.caseSensitive===!0,childrenIndex:y,route:f};if(x.relativePath.startsWith("/")){if(!x.relativePath.startsWith(o)&&g)return;ot(x.relativePath.startsWith(o),`Absolute route path "${x.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),x.relativePath=x.relativePath.slice(o.length)}let S=as([o,x.relativePath]),v=r.concat(x);f.children&&f.children.length>0&&(ot(f.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${S}".`),sx(f.children,n,v,S,g)),!(f.path==null&&!f.index)&&n.push({path:S,score:cS(S,f.index),routesMeta:v})};return s.forEach((f,y)=>{if(f.path===""||!f.path?.includes("?"))d(f,y);else for(let g of ax(f.path))d(f,y,!0,g)}),n}function ax(s){let n=s.split("/");if(n.length===0)return[];let[r,...o]=n,c=r.endsWith("?"),d=r.replace(/\?$/,"");if(o.length===0)return c?[d,""]:[d];let f=ax(o.join("/")),y=[];return y.push(...f.map(g=>g===""?d:[d,g].join("/"))),c&&y.push(...f),y.map(g=>s.startsWith("/")&&g===""?"/":g)}function nS(s){s.sort((n,r)=>n.score!==r.score?r.score-n.score:uS(n.routesMeta.map(o=>o.childrenIndex),r.routesMeta.map(o=>o.childrenIndex)))}var sS=/^:[\w-]+$/,aS=3,lS=2,rS=1,iS=10,oS=-2,Om=s=>s==="*";function cS(s,n){let r=s.split("/"),o=r.length;return r.some(Om)&&(o+=oS),n&&(o+=lS),r.filter(c=>!Om(c)).reduce((c,d)=>c+(sS.test(d)?aS:d===""?rS:iS),o)}function uS(s,n){return s.length===n.length&&s.slice(0,-1).every((o,c)=>o===n[c])?s[s.length-1]-n[n.length-1]:0}function dS(s,n,r=!1){let{routesMeta:o}=s,c={},d="/",f=[];for(let y=0;y<o.length;++y){let g=o[y],m=y===o.length-1,x=d==="/"?n:n.slice(d.length)||"/",S=Lo({path:g.relativePath,caseSensitive:g.caseSensitive,end:m},x),v=g.route;if(!S&&m&&r&&!o[o.length-1].route.index&&(S=Lo({path:g.relativePath,caseSensitive:g.caseSensitive,end:!1},x)),!S)return null;Object.assign(c,S.params),f.push({params:c,pathname:as([d,S.pathname]),pathnameBase:yS(as([d,S.pathnameBase])),route:v}),S.pathnameBase!=="/"&&(d=as([d,S.pathnameBase]))}return f}function Lo(s,n){typeof s=="string"&&(s={path:s,caseSensitive:!1,end:!0});let[r,o]=hS(s.path,s.caseSensitive,s.end),c=n.match(r);if(!c)return null;let d=c[0],f=d.replace(/(.)\/+$/,"$1"),y=c.slice(1);return{params:o.reduce((m,{paramName:x,isOptional:S},v)=>{if(x==="*"){let w=y[v]||"";f=d.slice(0,d.length-w.length).replace(/(.)\/+$/,"$1")}const T=y[v];return S&&!T?m[x]=void 0:m[x]=(T||"").replace(/%2F/g,"/"),m},{}),pathname:d,pathnameBase:f,pattern:s}}function hS(s,n=!1,r=!0){An(s==="*"||!s.endsWith("*")||s.endsWith("/*"),`Route path "${s}" will be treated as if it were "${s.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${s.replace(/\*$/,"/*")}".`);let o=[],c="^"+s.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(f,y,g,m,x)=>{if(o.push({paramName:y,isOptional:g!=null}),g){let S=x.charAt(m+f.length);return S&&S!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return s.endsWith("*")?(o.push({paramName:"*"}),c+=s==="*"||s==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?c+="\\/*$":s!==""&&s!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,n?void 0:"i"),o]}function fS(s){try{return s.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return An(!1,`The URL path "${s}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),s}}function Os(s,n){if(n==="/")return s;if(!s.toLowerCase().startsWith(n.toLowerCase()))return null;let r=n.endsWith("/")?n.length-1:n.length,o=s.charAt(r);return o&&o!=="/"?null:s.slice(r)||"/"}var pS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function gS(s,n="/"){let{pathname:r,search:o="",hash:c=""}=typeof s=="string"?Ol(s):s,d;return r?(r=r.replace(/\/\/+/g,"/"),r.startsWith("/")?d=Lm(r.substring(1),"/"):d=Lm(r,n)):d=n,{pathname:d,search:xS(o),hash:vS(c)}}function Lm(s,n){let r=n.replace(/\/+$/,"").split("/");return s.split("/").forEach(c=>{c===".."?r.length>1&&r.pop():c!=="."&&r.push(c)}),r.length>1?r.join("/"):"/"}function hd(s,n,r,o){return`Cannot include a '${s}' character in a manually specified \`to.${n}\` field [${JSON.stringify(o)}]. 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 mS(s){return s.filter((n,r)=>r===0||n.route.path&&n.route.path.length>0)}function Wd(s){let n=mS(s);return n.map((r,o)=>o===n.length-1?r.pathname:r.pathnameBase)}function Go(s,n,r,o=!1){let c;typeof s=="string"?c=Ol(s):(c={...s},ot(!c.pathname||!c.pathname.includes("?"),hd("?","pathname","search",c)),ot(!c.pathname||!c.pathname.includes("#"),hd("#","pathname","hash",c)),ot(!c.search||!c.search.includes("#"),hd("#","search","hash",c)));let d=s===""||c.pathname==="",f=d?"/":c.pathname,y;if(f==null)y=r;else{let S=n.length-1;if(!o&&f.startsWith("..")){let v=f.split("/");for(;v[0]==="..";)v.shift(),S-=1;c.pathname=v.join("/")}y=S>=0?n[S]:"/"}let g=gS(c,y),m=f&&f!=="/"&&f.endsWith("/"),x=(d||f===".")&&r.endsWith("/");return!g.pathname.endsWith("/")&&(m||x)&&(g.pathname+="/"),g}var as=s=>s.join("/").replace(/\/\/+/g,"/"),yS=s=>s.replace(/\/+$/,"").replace(/^\/*/,"/"),xS=s=>!s||s==="?"?"":s.startsWith("?")?s:"?"+s,vS=s=>!s||s==="#"?"":s.startsWith("#")?s:"#"+s,bS=class{constructor(s,n,r,o=!1){this.status=s,this.statusText=n||"",this.internal=o,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function _S(s){return s!=null&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.internal=="boolean"&&"data"in s}function SS(s){return s.map(n=>n.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var lx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function rx(s,n){let r=s;if(typeof r!="string"||!pS.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let o=r,c=!1;if(lx)try{let d=new URL(window.location.href),f=r.startsWith("//")?new URL(d.protocol+r):new URL(r),y=Os(f.pathname,n);f.origin===d.origin&&y!=null?r=y+f.search+f.hash:c=!0}catch{An(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:c,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var ix=["POST","PUT","PATCH","DELETE"];new Set(ix);var TS=["GET",...ix];new Set(TS);var Ll=p.createContext(null);Ll.displayName="DataRouter";var Po=p.createContext(null);Po.displayName="DataRouterState";var ox=p.createContext(!1);function jS(){return p.useContext(ox)}var cx=p.createContext({isTransitioning:!1});cx.displayName="ViewTransition";var wS=p.createContext(new Map);wS.displayName="Fetchers";var kS=p.createContext(null);kS.displayName="Await";var dn=p.createContext(null);dn.displayName="Navigation";var Kr=p.createContext(null);Kr.displayName="Location";var zn=p.createContext({outlet:null,matches:[],isDataRoute:!1});zn.displayName="Route";var eh=p.createContext(null);eh.displayName="RouteError";var ux="REACT_ROUTER_ERROR",ES="REDIRECT",CS="ROUTE_ERROR_RESPONSE";function NS(s){if(s.startsWith(`${ux}:${ES}:{`))try{let n=JSON.parse(s.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 AS(s){if(s.startsWith(`${ux}:${CS}:{`))try{let n=JSON.parse(s.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new bS(n.status,n.statusText,n.data)}catch{}}function RS(s,{relative:n}={}){ot(ql(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:o}=p.useContext(dn),{hash:c,pathname:d,search:f}=Xr(s,{relative:n}),y=d;return r!=="/"&&(y=d==="/"?r:as([r,d])),o.createHref({pathname:y,search:f,hash:c})}function ql(){return p.useContext(Kr)!=null}function Lt(){return ot(ql(),"useLocation() may be used only in the context of a <Router> component."),p.useContext(Kr).location}var dx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function hx(s){p.useContext(dn).static||p.useLayoutEffect(s)}function Re(){let{isDataRoute:s}=p.useContext(zn);return s?YS():zS()}function zS(){ot(ql(),"useNavigate() may be used only in the context of a <Router> component.");let s=p.useContext(Ll),{basename:n,navigator:r}=p.useContext(dn),{matches:o}=p.useContext(zn),{pathname:c}=Lt(),d=JSON.stringify(Wd(o)),f=p.useRef(!1);return hx(()=>{f.current=!0}),p.useCallback((g,m={})=>{if(An(f.current,dx),!f.current)return;if(typeof g=="number"){r.go(g);return}let x=Go(g,JSON.parse(d),c,m.relative==="path");s==null&&n!=="/"&&(x.pathname=x.pathname==="/"?n:as([n,x.pathname])),(m.replace?r.replace:r.push)(x,m.state,m)},[n,r,d,c,s])}var DS=p.createContext(null);function OS(s){let n=p.useContext(zn).outlet;return p.useMemo(()=>n&&p.createElement(DS.Provider,{value:s},n),[n,s])}function Wt(){let{matches:s}=p.useContext(zn),n=s[s.length-1];return n?n.params:{}}function Xr(s,{relative:n}={}){let{matches:r}=p.useContext(zn),{pathname:o}=Lt(),c=JSON.stringify(Wd(r));return p.useMemo(()=>Go(s,JSON.parse(c),o,n==="path"),[s,c,o,n])}function LS(s,n){return fx(s,n)}function fx(s,n,r){ot(ql(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=p.useContext(dn),{matches:c}=p.useContext(zn),d=c[c.length-1],f=d?d.params:{},y=d?d.pathname:"/",g=d?d.pathnameBase:"/",m=d&&d.route;{let C=m&&m.path||"";gx(y,!m||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${y}" (under <Route path="${C}">) 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.
|
|
10
|
-
|
|
11
|
-
Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let x=Lt(),S;if(n){let C=typeof n=="string"?Ol(n):n;ot(g==="/"||C.pathname?.startsWith(g),`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 "${g}" but pathname "${C.pathname}" was given in the \`location\` prop.`),S=C}else S=x;let v=S.pathname||"/",T=v;if(g!=="/"){let C=g.replace(/^\//,"").split("/");T="/"+v.replace(/^\//,"").split("/").slice(C.length).join("/")}let w=nx(s,{pathname:T});An(m||w!=null,`No routes matched location "${S.pathname}${S.search}${S.hash}" `),An(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${S.pathname}${S.search}${S.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 k=US(w&&w.map(C=>Object.assign({},C,{params:Object.assign({},f,C.params),pathname:as([g,o.encodeLocation?o.encodeLocation(C.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?g:as([g,o.encodeLocation?o.encodeLocation(C.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),c,r);return n&&k?p.createElement(Kr.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...S},navigationType:"POP"}},k):k}function qS(){let s=VS(),n=_S(s)?`${s.status} ${s.statusText}`:s instanceof Error?s.message:JSON.stringify(s),r=s instanceof Error?s.stack:null,o="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:o},d={padding:"2px 4px",backgroundColor:o},f=null;return console.error("Error handled by React Router default ErrorBoundary:",s),f=p.createElement(p.Fragment,null,p.createElement("p",null,"💿 Hey developer 👋"),p.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",p.createElement("code",{style:d},"ErrorBoundary")," or"," ",p.createElement("code",{style:d},"errorElement")," prop on your route.")),p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},n),r?p.createElement("pre",{style:c},r):null,f)}var MS=p.createElement(qS,null),px=class extends p.Component{constructor(s){super(s),this.state={location:s.location,revalidation:s.revalidation,error:s.error}}static getDerivedStateFromError(s){return{error:s}}static getDerivedStateFromProps(s,n){return n.location!==s.location||n.revalidation!=="idle"&&s.revalidation==="idle"?{error:s.error,location:s.location,revalidation:s.revalidation}:{error:s.error!==void 0?s.error:n.error,location:n.location,revalidation:s.revalidation||n.revalidation}}componentDidCatch(s,n){this.props.onError?this.props.onError(s,n):console.error("React Router caught the following error during render",s)}render(){let s=this.state.error;if(this.context&&typeof s=="object"&&s&&"digest"in s&&typeof s.digest=="string"){const r=AS(s.digest);r&&(s=r)}let n=s!==void 0?p.createElement(zn.Provider,{value:this.props.routeContext},p.createElement(eh.Provider,{value:s,children:this.props.component})):this.props.children;return this.context?p.createElement(BS,{error:s},n):n}};px.contextType=ox;var fd=new WeakMap;function BS({children:s,error:n}){let{basename:r}=p.useContext(dn);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let o=NS(n.digest);if(o){let c=fd.get(n);if(c)throw c;let d=rx(o.location,r);if(lx&&!fd.get(n))if(d.isExternal||o.reloadDocument)window.location.href=d.absoluteURL||d.to;else{const f=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(d.to,{replace:o.replace}));throw fd.set(n,f),f}return p.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d.absoluteURL||d.to}`})}}return s}function IS({routeContext:s,match:n,children:r}){let o=p.useContext(Ll);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),p.createElement(zn.Provider,{value:s},r)}function US(s,n=[],r){let o=r?.state;if(s==null){if(!o)return null;if(o.errors)s=o.matches;else if(n.length===0&&!o.initialized&&o.matches.length>0)s=o.matches;else return null}let c=s,d=o?.errors;if(d!=null){let x=c.findIndex(S=>S.route.id&&d?.[S.route.id]!==void 0);ot(x>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(d).join(",")}`),c=c.slice(0,Math.min(c.length,x+1))}let f=!1,y=-1;if(r&&o){f=o.renderFallback;for(let x=0;x<c.length;x++){let S=c[x];if((S.route.HydrateFallback||S.route.hydrateFallbackElement)&&(y=x),S.route.id){let{loaderData:v,errors:T}=o,w=S.route.loader&&!v.hasOwnProperty(S.route.id)&&(!T||T[S.route.id]===void 0);if(S.route.lazy||w){r.isStatic&&(f=!0),y>=0?c=c.slice(0,y+1):c=[c[0]];break}}}}let g=r?.onError,m=o&&g?(x,S)=>{g(x,{location:o.location,params:o.matches?.[0]?.params??{},unstable_pattern:SS(o.matches),errorInfo:S})}:void 0;return c.reduceRight((x,S,v)=>{let T,w=!1,k=null,C=null;o&&(T=d&&S.route.id?d[S.route.id]:void 0,k=S.route.errorElement||MS,f&&(y<0&&v===0?(gx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,C=null):y===v&&(w=!0,C=S.route.hydrateFallbackElement||null)));let j=n.concat(c.slice(0,v+1)),R=()=>{let L;return T?L=k:w?L=C:S.route.Component?L=p.createElement(S.route.Component,null):S.route.element?L=S.route.element:L=x,p.createElement(IS,{match:S,routeContext:{outlet:x,matches:j,isDataRoute:o!=null},children:L})};return o&&(S.route.ErrorBoundary||S.route.errorElement||v===0)?p.createElement(px,{location:o.location,revalidation:o.revalidation,component:k,error:T,children:R(),routeContext:{outlet:null,matches:j,isDataRoute:!0},onError:m}):R()},null)}function th(s){return`${s} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function $S(s){let n=p.useContext(Ll);return ot(n,th(s)),n}function HS(s){let n=p.useContext(Po);return ot(n,th(s)),n}function GS(s){let n=p.useContext(zn);return ot(n,th(s)),n}function nh(s){let n=GS(s),r=n.matches[n.matches.length-1];return ot(r.route.id,`${s} can only be used on routes that contain a unique "id"`),r.route.id}function PS(){return nh("useRouteId")}function VS(){let s=p.useContext(eh),n=HS("useRouteError"),r=nh("useRouteError");return s!==void 0?s:n.errors?.[r]}function YS(){let{router:s}=$S("useNavigate"),n=nh("useNavigate"),r=p.useRef(!1);return hx(()=>{r.current=!0}),p.useCallback(async(c,d={})=>{An(r.current,dx),r.current&&(typeof c=="number"?await s.navigate(c):await s.navigate(c,{fromRouteId:n,...d}))},[s,n])}var qm={};function gx(s,n,r){!n&&!qm[s]&&(qm[s]=!0,An(!1,r))}p.memo(FS);function FS({routes:s,future:n,state:r,isStatic:o,onError:c}){return fx(s,void 0,{state:r,isStatic:o,onError:c})}function Ma({to:s,replace:n,state:r,relative:o}){ot(ql(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c}=p.useContext(dn);An(!c,"<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:d}=p.useContext(zn),{pathname:f}=Lt(),y=Re(),g=Go(s,Wd(d),f,o==="path"),m=JSON.stringify(g);return p.useEffect(()=>{y(JSON.parse(m),{replace:n,state:r,relative:o})},[y,m,o,n,r]),null}function Ot(s){return OS(s.context)}function xe(s){ot(!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 QS({basename:s="/",children:n=null,location:r,navigationType:o="POP",navigator:c,static:d=!1,unstable_useTransitions:f}){ot(!ql(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let y=s.replace(/^\/*/,"/"),g=p.useMemo(()=>({basename:y,navigator:c,static:d,unstable_useTransitions:f,future:{}}),[y,c,d,f]);typeof r=="string"&&(r=Ol(r));let{pathname:m="/",search:x="",hash:S="",state:v=null,key:T="default",unstable_mask:w}=r,k=p.useMemo(()=>{let C=Os(m,y);return C==null?null:{location:{pathname:C,search:x,hash:S,state:v,key:T,unstable_mask:w},navigationType:o}},[y,m,x,S,v,T,o,w]);return An(k!=null,`<Router basename="${y}"> is not able to match the URL "${m}${x}${S}" because it does not start with the basename, so the <Router> won't render anything.`),k==null?null:p.createElement(dn.Provider,{value:g},p.createElement(Kr.Provider,{children:n,value:k}))}function is({children:s,location:n}){return LS(Bd(s),n)}function Bd(s,n=[]){let r=[];return p.Children.forEach(s,(o,c)=>{if(!p.isValidElement(o))return;let d=[...n,c];if(o.type===p.Fragment){r.push.apply(r,Bd(o.props.children,d));return}ot(o.type===xe,`[${typeof o.type=="string"?o.type:o.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),ot(!o.props.index||!o.props.children,"An index route cannot have child routes.");let f={id:o.props.id||d.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(f.children=Bd(o.props.children,d)),r.push(f)}),r}var Co="get",No="application/x-www-form-urlencoded";function Vo(s){return typeof HTMLElement<"u"&&s instanceof HTMLElement}function KS(s){return Vo(s)&&s.tagName.toLowerCase()==="button"}function XS(s){return Vo(s)&&s.tagName.toLowerCase()==="form"}function ZS(s){return Vo(s)&&s.tagName.toLowerCase()==="input"}function JS(s){return!!(s.metaKey||s.altKey||s.ctrlKey||s.shiftKey)}function WS(s,n){return s.button===0&&(!n||n==="_self")&&!JS(s)}function Id(s=""){return new URLSearchParams(typeof s=="string"||Array.isArray(s)||s instanceof URLSearchParams?s:Object.keys(s).reduce((n,r)=>{let o=s[r];return n.concat(Array.isArray(o)?o.map(c=>[r,c]):[[r,o]])},[]))}function eT(s,n){let r=Id(s);return n&&n.forEach((o,c)=>{r.has(c)||n.getAll(c).forEach(d=>{r.append(c,d)})}),r}var yo=null;function tT(){if(yo===null)try{new FormData(document.createElement("form"),0),yo=!1}catch{yo=!0}return yo}var nT=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function pd(s){return s!=null&&!nT.has(s)?(An(!1,`"${s}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${No}"`),null):s}function sT(s,n){let r,o,c,d,f;if(XS(s)){let y=s.getAttribute("action");o=y?Os(y,n):null,r=s.getAttribute("method")||Co,c=pd(s.getAttribute("enctype"))||No,d=new FormData(s)}else if(KS(s)||ZS(s)&&(s.type==="submit"||s.type==="image")){let y=s.form;if(y==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let g=s.getAttribute("formaction")||y.getAttribute("action");if(o=g?Os(g,n):null,r=s.getAttribute("formmethod")||y.getAttribute("method")||Co,c=pd(s.getAttribute("formenctype"))||pd(y.getAttribute("enctype"))||No,d=new FormData(y,s),!tT()){let{name:m,type:x,value:S}=s;if(x==="image"){let v=m?`${m}.`:"";d.append(`${v}x`,"0"),d.append(`${v}y`,"0")}else m&&d.append(m,S)}}else{if(Vo(s))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=Co,o=null,c=No,f=s}return d&&c==="text/plain"&&(f=d,d=void 0),{action:o,method:r.toLowerCase(),encType:c,formData:d,body:f}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function sh(s,n){if(s===!1||s===null||typeof s>"u")throw new Error(n)}function mx(s,n,r,o){let c=typeof s=="string"?new URL(s,typeof window>"u"?"server://singlefetch/":window.location.origin):s;return r?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${o}`:c.pathname=`${c.pathname}.${o}`:c.pathname==="/"?c.pathname=`_root.${o}`:n&&Os(c.pathname,n)==="/"?c.pathname=`${n.replace(/\/$/,"")}/_root.${o}`:c.pathname=`${c.pathname.replace(/\/$/,"")}.${o}`,c}async function aT(s,n){if(s.id in n)return n[s.id];try{let r=await import(s.module);return n[s.id]=r,r}catch(r){return console.error(`Error loading route module \`${s.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function lT(s){return s==null?!1:s.href==null?s.rel==="preload"&&typeof s.imageSrcSet=="string"&&typeof s.imageSizes=="string":typeof s.rel=="string"&&typeof s.href=="string"}async function rT(s,n,r){let o=await Promise.all(s.map(async c=>{let d=n.routes[c.route.id];if(d){let f=await aT(d,r);return f.links?f.links():[]}return[]}));return uT(o.flat(1).filter(lT).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function Mm(s,n,r,o,c,d){let f=(g,m)=>r[m]?g.route.id!==r[m].route.id:!0,y=(g,m)=>r[m].pathname!==g.pathname||r[m].route.path?.endsWith("*")&&r[m].params["*"]!==g.params["*"];return d==="assets"?n.filter((g,m)=>f(g,m)||y(g,m)):d==="data"?n.filter((g,m)=>{let x=o.routes[g.route.id];if(!x||!x.hasLoader)return!1;if(f(g,m)||y(g,m))return!0;if(g.route.shouldRevalidate){let S=g.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:r[0]?.params||{},nextUrl:new URL(s,window.origin),nextParams:g.params,defaultShouldRevalidate:!0});if(typeof S=="boolean")return S}return!0}):[]}function iT(s,n,{includeHydrateFallback:r}={}){return oT(s.map(o=>{let c=n.routes[o.route.id];if(!c)return[];let d=[c.module];return c.clientActionModule&&(d=d.concat(c.clientActionModule)),c.clientLoaderModule&&(d=d.concat(c.clientLoaderModule)),r&&c.hydrateFallbackModule&&(d=d.concat(c.hydrateFallbackModule)),c.imports&&(d=d.concat(c.imports)),d}).flat(1))}function oT(s){return[...new Set(s)]}function cT(s){let n={},r=Object.keys(s).sort();for(let o of r)n[o]=s[o];return n}function uT(s,n){let r=new Set;return new Set(n),s.reduce((o,c)=>{let d=JSON.stringify(cT(c));return r.has(d)||(r.add(d),o.push({key:d,link:c})),o},[])}function ah(){let s=p.useContext(Ll);return sh(s,"You must render this element inside a <DataRouterContext.Provider> element"),s}function dT(){let s=p.useContext(Po);return sh(s,"You must render this element inside a <DataRouterStateContext.Provider> element"),s}var lh=p.createContext(void 0);lh.displayName="FrameworkContext";function rh(){let s=p.useContext(lh);return sh(s,"You must render this element inside a <HydratedRouter> element"),s}function hT(s,n){let r=p.useContext(lh),[o,c]=p.useState(!1),[d,f]=p.useState(!1),{onFocus:y,onBlur:g,onMouseEnter:m,onMouseLeave:x,onTouchStart:S}=n,v=p.useRef(null);p.useEffect(()=>{if(s==="render"&&f(!0),s==="viewport"){let k=j=>{j.forEach(R=>{f(R.isIntersecting)})},C=new IntersectionObserver(k,{threshold:.5});return v.current&&C.observe(v.current),()=>{C.disconnect()}}},[s]),p.useEffect(()=>{if(o){let k=setTimeout(()=>{f(!0)},100);return()=>{clearTimeout(k)}}},[o]);let T=()=>{c(!0)},w=()=>{c(!1),f(!1)};return r?s!=="intent"?[d,v,{}]:[d,v,{onFocus:Or(y,T),onBlur:Or(g,w),onMouseEnter:Or(m,T),onMouseLeave:Or(x,w),onTouchStart:Or(S,T)}]:[!1,v,{}]}function Or(s,n){return r=>{s&&s(r),r.defaultPrevented||n(r)}}function fT({page:s,...n}){let r=jS(),{router:o}=ah(),c=p.useMemo(()=>nx(o.routes,s,o.basename),[o.routes,s,o.basename]);return c?r?p.createElement(gT,{page:s,matches:c,...n}):p.createElement(mT,{page:s,matches:c,...n}):null}function pT(s){let{manifest:n,routeModules:r}=rh(),[o,c]=p.useState([]);return p.useEffect(()=>{let d=!1;return rT(s,n,r).then(f=>{d||c(f)}),()=>{d=!0}},[s,n,r]),o}function gT({page:s,matches:n,...r}){let o=Lt(),{future:c}=rh(),{basename:d}=ah(),f=p.useMemo(()=>{if(s===o.pathname+o.search+o.hash)return[];let y=mx(s,d,c.unstable_trailingSlashAwareDataRequests,"rsc"),g=!1,m=[];for(let x of n)typeof x.route.shouldRevalidate=="function"?g=!0:m.push(x.route.id);return g&&m.length>0&&y.searchParams.set("_routes",m.join(",")),[y.pathname+y.search]},[d,c.unstable_trailingSlashAwareDataRequests,s,o,n]);return p.createElement(p.Fragment,null,f.map(y=>p.createElement("link",{key:y,rel:"prefetch",as:"fetch",href:y,...r})))}function mT({page:s,matches:n,...r}){let o=Lt(),{future:c,manifest:d,routeModules:f}=rh(),{basename:y}=ah(),{loaderData:g,matches:m}=dT(),x=p.useMemo(()=>Mm(s,n,m,d,o,"data"),[s,n,m,d,o]),S=p.useMemo(()=>Mm(s,n,m,d,o,"assets"),[s,n,m,d,o]),v=p.useMemo(()=>{if(s===o.pathname+o.search+o.hash)return[];let k=new Set,C=!1;if(n.forEach(R=>{let L=d.routes[R.route.id];!L||!L.hasLoader||(!x.some(N=>N.route.id===R.route.id)&&R.route.id in g&&f[R.route.id]?.shouldRevalidate||L.hasClientLoader?C=!0:k.add(R.route.id))}),k.size===0)return[];let j=mx(s,y,c.unstable_trailingSlashAwareDataRequests,"data");return C&&k.size>0&&j.searchParams.set("_routes",n.filter(R=>k.has(R.route.id)).map(R=>R.route.id).join(",")),[j.pathname+j.search]},[y,c.unstable_trailingSlashAwareDataRequests,g,o,d,x,n,s,f]),T=p.useMemo(()=>iT(S,d),[S,d]),w=pT(S);return p.createElement(p.Fragment,null,v.map(k=>p.createElement("link",{key:k,rel:"prefetch",as:"fetch",href:k,...r})),T.map(k=>p.createElement("link",{key:k,rel:"modulepreload",href:k,...r})),w.map(({key:k,link:C})=>p.createElement("link",{key:k,nonce:r.nonce,...C,crossOrigin:C.crossOrigin??r.crossOrigin})))}function yT(...s){return n=>{s.forEach(r=>{typeof r=="function"?r(n):r!=null&&(r.current=n)})}}var xT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{xT&&(window.__reactRouterVersion="7.14.0")}catch{}function vT({basename:s,children:n,unstable_useTransitions:r,window:o}){let c=p.useRef();c.current==null&&(c.current=Z_({window:o,v5Compat:!0}));let d=c.current,[f,y]=p.useState({action:d.action,location:d.location}),g=p.useCallback(m=>{r===!1?y(m):p.startTransition(()=>y(m))},[r]);return p.useLayoutEffect(()=>d.listen(g),[d,g]),p.createElement(QS,{basename:s,children:n,location:f.location,navigationType:f.action,navigator:d,unstable_useTransitions:r})}var yx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ls=p.forwardRef(function({onClick:n,discover:r="render",prefetch:o="none",relative:c,reloadDocument:d,replace:f,unstable_mask:y,state:g,target:m,to:x,preventScrollReset:S,viewTransition:v,unstable_defaultShouldRevalidate:T,...w},k){let{basename:C,navigator:j,unstable_useTransitions:R}=p.useContext(dn),L=typeof x=="string"&&yx.test(x),N=rx(x,C);x=N.to;let M=RS(x,{relative:c}),A=Lt(),z=null;if(y){let ue=Go(y,[],A.unstable_mask?A.unstable_mask.pathname:"/",!0);C!=="/"&&(ue.pathname=ue.pathname==="/"?C:as([C,ue.pathname])),z=j.createHref(ue)}let[I,H,P]=hT(o,w),U=TT(x,{replace:f,unstable_mask:y,state:g,target:m,preventScrollReset:S,relative:c,viewTransition:v,unstable_defaultShouldRevalidate:T,unstable_useTransitions:R});function J(ue){n&&n(ue),ue.defaultPrevented||U(ue)}let X=!(N.isExternal||d),te=p.createElement("a",{...w,...P,href:(X?z:void 0)||N.absoluteURL||M,onClick:X?J:n,ref:yT(k,H),target:m,"data-discover":!L&&r==="render"?"true":void 0});return I&&!L?p.createElement(p.Fragment,null,te,p.createElement(fT,{page:M})):te});Ls.displayName="Link";var bT=p.forwardRef(function({"aria-current":n="page",caseSensitive:r=!1,className:o="",end:c=!1,style:d,to:f,viewTransition:y,children:g,...m},x){let S=Xr(f,{relative:m.relative}),v=Lt(),T=p.useContext(Po),{navigator:w,basename:k}=p.useContext(dn),C=T!=null&&CT(S)&&y===!0,j=w.encodeLocation?w.encodeLocation(S).pathname:S.pathname,R=v.pathname,L=T&&T.navigation&&T.navigation.location?T.navigation.location.pathname:null;r||(R=R.toLowerCase(),L=L?L.toLowerCase():null,j=j.toLowerCase()),L&&k&&(L=Os(L,k)||L);const N=j!=="/"&&j.endsWith("/")?j.length-1:j.length;let M=R===j||!c&&R.startsWith(j)&&R.charAt(N)==="/",A=L!=null&&(L===j||!c&&L.startsWith(j)&&L.charAt(j.length)==="/"),z={isActive:M,isPending:A,isTransitioning:C},I=M?n:void 0,H;typeof o=="function"?H=o(z):H=[o,M?"active":null,A?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let P=typeof d=="function"?d(z):d;return p.createElement(Ls,{...m,"aria-current":I,className:H,ref:x,style:P,to:f,viewTransition:y},typeof g=="function"?g(z):g)});bT.displayName="NavLink";var _T=p.forwardRef(({discover:s="render",fetcherKey:n,navigate:r,reloadDocument:o,replace:c,state:d,method:f=Co,action:y,onSubmit:g,relative:m,preventScrollReset:x,viewTransition:S,unstable_defaultShouldRevalidate:v,...T},w)=>{let{unstable_useTransitions:k}=p.useContext(dn),C=kT(),j=ET(y,{relative:m}),R=f.toLowerCase()==="get"?"get":"post",L=typeof y=="string"&&yx.test(y),N=M=>{if(g&&g(M),M.defaultPrevented)return;M.preventDefault();let A=M.nativeEvent.submitter,z=A?.getAttribute("formmethod")||f,I=()=>C(A||M.currentTarget,{fetcherKey:n,method:z,navigate:r,replace:c,state:d,relative:m,preventScrollReset:x,viewTransition:S,unstable_defaultShouldRevalidate:v});k&&r!==!1?p.startTransition(()=>I()):I()};return p.createElement("form",{ref:w,method:R,action:j,onSubmit:o?g:N,...T,"data-discover":!L&&s==="render"?"true":void 0})});_T.displayName="Form";function ST(s){return`${s} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function xx(s){let n=p.useContext(Ll);return ot(n,ST(s)),n}function TT(s,{target:n,replace:r,unstable_mask:o,state:c,preventScrollReset:d,relative:f,viewTransition:y,unstable_defaultShouldRevalidate:g,unstable_useTransitions:m}={}){let x=Re(),S=Lt(),v=Xr(s,{relative:f});return p.useCallback(T=>{if(WS(T,n)){T.preventDefault();let w=r!==void 0?r:Qr(S)===Qr(v),k=()=>x(s,{replace:w,unstable_mask:o,state:c,preventScrollReset:d,relative:f,viewTransition:y,unstable_defaultShouldRevalidate:g});m?p.startTransition(()=>k()):k()}},[S,x,v,r,o,c,n,s,d,f,y,g,m])}function ih(s){An(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=p.useRef(Id(s)),r=p.useRef(!1),o=Lt(),c=p.useMemo(()=>eT(o.search,r.current?null:n.current),[o.search]),d=Re(),f=p.useCallback((y,g)=>{const m=Id(typeof y=="function"?y(new URLSearchParams(c)):y);r.current=!0,d("?"+m,g)},[d,c]);return[c,f]}var jT=0,wT=()=>`__${String(++jT)}__`;function kT(){let{router:s}=xx("useSubmit"),{basename:n}=p.useContext(dn),r=PS(),o=s.fetch,c=s.navigate;return p.useCallback(async(d,f={})=>{let{action:y,method:g,encType:m,formData:x,body:S}=sT(d,n);if(f.navigate===!1){let v=f.fetcherKey||wT();await o(v,r,f.action||y,{unstable_defaultShouldRevalidate:f.unstable_defaultShouldRevalidate,preventScrollReset:f.preventScrollReset,formData:x,body:S,formMethod:f.method||g,formEncType:f.encType||m,flushSync:f.flushSync})}else await c(f.action||y,{unstable_defaultShouldRevalidate:f.unstable_defaultShouldRevalidate,preventScrollReset:f.preventScrollReset,formData:x,body:S,formMethod:f.method||g,formEncType:f.encType||m,replace:f.replace,state:f.state,fromRouteId:r,flushSync:f.flushSync,viewTransition:f.viewTransition})},[o,c,n,r])}function ET(s,{relative:n}={}){let{basename:r}=p.useContext(dn),o=p.useContext(zn);ot(o,"useFormAction must be used inside a RouteContext");let[c]=o.matches.slice(-1),d={...Xr(s||".",{relative:n})},f=Lt();if(s==null){d.search=f.search;let y=new URLSearchParams(d.search),g=y.getAll("index");if(g.some(x=>x==="")){y.delete("index"),g.filter(S=>S).forEach(S=>y.append("index",S));let x=y.toString();d.search=x?`?${x}`:""}}return(!s||s===".")&&c.route.index&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(d.pathname=d.pathname==="/"?r:as([r,d.pathname])),Qr(d)}function CT(s,{relative:n}={}){let r=p.useContext(cx);ot(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=xx("useViewTransitionState"),c=Xr(s,{relative:n});if(!r.isTransitioning)return!1;let d=Os(r.currentLocation.pathname,o)||r.currentLocation.pathname,f=Os(r.nextLocation.pathname,o)||r.nextLocation.pathname;return Lo(c.pathname,f)!=null||Lo(c.pathname,d)!=null}const vx=p.createContext(void 0);function NT({children:s}){const[n,r]=p.useState(()=>localStorage.getItem("theme")||"light");p.useEffect(()=>{document.documentElement.setAttribute("data-theme",n),localStorage.setItem("theme",n)},[n]);const o=c=>{r(c)};return a.jsx(vx.Provider,{value:{theme:n,setTheme:o},children:s})}function AT(){const s=p.useContext(vx);if(!s)throw new Error("useTheme must be used within ThemeProvider");return s}let Bm=class extends Error{url;status;statusText;body;request;constructor(n,r,o){super(o),this.name="ApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.body=r.body,this.request=n}};class RT extends Error{constructor(n){super(n),this.name="CancelError"}get isCancelled(){return!0}}class zT{#t;#e;#n;#s;#l;#r;#a;constructor(n){this.#t=!1,this.#e=!1,this.#n=!1,this.#s=[],this.#l=new Promise((r,o)=>{this.#r=r,this.#a=o;const c=y=>{this.#t||this.#e||this.#n||(this.#t=!0,this.#r&&this.#r(y))},d=y=>{this.#t||this.#e||this.#n||(this.#e=!0,this.#a&&this.#a(y))},f=y=>{this.#t||this.#e||this.#n||this.#s.push(y)};return Object.defineProperty(f,"isResolved",{get:()=>this.#t}),Object.defineProperty(f,"isRejected",{get:()=>this.#e}),Object.defineProperty(f,"isCancelled",{get:()=>this.#n}),n(c,d,f)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(n,r){return this.#l.then(n,r)}catch(n){return this.#l.catch(n)}finally(n){return this.#l.finally(n)}cancel(){if(!(this.#t||this.#e||this.#n)){if(this.#n=!0,this.#s.length)try{for(const n of this.#s)n()}catch(n){console.warn("Cancellation threw an error",n);return}this.#s.length=0,this.#a&&this.#a(new RT("Request aborted"))}}get isCancelled(){return this.#n}}const Ge={BASE:"",VERSION:"1.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:void 0,USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0};var Im;(function(s){(function(n){n.NOT_STARTED="NOT_STARTED",n.IN_PROGRESS="IN_PROGRESS",n.FOR_REVIEW="FOR_REVIEW",n.DONE="DONE"})(s.taskStatus||(s.taskStatus={})),(function(n){n.NOT_STARTED="NOT_STARTED",n.IN_PROGRESS="IN_PROGRESS",n.FOR_REVIEW="FOR_REVIEW",n.DONE="DONE"})(s.taskStatusBeforeClaim||(s.taskStatusBeforeClaim={}))})(Im||(Im={}));var Um;(function(s){(function(n){n.HUMAN="human",n.AGENT="agent"})(s.type||(s.type={}))})(Um||(Um={}));var $m;(function(s){(function(n){n.CLAUDE="claude",n.CODEX="codex",n.OPENCODE="opencode",n.ADK="adk",n.GITHUBCOPILOT="githubcopilot",n.OTHER="other"})(s.type||(s.type={}))})($m||($m={}));var Hm;(function(s){(function(n){n.CLAUDE="claude",n.CODEX="codex",n.OPENCODE="opencode",n.ADK="adk",n.GITHUBCOPILOT="githubcopilot",n.OTHER="other"})(s.type||(s.type={}))})(Hm||(Hm={}));var Gm;(function(s){(function(n){n.CLAUDE="claude",n.CODEX="codex",n.OPENCODE="opencode",n.ADK="adk",n.GITHUBCOPILOT="githubcopilot",n.OTHER="other"})(s.type||(s.type={}))})(Gm||(Gm={}));var Pm;(function(s){(function(n){n.HTTP="http",n.STDIO="stdio"})(s.type||(s.type={}))})(Pm||(Pm={}));var Vm;(function(s){(function(n){n.NOT_STARTED="not_started",n.USER_CONSENT_REJECTED="USER_CONSENT_REJECTED",n.MCP_AUTH_FLOW_STARTED="mcp_auth_flow_started",n.MCP_AUTH_FLOW_COMPLETED="mcp_auth_flow_completed",n.CONNECTIONS_FLOW_STARTED="connections_flow_started",n.CONNECTIONS_FLOW_COMPLETED="connections_flow_completed",n.AUTHORIZATION_CODE_ISSUED="authorization_code_issued",n.AUTHORIZATION_CODE_EXCHANGED="authorization_code_exchanged"})(s.status||(s.status={}))})(Vm||(Vm={}));var Ym;(function(s){(function(n){n.NOT_STARTED="NOT_STARTED",n.IN_PROGRESS="IN_PROGRESS",n.FOR_REVIEW="FOR_REVIEW",n.DONE="DONE"})(s.status||(s.status={}))})(Ym||(Ym={}));var Fm;(function(s){(function(n){n.OPENAI="openai",n.ADK="adk"})(s.type||(s.type={}))})(Fm||(Fm={}));var Qm;(function(s){(function(n){n.NONE="none",n.CLIENT_SECRET_BASIC="client_secret_basic"})(s.token_endpoint_auth_method||(s.token_endpoint_auth_method={}))})(Qm||(Qm={}));var Km;(function(s){(function(n){n.PENDING="pending",n.AUTHORIZED="authorized",n.FAILED="failed"})(s.status||(s.status={}))})(Km||(Km={}));var Xm;(function(s){(function(n){n.CLAUDE="claude",n.CODEX="codex",n.OPENCODE="opencode",n.ADK="adk",n.GITHUBCOPILOT="githubcopilot",n.OTHER="other"})(s.type||(s.type={}))})(Xm||(Xm={}));var Zm;(function(s){(function(n){n.OPENAI="openai",n.ADK="adk"})(s.type||(s.type={}))})(Zm||(Zm={}));var Jm;(function(s){(function(n){n.HTTP="http",n.STDIO="stdio"})(s.type||(s.type={}))})(Jm||(Jm={}));var Wm;(function(s){(function(n){n.CLIENT_NOT_REGISTERED="CLIENT_NOT_REGISTERED",n.CLIENT_REGISTERED="CLIENT_REGISTERED",n.AUTHORIZATION_REQUEST_STARTED="AUTHORIZATION_REQUEST_STARTED",n.USER_CONSENT_OK="USER_CONSENT_OK",n.USER_CONSENT_REJECTED="USER_CONSENT_REJECTED",n.WAITING_ON_DOWNSTREAM_AUTH="WAITING_ON_DOWNSTREAM_AUTH",n.AUTHORIZATION_CODE_ISSUED="AUTHORIZATION_CODE_ISSUED",n.AUTHORIZATION_CODE_EXCHANGED="AUTHORIZATION_CODE_EXCHANGED"})(s.status||(s.status={}))})(Wm||(Wm={}));var ey;(function(s){(function(n){n.TASK="task",n.CONTEXT_BLOCK="context_block",n.AGENT="agent",n.PROJECT="project",n.TAG="tag",n.TOOL="tool"})(s.type||(s.type={}))})(ey||(ey={}));var ty;(function(s){(function(n){n.ACCESS_TOKEN="access_token",n.REFRESH_TOKEN="refresh_token"})(s.token_type_hint||(s.token_type_hint={}))})(ty||(ty={}));var ny;(function(s){(function(n){n.BEARER="Bearer"})(s.token_type||(s.token_type={}))})(ny||(ny={}));var sy;(function(s){(function(n){n.CLIENT_NOT_REGISTERED="CLIENT_NOT_REGISTERED",n.CLIENT_REGISTERED="CLIENT_REGISTERED",n.AUTHORIZATION_REQUEST_STARTED="AUTHORIZATION_REQUEST_STARTED",n.USER_CONSENT_OK="USER_CONSENT_OK",n.USER_CONSENT_REJECTED="USER_CONSENT_REJECTED",n.WAITING_ON_DOWNSTREAM_AUTH="WAITING_ON_DOWNSTREAM_AUTH",n.AUTHORIZATION_CODE_ISSUED="AUTHORIZATION_CODE_ISSUED",n.AUTHORIZATION_CODE_EXCHANGED="AUTHORIZATION_CODE_EXCHANGED"})(s.status||(s.status={}))})(sy||(sy={}));var ay;(function(s){(function(n){n.CLAUDE="claude",n.CODEX="codex",n.OPENCODE="opencode",n.ADK="adk",n.GITHUBCOPILOT="githubcopilot",n.OTHER="other"})(s.type||(s.type={}))})(ay||(ay={}));var ly;(function(s){(function(n){n.NONE="none",n.CLIENT_SECRET_BASIC="client_secret_basic"})(s.token_endpoint_auth_method||(s.token_endpoint_auth_method={}))})(ly||(ly={}));var ry;(function(s){(function(n){n.HTTP="http",n.STDIO="stdio"})(s.type||(s.type={}))})(ry||(ry={}));var iy;(function(s){(function(n){n.SUCCEEDED="SUCCEEDED",n.FAILED="FAILED",n.STALE="STALE",n.CANCELLED="CANCELLED"})(s.status||(s.status={})),(function(n){n.OUT_OF_QUOTA="OUT_OF_QUOTA",n.INTERRUPTED="INTERRUPTED",n.UNKNOWN="UNKNOWN"})(s.errorCode||(s.errorCode={}))})(iy||(iy={}));var oy;(function(s){(function(n){n.NOT_STARTED="NOT_STARTED",n.IN_PROGRESS="IN_PROGRESS",n.FOR_REVIEW="FOR_REVIEW",n.DONE="DONE"})(s.taskStatus||(s.taskStatus={})),(function(n){n.SUCCEEDED="SUCCEEDED",n.FAILED="FAILED",n.STALE="STALE",n.CANCELLED="CANCELLED"})(s.status||(s.status={})),(function(n){n.OUT_OF_QUOTA="OUT_OF_QUOTA",n.INTERRUPTED="INTERRUPTED",n.UNKNOWN="UNKNOWN"})(s.errorCode||(s.errorCode={}))})(oy||(oy={}));var cy;(function(s){(function(n){n.NOT_STARTED="NOT_STARTED",n.IN_PROGRESS="IN_PROGRESS",n.FOR_REVIEW="FOR_REVIEW",n.DONE="DONE"})(s.taskStatus||(s.taskStatus={}))})(cy||(cy={}));var uy;(function(s){(function(n){n.NOT_STARTED="NOT_STARTED",n.IN_PROGRESS="IN_PROGRESS",n.FOR_REVIEW="FOR_REVIEW",n.DONE="DONE"})(s.status||(s.status={}))})(uy||(uy={}));var dy;(function(s){(function(n){n.NOT_STARTED="NOT_STARTED",n.IN_PROGRESS="IN_PROGRESS",n.FOR_REVIEW="FOR_REVIEW",n.DONE="DONE"})(s.status||(s.status={}))})(dy||(dy={}));var hy;(function(s){(function(n){n.URN_IETF_PARAMS_OAUTH_GRANT_TYPE_TOKEN_EXCHANGE="urn:ietf:params:oauth:grant-type:token-exchange"})(s.grant_type||(s.grant_type={})),(function(n){n.URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ACCESS_TOKEN="urn:ietf:params:oauth:token-type:access_token"})(s.subject_token_type||(s.subject_token_type={}))})(hy||(hy={}));var fy;(function(s){(function(n){n.AUTHORIZATION_CODE="authorization_code",n.REFRESH_TOKEN="refresh_token"})(s.grant_type||(s.grant_type={}))})(fy||(fy={}));var py;(function(s){(function(n){n.BEARER="Bearer"})(s.token_type||(s.token_type={}))})(py||(py={}));var gy;(function(s){(function(n){n.HTTP="http",n.STDIO="stdio"})(s.type||(s.type={}))})(gy||(gy={}));var my;(function(s){(function(n){n.ADMIN="admin",n.STANDARD="standard"})(s.role||(s.role={})),(function(n){n.FULL_PAGE="FULL_PAGE",n.BANNER="BANNER",n.OFF="OFF"})(s.onboardingDisplayMode||(s.onboardingDisplayMode={}))})(my||(my={}));var yy;(function(s){(function(n){n.FULL_PAGE="FULL_PAGE",n.BANNER="BANNER",n.OFF="OFF"})(s.onboardingDisplayMode||(s.onboardingDisplayMode={}))})(yy||(yy={}));const oh=s=>s!=null,Zr=s=>typeof s=="string",gd=s=>Zr(s)&&s!=="",ch=s=>typeof s=="object"&&typeof s.type=="string"&&typeof s.stream=="function"&&typeof s.arrayBuffer=="function"&&typeof s.constructor=="function"&&typeof s.constructor.name=="string"&&/^(Blob|File)$/.test(s.constructor.name)&&/^(Blob|File)$/.test(s[Symbol.toStringTag]),bx=s=>s instanceof FormData,DT=s=>{try{return btoa(s)}catch{return Buffer.from(s).toString("base64")}},OT=s=>{const n=[],r=(c,d)=>{n.push(`${encodeURIComponent(c)}=${encodeURIComponent(String(d))}`)},o=(c,d)=>{oh(d)&&(Array.isArray(d)?d.forEach(f=>{o(c,f)}):typeof d=="object"?Object.entries(d).forEach(([f,y])=>{o(`${c}[${f}]`,y)}):r(c,d))};return Object.entries(s).forEach(([c,d])=>{o(c,d)}),n.length>0?`?${n.join("&")}`:""},LT=(s,n)=>{const r=s.ENCODE_PATH||encodeURI,o=n.url.replace("{api-version}",s.VERSION).replace(/{(.*?)}/g,(d,f)=>n.path?.hasOwnProperty(f)?r(String(n.path[f])):d),c=`${s.BASE}${o}`;return n.query?`${c}${OT(n.query)}`:c},qT=s=>{if(s.formData){const n=new FormData,r=(o,c)=>{Zr(c)||ch(c)?n.append(o,c):n.append(o,JSON.stringify(c))};return Object.entries(s.formData).filter(([o,c])=>oh(c)).forEach(([o,c])=>{Array.isArray(c)?c.forEach(d=>r(o,d)):r(o,c)}),n}},xo=async(s,n)=>typeof n=="function"?n(s):n,MT=async(s,n)=>{const[r,o,c,d]=await Promise.all([xo(n,s.TOKEN),xo(n,s.USERNAME),xo(n,s.PASSWORD),xo(n,s.HEADERS)]),f=Object.entries({Accept:"application/json",...d,...n.headers}).filter(([y,g])=>oh(g)).reduce((y,[g,m])=>({...y,[g]:String(m)}),{});if(gd(r)&&(f.Authorization=`Bearer ${r}`),gd(o)&&gd(c)){const y=DT(`${o}:${c}`);f.Authorization=`Basic ${y}`}return n.body!==void 0&&(n.mediaType?f["Content-Type"]=n.mediaType:ch(n.body)?f["Content-Type"]=n.body.type||"application/octet-stream":Zr(n.body)?f["Content-Type"]="text/plain":bx(n.body)||(f["Content-Type"]="application/json")),new Headers(f)},BT=s=>{if(s.body!==void 0)return s.mediaType?.includes("/json")?JSON.stringify(s.body):Zr(s.body)||ch(s.body)||bx(s.body)?s.body:JSON.stringify(s.body)},IT=async(s,n,r,o,c,d,f)=>{const y=new AbortController,g={headers:d,body:o??c,method:n.method,signal:y.signal};return s.WITH_CREDENTIALS&&(g.credentials=s.CREDENTIALS),f(()=>y.abort()),await fetch(r,g)},UT=(s,n)=>{if(n){const r=s.headers.get(n);if(Zr(r))return r}},$T=async s=>{if(s.status!==204)try{const n=s.headers.get("Content-Type");if(n)return["application/json","application/problem+json"].some(c=>n.toLowerCase().startsWith(c))?await s.json():await s.text()}catch(n){console.error(n)}},HT=(s,n)=>{const o={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...s.errors}[n.status];if(o)throw new Bm(s,n,o);if(!n.ok){const c=n.status??"unknown",d=n.statusText??"unknown",f=(()=>{try{return JSON.stringify(n.body,null,2)}catch{return}})();throw new Bm(s,n,`Generic Error: status: ${c}; status text: ${d}; body: ${f}`)}},We=(s,n)=>new zT(async(r,o,c)=>{try{const d=LT(s,n),f=qT(n),y=BT(n),g=await MT(s,n);if(!c.isCancelled){const m=await IT(s,n,d,y,f,g,c),x=await $T(m),S=UT(m,n.responseHeader),v={url:d,ok:m.ok,status:m.status,statusText:m.statusText,body:S??x};HT(n,v),r(v.body)}}catch(d){o(d)}});class _x{static actorControllerListActors(n=Ge){return We(n,{method:"GET",url:"/api/v1/actors"})}static actorControllerSearchActors(n,r=10,o=.3,c=Ge){return We(c,{method:"GET",url:"/api/v1/actors/search",query:{query:n,limit:r,threshold:o}})}}class $r{static chatProvidersControllerCreateChatProvider(n,r=Ge){return We(r,{method:"POST",url:"/api/v1/chat-providers",body:n,mediaType:"application/json"})}static chatProvidersControllerListChatProviders(n=Ge){return We(n,{method:"GET",url:"/api/v1/chat-providers"})}static chatProvidersControllerGetChatProvider(n,r=Ge){return We(r,{method:"GET",url:"/api/v1/chat-providers/{id}",path:{id:n},errors:{404:"Chat provider not found"}})}static chatProvidersControllerUpdateChatProvider(n,r,o=Ge){return We(o,{method:"PATCH",url:"/api/v1/chat-providers/{id}",path:{id:n},body:r,mediaType:"application/json",errors:{404:"Chat provider not found"}})}static chatProvidersControllerDeleteChatProvider(n,r=Ge){return We(r,{method:"DELETE",url:"/api/v1/chat-providers/{id}",path:{id:n},errors:{404:"Chat provider not found"}})}static chatProvidersControllerSetActiveChatProvider(n,r=Ge){return We(r,{method:"POST",url:"/api/v1/chat-providers/set-active",body:n,mediaType:"application/json",errors:{404:"Chat provider not found"}})}static chatProvidersControllerDeactivateActiveChatProvider(n=Ge){return We(n,{method:"POST",url:"/api/v1/chat-providers/deactivate"})}}let GT=class{static metaControllerCreateTag(n,r=Ge){return We(r,{method:"POST",url:"/api/v1/meta/tags",body:n,mediaType:"application/json",errors:{400:"Invalid input data"}})}static metaControllerGetAllTags(n=Ge){return We(n,{method:"GET",url:"/api/v1/meta/tags"})}static metaControllerGetTagColors(n=Ge){return We(n,{method:"GET",url:"/api/v1/meta/tags/colors"})}static metaControllerDeleteTag(n,r=Ge){return We(r,{method:"DELETE",url:"/api/v1/meta/tags/{tagId}",path:{tagId:n},errors:{404:"Tag not found"}})}};class xy{static projectsControllerCreateProject(n,r=Ge){return We(r,{method:"POST",url:"/api/v1/meta/projects",body:n,mediaType:"application/json",errors:{400:"Invalid input data"}})}static projectsControllerGetAllProjects(n=Ge){return We(n,{method:"GET",url:"/api/v1/meta/projects"})}static projectsControllerSearchProjects(n,r,o,c=Ge){return We(c,{method:"GET",url:"/api/v1/meta/projects/search",query:{q:n,limit:r,threshold:o}})}static projectsControllerGetProjectBySlug(n,r=Ge){return We(r,{method:"GET",url:"/api/v1/meta/projects/by-slug/{slug}",path:{slug:n},errors:{404:"Project not found"}})}static projectsControllerGetProject(n,r=Ge){return We(r,{method:"GET",url:"/api/v1/meta/projects/{projectId}",path:{projectId:n},errors:{404:"Project not found"}})}static projectsControllerUpdateProject(n,r,o=Ge){return We(o,{method:"PATCH",url:"/api/v1/meta/projects/{projectId}",path:{projectId:n},body:r,mediaType:"application/json",errors:{400:"Invalid input data",404:"Project not found"}})}static projectsControllerDeleteProject(n,r=Ge){return We(r,{method:"DELETE",url:"/api/v1/meta/projects/{projectId}",path:{projectId:n},errors:{404:"Project not found"}})}}class zs{static webAuthControllerLogin(n,r=Ge){return We(r,{method:"POST",url:"/api/v1/auth/login",body:n,mediaType:"application/json",errors:{401:"Invalid credentials"}})}static webAuthControllerRefresh(n=Ge){return We(n,{method:"POST",url:"/api/v1/auth/refresh",errors:{401:"Invalid or expired refresh token"}})}static webAuthControllerLogout(n=Ge){return We(n,{method:"POST",url:"/api/v1/auth/logout"})}static webAuthControllerMe(n=Ge){return We(n,{method:"GET",url:"/api/v1/auth/me",errors:{401:"Not authenticated"}})}static webAuthControllerChangePassword(n,r=Ge){return We(r,{method:"POST",url:"/api/v1/auth/change-password",body:n,mediaType:"application/json",errors:{401:"Not authenticated or current password is incorrect"}})}static webAuthControllerGetOnboardingStatus(n=Ge){return We(n,{method:"GET",url:"/api/v1/auth/onboarding-status"})}static webAuthControllerOnboard(n,r=Ge){return We(r,{method:"POST",url:"/api/v1/auth/onboard",body:n,mediaType:"application/json",errors:{409:"Admin users already exist, onboarding not allowed"}})}static webAuthControllerMarkWalkthroughSeen(n=Ge){return We(n,{method:"POST",url:"/api/v1/auth/mark-walkthrough-seen",errors:{401:"Not authenticated"}})}}const PT=()=>"",ha=s=>s,Ba=PT();Ge.BASE=Ba;Ge.CREDENTIALS="include";Ge.BASE=Ba;const Sx=p.createContext(void 0);function VT({children:s}){const[n,r]=p.useState(null),[o,c]=p.useState(!0);p.useEffect(()=>{zs.webAuthControllerMe().then(m=>{r(m)}).catch(()=>{r(null)}).finally(()=>{c(!1)})},[]),p.useEffect(()=>{if(!n)return;const m=setInterval(async()=>{try{const x=await zs.webAuthControllerRefresh();r(x.user)}catch(x){console.error("Token refresh failed:",x),r(null)}},480*1e3);return()=>clearInterval(m)},[n]);const g={user:n,isAuthenticated:!!n,isLoading:o,login:async(m,x)=>{const S=await zs.webAuthControllerLogin({email:m,password:x});r(S.user)},logout:async()=>{try{await zs.webAuthControllerLogout()}finally{r(null)}},refreshAuth:async()=>{const m=await zs.webAuthControllerRefresh();r(m.user)}};return a.jsx(Sx.Provider,{value:g,children:s})}function Dn(){const s=p.useContext(Sx);if(s===void 0)throw new Error("useAuth must be used within an AuthProvider");return s}function Tx({children:s}){return a.jsx("div",{className:"login-page",children:a.jsx("div",{className:"login-container",children:a.jsx("div",{className:"login-card",children:s})})})}const md=["a1","a2","a3","a4","a5","a6"];function YT(s){let n=5381;for(let r=0;r<s.length;r++)n=n*33^s.charCodeAt(r);return n>>>0}function FT(s){if(!s)return md[0];const n=YT(s.trim().toLowerCase())%md.length;return md[n]}function QT(s){if(!s)return"?";const n=s.trim();if(!n)return"?";const r=n.split(/\s+/).filter(Boolean),o=r[0]?.[0]??"?",c=r.length>1?r[r.length-1]?.[0]:"";return(o+c).toUpperCase()}function KT(s){return typeof s=="number"?null:`avatar--${s}`}function XT(s){if(typeof s=="number")return{width:s,height:s,fontSize:Math.max(10,Math.round(s*.42))}}function Ue({name:s,src:n,alt:r,size:o="md",className:c=""}){const d=QT(s),f=FT(s),y=KT(o),g=XT(o);return n?a.jsx("img",{className:`avatar ${y??""} ${c}`,style:g,src:n,alt:r??s,loading:"lazy"}):a.jsx("div",{className:`avatar avatar--fallback avatar--${f} ${y??""} ${c}`,style:g,"aria-label":r??s,role:"img",title:s,children:d})}function Ds(s){return a.jsx("span",{className:`chip chip--${s.color??"gray"}`,children:s.children})}function W({children:s,spacing:n="4",align:r="stretch",className:o=""}){return a.jsx("div",{className:`stack stack--spacing-${n} stack--align-${r} ${o}`,"data-component":"stack",children:s})}function lt({children:s,spacing:n="4",align:r="center",justify:o="start",className:c=""}){return a.jsx("div",{className:`row row--spacing-${n} row--align-${r} row--justify-${o} ${c}`,"data-component":"row",children:s})}function _({children:s,size:n="2",weight:r="normal",tone:o="default",style:c="sans",as:d="p",className:f="",wrap:y=!1}){return a.jsx(d,{className:`text text--size-${n} text--weight-${r} text--tone-${o} text--style-${c} ${y&&"text--wrap"} ${f}`,"data-component":"text",children:s})}function Rn(s){const{children:n}=s;return a.jsx("div",{className:"error--container",children:a.jsx(_,{size:s.size,weight:s.weight,tone:s.tone,as:s.as,wrap:s.wrap,className:"error--text",children:n})})}function oe({children:s,variant:n="primary",size:r="md",fullWidth:o=!1,className:c="",...d}){return a.jsx("button",{className:`btn btn--${n} btn--${r} ${o?"btn--full-width":""} ${c}`,"data-component":"button",...d,children:s})}function $e({children:s,padding:n="4",className:r=""}){return a.jsx("div",{className:`card card--padding-${n} ${r}`,"data-component":"card",children:s})}function jx({leading:s,children:n,tags:r=[],topRight:o,footer:c,trailing:d,animation:f,onClick:y,className:g="",pulseKey:m,highlight:x}){const[S,v]=p.useState(!1);p.useEffect(()=>{if(m==null)return;v(!0);const j=setTimeout(()=>v(!1),600);return()=>clearTimeout(j)},[m]);const T=f?`board-card--${f}`:"",w=S?"board-card--eventPulse":"",k=x?"board-card--highlight":"",C=j=>{y?.(j)};return a.jsx("div",{className:`board-card__wrapper ${T}`,onClick:C,children:a.jsxs("div",{className:`board-card ${k} ${w} ${g}`,"data-component":"board-card",children:[a.jsxs("div",{className:"board-card__header",children:[a.jsx("div",{className:"board-card__headerLeft",children:s?a.jsx("div",{className:"board-card__leading",children:s}):null}),a.jsxs("div",{className:"board-card__headerRight",children:[o?a.jsx("div",{className:"board-card__meta",children:o}):null,d?a.jsx("div",{className:"board-card__trailing",children:d}):null]})]}),a.jsx("div",{className:"board-card__main",children:n}),r.length?a.jsx("div",{className:"board-card__tags","aria-label":"tags",children:r.map(j=>a.jsx("span",{className:`chip chip--${j.color??"gray"}`,children:j.label},j.label))}):null,c?a.jsx("div",{className:"board-card__footer",children:c}):null]})})}function ge({leading:s,children:n,tags:r=[],topRight:o,trailing:c,animation:d,onClick:f,highlight:y,className:g=""}){const m=d?`data-row--${d}`:"",x=y?"data-row--highlight":"",S=f?"data-row--clickable":"",v=T=>{f?.(T)};return a.jsx("div",{className:`data-row__wrapper ${m}`,onClick:v,children:a.jsxs("div",{className:`data-row ${x} ${S} ${g}`,"data-component":"data-row",children:[s?a.jsx("div",{className:"data-row__leading",children:s}):null,a.jsxs("div",{className:"data-row__content",children:[a.jsxs("div",{className:"data-row__top",children:[a.jsx("div",{className:`data-row__main ${g}`,children:n}),o?a.jsx("div",{className:"data-row__meta",children:o}):null]}),r.length?a.jsx("div",{className:"data-row__tags","aria-label":"tags",children:r.map((T,w)=>{const k=`chip chip--${T.color??"gray"}${T.onClick?" chip--clickable":""}`;return T.onClick?a.jsx("button",{type:"button",className:k,"aria-label":T.clickLabel??T.label,onClick:C=>{C.stopPropagation(),T.onClick?.()},children:T.label},`${T.label}-${T.color??"gray"}-${w}`):a.jsxs("span",{className:k,children:[T.label,T.onRemove?a.jsx("button",{type:"button",className:"chip__remove","aria-label":T.removeLabel??`Remove ${T.label}`,onClick:C=>{C.stopPropagation(),T.onRemove?.()},children:"×"}):null]},`${T.label}-${T.color??"gray"}-${w}`)})}):null]}),c?a.jsx("div",{className:"data-row__trailing",children:c}):null]})})}function fe({children:s,title:n,className:r,action:o}){return a.jsxs("div",{className:`data-row__container ${r}`,children:[(n||o)&&a.jsxs("div",{className:"data-row__container-header",children:[n&&a.jsx(_,{size:"4",weight:"bold",children:n}),o&&a.jsx("div",{className:"data-row__container-action",children:o})]}),s]})}function ZT({children:s,onClick:n,interactive:r=!1,className:o=""}){const c=r||!!n;return a.jsx("div",{className:`list-row ${c?"list-row--interactive":""} ${o}`,onClick:n,role:n?"button":void 0,tabIndex:n?0:void 0,"data-component":"list-row",children:s})}function JT(){const[s,n]=p.useState(""),[r,o]=p.useState(""),[c,d]=p.useState(""),[f,y]=p.useState(!1),{login:g,isLoading:m,isAuthenticated:x}=Dn(),S=Re(),T=Lt().state?.from,w=T?.pathname||"/",k=T?.search||"",C=w==="/logout"?"/":`${w}${k}`;p.useEffect(()=>{!m&&x&&(console.log("you're in mate"),S(C))},[m,x,C]);const j=async R=>{R.preventDefault(),y(!0),d("");try{await g(s,r),S(C,{replace:!0})}catch{d("Invalid email or password")}finally{y(!1)}};return a.jsx("form",{onSubmit:j,children:a.jsxs(W,{spacing:"6",children:[a.jsxs(W,{spacing:"2",align:"center",children:[a.jsx(_,{size:"6",weight:"bold",className:"login__copy",children:"Taico"}),a.jsx(_,{tone:"muted",className:"login__copy",children:"Where people and agents collaborate in threads, using shared context to get work done."})]}),a.jsxs(W,{spacing:"4",children:[a.jsxs(W,{spacing:"2",children:[a.jsx("label",{htmlFor:"email",className:"login-label",children:a.jsx(_,{size:"2",weight:"medium",children:"Email"})}),a.jsx("input",{id:"email",type:"email",value:s,onChange:R=>n(R.target.value),className:"login-input",placeholder:"name@work.com",required:!0,disabled:f,autoComplete:"email"})]}),a.jsxs(W,{spacing:"2",children:[a.jsx("label",{htmlFor:"password",className:"login-label",children:a.jsx(_,{size:"2",weight:"medium",children:"Password"})}),a.jsx("input",{id:"password",type:"password",value:r,onChange:R=>o(R.target.value),className:"login-input",placeholder:"••••••••",required:!0,disabled:f,autoComplete:"current-password"})]}),c&&a.jsx(Rn,{size:"2",weight:"medium",className:"",children:c}),a.jsx(oe,{type:"submit",variant:"primary",size:"lg",disabled:f,className:"login-button",children:f?"Signing in...":"Sign In"})]})]})})}function WT(){return a.jsx(Tx,{children:a.jsx(JT,{})})}function ej(){const[s,n]=p.useState(""),[r,o]=p.useState(""),[c,d]=p.useState(""),[f,y]=p.useState(""),[g,m]=p.useState(""),[x,S]=p.useState(!1),{refreshAuth:v}=Dn(),T=Re(),w=async k=>{k.preventDefault(),S(!0),m("");try{await zs.webAuthControllerOnboard({email:s,displayName:r,slug:c,password:f}),await v(),T("/",{replace:!0})}catch(C){let j="Failed to create admin user";C.body?.context?.fields&&Array.isArray(C.body.context.fields)?j=C.body.context.fields.join(", "):C.body?.detail?j=C.body.detail:C.body?.title?j=C.body.title:C.message&&(j=C.message),m(j)}finally{S(!1)}};return a.jsx("form",{onSubmit:w,children:a.jsxs(W,{spacing:"6",children:[a.jsxs(W,{spacing:"2",align:"center",children:[a.jsx(_,{size:"6",weight:"bold",className:"login__copy",children:"Welcome to Taico"}),a.jsx(_,{tone:"muted",className:"login__copy",children:"Let's set up your first admin account to get started."})]}),a.jsxs(W,{spacing:"4",children:[a.jsxs(W,{spacing:"2",children:[a.jsx("label",{htmlFor:"displayName",className:"login-label",children:a.jsx(_,{size:"2",weight:"medium",children:"Display Name"})}),a.jsx("input",{id:"displayName",type:"text",value:r,onChange:k=>o(k.target.value),className:"login-input",placeholder:"Admin User",required:!0,disabled:x,autoComplete:"name"})]}),a.jsxs(W,{spacing:"2",children:[a.jsx("label",{htmlFor:"slug",className:"login-label",children:a.jsx(_,{size:"2",weight:"medium",children:"Username"})}),a.jsx("input",{id:"slug",type:"text",value:c,onChange:k=>d(k.target.value),className:"login-input",placeholder:"admin",required:!0,disabled:x,autoComplete:"username"})]}),a.jsxs(W,{spacing:"2",children:[a.jsx("label",{htmlFor:"email",className:"login-label",children:a.jsx(_,{size:"2",weight:"medium",children:"Email"})}),a.jsx("input",{id:"email",type:"email",value:s,onChange:k=>n(k.target.value),className:"login-input",placeholder:"admin@example.com",required:!0,disabled:x,autoComplete:"email"}),a.jsx(_,{size:"1",tone:"muted",children:"Email is not verified and cannot be changed later. Make sure it's correct."})]}),a.jsxs(W,{spacing:"2",children:[a.jsx("label",{htmlFor:"password",className:"login-label",children:a.jsx(_,{size:"2",weight:"medium",children:"Password"})}),a.jsx("input",{id:"password",type:"password",value:f,onChange:k=>y(k.target.value),className:"login-input",placeholder:"••••••••",required:!0,disabled:x,autoComplete:"new-password"}),a.jsx(_,{size:"1",tone:"muted",children:"Remember this password - you won't receive a confirmation email."})]}),g&&a.jsx(Rn,{size:"2",weight:"medium",className:"",children:g}),a.jsx(oe,{type:"submit",variant:"primary",size:"lg",disabled:x,className:"login-button",children:x?"Creating account...":"Create Admin Account"})]})]})})}function tj(){return a.jsx(Tx,{children:a.jsx(ej,{})})}function nj({children:s}){const{isAuthenticated:n,isLoading:r}=Dn(),o=Lt();return r?null:n?a.jsx(a.Fragment,{children:s}):a.jsx(Ma,{to:"/login",state:{from:o},replace:!0})}const sj=4;function aj({children:s}){const[n,r]=p.useState(null),[o,c]=p.useState(!0),[d,f]=p.useState(null),[y,g]=p.useState(0);return p.useEffect(()=>{let m=!0,x;const S=()=>{x&&clearTimeout(x)},v=async()=>{try{const T=await zs.webAuthControllerGetOnboardingStatus();if(!m)return;S(),r(T.needsOnboarding),f(null)}catch(T){if(!m)return;console.error("Failed to check onboarding status:",T),f(T instanceof Error?T:new Error("Failed to check onboarding status")),r(null),g(w=>w+1),x=setTimeout(()=>{S(),m&&v()},sj*1e3)}finally{m&&c(!1)}};return v(),()=>{m=!1,S()}},[]),o?null:d?a.jsx("div",{className:"onboarding-checker-shell",children:a.jsxs(W,{spacing:"4",align:"center",className:"onboarding-checker-card",children:[a.jsxs("span",{className:"onboarding-checker-signal","aria-hidden":"true",children:[a.jsx("span",{}),a.jsx("span",{}),a.jsx("span",{})]}),a.jsx(_,{size:"5",weight:"semibold",as:"div",children:"Reconnecting to Taico..."}),a.jsx(_,{size:"3",tone:"muted",as:"div",className:"onboarding-checker-copy",children:"The backend is not responding yet. We will keep retrying until it is back."}),a.jsxs(_,{size:"1",tone:"muted",as:"div",className:"onboarding-checker-feedback",children:["Retry attempt ",y]})]})}):n?a.jsx(Ma,{to:"/onboarding",replace:!0}):a.jsx(a.Fragment,{children:s})}function lj(s){return p.useSyncExternalStore(n=>{const r=window.matchMedia(s);return r.addEventListener("change",n),()=>r.removeEventListener("change",n)},()=>window.matchMedia(s).matches,()=>!1)}function jt(){return lj("(min-width: 768px)")}const Al=[{path:"/home",label:"Home",icon:"🏠"},{path:"/tasks",label:"Tasks",icon:"🧩"},{path:"/tasks/schedule",label:"Schedules",icon:"🗓"},{path:"/context",label:"Context",icon:"🧱"},{path:"/agents",label:"Agents",icon:"🦄"},{path:"/threads",label:"Threads",icon:"🧵"},{path:"/tools",label:"Tools",icon:"🧰"},{path:"/runs",label:"Runs",icon:"⚡"},{path:"/settings",label:"Settings",icon:"⚙️"},{path:"/logout",label:"Logout",icon:"🔓"}];function wt(s){const n=Lt();Wt(),p.useEffect(()=>{const r=n.pathname;let o="taico";if(r.startsWith("/home"))o="🏠 taico";else if(r.match(/\/tasks\/task\/.+/)&&s?.task?.name){const c=s.task.name;o=`🧩 ${c.length>50?c.substring(0,50)+"...":c}`}else if(r.startsWith("/tasks"))o="🧩 tasks";else if(r.match(/\/context\/block\/.+/)&&s?.contextBlock?.title){const c=s.contextBlock.title;o=`🧱 ${c.length>50?c.substring(0,50)+"...":c}`}else if(r.startsWith("/context"))o="🧱 context";else if(r.startsWith("/settings"))o="⚙️ settings";else if(r.match(/\/agents\/agent\/.+/)&&s?.agent?.name)o=`🦄 ${s.agent.name}`;else if(r.startsWith("/agents"))o="🦄 agents";else if(r.match(/\/tools\/tool\/.+/)&&s?.tool?.name)o=`🧰 ${s.tool.name}`;else if(r.startsWith("/tools"))o="🧰 tools";else if(r.match(/\/threads\/.+/)&&s?.thread?.title){const c=s.thread.title;o=`🧵 ${c.length>50?c.substring(0,50)+"...":c}`}else r.startsWith("/threads")?o="🧵 threads":r.startsWith("/runs")||r.startsWith("/executions")?o="⚡ runs":r.startsWith("/walkthrough")&&(o="🐣 walkthrough");document.title=o},[n.pathname,s])}function rj({children:s}){console.log("Beta shell");const{user:n}=Dn(),r=Lt();wt();const o=p.useMemo(()=>{if(!(n?.onboardingDisplayMode==="FULL_PAGE"||n?.onboardingDisplayMode==="BANNER"))return Al;const m=Al.findIndex(S=>S.path==="/settings"),x=[...Al];return x.splice(m,0,{path:"/walkthrough",label:"Walkthrough",icon:"🐣"}),x},[n?.onboardingDisplayMode]),c=jt(),[d,f]=p.useState(()=>localStorage.getItem("sidebar-collapsed")==="true");p.useEffect(()=>{localStorage.setItem("sidebar-collapsed",String(d))},[d]);const y=()=>{f(!d)};return a.jsxs("div",{className:`${c?"beta-shell__desktop":"beta-shell__mobile"}`,"data-shell":`${c?"desktop":"mobile"}`,children:[c&&a.jsxs("aside",{className:`beta-shell__desktop__sidebar ${d?"beta-shell__desktop__sidebar--collapsed":""}`,children:[a.jsx("nav",{className:"beta-shell__desktop__nav",children:a.jsx("div",{className:"beta-shell__desktop__navInner",children:a.jsx(W,{spacing:"1",children:o.map(g=>{const m=r.pathname.startsWith(g.path);return a.jsxs(Ls,{to:g.path,title:d?g.label:void 0,className:`beta-shell__desktop__nav-item ${m?"beta-shell__desktop__nav-item--active":""}`,children:[a.jsx("span",{className:"beta-shell__desktop__nav-icon",children:g.icon}),!d&&a.jsx("span",{className:"beta-shell__desktop__nav-label",children:g.label})]},g.path)})})})}),a.jsx("button",{className:"beta-shell__desktop__sidebar--toggle",onClick:y,"aria-label":d?"Expand sidebar":"Collapse sidebar",children:d?"→":"←"})]}),a.jsx("div",{className:`${c?"beta-shell__desktop__main":""}`,children:s})]})}function ij(s){return typeof s=="object"&&s!==null}function oj(s){if(!ij(s))return;const n=s.detail;if(typeof n=="string"&&n.length>0)return n;const r=s.message;if(typeof r=="string"&&r.length>0)return r;const o=s.title;if(typeof o=="string"&&o.length>0)return o;const c=s.error_description;if(typeof c=="string"&&c.length>0)return c}class vy extends Error{status;statusText;body;constructor(n,r){const o=oj(r)??`HTTP ${n.status}: ${n.statusText}`;super(o),this.name="ApiError",this.status=n.status,this.statusText=n.statusText,this.body=r}}class rt{config;constructor(n){this.config=n}async parseResponseBody(n,r="auto"){if(r==="void"||n.status===204||n.headers.get("content-length")==="0")return;if(r==="json")try{return await n.json()}catch{return}if(r==="text"){const d=await n.text();return d.length>0?d:void 0}if(r==="arrayBuffer"){const d=await n.arrayBuffer();return d.byteLength>0?d:void 0}if(n.headers.get("content-type")?.includes("application/json"))try{return await n.json()}catch{return}const c=await n.text();return c.length>0?c:void 0}hasHeader(n,r){const o=r.toLowerCase();return Object.keys(n).some(c=>c.toLowerCase()===o)}removeHeader(n,r){const o=r.toLowerCase();for(const c of Object.keys(n))c.toLowerCase()===o&&delete n[c]}async buildAuthHeaders(){const n={};if(this.config.getAccessToken){const r=await this.config.getAccessToken();n.Authorization=`Bearer ${r}`}return this.config.getCookies&&(n.Cookie=await this.config.getCookies()),n}async request(n,r,o){const c=new URL(r,this.config.baseUrl);if(o?.params)for(const[g,m]of Object.entries(o.params))m!=null&&c.searchParams.append(g,String(m));const d={};if(this.config.headers)for(const[g,m]of Object.entries(this.config.headers))m!=null&&(d[g]=String(m));if(o?.headers)for(const[g,m]of Object.entries(o.headers))m!=null&&(d[g]=String(m));Object.assign(d,await this.buildAuthHeaders());let f;if(o?.body!==void 0){const g=o.bodyType??"json";g==="form-data"?(f=o.body,this.removeHeader(d,"Content-Type")):g==="raw"?f=o.body:(this.hasHeader(d,"Content-Type")||(d["Content-Type"]="application/json"),f=JSON.stringify(o.body))}const y=await fetch(c.toString(),{method:n,headers:d,body:f,signal:o?.signal,credentials:this.config.credentials});if(!y.ok){const g=await this.parseResponseBody(y,"auto");throw new vy(y,g)}return await this.parseResponseBody(y,o?.responseType??"auto")}async*streamEvents(n,r){const o=new URL(n,this.config.baseUrl);if(r?.params)for(const[m,x]of Object.entries(r.params))x!=null&&o.searchParams.append(m,String(x));const c={Accept:"text/event-stream"};if(this.config.headers)for(const[m,x]of Object.entries(this.config.headers))x!=null&&(c[m]=String(x));if(r?.headers)for(const[m,x]of Object.entries(r.headers))x!=null&&(c[m]=String(x));Object.assign(c,await this.buildAuthHeaders());const d=await fetch(o.toString(),{method:"GET",headers:c,signal:r?.signal,credentials:this.config.credentials});if(!d.ok){const m=await this.parseResponseBody(d);throw new vy(d,m)}if(!d.body)throw new Error("Response body is null");const f=d.body.getReader(),y=new TextDecoder;let g="";try{for(;;){const{done:m,value:x}=await f.read();if(m)break;g+=y.decode(x,{stream:!0});const S=g.split(`
|
|
12
|
-
`);g=S.pop()||"";for(const v of S)if(v.startsWith("data: ")){const T=v.slice(6);try{yield JSON.parse(T)}catch{yield T}}}}finally{f.releaseLock()}}}class cj extends rt{constructor(n){super(n)}async AppController_getHello(n){return this.request("GET","/api/v1",{signal:n?.signal})}}class uj extends rt{constructor(n){super(n)}async MetaController_createTag(n){return this.request("POST","/api/v1/meta/tags",{body:n.body,signal:n?.signal})}async MetaController_getAllTags(n){return this.request("GET","/api/v1/meta/tags",{signal:n?.signal})}async MetaController_getTagColors(n){return this.request("GET","/api/v1/meta/tags/colors",{signal:n?.signal})}async MetaController_deleteTag(n){return this.request("DELETE",`/api/v1/meta/tags/${n.tagId}`,{responseType:"void",signal:n?.signal})}}class dj extends rt{constructor(n){super(n)}async ProjectsController_createProject(n){return this.request("POST","/api/v1/meta/projects",{body:n.body,signal:n?.signal})}async ProjectsController_getAllProjects(n){return this.request("GET","/api/v1/meta/projects",{signal:n?.signal})}async ProjectsController_searchProjects(n){return this.request("GET","/api/v1/meta/projects/search",{params:{q:n.q,limit:n.limit,threshold:n.threshold},signal:n?.signal})}async ProjectsController_getProjectBySlug(n){return this.request("GET",`/api/v1/meta/projects/by-slug/${n.slug}`,{signal:n?.signal})}async ProjectsController_getProject(n){return this.request("GET",`/api/v1/meta/projects/${n.projectId}`,{signal:n?.signal})}async ProjectsController_updateProject(n){return this.request("PATCH",`/api/v1/meta/projects/${n.projectId}`,{body:n.body,signal:n?.signal})}async ProjectsController_deleteProject(n){return this.request("DELETE",`/api/v1/meta/projects/${n.projectId}`,{responseType:"void",signal:n?.signal})}}class hj extends rt{constructor(n){super(n)}async ClientRegistrationController_registerClient(n){return this.request("POST",`/api/v1/auth/clients/register/mcp/${n.serverId}/${n.version}`,{body:n.body,signal:n?.signal})}async ClientRegistrationController_getClient(n){return this.request("GET",`/api/v1/auth/clients/${n.clientId}`,{signal:n?.signal})}async ClientRegistrationController_listClients(n){return this.request("GET","/api/v1/auth/clients",{signal:n?.signal})}async AuthorizationController_authorize(n){return this.request("GET",`/api/v1/auth/authorize/mcp/${n.serverIdentifier}/${n.version}`,{params:{response_type:n.response_type,scope:n.scope,client_id:n.client_id,code_challenge:n.code_challenge,code_challenge_method:n.code_challenge_method,redirect_uri:n.redirect_uri,state:n.state,resource:n.resource},responseType:"void",signal:n?.signal})}async AuthorizationController_authorizeConsent(n){return this.request("POST",`/api/v1/auth/authorize/mcp/${n.serverIdentifier}/${n.version}`,{body:n.body,responseType:"void",signal:n?.signal})}async AuthorizationController_getConsentMetadata(n){return this.request("GET",`/api/v1/auth/consent/${n.flowId}`,{signal:n?.signal})}async AuthorizationController_token(n){return this.request("POST",`/api/v1/auth/token/mcp/${n.serverIdentifier}/${n.version}`,{body:n.body,signal:n?.signal})}async AuthorizationController_introspect(n){return this.request("POST",`/api/v1/auth/introspect/mcp/${n.serverIdentifier}/${n.version}`,{body:n.body,signal:n?.signal})}async AuthorizationController_tokenExchange(n){return this.request("POST",`/api/v1/auth/token-exchange/mcp/${n.serverIdentifier}/${n.version}`,{body:n.body,signal:n?.signal})}async AuthorizationController_callback(n){return this.request("GET","/api/v1/auth/callback",{params:{code:n.code,state:n.state,error:n.error,scope:n.scope,error_description:n.error_description},responseType:"void",signal:n?.signal})}async AuthorizationController_getScopes(n){return this.request("GET","/api/v1/auth/scopes",{signal:n?.signal})}}class fj extends rt{constructor(n){super(n)}async WebAuthController_login(n){return this.request("POST","/api/v1/auth/login",{body:n.body,signal:n?.signal})}async WebAuthController_refresh(n){return this.request("POST","/api/v1/auth/refresh",{signal:n?.signal})}async WebAuthController_logout(n){return this.request("POST","/api/v1/auth/logout",{signal:n?.signal})}async WebAuthController_me(n){return this.request("GET","/api/v1/auth/me",{signal:n?.signal})}async WebAuthController_changePassword(n){return this.request("POST","/api/v1/auth/change-password",{body:n.body,signal:n?.signal})}async WebAuthController_getOnboardingStatus(n){return this.request("GET","/api/v1/auth/onboarding-status",{signal:n?.signal})}async WebAuthController_onboard(n){return this.request("POST","/api/v1/auth/onboard",{body:n.body,signal:n?.signal})}async WebAuthController_markWalkthroughSeen(n){return this.request("POST","/api/v1/auth/mark-walkthrough-seen",{signal:n?.signal})}}class pj extends rt{constructor(n){super(n)}async AuthJourneysController_getAuthJourneys(n){return this.request("GET",`/api/v1/auth-journeys/servers/${n.serverId}`,{signal:n?.signal})}}class gj extends rt{constructor(n){super(n)}async McpRegistryController_createServer(n){return this.request("POST","/api/v1/mcp/servers",{body:n.body,signal:n?.signal})}async McpRegistryController_listServers(n){return this.request("GET","/api/v1/mcp/servers",{params:{page:n?.page,limit:n?.limit},signal:n?.signal})}async McpRegistryController_getServer(n){return this.request("GET",`/api/v1/mcp/servers/${n.serverId}`,{signal:n?.signal})}async McpRegistryController_updateServer(n){return this.request("PATCH",`/api/v1/mcp/servers/${n.serverId}`,{body:n.body,signal:n?.signal})}async McpRegistryController_deleteServer(n){return this.request("DELETE",`/api/v1/mcp/servers/${n.serverId}`,{signal:n?.signal})}async McpRegistryController_createScopes(n){return this.request("POST",`/api/v1/mcp/servers/${n.serverId}/scopes`,{body:n.body,signal:n?.signal})}async McpRegistryController_listScopes(n){return this.request("GET",`/api/v1/mcp/servers/${n.serverId}/scopes`,{signal:n?.signal})}async McpRegistryController_getScope(n){return this.request("GET",`/api/v1/mcp/servers/${n.serverId}/scopes/${n.scopeId}`,{signal:n?.signal})}async McpRegistryController_deleteScope(n){return this.request("DELETE",`/api/v1/mcp/servers/${n.serverId}/scopes/${n.scopeId}`,{signal:n?.signal})}async McpRegistryController_createConnection(n){return this.request("POST",`/api/v1/mcp/servers/${n.serverId}/connections`,{body:n.body,signal:n?.signal})}async McpRegistryController_listConnections(n){return this.request("GET",`/api/v1/mcp/servers/${n.serverId}/connections`,{signal:n?.signal})}async McpRegistryController_getConnection(n){return this.request("GET",`/api/v1/mcp/connections/${n.connectionId}`,{signal:n?.signal})}async McpRegistryController_updateConnection(n){return this.request("PATCH",`/api/v1/mcp/connections/${n.connectionId}`,{body:n.body,signal:n?.signal})}async McpRegistryController_deleteConnection(n){return this.request("DELETE",`/api/v1/mcp/connections/${n.connectionId}`,{signal:n?.signal})}async McpRegistryController_createMapping(n){return this.request("POST",`/api/v1/mcp/servers/${n.serverId}/mappings`,{body:n.body,signal:n?.signal})}async McpRegistryController_listMappings(n){return this.request("GET",`/api/v1/mcp/servers/${n.serverId}/scopes/${n.scopeId}/mappings`,{signal:n?.signal})}async McpRegistryController_deleteMapping(n){return this.request("DELETE",`/api/v1/mcp/mappings/${n.mappingId}`,{signal:n?.signal})}}class mj extends rt{constructor(n){super(n)}async JwksController_getJwks(n){return this.request("GET","/.well-known/jwks.json",{signal:n?.signal})}}class yj extends rt{constructor(n){super(n)}async ActorController_listActors(n){return this.request("GET","/api/v1/actors",{signal:n?.signal})}async ActorController_searchActors(n){return this.request("GET","/api/v1/actors/search",{params:{query:n.query,limit:n.limit,threshold:n.threshold},signal:n?.signal})}}class xj extends rt{constructor(n){super(n)}async TasksController_createTask(n){return this.request("POST","/api/v1/tasks/tasks",{body:n.body,signal:n?.signal})}async TasksController_listTasks(n){return this.request("GET","/api/v1/tasks/tasks",{params:{assignee:n?.assignee,sessionId:n?.sessionId,tag:n?.tag,page:n?.page,limit:n?.limit},signal:n?.signal})}async TasksController_updateTask(n){return this.request("PATCH",`/api/v1/tasks/tasks/${n.id}`,{body:n.body,signal:n?.signal})}async TasksController_deleteTask(n){return this.request("DELETE",`/api/v1/tasks/tasks/${n.id}`,{responseType:"void",signal:n?.signal})}async TasksController_getTask(n){return this.request("GET",`/api/v1/tasks/tasks/${n.id}`,{signal:n?.signal})}async TasksController_assignTask(n){return this.request("PATCH",`/api/v1/tasks/tasks/${n.id}/assign`,{body:n.body,signal:n?.signal})}async TasksController_assignTaskToMe(n){return this.request("PATCH",`/api/v1/tasks/tasks/${n.id}/assign-to-me`,{signal:n?.signal})}async TasksController_searchTasks(n){return this.request("GET","/api/v1/tasks/tasks/search/query",{params:{query:n.query,limit:n.limit,threshold:n.threshold},signal:n?.signal})}async TasksController_addComment(n){return this.request("POST",`/api/v1/tasks/tasks/${n.id}/comments`,{body:n.body,signal:n?.signal})}async TasksController_addArtefact(n){return this.request("POST",`/api/v1/tasks/tasks/${n.id}/artefacts`,{body:n.body,signal:n?.signal})}async TasksController_changeStatus(n){return this.request("PATCH",`/api/v1/tasks/tasks/${n.id}/status`,{body:n.body,signal:n?.signal})}async TasksController_addTagToTask(n){return this.request("POST",`/api/v1/tasks/tasks/${n.id}/tags`,{body:n.body,signal:n?.signal})}async TasksController_removeTagFromTask(n){return this.request("DELETE",`/api/v1/tasks/tasks/${n.id}/tags/${n.tagId}`,{signal:n?.signal})}async TasksController_createInputRequest(n){return this.request("POST",`/api/v1/tasks/tasks/${n.id}/input-requests`,{body:n.body,signal:n?.signal})}async TasksController_answerInputRequest(n){return this.request("POST",`/api/v1/tasks/tasks/${n.id}/input-requests/${n.inputRequestId}/answer`,{body:n.body,signal:n?.signal})}async TasksController_handleMcp_get(n){return this.request("GET","/api/v1/tasks/tasks/mcp",{responseType:"void",signal:n?.signal})}async TasksController_handleMcp_post(n){return this.request("POST","/api/v1/tasks/tasks/mcp",{responseType:"void",signal:n?.signal})}async TasksController_handleMcp_put(n){return this.request("PUT","/api/v1/tasks/tasks/mcp",{responseType:"void",signal:n?.signal})}async TasksController_handleMcp_delete(n){return this.request("DELETE","/api/v1/tasks/tasks/mcp",{responseType:"void",signal:n?.signal})}async TasksController_handleMcp_patch(n){return this.request("PATCH","/api/v1/tasks/tasks/mcp",{responseType:"void",signal:n?.signal})}async TasksController_handleMcp_options(n){return this.request("OPTIONS","/api/v1/tasks/tasks/mcp",{responseType:"void",signal:n?.signal})}async TasksController_handleMcp_head(n){return this.request("HEAD","/api/v1/tasks/tasks/mcp",{responseType:"void",signal:n?.signal})}}class vj extends rt{constructor(n){super(n)}async AgentRunsController_createAgentRun(n){return this.request("POST","/api/v1/agent-runs",{body:n.body,signal:n?.signal})}async AgentRunsController_listAgentRuns(n){return this.request("GET","/api/v1/agent-runs",{params:{actorId:n?.actorId,parentTaskId:n?.parentTaskId,page:n?.page,limit:n?.limit},signal:n?.signal})}async AgentRunsController_getAgentRunById(n){return this.request("GET",`/api/v1/agent-runs/${n.runId}`,{signal:n?.signal})}async AgentRunsController_updateAgentRun(n){return this.request("PATCH",`/api/v1/agent-runs/${n.runId}`,{body:n.body,signal:n?.signal})}}class bj extends rt{constructor(n){super(n)}async ThreadsController_createThread(n){return this.request("POST","/api/v1/threads",{body:n.body,signal:n?.signal})}async ThreadsController_listThreads(n){return this.request("GET","/api/v1/threads",{params:{page:n?.page,limit:n?.limit},signal:n?.signal})}async ThreadsController_updateThread(n){return this.request("PATCH",`/api/v1/threads/${n.id}`,{body:n.body,signal:n?.signal})}async ThreadsController_getThread(n){return this.request("GET",`/api/v1/threads/${n.id}`,{signal:n?.signal})}async ThreadsController_deleteThread(n){return this.request("DELETE",`/api/v1/threads/${n.id}`,{responseType:"void",signal:n?.signal})}async ThreadsController_getThreadByTaskId(n){return this.request("GET",`/api/v1/threads/by-task/${n.taskId}`,{signal:n?.signal})}async ThreadsController_getThreadsByStateBlockId(n){return this.request("GET",`/api/v1/threads/by-state-block/${n.stateBlockId}`,{signal:n?.signal})}async ThreadsController_attachTask(n){return this.request("POST",`/api/v1/threads/${n.id}/tasks`,{body:n.body,signal:n?.signal})}async ThreadsController_referenceContextBlock(n){return this.request("POST",`/api/v1/threads/${n.id}/context-blocks`,{body:n.body,signal:n?.signal})}async ThreadsController_addTagToThread(n){return this.request("POST",`/api/v1/threads/${n.id}/tags`,{body:n.body,signal:n?.signal})}async ThreadsController_removeTagFromThread(n){return this.request("DELETE",`/api/v1/threads/${n.id}/tags/${n.tagId}`,{signal:n?.signal})}async ThreadsController_addParticipant(n){return this.request("POST",`/api/v1/threads/${n.id}/participants`,{body:n.body,signal:n?.signal})}async ThreadsController_getThreadState(n){return this.request("GET",`/api/v1/threads/${n.id}/state`,{signal:n?.signal})}async ThreadsController_updateThreadState(n){return this.request("PATCH",`/api/v1/threads/${n.id}/state`,{body:n.body,signal:n?.signal})}async ThreadsController_appendThreadState(n){return this.request("POST",`/api/v1/threads/${n.id}/state/append`,{body:n.body,signal:n?.signal})}async ThreadsController_createMessage(n){return this.request("POST",`/api/v1/threads/${n.id}/messages`,{body:n.body,signal:n?.signal})}async ThreadsController_listMessages(n){return this.request("GET",`/api/v1/threads/${n.id}/messages`,{params:{page:n.page,limit:n.limit},signal:n?.signal})}}class _j extends rt{constructor(n){super(n)}async AgentsController_createAgent(n){return this.request("POST","/api/v1/agents",{body:n.body,signal:n?.signal})}async AgentsController_listAgents(n){return this.request("GET","/api/v1/agents",{params:{isActive:n?.isActive,page:n?.page,limit:n?.limit},signal:n?.signal})}async AgentsController_listAgentTemplates(n){return this.request("GET","/api/v1/agents/templates",{signal:n?.signal})}async AgentsController_getAgentBySlug(n){return this.request("GET",`/api/v1/agents/${n.slug}`,{signal:n?.signal})}async AgentsController_patchAgent(n){return this.request("PATCH",`/api/v1/agents/${n.actorId}`,{body:n.body,signal:n?.signal})}async AgentsController_deleteAgent(n){return this.request("DELETE",`/api/v1/agents/${n.actorId}`,{responseType:"void",signal:n?.signal})}async AgentToolPermissionsController_listAgentToolPermissions(n){return this.request("GET",`/api/v1/agents/${n.actorId}/tool-permissions`,{signal:n?.signal})}async AgentToolPermissionsController_upsertAgentToolPermission(n){return this.request("PUT",`/api/v1/agents/${n.actorId}/tool-permissions/${n.serverId}`,{body:n.body,signal:n?.signal})}async AgentToolPermissionsController_deleteAgentToolPermission(n){return this.request("DELETE",`/api/v1/agents/${n.actorId}/tool-permissions/${n.serverId}`,{responseType:"void",signal:n?.signal})}}class Sj extends rt{constructor(n){super(n)}async AgentTokensController_issueToken(n){return this.request("POST",`/api/v1/agents/${n.slug}/tokens`,{body:n.body,signal:n?.signal})}async AgentTokensController_listTokens(n){return this.request("GET",`/api/v1/agents/${n.slug}/tokens`,{signal:n?.signal})}async AgentTokensController_revokeToken(n){return this.request("DELETE",`/api/v1/agents/${n.slug}/tokens/${n.tokenId}`,{signal:n?.signal})}}class Tj extends rt{constructor(n){super(n)}async AgentExecutionTokensController_requestExecutionToken(n){return this.request("POST",`/api/v1/agents/${n.slug}/execution-token`,{body:n.body,signal:n?.signal})}}class jj extends rt{constructor(n){super(n)}async ContextController_createBlock(n){return this.request("POST","/api/v1/context/blocks",{body:n.body,signal:n?.signal})}async ContextController_listBlocks(n){return this.request("GET","/api/v1/context/blocks",{params:{tag:n?.tag},signal:n?.signal})}async ContextController_searchBlocks(n){return this.request("GET","/api/v1/context/blocks/search/query",{params:{query:n.query,limit:n.limit,threshold:n.threshold},signal:n?.signal})}async ContextController_getBlockTree(n){return this.request("GET","/api/v1/context/blocks/tree",{signal:n?.signal})}async ContextController_exportBlocks(n){return this.request("GET","/api/v1/context/blocks/export",{responseType:"arrayBuffer",signal:n?.signal})}async ContextController_importBlocks(n){return this.request("POST","/api/v1/context/blocks/import",{body:n.body,bodyType:"form-data",signal:n?.signal})}async ContextController_getBlock(n){return this.request("GET",`/api/v1/context/blocks/${n.id}`,{signal:n?.signal})}async ContextController_updateBlock(n){return this.request("PATCH",`/api/v1/context/blocks/${n.id}`,{body:n.body,signal:n?.signal})}async ContextController_deleteBlock(n){return this.request("DELETE",`/api/v1/context/blocks/${n.id}`,{responseType:"void",signal:n?.signal})}async ContextController_appendToBlock(n){return this.request("POST",`/api/v1/context/blocks/${n.id}/append`,{body:n.body,signal:n?.signal})}async ContextController_reorderBlock(n){return this.request("PATCH",`/api/v1/context/blocks/${n.id}/reorder`,{body:n.body,signal:n?.signal})}async ContextController_moveBlock(n){return this.request("PATCH",`/api/v1/context/blocks/${n.id}/move`,{body:n.body,signal:n?.signal})}async ContextController_addTagToBlock(n){return this.request("POST",`/api/v1/context/blocks/${n.id}/tags`,{body:n.body,signal:n?.signal})}async ContextController_removeTagFromBlock(n){return this.request("DELETE",`/api/v1/context/blocks/${n.id}/tags/${n.tagId}`,{signal:n?.signal})}async ContextController_handleMcp_get(n){return this.request("GET","/api/v1/context/blocks/mcp",{responseType:"void",signal:n?.signal})}async ContextController_handleMcp_post(n){return this.request("POST","/api/v1/context/blocks/mcp",{responseType:"void",signal:n?.signal})}async ContextController_handleMcp_put(n){return this.request("PUT","/api/v1/context/blocks/mcp",{responseType:"void",signal:n?.signal})}async ContextController_handleMcp_delete(n){return this.request("DELETE","/api/v1/context/blocks/mcp",{responseType:"void",signal:n?.signal})}async ContextController_handleMcp_patch(n){return this.request("PATCH","/api/v1/context/blocks/mcp",{responseType:"void",signal:n?.signal})}async ContextController_handleMcp_options(n){return this.request("OPTIONS","/api/v1/context/blocks/mcp",{responseType:"void",signal:n?.signal})}async ContextController_handleMcp_head(n){return this.request("HEAD","/api/v1/context/blocks/mcp",{responseType:"void",signal:n?.signal})}}class wj extends rt{constructor(n){super(n)}async ChatProvidersController_createChatProvider(n){return this.request("POST","/api/v1/chat-providers",{body:n.body,signal:n?.signal})}async ChatProvidersController_listChatProviders(n){return this.request("GET","/api/v1/chat-providers",{signal:n?.signal})}async ChatProvidersController_getChatProvider(n){return this.request("GET",`/api/v1/chat-providers/${n.id}`,{signal:n?.signal})}async ChatProvidersController_updateChatProvider(n){return this.request("PATCH",`/api/v1/chat-providers/${n.id}`,{body:n.body,signal:n?.signal})}async ChatProvidersController_deleteChatProvider(n){return this.request("DELETE",`/api/v1/chat-providers/${n.id}`,{responseType:"void",signal:n?.signal})}async ChatProvidersController_setActiveChatProvider(n){return this.request("POST","/api/v1/chat-providers/set-active",{body:n.body,signal:n?.signal})}async ChatProvidersController_deactivateActiveChatProvider(n){return this.request("POST","/api/v1/chat-providers/deactivate",{responseType:"void",signal:n?.signal})}}class kj extends rt{constructor(n){super(n)}async SecretsController_createSecret(n){return this.request("POST","/api/v1/secrets",{body:n.body,signal:n?.signal})}async SecretsController_listSecrets(n){return this.request("GET","/api/v1/secrets",{signal:n?.signal})}async SecretsController_getSecret(n){return this.request("GET",`/api/v1/secrets/${n.id}`,{signal:n?.signal})}async SecretsController_updateSecret(n){return this.request("PATCH",`/api/v1/secrets/${n.id}`,{body:n.body,signal:n?.signal})}async SecretsController_deleteSecret(n){return this.request("DELETE",`/api/v1/secrets/${n.id}`,{responseType:"void",signal:n?.signal})}async SecretsController_getSecretValue(n){return this.request("GET",`/api/v1/secrets/${n.id}/value`,{signal:n?.signal})}}class Ej extends rt{constructor(n){super(n)}async TaskExecutionQueueController_listQueue(n){return this.request("GET","/api/v1/executions/queue",{signal:n?.signal})}async TaskExecutionQueueController_claimTask(n){return this.request("POST",`/api/v1/executions/queue/${n.taskId}/claim`,{signal:n?.signal})}async ActiveTaskExecutionController_listActiveExecutions(n){return this.request("GET","/api/v1/executions/active",{signal:n?.signal})}async ActiveTaskExecutionController_stopTaskExecution(n){return this.request("POST",`/api/v1/executions/active/${n.executionId}/stop`,{body:n.body,signal:n?.signal})}async ActiveTaskExecutionController_updateRunnerSessionId(n){return this.request("PATCH",`/api/v1/executions/active/${n.executionId}/session`,{body:n.body,responseType:"void",signal:n?.signal})}async ActiveTaskExecutionController_incrementToolCallCount(n){return this.request("PATCH",`/api/v1/executions/active/${n.executionId}/tool-calls/increment`,{responseType:"void",signal:n?.signal})}async ActiveTaskExecutionController_updateExecutionStats(n){return this.request("PATCH",`/api/v1/executions/active/${n.executionId}/stats`,{body:n.body,responseType:"void",signal:n?.signal})}async ActiveTaskExecutionController_interruptExecution(n){return this.request("POST",`/api/v1/executions/active/${n.executionId}/interrupt`,{responseType:"void",signal:n?.signal})}async TaskExecutionHistoryController_listHistory(n){return this.request("GET","/api/v1/executions/history",{signal:n?.signal})}}class Cj extends rt{constructor(n){super(n)}async WorkersController_listWorkers(n){return this.request("GET","/api/v1/workers",{signal:n?.signal})}}class Nj extends rt{constructor(n){super(n)}async TaskBlueprintsController_createTaskBlueprint(n){return this.request("POST","/api/v1/task-blueprints",{body:n.body,signal:n?.signal})}async TaskBlueprintsController_listTaskBlueprints(n){return this.request("GET","/api/v1/task-blueprints",{params:{page:n?.page,limit:n?.limit},signal:n?.signal})}async TaskBlueprintsController_getTaskBlueprint(n){return this.request("GET",`/api/v1/task-blueprints/${n.id}`,{signal:n?.signal})}async TaskBlueprintsController_updateTaskBlueprint(n){return this.request("PATCH",`/api/v1/task-blueprints/${n.id}`,{body:n.body,signal:n?.signal})}async TaskBlueprintsController_deleteTaskBlueprint(n){return this.request("DELETE",`/api/v1/task-blueprints/${n.id}`,{responseType:"void",signal:n?.signal})}async TaskBlueprintsController_createTaskFromBlueprint(n){return this.request("POST",`/api/v1/task-blueprints/${n.id}/create-task`,{signal:n?.signal})}}class Aj extends rt{constructor(n){super(n)}async ScheduledTasksController_createScheduledTask(n){return this.request("POST","/api/v1/scheduled-tasks",{body:n.body,signal:n?.signal})}async ScheduledTasksController_listScheduledTasks(n){return this.request("GET","/api/v1/scheduled-tasks",{params:{page:n?.page,limit:n?.limit,enabled:n?.enabled},signal:n?.signal})}async ScheduledTasksController_getScheduledTask(n){return this.request("GET",`/api/v1/scheduled-tasks/${n.id}`,{signal:n?.signal})}async ScheduledTasksController_updateScheduledTask(n){return this.request("PATCH",`/api/v1/scheduled-tasks/${n.id}`,{body:n.body,signal:n?.signal})}async ScheduledTasksController_deleteScheduledTask(n){return this.request("DELETE",`/api/v1/scheduled-tasks/${n.id}`,{responseType:"void",signal:n?.signal})}}class Rj extends rt{constructor(n){super(n)}async DiscoveryController_getIssuer(n){return this.request("GET","/.well-known/oauth-authorization-server/mcp/issuer",{signal:n?.signal})}async DiscoveryController_getAuthorizationServerMetadata(n){return this.request("GET",`/.well-known/oauth-authorization-server/mcp/${n.mcpServerId}/${n.version}`,{signal:n?.signal})}async DiscoveryController_all(n){return this.request("GET",`/.well-known/oauth-protected-resource/${n.path}`,{signal:n?.signal})}}class zj extends rt{constructor(n){super(n)}async GlobalSearchController_search(n){return this.request("GET","/api/v1/search/query",{params:{query:n.query,limit:n.limit,threshold:n.threshold},signal:n?.signal})}}class Dj extends rt{constructor(n){super(n)}async WalkthroughController_acknowledge(n){return this.request("POST","/api/v1/walkthrough/acknowledge",{responseType:"void",signal:n?.signal})}async WalkthroughController_getStatus(n){return this.request("GET","/api/v1/walkthrough/status",{signal:n?.signal})}}class Fn{app;meta;metaProjects;authorizationServer;webAuthentication;authorizationJourneys;tools;jwks;actors;task;agentrun;threads;agent;agentTokens;agentExecutionTokens;context;chatProviders;secrets;executions;workers;taskBlueprints;scheduledTasks;discovery;search;walkthrough;constructor(n){this.app=new cj(n),this.meta=new uj(n),this.metaProjects=new dj(n),this.authorizationServer=new hj(n),this.webAuthentication=new fj(n),this.authorizationJourneys=new pj(n),this.tools=new gj(n),this.jwks=new mj(n),this.actors=new yj(n),this.task=new xj(n),this.agentrun=new vj(n),this.threads=new bj(n),this.agent=new _j(n),this.agentTokens=new Sj(n),this.agentExecutionTokens=new Tj(n),this.context=new jj(n),this.chatProviders=new wj(n),this.secrets=new kj(n),this.executions=new Ej(n),this.workers=new Cj(n),this.taskBlueprints=new Nj(n),this.scheduledTasks=new Aj(n),this.discovery=new Rj(n),this.search=new zj(n),this.walkthrough=new Dj(n)}}const Oj=window.location.origin,Lj=new Fn({baseUrl:Oj,credentials:"include"}),uh=Lj.walkthrough,qj=()=>{console.log("useHome mounting");const[s,n]=p.useState(null);return p.useEffect(()=>{console.log("useHome setting message"),n("Message coming from useHome")},[]),{message:s,setMessage:n}},wx=p.createContext(null);function Mj({children:s}){const{message:n}=qj(),[r,o]=p.useState(""),c=p.useMemo(()=>({message:n,sectionTitle:r,setSectionTitle:o}),[n,r,o]);return a.jsx(wx.Provider,{value:c,children:s})}function Qn(){const s=p.useContext(wx);if(!s)throw new Error("useHomeCtx must be used within <HomeProvider>");return s}const Bj=window.location.origin,kx=new Fn({baseUrl:Bj,credentials:"include"}),Ij=kx.search;kx.search;function Ex(){const[s,n]=p.useState(null),[r,o]=p.useState(!0),[c,d]=p.useState(null);return p.useEffect(()=>{uh.WalkthroughController_getStatus().then(f=>{const y=[{id:"worker",label:"Configure a worker",description:"A worker is a process that runs on your machine and executes agent tasks. Launch the Taico worker binary, then authenticate it with your account — it will appear here once connected.",href:"/settings/workers",completed:f.workerConfigured},{id:"agent",label:"Create an agent",description:"Agents are AI assistants that work on tasks. Create one by picking a runner (e.g. Claude Code, OpenCode), choosing a template, and selecting which tools it can use.",href:"/agents",completed:f.agentCreated},{id:"task",label:"Create a task",description:"Tasks are the core unit of work in Taico. Create your first task, write a clear description, and assign it to an agent to get it working.",href:"/tasks",completed:f.taskCreated},{id:"project-create",label:"Create a project",description:"Projects are created automatically when you add a tag in the format project:<name> to any task. Go to Tasks, open or create a task, and add a tag like project:my-app. Taico will create the project entry for you.",href:"/tasks",completed:f.projectCreated},{id:"project-configure",label:"Configure a project",description:"Link your project to a code repository. Go to Settings → Projects, find your project, and add a repository URL. Taico will automatically clone that repo for any task tagged with this project — no need to specify it per-task.",href:"/settings/projects",completed:f.projectConfigured},{id:"task-with-project",label:"Assign a task to an agent with a project",description:"Tag a task with a project tag and assign it to an agent. Taico will clone the linked repository and make it available in the agent's working directory automatically.",href:"/tasks",completed:f.taskWithProjectCreated},{id:"context",label:"Create a context block",description:"Context blocks are reusable pieces of text — instructions, reference docs, coding standards — that you can attach to tasks and threads. Agents will read them as part of their prompt.",href:"/context",completed:f.contextBlockCreated},{id:"thread",label:"Configure threads",description:"Threads coordinate parallel work when a task branches into sub-tasks. They are created automatically when a task spawns children. Explore the Threads section to see how work is organized.",href:"/settings/chat",completed:f.threadConfigured}],g=y.filter(m=>m.completed).length;n({steps:y,completedCount:g,totalCount:y.length,displayMode:f.onboardingDisplayMode})}).catch(f=>{console.error("Failed to fetch walkthrough status:",f),d(f instanceof Error?f.message:"Failed to load walkthrough")}).finally(()=>{o(!1)})},[]),{status:s,isLoading:r,error:c}}function Uj(){const{user:s,refreshAuth:n}=Dn(),{status:r}=Ex(),o=Re(),[c,d]=p.useState(!1),[f,y]=p.useState(!1);if(s?.onboardingDisplayMode!=="BANNER"||c)return null;const g=r?.completedCount??0,m=r?.totalCount??7,x=m-g,S=()=>o("/walkthrough"),v=w=>{w.stopPropagation(),d(!0)},T=async w=>{w.stopPropagation();try{y(!0),await zs.webAuthControllerMarkWalkthroughSeen(),await n()}catch(k){console.error("Failed to hide walkthrough:",k),y(!1)}};return a.jsx("div",{className:"home-walkthrough-wrap",children:a.jsxs("div",{className:"home-walkthrough-card",onClick:S,role:"button",tabIndex:0,onKeyDown:w=>w.key==="Enter"&&S(),children:[a.jsx("div",{className:"home-walkthrough-dots","aria-hidden":"true",children:Array.from({length:m}).map((w,k)=>a.jsx("span",{className:`home-walkthrough-dot${k<g?" home-walkthrough-dot--done":""}`},k))}),a.jsxs("div",{className:"home-walkthrough-body",children:[a.jsx(_,{size:"2",weight:"semibold",children:x===0?"Setup complete!":`${x} step${x===1?"":"s"} to go`}),a.jsxs(_,{size:"1",tone:"muted",children:[g," of ",m," setup steps completed · Click to continue"]})]}),a.jsxs("div",{className:"home-walkthrough-actions",children:[a.jsx("button",{className:"home-walkthrough-not-now",onClick:v,children:"Not now"}),a.jsx("button",{className:"home-walkthrough-all-set",onClick:T,disabled:f,children:f?"…":"I'm all set"})]})]})})}function $j(){const s=Re(),{setSectionTitle:n}=Qn(),[r,o]=p.useState(""),[c,d]=p.useState([]),[f,y]=p.useState(!1),[g,m]=p.useState(-1),x=p.useRef(null),S=p.useRef([]);wt(),p.useEffect(()=>{n(""),x.current?.focus()},[n]);const v=p.useCallback(async j=>{if(!j.trim()){d([]),m(-1);return}y(!0);try{const R=await Ij.GlobalSearchController_search({query:j,limit:20});d(R),m(-1),S.current=[]}catch(R){console.error("Search failed:",R),d([])}finally{y(!1)}},[]);p.useEffect(()=>{const j=setTimeout(()=>{v(r)},300);return()=>clearTimeout(j)},[r,v]);const T=j=>{j.key==="ArrowDown"?(j.preventDefault(),m(R=>{const L=R<c.length-1?R+1:R;return setTimeout(()=>{S.current[L]?.scrollIntoView({behavior:"smooth",block:"nearest"})},0),L})):j.key==="ArrowUp"?(j.preventDefault(),m(R=>{const L=R>0?R-1:0;return setTimeout(()=>{S.current[L]?.scrollIntoView({behavior:"smooth",block:"nearest"})},0),L})):j.key==="Enter"&&g>=0&&c[g]&&(j.preventDefault(),s(c[g].url))},w=j=>{s(j)},k=j=>{switch(j){case"task":return"blue";case"context_block":return"purple";case"agent":return"green";case"project":return"orange";case"tag":return"yellow";case"tool":return"red";default:return"gray"}},C=j=>{switch(j){case"task":return"Task";case"context_block":return"Context";case"agent":return"Agent";case"project":return"Project";case"tag":return"Tag";case"tool":return"Tool";default:return j}};return a.jsxs("div",{className:"home-page",children:[a.jsx(Uj,{}),a.jsx("div",{className:"home-page-search",children:a.jsx("div",{className:"home-search-container",children:a.jsxs(W,{spacing:"6",align:"center",children:[a.jsxs(W,{spacing:"3",align:"center",children:[a.jsx(_,{size:"6",weight:"bold",className:"home-search-title",children:"Find anything"}),a.jsx(_,{size:"3",tone:"muted",className:"home-search-subtitle",children:"Search across tasks, context, agents, tools, and more"})]}),a.jsx("div",{className:"home-search-box",children:a.jsx("input",{ref:x,type:"text",className:"home-search-input",placeholder:"Search...",value:r,onChange:j=>o(j.target.value),onKeyDown:T,autoFocus:!0})}),r&&a.jsx($e,{className:"home-search-results",children:a.jsxs(W,{spacing:"2",children:[f&&a.jsx(_,{tone:"muted",size:"2",children:"Searching..."}),!f&&c.length===0&&a.jsx(_,{tone:"muted",size:"2",children:"No results found"}),!f&&c.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs(_,{size:"1",tone:"muted",children:[c.length," ",c.length===1?"result":"results"]}),a.jsx("div",{className:"home-search-results-list",children:c.map((j,R)=>a.jsx("div",{ref:L=>{S.current[R]=L},children:a.jsxs(ZT,{interactive:!0,onClick:()=>w(j.url),className:`home-search-result-row ${R===g?"home-search-result-row--selected":""}`,children:[a.jsx("div",{className:"home-search-result-main",children:a.jsx(_,{weight:"medium",size:"3",children:j.title})}),a.jsxs("div",{className:"home-search-result-meta",children:[a.jsx(Ds,{color:k(j.type),children:C(j.type)}),a.jsxs(_,{size:"1",tone:"muted",children:[Math.round(j.score*100),"% match"]})]})]})},j.id))})]})]})}),a.jsxs(lt,{spacing:"2",className:"home-quick-links",children:[a.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>s("/tasks"),children:"Tasks"}),a.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>s("/threads"),children:"Threads"}),a.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>s("/agents"),children:"Agents"}),a.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>s("/context"),children:"Context"})]})]})})})]})}function Ua({sectionTitle:s,headerActions:n,children:r}){return a.jsxs("div",{className:"desktop-shell",children:[s&&a.jsxs("div",{className:"desktop-shell__header",children:[a.jsx("h1",{className:"desktop-shell__title",children:s}),n?a.jsx("div",{className:"desktop-shell__actions",children:n}):null]}),a.jsx("div",{className:"desktop-shell__content",children:r})]})}function Hj({navItems:s,activePath:n,onActiveItemClick:r}){return console.log("Rendering BottomNavContent with navItems:",s),s.length===0?a.jsx(a.Fragment,{}):a.jsx(lt,{spacing:"1",justify:"space-between",children:s.map((o,c)=>{const d=n===o.path;return a.jsxs(Ls,{to:o.path,className:`ios-shell__bottom-nav__item ${d?"ios-shell__bottom-nav__item--active":""}`,onClick:()=>{d&&r()},children:[a.jsx("span",{className:"ios-shell__bottom-nav__icon",children:o.icon}),a.jsx(_,{size:"1",className:"ios-shell__bottom-nav-label",children:o.label})]},o.label)})})}function $a(s){const n=Lt();console.log("Mounting iOS shell");const[r,o]=p.useState(!1),c=()=>{o(!1)},[d,f]=p.useState(!0),[y,g]=p.useState(!0),[m,x]=p.useState(!0),S=p.useRef(null),v=U=>{S.current=U,I(),z(),H()},T=p.useRef(null),w=U=>{T.current=U,I()},k=p.useRef(null),C=p.useRef(null),j=U=>{C.current=U,z()},R=p.useRef(null),L=p.useRef(null),N=U=>{L.current=U,H()},M=p.useRef(null),A=(U,J,X)=>{const te=J.current,ue=S.current;!te||!ue||(U.current?.disconnect(),U.current=new IntersectionObserver(([B])=>{X(B.isIntersecting)},{root:ue,threshold:[0,1]}),U.current.observe(te))},z=()=>{A(R,C,U=>{console.log(`title visibility detector: ${U}`),f(U)})},I=()=>{A(k,T,U=>{console.log(`content behind header detector: ${U}`),g(!U)})},H=()=>{A(M,L,U=>{console.log(`bottom detector: ${U}`),x(!U)})},P=()=>{S.current?.scrollTo({top:0,behavior:"smooth"})};return p.useEffect(()=>()=>{R.current?.disconnect(),k.current?.disconnect(),M.current?.disconnect()},[]),a.jsxs("div",{className:"ios-shell",children:[a.jsxs("aside",{className:`ios-shell__drawer ${r?"ios-shell__drawer--open":""}`,children:[a.jsxs("div",{className:"ios-shell__drawer-header",children:[a.jsx(_,{size:"4",weight:"bold",children:"taico"}),a.jsx("button",{className:"ios-shell__drawer-close",onClick:c,"aria-label":"Close menu",children:"✕"})]}),a.jsx("nav",{className:"ios-shell__drawer-nav",children:Al.map(U=>{const J=n.pathname===U.path||n.pathname.startsWith(U.path+"/");return a.jsxs(Ls,{to:U.path,className:`ios-shell__drawer-item ${J?"ios-shell__drawer-item--active":""}`,onClick:c,children:[a.jsx("span",{className:"ios-shell__drawer-icon",children:U.icon}),a.jsx("span",{className:"ios-shell__drawer-label",children:U.label})]},U.path)})})]}),a.jsx("header",{className:`ios-shell__header ${y?"elevated":""}`,children:a.jsxs(lt,{spacing:"5",align:"center",children:[a.jsx("button",{className:"ios-shell__hamburger",onClick:()=>o(!0),"aria-label":"Open menu",children:"☰"}),a.jsx(_,{size:"3",weight:"normal",as:"div",children:s.appTitle}),a.jsx("div",{className:`ios-shell__header__section-title ${d?"is-hidden":"is-visible"}`,children:s.sectionTitle})]})}),a.jsxs("main",{ref:v,className:"ios-shell__main",children:[a.jsx("div",{className:"ios-shell__main__top-padding"}),a.jsx("div",{ref:w,className:"ios-shell__main__section-title-top-sentinel"}),a.jsx("div",{className:`ios-shell__main__section-title ${d?"is-visible":"is-hidden"}`,children:s.sectionTitle}),a.jsx("div",{ref:j,className:"ios-shell__main__section-title-bottom-sentinel"}),a.jsx("div",{className:"ios-shell__main__top-sentinel"}),s.children,a.jsx("div",{ref:N,className:"ios-shell__main__bottom-sentinel"}),a.jsx("div",{className:"ios-shell__main__bottom-padding"})]}),a.jsx("nav",{className:`ios-shell__bottom-nav ${m?"elevated":""}`,children:a.jsx(Hj,{navItems:s.navItems,activePath:n.pathname,onActiveItemClick:P})})]})}const Gj=[{path:"/home",label:"Home",icon:"🏠"},{path:"/tasks",label:"Tasks",icon:"🧩"},{path:"/context",label:"Context",icon:"🧱"},{path:"/agents",label:"Agents",icon:"🦄"},{path:"/settings",label:"Settings",icon:"⚙️"}];function Pj(){const s=jt(),{sectionTitle:n}=Qn();return a.jsx(a.Fragment,{children:s?a.jsx(Ua,{sectionTitle:n,children:a.jsx(Ot,{})}):a.jsx($a,{appTitle:"Home",sectionTitle:n,navItems:Gj,children:a.jsx(Ot,{})})})}const Cx=p.createContext(null);function Jr(){const s=p.useContext(Cx);if(!s)throw new Error("useCommandPalette must be used within a CommandPaletteProvider");return s}function Vj({children:s}){const n=Re(),[r,o]=p.useState(new Map),[c,d]=p.useState(new Map),f=p.useRef(0),y=p.useMemo(()=>[{id:"nav-home",label:"Home",description:"Go to homepage",aliases:["home","search"],onSelect:()=>n("/home")},{id:"nav-tasks",label:"Tasks",description:"Go to tasks",aliases:["task"],onSelect:()=>n("/tasks")},{id:"nav-context",label:"Context",description:"Go to context blocks",aliases:["blocks","block"],onSelect:()=>n("/context")},{id:"nav-agents",label:"Agents",description:"Go to agents",aliases:["agent"],onSelect:()=>n("/agents")},{id:"nav-threads",label:"Threads",description:"Go to threads",aliases:["thread"],onSelect:()=>n("/threads")},{id:"nav-tools",label:"Tools",description:"Go to tools",aliases:["mcp","tool"],onSelect:()=>n("/tools")},{id:"nav-runs",label:"Runs",description:"Go to runs",aliases:["executions","execution","work queue"],onSelect:()=>n("/runs")},{id:"nav-schedule",label:"Schedule",description:"Go to schedule",aliases:["cron","schedules"],onSelect:()=>n("/tasks/schedule")},{id:"nav-settings",label:"Settings",description:"Go to settings",aliases:["setting","config"],onSelect:()=>n("/settings")}],[n]),g=p.useCallback(T=>{const w=String(++f.current);return o(k=>{const C=new Map(k);return C.set(w,T),C}),()=>{o(k=>{const C=new Map(k);return C.delete(w),C})}},[]),m=p.useCallback(T=>{const w=String(++f.current);return d(k=>{const C=new Map(k);return C.set(w,T),C}),()=>{d(k=>{const C=new Map(k);return C.delete(w),C})}},[]),x=p.useMemo(()=>[...Array.from(r.values()).flat(),...y],[y,r]),S=p.useMemo(()=>{const T=Array.from(c.values());return T[T.length-1]},[c]),v=p.useMemo(()=>({commands:x,registerCommands:g,searchTasks:S,registerTaskSearch:m}),[x,g,S,m]);return a.jsxs(Cx.Provider,{value:v,children:[s,a.jsx(Yj,{})]})}function Yj(){const{commands:s,searchTasks:n}=Jr(),r=Re(),[o,c]=p.useState(!1),[d,f]=p.useState(""),[y,g]=p.useState(0),[m,x]=p.useState(!1),[S,v]=p.useState([]),[T,w]=p.useState(!1),k=p.useRef(null),C=p.useRef(null),j=p.useRef(null),R=p.useRef(0);function L(U,J){const X=U.label.toLowerCase(),te=U.description?.toLowerCase()||"",ue=X.indexOf(J);if(ue!==-1)return X===J?1e3:ue===0?500:300;if(U.aliases)for(const B of U.aliases){const re=B.toLowerCase(),he=re.indexOf(J);if(he!==-1)return re===J?800:he===0?400:200}return te.includes(J)?100:0}const N=d.toLowerCase().trim(),A=[...s.map(U=>({command:U,score:N?L(U,N):0})).filter(U=>U.score>0).sort((U,J)=>J.score!==U.score?J.score-U.score:0).map(U=>U.command).map(U=>({type:"command",command:U})),...S.map(U=>({type:"task",task:U}))];function z(U){if(!N)return U;const J=U.toLowerCase().indexOf(N);return J===-1?U:a.jsxs(a.Fragment,{children:[U.slice(0,J),a.jsx("mark",{children:U.slice(J,J+N.length)}),U.slice(J+N.length)]})}p.useEffect(()=>{if(j.current&&clearTimeout(j.current),!n){R.current+=1,v([]),w(!1);return}if(!N){R.current+=1,v([]),w(!1);return}R.current+=1;const U=R.current;return j.current=window.setTimeout(async()=>{w(!0);try{const J=await n(N);R.current===U&&v(J)}catch(J){console.error("Failed to search tasks:",J),R.current===U&&v([])}finally{R.current===U&&w(!1)}},200),()=>{j.current&&clearTimeout(j.current)}},[N,n]),p.useEffect(()=>{g(0)},[d]),p.useEffect(()=>{const U=J=>{(J.metaKey||J.ctrlKey)&&J.key==="/"&&(J.preventDefault(),c(!0))};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[]),p.useEffect(()=>{o&&k.current&&k.current.focus()},[o]),p.useEffect(()=>{const U=J=>{C.current&&!C.current.contains(J.target)&&o&&I()};if(o)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[o]);function I(){c(!1),f(""),g(0),v([]),w(!1),j.current&&clearTimeout(j.current),R.current+=1}function H(U){U.type==="command"?U.command.onSelect():r(`/tasks/task/${U.task.id}`),I()}function P(U){if(U.key==="Escape"){U.preventDefault(),I();return}if(U.key==="ArrowDown"){U.preventDefault(),g(J=>J<A.length-1?J+1:J);return}if(U.key==="ArrowUp"){U.preventDefault(),g(J=>J>0?J-1:0);return}if(U.key==="Enter"){if(U.preventDefault(),A.length===0){x(!0),setTimeout(()=>x(!1),500);return}const J=A[y];J&&H(J);return}}return o?a.jsx("div",{className:"command-palette-backdrop",children:a.jsxs("div",{className:`command-palette-container ${m?"command-palette-container--shake":""}`,ref:C,children:[a.jsx("input",{ref:k,type:"text",className:"command-palette-input",placeholder:"Type a command...",value:d,onChange:U=>f(U.target.value),onKeyDown:P,autoComplete:"off",spellCheck:!1}),A.length>0&&a.jsx("div",{className:"command-palette-results",children:A.map((U,J)=>{if(U.type==="command"){const X=U.command;return a.jsxs("div",{className:`command-palette-item ${J===y?"command-palette-item--selected":""}`,onClick:()=>H(U),onMouseEnter:()=>g(J),children:[a.jsx("span",{className:"command-palette-item-label",children:z(X.label)}),X.description&&a.jsx("span",{className:"command-palette-item-description",children:X.description})]},`cmd-${X.id}`)}else{const X=U.task;return a.jsxs("div",{className:`command-palette-item command-palette-item--task ${J===y?"command-palette-item--selected":""}`,onClick:()=>H(U),onMouseEnter:()=>g(J),children:[a.jsx("span",{className:"command-palette-item-label",children:z(X.name)}),a.jsx("span",{className:"command-palette-item-description",children:"Task"})]},`task-${X.id}`)}})}),d&&A.length===0&&!T&&a.jsx("div",{className:"command-palette-no-results",children:"No results found"}),T&&a.jsx("div",{className:"command-palette-searching",children:"Searching tasks..."})]})}):null}function Ml({onDelete:s,deleteLabel:n="Delete",confirmLabel:r="Confirm Delete",cancelLabel:o="Cancel",className:c,size:d="lg"}){const[f,y]=p.useState(!1),g=async()=>{await s(),y(!1)};return a.jsx(fe,{className:c,children:f?a.jsxs(a.Fragment,{children:[a.jsx(oe,{size:d,variant:"secondary",onClick:()=>y(!1),children:o}),a.jsx(oe,{size:d,variant:"danger",onClick:g,children:r})]}):a.jsx(oe,{size:d,variant:"danger",onClick:()=>y(!0),children:n})})}const Nx=p.createContext(void 0);function hn(){const s=p.useContext(Nx);if(!s)throw new Error("useToast must be used within ToastProvider");return s}function Fj(s){if(s&&typeof s=="object"){const n=s;if(n.body?.detail)return n.body.detail;if(n.detail)return n.detail;if(n.message)return n.message}return typeof s=="string"?s:"An unexpected error occurred"}function Qj({children:s}){const[n,r]=p.useState([]),o=p.useCallback((f,y="info",g=5e3)=>{const m=crypto.randomUUID(),x={id:m,message:f,type:y,duration:g};r(S=>[...S,x]),g>0&&setTimeout(()=>{d(m)},g)},[]),c=p.useCallback(f=>{const y=Fj(f);o(y,"error",6e3)},[o]),d=p.useCallback(f=>{r(y=>y.filter(g=>g.id!==f))},[]);return a.jsx(Nx.Provider,{value:{toasts:n,showToast:o,showError:c,dismissToast:d},children:s})}function Kj(){const{toasts:s,dismissToast:n}=hn();return s.length===0?null:a.jsx("div",{className:"toast-container",children:s.map(r=>a.jsxs("div",{className:`toast toast--${r.type}`,role:"alert","aria-live":"assertive",children:[a.jsx("div",{className:"toast__content",children:a.jsx(_,{size:"2",className:"toast__message",children:r.message})}),a.jsx("button",{className:"toast__close",onClick:()=>n(r.id),"aria-label":"Dismiss notification",children:"×"})]},r.id))})}function Xj(){const{setSectionTitle:s}=Qn(),n=jt(),r=Re(),{registerCommands:o}=Jr();return wt(),p.useEffect(()=>{s("Settings")},[]),p.useEffect(()=>o([{id:"settings-account",label:"Account Settings",description:"Manage your account security",aliases:["password","account","security"],onSelect:()=>r("/settings/account")},{id:"settings-appearance",label:"Appearance Settings",description:"Choose your preferred color theme",aliases:["theme","appearance","dark mode","light mode"],onSelect:()=>r("/settings/appearance")},{id:"settings-projects",label:"Projects Settings",description:"Manage your projects",aliases:["projects","manage projects"],onSelect:()=>r("/settings/projects")},{id:"settings-chat",label:"Chat Settings",description:"Configure chat providers for conversations",aliases:["chat","openai","providers","chat providers"],onSelect:()=>r("/settings/chat")},{id:"settings-workers",label:"Workers Settings",description:"Configure and manage background workers",aliases:["workers","background","execution"],onSelect:()=>r("/settings/workers")},{id:"settings-ai-providers",label:"AI Providers",description:"View usage and quota for AI providers",aliases:["ai","providers","usage","quota","anthropic","openai","claude"],onSelect:()=>r("/settings/ai-providers")},{id:"settings-data",label:"Import / Export",description:"Import and export workspace data",aliases:["data","export","import","backup","restore"],onSelect:()=>r("/settings/data")}]),[o,r]),a.jsxs(W,{spacing:"6",children:[n?a.jsx(_,{tone:"muted",children:"Customize your experience"}):"",a.jsx($e,{padding:"5",children:a.jsxs(W,{spacing:"3",children:[a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"4",weight:"semibold",children:"Account"}),a.jsx(_,{tone:"muted",children:"Manage your account security"})]}),a.jsxs(lt,{justify:"space-between",align:"center",children:[a.jsx(_,{size:"2",tone:"muted",children:"Update your password"}),a.jsx(oe,{variant:"secondary",size:"sm",onClick:()=>r("/settings/account"),children:"Change Password"})]})]})}),a.jsx($e,{padding:"5",children:a.jsxs(W,{spacing:"3",children:[a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"4",weight:"semibold",children:"Appearance"}),a.jsx(_,{tone:"muted",children:"Choose your preferred color theme"})]}),a.jsxs(lt,{justify:"space-between",align:"center",children:[a.jsx(_,{size:"2",tone:"muted",children:"Pick a theme for the app"}),a.jsx(oe,{variant:"secondary",size:"sm",onClick:()=>r("/settings/appearance"),children:"Choose Theme"})]})]})}),a.jsx($e,{padding:"5",children:a.jsxs(W,{spacing:"3",children:[a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"4",weight:"semibold",children:"Projects"}),a.jsx(_,{tone:"muted",children:"Manage your projects"})]}),a.jsxs(lt,{justify:"space-between",align:"center",children:[a.jsx(_,{size:"2",tone:"muted",children:"View and edit project details"}),a.jsx(oe,{variant:"secondary",size:"sm",onClick:()=>r("/settings/projects"),children:"Manage Projects"})]})]})}),a.jsx($e,{padding:"5",children:a.jsxs(W,{spacing:"3",children:[a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"4",weight:"semibold",children:"Chat"}),a.jsx(_,{tone:"muted",children:"Configure chat providers for conversations"})]}),a.jsxs(lt,{justify:"space-between",align:"center",children:[a.jsx(_,{size:"2",tone:"muted",children:"Manage OpenAI and other providers"}),a.jsx(oe,{variant:"secondary",size:"sm",onClick:()=>r("/settings/chat"),children:"Configure Chat"})]})]})}),a.jsx($e,{padding:"5",children:a.jsxs(W,{spacing:"3",children:[a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"4",weight:"semibold",children:"Workers"}),a.jsx(_,{tone:"muted",children:"Configure and manage background workers"})]}),a.jsxs(lt,{justify:"space-between",align:"center",children:[a.jsx(_,{size:"2",tone:"muted",children:"Set up workers for task execution"}),a.jsx(oe,{variant:"secondary",size:"sm",onClick:()=>r("/settings/workers"),children:"Manage Workers"})]})]})}),a.jsx($e,{padding:"5",children:a.jsxs(W,{spacing:"3",children:[a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"4",weight:"semibold",children:"AI Providers"}),a.jsx(_,{tone:"muted",children:"View usage and quota for AI providers"})]}),a.jsxs(lt,{justify:"space-between",align:"center",children:[a.jsx(_,{size:"2",tone:"muted",children:"Monitor Anthropic and OpenAI usage"}),a.jsx(oe,{variant:"secondary",size:"sm",onClick:()=>r("/settings/ai-providers"),children:"Settings"})]})]})}),a.jsx($e,{padding:"5",children:a.jsxs(W,{spacing:"3",children:[a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"4",weight:"semibold",children:"Import / Export"}),a.jsx(_,{tone:"muted",children:"Back up and restore workspace data"})]}),a.jsxs(lt,{justify:"space-between",align:"center",children:[a.jsx(_,{size:"2",tone:"muted",children:"Export blocks and import archive files"}),a.jsx(oe,{variant:"secondary",size:"sm",onClick:()=>r("/settings/data"),children:"Manage Data"})]})]})}),a.jsx($e,{padding:"5",children:a.jsxs(W,{spacing:"3",children:[a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"4",weight:"semibold",children:"Setup walkthrough"}),a.jsx(_,{tone:"muted",children:"Step-by-step guide to configuring Taico"})]}),a.jsxs(lt,{justify:"space-between",align:"center",children:[a.jsx(_,{size:"2",tone:"muted",children:"Review setup steps and track your progress"}),a.jsx(oe,{variant:"secondary",size:"sm",onClick:()=>r("/walkthrough"),children:"Open walkthrough"})]})]})})]})}function Zj(){const{setSectionTitle:s}=Qn(),{logout:n}=Dn(),r=Re(),[o,c]=p.useState(""),[d,f]=p.useState(""),[y,g]=p.useState(""),[m,x]=p.useState(""),[S,v]=p.useState(!1);p.useEffect(()=>{s("Account")},[]);const T=async w=>{w.preventDefault(),g(""),x(""),v(!0);try{await zs.webAuthControllerChangePassword({currentPassword:o,newPassword:d}),x("Password changed successfully! You will be logged out."),c(""),f(""),setTimeout(async()=>{await n(),r("/login")},2e3)}catch(k){g(k?.body?.detail||"Failed to change password. Please check your current password.")}finally{v(!1)}};return a.jsx(W,{spacing:"6",children:a.jsx($e,{padding:"5",children:a.jsxs(W,{spacing:"4",children:[a.jsxs(W,{spacing:"2",children:[a.jsx(_,{size:"4",weight:"semibold",children:"Change Password"}),a.jsx(_,{tone:"muted",children:"Update your account password"})]}),a.jsx("form",{onSubmit:T,children:a.jsxs(W,{spacing:"4",children:[a.jsxs(W,{spacing:"2",children:[a.jsx("label",{htmlFor:"current-password",className:"login-label",children:a.jsx(_,{size:"2",weight:"medium",children:"Current Password"})}),a.jsx("input",{id:"current-password",type:"password",value:o,onChange:w=>c(w.target.value),className:"login-input",placeholder:"••••••••",required:!0,disabled:S,autoComplete:"current-password"})]}),a.jsxs(W,{spacing:"2",children:[a.jsx("label",{htmlFor:"new-password",className:"login-label",children:a.jsx(_,{size:"2",weight:"medium",children:"New Password"})}),a.jsx("input",{id:"new-password",type:"password",value:d,onChange:w=>f(w.target.value),className:"login-input",placeholder:"••••••••",required:!0,disabled:S,autoComplete:"new-password"})]}),y&&a.jsx(Rn,{size:"2",weight:"medium",children:y}),m&&a.jsx("div",{style:{color:"var(--accent)"},children:a.jsx(_,{size:"2",weight:"medium",children:m})}),a.jsx(oe,{type:"submit",variant:"primary",size:"md",disabled:S||!o||!d,children:S?"Changing Password...":"Change Password"})]})})]})})})}const Jj=[{value:"light",label:"Light",description:"Clean light theme"},{value:"dark",label:"Dark",description:"Easy on the eyes"},{value:"github",label:"GitHub",description:"GitHub-inspired green accent"},{value:"forest",label:"Forest",description:"Nature-inspired dark green"},{value:"terminal",label:"Terminal",description:"Classic terminal green on black"},{value:"ai-vibes",label:"AI Vibes",description:"Deep purples with neon accents"},{value:"halo",label:"Halo",description:"Light background with deeper surfaces"},{value:"mono",label:"Mono",description:"Black and white minimalism"},{value:"terminal-amber",label:"Terminal Amber",description:"Terminal tones without the green"},{value:"oceanic",label:"Oceanic",description:"Cool blues and teals"},{value:"party",label:"Party",description:"Playful warm palette"},{value:"tribute",label:"Tribute",description:"Inspired by the old UI's dark sidebar"}];function Wj(){const{theme:s,setTheme:n}=AT(),{setSectionTitle:r}=Qn();return p.useEffect(()=>{r("Appearance")},[]),a.jsx(W,{spacing:"6",children:a.jsx($e,{padding:"5",children:a.jsxs(W,{spacing:"4",children:[a.jsxs(W,{spacing:"2",children:[a.jsx(_,{size:"4",weight:"semibold",children:"Appearance"}),a.jsx(_,{tone:"muted",children:"Choose your preferred color theme"})]}),a.jsx(W,{spacing:"3",children:Jj.map(o=>{const c=s===o.value;return a.jsx($e,{padding:"4",className:c?"settings-theme-card--active":"",children:a.jsxs(lt,{justify:"space-between",align:"center",children:[a.jsxs(W,{spacing:"1",children:[a.jsx(_,{weight:"semibold",children:o.label}),a.jsx(_,{size:"1",tone:"muted",children:o.description})]}),a.jsx(oe,{variant:c?"primary":"secondary",size:"sm",onClick:()=>n(o.value),children:c?"Active":"Select"})]})},o.value)})})]})})})}Ge.BASE=Ba;function ew(){const{setSectionTitle:s}=Qn(),[n,r]=p.useState([]),[o,c]=p.useState(!0),[d,f]=p.useState(""),[y,g]=p.useState(null),[m,x]=p.useState(""),[S,v]=p.useState(""),[T,w]=p.useState(""),[k,C]=p.useState("");p.useEffect(()=>{s("Projects"),j()},[]);const j=async()=>{c(!0),f("");try{const M=await xy.projectsControllerGetAllProjects();r(M)}catch(M){f(M?.body?.detail||"Failed to load projects")}finally{c(!1)}},R=M=>{g(M.id),x(M.description||""),v(M.repoUrl||""),w(""),C("")},L=()=>{g(null),x(""),v(""),w(""),C("")},N=async M=>{w(""),C("");try{await xy.projectsControllerUpdateProject(M,{description:m,repoUrl:S}),C("Project updated successfully!"),g(null),await j(),setTimeout(()=>{C("")},3e3)}catch(A){w(A?.body?.detail||"Failed to update project")}};return o?a.jsx(W,{spacing:"6",children:a.jsx(_,{tone:"muted",children:"Loading projects..."})}):d?a.jsxs(W,{spacing:"6",children:[a.jsx(Rn,{children:d}),a.jsx(oe,{variant:"secondary",onClick:j,children:"Retry"})]}):a.jsxs(W,{spacing:"6",children:[a.jsx(_,{tone:"muted",children:"Manage your projects"}),n.length===0?a.jsx($e,{padding:"5",children:a.jsx(_,{tone:"muted",children:"No projects found"})}):n.map(M=>a.jsx($e,{padding:"5",children:a.jsxs(W,{spacing:"4",children:[a.jsxs(W,{spacing:"2",children:[a.jsx(_,{size:"4",weight:"semibold",children:M.slug}),a.jsxs(_,{size:"2",tone:"muted",children:["Tag: ",M.tagName]})]}),y===M.id?a.jsx("form",{onSubmit:A=>{A.preventDefault(),N(M.id)},children:a.jsxs(W,{spacing:"4",children:[a.jsxs(W,{spacing:"2",children:[a.jsx("label",{htmlFor:`description-${M.id}`,className:"login-label",children:a.jsx(_,{size:"2",weight:"medium",children:"Description"})}),a.jsx("textarea",{id:`description-${M.id}`,value:m,onChange:A=>x(A.target.value),className:"login-input",placeholder:"Project description",rows:3,style:{resize:"vertical",fontFamily:"inherit"}})]}),a.jsxs(W,{spacing:"2",children:[a.jsx("label",{htmlFor:`repo-url-${M.id}`,className:"login-label",children:a.jsx(_,{size:"2",weight:"medium",children:"Repository URL"})}),a.jsx("input",{id:`repo-url-${M.id}`,type:"url",value:S,onChange:A=>v(A.target.value),className:"login-input",placeholder:"https://github.com/username/repo"})]}),T&&a.jsx(Rn,{size:"2",weight:"medium",children:T}),k&&a.jsx("div",{style:{color:"var(--accent)"},children:a.jsx(_,{size:"2",weight:"medium",children:k})}),a.jsxs(lt,{spacing:"3",children:[a.jsx(oe,{type:"submit",variant:"primary",size:"md",children:"Save Changes"}),a.jsx(oe,{type:"button",variant:"secondary",size:"md",onClick:L,children:"Cancel"})]})]})}):a.jsxs(a.Fragment,{children:[a.jsxs(W,{spacing:"2",children:[a.jsx(_,{size:"2",weight:"medium",children:"Description"}),a.jsx(_,{size:"2",tone:"muted",children:M.description||"No description"})]}),a.jsxs(W,{spacing:"2",children:[a.jsx(_,{size:"2",weight:"medium",children:"Repository URL"}),a.jsx(_,{size:"2",tone:"muted",children:M.repoUrl||"No repository URL"})]}),a.jsx(lt,{justify:"end",children:a.jsx(oe,{variant:"secondary",size:"sm",onClick:()=>R(M),children:"Edit Project"})})]})]})},M.id))]})}function tw(){const{setSectionTitle:s}=Qn(),[n,r]=p.useState([]),[o,c]=p.useState(""),[d,f]=p.useState(!0),[y,g]=p.useState(""),[m,x]=p.useState(null),[S,v]=p.useState(null);p.useEffect(()=>{if(!S)return;const j=window.setTimeout(()=>{v(R=>R?.providerId===S.providerId?null:R)},2400);return()=>window.clearTimeout(j)},[S]),p.useEffect(()=>{s("Chat Settings"),T()},[]);const T=async()=>{f(!0);try{const j=await $r.chatProvidersControllerListChatProviders();r(j)}catch(j){c(j?.body?.detail||"Failed to load chat settings")}finally{f(!1)}},w=async j=>{if(!y.trim()){c("Please enter an API key");return}c(""),v(null);try{await $r.chatProvidersControllerUpdateChatProvider(j,{apiKey:y}),v({providerId:j,action:"configure",message:"Config updated"}),x(null),g(""),await T()}catch(R){c(R?.body?.detail||"Failed to configure provider")}},k=async j=>{if(!n.find(L=>L.id===j)?.isConfigured){c("Please configure the provider first");return}c(""),v(null);try{await $r.chatProvidersControllerSetActiveChatProvider({providerId:j}),v({providerId:j,action:"activate",message:"Now active"}),await T()}catch(L){c(L?.body?.detail||"Failed to set active provider")}},C=async j=>{c(""),v(null);try{await $r.chatProvidersControllerDeactivateActiveChatProvider(),v({providerId:j,action:"deactivate",message:"Deactivated"}),await T()}catch(R){c(R?.body?.detail||"Failed to deactivate provider")}};return d?a.jsx(W,{spacing:"6",children:a.jsx(_,{children:"Loading..."})}):a.jsxs(W,{spacing:"6",children:[a.jsx(_,{tone:"muted",children:"Configure chat providers for thread conversations"}),o&&a.jsx(Rn,{size:"2",weight:"medium",children:o}),n.length===0?a.jsx($e,{padding:"5",children:a.jsx(_,{tone:"muted",children:"No chat providers available. OpenAI provider should be created automatically."})}):n.map(j=>a.jsx($e,{padding:"5",children:a.jsxs(W,{spacing:"4",children:[a.jsx(lt,{justify:"space-between",align:"center",children:a.jsxs(W,{spacing:"1",className:"settings-chat__header-copy",children:[a.jsxs("div",{className:"settings-chat__title-row",children:[a.jsx(_,{size:"4",weight:"semibold",children:j.name}),j.isActive?a.jsx("span",{className:"settings-chat__active-indicator",children:"Active"}):null]}),j.type==="openai"?a.jsxs(_,{size:"1",tone:"muted",children:["You can get an API key from"," ",a.jsx("a",{href:"https://platform.openai.com/api-keys",target:"_blank",rel:"noopener noreferrer",className:"settings-chat__helper-link",children:"platform.openai.com/api-keys"})]}):j.type==="adk"?a.jsx(_,{size:"1",tone:"muted",children:"Uses Google AI environment variables (GOOGLE_API_KEY or Vertex AI config). No key stored here."}):null]})}),m===j.id&&j.type!=="adk"?a.jsxs(W,{spacing:"3",children:[a.jsxs(W,{spacing:"2",children:[a.jsx(_,{size:"2",weight:"medium",children:"Enter API Key"}),a.jsx("input",{type:"password",value:y,onChange:R=>g(R.target.value),className:"login-input",placeholder:"sk-...",autoFocus:!0}),a.jsx(_,{size:"1",tone:"muted",children:"Your API key will be stored securely"})]}),a.jsxs(lt,{spacing:"2",children:[a.jsx(oe,{variant:"primary",size:"sm",onClick:()=>w(j.id),disabled:!y.trim(),children:"Save"}),a.jsx(oe,{variant:"secondary",size:"sm",onClick:()=>{x(null),g("")},children:"Cancel"})]})]}):a.jsx(lt,{spacing:"2",children:(()=>{const R=S?.providerId===j.id&&S.action==="configure"?S.message:null,L=S?.providerId===j.id&&S.action==="activate"?S.message:null,N=S?.providerId===j.id&&S.action==="deactivate"?S.message:null,M=L||N,A=!j.isActive&&!j.isConfigured,z=M?"primary":j.isActive?"danger":"primary",I=M||(j.isActive?"Deactivate":"Set Active"),H=j.isActive?()=>C(j.id):()=>k(j.id),P=A?"Configure the provider first to set it as active":"";return a.jsxs(a.Fragment,{children:[j.type!=="adk"&&a.jsx(oe,{variant:R?"primary":"secondary",size:"sm",onClick:()=>x(j.id),children:R||(j.isConfigured?"Update Config":"Configure")}),a.jsx("span",{className:"settings-chat__action-wrapper",title:P,children:a.jsx(oe,{variant:z,size:"sm",onClick:H,disabled:A,className:"settings-chat__action-button","data-feedback":L?"active":N?"deactivated":null,children:I})})]})})()})]})},j.id))]})}function nw(){const{setSectionTitle:s}=Qn(),[n,r]=p.useState(!1),[o,c]=p.useState(!1),[d,f]=p.useState(null),[y,g]=p.useState(""),[m,x]=p.useState("");p.useEffect(()=>{s("Import / Export")},[s]);const S=p.useMemo(()=>`${Ba}/api/v1/context/blocks/export`,[]),v=p.useMemo(()=>`${Ba}/api/v1/context/blocks/import`,[]),T=async()=>{r(!0),g(""),x("");try{const k=await fetch(S,{method:"GET",credentials:"include"});if(!k.ok)throw new Error("Failed to export blocks");const C=await k.blob(),R=k.headers.get("content-disposition")?.match(/filename="?([^";]+)"?/)?.[1]||"context-blocks.zip",L=window.URL.createObjectURL(C),N=document.createElement("a");N.href=L,N.download=R,document.body.appendChild(N),N.click(),N.remove(),window.URL.revokeObjectURL(L),x("Blocks export downloaded successfully.")}catch{g("Failed to export blocks. Please try again.")}finally{r(!1)}},w=async()=>{if(!d){g("Please choose a .zip file first."),x("");return}c(!0),g(""),x("");try{const k=new FormData;k.append("file",d);const C=await fetch(v,{method:"POST",credentials:"include",body:k}),j=await C.json().catch(()=>({}));if(!C.ok)throw new Error("Failed to import blocks");const R=j.importedCount??0;x(`Import complete. ${R} block${R===1?"":"s"} created.`),f(null)}catch{g("Failed to import blocks. Verify the archive format and try again.")}finally{c(!1)}};return a.jsxs(W,{spacing:"6",children:[a.jsx(_,{tone:"muted",children:"Import and export workspace data. Blocks are available now; task support can be added in this section later."}),y?a.jsx(Rn,{size:"2",weight:"medium",children:y}):null,m?a.jsx(_,{size:"2",className:"settings-data__success",children:m}):null,a.jsx($e,{padding:"5",children:a.jsxs(W,{spacing:"4",children:[a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"4",weight:"semibold",children:"Export Blocks"}),a.jsx(_,{tone:"muted",children:"Download all context blocks as a nested markdown zip archive."})]}),a.jsx(lt,{justify:"end",children:a.jsx(oe,{variant:"primary",size:"sm",onClick:T,disabled:n,children:n?"Exporting...":"Export Blocks"})})]})}),a.jsx($e,{padding:"5",children:a.jsxs(W,{spacing:"4",children:[a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"4",weight:"semibold",children:"Import Blocks"}),a.jsx(_,{tone:"muted",children:"Upload a blocks archive to create context blocks in this workspace."})]}),a.jsx("label",{htmlFor:"blocks-import-file",className:"settings-data__file-label",children:"Select archive (.zip)"}),a.jsx("input",{id:"blocks-import-file",type:"file",accept:".zip,application/zip",onChange:k=>f(k.target.files?.[0]??null),className:"settings-data__file-input"}),a.jsx(_,{size:"1",tone:"muted",children:d?`Selected: ${d.name}`:"No file selected"}),a.jsx(lt,{justify:"end",children:a.jsx(oe,{variant:"secondary",size:"sm",onClick:w,disabled:o,children:o?"Importing...":"Import Blocks"})})]})})]})}const rs=Object.create(null);rs.open="0";rs.close="1";rs.ping="2";rs.pong="3";rs.message="4";rs.upgrade="5";rs.noop="6";const Ao=Object.create(null);Object.keys(rs).forEach(s=>{Ao[rs[s]]=s});const Ud={type:"error",data:"parser error"},Ax=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Rx=typeof ArrayBuffer=="function",zx=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s&&s.buffer instanceof ArrayBuffer,dh=({type:s,data:n},r,o)=>Ax&&n instanceof Blob?r?o(n):by(n,o):Rx&&(n instanceof ArrayBuffer||zx(n))?r?o(n):by(new Blob([n]),o):o(rs[s]+(n||"")),by=(s,n)=>{const r=new FileReader;return r.onload=function(){const o=r.result.split(",")[1];n("b"+(o||""))},r.readAsDataURL(s)};function _y(s){return s instanceof Uint8Array?s:s instanceof ArrayBuffer?new Uint8Array(s):new Uint8Array(s.buffer,s.byteOffset,s.byteLength)}let yd;function sw(s,n){if(Ax&&s.data instanceof Blob)return s.data.arrayBuffer().then(_y).then(n);if(Rx&&(s.data instanceof ArrayBuffer||zx(s.data)))return n(_y(s.data));dh(s,!1,r=>{yd||(yd=new TextEncoder),n(yd.encode(r))})}const Sy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Hr=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let s=0;s<Sy.length;s++)Hr[Sy.charCodeAt(s)]=s;const aw=s=>{let n=s.length*.75,r=s.length,o,c=0,d,f,y,g;s[s.length-1]==="="&&(n--,s[s.length-2]==="="&&n--);const m=new ArrayBuffer(n),x=new Uint8Array(m);for(o=0;o<r;o+=4)d=Hr[s.charCodeAt(o)],f=Hr[s.charCodeAt(o+1)],y=Hr[s.charCodeAt(o+2)],g=Hr[s.charCodeAt(o+3)],x[c++]=d<<2|f>>4,x[c++]=(f&15)<<4|y>>2,x[c++]=(y&3)<<6|g&63;return m},lw=typeof ArrayBuffer=="function",hh=(s,n)=>{if(typeof s!="string")return{type:"message",data:Dx(s,n)};const r=s.charAt(0);return r==="b"?{type:"message",data:rw(s.substring(1),n)}:Ao[r]?s.length>1?{type:Ao[r],data:s.substring(1)}:{type:Ao[r]}:Ud},rw=(s,n)=>{if(lw){const r=aw(s);return Dx(r,n)}else return{base64:!0,data:s}},Dx=(s,n)=>{switch(n){case"blob":return s instanceof Blob?s:new Blob([s]);case"arraybuffer":default:return s instanceof ArrayBuffer?s:s.buffer}},Ox="",iw=(s,n)=>{const r=s.length,o=new Array(r);let c=0;s.forEach((d,f)=>{dh(d,!1,y=>{o[f]=y,++c===r&&n(o.join(Ox))})})},ow=(s,n)=>{const r=s.split(Ox),o=[];for(let c=0;c<r.length;c++){const d=hh(r[c],n);if(o.push(d),d.type==="error")break}return o};function cw(){return new TransformStream({transform(s,n){sw(s,r=>{const o=r.length;let c;if(o<126)c=new Uint8Array(1),new DataView(c.buffer).setUint8(0,o);else if(o<65536){c=new Uint8Array(3);const d=new DataView(c.buffer);d.setUint8(0,126),d.setUint16(1,o)}else{c=new Uint8Array(9);const d=new DataView(c.buffer);d.setUint8(0,127),d.setBigUint64(1,BigInt(o))}s.data&&typeof s.data!="string"&&(c[0]|=128),n.enqueue(c),n.enqueue(r)})}})}let xd;function vo(s){return s.reduce((n,r)=>n+r.length,0)}function bo(s,n){if(s[0].length===n)return s.shift();const r=new Uint8Array(n);let o=0;for(let c=0;c<n;c++)r[c]=s[0][o++],o===s[0].length&&(s.shift(),o=0);return s.length&&o<s[0].length&&(s[0]=s[0].slice(o)),r}function uw(s,n){xd||(xd=new TextDecoder);const r=[];let o=0,c=-1,d=!1;return new TransformStream({transform(f,y){for(r.push(f);;){if(o===0){if(vo(r)<1)break;const g=bo(r,1);d=(g[0]&128)===128,c=g[0]&127,c<126?o=3:c===126?o=1:o=2}else if(o===1){if(vo(r)<2)break;const g=bo(r,2);c=new DataView(g.buffer,g.byteOffset,g.length).getUint16(0),o=3}else if(o===2){if(vo(r)<8)break;const g=bo(r,8),m=new DataView(g.buffer,g.byteOffset,g.length),x=m.getUint32(0);if(x>Math.pow(2,21)-1){y.enqueue(Ud);break}c=x*Math.pow(2,32)+m.getUint32(4),o=3}else{if(vo(r)<c)break;const g=bo(r,c);y.enqueue(hh(d?g:xd.decode(g),n)),o=0}if(c===0||c>s){y.enqueue(Ud);break}}}})}const Lx=4;function Tt(s){if(s)return dw(s)}function dw(s){for(var n in Tt.prototype)s[n]=Tt.prototype[n];return s}Tt.prototype.on=Tt.prototype.addEventListener=function(s,n){return this._callbacks=this._callbacks||{},(this._callbacks["$"+s]=this._callbacks["$"+s]||[]).push(n),this};Tt.prototype.once=function(s,n){function r(){this.off(s,r),n.apply(this,arguments)}return r.fn=n,this.on(s,r),this};Tt.prototype.off=Tt.prototype.removeListener=Tt.prototype.removeAllListeners=Tt.prototype.removeEventListener=function(s,n){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+s];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+s],this;for(var o,c=0;c<r.length;c++)if(o=r[c],o===n||o.fn===n){r.splice(c,1);break}return r.length===0&&delete this._callbacks["$"+s],this};Tt.prototype.emit=function(s){this._callbacks=this._callbacks||{};for(var n=new Array(arguments.length-1),r=this._callbacks["$"+s],o=1;o<arguments.length;o++)n[o-1]=arguments[o];if(r){r=r.slice(0);for(var o=0,c=r.length;o<c;++o)r[o].apply(this,n)}return this};Tt.prototype.emitReserved=Tt.prototype.emit;Tt.prototype.listeners=function(s){return this._callbacks=this._callbacks||{},this._callbacks["$"+s]||[]};Tt.prototype.hasListeners=function(s){return!!this.listeners(s).length};const Yo=typeof Promise=="function"&&typeof Promise.resolve=="function"?n=>Promise.resolve().then(n):(n,r)=>r(n,0),En=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),hw="arraybuffer";function qx(s,...n){return n.reduce((r,o)=>(s.hasOwnProperty(o)&&(r[o]=s[o]),r),{})}const fw=En.setTimeout,pw=En.clearTimeout;function Fo(s,n){n.useNativeTimers?(s.setTimeoutFn=fw.bind(En),s.clearTimeoutFn=pw.bind(En)):(s.setTimeoutFn=En.setTimeout.bind(En),s.clearTimeoutFn=En.clearTimeout.bind(En))}const gw=1.33;function mw(s){return typeof s=="string"?yw(s):Math.ceil((s.byteLength||s.size)*gw)}function yw(s){let n=0,r=0;for(let o=0,c=s.length;o<c;o++)n=s.charCodeAt(o),n<128?r+=1:n<2048?r+=2:n<55296||n>=57344?r+=3:(o++,r+=4);return r}function Mx(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function xw(s){let n="";for(let r in s)s.hasOwnProperty(r)&&(n.length&&(n+="&"),n+=encodeURIComponent(r)+"="+encodeURIComponent(s[r]));return n}function vw(s){let n={},r=s.split("&");for(let o=0,c=r.length;o<c;o++){let d=r[o].split("=");n[decodeURIComponent(d[0])]=decodeURIComponent(d[1])}return n}class bw extends Error{constructor(n,r,o){super(n),this.description=r,this.context=o,this.type="TransportError"}}class fh extends Tt{constructor(n){super(),this.writable=!1,Fo(this,n),this.opts=n,this.query=n.query,this.socket=n.socket,this.supportsBinary=!n.forceBase64}onError(n,r,o){return super.emitReserved("error",new bw(n,r,o)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(n){this.readyState==="open"&&this.write(n)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(n){const r=hh(n,this.socket.binaryType);this.onPacket(r)}onPacket(n){super.emitReserved("packet",n)}onClose(n){this.readyState="closed",super.emitReserved("close",n)}pause(n){}createUri(n,r={}){return n+"://"+this._hostname()+this._port()+this.opts.path+this._query(r)}_hostname(){const n=this.opts.hostname;return n.indexOf(":")===-1?n:"["+n+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(n){const r=xw(n);return r.length?"?"+r:""}}class _w extends fh{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(n){this.readyState="pausing";const r=()=>{this.readyState="paused",n()};if(this._polling||!this.writable){let o=0;this._polling&&(o++,this.once("pollComplete",function(){--o||r()})),this.writable||(o++,this.once("drain",function(){--o||r()}))}else r()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(n){const r=o=>{if(this.readyState==="opening"&&o.type==="open"&&this.onOpen(),o.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(o)};ow(n,this.socket.binaryType).forEach(r),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const n=()=>{this.write([{type:"close"}])};this.readyState==="open"?n():this.once("open",n)}write(n){this.writable=!1,iw(n,r=>{this.doWrite(r,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const n=this.opts.secure?"https":"http",r=this.query||{};return this.opts.timestampRequests!==!1&&(r[this.opts.timestampParam]=Mx()),!this.supportsBinary&&!r.sid&&(r.b64=1),this.createUri(n,r)}}let Bx=!1;try{Bx=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Sw=Bx;function Tw(){}class jw extends _w{constructor(n){if(super(n),typeof location<"u"){const r=location.protocol==="https:";let o=location.port;o||(o=r?"443":"80"),this.xd=typeof location<"u"&&n.hostname!==location.hostname||o!==n.port}}doWrite(n,r){const o=this.request({method:"POST",data:n});o.on("success",r),o.on("error",(c,d)=>{this.onError("xhr post error",c,d)})}doPoll(){const n=this.request();n.on("data",this.onData.bind(this)),n.on("error",(r,o)=>{this.onError("xhr poll error",r,o)}),this.pollXhr=n}}class ls extends Tt{constructor(n,r,o){super(),this.createRequest=n,Fo(this,o),this._opts=o,this._method=o.method||"GET",this._uri=r,this._data=o.data!==void 0?o.data:null,this._create()}_create(){var n;const r=qx(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this._opts.xd;const o=this._xhr=this.createRequest(r);try{o.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){o.setDisableHeaderCheck&&o.setDisableHeaderCheck(!0);for(let c in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(c)&&o.setRequestHeader(c,this._opts.extraHeaders[c])}}catch{}if(this._method==="POST")try{o.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{o.setRequestHeader("Accept","*/*")}catch{}(n=this._opts.cookieJar)===null||n===void 0||n.addCookies(o),"withCredentials"in o&&(o.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(o.timeout=this._opts.requestTimeout),o.onreadystatechange=()=>{var c;o.readyState===3&&((c=this._opts.cookieJar)===null||c===void 0||c.parseCookies(o.getResponseHeader("set-cookie"))),o.readyState===4&&(o.status===200||o.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof o.status=="number"?o.status:0)},0))},o.send(this._data)}catch(c){this.setTimeoutFn(()=>{this._onError(c)},0);return}typeof document<"u"&&(this._index=ls.requestsCount++,ls.requests[this._index]=this)}_onError(n){this.emitReserved("error",n,this._xhr),this._cleanup(!0)}_cleanup(n){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Tw,n)try{this._xhr.abort()}catch{}typeof document<"u"&&delete ls.requests[this._index],this._xhr=null}}_onLoad(){const n=this._xhr.responseText;n!==null&&(this.emitReserved("data",n),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}ls.requestsCount=0;ls.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Ty);else if(typeof addEventListener=="function"){const s="onpagehide"in En?"pagehide":"unload";addEventListener(s,Ty,!1)}}function Ty(){for(let s in ls.requests)ls.requests.hasOwnProperty(s)&&ls.requests[s].abort()}const ww=(function(){const s=Ix({xdomain:!1});return s&&s.responseType!==null})();class kw extends jw{constructor(n){super(n);const r=n&&n.forceBase64;this.supportsBinary=ww&&!r}request(n={}){return Object.assign(n,{xd:this.xd},this.opts),new ls(Ix,this.uri(),n)}}function Ix(s){const n=s.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!n||Sw))return new XMLHttpRequest}catch{}if(!n)try{return new En[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Ux=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Ew extends fh{get name(){return"websocket"}doOpen(){const n=this.uri(),r=this.opts.protocols,o=Ux?{}:qx(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(o.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(n,r,o)}catch(c){return this.emitReserved("error",c)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=n=>this.onClose({description:"websocket connection closed",context:n}),this.ws.onmessage=n=>this.onData(n.data),this.ws.onerror=n=>this.onError("websocket error",n)}write(n){this.writable=!1;for(let r=0;r<n.length;r++){const o=n[r],c=r===n.length-1;dh(o,this.supportsBinary,d=>{try{this.doWrite(o,d)}catch{}c&&Yo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const n=this.opts.secure?"wss":"ws",r=this.query||{};return this.opts.timestampRequests&&(r[this.opts.timestampParam]=Mx()),this.supportsBinary||(r.b64=1),this.createUri(n,r)}}const vd=En.WebSocket||En.MozWebSocket;class Cw extends Ew{createSocket(n,r,o){return Ux?new vd(n,r,o):r?new vd(n,r):new vd(n)}doWrite(n,r){this.ws.send(r)}}class Nw extends fh{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(n){return this.emitReserved("error",n)}this._transport.closed.then(()=>{this.onClose()}).catch(n=>{this.onError("webtransport error",n)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(n=>{const r=uw(Number.MAX_SAFE_INTEGER,this.socket.binaryType),o=n.readable.pipeThrough(r).getReader(),c=cw();c.readable.pipeTo(n.writable),this._writer=c.writable.getWriter();const d=()=>{o.read().then(({done:y,value:g})=>{y||(this.onPacket(g),d())}).catch(y=>{})};d();const f={type:"open"};this.query.sid&&(f.data=`{"sid":"${this.query.sid}"}`),this._writer.write(f).then(()=>this.onOpen())})})}write(n){this.writable=!1;for(let r=0;r<n.length;r++){const o=n[r],c=r===n.length-1;this._writer.write(o).then(()=>{c&&Yo(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var n;(n=this._transport)===null||n===void 0||n.close()}}const Aw={websocket:Cw,webtransport:Nw,polling:kw},Rw=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,zw=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function $d(s){if(s.length>8e3)throw"URI too long";const n=s,r=s.indexOf("["),o=s.indexOf("]");r!=-1&&o!=-1&&(s=s.substring(0,r)+s.substring(r,o).replace(/:/g,";")+s.substring(o,s.length));let c=Rw.exec(s||""),d={},f=14;for(;f--;)d[zw[f]]=c[f]||"";return r!=-1&&o!=-1&&(d.source=n,d.host=d.host.substring(1,d.host.length-1).replace(/;/g,":"),d.authority=d.authority.replace("[","").replace("]","").replace(/;/g,":"),d.ipv6uri=!0),d.pathNames=Dw(d,d.path),d.queryKey=Ow(d,d.query),d}function Dw(s,n){const r=/\/{2,9}/g,o=n.replace(r,"/").split("/");return(n.slice(0,1)=="/"||n.length===0)&&o.splice(0,1),n.slice(-1)=="/"&&o.splice(o.length-1,1),o}function Ow(s,n){const r={};return n.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(o,c,d){c&&(r[c]=d)}),r}const Hd=typeof addEventListener=="function"&&typeof removeEventListener=="function",Ro=[];Hd&&addEventListener("offline",()=>{Ro.forEach(s=>s())},!1);class da extends Tt{constructor(n,r){if(super(),this.binaryType=hw,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,n&&typeof n=="object"&&(r=n,n=null),n){const o=$d(n);r.hostname=o.host,r.secure=o.protocol==="https"||o.protocol==="wss",r.port=o.port,o.query&&(r.query=o.query)}else r.host&&(r.hostname=$d(r.host).host);Fo(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},r.transports.forEach(o=>{const c=o.prototype.name;this.transports.push(c),this._transportsByName[c]=o}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=vw(this.opts.query)),Hd&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Ro.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(n){const r=Object.assign({},this.opts.query);r.EIO=Lx,r.transport=n,this.id&&(r.sid=this.id);const o=Object.assign({},this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[n]);return new this._transportsByName[n](o)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const n=this.opts.rememberUpgrade&&da.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const r=this.createTransport(n);r.open(),this.setTransport(r)}setTransport(n){this.transport&&this.transport.removeAllListeners(),this.transport=n,n.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",r=>this._onClose("transport close",r))}onOpen(){this.readyState="open",da.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",n),this.emitReserved("heartbeat"),n.type){case"open":this.onHandshake(JSON.parse(n.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const r=new Error("server error");r.code=n.data,this._onError(r);break;case"message":this.emitReserved("data",n.data),this.emitReserved("message",n.data);break}}onHandshake(n){this.emitReserved("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this._pingInterval=n.pingInterval,this._pingTimeout=n.pingTimeout,this._maxPayload=n.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const n=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+n,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},n),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const n=this._getWritablePackets();this.transport.send(n),this._prevBufferLen=n.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let r=1;for(let o=0;o<this.writeBuffer.length;o++){const c=this.writeBuffer[o].data;if(c&&(r+=mw(c)),o>0&&r>this._maxPayload)return this.writeBuffer.slice(0,o);r+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const n=Date.now()>this._pingTimeoutTime;return n&&(this._pingTimeoutTime=0,Yo(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),n}write(n,r,o){return this._sendPacket("message",n,r,o),this}send(n,r,o){return this._sendPacket("message",n,r,o),this}_sendPacket(n,r,o,c){if(typeof r=="function"&&(c=r,r=void 0),typeof o=="function"&&(c=o,o=null),this.readyState==="closing"||this.readyState==="closed")return;o=o||{},o.compress=o.compress!==!1;const d={type:n,data:r,options:o};this.emitReserved("packetCreate",d),this.writeBuffer.push(d),c&&this.once("flush",c),this.flush()}close(){const n=()=>{this._onClose("forced close"),this.transport.close()},r=()=>{this.off("upgrade",r),this.off("upgradeError",r),n()},o=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?o():n()}):this.upgrading?o():n()),this}_onError(n){if(da.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",n),this._onClose("transport error",n)}_onClose(n,r){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Hd&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const o=Ro.indexOf(this._offlineEventListener);o!==-1&&Ro.splice(o,1)}this.readyState="closed",this.id=null,this.emitReserved("close",n,r),this.writeBuffer=[],this._prevBufferLen=0}}}da.protocol=Lx;class Lw extends da{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let n=0;n<this._upgrades.length;n++)this._probe(this._upgrades[n])}_probe(n){let r=this.createTransport(n),o=!1;da.priorWebsocketSuccess=!1;const c=()=>{o||(r.send([{type:"ping",data:"probe"}]),r.once("packet",S=>{if(!o)if(S.type==="pong"&&S.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;da.priorWebsocketSuccess=r.name==="websocket",this.transport.pause(()=>{o||this.readyState!=="closed"&&(x(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=r.name,this.emitReserved("upgradeError",v)}}))};function d(){o||(o=!0,x(),r.close(),r=null)}const f=S=>{const v=new Error("probe error: "+S);v.transport=r.name,d(),this.emitReserved("upgradeError",v)};function y(){f("transport closed")}function g(){f("socket closed")}function m(S){r&&S.name!==r.name&&d()}const x=()=>{r.removeListener("open",c),r.removeListener("error",f),r.removeListener("close",y),this.off("close",g),this.off("upgrading",m)};r.once("open",c),r.once("error",f),r.once("close",y),this.once("close",g),this.once("upgrading",m),this._upgrades.indexOf("webtransport")!==-1&&n!=="webtransport"?this.setTimeoutFn(()=>{o||r.open()},200):r.open()}onHandshake(n){this._upgrades=this._filterUpgrades(n.upgrades),super.onHandshake(n)}_filterUpgrades(n){const r=[];for(let o=0;o<n.length;o++)~this.transports.indexOf(n[o])&&r.push(n[o]);return r}}let qw=class extends Lw{constructor(n,r={}){const o=typeof n=="object"?n:r;(!o.transports||o.transports&&typeof o.transports[0]=="string")&&(o.transports=(o.transports||["polling","websocket","webtransport"]).map(c=>Aw[c]).filter(c=>!!c)),super(n,o)}};function Mw(s,n="",r){let o=s;r=r||typeof location<"u"&&location,s==null&&(s=r.protocol+"//"+r.host),typeof s=="string"&&(s.charAt(0)==="/"&&(s.charAt(1)==="/"?s=r.protocol+s:s=r.host+s),/^(https?|wss?):\/\//.test(s)||(typeof r<"u"?s=r.protocol+"//"+s:s="https://"+s),o=$d(s)),o.port||(/^(http|ws)$/.test(o.protocol)?o.port="80":/^(http|ws)s$/.test(o.protocol)&&(o.port="443")),o.path=o.path||"/";const d=o.host.indexOf(":")!==-1?"["+o.host+"]":o.host;return o.id=o.protocol+"://"+d+":"+o.port+n,o.href=o.protocol+"://"+d+(r&&r.port===o.port?"":":"+o.port),o}const Bw=typeof ArrayBuffer=="function",Iw=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s.buffer instanceof ArrayBuffer,$x=Object.prototype.toString,Uw=typeof Blob=="function"||typeof Blob<"u"&&$x.call(Blob)==="[object BlobConstructor]",$w=typeof File=="function"||typeof File<"u"&&$x.call(File)==="[object FileConstructor]";function ph(s){return Bw&&(s instanceof ArrayBuffer||Iw(s))||Uw&&s instanceof Blob||$w&&s instanceof File}function zo(s,n){if(!s||typeof s!="object")return!1;if(Array.isArray(s)){for(let r=0,o=s.length;r<o;r++)if(zo(s[r]))return!0;return!1}if(ph(s))return!0;if(s.toJSON&&typeof s.toJSON=="function"&&arguments.length===1)return zo(s.toJSON(),!0);for(const r in s)if(Object.prototype.hasOwnProperty.call(s,r)&&zo(s[r]))return!0;return!1}function Hw(s){const n=[],r=s.data,o=s;return o.data=Gd(r,n),o.attachments=n.length,{packet:o,buffers:n}}function Gd(s,n){if(!s)return s;if(ph(s)){const r={_placeholder:!0,num:n.length};return n.push(s),r}else if(Array.isArray(s)){const r=new Array(s.length);for(let o=0;o<s.length;o++)r[o]=Gd(s[o],n);return r}else if(typeof s=="object"&&!(s instanceof Date)){const r={};for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&(r[o]=Gd(s[o],n));return r}return s}function Gw(s,n){return s.data=Pd(s.data,n),delete s.attachments,s}function Pd(s,n){if(!s)return s;if(s&&s._placeholder===!0){if(typeof s.num=="number"&&s.num>=0&&s.num<n.length)return n[s.num];throw new Error("illegal attachments")}else if(Array.isArray(s))for(let r=0;r<s.length;r++)s[r]=Pd(s[r],n);else if(typeof s=="object")for(const r in s)Object.prototype.hasOwnProperty.call(s,r)&&(s[r]=Pd(s[r],n));return s}const Pw=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ie;(function(s){s[s.CONNECT=0]="CONNECT",s[s.DISCONNECT=1]="DISCONNECT",s[s.EVENT=2]="EVENT",s[s.ACK=3]="ACK",s[s.CONNECT_ERROR=4]="CONNECT_ERROR",s[s.BINARY_EVENT=5]="BINARY_EVENT",s[s.BINARY_ACK=6]="BINARY_ACK"})(Ie||(Ie={}));class Vw{constructor(n){this.replacer=n}encode(n){return(n.type===Ie.EVENT||n.type===Ie.ACK)&&zo(n)?this.encodeAsBinary({type:n.type===Ie.EVENT?Ie.BINARY_EVENT:Ie.BINARY_ACK,nsp:n.nsp,data:n.data,id:n.id}):[this.encodeAsString(n)]}encodeAsString(n){let r=""+n.type;return(n.type===Ie.BINARY_EVENT||n.type===Ie.BINARY_ACK)&&(r+=n.attachments+"-"),n.nsp&&n.nsp!=="/"&&(r+=n.nsp+","),n.id!=null&&(r+=n.id),n.data!=null&&(r+=JSON.stringify(n.data,this.replacer)),r}encodeAsBinary(n){const r=Hw(n),o=this.encodeAsString(r.packet),c=r.buffers;return c.unshift(o),c}}class gh extends Tt{constructor(n){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof n=="function"?{reviver:n}:n)}add(n){let r;if(typeof n=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(n);const o=r.type===Ie.BINARY_EVENT;o||r.type===Ie.BINARY_ACK?(r.type=o?Ie.EVENT:Ie.ACK,this.reconstructor=new Yw(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(ph(n)||n.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(n),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+n)}decodeString(n){let r=0;const o={type:Number(n.charAt(0))};if(Ie[o.type]===void 0)throw new Error("unknown packet type "+o.type);if(o.type===Ie.BINARY_EVENT||o.type===Ie.BINARY_ACK){const d=r+1;for(;n.charAt(++r)!=="-"&&r!=n.length;);const f=n.substring(d,r);if(f!=Number(f)||n.charAt(r)!=="-")throw new Error("Illegal attachments");const y=Number(f);if(!Fw(y)||y<0)throw new Error("Illegal attachments");if(y>this.opts.maxAttachments)throw new Error("too many attachments");o.attachments=y}if(n.charAt(r+1)==="/"){const d=r+1;for(;++r&&!(n.charAt(r)===","||r===n.length););o.nsp=n.substring(d,r)}else o.nsp="/";const c=n.charAt(r+1);if(c!==""&&Number(c)==c){const d=r+1;for(;++r;){const f=n.charAt(r);if(f==null||Number(f)!=f){--r;break}if(r===n.length)break}o.id=Number(n.substring(d,r+1))}if(n.charAt(++r)){const d=this.tryParse(n.substr(r));if(gh.isPayloadValid(o.type,d))o.data=d;else throw new Error("invalid payload")}return o}tryParse(n){try{return JSON.parse(n,this.opts.reviver)}catch{return!1}}static isPayloadValid(n,r){switch(n){case Ie.CONNECT:return jy(r);case Ie.DISCONNECT:return r===void 0;case Ie.CONNECT_ERROR:return typeof r=="string"||jy(r);case Ie.EVENT:case Ie.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&Pw.indexOf(r[0])===-1);case Ie.ACK:case Ie.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Yw{constructor(n){this.packet=n,this.buffers=[],this.reconPack=n}takeBinaryData(n){if(this.buffers.push(n),this.buffers.length===this.reconPack.attachments){const r=Gw(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Fw=Number.isInteger||function(s){return typeof s=="number"&&isFinite(s)&&Math.floor(s)===s};function jy(s){return Object.prototype.toString.call(s)==="[object Object]"}const Qw=Object.freeze(Object.defineProperty({__proto__:null,Decoder:gh,Encoder:Vw,get PacketType(){return Ie}},Symbol.toStringTag,{value:"Module"}));function $n(s,n,r){return s.on(n,r),function(){s.off(n,r)}}const Kw=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Hx extends Tt{constructor(n,r,o){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=n,this.nsp=r,o&&o.auth&&(this.auth=o.auth),this._opts=Object.assign({},o),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const n=this.io;this.subs=[$n(n,"open",this.onopen.bind(this)),$n(n,"packet",this.onpacket.bind(this)),$n(n,"error",this.onerror.bind(this)),$n(n,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...n){return n.unshift("message"),this.emit.apply(this,n),this}emit(n,...r){var o,c,d;if(Kw.hasOwnProperty(n))throw new Error('"'+n.toString()+'" is a reserved event name');if(r.unshift(n),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(r),this;const f={type:Ie.EVENT,data:r};if(f.options={},f.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"){const x=this.ids++,S=r.pop();this._registerAckCallback(x,S),f.id=x}const y=(c=(o=this.io.engine)===null||o===void 0?void 0:o.transport)===null||c===void 0?void 0:c.writable,g=this.connected&&!(!((d=this.io.engine)===null||d===void 0)&&d._hasPingExpired());return this.flags.volatile&&!y||(g?(this.notifyOutgoingListeners(f),this.packet(f)):this.sendBuffer.push(f)),this.flags={},this}_registerAckCallback(n,r){var o;const c=(o=this.flags.timeout)!==null&&o!==void 0?o:this._opts.ackTimeout;if(c===void 0){this.acks[n]=r;return}const d=this.io.setTimeoutFn(()=>{delete this.acks[n];for(let y=0;y<this.sendBuffer.length;y++)this.sendBuffer[y].id===n&&this.sendBuffer.splice(y,1);r.call(this,new Error("operation has timed out"))},c),f=(...y)=>{this.io.clearTimeoutFn(d),r.apply(this,y)};f.withError=!0,this.acks[n]=f}emitWithAck(n,...r){return new Promise((o,c)=>{const d=(f,y)=>f?c(f):o(y);d.withError=!0,r.push(d),this.emit(n,...r)})}_addToQueue(n){let r;typeof n[n.length-1]=="function"&&(r=n.pop());const o={id:this._queueSeq++,tryCount:0,pending:!1,args:n,flags:Object.assign({fromQueue:!0},this.flags)};n.push((c,...d)=>(this._queue[0],c!==null?o.tryCount>this._opts.retries&&(this._queue.shift(),r&&r(c)):(this._queue.shift(),r&&r(null,...d)),o.pending=!1,this._drainQueue())),this._queue.push(o),this._drainQueue()}_drainQueue(n=!1){if(!this.connected||this._queue.length===0)return;const r=this._queue[0];r.pending&&!n||(r.pending=!0,r.tryCount++,this.flags=r.flags,this.emit.apply(this,r.args))}packet(n){n.nsp=this.nsp,this.io._packet(n)}onopen(){typeof this.auth=="function"?this.auth(n=>{this._sendConnectPacket(n)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(n){this.packet({type:Ie.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},n):n})}onerror(n){this.connected||this.emitReserved("connect_error",n)}onclose(n,r){this.connected=!1,delete this.id,this.emitReserved("disconnect",n,r),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(n=>{if(!this.sendBuffer.some(o=>String(o.id)===n)){const o=this.acks[n];delete this.acks[n],o.withError&&o.call(this,new Error("socket has been disconnected"))}})}onpacket(n){if(n.nsp===this.nsp)switch(n.type){case Ie.CONNECT:n.data&&n.data.sid?this.onconnect(n.data.sid,n.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ie.EVENT:case Ie.BINARY_EVENT:this.onevent(n);break;case Ie.ACK:case Ie.BINARY_ACK:this.onack(n);break;case Ie.DISCONNECT:this.ondisconnect();break;case Ie.CONNECT_ERROR:this.destroy();const o=new Error(n.data.message);o.data=n.data.data,this.emitReserved("connect_error",o);break}}onevent(n){const r=n.data||[];n.id!=null&&r.push(this.ack(n.id)),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(n){if(this._anyListeners&&this._anyListeners.length){const r=this._anyListeners.slice();for(const o of r)o.apply(this,n)}super.emit.apply(this,n),this._pid&&n.length&&typeof n[n.length-1]=="string"&&(this._lastOffset=n[n.length-1])}ack(n){const r=this;let o=!1;return function(...c){o||(o=!0,r.packet({type:Ie.ACK,id:n,data:c}))}}onack(n){const r=this.acks[n.id];typeof r=="function"&&(delete this.acks[n.id],r.withError&&n.data.unshift(null),r.apply(this,n.data))}onconnect(n,r){this.id=n,this.recovered=r&&this._pid===r,this._pid=r,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(n=>this.emitEvent(n)),this.receiveBuffer=[],this.sendBuffer.forEach(n=>{this.notifyOutgoingListeners(n),this.packet(n)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(n=>n()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ie.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(n){return this.flags.compress=n,this}get volatile(){return this.flags.volatile=!0,this}timeout(n){return this.flags.timeout=n,this}onAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(n),this}prependAny(n){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(n),this}offAny(n){if(!this._anyListeners)return this;if(n){const r=this._anyListeners;for(let o=0;o<r.length;o++)if(n===r[o])return r.splice(o,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(n),this}prependAnyOutgoing(n){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(n),this}offAnyOutgoing(n){if(!this._anyOutgoingListeners)return this;if(n){const r=this._anyOutgoingListeners;for(let o=0;o<r.length;o++)if(n===r[o])return r.splice(o,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(n){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const r=this._anyOutgoingListeners.slice();for(const o of r)o.apply(this,n.data)}}}function Bl(s){s=s||{},this.ms=s.min||100,this.max=s.max||1e4,this.factor=s.factor||2,this.jitter=s.jitter>0&&s.jitter<=1?s.jitter:0,this.attempts=0}Bl.prototype.duration=function(){var s=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var n=Math.random(),r=Math.floor(n*this.jitter*s);s=(Math.floor(n*10)&1)==0?s-r:s+r}return Math.min(s,this.max)|0};Bl.prototype.reset=function(){this.attempts=0};Bl.prototype.setMin=function(s){this.ms=s};Bl.prototype.setMax=function(s){this.max=s};Bl.prototype.setJitter=function(s){this.jitter=s};class Vd extends Tt{constructor(n,r){var o;super(),this.nsps={},this.subs=[],n&&typeof n=="object"&&(r=n,n=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,Fo(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((o=r.randomizationFactor)!==null&&o!==void 0?o:.5),this.backoff=new Bl({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=n;const c=r.parser||Qw;this.encoder=new c.Encoder,this.decoder=new c.Decoder,this._autoConnect=r.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(n){return arguments.length?(this._reconnection=!!n,n||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(n){return n===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=n,this)}reconnectionDelay(n){var r;return n===void 0?this._reconnectionDelay:(this._reconnectionDelay=n,(r=this.backoff)===null||r===void 0||r.setMin(n),this)}randomizationFactor(n){var r;return n===void 0?this._randomizationFactor:(this._randomizationFactor=n,(r=this.backoff)===null||r===void 0||r.setJitter(n),this)}reconnectionDelayMax(n){var r;return n===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=n,(r=this.backoff)===null||r===void 0||r.setMax(n),this)}timeout(n){return arguments.length?(this._timeout=n,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(n){if(~this._readyState.indexOf("open"))return this;this.engine=new qw(this.uri,this.opts);const r=this.engine,o=this;this._readyState="opening",this.skipReconnect=!1;const c=$n(r,"open",function(){o.onopen(),n&&n()}),d=y=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",y),n?n(y):this.maybeReconnectOnOpen()},f=$n(r,"error",d);if(this._timeout!==!1){const y=this._timeout,g=this.setTimeoutFn(()=>{c(),d(new Error("timeout")),r.close()},y);this.opts.autoUnref&&g.unref(),this.subs.push(()=>{this.clearTimeoutFn(g)})}return this.subs.push(c),this.subs.push(f),this}connect(n){return this.open(n)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const n=this.engine;this.subs.push($n(n,"ping",this.onping.bind(this)),$n(n,"data",this.ondata.bind(this)),$n(n,"error",this.onerror.bind(this)),$n(n,"close",this.onclose.bind(this)),$n(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(n){try{this.decoder.add(n)}catch(r){this.onclose("parse error",r)}}ondecoded(n){Yo(()=>{this.emitReserved("packet",n)},this.setTimeoutFn)}onerror(n){this.emitReserved("error",n)}socket(n,r){let o=this.nsps[n];return o?this._autoConnect&&!o.active&&o.connect():(o=new Hx(this,n,r),this.nsps[n]=o),o}_destroy(n){const r=Object.keys(this.nsps);for(const o of r)if(this.nsps[o].active)return;this._close()}_packet(n){const r=this.encoder.encode(n);for(let o=0;o<r.length;o++)this.engine.write(r[o],n.options)}cleanup(){this.subs.forEach(n=>n()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(n,r){var o;this.cleanup(),(o=this.engine)===null||o===void 0||o.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",n,r),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const n=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const r=this.backoff.duration();this._reconnecting=!0;const o=this.setTimeoutFn(()=>{n.skipReconnect||(this.emitReserved("reconnect_attempt",n.backoff.attempts),!n.skipReconnect&&n.open(c=>{c?(n._reconnecting=!1,n.reconnect(),this.emitReserved("reconnect_error",c)):n.onreconnect()}))},r);this.opts.autoUnref&&o.unref(),this.subs.push(()=>{this.clearTimeoutFn(o)})}}onreconnect(){const n=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",n)}}const Lr={};function Nn(s,n){typeof s=="object"&&(n=s,s=void 0),n=n||{};const r=Mw(s,n.path||"/socket.io"),o=r.source,c=r.id,d=r.path,f=Lr[c]&&d in Lr[c].nsps,y=n.forceNew||n["force new connection"]||n.multiplex===!1||f;let g;return y?g=new Vd(o,n):(Lr[c]||(Lr[c]=new Vd(o,n)),g=Lr[c]),r.query&&!n.query&&(n.query=r.queryKey),g.socket(r.path,n)}Object.assign(Nn,{Manager:Vd,Socket:Hx,io:Nn,connect:Nn});const un={TASK_CREATED:"task.created",TASK_UPDATED:"task.updated",TASK_DELETED:"task.deleted",TASK_ASSIGNED:"task.assigned",TASK_STATUS_CHANGED:"task.status_changed",TASK_COMMENTED:"task.commented",INPUT_REQUEST_ANSWERED:"input.request.answered",TASK_ACTIVITY:"task.activity"},Rl={THREAD_UPDATED:"thread.updated",THREAD_TITLE_UPDATED:"thread.title.updated",MESSAGE_CREATED:"thread.message.created",AGENT_ACTIVITY:"thread.agent.activity",AGENT_RESPONSE_DELTA:"thread.agent.response.delta"};var qo;(function(s){s.HUMAN="human",s.AGENT="agent"})(qo||(qo={}));const Xw={WORKER_SEEN:"worker.seen"},Zw=window.location.origin,Gx=new Fn({baseUrl:Zw,credentials:"include"}),Jw=Gx.workers;Gx.workers;const Ww=ha("/workers");function ek(){const[s,n]=p.useState([]),[r,o]=p.useState(!0),[c,d]=p.useState(null),[f,y]=p.useState(!1),g=x=>[...x].sort((S,v)=>{const T=new Date(S.lastSeenAt).getTime();return new Date(v.lastSeenAt).getTime()-T}),m=async()=>{try{o(!0),d(null);const x=await Jw.WorkersController_listWorkers();n(g(x))}catch(x){console.error("Error fetching workers:",x),d(x instanceof Error?x.message:"Failed to load workers")}finally{o(!1)}};return p.useEffect(()=>{const x=Nn(Ww,{withCredentials:!0,transports:["websocket","polling"]});return m(),x.on("connect",()=>{x.emit("workers.subscribe",{},S=>{if(S.ok){y(!0);return}y(!1)}),m()}),x.on("disconnect",()=>{y(!1)}),x.on("connect_error",S=>{console.error("Workers WebSocket connection error:",S)}),x.on(Xw.WORKER_SEEN,S=>{n(v=>{const T=v.findIndex(w=>w.id===S.worker.id);if(T>=0){const w=[...v];return w[T]=S.worker,g(w)}return g([...v,S.worker])})}),()=>{x.emit("workers.unsubscribe",{}),x.disconnect()}},[]),{workers:s,isLoading:r,error:c,isConnected:f}}function tk(){const{setSectionTitle:s}=Qn(),{workers:n,isLoading:r,error:o}=ek(),[c,d]=p.useState(null);p.useEffect(()=>{s("Workers Settings")},[]);const y=`npx -y @taico/worker --serverurl ${`${window.location.protocol}//${window.location.host}`}`,g=x=>{const S=new Date(x),T=new Date().getTime()-S.getTime(),w=120*1e3;return T<=w},m=async()=>{try{await navigator.clipboard.writeText(y),d("Copied"),window.setTimeout(()=>d(null),1800)}catch{d("Copy failed"),window.setTimeout(()=>d(null),1800)}};return r?a.jsx(W,{spacing:"6",children:a.jsx(_,{children:"Loading..."})}):a.jsxs(W,{spacing:"6",children:[a.jsx(_,{tone:"muted",children:"Workers execute tasks in the background. Configure workers to enable automated task execution."}),o?a.jsx(Rn,{size:"2",weight:"medium",children:o}):null,a.jsx($e,{padding:"5",children:a.jsxs(W,{spacing:"4",children:[a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"4",weight:"semibold",children:"Configure a New Worker"}),a.jsx(_,{tone:"muted",children:"Run this command in your terminal to start a new worker:"})]}),a.jsxs("div",{className:"settings-workers__command-container",children:[a.jsx("code",{className:"settings-workers__command",children:y}),a.jsx(oe,{className:"settings-workers__copy-button",variant:"secondary",size:"sm",onClick:m,children:c??"Copy"})]}),a.jsx(_,{size:"1",tone:"muted",children:"The worker will automatically register and appear in the list below when it connects."})]})}),a.jsxs(W,{spacing:"3",children:[a.jsxs(_,{size:"4",weight:"semibold",children:["Registered Workers (",n.length,")"]}),n.length===0?a.jsx($e,{padding:"5",children:a.jsx(_,{tone:"muted",children:"No workers registered yet. Run the command above to start your first worker."})}):n.map(x=>{const S=g(x.lastSeenAt),T=new Date(x.lastSeenAt).toLocaleString();return a.jsx($e,{padding:"5",children:a.jsxs(W,{spacing:"3",children:[a.jsx(lt,{justify:"space-between",align:"center",children:a.jsxs(W,{spacing:"1",children:[a.jsxs("div",{className:"settings-workers__title-row",children:[a.jsx(_,{size:"3",weight:"semibold",children:"Worker"}),a.jsx("span",{className:`settings-workers__status-indicator ${S?"settings-workers__status-indicator--connected":"settings-workers__status-indicator--disconnected"}`,children:S?"Connected":"Disconnected"})]}),a.jsxs(_,{size:"1",tone:"muted",children:["ID: ",x.id]}),a.jsxs(_,{size:"1",tone:"muted",children:["Last seen: ",T]})]})}),x.harnesses&&x.harnesses.length>0&&a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"2",weight:"medium",children:"Harnesses:"}),a.jsx("div",{className:"settings-workers__harnesses",children:x.harnesses.map(w=>a.jsx("span",{className:"settings-workers__harness-badge",children:w},w))})]})]})},x.id)})]})]})}function nk(){const{setSectionTitle:s}=Qn();return wt(),p.useEffect(()=>{s("AI Providers")},[]),a.jsxs(W,{spacing:"6",children:[a.jsx(_,{tone:"muted",children:"View usage and quota information for AI providers"}),a.jsx($e,{padding:"5",children:a.jsxs(W,{spacing:"4",children:[a.jsx(lt,{justify:"space-between",align:"center",children:a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"4",weight:"semibold",children:"OpenAI"}),a.jsx(_,{size:"1",tone:"muted",children:"Codex and GPT models"})]})}),a.jsx(W,{spacing:"2",children:a.jsx(lt,{spacing:"2",children:a.jsx(oe,{variant:"secondary",size:"sm",onClick:()=>window.open("https://chatgpt.com/codex/cloud/settings/usage","_blank","noopener,noreferrer"),children:"See usage"})})})]})}),a.jsx($e,{padding:"5",children:a.jsxs(W,{spacing:"4",children:[a.jsx(lt,{justify:"space-between",align:"center",children:a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"4",weight:"semibold",children:"Anthropic"}),a.jsx(_,{size:"1",tone:"muted",children:"Claude models"})]})}),a.jsx(W,{spacing:"2",children:a.jsx(lt,{spacing:"2",children:a.jsx(oe,{variant:"secondary",size:"sm",onClick:()=>window.open("https://claude.ai/settings/usage","_blank","noopener,noreferrer"),children:"See usage"})})})]})})]})}function sk({step:s,isCompleted:n,isCurrent:r,isLast:o,isExpanded:c,onToggle:d}){return a.jsxs("div",{className:"walkthrough-step",children:[a.jsxs("div",{className:"walkthrough-step-rail",children:[a.jsx("div",{className:["walkthrough-step-dot",n?"walkthrough-step-dot--completed":"",r?"walkthrough-step-dot--current":""].filter(Boolean).join(" "),children:n&&a.jsx("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M1 4L3.5 6.5L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),!o&&a.jsx("div",{className:["walkthrough-step-connector",n?"walkthrough-step-connector--completed":""].filter(Boolean).join(" ")})]}),a.jsxs("div",{className:"walkthrough-step-body",children:[a.jsx("button",{className:"walkthrough-step-header",onClick:d,"aria-expanded":c,children:a.jsx(_,{size:"2",weight:r?"semibold":"medium",className:n?"walkthrough-label-done":"",children:s.label})}),c&&a.jsxs("div",{className:"walkthrough-step-detail",children:[a.jsx(_,{size:"2",tone:"muted",as:"p",className:"walkthrough-step-description",children:s.description}),a.jsx(Ls,{to:s.href,className:"walkthrough-step-cta",children:"Go →"})]})]})]})}function ak(){const{setSectionTitle:s}=Qn(),{user:n,refreshAuth:r}=Dn(),{status:o,isLoading:c}=Ex(),[d,f]=p.useState(new Set),y=p.useRef(!1),g=p.useRef(!1);wt(),p.useEffect(()=>{s("Setup walkthrough")},[s]),p.useEffect(()=>{g.current||!n||!o||n.onboardingDisplayMode==="OFF"&&o.completedCount<o.totalCount&&(g.current=!0,uh.WalkthroughController_acknowledge().then(()=>r()).catch(console.error))},[n,o,r]),p.useEffect(()=>{if(!o||y.current)return;y.current=!0;const T=o.steps.find(w=>!w.completed);T&&f(new Set([T.id]))},[o]);const m=T=>{f(w=>{const k=new Set(w);return k.has(T)?k.delete(T):k.add(T),k})},x=o?.completedCount??0,S=o?.totalCount??8,v=o?.steps.findIndex(T=>!T.completed)??-1;return a.jsx("div",{className:"walkthrough-page",children:a.jsxs(W,{spacing:"5",className:"walkthrough-page-inner",children:[a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"2",tone:"muted",as:"p",children:"Complete these steps to get the most out of Taico."}),a.jsxs(_,{size:"2",weight:"semibold",children:[x," / ",S," completed"]})]}),c?a.jsx(_,{size:"2",tone:"muted",children:"Loading..."}):a.jsx("div",{className:"walkthrough-track",children:o?.steps.map((T,w)=>a.jsx(sk,{step:T,isCompleted:T.completed,isCurrent:w===v,isLast:w===o.steps.length-1,isExpanded:d.has(T.id),onToggle:()=>m(T.id)},T.id))})]})})}function lk(){return a.jsx(Mj,{children:a.jsx(is,{children:a.jsxs(xe,{element:a.jsx(Pj,{}),children:[a.jsx(xe,{path:"/home",element:a.jsx($j,{})}),a.jsx(xe,{path:"/settings",element:a.jsx(Xj,{})}),a.jsx(xe,{path:"/settings/account",element:a.jsx(Zj,{})}),a.jsx(xe,{path:"/settings/appearance",element:a.jsx(Wj,{})}),a.jsx(xe,{path:"/settings/projects",element:a.jsx(ew,{})}),a.jsx(xe,{path:"/settings/chat",element:a.jsx(tw,{})}),a.jsx(xe,{path:"/settings/workers",element:a.jsx(tk,{})}),a.jsx(xe,{path:"/settings/ai-providers",element:a.jsx(nk,{})}),a.jsx(xe,{path:"/settings/data",element:a.jsx(nw,{})}),a.jsx(xe,{path:"/walkthrough",element:a.jsx(ak,{})})]})})})}const rk="/",ik=window.location.origin,Mo=new Fn({baseUrl:ik,credentials:"include"}),Dt=Mo.task;Mo.actors;Mo.task,Mo.actors;const ok=ha("/tasks"),ck=100,uk=()=>{const[s,n]=p.useState(!0),[r,o]=p.useState(!1),[c,d]=p.useState(null),[f,y]=p.useState([]),[g,m]=p.useState(null),[x,S]=p.useState(!1),[v,T]=p.useState({}),w=H=>{if(!H.message){console.warn("Received task activity event without message, skipping",H);return}T(P=>({...P,[H.taskId]:H}))};p.useEffect(()=>(A(),I()),[]);const k=H=>[...H].sort((P,U)=>{const J=new Date(P.updatedAt).getTime();return new Date(U.updatedAt).getTime()-J}),C=async H=>await Dt.TasksController_createTask({body:H}),j=async({taskId:H})=>await Dt.TasksController_deleteTask({id:H}),R=async({taskId:H,comment:P})=>await Dt.TasksController_addComment({id:H,body:{content:P}}),L=async({taskId:H,assigneeActorId:P})=>{const U={assigneeActorId:P};return await Dt.TasksController_assignTask({id:H,body:U})},N=async({taskId:H})=>await Dt.TasksController_assignTaskToMe({id:H}),M=async({taskId:H,inputRequestId:P,answer:U})=>await Dt.TasksController_answerInputRequest({id:H,inputRequestId:P,body:{answer:U}}),A=async()=>{n(!0),d(null);try{const H=await Dt.TasksController_listTasks({page:1,limit:ck});y(k(H.items))}catch(H){d(H instanceof Error?H.message:"Failed to load tasks")}finally{o(!0),n(!1)}},z=p.useCallback(async H=>{try{const P=await Dt.TasksController_getTask({id:H});return y(U=>U.some(J=>J.id===P.id)?k(U.map(J=>J.id===P.id?P:J)):k([P,...U])),P}catch(P){return console.error("Failed to fetch task by ID",P),null}},[]),I=()=>{const H=Nn(ok,{transports:["websocket","polling"],withCredentials:!0});return H.on("connect",()=>{console.log("Connected to websocket"),H.emit("tasks.subscribe",{},P=>{P.ok?(console.log(P),console.log("Subscribed to room:",P.room),S(!0)):(console.error("Failed to subscribe to room"),S(!1))}),A()}),H.on("disconnect",()=>{console.log("WebSocket disconnected"),S(!1)}),H.on(un.TASK_CREATED,P=>{console.log("task.created",P),y(U=>U.some(J=>J.id===P.payload.id)?U:k([P.payload,...U]))}),H.on(un.TASK_UPDATED,P=>{console.log("task.updated",P),y(U=>k(U.map(J=>J.id===P.payload.id?P.payload:J)))}),H.on(un.TASK_DELETED,P=>{console.log("task.deleted",P),y(U=>U.filter(J=>J.id!==P.payload.taskId))}),H.on(un.TASK_ASSIGNED,P=>{console.log("task.assigned",P),y(U=>k(U.map(J=>J.id===P.payload.id?P.payload:J)))}),H.on(un.TASK_COMMENTED,async P=>{console.log("task.commented",P);try{const U=await Dt.TasksController_getTask({id:P.payload.taskId});y(J=>J.findIndex(te=>te.id===U.id)===-1?k([U,...J]):k(J.map(te=>te.id===U.id?U:te)))}catch(U){console.error("Failed to refresh task after comment",U)}}),H.on(un.INPUT_REQUEST_ANSWERED,async P=>{console.log("input.request.answered",P);try{const U=await Dt.TasksController_getTask({id:P.payload.taskId});y(J=>J.findIndex(te=>te.id===U.id)===-1?k([U,...J]):k(J.map(te=>te.id===U.id?U:te)))}catch(U){console.error("Failed to refresh task after input request answer",U)}}),H.on(un.TASK_STATUS_CHANGED,P=>{console.log("task.status_changed",P),y(U=>k(U.map(J=>J.id===P.payload.id?P.payload:J)))}),H.on(un.TASK_ACTIVITY,P=>{console.log("task.activity",P),w(P)}),m(H),()=>{H.close()}};return{isLoading:s,hasLoadedOnce:r,error:c,activityByTaskId:v,tasks:f,getTaskById:z,createTask:C,deleteTask:j,addComment:R,assignTask:L,assignTaskToMe:N,answerInputRequest:M,isConnected:x}},ve={NOT_STARTED:"NOT_STARTED",IN_PROGRESS:"IN_PROGRESS",FOR_REVIEW:"FOR_REVIEW",DONE:"DONE"},Vn={[ve.NOT_STARTED]:{path:"/tasks/not-started",label:"Queued",icon:"📋"},[ve.IN_PROGRESS]:{path:"/tasks/in-progress",label:"Building",icon:"👨🏻💻"},[ve.FOR_REVIEW]:{path:"/tasks/in-review",label:"Review",icon:"👀"},[ve.DONE]:{path:"/tasks/done",label:"Shipped",icon:"🚀"}},dk=[Vn[ve.NOT_STARTED],Vn[ve.IN_PROGRESS],Vn[ve.FOR_REVIEW],Vn[ve.DONE]],hk=()=>({[ve.NOT_STARTED]:{enteringIds:new Set,exitingTasks:[]},[ve.IN_PROGRESS]:{enteringIds:new Set,exitingTasks:[]},[ve.FOR_REVIEW]:{enteringIds:new Set,exitingTasks:[]},[ve.DONE]:{enteringIds:new Set,exitingTasks:[]}}),Px=p.createContext(null),fk=500,pk=4e3;function gk({children:s}){const{tasks:n,getTaskById:r,isLoading:o,hasLoadedOnce:c,error:d,isConnected:f,createTask:y,deleteTask:g,addComment:m,assignTask:x,assignTaskToMe:S,answerInputRequest:v,activityByTaskId:T}=uk(),[w,k]=p.useState(""),[C,j]=p.useState(0),R=p.useRef(new Map),L=p.useRef([]),N=p.useRef(new Map),M=p.useRef(0),[A,z]=p.useState(0),{animationByStatus:I,globalEnteringIds:H,globalExitingTasks:P}=p.useMemo(()=>{const J=Date.now(),X=new Map(n.map(Te=>[Te.id,Te])),te=R.current,ue=new Set(te.keys()),B=new Set(X.keys());if(L.current=L.current.filter(Te=>Te.expiresAt>J),ue.size>0){const Te={[ve.NOT_STARTED]:new Set,[ve.IN_PROGRESS]:new Set,[ve.FOR_REVIEW]:new Set,[ve.DONE]:new Set},D={[ve.NOT_STARTED]:[],[ve.IN_PROGRESS]:[],[ve.FOR_REVIEW]:[],[ve.DONE]:[]},K=new Set,ce=[];for(const[G,ne]of X){const le=te.get(G);le?le.status!==ne.status&&(D[le.status].push(le),Te[ne.status].add(G)):(Te[ne.status].add(G),K.add(G))}for(const[G,ne]of te)B.has(G)||(D[ne.status].push(ne),ce.push(ne));(Object.values(Te).some(G=>G.size>0)||Object.values(D).some(G=>G.length>0))&&L.current.push({enteringByStatus:Te,exitingByStatus:D,globalEntering:K,globalExiting:ce,expiresAt:J+fk})}R.current=X;const re=hk();let he=new Set,ke=[];for(const Te of L.current){for(const D of Object.values(ve))Te.enteringByStatus[D].forEach(K=>re[D].enteringIds.add(K)),re[D].exitingTasks.push(...Te.exitingByStatus[D]);Te.globalEntering.forEach(D=>he.add(D)),ke.push(...Te.globalExiting)}return{animationByStatus:re,globalEnteringIds:he,globalExitingTasks:ke}},[n,A]);p.useEffect(()=>{if(L.current.length===0)return;const X=Math.min(...L.current.map(ue=>ue.expiresAt))-Date.now();if(X<=0){z(ue=>ue+1);return}const te=setTimeout(()=>{z(ue=>ue+1)},X);return()=>clearTimeout(te)},[I,H,P]),p.useEffect(()=>{const J=N.current,X=new Map(n.map(ue=>[ue.id,ue]));if(J.size===0){N.current=X;return}let te=!1;for(const[ue,B]of X){const re=J.get(ue);if(re&&re.status!==ve.DONE&&B.status===ve.DONE){te=!0;break}}if(te){const ue=Date.now();ue-M.current>=pk&&(M.current=ue,j(B=>B+1))}N.current=X},[n]);const U=p.useMemo(()=>({tasks:n,getTaskById:r,createTask:y,deleteTask:g,addComment:m,assignTask:x,assignTaskToMe:S,answerInputRequest:v,isLoading:o,hasLoadedOnce:c,error:d,isConnected:f,sectionTitle:w,setSectionTitle:k,animationByStatus:I,globalEnteringIds:H,globalExitingTasks:P,activityByTaskId:T,shippedCelebrationTrigger:C}),[n,r,y,g,m,x,S,v,o,c,d,f,w,k,I,H,P,T,C]);return a.jsx(Px.Provider,{value:U,children:s})}function fa(){const s=p.useContext(Px);if(!s)throw new Error("useTasksCtx must be used within <TasksProvider>");return s}function ct({title:s,onCancel:n,onSave:r,children:o,headerLeft:c,headerRight:d,closeMs:f=220}){const[y,g]=p.useState(!1),[m,x]=p.useState(!1);p.useEffect(()=>{requestAnimationFrame(()=>g(!0))},[]);function S(){g(!1),setTimeout(()=>n?.(),f)}async function v(){if(!(!r||m))try{x(!0),await r()&&S()}catch{}finally{x(!1)}}function T(w){if(!w.nativeEvent.isComposing){if(w.key==="Escape"){w.preventDefault(),S();return}w.key==="Enter"&&(!w.metaKey&&!w.ctrlKey||(w.preventDefault(),v()))}}return a.jsxs("div",{className:`pop-shell__overlay ${y?"pop-shell__overlay--open":""}`,children:[a.jsx("div",{className:"pop-shell__space",onClick:S}),a.jsxs("div",{className:`pop-shell__main-panel ${y?"pop-shell__main-panel--open":""}`,onKeyDown:T,children:[a.jsxs("div",{className:"pop-shell__main-title",children:[c??a.jsx("div",{onClick:S,children:a.jsx(_,{size:"4",weight:"normal",className:"pop-shell__main-title-button",children:"cancel"})}),a.jsx(_,{size:"4",weight:"medium",children:s}),d??a.jsx("div",{onClick:v,style:{opacity:m?.6:1,pointerEvents:m?"none":"auto"},children:a.jsx(_,{size:"4",weight:"normal",className:"pop-shell__main-title-button",children:m?"saving":"save"})})]}),a.jsx("div",{className:"pop-shell__main-content",children:o})]})]})}function wy(s,n){try{const r=localStorage.getItem(s);if(r)return JSON.parse(r)}catch(r){console.error("Error loading draft from localStorage:",r)}return n}function Wr({key:s,defaultValue:n,debounceMs:r=500}){const o=p.useRef(n);p.useEffect(()=>{o.current=n},[n]);const[c,d]=p.useState(()=>wy(s,n)),f=p.useRef(void 0);return p.useEffect(()=>{d(wy(s,o.current))},[s]),p.useEffect(()=>(f.current&&clearTimeout(f.current),f.current=setTimeout(()=>{try{localStorage.setItem(s,JSON.stringify(c))}catch(g){console.error("Error saving draft to localStorage:",g)}},r),()=>{f.current&&clearTimeout(f.current)}),[c,s,r]),[c,d,()=>{try{localStorage.removeItem(s),d(o.current)}catch(g){console.error("Error clearing draft from localStorage:",g)}}]}const mk={title:"",description:""},ky=s=>{s&&(s.style.height="auto",s.style.height=`${s.scrollHeight}px`)};function Yd({onCancel:s,onSave:n}){const[r,o,c]=Wr({key:"new-task-draft",defaultValue:mk}),{title:d,description:f}=r,y=p.useRef(null),g=p.useRef(null),m=(v,T)=>{o({...r,[v]:T})};p.useEffect(()=>{y.current?.focus()},[]),p.useEffect(()=>{ky(g.current)},[f]);function x(v){m("description",v.target.value),ky(v.target)}async function S(){const v=await n({title:d,description:f});return v&&c(),v}return a.jsx(ct,{title:"Create a Task",onCancel:s,onSave:S,children:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"new-task-pop__input-title",children:a.jsx("input",{className:"new-task-pop__input-title",ref:y,placeholder:"Title",value:d,onChange:v=>m("title",v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),g.current?.focus())}})}),a.jsx("div",{className:"new-task-pop__input-description",children:a.jsx("textarea",{className:"new-task-pop__input-description",ref:g,placeholder:"Enter a description (optional)",value:f,onChange:x})})]})})}const Nt=s=>{const n=new Date(s),o=Math.round((new Date().getTime()-n.getTime())/(1e3*60));if(o<60)return`${Math.max(o,1)}m ago`;const c=Math.round(o/60);return c<24?`${c}h ago`:n.toLocaleDateString("en-US",{month:"short",day:"numeric"})};function Pr({task:s,animation:n,onClick:r,pulseKey:o,additionalTags:c}){const[d,f]=p.useState(!1),y=s.assigneeActor??s.createdByActor;p.useEffect(()=>{if(o==null)return;f(!0);const x=setTimeout(()=>f(!1),1e3);return()=>clearTimeout(x)},[o]);const g=s.tags.map(x=>({label:x.name}));s.comments.length&&g.push({label:`💬 ${s.comments.length}`}),s.artefacts.length&&g.push({label:`🔗 ${s.artefacts.length}`});const m=s.inputRequests.filter(x=>!x.resolvedAt).length;return m&&g.push({label:`✋ ${m}`}),c&&g.push(...c),a.jsxs(ge,{leading:a.jsx(Ue,{name:y.displayName,size:"lg",src:y.avatarUrl||void 0}),topRight:Nt(s.updatedAt),tags:g,animation:n,highlight:s.inputRequests.filter(x=>!x.resolvedAt)?.length>0,onClick:r,children:[a.jsxs(_,{className:"pre",children:["#",s.id.slice(0,6)]}),a.jsx("div",{style:{minWidth:0,overflow:"hidden"},children:a.jsx(_,{weight:"bold",size:"3",tone:"default",children:a.jsxs("span",{className:"task-row__title",children:[a.jsx("span",{className:"task-row__titleText",children:s.name}),d?a.jsx("span",{className:"task-row__pulseDot","aria-hidden":!0}):null]})})}),a.jsx("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.description}),a.jsxs("div",{style:{fontSize:12},className:"text--tone-muted",children:[s.assignee?`Assigned: @${s.assignee}`:"unassigned"," · ",`Created by @${s.createdByActor.slug}`]})]})}function Vx(s){const n=new Map,r=new Date;r.setHours(0,0,0,0);for(const o of s){const c=new Date(o.updatedAt);c.setHours(0,0,0,0);const d=c.toISOString().split("T")[0],f=c.getTime()===r.getTime();n.has(d)||n.set(d,{date:c,dateKey:d,tasks:[],isToday:f}),n.get(d).tasks.push(o)}return Array.from(n.values()).sort((o,c)=>c.date.getTime()-o.date.getTime())}function Yx(s){const n=new Date;n.setHours(0,0,0,0);const r=new Date(n);r.setDate(r.getDate()-1);const o=new Date(s);if(o.setHours(0,0,0,0),o.getTime()===n.getTime())return"Today";if(o.getTime()===r.getTime())return"Yesterday";const c=n.getFullYear(),d=o.getFullYear(),y=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][o.getMonth()],g=o.getDate();return d===c?`${y} ${g}`:`${y} ${g}, ${d}`}function yk({date:s,taskCount:n,isExpanded:r,onClick:o}){const c=Yx(s),d=r?"▼":"▶";return a.jsx(ge,{onClick:o,className:"day-summary-row",children:a.jsxs("div",{className:"day-summary-row__content",children:[a.jsx("span",{className:"day-summary-row__chevron",children:d}),a.jsx(_,{weight:"bold",size:"3",children:c}),a.jsxs(_,{size:"2",tone:"muted",className:"day-summary-row__count",children:["· ",n," ",n===1?"task":"tasks"," shipped"]})]})})}function xk({tasks:s,enteringIds:n,exitingTasks:r,groupByDay:o=!1}){const c=Re(),{activityByTaskId:d}=fa(),[f,y]=p.useState(new Set),g=new Set(r.map(v=>v.id)),m=[...s,...r].sort((v,T)=>new Date(T.updatedAt).getTime()-new Date(v.updatedAt).getTime());if(!o)return a.jsx(fe,{children:m.map(v=>{const T=g.has(v.id),w=n.has(v.id);let k;T?k="exiting":w&&(k="entering");const C=d[v.id];return a.jsx(Pr,{task:v,animation:k,pulseKey:C?.ts,onClick:()=>c(`/tasks/task/${v.id}`)},T?`exiting-${v.id}`:v.id)})});const x=Vx(m),S=v=>{y(T=>{const w=new Set(T);return w.has(v)?w.delete(v):w.add(v),w})};return a.jsx(fe,{children:x.map(v=>{if(v.isToday)return v.tasks.map(w=>{const k=g.has(w.id),C=n.has(w.id);let j;k?j="exiting":C&&(j="entering");const R=d[w.id];return a.jsx(Pr,{task:w,animation:j,pulseKey:R?.ts,onClick:()=>c(`/tasks/task/${w.id}`)},k?`exiting-${w.id}`:w.id)});const T=f.has(v.dateKey);return a.jsxs("div",{children:[a.jsx(yk,{date:v.date,taskCount:v.tasks.length,isExpanded:T,onClick:()=>S(v.dateKey)}),T&&v.tasks.map(w=>{const k=g.has(w.id),C=n.has(w.id);let j;k?j="exiting":C&&(j="entering");const R=d[w.id];return a.jsx(Pr,{task:w,animation:j,pulseKey:R?.ts,onClick:()=>c(`/tasks/task/${w.id}`)},k?`exiting-${w.id}`:w.id)})]},v.dateKey)})})}function Do({task:s,animation:n,onClick:r,pulseKey:o}){const c=s.assigneeActor??s.createdByActor,d=s.tags.map(y=>({label:y.name}));s.comments.length&&d.push({label:`💬 ${s.comments.length}`});const f=s.inputRequests.filter(y=>!y.resolvedAt).length;return f&&d.push({label:`✋ ${f}`}),s.artefacts.length&&d.push({label:`🔗 ${s.artefacts.length}`}),a.jsxs(jx,{leading:a.jsx(Ue,{name:c.displayName,size:"md",src:c.avatarUrl||void 0}),topRight:Nt(s.updatedAt),tags:d,animation:n,onClick:r,pulseKey:o,highlight:s.inputRequests.filter(y=>!y.resolvedAt)?.length>0,footer:a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"row-detail truncate",children:["#",s.id.slice(0,6)]}),a.jsx("span",{className:"row-detail truncate",children:s.assigneeActor?`Assigned: @${s.assigneeActor.slug}`:"unassigned"})]}),children:[a.jsx("div",{className:"row-title truncate",children:s.name}),a.jsx("div",{className:"row-subtitle truncate",children:s.description})]})}function vk({date:s,taskCount:n,isExpanded:r,onClick:o}){const c=Yx(s),d=r?"▼":"▶";return a.jsxs("div",{className:"day-summary-card__content",onClick:o,children:[a.jsx("span",{className:"day-summary-card__chevron",children:d}),a.jsxs("span",{className:"day-summary-card__text",children:[a.jsx("strong",{children:c})," · ",n," ",n===1?"task":"tasks"]})]})}function bk({tasks:s,enteringIds:n,exitingTasks:r,groupByDay:o=!1}){const c=Re(),{activityByTaskId:d}=fa(),[f,y]=p.useState(new Set),g=new Set(r.map(T=>T.id)),m=[...s,...r].sort((T,w)=>new Date(w.updatedAt).getTime()-new Date(T.updatedAt).getTime());if(!o)return a.jsx(a.Fragment,{children:m.map(T=>{const w=g.has(T.id),k=n.has(T.id),C=d[T.id];let j;return w?j="exiting":k&&(j="entering"),a.jsx(Do,{task:T,animation:j,onClick:()=>c(`/tasks/task/${T.id}`),pulseKey:C?.ts},w?`exiting-${T.id}`:T.id)})});const x=[],S=Vx(m),v=T=>{y(w=>{const k=new Set(w);return k.has(T)?k.delete(T):k.add(T),k})};return S.forEach(T=>{if(T.isToday){T.tasks.forEach(k=>{const C=g.has(k.id),j=n.has(k.id),R=d[k.id];let L;C?L="exiting":j&&(L="entering");const N=a.jsx(Do,{task:k,animation:L,onClick:()=>c(`/tasks/task/${k.id}`),pulseKey:R?.ts},C?`exiting-${k.id}`:k.id);x.push(N)});return}const w=f.has(T.dateKey);x.push(a.jsx(vk,{date:T.date,taskCount:T.tasks.length,isExpanded:w,onClick:()=>v(T.dateKey)},`date-group-${T.date}`)),w&&T.tasks.forEach(k=>{const C=g.has(k.id),j=n.has(k.id),R=d[k.id];let L;C?L="exiting":j&&(L="entering");const N=a.jsx(Do,{task:k,animation:L,onClick:()=>c(`/tasks/task/${k.id}`),pulseKey:R?.ts},C?`exiting-${k.id}`:k.id);x.push(N)})}),a.jsx(a.Fragment,{children:x})}function _o({status:s}){const n=jt(),r=n?void 0:s,{tasks:o,createTask:c,setSectionTitle:d,animationByStatus:f,globalEnteringIds:y,globalExitingTasks:g,activityByTaskId:m}=fa(),{showError:x}=hn(),{registerCommands:S,registerTaskSearch:v}=Jr(),T=Re();wt(),p.useEffect(()=>{if(!r){d("All Tasks");return}d(Vn[r].label)},[r,d]),p.useEffect(()=>S([{id:"new-task",label:"New Task",description:"Create a new task",aliases:["create","add task"],onSelect:()=>M(!0)}]),[S]),p.useEffect(()=>v(I=>Dt.TasksController_searchTasks({query:I,limit:5,threshold:.1})),[v]);const w=p.useMemo(()=>r?o.filter(I=>I.status===r):o,[o,r]),k=p.useMemo(()=>r?{enteringIds:f[r].enteringIds,exitingTasks:f[r].exitingTasks}:{enteringIds:y,exitingTasks:g},[r,f,y,g]),[C,j]=ih(),[R,L]=p.useState(null),[N,M]=p.useState(!1);p.useEffect(()=>{C.get("new")==="1"&&(M(!0),j({},{replace:!0}))},[C,j]);const A=()=>{console.log("cancel"),M(!1)},z=async({title:I,description:H})=>{console.log(`save title: ${I} - description: ${H}`),L({name:I,description:H});try{const P=await c({name:I,description:H});return P?(L(P),T(`/tasks/task/${P.id}`),!0):!1}catch(P){return console.error("Error saving task"),console.error(P),x(P),!1}};return a.jsx("div",{className:`${n?"full-height":""}`,children:n?a.jsxs("div",{className:"tasks-page",children:[a.jsx(_k,{tasks:o,animationByStatus:f}),a.jsxs("button",{className:"tasks-fab tasks-fab--desktop",type:"button",onClick:()=>M(!0),children:[a.jsx("span",{className:"tasks-fab__plus",children:"+"}),a.jsx("span",{className:"tasks-fab__label",children:"New task"})]}),N?a.jsx(Yd,{onCancel:A,onSave:z}):null]}):a.jsxs(a.Fragment,{children:[a.jsx(xk,{tasks:w,enteringIds:k.enteringIds,exitingTasks:k.exitingTasks,groupByDay:r===ve.DONE}),a.jsx("button",{className:"tasks-fab",type:"button",onClick:()=>M(!0),"aria-label":"Create new task",children:"+"}),N?a.jsx(Yd,{onCancel:A,onSave:z}):null]})})}function So({tasks:s,status:n,animationState:r}){const o=p.useMemo(()=>s.filter(d=>d.status===n),[s,n]),c=Vn[n].label;return a.jsxs("div",{className:"tasks-board-column",children:[a.jsxs("div",{className:"tasks-board-column__header",children:[a.jsx(_,{size:"3",weight:"bold",children:c}),a.jsx(_,{size:"1",tone:"muted",children:o.length})]}),a.jsx("div",{className:"tasks-board-column__body",children:a.jsx(bk,{tasks:o,enteringIds:r.enteringIds,exitingTasks:r.exitingTasks,groupByDay:n===ve.DONE})})]})}function _k({tasks:s,animationByStatus:n}){return a.jsxs("div",{className:"tasks-board-view",children:[a.jsx(So,{status:ve.NOT_STARTED,tasks:s,animationState:n[ve.NOT_STARTED]}),a.jsx(So,{status:ve.IN_PROGRESS,tasks:s,animationState:n[ve.IN_PROGRESS]}),a.jsx(So,{status:ve.FOR_REVIEW,tasks:s,animationState:n[ve.FOR_REVIEW]}),a.jsx(So,{status:ve.DONE,tasks:s,animationState:n[ve.DONE]})]})}const Sk=2200;function Tk({trigger:s,durationMs:n=Sk}){const[r,o]=p.useState(!1);return p.useEffect(()=>{if(s<=0)return;o(!0);const c=window.setTimeout(()=>o(!1),n);return()=>window.clearTimeout(c)},[s,n]),r?a.jsxs("div",{className:"shipped-celebration",style:{"--celebration-duration":`${n}ms`},"aria-hidden":"true",children:[a.jsx("div",{className:"shipped-celebration__veil"}),a.jsx("div",{className:"shipped-celebration__rocket",role:"presentation",children:"🚀"}),a.jsx("div",{className:"shipped-celebration__spark shipped-celebration__spark--one"}),a.jsx("div",{className:"shipped-celebration__spark shipped-celebration__spark--two"}),a.jsx("div",{className:"shipped-celebration__spark shipped-celebration__spark--three"})]}):null}const jk=window.location.origin,Fx=new Fn({baseUrl:jk,credentials:"include"}),qr=Fx.taskBlueprints,Cl=Fx.scheduledTasks;function wk(){const s=jt(),{sectionTitle:n,shippedCelebrationTrigger:r}=fa(),o=Re(),[c,d]=p.useState(null);return p.useEffect(()=>{let f=!0;return(async()=>{try{const g=await Cl.ScheduledTasksController_listScheduledTasks({page:1,limit:50});if(!f)return;const m=g.items.filter(x=>x.enabled).length;d(m)}catch{f&&d(null)}})(),()=>{f=!1}},[]),a.jsxs("div",{style:{minHeight:0},children:[a.jsx(Tk,{trigger:r}),s?a.jsx(Ua,{sectionTitle:n,headerActions:a.jsxs(oe,{size:"sm",variant:"ghost",className:"tasks-layout__schedule-button",onClick:()=>o("/tasks/schedule"),children:[a.jsx("span",{className:"tasks-layout__schedule-icon",children:"🗓"}),"Schedule",c&&c>0?a.jsx("span",{className:"tasks-layout__schedule-badge",children:c}):null]}),children:a.jsx(Ot,{})}):a.jsx($a,{appTitle:"Tasks",sectionTitle:n,navItems:dk,children:a.jsx(Ot,{})})]})}const kk={content:""},Ey=s=>{s&&(s.style.height="auto",s.style.height=`${s.scrollHeight}px`)};function Ek({onCancel:s,onSave:n,taskId:r}){const[o,c,d]=Wr({key:`new-comment-draft-${r}`,defaultValue:kk}),{content:f}=o,y=p.useRef(null);p.useEffect(()=>{y.current?.focus()},[]),p.useEffect(()=>{Ey(y.current)},[f]);function g(x){c({...o,content:x.target.value}),Ey(x.target)}async function m(){const x=await n({content:f});return x&&d(),x}return a.jsx(ct,{title:"Add Comment",onCancel:s,onSave:m,children:a.jsx(a.Fragment,{children:a.jsx("div",{className:"new-comment-pop__input-content",children:a.jsx("textarea",{className:"new-comment-pop__input-content",ref:y,placeholder:"Leave a comment...",value:f,onChange:g})})})})}const Ck={answer:""},bd=s=>{s&&(s.style.height="auto",s.style.height=`${s.scrollHeight}px`)};function Nk({onCancel:s,onSave:n,taskId:r,inputRequestId:o,question:c}){const[d,f,y]=Wr({key:`answer-input-request-draft-${o}`,defaultValue:Ck}),{answer:g}=d,m=p.useRef(null),x=p.useRef(null);p.useEffect(()=>{x.current?.focus()},[]),p.useEffect(()=>{bd(m.current)},[c]),p.useEffect(()=>{bd(x.current)},[g]);function S(T){f({...d,answer:T.target.value}),bd(T.target)}async function v(){const T=await n({answer:g});return T&&y(),T}return a.jsx(ct,{title:"Answer Input Request",onCancel:s,onSave:v,children:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"new-comment-pop__input-content",children:a.jsx("textarea",{className:"new-comment-pop__input-content",ref:m,value:c,readOnly:!0,style:{opacity:.7,cursor:"default"}})}),a.jsx("div",{className:"new-comment-pop__input-content",children:a.jsx("textarea",{className:"new-comment-pop__input-content",ref:x,placeholder:"Your answer...",value:g,onChange:S})})]})})}function Ak({onCancel:s,onSave:n,existingTags:r}){const[o,c]=p.useState([]),[d,f]=p.useState(!0),[y,g]=p.useState(""),[m,x]=p.useState(0),[S,v]=p.useState(!1),T=p.useRef(null),w=p.useRef(null);p.useEffect(()=>{(async()=>{try{const M=await GT.metaControllerGetAllTags();c(M)}catch(M){console.error("Failed to load tags:",M)}finally{f(!1)}})()},[]),p.useEffect(()=>{T.current?.focus()},[]);const k=p.useMemo(()=>{const N=new Set(r.map(I=>I.id)),M=o.filter(I=>!N.has(I.id));if(!y.trim())return M;const A=y.toLowerCase().trim();return M.map(I=>{let H=0;return I.name.toLowerCase().startsWith(A)?H+=100:I.name.toLowerCase().includes(A)&&(H+=50),{tag:I,score:H}}).filter(I=>I.score>0).sort((I,H)=>H.score-I.score).map(I=>I.tag)},[o,r,y]),C=p.useMemo(()=>{if(!y.trim())return!1;const N=y.toLowerCase().trim();return!o.some(M=>M.name.toLowerCase()===N)},[y,o]);p.useEffect(()=>{x(0)},[k.length,y,C]),p.useEffect(()=>{if(w.current){const N=k.length+(C?1:0);if(m<N){const M=w.current.children[m];M&&M.scrollIntoView({block:"nearest"})}}},[m,k.length,C]);const j=p.useCallback(async N=>{if(S)return!1;v(!0);try{const M=await n(N);return M&&s?.(),M}finally{v(!1)}},[S,s,n]),R=p.useCallback(N=>{if(N.nativeEvent.isComposing)return;const M=k.length+(C?1:0);switch(N.key){case"ArrowDown":if(M===0)return;N.preventDefault(),x(A=>A<M-1?A+1:A);break;case"ArrowUp":if(M===0)return;N.preventDefault(),x(A=>A>0?A-1:0);break;case"Enter":N.preventDefault(),m<k.length?j(k[m]):C&&m===k.length&&j(_d(y));break;case"Escape":N.preventDefault(),s?.();break}},[C,k,m,s,y,j]);async function L(){if(k.length+(C?1:0)===0)return!1;if(m<k.length){const M=k[m];return M?j(M):!1}return C&&m===k.length?j(_d(y)):!1}return a.jsx(ct,{title:"Add Tag",onCancel:s,onSave:L,children:a.jsxs("div",{className:"tag-search-pop",children:[a.jsx("input",{ref:T,type:"text",className:"tag-search-pop__input",placeholder:"Search or create tag...",value:y,onChange:N=>g(N.target.value),onKeyDown:R}),a.jsx("div",{className:"tag-search-pop__list",ref:w,role:"listbox","aria-label":"Available tags",children:d?a.jsx("div",{className:"tag-search-pop__empty",children:a.jsx(_,{tone:"muted",children:"Loading tags..."})}):k.length===0&&!C?a.jsx("div",{className:"tag-search-pop__empty",children:a.jsx(_,{tone:"muted",children:"No tags found"})}):a.jsxs(a.Fragment,{children:[k.map((N,M)=>a.jsx("button",{type:"button",role:"option","aria-selected":M===m,className:`tag-search-pop__item ${M===m?"tag-search-pop__item--highlighted":""}`,onClick:()=>void j(N),onMouseEnter:()=>x(M),disabled:S,children:a.jsx("div",{className:"tag-search-pop__tag-badge",style:{backgroundColor:N.color||"#999"},children:N.name})},N.id)),C&&a.jsxs("button",{type:"button",role:"option","aria-selected":m===k.length,className:`tag-search-pop__item tag-search-pop__item--create ${m===k.length?"tag-search-pop__item--highlighted":""}`,onClick:()=>void j(_d(y)),onMouseEnter:()=>x(k.length),disabled:S,children:[a.jsx(_,{size:"2",tone:"muted",children:"Create new tag:"}),a.jsx("div",{className:"tag-search-pop__tag-badge",style:{backgroundColor:"#999"},children:y.trim()})]})]})})]})})}function _d(s){return{id:"",name:s.trim(),color:void 0,createdAt:"",updatedAt:""}}function Rk({onCancel:s,onSave:n,excludeTaskIds:r}){const[o,c]=p.useState(""),[d,f]=p.useState(0),[y,g]=p.useState([]),[m,x]=p.useState(!1),[S,v]=p.useState(null),[T,w]=p.useState(!1),k=p.useRef(null),C=p.useRef(null),j=p.useRef(0);p.useEffect(()=>{k.current?.focus()},[]),p.useEffect(()=>{const z=o.trim();if(!z){j.current=j.current+1,g([]),v(null),x(!1);return}const I=j.current+1;j.current=I,x(!0),v(null);const H=window.setTimeout(async()=>{try{const P=await Dt.TasksController_searchTasks({query:z,limit:20});if(j.current!==I)return;g(P??[])}catch(P){if(j.current!==I)return;v(P instanceof Error?P.message:"Failed to search tasks"),g([])}finally{j.current===I&&x(!1)}},200);return()=>{window.clearTimeout(H)}},[o]);const R=p.useMemo(()=>{const z=new Set(r);return y.filter(I=>!z.has(I.id))},[y,r]);p.useEffect(()=>{f(0)},[R.length,o]),p.useEffect(()=>{if(C.current){const z=C.current.children[d];z&&z.scrollIntoView({block:"nearest"})}},[d]);const L=p.useCallback(async z=>{if(T)return!1;w(!0);try{const I=await Dt.TasksController_getTask({id:z.id}),H=await n(I);return H&&s?.(),H}catch(I){return console.error("Failed to fetch task details:",I),!1}finally{w(!1)}},[T,s,n]),N=p.useCallback(()=>{if(R.length===0)return;const z=R[d];z&&L(z)},[R,d,L]),M=p.useCallback(z=>{if(!z.nativeEvent.isComposing)switch(z.key){case"ArrowDown":if(R.length===0)return;z.preventDefault(),f(I=>I<R.length-1?I+1:I);break;case"ArrowUp":if(R.length===0)return;z.preventDefault(),f(I=>I>0?I-1:0);break;case"Enter":z.preventDefault(),N();break;case"Escape":z.preventDefault(),s?.();break}},[R,N,s]);async function A(){if(R.length===0)return!1;const z=R[d];return z?L(z):!1}return a.jsx(ct,{title:"Add Dependency",onCancel:s,onSave:A,children:a.jsxs("div",{className:"task-search-pop",children:[a.jsx("input",{ref:k,type:"text",className:"task-search-pop__input",placeholder:"Search tasks...",value:o,onChange:z=>c(z.target.value),onKeyDown:M}),a.jsx("div",{className:"task-search-pop__list",ref:C,role:"listbox","aria-label":"Tasks",children:R.length===0?a.jsx("div",{className:"task-search-pop__empty",children:a.jsx(_,{tone:"muted",children:o.trim()?m?"Searching tasks...":S||"No tasks found":"Type to search for tasks"})}):R.map((z,I)=>a.jsx("button",{type:"button",role:"option","aria-selected":I===d,className:`task-search-pop__item ${I===d?"task-search-pop__item--highlighted":""}`,onClick:()=>void L(z),onMouseEnter:()=>f(I),disabled:T,children:a.jsxs("div",{className:"task-search-pop__item-info",children:[a.jsx(_,{weight:"medium",size:"2",children:z.name}),a.jsxs(_,{tone:"muted",size:"1",style:"mono",children:["#",z.id.slice(0,6)]})]})},z.id))})]})})}Ge.BASE=Ba;const Qx=p.createContext(null);function zk({children:s}){const[n,r]=p.useState([]),[o,c]=p.useState(!1),[d,f]=p.useState(null),y=p.useCallback(async()=>{c(!0),f(null);try{const x=await _x.actorControllerListActors();r(x||[])}catch(x){f(x instanceof Error?x.message:"Failed to load actors")}finally{c(!1)}},[]);p.useEffect(()=>{y()},[y]);const g=p.useCallback(async()=>{await y()},[y]),m=p.useMemo(()=>({actors:n,isLoading:o,error:d,refreshActors:g}),[n,o,d,g]);return a.jsx(Qx.Provider,{value:m,children:s})}function mh(){const s=p.useContext(Qx);if(!s)throw new Error("useActorsCtx must be used within <ActorsProvider>");return s}function Dk({onCancel:s,onSave:n}){const{actors:r,isLoading:o,error:c,refreshActors:d}=mh(),[f,y]=p.useState(""),[g,m]=p.useState(0),[x,S]=p.useState(null),[v,T]=p.useState(!1),[w,k]=p.useState(null),[C,j]=p.useState(!1),R=p.useRef(null),L=p.useRef(null),N=p.useRef(0);p.useEffect(()=>{R.current?.focus()},[]),p.useEffect(()=>{d().catch(()=>{})},[d]),p.useEffect(()=>{const P=f.trim();if(!P){S(null),k(null),T(!1);return}const U=N.current+1;N.current=U,T(!0),k(null);const J=window.setTimeout(async()=>{try{const X=await _x.actorControllerSearchActors(P,20);if(N.current!==U)return;S(X??[])}catch(X){if(N.current!==U)return;k(X instanceof Error?X.message:"Failed to search actors"),S([])}finally{N.current===U&&T(!1)}},200);return()=>{window.clearTimeout(J)}},[f]);const M=p.useMemo(()=>f.trim()?x??[]:r,[r,f,x]);p.useEffect(()=>{m(0)},[M.length,f]),p.useEffect(()=>{if(L.current){const P=L.current.children[g];P&&P.scrollIntoView({block:"nearest"})}},[g]);const A=p.useCallback(async P=>{if(C)return!1;j(!0);try{const U=await n(P);return U&&s?.(),U}finally{j(!1)}},[C,s,n]),z=p.useCallback(()=>{if(M.length===0)return;const P=M[g];P&&A(P)},[M,g,A]),I=p.useCallback(P=>{if(!P.nativeEvent.isComposing)switch(P.key){case"ArrowDown":if(M.length===0)return;P.preventDefault(),m(U=>U<M.length-1?U+1:U);break;case"ArrowUp":if(M.length===0)return;P.preventDefault(),m(U=>U>0?U-1:0);break;case"Enter":P.preventDefault(),z();break}},[M,z]);async function H(){if(M.length===0)return!1;const P=M[g];return P?A(P):!1}return a.jsx(ct,{title:"Assign Task",onCancel:s,onSave:H,children:a.jsxs("div",{className:"actor-search-pop",children:[a.jsx("input",{ref:R,type:"text",className:"actor-search-pop__input",placeholder:"Search by name or @slug...",value:f,onChange:P=>y(P.target.value),onKeyDown:I}),a.jsx("div",{className:"actor-search-pop__list",ref:L,role:"listbox","aria-label":"Assignees",children:M.length===0?a.jsx("div",{className:"actor-search-pop__empty",children:a.jsx(_,{tone:"muted",children:f.trim()?v?"Searching actors...":w||"No actors found":o?"Loading actors...":c||"No actors found"})}):M.map((P,U)=>a.jsxs("button",{type:"button",role:"option","aria-selected":U===g,className:`actor-search-pop__item ${U===g?"actor-search-pop__item--highlighted":""}`,onClick:()=>void A(P),onMouseEnter:()=>m(U),disabled:C,children:[a.jsx(Ue,{name:P.displayName,size:"sm",src:P.avatarUrl||void 0}),a.jsxs("div",{className:"actor-search-pop__item-info",children:[a.jsx(_,{weight:"medium",size:"2",children:P.displayName}),a.jsxs(_,{tone:"muted",size:"1",children:["@",P.slug," · ",P.type]})]})]},P.id))})]})})}const Ok=window.location.origin,Lk=new Fn({baseUrl:Ok,credentials:"include"}),Yn=Lk.threads,qk=window.location.origin,Mk=new Fn({baseUrl:qk,credentials:"include"}),La=Mk.executions,Bk=s=>s.some(o=>o.isActive&&o.isConfigured)?{isReady:!0,title:"Thread chat is ready",description:"Your conversation tools are online.",ctaLabel:"Open chat settings"}:s.length===0?{isReady:!1,title:"Thread chat is waiting at the gate",description:"Connect your first chat provider in settings to unlock new threads and live conversation.",ctaLabel:"Set up chat"}:s.some(o=>o.isConfigured)?{isReady:!1,title:"Your next level is one switch away",description:"A provider is configured, but none is active yet. Pick one in chat settings to open the thread portal.",ctaLabel:"Choose active provider"}:{isReady:!1,title:"Thread chat needs one more step",description:"A provider exists, but it still needs credentials before threads can talk back.",ctaLabel:"Finish chat setup"};function yh(){const[s,n]=p.useState(null),[r,o]=p.useState(!0),c=p.useCallback(async()=>{o(!0);try{const d=await $r.chatProvidersControllerListChatProviders();n(Bk(d))}catch{n(null)}finally{o(!1)}},[]);return p.useEffect(()=>{c()},[c]),{readiness:s,isLoading:r,isReady:s?.isReady??!0,refresh:c}}function xh({title:s,description:n,ctaLabel:r,onOpenSettings:o,className:c}){return a.jsxs("div",{className:`chat-setup-callout ${c??""}`.trim(),children:[a.jsx("div",{className:"chat-setup-callout__badge",children:"Thread Chat"}),a.jsxs(W,{spacing:"3",children:[a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"4",weight:"semibold",children:s}),a.jsx(_,{tone:"muted",children:n}),a.jsx(_,{size:"1",tone:"muted",children:"Visit `/settings/chat` to wire it up."})]}),a.jsx("div",{className:"chat-setup-callout__actions",children:a.jsx(oe,{variant:"primary",onClick:o,children:r})})]})]})}const Sd=3,Td=3;function Kx({task:s,backPath:n,setSectionTitle:r,isLoadingTask:o=!1,activityByTaskId:c={},handlers:d,allTasks:f}){const y=Re(),{actors:g}=mh(),{user:m}=Dn(),{showError:x,showToast:S}=hn(),{registerCommands:v}=Jr(),{readiness:T,isReady:w,isLoading:k}=yh(),[C,j]=p.useState(null),[R,L]=p.useState("idle"),[N,M]=p.useState(!1),[A,z]=p.useState(!1),I=p.useRef(null),H=p.useRef(null),P=3500,U=220;wt({task:{name:s?.name}});const J=p.useCallback(async se=>{if(s)try{await d.changeStatus({taskId:s.id,status:se})}catch(pe){x(pe)}},[s,d,x]),[X,te]=p.useState(null),[ue,B]=p.useState(!1),re=p.useCallback(async()=>{if(s){if(!w){S("Thread chat unlocks in Chat Settings.","info"),y("/settings/chat");return}B(!0);try{if(X){y(`/threads/${X}`);return}const se=await Yn.ThreadsController_createThread({body:{title:s.name,parentTaskId:s.id}});te(se.id),y(`/threads/${se.id}`)}catch(se){x(se)}finally{B(!1)}}},[s,X,w,y,x,S]);p.useEffect(()=>{if(!s){te(null);return}let se=!1;return B(!0),Yn.ThreadsController_getThreadByTaskId({taskId:s.id}).then(pe=>{se||te(pe?.id??null)}).catch(pe=>{se||(x(pe),te(null))}).finally(()=>{se||B(!1)}),()=>{se=!0}},[s,x]);const he=p.useMemo(()=>!s||!s.dependsOnIds||s.dependsOnIds.length===0?[]:s.dependsOnIds.map(se=>f.find(pe=>pe.id===se)).filter(se=>se!==void 0),[s,f]);p.useEffect(()=>{if(!s)return;const se={[ve.NOT_STARTED]:["not started","to do","todo","queued"],[ve.IN_PROGRESS]:["in progress","doing","building"],[ve.FOR_REVIEW]:["for review","review","in review"],[ve.DONE]:["done","shipped","release","complete"]},pe=Object.entries(Vn).map(([nt,ut])=>({id:`task-status-${nt}`,label:ut.label,description:`Mark task as ${ut.label.toLowerCase()}`,aliases:se[nt],onSelect:()=>J(nt)})),Ke=[{id:"task-add-comment",label:"Comment",description:"Add a comment to this task",aliases:["add comment","note"],onSelect:()=>yt(!0)},{id:"task-assign",label:"Assign",description:"Assign this task to someone",aliases:["reassign","assignee"],onSelect:()=>Ee(!0)},{id:"task-assign-to-me",label:"Assign to Me",description:"Assign this task to yourself",aliases:["claim","take"],onSelect:()=>{d.assignTaskToMe({taskId:s.id}).catch(x)}},{id:"task-add-tag",label:"Tag",description:"Add a tag to this task",aliases:["add tag","label"],onSelect:()=>kt(!0)},{id:"task-thread-action",label:X?"Go to thread":"Create thread",description:X?"Open this task thread":"Create a thread from this task",aliases:["thread","open thread","create thread","chat"],onSelect:()=>{re()}}];return v([...pe,...Ke])},[s,v,J,d,x,X,re]),p.useEffect(()=>{if(o){r("Loading task...");return}if(!s){r("Task");return}r(s.name)},[s,o,r]),p.useEffect(()=>()=>{I.current&&window.clearTimeout(I.current),H.current&&window.clearTimeout(H.current)},[]);const[ke,Te]=p.useState(null),[D,K]=p.useState(!1),[ce,de]=p.useState([]),[G,ne]=p.useState(!1),[le,_e]=p.useState(null),[ze,mt]=p.useState(new Set),[fn,pn]=p.useState(new Set),[Kn,yt]=p.useState(!1),[je,Ee]=p.useState(!1),[ft,kt]=p.useState(!1),[On,en]=p.useState(!1),[qt,os]=p.useState(null),gn=p.useCallback(se=>{mt(pe=>{const Ke=new Set(pe);return Ke.has(se)?Ke.delete(se):Ke.add(se),Ke})},[]),xt=p.useCallback(async(se,pe,Ke)=>{if(confirm(`Are you sure you want to interrupt the active execution for "${pe??"this task"}"?`)){pn(nt=>new Set(nt).add(se));try{await La.ActiveTaskExecutionController_interruptExecution({executionId:se}),S(`Interrupt signal sent for "${pe??"this task"}"`)}catch(nt){x(nt)}finally{pn(nt=>{const ut=new Set(nt);return ut.delete(se),ut})}}},[S,x]);p.useEffect(()=>{const se=pe=>{if(!s||pe.defaultPrevented||pe.metaKey||pe.ctrlKey||pe.altKey||Kn||je||ft||On||qt||Gk(pe.target))return;const Ke=pe.key.toLowerCase();Ke==="a"?(pe.preventDefault(),Ee(!0)):Ke==="c"?(pe.preventDefault(),yt(!0)):Ke==="t"&&(pe.preventDefault(),kt(!0))};return window.addEventListener("keydown",se),()=>window.removeEventListener("keydown",se)},[s,Kn,je,ft,On,qt]);const cs=async({content:se})=>{if(!s)return!1;try{return await d.addComment({taskId:s.id,comment:se}),!0}catch(pe){return x(pe),!1}},us=()=>{yt(!1)},pa=async se=>{if(!s)return!1;try{return await d.assignTask({taskId:s.id,assigneeActorId:se.id}),!0}catch(pe){return x(pe),!1}},qs=()=>{Ee(!1)},Ul=async({answer:se})=>{if(!s||!qt)return!1;try{return await d.answerInputRequest({taskId:s.id,inputRequestId:qt.id,answer:se}),!0}catch(pe){return x(pe),!1}},Ga=()=>{os(null)},$l=async se=>{if(!s)return!1;try{return await d.addTag({taskId:s.id,tag:se}),!0}catch(pe){return x(pe),!1}},Hl=()=>{kt(!1)},ds=async se=>{if(s)try{await d.removeTag({taskId:s.id,tagId:se})}catch(pe){x(pe)}},Mt=async se=>{if(!s)return!1;try{return await d.addDependency({taskId:s.id,dependencyTaskId:se.id}),!0}catch(pe){return x(pe),!1}},mn=()=>{en(!1)},Bt=async se=>{if(s)try{await d.removeDependency({taskId:s.id,dependencyTaskId:se})}catch(pe){x(pe)}},Ln=s?c[s.id]:null;p.useEffect(()=>{M(!1),z(!1)},[s?.id]);const Ms=p.useCallback(async se=>{ne(!0);try{const[pe,Ke]=await Promise.all([La.ActiveTaskExecutionController_listActiveExecutions(),La.TaskExecutionHistoryController_listHistory()]),nt=pe.filter(Me=>Me.taskId===se).map(Me=>({id:`active-${Me.id}`,executionId:Me.id,agentActorId:Me.agentActorId,status:"ACTIVE",source:"active",timestamp:Me.claimedAt,runnerSessionId:Me.runnerSessionId,toolCallCount:Me.toolCallCount,errorCode:null,errorMessage:null})),ut=Ke.filter(Me=>Me.taskId===se).map(Me=>({id:`history-${Me.id}`,executionId:Me.id,agentActorId:Me.agentActorId,status:Me.status,source:"history",timestamp:Me.transitionedAt,runnerSessionId:Me.runnerSessionId,toolCallCount:Me.toolCallCount,errorCode:Me.errorCode,errorMessage:Me.errorMessage})),Zn=[...nt,...ut].sort((Me,ie)=>new Date(ie.timestamp).getTime()-new Date(Me.timestamp).getTime());de(Zn),_e(null)}catch(pe){const Ke=pe instanceof Error?pe.message:"Failed to load runs for this task";_e(Ke)}finally{ne(!1)}},[]),hs=p.useMemo(()=>s?[...s.comments.map(se=>({type:"comment",data:se,timestamp:new Date(se.createdAt).getTime()})),...s.inputRequests.map(se=>({type:"inputRequest",data:se,timestamp:new Date(se.createdAt).getTime()}))].sort((se,pe)=>se.timestamp-pe.timestamp):[],[s]),Bs=N?hs:hs.slice(0,Sd),fs=hs.length>Sd,Xn=A?ce:ce.slice(0,Td),qn=ce.length>Td;if(p.useEffect(()=>{if(!s){de([]),_e(null),mt(new Set);return}mt(new Set),Ms(s.id)},[s,Ms]),p.useEffect(()=>{!s||!Ln||Ln.kind.startsWith("execution.")&&Ms(s.id)},[Ln,s,Ms]),p.useEffect(()=>{!s||!Ln||!Ln.message||(I.current&&window.clearTimeout(I.current),H.current&&window.clearTimeout(H.current),j(Ln),L("enter"),I.current=window.setTimeout(()=>{L("exit"),H.current=window.setTimeout(()=>{j(null),L("idle")},U)},P))},[Ln,s,U,P]),!s&&o)return a.jsx(Uk,{backPath:n});if(!s)return a.jsx("div",{className:"task-detail-page",children:a.jsxs(W,{spacing:"4",align:"center",children:[a.jsx(_,{size:"3",tone:"muted",children:"Task not found"}),a.jsx(oe,{variant:"secondary",onClick:()=>y(n),children:"Back to tasks"})]})});const Is=async se=>{K(!0);try{await d.changeStatus({taskId:s.id,status:se}),Te(null)}catch(pe){x(pe)}finally{K(!1)}};return a.jsxs("div",{className:"task-detail-page",children:[ke&&a.jsxs(Rn,{children:[a.jsx("button",{onClick:()=>Te(null),className:"task-detail-page__error-close",children:"×"}),ke]}),a.jsxs(fe,{className:"task-detail-page__section",children:[a.jsxs(ge,{leading:a.jsx(Ue,{size:"sm",name:s.createdByActor.displayName,src:s.createdByActor.avatarUrl||void 0}),tags:[$k({status:s.status}),...s.tags.map(se=>({label:se.name,onRemove:()=>ds(se.id)})),{label:"+ add tag",color:"gray",onClick:()=>kt(!0),clickLabel:"Add tag"}],topRight:a.jsx(_,{size:"1",tone:"muted",children:Nt(s.updatedAt)}),children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:s.createdByActor.displayName}),a.jsx(_,{as:"span",weight:"normal",tone:"muted",size:"3",children:` @${s.createdByActor.slug} created `}),a.jsxs(_,{as:"span",tone:"muted",style:"mono",children:["#",s.id.slice(0,6)]}),s.assigneeActor?null:a.jsx(_,{tone:"muted",children:"unassigned"})]}),s.assigneeActor?a.jsxs(ge,{leading:a.jsx(Ue,{size:"sm",name:s.assigneeActor.displayName,src:s.assigneeActor.avatarUrl||void 0}),onClick:()=>Ee(!0),children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:s.assigneeActor.displayName}),a.jsx(_,{as:"span",weight:"normal",tone:"muted",size:"3",children:` @${s.assigneeActor.slug} assigned`}),a.jsx(_,{size:"1",tone:"muted",children:"tap to reassign"})]}):null]}),s.artefacts&&s.artefacts.length>0&&a.jsx(fe,{className:"task-detail-page__section",children:s.artefacts.map(se=>a.jsxs(ge,{children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:`${se.name}: `}),a.jsx(_,{as:"span",children:a.jsx("a",{href:se.link,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent)",textDecoration:"underline"},children:se.link})})]},se.id))}),(he.length>0||s)&&a.jsxs(fe,{title:"Depends on",className:"task-detail-page__section",children:[he.map(se=>a.jsx(Pr,{task:se,onClick:()=>y(`/tasks/task/${se.id}`),additionalTags:[{label:"× remove",color:"red",onClick:()=>Bt(se.id),clickLabel:"Remove dependency"}]},se.id)),a.jsx(ge,{tags:[{label:"+ add dependency",color:"gray",onClick:()=>en(!0),clickLabel:"Add dependency"}],children:a.jsx(_,{tone:"muted",size:"2",children:he.length===0?"No dependencies yet":"Add another dependency"})})]}),a.jsx(fe,{className:"task-detail-page__section",children:a.jsxs(ge,{leading:a.jsx(Ue,{size:"sm",name:s.createdByActor.displayName,src:s.createdByActor.avatarUrl||void 0}),tags:[],topRight:a.jsx(_,{size:"1",tone:"muted",children:Nt(s.createdAt)}),children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:s.createdByActor.displayName}),a.jsx(_,{as:"span",weight:"normal",tone:"muted",size:"3",children:` @${s.createdByActor.slug}`}),a.jsx(_,{children:s.description?s.description:"no description"})]})}),a.jsxs(fe,{title:"Updates",className:"task-detail-page__section",children:[hs.length===0?a.jsx(_,{className:"task-detail-page__executions-state",tone:"muted",children:"No updates yet."}):null,Bs.map(se=>{if(se.type==="comment"){const tn=se.data,Mn=tn.commenterActor?.displayName||"unknown",Et=tn.commenterActor?.slug||"unknown";return a.jsxs(ge,{leading:a.jsx(Ue,{size:"sm",name:Mn,src:tn.commenterActor?.avatarUrl||void 0}),topRight:a.jsx(_,{size:"1",tone:"muted",children:Nt(tn.createdAt)}),children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:Mn}),a.jsx(_,{as:"span",weight:"normal",tone:"muted",size:"3",children:` @${Et}`}),a.jsx(_,{children:tn.content})]},`comment-${tn.id}`)}const pe=se.data,Ke=g.find(tn=>tn.id===pe.askedByActorId),nt=g.find(tn=>tn.id===pe.assignedToActorId),ut=Ke?.displayName||"Unknown",Zn=Ke?.slug||"unknown",Me=nt?.displayName||"Unknown",ie=nt?.slug||"unknown",ye=!!pe.resolvedAt,At=m&&pe.assignedToActorId===m.actorId,ga=typeof pe.answer=="string"?pe.answer:JSON.stringify(pe.answer),si=ye?[{label:"resolved question",color:"gray"},{label:"answer",color:"green"}]:[{label:"question",color:"orange"}];return a.jsx(ge,{leading:ye?a.jsxs("div",{className:"task-detail-page__input-request-avatars",children:[a.jsx(Ue,{size:"sm",name:ut,src:Ke?.avatarUrl||void 0}),a.jsx(Ue,{size:"sm",name:Me,src:nt?.avatarUrl||void 0})]}):a.jsx(Ue,{size:"sm",name:ut,src:Ke?.avatarUrl||void 0}),tags:si,topRight:a.jsx(_,{size:"1",tone:"muted",children:Nt(pe.createdAt)}),children:a.jsxs(W,{spacing:"2",children:[a.jsxs("div",{className:"task-detail-page__input-request",children:[a.jsxs("div",{className:"task-detail-page__input-request-question",children:[a.jsxs("div",{className:"task-detail-page__input-request-header",children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:ut}),a.jsx(_,{as:"span",weight:"normal",tone:"muted",size:"3",children:` @${Zn}`})]}),a.jsxs(_,{children:[a.jsx(_,{as:"span",tone:"muted",children:"Asked:"})," ",pe.question]})]}),ye?a.jsxs("div",{className:"task-detail-page__input-request-answer",children:[a.jsxs("div",{className:"task-detail-page__input-request-header",children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:Me}),a.jsx(_,{as:"span",weight:"normal",tone:"muted",size:"3",children:` @${ie}`})]}),a.jsxs(_,{children:[a.jsx(_,{as:"span",tone:"muted",children:"Answered:"})," ",ga]})]}):null]}),!ye&&At&&a.jsx(oe,{size:"sm",variant:"primary",onClick:()=>os(pe),children:"Respond"})]})},`input-request-${pe.id}`)}),fs?a.jsx("div",{className:"task-detail-page__section-toggle",children:a.jsx(oe,{size:"sm",variant:"secondary",onClick:()=>M(se=>!se),children:N?"Show fewer updates":`See ${hs.length-Sd} more updates`})}):null]}),a.jsx(fe,{className:"task-detail-page__section",children:a.jsx("div",{className:"task-detail-page__activity",children:a.jsxs("div",{className:`task-detail-page__activity-slot ${C?"task-detail-page__activity-slot--active":""}`,children:[a.jsx("div",{className:"task-detail-page__activity-placeholder",children:a.jsx(_,{size:"2",tone:"muted",children:"Live activity will show here"})}),C?a.jsx("div",{className:`task-detail-page__activity-card ${R==="enter"?"is-entering":""} ${R==="exit"?"is-exiting":""}`,children:a.jsx(_,{size:"2",className:"task-detail-page__activity-message",children:C.message?.replace(/\s+/g," ").trim()||"Activity in progress..."})}):null]})})}),a.jsxs(fe,{title:"Runs",className:"task-detail-page__section",children:[G&&ce.length===0?a.jsx(_,{className:"task-detail-page__executions-state",tone:"muted",children:"Loading runs..."}):null,le?a.jsxs(_,{className:"task-detail-page__executions-state",tone:"muted",children:["Failed to load runs: ",le]}):null,!G&&!le&&ce.length===0?a.jsx(_,{className:"task-detail-page__executions-state",tone:"muted",children:"No runs yet for this task."}):null,Xn.map(se=>{const pe=g.find(ga=>ga.id===se.agentActorId),Ke=pe?.displayName??jd(se.agentActorId),nt=pe?.slug,ut=Hk(se.status),Zn=se.status==="FAILED"&&!!(se.errorCode||se.errorMessage),Me=ze.has(se.id),ie=se.source==="active",ye=fn.has(se.executionId),At={label:ie?"active":"history",color:"gray"};return a.jsx(ge,{leading:a.jsx(Ue,{size:"sm",name:Ke,src:pe?.avatarUrl||void 0}),tags:[ut,At],topRight:ie?a.jsx(oe,{variant:"danger",size:"sm",disabled:ye,onClick:()=>void xt(se.executionId,s?.name,s?.id??""),children:ye?"Interrupting…":"Interrupt"}):a.jsx(_,{size:"1",tone:"muted",children:Nt(se.timestamp)}),children:a.jsxs(W,{spacing:"1",children:[a.jsxs("div",{children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:Ke}),a.jsx(_,{as:"span",weight:"normal",tone:"muted",size:"3",children:nt?` @${nt}`:""})]}),a.jsx(_,{as:"span",tone:"muted",size:"2",children:a.jsxs("span",{className:"task-detail-page__execution-meta",children:["run #",jd(se.executionId),Zn?a.jsx("button",{type:"button",className:"task-detail-page__execution-error-toggle",onClick:()=>gn(se.id),"aria-label":Me?"Hide failure details":"Show failure details","aria-expanded":Me,title:Me?"Hide failure details":"Show failure details",children:"i"}):null]})}),a.jsx(_,{as:"span",size:"1",tone:"muted",children:a.jsxs("span",{className:"task-detail-page__execution-stats",children:["tools: ",se.toolCallCount,a.jsx("span",{className:"task-detail-page__execution-stats-separator",children:"|"}),"session: ",se.runnerSessionId?jd(se.runnerSessionId):"pending",ie?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"task-detail-page__execution-stats-separator",children:"|"}),Nt(se.timestamp)]}):null]})}),Zn&&Me?a.jsxs("div",{className:"task-detail-page__execution-error-detail",children:[se.errorCode?a.jsx(_,{as:"span",size:"1",style:"mono",className:"task-detail-page__execution-error-code",children:se.errorCode}):null,se.errorMessage?a.jsx(_,{as:"span",size:"2",wrap:!0,children:se.errorMessage}):null]}):null]})},se.id)}),qn?a.jsx("div",{className:"task-detail-page__section-toggle",children:a.jsx(oe,{size:"sm",variant:"secondary",onClick:()=>z(se=>!se),children:A?"Show fewer runs":`See ${ce.length-Td} more runs`})}):null]}),a.jsx(fe,{className:"task-detail-page__status-buttons",children:Object.entries(Vn).map(([se,pe])=>a.jsx(oe,{size:"sm",variant:se===s.status?"primary":"secondary",onClick:()=>Is(se),disabled:D,children:a.jsxs(W,{spacing:"0",children:[a.jsx("div",{children:pe.icon}),a.jsx("div",{children:pe.label})]})},se))}),a.jsx(oe,{className:"task-detail-fab",onClick:()=>yt(!0),variant:"primary",size:"lg",children:"Add Comment"}),!s.assigneeActor&&a.jsxs(fe,{className:"task-detail-page__comment-buttons",children:[a.jsx(oe,{size:"lg",onClick:()=>Ee(!0),children:"Assign"}),a.jsx(oe,{size:"lg",variant:"primary",onClick:async()=>{await d.assignTaskToMe({taskId:s.id})},children:"Assign to Me"})]}),a.jsx(Ml,{className:"task-detail-page__comment-buttons",onDelete:async()=>{try{await d.deleteTask({taskId:s.id}),y(n)}catch(se){x(se)}}}),a.jsxs(fe,{className:"task-detail-page__actions",children:[!k&&T&&!T.isReady?a.jsx(xh,{title:T.title,description:T.description,ctaLabel:T.ctaLabel,onOpenSettings:()=>y("/settings/chat")}):null,a.jsx(oe,{size:"lg",variant:X?"primary":"secondary",onClick:()=>{re()},disabled:ue||!w||k,children:X?"Go to thread":"Create thread"}),a.jsx(oe,{size:"lg",variant:"secondary",onClick:()=>y(n),children:"Back to Tasks"})]}),Kn?a.jsx(Ek,{onCancel:us,onSave:cs,taskId:s.id}):null,je?a.jsx(Dk,{onCancel:qs,onSave:pa}):null,ft?a.jsx(Ak,{onCancel:Hl,onSave:$l,existingTags:s.tags}):null,On?a.jsx(Rk,{onCancel:mn,onSave:Mt,excludeTaskIds:[s.id,...s.dependsOnIds||[]]}):null,qt?a.jsx(Nk,{onCancel:Ga,onSave:Ul,taskId:s.id,inputRequestId:qt.id,question:qt.question}):null]})}function Ik(){const{d:s}=Wt(),{tasks:n,getTaskById:r,isLoading:o,hasLoadedOnce:c,setSectionTitle:d,addComment:f,deleteTask:y,assignTask:g,assignTaskToMe:m,answerInputRequest:x,activityByTaskId:S}=fa(),[v,T]=p.useState(!1),w=s?n.find(j=>j.id===s):void 0;p.useEffect(()=>{if(!s)return;let j=!1;return T(!0),r(s).catch(R=>console.error("Failed to fetch task",R)).finally(()=>{j||T(!1)}),()=>{j=!0}},[s,r]),p.useEffect(()=>{if(!w||!w.dependsOnIds||w.dependsOnIds.length===0)return;const j=w.dependsOnIds.filter(R=>!n.some(L=>L.id===R));j.length!==0&&Promise.all(j.map(R=>r(R).catch(L=>(console.error(`Failed to hydrate dependency ${R}`,L),null))))},[w,n,r]);const k=!w&&(!c||o||v),C={addComment:({taskId:j,comment:R})=>f({taskId:j,comment:R}),deleteTask:({taskId:j})=>y({taskId:j}),assignTask:({taskId:j,assigneeActorId:R})=>g({taskId:j,assigneeActorId:R}),assignTaskToMe:({taskId:j})=>m({taskId:j}),answerInputRequest:({taskId:j,inputRequestId:R,answer:L})=>x({taskId:j,inputRequestId:R,answer:L}),changeStatus:({taskId:j,status:R})=>Dt.TasksController_changeStatus({id:j,body:{status:R}}),addTag:({taskId:j,tag:R})=>Dt.TasksController_addTagToTask({id:j,body:{name:R.name}}),removeTag:({taskId:j,tagId:R})=>Dt.TasksController_removeTagFromTask({id:j,tagId:R}),addDependency:async({taskId:j,dependencyTaskId:R})=>{const L=n.find(M=>M.id===j);if(!L)return;const N=[...L.dependsOnIds||[],R];await Dt.TasksController_updateTask({id:j,body:{dependsOnIds:N}});try{await r(R)}catch(M){console.error(`Failed to hydrate dependency ${R} after adding`,M)}},removeDependency:async({taskId:j,dependencyTaskId:R})=>{const L=n.find(M=>M.id===j);if(!L)return;const N=(L.dependsOnIds||[]).filter(M=>M!==R);await Dt.TasksController_updateTask({id:j,body:{dependsOnIds:N}})}};return a.jsx(Kx,{task:w,backPath:"/tasks",setSectionTitle:d,isLoadingTask:k,activityByTaskId:S,handlers:C,allTasks:n})}function Uk({backPath:s}){const n=Re();return a.jsxs("div",{className:"task-detail-page",children:[a.jsxs(fe,{className:"task-detail-page__section task-detail-page__shell-container",children:[a.jsx("div",{className:"task-detail-page__shell-line task-detail-page__shell-line--wide"}),a.jsx("div",{className:"task-detail-page__shell-line task-detail-page__shell-line--mid"})]}),a.jsxs(fe,{className:"task-detail-page__section task-detail-page__shell-container",children:[a.jsx("div",{className:"task-detail-page__shell-line task-detail-page__shell-line--full"}),a.jsx("div",{className:"task-detail-page__shell-line task-detail-page__shell-line--short"}),a.jsx("div",{className:"task-detail-page__shell-line task-detail-page__shell-line--mid"})]}),a.jsxs(fe,{className:"task-detail-page__section task-detail-page__shell-container",children:[a.jsx("div",{className:"task-detail-page__shell-line task-detail-page__shell-line--full"}),a.jsx("div",{className:"task-detail-page__shell-line task-detail-page__shell-line--full"})]}),a.jsx("div",{className:"task-detail-page__actions",children:a.jsx(oe,{size:"lg",variant:"secondary",onClick:()=>n(s),children:"Back to Tasks"})})]})}function $k({status:s}){let n="gray",r="unknown";return s===ve.DONE?(r="done",n="purple"):s===ve.IN_PROGRESS?(r="in progress",n="green"):s===ve.NOT_STARTED?(r="not started",n="blue"):s===ve.FOR_REVIEW&&(r="in review",n="orange"),{label:r,color:n}}function Hk(s){return s==="ACTIVE"?{label:"active",color:"blue"}:s==="SUCCEEDED"?{label:"succeeded",color:"green"}:s==="FAILED"?{label:"failed",color:"red"}:s==="STALE"?{label:"stale",color:"orange"}:{label:"cancelled",color:"gray"}}function jd(s){return s.length<=12?s:`${s.slice(0,8)}…${s.slice(-4)}`}function Gk(s){if(!(s instanceof HTMLElement))return!1;if(s.isContentEditable)return!0;const n=s.tagName.toLowerCase();return n==="input"||n==="textarea"||n==="select"?!0:!!s.closest('[contenteditable="true"], input, textarea, select')}const Cy=100,Pk=()=>{const[s,n]=p.useState([]),[r,o]=p.useState({}),[c,d]=p.useState([]),[f,y]=p.useState(!1),[g,m]=p.useState(null),x=p.useCallback(A=>{o(z=>({...z,[A.id]:A})),d(z=>z.some(H=>H.id===A.id)?z.map(H=>H.id===A.id?A:H):[A,...z])},[]),S=p.useCallback(A=>{n(z=>z.find(H=>H.id===A.id)?z.map(H=>H.id===A.id?A:H):[A,...z])},[]),v=p.useCallback(async()=>{y(!0),m(null);try{const A=await Cl.ScheduledTasksController_listScheduledTasks({page:1,limit:Cy});n(A.items),A.items.forEach(z=>{z.taskBlueprint&&x(z.taskBlueprint)})}catch(A){m(A instanceof Error?A.message:"Failed to load scheduled tasks")}finally{y(!1)}},[x]),T=p.useCallback(async A=>{const z=await Cl.ScheduledTasksController_getScheduledTask({id:A});return S(z),z.taskBlueprint&&x(z.taskBlueprint),z},[S,x]),w=p.useCallback(async A=>{const z=await qr.TaskBlueprintsController_getTaskBlueprint({id:A});return x(z),z},[x]),k=p.useCallback(async()=>{m(null);try{const A=await qr.TaskBlueprintsController_listTaskBlueprints({page:1,limit:Cy});d(A.items),A.items.forEach(z=>x(z))}catch(A){m(A instanceof Error?A.message:"Failed to load task blueprints")}},[x]),C=p.useCallback(async A=>{const z=await qr.TaskBlueprintsController_createTaskBlueprint({body:A});return x(z),z},[x]),j=p.useCallback(async(A,z)=>{const I=await qr.TaskBlueprintsController_updateTaskBlueprint({id:A,body:z});return x(I),I},[x]),R=p.useCallback(async A=>{const z=await Cl.ScheduledTasksController_createScheduledTask({body:A});return S(z),z.taskBlueprint&&x(z.taskBlueprint),z},[S,x]),L=p.useCallback(async(A,z)=>{const I=await Cl.ScheduledTasksController_updateScheduledTask({id:A,body:z});return S(I),I.taskBlueprint&&x(I.taskBlueprint),I},[S,x]),N=p.useCallback(async A=>{await Cl.ScheduledTasksController_deleteScheduledTask({id:A}),n(z=>z.filter(I=>I.id!==A))},[]),M=p.useCallback(async A=>{await qr.TaskBlueprintsController_deleteTaskBlueprint({id:A}),d(z=>z.filter(I=>I.id!==A)),o(z=>{const I={...z};return delete I[A],I})},[]);return p.useEffect(()=>{v()},[v]),{scheduledTasks:s,blueprintsById:r,blueprints:c,isLoading:f,error:g,loadScheduledTasks:v,loadScheduledTask:T,loadBlueprint:w,loadBlueprints:k,createBlueprint:C,updateBlueprint:j,createScheduledTask:R,updateScheduledTask:L,deleteScheduledTask:N,deleteBlueprint:M}},Xx=p.createContext(null);function Vk({children:s}){const{scheduledTasks:n,blueprints:r,blueprintsById:o,isLoading:c,error:d,loadScheduledTasks:f,loadScheduledTask:y,loadBlueprint:g,loadBlueprints:m,createBlueprint:x,updateBlueprint:S,createScheduledTask:v,updateScheduledTask:T,deleteScheduledTask:w,deleteBlueprint:k}=Pk(),[C,j]=p.useState(""),R=p.useMemo(()=>({scheduledTasks:n,blueprints:r,blueprintsById:o,isLoading:c,error:d,sectionTitle:C,setSectionTitle:j,loadScheduledTasks:f,loadScheduledTask:y,loadBlueprint:g,loadBlueprints:m,createBlueprint:x,updateBlueprint:S,createScheduledTask:v,updateScheduledTask:T,deleteScheduledTask:w,deleteBlueprint:k}),[n,r,o,c,d,C,f,y,g,m,x,S,v,T,w,k]);return a.jsx(Xx.Provider,{value:R,children:s})}function vh(){const s=p.useContext(Xx);if(!s)throw new Error("useScheduledTasksCtx must be used within <ScheduledTasksProvider>");return s}const Bo=s=>String(s).padStart(2,"0"),Yk=s=>{const[n="0",r="0"]=s.split(":"),o=Number(n),c=Number(r);return{hour:Number.isFinite(o)?o:0,minute:Number.isFinite(c)?c:0}},Fk=(s,n,r)=>{if(!s||s==="*")return[];const o=s.split(","),c=[];for(const d of o){const f=d.trim();if(f)if(f.includes("-")){const[y,g]=f.split("-"),m=Number(y),x=Number(g);if(!Number.isFinite(m)||!Number.isFinite(x))continue;const S=Math.max(n,Math.min(m,x)),v=Math.min(r,Math.max(m,x));for(let T=S;T<=v;T+=1)c.push(T)}else{const y=Number(f);Number.isFinite(y)&&y>=n&&y<=r&&c.push(y)}}return Array.from(new Set(c)).sort((d,f)=>d-f)},Qk=s=>{if(s.preset==="custom")return s.cronExpression.trim();const{hour:n,minute:r}=Yk(s.time),o=Bo(r),c=Bo(n);if(s.preset==="daily")return`${o} ${c} * * *`;if(s.preset==="weekly"){const f=s.days.length?s.days.join(","):"1";return`${o} ${c} * * ${f}`}const d=Math.min(Math.max(s.dayOfMonth,1),28);return`${o} ${c} ${d} * *`},Zx=s=>{const n=s.trim(),r=n.split(/\s+/);if(r.length<5)return{preset:"custom",time:"09:00",days:[],dayOfMonth:1,cronExpression:n};const[o,c,d,f,y]=r,g=`${Bo(Number(c))}:${Bo(Number(o))}`;if(d==="*"&&f==="*"&&y==="*")return{preset:"daily",time:g,days:[],dayOfMonth:1,cronExpression:n};if(d==="*"&&f==="*"&&y!=="*"){const m=Fk(y,0,7).map(x=>x===7?0:x);return m.length?{preset:"weekly",time:g,days:m,dayOfMonth:1,cronExpression:n}:{preset:"custom",time:g,days:[],dayOfMonth:1,cronExpression:n}}if(d!=="*"&&f==="*"&&y==="*"){const m=Number(d);return{preset:"monthly",time:g,days:[],dayOfMonth:Number.isFinite(m)?m:1,cronExpression:n}}return{preset:"custom",time:"09:00",days:[],dayOfMonth:1,cronExpression:n}},Jx=s=>{if(s.preset==="custom")return`Cron: ${s.cronExpression}`;if(s.preset==="daily")return`Daily at ${s.time}`;if(s.preset==="weekly"){const n=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];return`Weekly on ${(s.days.length?s.days:[1]).map(c=>n[c]??"").join(", ")} at ${s.time}`}return`Monthly on day ${s.dayOfMonth} at ${s.time}`},Kk=/^[\d*/,\-]+$/,Xk=s=>{const n=s.trim().split(/\s+/);return n.length!==5?"Cron must have 5 fields: minute hour day-of-month month day-of-week.":n.some(r=>!r||!Kk.test(r))?"Cron can only include digits, *, /, -, and commas.":null};function Zk({blueprints:s,onCancel:n,onSave:r,onRequestNewBlueprint:o}){const[c,d]=p.useState(""),[f,y]=p.useState(null),[g,m]=p.useState(0),x=p.useMemo(()=>{const v=c.trim().toLowerCase();return v?s.filter(T=>[T.name,T.description||"",T.assigneeActor?.displayName||"",T.assigneeActor?.slug||""].join(" ").toLowerCase().includes(v)):s},[s,c]),S=async()=>f?r(f):!1;return a.jsx(ct,{title:"Create Schedule",onCancel:n,onSave:S,children:a.jsxs("div",{className:"new-schedule-pop",children:[f?a.jsxs("div",{className:"new-schedule-pop__selected",onClick:()=>y(null),children:[a.jsx(Ue,{size:"md",name:f.name,src:f.assigneeActor?.avatarUrl||void 0}),a.jsxs("div",{className:"new-schedule-pop__selected-meta",children:[a.jsx(_,{weight:"medium",size:"3",children:f.name}),a.jsx(_,{tone:"muted",size:"2",children:f.description||"No description"})]}),a.jsx(_,{size:"2",tone:"muted",children:"tap to change"})]}):a.jsxs(a.Fragment,{children:[a.jsx("input",{className:"new-schedule-pop__input",placeholder:"Search blueprint by name...",value:c,onChange:v=>d(v.target.value),onKeyDown:v=>{v.key==="ArrowDown"&&(v.preventDefault(),m(T=>Math.min(T+1,x.length-1))),v.key==="ArrowUp"&&(v.preventDefault(),m(T=>Math.max(T-1,0))),v.key==="Enter"&&x[g]&&(v.preventDefault(),y(x[g]))}}),a.jsx("div",{className:"new-schedule-pop__list",children:x.length===0?a.jsx("div",{className:"new-schedule-pop__empty",children:a.jsx(_,{tone:"muted",size:"2",children:"No blueprints found"})}):x.map((v,T)=>a.jsxs("div",{className:`new-schedule-pop__item ${T===g?"new-schedule-pop__item--highlighted":""}`,onMouseEnter:()=>m(T),onClick:()=>y(v),children:[a.jsx(Ue,{size:"sm",name:v.name,src:v.assigneeActor?.avatarUrl||void 0}),a.jsxs("div",{className:"new-schedule-pop__item-meta",children:[a.jsx(_,{size:"2",weight:"medium",children:v.name}),a.jsx(_,{size:"1",tone:"muted",children:v.assigneeActor?`@${v.assigneeActor.slug}`:"Unassigned"})]})]},v.id))})]}),a.jsx(oe,{size:"sm",variant:"secondary",onClick:o,children:"+ New blueprint"})]})})}function Jk(){const s=Re(),{scheduledTasks:n,blueprints:r,isLoading:o,error:c,createBlueprint:d,createScheduledTask:f,deleteScheduledTask:y,loadBlueprints:g}=vh(),{setSectionTitle:m}=fa(),{showError:x}=hn(),S=jt(),[v,T]=p.useState(!1),[w,k]=p.useState(!1),C=p.useRef(!1);wt(),p.useEffect(()=>{m("Schedule")},[m]),p.useEffect(()=>{g().catch(x)},[g,x]);const j=p.useMemo(()=>n.filter(A=>A.enabled).length,[n]),R=async A=>{try{const z=await d({name:A.title,description:A.description});return T(!1),s(`/tasks/blueprints/${z.id}`),!0}catch(z){return x(z),!1}},L=async A=>{if(C.current)return!1;C.current=!0;try{const z=await f({taskBlueprintId:A.id,cronExpression:"0 9 * * *",enabled:!1});return k(!1),s(`/tasks/schedule/${z.id}`),!0}catch(z){return x(z),!1}finally{C.current=!1}},N=p.useMemo(()=>r.map(A=>({id:A.id,name:A.name,description:A.description,status:ve.NOT_STARTED,assignee:null,assigneeActor:A.assigneeActor??void 0,sessionId:null,comments:[],artefacts:[],inputRequests:[],tags:A.tags,createdByActor:A.createdByActor,dependsOnIds:A.dependsOnIds,createdAt:A.createdAt,updatedAt:A.updatedAt})),[r]),M=async A=>{if(window.confirm("Delete this schedule?"))try{await y(A.id)}catch(z){x(z)}};return a.jsxs("div",{className:"scheduled-tasks-page",children:[c?a.jsx(_,{tone:"muted",children:c}):null,a.jsx("section",{className:"scheduled-tasks-page__section",children:o?a.jsx(_,{tone:"muted",children:"Loading scheduled tasks..."}):a.jsx(fe,{title:"Schedules",action:a.jsxs("div",{className:"scheduled-tasks-page__header-actions",children:[a.jsxs(_,{size:"2",tone:"muted",children:[j," active schedules"]}),a.jsx(oe,{size:"sm",variant:"secondary",onClick:()=>k(!0),children:"+ Add schedule"})]}),children:n.length===0?a.jsxs($e,{className:"scheduled-tasks-page__empty",children:[a.jsx(_,{weight:"medium",children:"No schedules yet"}),a.jsx(_,{tone:"muted",children:"Create a schedule from a blueprint."})]}):n.map(A=>{const z=A.taskBlueprint,I=Jx(Zx(A.cronExpression));return a.jsxs(ge,{onClick:()=>s(`/tasks/schedule/${A.id}`),tags:[{label:A.enabled?"enabled":"paused",color:A.enabled?"green":"gray"}],topRight:a.jsxs(_,{size:"1",tone:"muted",children:["Next: ",new Date(A.nextRunAt).toLocaleString()]}),trailing:a.jsx(oe,{size:"sm",variant:"danger",onClick:H=>{H.stopPropagation(),M(A)},children:"Delete"}),children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:z?.name||"Untitled blueprint"}),a.jsx(_,{as:"span",size:"2",tone:"muted",children:` ${I}`})]},A.id)})})}),a.jsx("section",{className:"scheduled-tasks-page__section",children:N.length===0?a.jsxs($e,{className:"scheduled-tasks-page__empty",children:[a.jsx(_,{weight:"medium",children:"No blueprints yet"}),a.jsx(_,{tone:"muted",children:"Create a blueprint to reuse task definitions."})]}):S?a.jsx(fe,{title:"Blueprints",action:a.jsxs("div",{className:"scheduled-tasks-page__header-actions",children:[a.jsxs(_,{size:"2",tone:"muted",children:[r.length," blueprints"]}),a.jsx(oe,{size:"sm",variant:"secondary",onClick:()=>T(!0),children:"+ New blueprint"})]}),children:a.jsx("div",{className:"scheduled-tasks-page__blueprints-board",children:N.map(A=>a.jsx(Do,{task:A,onClick:()=>s(`/tasks/blueprints/${A.id}`)},A.id))})}):a.jsx(fe,{title:"Blueprints",action:a.jsxs("div",{className:"scheduled-tasks-page__header-actions",children:[a.jsxs(_,{size:"2",tone:"muted",children:[r.length," blueprints"]}),a.jsx(oe,{size:"sm",variant:"secondary",onClick:()=>T(!0),children:"+ New blueprint"})]}),children:N.map(A=>a.jsx(Pr,{task:A,onClick:()=>s(`/tasks/blueprints/${A.id}`)},A.id))})}),v?a.jsx(Yd,{onCancel:()=>T(!1),onSave:R}):null,w?a.jsx(Zk,{blueprints:r,onCancel:()=>k(!1),onSave:L,onRequestNewBlueprint:()=>{k(!1),T(!0)}}):null]})}const Wk=[{value:0,label:"Sun"},{value:1,label:"Mon"},{value:2,label:"Tue"},{value:3,label:"Wed"},{value:4,label:"Thu"},{value:5,label:"Fri"},{value:6,label:"Sat"}];function eE(){const{scheduleId:s}=Wt(),n=Re(),{scheduledTasks:r,blueprintsById:o,loadScheduledTask:c,loadBlueprint:d,updateScheduledTask:f}=vh(),{setSectionTitle:y}=fa(),{showError:g,showToast:m}=hn(),[x,S]=p.useState("daily"),[v,T]=p.useState("09:00"),[w,k]=p.useState([1]),[C,j]=p.useState(1),[R,L]=p.useState("0 9 * * *"),[N,M]=p.useState(!1),[A,z]=p.useState(!1),[I,H]=p.useState(null),P=r.find(B=>B.id===s),U=P?.taskBlueprint||(P?o[P.taskBlueprintId]:void 0);wt(),p.useEffect(()=>{s&&(P||c(s).catch(g))},[s,P,c,g]),p.useEffect(()=>{P&&!P.taskBlueprint&&d(P.taskBlueprintId).catch(g)},[P,d,g]),p.useEffect(()=>{U?.name?y(U.name):y("Schedule")},[U,y]),p.useEffect(()=>{if(!P)return;const B=Zx(P.cronExpression);S(B.preset),T(B.time),k(B.days.length?B.days:[1]),j(B.dayOfMonth||1),L(B.cronExpression||P.cronExpression),M(P.enabled)},[P]);const J=p.useMemo(()=>Qk({preset:x,time:v,days:w,dayOfMonth:C,cronExpression:R}),[x,v,w,C,R]);if(!P)return a.jsxs("div",{className:"scheduled-task-detail-page",children:[a.jsx(_,{tone:"muted",children:"Scheduled task not found."}),a.jsx(oe,{variant:"secondary",onClick:()=>n("/tasks/schedule"),children:"Back to schedules"})]});const X=Jx({preset:x,time:v,days:w,dayOfMonth:C,cronExpression:J}),te=B=>{k(re=>{if(re.includes(B)){const he=re.filter(ke=>ke!==B);return he.length?he:re}return[...re,B].sort((he,ke)=>he-ke)})},ue=async()=>{if(x==="custom"){const B=Xk(J);if(B){H(B);return}}H(null),z(!0);try{await f(P.id,{cronExpression:J,enabled:N}),m("Schedule saved","success")}catch(B){g(B)}finally{z(!1)}};return a.jsxs("div",{className:"scheduled-task-detail-page",children:[a.jsx(fe,{title:"Task",className:"scheduled-task-detail-page__section",children:a.jsxs(ge,{onClick:()=>n(`/tasks/blueprints/${P.taskBlueprintId}`),tags:[{label:"blueprint",color:"blue"}],trailing:a.jsx(_,{size:"2",tone:"muted",children:"Open"}),children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:U?.name||"Untitled blueprint"}),a.jsx(_,{as:"span",tone:"muted",size:"2",children:` ${U?.description||"No description"}`})]})}),a.jsxs(fe,{title:"Schedule",className:"scheduled-task-detail-page__section",children:[a.jsxs("div",{className:"scheduled-task-detail-page__controls",children:[a.jsxs("label",{className:"scheduled-task-detail-page__label",children:[a.jsx(_,{size:"2",tone:"muted",children:"Frequency"}),a.jsxs("select",{className:"scheduled-task-detail-page__select",value:x,onChange:B=>S(B.target.value),children:[a.jsx("option",{value:"daily",children:"Daily"}),a.jsx("option",{value:"weekly",children:"Weekly"}),a.jsx("option",{value:"monthly",children:"Monthly"}),a.jsx("option",{value:"custom",children:"Custom (cron)"})]})]}),x!=="custom"?a.jsxs("label",{className:"scheduled-task-detail-page__label",children:[a.jsx(_,{size:"2",tone:"muted",children:"Time"}),a.jsx("input",{className:"scheduled-task-detail-page__input",type:"time",value:v,onChange:B=>T(B.target.value)})]}):null,x==="weekly"?a.jsxs("div",{className:"scheduled-task-detail-page__label",children:[a.jsx(_,{size:"2",tone:"muted",children:"Days"}),a.jsx("div",{className:"scheduled-task-detail-page__day-grid",children:Wk.map(B=>a.jsx("button",{type:"button",className:`scheduled-task-detail-page__day ${w.includes(B.value)?"is-selected":""}`,onClick:()=>te(B.value),children:B.label},B.value))})]}):null,x==="monthly"?a.jsxs("label",{className:"scheduled-task-detail-page__label",children:[a.jsx(_,{size:"2",tone:"muted",children:"Date"}),a.jsx("input",{className:"scheduled-task-detail-page__input",type:"date",value:`2026-01-${String(Math.min(Math.max(C,1),28)).padStart(2,"0")}`,onChange:B=>{const re=new Date(`${B.target.value}T00:00:00`).getDate();Number.isFinite(re)&&j(Math.min(Math.max(re,1),28))}})]}):null,x==="custom"?a.jsxs("label",{className:"scheduled-task-detail-page__label",children:[a.jsx(_,{size:"2",tone:"muted",children:"Cron expression"}),a.jsx("input",{className:"scheduled-task-detail-page__input",value:R,onChange:B=>{L(B.target.value),I&&H(null)},placeholder:"0 9 * * 1-5"}),a.jsx(_,{size:"1",tone:"muted",children:"Use 5 fields: minute hour day-of-month month day-of-week."})]}):null,a.jsx(_,{size:"1",tone:"muted",children:"Schedules run using the server timezone."}),I?a.jsx(Rn,{size:"1",children:I}):null,a.jsxs("div",{className:"scheduled-task-detail-page__toggle-row",children:[a.jsx(_,{size:"2",tone:"muted",children:"Status"}),a.jsxs("div",{className:"scheduled-task-detail-page__toggle-buttons",children:[a.jsx(oe,{size:"sm",variant:N?"primary":"secondary",onClick:()=>M(!0),children:"On"}),a.jsx(oe,{size:"sm",variant:N?"secondary":"primary",onClick:()=>M(!1),children:"Off"})]})]})]}),a.jsx(ge,{topRight:a.jsxs(_,{size:"1",tone:"muted",children:["Next: ",new Date(P.nextRunAt).toLocaleString()]}),children:a.jsx(_,{as:"span",size:"2",children:X})}),a.jsx(ge,{children:a.jsx(_,{as:"span",size:"2",style:"mono",children:J})})]}),a.jsxs(fe,{className:"scheduled-task-detail-page__actions",children:[a.jsx(oe,{size:"lg",variant:"primary",onClick:ue,disabled:A,children:A?"Saving...":"Save schedule"}),a.jsx(oe,{size:"lg",variant:"secondary",onClick:()=>n("/tasks/schedule"),children:"Back to schedules"})]})]})}function tE(){const{taskBlueprintId:s}=Wt(),{user:n}=Dn(),{showError:r}=hn(),{blueprints:o,blueprintsById:c,loadBlueprint:d,updateBlueprint:f,deleteBlueprint:y}=vh(),{setSectionTitle:g,tasks:m}=fa(),x=p.useMemo(()=>{if(s)return c[s]||o.find(T=>T.id===s)},[o,c,s]);p.useEffect(()=>{!s||x||d(s).catch(r)},[s,x,d,r]);const S=p.useMemo(()=>{if(x)return{id:x.id,name:x.name,description:x.description,status:ve.NOT_STARTED,assignee:null,assigneeActor:x.assigneeActor??void 0,sessionId:null,comments:[],artefacts:[],inputRequests:[],tags:x.tags,createdByActor:x.createdByActor,dependsOnIds:x.dependsOnIds,createdAt:x.createdAt,updatedAt:x.updatedAt}},[x]),v={addComment:async()=>{throw new Error("Blueprints do not support comments.")},deleteTask:async({taskId:T})=>{await y(T)},assignTask:async({taskId:T,assigneeActorId:w})=>{await f(T,{assigneeActorId:w})},assignTaskToMe:async({taskId:T})=>{if(!n?.actorId)throw new Error("No user session found.");await f(T,{assigneeActorId:n.actorId})},answerInputRequest:async()=>{throw new Error("Blueprints do not support input requests.")},changeStatus:async()=>{throw new Error("Blueprints do not have status updates.")},addTag:async({taskId:T,tag:w})=>{const k=x?.tags?.map(j=>j.name)??[],C=k.includes(w.name)?k:[...k,w.name];await f(T,{tagNames:C})},removeTag:async({taskId:T,tagId:w})=>{const C=(x?.tags??[]).filter(j=>j.id!==w).map(j=>j.name);await f(T,{tagNames:C})},addDependency:async({taskId:T,dependencyTaskId:w})=>{const C=[...x?.dependsOnIds??[],w];await f(T,{dependsOnIds:C})},removeDependency:async({taskId:T,dependencyTaskId:w})=>{const C=(x?.dependsOnIds??[]).filter(j=>j!==w);await f(T,{dependsOnIds:C})}};return a.jsx(Kx,{task:S,backPath:"/tasks/schedule",setSectionTitle:g,handlers:v,allTasks:m})}function nE(){return a.jsx(Vk,{children:a.jsx(Ot,{})})}function sE(){return a.jsx(gk,{children:a.jsx(is,{children:a.jsxs(xe,{element:a.jsx(wk,{}),children:[a.jsx(xe,{index:!0,element:a.jsx(Ma,{to:"/tasks/not-started",replace:!0})}),a.jsx(xe,{path:"not-started",element:a.jsx(_o,{status:ve.NOT_STARTED})}),a.jsx(xe,{path:"in-progress",element:a.jsx(_o,{status:ve.IN_PROGRESS})}),a.jsx(xe,{path:"in-review",element:a.jsx(_o,{status:ve.FOR_REVIEW})}),a.jsx(xe,{path:"done",element:a.jsx(_o,{status:ve.DONE})}),a.jsx(xe,{path:"task/:d",element:a.jsx(Ik,{})}),a.jsxs(xe,{element:a.jsx(nE,{}),children:[a.jsx(xe,{path:"schedule",element:a.jsx(Jk,{})}),a.jsx(xe,{path:"schedule/:scheduleId",element:a.jsx(eE,{})}),a.jsx(xe,{path:"blueprints/:taskBlueprintId",element:a.jsx(tE,{})})]})]})})})}function aE(){const{logout:s}=Dn(),n=Re();return p.useEffect(()=>{(async()=>{try{await s()}finally{n("/login",{replace:!0})}})()},[s,n]),null}const lE=window.location.origin,Wx=new Fn({baseUrl:lE,credentials:"include"}),qa=Wx.context;Wx.context;const ev=ha("/context"),Vr={CONTEXT_BLOCK_CREATED:"context.block.created",CONTEXT_BLOCK_UPDATED:"context.block.updated",CONTEXT_BLOCK_DELETED:"context.block.deleted"};function rE(){const[s,n]=p.useState([]),[r,o]=p.useState(!0),[c,d]=p.useState(null),[f,y]=p.useState(!1),g=v=>[...v].sort((T,w)=>{const k=new Date(T.updatedAt).getTime();return new Date(w.updatedAt).getTime()-k}),m=async()=>{try{o(!0),d(null);const v=await qa.ContextController_listBlocks();n(g(v.items))}catch(v){d(v instanceof Error?v.message:"Failed to fetch context blocks"),console.error("Error fetching context blocks:",v)}finally{o(!1)}},x=()=>{const v=Nn(ev,{transports:["websocket","polling"],withCredentials:!0});return v.on("connect",()=>{console.log("Connected to context WebSocket"),v.emit("context.subscribe",{},T=>{T.ok?(console.log("Subscribed to context room:",T.room),y(!0)):(console.error("Failed to subscribe to context room"),y(!1))}),m()}),v.on("disconnect",()=>{console.log("Context WebSocket disconnected"),y(!1)}),v.on("connect_error",T=>{console.error("Context websocket connect_error",T.message)}),v.on(Vr.CONTEXT_BLOCK_CREATED,T=>{console.log("context.block.created",T),n(w=>w.some(k=>k.id===T.payload.id)?w:g([T.payload,...w]))}),v.on(Vr.CONTEXT_BLOCK_UPDATED,T=>{console.log("context.block.updated",T),n(w=>g(w.map(k=>k.id===T.payload.id?T.payload:k)))}),v.on(Vr.CONTEXT_BLOCK_DELETED,T=>{console.log("context.block.deleted",T),n(w=>w.filter(k=>k.id!==T.payload.blockId))}),()=>{v.emit("context.unsubscribe",{}),v.close()}},S=p.useCallback(async v=>{try{const T=await qa.ContextController_getBlock({id:v});return n(w=>w.some(k=>k.id===T.id)?w:g([T,...w])),T}catch(T){return console.error("Failed to fetch block by ID",T),null}},[]);return p.useEffect(()=>(m(),x()),[]),{blocks:s,getBlockById:S,isLoading:r,error:c,isConnected:f,reload:m}}function iE(s){const[n,r]=p.useState(null),[o,c]=p.useState(!0),[d,f]=p.useState(null),[y,g]=p.useState(!1),m=p.useCallback(async()=>{try{c(!0),f(null);const x=await qa.ContextController_getBlock({id:s});r(x),g(!1)}catch(x){f(x instanceof Error?x.message:"Failed to fetch context block"),console.error("Error fetching context block:",x)}finally{c(!1)}},[s]);return p.useEffect(()=>{s&&m()},[s,m]),p.useEffect(()=>{if(!s)return;const x=Nn(ev,{transports:["websocket","polling"],withCredentials:!0});return x.on("connect",()=>{console.log("Connected to context WebSocket (detail page)"),x.emit("context.subscribe",{blockId:s},S=>{S.ok?(console.log("Subscribed to context room (detail page):",S.room),m()):console.error("Failed to subscribe to context room (detail page)",S.error)})}),x.on("connect_error",S=>{console.error("Context detail websocket connect_error",S.message)}),x.on("disconnect",()=>{console.log("Context WebSocket disconnected (detail page)")}),x.on(Vr.CONTEXT_BLOCK_UPDATED,S=>{S.payload.id===s&&(console.log("context.block.updated (detail page)",S),m().catch(v=>console.error("Error refreshing block after update:",v)))}),x.on(Vr.CONTEXT_BLOCK_DELETED,S=>{S.payload.blockId===s&&(console.log("context.block.deleted (detail page)",S),g(!0),r(null))}),()=>{x.emit("context.unsubscribe",{blockId:s}),x.close()}},[s,m]),{block:n,isLoading:o,error:d,isDeleted:y}}const tv=p.createContext(null);function oE({children:s}){const{blocks:n,getBlockById:r,isLoading:o,error:c,isConnected:d,reload:f}=rE(),[y,g]=p.useState(""),m=p.useMemo(()=>({blocks:n,getBlockById:r,isLoading:o,error:c,isConnected:d,reload:f,sectionTitle:y,setSectionTitle:g}),[n,r,o,c,d,f,y,g]);return a.jsx(tv.Provider,{value:m,children:s})}function Qo(){const s=p.useContext(tv);if(!s)throw new Error("useContextCtx must be used within <ContextProvider>");return s}const cE=6;function nv(s){return typeof s=="string"?s:s&&typeof s=="object"&&"id"in s&&typeof s.id=="string"?s.id:null}function Ny(s,n){return s.order!==n.order?n.order-s.order:s.title.localeCompare(n.title)}function uE(s){const n=new Map;s.forEach(d=>{n.set(d.id,{block:d,children:[],latestUpdatedAt:new Date(d.updatedAt).getTime()})});const r=[];s.forEach(d=>{const f=n.get(d.id);if(!f)return;const y=nv(d.parentId);if(!y){r.push(f);return}const g=n.get(y);if(!g){r.push(f);return}g.children.push(f)});const o=d=>{d.sort((f,y)=>Ny(f.block,y.block)),d.forEach(f=>o(f.children))};o(r);const c=d=>{if(d.children.length===0)return d.latestUpdatedAt;let f=d.latestUpdatedAt;return d.children.forEach(y=>{const g=c(y);g>f&&(f=g)}),d.latestUpdatedAt=f,f};return r.forEach(d=>{c(d)}),r.sort((d,f)=>{const y=f.latestUpdatedAt-d.latestUpdatedAt;return y!==0?y:Ny(d.block,f.block)}),r}function sv({nodes:s,depth:n,onOpenBlock:r,onAddChild:o,collapsedIds:c,onToggleNode:d,selectedBlockId:f,compact:y=!1}){return a.jsx("ul",{className:"context-tree__branch",role:n===0?"tree":"group",children:s.map(g=>{const m=g.children.length>0,x=m?!c.has(g.block.id):!1,S=Math.min(n,cE),v=f===g.block.id;return a.jsxs("li",{className:"context-tree__item",role:"treeitem","aria-expanded":m?x:void 0,children:[a.jsxs("div",{className:`context-tree__row ${v?"context-tree__row--selected":""} ${y?"context-tree__row--compact":""}`,style:{"--tree-depth":S},children:[m?a.jsx("button",{type:"button",className:"context-tree__toggle","aria-expanded":x,"aria-label":x?`Collapse ${g.block.title}`:`Expand ${g.block.title}`,onClick:()=>d(g.block.id),children:a.jsx("span",{className:"context-tree__marker","aria-hidden":"true",children:x?"▼":"►"})}):a.jsx("span",{className:"context-tree__spacer","aria-hidden":"true"}),a.jsxs("button",{type:"button",className:"context-tree__open",onClick:()=>r(g.block.id),children:[a.jsxs("div",{className:"context-tree__main",children:[a.jsx(_,{weight:v?"bold":"medium",size:y?"2":"3",tone:"default",className:"context-tree__title",children:g.block.title}),y?null:a.jsxs("div",{className:"context-tree__meta",children:[a.jsxs("span",{className:"context-tree__id",children:["#",g.block.id.slice(0,6)]}),a.jsx("span",{children:g.block.createdBy||"unknown"})]})]}),!y&&g.block.tags.length>0?a.jsxs("div",{className:"context-tree__tags","aria-label":"Block tags",children:[g.block.tags.slice(0,2).map(T=>a.jsx("span",{className:"context-tree__tag",children:T.name},`${g.block.id}-${T.id}`)),g.block.tags.length>2?a.jsxs("span",{className:"context-tree__tag context-tree__tag--count",children:["+",g.block.tags.length-2]}):null]}):null]}),o?a.jsx("button",{type:"button",className:"context-tree__add-child","aria-label":`Add child block under ${g.block.title}`,onClick:T=>{T.stopPropagation(),o(g.block.id)},children:"+"}):null]}),m&&x?a.jsx(sv,{nodes:g.children,depth:n+1,onOpenBlock:r,onAddChild:o,collapsedIds:c,onToggleNode:d,selectedBlockId:f,compact:y}):null]},g.block.id)})})}function Ay(s){const n=new Set,r=o=>{for(const c of o)c.children.length>0&&(n.add(c.block.id),r(c.children))};return r(s),n}function av({blocks:s,onOpenBlock:n,onAddChild:r,selectedBlockId:o,compact:c=!1}){const d=p.useMemo(()=>uE(s),[s]),[f,y]=p.useState(()=>Ay(d)),g=p.useRef(!1);p.useEffect(()=>{!g.current&&d.length>0&&(y(Ay(d)),g.current=!0)},[d]),p.useEffect(()=>{if(!o)return;const x=new Map;s.forEach(T=>{x.set(T.id,nv(T.parentId))});const S=new Set;let v=x.get(o)??null;for(;v;)S.add(v),v=x.get(v)??null;S.size!==0&&y(T=>{const w=new Set(T);return S.forEach(k=>w.delete(k)),w})},[s,o]);const m=x=>{y(S=>{const v=new Set(S);return v.has(x)?v.delete(x):v.add(x),v})};return a.jsx("section",{className:`context-tree ${c?"context-tree--compact":""}`,children:a.jsx(sv,{nodes:d,depth:0,onOpenBlock:n,onAddChild:r,collapsedIds:f,onToggleNode:m,selectedBlockId:o,compact:c})})}function dE(){const s=jt(),{sectionTitle:n,blocks:r,isLoading:o,error:c}=Qo(),d=Re(),f=Lt(),{id:y}=Wt(),[g,m]=p.useState(!1),[x,S]=p.useState(!1);return p.useEffect(()=>{if(!s)return;const v=localStorage.getItem("context-sidebar-collapsed");m(v==="true")},[s]),p.useEffect(()=>{s&&localStorage.setItem("context-sidebar-collapsed",String(g))},[s,g]),p.useEffect(()=>{S(!1)},[f.pathname]),a.jsxs("div",{className:`context-layout ${s?"context-layout--desktop":"context-layout--mobile"}`,children:[!s&&a.jsxs(a.Fragment,{children:[x&&a.jsx("div",{className:"context-layout__drawer-overlay",onClick:()=>S(!1)}),a.jsxs("aside",{className:`context-layout__drawer ${x?"context-layout__drawer--open":""}`,children:[a.jsxs("div",{className:"context-layout__drawer-header",children:[a.jsx(_,{size:"4",weight:"bold",children:"taico"}),a.jsx("button",{className:"context-layout__drawer-close",onClick:()=>S(!1),"aria-label":"Close menu",children:"✕"})]}),a.jsx("nav",{className:"context-layout__drawer-nav",children:Al.map(v=>{const T=f.pathname===v.path||f.pathname.startsWith(v.path+"/");return a.jsxs(Ls,{to:v.path,className:`context-layout__drawer-item ${T?"context-layout__drawer-item--active":""}`,children:[a.jsx("span",{className:"context-layout__drawer-icon",children:v.icon}),a.jsx("span",{children:v.label})]},v.path)})})]})]}),!s&&a.jsx("header",{className:"context-layout__mobile-header",children:a.jsxs(lt,{spacing:"5",align:"center",children:[a.jsx("button",{className:"context-layout__hamburger",onClick:()=>S(!0),"aria-label":"Open menu",children:"☰"}),a.jsx(_,{size:"3",weight:"normal",as:"div",children:"Context"}),a.jsx(_,{size:"3",weight:"semibold",as:"div",className:"context-layout__mobile-section-title",children:n})]})}),s&&a.jsxs("aside",{className:`context-desktop__sidebar ${g?"context-desktop__sidebar--collapsed":""}`,children:[a.jsx("div",{className:"context-desktop__sidebar-header",children:g?a.jsx(_,{as:"div",size:"1",tone:"muted",children:r.length}):a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"context-desktop__sidebar-title",onClick:()=>d("/context/home"),children:a.jsx(_,{as:"span",size:"2",weight:"semibold",children:"Context"})}),a.jsxs("div",{className:"context-desktop__sidebar-header-actions",children:[a.jsx(_,{as:"div",size:"1",tone:"muted",children:r.length}),a.jsx("button",{type:"button",className:"context-desktop__sidebar-new",onClick:()=>d("/context/new"),"aria-label":"New block",title:"New block",children:"+"})]})]})}),a.jsx("div",{className:"context-desktop__sidebar-body",children:g?null:o?a.jsx("div",{className:"context-home__loading",children:"Loading context blocks..."}):c?a.jsxs("div",{className:"context-home__error",children:["Error: ",c]}):r.length===0?a.jsx("div",{className:"context-home__empty",children:"No context blocks found"}):a.jsx(av,{blocks:r,onOpenBlock:v=>d(`/context/block/${v}`),onAddChild:v=>d(`/context/new?parentId=${v}`),selectedBlockId:y,compact:!0})}),a.jsx("button",{type:"button",className:"context-desktop__sidebar-toggle",onClick:()=>m(v=>!v),"aria-label":g?"Expand context sidebar":"Collapse context sidebar",children:g?"→":"←"})]}),a.jsx("main",{className:"context-layout__main",children:a.jsx(Ot,{})})]})}function hE(){const{setSectionTitle:s,blocks:n,isLoading:r,error:o}=Qo(),c=Re(),d=jt(),[f,y]=p.useState("");return wt(),p.useEffect(()=>{s("Context")},[s]),r?a.jsx("div",{className:"context-home__loading",children:"Loading context blocks..."}):o?a.jsxs("div",{className:"context-home__error",children:["Error: ",o]}):n.length===0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"context-home__empty",children:a.jsx("div",{className:"context-home__empty-message",children:"No context blocks found"})}),a.jsx(wd,{onClick:()=>c("/context/new"),isDesktop:d})]}):d?a.jsxs(a.Fragment,{children:[a.jsx(fE,{blocks:n,searchQuery:f,onSearchQueryChange:y,onOpenBlock:g=>c(`/context/block/${g}`)}),a.jsx(wd,{onClick:()=>c("/context/new"),isDesktop:d})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"context-home",children:a.jsx(av,{blocks:n,onOpenBlock:g=>c(`/context/block/${g}`),onAddChild:g=>c(`/context/new?parentId=${g}`)})}),a.jsx(wd,{onClick:()=>c("/context/new"),isDesktop:d})]})}function wd({onClick:s,isDesktop:n}){return n?a.jsxs("button",{className:"context-fab context-fab--desktop",type:"button",onClick:s,children:[a.jsx("span",{className:"context-fab__plus",children:"+"}),a.jsx("span",{className:"context-fab__label",children:"New block"})]}):a.jsx("button",{className:"context-fab",type:"button",onClick:s,"aria-label":"Create new block",children:"+"})}function fE({blocks:s,searchQuery:n,onSearchQueryChange:r,onOpenBlock:o}){const c=n.trim().toLowerCase(),d=p.useMemo(()=>c?s.filter(f=>[f.title,f.createdBy||"",f.id,...f.tags.map(g=>g.name)].some(g=>g.toLowerCase().includes(c))):s.slice(0,18),[s,c]);return a.jsxs("div",{className:"context-home-desktop",children:[a.jsx("div",{className:"context-home-desktop__hero",children:a.jsx(_,{as:"div",size:"6",weight:"bold",className:"context-home-desktop__title",children:"Blocks"})}),a.jsx("div",{className:"context-home-desktop__search-box",children:a.jsx("input",{type:"search",className:"context-home-desktop__search-input",placeholder:"Search by title, tag, author, or block id",value:n,onChange:f=>r(f.target.value)})}),a.jsx("div",{className:"context-home-desktop__results",children:d.length===0?a.jsxs("div",{className:"context-home-desktop__empty",children:[a.jsx(_,{as:"div",size:"3",weight:"medium",children:"No matching blocks"}),a.jsx(_,{as:"div",size:"2",tone:"muted",children:"Try a different title, tag, author, or id fragment."})]}):d.map(f=>a.jsx(ge,{className:"context-home-desktop__result",onClick:()=>o(f.id),topRight:a.jsx(_,{as:"span",size:"2",tone:"muted",children:Nt(f.updatedAt)}),tags:f.tags.slice(0,3).map(y=>({label:y.name})),children:a.jsxs("div",{className:"context-home-desktop__result-main",children:[a.jsx("div",{className:"row-title",children:f.title}),a.jsxs("div",{className:"row-detail",children:["#",f.id.slice(0,6)," ",f.createdBy||"unknown"]})]})},f.id))})]})}function bh(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ha=bh();function lv(s){Ha=s}var Da={exec:()=>null};function He(s,n=""){let r=typeof s=="string"?s:s.source,o={replace:(c,d)=>{let f=typeof d=="string"?d:d.source;return f=f.replace(Vt.caret,"$1"),r=r.replace(c,f),o},getRegex:()=>new RegExp(r,n)};return o}var pE=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),Vt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:s=>new RegExp(`^( {0,3}${s})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}#`),htmlBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}>`)},gE=/^(?:[ \t]*(?:\n|$))+/,mE=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,yE=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,ei=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,xE=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_h=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,rv=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,iv=He(rv).replace(/bull/g,_h).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),vE=He(rv).replace(/bull/g,_h).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Sh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,bE=/^[^\n]+/,Th=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,_E=He(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Th).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),SE=He(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,_h).getRegex(),Ko="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",jh=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,TE=He("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",jh).replace("tag",Ko).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ov=He(Sh).replace("hr",ei).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ko).getRegex(),jE=He(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ov).getRegex(),wh={blockquote:jE,code:mE,def:_E,fences:yE,heading:xE,hr:ei,html:TE,lheading:iv,list:SE,newline:gE,paragraph:ov,table:Da,text:bE},Ry=He("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",ei).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ko).getRegex(),wE={...wh,lheading:vE,table:Ry,paragraph:He(Sh).replace("hr",ei).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ry).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ko).getRegex()},kE={...wh,html:He(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",jh).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Da,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:He(Sh).replace("hr",ei).replace("heading",` *#{1,6} *[^
|
|
13
|
-
]`).replace("lheading",iv).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},EE=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,CE=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,cv=/^( {2,}|\\)\n(?!\s*$)/,NE=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Il=/[\p{P}\p{S}]/u,Xo=/[\s\p{P}\p{S}]/u,kh=/[^\s\p{P}\p{S}]/u,AE=He(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Xo).getRegex(),uv=/(?!~)[\p{P}\p{S}]/u,RE=/(?!~)[\s\p{P}\p{S}]/u,zE=/(?:[^\s\p{P}\p{S}]|~)/u,DE=He(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",pE?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),dv=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,OE=He(dv,"u").replace(/punct/g,Il).getRegex(),LE=He(dv,"u").replace(/punct/g,uv).getRegex(),hv="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",qE=He(hv,"gu").replace(/notPunctSpace/g,kh).replace(/punctSpace/g,Xo).replace(/punct/g,Il).getRegex(),ME=He(hv,"gu").replace(/notPunctSpace/g,zE).replace(/punctSpace/g,RE).replace(/punct/g,uv).getRegex(),BE=He("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,kh).replace(/punctSpace/g,Xo).replace(/punct/g,Il).getRegex(),IE=He(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Il).getRegex(),UE="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",$E=He(UE,"gu").replace(/notPunctSpace/g,kh).replace(/punctSpace/g,Xo).replace(/punct/g,Il).getRegex(),HE=He(/\\(punct)/,"gu").replace(/punct/g,Il).getRegex(),GE=He(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),PE=He(jh).replace("(?:-->|$)","-->").getRegex(),VE=He("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",PE).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Io=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,YE=He(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Io).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),fv=He(/^!?\[(label)\]\[(ref)\]/).replace("label",Io).replace("ref",Th).getRegex(),pv=He(/^!?\[(ref)\](?:\[\])?/).replace("ref",Th).getRegex(),FE=He("reflink|nolink(?!\\()","g").replace("reflink",fv).replace("nolink",pv).getRegex(),zy=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Eh={_backpedal:Da,anyPunctuation:HE,autolink:GE,blockSkip:DE,br:cv,code:CE,del:Da,delLDelim:Da,delRDelim:Da,emStrongLDelim:OE,emStrongRDelimAst:qE,emStrongRDelimUnd:BE,escape:EE,link:YE,nolink:pv,punctuation:AE,reflink:fv,reflinkSearch:FE,tag:VE,text:NE,url:Da},QE={...Eh,link:He(/^!?\[(label)\]\((.*?)\)/).replace("label",Io).getRegex(),reflink:He(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Io).getRegex()},Fd={...Eh,emStrongRDelimAst:ME,emStrongLDelim:LE,delLDelim:IE,delRDelim:$E,url:He(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",zy).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:He(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",zy).getRegex()},KE={...Fd,br:He(cv).replace("{2,}","*").getRegex(),text:He(Fd.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},To={normal:wh,gfm:wE,pedantic:kE},Mr={normal:Eh,gfm:Fd,breaks:KE,pedantic:QE},XE={"&":"&","<":"<",">":">",'"':""","'":"'"},Dy=s=>XE[s];function ns(s,n){if(n){if(Vt.escapeTest.test(s))return s.replace(Vt.escapeReplace,Dy)}else if(Vt.escapeTestNoEncode.test(s))return s.replace(Vt.escapeReplaceNoEncode,Dy);return s}function Oy(s){try{s=encodeURI(s).replace(Vt.percentDecode,"%")}catch{return null}return s}function Ly(s,n){let r=s.replace(Vt.findPipe,(d,f,y)=>{let g=!1,m=f;for(;--m>=0&&y[m]==="\\";)g=!g;return g?"|":" |"}),o=r.split(Vt.splitPipe),c=0;if(o[0].trim()||o.shift(),o.length>0&&!o.at(-1)?.trim()&&o.pop(),n)if(o.length>n)o.splice(n);else for(;o.length<n;)o.push("");for(;c<o.length;c++)o[c]=o[c].trim().replace(Vt.slashPipe,"|");return o}function Br(s,n,r){let o=s.length;if(o===0)return"";let c=0;for(;c<o&&s.charAt(o-c-1)===n;)c++;return s.slice(0,o-c)}function ZE(s,n){if(s.indexOf(n[1])===-1)return-1;let r=0;for(let o=0;o<s.length;o++)if(s[o]==="\\")o++;else if(s[o]===n[0])r++;else if(s[o]===n[1]&&(r--,r<0))return o;return r>0?-2:-1}function JE(s,n=0){let r=n,o="";for(let c of s)if(c===" "){let d=4-r%4;o+=" ".repeat(d),r+=d}else o+=c,r++;return o}function qy(s,n,r,o,c){let d=n.href,f=n.title||null,y=s[1].replace(c.other.outputLinkReplace,"$1");o.state.inLink=!0;let g={type:s[0].charAt(0)==="!"?"image":"link",raw:r,href:d,title:f,text:y,tokens:o.inlineTokens(y)};return o.state.inLink=!1,g}function WE(s,n,r){let o=s.match(r.other.indentCodeCompensation);if(o===null)return n;let c=o[1];return n.split(`
|
|
14
|
-
`).map(d=>{let f=d.match(r.other.beginningSpace);if(f===null)return d;let[y]=f;return y.length>=c.length?d.slice(c.length):d}).join(`
|
|
15
|
-
`)}var Uo=class{options;rules;lexer;constructor(s){this.options=s||Ha}space(s){let n=this.rules.block.newline.exec(s);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(s){let n=this.rules.block.code.exec(s);if(n){let r=n[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Br(r,`
|
|
16
|
-
`)}}}fences(s){let n=this.rules.block.fences.exec(s);if(n){let r=n[0],o=WE(r,n[3]||"",this.rules);return{type:"code",raw:r,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:o}}}heading(s){let n=this.rules.block.heading.exec(s);if(n){let r=n[2].trim();if(this.rules.other.endingHash.test(r)){let o=Br(r,"#");(this.options.pedantic||!o||this.rules.other.endingSpaceChar.test(o))&&(r=o.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(s){let n=this.rules.block.hr.exec(s);if(n)return{type:"hr",raw:Br(n[0],`
|
|
17
|
-
`)}}blockquote(s){let n=this.rules.block.blockquote.exec(s);if(n){let r=Br(n[0],`
|
|
18
|
-
`).split(`
|
|
19
|
-
`),o="",c="",d=[];for(;r.length>0;){let f=!1,y=[],g;for(g=0;g<r.length;g++)if(this.rules.other.blockquoteStart.test(r[g]))y.push(r[g]),f=!0;else if(!f)y.push(r[g]);else break;r=r.slice(g);let m=y.join(`
|
|
20
|
-
`),x=m.replace(this.rules.other.blockquoteSetextReplace,`
|
|
21
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");o=o?`${o}
|
|
22
|
-
${m}`:m,c=c?`${c}
|
|
23
|
-
${x}`:x;let S=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(x,d,!0),this.lexer.state.top=S,r.length===0)break;let v=d.at(-1);if(v?.type==="code")break;if(v?.type==="blockquote"){let T=v,w=T.raw+`
|
|
24
|
-
`+r.join(`
|
|
25
|
-
`),k=this.blockquote(w);d[d.length-1]=k,o=o.substring(0,o.length-T.raw.length)+k.raw,c=c.substring(0,c.length-T.text.length)+k.text;break}else if(v?.type==="list"){let T=v,w=T.raw+`
|
|
26
|
-
`+r.join(`
|
|
27
|
-
`),k=this.list(w);d[d.length-1]=k,o=o.substring(0,o.length-v.raw.length)+k.raw,c=c.substring(0,c.length-T.raw.length)+k.raw,r=w.substring(d.at(-1).raw.length).split(`
|
|
28
|
-
`);continue}}return{type:"blockquote",raw:o,tokens:d,text:c}}}list(s){let n=this.rules.block.list.exec(s);if(n){let r=n[1].trim(),o=r.length>1,c={type:"list",raw:"",ordered:o,start:o?+r.slice(0,-1):"",loose:!1,items:[]};r=o?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=o?r:"[*+-]");let d=this.rules.other.listItemRegex(r),f=!1;for(;s;){let g=!1,m="",x="";if(!(n=d.exec(s))||this.rules.block.hr.test(s))break;m=n[0],s=s.substring(m.length);let S=JE(n[2].split(`
|
|
29
|
-
`,1)[0],n[1].length),v=s.split(`
|
|
30
|
-
`,1)[0],T=!S.trim(),w=0;if(this.options.pedantic?(w=2,x=S.trimStart()):T?w=n[1].length+1:(w=S.search(this.rules.other.nonSpaceChar),w=w>4?1:w,x=S.slice(w),w+=n[1].length),T&&this.rules.other.blankLine.test(v)&&(m+=v+`
|
|
31
|
-
`,s=s.substring(v.length+1),g=!0),!g){let k=this.rules.other.nextBulletRegex(w),C=this.rules.other.hrRegex(w),j=this.rules.other.fencesBeginRegex(w),R=this.rules.other.headingBeginRegex(w),L=this.rules.other.htmlBeginRegex(w),N=this.rules.other.blockquoteBeginRegex(w);for(;s;){let M=s.split(`
|
|
32
|
-
`,1)[0],A;if(v=M,this.options.pedantic?(v=v.replace(this.rules.other.listReplaceNesting," "),A=v):A=v.replace(this.rules.other.tabCharGlobal," "),j.test(v)||R.test(v)||L.test(v)||N.test(v)||k.test(v)||C.test(v))break;if(A.search(this.rules.other.nonSpaceChar)>=w||!v.trim())x+=`
|
|
33
|
-
`+A.slice(w);else{if(T||S.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||j.test(S)||R.test(S)||C.test(S))break;x+=`
|
|
34
|
-
`+v}T=!v.trim(),m+=M+`
|
|
35
|
-
`,s=s.substring(M.length+1),S=A.slice(w)}}c.loose||(f?c.loose=!0:this.rules.other.doubleBlankLine.test(m)&&(f=!0)),c.items.push({type:"list_item",raw:m,task:!!this.options.gfm&&this.rules.other.listIsTask.test(x),loose:!1,text:x,tokens:[]}),c.raw+=m}let y=c.items.at(-1);if(y)y.raw=y.raw.trimEnd(),y.text=y.text.trimEnd();else return;c.raw=c.raw.trimEnd();for(let g of c.items){if(this.lexer.state.top=!1,g.tokens=this.lexer.blockTokens(g.text,[]),g.task){if(g.text=g.text.replace(this.rules.other.listReplaceTask,""),g.tokens[0]?.type==="text"||g.tokens[0]?.type==="paragraph"){g.tokens[0].raw=g.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),g.tokens[0].text=g.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let x=this.lexer.inlineQueue.length-1;x>=0;x--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[x].src)){this.lexer.inlineQueue[x].src=this.lexer.inlineQueue[x].src.replace(this.rules.other.listReplaceTask,"");break}}let m=this.rules.other.listTaskCheckbox.exec(g.raw);if(m){let x={type:"checkbox",raw:m[0]+" ",checked:m[0]!=="[ ]"};g.checked=x.checked,c.loose?g.tokens[0]&&["paragraph","text"].includes(g.tokens[0].type)&&"tokens"in g.tokens[0]&&g.tokens[0].tokens?(g.tokens[0].raw=x.raw+g.tokens[0].raw,g.tokens[0].text=x.raw+g.tokens[0].text,g.tokens[0].tokens.unshift(x)):g.tokens.unshift({type:"paragraph",raw:x.raw,text:x.raw,tokens:[x]}):g.tokens.unshift(x)}}if(!c.loose){let m=g.tokens.filter(S=>S.type==="space"),x=m.length>0&&m.some(S=>this.rules.other.anyLine.test(S.raw));c.loose=x}}if(c.loose)for(let g of c.items){g.loose=!0;for(let m of g.tokens)m.type==="text"&&(m.type="paragraph")}return c}}html(s){let n=this.rules.block.html.exec(s);if(n)return{type:"html",block:!0,raw:n[0],pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:n[0]}}def(s){let n=this.rules.block.def.exec(s);if(n){let r=n[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),o=n[2]?n[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",c=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:r,raw:n[0],href:o,title:c}}}table(s){let n=this.rules.block.table.exec(s);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;let r=Ly(n[1]),o=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),c=n[3]?.trim()?n[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
36
|
-
`):[],d={type:"table",raw:n[0],header:[],align:[],rows:[]};if(r.length===o.length){for(let f of o)this.rules.other.tableAlignRight.test(f)?d.align.push("right"):this.rules.other.tableAlignCenter.test(f)?d.align.push("center"):this.rules.other.tableAlignLeft.test(f)?d.align.push("left"):d.align.push(null);for(let f=0;f<r.length;f++)d.header.push({text:r[f],tokens:this.lexer.inline(r[f]),header:!0,align:d.align[f]});for(let f of c)d.rows.push(Ly(f,d.header.length).map((y,g)=>({text:y,tokens:this.lexer.inline(y),header:!1,align:d.align[g]})));return d}}lheading(s){let n=this.rules.block.lheading.exec(s);if(n){let r=n[1].trim();return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:r,tokens:this.lexer.inline(r)}}}paragraph(s){let n=this.rules.block.paragraph.exec(s);if(n){let r=n[1].charAt(n[1].length-1)===`
|
|
37
|
-
`?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:r,tokens:this.lexer.inline(r)}}}text(s){let n=this.rules.block.text.exec(s);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(s){let n=this.rules.inline.escape.exec(s);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(s){let n=this.rules.inline.tag.exec(s);if(n)return!this.lexer.state.inLink&&this.rules.other.startATag.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(s){let n=this.rules.inline.link.exec(s);if(n){let r=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let d=Br(r.slice(0,-1),"\\");if((r.length-d.length)%2===0)return}else{let d=ZE(n[2],"()");if(d===-2)return;if(d>-1){let f=(n[0].indexOf("!")===0?5:4)+n[1].length+d;n[2]=n[2].substring(0,d),n[0]=n[0].substring(0,f).trim(),n[3]=""}}let o=n[2],c="";if(this.options.pedantic){let d=this.rules.other.pedanticHrefTitle.exec(o);d&&(o=d[1],c=d[3])}else c=n[3]?n[3].slice(1,-1):"";return o=o.trim(),this.rules.other.startAngleBracket.test(o)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?o=o.slice(1):o=o.slice(1,-1)),qy(n,{href:o&&o.replace(this.rules.inline.anyPunctuation,"$1"),title:c&&c.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(s,n){let r;if((r=this.rules.inline.reflink.exec(s))||(r=this.rules.inline.nolink.exec(s))){let o=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),c=n[o.toLowerCase()];if(!c){let d=r[0].charAt(0);return{type:"text",raw:d,text:d}}return qy(r,c,r[0],this.lexer,this.rules)}}emStrong(s,n,r=""){let o=this.rules.inline.emStrongLDelim.exec(s);if(!(!o||!o[1]&&!o[2]&&!o[3]&&!o[4]||o[4]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(o[1]||o[3])||!r||this.rules.inline.punctuation.exec(r))){let c=[...o[0]].length-1,d,f,y=c,g=0,m=o[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(m.lastIndex=0,n=n.slice(-1*s.length+c);(o=m.exec(n))!==null;){if(d=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!d)continue;if(f=[...d].length,o[3]||o[4]){y+=f;continue}else if((o[5]||o[6])&&c%3&&!((c+f)%3)){g+=f;continue}if(y-=f,y>0)continue;f=Math.min(f,f+y+g);let x=[...o[0]][0].length,S=s.slice(0,c+o.index+x+f);if(Math.min(c,f)%2){let T=S.slice(1,-1);return{type:"em",raw:S,text:T,tokens:this.lexer.inlineTokens(T)}}let v=S.slice(2,-2);return{type:"strong",raw:S,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(s){let n=this.rules.inline.code.exec(s);if(n){let r=n[2].replace(this.rules.other.newLineCharGlobal," "),o=this.rules.other.nonSpaceChar.test(r),c=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return o&&c&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:n[0],text:r}}}br(s){let n=this.rules.inline.br.exec(s);if(n)return{type:"br",raw:n[0]}}del(s,n,r=""){let o=this.rules.inline.delLDelim.exec(s);if(o&&(!o[1]||!r||this.rules.inline.punctuation.exec(r))){let c=[...o[0]].length-1,d,f,y=c,g=this.rules.inline.delRDelim;for(g.lastIndex=0,n=n.slice(-1*s.length+c);(o=g.exec(n))!==null;){if(d=o[1]||o[2]||o[3]||o[4]||o[5]||o[6],!d||(f=[...d].length,f!==c))continue;if(o[3]||o[4]){y+=f;continue}if(y-=f,y>0)continue;f=Math.min(f,f+y);let m=[...o[0]][0].length,x=s.slice(0,c+o.index+m+f),S=x.slice(c,-c);return{type:"del",raw:x,text:S,tokens:this.lexer.inlineTokens(S)}}}}autolink(s){let n=this.rules.inline.autolink.exec(s);if(n){let r,o;return n[2]==="@"?(r=n[1],o="mailto:"+r):(r=n[1],o=r),{type:"link",raw:n[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}url(s){let n;if(n=this.rules.inline.url.exec(s)){let r,o;if(n[2]==="@")r=n[0],o="mailto:"+r;else{let c;do c=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])?.[0]??"";while(c!==n[0]);r=n[0],n[1]==="www."?o="http://"+n[0]:o=n[0]}return{type:"link",raw:n[0],text:r,href:o,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(s){let n=this.rules.inline.text.exec(s);if(n){let r=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:n[0],escaped:r}}}},Hn=class Qd{tokens;options;state;inlineQueue;tokenizer;constructor(n){this.tokens=[],this.tokens.links=Object.create(null),this.options=n||Ha,this.options.tokenizer=this.options.tokenizer||new Uo,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let r={other:Vt,block:To.normal,inline:Mr.normal};this.options.pedantic?(r.block=To.pedantic,r.inline=Mr.pedantic):this.options.gfm&&(r.block=To.gfm,this.options.breaks?r.inline=Mr.breaks:r.inline=Mr.gfm),this.tokenizer.rules=r}static get rules(){return{block:To,inline:Mr}}static lex(n,r){return new Qd(r).lex(n)}static lexInline(n,r){return new Qd(r).inlineTokens(n)}lex(n){n=n.replace(Vt.carriageReturn,`
|
|
38
|
-
`),this.blockTokens(n,this.tokens);for(let r=0;r<this.inlineQueue.length;r++){let o=this.inlineQueue[r];this.inlineTokens(o.src,o.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(n,r=[],o=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(n=n.replace(Vt.tabCharGlobal," ").replace(Vt.spaceLine,""));n;){let c;if(this.options.extensions?.block?.some(f=>(c=f.call({lexer:this},n,r))?(n=n.substring(c.raw.length),r.push(c),!0):!1))continue;if(c=this.tokenizer.space(n)){n=n.substring(c.raw.length);let f=r.at(-1);c.raw.length===1&&f!==void 0?f.raw+=`
|
|
39
|
-
`:r.push(c);continue}if(c=this.tokenizer.code(n)){n=n.substring(c.raw.length);let f=r.at(-1);f?.type==="paragraph"||f?.type==="text"?(f.raw+=(f.raw.endsWith(`
|
|
40
|
-
`)?"":`
|
|
41
|
-
`)+c.raw,f.text+=`
|
|
42
|
-
`+c.text,this.inlineQueue.at(-1).src=f.text):r.push(c);continue}if(c=this.tokenizer.fences(n)){n=n.substring(c.raw.length),r.push(c);continue}if(c=this.tokenizer.heading(n)){n=n.substring(c.raw.length),r.push(c);continue}if(c=this.tokenizer.hr(n)){n=n.substring(c.raw.length),r.push(c);continue}if(c=this.tokenizer.blockquote(n)){n=n.substring(c.raw.length),r.push(c);continue}if(c=this.tokenizer.list(n)){n=n.substring(c.raw.length),r.push(c);continue}if(c=this.tokenizer.html(n)){n=n.substring(c.raw.length),r.push(c);continue}if(c=this.tokenizer.def(n)){n=n.substring(c.raw.length);let f=r.at(-1);f?.type==="paragraph"||f?.type==="text"?(f.raw+=(f.raw.endsWith(`
|
|
43
|
-
`)?"":`
|
|
44
|
-
`)+c.raw,f.text+=`
|
|
45
|
-
`+c.raw,this.inlineQueue.at(-1).src=f.text):this.tokens.links[c.tag]||(this.tokens.links[c.tag]={href:c.href,title:c.title},r.push(c));continue}if(c=this.tokenizer.table(n)){n=n.substring(c.raw.length),r.push(c);continue}if(c=this.tokenizer.lheading(n)){n=n.substring(c.raw.length),r.push(c);continue}let d=n;if(this.options.extensions?.startBlock){let f=1/0,y=n.slice(1),g;this.options.extensions.startBlock.forEach(m=>{g=m.call({lexer:this},y),typeof g=="number"&&g>=0&&(f=Math.min(f,g))}),f<1/0&&f>=0&&(d=n.substring(0,f+1))}if(this.state.top&&(c=this.tokenizer.paragraph(d))){let f=r.at(-1);o&&f?.type==="paragraph"?(f.raw+=(f.raw.endsWith(`
|
|
46
|
-
`)?"":`
|
|
47
|
-
`)+c.raw,f.text+=`
|
|
48
|
-
`+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=f.text):r.push(c),o=d.length!==n.length,n=n.substring(c.raw.length);continue}if(c=this.tokenizer.text(n)){n=n.substring(c.raw.length);let f=r.at(-1);f?.type==="text"?(f.raw+=(f.raw.endsWith(`
|
|
49
|
-
`)?"":`
|
|
50
|
-
`)+c.raw,f.text+=`
|
|
51
|
-
`+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=f.text):r.push(c);continue}if(n){let f="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(f);break}else throw new Error(f)}}return this.state.top=!0,r}inline(n,r=[]){return this.inlineQueue.push({src:n,tokens:r}),r}inlineTokens(n,r=[]){this.tokenizer.lexer=this;let o=n,c=null;if(this.tokens.links){let g=Object.keys(this.tokens.links);if(g.length>0)for(;(c=this.tokenizer.rules.inline.reflinkSearch.exec(o))!==null;)g.includes(c[0].slice(c[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,c.index)+"["+"a".repeat(c[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(c=this.tokenizer.rules.inline.anyPunctuation.exec(o))!==null;)o=o.slice(0,c.index)+"++"+o.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let d;for(;(c=this.tokenizer.rules.inline.blockSkip.exec(o))!==null;)d=c[2]?c[2].length:0,o=o.slice(0,c.index+d)+"["+"a".repeat(c[0].length-d-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);o=this.options.hooks?.emStrongMask?.call({lexer:this},o)??o;let f=!1,y="";for(;n;){f||(y=""),f=!1;let g;if(this.options.extensions?.inline?.some(x=>(g=x.call({lexer:this},n,r))?(n=n.substring(g.raw.length),r.push(g),!0):!1))continue;if(g=this.tokenizer.escape(n)){n=n.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.tag(n)){n=n.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.link(n)){n=n.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(g.raw.length);let x=r.at(-1);g.type==="text"&&x?.type==="text"?(x.raw+=g.raw,x.text+=g.text):r.push(g);continue}if(g=this.tokenizer.emStrong(n,o,y)){n=n.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.codespan(n)){n=n.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.br(n)){n=n.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.del(n,o,y)){n=n.substring(g.raw.length),r.push(g);continue}if(g=this.tokenizer.autolink(n)){n=n.substring(g.raw.length),r.push(g);continue}if(!this.state.inLink&&(g=this.tokenizer.url(n))){n=n.substring(g.raw.length),r.push(g);continue}let m=n;if(this.options.extensions?.startInline){let x=1/0,S=n.slice(1),v;this.options.extensions.startInline.forEach(T=>{v=T.call({lexer:this},S),typeof v=="number"&&v>=0&&(x=Math.min(x,v))}),x<1/0&&x>=0&&(m=n.substring(0,x+1))}if(g=this.tokenizer.inlineText(m)){n=n.substring(g.raw.length),g.raw.slice(-1)!=="_"&&(y=g.raw.slice(-1)),f=!0;let x=r.at(-1);x?.type==="text"?(x.raw+=g.raw,x.text+=g.text):r.push(g);continue}if(n){let x="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return r}},$o=class{options;parser;constructor(s){this.options=s||Ha}space(s){return""}code({text:s,lang:n,escaped:r}){let o=(n||"").match(Vt.notSpaceStart)?.[0],c=s.replace(Vt.endingNewline,"")+`
|
|
52
|
-
`;return o?'<pre><code class="language-'+ns(o)+'">'+(r?c:ns(c,!0))+`</code></pre>
|
|
53
|
-
`:"<pre><code>"+(r?c:ns(c,!0))+`</code></pre>
|
|
54
|
-
`}blockquote({tokens:s}){return`<blockquote>
|
|
55
|
-
${this.parser.parse(s)}</blockquote>
|
|
56
|
-
`}html({text:s}){return s}def(s){return""}heading({tokens:s,depth:n}){return`<h${n}>${this.parser.parseInline(s)}</h${n}>
|
|
57
|
-
`}hr(s){return`<hr>
|
|
58
|
-
`}list(s){let n=s.ordered,r=s.start,o="";for(let f=0;f<s.items.length;f++){let y=s.items[f];o+=this.listitem(y)}let c=n?"ol":"ul",d=n&&r!==1?' start="'+r+'"':"";return"<"+c+d+`>
|
|
59
|
-
`+o+"</"+c+`>
|
|
60
|
-
`}listitem(s){return`<li>${this.parser.parse(s.tokens)}</li>
|
|
61
|
-
`}checkbox({checked:s}){return"<input "+(s?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:s}){return`<p>${this.parser.parseInline(s)}</p>
|
|
62
|
-
`}table(s){let n="",r="";for(let c=0;c<s.header.length;c++)r+=this.tablecell(s.header[c]);n+=this.tablerow({text:r});let o="";for(let c=0;c<s.rows.length;c++){let d=s.rows[c];r="";for(let f=0;f<d.length;f++)r+=this.tablecell(d[f]);o+=this.tablerow({text:r})}return o&&(o=`<tbody>${o}</tbody>`),`<table>
|
|
63
|
-
<thead>
|
|
64
|
-
`+n+`</thead>
|
|
65
|
-
`+o+`</table>
|
|
66
|
-
`}tablerow({text:s}){return`<tr>
|
|
67
|
-
${s}</tr>
|
|
68
|
-
`}tablecell(s){let n=this.parser.parseInline(s.tokens),r=s.header?"th":"td";return(s.align?`<${r} align="${s.align}">`:`<${r}>`)+n+`</${r}>
|
|
69
|
-
`}strong({tokens:s}){return`<strong>${this.parser.parseInline(s)}</strong>`}em({tokens:s}){return`<em>${this.parser.parseInline(s)}</em>`}codespan({text:s}){return`<code>${ns(s,!0)}</code>`}br(s){return"<br>"}del({tokens:s}){return`<del>${this.parser.parseInline(s)}</del>`}link({href:s,title:n,tokens:r}){let o=this.parser.parseInline(r),c=Oy(s);if(c===null)return o;s=c;let d='<a href="'+s+'"';return n&&(d+=' title="'+ns(n)+'"'),d+=">"+o+"</a>",d}image({href:s,title:n,text:r,tokens:o}){o&&(r=this.parser.parseInline(o,this.parser.textRenderer));let c=Oy(s);if(c===null)return ns(r);s=c;let d=`<img src="${s}" alt="${ns(r)}"`;return n&&(d+=` title="${ns(n)}"`),d+=">",d}text(s){return"tokens"in s&&s.tokens?this.parser.parseInline(s.tokens):"escaped"in s&&s.escaped?s.text:ns(s.text)}},Ch=class{strong({text:s}){return s}em({text:s}){return s}codespan({text:s}){return s}del({text:s}){return s}html({text:s}){return s}text({text:s}){return s}link({text:s}){return""+s}image({text:s}){return""+s}br(){return""}checkbox({raw:s}){return s}},Gn=class Kd{options;renderer;textRenderer;constructor(n){this.options=n||Ha,this.options.renderer=this.options.renderer||new $o,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ch}static parse(n,r){return new Kd(r).parse(n)}static parseInline(n,r){return new Kd(r).parseInline(n)}parse(n){this.renderer.parser=this;let r="";for(let o=0;o<n.length;o++){let c=n[o];if(this.options.extensions?.renderers?.[c.type]){let f=c,y=this.options.extensions.renderers[f.type].call({parser:this},f);if(y!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(f.type)){r+=y||"";continue}}let d=c;switch(d.type){case"space":{r+=this.renderer.space(d);break}case"hr":{r+=this.renderer.hr(d);break}case"heading":{r+=this.renderer.heading(d);break}case"code":{r+=this.renderer.code(d);break}case"table":{r+=this.renderer.table(d);break}case"blockquote":{r+=this.renderer.blockquote(d);break}case"list":{r+=this.renderer.list(d);break}case"checkbox":{r+=this.renderer.checkbox(d);break}case"html":{r+=this.renderer.html(d);break}case"def":{r+=this.renderer.def(d);break}case"paragraph":{r+=this.renderer.paragraph(d);break}case"text":{r+=this.renderer.text(d);break}default:{let f='Token with "'+d.type+'" type was not found.';if(this.options.silent)return console.error(f),"";throw new Error(f)}}}return r}parseInline(n,r=this.renderer){this.renderer.parser=this;let o="";for(let c=0;c<n.length;c++){let d=n[c];if(this.options.extensions?.renderers?.[d.type]){let y=this.options.extensions.renderers[d.type].call({parser:this},d);if(y!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(d.type)){o+=y||"";continue}}let f=d;switch(f.type){case"escape":{o+=r.text(f);break}case"html":{o+=r.html(f);break}case"link":{o+=r.link(f);break}case"image":{o+=r.image(f);break}case"checkbox":{o+=r.checkbox(f);break}case"strong":{o+=r.strong(f);break}case"em":{o+=r.em(f);break}case"codespan":{o+=r.codespan(f);break}case"br":{o+=r.br(f);break}case"del":{o+=r.del(f);break}case"text":{o+=r.text(f);break}default:{let y='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(y),"";throw new Error(y)}}}return o}},Gr=class{options;block;constructor(s){this.options=s||Ha}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(s){return s}postprocess(s){return s}processAllTokens(s){return s}emStrongMask(s){return s}provideLexer(s=this.block){return s?Hn.lex:Hn.lexInline}provideParser(s=this.block){return s?Gn.parse:Gn.parseInline}},gv=class{defaults=bh();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Gn;Renderer=$o;TextRenderer=Ch;Lexer=Hn;Tokenizer=Uo;Hooks=Gr;constructor(...s){this.use(...s)}walkTokens(s,n){let r=[];for(let o of s)switch(r=r.concat(n.call(this,o)),o.type){case"table":{let c=o;for(let d of c.header)r=r.concat(this.walkTokens(d.tokens,n));for(let d of c.rows)for(let f of d)r=r.concat(this.walkTokens(f.tokens,n));break}case"list":{let c=o;r=r.concat(this.walkTokens(c.items,n));break}default:{let c=o;this.defaults.extensions?.childTokens?.[c.type]?this.defaults.extensions.childTokens[c.type].forEach(d=>{let f=c[d].flat(1/0);r=r.concat(this.walkTokens(f,n))}):c.tokens&&(r=r.concat(this.walkTokens(c.tokens,n)))}}return r}use(...s){let n=this.defaults.extensions||{renderers:{},childTokens:{}};return s.forEach(r=>{let o={...r};if(o.async=this.defaults.async||o.async||!1,r.extensions&&(r.extensions.forEach(c=>{if(!c.name)throw new Error("extension name required");if("renderer"in c){let d=n.renderers[c.name];d?n.renderers[c.name]=function(...f){let y=c.renderer.apply(this,f);return y===!1&&(y=d.apply(this,f)),y}:n.renderers[c.name]=c.renderer}if("tokenizer"in c){if(!c.level||c.level!=="block"&&c.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let d=n[c.level];d?d.unshift(c.tokenizer):n[c.level]=[c.tokenizer],c.start&&(c.level==="block"?n.startBlock?n.startBlock.push(c.start):n.startBlock=[c.start]:c.level==="inline"&&(n.startInline?n.startInline.push(c.start):n.startInline=[c.start]))}"childTokens"in c&&c.childTokens&&(n.childTokens[c.name]=c.childTokens)}),o.extensions=n),r.renderer){let c=this.defaults.renderer||new $o(this.defaults);for(let d in r.renderer){if(!(d in c))throw new Error(`renderer '${d}' does not exist`);if(["options","parser"].includes(d))continue;let f=d,y=r.renderer[f],g=c[f];c[f]=(...m)=>{let x=y.apply(c,m);return x===!1&&(x=g.apply(c,m)),x||""}}o.renderer=c}if(r.tokenizer){let c=this.defaults.tokenizer||new Uo(this.defaults);for(let d in r.tokenizer){if(!(d in c))throw new Error(`tokenizer '${d}' does not exist`);if(["options","rules","lexer"].includes(d))continue;let f=d,y=r.tokenizer[f],g=c[f];c[f]=(...m)=>{let x=y.apply(c,m);return x===!1&&(x=g.apply(c,m)),x}}o.tokenizer=c}if(r.hooks){let c=this.defaults.hooks||new Gr;for(let d in r.hooks){if(!(d in c))throw new Error(`hook '${d}' does not exist`);if(["options","block"].includes(d))continue;let f=d,y=r.hooks[f],g=c[f];Gr.passThroughHooks.has(d)?c[f]=m=>{if(this.defaults.async&&Gr.passThroughHooksRespectAsync.has(d))return(async()=>{let S=await y.call(c,m);return g.call(c,S)})();let x=y.call(c,m);return g.call(c,x)}:c[f]=(...m)=>{if(this.defaults.async)return(async()=>{let S=await y.apply(c,m);return S===!1&&(S=await g.apply(c,m)),S})();let x=y.apply(c,m);return x===!1&&(x=g.apply(c,m)),x}}o.hooks=c}if(r.walkTokens){let c=this.defaults.walkTokens,d=r.walkTokens;o.walkTokens=function(f){let y=[];return y.push(d.call(this,f)),c&&(y=y.concat(c.call(this,f))),y}}this.defaults={...this.defaults,...o}}),this}setOptions(s){return this.defaults={...this.defaults,...s},this}lexer(s,n){return Hn.lex(s,n??this.defaults)}parser(s,n){return Gn.parse(s,n??this.defaults)}parseMarkdown(s){return(n,r)=>{let o={...r},c={...this.defaults,...o},d=this.onError(!!c.silent,!!c.async);if(this.defaults.async===!0&&o.async===!1)return d(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return d(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return d(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(c.hooks&&(c.hooks.options=c,c.hooks.block=s),c.async)return(async()=>{let f=c.hooks?await c.hooks.preprocess(n):n,y=await(c.hooks?await c.hooks.provideLexer(s):s?Hn.lex:Hn.lexInline)(f,c),g=c.hooks?await c.hooks.processAllTokens(y):y;c.walkTokens&&await Promise.all(this.walkTokens(g,c.walkTokens));let m=await(c.hooks?await c.hooks.provideParser(s):s?Gn.parse:Gn.parseInline)(g,c);return c.hooks?await c.hooks.postprocess(m):m})().catch(d);try{c.hooks&&(n=c.hooks.preprocess(n));let f=(c.hooks?c.hooks.provideLexer(s):s?Hn.lex:Hn.lexInline)(n,c);c.hooks&&(f=c.hooks.processAllTokens(f)),c.walkTokens&&this.walkTokens(f,c.walkTokens);let y=(c.hooks?c.hooks.provideParser(s):s?Gn.parse:Gn.parseInline)(f,c);return c.hooks&&(y=c.hooks.postprocess(y)),y}catch(f){return d(f)}}}onError(s,n){return r=>{if(r.message+=`
|
|
70
|
-
Please report this to https://github.com/markedjs/marked.`,s){let o="<p>An error occurred:</p><pre>"+ns(r.message+"",!0)+"</pre>";return n?Promise.resolve(o):o}if(n)return Promise.reject(r);throw r}}},Ia=new gv;function et(s,n){return Ia.parse(s,n)}et.options=et.setOptions=function(s){return Ia.setOptions(s),et.defaults=Ia.defaults,lv(et.defaults),et};et.getDefaults=bh;et.defaults=Ha;et.use=function(...s){return Ia.use(...s),et.defaults=Ia.defaults,lv(et.defaults),et};et.walkTokens=function(s,n){return Ia.walkTokens(s,n)};et.parseInline=Ia.parseInline;et.Parser=Gn;et.parser=Gn.parse;et.Renderer=$o;et.TextRenderer=Ch;et.Lexer=Hn;et.lexer=Hn.lex;et.Tokenizer=Uo;et.Hooks=Gr;et.parse=et;et.options;et.setOptions;et.use;et.walkTokens;et.parseInline;Gn.parse;Hn.lex;var Nl=function(){return Nl=Object.assign||function(s){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var c in n)Object.prototype.hasOwnProperty.call(n,c)&&(s[c]=n[c])}return s},Nl.apply(this,arguments)},eC="~",tC="~~";function Nh(s,n){for(var r={},o={},c=s.split(tC),d=!1,f=0;c.length>f;f++){for(var y=c[f].split(eC),g=0;g<y.length;g+=2){var m=y[g],x=y[g+1],S="&"+m+";";r[S]=x,d&&(r["&"+m]=x),o[x]=S}d=!0}return n?{entities:Nl(Nl({},r),n.entities),characters:Nl(Nl({},o),n.characters)}:{entities:r,characters:o}}var kd={xml:/&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);?/g,html4:/∉|&(?:nbsp|iexcl|cent|pound|curren|yen|brvbar|sect|uml|copy|ordf|laquo|not|shy|reg|macr|deg|plusmn|sup2|sup3|acute|micro|para|middot|cedil|sup1|ordm|raquo|frac14|frac12|frac34|iquest|Agrave|Aacute|Acirc|Atilde|Auml|Aring|AElig|Ccedil|Egrave|Eacute|Ecirc|Euml|Igrave|Iacute|Icirc|Iuml|ETH|Ntilde|Ograve|Oacute|Ocirc|Otilde|Ouml|times|Oslash|Ugrave|Uacute|Ucirc|Uuml|Yacute|THORN|szlig|agrave|aacute|acirc|atilde|auml|aring|aelig|ccedil|egrave|eacute|ecirc|euml|igrave|iacute|icirc|iuml|eth|ntilde|ograve|oacute|ocirc|otilde|ouml|divide|oslash|ugrave|uacute|ucirc|uuml|yacute|thorn|yuml|quot|amp|lt|gt|#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);?/g,html5:/·|℗|⋇|⪧|⩺|⋗|⦕|⩼|⪆|⥸|⋗|⋛|⪌|≷|≳|⪦|⩹|⋖|⋋|⋉|⥶|⩻|⦖|◃|⊴|◂|∉|⋹̸|⋵̸|∉|⋷|⋶|∌|∌|⋾|⋽|∥|⊠|⨱|⨰|&(?:AElig|AMP|Aacute|Acirc|Agrave|Aring|Atilde|Auml|COPY|Ccedil|ETH|Eacute|Ecirc|Egrave|Euml|GT|Iacute|Icirc|Igrave|Iuml|LT|Ntilde|Oacute|Ocirc|Ograve|Oslash|Otilde|Ouml|QUOT|REG|THORN|Uacute|Ucirc|Ugrave|Uuml|Yacute|aacute|acirc|acute|aelig|agrave|amp|aring|atilde|auml|brvbar|ccedil|cedil|cent|copy|curren|deg|divide|eacute|ecirc|egrave|eth|euml|frac12|frac14|frac34|gt|iacute|icirc|iexcl|igrave|iquest|iuml|laquo|lt|macr|micro|middot|nbsp|not|ntilde|oacute|ocirc|ograve|ordf|ordm|oslash|otilde|ouml|para|plusmn|pound|quot|raquo|reg|sect|shy|sup1|sup2|sup3|szlig|thorn|times|uacute|ucirc|ugrave|uml|uuml|yacute|yen|yuml|#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);?/g},zl={};zl.xml=Nh(`lt~<~gt~>~quot~"~apos~'~amp~&`);zl.html4=Nh(`apos~'~OElig~Œ~oelig~œ~Scaron~Š~scaron~š~Yuml~Ÿ~circ~ˆ~tilde~˜~ensp~ ~emsp~ ~thinsp~ ~zwnj~~zwj~~lrm~~rlm~~ndash~–~mdash~—~lsquo~‘~rsquo~’~sbquo~‚~ldquo~“~rdquo~”~bdquo~„~dagger~†~Dagger~‡~permil~‰~lsaquo~‹~rsaquo~›~euro~€~fnof~ƒ~Alpha~Α~Beta~Β~Gamma~Γ~Delta~Δ~Epsilon~Ε~Zeta~Ζ~Eta~Η~Theta~Θ~Iota~Ι~Kappa~Κ~Lambda~Λ~Mu~Μ~Nu~Ν~Xi~Ξ~Omicron~Ο~Pi~Π~Rho~Ρ~Sigma~Σ~Tau~Τ~Upsilon~Υ~Phi~Φ~Chi~Χ~Psi~Ψ~Omega~Ω~alpha~α~beta~β~gamma~γ~delta~δ~epsilon~ε~zeta~ζ~eta~η~theta~θ~iota~ι~kappa~κ~lambda~λ~mu~μ~nu~ν~xi~ξ~omicron~ο~pi~π~rho~ρ~sigmaf~ς~sigma~σ~tau~τ~upsilon~υ~phi~φ~chi~χ~psi~ψ~omega~ω~thetasym~ϑ~upsih~ϒ~piv~ϖ~bull~•~hellip~…~prime~′~Prime~″~oline~‾~frasl~⁄~weierp~℘~image~ℑ~real~ℜ~trade~™~alefsym~ℵ~larr~←~uarr~↑~rarr~→~darr~↓~harr~↔~crarr~↵~lArr~⇐~uArr~⇑~rArr~⇒~dArr~⇓~hArr~⇔~forall~∀~part~∂~exist~∃~empty~∅~nabla~∇~isin~∈~notin~∉~ni~∋~prod~∏~sum~∑~minus~−~lowast~∗~radic~√~prop~∝~infin~∞~ang~∠~and~∧~or~∨~cap~∩~cup~∪~int~∫~there4~∴~sim~∼~cong~≅~asymp~≈~ne~≠~equiv~≡~le~≤~ge~≥~sub~⊂~sup~⊃~nsub~⊄~sube~⊆~supe~⊇~oplus~⊕~otimes~⊗~perp~⊥~sdot~⋅~lceil~⌈~rceil~⌉~lfloor~⌊~rfloor~⌋~lang~〈~rang~〉~loz~◊~spades~♠~clubs~♣~hearts~♥~diams~♦~~nbsp~ ~iexcl~¡~cent~¢~pound~£~curren~¤~yen~¥~brvbar~¦~sect~§~uml~¨~copy~©~ordf~ª~laquo~«~not~¬~shy~~reg~®~macr~¯~deg~°~plusmn~±~sup2~²~sup3~³~acute~´~micro~µ~para~¶~middot~·~cedil~¸~sup1~¹~ordm~º~raquo~»~frac14~¼~frac12~½~frac34~¾~iquest~¿~Agrave~À~Aacute~Á~Acirc~Â~Atilde~Ã~Auml~Ä~Aring~Å~AElig~Æ~Ccedil~Ç~Egrave~È~Eacute~É~Ecirc~Ê~Euml~Ë~Igrave~Ì~Iacute~Í~Icirc~Î~Iuml~Ï~ETH~Ð~Ntilde~Ñ~Ograve~Ò~Oacute~Ó~Ocirc~Ô~Otilde~Õ~Ouml~Ö~times~×~Oslash~Ø~Ugrave~Ù~Uacute~Ú~Ucirc~Û~Uuml~Ü~Yacute~Ý~THORN~Þ~szlig~ß~agrave~à~aacute~á~acirc~â~atilde~ã~auml~ä~aring~å~aelig~æ~ccedil~ç~egrave~è~eacute~é~ecirc~ê~euml~ë~igrave~ì~iacute~í~icirc~î~iuml~ï~eth~ð~ntilde~ñ~ograve~ò~oacute~ó~ocirc~ô~otilde~õ~ouml~ö~divide~÷~oslash~ø~ugrave~ù~uacute~ú~ucirc~û~uuml~ü~yacute~ý~thorn~þ~yuml~ÿ~quot~"~amp~&~lt~<~gt~>`);zl.html5=Nh('Abreve~Ă~Acy~А~Afr~𝔄~Amacr~Ā~And~⩓~Aogon~Ą~Aopf~𝔸~ApplyFunction~~Ascr~𝒜~Assign~≔~Backslash~∖~Barv~⫧~Barwed~⌆~Bcy~Б~Because~∵~Bernoullis~ℬ~Bfr~𝔅~Bopf~𝔹~Breve~˘~Bscr~ℬ~Bumpeq~≎~CHcy~Ч~Cacute~Ć~Cap~⋒~CapitalDifferentialD~ⅅ~Cayleys~ℭ~Ccaron~Č~Ccirc~Ĉ~Cconint~∰~Cdot~Ċ~Cedilla~¸~CenterDot~·~Cfr~ℭ~CircleDot~⊙~CircleMinus~⊖~CirclePlus~⊕~CircleTimes~⊗~ClockwiseContourIntegral~∲~CloseCurlyDoubleQuote~”~CloseCurlyQuote~’~Colon~∷~Colone~⩴~Congruent~≡~Conint~∯~ContourIntegral~∮~Copf~ℂ~Coproduct~∐~CounterClockwiseContourIntegral~∳~Cross~⨯~Cscr~𝒞~Cup~⋓~CupCap~≍~DD~ⅅ~DDotrahd~⤑~DJcy~Ђ~DScy~Ѕ~DZcy~Џ~Darr~↡~Dashv~⫤~Dcaron~Ď~Dcy~Д~Del~∇~Dfr~𝔇~DiacriticalAcute~´~DiacriticalDot~˙~DiacriticalDoubleAcute~˝~DiacriticalGrave~`~DiacriticalTilde~˜~Diamond~⋄~DifferentialD~ⅆ~Dopf~𝔻~Dot~¨~DotDot~⃜~DotEqual~≐~DoubleContourIntegral~∯~DoubleDot~¨~DoubleDownArrow~⇓~DoubleLeftArrow~⇐~DoubleLeftRightArrow~⇔~DoubleLeftTee~⫤~DoubleLongLeftArrow~⟸~DoubleLongLeftRightArrow~⟺~DoubleLongRightArrow~⟹~DoubleRightArrow~⇒~DoubleRightTee~⊨~DoubleUpArrow~⇑~DoubleUpDownArrow~⇕~DoubleVerticalBar~∥~DownArrow~↓~DownArrowBar~⤓~DownArrowUpArrow~⇵~DownBreve~̑~DownLeftRightVector~⥐~DownLeftTeeVector~⥞~DownLeftVector~↽~DownLeftVectorBar~⥖~DownRightTeeVector~⥟~DownRightVector~⇁~DownRightVectorBar~⥗~DownTee~⊤~DownTeeArrow~↧~Downarrow~⇓~Dscr~𝒟~Dstrok~Đ~ENG~Ŋ~Ecaron~Ě~Ecy~Э~Edot~Ė~Efr~𝔈~Element~∈~Emacr~Ē~EmptySmallSquare~◻~EmptyVerySmallSquare~▫~Eogon~Ę~Eopf~𝔼~Equal~⩵~EqualTilde~≂~Equilibrium~⇌~Escr~ℰ~Esim~⩳~Exists~∃~ExponentialE~ⅇ~Fcy~Ф~Ffr~𝔉~FilledSmallSquare~◼~FilledVerySmallSquare~▪~Fopf~𝔽~ForAll~∀~Fouriertrf~ℱ~Fscr~ℱ~GJcy~Ѓ~Gammad~Ϝ~Gbreve~Ğ~Gcedil~Ģ~Gcirc~Ĝ~Gcy~Г~Gdot~Ġ~Gfr~𝔊~Gg~⋙~Gopf~𝔾~GreaterEqual~≥~GreaterEqualLess~⋛~GreaterFullEqual~≧~GreaterGreater~⪢~GreaterLess~≷~GreaterSlantEqual~⩾~GreaterTilde~≳~Gscr~𝒢~Gt~≫~HARDcy~Ъ~Hacek~ˇ~Hat~^~Hcirc~Ĥ~Hfr~ℌ~HilbertSpace~ℋ~Hopf~ℍ~HorizontalLine~─~Hscr~ℋ~Hstrok~Ħ~HumpDownHump~≎~HumpEqual~≏~IEcy~Е~IJlig~IJ~IOcy~Ё~Icy~И~Idot~İ~Ifr~ℑ~Im~ℑ~Imacr~Ī~ImaginaryI~ⅈ~Implies~⇒~Int~∬~Integral~∫~Intersection~⋂~InvisibleComma~~InvisibleTimes~~Iogon~Į~Iopf~𝕀~Iscr~ℐ~Itilde~Ĩ~Iukcy~І~Jcirc~Ĵ~Jcy~Й~Jfr~𝔍~Jopf~𝕁~Jscr~𝒥~Jsercy~Ј~Jukcy~Є~KHcy~Х~KJcy~Ќ~Kcedil~Ķ~Kcy~К~Kfr~𝔎~Kopf~𝕂~Kscr~𝒦~LJcy~Љ~Lacute~Ĺ~Lang~⟪~Laplacetrf~ℒ~Larr~↞~Lcaron~Ľ~Lcedil~Ļ~Lcy~Л~LeftAngleBracket~⟨~LeftArrow~←~LeftArrowBar~⇤~LeftArrowRightArrow~⇆~LeftCeiling~⌈~LeftDoubleBracket~⟦~LeftDownTeeVector~⥡~LeftDownVector~⇃~LeftDownVectorBar~⥙~LeftFloor~⌊~LeftRightArrow~↔~LeftRightVector~⥎~LeftTee~⊣~LeftTeeArrow~↤~LeftTeeVector~⥚~LeftTriangle~⊲~LeftTriangleBar~⧏~LeftTriangleEqual~⊴~LeftUpDownVector~⥑~LeftUpTeeVector~⥠~LeftUpVector~↿~LeftUpVectorBar~⥘~LeftVector~↼~LeftVectorBar~⥒~Leftarrow~⇐~Leftrightarrow~⇔~LessEqualGreater~⋚~LessFullEqual~≦~LessGreater~≶~LessLess~⪡~LessSlantEqual~⩽~LessTilde~≲~Lfr~𝔏~Ll~⋘~Lleftarrow~⇚~Lmidot~Ŀ~LongLeftArrow~⟵~LongLeftRightArrow~⟷~LongRightArrow~⟶~Longleftarrow~⟸~Longleftrightarrow~⟺~Longrightarrow~⟹~Lopf~𝕃~LowerLeftArrow~↙~LowerRightArrow~↘~Lscr~ℒ~Lsh~↰~Lstrok~Ł~Lt~≪~Map~⤅~Mcy~М~MediumSpace~ ~Mellintrf~ℳ~Mfr~𝔐~MinusPlus~∓~Mopf~𝕄~Mscr~ℳ~NJcy~Њ~Nacute~Ń~Ncaron~Ň~Ncedil~Ņ~Ncy~Н~NegativeMediumSpace~~NegativeThickSpace~~NegativeThinSpace~~NegativeVeryThinSpace~~NestedGreaterGreater~≫~NestedLessLess~≪~NewLine~\n~Nfr~𝔑~NoBreak~~NonBreakingSpace~ ~Nopf~ℕ~Not~⫬~NotCongruent~≢~NotCupCap~≭~NotDoubleVerticalBar~∦~NotElement~∉~NotEqual~≠~NotEqualTilde~≂̸~NotExists~∄~NotGreater~≯~NotGreaterEqual~≱~NotGreaterFullEqual~≧̸~NotGreaterGreater~≫̸~NotGreaterLess~≹~NotGreaterSlantEqual~⩾̸~NotGreaterTilde~≵~NotHumpDownHump~≎̸~NotHumpEqual~≏̸~NotLeftTriangle~⋪~NotLeftTriangleBar~⧏̸~NotLeftTriangleEqual~⋬~NotLess~≮~NotLessEqual~≰~NotLessGreater~≸~NotLessLess~≪̸~NotLessSlantEqual~⩽̸~NotLessTilde~≴~NotNestedGreaterGreater~⪢̸~NotNestedLessLess~⪡̸~NotPrecedes~⊀~NotPrecedesEqual~⪯̸~NotPrecedesSlantEqual~⋠~NotReverseElement~∌~NotRightTriangle~⋫~NotRightTriangleBar~⧐̸~NotRightTriangleEqual~⋭~NotSquareSubset~⊏̸~NotSquareSubsetEqual~⋢~NotSquareSuperset~⊐̸~NotSquareSupersetEqual~⋣~NotSubset~⊂⃒~NotSubsetEqual~⊈~NotSucceeds~⊁~NotSucceedsEqual~⪰̸~NotSucceedsSlantEqual~⋡~NotSucceedsTilde~≿̸~NotSuperset~⊃⃒~NotSupersetEqual~⊉~NotTilde~≁~NotTildeEqual~≄~NotTildeFullEqual~≇~NotTildeTilde~≉~NotVerticalBar~∤~Nscr~𝒩~Ocy~О~Odblac~Ő~Ofr~𝔒~Omacr~Ō~Oopf~𝕆~OpenCurlyDoubleQuote~“~OpenCurlyQuote~‘~Or~⩔~Oscr~𝒪~Otimes~⨷~OverBar~‾~OverBrace~⏞~OverBracket~⎴~OverParenthesis~⏜~PartialD~∂~Pcy~П~Pfr~𝔓~PlusMinus~±~Poincareplane~ℌ~Popf~ℙ~Pr~⪻~Precedes~≺~PrecedesEqual~⪯~PrecedesSlantEqual~≼~PrecedesTilde~≾~Product~∏~Proportion~∷~Proportional~∝~Pscr~𝒫~Qfr~𝔔~Qopf~ℚ~Qscr~𝒬~RBarr~⤐~Racute~Ŕ~Rang~⟫~Rarr~↠~Rarrtl~⤖~Rcaron~Ř~Rcedil~Ŗ~Rcy~Р~Re~ℜ~ReverseElement~∋~ReverseEquilibrium~⇋~ReverseUpEquilibrium~⥯~Rfr~ℜ~RightAngleBracket~⟩~RightArrow~→~RightArrowBar~⇥~RightArrowLeftArrow~⇄~RightCeiling~⌉~RightDoubleBracket~⟧~RightDownTeeVector~⥝~RightDownVector~⇂~RightDownVectorBar~⥕~RightFloor~⌋~RightTee~⊢~RightTeeArrow~↦~RightTeeVector~⥛~RightTriangle~⊳~RightTriangleBar~⧐~RightTriangleEqual~⊵~RightUpDownVector~⥏~RightUpTeeVector~⥜~RightUpVector~↾~RightUpVectorBar~⥔~RightVector~⇀~RightVectorBar~⥓~Rightarrow~⇒~Ropf~ℝ~RoundImplies~⥰~Rrightarrow~⇛~Rscr~ℛ~Rsh~↱~RuleDelayed~⧴~SHCHcy~Щ~SHcy~Ш~SOFTcy~Ь~Sacute~Ś~Sc~⪼~Scedil~Ş~Scirc~Ŝ~Scy~С~Sfr~𝔖~ShortDownArrow~↓~ShortLeftArrow~←~ShortRightArrow~→~ShortUpArrow~↑~SmallCircle~∘~Sopf~𝕊~Sqrt~√~Square~□~SquareIntersection~⊓~SquareSubset~⊏~SquareSubsetEqual~⊑~SquareSuperset~⊐~SquareSupersetEqual~⊒~SquareUnion~⊔~Sscr~𝒮~Star~⋆~Sub~⋐~Subset~⋐~SubsetEqual~⊆~Succeeds~≻~SucceedsEqual~⪰~SucceedsSlantEqual~≽~SucceedsTilde~≿~SuchThat~∋~Sum~∑~Sup~⋑~Superset~⊃~SupersetEqual~⊇~Supset~⋑~TRADE~™~TSHcy~Ћ~TScy~Ц~Tab~ ~Tcaron~Ť~Tcedil~Ţ~Tcy~Т~Tfr~𝔗~Therefore~∴~ThickSpace~ ~ThinSpace~ ~Tilde~∼~TildeEqual~≃~TildeFullEqual~≅~TildeTilde~≈~Topf~𝕋~TripleDot~⃛~Tscr~𝒯~Tstrok~Ŧ~Uarr~↟~Uarrocir~⥉~Ubrcy~Ў~Ubreve~Ŭ~Ucy~У~Udblac~Ű~Ufr~𝔘~Umacr~Ū~UnderBar~_~UnderBrace~⏟~UnderBracket~⎵~UnderParenthesis~⏝~Union~⋃~UnionPlus~⊎~Uogon~Ų~Uopf~𝕌~UpArrow~↑~UpArrowBar~⤒~UpArrowDownArrow~⇅~UpDownArrow~↕~UpEquilibrium~⥮~UpTee~⊥~UpTeeArrow~↥~Uparrow~⇑~Updownarrow~⇕~UpperLeftArrow~↖~UpperRightArrow~↗~Upsi~ϒ~Uring~Ů~Uscr~𝒰~Utilde~Ũ~VDash~⊫~Vbar~⫫~Vcy~В~Vdash~⊩~Vdashl~⫦~Vee~⋁~Verbar~‖~Vert~‖~VerticalBar~∣~VerticalLine~|~VerticalSeparator~❘~VerticalTilde~≀~VeryThinSpace~ ~Vfr~𝔙~Vopf~𝕍~Vscr~𝒱~Vvdash~⊪~Wcirc~Ŵ~Wedge~⋀~Wfr~𝔚~Wopf~𝕎~Wscr~𝒲~Xfr~𝔛~Xopf~𝕏~Xscr~𝒳~YAcy~Я~YIcy~Ї~YUcy~Ю~Ycirc~Ŷ~Ycy~Ы~Yfr~𝔜~Yopf~𝕐~Yscr~𝒴~ZHcy~Ж~Zacute~Ź~Zcaron~Ž~Zcy~З~Zdot~Ż~ZeroWidthSpace~~Zfr~ℨ~Zopf~ℤ~Zscr~𝒵~abreve~ă~ac~∾~acE~∾̳~acd~∿~acy~а~af~~afr~𝔞~aleph~ℵ~amacr~ā~amalg~⨿~andand~⩕~andd~⩜~andslope~⩘~andv~⩚~ange~⦤~angle~∠~angmsd~∡~angmsdaa~⦨~angmsdab~⦩~angmsdac~⦪~angmsdad~⦫~angmsdae~⦬~angmsdaf~⦭~angmsdag~⦮~angmsdah~⦯~angrt~∟~angrtvb~⊾~angrtvbd~⦝~angsph~∢~angst~Å~angzarr~⍼~aogon~ą~aopf~𝕒~ap~≈~apE~⩰~apacir~⩯~ape~≊~apid~≋~approx~≈~approxeq~≊~ascr~𝒶~ast~*~asympeq~≍~awconint~∳~awint~⨑~bNot~⫭~backcong~≌~backepsilon~϶~backprime~‵~backsim~∽~backsimeq~⋍~barvee~⊽~barwed~⌅~barwedge~⌅~bbrk~⎵~bbrktbrk~⎶~bcong~≌~bcy~б~becaus~∵~because~∵~bemptyv~⦰~bepsi~϶~bernou~ℬ~beth~ℶ~between~≬~bfr~𝔟~bigcap~⋂~bigcirc~◯~bigcup~⋃~bigodot~⨀~bigoplus~⨁~bigotimes~⨂~bigsqcup~⨆~bigstar~★~bigtriangledown~▽~bigtriangleup~△~biguplus~⨄~bigvee~⋁~bigwedge~⋀~bkarow~⤍~blacklozenge~⧫~blacksquare~▪~blacktriangle~▴~blacktriangledown~▾~blacktriangleleft~◂~blacktriangleright~▸~blank~␣~blk12~▒~blk14~░~blk34~▓~block~█~bne~=⃥~bnequiv~≡⃥~bnot~⌐~bopf~𝕓~bot~⊥~bottom~⊥~bowtie~⋈~boxDL~╗~boxDR~╔~boxDl~╖~boxDr~╓~boxH~═~boxHD~╦~boxHU~╩~boxHd~╤~boxHu~╧~boxUL~╝~boxUR~╚~boxUl~╜~boxUr~╙~boxV~║~boxVH~╬~boxVL~╣~boxVR~╠~boxVh~╫~boxVl~╢~boxVr~╟~boxbox~⧉~boxdL~╕~boxdR~╒~boxdl~┐~boxdr~┌~boxh~─~boxhD~╥~boxhU~╨~boxhd~┬~boxhu~┴~boxminus~⊟~boxplus~⊞~boxtimes~⊠~boxuL~╛~boxuR~╘~boxul~┘~boxur~└~boxv~│~boxvH~╪~boxvL~╡~boxvR~╞~boxvh~┼~boxvl~┤~boxvr~├~bprime~‵~breve~˘~bscr~𝒷~bsemi~⁏~bsim~∽~bsime~⋍~bsol~\\~bsolb~⧅~bsolhsub~⟈~bullet~•~bump~≎~bumpE~⪮~bumpe~≏~bumpeq~≏~cacute~ć~capand~⩄~capbrcup~⩉~capcap~⩋~capcup~⩇~capdot~⩀~caps~∩︀~caret~⁁~caron~ˇ~ccaps~⩍~ccaron~č~ccirc~ĉ~ccups~⩌~ccupssm~⩐~cdot~ċ~cemptyv~⦲~centerdot~·~cfr~𝔠~chcy~ч~check~✓~checkmark~✓~cir~○~cirE~⧃~circeq~≗~circlearrowleft~↺~circlearrowright~↻~circledR~®~circledS~Ⓢ~circledast~⊛~circledcirc~⊚~circleddash~⊝~cire~≗~cirfnint~⨐~cirmid~⫯~cirscir~⧂~clubsuit~♣~colon~:~colone~≔~coloneq~≔~comma~,~commat~@~comp~∁~compfn~∘~complement~∁~complexes~ℂ~congdot~⩭~conint~∮~copf~𝕔~coprod~∐~copysr~℗~cross~✗~cscr~𝒸~csub~⫏~csube~⫑~csup~⫐~csupe~⫒~ctdot~⋯~cudarrl~⤸~cudarrr~⤵~cuepr~⋞~cuesc~⋟~cularr~↶~cularrp~⤽~cupbrcap~⩈~cupcap~⩆~cupcup~⩊~cupdot~⊍~cupor~⩅~cups~∪︀~curarr~↷~curarrm~⤼~curlyeqprec~⋞~curlyeqsucc~⋟~curlyvee~⋎~curlywedge~⋏~curvearrowleft~↶~curvearrowright~↷~cuvee~⋎~cuwed~⋏~cwconint~∲~cwint~∱~cylcty~⌭~dHar~⥥~daleth~ℸ~dash~‐~dashv~⊣~dbkarow~⤏~dblac~˝~dcaron~ď~dcy~д~dd~ⅆ~ddagger~‡~ddarr~⇊~ddotseq~⩷~demptyv~⦱~dfisht~⥿~dfr~𝔡~dharl~⇃~dharr~⇂~diam~⋄~diamond~⋄~diamondsuit~♦~die~¨~digamma~ϝ~disin~⋲~div~÷~divideontimes~⋇~divonx~⋇~djcy~ђ~dlcorn~⌞~dlcrop~⌍~dollar~$~dopf~𝕕~dot~˙~doteq~≐~doteqdot~≑~dotminus~∸~dotplus~∔~dotsquare~⊡~doublebarwedge~⌆~downarrow~↓~downdownarrows~⇊~downharpoonleft~⇃~downharpoonright~⇂~drbkarow~⤐~drcorn~⌟~drcrop~⌌~dscr~𝒹~dscy~ѕ~dsol~⧶~dstrok~đ~dtdot~⋱~dtri~▿~dtrif~▾~duarr~⇵~duhar~⥯~dwangle~⦦~dzcy~џ~dzigrarr~⟿~eDDot~⩷~eDot~≑~easter~⩮~ecaron~ě~ecir~≖~ecolon~≕~ecy~э~edot~ė~ee~ⅇ~efDot~≒~efr~𝔢~eg~⪚~egs~⪖~egsdot~⪘~el~⪙~elinters~⏧~ell~ℓ~els~⪕~elsdot~⪗~emacr~ē~emptyset~∅~emptyv~∅~emsp13~ ~emsp14~ ~eng~ŋ~eogon~ę~eopf~𝕖~epar~⋕~eparsl~⧣~eplus~⩱~epsi~ε~epsiv~ϵ~eqcirc~≖~eqcolon~≕~eqsim~≂~eqslantgtr~⪖~eqslantless~⪕~equals~=~equest~≟~equivDD~⩸~eqvparsl~⧥~erDot~≓~erarr~⥱~escr~ℯ~esdot~≐~esim~≂~excl~!~expectation~ℰ~exponentiale~ⅇ~fallingdotseq~≒~fcy~ф~female~♀~ffilig~ffi~fflig~ff~ffllig~ffl~ffr~𝔣~filig~fi~fjlig~fj~flat~♭~fllig~fl~fltns~▱~fopf~𝕗~fork~⋔~forkv~⫙~fpartint~⨍~frac13~⅓~frac15~⅕~frac16~⅙~frac18~⅛~frac23~⅔~frac25~⅖~frac35~⅗~frac38~⅜~frac45~⅘~frac56~⅚~frac58~⅝~frac78~⅞~frown~⌢~fscr~𝒻~gE~≧~gEl~⪌~gacute~ǵ~gammad~ϝ~gap~⪆~gbreve~ğ~gcirc~ĝ~gcy~г~gdot~ġ~gel~⋛~geq~≥~geqq~≧~geqslant~⩾~ges~⩾~gescc~⪩~gesdot~⪀~gesdoto~⪂~gesdotol~⪄~gesl~⋛︀~gesles~⪔~gfr~𝔤~gg~≫~ggg~⋙~gimel~ℷ~gjcy~ѓ~gl~≷~glE~⪒~gla~⪥~glj~⪤~gnE~≩~gnap~⪊~gnapprox~⪊~gne~⪈~gneq~⪈~gneqq~≩~gnsim~⋧~gopf~𝕘~grave~`~gscr~ℊ~gsim~≳~gsime~⪎~gsiml~⪐~gtcc~⪧~gtcir~⩺~gtdot~⋗~gtlPar~⦕~gtquest~⩼~gtrapprox~⪆~gtrarr~⥸~gtrdot~⋗~gtreqless~⋛~gtreqqless~⪌~gtrless~≷~gtrsim~≳~gvertneqq~≩︀~gvnE~≩︀~hairsp~ ~half~½~hamilt~ℋ~hardcy~ъ~harrcir~⥈~harrw~↭~hbar~ℏ~hcirc~ĥ~heartsuit~♥~hercon~⊹~hfr~𝔥~hksearow~⤥~hkswarow~⤦~hoarr~⇿~homtht~∻~hookleftarrow~↩~hookrightarrow~↪~hopf~𝕙~horbar~―~hscr~𝒽~hslash~ℏ~hstrok~ħ~hybull~⁃~hyphen~‐~ic~~icy~и~iecy~е~iff~⇔~ifr~𝔦~ii~ⅈ~iiiint~⨌~iiint~∭~iinfin~⧜~iiota~℩~ijlig~ij~imacr~ī~imagline~ℐ~imagpart~ℑ~imath~ı~imof~⊷~imped~Ƶ~in~∈~incare~℅~infintie~⧝~inodot~ı~intcal~⊺~integers~ℤ~intercal~⊺~intlarhk~⨗~intprod~⨼~iocy~ё~iogon~į~iopf~𝕚~iprod~⨼~iscr~𝒾~isinE~⋹~isindot~⋵~isins~⋴~isinsv~⋳~isinv~∈~it~~itilde~ĩ~iukcy~і~jcirc~ĵ~jcy~й~jfr~𝔧~jmath~ȷ~jopf~𝕛~jscr~𝒿~jsercy~ј~jukcy~є~kappav~ϰ~kcedil~ķ~kcy~к~kfr~𝔨~kgreen~ĸ~khcy~х~kjcy~ќ~kopf~𝕜~kscr~𝓀~lAarr~⇚~lAtail~⤛~lBarr~⤎~lE~≦~lEg~⪋~lHar~⥢~lacute~ĺ~laemptyv~⦴~lagran~ℒ~langd~⦑~langle~⟨~lap~⪅~larrb~⇤~larrbfs~⤟~larrfs~⤝~larrhk~↩~larrlp~↫~larrpl~⤹~larrsim~⥳~larrtl~↢~lat~⪫~latail~⤙~late~⪭~lates~⪭︀~lbarr~⤌~lbbrk~❲~lbrace~{~lbrack~[~lbrke~⦋~lbrksld~⦏~lbrkslu~⦍~lcaron~ľ~lcedil~ļ~lcub~{~lcy~л~ldca~⤶~ldquor~„~ldrdhar~⥧~ldrushar~⥋~ldsh~↲~leftarrow~←~leftarrowtail~↢~leftharpoondown~↽~leftharpoonup~↼~leftleftarrows~⇇~leftrightarrow~↔~leftrightarrows~⇆~leftrightharpoons~⇋~leftrightsquigarrow~↭~leftthreetimes~⋋~leg~⋚~leq~≤~leqq~≦~leqslant~⩽~les~⩽~lescc~⪨~lesdot~⩿~lesdoto~⪁~lesdotor~⪃~lesg~⋚︀~lesges~⪓~lessapprox~⪅~lessdot~⋖~lesseqgtr~⋚~lesseqqgtr~⪋~lessgtr~≶~lesssim~≲~lfisht~⥼~lfr~𝔩~lg~≶~lgE~⪑~lhard~↽~lharu~↼~lharul~⥪~lhblk~▄~ljcy~љ~ll~≪~llarr~⇇~llcorner~⌞~llhard~⥫~lltri~◺~lmidot~ŀ~lmoust~⎰~lmoustache~⎰~lnE~≨~lnap~⪉~lnapprox~⪉~lne~⪇~lneq~⪇~lneqq~≨~lnsim~⋦~loang~⟬~loarr~⇽~lobrk~⟦~longleftarrow~⟵~longleftrightarrow~⟷~longmapsto~⟼~longrightarrow~⟶~looparrowleft~↫~looparrowright~↬~lopar~⦅~lopf~𝕝~loplus~⨭~lotimes~⨴~lowbar~_~lozenge~◊~lozf~⧫~lpar~(~lparlt~⦓~lrarr~⇆~lrcorner~⌟~lrhar~⇋~lrhard~⥭~lrtri~⊿~lscr~𝓁~lsh~↰~lsim~≲~lsime~⪍~lsimg~⪏~lsqb~[~lsquor~‚~lstrok~ł~ltcc~⪦~ltcir~⩹~ltdot~⋖~lthree~⋋~ltimes~⋉~ltlarr~⥶~ltquest~⩻~ltrPar~⦖~ltri~◃~ltrie~⊴~ltrif~◂~lurdshar~⥊~luruhar~⥦~lvertneqq~≨︀~lvnE~≨︀~mDDot~∺~male~♂~malt~✠~maltese~✠~map~↦~mapsto~↦~mapstodown~↧~mapstoleft~↤~mapstoup~↥~marker~▮~mcomma~⨩~mcy~м~measuredangle~∡~mfr~𝔪~mho~℧~mid~∣~midast~*~midcir~⫰~minusb~⊟~minusd~∸~minusdu~⨪~mlcp~⫛~mldr~…~mnplus~∓~models~⊧~mopf~𝕞~mp~∓~mscr~𝓂~mstpos~∾~multimap~⊸~mumap~⊸~nGg~⋙̸~nGt~≫⃒~nGtv~≫̸~nLeftarrow~⇍~nLeftrightarrow~⇎~nLl~⋘̸~nLt~≪⃒~nLtv~≪̸~nRightarrow~⇏~nVDash~⊯~nVdash~⊮~nacute~ń~nang~∠⃒~nap~≉~napE~⩰̸~napid~≋̸~napos~ʼn~napprox~≉~natur~♮~natural~♮~naturals~ℕ~nbump~≎̸~nbumpe~≏̸~ncap~⩃~ncaron~ň~ncedil~ņ~ncong~≇~ncongdot~⩭̸~ncup~⩂~ncy~н~neArr~⇗~nearhk~⤤~nearr~↗~nearrow~↗~nedot~≐̸~nequiv~≢~nesear~⤨~nesim~≂̸~nexist~∄~nexists~∄~nfr~𝔫~ngE~≧̸~nge~≱~ngeq~≱~ngeqq~≧̸~ngeqslant~⩾̸~nges~⩾̸~ngsim~≵~ngt~≯~ngtr~≯~nhArr~⇎~nharr~↮~nhpar~⫲~nis~⋼~nisd~⋺~niv~∋~njcy~њ~nlArr~⇍~nlE~≦̸~nlarr~↚~nldr~‥~nle~≰~nleftarrow~↚~nleftrightarrow~↮~nleq~≰~nleqq~≦̸~nleqslant~⩽̸~nles~⩽̸~nless~≮~nlsim~≴~nlt~≮~nltri~⋪~nltrie~⋬~nmid~∤~nopf~𝕟~notinE~⋹̸~notindot~⋵̸~notinva~∉~notinvb~⋷~notinvc~⋶~notni~∌~notniva~∌~notnivb~⋾~notnivc~⋽~npar~∦~nparallel~∦~nparsl~⫽⃥~npart~∂̸~npolint~⨔~npr~⊀~nprcue~⋠~npre~⪯̸~nprec~⊀~npreceq~⪯̸~nrArr~⇏~nrarr~↛~nrarrc~⤳̸~nrarrw~↝̸~nrightarrow~↛~nrtri~⋫~nrtrie~⋭~nsc~⊁~nsccue~⋡~nsce~⪰̸~nscr~𝓃~nshortmid~∤~nshortparallel~∦~nsim~≁~nsime~≄~nsimeq~≄~nsmid~∤~nspar~∦~nsqsube~⋢~nsqsupe~⋣~nsubE~⫅̸~nsube~⊈~nsubset~⊂⃒~nsubseteq~⊈~nsubseteqq~⫅̸~nsucc~⊁~nsucceq~⪰̸~nsup~⊅~nsupE~⫆̸~nsupe~⊉~nsupset~⊃⃒~nsupseteq~⊉~nsupseteqq~⫆̸~ntgl~≹~ntlg~≸~ntriangleleft~⋪~ntrianglelefteq~⋬~ntriangleright~⋫~ntrianglerighteq~⋭~num~#~numero~№~numsp~ ~nvDash~⊭~nvHarr~⤄~nvap~≍⃒~nvdash~⊬~nvge~≥⃒~nvgt~>⃒~nvinfin~⧞~nvlArr~⤂~nvle~≤⃒~nvlt~<⃒~nvltrie~⊴⃒~nvrArr~⤃~nvrtrie~⊵⃒~nvsim~∼⃒~nwArr~⇖~nwarhk~⤣~nwarr~↖~nwarrow~↖~nwnear~⤧~oS~Ⓢ~oast~⊛~ocir~⊚~ocy~о~odash~⊝~odblac~ő~odiv~⨸~odot~⊙~odsold~⦼~ofcir~⦿~ofr~𝔬~ogon~˛~ogt~⧁~ohbar~⦵~ohm~Ω~oint~∮~olarr~↺~olcir~⦾~olcross~⦻~olt~⧀~omacr~ō~omid~⦶~ominus~⊖~oopf~𝕠~opar~⦷~operp~⦹~orarr~↻~ord~⩝~order~ℴ~orderof~ℴ~origof~⊶~oror~⩖~orslope~⩗~orv~⩛~oscr~ℴ~osol~⊘~otimesas~⨶~ovbar~⌽~par~∥~parallel~∥~parsim~⫳~parsl~⫽~pcy~п~percnt~%~period~.~pertenk~‱~pfr~𝔭~phiv~ϕ~phmmat~ℳ~phone~☎~pitchfork~⋔~planck~ℏ~planckh~ℎ~plankv~ℏ~plus~+~plusacir~⨣~plusb~⊞~pluscir~⨢~plusdo~∔~plusdu~⨥~pluse~⩲~plussim~⨦~plustwo~⨧~pm~±~pointint~⨕~popf~𝕡~pr~≺~prE~⪳~prap~⪷~prcue~≼~pre~⪯~prec~≺~precapprox~⪷~preccurlyeq~≼~preceq~⪯~precnapprox~⪹~precneqq~⪵~precnsim~⋨~precsim~≾~primes~ℙ~prnE~⪵~prnap~⪹~prnsim~⋨~profalar~⌮~profline~⌒~profsurf~⌓~propto~∝~prsim~≾~prurel~⊰~pscr~𝓅~puncsp~ ~qfr~𝔮~qint~⨌~qopf~𝕢~qprime~⁗~qscr~𝓆~quaternions~ℍ~quatint~⨖~quest~?~questeq~≟~rAarr~⇛~rAtail~⤜~rBarr~⤏~rHar~⥤~race~∽̱~racute~ŕ~raemptyv~⦳~rangd~⦒~range~⦥~rangle~⟩~rarrap~⥵~rarrb~⇥~rarrbfs~⤠~rarrc~⤳~rarrfs~⤞~rarrhk~↪~rarrlp~↬~rarrpl~⥅~rarrsim~⥴~rarrtl~↣~rarrw~↝~ratail~⤚~ratio~∶~rationals~ℚ~rbarr~⤍~rbbrk~❳~rbrace~}~rbrack~]~rbrke~⦌~rbrksld~⦎~rbrkslu~⦐~rcaron~ř~rcedil~ŗ~rcub~}~rcy~р~rdca~⤷~rdldhar~⥩~rdquor~”~rdsh~↳~realine~ℛ~realpart~ℜ~reals~ℝ~rect~▭~rfisht~⥽~rfr~𝔯~rhard~⇁~rharu~⇀~rharul~⥬~rhov~ϱ~rightarrow~→~rightarrowtail~↣~rightharpoondown~⇁~rightharpoonup~⇀~rightleftarrows~⇄~rightleftharpoons~⇌~rightrightarrows~⇉~rightsquigarrow~↝~rightthreetimes~⋌~ring~˚~risingdotseq~≓~rlarr~⇄~rlhar~⇌~rmoust~⎱~rmoustache~⎱~rnmid~⫮~roang~⟭~roarr~⇾~robrk~⟧~ropar~⦆~ropf~𝕣~roplus~⨮~rotimes~⨵~rpar~)~rpargt~⦔~rppolint~⨒~rrarr~⇉~rscr~𝓇~rsh~↱~rsqb~]~rsquor~’~rthree~⋌~rtimes~⋊~rtri~▹~rtrie~⊵~rtrif~▸~rtriltri~⧎~ruluhar~⥨~rx~℞~sacute~ś~sc~≻~scE~⪴~scap~⪸~sccue~≽~sce~⪰~scedil~ş~scirc~ŝ~scnE~⪶~scnap~⪺~scnsim~⋩~scpolint~⨓~scsim~≿~scy~с~sdotb~⊡~sdote~⩦~seArr~⇘~searhk~⤥~searr~↘~searrow~↘~semi~;~seswar~⤩~setminus~∖~setmn~∖~sext~✶~sfr~𝔰~sfrown~⌢~sharp~♯~shchcy~щ~shcy~ш~shortmid~∣~shortparallel~∥~sigmav~ς~simdot~⩪~sime~≃~simeq~≃~simg~⪞~simgE~⪠~siml~⪝~simlE~⪟~simne~≆~simplus~⨤~simrarr~⥲~slarr~←~smallsetminus~∖~smashp~⨳~smeparsl~⧤~smid~∣~smile~⌣~smt~⪪~smte~⪬~smtes~⪬︀~softcy~ь~sol~/~solb~⧄~solbar~⌿~sopf~𝕤~spadesuit~♠~spar~∥~sqcap~⊓~sqcaps~⊓︀~sqcup~⊔~sqcups~⊔︀~sqsub~⊏~sqsube~⊑~sqsubset~⊏~sqsubseteq~⊑~sqsup~⊐~sqsupe~⊒~sqsupset~⊐~sqsupseteq~⊒~squ~□~square~□~squarf~▪~squf~▪~srarr~→~sscr~𝓈~ssetmn~∖~ssmile~⌣~sstarf~⋆~star~☆~starf~★~straightepsilon~ϵ~straightphi~ϕ~strns~¯~subE~⫅~subdot~⪽~subedot~⫃~submult~⫁~subnE~⫋~subne~⊊~subplus~⪿~subrarr~⥹~subset~⊂~subseteq~⊆~subseteqq~⫅~subsetneq~⊊~subsetneqq~⫋~subsim~⫇~subsub~⫕~subsup~⫓~succ~≻~succapprox~⪸~succcurlyeq~≽~succeq~⪰~succnapprox~⪺~succneqq~⪶~succnsim~⋩~succsim~≿~sung~♪~supE~⫆~supdot~⪾~supdsub~⫘~supedot~⫄~suphsol~⟉~suphsub~⫗~suplarr~⥻~supmult~⫂~supnE~⫌~supne~⊋~supplus~⫀~supset~⊃~supseteq~⊇~supseteqq~⫆~supsetneq~⊋~supsetneqq~⫌~supsim~⫈~supsub~⫔~supsup~⫖~swArr~⇙~swarhk~⤦~swarr~↙~swarrow~↙~swnwar~⤪~target~⌖~tbrk~⎴~tcaron~ť~tcedil~ţ~tcy~т~tdot~⃛~telrec~⌕~tfr~𝔱~therefore~∴~thetav~ϑ~thickapprox~≈~thicksim~∼~thkap~≈~thksim~∼~timesb~⊠~timesbar~⨱~timesd~⨰~tint~∭~toea~⤨~top~⊤~topbot~⌶~topcir~⫱~topf~𝕥~topfork~⫚~tosa~⤩~tprime~‴~triangle~▵~triangledown~▿~triangleleft~◃~trianglelefteq~⊴~triangleq~≜~triangleright~▹~trianglerighteq~⊵~tridot~◬~trie~≜~triminus~⨺~triplus~⨹~trisb~⧍~tritime~⨻~trpezium~⏢~tscr~𝓉~tscy~ц~tshcy~ћ~tstrok~ŧ~twixt~≬~twoheadleftarrow~↞~twoheadrightarrow~↠~uHar~⥣~ubrcy~ў~ubreve~ŭ~ucy~у~udarr~⇅~udblac~ű~udhar~⥮~ufisht~⥾~ufr~𝔲~uharl~↿~uharr~↾~uhblk~▀~ulcorn~⌜~ulcorner~⌜~ulcrop~⌏~ultri~◸~umacr~ū~uogon~ų~uopf~𝕦~uparrow~↑~updownarrow~↕~upharpoonleft~↿~upharpoonright~↾~uplus~⊎~upsi~υ~upuparrows~⇈~urcorn~⌝~urcorner~⌝~urcrop~⌎~uring~ů~urtri~◹~uscr~𝓊~utdot~⋰~utilde~ũ~utri~▵~utrif~▴~uuarr~⇈~uwangle~⦧~vArr~⇕~vBar~⫨~vBarv~⫩~vDash~⊨~vangrt~⦜~varepsilon~ϵ~varkappa~ϰ~varnothing~∅~varphi~ϕ~varpi~ϖ~varpropto~∝~varr~↕~varrho~ϱ~varsigma~ς~varsubsetneq~⊊︀~varsubsetneqq~⫋︀~varsupsetneq~⊋︀~varsupsetneqq~⫌︀~vartheta~ϑ~vartriangleleft~⊲~vartriangleright~⊳~vcy~в~vdash~⊢~vee~∨~veebar~⊻~veeeq~≚~vellip~⋮~verbar~|~vert~|~vfr~𝔳~vltri~⊲~vnsub~⊂⃒~vnsup~⊃⃒~vopf~𝕧~vprop~∝~vrtri~⊳~vscr~𝓋~vsubnE~⫋︀~vsubne~⊊︀~vsupnE~⫌︀~vsupne~⊋︀~vzigzag~⦚~wcirc~ŵ~wedbar~⩟~wedge~∧~wedgeq~≙~wfr~𝔴~wopf~𝕨~wp~℘~wr~≀~wreath~≀~wscr~𝓌~xcap~⋂~xcirc~◯~xcup~⋃~xdtri~▽~xfr~𝔵~xhArr~⟺~xharr~⟷~xlArr~⟸~xlarr~⟵~xmap~⟼~xnis~⋻~xodot~⨀~xopf~𝕩~xoplus~⨁~xotime~⨂~xrArr~⟹~xrarr~⟶~xscr~𝓍~xsqcup~⨆~xuplus~⨄~xutri~△~xvee~⋁~xwedge~⋀~yacy~я~ycirc~ŷ~ycy~ы~yfr~𝔶~yicy~ї~yopf~𝕪~yscr~𝓎~yucy~ю~zacute~ź~zcaron~ž~zcy~з~zdot~ż~zeetrf~ℨ~zfr~𝔷~zhcy~ж~zigrarr~⇝~zopf~𝕫~zscr~𝓏~~AMP~&~COPY~©~GT~>~LT~<~QUOT~"~REG~®',zl.html4);var nC={0:65533,128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376},sC=String.fromCodePoint||function(s){return String.fromCharCode(Math.floor((s-65536)/1024)+55296,(s-65536)%1024+56320)},Dl=function(){return Dl=Object.assign||function(s){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var c in n)Object.prototype.hasOwnProperty.call(n,c)&&(s[c]=n[c])}return s},Dl.apply(this,arguments)},aC=Dl(Dl({},zl),{all:zl.html5}),lC={scope:"body",level:"all"},Ed=/&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);/g,Cd=/&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+)[;=]?/g,My={xml:{strict:Ed,attribute:Cd,body:kd.xml},html4:{strict:Ed,attribute:Cd,body:kd.html4},html5:{strict:Ed,attribute:Cd,body:kd.html5}},rC=Dl(Dl({},My),{all:My.html5}),mv=String.fromCharCode,iC=mv(65533);function oC(s,n,r,o){var c=s,d=s[s.length-1];if(r&&d==="=")c=s;else if(o&&d!==";")c=s;else{var f=n[s];if(f)c=f;else if(s[0]==="&"&&s[1]==="#"){var y=s[2],g=y=="x"||y=="X"?parseInt(s.substr(3),16):parseInt(s.substr(2));c=g>=1114111?iC:g>65535?sC(g):mv(nC[g]||g)}}return c}function cC(s,n){var r=lC,o=r.level,c=o===void 0?"all":o,d=r.scope,f=d===void 0?c==="xml"?"strict":"body":d;if(!s)return"";var y=rC[c][f],g=aC[c].entities,m=f==="attribute",x=f==="strict";return s.replace(y,function(S){return oC(S,g,m,x)})}const By=(s="")=>!s||!s.includes("&")?s:cC(s),Iy=(s,n)=>{if(!n)return s;try{return new URL(s,n).href}catch{return s}};var uC=class{constructor(s){this.renderer=s.renderer}parse(s){this.renderer.elIdList.push(0);const n=s.map(r=>{switch(r.type){case"space":return null;case"heading":{const o=r.depth;return this.renderer.heading(this.parseInline(r.tokens),o)}case"paragraph":return this.renderer.paragraph(this.parseInline(r.tokens));case"text":{const o=r;return o.tokens?this.parseInline(o.tokens):r.text}case"blockquote":{const o=r,c=this.parse(o.tokens);return this.renderer.blockquote(c)}case"list":{const o=r;this.renderer.elIdList.push(0);const c=o.items.map(d=>{const f=[];return d.task&&f.push(this.renderer.checkbox(d.checked??!1)),f.push(this.parse(d.tokens)),this.renderer.listItem(f)});return this.renderer.elIdList.pop(),this.renderer.list(c,r.ordered,r.ordered?r.start:void 0)}case"code":return this.renderer.code(r.text,r.lang);case"html":return this.renderer.html(r.text);case"table":{const o=r;this.renderer.elIdList.push(0);const c=o.header.map((m,x)=>this.renderer.tableCell(this.parseInline(m.tokens),{header:!0,align:r.align[x]}));this.renderer.elIdList.pop();const d=this.renderer.tableRow(c),f=this.renderer.tableHeader(d);this.renderer.elIdList.push(0);const y=o.rows.map(m=>{this.renderer.elIdList.push(0);const x=m.map((S,v)=>this.renderer.tableCell(this.parseInline(S.tokens),{header:!1,align:r.align[v]}));return this.renderer.elIdList.pop(),this.renderer.tableRow(x)});this.renderer.elIdList.pop();const g=this.renderer.tableBody(y);return this.renderer.table([f,g])}case"hr":return this.renderer.hr();default:return console.warn(`Token with "${r.type}" type was not found`),null}});return this.renderer.elIdList.pop(),n}parseInline(s=[]){this.renderer.elIdList.push(0);const n=s.map(r=>{switch(r.type){case"text":return this.renderer.text(By(r.text));case"strong":return this.renderer.strong(this.parseInline(r.tokens));case"em":return this.renderer.em(this.parseInline(r.tokens));case"del":return this.renderer.del(this.parseInline(r.tokens));case"codespan":return this.renderer.codespan(By(r.text));case"link":return this.renderer.link(r.href,this.parseInline(r.tokens));case"image":return this.renderer.image(r.href,r.text,r.title);case"html":return this.renderer.html(r.text);case"br":return this.renderer.br();case"escape":return this.renderer.text(r.text);default:return console.warn(`Token with "${r.type}" type was not found`),null}});return this.renderer.elIdList.pop(),n}},dC=class{#t;constructor(s={}){this.elIdList=[];const{renderer:n}=s;this.#t=s,n&&typeof n=="object"&&Object.entries(n).forEach(([r,o])=>{const c=r,d=o;!this[c]||c==="elementId"||c==="elIdList"||typeof d!="function"||Object.defineProperty(this,c,{value(...f){return this.#n(),d.apply(this,f)},writable:!0,enumerable:!0,configurable:!0})})}#e(s,n=null,r={}){const o={key:`marked-react-${this.elementId}`,suppressHydrationWarning:!0};return this.#n(),p.createElement(s,{...r,...o},n)}#n(){this.elIdList[this.elIdList.length-1]+=1}get elementId(){return this.elIdList.join("-")}heading(s,n){return this.#e(`h${n}`,s)}paragraph(s){return this.#e("p",s)}link(s,n){const r=Iy(s,this.#t.baseURL),o=this.#t.openLinksInNewTab?"_blank":null;return this.#e("a",n,{href:r,target:o})}image(s,n,r=null){const o=Iy(s,this.#t.baseURL);return this.#e("img",null,{src:o,alt:n,title:r})}codespan(s,n=null){const r=n?`${this.#t.langPrefix}${n}`:null;return this.#e("code",s,{className:r})}code(s,n){return this.#e("pre",this.codespan(s,n))}blockquote(s){return this.#e("blockquote",s)}list(s,n,r){return this.#e(n?"ol":"ul",s,n&&r!==1?{start:r}:{})}listItem(s){return this.#e("li",s)}checkbox(s){return this.#e("input",null,{type:"checkbox",disabled:!0,checked:s})}table(s){return this.#e("table",s)}tableHeader(s){return this.#e("thead",s)}tableBody(s){return this.#e("tbody",s)}tableRow(s){return this.#e("tr",s)}tableCell(s,n){const r=n.header?"th":"td";return this.#e(r,s,{align:n.align})}strong(s){return this.#e("strong",s)}em(s){return this.#e("em",s)}del(s){return this.#e("del",s)}text(s){return s}html(s){return s}hr(){return this.#e("hr")}br(){return this.#e("br")}};const hC=s=>{if(s.value&&typeof s.value!="string")throw new TypeError(`[marked-react]: Expected value to be of type string but got ${typeof s.value}`);if(s.children&&typeof s.children!="string")throw new TypeError(`[marked-react]: Expected children to be of type string but got ${typeof s.children}`)},fC={isInline:!1,breaks:!1,gfm:!0,baseURL:void 0,openLinksInNewTab:!0,langPrefix:"language-",renderer:void 0},pC=new gv,gC=s=>{hC(s);const n={...fC,...s},r=n.instance??pC,o={breaks:n.breaks,gfm:n.gfm,tokenizer:r.defaults.tokenizer},c=n.value??n.children??"",d=n.isInline?r.Lexer.lexInline(c,o):r.lexer(c,o),f=new uC({renderer:new dC({renderer:n.renderer,baseURL:n.baseURL,openLinksInNewTab:n.openLinksInNewTab,langPrefix:n.langPrefix})});return p.createElement(p.Fragment,null,n.isInline?f.parseInline(d):f.parse(d))};var mC=gC;function yC(s){return typeof s=="string"?s:s&&typeof s=="object"&&typeof s.id=="string"?s.id:null}function xC(){const{id:s}=Wt(),n=Re(),{setSectionTitle:r,blocks:o}=Qo(),{showError:c}=hn(),d=jt(),{block:f,isLoading:y,error:g,isDeleted:m}=iE(s||""),[x,S]=p.useState(null),[v,T]=p.useState(!1);wt(f?{contextBlock:{title:f.title}}:void 0),p.useEffect(()=>{f&&r(d?"Context":f.title)},[f,d,r]),p.useEffect(()=>{if(!f?.id){S(null);return}let C=!1;return T(!0),Yn.ThreadsController_getThreadsByStateBlockId({stateBlockId:f.id}).then(j=>{C||S(j.length>0?j[0].id:null)}).catch(j=>{C||(console.error("Error checking for thread:",j),S(null))}).finally(()=>{C||T(!1)}),()=>{C=!0}},[f?.id]),p.useEffect(()=>{m&&n("/context/home")},[m,n]);const w=()=>{if(!f)return;const j=`${f.title.replace(/[^a-z0-9]/gi,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase()||"context-block"}.md`,R=new Blob([f.content],{type:"text/markdown"}),L=URL.createObjectURL(R),N=document.createElement("a");N.href=L,N.download=j,document.body.appendChild(N),N.click(),document.body.removeChild(N),URL.revokeObjectURL(L)},k=p.useMemo(()=>{if(!f)return[];const C=new Map(o.map(L=>[L.id,L])),j=[];let R=f.id;for(;R;){const L=R===f.id?f:C.get(R);if(!L)break;j.unshift({id:L.id,title:L.title}),R=yC(L.parentId)}return j},[f,o]);return y?a.jsx("div",{className:"context-block-detail__loading",children:a.jsx(_,{children:"Loading..."})}):g?a.jsx("div",{className:"context-block-detail__error",children:a.jsxs(_,{className:"text--error",children:["Error: ",g]})}):f?a.jsxs("div",{className:"context-block-detail",children:[a.jsxs(W,{spacing:"3",className:"context-block-detail__header",children:[d?a.jsxs("div",{className:"context-block-detail__breadcrumbs","aria-label":"Breadcrumb",children:[a.jsx("button",{type:"button",className:"context-block-detail__breadcrumb",onClick:()=>n("/context/home"),children:"Home"}),k.map((C,j)=>a.jsxs("div",{className:"context-block-detail__breadcrumb-segment",children:[a.jsx("span",{className:"context-block-detail__breadcrumb-separator",children:"›"}),a.jsx("button",{type:"button",className:`context-block-detail__breadcrumb ${j===k.length-1?"context-block-detail__breadcrumb--current":""}`,onClick:()=>n(`/context/block/${C.id}`),disabled:j===k.length-1,children:C.title})]},C.id))]}):null,d?a.jsx("div",{className:"context-block-detail__title-wrap",children:a.jsx("h1",{className:"context-block-detail__title",children:f.title})}):null,f.tags.length>0&&a.jsx("div",{className:"context-block-detail__tags",children:f.tags.map(C=>a.jsx(Ds,{children:C.name},C.id))}),a.jsxs("div",{className:"context-block-detail__meta",children:[a.jsxs(_,{size:"2",tone:"muted",children:["by @",f.createdBy||"unknown"]}),a.jsx(_,{size:"2",tone:"muted",children:"•"}),a.jsx(_,{size:"2",tone:"muted",children:new Date(f.createdAt).toDateString()}),a.jsx(_,{size:"2",tone:"muted",children:"•"}),a.jsxs(_,{size:"2",tone:"muted",children:["Last edited ",Nt(f.updatedAt)]})]})]}),a.jsx("div",{className:"context-block-detail__content",children:a.jsx(mC,{children:f.content})}),a.jsx(Ml,{className:"context-block-detail__actions",onDelete:async()=>{try{await qa.ContextController_deleteBlock({id:f.id}),n("/context")}catch(C){c(C)}},deleteLabel:"Delete",confirmLabel:"Confirm Delete"}),a.jsxs(fe,{className:"context-block-detail__actions",children:[a.jsx(oe,{size:"lg",variant:"secondary",onClick:()=>n(`/context/block/${f.id}/edit`),children:"Edit"}),a.jsx(oe,{size:"lg",variant:"secondary",onClick:w,children:"Download as Markdown"}),x&&a.jsx(oe,{size:"lg",variant:"primary",onClick:()=>n(`/threads/${x}`),disabled:v,children:"Go to thread"}),d?null:a.jsx(oe,{size:"lg",variant:"secondary",onClick:()=>n("/context"),children:"Back to blocks"})]})]}):a.jsx("div",{className:"context-block-detail__error",children:a.jsx(_,{className:"text--error",children:"Context block not found"})})}function Uy(){const{id:s}=Wt(),n=!!s,{setSectionTitle:r}=Qo(),o=Re(),[c]=ih(),d=c.get("parentId")??void 0,{showError:f,showToast:y}=hn(),g=jt(),m=p.useRef(null),[x,S]=p.useState(""),[v,T]=p.useState(""),[w]=p.useState([]),[k,C]=p.useState(!1),[j,R]=p.useState(n),[L,N]=p.useState(null);p.useEffect(()=>{s&&(R(!0),qa.ContextController_getBlock({id:s}).then(I=>{S(I.title),T(I.content)}).catch(I=>{f(I),o("/context/home")}).finally(()=>R(!1)))},[s]),p.useEffect(()=>{r(g?"Context":n?"Edit Block":"New Block")},[r,g,n]);const M=async I=>{const H=I.target.files?.[0];if(H){if(!H.name.endsWith(".md")){f(new Error("Please select a markdown (.md) file"));return}N(H.name);try{const P=await H.text();T(P);const U=P.match(/^#\s+(.+)$/m);S(U?U[1].trim():H.name.replace(/\.md$/,""))}catch(P){f(P),N(null)}}},A=async()=>{if(!x.trim()){f(new Error("Title is required"));return}if(!v.trim()){f(new Error("Content is required"));return}C(!0);try{if(n&&s)await qa.ContextController_updateBlock({id:s,body:{title:x.trim(),content:v.trim()}}),y("Context block updated","success"),o(`/context/block/${s}`);else{const I=await qa.ContextController_createBlock({body:{title:x.trim(),content:v.trim(),tagNames:w.length>0?w:void 0,parentId:d}});y("Context block created","success"),o(`/context/block/${I.id}`)}}catch(I){f(I)}finally{C(!1)}},z=n&&s?`/context/block/${s}`:"/context/home";return j?a.jsx("div",{className:"context-block-create",children:a.jsx(_,{tone:"muted",children:"Loading…"})}):a.jsxs("div",{className:"context-block-create",children:[g&&a.jsxs("div",{className:"context-block-create__breadcrumbs",children:[a.jsx("button",{type:"button",className:"context-block-create__breadcrumb",onClick:()=>o("/context/home"),children:"Home"}),a.jsx("span",{className:"context-block-create__breadcrumb-separator",children:"›"}),a.jsx("span",{className:"context-block-create__breadcrumb context-block-create__breadcrumb--current",children:n?"Edit Block":"New Block"})]}),a.jsxs("div",{className:"context-block-create__title-row",children:[a.jsx("input",{type:"text",value:x,onChange:I=>S(I.target.value),placeholder:"Untitled",className:"context-block-create__title-input",maxLength:255,"aria-label":"Block title",autoFocus:!0}),a.jsx(oe,{type:"button",size:"lg",variant:"secondary",onClick:()=>m.current?.click(),title:L?`File: ${L}`:"Upload markdown file",tabIndex:-1,children:L?`↑ ${L}`:"↑ Upload .md"}),a.jsx("input",{ref:m,type:"file",accept:".md",onChange:M,className:"context-block-create__file-input-hidden","aria-hidden":"true"})]}),a.jsx("textarea",{value:v,onChange:I=>T(I.target.value),placeholder:"Write markdown content here, or upload a .md file above…",className:"context-block-create__editor","aria-label":"Block content (Markdown)"}),a.jsx("div",{className:"context-block-create__bottom-bar",children:a.jsxs("div",{className:"context-block-create__actions",children:[a.jsx(oe,{type:"button",size:"lg",variant:"secondary",onClick:()=>o(z),disabled:k,children:"Cancel"}),a.jsx(oe,{type:"button",size:"lg",variant:"primary",onClick:A,disabled:k||!x.trim()||!v.trim(),children:k?n?"Saving…":"Creating…":n?"Save":"Create"})]})})]})}function vC(){return a.jsx(oE,{children:a.jsx(is,{children:a.jsxs(xe,{element:a.jsx(dE,{}),children:[a.jsx(xe,{index:!0,element:a.jsx(Ma,{to:"home",replace:!0})}),a.jsx(xe,{path:"home",element:a.jsx(hE,{})}),a.jsx(xe,{path:"new",element:a.jsx(Uy,{})}),a.jsx(xe,{path:"block/:id",element:a.jsx(xC,{})}),a.jsx(xe,{path:"block/:id/edit",element:a.jsx(Uy,{})})]})})})}const bC=window.location.origin,Cn=new Fn({baseUrl:bC,credentials:"include"}),Oa=Cn.agent,jo=Cn.agentTokens,Yr=Cn.agent,_C=Cn.authorizationServer,Xd=Cn.meta,Fr=Cn.tools;Cn.agent,Cn.agentTokens,Cn.agent,Cn.authorizationServer,Cn.meta,Cn.tools;const SC=()=>{const[s,n]=p.useState(!1),[r,o]=p.useState(null),[c,d]=p.useState([]);p.useEffect(()=>{y()},[]);const f=v=>[...v].sort((T,w)=>{const k=new Date(T.updatedAt).getTime();return new Date(w.updatedAt).getTime()-k}),y=async()=>{n(!0),o(null);try{const v=await Oa.AgentsController_listAgents({});d(f(v.items||[]))}catch(v){o(v instanceof Error?v.message:"Failed to load agents")}finally{n(!1)}};return{isLoading:s,error:r,agents:c,loadAgents:y,loadAgentDetails:async v=>{n(!0),o(null);try{return await Oa.AgentsController_getAgentBySlug({slug:v})}catch(T){return o(T instanceof Error?T.message:"Failed to load agent details"),null}finally{n(!1)}},createAgent:async v=>{n(!0),o(null);try{const T=await Oa.AgentsController_createAgent({body:{name:v.name,slug:v.slug,systemPrompt:v.systemPrompt,allowedTools:v.allowedTools??[],type:v.type,description:v.description,introduction:v.introduction,avatarUrl:v.avatarUrl,providerId:v.providerId,modelId:v.modelId,statusTriggers:v.statusTriggers,tagTriggers:v.tagTriggers,isActive:v.isActive,concurrencyLimit:v.concurrencyLimit}});return d(w=>f([...w,T])),T}catch(T){return o(T instanceof Error?T.message:"Failed to create agent"),null}finally{n(!1)}},updateAgent:async(v,T)=>{n(!0),o(null);try{const w=await Oa.AgentsController_patchAgent({actorId:v,body:T});return d(k=>{const C=k.map(j=>j.actorId===v?w:j);return f(C)}),w}catch(w){return o(w instanceof Error?w.message:"Failed to update agent"),null}finally{n(!1)}},deleteAgent:async v=>{n(!0),o(null);try{return await Oa.AgentsController_deleteAgent({actorId:v}),d(T=>T.filter(w=>w.actorId!==v)),!0}catch(T){return o(T instanceof Error?T.message:"Failed to delete agent"),!1}finally{n(!1)}}}},yv=p.createContext(null);function TC({children:s}){const{agents:n,isLoading:r,error:o,loadAgentDetails:c,createAgent:d,updateAgent:f,deleteAgent:y}=SC(),[g,m]=p.useState(""),x=p.useMemo(()=>({agents:n,isLoading:r,error:o,sectionTitle:g,setSectionTitle:m,loadAgentDetails:c,createAgent:d,updateAgent:f,deleteAgent:y}),[n,r,o,g,m,c,d,f,y]);return a.jsx(yv.Provider,{value:x,children:s})}function ti(){const s=p.useContext(yv);if(!s)throw new Error("useAgentsCtx must be used within <AgentsProvider>");return s}function jC(){const{agents:s,setSectionTitle:n,isLoading:r,error:o}=ti(),c=Re(),d=jt();return wt(),p.useEffect(()=>{n("All Agents 🦄")},[n]),r&&s.length===0?a.jsx(fe,{children:a.jsx(ge,{leading:a.jsx(Ue,{name:"...",size:"lg"}),children:a.jsx(_,{tone:"muted",children:"Loading agents..."})})}):o?a.jsx(fe,{children:a.jsx(ge,{leading:a.jsx(Ue,{name:"!",size:"lg"}),children:a.jsxs(_,{tone:"muted",children:["Error: ",o]})})}):s.length===0?a.jsxs(a.Fragment,{children:[a.jsx(fe,{children:a.jsx(ge,{leading:a.jsx(Ue,{name:"?",size:"lg"}),children:a.jsx(_,{tone:"muted",children:"No agents found"})})}),a.jsx($y,{isDesktop:d,onClick:()=>c("/agents/new")})]}):a.jsxs(a.Fragment,{children:[a.jsx(fe,{children:s.map(f=>a.jsx(wC,{agent:f,onClick:()=>c(`/agents/agent/${f.slug}`)},f.actorId))}),a.jsx($y,{isDesktop:d,onClick:()=>c("/agents/new")})]})}function $y({isDesktop:s,onClick:n}){return a.jsx("button",{className:`agents-fab ${s?"agents-fab--desktop":""}`,type:"button",onClick:n,"aria-label":"Create new agent",children:s?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"agents-fab__plus",children:"+"}),a.jsx("span",{className:"agents-fab__label",children:"New agent"})]}):"+"})}function wC({agent:s,onClick:n}){const r=[kC(s.type),EC(s.isActive)];return a.jsxs(ge,{leading:a.jsx(Ue,{name:s.name,size:"lg"}),topRight:Nt(s.updatedAt),tags:r,onClick:n,children:[a.jsxs(_,{className:"pre",style:"mono",tone:"muted",children:["@",s.slug]}),a.jsx(_,{weight:"bold",size:"3",tone:"default",children:s.name}),a.jsx("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.jsx(_,{tone:"muted",size:"2",children:s.description?String(s.description):"No description"})}),a.jsxs("div",{style:{fontSize:12},className:"text--tone-muted",children:[s.statusTriggers.length>0&&a.jsxs("span",{children:["Triggers: ",s.statusTriggers.join(", ")]}),s.statusTriggers.length>0&&s.allowedTools.length>0&&" · ",s.allowedTools.length>0&&a.jsxs("span",{children:["Tools: ",s.allowedTools.length]})]})]})}function kC(s){return{label:s,color:{claude:"purple",codex:"green",opencode:"blue",adk:"red",githubcopilot:"yellow",other:"gray"}[s]||"gray"}}function EC(s){return{label:s?"active":"inactive",color:s?"green":"gray"}}function CC(){const s=jt(),{sectionTitle:n}=ti(),r=[];return a.jsx("div",{style:{minHeight:0},children:s?a.jsx(Ua,{sectionTitle:n,children:a.jsx(Ot,{})}):a.jsx($a,{appTitle:"Agents",sectionTitle:n,navItems:r,children:a.jsx(Ot,{})})})}const Hy=s=>{s&&(s.style.height="auto",s.style.height=`${s.scrollHeight}px`)};function NC({initialValue:s,onCancel:n,onSave:r}){const[o,c]=p.useState(s),d=p.useRef(null);p.useEffect(()=>{d.current?.focus()},[]),p.useEffect(()=>{Hy(d.current)},[o]);function f(g){c(g.target.value),Hy(g.target)}async function y(){return r({systemPrompt:o})}return a.jsx(ct,{title:"Edit System Prompt",onCancel:n,onSave:y,children:a.jsx(a.Fragment,{children:a.jsx("div",{className:"edit-system-prompt-pop__input-wrapper",children:a.jsx("textarea",{className:"edit-system-prompt-pop__input-content",ref:d,placeholder:"Enter system prompt...",value:o,onChange:f})})})})}function AC({initialValue:s,onCancel:n,onSave:r}){const[o,c]=p.useState(new Set(s)),d=g=>{c(m=>{const x=new Set(m);return x.has(g)?x.delete(g):x.add(g),x})};async function f(){return r({statusTriggers:Array.from(o)})}const y=[ve.NOT_STARTED,ve.IN_PROGRESS,ve.FOR_REVIEW,ve.DONE];return a.jsx(ct,{title:"Edit Status Triggers",onCancel:n,onSave:f,children:a.jsxs("div",{className:"edit-status-triggers-pop__content",children:[a.jsx(_,{size:"2",tone:"muted",className:"edit-status-triggers-pop__description",children:"Select which task statuses will trigger this agent to activate"}),a.jsx("div",{className:"edit-status-triggers-pop__checklist",children:y.map(g=>{const m=Vn[g];return a.jsxs("label",{className:"edit-status-triggers-pop__checklist-item",children:[a.jsx("input",{type:"checkbox",checked:o.has(g),onChange:()=>d(g),className:"edit-status-triggers-pop__checkbox"}),a.jsxs("div",{className:"edit-status-triggers-pop__status-info",children:[a.jsx("span",{className:"edit-status-triggers-pop__status-icon",children:m.icon}),a.jsx(_,{size:"3",weight:"medium",children:m.label}),a.jsx(_,{size:"2",tone:"muted",children:g})]})]},g)})})]})})}function RC({initialValue:s,onCancel:n,onSave:r}){const[o,c]=p.useState([]),[d,f]=p.useState(!0),[y,g]=p.useState(new Set(s)),[m,x]=p.useState(""),[S,v]=p.useState(0),T=p.useRef(null),w=p.useRef(null);p.useEffect(()=>{(async()=>{try{const z=await Xd.MetaController_getAllTags({});c(z)}catch(z){console.error("Failed to load tags:",z)}finally{f(!1)}})()},[]),p.useEffect(()=>{T.current?.focus()},[]);const k=p.useMemo(()=>{if(!m.trim())return o;const A=m.toLowerCase().trim();return o.map(I=>{let H=0;return I.name.toLowerCase().startsWith(A)?H+=100:I.name.toLowerCase().includes(A)&&(H+=50),{tag:I,score:H}}).filter(I=>I.score>0).sort((I,H)=>H.score-I.score).map(I=>I.tag)},[o,m]),C=p.useMemo(()=>{if(!m.trim())return!1;const A=m.toLowerCase().trim();return!o.some(z=>z.name.toLowerCase()===A)},[m,o]);p.useEffect(()=>{v(0)},[k.length,m,C]),p.useEffect(()=>{if(w.current){const A=k.length+(C?1:0);if(S<A){const z=w.current.children[S];z&&z.scrollIntoView({block:"nearest"})}}},[S,k.length,C]);const j=A=>{g(z=>{const I=new Set(z);return I.has(A)?I.delete(A):I.add(A),I})},R=async()=>{try{const A=await Xd.MetaController_createTag({body:{name:m.trim()}});c(z=>[...z,A]),g(z=>new Set([...z,A.name])),x(""),T.current?.focus()}catch(A){console.error("Failed to create tag:",A)}},L=p.useCallback(A=>{const z=k.length+(C?1:0);if(z!==0)switch(A.key){case"ArrowDown":A.preventDefault(),v(I=>I<z-1?I+1:I);break;case"ArrowUp":A.preventDefault(),v(I=>I>0?I-1:0);break;case"Enter":A.preventDefault(),S<k.length?j(k[S].name):C&&S===k.length&&R();break;case"Escape":A.preventDefault(),m&&x("");break}},[k,S,C,m]);async function N(){return r({tagTriggers:Array.from(y)})}const M=p.useMemo(()=>Array.from(y).sort((A,z)=>A.localeCompare(z)),[y]);return a.jsx(ct,{title:"Edit Tag Triggers",onCancel:n,onSave:N,children:a.jsxs("div",{className:"edit-tag-triggers-pop__content",children:[a.jsxs(_,{size:"2",tone:"muted",className:"edit-tag-triggers-pop__description",children:["Select which tag names will trigger this agent to activate when added to a task (",y.size," selected)"]}),M.length>0&&a.jsxs(_,{size:"2",tone:"muted",className:"edit-tag-triggers-pop__description",children:["Selected: ",M.join(", ")]}),a.jsx("input",{ref:T,type:"text",className:"edit-tag-triggers-pop__input",placeholder:"Search or create tag...",value:m,onChange:A=>x(A.target.value),onKeyDown:L}),a.jsx("div",{className:"edit-tag-triggers-pop__list",ref:w,children:d?a.jsx("div",{className:"edit-tag-triggers-pop__empty",children:a.jsx(_,{tone:"muted",children:"Loading tags..."})}):k.length===0&&!C?a.jsx("div",{className:"edit-tag-triggers-pop__empty",children:a.jsx(_,{tone:"muted",children:"No tags found"})}):a.jsxs(a.Fragment,{children:[k.map((A,z)=>a.jsxs("label",{className:`edit-tag-triggers-pop__item ${z===S?"edit-tag-triggers-pop__item--highlighted":""}`,onMouseEnter:()=>v(z),children:[a.jsx("input",{type:"checkbox",checked:y.has(A.name),onChange:()=>j(A.name),className:"edit-tag-triggers-pop__checkbox"}),a.jsx("div",{className:"edit-tag-triggers-pop__tag-badge",style:{backgroundColor:A.color||"#999"},children:A.name})]},A.id)),C&&a.jsxs("div",{className:`edit-tag-triggers-pop__item edit-tag-triggers-pop__item--create ${S===k.length?"edit-tag-triggers-pop__item--highlighted":""}`,onClick:R,onMouseEnter:()=>v(k.length),children:[a.jsx(_,{size:"2",tone:"muted",children:"Create new tag:"}),a.jsx("div",{className:"edit-tag-triggers-pop__tag-badge",style:{backgroundColor:"#999"},children:m.trim()})]})]})})]})})}const Gy=s=>{s&&(s.style.height="auto",s.style.height=`${s.scrollHeight}px`)};function zC({initialValue:s,onCancel:n,onSave:r}){const[o,c]=p.useState(s),d=p.useRef(null);p.useEffect(()=>{d.current?.focus()},[]),p.useEffect(()=>{Gy(d.current)},[o]);function f(g){c(g.target.value),Gy(g.target)}async function y(){return r({introduction:o})}return a.jsx(ct,{title:"Edit Introduction",onCancel:n,onSave:y,children:a.jsx(a.Fragment,{children:a.jsx("div",{className:"edit-introduction-pop__input-wrapper",children:a.jsx("textarea",{className:"edit-introduction-pop__input-content",ref:d,placeholder:"Enter introduction...",value:o,onChange:f})})})})}const DC=[{value:"claude",label:"Claude",description:"Anthropic's Claude AI"},{value:"codex",label:"Codex",description:"OpenAI's Codex"},{value:"opencode",label:"OpenCode",description:"OpenCode agent"},{value:"adk",label:"ADK",description:"Agent Development Kit"},{value:"githubcopilot",label:"GitHub Copilot",description:"GitHub Copilot agent"},{value:"other",label:"Other",description:"Other agent type"}];function OC({initialValue:s,onCancel:n,onSave:r}){const[o,c]=p.useState(s);async function d(){return r({type:o})}return a.jsx(ct,{title:"Edit Agent Type",onCancel:n,onSave:d,children:a.jsxs("div",{className:"edit-agent-type-pop__content",children:[a.jsx(_,{size:"2",tone:"muted",className:"edit-agent-type-pop__description",children:"Select the type of agent (provider). An agent can only be of one type."}),a.jsx("div",{className:"edit-agent-type-pop__radio-list",children:DC.map(f=>a.jsxs("label",{className:"edit-agent-type-pop__radio-item",children:[a.jsx("input",{type:"radio",name:"agent-type",value:f.value,checked:o===f.value,onChange:()=>c(f.value),className:"edit-agent-type-pop__radio"}),a.jsxs("div",{className:"edit-agent-type-pop__type-info",children:[a.jsx(_,{size:"3",weight:"medium",children:f.label}),a.jsx(_,{size:"2",tone:"muted",children:f.description})]})]},f.value))})]})})}function LC({initialProviderId:s,initialModelId:n,onCancel:r,onSave:o}){const[c,d]=p.useState(s),[f,y]=p.useState(n),g=p.useRef(null),m=p.useRef(null);p.useEffect(()=>{g.current?.focus()},[]);async function x(){return o({providerId:c.trim(),modelId:f.trim()})}return a.jsx(ct,{title:"Edit Model",onCancel:r,onSave:x,children:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"edit-agent-model-pop__field",children:a.jsx("input",{className:"edit-agent-model-pop__input",ref:g,placeholder:"Provider ID (optional)",value:c,onChange:S=>d(S.target.value),onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),m.current?.focus())}})}),a.jsx("div",{className:"edit-agent-model-pop__field",children:a.jsx("input",{className:"edit-agent-model-pop__input",ref:m,placeholder:"Model ID (optional)",value:f,onChange:S=>y(S.target.value)})})]})})}function qC({initialValue:s,onCancel:n,onSave:r}){const[o,c]=p.useState(s!==null?String(s):""),[d,f]=p.useState(null),y=p.useRef(null);p.useEffect(()=>{y.current?.focus()},[]);const g=async()=>{const m=o.trim();if(m.length===0)return r({concurrencyLimit:null});const x=Number(m);return!Number.isInteger(x)||x<1?(f("Use a whole number of 1 or higher, or leave empty for unlimited."),!1):(f(null),r({concurrencyLimit:x}))};return a.jsx(ct,{title:"Edit Concurrency",onCancel:n,onSave:g,children:a.jsxs("div",{className:"edit-concurrency-limit-pop__content",children:[a.jsx(_,{size:"2",tone:"muted",children:"Leave empty for unlimited parallel tasks."}),a.jsx("input",{ref:y,className:"edit-concurrency-limit-pop__input",type:"number",min:1,step:1,placeholder:"Unlimited",value:o,onChange:m=>{c(m.target.value),d&&f(null)}}),d&&a.jsx(_,{size:"1",className:"edit-concurrency-limit-pop__error",children:d})]})})}function xv({avatars:s,selectedUrl:n,onSelect:r}){return a.jsx("div",{className:"agent-avatar-picker",children:s.map(o=>{const c=n===o.url;return a.jsxs("button",{type:"button",className:`agent-avatar-picker__option ${c?"agent-avatar-picker__option--selected":""}`,onClick:()=>r(o.url),"aria-pressed":c,children:[a.jsx(Ue,{name:o.label,src:o.url,size:64,className:"agent-avatar-picker__image"}),a.jsx(_,{size:"2",weight:"medium",children:o.label})]},o.id)})})}function MC({avatars:s,initialValue:n,onCancel:r,onSave:o}){const[c,d]=p.useState(n??s[0]?.url??"");async function f(){return c?o({avatarUrl:c}):!1}return a.jsx(ct,{title:"Choose Avatar",onCancel:r,onSave:f,children:a.jsx(xv,{avatars:s,selectedUrl:c,onSelect:d})})}const Nd=["meta:read","meta:write","tasks:read","tasks:write","context:read","context:write","agents:read","run:read","run:write","threads:read","threads:write","mcp-registry:read","mcp:use","secret:read"];function BC(){const{slug:s}=Wt(),n=Re(),{agents:r,setSectionTitle:o,loadAgentDetails:c,updateAgent:d,deleteAgent:f}=ti(),{showError:y}=hn(),g=r.find(ie=>ie.slug===s),[m,x]=p.useState(g||null),[S,v]=p.useState(!g),[T,w]=p.useState([]),[k,C]=p.useState(!1),[j,R]=p.useState(null),[L,N]=p.useState(!1),[M,A]=p.useState(!1),[z,I]=p.useState(""),[H,P]=p.useState(new Set(Nd)),[U,J]=p.useState(30),[X,te]=p.useState([]),[ue,B]=p.useState(!1),[re,he]=p.useState([]),[ke,Te]=p.useState(!1),[D,K]=p.useState([]),[ce,de]=p.useState(!1),[G,ne]=p.useState(!1),[le,_e]=p.useState(!1),[ze,mt]=p.useState(!1),[fn,pn]=p.useState(!1),[Kn,yt]=p.useState(!1),[je,Ee]=p.useState(!1),[ft,kt]=p.useState(!1),[On,en]=p.useState(!1),[qt,os]=p.useState([]),gn=p.useCallback(async()=>{if(s){C(!0);try{const ie=await jo.AgentTokensController_listTokens({slug:s});w(ie)}catch(ie){console.error("Failed to load tokens:",ie)}finally{C(!1)}}},[s]),xt=p.useCallback(async()=>{B(!0);try{const ie=await _C.AuthorizationController_getScopes({});te(ie.scopes)}catch(ie){console.error("Failed to load scopes:",ie)}finally{B(!1)}},[]),cs=p.useCallback(async()=>{try{const ie=await Oa.AgentsController_listAgentTemplates({});os(ie.avatars)}catch(ie){console.error("Failed to load avatar catalog:",ie)}},[]),us=p.useCallback(async()=>{Te(!0);try{const ie=await Xd.MetaController_getAllTags({});he(ie)}catch(ie){console.error("Failed to load tags:",ie)}finally{Te(!1)}},[]),pa=p.useCallback(async()=>{if(m){de(!0);try{const ie=await Yr.AgentToolPermissionsController_listAgentToolPermissions({actorId:m.actorId});K(ie)}catch(ie){console.error("Failed to load tool permissions:",ie)}finally{de(!1)}}},[m]);p.useEffect(()=>{!g&&s?(v(!0),console.log("AGENT DETAIL PAGE"),c(s).then(ie=>{x(ie),v(!1)}).catch(ie=>{x(null)})):g&&x(g)},[s,g,c]),p.useEffect(()=>{m&&(gn(),us(),pa(),qt.length===0&&cs())},[m,qt.length,gn,us,pa,cs]),p.useEffect(()=>{M&&X.length===0&&xt(),M||P(new Set(Nd))},[M,X.length,xt]),wt({agent:{name:m?.name}}),p.useEffect(()=>{if(!m){o("Agent");return}o(m.name)},[m,o]);const qs=async()=>{if(!(!s||!z.trim()||H.size===0)){N(!0);try{const ie=Array.from(H),ye=await jo.AgentTokensController_issueToken({slug:s,body:{name:z.trim(),scopes:ie,expirationDays:U}});R(ye.token),A(!1),I(""),P(new Set(Nd)),await gn()}catch(ie){console.error("Failed to create token:",ie),alert("Failed to create token")}finally{N(!1)}}},Ul=ie=>{P(ye=>{const At=new Set(ye);return At.has(ie)?At.delete(ie):At.add(ie),At})},Ga=async({systemPrompt:ie})=>{if(!m)return!1;try{const ye=await d(m.actorId,{systemPrompt:ie});return ye?(x(ye),ne(!1),!0):!1}catch(ye){return console.error("Failed to update system prompt:",ye),y(ye),!1}},$l=async({statusTriggers:ie})=>{if(!m)return!1;try{const ye=await d(m.actorId,{statusTriggers:ie});return ye?(x(ye),_e(!1),!0):!1}catch(ye){return console.error("Failed to update status triggers:",ye),y(ye),!1}},Hl=async({tagTriggers:ie})=>{if(!m)return!1;try{const ye=await d(m.actorId,{tagTriggers:ie});return ye?(x(ye),mt(!1),!0):!1}catch(ye){return console.error("Failed to update tag triggers:",ye),y(ye),!1}},ds=async({introduction:ie})=>{if(!m)return!1;try{const ye=await d(m.actorId,{introduction:ie});return ye?(x(ye),yt(!1),!0):!1}catch(ye){return console.error("Failed to update introduction:",ye),y(ye),!1}},Mt=async({type:ie})=>{if(!m)return!1;try{const ye=await d(m.actorId,{type:ie});return ye?(x(ye),pn(!1),!0):!1}catch(ye){return console.error("Failed to update agent type:",ye),y(ye),!1}},mn=async({providerId:ie,modelId:ye})=>{if(!m)return!1;try{const At=await d(m.actorId,{providerId:ie,modelId:ye});return At?(x(At),Ee(!1),!0):!1}catch(At){return console.error("Failed to update model config:",At),y(At),!1}},Bt=async({concurrencyLimit:ie})=>{if(!m)return!1;try{const ye=await d(m.actorId,{concurrencyLimit:ie});return ye?(x(ye),kt(!1),!0):!1}catch(ye){return console.error("Failed to update concurrency limit:",ye),y(ye),!1}},Ln=async({avatarUrl:ie})=>{if(!m)return!1;try{const ye=await d(m.actorId,{avatarUrl:ie});return ye?(x(ye),en(!1),!0):!1}catch(ye){return console.error("Failed to update avatar:",ye),y(ye),!1}},Ms=async ie=>{if(s&&confirm("Are you sure you want to revoke this token? This action cannot be undone."))try{await jo.AgentTokensController_revokeToken({slug:s,tokenId:ie}),await gn()}catch(ye){console.error("Failed to revoke token:",ye),alert("Failed to revoke token")}},hs=async ie=>{if(s){N(!0);try{const ye=await jo.AgentTokensController_issueToken({slug:s,body:{name:ie.name,scopes:ie.scopes,expirationDays:U}});R(ye.token),await gn()}catch(ye){console.error("Failed to refresh token:",ye),alert("Failed to refresh token")}finally{N(!1)}}},Bs=ie=>{navigator.clipboard.writeText(ie)};if(S)return a.jsx("div",{className:"agent-detail-page",children:a.jsx(W,{spacing:"4",align:"center",children:a.jsx(_,{size:"3",tone:"muted",children:"Loading agent..."})})});if(!m)return a.jsx("div",{className:"agent-detail-page",children:a.jsxs(W,{spacing:"4",align:"center",children:[a.jsx(_,{size:"3",tone:"muted",children:"Agent not found"}),a.jsx(oe,{variant:"secondary",onClick:()=>n("/agents"),children:"Back to agents"})]})});const fs=m.introduction,Xn=typeof fs=="string"?fs:"",qn=m.providerId&&m.providerId.trim().length>0?m.providerId:"Default provider",Is=m.modelId&&m.modelId.trim().length>0?m.modelId:"Default model",se=m.concurrencyLimit,pe=typeof se=="number"&&Number.isFinite(se)&&se>0?Math.floor(se):null,Ke=new Map(re.map(ie=>[ie.name,ie.color])),nt=D.filter(ie=>ie.server.providedId==="tasks"||ie.server.providedId==="context").length,ut=D.length-nt,Zn=ce?"Loading tool permissions...":D.length===0?"No tools configured":`${D.length} ${D.length===1?"tool":"tools"} configured`,Me=ce?"Checking assigned tools and scopes":D.length===0?"Tasks and Context can be configured from the dedicated tools page.":`${nt} system ${nt===1?"tool":"tools"}, ${ut} additional ${ut===1?"tool":"tools"}`;return a.jsxs("div",{className:"agent-detail-page",children:[a.jsx(fe,{className:"agent-detail-page__section",children:a.jsxs(ge,{onClick:()=>en(!0),leading:a.jsx(Ue,{size:"sm",name:m.name,src:m.avatarUrl||void 0}),tags:[IC(m.type),UC(m.isActive)],topRight:a.jsx(_,{size:"1",tone:"muted",children:Nt(m.updatedAt)}),children:[a.jsx(_,{as:"span",weight:"normal",tone:"muted",size:"3",children:` @${m.slug} `}),a.jsxs(_,{as:"span",tone:"muted",style:"mono",children:["#",m.actorId.slice(0,6)]}),a.jsx(_,{children:m.description?String(m.description):"No description"}),a.jsx(_,{size:"1",tone:"muted",children:"tap to edit avatar"})]})}),a.jsx(fe,{title:"System Prompt",className:"agent-detail-page__section",children:a.jsxs(ge,{onClick:()=>ne(!0),children:[a.jsx(_,{size:"2",style:"mono",className:"agent-detail-page__text-preview agent-detail-page__text-preview--system",children:m.systemPrompt||"No system prompt configured"}),a.jsx(_,{size:"1",tone:"muted",children:"tap to edit"})]})}),a.jsx(fe,{title:"Introduction",className:"agent-detail-page__section",children:a.jsxs(ge,{onClick:()=>yt(!0),children:[a.jsx(_,{size:"2",className:"agent-detail-page__text-preview",children:Xn.trim().length>0?Xn:"No introduction configured"}),a.jsx(_,{size:"1",tone:"muted",children:"tap to edit"})]})}),a.jsx(fe,{title:"Agent Type",className:"agent-detail-page__section",children:a.jsxs(ge,{onClick:()=>pn(!0),children:[a.jsx(_,{size:"2",tone:"muted",children:m.type}),a.jsx(_,{size:"1",tone:"muted",children:"tap to edit"})]})}),a.jsx(fe,{title:"Model",className:"agent-detail-page__section",children:a.jsxs(ge,{onClick:()=>Ee(!0),children:[a.jsxs(W,{spacing:"1",children:[a.jsxs(_,{size:"2",tone:"muted",children:["Provider: ",qn]}),a.jsxs(_,{size:"2",tone:"muted",children:["Model: ",Is]})]}),a.jsx(_,{size:"1",tone:"muted",children:"tap to edit"})]})}),a.jsx(fe,{title:"Concurrency",className:"agent-detail-page__section",children:a.jsxs(ge,{onClick:()=>kt(!0),children:[a.jsx(_,{size:"2",tone:"muted",children:pe===null?"Unlimited parallel tasks":`${pe} parallel ${pe===1?"task":"tasks"}`}),a.jsx(_,{size:"1",tone:"muted",children:"tap to edit"})]})}),a.jsx(fe,{title:"Status Triggers",className:"agent-detail-page__section",children:a.jsxs(ge,{onClick:()=>_e(!0),children:[m.statusTriggers.length>0?m.statusTriggers.map(ie=>a.jsx(_,{tone:"muted",children:ie},ie)):a.jsx(_,{tone:"muted",children:"No status triggers configured"}),a.jsx(_,{size:"1",tone:"muted",children:"tap to edit"})]})}),a.jsx(fe,{title:"Tag Triggers",className:"agent-detail-page__section",children:a.jsxs(ge,{onClick:()=>mt(!0),children:[m.tagTriggers&&m.tagTriggers.length>0?a.jsx("div",{className:"agent-detail-page__tag-triggers",children:ke?a.jsx(_,{tone:"muted",children:"Loading tags..."}):m.tagTriggers.map(ie=>a.jsx(Ds,{color:$C(Ke.get(ie)),children:ie},ie))}):a.jsx(_,{tone:"muted",children:"No tag triggers configured"}),a.jsx(_,{size:"1",tone:"muted",children:"tap to edit"})]})}),a.jsx(fe,{title:"Tools",className:"agent-detail-page__section",children:a.jsxs(ge,{onClick:()=>n(`/agents/agent/${m.slug}/tools`),children:[a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"2",weight:"medium",children:Zn}),a.jsx(_,{size:"1",tone:"muted",children:Me})]}),a.jsx(_,{size:"1",tone:"muted",children:"tap to manage"})]})}),j&&a.jsx(fe,{title:"New Token Created",className:"agent-detail-page__section agent-detail-page__new-token",children:a.jsx(ge,{children:a.jsxs(W,{spacing:"2",children:[a.jsx(_,{weight:"medium",size:"2",className:"agent-detail-page__warning-text",children:"Copy this token now. It will not be shown again."}),a.jsx("div",{className:"agent-detail-page__token-display",children:a.jsx("code",{className:"agent-detail-page__token-code",children:j})}),a.jsxs("div",{className:"agent-detail-page__button-row",children:[a.jsx(oe,{size:"sm",onClick:()=>Bs(j),children:"Copy Token"}),a.jsx(oe,{size:"sm",variant:"secondary",onClick:()=>R(null),children:"Dismiss"})]})]})})}),a.jsxs(fe,{title:"Access Tokens",className:"agent-detail-page__section",action:!M&&a.jsx(oe,{size:"sm",onClick:()=>A(!0),children:"New Token"}),children:[M&&a.jsx(ge,{children:a.jsxs(W,{spacing:"3",children:[a.jsx(_,{weight:"medium",size:"2",children:"Create New Token"}),a.jsxs("div",{className:"agent-detail-page__form-field",children:[a.jsx("label",{children:a.jsx(_,{size:"1",tone:"muted",children:"Token Name"})}),a.jsx("input",{type:"text",value:z,onChange:ie=>I(ie.target.value),placeholder:"e.g., CI/CD Pipeline",className:"agent-detail-page__input"})]}),a.jsxs("div",{className:"agent-detail-page__form-field",children:[a.jsx("label",{children:a.jsx(_,{size:"1",tone:"muted",children:"Scopes"})}),a.jsx(_,{size:"1",tone:"muted",className:"agent-detail-page__scope-note",children:"The preselected scopes are sufficient for the worker process running this agent."}),ue?a.jsx(_,{size:"2",tone:"muted",children:"Loading available scopes..."}):a.jsx("div",{className:"agent-detail-page__scopes-list",children:X.map(ie=>a.jsxs("label",{className:"agent-detail-page__scope-item",children:[a.jsx("input",{type:"checkbox",checked:H.has(ie.id),onChange:()=>Ul(ie.id)}),a.jsxs("div",{className:"agent-detail-page__scope-info",children:[a.jsx(_,{size:"2",weight:"medium",children:ie.id}),a.jsx(_,{size:"1",tone:"muted",children:ie.description})]})]},ie.id))})]}),a.jsxs("div",{className:"agent-detail-page__form-field",children:[a.jsx("label",{children:a.jsx(_,{size:"1",tone:"muted",children:"Expires in (days)"})}),a.jsx("input",{type:"number",value:U,onChange:ie=>J(parseInt(ie.target.value)||30),min:1,max:365,className:"agent-detail-page__input"})]}),a.jsxs("div",{className:"agent-detail-page__button-row",children:[a.jsx(oe,{size:"sm",onClick:qs,disabled:L||!z.trim()||H.size===0,children:L?"Creating...":"Create Token"}),a.jsx(oe,{size:"sm",variant:"secondary",onClick:()=>A(!1),children:"Cancel"})]})]})}),k?a.jsx(ge,{children:a.jsx(_,{tone:"muted",size:"2",children:"Loading tokens..."})}):T.length===0?a.jsx(ge,{children:a.jsx(_,{tone:"muted",size:"2",children:"No tokens issued for this agent yet."})}):T.map(ie=>a.jsxs(ge,{tags:[ie.isValid?{label:"active",color:"green"}:{label:ie.revokedAt?"revoked":"expired",color:"gray"}],topRight:ie.isValid?a.jsx(oe,{size:"sm",variant:"secondary",onClick:()=>Ms(ie.id),children:"Revoke"}):a.jsx(oe,{size:"sm",variant:"secondary",onClick:()=>hs(ie),disabled:L,children:"Refresh"}),children:[a.jsx(_,{weight:"medium",size:"2",children:ie.name}),a.jsxs(W,{spacing:"1",children:[a.jsxs(_,{size:"1",tone:"muted",children:["Scopes: ",ie.scopes.join(", ")]}),a.jsxs(_,{size:"1",tone:"muted",children:["Created: ",new Date(ie.createdAt).toLocaleDateString()," by ",ie.issuedByDisplayName]}),a.jsxs(_,{size:"1",tone:"muted",children:["Expires: ",new Date(ie.expiresAt).toLocaleDateString()]}),ie.revokedAt&&a.jsxs(_,{size:"1",tone:"muted",className:"agent-detail-page__revoked-text",children:["Revoked: ",new Date(String(ie.revokedAt)).toLocaleDateString()]})]})]},ie.id))]}),a.jsx(Ml,{className:"agent-detail-page__actions",onDelete:async()=>{f(m.actorId),n("/agents")}}),a.jsx(fe,{className:"agent-detail-page__actions",children:a.jsx(oe,{size:"lg",variant:"secondary",onClick:()=>n("/agents"),children:"Back to Agents"})}),G&&m&&a.jsx(NC,{initialValue:m.systemPrompt,onCancel:()=>ne(!1),onSave:Ga}),le&&m&&a.jsx(AC,{initialValue:m.statusTriggers,onCancel:()=>_e(!1),onSave:$l}),ze&&m&&a.jsx(RC,{initialValue:m.tagTriggers||[],onCancel:()=>mt(!1),onSave:Hl}),fn&&m&&a.jsx(OC,{initialValue:m.type,onCancel:()=>pn(!1),onSave:Mt}),Kn&&m&&a.jsx(zC,{initialValue:Xn,onCancel:()=>yt(!1),onSave:ds}),je&&m&&a.jsx(LC,{initialProviderId:m.providerId??"",initialModelId:m.modelId??"",onCancel:()=>Ee(!1),onSave:mn}),ft&&m&&a.jsx(qC,{initialValue:pe,onCancel:()=>kt(!1),onSave:Bt}),On&&m&&qt.length>0&&a.jsx(MC,{avatars:qt,initialValue:m.avatarUrl,onCancel:()=>en(!1),onSave:Ln})]})}function IC(s){return{label:s,color:{claude:"orange",codex:"green",opencode:"blue",adk:"red",githubcopilot:"yellow",other:"gray"}[s]||"gray"}}function UC(s){return{label:s?"active":"inactive",color:s?"green":"gray"}}function $C(s){if(!s)return"gray";const n={"#6B7280":"gray","#3B82F6":"blue","#10B981":"green","#52B788":"green","#F59E0B":"yellow","#F97316":"orange","#EF4444":"red","#8B5CF6":"purple","#A855F7":"purple","#98D8C8":"green"};if(n[s])return n[s];const r=parseInt(s.slice(1,3),16),o=parseInt(s.slice(3,5),16),c=parseInt(s.slice(5,7),16);return r>o&&r>c?o>100?"orange":"red":o>r&&o>c?"green":c>r&&c>o?r>100?"purple":"blue":r>150&&o>150&&c<100?"yellow":"gray"}function HC({currentPermissions:s,onCancel:n,onSaveUnscopedTool:r,onConfigureScopedTool:o}){const[c,d]=p.useState([]),[f,y]=p.useState(!0),[g,m]=p.useState(""),[x,S]=p.useState(0),[v,T]=p.useState(""),[w,k]=p.useState([]),[C,j]=p.useState(!1),[R,L]=p.useState(!1),N=p.useRef(null),M=p.useRef(null);p.useEffect(()=>{N.current?.focus()},[]),p.useEffect(()=>{(async()=>{y(!0);try{const ue=await Fr.McpRegistryController_listServers({});d(ue.items)}catch(ue){console.error("Failed to load tools:",ue)}finally{y(!1)}})()},[]);const A=new Set(s.map(te=>te.serverId)),z=p.useMemo(()=>c.filter(te=>!A.has(te.id)),[c,A]),I=p.useMemo(()=>{const te=g.trim().toLowerCase();return te?z.filter(ue=>ue.name.toLowerCase().includes(te)||ue.type.toLowerCase().includes(te)||ue.description.toLowerCase().includes(te)||ue.providedId.toLowerCase().includes(te)):z},[g,z]),H=I.find(te=>te.id===v)??z.find(te=>te.id===v)??null;p.useEffect(()=>{S(0)},[I.length,g]),p.useEffect(()=>{if(!M.current)return;M.current.children[x]?.scrollIntoView({block:"nearest"})},[x]),p.useEffect(()=>{if(!H||H.type!=="http"){k([]),j(!1);return}let te=!1;return j(!0),Fr.McpRegistryController_listScopes({serverId:H.id}).then(ue=>{te||k(ue)}).catch(ue=>{te||(console.error("Failed to load scopes:",ue),k([]))}).finally(()=>{te||j(!1)}),()=>{te=!0}},[H]);const P=p.useCallback(te=>{if(!(te.nativeEvent.isComposing||I.length===0))switch(te.key){case"ArrowDown":te.preventDefault(),S(ue=>ue<I.length-1?ue+1:ue);break;case"ArrowUp":te.preventDefault(),S(ue=>ue>0?ue-1:0);break;case"Enter":te.preventDefault(),T(I[x]?.id??"");break}},[I,x]),U=p.useCallback(async()=>{if(!(!H||C||R)){if(H.type==="http"&&w.length>0){o(H,w),n?.();return}L(!0);try{await r(H),n?.()}finally{L(!1)}}},[R,C,n,o,r,H,w]),J=p.useCallback(async(te,ue)=>{if(!R){if(T(te.id),S(ue),te.type!=="http"){L(!0);try{await r(te),n?.()}finally{L(!1)}return}j(!0);try{const B=await Fr.McpRegistryController_listScopes({serverId:te.id});if(B.length>0){o(te,B),n?.();return}L(!0);try{await r(te),n?.()}finally{L(!1)}}catch(B){console.error("Failed to load scopes:",B)}finally{j(!1)}}},[R,n,o,r]),X=H?.type==="http"&&w.length>0?"next":R?"saving":"save";return a.jsx(ct,{title:"Add Tool",onCancel:n,headerRight:a.jsx("div",{onClick:()=>{U()},style:{opacity:!H||C||R?.5:1,pointerEvents:!H||C||R?"none":"auto"},children:a.jsx(_,{size:"4",weight:"normal",className:"pop-shell__main-title-button",children:X})}),children:a.jsx("div",{className:"actor-search-pop",children:f?a.jsx("div",{className:"actor-search-pop__empty",children:a.jsx(_,{tone:"muted",children:"Loading tools..."})}):z.length===0?a.jsx("div",{className:"actor-search-pop__empty",children:a.jsx(_,{tone:"muted",children:"All available tools already assigned"})}):a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:N,type:"text",className:"actor-search-pop__input",placeholder:"Search tools...",value:g,onChange:te=>m(te.target.value),onKeyDown:P}),a.jsx("div",{className:"actor-search-pop__list",ref:M,role:"listbox","aria-label":"Tools",children:I.length===0?a.jsx("div",{className:"actor-search-pop__empty",children:a.jsx(_,{tone:"muted",children:"No tools found"})}):I.map((te,ue)=>{const B=ue===x,re=te.id===v;return a.jsxs("button",{type:"button",role:"option","aria-selected":re,className:`actor-search-pop__item ${B||re?"actor-search-pop__item--highlighted":""}`,onClick:()=>{J(te,ue)},onMouseEnter:()=>S(ue),disabled:R||C,children:[a.jsx(Ue,{name:te.name,size:"sm"}),a.jsxs("div",{className:"actor-search-pop__item-info",children:[a.jsx(_,{weight:"medium",size:"2",children:te.name}),a.jsxs(_,{tone:"muted",size:"1",children:["@",te.providedId," · ",te.type]})]})]},te.id)})})]})})})}function Py({agentActorId:s,currentPermissions:n,onCancel:r,onSave:o,editingPermission:c=null,onDelete:d,fixedTool:f=null,title:y,saveLabel:g}){const[m,x]=p.useState([]),[S,v]=p.useState(!0),[T,w]=p.useState(""),[k,C]=p.useState(0),[j,R]=p.useState(f?.serverId||c?.serverId||""),[L,N]=p.useState([]),[M,A]=p.useState(!1),[z,I]=p.useState(c?new Set(c.scopeIds):new Set),[H,P]=p.useState(c?.hasAllScopes||!1),[U,J]=p.useState(!1),X=!!c,te=!!f,ue=p.useRef(null),B=p.useRef(null);p.useEffect(()=>{(async()=>{v(!0);try{const _e=await Fr.McpRegistryController_listServers({});x(_e.items)}catch(_e){console.error("Failed to load tools:",_e)}finally{v(!1)}})()},[]);const re=m.find(le=>le.id===j),he=re?.type==="http",ke=!!(he&&L.length>0),Te=new Set(n.map(le=>le.serverId)),D=m.filter(le=>!Te.has(le.id)||X&&c&&le.id===c.serverId),K=p.useMemo(()=>{if(X||te)return D;const le=T.trim().toLowerCase();return le?D.filter(_e=>_e.name.toLowerCase().includes(le)||_e.type.toLowerCase().includes(le)||_e.description.toLowerCase().includes(le)):D},[X,te,T,D]);p.useEffect(()=>{!X&&!te&&ue.current?.focus()},[X,te]),p.useEffect(()=>{C(0)},[K.length,T]),p.useEffect(()=>{if(!B.current||X||te)return;B.current.children[k]?.scrollIntoView({block:"nearest"})},[k,X,te]),p.useEffect(()=>{j&&he?(A(!0),Fr.McpRegistryController_listScopes({serverId:j}).then(le=>{N(le),c&&c.serverId===j&&(I(new Set(c.scopeIds)),P(c.hasAllScopes))}).catch(le=>{console.error("Failed to load scopes:",le),N([])}).finally(()=>{A(!1)})):(N([]),!X&&!te&&(I(new Set),P(!1)))},[j,he,c,X,te]);const ce=()=>{const le=!H;P(le),I(le?new Set(L.map(_e=>_e.id)):new Set)},de=le=>{I(_e=>{const ze=new Set(_e);ze.has(le)?ze.delete(le):ze.add(le);const mt=L.length>0&&L.every(fn=>ze.has(fn.id));return P(mt),ze})},G=p.useCallback(async()=>{if(!j)return!1;J(!0);try{return await Yr.AgentToolPermissionsController_upsertAgentToolPermission({actorId:s,serverId:j,body:{scopeIds:Array.from(z)}}),!te&&!X&&R(""),I(new Set),P(!1),await o(),!0}catch(le){return console.error("Failed to add permission:",le),alert("Failed to add tool permission"),!1}finally{J(!1)}},[s,X,te,o,ke,z,j]),ne=p.useCallback(le=>{if(!(le.nativeEvent.isComposing||K.length===0))switch(le.key){case"ArrowDown":le.preventDefault(),C(_e=>_e<K.length-1?_e+1:_e);break;case"ArrowUp":le.preventDefault(),C(_e=>_e>0?_e-1:0);break;case"Enter":le.preventDefault(),R(K[k]?.id??"");break}},[K,k]);return a.jsx(ct,{title:y??(X?"Edit Tool Permission":"Select Scopes"),onCancel:r,onSave:G,headerRight:g?a.jsx("div",{onClick:()=>{G()},style:{opacity:U?.5:1,pointerEvents:U?"none":"auto"},children:a.jsx(_,{size:"4",weight:"normal",className:"pop-shell__main-title-button",children:U?"saving":g})}):void 0,children:a.jsx("div",{className:"actor-search-pop",children:a.jsx(W,{spacing:"2",children:S?a.jsx(_,{size:"2",tone:"muted",children:"Loading available tools..."}):D.length===0?a.jsx(_,{size:"2",tone:"muted",children:"All available tools already assigned"}):a.jsxs(a.Fragment,{children:[!X&&!te?a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:ue,type:"text",className:"actor-search-pop__input",placeholder:"Search tools...",value:T,onChange:le=>w(le.target.value),onKeyDown:ne}),a.jsx("div",{className:"actor-search-pop__list",ref:B,role:"listbox","aria-label":"Tools",children:K.length===0?a.jsx("div",{className:"actor-search-pop__empty",children:a.jsx(_,{tone:"muted",size:"2",children:"No tools found"})}):K.map((le,_e)=>{const ze=_e===k,mt=le.id===j;return a.jsxs("button",{type:"button",role:"option","aria-selected":mt,className:`actor-search-pop__item ${ze||mt?"actor-search-pop__item--highlighted":""}`,onClick:()=>{R(le.id),C(_e)},onMouseEnter:()=>C(_e),disabled:U,children:[a.jsx(Ue,{name:le.name,size:"sm"}),a.jsxs("div",{className:"actor-search-pop__item-info",children:[a.jsx(_,{weight:"medium",size:"2",children:le.name}),a.jsxs(_,{tone:"muted",size:"1",children:["@",le.providedId," · ",le.type]})]})]},le.id)})})]}):a.jsxs("div",{className:"edit-agent-tool-permissions-pop__selected-tool",children:[a.jsx(_,{size:"2",weight:"medium",children:re?.name??f?.serverName??c?.serverName}),a.jsx(_,{size:"1",tone:"muted",children:re?.description??"Update the scopes for this tool."})]}),j&&he&&L.length>0&&a.jsxs("div",{className:"edit-agent-tool-permissions-pop__scopes",children:[a.jsx(_,{size:"2",weight:"medium",children:"Select Scopes"}),a.jsxs("label",{className:"edit-agent-tool-permissions-pop__scope-item",children:[a.jsx("input",{type:"checkbox",checked:H,onChange:ce}),a.jsxs("div",{className:"edit-agent-tool-permissions-pop__scope-info",children:[a.jsx(_,{size:"2",weight:"medium",children:"All scopes"}),a.jsx(_,{size:"1",tone:"muted",children:"Grant all available scopes"})]})]}),L.map(le=>a.jsxs("label",{className:"edit-agent-tool-permissions-pop__scope-item",children:[a.jsx("input",{type:"checkbox",checked:z.has(le.id),onChange:()=>de(le.id)}),a.jsxs("div",{className:"edit-agent-tool-permissions-pop__scope-info",children:[a.jsx(_,{size:"2",weight:"medium",style:"mono",children:le.id}),a.jsx(_,{size:"1",tone:"muted",children:le.description})]})]},le.id))]}),j&&he&&L.length===0&&!M&&a.jsx(_,{size:"2",tone:"muted",children:"This HTTP tool does not define scopes. Access will be granted without scope selection."}),j&&!he&&a.jsx(_,{size:"2",tone:"muted",children:"This STDIO tool does not require scope configuration."}),j&&X&&d&&a.jsx(W,{spacing:"2",children:a.jsx(oe,{size:"sm",variant:"secondary",onClick:()=>{d()},children:"Remove Tool"})})]})})})})}function Vy(s){return s.server.providedId==="tasks"||s.server.providedId==="context"}function Yy(s){return s.server.type==="stdio"?"No scopes required":s.hasAllScopes?"All scopes":`${s.grantedScopes.length} scope${s.grantedScopes.length===1?"":"s"} granted`}function GC(){const{slug:s}=Wt(),n=Re(),{agents:r,setSectionTitle:o,loadAgentDetails:c}=ti(),{showError:d}=hn(),f=r.find(X=>X.slug===s),[y,g]=p.useState(f||null),[m,x]=p.useState(!f),[S,v]=p.useState([]),[T,w]=p.useState(!1),[k,C]=p.useState(!1),[j,R]=p.useState(!1),[L,N]=p.useState(null),[M,A]=p.useState(null),z=p.useCallback(async X=>{w(!0);try{const te=await Yr.AgentToolPermissionsController_listAgentToolPermissions({actorId:X});v(te)}catch(te){console.error("Failed to load tool permissions:",te),d(te)}finally{w(!1)}},[d]);p.useEffect(()=>{!f&&s?(x(!0),c(s).then(X=>{g(X),x(!1)}).catch(()=>{g(null),x(!1)})):f&&(g(f),x(!1))},[s,f,c]),p.useEffect(()=>{y&&z(y.actorId)},[y,z]),p.useEffect(()=>{if(!y){o("Tools");return}o(`${y.name} Tools`)},[y,o]),wt({agent:{name:y?`${y.name} Tools`:void 0}});const I=()=>{C(!0)},H=X=>{N(X),R(!0)},P=async X=>{if(y&&confirm("Remove this tool permission?"))try{await Yr.AgentToolPermissionsController_deleteAgentToolPermission({actorId:y.actorId,serverId:X}),R(!1),N(null),await z(y.actorId)}catch(te){console.error("Failed to delete tool permission:",te),d(te)}};if(m)return a.jsx("div",{className:"agent-tools-page",children:a.jsx(W,{spacing:"4",align:"center",children:a.jsx(_,{size:"3",tone:"muted",children:"Loading tools..."})})});if(!y)return a.jsx("div",{className:"agent-tools-page",children:a.jsxs(W,{spacing:"4",align:"center",children:[a.jsx(_,{size:"3",tone:"muted",children:"Agent not found"}),a.jsx(oe,{variant:"secondary",onClick:()=>n("/agents"),children:"Back to agents"})]})});const U=S.filter(Vy),J=S.filter(X=>!Vy(X));return a.jsxs("div",{className:"agent-tools-page",children:[a.jsx(fe,{className:"agent-tools-page__section",children:a.jsx(ge,{children:a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"3",weight:"medium",children:"Tools"}),a.jsx(_,{size:"2",tone:"muted",children:"Tasks and Context stay available. Additional tools can be assigned per agent with scoped access."})]})})}),a.jsx(fe,{title:"System Tools",className:"agent-tools-page__section",children:U.map(X=>a.jsx(ge,{children:a.jsx("div",{className:"agent-tools-page__row",children:a.jsxs("div",{className:"agent-tools-page__row-main",children:[a.jsxs("div",{className:"agent-tools-page__row-title",children:[a.jsx(_,{size:"2",weight:"medium",children:X.server.name}),a.jsxs("div",{className:"agent-tools-page__chips",children:[a.jsx(Ds,{color:"purple",children:"System Tool"}),a.jsx(Ds,{color:X.server.type==="http"?"green":"orange",children:X.server.type})]})]}),a.jsx(_,{size:"1",tone:"muted",children:X.server.description}),a.jsx(_,{size:"1",tone:"muted",children:Yy(X)})]})})},X.server.id))}),a.jsx(fe,{title:"Additional Tools",className:"agent-tools-page__section",children:T?a.jsx(ge,{children:a.jsx(_,{size:"2",tone:"muted",children:"Loading tool permissions..."})}):J.length===0?a.jsx(ge,{children:a.jsxs(W,{spacing:"1",children:[a.jsx(_,{size:"2",tone:"muted",children:"No additional tools configured"}),a.jsx(_,{size:"1",tone:"muted",children:"Add a tool to grant this agent access beyond Tasks and Context."})]})}):J.map(X=>a.jsx(ge,{onClick:()=>H(X),trailing:a.jsx(_,{size:"2",tone:"muted",children:"Edit"}),children:a.jsx("div",{className:"agent-tools-page__row",children:a.jsxs("div",{className:"agent-tools-page__row-main",children:[a.jsxs("div",{className:"agent-tools-page__row-title",children:[a.jsx(_,{size:"2",weight:"medium",children:X.server.name}),a.jsx("div",{className:"agent-tools-page__chips",children:a.jsx(Ds,{color:X.server.type==="http"?"green":"orange",children:X.server.type})})]}),a.jsx(_,{size:"1",tone:"muted",children:X.server.description}),a.jsx(_,{size:"1",tone:"muted",children:Yy(X)})]})})},X.server.id))}),a.jsxs(fe,{className:"agent-tools-page__actions",children:[a.jsx(oe,{size:"lg",onClick:I,children:"Add Tool"}),a.jsx(oe,{size:"lg",variant:"secondary",onClick:()=>n(`/agents/agent/${y.slug}`),children:"Back to agent details"})]}),k&&a.jsx(HC,{currentPermissions:S.map(X=>({serverId:X.server.id})),onCancel:()=>C(!1),onSaveUnscopedTool:async X=>{await Yr.AgentToolPermissionsController_upsertAgentToolPermission({actorId:y.actorId,serverId:X.id,body:{scopeIds:[]}}),await z(y.actorId)},onConfigureScopedTool:(X,te)=>{A({serverId:X.id,serverName:X.name,serverProvidedId:X.providedId,serverType:X.type})}}),j&&a.jsx(Py,{agentActorId:y.actorId,currentPermissions:S.map(X=>({serverId:X.server.id,serverName:X.server.name,serverProvidedId:X.server.providedId,serverType:X.server.type,scopeIds:X.grantedScopes.map(te=>te.id),hasAllScopes:X.hasAllScopes})),editingPermission:L?{serverId:L.server.id,serverName:L.server.name,serverProvidedId:L.server.providedId,serverType:L.server.type,scopeIds:L.grantedScopes.map(X=>X.id),hasAllScopes:L.hasAllScopes}:null,onCancel:()=>{R(!1),N(null)},onSave:async()=>{await z(y.actorId),R(!1),N(null)},onDelete:L?async()=>{await P(L.server.id)}:void 0}),M&&a.jsx(Py,{agentActorId:y.actorId,currentPermissions:S.map(X=>({serverId:X.server.id,serverName:X.server.name,serverProvidedId:X.server.providedId,serverType:X.server.type,scopeIds:X.grantedScopes.map(te=>te.id),hasAllScopes:X.hasAllScopes})),fixedTool:M,title:"Select Scopes",saveLabel:"save",onCancel:()=>A(null),onSave:async()=>{await z(y.actorId),A(null)}})]})}function wo(s,n){const r=n.providerId?.trim().toLowerCase()??"",o=n.modelId?.trim().toLowerCase()??"";return r.includes("anthropic")||o.includes("claude")?Ir(s,"claude"):r.includes("openai")||o.includes("gpt")||o.includes("codex")?Ir(s,"openai"):r.includes("google")||o.includes("gemini")||n.type==="adk"?Ir(s,"gemini"):o.includes("qwen")?Ir(s,"qwen"):Ir(s,VC[n.type??"other"])}function PC(s,n){return s.avatars.find(r=>r.url===n)?.label??"Default"}function Ir(s,n){return s.avatars.find(r=>r.id===n)?.url}const VC={claude:"claude",codex:"openai",opencode:"opencode",adk:"gemini",githubcopilot:"openai",other:void 0},Fy=["template","harness","model","status","tags","avatar"],YC=[ve.NOT_STARTED,ve.IN_PROGRESS,ve.FOR_REVIEW,ve.DONE],FC={name:"",slug:"",type:"other",description:void 0,systemPrompt:"",providerId:void 0,modelId:void 0,statusTriggers:[],tagTriggers:[],allowedTools:[],isActive:!0,concurrencyLimit:1},QC={stepIndex:0,draft:FC,selectedModelOptionId:"default",customProviderId:"",customModelId:"",tagText:"",slugTouched:!1,avatarTouched:!1};function KC(){const s=Re(),{setSectionTitle:n,createAgent:r}=ti(),[o,c]=p.useState(null),[d,f]=p.useState(null),[y,g]=p.useState(!0),[m,x,S]=Wr({key:"new-agent-wizard-draft",defaultValue:QC,debounceMs:0}),[v,T]=p.useState(!1),[w,k]=p.useState(null),{stepIndex:C,draft:j,selectedModelOptionId:R,customProviderId:L,customModelId:N,tagText:M,slugTouched:A}=m;wt(),p.useEffect(()=>{n("New Agent")},[n]),p.useEffect(()=>{let G=!0;async function ne(){try{const le=await Oa.AgentsController_listAgentTemplates({});if(!G)return;c(le);const _e=le.templates.find(ze=>ze.id==="custom")??le.templates[0];_e&&!m.draft.templateId&&X(_e)}catch(le){if(!G)return;f(le instanceof Error?le.message:"Failed to load agent templates")}finally{G&&g(!1)}}return ne(),()=>{G=!1}},[]);const z=p.useMemo(()=>j.templateId==="custom"?[...Fy,"prompt","identity"]:[...Fy,"identity"],[j.templateId]),I=Math.min(C,z.length-1),H=z[I],P=p.useMemo(()=>o?.harnesses.find(G=>G.type===j.type)??null,[o,j.type]),U=Qy(H,j),J=I===z.length-1;function X(G){x(ne=>({...ne,draft:{...ne.draft,templateId:G.id,type:G.type??ne.draft.type??"other",description:G.agentDescription||void 0,systemPrompt:G.systemPrompt,providerId:G.providerId||void 0,modelId:G.modelId||void 0,statusTriggers:G.statusTriggers,tagTriggers:G.tagTriggers,avatarUrl:G.avatarUrl,concurrencyLimit:G.concurrencyLimit,allowedTools:[],isActive:!0},tagText:G.tagTriggers.join(", "),selectedModelOptionId:G.providerId||G.modelId?`${G.providerId||"default-provider"}:${G.modelId}`:"default",customProviderId:"",customModelId:"",avatarTouched:!1}))}function te(G){x(ne=>({...ne,avatarTouched:!1,draft:{...ne.draft,type:G.type,providerId:void 0,modelId:void 0,avatarUrl:o?wo(o,{type:G.type}):ne.draft.avatarUrl},selectedModelOptionId:"default",customProviderId:"",customModelId:""}))}function ue(G){if(G==="custom"){x(ne=>({...ne,selectedModelOptionId:"custom",draft:{...ne.draft,providerId:ne.customProviderId.trim()||void 0,modelId:ne.customModelId.trim()||void 0,avatarUrl:o&&!ne.avatarTouched?wo(o,{type:ne.draft.type,providerId:ne.customProviderId,modelId:ne.customModelId}):ne.draft.avatarUrl}}));return}x(ne=>({...ne,selectedModelOptionId:G.id,draft:{...ne.draft,providerId:G.providerId,modelId:G.modelId,avatarUrl:o&&!ne.avatarTouched?wo(o,{type:ne.draft.type,providerId:G.providerId,modelId:G.modelId}):ne.draft.avatarUrl}}))}function B(G,ne){x(le=>({...le,customProviderId:G,customModelId:ne,draft:{...le.draft,providerId:G.trim()||void 0,modelId:ne.trim()||void 0,avatarUrl:o&&!le.avatarTouched?wo(o,{type:le.draft.type,providerId:G,modelId:ne}):le.draft.avatarUrl}}))}function re(G){x(ne=>({...ne,avatarTouched:!0,draft:{...ne.draft,avatarUrl:G}}))}function he(G){x(ne=>{const le=new Set(ne.draft.statusTriggers??[]);return le.has(G)?le.delete(G):le.add(G),{...ne,draft:{...ne.draft,statusTriggers:Array.from(le)}}})}function ke(G){x(ne=>({...ne,tagText:G,draft:{...ne.draft,tagTriggers:G.split(",").map(le=>le.trim()).filter(Boolean)}}))}function Te(G){x(ne=>({...ne,draft:{...ne.draft,name:G,slug:ne.slugTouched?ne.draft.slug:ZC(G)}}))}function D(G){x(ne=>({...ne,slugTouched:!0,draft:{...ne.draft,slug:JC(G)}}))}function K(){U&&x(G=>({...G,stepIndex:Math.min(G.stepIndex+1,z.length-1)}))}function ce(){x(G=>({...G,stepIndex:Math.max(G.stepIndex-1,0)}))}async function de(){if(!(!Qy("identity",j)||v)){T(!0),k(null);try{const G=await r({name:j.name.trim(),slug:j.slug.trim(),type:j.type,description:j.description,avatarUrl:j.avatarUrl,systemPrompt:j.systemPrompt,providerId:j.providerId,modelId:j.modelId,statusTriggers:j.statusTriggers??[],tagTriggers:j.tagTriggers??[],allowedTools:[],isActive:!0,concurrencyLimit:j.concurrencyLimit});G?(S(),s(`/agents/agent/${G.slug}`)):k("Agent creation failed")}finally{T(!1)}}}return y?a.jsx(fe,{children:a.jsx(ge,{children:a.jsx(_,{tone:"muted",children:"Loading agent templates..."})})}):d||!o?a.jsx(fe,{children:a.jsx(ge,{children:a.jsxs(W,{spacing:"3",children:[a.jsx(_,{tone:"muted",children:d??"Agent templates are unavailable"}),a.jsx(oe,{variant:"secondary",onClick:()=>s("/agents"),children:"Back to Agents"})]})})}):a.jsxs("div",{className:"new-agent-wizard",children:[a.jsxs("div",{className:"new-agent-wizard__header",children:[a.jsxs(_,{size:"1",tone:"muted",children:["Step ",I+1," of ",z.length]}),a.jsx("div",{className:"new-agent-wizard__progress","aria-hidden":"true",children:a.jsx("div",{className:"new-agent-wizard__progress-fill",style:{width:`${(I+1)/z.length*100}%`}})})]}),a.jsxs("div",{className:"new-agent-wizard__body",children:[H==="template"&&a.jsx(ca,{title:"What kind of agent are you making?",support:"Pick a starting point. You can adjust the agent from its page later.",children:a.jsx("div",{className:"new-agent-wizard__option-grid",children:o.templates.map(G=>a.jsx(Ur,{title:G.label,description:G.description,selected:j.templateId===G.id,onClick:()=>X(G)},G.id))})}),H==="harness"&&a.jsx(ca,{title:"What harness do you want to use?",support:"Choose the runtime that will execute this agent.",children:a.jsx("div",{className:"new-agent-wizard__option-grid",children:o.harnesses.map(G=>a.jsx(Ur,{title:G.label,description:G.description,selected:j.type===G.type,onClick:()=>te(G)},G.type))})}),H==="model"&&a.jsxs(ca,{title:"Which model should it use?",support:"Default lets the harness choose. You can also pick a preset or enter a model.",children:[a.jsxs("div",{className:"new-agent-wizard__option-grid",children:[(P?.modelOptions??[]).map(G=>a.jsx(Ur,{title:G.label,description:G.isDefault?"Use the harness default":Ky(G),selected:R===G.id,onClick:()=>ue(G)},G.id)),a.jsx(Ur,{title:"Custom",description:"Use a provider and model ID",selected:R==="custom",onClick:()=>ue("custom")})]}),R==="custom"&&a.jsxs("div",{className:"new-agent-wizard__field-grid",children:[a.jsxs("label",{className:"new-agent-wizard__field",children:[a.jsx(_,{size:"1",tone:"muted",children:"Provider ID"}),a.jsx("input",{value:L,onChange:G=>B(G.target.value,N),placeholder:"openai"})]}),a.jsxs("label",{className:"new-agent-wizard__field",children:[a.jsx(_,{size:"1",tone:"muted",children:"Model ID"}),a.jsx("input",{value:N,onChange:G=>B(L,G.target.value),placeholder:"gpt-5.3-codex"})]})]})]}),H==="status"&&a.jsx(ca,{title:"When should this agent react?",support:"These task statuses trigger the agent. Select none if it should only run manually.",children:a.jsx("div",{className:"new-agent-wizard__option-grid",children:YC.map(G=>{const ne=Vn[G];return a.jsx(Ur,{title:`${ne.icon} ${ne.label}`,description:G,selected:(j.statusTriggers??[]).includes(G),onClick:()=>he(G)},G)})})}),H==="tags"&&a.jsx(ca,{title:"Should this only run for certain tags?",support:"Leave this blank to react to every task with the selected status.",children:a.jsxs("label",{className:"new-agent-wizard__field",children:[a.jsx(_,{size:"1",tone:"muted",children:"Tag names"}),a.jsx("input",{value:M,onChange:G=>ke(G.target.value),placeholder:"code, review"})]})}),H==="avatar"&&a.jsx(ca,{title:"Choose avatar",support:"Pick one of the bundled avatars that the backend exposes for agents.",children:a.jsx(xv,{avatars:o.avatars,selectedUrl:j.avatarUrl??void 0,onSelect:re})}),H==="prompt"&&a.jsx(ca,{title:"What should this agent do?",support:"Write the system prompt for this custom agent.",children:a.jsx("textarea",{className:"new-agent-wizard__prompt-editor",value:j.systemPrompt,onChange:G=>x(ne=>({...ne,draft:{...ne.draft,systemPrompt:G.target.value}})),placeholder:"You are an agent that...","aria-label":"System prompt"})}),H==="identity"&&a.jsxs(ca,{title:"Almost done. Name your agent.",support:"Tools can be added from the agent page after creation.",children:[a.jsxs("div",{className:"new-agent-wizard__identity-fields",children:[a.jsxs("label",{className:"new-agent-wizard__identity-field",children:[a.jsx(_,{size:"1",tone:"muted",children:"Display name"}),a.jsx("input",{className:"new-agent-wizard__name-input",value:j.name,onChange:G=>Te(G.target.value),placeholder:"Code Reviewer",autoFocus:!0})]}),a.jsxs("label",{className:"new-agent-wizard__identity-field",children:[a.jsx(_,{size:"1",tone:"muted",children:"Slug"}),a.jsxs("div",{className:"new-agent-wizard__slug-row",children:[a.jsx(_,{as:"span",size:"4",tone:"muted",children:"@"}),a.jsx("input",{className:"new-agent-wizard__slug-input",value:j.slug,onChange:G=>D(G.target.value),placeholder:"code-reviewer"})]})]})]}),a.jsxs("div",{className:"new-agent-wizard__summary",children:[a.jsx(_,{size:"2",weight:"medium",children:"Summary"}),a.jsxs(_,{size:"2",tone:"muted",children:["Template: ",XC(o.templates,j.templateId)]}),a.jsxs(_,{size:"2",tone:"muted",children:["Harness: ",P?.label??j.type??"Other"]}),a.jsxs(_,{size:"2",tone:"muted",children:["Model: ",j.modelId?Ky(j):"Default"]}),a.jsxs(_,{size:"2",tone:"muted",children:["Avatar: ",PC(o,j.avatarUrl)]}),a.jsxs(_,{size:"2",tone:"muted",children:["Triggers: ",(j.statusTriggers??[]).length>0?j.statusTriggers?.join(", "):"Manual"]}),a.jsxs(_,{size:"2",tone:"muted",children:["Tags: ",(j.tagTriggers??[]).length>0?j.tagTriggers?.join(", "):"Any tag"]})]})]}),w&&a.jsx(_,{size:"2",className:"new-agent-wizard__error",children:w})]}),a.jsxs("div",{className:"new-agent-wizard__footer",children:[a.jsx(oe,{variant:"secondary",size:"lg",fullWidth:!0,onClick:I===0?()=>{S(),s("/agents")}:ce,children:I===0?"Cancel":"Back"}),a.jsx(oe,{size:"lg",fullWidth:!0,onClick:J?de:K,disabled:!U||v,children:J?v?"Creating...":"Create agent":"Next"})]})]})}function ca({title:s,support:n,children:r}){return a.jsxs(W,{spacing:"4",className:"new-agent-wizard__section",children:[a.jsxs(W,{spacing:"2",children:[a.jsx(_,{size:"5",weight:"bold",children:s}),a.jsx(_,{size:"2",tone:"muted",children:n})]}),r]})}function Ur({title:s,description:n,selected:r,onClick:o}){return a.jsxs("button",{className:`new-agent-wizard__option ${r?"new-agent-wizard__option--selected":""}`,type:"button",onClick:o,children:[a.jsx(_,{size:"3",weight:"medium",children:s}),a.jsx(_,{size:"2",tone:"muted",children:n})]})}function Qy(s,n){return s==="template"?!!n.templateId:s==="harness"?!!n.type:s==="prompt"?!!n.systemPrompt.trim():s==="identity"?!!(n.name.trim()&&n.slug.trim()):!0}function XC(s,n){return s.find(r=>r.id===n)?.label??"Custom"}function Ky(s){const n=[s.providerId,s.modelId].filter(Boolean);return n.length>0?n.join(" / "):"Default"}function ZC(s){return s.toLowerCase().trim().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}function JC(s){return s.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9_-]/g,"")}function WC(){return a.jsx(TC,{children:a.jsx(is,{children:a.jsxs(xe,{element:a.jsx(CC,{}),children:[a.jsx(xe,{index:!0,element:a.jsx(jC,{})}),a.jsx(xe,{path:"/new",element:a.jsx(KC,{})}),a.jsx(xe,{path:"/agent/:slug",element:a.jsx(BC,{})}),a.jsx(xe,{path:"/agent/:slug/tools",element:a.jsx(GC,{})})]})})})}const e0=ha("/threads"),t0=()=>{const[s,n]=p.useState(!1),[r,o]=p.useState(null),[c,d]=p.useState([]),[f,y]=p.useState(null),[g,m]=p.useState(!1);p.useEffect(()=>(x(),w()),[]);const x=async()=>{n(!0),o(null);try{const k=await Yn.ThreadsController_listThreads({});d(k.items||[])}catch(k){o(k instanceof Error?k.message:"Failed to load threads")}finally{n(!1)}},S=p.useCallback(async k=>await Yn.ThreadsController_getThread({id:k}),[]),v=p.useCallback(async k=>{const C=await Yn.ThreadsController_createThread({body:{title:k}});return d(j=>[C,...j]),C},[]),T=p.useCallback(async k=>{await Yn.ThreadsController_deleteThread({id:k}),d(C=>C.filter(j=>j.id!==k))},[]),w=p.useCallback(()=>{const k=Nn(e0,{transports:["websocket","polling"],withCredentials:!0});return k.on("connect",()=>{console.log("Connected to websocket"),k.emit("threads.subscribe",{},C=>{C.ok?(console.log(C),console.log("Subscribed to room:",C.room),m(!0)):(console.error("Failed to subscribe to room"),m(!1))})}),k.on(Rl.THREAD_TITLE_UPDATED,C=>{d(j=>j.map(R=>R.id===C.payload.threadId?{...R,title:C.payload.title}:R))}),k.on("disconnect",()=>{console.log("WebSocket disconnected"),m(!1)}),y(k),()=>{k.emit("threads.unsubscribe",{}),k.close(),y(null),m(!1)}},[]);return{isLoading:s,error:r,threads:c,loadThreads:x,getThread:S,createThread:v,deleteThread:T}},vv=p.createContext(null);function n0({children:s}){const{threads:n,isLoading:r,error:o,getThread:c,createThread:d,deleteThread:f}=t0(),[y,g]=p.useState(""),[m,x]=p.useState([]),S=p.useMemo(()=>({threads:n,isLoading:r,error:o,sectionTitle:y,setSectionTitle:g,navItems:m,setNavItems:x,getThread:c,createThread:d,deleteThread:f}),[n,r,o,y,g,m,x,c,d,f]);return a.jsx(vv.Provider,{value:S,children:s})}function Ho(){const s=p.useContext(vv);if(!s)throw new Error("useThreadsCtx must be used within <ThreadsProvider>");return s}function s0({thread:s,onClick:n}){return a.jsxs(ge,{onClick:n,children:[a.jsx("div",{style:{minWidth:0,overflow:"hidden"},children:a.jsx(_,{weight:"bold",size:"3",tone:"default",children:s.title})}),a.jsxs("div",{style:{fontSize:12},className:"text--tone-muted",children:["#",s.id.slice(0,6)]})]})}function a0(){const{threads:s,setSectionTitle:n,createThread:r}=Ho(),o=Re(),c=jt(),{showError:d,showToast:f}=hn(),{registerCommands:y}=Jr(),{readiness:g,isReady:m,isLoading:x}=yh();wt(),p.useEffect(()=>{n("Threads 🧵")},[n]);const S=T=>{o(`/threads/${T}`)},v=p.useCallback(async()=>{if(!m){f("Thread chat unlocks in Chat Settings.","info"),o("/settings/chat");return}try{const T=await r();T&&o(`/threads/${T.id}`)}catch(T){console.error("Error creating thread"),console.error(T),d(T)}},[r,m,o,d,f]);return p.useEffect(()=>y([{id:"new-thread",label:"New Thread",description:"Create a new thread",aliases:["create thread","add thread"],onSelect:v}]),[y,v]),a.jsxs(a.Fragment,{children:[!x&&g&&!g.isReady?a.jsx(xh,{title:g.title,description:g.description,ctaLabel:g.ctaLabel,onOpenSettings:()=>o("/settings/chat")}):null,a.jsx(fe,{children:s.map(T=>a.jsx(s0,{thread:T,onClick:()=>S(T.id)},T.id))}),a.jsx("button",{className:`threads-fab ${c?"threads-fab--desktop":""}`,type:"button",onClick:v,disabled:!m||x,"aria-label":"Create new thread",children:c?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"threads-fab__plus",children:"+"}),a.jsx("span",{className:"threads-fab__label",children:"New thread"})]}):"+"})]})}function l0(){const s=jt(),{id:n}=Wt(),r=!!n,{sectionTitle:o,navItems:c}=Ho();return a.jsx("div",{style:{minHeight:0},children:s?r?a.jsx(Ot,{}):a.jsx(Ua,{sectionTitle:o,children:a.jsx(Ot,{})}):r?a.jsx(Ot,{}):a.jsx($a,{appTitle:"Threads",sectionTitle:o,navItems:c,children:a.jsx(Ot,{})})})}function bv({contextBlock:s,isStateMemory:n=!1}){const r=Re(),o=d=>{d.metaKey||d.ctrlKey?(d.stopPropagation(),window.open(`/context/block/${s.id}`,"_blank")):r(`/context/block/${s.id}`)},c=d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),r(`/context/block/${s.id}`))};return a.jsx($e,{className:"thread-context-card",children:a.jsxs("div",{className:"thread-context-card__content",role:"button",tabIndex:0,onClick:o,onKeyDown:c,children:[a.jsx(_,{size:"2",weight:"semibold",children:s.title}),a.jsxs("div",{className:"thread-context-card__meta",children:[a.jsxs(_,{size:"1",tone:"muted",children:["#",s.id.slice(0,6)]}),n&&a.jsx(Ds,{color:"blue",children:"State"})]})]})})}function r0({task:s}){const n=Re(),r=s.tags.map(d=>({label:d.name}));s.commentCount>0&&r.push({label:`💬 ${s.commentCount}`});const o=s.inputRequests.filter(d=>!d.resolvedAt).length;o>0&&r.push({label:`✋ ${o}`});const c=d=>{d.metaKey||d.ctrlKey?(d.stopPropagation(),window.open(`/tasks/task/${s.id}`,"_blank")):n(`/tasks/task/${s.id}`)};return a.jsxs(jx,{leading:a.jsx(Ue,{name:s.createdByActor.displayName,size:"md",src:s.createdByActor.avatarUrl||void 0}),topRight:Nt(s.updatedAt),tags:r,onClick:c,highlight:o>0,footer:a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"row-detail truncate",children:["#",s.id.slice(0,6)]}),a.jsx("span",{className:"row-detail truncate",children:s.assigneeActor?`Assigned: @${s.assigneeActor.slug}`:"unassigned"})]}),children:[a.jsx("div",{className:"row-title truncate",children:s.name}),a.jsx("div",{className:"row-subtitle truncate",children:s.description})]})}function i0({task:s,onClick:n}){const r=s.assigneeActor??s.createdByActor,o=s.tags.map(d=>({label:d.name}));s.commentCount>0&&o.push({label:`comments ${s.commentCount}`});const c=s.inputRequests.filter(d=>!d.resolvedAt).length;return c>0&&o.push({label:`questions ${c}`}),a.jsxs(ge,{leading:a.jsx(Ue,{name:r.displayName,size:"lg",src:r.avatarUrl||void 0}),topRight:Nt(s.updatedAt),tags:o,highlight:c>0,onClick:n,children:[a.jsxs(_,{className:"pre",children:["#",s.id.slice(0,6)]}),a.jsx("div",{style:{minWidth:0,overflow:"hidden"},children:a.jsx(_,{weight:"bold",size:"3",tone:"default",children:a.jsx("span",{className:"task-row__title",children:a.jsx("span",{className:"task-row__titleText",children:s.name})})})}),a.jsx("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.description}),a.jsxs("div",{style:{fontSize:12},className:"text--tone-muted",children:[s.assigneeActor?`Assigned: @${s.assigneeActor.slug}`:"unassigned"," - ",`Created by @${s.createdByActor.slug}`]})]})}const o0=s=>[...s].sort((n,r)=>{const o=new Date(n.updatedAt).getTime(),c=new Date(r.updatedAt).getTime();return o-c}),c0=s=>{const[n,r]=p.useState(!1),[o,c]=p.useState(null),[d,f]=p.useState(!1),[y,g]=p.useState(null),[m,x]=p.useState(!1),[S,v]=p.useState(null),[T,w]=p.useState(null),[k,C]=p.useState([]),j=p.useCallback(async()=>{r(!0),c(null);try{const M=await Yn.ThreadsController_getThread({id:s});w(M||null)}catch(M){c(M instanceof Error?M.message:"Failed to load thread")}finally{r(!1)}},[s]),R=p.useCallback(async()=>{f(!0),g(null);try{const M=await Yn.ThreadsController_listMessages({id:s});C(o0(M.items))}catch(M){g(M instanceof Error?M.message:"Failed to load messages")}finally{f(!1)}},[s]),L=p.useCallback(async M=>{x(!0),v(null);let A=null;try{A=await Yn.ThreadsController_createMessage({id:s,body:{content:M}})}catch(z){v(z instanceof Error?z.message:"Failed to send message")}finally{x(!1)}return A},[s]),N=p.useCallback(async M=>{await Yn.ThreadsController_deleteThread({id:M}),w(null)},[]);return{thread:T,messages:k,isLoading:n,error:o,chatIsLoading:d,chatError:y,chatIsSending:m,chatSendError:S,loadThread:j,loadMessages:R,sendMessage:L,deleteThread:N,setMessages:C,setThread:w}},Xy={HUMAN:"human",AGENT:"agent"},u0=ha("/threads"),d0=s=>{if(s){if(s.type===qo.HUMAN)return{...s,type:Xy.HUMAN};if(s.type===qo.AGENT)return{...s,type:Xy.AGENT}}},h0=s=>{const[n,r]=p.useState(null),[o,c]=p.useState(!1),[d,f]=p.useState(null),[y,g]=p.useState(null),m=p.useRef(null),x=p.useRef(null),S=p.useCallback(()=>{m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{f(null),m.current=null},3e3)},[]),v=p.useCallback(T=>{x.current=T},[]);return p.useEffect(()=>{const T=Nn(u0,{transports:["websocket","polling"],withCredentials:!0});return T.on("connect",()=>{T.emit("threads.subscribe",{threadId:s},w=>{w.ok?c(!0):(console.error("Failed to subscribe to thread room",{threadId:s,ack:w}),c(!1))})}),T.on("connect_error",w=>{console.error("Thread websocket connect_error",{threadId:s,message:w.message})}),T.on("disconnect",()=>{c(!1),m.current&&(clearTimeout(m.current),m.current=null),f(null),g(null)}),T.on(Rl.MESSAGE_CREATED,w=>{if(w.payload.threadId!==s)return;m.current&&(clearTimeout(m.current),m.current=null),f(null),g(j=>j&&(j.actorId===w.payload.createdByActorId?null:j));const k=d0(w.payload.createdByActor),C={...w.payload,createdByActor:k};x.current&&x.current(C)}),T.on(Rl.AGENT_ACTIVITY,w=>{w.payload.threadId===s&&(f(w.payload.kind),S())}),T.on(Rl.AGENT_RESPONSE_DELTA,w=>{w.payload.threadId===s&&g(k=>!k||k.streamId!==w.payload.streamId?{streamId:w.payload.streamId,actorId:w.actor.id,content:w.payload.delta}:{...k,content:`${k.content}${w.payload.delta}`})}),r(T),()=>{T.emit("threads.unsubscribe",{threadId:s}),m.current&&(clearTimeout(m.current),m.current=null),g(null),T.close()}},[s,S]),{socket:n,isConnected:o,agentActivity:d,agentResponseStream:y,onMessageCreated:v}},f0=s=>[...s].sort((n,r)=>{const o=new Date(n.updatedAt).getTime(),c=new Date(r.updatedAt).getTime();return o-c}),p0=s=>{const{messages:n,isLoading:r,error:o,chatIsLoading:c,chatError:d,chatIsSending:f,chatSendError:y,loadThread:g,loadMessages:m,sendMessage:x,setMessages:S}=c0(s),{agentActivity:v,agentResponseStream:T,onMessageCreated:w}=h0(s);return p.useEffect(()=>{g(),m()},[g,m]),p.useEffect(()=>{w(k=>{S(C=>f0([...C.filter(j=>j.id!==k.id),k]))})},[w,S]),{isLoading:r,error:o,chatIsLoading:c,chatError:d,chatIsSending:f,chatSendError:y,messages:n,agentActivity:v,agentResponseStream:T,sendMessage:x}};function _v({threadId:s}){const n=Re(),[r,o,c]=Wr({key:`thread-chat-draft-${s}`,defaultValue:{content:""}}),{content:d}=r,f=p.useRef(null),y=p.useRef(null),{user:g}=Dn(),{readiness:m,isReady:x,isLoading:S}=yh(),{messages:v,agentActivity:T,agentResponseStream:w,sendMessage:k,chatIsSending:C,chatIsLoading:j,chatError:R,chatSendError:L}=p0(s);p.useEffect(()=>{f.current?.scrollIntoView({behavior:"smooth"})},[v,T,w?.content]),p.useEffect(()=>{j||y.current?.focus()},[j,s]);const N=async A=>{if(A.preventDefault(),!(!d.trim()||C))try{await k(d),c(),requestAnimationFrame(()=>{y.current?.focus()})}catch(z){console.error("Failed to send message:",z)}},M=A=>{const z=new Date(A);return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(z)};return j?a.jsx("div",{className:"thread-chat",children:a.jsx(_,{size:"2",tone:"muted",children:"Loading messages..."})}):a.jsxs("div",{className:"thread-chat",children:[a.jsxs("div",{className:"thread-chat__messages",children:[R&&a.jsx("div",{className:"thread-chat__status thread-chat__status--error",children:a.jsx(_,{size:"2",children:R})}),v.length===0?a.jsx("div",{className:"thread-chat__empty-state",children:a.jsx(_,{size:"2",tone:"muted",children:"No messages yet. Start the conversation."})}):v.map(A=>{const z=A.createdByActor,I=!!(g?.actorId&&g.actorId===A.createdByActorId),H=z?.displayName||"Anonymous",P=z?.slug;return a.jsxs("div",{className:`thread-chat__message ${I?"thread-chat__message--mine":""}`,children:[a.jsxs("div",{className:"thread-chat__message-header",children:[a.jsxs("div",{className:"thread-chat__author",children:[a.jsx(Ue,{name:H,src:z?.avatarUrl||void 0,size:"xs"}),a.jsx(_,{size:"1",weight:"semibold",children:H}),P&&a.jsxs(_,{size:"1",tone:"muted",children:["@",P]})]}),a.jsx(_,{size:"1",tone:"muted",children:M(A.createdAt)})]}),a.jsx(_,{size:"2",children:A.content})]},A.id)}),w&&a.jsxs("div",{className:"thread-chat__message thread-chat__message--streaming",role:"status","aria-live":"polite",children:[a.jsxs("div",{className:"thread-chat__message-header",children:[a.jsxs("div",{className:"thread-chat__author",children:[a.jsx(Ue,{name:"Assistant",size:"xs"}),a.jsx(_,{size:"1",weight:"semibold",children:"Assistant"})]}),a.jsx(_,{size:"1",tone:"muted",children:"typing..."})]}),a.jsx(_,{size:"2",children:w.content})]}),a.jsx("div",{ref:f})]}),x&&T&&a.jsx("div",{className:"thread-chat__activity",role:"status","aria-live":"polite",children:a.jsx(_,{size:"1",tone:"muted",children:T==="thinking"?"Assistant is thinking...":"Assistant is calling a tool..."})}),!S&&m&&!m.isReady?a.jsx("div",{className:"thread-chat__setup-callout",children:a.jsx(xh,{title:m.title,description:m.description,ctaLabel:m.ctaLabel,onOpenSettings:()=>n("/settings/chat")})}):a.jsxs("form",{className:"thread-chat__input-form",onSubmit:N,children:[a.jsxs("div",{className:"thread-chat__composer-row",children:[a.jsx("textarea",{ref:y,className:"thread-chat__input",value:d,onChange:A=>o({...r,content:A.target.value}),placeholder:"Write a message to this thread...",rows:3,disabled:C||S,onKeyDown:A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),N(A))}}),a.jsx(oe,{type:"submit",variant:"secondary",className:"thread-chat__send-btn",disabled:!d.trim()||C||S,children:C?"sending...":"send"})]}),L&&a.jsx("div",{className:"thread-chat__status thread-chat__status--error",children:a.jsx(_,{size:"1",children:L})})]})]})}const g0=[{path:"/dashboard",label:"Dashboard",icon:"🏠"},{path:"/tasks",label:"Tasks",icon:"🧩"},{path:"/context",label:"Context",icon:"🧱"}];function m0(s){return g0.map(n=>({...n,path:`/threads/${s}${n.path}`}))}const y0=ha("/threads"),x0=ha("/tasks"),v0=[ve.DONE,ve.FOR_REVIEW,ve.IN_PROGRESS,ve.NOT_STARTED],Sv=s=>{const n=s.parentTaskId,r=n&&typeof n=="string"?s.tasks.find(d=>d.id===n):null,o=[];r&&o.push({status:"parent",label:"Parent Task",tasks:[r]});const c={[ve.DONE]:[],[ve.FOR_REVIEW]:[],[ve.IN_PROGRESS]:[],[ve.NOT_STARTED]:[]};return s.tasks.forEach(d=>{if(n&&d.id===n)return;const f=d.status;c[f]&&c[f].push(d)}),v0.forEach(d=>{c[d].length>0&&o.push({status:d,label:Vn[d].label,tasks:c[d]})}),o},Tv=s=>{const n=[{id:s.stateContextBlockId,title:"Thread state memory",isStateMemory:!0}];return s.referencedContextBlocks.forEach(r=>{r.id!==s.stateContextBlockId&&n.push({id:r.id,title:r.title,isStateMemory:!1})}),n};function ko(){const{id:s}=Wt(),n=Re(),{setSectionTitle:r,getThread:o,deleteThread:c}=Ho(),d=jt(),[f,y]=p.useState(null),[g,m]=p.useState(!0),[x,S]=p.useState(null),v=p.useRef(new Set),{setNavItems:T}=Ho();wt(f?{thread:{title:f.title}}:void 0);const w=p.useCallback(async()=>{if(s)try{const C=await o(s);y(C),S(null)}catch(C){S(C instanceof Error?C.message:"Failed to load thread")}},[s,o]);if(p.useEffect(()=>{v.current=new Set(f?.tasks.map(C=>C.id)??[])},[f]),p.useEffect(()=>{if(!s)return;T(m0(s)),(async()=>{m(!0),await w(),m(!1)})()},[s,w,T]),p.useEffect(()=>{if(!s)return;const C=Nn(y0,{transports:["websocket","polling"],withCredentials:!0});C.on("connect",()=>{C.emit("threads.subscribe",{threadId:s}),w()}),C.on(Rl.THREAD_UPDATED,L=>{L.payload.id===s&&w()}),C.on(Rl.THREAD_TITLE_UPDATED,L=>{L.payload.threadId===s&&w()});const j=Nn(x0,{transports:["websocket","polling"],withCredentials:!0});j.on("connect",()=>{j.emit("tasks.subscribe",{}),w()});const R=L=>{v.current.has(L)&&w()};return j.on(un.TASK_UPDATED,L=>{R(L.payload.id)}),j.on(un.TASK_STATUS_CHANGED,L=>{R(L.payload.id)}),j.on(un.TASK_ASSIGNED,L=>{R(L.payload.id)}),j.on(un.TASK_DELETED,L=>{R(L.payload.taskId)}),()=>{C.emit("threads.unsubscribe",{threadId:s}),C.close(),j.emit("tasks.unsubscribe",{}),j.close()}},[s,w]),p.useEffect(()=>{if(!f){r("Thread");return}r(f.title)},[f,r]),g)return a.jsx("div",{className:"thread-detail-page",children:a.jsx(W,{spacing:"4",align:"center",children:a.jsx(_,{size:"3",tone:"muted",children:"Loading..."})})});if(x||!f)return a.jsx("div",{className:"thread-detail-page",children:a.jsxs(W,{spacing:"4",align:"center",children:[a.jsx(_,{size:"3",tone:"muted",children:x||"Thread not found"}),a.jsx(oe,{variant:"secondary",onClick:()=>n("/threads"),children:"Back to threads"})]})});const k=async()=>{await c(f.id),n("/threads")};return d?a.jsx(b0,{thread:f,onDelete:k}):a.jsx(_0,{thread:f,onDelete:k})}function b0({thread:s,onDelete:n}){const[r,o]=p.useState(!0),c=Sv(s),d=Tv(s);return a.jsxs("div",{className:"thread-detail-page thread-detail-page--desktop",children:[a.jsx("div",{className:"thread-detail-page__main",children:a.jsxs("div",{className:"thread-detail-page__content",children:[a.jsx("div",{className:"thread-detail-page__header",children:a.jsx("div",{className:"thread-detail-page__header-top",children:a.jsxs("div",{children:[a.jsx(_,{size:"5",weight:"bold",children:s.title}),a.jsxs("div",{className:"thread-detail-page__meta-row",children:[a.jsxs(Ds,{color:"gray",children:["#",s.id.slice(0,6)]}),a.jsxs(_,{size:"1",tone:"muted",children:[s.participants.length," participants"]})]})]})})}),a.jsx("div",{className:"thread-detail-page__chat",children:a.jsx(_v,{threadId:s.id})})]})}),a.jsxs("div",{className:`thread-detail-page__sidebar ${r?"":"thread-detail-page__sidebar--collapsed"}`,children:[r&&a.jsxs("div",{className:"thread-detail-page__sidebar-scroll",children:[s.participants.length>0&&a.jsxs("div",{className:"thread-detail-page__sidebar-section",children:[a.jsxs(_,{size:"2",weight:"semibold",className:"thread-detail-page__sidebar-header",children:["Participants (",s.participants.length,")"]}),a.jsx("div",{className:"thread-detail-page__participants",children:s.participants.map(f=>a.jsxs("div",{className:"thread-detail-page__participant",children:[a.jsx(Ue,{name:f.displayName,size:"sm",src:f.avatarUrl||void 0}),a.jsxs("div",{className:"thread-detail-page__participant-text",children:[a.jsx(_,{size:"2",weight:"medium",children:f.displayName}),a.jsxs(_,{size:"1",tone:"muted",children:["@",f.slug]})]})]},f.id))})]}),c.map(f=>a.jsxs("div",{className:"thread-detail-page__sidebar-section",children:[a.jsxs(_,{size:"2",weight:"semibold",className:"thread-detail-page__sidebar-header",children:[f.label," (",f.tasks.length,")"]}),a.jsx("div",{className:"thread-detail-page__sidebar-content",children:f.tasks.map(y=>a.jsx(r0,{task:y},y.id))})]},f.status)),d.length>0&&a.jsxs("div",{className:"thread-detail-page__sidebar-section",children:[a.jsxs(_,{size:"2",weight:"semibold",className:"thread-detail-page__sidebar-header",children:["Context (",d.length,")"]}),a.jsx("div",{className:"thread-detail-page__sidebar-content",children:d.map(f=>a.jsx(bv,{contextBlock:f,isStateMemory:f.isStateMemory},`${f.id}-${f.isStateMemory?"state":"reference"}`))})]}),s.tasks.length===0&&d.length===0&&a.jsx("div",{className:"thread-detail-page__sidebar-empty",children:a.jsx(_,{size:"2",tone:"muted",children:"No context or tasks attached"})}),a.jsx("div",{className:"thread-detail-page__sidebar-section thread-detail-page__sidebar-delete",children:a.jsx("div",{className:"thread-detail-page__sidebar-content thread-detail-page__sidebar-content--centered",children:a.jsx(Ml,{className:"thread-detail-page__delete-actions",onDelete:n,size:"md",deleteLabel:"Delete thread",confirmLabel:"Delete forever"})})})]}),a.jsx("button",{className:"thread-detail-page__sidebar-toggle",onClick:()=>o(f=>!f),"aria-label":r?"Collapse details panel":"Expand details panel",children:r?"→":"←"})]})]})}function _0({thread:s,onDelete:n}){const r=Re(),o=Sv(s),c=Tv(s),[d,f]=p.useState("chat"),[y,g]=p.useState(!1);return a.jsxs("div",{className:"thread-detail-page thread-detail-page--mobile",children:[a.jsx(S0,{isOpen:y,onClose:()=>g(!1)}),a.jsxs("header",{className:"thread-detail-page__mobile-header",children:[a.jsx("button",{className:"thread-detail-page__mobile-burger",onClick:()=>g(!0),"aria-label":"Open menu",children:"☰"}),a.jsxs("div",{className:"thread-detail-page__mobile-header-content",children:[a.jsx(_,{size:"2",weight:"semibold",children:s.title}),a.jsxs(_,{size:"1",tone:"muted",children:["#",s.id.slice(0,6)," · ",s.participants.length," participants"]})]})]}),a.jsxs("div",{className:"thread-detail-page__mobile-tabs",role:"tablist","aria-label":"Thread mobile views",children:[a.jsx("button",{type:"button",role:"tab","aria-selected":d==="chat",className:`thread-detail-page__mobile-tab ${d==="chat"?"thread-detail-page__mobile-tab--active":""}`,onClick:()=>f("chat"),children:"Chat"}),a.jsx("button",{type:"button",role:"tab","aria-selected":d==="tasks",className:`thread-detail-page__mobile-tab ${d==="tasks"?"thread-detail-page__mobile-tab--active":""}`,onClick:()=>f("tasks"),children:"Tasks"}),a.jsx("button",{type:"button",role:"tab","aria-selected":d==="context",className:`thread-detail-page__mobile-tab ${d==="context"?"thread-detail-page__mobile-tab--active":""}`,onClick:()=>f("context"),children:"Context"}),a.jsx("button",{type:"button",role:"tab","aria-selected":d==="more",className:`thread-detail-page__mobile-tab ${d==="more"?"thread-detail-page__mobile-tab--active":""}`,onClick:()=>f("more"),children:"More"})]}),a.jsxs("div",{className:"thread-detail-page__mobile-content",children:[d==="chat"&&a.jsx("div",{className:"thread-detail-page__mobile-chat-container",children:a.jsx(_v,{threadId:s.id})}),d==="tasks"&&a.jsx("div",{className:"thread-detail-page__mobile-scrollable",children:o.length>0?o.map(m=>a.jsx("div",{className:"thread-detail-page__mobile-section",children:a.jsx(fe,{title:m.label,children:m.tasks.map(x=>a.jsx(i0,{task:x,onClick:()=>r(`/tasks/task/${x.id}`)},x.id))})},m.status)):a.jsx("div",{className:"thread-detail-page__mobile-empty",children:a.jsx(_,{size:"2",tone:"muted",children:"No tasks attached"})})}),d==="context"&&a.jsx("div",{className:"thread-detail-page__mobile-scrollable",children:c.length>0?a.jsx("div",{className:"thread-detail-page__mobile-section",children:a.jsx("div",{className:"thread-detail-page__mobile-list",children:c.map(m=>a.jsx(bv,{contextBlock:m,isStateMemory:m.isStateMemory},`${m.id}-${m.isStateMemory?"state":"reference"}`))})}):a.jsx("div",{className:"thread-detail-page__mobile-empty",children:a.jsx(_,{size:"2",tone:"muted",children:"No context blocks attached"})})}),d==="more"&&a.jsx("div",{className:"thread-detail-page__mobile-scrollable",children:a.jsx("div",{className:"thread-detail-page__mobile-section",children:a.jsxs(W,{spacing:"4",children:[a.jsxs(W,{spacing:"2",children:[a.jsx(_,{size:"2",weight:"semibold",children:"Thread Settings"}),a.jsx(_,{size:"2",tone:"muted",children:"Manage this thread's settings and data."})]}),a.jsx("div",{className:"thread-detail-page__mobile-settings-section",children:a.jsxs(W,{spacing:"3",children:[a.jsx(_,{size:"2",weight:"semibold",children:"Attach Items (Coming Soon)"}),a.jsxs(W,{spacing:"2",children:[a.jsx(oe,{variant:"secondary",disabled:!0,className:"thread-detail-page__mobile-settings-button",children:"Add Task"}),a.jsx(oe,{variant:"secondary",disabled:!0,className:"thread-detail-page__mobile-settings-button",children:"Add Context Block"})]})]})}),a.jsx("div",{className:"thread-detail-page__mobile-settings-section",children:a.jsxs(W,{spacing:"3",children:[a.jsx(_,{size:"2",weight:"semibold",children:"Danger Zone"}),a.jsx(Ml,{className:"thread-detail-page__mobile-delete-action",onDelete:n,size:"md",deleteLabel:"Delete Thread",confirmLabel:"Delete Forever"})]})})]})})})]})]})}function S0({isOpen:s,onClose:n}){const r=Lt();return a.jsxs(a.Fragment,{children:[s&&a.jsx("div",{className:"thread-detail-page__mobile-drawer-overlay",onClick:n}),a.jsxs("aside",{className:`thread-detail-page__mobile-drawer ${s?"thread-detail-page__mobile-drawer--open":""}`,children:[a.jsxs("div",{className:"thread-detail-page__mobile-drawer-header",children:[a.jsx(_,{size:"4",weight:"bold",children:"taico"}),a.jsx("button",{className:"thread-detail-page__mobile-drawer-close",onClick:n,"aria-label":"Close menu",children:"✕"})]}),a.jsx("nav",{className:"thread-detail-page__mobile-drawer-nav",children:Al.map(o=>{const c=r.pathname===o.path||r.pathname.startsWith(o.path+"/");return a.jsxs(Ls,{to:o.path,className:`thread-detail-page__mobile-drawer-item ${c?"thread-detail-page__mobile-drawer-item--active":""}`,onClick:n,children:[a.jsx("span",{className:"thread-detail-page__mobile-drawer-icon",children:o.icon}),a.jsx("span",{className:"thread-detail-page__mobile-drawer-label",children:o.label})]},o.path)})})]})]})}function T0(){return a.jsx(n0,{children:a.jsx(is,{children:a.jsxs(xe,{element:a.jsx(l0,{}),children:[a.jsx(xe,{index:!0,element:a.jsx(a0,{})}),a.jsx(xe,{path:"/:id",element:a.jsx(ko,{})}),a.jsx(xe,{path:"/:id/dashboard",element:a.jsx(ko,{})}),a.jsx(xe,{path:"/:id/tasks",element:a.jsx(ko,{})}),a.jsx(xe,{path:"/:id/context",element:a.jsx(ko,{})})]})})})}const j0=window.location.origin,jv=new Fn({baseUrl:j0,credentials:"include"}),ss=jv.tools,w0=jv.authorizationJourneys,k0="http://localhost:3000/mcp",E0="npx",C0=["-y","@modelcontextprotocol/server-memory"],N0=s=>s.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"new-tool",A0=(s,n)=>{const r=new Set(n.map(d=>d.providedId));if(!r.has(s))return s;let o=2,c=`${s}-${o}`;for(;r.has(c);)o+=1,c=`${s}-${o}`;return c},R0=()=>{const[s,n]=p.useState(!1),[r,o]=p.useState(null),[c,d]=p.useState([]);p.useEffect(()=>{y()},[]);const f=C=>[...C].sort((j,R)=>{const L=new Date(j.updatedAt).getTime();return new Date(R.updatedAt).getTime()-L}),y=async()=>{n(!0),o(null);try{const C=await ss.McpRegistryController_listServers({});d(f(C.items||[]))}catch(C){o(C instanceof Error?C.message:"Failed to load tools")}finally{n(!1)}},g=p.useCallback(async C=>{n(!0),o(null);try{return await ss.McpRegistryController_getServer({serverId:C})}catch(j){return o(j instanceof Error?j.message:"Failed to load tool details"),null}finally{n(!1)}},[]),m=p.useCallback(async C=>{try{return await ss.McpRegistryController_listScopes({serverId:C})}catch(j){return console.error("Failed to load scopes:",j),[]}},[]),x=p.useCallback(async C=>{console.log(`loading clients for server ${C}`);try{const j=await ss.McpRegistryController_listConnections({serverId:C});return console.log(`clients: ${j}`),j}catch(j){return console.error("Failed to load clients:",j),[]}},[]),S=p.useCallback(async C=>{console.log(`loading authorizations for server ${C}`);try{const j=await w0.AuthJourneysController_getAuthJourneys({serverId:C});return console.log("authorizations:",j),j}catch(j){return console.error("Failed to load authorizations:",j),[]}},[]),v=p.useCallback(async C=>{n(!0),o(null);try{return await ss.McpRegistryController_getConnection({connectionId:C})}catch(j){return o(j instanceof Error?j.message:"Failed to load client details"),null}finally{n(!1)}},[]),T=async C=>{n(!0),o(null);try{const j=N0(C.name),L={providedId:A0(j,c),name:C.name,description:`New ${C.type.toUpperCase()} MCP server`,type:C.type,...C.type==="http"?{url:k0}:{cmd:E0,args:[...C0]}},N=await ss.McpRegistryController_createServer({body:L});return d(M=>f([...M,N])),N}catch(j){throw o(j instanceof Error?j.message:"Failed to create tool"),j}finally{n(!1)}},w=p.useCallback(async(C,j)=>{n(!0),o(null);try{const R=await ss.McpRegistryController_updateServer({serverId:C,body:j});return d(L=>{const N=L.map(M=>M.id===C?R:M);return f(N)}),R}catch(R){return o(R instanceof Error?R.message:"Failed to update tool"),null}finally{n(!1)}},[]),k=p.useCallback(async C=>{n(!0),o(null);try{return await ss.McpRegistryController_deleteServer({serverId:C}),d(j=>j.filter(R=>R.id!==C)),!0}catch(j){return o(j instanceof Error?j.message:"Failed to delete tool"),!1}finally{n(!1)}},[]);return{isLoading:s,error:r,tools:c,loadTools:y,loadToolDetails:g,loadToolScopes:m,loadToolClients:x,loadToolAuthorizations:S,loadClientDetails:v,createTool:T,updateTool:w,deleteTool:k}},wv=p.createContext(null);function z0({children:s}){const{tools:n,isLoading:r,error:o,loadToolDetails:c,loadToolScopes:d,loadToolClients:f,loadToolAuthorizations:y,loadClientDetails:g,createTool:m,updateTool:x,deleteTool:S}=R0(),[v,T]=p.useState(""),w=p.useMemo(()=>({tools:n,isLoading:r,error:o,sectionTitle:v,setSectionTitle:T,loadToolDetails:c,loadToolScopes:d,loadToolClients:f,loadToolAuthorizations:y,loadClientDetails:g,createTool:m,updateTool:x,deleteTool:S}),[n,r,o,v,T,c,d,f,y,g,m,x,S]);return a.jsx(wv.Provider,{value:w,children:s})}function ni(){const s=p.useContext(wv);if(!s)throw new Error("useToolsCtx must be used within <ToolsProvider>");return s}function D0({onCancel:s,onSave:n,error:r}){const[o,c]=p.useState(""),[d,f]=p.useState("http"),y=p.useRef(null);p.useEffect(()=>{y.current?.focus()},[]);const g=p.useMemo(()=>o.trim().length>0,[o]),m=async()=>g?n({name:o.trim(),type:d}):!1;return a.jsxs(ct,{title:"Create a Tool",onCancel:s,onSave:m,children:[a.jsx("div",{className:"new-tool-pop__group",children:a.jsx("input",{className:"new-tool-pop__input",ref:y,placeholder:"Tool name",value:o,onChange:x=>c(x.target.value)})}),r?a.jsx("p",{className:"new-tool-pop__error",children:r}):null,a.jsxs("div",{className:"new-tool-pop__group",children:[a.jsx("label",{className:"new-tool-pop__label",htmlFor:"new-tool-transport-type",children:"Transport type"}),a.jsxs("select",{id:"new-tool-transport-type",className:"new-tool-pop__select",value:d,onChange:x=>f(x.target.value),children:[a.jsx("option",{value:"http",children:"HTTP"}),a.jsx("option",{value:"stdio",children:"STDIO"})]})]})]})}function O0(){const{tools:s,setSectionTitle:n,isLoading:r,error:o,createTool:c}=ni(),d=Re(),f=jt(),[y,g]=p.useState(!1),[m,x]=p.useState(null);if(wt(),p.useEffect(()=>{n("All Tools")},[n]),r&&s.length===0)return a.jsx(fe,{children:a.jsx(ge,{leading:a.jsx(Ue,{name:"...",size:"lg"}),children:a.jsx(_,{tone:"muted",children:"Loading tools..."})})});if(o&&s.length===0)return a.jsx(fe,{children:a.jsx(ge,{leading:a.jsx(Ue,{name:"!",size:"lg"}),children:a.jsxs(_,{tone:"muted",children:["Error: ",o]})})});const S=()=>{g(!1),x(null)},v=async({name:T,type:w})=>{x(null);try{const k=await c({name:T,type:w});return k?(d(`/tools/tool/${k.id}`),!0):!1}catch(k){const C=k?.body?.detail??k?.message??"Failed to create tool";return x(C),!1}};return a.jsxs(a.Fragment,{children:[a.jsx(fe,{children:s.length===0?a.jsx(ge,{leading:a.jsx(Ue,{name:"?",size:"lg"}),children:a.jsx(_,{tone:"muted",children:"No tools found"})}):s.map(T=>a.jsx(L0,{tool:T,onClick:()=>d(`/tools/tool/${T.id}`)},T.id))}),a.jsx("button",{className:`tools-fab ${f?"tools-fab--desktop":""}`,type:"button",onClick:()=>g(!0),"aria-label":"Create new tool",children:f?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"tools-fab__plus",children:"+"}),a.jsx("span",{className:"tools-fab__label",children:"New tool"})]}):"+"}),y?a.jsx(D0,{onCancel:S,onSave:v,error:m}):null]})}function L0({tool:s,onClick:n}){const r=[{label:"MCP Server",color:"blue"}];return s.type==="http"?r.push({label:"remote",color:"green"}):r.push({label:"stdio",color:"orange"}),a.jsxs(ge,{leading:a.jsx(Ue,{name:s.name,size:"lg"}),topRight:Nt(s.updatedAt),tags:r,onClick:n,children:[a.jsx(_,{className:"pre",style:"mono",tone:"muted",children:s.providedId}),a.jsx(_,{weight:"bold",size:"3",tone:"default",children:s.name}),a.jsx("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.jsx(_,{tone:"muted",size:"2",children:s.description||"No description"})})]})}function q0(){const s=jt(),{sectionTitle:n}=ni(),r=[];return a.jsx("div",{style:{minHeight:0},children:s?a.jsx(Ua,{sectionTitle:n,children:a.jsx(Ot,{})}):a.jsx($a,{appTitle:"Tools",sectionTitle:n,navItems:r,children:a.jsx(Ot,{})})})}function M0({initialValue:s,onCancel:n,onSave:r}){const[o,c]=p.useState(s),d=p.useRef(null);p.useEffect(()=>{d.current?.focus()},[]);async function f(){return o.trim()?r({name:o.trim()}):!1}return a.jsx(ct,{title:"Edit Tool Name",onCancel:n,onSave:f,children:a.jsx(a.Fragment,{children:a.jsx("div",{className:"edit-tool-name-pop__input-wrapper",children:a.jsx("input",{type:"text",className:"edit-tool-name-pop__input",ref:d,placeholder:"Enter tool name...",value:o,onChange:y=>c(y.target.value)})})})})}const Zy=s=>{s&&(s.style.height="auto",s.style.height=`${s.scrollHeight}px`)};function B0({initialValue:s,onCancel:n,onSave:r}){const[o,c]=p.useState(s),d=p.useRef(null);p.useEffect(()=>{d.current?.focus()},[]),p.useEffect(()=>{Zy(d.current)},[o]);function f(g){c(g.target.value),Zy(g.target)}async function y(){return r({description:o})}return a.jsx(ct,{title:"Edit Tool Description",onCancel:n,onSave:y,children:a.jsx(a.Fragment,{children:a.jsx("div",{className:"edit-tool-description-pop__input-wrapper",children:a.jsx("textarea",{className:"edit-tool-description-pop__input",ref:d,placeholder:"Enter description...",value:o,onChange:f})})})})}function I0({initialValue:s,onCancel:n,onSave:r}){const[o,c]=p.useState(s),d=p.useRef(null);p.useEffect(()=>{d.current?.focus()},[]);async function f(){return o.trim()?r({url:o.trim()}):!1}return a.jsx(ct,{title:"Edit Server URL",onCancel:n,onSave:f,children:a.jsx(a.Fragment,{children:a.jsx("div",{className:"edit-tool-url-pop__input-wrapper",children:a.jsx("input",{type:"url",className:"edit-tool-url-pop__input",ref:d,placeholder:"https://example.com/mcp",value:o,onChange:y=>c(y.target.value)})})})})}function U0({initialCmd:s,initialArgs:n,onCancel:r,onSave:o}){const[c,d]=p.useState(s),[f,y]=p.useState(n.join(`
|
|
71
|
-
`)),g=p.useRef(null);p.useEffect(()=>{g.current?.focus()},[]);async function m(){if(!c.trim())return!1;const x=f.split(`
|
|
72
|
-
`).map(S=>S.trim()).filter(S=>S.length>0);return o({cmd:c.trim(),args:x})}return a.jsx(ct,{title:"Edit Command",onCancel:r,onSave:m,children:a.jsx(a.Fragment,{children:a.jsx("div",{className:"edit-tool-command-pop__wrapper",children:a.jsxs(W,{spacing:"3",children:[a.jsxs("div",{children:[a.jsx(_,{size:"2",weight:"medium",children:"Command"}),a.jsx("input",{type:"text",className:"edit-tool-command-pop__input",ref:g,placeholder:"npx",value:c,onChange:x=>d(x.target.value)})]}),a.jsxs("div",{children:[a.jsx(_,{size:"2",weight:"medium",children:"Arguments (one per line)"}),a.jsx("textarea",{className:"edit-tool-command-pop__textarea",placeholder:`-y
|
|
73
|
-
@modelcontextprotocol/server-memory`,value:f,onChange:x=>y(x.target.value),rows:5})]})]})})})})}function $0({toolId:s,initialScopes:n,onCancel:r,onSave:o}){const[c,d]=p.useState(n),[f,y]=p.useState(""),[g,m]=p.useState(""),x=()=>{if(!f.trim()||!g.trim())return;const T={id:f.trim(),description:g.trim(),serverId:s,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};d([...c,T]),y(""),m("")},S=T=>{d(c.filter(w=>w.id!==T))};async function v(){const T=new Set(n.map(j=>j.id)),w=new Set(c.map(j=>j.id)),k=c.filter(j=>!T.has(j.id)).map(j=>({id:j.id,description:j.description})),C=n.filter(j=>!w.has(j.id)).map(j=>j.id);return o({scopesToCreate:k,scopesToDelete:C})}return a.jsx(ct,{title:"Edit Scopes",onCancel:r,onSave:v,children:a.jsx(a.Fragment,{children:a.jsx("div",{className:"edit-tool-scopes-pop__wrapper",children:a.jsxs(W,{spacing:"3",children:[a.jsxs("div",{children:[a.jsx(_,{size:"2",weight:"medium",children:"Current Scopes"}),c.length===0?a.jsx(_,{size:"2",tone:"muted",children:"No scopes configured"}):a.jsx("div",{className:"edit-tool-scopes-pop__scopes-list",children:c.map(T=>a.jsxs("div",{className:"edit-tool-scopes-pop__scope-item",children:[a.jsxs("div",{className:"edit-tool-scopes-pop__scope-info",children:[a.jsx(_,{size:"2",weight:"medium",style:"mono",children:T.id}),a.jsx(_,{size:"1",tone:"muted",children:T.description})]}),a.jsx(oe,{size:"sm",variant:"secondary",onClick:()=>S(T.id),children:"Remove"})]},T.id))})]}),a.jsxs("div",{children:[a.jsx(_,{size:"2",weight:"medium",children:"Add New Scope"}),a.jsxs("div",{className:"edit-tool-scopes-pop__new-scope",children:[a.jsx("input",{type:"text",className:"edit-tool-scopes-pop__input",placeholder:"Scope ID (e.g., tool:read)",value:f,onChange:T=>y(T.target.value)}),a.jsx("input",{type:"text",className:"edit-tool-scopes-pop__input",placeholder:"Description",value:g,onChange:T=>m(T.target.value)}),a.jsx(oe,{size:"sm",onClick:x,disabled:!f.trim()||!g.trim(),children:"Add Scope"})]})]})]})})})})}function H0(s){switch(s){case"AUTHORIZATION_CODE_EXCHANGED":return{color:"green",label:"Active"};case"USER_CONSENT_REJECTED":return{color:"red",label:"Rejected"};case"AUTHORIZATION_CODE_ISSUED":return{color:"blue",label:"Code Issued"};case"mcp_auth_flow_started":return{color:"yellow",label:"Flow Started"};case"mcp_auth_flow_completed":return{color:"blue",label:"MCP Auth Complete"};case"CONNECTIONS_FLOW_STARTED":return{color:"yellow",label:"Connecting"};case"CONNECTIONS_FLOW_COMPLETED":return{color:"blue",label:"Connected"};case"not_started":return{color:"gray",label:"Not Started"};default:return{color:"gray",label:s.replace(/_/g," ").toLowerCase()}}}function G0(){const{toolId:s}=Wt(),n=Re(),{tools:r,setSectionTitle:o,loadToolDetails:c,loadToolScopes:d,loadToolClients:f,loadToolAuthorizations:y,updateTool:g,deleteTool:m}=ni(),{showError:x}=hn(),S=r.find(je=>je.id===s),[v,T]=p.useState(S||null),[w,k]=p.useState([]),[C,j]=p.useState([]),[R,L]=p.useState([]),[N,M]=p.useState(!S),[A,z]=p.useState(!1),[I,H]=p.useState(null),[P,U]=p.useState(!1),[J,X]=p.useState(!1),[te,ue]=p.useState(!1),[B,re]=p.useState(!1),[he,ke]=p.useState(!1),[Te,D]=p.useState(!1),K=v?.type==="http",ce=v?.type==="stdio",de=je=>{navigator.clipboard.writeText(je),U(!0),setTimeout(()=>U(!1),1500)},G=p.useRef(S?s??null:null);p.useEffect(()=>{if(!s)return;const je=S;if(je){T(je),G.current=s;return}G.current!==s&&(G.current=s,M(!0),c(s).then(Ee=>{T(Ee),M(!1)}))},[s,c]),p.useEffect(()=>{v&&s&&(v.type==="http"?(d(s).then(k),y(s).then(L)):(k([]),L([])),f(s).then(j))},[v,s,d,f,y]);const ne=p.useMemo(()=>!v||v.type!=="stdio"?[]:[v.cmd,...v.args??[]].filter(je=>!!je),[v]),le=je=>/^[a-zA-Z0-9._/@:=+-]+$/.test(je)?je:`"${je.replace(/(["\\$`])/g,"\\$1")}"`,_e=je=>je.map(Ee=>le(Ee)).join(" "),ze=async({name:je})=>{if(!v)return!1;try{const Ee=await g(v.id,{name:je});return Ee?(T(Ee),X(!1),!0):!1}catch(Ee){return console.error("Failed to update name:",Ee),x(Ee),!1}},mt=async({description:je})=>{if(!v)return!1;try{const Ee=await g(v.id,{description:je});return Ee?(T(Ee),ue(!1),!0):!1}catch(Ee){return console.error("Failed to update description:",Ee),x(Ee),!1}},fn=async({url:je})=>{if(!v)return!1;try{const Ee=await g(v.id,{url:je});return Ee?(T(Ee),re(!1),!0):!1}catch(Ee){return console.error("Failed to update URL:",Ee),x(Ee),!1}},pn=async({cmd:je,args:Ee})=>{if(!v)return!1;try{const ft=await g(v.id,{cmd:je,args:Ee});return ft?(T(ft),ke(!1),!0):!1}catch(ft){return console.error("Failed to update command:",ft),x(ft),!1}},Kn=async({scopesToCreate:je,scopesToDelete:Ee})=>{if(!v)return!1;try{for(const kt of Ee)await ss.McpRegistryController_deleteScope({serverId:v.id,scopeId:kt});je.length>0&&await ss.McpRegistryController_createScopes({serverId:v.id,body:je});const ft=await d(v.id);return k(ft),D(!1),!0}catch(ft){return console.error("Failed to update scopes:",ft),x(ft),!1}};if(p.useEffect(()=>{const je=v?.url;if(!je){H(null);return}const Ee=new AbortController;return(async()=>{try{const kt=new URL(je),On=new URL(`/.well-known/oauth-protected-resource${kt.pathname}`,kt.origin),en=await fetch(On.toString(),{signal:Ee.signal});if(!en.ok){H(null);return}const os=(await en.json()).authorization_servers?.[0];if(!os){H(null);return}const gn=new URL(os),xt=new URL(`${gn.origin}/.well-known/oauth-authorization-server${gn.pathname}`),cs=await fetch(xt,{signal:Ee.signal});if(!cs.ok){H(null);return}const us=await cs.json();H(us)}catch(kt){if(console.error(kt),kt.name==="AbortError")return;H(null)}})(),()=>{Ee.abort()}},[v?.url]),wt({tool:{name:v?.name}}),p.useEffect(()=>{if(!v){o("Tool");return}o(v.name)},[v,o]),N)return a.jsx("div",{className:"tool-detail-page",children:a.jsx(W,{spacing:"4",align:"center",children:a.jsx(_,{size:"3",tone:"muted",children:"Loading tool..."})})});if(!v)return a.jsx("div",{className:"tool-detail-page",children:a.jsxs(W,{spacing:"4",align:"center",children:[a.jsx(_,{size:"3",tone:"muted",children:"Tool not found"}),a.jsx(oe,{variant:"secondary",onClick:()=>n("/tools"),children:"Back to tools"})]})});const yt=[{label:"MCP Server",color:"blue"}];return v.type==="http"?yt.push({label:"remote",color:"green"}):yt.push({label:"stdio",color:"orange"}),a.jsxs("div",{className:"tool-detail-page",children:[a.jsx(fe,{className:"tool-detail-page__section",children:a.jsxs(ge,{leading:a.jsx(Ue,{name:v.name}),tags:yt,topRight:a.jsx(_,{size:"1",tone:"muted",children:Nt(v.updatedAt)}),children:[a.jsx(_,{as:"span",weight:"normal",tone:"muted",size:"3",children:`${v.providedId} `}),a.jsxs(_,{as:"span",tone:"muted",style:"mono",children:["#",v.id.slice(0,6)]}),a.jsx(_,{children:v.description}),I?a.jsxs(ge,{onClick:()=>z(!A),children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:"Auth Server Metadata"}),a.jsx(_,{size:"2",tone:"muted",children:A?"(tap to collapse)":"(tap to expand)"})]}),A&&a.jsx("div",{className:"tool-detail-page__metadata",children:a.jsx("pre",{children:JSON.stringify(I,null,2)})})]}):a.jsx(_,{tone:"muted",size:"2",children:"Authorization Server metadata not found"})]})}),a.jsx(fe,{title:"Name",className:"tool-detail-page__section",children:a.jsxs(ge,{onClick:()=>X(!0),children:[a.jsx(_,{size:"2",children:v.name}),a.jsx(_,{size:"1",tone:"muted",children:"tap to edit"})]})}),a.jsx(fe,{title:"Description",className:"tool-detail-page__section",children:a.jsxs(ge,{onClick:()=>ue(!0),children:[a.jsx(_,{size:"2",children:v.description}),a.jsx(_,{size:"1",tone:"muted",children:"tap to edit"})]})}),K&&v.url?a.jsx(fe,{title:"Server URL",className:"tool-detail-page__section",children:a.jsxs(ge,{onClick:()=>re(!0),children:[a.jsx(_,{as:"div",size:"2",style:"mono",className:"tool-detail-page__url",children:v.url}),a.jsx(_,{size:"1",tone:"muted",children:"tap to edit"})]})}):null,ce&&a.jsx(fe,{title:"Command",className:"tool-detail-page__section",children:a.jsxs(ge,{onClick:()=>ke(!0),children:[a.jsx(_,{size:"2",style:"mono",children:v.cmd}),v.args&&v.args.length>0&&a.jsxs(_,{size:"2",tone:"muted",style:"mono",children:["Args: ",v.args.join(" ")]}),a.jsx(_,{size:"1",tone:"muted",children:"tap to edit"})]})}),K&&v.url&&a.jsxs(fe,{title:"Configure",className:"tool-detail-page__section",children:[a.jsxs(ge,{onClick:()=>de(`npx @modelcontextprotocol/inspector --transport http --server-url ${v.url}`),children:[a.jsx(_,{weight:"medium",size:"3",children:"Inspector Command"}),a.jsx(_,{size:"2",tone:"muted",children:"Run this command to start the MCP inspector:"}),a.jsxs(_,{as:"div",style:"mono",children:[`npx @modelcontextprotocol/inspector --transport http --server-url ${v.url}`,a.jsx(_,{size:"1",tone:"muted",children:"tap to copy"})]})]}),a.jsxs(ge,{onClick:()=>de(`codex mcp add ${v.providedId} --url ${v.url}`),children:[a.jsx(_,{weight:"medium",size:"3",children:"Codex"}),a.jsx(_,{size:"2",tone:"muted",children:"Run this command to add this MCP server to Codex:"}),a.jsxs(_,{as:"div",style:"mono",children:[`codex mcp add ${v.providedId} --url ${v.url}`,a.jsx(_,{size:"1",tone:"muted",children:"tap to copy"})]})]}),a.jsxs(ge,{onClick:()=>de(`claude mcp add ${v.providedId} --transport http ${v.url}`),children:[a.jsx(_,{weight:"medium",size:"3",children:"Claude Code"}),a.jsxs(_,{as:"div",style:"mono",children:[`claude mcp add ${v.providedId} --transport http ${v.url}`,a.jsx(_,{size:"1",tone:"muted",children:"tap to copy"})]})]})]}),ce&&ne.length>0&&a.jsxs(fe,{title:"Configure",className:"tool-detail-page__section",children:[a.jsxs(ge,{onClick:()=>de(_e(["npx","@modelcontextprotocol/inspector","--transport","stdio",...ne])),children:[a.jsx(_,{weight:"medium",size:"3",children:"Inspector Command"}),a.jsx(_,{size:"2",tone:"muted",children:"Run this command to start the MCP inspector:"}),a.jsxs(_,{style:"mono",children:[_e(["npx","@modelcontextprotocol/inspector","--transport","stdio",...ne]),a.jsx(_,{size:"1",tone:"muted",children:"tap to copy"})]})]}),a.jsxs(ge,{onClick:()=>de(_e(["codex","mcp","add",v.providedId,...ne])),children:[a.jsx(_,{weight:"medium",size:"3",children:"Codex"}),a.jsxs(_,{style:"mono",children:[_e(["codex","mcp","add",v.providedId,...ne]),a.jsx(_,{size:"1",tone:"muted",children:"tap to copy"})]})]}),a.jsxs(ge,{onClick:()=>de(_e(["claude","mcp","add",v.providedId,"--",...ne])),children:[a.jsx(_,{weight:"medium",size:"3",children:"Claude Code"}),a.jsxs(_,{style:"mono",children:[_e(["claude","mcp","add",v.providedId,"--",...ne]),a.jsx(_,{size:"1",tone:"muted",children:"tap to copy"})]})]})]}),K&&a.jsx(fe,{title:"Scopes",className:"tool-detail-page__section",children:a.jsxs(ge,{onClick:()=>D(!0),children:[w.length>0?a.jsx(W,{spacing:"1",children:w.map(je=>a.jsxs("div",{children:[a.jsx(_,{size:"2",style:"mono",weight:"medium",children:je.id}),a.jsx(_,{size:"2",tone:"muted",children:je.description})]},je.id))}):a.jsx(_,{tone:"muted",size:"2",children:"No scopes configured"}),a.jsx(_,{size:"1",tone:"muted",children:"tap to edit"})]})}),ce&&a.jsx(_,{tone:"muted",size:"2",children:"STDIO servers do not expose OAuth scopes."}),K&&a.jsx(fe,{title:"Authorizations",className:"tool-detail-page__section",children:R.length===0?a.jsx(ge,{children:a.jsx(_,{tone:"muted",size:"2",children:"No active authorizations"})}):[...R].sort((je,Ee)=>new Date(Ee.updatedAt).getTime()-new Date(je.updatedAt).getTime()).map(je=>{const Ee=H0(je.status),ft=Nt(je.updatedAt);return a.jsxs(ge,{children:[a.jsx(_,{weight:"medium",size:"3",children:je.mcpAuthorizationFlow.clientName||"Unknown Client"}),je.actor&&a.jsxs(_,{size:"2",tone:"muted",children:["@",je.actor.slug," updated ",ft]}),a.jsx("div",{style:{marginTop:"4px"},children:a.jsx(Ds,{color:Ee.color,children:Ee.label})})]},je.id)})}),a.jsx(Ml,{className:"tool-detail-page__actions",onDelete:async()=>{await m(v.id)?n("/tools"):x("Failed to delete tool")}}),a.jsx(fe,{className:"tool-detail-page__actions",children:a.jsx(oe,{size:"lg",variant:"secondary",onClick:()=>n("/tools"),children:"Back to Tools"})}),a.jsx("div",{className:`tool-detail-page__toast ${P?"tool-detail-page__toast--visible":""}`,children:"Copied!"}),J&&v&&a.jsx(M0,{initialValue:v.name,onCancel:()=>X(!1),onSave:ze}),te&&v&&a.jsx(B0,{initialValue:v.description,onCancel:()=>ue(!1),onSave:mt}),B&&v&&K&&v.url&&a.jsx(I0,{initialValue:v.url,onCancel:()=>re(!1),onSave:fn}),he&&v&&ce&&a.jsx(U0,{initialCmd:v.cmd||"",initialArgs:v.args||[],onCancel:()=>ke(!1),onSave:pn}),Te&&v&&K&&a.jsx($0,{toolId:v.id,initialScopes:w,onCancel:()=>D(!1),onSave:Kn})]})}function P0(){const{toolId:s}=Wt(),n=Re(),{tools:r,setSectionTitle:o,loadToolDetails:c,loadToolClients:d}=ni(),f=r.find(T=>T.id===s),[y,g]=p.useState(f||null),[m,x]=p.useState([]),[S,v]=p.useState(!0);return p.useEffect(()=>{!f&&s?c(s).then(g):f&&g(f)},[s,f,c]),p.useEffect(()=>{s&&(v(!0),d(s).then(T=>{const w=[...T].sort((k,C)=>new Date(C.updatedAt).getTime()-new Date(k.updatedAt).getTime());x(w),v(!1)}))},[s,d]),p.useEffect(()=>{o(y?`${y.name} Clients`:"Clients")},[y,o]),S?a.jsx(fe,{children:a.jsx(ge,{leading:a.jsx(Ue,{name:"...",size:"lg"}),children:a.jsx(_,{tone:"muted",children:"Loading clients..."})})}):m.length===0?a.jsxs("div",{className:"clients-page",children:[a.jsx(fe,{children:a.jsx(ge,{leading:a.jsx(Ue,{name:"?",size:"lg"}),children:a.jsx(_,{tone:"muted",children:"No clients found for this tool"})})}),a.jsx(fe,{className:"clients-page__actions",children:a.jsx(oe,{size:"lg",variant:"secondary",onClick:()=>n(`/tools/tool/${s}`),children:"Back to Tool"})})]}):a.jsxs("div",{className:"clients-page",children:[a.jsx(fe,{children:m.map(T=>a.jsx(V0,{client:T,onClick:()=>n(`/tools/tool/${s}/clients/${T.id}`)},T.id))}),a.jsx(fe,{className:"clients-page__actions",children:a.jsx(oe,{size:"lg",variant:"secondary",onClick:()=>n(`/tools/tool/${s}`),children:"Back to Tool"})})]})}function V0({client:s,onClick:n}){const r=Y0(s);return a.jsxs(ge,{leading:a.jsx(Ue,{name:s.friendlyName,size:"lg"}),topRight:Nt(s.updatedAt),tags:r,onClick:n,children:[a.jsx(_,{className:"pre",style:"mono",tone:"muted",children:s.clientId}),a.jsx(_,{weight:"bold",size:"3",tone:"default",children:s.friendlyName}),a.jsx("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.jsx(_,{tone:"muted",size:"2",children:s.authorizeUrl})})]})}function Y0(s){const n=[];return s.authorizeUrl&&s.tokenUrl?n.push({label:"OAuth Ready",color:"green"}):n.push({label:"Incomplete",color:"orange"}),s.clientSecret&&n.push({label:"Secret Set",color:"blue"}),n}function F0(){const{toolId:s,clientId:n}=Wt(),r=Re(),{tools:o,setSectionTitle:c,loadToolDetails:d,loadClientDetails:f}=ni(),y=o.find(k=>k.id===s),[g,m]=p.useState(y||null),[x,S]=p.useState(null),[v,T]=p.useState(!0);if(p.useEffect(()=>{!y&&s?d(s).then(m):y&&m(y)},[s,y,d]),p.useEffect(()=>{n&&(T(!0),f(n).then(k=>{S(k),T(!1)}))},[n,f]),p.useEffect(()=>{if(!x){c("Client");return}c(x.friendlyName)},[x,c]),v)return a.jsx("div",{className:"client-detail-page",children:a.jsx(W,{spacing:"4",align:"center",children:a.jsx(_,{size:"3",tone:"muted",children:"Loading client..."})})});if(!x)return a.jsx("div",{className:"client-detail-page",children:a.jsxs(W,{spacing:"4",align:"center",children:[a.jsx(_,{size:"3",tone:"muted",children:"Client not found"}),a.jsx(oe,{variant:"secondary",onClick:()=>r(`/tools/tool/${s}/clients`),children:"Back to clients"})]})});const w=Q0(x);return a.jsxs("div",{className:"client-detail-page",children:[a.jsx(fe,{className:"client-detail-page__section",children:a.jsxs(ge,{leading:a.jsx(Ue,{size:"sm",name:x.friendlyName}),tags:w,topRight:a.jsx(_,{size:"1",tone:"muted",children:Nt(x.updatedAt)}),children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:x.friendlyName}),a.jsx(_,{as:"span",tone:"muted",style:"mono",children:` #${x.id.slice(0,6)}`})]})}),a.jsx(fe,{className:"client-detail-page__section",children:a.jsxs(ge,{children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:"Client ID"}),a.jsx(_,{size:"2",style:"mono",className:"client-detail-page__value",children:x.clientId})]})}),a.jsx(fe,{className:"client-detail-page__section",children:a.jsxs(ge,{children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:"Connection ID"}),a.jsx(_,{size:"2",style:"mono",className:"client-detail-page__value",children:x.id})]})}),a.jsx(fe,{className:"client-detail-page__section",children:a.jsxs(ge,{children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:"Server ID"}),a.jsx(_,{size:"2",style:"mono",className:"client-detail-page__value",children:x.serverId})]})}),a.jsx(fe,{className:"client-detail-page__section",children:a.jsxs(ge,{children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:"Authorization URL"}),a.jsx(_,{size:"2",style:"mono",className:"client-detail-page__value",children:x.authorizeUrl})]})}),a.jsx(fe,{className:"client-detail-page__section",children:a.jsxs(ge,{children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:"Token URL"}),a.jsx(_,{size:"2",style:"mono",className:"client-detail-page__value",children:x.tokenUrl})]})}),a.jsx(fe,{className:"client-detail-page__section",children:a.jsxs(ge,{children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:"Client Secret"}),a.jsx(_,{size:"2",tone:"muted",children:x.clientSecret?"Configured (hidden)":"Not configured"})]})}),a.jsx(fe,{className:"client-detail-page__section",children:a.jsxs(ge,{children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:"Registration Date"}),a.jsx(_,{size:"2",tone:"muted",children:new Date(x.createdAt).toLocaleString()})]})}),a.jsx(fe,{className:"client-detail-page__section",children:a.jsxs(ge,{children:[a.jsx(_,{as:"span",weight:"medium",size:"3",children:"Last Updated"}),a.jsx(_,{size:"2",tone:"muted",children:new Date(x.updatedAt).toLocaleString()})]})}),a.jsxs(fe,{className:"client-detail-page__actions",children:[a.jsx(oe,{size:"lg",variant:"secondary",onClick:()=>r(`/tools/tool/${s}/clients`),children:"Back to Clients"}),a.jsx(oe,{size:"lg",variant:"secondary",onClick:()=>r(`/tools/tool/${s}`),children:"Back to Tool"})]})]})}function Q0(s){const n=[];return s.authorizeUrl&&s.tokenUrl?n.push({label:"OAuth Ready",color:"green"}):n.push({label:"Incomplete",color:"orange"}),s.clientSecret&&n.push({label:"Secret Set",color:"blue"}),n}function K0(){return a.jsx(z0,{children:a.jsx(is,{children:a.jsxs(xe,{element:a.jsx(q0,{}),children:[a.jsx(xe,{index:!0,element:a.jsx(O0,{})}),a.jsx(xe,{path:"/tool/:toolId",element:a.jsx(G0,{})}),a.jsx(xe,{path:"/tool/:toolId/clients",element:a.jsx(P0,{})}),a.jsx(xe,{path:"/tool/:toolId/clients/:clientId",element:a.jsx(F0,{})})]})})})}const X0=window.location.origin,Z0=new Fn({baseUrl:X0,credentials:"include"}),J0=Z0.authorizationServer,W0=()=>{console.log("useConsent mounting");const[s,n]=p.useState(null),[r,o]=p.useState(null),[c,d]=p.useState(!0),[f,y]=p.useState(null),[g,m]=p.useState(!1);return p.useEffect(()=>{console.log("useConsent setting message"),n("Message coming from useConsent")},[]),{message:s,setMessage:n,loadConsentMetadata:async v=>{if(v){d(!0),y(null);try{const T=await J0.AuthorizationController_getConsentMetadata({flowId:v});o(T)}catch(T){y(T instanceof Error?T.message:"Failed to load authorization details")}finally{d(!1)}}},consentMetadata:r,submitConsent:async(v,T,w)=>{m(!0),y(null);try{const k={flow_id:v,approved:w},C=Ba||window.location.origin,j=document.createElement("form");j.method="POST",j.action=`${C}/api/v1/auth/authorize/mcp/${T}/0.0.0`,Object.entries(k).forEach(([R,L])=>{const N=document.createElement("input");N.type="hidden",N.name=R,N.value=String(L),j.appendChild(N)}),document.body.appendChild(j),j.submit()}catch(k){y(k instanceof Error?k.message:"Failed to submit consent decision"),m(!1)}},error:f,isApproving:g,isLoading:c}},kv=p.createContext(null);function eN({children:s}){const{message:n,error:r,isLoading:o,isApproving:c,loadConsentMetadata:d,consentMetadata:f,submitConsent:y}=W0(),[g,m]=p.useState(""),x=p.useMemo(()=>({message:n,sectionTitle:g,setSectionTitle:m,loadConsentMetadata:d,consentMetadata:f,submitConsent:y,error:r,isLoading:o,isApproving:c}),[n,g,m,d,f,y,r,o,c]);return a.jsx(kv.Provider,{value:x,children:s})}function Ev(){const s=p.useContext(kv);if(!s)throw new Error("useConsentCtx must be used within <ConsentProvider>");return s}function tN(){const s=jt();console.log("Consent page mounting");const{setSectionTitle:n,loadConsentMetadata:r,submitConsent:o,consentMetadata:c,isLoading:d,isApproving:f,error:y}=Ev(),[g]=ih(),m=g.get("flow");if(!m)return a.jsx("div",{children:"whoops! missing flow id 👀"});p.useEffect(()=>{r(m)},[m]),p.useEffect(()=>{console.log("Consent page useEffect hook triggered"),console.log("setting section title"),n("🔐 Authorization request")},[]),p.useMemo(()=>!d&&!y&&c,[d,y,c]);const x=()=>{c&&o(m,k.providedId,!0)},S=()=>{c&&o(m,k.providedId,!1)};if(d)return a.jsxs("div",{children:[a.jsx("div",{className:"spinner"}),a.jsx("p",{children:"Loading authorization details..."})]});if(y||!c)return a.jsxs("div",{children:[a.jsx("h2",{children:"Authorization Error"}),a.jsx(Rn,{children:y||"Invalid authorization request"})]});const{client:v,scopes:T,redirectUri:w,server:k,resource:C,createdAt:j}=c;return a.jsxs("div",{className:"consent-page",children:[a.jsxs("div",{className:"consent-container",children:[s?a.jsxs("div",{className:"consent-header",children:[a.jsx("div",{className:"oauth-icon",children:"🔐"}),a.jsx("h1",{children:"Authorization Request"}),a.jsx("p",{className:"subtitle",children:"Review the following authorization request carefully"})]}):null,a.jsxs("div",{className:"consent-details",children:[a.jsxs($e,{className:"detail-section",children:[a.jsx("h2",{children:"WHO is requesting access"}),a.jsxs("div",{className:"client-info",children:[a.jsxs("div",{className:"info-row",children:[a.jsx("span",{className:"label",children:"Client Name:"}),a.jsx("span",{className:"value",children:v.clientName})]}),a.jsxs("div",{className:"info-row",children:[a.jsx("span",{className:"label",children:"Client ID:"}),a.jsx("span",{className:"value",children:a.jsx("code",{children:v.clientId})})]}),a.jsxs("div",{className:"info-row",children:[a.jsx("span",{className:"label",children:"Registered:"}),a.jsx("span",{className:"value",children:a.jsx("code",{children:new Date(j).toLocaleString()})})]})]})]}),a.jsxs($e,{className:"detail-section",children:[a.jsx("h2",{children:"WHAT access is requested"}),T&&T.length>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"scopes-list",children:T.map(R=>a.jsx(nN,{children:R},R))}),a.jsx("p",{style:{marginTop:"12px",fontSize:"13px",color:"#7f8c8d",marginBottom:0},children:"These permissions determine what the client can do on your behalf."})]}):a.jsx("p",{style:{fontSize:"13px",color:"#7f8c8d",marginBottom:0},children:"No specific permissions requested."})]}),a.jsxs($e,{className:"detail-section",children:[a.jsx("h2",{children:"WHERE access is granted"}),a.jsxs("div",{className:"server-info",children:[a.jsx("div",{className:"server-name",children:k.name}),a.jsxs("div",{className:"server-id",children:["Server ID: ",k.providedId]})]}),a.jsxs("div",{className:"resource-info",style:{marginTop:"16px"},children:[a.jsx("div",{style:{fontSize:"13px",color:"#7f8c8d",marginBottom:"8px"},children:"Resource:"}),a.jsx("code",{children:C})]})]}),a.jsxs($e,{className:"detail-section",children:[a.jsx("h2",{children:"Redirect Information"}),a.jsx("div",{className:"client-info",children:a.jsxs("div",{className:"info-row",children:[a.jsx("span",{className:"label",children:"Redirect URI:"}),a.jsx("span",{className:"value",children:a.jsx("code",{children:w})})]})}),a.jsx("p",{style:{marginTop:"12px",fontSize:"13px",color:"#7f8c8d",marginBottom:0},children:"After authorization, you will be redirected to this URL."})]})]})]}),y&&a.jsx(Rn,{children:y}),a.jsxs("div",{className:"consent-actions",children:[a.jsx(oe,{variant:"danger",onClick:S,disabled:f,children:"Deny"}),a.jsx(oe,{variant:"primary",onClick:x,disabled:f,children:f?"Approving...":"Approve"})]}),a.jsxs("div",{className:"consent-footer",children:[a.jsxs("p",{children:["By approving, you authorize ",a.jsx("strong",{children:c.client.clientName})," to access the specified resources with the requested permissions."]}),a.jsx(Ls,{to:"/",children:"Home"})]})]})}function nN({children:s}){return a.jsx("span",{className:"scope-badge",children:s})}function sN(){const s=jt(),{sectionTitle:n}=Ev();return a.jsx(a.Fragment,{children:s?a.jsx(Ua,{sectionTitle:n,children:a.jsx(Ot,{})}):a.jsx($a,{appTitle:"Consent",sectionTitle:n,navItems:[],children:a.jsx(Ot,{})})})}function aN(){return a.jsx(eN,{children:a.jsx(is,{children:a.jsx(xe,{element:a.jsx(sN,{}),children:a.jsx(xe,{path:"/",element:a.jsx(tN,{})})})})})}const lN=5e3,rN=ha("/tasks"),iN=()=>{const[s,n]=p.useState(!0),[r,o]=p.useState(!1),[c,d]=p.useState(null),[f,y]=p.useState(!1),[g,m]=p.useState([]),[x,S]=p.useState([]),[v,T]=p.useState([]),[w,k]=p.useState(null),C=p.useRef(!1),j=p.useCallback(async R=>{if(C.current)return;C.current=!0;const L=!r,N=R?.silent??!1;L?n(!0):N||y(!0);try{const[M,A,z]=await Promise.all([La.TaskExecutionQueueController_listQueue(),La.ActiveTaskExecutionController_listActiveExecutions(),La.TaskExecutionHistoryController_listHistory()]);m(M),S(A.sort((I,H)=>H.claimedAt.localeCompare(I.claimedAt))),T(z.sort((I,H)=>H.transitionedAt.localeCompare(I.transitionedAt))),k(new Date().toISOString()),d(null)}catch(M){d(M instanceof Error?M.message:"Failed to load executions")}finally{C.current=!1,o(!0),n(!1),y(!1)}},[r]);return p.useEffect(()=>{j();const R=window.setInterval(()=>{j({silent:!0})},lN);return()=>window.clearInterval(R)},[j]),p.useEffect(()=>{const R=Nn(rN,{transports:["websocket","polling"],withCredentials:!0});return R.on("connect",()=>{R.emit("tasks.subscribe",{},()=>{})}),R.on(un.TASK_ACTIVITY,L=>{L.kind.startsWith("execution.")&&j({silent:!0})}),()=>{R.close()}},[j]),{isLoading:s,isRefreshing:f,hasLoadedOnce:r,error:c,queue:g,active:x,history:v,loadExecutions:j,lastUpdatedAt:w}};function oN(){const s=Re(),{actors:n}=mh(),{showToast:r,showError:o}=hn(),{queue:c,active:d,history:f,isLoading:y,isRefreshing:g,hasLoadedOnce:m,error:x,loadExecutions:S}=iN();wt();const v=p.useMemo(()=>f.filter(N=>N.status==="SUCCEEDED").length,[f]),T=f.length-v,[w,k]=p.useState(()=>new Set),[C,j]=p.useState(()=>new Set),R=N=>{k(M=>{const A=new Set(M);return A.has(N)?A.delete(N):A.add(N),A})},L=async(N,M)=>{if(confirm(`Are you sure you want to interrupt the execution for "${M??"Untitled task"}"?`)){j(A=>new Set(A).add(N));try{await La.ActiveTaskExecutionController_interruptExecution({executionId:N}),r(`Interrupt signal sent for "${M??"Untitled task"}"`),await S()}catch(A){o(A)}finally{j(A=>{const z=new Set(A);return z.delete(N),z})}}};return a.jsxs("div",{className:"executions-page",children:[a.jsxs("div",{className:"executions-hero",children:[a.jsxs("div",{className:"executions-hero__copy",children:[a.jsx(_,{as:"div",size:"6",weight:"bold",children:"Runs"}),a.jsx(_,{as:"div",size:"3",tone:"muted",wrap:!0,children:"Queue, active work, and recent history in one place. The view refreshes automatically every 5 seconds."})]}),a.jsxs("div",{className:"executions-hero__actions",children:[a.jsx("span",{className:`executions-pill ${x?"executions-pill--danger":"executions-pill--success"}`,children:x?"Fetch failed":g?"Refreshing":"Polling"}),a.jsx(oe,{variant:"secondary",onClick:()=>void S(),disabled:g,children:"Refresh now"})]})]}),a.jsxs("div",{className:"executions-summary-grid",children:[a.jsx(Eo,{label:"Queued",value:c.length,tone:"accent"}),a.jsx(Eo,{label:"Active",value:d.length,tone:"warning"}),a.jsx(Eo,{label:"Succeeded",value:v,tone:"success"}),a.jsx(Eo,{label:"Failed",value:T,tone:"danger"})]}),y&&!m?a.jsx($e,{className:"executions-empty-card",children:a.jsx(_,{as:"div",size:"3",weight:"medium",children:"Loading executions…"})}):null,x?a.jsxs($e,{className:"executions-empty-card",children:[a.jsx(_,{as:"div",size:"3",weight:"medium",children:"Could not load executions"}),a.jsx(_,{as:"div",tone:"muted",wrap:!0,children:x})]}):null,m&&!x?a.jsxs("div",{className:"executions-sections",children:[a.jsx(Ad,{title:"Queue",subtitle:"",count:c.length,emptyMessage:"Nothing is waiting in the queue.",table:a.jsx(Rd,{columns:["State","Task","Task status","Task ID"],rows:c.map(N=>({key:N.taskId,cells:[a.jsx(ua,{tone:"accent",children:"Queued"},"state"),a.jsx(zd,{taskId:N.taskId,taskName:N.taskName,onClick:()=>s(`/tasks/task/${N.taskId}`)},"task"),a.jsx(ua,{tone:qd(N.taskStatus),children:N.taskStatus??"Unknown"},"status"),a.jsx(Dd,{value:N.taskId},"id")],mobile:a.jsx(Ld,{tone:"accent",title:N.taskName??"Untitled task",badge:"Queued",lines:[{label:"Task status",value:N.taskStatus??"Unknown"},{label:"Task ID",value:Pn(N.taskId),mono:!0}],onClick:()=>s(`/tasks/task/${N.taskId}`)},`queue-mobile-${N.taskId}`)}))})}),a.jsx(Ad,{title:"Active",subtitle:"",count:d.length,emptyMessage:"No active executions right now.",table:a.jsx(Rd,{columns:["State","Task","Worker","Agent","Session","Tools","Claimed","Latest heartbeat","Before claim","Actions"],rows:d.map(N=>{const M=n.find(z=>z.id===N.agentActorId),A=C.has(N.id);return{key:N.id,cells:[a.jsx(ua,{tone:"warning",children:"Active"},"state"),a.jsx(zd,{taskId:N.taskId,taskName:N.taskName,onClick:()=>s(`/tasks/task/${N.taskId}`)},"task"),a.jsx(Dd,{value:N.workerClientId},"worker"),a.jsx(Jy,{actorId:N.agentActorId,actorName:M?.displayName,actorSlug:M?.slug},"agent"),a.jsx(Wy,{value:N.runnerSessionId},"session"),a.jsx(ex,{value:N.toolCallCount},"tool-count"),a.jsx(Od,{value:N.claimedAt},"claimed"),a.jsx(Od,{value:N.lastHeartbeatAt},"heartbeat"),a.jsx(ua,{tone:qd(N.taskStatusBeforeClaim),children:N.taskStatusBeforeClaim},"before"),a.jsx(oe,{variant:"danger",size:"sm",disabled:A,onClick:()=>void L(N.id,N.taskName),children:A?"Interrupting…":"Interrupt"},"interrupt")],mobile:a.jsx(Ld,{tone:"warning",title:N.taskName??"Untitled task",badge:"Active",lines:[{label:"Claimed",value:Oo(N.claimedAt)},{label:"Latest heartbeat",value:Oo(N.lastHeartbeatAt)},{label:"Worker",value:Pn(N.workerClientId),mono:!0},{label:"Agent",value:M?.slug?`@${M.slug}`:Pn(N.agentActorId),mono:!0},{label:"Session",value:Zd(N.runnerSessionId),mono:!0},{label:"Tool calls",value:String(N.toolCallCount)},{label:"Before claim",value:N.taskStatusBeforeClaim}],actionButton:a.jsx(oe,{variant:"danger",size:"sm",disabled:A,onClick:()=>void L(N.id,N.taskName),children:A?"Interrupting…":"Interrupt"}),onClick:()=>s(`/tasks/task/${N.taskId}`)},`active-mobile-${N.id}`)}})})}),a.jsx(Ad,{title:"History",subtitle:"",count:f.length,emptyMessage:"No historical executions yet.",table:a.jsx(Rd,{columns:["Result","Task","Transitioned","Task status","Agent","Worker","Session","Tools","Error"],rows:f.map(N=>{const M=n.find(A=>A.id===N.agentActorId);return{key:N.id,expandedContent:N.errorMessage&&w.has(N.id)?a.jsx(uN,{status:N.status,message:N.errorMessage}):null,cells:[a.jsx(ua,{tone:N.status==="SUCCEEDED"?"success":"danger",children:N.status},"result"),a.jsx(zd,{taskId:N.taskId,taskName:N.taskName,onClick:()=>s(`/tasks/task/${N.taskId}`)},"task"),a.jsx(Od,{value:N.transitionedAt},"transitioned"),a.jsx(ua,{tone:qd(N.taskStatus),children:N.taskStatus??"Unknown"},"task-status"),a.jsx(Jy,{actorId:N.agentActorId,actorName:M?.displayName,actorSlug:M?.slug},"agent"),a.jsx(Dd,{value:N.workerClientId},"worker"),a.jsx(Wy,{value:N.runnerSessionId},"session"),a.jsx(ex,{value:N.toolCallCount},"tool-count"),a.jsx(cN,{errorCode:N.errorCode,errorMessage:N.errorMessage,expanded:w.has(N.id),onToggle:()=>R(N.id)},"error")],mobile:a.jsx(Ld,{tone:N.status==="SUCCEEDED"?"success":"danger",title:N.taskName??"Untitled task",badge:N.status,lines:[{label:"Transitioned",value:Oo(N.transitionedAt)},{label:"Task status",value:N.taskStatus??"Unknown"},{label:"Agent",value:M?.slug?`@${M.slug}`:Pn(N.agentActorId),mono:!0},{label:"Worker",value:Pn(N.workerClientId),mono:!0},{label:"Session",value:Zd(N.runnerSessionId),mono:!0},{label:"Tool calls",value:String(N.toolCallCount)},{label:"Error",value:N.errorCode??"None"},...N.errorMessage?[{label:"Message",value:N.errorMessage}]:[]],onClick:()=>s(`/tasks/task/${N.taskId}`)},`history-mobile-${N.id}`)}})})})]}):null]})}function Eo({label:s,value:n,tone:r}){return a.jsxs($e,{className:`executions-summary-card executions-summary-card--${r}`,children:[a.jsx(_,{as:"div",size:"2",tone:"muted",weight:"medium",children:s}),a.jsx(_,{as:"div",size:"6",weight:"bold",children:n})]})}function Ad({title:s,subtitle:n,count:r,emptyMessage:o,table:c}){return a.jsxs($e,{padding:"0",className:"executions-section-card",children:[a.jsxs("div",{className:"executions-section-card__header",children:[a.jsxs("div",{children:[a.jsx(_,{as:"div",size:"4",weight:"bold",children:s}),a.jsx(_,{as:"div",size:"2",tone:"muted",children:n})]}),a.jsx("span",{className:"executions-count-pill",children:r})]}),r===0?a.jsx("div",{className:"executions-section-card__empty",children:a.jsx(_,{as:"div",tone:"muted",children:o})}):c]})}function Rd({columns:s,rows:n}){return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"executions-table-wrap",children:a.jsxs("table",{className:"executions-table",children:[a.jsx("thead",{children:a.jsx("tr",{children:s.map(r=>a.jsx("th",{children:r},r))})}),a.jsx("tbody",{children:n.map(r=>a.jsxs(p.Fragment,{children:[a.jsx("tr",{children:r.cells.map((o,c)=>a.jsx("td",{children:o},`${r.key}-${c}`))}),r.expandedContent?a.jsx("tr",{className:"executions-table-detail-row",children:a.jsx("td",{colSpan:s.length,children:r.expandedContent})}):null]},r.key))})]})}),a.jsx("div",{className:"executions-mobile-list",children:n.map(r=>r.mobile)})]})}function ua({children:s,tone:n}){return a.jsx("span",{className:`executions-status-pill executions-status-pill--${n}`,children:s})}function zd({taskId:s,taskName:n,onClick:r}){return r?a.jsxs("button",{type:"button",className:"executions-task-cell executions-task-cell--clickable",onClick:r,"aria-label":`Navigate to task: ${n??"Untitled task"}`,children:[a.jsx(_,{as:"div",size:"2",weight:"semibold",children:n??"Untitled task"}),a.jsx(_,{as:"div",size:"1",tone:"muted",style:"mono",children:Pn(s)})]}):a.jsxs("div",{className:"executions-task-cell",children:[a.jsx(_,{as:"div",size:"2",weight:"semibold",children:n??"Untitled task"}),a.jsx(_,{as:"div",size:"1",tone:"muted",style:"mono",children:Pn(s)})]})}function Dd({value:s}){return a.jsx(_,{as:"span",size:"1",style:"mono",className:"executions-code-copy",children:Pn(s)})}function Jy({actorId:s,actorName:n,actorSlug:r}){return a.jsxs("div",{className:"executions-actor-cell",children:[a.jsx(_,{as:"div",size:"2",weight:"semibold",children:n??Pn(s)}),a.jsx(_,{as:"div",size:"1",tone:"muted",style:"mono",className:"executions-actor-slug",children:r?`@${r}`:Pn(s)})]})}function cN({errorCode:s,errorMessage:n,expanded:r,onToggle:o}){const c=!!n;return a.jsxs("div",{className:"executions-error-cell",children:[a.jsx("span",{className:s?"executions-error-copy":"executions-muted-copy",children:s??"None"}),c?a.jsx("button",{type:"button",className:"executions-error-toggle",onClick:o,"aria-expanded":r,"aria-label":r?"Hide error message":"Show error message",title:r?"Hide error message":"Show error message",children:"!"}):null]})}function uN({status:s,message:n}){return a.jsxs("div",{className:"executions-error-detail",children:[a.jsx(_,{as:"div",size:"1",weight:"medium",tone:s==="CANCELLED"?"muted":"default",className:s==="CANCELLED"?void 0:"executions-error-detail__label",children:s==="CANCELLED"?"Cancellation message":"Failure message"}),a.jsx(_,{as:"div",size:"2",wrap:!0,children:n})]})}function Od({value:s}){return a.jsxs("div",{className:"executions-time-cell",children:[a.jsx(_,{as:"div",size:"2",children:Oo(s)}),s?a.jsx(_,{as:"div",size:"1",tone:"muted",children:dN(s)}):null]})}function Wy({value:s}){return a.jsx(_,{as:"span",size:"1",style:"mono",className:"executions-code-copy",children:Zd(s)})}function ex({value:s}){return a.jsx(_,{as:"span",size:"2",weight:"semibold",children:s})}function Ld({title:s,badge:n,tone:r,lines:o,onClick:c,actionButton:d}){if(d&&c)return a.jsxs("div",{className:"executions-mobile-card",children:[a.jsxs("button",{type:"button",className:"executions-mobile-card__header executions-mobile-card__header--clickable",onClick:c,"aria-label":`Navigate to task: ${s}`,children:[a.jsx(_,{as:"div",size:"3",weight:"semibold",wrap:!0,children:s}),a.jsx(ua,{tone:r,children:n})]}),a.jsx("div",{className:"executions-mobile-card__body",children:o.map(g=>a.jsxs("div",{className:"executions-mobile-card__row",children:[a.jsx(_,{as:"span",size:"1",tone:"muted",children:g.label}),a.jsx(_,{as:"span",size:"2",style:g.mono?"mono":"sans",className:g.label==="Error"&&g.value!=="None"?"executions-error-copy":"",children:g.value})]},`${n}-${g.label}`))}),a.jsx("div",{className:"executions-mobile-card__actions",children:d})]});const f=c?"executions-mobile-card executions-mobile-card--clickable":"executions-mobile-card",y=a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"executions-mobile-card__header",children:[a.jsx(_,{as:"div",size:"3",weight:"semibold",wrap:!0,children:s}),a.jsx(ua,{tone:r,children:n})]}),a.jsx("div",{className:"executions-mobile-card__body",children:o.map(g=>a.jsxs("div",{className:"executions-mobile-card__row",children:[a.jsx(_,{as:"span",size:"1",tone:"muted",children:g.label}),a.jsx(_,{as:"span",size:"2",style:g.mono?"mono":"sans",className:g.label==="Error"&&g.value!=="None"?"executions-error-copy":"",children:g.value})]},`${n}-${g.label}`))})]});return c?a.jsx("button",{type:"button",className:f,onClick:c,"aria-label":`Navigate to task: ${s}`,children:y}):a.jsx("div",{className:f,children:y})}function qd(s){switch(s){case"NOT_STARTED":return"accent";case"IN_PROGRESS":return"warning";case"FOR_REVIEW":return"warning";case"DONE":return"success";case null:return"neutral";default:return"neutral"}}function Oo(s){return s?new Date(s).toLocaleString():"Never"}function dN(s){const n=Date.now()-new Date(s).getTime(),r=Math.max(0,Math.floor(n/1e3));if(r<60)return`${r}s ago`;const o=Math.floor(r/60);if(o<60)return`${o}m ago`;const c=Math.floor(o/60);return c<24?`${c}h ago`:`${Math.floor(c/24)}d ago`}function Pn(s){return s.length>12?`${s.slice(0,8)}…${s.slice(-4)}`:s}function Zd(s){return s?Pn(s):"pending"}function hN(){const s=jt(),n="Runs",r=[];return a.jsx("div",{style:{minHeight:0},children:s?a.jsx(Ua,{sectionTitle:n,children:a.jsx(Ot,{})}):a.jsx($a,{appTitle:"Runs",sectionTitle:n,navItems:r,children:a.jsx(Ot,{})})})}function fN(){return a.jsx(is,{children:a.jsx(xe,{element:a.jsx(hN,{}),children:a.jsx(xe,{index:!0,element:a.jsx(oN,{})})})})}function pN({children:s}){const{user:n,refreshAuth:r}=Dn(),o=p.useRef(!1);return p.useEffect(()=>{o.current||!n||n.onboardingDisplayMode==="FULL_PAGE"&&(o.current=!0,uh.WalkthroughController_acknowledge().then(()=>r()).catch(console.error))},[n,r]),!o.current&&n?.onboardingDisplayMode==="FULL_PAGE"?a.jsx(Ma,{to:"/walkthrough",replace:!0}):a.jsx(a.Fragment,{children:s})}function gN(){return a.jsxs(is,{children:[a.jsx(xe,{path:"/logout",element:a.jsx(aE,{})}),a.jsx(xe,{index:!0,element:a.jsx(Ma,{to:"home",replace:!0})}),a.jsx(xe,{path:"/consent",element:a.jsx(aN,{})}),a.jsx(xe,{path:"/*",element:a.jsx(lk,{})}),a.jsx(xe,{path:"/tasks/*",element:a.jsx(sE,{})}),a.jsx(xe,{path:"/context/*",element:a.jsx(vC,{})}),a.jsx(xe,{path:"/agents/*",element:a.jsx(WC,{})}),a.jsx(xe,{path:"/threads/*",element:a.jsx(T0,{})}),a.jsx(xe,{path:"/tools/*",element:a.jsx(K0,{})}),a.jsx(xe,{path:"/runs/*",element:a.jsx(fN,{})}),a.jsx(xe,{path:"/executions/*",element:a.jsx(Ma,{to:"/runs",replace:!0})})]})}function mN(){return a.jsx(vT,{basename:rk,children:a.jsx(NT,{children:a.jsx(Qj,{children:a.jsx(VT,{children:a.jsxs(zk,{children:[a.jsxs(is,{children:[a.jsx(xe,{path:"/onboarding",element:a.jsx(tj,{})}),a.jsx(xe,{path:"/login",element:a.jsx(aj,{children:a.jsx(WT,{})})}),a.jsx(xe,{path:"*",element:a.jsx(nj,{children:a.jsx(Vj,{children:a.jsx(pN,{children:a.jsx(rj,{children:a.jsx(gN,{})})})})})})]}),a.jsx(Kj,{})]})})})})})}X_.createRoot(document.getElementById("root")).render(a.jsx(H_.StrictMode,{children:a.jsx(mN,{})}));
|